Qt GLWidget how to draw text


Qt GLWidget how to draw text



before I used Qt and customized my own Widget which is inherits from QGLWidget
i used OpenGl in standard projects and free glut.



by doing this, I used glutBitmapChracter but now in Qt there is no need to manage windows because I created customize widget with gui.



so how can I draw text on the widget?
if I want to include the free glut and use glutBitmapCharacter I nedd also to init the glut and im getting confused?



is there any other way or do I have to use external library?





Qt Docs
– Asaq
Jul 1 at 13:18




1 Answer
1



You are using a QGLWidget and want to draw 2D text on top of the 3D scene?



glutBitmapCharacter should still work in a QGLWidget, just like other GL library code. I do not think you need to call glutInit to use the GLUT character drawing functions.



Or you could use the Qt 2D text drawing methods (QPainter) to draw text on top of your QGLWidget. A Qt book or online documentation will explain how to do this. (I have the books on Qt programming by Blanchette and Summerfield, and can recommend them.)



Hope this helps.






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

api-platform.com Unable to generate an IRI for the item of type

How to set up datasource with Spring for HikariCP?

Display dokan vendor name on Woocommerce single product pages