Downgraded the OpenGL context version to 2.1. Qt's QOpenGLPaintDevice is
not compatible with OpenGL versions >= 3.0. NVIDIA does not care, but unfortunately AMD does. Also tweaked some other qt & opengl settings for more pleasant visuals.
This commit is contained in:
@@ -43,9 +43,15 @@ namespace advsettings {
|
||||
}
|
||||
|
||||
QSurfaceFormat format;
|
||||
format.setMajorVersion( 4 );
|
||||
format.setMinorVersion( 1 );
|
||||
format.setProfile( QSurfaceFormat::CompatibilityProfile );
|
||||
// Qt's QOpenGLPaintDevice is not compatible with OpenGL versions >= 3.0
|
||||
// NVIDIA does not care, but unfortunately AMD does
|
||||
// Are subtle changes to the semantics of OpenGL functions actually covered by the compatibility profile,
|
||||
// and this is an AMD bug?
|
||||
format.setVersion(2, 1);
|
||||
//format.setProfile( QSurfaceFormat::CompatibilityProfile );
|
||||
format.setDepthBufferSize(16);
|
||||
format.setStencilBufferSize(8);
|
||||
format.setSamples(16);
|
||||
|
||||
m_pOpenGLContext.reset(new QOpenGLContext());
|
||||
m_pOpenGLContext->setFormat(format);
|
||||
@@ -55,6 +61,7 @@ namespace advsettings {
|
||||
|
||||
// create an offscreen surface to attach the context and FBO to
|
||||
m_pOffscreenSurface.reset(new QOffscreenSurface());
|
||||
m_pOffscreenSurface->setFormat(m_pOpenGLContext->format());
|
||||
m_pOffscreenSurface->create();
|
||||
m_pOpenGLContext->makeCurrent(m_pOffscreenSurface.get());
|
||||
|
||||
@@ -95,7 +102,11 @@ void OverlayController::SetWidget(OverlayWidget *pWidget, const std::string& nam
|
||||
m_pPumpEventsTimer->setInterval(20);
|
||||
m_pPumpEventsTimer->start();
|
||||
|
||||
m_pFbo.reset(new QOpenGLFramebufferObject(pWidget->width(), pWidget->height(), GL_TEXTURE_2D));
|
||||
QOpenGLFramebufferObjectFormat fboFormat;
|
||||
fboFormat.setAttachment(QOpenGLFramebufferObject::CombinedDepthStencil);
|
||||
fboFormat.setTextureTarget(GL_TEXTURE_2D);
|
||||
|
||||
m_pFbo.reset(new QOpenGLFramebufferObject(pWidget->width(), pWidget->height(), fboFormat));
|
||||
|
||||
vr::HmdVector2_t vecWindowSize = {
|
||||
(float)pWidget->width(),
|
||||
@@ -122,6 +133,7 @@ void OverlayController::OnSceneChanged( const QList<QRectF>& ) {
|
||||
|
||||
QOpenGLPaintDevice device(m_pFbo->size());
|
||||
QPainter painter(&device);
|
||||
painter.setRenderHints(QPainter::Antialiasing | QPainter::TextAntialiasing | QPainter::SmoothPixmapTransform);
|
||||
|
||||
m_pScene->render(&painter);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user