Monday, March 21, 2011

The hero’s final destination: Geometry Planetary System a.k.a. Graphics Engine!


Hello my fellow readers! As a man of my word, here I am again. This time will be all about my Graphics Engine. I will talk about its architecture in general (components & description) and also have included a video so you can see it running in all its glory =D

Let’s start from the beginning. This engine was built in Visual Studio 2010 using C++ and OpenGL. I used the Pyramid Demo (Chapter 5) from the OpenGL SuperBible (5th edition) book as my starting point for the implementation. During the last month of the quarter, all the students worked in tandem with Prof. Keenan refactoring this code (Pyramid Demo), in order to make it more efficient and flexible, but at the same time more elegant and re-usable. In my opinion, that’s the whole idea behind a Graphics Engine, to be fast but flexible at the same time.

Basically we took the book’s code and reorganized it into different classes in order to achieve our objectives. The majority of these classes were created using the Singleton Pattern (one-instance class), and the idea behind this move was to build a collection of Managers to handle the different components of the Engine: Renderer, Camera Manager, Texture Manager, Objects Manager and Objects Library. For the porpoise of this post, I shall give you a small description of these components:
  • Renderer (Graphics Manager): handles the majority of OpenGL calls, including all the initialization, setting up, program main loop, input handling and program shutdown. This one is basically the orchestra director and the one piece that glues the whole engine together.
  • Camera Manager: takes care of camera administration, including creation and destruction of all cameras, as well as setting up a primary camera (main frustum) and alternative cameras for frustum viewing.
  • Texture Manager: this manager is in charge of loading textures to GPU’s memory, storing the appropriate texture handlers, upon request give the texture handlers and freeing all texture resources when the program is shutdown.
  • Objects Manager: holds pointers to all objects created during program execution (at least all objects that the engine will draw). This manager also handles on-the-fly texture changes for current selected object, and finally, destruction of all objects when the program is close.
  • Objects Library: this singleton class is in charge of creating models (geometry figures) in GPU’s memory using Vertex Buffer Objects and Vertex Arrays, and also storing the respective model handler (GLuint). These handlers are later assigned to objects to specify to kind figure they represent.

Now, I shall present you the demo (video) I recorded and submitted for this assignment. Hope you enjoy it!


I will probably post one more time to cover other details about the Graphics Engine before moving onto the second Game Engine Programming class (next week). So, I guess I will see you soon again! Have a nice one!

Adios!

No comments:

Post a Comment