mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-04 18:06:22 +03:00
0029147: Visualization - D3DHost_FrameBuffer::BindBuffer() fails on some Intel drivers
D3DHost_FrameBuffer::BindBuffer() now implicitly detaches Depth+Stencil texture in case of driver failure. D3DHost_View::d3dCreateRenderTarget() now does not request Depth+Stencil texture by default.
This commit is contained in:
parent
6cde53c431
commit
da2a6aee19
@ -97,11 +97,11 @@ Standard_Boolean D3DHost_FrameBuffer::Init (const Handle(OpenGl_Context)& theCtx
|
||||
const Standard_Integer theSizeX,
|
||||
const Standard_Integer theSizeY)
|
||||
{
|
||||
if (InitD3dInterop (theCtx, theD3DDevice, theIsD3dEx, theSizeX, theSizeY))
|
||||
if (InitD3dInterop (theCtx, theD3DDevice, theIsD3dEx, theSizeX, theSizeY, GL_DEPTH24_STENCIL8))
|
||||
{
|
||||
return Standard_True;
|
||||
}
|
||||
return InitD3dFallback (theCtx, theD3DDevice, theIsD3dEx, theSizeX, theSizeY);
|
||||
return InitD3dFallback (theCtx, theD3DDevice, theIsD3dEx, theSizeX, theSizeY, GL_DEPTH24_STENCIL8);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
@ -112,9 +112,10 @@ Standard_Boolean D3DHost_FrameBuffer::InitD3dFallback (const Handle(OpenGl_Conte
|
||||
IDirect3DDevice9* theD3DDevice,
|
||||
const Standard_Boolean theIsD3dEx,
|
||||
const Standard_Integer theSizeX,
|
||||
const Standard_Integer theSizeY)
|
||||
const Standard_Integer theSizeY,
|
||||
const GLint theDepthFormat)
|
||||
{
|
||||
const Standard_Boolean isGlInit = Init (theCtx, theSizeX, theSizeY, GL_RGBA8, GL_DEPTH24_STENCIL8, 0);
|
||||
const Standard_Boolean isGlInit = OpenGl_FrameBuffer::Init (theCtx, theSizeX, theSizeY, GL_RGBA8, theDepthFormat, 0);
|
||||
myD3dFallback = Standard_True;
|
||||
|
||||
const Standard_Integer aSizeX = theSizeX > 0 ? theSizeX : 2;
|
||||
@ -125,7 +126,7 @@ Standard_Boolean D3DHost_FrameBuffer::InitD3dFallback (const Handle(OpenGl_Conte
|
||||
{
|
||||
Release (theCtx.operator->());
|
||||
theCtx->PushMessage (GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_ERROR, 0, GL_DEBUG_SEVERITY_HIGH,
|
||||
TCollection_AsciiString ("D3DHost_FrameBuffer, could not D3DFMT_X8R8G8B8 render target ") + aSizeX + "x" + aSizeY);
|
||||
TCollection_AsciiString ("D3DHost_FrameBuffer, could not create D3DFMT_X8R8G8B8 render target ") + aSizeX + "x" + aSizeY);
|
||||
return Standard_False;
|
||||
}
|
||||
return isGlInit;
|
||||
@ -139,10 +140,12 @@ Standard_Boolean D3DHost_FrameBuffer::InitD3dInterop (const Handle(OpenGl_Contex
|
||||
IDirect3DDevice9* theD3DDevice,
|
||||
const Standard_Boolean theIsD3dEx,
|
||||
const Standard_Integer theSizeX,
|
||||
const Standard_Integer theSizeY)
|
||||
const Standard_Integer theSizeY,
|
||||
const GLint theDepthFormat)
|
||||
{
|
||||
Release (theCtx.operator->());
|
||||
#if !defined(GL_ES_VERSION_2_0)
|
||||
myDepthFormat = theDepthFormat;
|
||||
myVPSizeX = theSizeX;
|
||||
myVPSizeY = theSizeY;
|
||||
myInitVPSizeX = theSizeX;
|
||||
@ -167,7 +170,7 @@ Standard_Boolean D3DHost_FrameBuffer::InitD3dInterop (const Handle(OpenGl_Contex
|
||||
{
|
||||
Release (theCtx.operator->());
|
||||
theCtx->PushMessage (GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_ERROR, 0, GL_DEBUG_SEVERITY_HIGH,
|
||||
TCollection_AsciiString ("D3DHost_FrameBuffer, could not D3DFMT_X8R8G8B8 render target ") + aSizeX + "x" + aSizeY);
|
||||
TCollection_AsciiString ("D3DHost_FrameBuffer, could not create D3DFMT_X8R8G8B8 render target ") + aSizeX + "x" + aSizeY);
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
@ -189,9 +192,13 @@ Standard_Boolean D3DHost_FrameBuffer::InitD3dInterop (const Handle(OpenGl_Contex
|
||||
myIsOwnBuffer = true;
|
||||
myIsOwnDepth = true;
|
||||
theCtx->arbFBO->glGenFramebuffers (1, &myGlFBufferId);
|
||||
if (!myDepthStencilTexture->Init (theCtx, GL_DEPTH24_STENCIL8,
|
||||
GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8,
|
||||
aSizeX, aSizeY, Graphic3d_TOT_2D))
|
||||
|
||||
GLenum aPixelFormat = 0, aDataType = 0;
|
||||
if (myDepthFormat != 0
|
||||
&& getDepthDataFormat (myDepthFormat, aPixelFormat, aDataType)
|
||||
&& !myDepthStencilTexture->Init (theCtx, myDepthFormat,
|
||||
aPixelFormat, aDataType,
|
||||
aSizeX, aSizeY, Graphic3d_TOT_2D))
|
||||
{
|
||||
Release (theCtx.operator->());
|
||||
theCtx->PushMessage (GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_ERROR, 0, GL_DEBUG_SEVERITY_HIGH,
|
||||
@ -206,6 +213,7 @@ Standard_Boolean D3DHost_FrameBuffer::InitD3dInterop (const Handle(OpenGl_Contex
|
||||
(void )theIsD3dEx;
|
||||
(void )theSizeX;
|
||||
(void )theSizeY;
|
||||
(void )theDepthFormat;
|
||||
return Standard_False;
|
||||
#endif
|
||||
}
|
||||
@ -247,6 +255,7 @@ Standard_Boolean D3DHost_FrameBuffer::registerD3dBuffer (const Handle(OpenGl_Con
|
||||
myColorTextures (0)->TextureId(),
|
||||
GL_TEXTURE_2D,
|
||||
WGL_ACCESS_WRITE_DISCARD_NV);
|
||||
theCtx->ResetErrors (true);
|
||||
if (myGlD3dSurf == NULL)
|
||||
{
|
||||
theCtx->PushMessage (GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_ERROR, 0, GL_DEBUG_SEVERITY_HIGH,
|
||||
@ -278,20 +287,54 @@ void D3DHost_FrameBuffer::BindBuffer (const Handle(OpenGl_Context)& theCtx)
|
||||
|
||||
theCtx->arbFBO->glFramebufferTexture2D (GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
|
||||
myColorTextures (0)->GetTarget(), myColorTextures (0)->TextureId(), 0);
|
||||
#ifdef GL_DEPTH_STENCIL_ATTACHMENT
|
||||
theCtx->arbFBO->glFramebufferTexture2D (GL_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT,
|
||||
myDepthStencilTexture->GetTarget(), myDepthStencilTexture->TextureId(), 0);
|
||||
#else
|
||||
theCtx->arbFBO->glFramebufferTexture2D (GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT,
|
||||
myDepthStencilTexture->GetTarget(), myDepthStencilTexture->TextureId(), 0);
|
||||
theCtx->arbFBO->glFramebufferTexture2D (GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT,
|
||||
myDepthStencilTexture->GetTarget(), myDepthStencilTexture->TextureId(), 0);
|
||||
#endif
|
||||
|
||||
GLenum aDepthPixelFormat = 0, aDepthDataType = 0;
|
||||
getDepthDataFormat (myDepthFormat, aDepthPixelFormat, aDepthDataType);
|
||||
if (myDepthStencilTexture->IsValid())
|
||||
{
|
||||
#ifdef GL_DEPTH_STENCIL_ATTACHMENT
|
||||
theCtx->arbFBO->glFramebufferTexture2D (GL_FRAMEBUFFER, aDepthPixelFormat == GL_DEPTH_STENCIL ? GL_DEPTH_STENCIL_ATTACHMENT : GL_DEPTH_ATTACHMENT,
|
||||
myDepthStencilTexture->GetTarget(), myDepthStencilTexture->TextureId(), 0);
|
||||
#else
|
||||
theCtx->arbFBO->glFramebufferTexture2D (GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT,
|
||||
myDepthStencilTexture->GetTarget(), myDepthStencilTexture->TextureId(), 0);
|
||||
if (aDepthPixelFormat == GL_DEPTH_STENCIL)
|
||||
{
|
||||
theCtx->arbFBO->glFramebufferTexture2D (GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT,
|
||||
myDepthStencilTexture->GetTarget(), myDepthStencilTexture->TextureId(), 0);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
if (theCtx->arbFBO->glCheckFramebufferStatus (GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE)
|
||||
{
|
||||
theCtx->PushMessage (GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_ERROR, 0, GL_DEBUG_SEVERITY_HIGH,
|
||||
"D3DHost_FrameBuffer, OpenGL FBO is incomplete!");
|
||||
Release (theCtx.operator->());
|
||||
if (myDepthStencilTexture->IsValid())
|
||||
{
|
||||
#ifdef GL_DEPTH_STENCIL_ATTACHMENT
|
||||
theCtx->arbFBO->glFramebufferTexture2D (GL_FRAMEBUFFER, aDepthPixelFormat == GL_DEPTH_STENCIL ? GL_DEPTH_STENCIL_ATTACHMENT : GL_DEPTH_ATTACHMENT,
|
||||
myDepthStencilTexture->GetTarget(), 0, 0);
|
||||
#else
|
||||
theCtx->arbFBO->glFramebufferTexture2D (GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT,
|
||||
myDepthStencilTexture->GetTarget(), 0, 0);
|
||||
if (aDepthPixelFormat == GL_DEPTH_STENCIL)
|
||||
{
|
||||
theCtx->arbFBO->glFramebufferTexture2D (GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT,
|
||||
myDepthStencilTexture->GetTarget(), 0, 0);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
if (theCtx->arbFBO->glCheckFramebufferStatus (GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE)
|
||||
{
|
||||
theCtx->PushMessage (GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_ERROR, 0, GL_DEBUG_SEVERITY_HIGH,
|
||||
"D3DHost_FrameBuffer, OpenGL FBO is incomplete!");
|
||||
Release (theCtx.operator->());
|
||||
}
|
||||
else
|
||||
{
|
||||
myDepthFormat = 0;
|
||||
myDepthStencilTexture->Release (theCtx.get());
|
||||
theCtx->PushMessage (GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_PORTABILITY, 0, GL_DEBUG_SEVERITY_HIGH,
|
||||
"D3DHost_FrameBuffer, OpenGL FBO is created without Depth+Stencil attachements!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -36,6 +36,13 @@ public:
|
||||
Standard_EXPORT virtual void Release (OpenGl_Context* theCtx) Standard_OVERRIDE;
|
||||
|
||||
//! Initializes OpenGL FBO for Direct3D interoperability or in fallback mode.
|
||||
//! Color pixel format is always GL_RGBA8/D3DFMT_X8R8G8B8, no MSAA; depth-stencil pixel format is GL_DEPTH24_STENCIL8.
|
||||
//! @param theGlCtx currently bound OpenGL context
|
||||
//! @param theD3DDevice d3d9 device
|
||||
//! @param theIsD3dEx d3d9 extended flag (for creating shared texture resource)
|
||||
//! @param theSizeX texture width
|
||||
//! @param theSizeY texture height
|
||||
//! @return true on success
|
||||
Standard_EXPORT Standard_Boolean Init (const Handle(OpenGl_Context)& theCtx,
|
||||
IDirect3DDevice9* theD3DDevice,
|
||||
const Standard_Boolean theIsD3dEx,
|
||||
@ -43,18 +50,36 @@ public:
|
||||
const Standard_Integer theSizeY);
|
||||
|
||||
//! Initializes OpenGL FBO for Direct3D interoperability.
|
||||
//! Color pixel format is always GL_RGBA8/D3DFMT_X8R8G8B8, no MSAA.
|
||||
//! @param theGlCtx currently bound OpenGL context
|
||||
//! @param theD3DDevice d3d9 device
|
||||
//! @param theIsD3dEx d3d9 extended flag (for creating shared texture resource)
|
||||
//! @param theSizeX texture width
|
||||
//! @param theSizeY texture height
|
||||
//! @param theDepthFormat depth-stencil texture sized format (0 means no depth attachment), e.g. GL_DEPTH24_STENCIL8
|
||||
//! @return true on success
|
||||
Standard_EXPORT Standard_Boolean InitD3dInterop (const Handle(OpenGl_Context)& theCtx,
|
||||
IDirect3DDevice9* theD3DDevice,
|
||||
const Standard_Boolean theIsD3dEx,
|
||||
const Standard_Integer theSizeX,
|
||||
const Standard_Integer theSizeY);
|
||||
const Standard_Integer theSizeY,
|
||||
const GLint theDepthFormat);
|
||||
|
||||
//! Initializes OpenGL FBO + Direct3D surface for copying memory using fallback.
|
||||
//! Color pixel format is always GL_RGBA8/D3DFMT_X8R8G8B8, no MSAA.
|
||||
//! @param theGlCtx currently bound OpenGL context
|
||||
//! @param theD3DDevice d3d9 device
|
||||
//! @param theIsD3dEx d3d9 extended flag (for creating shared texture resource)
|
||||
//! @param theSizeX texture width
|
||||
//! @param theSizeY texture height
|
||||
//! @param theDepthFormat depth-stencil texture sized format (0 means no depth attachment), e.g. GL_DEPTH24_STENCIL8
|
||||
//! @return true on success
|
||||
Standard_EXPORT Standard_Boolean InitD3dFallback (const Handle(OpenGl_Context)& theCtx,
|
||||
IDirect3DDevice9* theD3DDevice,
|
||||
const Standard_Boolean theIsD3dEx,
|
||||
const Standard_Integer theSizeX,
|
||||
const Standard_Integer theSizeY);
|
||||
const Standard_Integer theSizeY,
|
||||
const GLint theDepthFormat);
|
||||
|
||||
//! Binds Direct3D color buffer to OpenGL texture.
|
||||
Standard_EXPORT Standard_Boolean registerD3dBuffer (const Handle(OpenGl_Context)& theCtx);
|
||||
|
@ -242,7 +242,8 @@ bool D3DHost_View::d3dCreateRenderTarget()
|
||||
myD3dDevice,
|
||||
myIsD3dEx,
|
||||
myWindow->Width(),
|
||||
myWindow->Height());
|
||||
myWindow->Height(),
|
||||
0); // do not request depth-stencil attachment since buffer will be flipped using addition FBO (myToFlipOutput)
|
||||
}
|
||||
if (toD3dFallback)
|
||||
{
|
||||
@ -250,7 +251,8 @@ bool D3DHost_View::d3dCreateRenderTarget()
|
||||
myD3dDevice,
|
||||
myIsD3dEx,
|
||||
myWindow->Width(),
|
||||
myWindow->Height()))
|
||||
myWindow->Height(),
|
||||
GL_DEPTH24_STENCIL8))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -23,114 +23,6 @@ IMPLEMENT_STANDARD_RTTIEXT(OpenGl_FrameBuffer,OpenGl_Resource)
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
//! Determine data type from texture sized format.
|
||||
static bool getDepthDataFormat (GLint theTextFormat,
|
||||
GLenum& thePixelFormat,
|
||||
GLenum& theDataType)
|
||||
{
|
||||
switch (theTextFormat)
|
||||
{
|
||||
case GL_DEPTH24_STENCIL8:
|
||||
{
|
||||
thePixelFormat = GL_DEPTH_STENCIL;
|
||||
theDataType = GL_UNSIGNED_INT_24_8;
|
||||
return true;
|
||||
}
|
||||
case GL_DEPTH32F_STENCIL8:
|
||||
{
|
||||
thePixelFormat = GL_DEPTH_STENCIL;
|
||||
theDataType = GL_FLOAT_32_UNSIGNED_INT_24_8_REV;
|
||||
return true;
|
||||
}
|
||||
case GL_DEPTH_COMPONENT16:
|
||||
{
|
||||
thePixelFormat = GL_DEPTH_COMPONENT;
|
||||
theDataType = GL_UNSIGNED_SHORT;
|
||||
return true;
|
||||
}
|
||||
case GL_DEPTH_COMPONENT24:
|
||||
{
|
||||
thePixelFormat = GL_DEPTH_COMPONENT;
|
||||
theDataType = GL_UNSIGNED_INT;
|
||||
return true;
|
||||
}
|
||||
case GL_DEPTH_COMPONENT32F:
|
||||
{
|
||||
thePixelFormat = GL_DEPTH_COMPONENT;
|
||||
theDataType = GL_FLOAT;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
//! Determine data type from texture sized format.
|
||||
static bool getColorDataFormat (const Handle(OpenGl_Context)& theGlContext,
|
||||
GLint theTextFormat,
|
||||
GLenum& thePixelFormat,
|
||||
GLenum& theDataType)
|
||||
{
|
||||
switch (theTextFormat)
|
||||
{
|
||||
case GL_RGBA32F:
|
||||
{
|
||||
thePixelFormat = GL_RGBA;
|
||||
theDataType = GL_FLOAT;
|
||||
return true;
|
||||
}
|
||||
case GL_R32F:
|
||||
{
|
||||
thePixelFormat = GL_RED;
|
||||
theDataType = GL_FLOAT;
|
||||
return true;
|
||||
}
|
||||
case GL_RGBA16F:
|
||||
{
|
||||
thePixelFormat = GL_RGBA;
|
||||
theDataType = GL_HALF_FLOAT;
|
||||
if (theGlContext->hasHalfFloatBuffer == OpenGl_FeatureInExtensions)
|
||||
{
|
||||
#if defined(GL_ES_VERSION_2_0)
|
||||
theDataType = GL_HALF_FLOAT_OES;
|
||||
#else
|
||||
theDataType = GL_FLOAT;
|
||||
#endif
|
||||
}
|
||||
return true;
|
||||
}
|
||||
case GL_R16F:
|
||||
{
|
||||
thePixelFormat = GL_RED;
|
||||
theDataType = GL_HALF_FLOAT;
|
||||
if (theGlContext->hasHalfFloatBuffer == OpenGl_FeatureInExtensions)
|
||||
{
|
||||
#if defined(GL_ES_VERSION_2_0)
|
||||
theDataType = GL_HALF_FLOAT_OES;
|
||||
#else
|
||||
theDataType = GL_FLOAT;
|
||||
#endif
|
||||
}
|
||||
return true;
|
||||
}
|
||||
case GL_RGBA8:
|
||||
case GL_RGBA:
|
||||
{
|
||||
thePixelFormat = GL_RGBA;
|
||||
theDataType = GL_UNSIGNED_BYTE;
|
||||
return true;
|
||||
}
|
||||
case GL_RGB8:
|
||||
case GL_RGB:
|
||||
{
|
||||
thePixelFormat = GL_RGB;
|
||||
theDataType = GL_UNSIGNED_BYTE;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
//! Checks whether two format arrays are equal or not.
|
||||
static bool operator== (const OpenGl_ColorFormats& theFmt1,
|
||||
const OpenGl_ColorFormats& theFmt2)
|
||||
@ -148,6 +40,119 @@ namespace
|
||||
}
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : getDepthDataFormat
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
bool OpenGl_FrameBuffer::getDepthDataFormat (GLint theTextFormat,
|
||||
GLenum& thePixelFormat,
|
||||
GLenum& theDataType)
|
||||
{
|
||||
switch (theTextFormat)
|
||||
{
|
||||
case GL_DEPTH24_STENCIL8:
|
||||
{
|
||||
thePixelFormat = GL_DEPTH_STENCIL;
|
||||
theDataType = GL_UNSIGNED_INT_24_8;
|
||||
return true;
|
||||
}
|
||||
case GL_DEPTH32F_STENCIL8:
|
||||
{
|
||||
thePixelFormat = GL_DEPTH_STENCIL;
|
||||
theDataType = GL_FLOAT_32_UNSIGNED_INT_24_8_REV;
|
||||
return true;
|
||||
}
|
||||
case GL_DEPTH_COMPONENT16:
|
||||
{
|
||||
thePixelFormat = GL_DEPTH_COMPONENT;
|
||||
theDataType = GL_UNSIGNED_SHORT;
|
||||
return true;
|
||||
}
|
||||
case GL_DEPTH_COMPONENT24:
|
||||
{
|
||||
thePixelFormat = GL_DEPTH_COMPONENT;
|
||||
theDataType = GL_UNSIGNED_INT;
|
||||
return true;
|
||||
}
|
||||
case GL_DEPTH_COMPONENT32F:
|
||||
{
|
||||
thePixelFormat = GL_DEPTH_COMPONENT;
|
||||
theDataType = GL_FLOAT;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : getColorDataFormat
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
bool OpenGl_FrameBuffer::getColorDataFormat (const Handle(OpenGl_Context)& theGlContext,
|
||||
GLint theTextFormat,
|
||||
GLenum& thePixelFormat,
|
||||
GLenum& theDataType)
|
||||
{
|
||||
switch (theTextFormat)
|
||||
{
|
||||
case GL_RGBA32F:
|
||||
{
|
||||
thePixelFormat = GL_RGBA;
|
||||
theDataType = GL_FLOAT;
|
||||
return true;
|
||||
}
|
||||
case GL_R32F:
|
||||
{
|
||||
thePixelFormat = GL_RED;
|
||||
theDataType = GL_FLOAT;
|
||||
return true;
|
||||
}
|
||||
case GL_RGBA16F:
|
||||
{
|
||||
thePixelFormat = GL_RGBA;
|
||||
theDataType = GL_HALF_FLOAT;
|
||||
if (theGlContext->hasHalfFloatBuffer == OpenGl_FeatureInExtensions)
|
||||
{
|
||||
#if defined(GL_ES_VERSION_2_0)
|
||||
theDataType = GL_HALF_FLOAT_OES;
|
||||
#else
|
||||
theDataType = GL_FLOAT;
|
||||
#endif
|
||||
}
|
||||
return true;
|
||||
}
|
||||
case GL_R16F:
|
||||
{
|
||||
thePixelFormat = GL_RED;
|
||||
theDataType = GL_HALF_FLOAT;
|
||||
if (theGlContext->hasHalfFloatBuffer == OpenGl_FeatureInExtensions)
|
||||
{
|
||||
#if defined(GL_ES_VERSION_2_0)
|
||||
theDataType = GL_HALF_FLOAT_OES;
|
||||
#else
|
||||
theDataType = GL_FLOAT;
|
||||
#endif
|
||||
}
|
||||
return true;
|
||||
}
|
||||
case GL_RGBA8:
|
||||
case GL_RGBA:
|
||||
{
|
||||
thePixelFormat = GL_RGBA;
|
||||
theDataType = GL_UNSIGNED_BYTE;
|
||||
return true;
|
||||
}
|
||||
case GL_RGB8:
|
||||
case GL_RGB:
|
||||
{
|
||||
thePixelFormat = GL_RGB;
|
||||
theDataType = GL_UNSIGNED_BYTE;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : OpenGl_FrameBuffer
|
||||
// purpose :
|
||||
|
@ -266,6 +266,19 @@ protected:
|
||||
return myGlFBufferId != NO_FRAMEBUFFER;
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
//! Determine data type from texture sized format.
|
||||
Standard_EXPORT static bool getDepthDataFormat (GLint theTextFormat,
|
||||
GLenum& thePixelFormat,
|
||||
GLenum& theDataType);
|
||||
|
||||
//! Determine data type from texture sized format.
|
||||
Standard_EXPORT static bool getColorDataFormat (const Handle(OpenGl_Context)& theCtx,
|
||||
GLint theTextFormat,
|
||||
GLenum& thePixelFormat,
|
||||
GLenum& theDataType);
|
||||
|
||||
protected:
|
||||
|
||||
typedef NCollection_Vector<Handle(OpenGl_Texture)> OpenGl_TextureArray;
|
||||
|
Loading…
x
Reference in New Issue
Block a user