mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-16 10:08:36 +03:00
0028734: Visualization, OpenGl_Texture - fix initialization of 1D texture
OpenGl_Texture::Init() - fixed proxy check for 1D textures. Declarations.glsl - defined occTexture1D/3D aliases similar to occTexture2D.
This commit is contained in:
parent
b7c18ef8b0
commit
ff6665dc50
@ -413,6 +413,14 @@ bool OpenGl_Texture::Init (const Handle(OpenGl_Context)& theCtx,
|
|||||||
const GLint anIntFormat = theCtx->IsGlGreaterEqual (3, 0) ? theTextFormat : thePixelFormat;
|
const GLint anIntFormat = theCtx->IsGlGreaterEqual (3, 0) ? theTextFormat : thePixelFormat;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
if (theDataType == GL_FLOAT && !theCtx->arbTexFloat)
|
||||||
|
{
|
||||||
|
theCtx->PushMessage (GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_ERROR, 0, GL_DEBUG_SEVERITY_HIGH,
|
||||||
|
"Error: floating-point textures are not supported by hardware.");
|
||||||
|
Release (theCtx.operator->());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
const GLsizei aMaxSize = theCtx->MaxTextureSize();
|
const GLsizei aMaxSize = theCtx->MaxTextureSize();
|
||||||
if (theSizeX > aMaxSize
|
if (theSizeX > aMaxSize
|
||||||
|| theSizeY > aMaxSize)
|
|| theSizeY > aMaxSize)
|
||||||
@ -515,7 +523,7 @@ bool OpenGl_Texture::Init (const Handle(OpenGl_Context)& theCtx,
|
|||||||
glTexImage1D (GL_PROXY_TEXTURE_1D, 0, anIntFormat,
|
glTexImage1D (GL_PROXY_TEXTURE_1D, 0, anIntFormat,
|
||||||
theSizeX, 0,
|
theSizeX, 0,
|
||||||
thePixelFormat, theDataType, NULL);
|
thePixelFormat, theDataType, NULL);
|
||||||
glGetTexLevelParameteriv (GL_PROXY_TEXTURE_2D, 0, GL_TEXTURE_WIDTH, &aTestWidth);
|
glGetTexLevelParameteriv (GL_PROXY_TEXTURE_1D, 0, GL_TEXTURE_WIDTH, &aTestWidth);
|
||||||
if (aTestWidth == 0)
|
if (aTestWidth == 0)
|
||||||
{
|
{
|
||||||
// no memory or broken input parameters
|
// no memory or broken input parameters
|
||||||
@ -540,6 +548,8 @@ bool OpenGl_Texture::Init (const Handle(OpenGl_Context)& theCtx,
|
|||||||
Unbind (theCtx);
|
Unbind (theCtx);
|
||||||
return true;
|
return true;
|
||||||
#else
|
#else
|
||||||
|
theCtx->PushMessage (GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_ERROR, 0, GL_DEBUG_SEVERITY_HIGH,
|
||||||
|
"Error: 1D textures are not supported by hardware.");
|
||||||
Release (theCtx.operator->());
|
Release (theCtx.operator->());
|
||||||
return false;
|
return false;
|
||||||
#endif
|
#endif
|
||||||
|
@ -24,13 +24,17 @@
|
|||||||
#define THE_SHADER_IN in
|
#define THE_SHADER_IN in
|
||||||
#define THE_SHADER_OUT out
|
#define THE_SHADER_OUT out
|
||||||
#define THE_OUT out
|
#define THE_OUT out
|
||||||
|
#define occTexture1D texture
|
||||||
#define occTexture2D texture
|
#define occTexture2D texture
|
||||||
|
#define occTexture3D texture
|
||||||
#else
|
#else
|
||||||
#define THE_ATTRIBUTE attribute
|
#define THE_ATTRIBUTE attribute
|
||||||
#define THE_SHADER_IN varying
|
#define THE_SHADER_IN varying
|
||||||
#define THE_SHADER_OUT varying
|
#define THE_SHADER_OUT varying
|
||||||
#define THE_OUT
|
#define THE_OUT
|
||||||
|
#define occTexture1D texture1D
|
||||||
#define occTexture2D texture2D
|
#define occTexture2D texture2D
|
||||||
|
#define occTexture3D texture3D
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef GL_ES
|
#ifdef GL_ES
|
||||||
|
@ -27,13 +27,17 @@ static const char Shaders_Declarations_glsl[] =
|
|||||||
" #define THE_SHADER_IN in\n"
|
" #define THE_SHADER_IN in\n"
|
||||||
" #define THE_SHADER_OUT out\n"
|
" #define THE_SHADER_OUT out\n"
|
||||||
" #define THE_OUT out\n"
|
" #define THE_OUT out\n"
|
||||||
|
" #define occTexture1D texture\n"
|
||||||
" #define occTexture2D texture\n"
|
" #define occTexture2D texture\n"
|
||||||
|
" #define occTexture3D texture\n"
|
||||||
"#else\n"
|
"#else\n"
|
||||||
" #define THE_ATTRIBUTE attribute\n"
|
" #define THE_ATTRIBUTE attribute\n"
|
||||||
" #define THE_SHADER_IN varying\n"
|
" #define THE_SHADER_IN varying\n"
|
||||||
" #define THE_SHADER_OUT varying\n"
|
" #define THE_SHADER_OUT varying\n"
|
||||||
" #define THE_OUT\n"
|
" #define THE_OUT\n"
|
||||||
|
" #define occTexture1D texture1D\n"
|
||||||
" #define occTexture2D texture2D\n"
|
" #define occTexture2D texture2D\n"
|
||||||
|
" #define occTexture3D texture3D\n"
|
||||||
"#endif\n"
|
"#endif\n"
|
||||||
"\n"
|
"\n"
|
||||||
"#ifdef GL_ES\n"
|
"#ifdef GL_ES\n"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user