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. QGLWidget paintGL function in Qt 5.1.1 not working
Forum Updated to NodeBB v4.3 + New Features

QGLWidget paintGL function in Qt 5.1.1 not working

Scheduled Pinned Locked Moved General and Desktop
6 Posts 2 Posters 2.2k 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.
  • C Offline
    C Offline
    cr4y88
    wrote on last edited by
    #1

    Hello guys,

    I just try to move from Qt 4.8.2 to Qt 5.1.1 today. I install the complete offline installer from Download page. Qt 5.1.1 for Windows 32-bit (MinGW 4.8, OpenGL, 666 MB).
    I want to open my old project with QGLWidget on it.
    But it seems I didn't work fully.

    After searching I found that I can't draw primitive geometries in Qt 5.1.1

    Even a simple code like this :

    @
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    glBegin(GL_TRIANGLES);
    glVertex3f( 0.0f, 1.0f, 0.0f);
    glVertex3f(-1.0f,-1.0f, 0.0f);
    glVertex3f( 1.0f,-1.0f, 0.0f);
    glEnd();
    @

    It won't work. I won't see any triangle there.

    Maybe someone know how to fix this? I've been searching the forums and google. I can't find anything :(

    1 Reply Last reply
    0
    • K Offline
      K Offline
      kenchan
      wrote on last edited by
      #2

      Are you doing it in the paint method and putting that code between these two functions?

      @
      painter->beginNativePainting();
      ...
      painter->endNativePainting();
      @

      1 Reply Last reply
      0
      • C Offline
        C Offline
        cr4y88
        wrote on last edited by
        #3

        I wrote that in paintGL().

        Using Qt 5.1.1 + MinGW 4.8.1 I can see the triangle but it's very big,
        But if I use Qt 4.8.4 + MinGW 4.8.0 the triangle will be small.

        Here are the screenshots I made :

        https://www.dropbox.com/s/jsh3f66tgcw7xko/1.png -> Small WindowQt 4.8.4 + MinGW 4.8.0

        https://www.dropbox.com/s/14iexplqhsadzqg/4.png -> Big Window Qt 4.8.4 + MinGW 4.8.0

        https://www.dropbox.com/s/dl4zktcf19bn3fm/2.png -> Small Window Qt 5.1.1 + MinGW 4.8.1

        https://www.dropbox.com/s/1gl0ugtwknrs3l9/3.png -> Big Window Qt 5.1.1 + MinGW 4.8.1

        Anyone know why?

        1 Reply Last reply
        0
        • K Offline
          K Offline
          kenchan
          wrote on last edited by
          #4

          Not sure then, I never used 4.8.1 sorry.

          Are you sure you got this in your pro file?
          QT += opengl

          1 Reply Last reply
          0
          • C Offline
            C Offline
            cr4y88
            wrote on last edited by
            #5

            I did that.

            I found it. It's working. It's different. It's not the same with qt 4.8.1. I read it a couple days ago

            Thanks

            Solved

            1 Reply Last reply
            0
            • K Offline
              K Offline
              kenchan
              wrote on last edited by
              #6

              Glad to hear it is working for you now.

              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