Is this the correct way to draw rotated text with TextRenderer?
I'm writing a 2D program and I'm using some TextRenderer objects to overlay text in my GLCanvas. I have a weird intermittent problem: when I try to draw rotated text (code below) it usually works perfectly, but sometimes it instead draws the text at the bottom-left of the GLCanvas with no rotation. Sometimes it will flicker between drawing correctly, and drawing at the bottom-left-without-rotation quirk. It's intermittent, but somewhat repeatable. It happens with both an Nvidia card and on another PC with integrated Intel graphics.
2) The width and height parameters to be given to beginRendering(...) are not the canvas size but rather the current viewport dimension inside this canvas.
In my case I have a canvas where two distinct viewport are used : the left part is for the 3D chart, the right part is for a colorbar. When using the canvas dimension for text that should appear in the left part, then everything is weirdly stretched (see below).
To avoid this, configure beginRendering() with viewport and viewport after retrieving viewport as follow
int viewport = new int;
glGetIntegerv(GL.GL_VIEWPORT, viewport, 0);