2013-01-23 29 views

Odpowiedz

10

Zajęło mi trochę czasu, aby wymyślić ten jeden.

Sztuką jest wykorzystanie QSurfaceFormat w konstruktorze twoi QWindow „s tak:

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(); 

a później, gdy inicjowanie OpenGL:

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

naprawdę dziwne, jaki jest sens w tworzeniu go na QOpenGLContext, jeśli QWindow zrobi to samo, – paulm

+2

@paulm: Nie, po prostu bawiłem się z rzeczami, dopóki to nie zadziałało ;-) – Cameron