Hi Guys,
This is a follow up question from http://stackoverflow.com/questions/3238690/problem-with-array-assignment
I now have addcube done like so.. and all works as expected, when I print the array. but when I print the same index's AFTER assignment in another class It tells me their equal to 0
. So the values are not 'saving'. Why is this? How would I correct this?
public void addcube(float highx, float lowx, float highz, float lowz){
//Constructing new cube...
System.out.println("f = " + f);
Global.cubes++;
float y = 1.5f;
System.out.println("highx = " + highx + "lowx = " + lowx + "highz = " + highz + "lowz = " + lowz);
//FRONT
Global.camObjCoord[Global.i] = highx;
Global.i++;
System.out.println("cube i = " + Global.i);
}
In both cases I'm printing like so...
int p = 0;
while(p < 72){
System.out.println(Global.camObjCoord[p]);
p++;
}
Global.i = 0
at the beginning.
The only other places the array is being referenced is the following..
cubeBuff = makeFloatBuffer(Global.camObjCoord);
FloatBuffer makeFloatBuffer(float[] arr) {
ByteBuffer bb = ByteBuffer.allocateDirect(arr.length*4);
bb.order(ByteOrder.nativeOrder());
FloatBuffer fb = bb.asFloatBuffer();
fb.put(arr);
fb.position(0);
return fb;
}
There is no further refrences to the array in my code.
Thanks.