Making Graphics Independent
After ripping apart the class in the previous assignment to create platform specific implementation of the Graphics calls, I had to bring things back together. Specifically, Graphics.cpp and Graphics.h will now be platform independent interfaces. Meaning that either D3D or GL platforms will utilize this interface synonymously. However, we still needed to consider the specific requirements of OpenGL and Direct3D via a platform dependent implementation. This was done via a class titled View.h and View.cpp respectively. This implementation will sit in the root directory of the Graphics project. It sits parallel to the location of Graphics.cpp and Graphics.h. Reasoning being that both platforms are used in this file, therefore it would not make sense to place into the specific Direct3D or OpenGL directories.
Clearing the Back Buffer Color (To Something besides Black)
The user is able to specify the color of this Back Buffer via the RenderViewFrame call in Graphics.cpp
Sprite and Effect Initialization
Concerning Sprites, users are able to specify the location of the sprites. These are floats that fall within the bounds of the window of [-1, 1] in both horizontal and vertical directions.
With Effects, users are able to specify the exact path of the built Vertex and Fragment shader files used to create the effects. As well as the initial value of the default render state.
Although this was only Assignment 3, I felt that it was the most interesting and beneficial assignment concerning my goal of learning better architecture. Taking an existing code base, that of John-Paul’s engine, and ripping it apart and putting it back together was a good exercise in identifying where platform independence and dependence lie. Also, while this assignment was less Visual Studio detail heavy, it was a good exercise in practicing some good old C++ skills with the few hours spent on Circular Dependency searching while compiling the initial version of Graphics.cpp and Graphics.h.
You can try out these games via the below links. The only difference is that Direct3D will be used in the x64 version, with OpenGL in the other. They have been built and verified to work on Windows.