View Full Version : Rotation Problem

09-20-2006, 11:16 AM
I am trying to rotate some text for a 2-D plot I am making. I am trying to put this in a portion of my left viewport so that it runs from bottom to top. The bottom of the letters will face the inside of the plot. I am designing this program in Qt and using a QGLWidget. Here is the snipet of my code I have:

glMatrixMode( GL_PROJECTION );
glLoadIdentity( );
glOrtho( -10.0, 10.0, -10.0, 10.0, -10.0, 10.0 );
glMatrixMode( GL_MODELVIEW );
glLoadIdentity( );

glViewport( ( leftMarginWidth / 4.0 ), 0.0, ( leftMarginWidth / 4.0 ), winHeight );
glScissor( ( leftMarginWidth / 4.0 ), 0.0, ( leftMarginWidth / 4.0 ), winHeight );

mpQgl->qglColor( mLeftLabelColor );
glPushMatrix( );
mpQgl->renderText( 0.0, 0.0, 0.0, mLeftLabel );
glRotated( 90.0, 0.0, 0.0, 1.0 );
glPopMatrix( ); mLeftLabel is a QString of what holds the label.
leftMarginWidth is a double holding the width of the left margin. I allow for a title to be in the first 1/4 of the margin, followed by the label in the 2nd quarter of the margin, followed by the actual axis tick marks and corresponding values in the 2nd half of the margin.
mpQgl is a pointer to the QGLWidget I am drawing in.
I have 3 different viewports on each margin and margins on all 4 sides and then the viewport for the plot in the middle. So the only viewport I want rotated is the viewport with the axis label on the left side. I have tried moving the rotate before the render text and also moving the renderText outside the push/pop matrix, but nothing helps. The text always renders in a horizontal manner inside the middle of the viewport I created. Here is a link to renderText (http://doc.trolltech.com/4.1/qglwidget.html#renderText-2) .

Thanks for all your help in trying to help me figure out why my text isn't rotating. If you need more information, please let me know what it is I am missing so I can try to find what you need to further help me.

09-20-2006, 02:25 PM
Well, my bet would be that renderText does not support rotating. There are some libraries that render text using OpenGL, for example: http://quesoglc.sourceforge.net/