Jump to content

  • Log In with Google      Sign In   
  • Create Account

Can't see the front face in simple rotating cube


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
3 replies to this topic

#1 Ghyrome   GDNet+   -  Reputation: 128

Like
0Likes
Like

Posted 03 February 2013 - 06:02 PM

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.



Sponsor:

#2 Khatharr   Crossbones+   -  Reputation: 3003

Like
0Likes
Like

Posted 04 February 2013 - 12:02 PM

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.

#3 Ghyrome   GDNet+   -  Reputation: 128

Like
0Likes
Like

Posted 04 February 2013 - 12:29 PM

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


#4 Khatharr   Crossbones+   -  Reputation: 3003

Like
0Likes
Like

Posted 06 February 2013 - 07:35 PM

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.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS