Imagination PowerVR SDK Blog

No output with glDrawArrays


#1

Hi,
I’m not using PowerVR SDK but it seems there are a lot of people who know OpenGL ES 2.0 around here, so hopefully someone can help me anyway.
I’m working on a native renderer on a Motorola XOOM and Android 3.2. It basically works, i.e. I get the EGL context and can set the clear color.  But there is no output when it comes to actual rendering. Here is the context configuration:

 EGLint configAttribs[] = {
            EGL_SURFACE_TYPE, EGL_WINDOW_BIT | EGL_PBUFFER_BIT,
            EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
            EGL_RED_SIZE, 5,
            EGL_GREEN_SIZE, 6,
            EGL_BLUE_SIZE, 5,
            //EGL_DEPTH_SIZE, 16,
            EGL_NONE
        };

The actual rendering is a Hello Triangle example so the vertex array comprises 3 vertices. Please ignore the variables for the moment, I am interested in possible errors of the command sequence:

glClearColor(0.5f, 0.5f, 0.5f, 1.0f);
glViewport(0, 0, eglCtx->getSurfaceWidth(), eglCtx->getSurfaceHeight());
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glUseProgram(t->mProgramID);
glVertexAttribPointer(t->aPositionID, 3, GL_FLOAT, GL_FALSE, 0, arrayBuf);
glEnableVertexAttribArray(t->aPositionID);
glDrawArrays(GL_TRIANGLES, 0, 3);
glDisableVertexAttribArray(t->aPositionID);

Program linking and obtaining the attribute location (there is only one attribute, no textures) works without errors. The above commands return without errors as well. As I said, the background color is visible on the device but the triangle does not appear. Any help is highly appreciated.

Regards,
Daniel