mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-19 13:40:49 +03:00
Compare commits
1 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
1f7f051ed4 |
@@ -458,6 +458,7 @@ void OpenGl_Context::SetReadBuffer (const Standard_Integer theReadBuffer)
|
|||||||
&& arbFBO != NULL)
|
&& arbFBO != NULL)
|
||||||
{
|
{
|
||||||
arbFBO->glBindFramebuffer (GL_FRAMEBUFFER, OpenGl_FrameBuffer::NO_FRAMEBUFFER);
|
arbFBO->glBindFramebuffer (GL_FRAMEBUFFER, OpenGl_FrameBuffer::NO_FRAMEBUFFER);
|
||||||
|
SetActiveFrameBuffer (NULL);
|
||||||
}
|
}
|
||||||
::glReadBuffer (myReadBuffer);
|
::glReadBuffer (myReadBuffer);
|
||||||
#else
|
#else
|
||||||
@@ -477,6 +478,7 @@ void OpenGl_Context::SetDrawBuffer (const Standard_Integer theDrawBuffer)
|
|||||||
&& arbFBO != NULL)
|
&& arbFBO != NULL)
|
||||||
{
|
{
|
||||||
arbFBO->glBindFramebuffer (GL_FRAMEBUFFER, OpenGl_FrameBuffer::NO_FRAMEBUFFER);
|
arbFBO->glBindFramebuffer (GL_FRAMEBUFFER, OpenGl_FrameBuffer::NO_FRAMEBUFFER);
|
||||||
|
SetActiveFrameBuffer (NULL);
|
||||||
}
|
}
|
||||||
::glDrawBuffer (aDrawBuffer);
|
::glDrawBuffer (aDrawBuffer);
|
||||||
|
|
||||||
@@ -517,6 +519,7 @@ void OpenGl_Context::SetDrawBuffers (const Standard_Integer theNb, const Standar
|
|||||||
if (arbFBO != NULL && useDefaultFbo)
|
if (arbFBO != NULL && useDefaultFbo)
|
||||||
{
|
{
|
||||||
arbFBO->glBindFramebuffer (GL_FRAMEBUFFER, OpenGl_FrameBuffer::NO_FRAMEBUFFER);
|
arbFBO->glBindFramebuffer (GL_FRAMEBUFFER, OpenGl_FrameBuffer::NO_FRAMEBUFFER);
|
||||||
|
SetActiveFrameBuffer (NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
myFuncs->glDrawBuffers (theNb, (const GLenum*)theDrawBuffers);
|
myFuncs->glDrawBuffers (theNb, (const GLenum*)theDrawBuffers);
|
||||||
|
@@ -916,6 +916,18 @@ public: //! @name methods to alter or retrieve current state
|
|||||||
//! Bind default Vertex Array Object
|
//! Bind default Vertex Array Object
|
||||||
Standard_EXPORT void BindDefaultVao();
|
Standard_EXPORT void BindDefaultVao();
|
||||||
|
|
||||||
|
//! Active Frame Buffer Object.
|
||||||
|
const Handle(OpenGl_FrameBuffer)& ActiveFrameBuffer() const
|
||||||
|
{
|
||||||
|
return myActiveFbo;
|
||||||
|
}
|
||||||
|
|
||||||
|
//! Setup Active Frame Buffer Object.
|
||||||
|
void SetActiveFrameBuffer (const Handle(OpenGl_FrameBuffer)& theFbo)
|
||||||
|
{
|
||||||
|
myActiveFbo = theFbo;
|
||||||
|
}
|
||||||
|
|
||||||
//! Default Frame Buffer Object.
|
//! Default Frame Buffer Object.
|
||||||
const Handle(OpenGl_FrameBuffer)& DefaultFrameBuffer() const
|
const Handle(OpenGl_FrameBuffer)& DefaultFrameBuffer() const
|
||||||
{
|
{
|
||||||
@@ -1173,6 +1185,7 @@ private: //! @name fields tracking current state
|
|||||||
//!< currently active sampler objects
|
//!< currently active sampler objects
|
||||||
Standard_Integer myActiveMockTextures; //!< currently active mock sampler objects
|
Standard_Integer myActiveMockTextures; //!< currently active mock sampler objects
|
||||||
Handle(OpenGl_FrameBuffer) myDefaultFbo; //!< default Frame Buffer Object
|
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_LineAttributes) myHatchStyles; //!< resource holding predefined hatch styles patterns
|
||||||
Standard_Integer myActiveHatchType; //!< currently activated type of polygon hatch
|
Standard_Integer myActiveHatchType; //!< currently activated type of polygon hatch
|
||||||
Standard_Boolean myHatchIsEnabled; //!< current enabled state of polygon hatching rasterization
|
Standard_Boolean myHatchIsEnabled; //!< current enabled state of polygon hatching rasterization
|
||||||
|
@@ -196,6 +196,7 @@ Standard_Boolean OpenGl_FrameBuffer::Init (const Handle(OpenGl_Context)& theGlCo
|
|||||||
// Build FBO and setup it as texture
|
// Build FBO and setup it as texture
|
||||||
theGlContext->arbFBO->glGenFramebuffers (1, &myGlFBufferId);
|
theGlContext->arbFBO->glGenFramebuffers (1, &myGlFBufferId);
|
||||||
theGlContext->arbFBO->glBindFramebuffer (GL_FRAMEBUFFER, myGlFBufferId);
|
theGlContext->arbFBO->glBindFramebuffer (GL_FRAMEBUFFER, myGlFBufferId);
|
||||||
|
theGlContext->SetActiveFrameBuffer (this);
|
||||||
|
|
||||||
for (Standard_Integer aColorBufferIdx = 0; aColorBufferIdx < myColorTextures.Length(); ++aColorBufferIdx)
|
for (Standard_Integer aColorBufferIdx = 0; aColorBufferIdx < myColorTextures.Length(); ++aColorBufferIdx)
|
||||||
{
|
{
|
||||||
@@ -346,6 +347,7 @@ Standard_Boolean OpenGl_FrameBuffer::Init (const Handle(OpenGl_Context)& theGlCo
|
|||||||
// Build FBO and setup it as texture
|
// Build FBO and setup it as texture
|
||||||
theGlContext->arbFBO->glGenFramebuffers (1, &myGlFBufferId);
|
theGlContext->arbFBO->glGenFramebuffers (1, &myGlFBufferId);
|
||||||
theGlContext->arbFBO->glBindFramebuffer (GL_FRAMEBUFFER, myGlFBufferId);
|
theGlContext->arbFBO->glBindFramebuffer (GL_FRAMEBUFFER, myGlFBufferId);
|
||||||
|
theGlContext->SetActiveFrameBuffer (this);
|
||||||
for (Standard_Integer aColorBufferIdx = 0; aColorBufferIdx < myColorTextures.Length(); ++aColorBufferIdx)
|
for (Standard_Integer aColorBufferIdx = 0; aColorBufferIdx < myColorTextures.Length(); ++aColorBufferIdx)
|
||||||
{
|
{
|
||||||
const Handle(OpenGl_Texture)& aColorTexture = myColorTextures (aColorBufferIdx);
|
const Handle(OpenGl_Texture)& aColorTexture = myColorTextures (aColorBufferIdx);
|
||||||
@@ -512,6 +514,7 @@ Standard_Boolean OpenGl_FrameBuffer::InitWithRB (const Handle(OpenGl_Context)& t
|
|||||||
// create FBO
|
// create FBO
|
||||||
theGlCtx->arbFBO->glGenFramebuffers (1, &myGlFBufferId);
|
theGlCtx->arbFBO->glGenFramebuffers (1, &myGlFBufferId);
|
||||||
theGlCtx->arbFBO->glBindFramebuffer (GL_FRAMEBUFFER, myGlFBufferId);
|
theGlCtx->arbFBO->glBindFramebuffer (GL_FRAMEBUFFER, myGlFBufferId);
|
||||||
|
theGlCtx->SetActiveFrameBuffer (this);
|
||||||
theGlCtx->arbFBO->glFramebufferRenderbuffer (GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
|
theGlCtx->arbFBO->glFramebufferRenderbuffer (GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
|
||||||
GL_RENDERBUFFER, myGlColorRBufferId);
|
GL_RENDERBUFFER, myGlColorRBufferId);
|
||||||
if (myGlDepthRBufferId != NO_RENDERBUFFER)
|
if (myGlDepthRBufferId != NO_RENDERBUFFER)
|
||||||
@@ -692,6 +695,7 @@ void OpenGl_FrameBuffer::BindBuffer (const Handle(OpenGl_Context)& theGlCtx)
|
|||||||
{
|
{
|
||||||
theGlCtx->arbFBO->glBindFramebuffer (GL_FRAMEBUFFER, myGlFBufferId);
|
theGlCtx->arbFBO->glBindFramebuffer (GL_FRAMEBUFFER, myGlFBufferId);
|
||||||
theGlCtx->SetFrameBufferSRGB (true);
|
theGlCtx->SetFrameBufferSRGB (true);
|
||||||
|
theGlCtx->SetActiveFrameBuffer (this);
|
||||||
}
|
}
|
||||||
|
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
@@ -702,6 +706,7 @@ void OpenGl_FrameBuffer::BindDrawBuffer (const Handle(OpenGl_Context)& theGlCtx)
|
|||||||
{
|
{
|
||||||
theGlCtx->arbFBO->glBindFramebuffer (GL_DRAW_FRAMEBUFFER, myGlFBufferId);
|
theGlCtx->arbFBO->glBindFramebuffer (GL_DRAW_FRAMEBUFFER, myGlFBufferId);
|
||||||
theGlCtx->SetFrameBufferSRGB (true);
|
theGlCtx->SetFrameBufferSRGB (true);
|
||||||
|
theGlCtx->SetActiveFrameBuffer (this);
|
||||||
}
|
}
|
||||||
|
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
@@ -711,6 +716,7 @@ void OpenGl_FrameBuffer::BindDrawBuffer (const Handle(OpenGl_Context)& theGlCtx)
|
|||||||
void OpenGl_FrameBuffer::BindReadBuffer (const Handle(OpenGl_Context)& theGlCtx)
|
void OpenGl_FrameBuffer::BindReadBuffer (const Handle(OpenGl_Context)& theGlCtx)
|
||||||
{
|
{
|
||||||
theGlCtx->arbFBO->glBindFramebuffer (GL_READ_FRAMEBUFFER, myGlFBufferId);
|
theGlCtx->arbFBO->glBindFramebuffer (GL_READ_FRAMEBUFFER, myGlFBufferId);
|
||||||
|
theGlCtx->SetActiveFrameBuffer (this);
|
||||||
}
|
}
|
||||||
|
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
@@ -728,6 +734,7 @@ void OpenGl_FrameBuffer::UnbindBuffer (const Handle(OpenGl_Context)& theGlCtx)
|
|||||||
{
|
{
|
||||||
theGlCtx->arbFBO->glBindFramebuffer (GL_FRAMEBUFFER, NO_FRAMEBUFFER);
|
theGlCtx->arbFBO->glBindFramebuffer (GL_FRAMEBUFFER, NO_FRAMEBUFFER);
|
||||||
theGlCtx->SetFrameBufferSRGB (false);
|
theGlCtx->SetFrameBufferSRGB (false);
|
||||||
|
theGlCtx->SetActiveFrameBuffer (NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1269,6 +1269,7 @@ void OpenGl_View::renderStructs (Graphic3d_Camera::Projection theProjection,
|
|||||||
{
|
{
|
||||||
aCtx->arbFBO->glBindFramebuffer (GL_DRAW_FRAMEBUFFER, 0);
|
aCtx->arbFBO->glBindFramebuffer (GL_DRAW_FRAMEBUFFER, 0);
|
||||||
aCtx->SetFrameBufferSRGB (false);
|
aCtx->SetFrameBufferSRGB (false);
|
||||||
|
aCtx->SetActiveFrameBuffer (NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Render non-polygonal elements in default layer
|
// Render non-polygonal elements in default layer
|
||||||
@@ -1285,6 +1286,7 @@ void OpenGl_View::renderStructs (Graphic3d_Camera::Projection theProjection,
|
|||||||
{
|
{
|
||||||
aCtx->arbFBO->glBindFramebuffer (GL_FRAMEBUFFER, 0);
|
aCtx->arbFBO->glBindFramebuffer (GL_FRAMEBUFFER, 0);
|
||||||
aCtx->SetFrameBufferSRGB (false);
|
aCtx->SetFrameBufferSRGB (false);
|
||||||
|
aCtx->SetActiveFrameBuffer (NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reset OpenGl aspects state to default to avoid enabling of
|
// Reset OpenGl aspects state to default to avoid enabling of
|
||||||
@@ -1483,6 +1485,7 @@ bool OpenGl_View::blitBuffers (OpenGl_FrameBuffer* theReadFbo,
|
|||||||
{
|
{
|
||||||
aCtx->arbFBO->glBindFramebuffer (GL_FRAMEBUFFER, OpenGl_FrameBuffer::NO_FRAMEBUFFER);
|
aCtx->arbFBO->glBindFramebuffer (GL_FRAMEBUFFER, OpenGl_FrameBuffer::NO_FRAMEBUFFER);
|
||||||
aCtx->SetFrameBufferSRGB (false);
|
aCtx->SetFrameBufferSRGB (false);
|
||||||
|
aCtx->SetActiveFrameBuffer (NULL);
|
||||||
}
|
}
|
||||||
const Standard_Integer aViewport[4] = { 0, 0, aDrawSizeX, aDrawSizeY };
|
const Standard_Integer aViewport[4] = { 0, 0, aDrawSizeX, aDrawSizeY };
|
||||||
aCtx->ResizeViewport (aViewport);
|
aCtx->ResizeViewport (aViewport);
|
||||||
@@ -1528,6 +1531,7 @@ bool OpenGl_View::blitBuffers (OpenGl_FrameBuffer* theReadFbo,
|
|||||||
}
|
}
|
||||||
aCtx->arbFBO->glBindFramebuffer (GL_DRAW_FRAMEBUFFER, OpenGl_FrameBuffer::NO_FRAMEBUFFER);
|
aCtx->arbFBO->glBindFramebuffer (GL_DRAW_FRAMEBUFFER, OpenGl_FrameBuffer::NO_FRAMEBUFFER);
|
||||||
aCtx->SetFrameBufferSRGB (false);
|
aCtx->SetFrameBufferSRGB (false);
|
||||||
|
aCtx->SetActiveFrameBuffer (NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
// we don't copy stencil buffer here... does it matter for performance?
|
// we don't copy stencil buffer here... does it matter for performance?
|
||||||
@@ -1569,6 +1573,7 @@ bool OpenGl_View::blitBuffers (OpenGl_FrameBuffer* theReadFbo,
|
|||||||
{
|
{
|
||||||
aCtx->arbFBO->glBindFramebuffer (GL_FRAMEBUFFER, OpenGl_FrameBuffer::NO_FRAMEBUFFER);
|
aCtx->arbFBO->glBindFramebuffer (GL_FRAMEBUFFER, OpenGl_FrameBuffer::NO_FRAMEBUFFER);
|
||||||
aCtx->SetFrameBufferSRGB (false);
|
aCtx->SetFrameBufferSRGB (false);
|
||||||
|
aCtx->SetActiveFrameBuffer (NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
Reference in New Issue
Block a user