You put the <GL/glut.h> at the top, and then there is a display() function that you put all the code in, or put links to other functions where code is written. Here is an example of a code that draws a few white dots.
Code:
void points(void)
{
glBegin(GL_POINTS);
glColor3f(1.0,1.0,1.0);
glVertex3f(0.4,0.2,0.0);
glVertex3f(0.2,0.7,0.0);
glEnd();
}
And there are functions like this for a keyboard:
Code:
void SpecialKeyHandler(int key,int x,int y)
{
switch(key)
{
case GLUT_KEY_UP:
y1+=6;
break;
case GLUT_KEY_DOWN:
y1-=4;
break;
case GLUT_KEY_LEFT:
x1-=1;
break;
case GLUT_KEY_RIGHT:
x1+=1;
break;
default:
break;
}
}
There are mouse functions, special keyboard functions, and regular keyboard functions. It is the easiest way to make a game with OpenGL I know of!