From e5b2dec8381ff69bfb89ed9cb2fc38da97cf253f 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 916478e1a4..b1d16e311f 100644 --- a/src/OpenGl/OpenGl_Context.hxx +++ b/src/OpenGl/OpenGl_Context.hxx @@ -916,6 +916,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 { @@ -1173,6 +1185,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 Standard_Integer myActiveHatchType; //!< currently activated type of polygon hatch Standard_Boolean myHatchIsEnabled; //!< current enabled state of polygon hatching rasterization 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