The main objective of this assignment was to make the Render() platform independent. So as you can see the picture below I have split the Render in for Direct3D and OpenGL into Clear(), BeginDraw(), EndDraw() an ShowBuffer().
So there is basically no platform specific code within this Render function . It is platform independent. The implementation or the details would obviously differ depending on the platform. So the Clear() function basically clears the screen to black. We have the BeginDraw() and EndDraw() for the D3D implementation . For OpenGL I am just returning true for both the functions.
Below is the screen shot of my vertex shader . Had to take two screenshots so its half and half because it didnt fit the screen.
The vertex shader includes the shaders.inc which makes things more platform independent. I have also made the output position calculation platform independent. For calculating the output positions , I am however using the #if defined for OpenGL and Direct3D . The g_offset position is again common for both the OpenGL and Direct3D platforms.
My AssetsToBuild.lua screenshot is as shown in the image below where I have added the dependencies.
It took me around 6 hours to finish this assignment.
You can download the Zip File of Assignment_09 from the following link to get the square output. Use the arrow keys to move the red square.
After downloading the link run Game.exe.