Hi!
I am doing an application that renders different views of an object. I do the rendering of the objects i have in a modified QGLWidget(glWidget). So to have different views of the objects that i render, i instantiate glWidget X Times with different id's.
Getting to the point glWidget has a shader, that does phong shading and the problem is, that when i run more than one view(more than one instantiation of glWidget), only the first glWidget shows the correct shader. The other 3 give a warning message:
QGLShaderProgram::bind: program is not valid in the current context.
Here is how i instantiate glWidget:
GLWidget *topleft = new GLWidget(1);
GLWidget *topright = new GLWidget(2);
GLWidget *botleft = new GLWidget(3);
GLWidget *botright = new GLWidget(4);
GLWidget *topleft = new GLWidget(1);
GLWidget *topright = new GLWidget(2);
GLWidget *botleft = new GLWidget(3);
GLWidget *botright = new GLWidget(4);
To copy to clipboard, switch view to plain text mode
And here is how i create the shader program:
shaderProgram = new QGLShaderProgram(context());
shaderProgram = new QGLShaderProgram(context());
To copy to clipboard, switch view to plain text mode
So every instantiation of GLWidget should have a different context and (because its a different object) a different shader, so it should work?
Can someone see the problem, or how it is to be solved?
Thanks,
Elbe
Bookmarks