# Thread: Splitting Pyramid Problem

1. ## Splitting Pyramid Problem

Good for now: oknow.jpg
Bad. One of the faces reappears down the middle: badlater.jpg

I've have a pyramid on screen. I'm able to rotate it by 5 degrees on the y-axis, but at certain points one of the faces will appear straight down the middle, and will continue to increase in size until it reaches the original face size, which at that point if you continue to go in the same direction (using the left/right arrow keys) the pyramid will then rotate in the opposite direction. I am incrementing and decrementing the angle with:

Code :
```if ( key == GLUT_KEY_LEFT )
{
rStepAngle += 0.10f;
}

else if ( key == GLUT_KEY_RIGHT )
{
rStepAngle -= 0.10f;
}
...```

Another question I have is, how do I make each face a solid color. I attempted to do this by:

Code :
```VertexData data[ 12 ] = {
{ { 255,   0,   0, 255 }, { -0.5f, 0.0f,  0.5f } },	// front
{ { 255,   0,   0, 255 }, {  0.5f, 0.0f,  0.5f } },
{ { 255,   0,   0, 255 }, {  0.0f, 0.5f,  0.0f } },
{ {   0, 255,   0, 255 }, {  0.5f, 0.0f,  0.5f } },	// right
{ {   0, 255,   0, 255 }, {  0.5f, 0.0f, -0.5f } },
{ {   0, 255,   0, 255 }, {  0.0f, 0.5f,  0.0f } },
{ {   0,   0, 255, 255 }, {  0.5f, 0.0f, -0.5f } },	// back
{ {   0,   0, 255, 255 }, { -0.5f, 0.0f, -0.5f } },
{ {   0,   0, 255, 255 }, {  0.0f, 0.5f,  0.0f } },
{ { 255, 255,   0, 255 }, { -0.5f, 0.0f, -0.5f } },	// left
{ { 255, 255,   0, 255 }, { -0.5f, 0.0f,  0.5f } },
{ { 255, 255,   0, 255 }, {  0.0f, 0.5f,  0.0f } }
};

glVertexAttribPointer( vColor, 4, GL_UNSIGNED_BYTE, GL_TRUE, sizeof( VertexData ), BUFFER_OFFSET( 0 ) );```

Sticking that in the buffer, but the shader does gouraud and it's like the color for the vertices is random.

2. I was able to figure out the problem. A beginner mistake: I had not culled the back face.

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•