Convert m_pOpenGLContext from pointer to object

This commit is contained in:
Vasily
2019-11-30 18:14:49 +01:00
committed by username223
parent 6c04dd25b1
commit 8136569455
2 changed files with 8 additions and 10 deletions
+7 -9
View File
@@ -111,18 +111,17 @@ OverlayController::OverlayController( bool desktopMode,
format.setStencilBufferSize( 8 );
format.setSamples( 16 );
m_pOpenGLContext.reset( new QOpenGLContext() );
m_pOpenGLContext->setFormat( format );
if ( !m_pOpenGLContext->create() )
m_openGLContext.setFormat( format );
if ( !m_openGLContext.create() )
{
throw std::runtime_error( "Could not create OpenGL context" );
}
// create an offscreen surface to attach the context and FBO to
m_pOffscreenSurface.reset( new QOffscreenSurface() );
m_pOffscreenSurface->setFormat( m_pOpenGLContext->format() );
m_pOffscreenSurface->setFormat( m_openGLContext.format() );
m_pOffscreenSurface->create();
m_pOpenGLContext->makeCurrent( m_pOffscreenSurface.get() );
m_openGLContext.makeCurrent( m_pOffscreenSurface.get() );
if ( !vr::VROverlay() )
{
@@ -418,7 +417,6 @@ void OverlayController::Shutdown()
m_pRenderTimer.reset();
}
m_pFbo.reset();
m_pOpenGLContext.reset();
m_pOffscreenSurface.reset();
// save to settings that shutdown was safe
@@ -497,7 +495,7 @@ void OverlayController::SetWidget( QQuickItem* quickItem,
0,
static_cast<int>( quickItem->width() ),
static_cast<int>( quickItem->height() ) );
m_renderControl.initialize( m_pOpenGLContext.get() );
m_renderControl.initialize( &m_openGLContext );
vr::HmdVector2_t vecWindowSize
= { static_cast<float>( quickItem->width() ),
@@ -575,8 +573,8 @@ void OverlayController::renderOverlay()
#endif
vr::VROverlay()->SetOverlayTexture( m_ulOverlayHandle, &texture );
}
m_pOpenGLContext->functions()->glFlush(); // We need to flush otherwise
// the texture may be empty.*/
m_openGLContext.functions()->glFlush(); // We need to flush otherwise
// the texture may be empty.*/
}
}
+1 -1
View File
@@ -109,7 +109,7 @@ private:
QQuickRenderControl m_renderControl;
QQuickWindow m_window{ &m_renderControl };
std::unique_ptr<QOpenGLFramebufferObject> m_pFbo;
std::unique_ptr<QOpenGLContext> m_pOpenGLContext;
QOpenGLContext m_openGLContext;
std::unique_ptr<QOffscreenSurface> m_pOffscreenSurface;
std::unique_ptr<QTimer> m_pPumpEventsTimer;