2013-01-23 20 views

risposta

10

Mi ci è voluto un po 'per capire questo.

Il trucco è quello di utilizzare un QSurfaceFormat nel costruttore 's tuoi QWindow in questo modo:

setSurfaceType(QWindow::OpenGLSurface); 
QSurfaceFormat format; 
format.setSamples(4); // Set the number of samples used for multisampling 
setFormat(format);  // Note we set the format on the window... 
create();    // Create the window 

context = new QOpenGLContext(this); 
context->setFormat(format); // ...and set the format on the context too 
context->create(); 

E più tardi, quando l'inizializzazione OpenGL:

glEnable(GL_MULTISAMPLE); // This seems to be the default given the configuration above, but just in case that's not universal... 
+0

davvero strano, quello che è il punto di impostazione su QOpenGLContext se QWindow farà solo le sue cose – paulm

+2

@paulm: non ne ho idea, ho solo maneggiato le cose finché non ha funzionato ;-) – Cameron