Hi
I am already connecting the signal as follows:
Window::Window(QWindow *parent)
: QQuickView(parent),
mScene(new TeapotTessellation(this))
{
setClearBeforeRendering(false);
QObject::connect(this,
SIGNAL(beforeRendering
()),
SLOT(renderOpenGLScene
()),Qt
::DirectConnection);
connect(timer,SIGNAL(timeout()),this,SLOT(update()));
timer->start();
QSurfaceFormat format;
format.setMajorVersion(4);
format.setMinorVersion(3);
format.setSamples(4);
format.setProfile(QSurfaceFormat::CompatibilityProfile);
setFormat(format);
}
Window::Window(QWindow *parent)
: QQuickView(parent),
mScene(new TeapotTessellation(this))
{
setClearBeforeRendering(false);
QObject::connect(this,SIGNAL(beforeRendering()),SLOT(renderOpenGLScene()),Qt::DirectConnection);
QTimer *timer = new QTimer(this);
connect(timer,SIGNAL(timeout()),this,SLOT(update()));
timer->start();
QSurfaceFormat format;
format.setMajorVersion(4);
format.setMinorVersion(3);
format.setSamples(4);
format.setProfile(QSurfaceFormat::CompatibilityProfile);
setFormat(format);
}
To copy to clipboard, switch view to plain text mode
And after every rendering commands i am unbinding the shaders and vertex array object explicitly and i am not sure where to call this resetOpenGLState(). Check also the following snippet:
void Window::update()
{
float time = mTime.elapsed() / 1000.0f;
mScene->update(time);
QQuickView::update();
}
void Window::renderOpenGLScene()
{
static bool firstTime = true;
if(firstTime)
{
mScene->initialise();
mScene->resize(width(),height());
firstTime = false;
}
mScene->render();
//SHOULD I CALL THE FUNCTION resetOpenGLState() here ?
}
void Window::update()
{
float time = mTime.elapsed() / 1000.0f;
mScene->update(time);
QQuickView::update();
}
void Window::renderOpenGLScene()
{
static bool firstTime = true;
if(firstTime)
{
mScene->initialise();
mScene->resize(width(),height());
firstTime = false;
}
mScene->render();
//SHOULD I CALL THE FUNCTION resetOpenGLState() here ?
}
To copy to clipboard, switch view to plain text mode
Bookmarks