glRasterPos2f- hopefully an easy question
Hey all. This should be an easy question?
glRasterPos2f(0.0f, 0.0f);
glPrint("Hi Everyone");
Now at the moment the text starts being printed at 0.0f, whereas I want the text centered. Anyone know how to do that? Sorry to ask that question, for some reason never used bit-mapped fonts before :~/
Thanks [smile],
John
the easy answer is magic number it over to where it is centered. the hard and robust answer: OpenGL does not support this and you have to make GDI calls (under Windows) to calculate your texts rectangle, then map that rectangle to your 2d projection coordinates in OpenGL.
the GDI function is DrawText, with a DT_CALC_RECT passed in IIRC
and the OpenGL function i typically use is gluOrtho2D (with the window size in pixels to map to pixelspace).
the GDI function is DrawText, with a DT_CALC_RECT passed in IIRC
and the OpenGL function i typically use is gluOrtho2D (with the window size in pixels to map to pixelspace).
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement