How do I start planning my first game using OpenGL and C++?

I suggest you keep the following Object-Oriented Principles in mind during your game development:

  • Encapsulate what varies
  • Code to the interface, not to the implementation.
  • Favor composition over inheritance.
  • Strive for loosely coupled designs between objects that interact.
  • Classes should be open for extension but closed for modifications.
  • Depend on abstractions. Do not depend on concrete classes.
  • A class should have only one reason to change.

Here is a nice infographic for your reference.

Design Patterns

Make sure to implement Design Patterns in your game. It will make your game Flexible, Adaptable, Modular and Maintainable. Here are some of the common Design Patterns that you should implement:

With design patterns you no longer code, instead you Design. You are no longer the mason, you are the architect. With design patterns, you will design games that are:

  • Easy to modify
  • Simple to add functionality
  • Painless to maintain


With regard to C++, I would recommend to keep in mind the following tips:

  • Always declare a virtual destructor if and only if you also have at least one virtual method. Read More
  • Manually initialize objects of built-in type, because C++ only sometimes initializes them itself. Read More
  • In a constructor, prefer the use of the member initialization list to assignment inside the body of the constructor. Read More
  • Don't call virtual functions during construction or destruction. Read More
  • Have assignment operators(=,+=,-+,*=,etc.) return a reference to *this Read More
  • Prevent exceptions from leaving destructors Read More
  • Don't try to manage resources manually instead use objects (autoptr or tr1::sharedptr) to help you manage resources. Read More
  • Prefer pass-by-reference-to-const to pass-by-value Read More
  • Don't return a reference when you must return an object Read More
  • Avoid memory leaks with smart pointers Read More
  • Learn how to use namespaces Read More
  • Delay construction of objects until they are truly need it Read More

I recommend you to read Effective C++ by Scott Meyer


If this is your first project with OpenGL, then I would recommend to use a game engine instead. OpenGL can be a bit intimidating and will require you to do a lot of work. If you are making this game for mobile platform, then the game engine you will end up using will use OpenGL ES. A good engine to use is Cocos2D-x.

Hope this helps.

PS. Sign up to my newsletter and get Game Engine development tips.

Harold Serrano

Computer Graphics Enthusiast. Currently developing a 3D Game Engine.