Assignment 2
The write-up should also explain (in your own words) what the point of the assignment was and how you did it
Answer:
The point of the assignment in my opinion was to: restructure the Graphics code base to include a Geometry and Effect based class, and restructure it in a way that such classes could be interfaced with in a platform independent manner.
I approached this first by moving Geometry and Shader Effect code to platform dependent files. From there I then identified similarities between both platforms and moved similar code into platform independent files. After reaching a point that was stable, I then tackled the problem of how I would want to interface with such logic from an outside point of view. I came up with the conclusion that the Effect interface would include the specifying of paths to a vertex shader and fragment shader. I also came up with the conclusion that the Geometry interface would take a list of vertexes to draw a shape, but not care for the underlying platform (which lead me to implementing some vertex conversion logic).
The write-up should contain detail about how you personally completed the assignment:
Answer:
For the scope of the assignment I decided on some simple interfaces for both the Geometry and Shader. I also felt that the assignment was straight forward for the most part. But I also can’t help but feel unsure if how I actually interfaced my classes are the best “designed way”.
For sure one thing I know that could probably be improved is the removed of static references from the classes (such as the sShader manager and sState manager). These should probably be passed in as parameter instead. I made an attempt at trying to pass these into the classes, but I was running into index errors that I could not resolve. Shown in the last screen shot on this page. For future implementation, I would want to isolate the logic of my geometry and effect class as much as possible to remove external dependencies.
With my vertex passing interface, I easily drew a house for both platforms.
Specific Requirements:
Screenshots. All 5 can be found below.
Code Screen shots. Found right below.
Tell us (in general terms) what the remaining differences are between Graphics.d3d.cpp and Graphics.gl.cpp. (Discuss any ways that you can think of to use platform-independent code to eliminate those differences so that only a single platform-independent Graphics.cpp file would be necessary.)
Answer:
Remaining differences:
Key difference of platform specific window logic (3d3 and initializing view, gl creating some program?)
Platform clearing of the screen
Back buffer and front buffer swapping
Cleaning of platform specific logic
Elimination of differences:
I could see encapsulating screen based logic (like treating the screen as a generic screen of some sort) as a solution to making the system more platform independent. Such an encapsulation would handle clearing the screen as well as swapping buffers.
Encapsulating core platform logic in an interface of initialization and teardown (like some kind of Renderer Interface), could make Graphics more platform independent.
Credits:
None
Initialize interface for geometry. The passing of vertex points (which are assumed to be right handed) as a parameter. My platform independent implementation converts the points behind the scenes depending on the platform
Initialize interface for shader effects. The passing of the path for the vertex shader and fragment shader are taken as a parameter.
During the draw call. I bind the effect and draw geometry the same way in both platforms.
Direct X GPU Capture 1
Direct X GPU Capture 2
Open GL GPU Capture 1
Open GL GPU Capture 2
Open GL GPU Capture 3
An error that showed up when I was trying to pass in manage instances instead. THIS DOES NOT MEAN I FAILED TO COMPLETE THE ASSIGNMENT. Just a reference to one of the notes I made up above.