PDA

View Full Version : Using Qpainter in qglwidget paintGL function



danics
6th September 2014, 11:20
hi,

i have problem with overpainting in qglwidget, when i create QPainter p(this) in paintG,L swapbuffers() dont work and my widget blinked during animation using updateGL and give me this error:
QOpenGlContext::swapBuffers called without corresponding makecurrent()
and when i using paintEvent() and i use update() i havent see smooth swap buffer too but if i dont use QPainter its work so good,

How can i use QPainter beside using swapbuffers()? do we have any function fer getting current context painter device?

this is my code


paintGL()
{
glClearColor(0,0,0,1);
glClear(GL_COLOR_BUFFER_BIT);

QPainter p(this);
drawBackground(&p);
drawForeground();
}


sorry for bad english and thanks.