Sign in to follow this  
Ghyrome

Can't see the front face in simple rotating cube

Recommended Posts

Ghyrome    129

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.

Share this post


Link to post
Share on other sites
Ghyrome    129

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

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this