PDA

View Full Version : Strange Behavior with QGLWidget if Fullscreen



Barry79
3rd April 2009, 16:18
Hi,

I have the following very simple class -



#ifndef GLTEST_H_
#define GLTEST_H_

#include <QtGui>
#include <GL/glew.h>
#include <QGLWidget>
#include <iostream>

using namespace std;

class GlTest : public QGLWidget
{

public:
Q_OBJECT

public:

GlTest(){}

virtual void initWindow(){}

virtual void initializeGL()
{
QGLWidget::initializeGL();
}

virtual void paintGL()
{
cout << "paintGL"<< endl;
QGLWidget::paintGL();
}

virtual void swapBuffers()
{
QGLWidget::swapBuffers();
}
};


which I call via -



if(!glWindow.get())
glWindow.reset(new GlTest());

glWindow->showFullScreen();


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.

Barry79
5th April 2009, 10:41
Can anyone offer me some suggestions? I'm at a dead-end with this. Perhaps I'm not being clear about something.

Thanks,

Barry

Barry79
8th April 2009, 16:35
Anyone an idea why?