Android Emulator vs phone opengl inconsistensies -


i'm having problem application looks right on emulator, on phone displays fragment of scene.

images here (the emulator 1 on right.

my renderer code seen here. (this class abstract implementing class doing draw polygons)

public abstract class abstractrenderer implements renderer { float x = 0.5f; float y = 1f; float z = 3;  boolean displaycoordinatesystem = true;  public void onsurfacecreated(gl10 gl, eglconfig eglconfig) {     gl.gldisable(gl10.gl_dither);     gl.glhint(gl10.gl_perspective_correction_hint, gl10.gl_fastest);     gl.glclearcolor(.5f, .5f, .5f, 1);     gl.glshademodel(gl10.gl_smooth);     gl.glenable(gl10.gl_depth_test); }  public void onsurfacechanged(gl10 gl, int w, int h) {     gl.glviewport(0, 0, w, h);     float ratio = (float) w / h;     gl.glmatrixmode(gl10.gl_projection);     gl.glloadidentity();     gl.glfrustumf(-ratio, ratio, -1, 1, 0, 10); }  public void ondrawframe(gl10 gl) {     gl.gldisable(gl10.gl_dither);     gl.glclear(gl10.gl_color_buffer_bit | gl10.gl_depth_buffer_bit);     gl.glmatrixmode(gl10.gl_modelview);     gl.glloadidentity();     glu.glulookat(gl, x, y, z, 0f, 0, 0f, 0f, 1f, 0f);     gl.glenableclientstate(gl10.gl_vertex_array);      if(displaycoordinatesystem) {         drawcoordinatesystem(gl);     }      draw(gl);  //      gl.glflush(); }  private void drawcoordinatesystem(gl10 gl) {     bytebuffer vbb = bytebuffer.allocatedirect(6*3*4);     vbb.order(byteorder.nativeorder());     floatbuffer vertices = vbb.asfloatbuffer();      bytebuffer ibb = bytebuffer.allocatedirect(6*2);     ibb.order(byteorder.nativeorder());     shortbuffer indexes = ibb.asshortbuffer();      final float coordlength = 27f;      //add point (-1, 0, 0)     vertices.put(-coordlength);     vertices.put(0);     vertices.put(0);      //add point (1, 0, 0)     vertices.put(coordlength);     vertices.put(0);     vertices.put(0);      //add point (0, -1, 0)     vertices.put(0);     vertices.put(-coordlength);     vertices.put(0);      //add point (0, 1, 0)     vertices.put(0);     vertices.put(coordlength);     vertices.put(0);      //add point (0, 0, -1)     vertices.put(0);     vertices.put(0);     vertices.put(-coordlength);      //add point (0, 0, 1)     vertices.put(0);     vertices.put(0);     vertices.put(coordlength);      for(int = 0; < 6; i++) {         indexes.put((short)i);     }      vertices.position(0);     indexes.position(0);      gl.glcolor4f(1, 1, 0, 0.5f);     gl.glvertexpointer(3, gl10.gl_float, 0, vertices);     gl.gldrawelements(gl10.gl_lines, 2, gl10.gl_unsigned_short, indexes);      indexes.position(2);     gl.glcolor4f(0, 1, 0, 0.5f);     gl.gldrawelements(gl10.gl_lines, 2, gl10.gl_unsigned_short, indexes);      indexes.position(4);     gl.glcolor4f(0, 0, 1, 0.5f);     gl.gldrawelements(gl10.gl_lines, 2, gl10.gl_unsigned_short, indexes); }  protected abstract void draw(gl10 gl); } 

my guess i'm not setting value set default emulator implementation. thing have no clue thing might be.

hoping hear dudes , dudettes!

it's depth buffer problem: "notes" section in man page of glfrustum:

near must never set 0.

you should calculate near value far camera possible, , far close possible, while still encompassing things want draw.


Comments

Popular posts from this blog

javascript - Enclosure Memory Copies -

php - Replacing tags in braces, even nested tags, with regex -