PDA

View Full Version : QGraphicsView + opengl + Vsync



medved6
7th March 2011, 00:01
I'm new in GL as well as in UI in general. So it might be a strange question....

My software uses QGraphicsView with OpenGL view port. I have a lot of animation on the scene and if I do not have Vsynch image does not look good. Before now I forced drivers ( like on NVIDA control panel or ATI try tools ) to force Vsync yo "always on".

Now I want to do it from software. To enable it I have to call somehow function wglSwapIntervalEXT(1). So I have 2 questions...


1) Where should I call it ? So far the only place I see I can call it is inside Item's painting routines. But I want it to be global for the whole scene/view ( not a single item ).


2) How do I handle dual monitor issue ?
- is it possible to sync with both monitors ?
- if not how do I control with which one to sync?


Thanks in advance!

medved6
11th March 2011, 03:27
ok.

to setup vsync I need



QGLFormat glFormat(QGL::SampleBuffers);
glFormat.setSwapInterval(1); // vsync
setViewport(new QGLWidget(glFormat)); //Antialiasing


But how do I control which monitor to sync with ?

JohannesMunk
11th March 2011, 12:41
I am pretty sure that you don't need to worry about that. Each OpenGl context will vsync on the monitor it is shown. Thats done in the driver/hardware.

Joh

medved6
11th March 2011, 16:20
Must be I have bad drivers on several machine:-)
But I tried different driver version.