Assignment3
A downloadable game
I think the purpose of this assignment is to make our game engine more flexible. Since the game engine accepted only one buffer with one shader, we could only create monochrome game before, but now we can create colorful game!! And also, this change makes users easier to use. However, to be honest, I still don’t understand why we have to make graphics.cpp identical. There are some functions that require for graphics in DirectX which doesn’t exist in OpenGL, and, in order to make it identical, I need to put some of the function to an additional class which make me hard to track down which functions are in which.
Aside from that, the trouble I also encountered the bug was not always get reproduced. When it happened, the program sometime works without any problem, sometime the program gives you error before it draws, sometime it gives error when you close the window. The only things I did was move some of the static functions to member functions or other way around. Later, I just rewrote the code from the point where doesn’t have problem, and everything works.
In order to make Graphics.cpp independent to platform, I take out the functions which both DirectX and OpenGL have, such as clear buffer and swap buffer to GraphicPlatformDependent class, and move the functions that only exist in one platform to GraphicsPlatformDepenedent as well, but for those functions, I place under a specific namespace such as namespace DirectX so that when you see Grahics.cpp you will realize that the line of code is for DirectX.
The code user needs to specify in cEffect is the paths for vertex shader and fragment shader.
The amount of memory a single effect can take up is 12(sizeof(s_vertexShader) + sizeof(s_fragmentShader) + sizeof(s_renderState)) + size of string for the paths for fragment shader + vertex shader in DirectX, 16(sizeof(s_vertexShader) + sizeof(s_fragmentShader) + sizeof(s_renderState) + sizeof(s_programId) ) + size of string for the paths for fragment shader + vertex shader in OpenGL. I don’t know the way to make this smaller anymore.
The data a user needs to specify is vertex data and which vertex to make a triangle.
The data of my object geometry is 40 for OpenGL, and 44 for DirectX. There are some redundant variables in my class, so yes I can make it smaller by deleting those variables.
Status | Released |
Author | dropanddrop |
Leave a comment
Log in with itch.io to leave a comment.