diff --git a/src/Graphic3d/Graphic3d_BufferType.hxx b/src/Graphic3d/Graphic3d_BufferType.hxx index d4e7c5b6f4..8abedb9d17 100644 --- a/src/Graphic3d/Graphic3d_BufferType.hxx +++ b/src/Graphic3d/Graphic3d_BufferType.hxx @@ -15,12 +15,13 @@ #define _Graphic3d_BufferType_H__ //! Define buffers available for dump -typedef enum +enum Graphic3d_BufferType { Graphic3d_BT_RGB, //!< color buffer without alpha component Graphic3d_BT_RGBA, //!< color buffer - Graphic3d_BT_Depth, //!< depth buffer - Graphic3d_BT_RGB_RayTraceHdrLeft //!< left view HDR color buffer for Ray-Tracing -} Graphic3d_BufferType; + Graphic3d_BT_Depth, //!< depth buffer + Graphic3d_BT_RGB_RayTraceHdrLeft, //!< left view HDR color buffer for Ray-Tracing + Graphic3d_BT_Red, //!< color buffer, red channel +}; #endif // _Graphic3d_BufferType_H__ diff --git a/src/OpenGl/OpenGl_FrameBuffer.cxx b/src/OpenGl/OpenGl_FrameBuffer.cxx index 3380c17e1f..a05e321660 100644 --- a/src/OpenGl/OpenGl_FrameBuffer.cxx +++ b/src/OpenGl/OpenGl_FrameBuffer.cxx @@ -779,11 +779,11 @@ Standard_Boolean OpenGl_FrameBuffer::BufferDump (const Handle(OpenGl_Context)& t { #if !defined(GL_ES_VERSION_2_0) case Image_Format_Gray: - aFormat = GL_DEPTH_COMPONENT; + aFormat = theBufferType == Graphic3d_BT_Depth ? GL_DEPTH_COMPONENT : GL_RED; aType = GL_UNSIGNED_BYTE; break; case Image_Format_GrayF: - aFormat = GL_DEPTH_COMPONENT; + aFormat = theBufferType == Graphic3d_BT_Depth ? GL_DEPTH_COMPONENT : GL_RED; aType = GL_FLOAT; break; case Image_Format_RGF: diff --git a/src/V3d/V3d_View.cxx b/src/V3d/V3d_View.cxx index 1b63f491f3..4950ea4cb5 100644 --- a/src/V3d/V3d_View.cxx +++ b/src/V3d/V3d_View.cxx @@ -2700,6 +2700,7 @@ Standard_Boolean V3d_View::ToPixMap (Image_PixMap& theImage, case Graphic3d_BT_RGBA: aFormat = Image_Format_RGBA; break; case Graphic3d_BT_Depth: aFormat = Image_Format_GrayF; break; case Graphic3d_BT_RGB_RayTraceHdrLeft: aFormat = Image_Format_RGBF; break; + case Graphic3d_BT_Red: aFormat = Image_Format_Gray; break; } if (!theImage.InitZero (aFormat, Standard_Size(aTargetSize.x()), Standard_Size(aTargetSize.y()))) diff --git a/src/ViewerTest/ViewerTest.cxx b/src/ViewerTest/ViewerTest.cxx index 6e2a972446..e1885668cd 100644 --- a/src/ViewerTest/ViewerTest.cxx +++ b/src/ViewerTest/ViewerTest.cxx @@ -1157,6 +1157,10 @@ static Standard_Integer VDump (Draw_Interpretor& theDI, { aParams.BufferType = Graphic3d_BT_RGB; } + else if (aBufArg == "red") + { + aParams.BufferType = Graphic3d_BT_Red; + } else if (aBufArg == "depth") { aParams.BufferType = Graphic3d_BT_Depth; @@ -1223,6 +1227,11 @@ static Standard_Integer VDump (Draw_Interpretor& theDI, { aParams.BufferType = Graphic3d_BT_RGB; } + else if (anArg == "-red" + || anArg == "red") + { + aParams.BufferType = Graphic3d_BT_Red; + } else if (anArg == "-depth" || anArg == "depth") { @@ -1303,6 +1312,7 @@ static Standard_Integer VDump (Draw_Interpretor& theDI, case Graphic3d_BT_RGBA: aFormat = Image_Format_RGBA; break; case Graphic3d_BT_Depth: aFormat = Image_Format_GrayF; break; case Graphic3d_BT_RGB_RayTraceHdrLeft: aFormat = Image_Format_RGBF; break; + case Graphic3d_BT_Red: aFormat = Image_Format_Gray; break; } switch (aStereoPair)