Here's my platform-independent render method. PlatformWrapper is a namespace containing helper functions. For cleaning buffer, a uint8_t rgb color is first set, with 0, 0, 0 being default argument. There's a range conversion for gl onlu. Then CleanSelectBuffer method is called with three possible boolean arguments indicating if to clean each buffer by setting their separate bit in each platform. Here default argument is to clean color buffer while leaving the other two untouched for now. RenderStart() & RenderEnd() are for D3D use as JP mentioned. Renderable info is kept in a multimap. RenderAll() iterates through the map and call seteffect, setuniform and drawmesh for them. Display just swap the buffer to show the rendered content with separate implementation.
I chose d3d types by random. The differences between implementation is basically on variable declaration and function argument list. Redefine platform separate types and also platform specific required naming into common convention is necessary to keep public area platform independent. For instance, output positions are both defined to O_POSITION to make main function platform independent.
For dependency files, I just add another table called Dependency just as optional arguments. These files are checked to get the latest modified time to compare with build target.
Here's an executable of mine:
Here's an executable of mine:
assignment09.zip |