• entries
    59
  • comments
    74
  • views
    43954

Fixing the Text

Sign in to follow this  
yckx

379 views

The text strings in Pac-Hedron are simple chains of squares, with each square's texture coordinates adjusted to display the appropriate bit of the font texture. The entire string is a single mesh, which is saved in a std::map along with all the other meshes so it can be reused. This is bad design.

I came to realize some time ago that displaying the score would break this. Every score update would result in a new string being requested, created, and subsequently stored for later use, causing the program to eat up memory with every pellet eaten. Not good.

So, tomorrow's task is to have each character be a separate mesh, and modify the draw routine to iterate through all the characters of all text to be drawn, compiling them all into a "master" vertex buffer and index buffer, and then draw them with a single [font="Lucida Console"]DrawIndexedInstanced[/font] call.

That sounds right to my 2 a.m. self, although just thinking through it for this post has lead me to adjust the design a bit. I'm concerned it will become a more involved task than I believe it to be. But that's usually the way it goes.

Also, I spilled a very little bit of Red Bull on my keyboard this evening, and it went spastic, sending random characters as if a monkey were banging on the keys. I've been using a spare IBM keyboard my housemate has. We hates it. First order of business tomorrow is to go get a new keyboard.
Sign in to follow this  


0 Comments


Recommended Comments

There are no comments to display.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now