Game Dev

OpenGLES PowerVR Coursework Update

By 5th April 2012 No Comments

Although it may look finished, I need to add normals to the objects to make the lighting work properly. I also think that I haven’t done the sphere correct to the specification. We are asked to make the objects either by Vertex Buffer Objects or Vertex Arrays and I think that the sphere is neither.

Here is the code that I have done to draw the sphere from vertices which I have also used to draw the cube and pyramid:

glEnableClientState(GL_VERTEX_ARRAY);
glVertexPointer(3, GL_FLOAT, 0, &sphereVertices[0]);

glPushMatrix();
glColor4f(0,1,1,1);
glRotatef(angle, 0.2, 0.1, 0);
glDrawElements(GL_TRIANGLE_STRIP, ((sphereStacks * sphereSlices)*2), GL_UNSIGNED_BYTE, &sphereIndices[0]);
glPopMatrix();

glDisableClientState(GL_VERTEX_ARRAY);

Even though I have declared the EnableClientState(GL_VERTEX_ARRAY) does this count as creating the Sphere using Vertex Arrays?

Author James Croft

James is a .NET developer for Black Marble Ltd. with over 5 years app development experience in Microsoft platforms. He enjoys blogging, helping others learn to code, making YouTube videos, spending time with his girlfriend but most of all, penguins.

More posts by James Croft

Leave a comment