OpenGL depth buffer on Android -
i'm learning opengl es programming on android (2.1). started obligatory rotating cube. it's rotating fine can't depth buffer work. polygons displayed in order gl commands render them. during initialization of gl:
gl.glclearcolor(.5f, .5f, .5f, 1); gl.glshademodel(gl10.gl_smooth); gl.glcleardepthf(1f); gl.glenable(gl10.gl_depth_test); gl.gldepthfunc(gl10.gl_lequal); gl.glhint(gl10.gl_perspective_correction_hint, gl10.gl_nicest);
on surface-change this:
gl.glviewport(0, 0, width, height); gl.glmatrixmode(gl10.gl_projection); gl.glloadidentity(); glu.gluperspective(gl, 45.0f, (float) width / (float) height, 0.1f, 100f);
when enable backface culling looks correct. backface culling speed-optimization should work depth buffer or not? missing here?
found myself. wasn't gl code, android code:
view.seteglconfigchooser(false);
the "false" in line explicitly says no z-buffer should allocated. after switching "true" worked perfectly.
Comments
Post a Comment