2d Text and Picture renderer

Hey guys,

I know it sounds really stupid :persecutioncomplex:, but I don’t know how to render 2d text. I looked on a few places but could’nt find anything.

Can someone point me to a tutorial or something of the sort?

Thanks!

Check out Slick2D’s code: https://bitbucket.org/kevglass/slick/src/c0e4b96798d1c5b1969a26cb62eb7489d701ca6f/trunk/Slick/src/org/newdawn/slick/TrueTypeFont.java?at=default

Basically you draw your font to an image and keep track of the texture region for each character, and then draw each character when you need them.

Ok, figured it out, but I have an issue.

I have a 1st person camera set up. But when I look around the text disappears.

How do I get it to maintain it’s position on the screen no matter what?

Camera control: http://pastebin.java-gaming.org/e8f708e821b17

I’m not very familar with 3d, but maybe add a [icode]GL11.glPushMatrix()[/icode] in your [icode]lookThrough()[/icode] and then before you render text do [icode]GL11.glPopMatrix()[/icode]. Then you should be back to typical 2d projection. Again, I’m not familiar with 3d, so if I’m wrong, someone please correct me.

Ok, new issue!

Now my voxels don’t render!

Heres my main class code: http://pastebin.java-gaming.org/8f70e928b171d

Speaking from my experience, text is really hard to render the way I want to. People really seem to underestimate the amount of stuff required to render text properly. Its kinda of taken for granted in my opinion. Then again, this is just my opinion.

So its nothing stupid if you don’t know how to render text properly to me.

Try adding [icode]glLoadIdentity()[/icode] to the beginning of your loop. Another idea is to switch [icode]render()[/icode] and [icode]renderForeground()[/icode]. If that doesn’t work, then posting the BlockRenderer class code will help see if there is another isse.