1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-10 18:51:21 +03:00

0032150: Visualization, TKOpenGl - ignore OpenGl_Caps::ffpEnable when FFP is unavailable

OpenGl_Workspace::Activate() now implicitly disables OpenGl_Caps::ffpEnable when it is unsupported.
OpenGl_AspectsSprite::build() now ignores OpenGl_Caps::pntSpritesDisable when Display Lists are unsupported.
This commit is contained in:
kgv 2021-02-20 20:58:33 +03:00 committed by bugmaster
parent 93cdaa76da
commit 9299697997
5 changed files with 32 additions and 8 deletions

View File

@ -253,9 +253,8 @@ void OpenGl_AspectsSprite::build (const Handle(OpenGl_Context)& theCtx,
return; return;
} }
if (!theCtx.IsNull() if (theCtx->core20fwd != NULL
&& theCtx->core20fwd != NULL && (!theCtx->caps->pntSpritesDisable || theCtx->core11 == NULL))
&& !theCtx->caps->pntSpritesDisable)
{ {
// Creating texture resource for using it with point sprites // Creating texture resource for using it with point sprites
Handle(Image_PixMap) anImage = aNewMarkerImage->GetImage(); Handle(Image_PixMap) anImage = aNewMarkerImage->GetImage();
@ -273,7 +272,7 @@ void OpenGl_AspectsSprite::build (const Handle(OpenGl_Context)& theCtx,
} }
} }
} }
else else if (theCtx->core11 != NULL)
{ {
#if !defined(GL_ES_VERSION_2_0) #if !defined(GL_ES_VERSION_2_0)
// Creating list with bitmap for using it in compatibility mode // Creating list with bitmap for using it in compatibility mode

View File

@ -2579,7 +2579,9 @@ void OpenGl_Context::SetLineStipple (const Standard_ShortReal theFactor,
// ======================================================================= // =======================================================================
void OpenGl_Context::SetLineWidth (const Standard_ShortReal theWidth) void OpenGl_Context::SetLineWidth (const Standard_ShortReal theWidth)
{ {
#if !defined(GL_ES_VERSION_2_0)
if (core11 != NULL) if (core11 != NULL)
#endif
{ {
// glLineWidth() is still defined within Core Profile, but has no effect with values != 1.0f // glLineWidth() is still defined within Core Profile, but has no effect with values != 1.0f
core11fwd->glLineWidth (theWidth * myLineWidthScale); core11fwd->glLineWidth (theWidth * myLineWidthScale);

View File

@ -33,8 +33,13 @@
void OpenGl_GlFunctions::load (OpenGl_Context& theCtx, void OpenGl_GlFunctions::load (OpenGl_Context& theCtx,
Standard_Boolean theIsCoreProfile) Standard_Boolean theIsCoreProfile)
{ {
#if defined(GL_ES_VERSION_2_0)
(void )theIsCoreProfile;
theCtx.core11 = NULL;
#else
const bool isCoreProfile = theIsCoreProfile; const bool isCoreProfile = theIsCoreProfile;
theCtx.core11 = !isCoreProfile ? (OpenGl_GlCore11* )this : NULL; theCtx.core11 = !isCoreProfile ? (OpenGl_GlCore11* )this : NULL;
#endif
theCtx.core11fwd = (OpenGl_GlCore11Fwd* )this; theCtx.core11fwd = (OpenGl_GlCore11Fwd* )this;
theCtx.core15 = NULL; theCtx.core15 = NULL;
theCtx.core15fwd = NULL; theCtx.core15fwd = NULL;

View File

@ -123,12 +123,17 @@ OpenGl_TextureFormat OpenGl_TextureFormat::FindFormat (const Handle(OpenGl_Conte
{ {
OpenGl_TextureFormat aFormat; OpenGl_TextureFormat aFormat;
aFormat.SetImageFormat (theFormat); aFormat.SetImageFormat (theFormat);
#if defined(GL_ES_VERSION_2_0)
const bool useRedRedAlpha = false;
#else
const bool useRedRedAlpha = (theCtx->core11 == NULL);
#endif
switch (theFormat) switch (theFormat)
{ {
case Image_Format_GrayF: case Image_Format_GrayF:
{ {
aFormat.SetNbComponents (1); aFormat.SetNbComponents (1);
if (theCtx->core11 == NULL) if (useRedRedAlpha)
{ {
aFormat.SetInternalFormat (theCtx->arbTexFloat ? GL_R32F : GL_R8); aFormat.SetInternalFormat (theCtx->arbTexFloat ? GL_R32F : GL_R8);
aFormat.SetPixelFormat (GL_RED); aFormat.SetPixelFormat (GL_RED);
@ -148,7 +153,7 @@ OpenGl_TextureFormat OpenGl_TextureFormat::FindFormat (const Handle(OpenGl_Conte
case Image_Format_AlphaF: case Image_Format_AlphaF:
{ {
aFormat.SetNbComponents (1); aFormat.SetNbComponents (1);
if (theCtx->core11 == NULL) if (useRedRedAlpha)
{ {
aFormat.SetInternalFormat (theCtx->arbTexFloat ? GL_R32F : GL_R8); aFormat.SetInternalFormat (theCtx->arbTexFloat ? GL_R32F : GL_R8);
aFormat.SetPixelFormat (GL_RED); aFormat.SetPixelFormat (GL_RED);
@ -382,7 +387,7 @@ OpenGl_TextureFormat OpenGl_TextureFormat::FindFormat (const Handle(OpenGl_Conte
case Image_Format_Gray: case Image_Format_Gray:
{ {
aFormat.SetNbComponents (1); aFormat.SetNbComponents (1);
if (theCtx->core11 == NULL) if (useRedRedAlpha)
{ {
aFormat.SetInternalFormat (GL_R8); aFormat.SetInternalFormat (GL_R8);
aFormat.SetPixelFormat (GL_RED); aFormat.SetPixelFormat (GL_RED);
@ -402,7 +407,7 @@ OpenGl_TextureFormat OpenGl_TextureFormat::FindFormat (const Handle(OpenGl_Conte
case Image_Format_Alpha: case Image_Format_Alpha:
{ {
aFormat.SetNbComponents (1); aFormat.SetNbComponents (1);
if (theCtx->core11 == NULL) if (useRedRedAlpha)
{ {
aFormat.SetInternalFormat (GL_R8); aFormat.SetInternalFormat (GL_R8);
aFormat.SetPixelFormat (GL_RED); aFormat.SetPixelFormat (GL_RED);

View File

@ -168,6 +168,19 @@ Standard_Boolean OpenGl_Workspace::Activate()
ViewMatrix_applied = &myDefaultMatrix; ViewMatrix_applied = &myDefaultMatrix;
StructureMatrix_applied = &myDefaultMatrix; StructureMatrix_applied = &myDefaultMatrix;
if (myGlContext->core11 == NULL)
{
if (myGlContext->caps->ffpEnable)
{
#if defined(GL_ES_VERSION_2_0)
Message::SendWarning ("Warning: FFP is unsupported by OpenGL ES");
#else
Message::SendWarning ("Warning: FFP is unsupported by OpenGL Core Profile");
#endif
myGlContext->caps->ffpEnable = false;
}
}
ResetAppliedAspect(); ResetAppliedAspect();
// reset state for safety // reset state for safety