git-svn-id: svn://db.shs.com.ru/libs@540 a8b55f48-bf90-11e4-a774-851b48703e85
This commit is contained in:
@@ -7,12 +7,26 @@
|
||||
|
||||
OpenGLWindow::OpenGLWindow(QWindow *parent)
|
||||
: QWindow(parent)
|
||||
, m_animating(false)
|
||||
, m_context(nullptr)
|
||||
, m_device(nullptr)
|
||||
{
|
||||
setFlag(Qt::FramelessWindowHint);
|
||||
setSurfaceType(QWindow::OpenGLSurface);
|
||||
QSurfaceFormat format = QSurfaceFormat::defaultFormat();
|
||||
// qDebug() << format;
|
||||
#ifdef QT_OPENGL_ES_2
|
||||
format.setRenderableType(QSurfaceFormat::OpenGLES);
|
||||
#else
|
||||
if (QOpenGLContext::openGLModuleType() == QOpenGLContext::LibGL) {
|
||||
format.setVersion(2, 0);
|
||||
format.setProfile(QSurfaceFormat::NoProfile);
|
||||
}
|
||||
#endif
|
||||
format.setDepthBufferSize(24);
|
||||
// format.setSamples(4);
|
||||
// format.setStencilBufferSize(8);
|
||||
setFormat(format);
|
||||
QSurfaceFormat::setDefaultFormat(format);
|
||||
}
|
||||
|
||||
|
||||
@@ -77,13 +91,5 @@ void OpenGLWindow::renderNow() {
|
||||
}
|
||||
render();
|
||||
m_context->swapBuffers(this);
|
||||
if (m_animating)
|
||||
renderLater();
|
||||
}
|
||||
|
||||
|
||||
void OpenGLWindow::setAnimating(bool animating) {
|
||||
m_animating = animating;
|
||||
if (animating) renderLater();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user