Bugs keep creeping in…

First and foremost:  I’ve put up another update to GoGoGo!.  If you were having crashes or etc, go grab that.

Technical stuff follows:

In computer graphics, the scarcest resource is currently (usually) communication time.  That is, you only have a certain amount of time for the CPU to deliver data and instructions to the graphics card, if you want to maintain your frame rate.  These days, that communication time is far more of a limiting factor than how many polygons you’re going to draw or how many pixels you’re going to be touching.

Back in VectorStorm’s early days (say, up to about Game in a Week #5), I wasn’t actually drawing enough for this communication speed to be a big issue;  it was just a few dozen lines, for the most part.  I could just naively send them to the graphics card every frame.  Easy.  But as my games have started drawing more and more — triangle meshes, textures, etc.  It has begun to become more and more important to optimise the communication.

In OpenGL, the usual way to do this is with Vertex Buffer Objects (VBOs).  Basically, these are just a way to store data directly on the graphics card.  So instead of needing to send a hundred vertices to the graphics card each time you want to draw them, you can instead just say “Draw the hundred vertices that I already put into VBO #1.”  Much faster to transmit, that way!

The tricky problem, of course, is that OpenGL will typically need to be restarted in the new resolution, which means that all of that stored data on the graphics card needs to be sent up again.  And I was forgetting to do that for VBOs.

The funny thing is that this bug has been in the code ever since GiaW #6, and has affected several released games in the time since then.  It’s just that none of them have actually presented an interface which allowed you to change the screen settings while the game was running.

Anyhow, I have this fixed now.  Fullscreen and changing resolutions from the Options screen should all now be working again.

Similarly, the formatting issue on the Options screen was related to VectorStorm not knowing how to build a bounding radius around data which was stored inside a VBO.  Since it didn’t know how big the different pieces of text were, it didn’t know how to keep the different pieces of text from overlapping.  I’ve now fixed that issue as well, so the options screen is correctly formatted again.

Just goes to show how adding a single new feature (VBOs, in this case) can break a whole bunch of old things that used to work properly.

(Note to self:  Must fix textures to be re-uploaded to the video card when a resolution change happens, as well.  I’m getting away with not doing this right now because there are no textures in the game mode where you change resolution/fullscreen, but that won’t always be the case.)