PDA

View Full Version : how to create a menu with text



xman84
05-01-2011, 12:28 PM
How would I go about creating a menu system with fonts in WebGL? I want to make a dungeon crawler and will need a menu for inventory and stats for the weapons. I can draw a world made out of blocks ok but I'm not quite sure how to do this.

I think I need to use the matrix that glortho applies to the matrix stack. And I get the feeling I need to some how create my own font because it doesn't sound like any are available to me.

Any help with how I would go about doing this would be appreciated.

SteveBaker
05-01-2011, 04:44 PM
Well, you could create a font in a texture and render quadrilaterals with the appropriate texture coordinates to create letters.

But why bother? You have the whole of HTML5 at your disposal?

I started writing my own game using WebGL-rendered fonts - but to save implementation time, I switched over to using HTML to render on-screen text and GUI elements. The result is really neat - you can even use CSS to set up the style of the thing. My game has user-switchable 'skins' now - it's trival to do that by switching CSS files.