Can't see the front face in simple rotating cube

Started by
2 comments, last by Khatharr 11 years, 2 months ago

When rotating a simple 1x1x1 cube on all three axis, I cannot see the front face.

I have set "GLES20.glClear (GLES20.GL_DEPTH_BUFFER_BIT | GLES20.GL_COLOR_BUFFER_BIT). And I have tried to no avail the following: GLES20.glDisable (GLES20.GL_CULL_FACE), and GLES20.glFrontFace(GLES20.GL_CCW) and GLES20.glFrontFace(GLES20.GL_CW).

I also have set the following view-port and frustum in the onSurfaceChanged method: GLES20.glViewport(0, 0, width, height), final float ratio = (float) width / height; final float left = -ratio; final float right = ratio; final float bottom = -1.0f; final float top = 1.0f; final float near = 1.0f; final float far = 10.0f; Matrix.frustumM(mProjectionMatrix, 0, left, right, bottom, top, near, far).

I've wound the front face both CW & CCW. I specifically wound the front face in the following orders: CCW [(0, 1, 2) (2, 3, 0)] & CCW [(0, 1, 2) (0, 2, 3)].

I changed my right face from blue to red just so I could see RED! And I'm still seeing red (just joking).

In closing, HELP!

Thanks in advance, Ghyrome.

Advertisement

Check your vertex values.

Apart from that, can you show the relevant code? (Please use code tags.)

void hurrrrrrrr() {__asm sub [ebp+4],5;}

There are ten kinds of people in this world: those who understand binary and those who don't.

Thanks Khatharr.

After reviewing Lesson Five on http://nehe.gamedev.net/, I resolved the problem by adding the following code:

// No culling of back faces
GLES20.glDisable(GLES20.GL_CULL_FACE);
// Enable depth testing
GLES20.glEnable(GLES20.GL_DEPTH_TEST);
Ghyrome

Ah. The near part was being overdrawn because depth testing wasn't on.

Glad it's working for you.

void hurrrrrrrr() {__asm sub [ebp+4],5;}

There are ten kinds of people in this world: those who understand binary and those who don't.

This topic is closed to new replies.

Advertisement