Results 1 to 3 of 3

Thread: Strange Behavior with QGLWidget if Fullscreen

  1. #1
    Join Date
    Feb 2009
    Posts
    21
    Thanks
    2
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Question Strange Behavior with QGLWidget if Fullscreen

    Hi,

    I have the following very simple class -

    Qt Code:
    1. #ifndef GLTEST_H_
    2. #define GLTEST_H_
    3.  
    4. #include <QtGui>
    5. #include <GL/glew.h>
    6. #include <QGLWidget>
    7. #include <iostream>
    8.  
    9. using namespace std;
    10.  
    11. class GlTest : public QGLWidget
    12. {
    13.  
    14. public:
    15. Q_OBJECT
    16.  
    17. public:
    18.  
    19. GlTest(){}
    20.  
    21. virtual void initWindow(){}
    22.  
    23. virtual void initializeGL()
    24. {
    25. QGLWidget::initializeGL();
    26. }
    27.  
    28. virtual void paintGL()
    29. {
    30. cout << "paintGL"<< endl;
    31. QGLWidget::paintGL();
    32. }
    33.  
    34. virtual void swapBuffers()
    35. {
    36. QGLWidget::swapBuffers();
    37. }
    38. };
    To copy to clipboard, switch view to plain text mode 

    which I call via -

    Qt Code:
    1. if(!glWindow.get())
    2. glWindow.reset(new GlTest());
    3.  
    4. glWindow->showFullScreen();
    To copy to clipboard, switch view to plain text mode 

    I'm using two screens so the above code will fill the first screen with the gl window. If I then click on another application in the second window, the above program prints - "paintGL". Then, when I click on the gl window again, this message is again printed. However if I use show() instead of showFullScreen() then this behavior does not happen. In other words, I can click on other windows and the paintGL() function is not entered - as expected. Why might this difference between show() and showFullScreen() be? If this is a bug what might a work around be? I don't wish for paintGL() to be called when the gl window stops being active (or when it starts being active again for that matter). I wish it to work as it does with show().

    The above code is a very stripped down version of what I am actually doing. At the moment I am having problems when in full screen mode because the scene I wish to show in the gl window is being recalculated each time paintGL() is being called.

    Any tips?

    Barry.

  2. #2
    Join Date
    Feb 2009
    Posts
    21
    Thanks
    2
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Strange Behavior with QGLWidget if Fullscreen

    Can anyone offer me some suggestions? I'm at a dead-end with this. Perhaps I'm not being clear about something.

    Thanks,

    Barry

  3. #3
    Join Date
    Feb 2009
    Posts
    21
    Thanks
    2
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Red face Re: Strange Behavior with QGLWidget if Fullscreen

    Anyone an idea why?

Tags for this Thread

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.