Thanks, I will take a look at doing that.
I have a follow-up question regarding the use of TextRenderer
. I've read through the source code a bit, and also the docs, and since the source talks about textures and vertex buffer arrays, I think it is rendering text by drawing appropriate quads (or a couple of triangles making up a quad) with a texture containing the appropriate glyph for each character.
Nothing I'm reading suggests that changes to the Modelview matrix shouldn't affect the way that text is drawn. However, I have this code:
TextRenderer renderer = new TextRenderer(getFont());
renderer.setColor(Color.black);
gl.glMatrixMode(MatrixMode.MODELVIEW.getValue());
gl.glLoadIdentity();
gl.glTranslated(50, 0, 0);
renderer.beginRendering(canvas.getWidth(), canvas.getHeight());
renderer.draw("Bottom Left (0, 0)", 0, 0);
renderer.endRendering();
and it draws the string "Bottom left (0, 0)" at the bottom left corner of my drawable, seemingly ignoring my modelview matrix.
However, if I move the code that manipulates the modelview matrix after the call to beginRendering
, it does what I expect it to. After seeing this, I looked back at the Javadoc for beginRendering
and noticed it does state that it pushes the modelview matrix in addition to the projection matrix.
But the docs don't say anything about beginRendering
changing the modelview matrix. My example above seems to indicate that the identity matrix is being loaded into the modelview matrix. I haven't yet found evidence of this in the source, however.
Am I correct about this? If so, I think it would be good if the docs for beginRendering
mention this explicitly. It's clear that the projection matrix is going to be changed, but less clear that the modelview matrix will be, at least to me. I guess if it wasn't going to be changed, it wouldn't need to be pushed, but it seems it would be better to state it explicitly.
Free forum by Nabble | Edit this page |