Hi,
i'm using a QGLWidget in my class to establish a OpenGL Context. When i resize the QGLWidget using the resize method, the framebuffer will be resized as expected, but not the actual color target. For example, if i resize the widget to 1280x1024 and clear the scene using a red color, only a part of the scene will be cleared in red (as shown on the the following image)

The class using the QGLWidget:
class OpenGLExample
{
public:
OpenGLExample()
{
widget.resize(1280,1024);
widget.makeCurrent();
}
void draw()
{
glClearColor(1.0f,0.0f,0.0f,0.0f);
glClear(GL_COLOR_BUFFER_BIT);
widget.grabFrameBuffer().save("test.png");
}
private:
};
class OpenGLExample
{
public:
OpenGLExample()
{
widget.resize(1280,1024);
widget.makeCurrent();
}
void draw()
{
glClearColor(1.0f,0.0f,0.0f,0.0f);
glClear(GL_COLOR_BUFFER_BIT);
widget.grabFrameBuffer().save("test.png");
}
private:
QGLWidget widget;
};
To copy to clipboard, switch view to plain text mode
And the main class:
int main(int argc, char *argv[])
{
OpenGLExample example;
example.draw();
return 0;
}
int main(int argc, char *argv[])
{
QApplication app(argc,argv);
OpenGLExample example;
example.draw();
return 0;
}
To copy to clipboard, switch view to plain text mode
glClear should affect the complete framebuffer and not only a part. Whats wrong with my code?
Thanks!
Bookmarks