Setting up the OpenGL window

We are now going to add the code required to create an OpenGL window. We did this once for RoboRacer2D, but now, we are creating a 3D game and there will be some differences. Here's a look at what we need to do:

  1. Include header files.
  2. Define global variables.
  3. Create the OpenGL window.
  4. Initialize the OpenGL window.
  5. Size the OpenGL window.
  6. Remove the OpenGL window.
  7. Create the Windows event handler.
  8. Create the WinMain function.

Notice that we still have to create some code to satisfy Windows. We need an event handler to process Windows events, and we still need a main function to serve as the program entry point and run the main program loop. Everything else in this list is used to set up the OpenGL environment.

Tip

I listed the ...

Get OpenGL Game Development By Example now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.