Rendering text over OpenGL ES 2.0 surface (QGLWidget)?
What would be the best (= most efficient) way to render text on top of a rendered opengl (es 2.0) scene? This would be needed for typical gaming stuff such as screen notifications, fps counter etc. I was thinking perhaps render the text onto a QImage / other RGBA canvas and then draw that using OpenGL’s texture..?
9 replies
Rather than prebaking an image atlas, I generate it dynamically using a QPainter to draw to a texture which is displayed with quads. I don’t know how much less efficient it is to draw the characters to the image on demand rather than prebaking, but I need the flexibility to change the font to anything the system provides. You can see the code here:
http://gitorious.org/mifit/mifit/blobs/master/libs/opengl/Text.h
http://gitorious.org/mifit/mifit/blobs/master/libs/opengl/Text.cpp
Hey, I’m without my N8 for a week or so, but I’ve just finished writing openGL code for a game in the simulator, including using QGLWidget::renderText() for text rendering. But I read that it’s not supported by OpenGL ES? Does that mean it won’t show up on the phone or will cause other problems? Does anyone know if renderText() will/won’t work?
Hey, I’m without my N8 for a week or so, but I’ve just finished writing openGL code for a game in the simulator, including using QGLWidget::renderText() for text rendering. But I read that it’s not supported by OpenGL ES? Does that mean it won’t show up on the phone or will cause other problems? Does anyone know if renderText() will/won’t work?
FYI: don’t use QGLWidget::renderText(). you’ll get this message:
[Qt Message] QGLWidget::renderText is not supported under OpenGL/ES
You must log in to post a reply. Not a member yet? Register here!




