Monday, February 27

Part Two

Since I don't really have much else to talk about right now, I will continue to talk about my programming woes and triumphs.  Firstly I'd like to say I have my object loader working perfectly fine, and things are good on that front.  It can load in multiple objects in different viewports, so now I just need to get lerping!

On the other hand, the particle system is...halfway there.  I got glMultiTexCoord working as it is supposed to, but this resulted in a rather nasty runtime-check error.  I've googled it for a depressingly long amount of time, and have surmised that it involves the difference between how c++ and c function calls work.

The difference comes down to __stdcall and __cdecl, and because glMultiTexCoord works off a dll which uses c, it is corrupting the stack pointer when it tries to clean up the memory.  I have found a way to force the program to run anyways, but after 5 particles on the screen the stack pointer becomes corrupted so...not much of a particle system.  Oh they are all there...you just cant see them -.-

With a little help from the game dev group I've learned how CG shaders actually get their input parameters from the program.  Certain opengl functions such as glTexCoord and glVertex are automatically used by variables in shaders with certain semantics, TEXCOORD and POSITION respectively.

As for the 'uniform' variables, they are explicitly set in the actual program with functions such as cgSetParameter#.  In the shader the uniform identifier states that the program will take this variable, and these types of variables stay the same across all vertices/pixels.  The aforementioned variables are implicitly called as varying, because they are different for every vertex on the screen.

So that's my little shader variable wrap-up, until next time!

No comments:

Post a Comment