Here is a source code that head directly into the opengl game mode and draw the glSoildTeapot ,
and I also add the keyboard function , you can zoop in teapot using ‘w’ key and zoom out using
‘e’ key.And you can quit from application pressing ‘q’.
Here is the source code.
#include <stdlib.h>
#include <stdio.h>
#include <GL/gl.h>
#include <GL/glut.h>
double gTeaPotSize = 0.5 ;
void display_function ( void);
/* keyboard function */
void keyboard_function ( unsigned char key , int x ,int y)
{
if ( key=='q')
exit(0);
if (key == 'w' )
gTeaPotSize += 0.05;
glutDisplayFunc( display_function);
glutPostRedisplay();
if (key == 'e')
gTeaPotSize -= 0.05;
glutDisplayFunc(display_function);
glutPostRedisplay();
}
/* display function */
void display_function ( void)
{
glClearColor ( 0.5,0.22,.022,1.0);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT) ;
glutWireTeapot(gTeaPotSize);
}
/* the main function */
int main( int argc , char ** argv)
{
glutInit( &argc , argv);
glutInitDisplayMode( GLUT_SINGLE | GLUT_RGBA );
glutGameModeString("640x480@60");
glutEnterGameMode();
// glutInitWindowPosition(0,0 );
glutFullScreen();
// int i = glutCreateWindow( "The Ch02 program ");
glutDisplayFunc ( display_function);
glutKeyboardFunc ( keyboard_function);
glutMainLoop();
// glutDestroyWindow(i);
}
And by assuming that you save your source code as teapot.cc , type these command on the shell to compile this program.
$gcc -o teapot teapot.cc -lglut
and here’s how it’s running.

Try it YourSelf.
–Happy Coding–