Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [Solved] QtGui 5.0: OpenGL Window Example - Black screen on Mac
Forum Updated to NodeBB v4.3 + New Features

[Solved] QtGui 5.0: OpenGL Window Example - Black screen on Mac

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 Posters 3.5k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    Rockbridge
    wrote on last edited by
    #1

    Hi all,

    I have just started to experiment with Qt 5.0 and OpenGL on Mac OS X and Windows using the "QtGui 5.0: OpenGL Window Example tutorial.":http://qt-project.org/doc/qt-5.0/qtgui/openglwindow.html While the example builds on both platforms smoothly, it only runs correctly under Windows. The Mac version shows the window but does not render any output. Debugging shows that events are processed as expected. Has anyone experienced the same issues?

    Update:
    I could locate the reason for the problem. The screen refresh rate is reported as zero (line 14 - screen()->refreshRate()), which breaks the rotation matrix calculation:
    @void TriangleWindow::render()
    {
    glViewport(0, 0, width(), height());

    glClear(GL_COLOR_BUFFER_BIT);
    
    m_program->bind();
    
    QMatrix4x4 matrix;
    matrix.setToIdentity();
    
    matrix.perspective(60, 4.0/3.0, 0.1, 100.0);
    matrix.translate(0, 0, -2);
    matrix.rotate(100.0f * m_frame / screen()->refreshRate(), 0, 1, 0);
    

    @

    Setting the refresh rate to a const value of 60 makes the example work. I will investigate further in the behavior of QScreen on the Mac platform.

    Martin

    1 Reply Last reply
    0
    • M Offline
      M Offline
      mkimojohnson
      wrote on last edited by
      #2

      Yes, same issue for me on a MacBook Pro 2.66 GHz Core i7 with a GeForce GT 330M running 10.8.2. Your suggested modification fixed the problem.

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved