OpenGl_Context::init() - fix condition on initializing alien OpenGL context within core profile.
OpenGl_Font::renderGlyph() - use GL_RED data format in core profile.
OpenGl_Text::render() - do not use GL_ALPHA_TEST in core profile.
Test-case for issue #26424
isCoreProfile = (theIsCoreProfile == Standard_True);
// detect Core profile
- if (isCoreProfile)
+ if (!isCoreProfile)
{
GLint aProfile = 0;
::glGetIntegerv (GL_CONTEXT_PROFILE_MASK, &aProfile);
return;
}
- // application can not handle this case by exception - this is bug in code
- Standard_ASSERT_RETURN (theCtx != NULL,
- "OpenGl_Font destroyed without GL context! Possible GPU memory leakage...",);
-
for (Standard_Integer anIter = 0; anIter < myTextures.Length(); ++anIter)
{
Handle(OpenGl_Texture)& aTexture = myTextures.ChangeValue (anIter);
+ if (aTexture->IsValid())
+ {
+ // application can not handle this case by exception - this is bug in code
+ Standard_ASSERT_RETURN (theCtx != NULL,
+ "OpenGl_Font destroyed without GL context! Possible GPU memory leakage...",);
+ }
+
aTexture->Release (theCtx);
aTexture.Nullify();
}
myTileSizeY = myFont->GlyphMaxSizeY();
myLastTileId = -1;
- return createTexture (theCtx);
+ if (!createTexture (theCtx))
+ {
+ Release (theCtx.operator->());
+ return false;
+ }
+ return true;
}
// =======================================================================
}
Handle(OpenGl_Texture)& aTexture = myTextures.ChangeLast();
+ if (aTexture.IsNull()
+ || !aTexture->IsValid())
+ {
+ return false;
+ }
const Image_PixMap& anImg = myFont->GlyphImage();
const Standard_Integer aTileId = myLastTileId + 1;
glTexSubImage2D (GL_TEXTURE_2D, 0,
myLastTilePx.Left, myLastTilePx.Top, (GLsizei )anImg.SizeX(), (GLsizei )anImg.SizeY(),
- GL_ALPHA, GL_UNSIGNED_BYTE, anImg.Data());
+ aTexture->GetFormat(), GL_UNSIGNED_BYTE, anImg.Data());
OpenGl_Font::Tile aTile;
aTile.uv.Left = GLfloat(myLastTilePx.Left) / GLfloat(aTexture->SizeX());
aTextAspect->SubtitleColor());
}
+ aCtx->BindProgram (NULL);
+
// restore aspects
if (!aPrevTexture.IsNull())
{
aMsg += "' - initialization of GL resources has failed!";
theCtx->PushMessage (GL_DEBUG_SOURCE_APPLICATION_ARB, GL_DEBUG_TYPE_ERROR_ARB, 0, GL_DEBUG_SEVERITY_HIGH_ARB, aMsg);
aFontFt.Nullify();
+ aFont->Release (theCtx.operator->());
aFont = new OpenGl_Font (aFontFt, theKey);
}
}
theCtx->core15fwd->glActiveTexture (GL_TEXTURE0);
}
#if !defined(GL_ES_VERSION_2_0)
- // setup alpha test
- glAlphaFunc (GL_GEQUAL, 0.285f);
- glEnable (GL_ALPHA_TEST);
-
// activate texture unit
GLint aTexEnvParam = GL_REPLACE;
if (theCtx->core11 != NULL)
{
+ // setup alpha test
+ glAlphaFunc (GL_GEQUAL, 0.285f);
+ glEnable (GL_ALPHA_TEST);
+
glDisable (GL_TEXTURE_1D);
glEnable (GL_TEXTURE_2D);
glGetTexEnviv (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, &aTexEnvParam);
glDisable (GL_BLEND);
glDisable (GL_STENCIL_TEST);
#if !defined(GL_ES_VERSION_2_0)
- glDisable (GL_ALPHA_TEST);
+ if (theCtx->core11 != NULL)
+ {
+ glDisable (GL_ALPHA_TEST);
+ }
glDisable (GL_COLOR_LOGIC_OP);
#endif
--- /dev/null
+puts "========"
+puts "OCC26424"
+puts "========"
+puts ""
+################################################################
+# Text is not rendered within core profile on Windows platform
+################################################################
+
+vcaps -core
+vinit View1
+vclear
+vaxo
+vzbufftrihedron
+
+if { [array get env os_type] != "" } {
+ set os $env(os_type)
+}
+if { [string compare $os "windows"] != 0 } {
+ # Linux platform
+ set ok_color "GRAY85"
+} else {
+ # Windows platform
+ set ok_color "GRAY52"
+}
+
+set bug_info [vreadpixel 71 350 rgb name]
+if {$bug_info != $ok_color} {
+ puts "ERROR: OCC26424 is reproduced. Trihedron does non have text labels."
+}
+
+set only_screen 1