mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-10 18:51:21 +03:00
0031405: Advanced wrappers, C# wrapper - dark colors in WPF sample
D3DHost_FrameBuffer::IsSRGBReady() - added new propery defining if D3D application handles FBO as sRGB-ready texture or not.
This commit is contained in:
parent
fffc249f21
commit
e5c11edd7b
@ -34,7 +34,8 @@ D3DHost_FrameBuffer::D3DHost_FrameBuffer()
|
|||||||
myGlD3dDevice (NULL),
|
myGlD3dDevice (NULL),
|
||||||
myGlD3dSurf (NULL),
|
myGlD3dSurf (NULL),
|
||||||
myLockCount (0),
|
myLockCount (0),
|
||||||
myD3dFallback (Standard_False)
|
myD3dFallback (Standard_False),
|
||||||
|
myIsSRGBReady (Standard_False)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
}
|
}
|
||||||
@ -277,6 +278,7 @@ void D3DHost_FrameBuffer::BindBuffer (const Handle(OpenGl_Context)& theCtx)
|
|||||||
}
|
}
|
||||||
|
|
||||||
OpenGl_FrameBuffer::BindBuffer (theCtx);
|
OpenGl_FrameBuffer::BindBuffer (theCtx);
|
||||||
|
theCtx->SetFrameBufferSRGB (true, myIsSRGBReady);
|
||||||
if (myD3dFallback)
|
if (myD3dFallback)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
|
@ -103,6 +103,13 @@ public:
|
|||||||
//! Returns TRUE if FBO has been initialized without WGL/D3D interop.
|
//! Returns TRUE if FBO has been initialized without WGL/D3D interop.
|
||||||
Standard_Boolean D3dFallback() const { return myD3dFallback; }
|
Standard_Boolean D3dFallback() const { return myD3dFallback; }
|
||||||
|
|
||||||
|
//! Returns TRUE if color buffer is sRGB ready; FALSE by default.
|
||||||
|
//! Requires D3DSAMP_SRGBTEXTURE sampler parameter being set on D3D level for rendering D3D surface.
|
||||||
|
Standard_Boolean IsSRGBReady() const { return myIsSRGBReady; }
|
||||||
|
|
||||||
|
//! Set if color buffer is sRGB ready.
|
||||||
|
void SetSRGBReady (Standard_Boolean theIsReady) { myIsSRGBReady = theIsReady; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
using OpenGl_FrameBuffer::Init;
|
using OpenGl_FrameBuffer::Init;
|
||||||
@ -115,6 +122,7 @@ protected:
|
|||||||
void* myGlD3dSurf; //!< WGL/D3D surface handle
|
void* myGlD3dSurf; //!< WGL/D3D surface handle
|
||||||
Standard_Integer myLockCount; //!< locking counter
|
Standard_Integer myLockCount; //!< locking counter
|
||||||
Standard_Boolean myD3dFallback; //!< indicates that FBO has been initialized without WGL/D3D interop
|
Standard_Boolean myD3dFallback; //!< indicates that FBO has been initialized without WGL/D3D interop
|
||||||
|
Standard_Boolean myIsSRGBReady; //!< indicates that color buffer is sRGB ready
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
@ -517,7 +517,7 @@ void OpenGl_Context::SetDrawBuffers (const Standard_Integer theNb, const Standar
|
|||||||
// function : SetFrameBufferSRGB
|
// function : SetFrameBufferSRGB
|
||||||
// purpose :
|
// purpose :
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
void OpenGl_Context::SetFrameBufferSRGB (bool theIsFbo)
|
void OpenGl_Context::SetFrameBufferSRGB (bool theIsFbo, bool theIsFboSRgb)
|
||||||
{
|
{
|
||||||
if (!hasFboSRGB)
|
if (!hasFboSRGB)
|
||||||
{
|
{
|
||||||
@ -525,7 +525,8 @@ void OpenGl_Context::SetFrameBufferSRGB (bool theIsFbo)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
myIsSRgbActive = ToRenderSRGB()
|
myIsSRgbActive = ToRenderSRGB()
|
||||||
&& (theIsFbo || myIsSRgbWindow);
|
&& (theIsFbo || myIsSRgbWindow)
|
||||||
|
&& theIsFboSRgb;
|
||||||
if (!hasSRGBControl)
|
if (!hasSRGBControl)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
|
@ -584,6 +584,9 @@ public:
|
|||||||
//! (GL_FRAMEBUFFER_SRGB can be considered as always tuned ON).
|
//! (GL_FRAMEBUFFER_SRGB can be considered as always tuned ON).
|
||||||
bool IsWindowSRGB() const { return myIsSRgbWindow; }
|
bool IsWindowSRGB() const { return myIsSRgbWindow; }
|
||||||
|
|
||||||
|
//! Overrides if window/surface buffer is sRGB-ready or not (initialized with the context).
|
||||||
|
void SetWindowSRGB (bool theIsSRgb) { myIsSRgbWindow = theIsSRgb; }
|
||||||
|
|
||||||
//! Convert Quantity_ColorRGBA into vec4
|
//! Convert Quantity_ColorRGBA into vec4
|
||||||
//! with conversion or no conversion into non-linear sRGB
|
//! with conversion or no conversion into non-linear sRGB
|
||||||
//! basing on ToRenderSRGB() flag.
|
//! basing on ToRenderSRGB() flag.
|
||||||
@ -794,7 +797,8 @@ public: //! @name methods to alter or retrieve current state
|
|||||||
//! - FALSE if sRGB rendering is not supported or sRGB-not-ready window buffer is used for drawing.
|
//! - FALSE if sRGB rendering is not supported or sRGB-not-ready window buffer is used for drawing.
|
||||||
//! @param theIsFbo [in] flag indicating writing into offscreen FBO (always expected sRGB-ready when sRGB FBO is supported)
|
//! @param theIsFbo [in] flag indicating writing into offscreen FBO (always expected sRGB-ready when sRGB FBO is supported)
|
||||||
//! or into window buffer (FALSE, sRGB-readiness might vary).
|
//! or into window buffer (FALSE, sRGB-readiness might vary).
|
||||||
Standard_EXPORT void SetFrameBufferSRGB (bool theIsFbo);
|
//! @param theIsSRgb [in] flag indicating off-screen FBO is sRGB-ready
|
||||||
|
Standard_EXPORT void SetFrameBufferSRGB (bool theIsFbo, bool theIsFboSRgb = true);
|
||||||
|
|
||||||
//! Return cached flag indicating writing into color buffer is enabled or disabled (glColorMask).
|
//! Return cached flag indicating writing into color buffer is enabled or disabled (glColorMask).
|
||||||
bool ColorMask() const { return myColorMask; }
|
bool ColorMask() const { return myColorMask; }
|
||||||
|
Loading…
x
Reference in New Issue
Block a user