Saturday, February 18, 2012

[android-developers] OpenGL: Big values of verticies coordinates on Android emulator

Hello!

Sometimes I'm need to draw my objects with pretty hight coordinates
(more than 200000). But when I trying to render even objects with
coordinates about 10000, there's nothing on my emulator. But on my
Samsung Galaxy S2 there's all ok!
I tried to change coordinates and found highest coodinates - there's
about 7000. If we use bigger values, we willn't see any objects.
There's parts of my code:
Initialization:
ByteBuffer vbb = ByteBuffer.allocateDirect(VERTS * 3 * 4);
vbb.order(ByteOrder.nativeOrder());
mFVertexBuffer = vbb.asFloatBuffer();

float[] coords = {
6985.5f, 6985.5f, 0,
6984.5f, 6985.5f, 0,
6985.0f, 6984.5f, 0,
6985.5f, 6985.5f,0,
6984.5f, 6985.5f, 0,
6985.0f, 6984.5f, 0
}; //there's all ok with such coords. With >7000 triangle doesn't
rendered.

for (int i = 0; i < VERTS; i++) {
for (int j = 0; j < 3; j++) {
mFVertexBuffer.put(coords[i * 3 + j]);
}
}

mFVertexBuffer.rewind();

Render loop:
gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT);
gl.glMatrixMode(GL10.GL_MODELVIEW);
gl.glLoadIdentity();

GLU.gluLookAt(gl, 6985, 6985, 4, 6985, 6985, 0, 0f, 1f, 0f);

gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);
gl.glColor4f(1.0f, 0.0f, 0.0f, 0.0f);

gl.glVertexPointer(3, GL10.GL_FLOAT, 0, mFVertexBuffer); //
gl11.glBindBuffer(GL11.GL_ELEMENT_ARRAY_BUFFER, 0);
gl.glDrawArrays(GL10.GL_TRIANGLES, 0,
mFVertexBuffer.capacity() / 3);

gl.glDisableClientState(GL10.GL_VERTEX_ARRAY);


Is there emulator bug or there's my mistake somewhere?
How I can solve this problem? I really need it - lots of chinense
devices has pretty same bugs as emulator :(

Thanks!

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment