OK thanks for clearing that up Lindley, yes I am using GLUT but I’m quite happy to stick with that form as long as I know what it does
.
I have a new completey unrelated question though. I’m experimenting drawing basic polygons using vertex arrays but I’m having some difficulty. It works perfectly with the glDrawArrays function but I cant get it to work with any of the ‘single’ functions, i.e. glDrawElements. Here’s the code I’m using
static GLint vertices[] = {0, 0, 0,
2, 0, 0,
0, 2, 0,
2, 2, 5,
4, 2, 5,
2, 4, 5};
static GLfloat colors[] = {1.0, 0.0, 0.0,
1.0, 0.0, 0.0,
1.0, 0.0, 0.0,
0.0, 1.0, 1.0,
0.0, 1.0, 1.0,
0.0, 1.0, 1.0};
void init(void) {
glClearColor(0.0, 0.0, 0.0, 0.0);
glEnable(GL_DEPTH_TEST);
glShadeModel(GL_FLAT);
}
void display (void){
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glPushMatrix();
glColor3f(1.0,0.0,0.0);
glEnableClientState(GL_COLOR_ARRAY);
glEnableClientState(GL_VERTEX_ARRAY);
glColorPointer(3, GL_FLOAT, 0, colors);
glVertexPointer(3, GL_INT, 0, vertices);
//***This works***
//glDrawArrays(GL_TRIANGLES, 0, 6);
// <-***This Doesnt***
glDrawElements(GL_TRIANGLES, 6, GL_INT, vertices);
//***Neither Does this***
//glBegin(GL_TRIANGLES);
//glArrayElement(0);
//glArrayElement(1);
//glArrayElement(2);
//glEnd;
glPopMatrix();
glutSwapBuffers();
}
void reshape (int w, int h) {
if(h == 0) // Prevent a divide by zero, when window is too short (you cant make a window of zero width).
h = 1;
ratio = 1.0f * w / h; // Reset the coordinate system before modifying
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glViewport(0, 0, w, h); // Set the viewport to be the entire window
// Set the clipping volume
gluPerspective(45,ratio,1,1000);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
gluLookAt( x, y, z,
x + lx,y + ly,z + lz,
0.0f,1.0f,0.0f);
}
int main (int argc, char** argv) {
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB);
glutInitWindowSize(350, 350);
glutInitWindowPosition(100, 100);
glutCreateWindow("Testing");
init();
glutSpecialFunc(inputKey);
glutIdleFunc(display);
glutDisplayFunc(display);
glutReshapeFunc(reshape);
glutMainLoop();
return 0;
}
There are some variables not explained to do with my camera system but I havent included the code for that. I have tried loads of different ways of using the glDrawElements function (different primitive shape types, different sized vertex arrays with different data, plotting single points) but nothng seems to work. What have I done wrong? 
Thanks again.