From 466e3259dd1a3a6440d377058b8c0000a9300011 Mon Sep 17 00:00:00 2001 From: nds Date: Sat, 21 Mar 2020 20:13:55 +0300 Subject: [PATCH] 0031457: Visualization - interface to find an active frame buffer --- src/OpenGl/OpenGl_Context.hxx | 13 +++++++++++++ src/OpenGl/OpenGl_FrameBuffer.cxx | 2 ++ 2 files changed, 15 insertions(+) diff --git a/src/OpenGl/OpenGl_Context.hxx b/src/OpenGl/OpenGl_Context.hxx index 9808544835..dd079ceb72 100644 --- a/src/OpenGl/OpenGl_Context.hxx +++ b/src/OpenGl/OpenGl_Context.hxx @@ -895,6 +895,18 @@ public: //! @name methods to alter or retrieve current state //! Bind default Vertex Array Object Standard_EXPORT void BindDefaultVao(); + //! Active Frame Buffer Object. + const Handle(OpenGl_FrameBuffer)& ActiveFrameBuffer() const + { + return myActiveFbo; + } + + //! Setup Active Frame Buffer Object. + Standard_EXPORT void SetActiveFrameBuffer (const Handle(OpenGl_FrameBuffer)& theFbo) + { + myActiveFbo = theFbo; + } + //! Default Frame Buffer Object. const Handle(OpenGl_FrameBuffer)& DefaultFrameBuffer() const { @@ -1132,6 +1144,7 @@ private: //! @name fields tracking current state //!< currently active sampler objects Standard_Integer myActiveMockTextures; //!< currently active mock sampler objects Handle(OpenGl_FrameBuffer) myDefaultFbo; //!< default Frame Buffer Object + Handle(OpenGl_FrameBuffer) myActiveFbo; //!< active Frame Buffer Object Handle(OpenGl_LineAttributes) myHatchStyles; //!< resource holding predefined hatch styles patterns Handle(OpenGl_Texture) myTextureRgbaBlack;//!< mock black texture returning (0, 0, 0, 0) Handle(OpenGl_Texture) myTextureRgbaWhite;//!< mock white texture returning (1, 1, 1, 1) diff --git a/src/OpenGl/OpenGl_FrameBuffer.cxx b/src/OpenGl/OpenGl_FrameBuffer.cxx index a05e321660..00fd8c2f84 100644 --- a/src/OpenGl/OpenGl_FrameBuffer.cxx +++ b/src/OpenGl/OpenGl_FrameBuffer.cxx @@ -692,6 +692,8 @@ void OpenGl_FrameBuffer::BindBuffer (const Handle(OpenGl_Context)& theGlCtx) { theGlCtx->arbFBO->glBindFramebuffer (GL_FRAMEBUFFER, myGlFBufferId); theGlCtx->SetFrameBufferSRGB (true); + + theGlCtx->SetActiveFrameBuffer (this); } // ======================================================================= -- 2.39.5