openGL glut how to make loading screen and more?

Hi Im Alex(BOY) and Im 12 but that’s deep information XD.

So Im asking how do i make a loading screen, and i have other questions.
So what Im trying to do is to add a loading screen or to be clear a loading screen for a game,
and that contains the basic game loop.

(Just to say im using openGL c++ glut/windows)

That means you won’t help me if you tell me something made with glew/SDL/sfml ect.
If you tell me something from this list (i’ll be (-_-/)whut the).
I know it sounds stupid but im trying to make my own fps shooter game for PC
and i want it to be from only openGL glut and other libraries in the compiler VS2017,
and the only thing i want to know is how do i make a loading screen and the basic game loop.

Thanks in advance <3 <3.


Welcome to the boards!

…how do i make a loading screen and the basic game loop. …im using openGL c++ glut/windows)

In a basic GLUT program (see below), you implement your own callback function to render the contents of the window. You register this callback function with GLUT using glutDisplayFunc(). You prompt GLUT to call this function again soon by calling glutPostRedisplay().

As far as a loading screen, if your game is in “loading mode” you can have your display function clear the screen and render some text, display an image, or whatever you want to do in loading mode.

As far as the basic game loop, GLUT basically takes care of that for you in glutMainLoop(). Inside this loop, it invokes callback functions you implement when “something happens” in the game loop that it thinks you might want to react to (e.g. mouse button pressed, key pressed, mouse moved, window needs displayed, etc.). All you have to do is implement and register the appropriate callbacks.

If you haven’t already, you might want to browse some of the GLUT tutorials for ideas:

in particular:

Keep in mind that GLUT is one of the older OpenGL toolkits, so many of the OpenGL GLUT tutorials you find on the net typically won’t be exercising modern OpenGL techniques (though you can implement modern OpenGL in a GLUT-based program!) At some point you may outgrow it. However, GLUT is great when you’re just getting started with GL and for whipping up small GL test programs because it abstracts all the platform-specific silliness needed to create windows and receive device events. I still use it occasionally!

//  Stand-alone GLUT test program
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <GL/glew.h>
#include <GL/glut.h>
void checkGLError( const char hdr[] )
    int err = glGetError();
    if( err )
        fprintf(stderr, "ERROR %s: %s
", hdr, gluErrorString(err));
void init()
    // Put your GL init code here.
    // glGenBuffers( 1, &Vbo_handle );
    //   etc.
    checkGLError( "init" );
void reshape( int width, int height )
    glViewport(0, 0, width, height);
void display()
    // Clear screen
    glClearColor( 0.1f, 0.1f, 0.43f, 1.0f );
    // Put your GL draw code here.
    // Swap
    // Cause display() to be called again.
    checkGLError( "End of display()" );
void keyboard( unsigned char key, int x, int y )
    switch (key)
        case 27:         // ESC quits
int main( int argc, char** argv )
    // Init GLUT
    glutInit( &argc, argv );
    glutInitDisplayMode(  GLUT_RGBA | GLUT_DEPTH | GLUT_DOUBLE  );
    glutCreateWindow( argv[0] );
    glutKeyboardFunc( keyboard );
    glutDisplayFunc( display );
    glutReshapeFunc( reshape );
    glutReshapeWindow( 400,400 );
    // Init GLEW
    GLenum err = glewInit();
    if ( err != GLEW_OK )
        // Problem: glewInit failed, something is seriously wrong.
        fprintf( stderr, "Error: %s
", glewGetErrorString(err) );
    printf( "GL_RENDERER = %s
", glGetString( GL_RENDERER) );
    return 0;

Thanks for this and i’ll sure be checking the tutorials, and maybe i’ll use other libraries from some point because of you and thanks for that tho.