Hi friends,
i tried to embed a QOpenGL widget to my QGraphicsView using QGraphicsProxyWidget .. i tried
adding the widget like this ..
QGraphicsProxyWidget *proxy = scene->addWidget(glWidget);
QGraphicsProxyWidget *proxy = scene->addWidget(glWidget);
To copy to clipboard, switch view to plain text mode
but it returns warning as
QPainter::begin: A paint device can only be painted by one painter at a time.
and it not showing the widget ...
when i replace the opengl widget with normal widget (QTextEdit) it renders it properly ..
my openGL paintGL() code is..
glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
glMatrixMode(GL_PROJECTION);
glLoadIdentity ();
glOrtho(this->max_x,this->max_y,this->min_x,this->min_y,-1.0f,1.0f);
glPushMatrix();
glBindTexture(GL_TEXTURE_2D, texture);
glBegin (GL_TRIANGLE_STRIP);
....
....
glEnd ();
glPopMatrix();
glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
glMatrixMode(GL_PROJECTION);
glLoadIdentity ();
glOrtho(this->max_x,this->max_y,this->min_x,this->min_y,-1.0f,1.0f);
glPushMatrix();
glBindTexture(GL_TEXTURE_2D, texture);
glBegin (GL_TRIANGLE_STRIP);
....
....
glEnd ();
glPopMatrix();
To copy to clipboard, switch view to plain text mode
please help me in solving this issue ... where it requires painter.save() function ..? or some other ..? in QGLWidget where i have to use Qt GL functions ..?
please help me ... thanks in advance ..
Bookmarks