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.
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.