Hi,
I have written following openglES code to render the shape.
But it is drawing any thing. blank screen is appearing.
Where am I doing the mistake.
Could you please help me .
Thanks
void CAppView::drawScene2()
{
glClearColor( 0.f, 0.f, 0.f, 1.f );
glViewport( 0, 0, 240, 320 );
glPushMatrix();
const GLfloat pyramidVertices[] = {
// Our pyramid consists of 4 triangles and a square base.
// We'll start with the square base
-1.0, -1.0, 1.0,
1.0, -1.0, 1.0,
1.0, -1.0, -1.0,
-1.0, -1.0, -1.0,
// Front face
-1.0, -1.0, 1.0,
1.0, -1.0, 1.0,
0.0, 1.0, 0.0,
// Rear face
1.0, -1.0, -1.0,
-1.0, -1.0, -1.0,
0.0, 1.0, 0.0,
// left face
-1.0, -1.0, -1.0, // bottom rear
-1.0, -1.0, 1.0, // bottom front
0.0, 1.0, 0.0, // top centre
// right face
1.0, -1.0, 1.0, // bottom front
1.0, -1.0, -1.0, // bottom rear
0.0, 1.0, 0.0 // top centre
};
glEnableClientState ( GL_VERTEX_ARRAY );
glVertexPointer( 3, GL_FLOAT, 0, pyramidVertices );
glColor4f(1.0, 0.0, 0.0, 1.0);
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
glPopMatrix();
}