Results 1 to 3 of 3

Thread: OpenGL and Qt Question

  1. #1
    Join Date
    Jan 2006
    Location
    Ohio
    Posts
    332
    Thanks
    37
    Thanked 8 Times in 4 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default OpenGL and Qt Question

    I have a project in which I am using Qt and OpenGL (with QGLWidgets). I thought I had OpenGL installed on machine, but now I am doubting myself. I was trying to use the OpenGL function glWindowPos* which is only available in OpenGL 1.4 and higher (they are currently at 2.0 or 2.1). My compiler/linker (VS 2003) complained about not understanding this function call. I decided to use the glGetString( GL_VERSION ) call to see what version on OpenGL I have, but the string that results from this call returns "(null)".

    This result is leading me to believe I do not have OpenGL installed on my machine, but leaves me confused how all my OpenGL code compiles and displays. Does Qt come with a majority of the OpenGL calls embedded into the QGLWidget class or how is my code working. I did a search on my machine for gl.h and the only one I got was qgl.h. If this is the only OpenGL code I have, does anybody know what version of OpenGL the QGLWidgets have implemented? Thanks!

  2. #2
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    258
    Thanks
    22
    Thanked 19 Times in 16 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: OpenGL and Qt Question

    I don't know much about opengl but this function may help you:
    OpenGLVersionFlags QGLFormat:penGLVersionFlags ()
    It returns the OpenGlVersionFlags struct that tells you the details about what version of opengl is supported on your system.
    http://doc.trolltech.com/4.3/qglformat.html#openGLVersionFlags

  3. #3
    Join Date
    Jun 2008
    Posts
    4
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: OpenGL and Qt Question

    You have to run QGLWidget::makeCurrent() before using any OpenGL function, as I see it now. The exception goes to QGLWidget::initializeGL(), QGLWidget::resizeGL(), QGLWidget::paintGL(), where QGLWidget::makeCurrent() is implicitly called for you.
    Qt4 lover

Similar Threads

  1. openGL with QT
    By me_here_me in forum Qt Programming
    Replies: 4
    Last Post: 2nd July 2007, 01:19
  2. Qtopia Core & OpenGL ES?
    By zelko in forum Qt for Embedded and Mobile
    Replies: 0
    Last Post: 28th May 2007, 07:21
  3. OpenGL ES, Qt/11 - Qtopia Core?
    By zelko in forum Qt Programming
    Replies: 0
    Last Post: 3rd May 2007, 10:56
  4. 3 Dimensions using opengl
    By vermarajeev in forum Qt Programming
    Replies: 30
    Last Post: 23rd April 2007, 11:31
  5. Qt's optimized OpenGL context switching
    By sverhoff in forum Qt Programming
    Replies: 0
    Last Post: 28th March 2006, 16:40

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.