diff --git a/src/OpenGl/OpenGl_AspectsSprite.cxx b/src/OpenGl/OpenGl_AspectsSprite.cxx index f991381a89..568a642c1f 100644 --- a/src/OpenGl/OpenGl_AspectsSprite.cxx +++ b/src/OpenGl/OpenGl_AspectsSprite.cxx @@ -253,9 +253,8 @@ void OpenGl_AspectsSprite::build (const Handle(OpenGl_Context)& theCtx, return; } - if (!theCtx.IsNull() - && theCtx->core20fwd != NULL - && !theCtx->caps->pntSpritesDisable) + if (theCtx->core20fwd != NULL + && (!theCtx->caps->pntSpritesDisable || theCtx->core11 == NULL)) { // Creating texture resource for using it with point sprites 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) // Creating list with bitmap for using it in compatibility mode diff --git a/src/OpenGl/OpenGl_Context.cxx b/src/OpenGl/OpenGl_Context.cxx index c649bd9e2b..a580583644 100644 --- a/src/OpenGl/OpenGl_Context.cxx +++ b/src/OpenGl/OpenGl_Context.cxx @@ -2579,7 +2579,9 @@ void OpenGl_Context::SetLineStipple (const Standard_ShortReal theFactor, // ======================================================================= void OpenGl_Context::SetLineWidth (const Standard_ShortReal theWidth) { +#if !defined(GL_ES_VERSION_2_0) if (core11 != NULL) +#endif { // glLineWidth() is still defined within Core Profile, but has no effect with values != 1.0f core11fwd->glLineWidth (theWidth * myLineWidthScale); diff --git a/src/OpenGl/OpenGl_GlFunctions.cxx b/src/OpenGl/OpenGl_GlFunctions.cxx index aaec5276cd..216aa3197e 100644 --- a/src/OpenGl/OpenGl_GlFunctions.cxx +++ b/src/OpenGl/OpenGl_GlFunctions.cxx @@ -33,8 +33,13 @@ void OpenGl_GlFunctions::load (OpenGl_Context& theCtx, Standard_Boolean theIsCoreProfile) { +#if defined(GL_ES_VERSION_2_0) + (void )theIsCoreProfile; + theCtx.core11 = NULL; +#else const bool isCoreProfile = theIsCoreProfile; theCtx.core11 = !isCoreProfile ? (OpenGl_GlCore11* )this : NULL; +#endif theCtx.core11fwd = (OpenGl_GlCore11Fwd* )this; theCtx.core15 = NULL; theCtx.core15fwd = NULL; diff --git a/src/OpenGl/OpenGl_TextureFormat.cxx b/src/OpenGl/OpenGl_TextureFormat.cxx index be055ae72d..b9ad0f03a6 100644 --- a/src/OpenGl/OpenGl_TextureFormat.cxx +++ b/src/OpenGl/OpenGl_TextureFormat.cxx @@ -123,12 +123,17 @@ OpenGl_TextureFormat OpenGl_TextureFormat::FindFormat (const Handle(OpenGl_Conte { OpenGl_TextureFormat aFormat; aFormat.SetImageFormat (theFormat); +#if defined(GL_ES_VERSION_2_0) + const bool useRedRedAlpha = false; +#else + const bool useRedRedAlpha = (theCtx->core11 == NULL); +#endif switch (theFormat) { case Image_Format_GrayF: { aFormat.SetNbComponents (1); - if (theCtx->core11 == NULL) + if (useRedRedAlpha) { aFormat.SetInternalFormat (theCtx->arbTexFloat ? GL_R32F : GL_R8); aFormat.SetPixelFormat (GL_RED); @@ -148,7 +153,7 @@ OpenGl_TextureFormat OpenGl_TextureFormat::FindFormat (const Handle(OpenGl_Conte case Image_Format_AlphaF: { aFormat.SetNbComponents (1); - if (theCtx->core11 == NULL) + if (useRedRedAlpha) { aFormat.SetInternalFormat (theCtx->arbTexFloat ? GL_R32F : GL_R8); aFormat.SetPixelFormat (GL_RED); @@ -382,7 +387,7 @@ OpenGl_TextureFormat OpenGl_TextureFormat::FindFormat (const Handle(OpenGl_Conte case Image_Format_Gray: { aFormat.SetNbComponents (1); - if (theCtx->core11 == NULL) + if (useRedRedAlpha) { aFormat.SetInternalFormat (GL_R8); aFormat.SetPixelFormat (GL_RED); @@ -402,7 +407,7 @@ OpenGl_TextureFormat OpenGl_TextureFormat::FindFormat (const Handle(OpenGl_Conte case Image_Format_Alpha: { aFormat.SetNbComponents (1); - if (theCtx->core11 == NULL) + if (useRedRedAlpha) { aFormat.SetInternalFormat (GL_R8); aFormat.SetPixelFormat (GL_RED); diff --git a/src/OpenGl/OpenGl_Workspace.cxx b/src/OpenGl/OpenGl_Workspace.cxx index d720ec2451..bfe72a4278 100644 --- a/src/OpenGl/OpenGl_Workspace.cxx +++ b/src/OpenGl/OpenGl_Workspace.cxx @@ -168,6 +168,19 @@ Standard_Boolean OpenGl_Workspace::Activate() ViewMatrix_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(); // reset state for safety