(Android) No puedo hacer que el búfer de profundidad funcione en opengl es2

I already spent several hours trying to make depth buffer work, but no luck. Initialization code:

class MyGLSurfaceView extends GLSurfaceView {
public BasicGLSurfaceView(Context context) {
    setEGLConfigChooser(8, 8, 8, 8, 16, 0);
    m_rend = new ViewRenderer(context, m_app);

rendering funcrtion looks like this:

public void Render() {
    GLES20.glClearColor(m_backColor.x(), m_backColor.y(), m_backColor.z(), 1.0f);
    GLES20.glDepthRangef(m_depthNear, m_depthFar);

I assume that there are two things can be wrong: first is depth buffer wasn't initialized successfully, but setEGLConfigChooser returns no error, and second if I setup rendering states incorrrectly. What's wrong with my code?

BTW. I've made it work in my NativeActivity project, but i can't do the same in java :(

Gracias de antemano!

preguntado el 24 de agosto de 12 a las 03:08

Please define what 'not work' means exactly. Also what is your 'depthNear/depthFar' set to? Have you tested errors with glGetError? -

Not work means that it draws like there is no depth buffer at all. And yes, I tried glGetLastError, please, read the question carefully. -

The problem was solved by rebooting my galaxy tab and restarting Eclipse... In other words, it wasn't actually application bug, but troubles somewhere in Eclipse or Android SDK internals. -

0 Respuestas

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.