2013-01-23 33 views

Trả lời

10

Hãy cho tôi một thời gian để tìm hiểu điều này.

Bí quyết là sử dụng một QSurfaceFormat trong constructor QWindow của bạn như sau:

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

Và sau đó, khi initialising OpenGL:

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

thực sự kỳ lạ, điểm trong việc thiết nó là gì trên QOpenGLContext nếu QWindow sẽ chỉ làm điều riêng của mình – paulm

+2

@paulm: Không có ý tưởng, tôi chỉ cần sử dụng công cụ cho đến khi nó hoạt động ;-) – Cameron

Các vấn đề liên quan