From: kgv Date: Thu, 29 Jan 2015 12:16:09 +0000 (+0300) Subject: 0025758: Visualization, TKOpenGl - texture initialization fails on Intel HD 4600... X-Git-Tag: V6_9_0_beta~149 X-Git-Url: http://git.dev.opencascade.org/gitweb/?p=occt.git;a=commitdiff_plain;h=e3414ada99bbed0eeffb83a11dac980a7f79dd4a 0025758: Visualization, TKOpenGl - texture initialization fails on Intel HD 4600 in ray tracing test Unbind global texture sampler right after its usage. --- diff --git a/src/OpenGl/OpenGl_Text.cxx b/src/OpenGl/OpenGl_Text.cxx index 7d7de531eb..da89880e4c 100755 --- a/src/OpenGl/OpenGl_Text.cxx +++ b/src/OpenGl/OpenGl_Text.cxx @@ -19,7 +19,6 @@ #include #include #include -#include #include #include #include @@ -382,11 +381,6 @@ void OpenGl_Text::Render (const Handle(OpenGl_Workspace)& theWorkspace) const const OpenGl_AspectText* aTextAspect = theWorkspace->AspectText (Standard_True); const Handle(OpenGl_Texture) aPrevTexture = theWorkspace->DisableTexture(); const Handle(OpenGl_Context)& aCtx = theWorkspace->GetGlContext(); - const Handle(OpenGl_Sampler)& aSampler = aCtx->TextureSampler(); - if (!aSampler.IsNull()) - { - aSampler->Unbind (*aCtx); - } if (aCtx->IsGlGreaterEqual (2, 0)) { @@ -424,10 +418,6 @@ void OpenGl_Text::Render (const Handle(OpenGl_Workspace)& theWorkspace) const } // restore aspects - if (!aSampler.IsNull()) - { - aSampler->Bind (*aCtx); - } if (!aPrevTexture.IsNull()) { theWorkspace->EnableTexture (aPrevTexture); @@ -759,13 +749,6 @@ void OpenGl_Text::render (const Handle(OpenGl_PrinterContext)& thePrintCtx, theCtx->core15fwd->glActiveTexture (GL_TEXTURE0); } - // unbind current OpenGL sampler - const Handle(OpenGl_Sampler)& aSampler = theCtx->TextureSampler(); - if (!aSampler.IsNull() && aSampler->IsValid()) - { - aSampler->Unbind (*theCtx); - } - // extra drawings switch (theTextAspect.DisplayType()) { @@ -855,11 +838,5 @@ void OpenGl_Text::render (const Handle(OpenGl_PrinterContext)& thePrintCtx, // model view matrix was modified theCtx->WorldViewState.Pop(); theCtx->ApplyModelViewMatrix(); - - // revert custom OpenGL sampler - if (!aSampler.IsNull() && aSampler->IsValid()) - { - aSampler->Bind (*theCtx); - } #endif } diff --git a/src/OpenGl/OpenGl_Workspace.cxx b/src/OpenGl/OpenGl_Workspace.cxx index fdeaeb52d1..c0e1d1a827 100644 --- a/src/OpenGl/OpenGl_Workspace.cxx +++ b/src/OpenGl/OpenGl_Workspace.cxx @@ -292,6 +292,12 @@ Handle(OpenGl_Texture) OpenGl_Workspace::DisableTexture() return myTextureBound; } + const Handle(OpenGl_Sampler)& aSampler = myGlContext->TextureSampler(); + if (!aSampler.IsNull()) + { + aSampler->Unbind (*myGlContext); + } + #if !defined(GL_ES_VERSION_2_0) // reset texture matrix because some code may expect it is identity GLint aMatrixMode = GL_TEXTURE;