Results 1 to 3 of 3

Thread: GraphicViews And OpenGL

  1. #1
    Join Date
    Dec 2013
    Posts
    3
    Qt products
    Qt5
    Platforms
    Windows

    Default GraphicViews And OpenGL

    Hi,

    I am a recently retired software developer and total newcomer to QT and OpenGL ( Although I did have some exposure to OpenGL in the late 80's , has it changed ) . My interests are in Astronomy and astronomy software applications. For the last twenty years I have been developing computational geometry algorithms for a major graphics software vendor. I haven't developed a GUI since 1995 so what an eye opener QT is. It was a choice between QT or .Net . After exposure to a number of very professional and stable QT astronomy applications and a desire to move away from managed code I decided to spend my retirement graphics programming in QT and OpenGL and with maybe a bit of Angle.

    I have a problem with OpenGL not drawing ( not displaying ) after the initial draw. The call to do the draw is invoked from QGraphicsView::drawBackground and I am using glDrawElements to draw 2 million triangles. On the first call the triangles are drawn correctly in an incredible 60 milli seconds. For the second and subsequent calls they just don't appear on the screen. I have set the view port to a QGLWidget and I am using gLOrtho to set the transformation from my real world coordinates. The problem could be due to my inexperience in initializing and sequencing the OpenGL calls correctly. However on the second and subsequent calls I can draw lines with openGL if I express their coordinates in screen coordinates.

    I would appreciate some advice on the correct sequencing of the OpenGL calls for this requirement or referral to some OpenGL example that shows this. Or consequently any advice on what I may be doing incorrectly.

    Rob

  2. #2
    Join Date
    Sep 2009
    Location
    Wroclaw, Poland
    Posts
    1,394
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows Android
    Thanked 342 Times in 324 Posts

    Default Re: GraphicViews And OpenGL

    Typically for OpenGL you want to subclass QGLWidget and reimplement three methods:
    1) initializeGL()
    2) resizeGL()
    3) paintGL()
    Using opengl calls for rendering outside of QGLWidget requires to call beginNativePainting() method of QPainter object.
    some opengl + Qt examples : link
    Btw. nice retirement plan

  3. #3
    Join Date
    Dec 2013
    Posts
    3
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: GraphicViews And OpenGL

    Thanks for the response Stampede.

    I fixed the problem. I wasn't pushing and popping the current transformation matrix. Explains why the coordinates were being screwed.

    As I am using a QGLWidget for the QGraphicView view port there was no need to wrap the opengl calls with begin and end native painting calls.

    Rob

Similar Threads

  1. Conversion from opengl to opengl es2 (Shapefile rendering)?
    By swapan_gh in forum Qt for Embedded and Mobile
    Replies: 1
    Last Post: 5th December 2013, 06:59
  2. converting GLUT/OpenGL to Qt/OpenGL - displaying issue
    By yoti13 in forum Qt Programming
    Replies: 1
    Last Post: 25th November 2012, 00:45
  3. [Qt 4.6.3/OpenGL 4.1] : Unrecognized OpenGL
    By didier in forum Qt Programming
    Replies: 3
    Last Post: 5th August 2011, 23:33
  4. Replies: 0
    Last Post: 6th December 2009, 00:41
  5. Qt with OpenGL ES for ARM9 - All OpenGL ES tests have failed!
    By vinpa in forum Qt for Embedded and Mobile
    Replies: 1
    Last Post: 3rd December 2009, 10:10

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
  •  
Qt is a trademark of The Qt Company.