Friday, June 8, 2012

FINALLY...... you'll never believe this

TL;DR: I fixed the problem, here's the result. For those who want to know the dirty details... I was playing around with Caltron, the rendering engine for PolyMo Live! (now Concertroid!) and I started noticing a peculiar bug in the method that applies the textures. Colors in normal GDI are encapsulated by System.Drawing.Color in the .NET framework, a structure I use to store color values in non-Caltron projects (like Universal Editor). These Colors represent color values using four Int32s (something I've never understood, since colors can really only be practically represented in ranges from 0-255). Whether they're four Int32s or four Bytes, their practical range is still only 0-255. Well, OpenGL expects color values to be formatted as percentages, something I knew full well when I started getting into it. However, as I soon learned, I was forgetting a crucial part to the texture applicator. The RGB color values were not getting divided by 255. So, I just added the necessary division, and voilĂ ! The entire thing went black. See, I had forgotten ANOTHER crucial part to the renderer. I had forgotten to flip the light switch. Yes, the light had been configured with the correct color values and position and whatnot, but I had forgotten to glEnable() the light. Anyway, now that I fixed both of the problems (and found an interesting phenomenon where the light position wasn't completely correct and was actually illuminating INSIDE Miku instead of outside her), I feel it's time to update the blog. So enjoy the latest picture! I should have a test program (and complete source code) released soon, but I found another bug where the software will run on my machine but no one else's. I think it's due to the universal-editor library doing something it shouldn't be doing (namely, attempting to read/write from a read/write-protected location)... so I should have that fixed in no time.

No comments:

Post a Comment