I have a float array camObjCoorddeclared as ..
public static float camObjCoord[] = new float[8000];
Then I populate its indexes in a class that does something like the following.
public void addcube(float highx, float lowx, float highz, float lowz){
System.out.println("f = " + f);
Global.cubes++;
float y = 1.5f;
System.out.println("highx = " + highx + "lowx = " + lowx + "highz = " + highz + "lowz = " + lowz);
camObjCoord[i] = lowx;
i++;
camObjCoord[i] = -y;
i++;
camObjCoord[i] = highz;
i++;
camObjCoord[i] = highx;
i++;
camObjCoord[i] = -y;
i++;
camObjCoord[i] = highz;
i++;
camObjCoord[i] = lowx;
i++;
camObjCoord[i] = y;
i++;
camObjCoord[i] = highz;
i++;
camObjCoord[i] = highx;
i++;
camObjCoord[i] = y;
i++;
camObjCoord[i] = highz;
i++;
camObjCoord[i] = lowx;
i++;
camObjCoord[i] = -y;
i++;
camObjCoord[i] = lowz;
i++;
camObjCoord[i] = lowx;
i++;
camObjCoord[i] = y;
i++;
camObjCoord[i] = lowz;
i++;
camObjCoord[i] = highx;
i++;
camObjCoord[i] = -y;
i++;
camObjCoord[i] = lowz;
i++;
camObjCoord[i] = highx;
i++;
camObjCoord[i] = y;
i++;
camObjCoord[i] = lowz;
i++;
camObjCoord[i] = lowx;
i++;
camObjCoord[i] = -y;
i++;
camObjCoord[i] = highz;
i++;
camObjCoord[i] = lowx;
i++;
camObjCoord[i] = y;
i++;
camObjCoord[i] = highz;
i++;
camObjCoord[i] = lowx;
i++;
camObjCoord[i] = -y;
i++;
camObjCoord[i] = lowz;
i++;
camObjCoord[i] = lowx;
i++;
camObjCoord[i] = y;
i++;
camObjCoord[i] = lowz;
i++;
camObjCoord[i] = highx;
i++;
camObjCoord[i] = -y;
i++;
camObjCoord[i] = lowz;
i++;
camObjCoord[i] = highx;
i++;
camObjCoord[i] = y;
i++;
camObjCoord[i] = lowz;
i++;
camObjCoord[i] = highx;
i++;
camObjCoord[i] = -y;
i++;
camObjCoord[i] = highz;
i++;
camObjCoord[i] = highx;
i++;
camObjCoord[i] = y;
i++;
camObjCoord[i] = highz;
i++;
camObjCoord[i] = lowx;
i++;
camObjCoord[i] = y;
i++;
camObjCoord[i] = highz;
i++;
camObjCoord[i] = highx;
i++;
camObjCoord[i] = y;
i++;
camObjCoord[i] = highz;
i++;
camObjCoord[i] = lowx;
i++;
camObjCoord[i] = y;
i++;
camObjCoord[i] = highz;
i++;
camObjCoord[i] = highx;
i++;
camObjCoord[i] = y;
i++;
camObjCoord[i] = lowz;
i++;
camObjCoord[i] = lowx;
i++;
camObjCoord[i] = -y;
i++;
camObjCoord[i] = highz;
i++;
camObjCoord[i] = lowx;
i++;
camObjCoord[i] = -y;
i++;
camObjCoord[i] = lowz;
i++;
camObjCoord[i] = highx;
i++;
camObjCoord[i] = -y;
i++;
camObjCoord[i] = highz;
i++;
camObjCoord[i] = highx;
i++;
camObjCoord[i] = -y;
i++;
camObjCoord[i] = lowz;
i++;
int p = 0;
System.out.println("FULL ARRAY");
while(p < 72){
System.out.println(camObjCoord[p]);
p++;
}
}
Then i call makeview()
public void makeview() {
Intent myIntent = new Intent(this, GLCamTest.class);
Bundle b = new Bundle();
b.putFloatArray("tweets", camObjCoord);
myIntent.putExtras(b);
this.startActivity(myIntent);
}
and then in the new class that he does ...
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Bundle b = this.getIntent().getExtras();
float original[] = b.getFloatArray("tweets");
camObjCoord = original;
counter++;
}
Then I have another class class GLLayer, and it looks like this. http://pastebin.org/394884 inside this class. I draw a cube from a float array, I checked, and there really are values for the cube, and when I encode the array, it works, but when I dynamically build the array and then pass it, the cube does not attract. I call the class this way.
glView=new GLLayer(this);
mPreview = new CamLayer(this, glView);
Can anyone understand why? How can I fix my problem? Just add, I give exact values for the same indices when I dynamically draw
final static float camObjCoord[] = new float[] {
-2.0f, -1.5f, 2.0f,
2.0f, -1.5f, 2.0f,
-2.0f, 1.5f, 2.0f,
2.0f, 1.5f, 2.0f,
-2.0f, -1.5f, -2.0f,
-2.0f, 1.5f, -2.0f,
2.0f, -1.5f, -2.0f,
2.0f, 1.5f, -2.0f,
-2.0f, -1.5f, 2.0f,
-2.0f, 1.5f, 2.0f,
-2.0f, -1.5f, -2.0f,
-2.0f, 1.5f, -2.0f,
2.0f, -1.5f, -2.0f,
2.0f, 1.5f, -2.0f,
2.0f, -1.5f, 2.0f,
2.0f, 1.5f, 2.0f,
-2.0f, 1.5f, 2.0f,
2.0f, 1.5f, 2.0f,
-2.0f, 1.5f, -2.0f,
2.0f, 1.5f, -2.0f,
-2.0f, -1.5f, 2.0f,
-2.0f, -1.5f, -2.0f,
2.0f, -1.5f, 2.0f,
2.0f, -1.5f, -2.0f,
};
. , , , . ? ? , Android.
.
edit1: : , , ...
edit2: , GLLayer (, ), , . , : (
edit3: , .
edit4: . .