[Solved] Java2D Text on Quad Prob

I’m having some HUD fun right now – just trying to get a prototype up and running.  I’ve followed the HUDs for Noobs tutorial and slightly modified it to test what I want it to do in-game.  All is well until I try to apply a Java2d Texture to the Quad and render Text.  The texture coordinates don’t appear to be the same as what they are for applying images as textures to quads – in fact when applied I can’t see any text at all.  The text comes out upside down with 0,0 at the lower left corner when the texture coordinates are not applied.



My texture coordinate code that loses my text somewhere “out there”:



        FloatBuffer hpctexCoords = BufferUtils.createVector2Buffer(4);

        hpctexCoords.put(getUForPixel(0)).put(getVForPixel(0));

        hpctexCoords.put(getUForPixel(0)).put(getVForPixel(59));

        hpctexCoords.put(getUForPixel(59)).put(getVForPixel(59));

        hpctexCoords.put(getUForPixel(59)).put(getVForPixel(0));

        hpCountQuad.setTextureBuffer(0,hpctexCoords);



A screenshot without using the texture coordinates (numbers in the center drawn with Java2D):







Are texture coordinates built differently for this usage or is there a setting that I’m missing to to display text rightside up?

I should have dug a bit further in the forums before posting.  The following post details and resolves the same problem:



http://www.jmonkeyengine.com/jmeforum/index.php?topic=4971.0



To summarize: use java.awt.geom.AffineTransform and call



AffineTransform tx = AffineTransform.getScaleInstance(1.0, -1.0);

g.setTransform (tx);



before drawing text onto the image space.  The origin of the image space is in the lower left but that’s manageable for positioning text within the image space.



Now we’re talking: