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 not showing
Qt 6.11 is out! See what's new in the release blog

QGLWidget not showing

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 1.7k 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.
  • ? Offline
    ? Offline
    A Former User
    wrote on last edited by
    #1

    Hi there,

    I am new to OpenGL and fairly new to Qt and I encountered a curious problem. Based on the "tutorial":http://files.linux-addicted.net/qtproject/learning/developerguides/qtopengltutorial/OpenGLTutorial.pdf linked on this homepage I implemented some basic OpenGL examples. They work fine and I was even able to extend them to my wishes.

    But, as soon as I try to use the widget as a component in a layout the frame stays black.

    After some trail and error I also found that the original widget does not show if I instantiate it through a pointer. I suppose this might have something to do with the problem.

    @#include <QtWidgets/QApplication>
    #include "GlWidget.h"

    int main(int argc, char *argv[])
    {
    QApplication a(argc, argv);

    //This is not showing:
    GlWidget *sphere1 = new GlWidget();
    sphere1->show();

    //This is showing:
    GlWidget sphere2;
    sphere2.show();

    return a.exec();
    }@

    I am using Qt 5.3 and really hope you can help me solve this. It is a central point for the project I'm working on right now. If you need any further code please let me know (but basically it is the code described in chapter 3.5 of the tutorial and can be downloaded via "link ":http://download.qt.io/learning/developerguides/qtopengltutorial/ ).

    Cheers and thanks in advance,
    Jack

    1 Reply Last reply
    0
    • ? Offline
      ? Offline
      A Former User
      wrote on last edited by
      #2

      Hi again,

      just tried it with the original scr and works perfectly. I'll just try and rebuild it from that point.

      Thanks for the interest in the topic,
      Jack

      1 Reply Last reply
      0
      • ? Offline
        ? Offline
        A Former User
        wrote on last edited by
        #3

        Okay,

        I solved it. It was a case of personal stupidity and not a technical problem. I failed with the declaration of a parameter (I love C++ ;-D).
        Somebody please close this thread.

        Cheers,
        Jack

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Hi and welcome to devnet,

          What parameter was it ? It might help another forum user :)

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          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