You're overriding the global varible in your setup with float[][] pointsArray, making it local to setup. The first line in your setup initializes the global pointsArray. You're second line creates a new local variable pointsArray, which is disposed of at the end of setup(). Your draw calls the global, which is still empty. You would think that removing float[][] in the setup should fix it, but Processing doesn't like creating a array via {} when you define the array earlier. So I guess you could do this:
- float[][] pointsArray = {
- {
- 0, 1, 2, 3
- }
- ,
- {
- 3, 2, 1, 0
- }
- ,
- {
- 3, 5, 6, 1
- }
- ,
- {
- 3, 8, 3, 4
- }
- };
- void setup()
- {
- // pointsArray= new float[4][4];
- }
- void draw()
- {
- println(pointsArray[1][1]);
- }
or
- float[][] pointsArray;
- void setup()
- {
- pointsArray= new float[4][4];
- float[][] pArray = {
- {
- 0, 1, 2, 3
- }
- ,
- {
- 3, 2, 1, 0
- }
- ,
- {
- 3, 5, 6, 1
- }
- ,
- {
- 3, 8, 3, 4
- }
- };
- pointsArray = pArray;
- }
- void draw()
- {
- println(pointsArray[1][1]);
- }