PDA

View Full Version : Is there a limit for coords?



farofinoaf
06-06-2012, 01:28 PM
Hi everybody,

I can see a red and green triangle with this code:


vert.setVertices(( new float[] { -14302f,-12200f, 1, 0, 0, 1,
-14300f,-12200f, 1, 0, 0, 1,
-14301f,-12202f, 1, 0, 0, 1,
-14305f,-12200f, 0, 1, 0, 1,
-14308f,-12200f, 0, 1, 0, 1,
-14306f,-12202f, 0, 1, 0, 1,}),0, 6 * 6);


gl.glViewport(0, 0, width, height);
gl.glClear(GL10.GL_COLOR_BUFFER_BIT);
gl.glMatrixMode(GL10.GL_PROJECTION);
gl.glLoadIdentity();
GLU.gluPerspective(gl, 67, width/ height, 1f, 15f);
gl.glMatrixMode(GL10.GL_MODELVIEW);
gl.glLoadIdentity();
GLU.gluLookAt(gl, -14301f, -12201f, 10f, -14301f, -12201f, 0, 0, 1, 0);

But can't see changing the first "1" for "2" in my coords.


vert.setVertices(( new float[] { -24302f,-22200f, 1, 0, 0, 1,
-24300f,-22200f, 1, 0, 0, 1,
-24301f,-22202f, 1, 0, 0, 1,
-24305f,-22200f, 0, 1, 0, 1,
-24308f,-22200f, 0, 1, 0, 1,
-24306f,-22202f, 0, 1, 0, 1,}),0, 6 * 6);


gl.glViewport(0, 0, width, height);
gl.glClear(GL10.GL_COLOR_BUFFER_BIT);
gl.glMatrixMode(GL10.GL_PROJECTION);
gl.glLoadIdentity();
GLU.gluPerspective(gl, 67, width/ height, 1f, 15f);
gl.glMatrixMode(GL10.GL_MODELVIEW);
gl.glLoadIdentity();
GLU.gluLookAt(gl, -24301f, -22201f, 10f, -24301f, -22201f, 0, 0, 1, 0);



I only change the triangles and cam position.

What's is wrong?

Thanks.

farofinoaf
06-08-2012, 11:50 AM
A few more details.
I'm coding for Android Opengl ES 1.0

And why a can see this triangle:

-14302f,-12200f,
-14300f,-12200f,
-14301f,-12202f,

with this lookat: GLU.gluLookAt(gl, -14301f, -12201f, 10f, -14301f, -12201f, 0, 0, 1, 0);

and can't see:

-24302f,-22200f,
-24300f,-22200f,
-24301f,-22202f,

with this lookat: GLU.gluLookAt(gl, -24301f, -22201f, 10f, -24301f, -22201f, 0, 0, 1, 0);

aqnuep
06-08-2012, 11:58 AM
Your limit is precision.
No matter your GPU uses floating point values or fixed point values for storing the inputs you give to OpenGL, the implementation might not be able to represent that. With fixed point values you have a range [a,b] that can be represented with certain number of bits of precision, while with floating point, the number of digits that can be represented are the primary limiting factor, which, again, is based on the number of bits used as storage.

farofinoaf
06-08-2012, 12:17 PM
OK aqnuep thanks.

But can you see a problem in my code?

I mean, i'm giving some coords and looking to these coords and can't see my triangle, why?

I expected same result with these different coords because i'm looking to the same point in these two scenes.

Thanks again.