Hold space to change the humerus texture and find your funny!
(Simple one-click download. Once downloaded, unzip, play the executable, enjoy!)
About the Project
I thought this assignment was fun. I like working with macros, and since we can’t have separate cpp implementation files for shaders like we do for our other code, to make my shaders platform independent I got to use my C macros. Declaring the variables is simple enough. For instance, in my platform independent shader, with the use of the macros, this is how I declare a texture:
DeclareTextureObj( g_color_texture, 0 );
The functions were a bit more tricky, but this is how I sample a color from the texture:
const float4 sampledColor = TEXTURE( g_color_texture, i_texcoord, g_color_samplerState );
Since openGL has a reserved variable “gl_Position” which is required, to manage this I set up a macro so that in my shader all I have to do is this:
o_position = float4( i_position.x, i_position.y, 0.0, 1.0 );
and the macro resolves the “o_position” to “gl_Position”.
I also decided to complete the optional challenge of enabling alpha transparency to my shaders. This was a very simple task. The render state is updated based on the bit in the renderstate variable. Change that bit to a 1 and you have enabled alpha transparency. I did this for my kiddy corner images.
Last thing I did was move and resize my images as well us update the user input mechanic so that when you hold the space bar you see one image, and when you release it it changes back.