Skip to content

Commit 8bfd75b

Browse files
committed
Add SetSRGBDisabled() to disable sRGB framebuffer
- exposes OpenGl_Caps::sRGBDisable via Display3d API - fixes GL_SRGB8_ALPHA8 texture error on macOS Core Profile - must call before Init()/InitOffscreen()
1 parent 49c2898 commit 8bfd75b

3 files changed

Lines changed: 13 additions & 0 deletions

File tree

src/Visualization/Display3d.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -318,3 +318,13 @@ void Display3d::SetBuffersNoSwap(Standard_Boolean theNoSwap)
318318
// their own buffer swapping.
319319
GetGraphicDriver()->ChangeOptions().buffersNoSwap = theNoSwap;
320320
}
321+
322+
void Display3d::SetSRGBDisabled(Standard_Boolean theDisabled)
323+
{
324+
// Disable sRGB rendering (OFF by default in OCCT).
325+
// When enabled, OCCT won't attempt to create sRGB framebuffers.
326+
// Useful for macOS where GL_SRGB8_ALPHA8 format may not be supported
327+
// in certain contexts.
328+
// Must be called BEFORE Init()/InitOffscreen() to take effect.
329+
GetGraphicDriver()->ChangeOptions().sRGBDisable = theDisabled;
330+
}

src/Visualization/Visualization.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ class Display3d
7474
Standard_EXPORT void SetContextCompatible(Standard_Boolean theCompatible);
7575
Standard_EXPORT void SetFfpEnable(Standard_Boolean theEnabled);
7676
Standard_EXPORT void SetBuffersNoSwap(Standard_Boolean theNoSwap);
77+
Standard_EXPORT void SetSRGBDisabled(Standard_Boolean theDisabled);
7778

7879
Standard_EXPORT Handle_V3d_View& GetView() {return myV3dView;};
7980
Standard_EXPORT Handle_V3d_Viewer& GetViewer() {return myV3dViewer;};

src/Visualization/Visualization.i

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,8 @@ class Display3d {
8989
void SetFfpEnable(bool theEnabled);
9090
%feature("autodoc", "1");
9191
void SetBuffersNoSwap(bool theNoSwap);
92+
%feature("autodoc", "1");
93+
void SetSRGBDisabled(bool theDisabled);
9294
};
9395

9496
%extend Display3d {

0 commit comments

Comments
 (0)