mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-06 18:26:22 +03:00
0025758: Visualization, TKOpenGl - texture initialization fails on Intel HD 4600 in ray tracing test
Unbind global texture sampler right after its usage.
This commit is contained in:
parent
1e99558fbd
commit
e3414ada99
@ -19,7 +19,6 @@
|
|||||||
#include <OpenGl_ShaderManager.hxx>
|
#include <OpenGl_ShaderManager.hxx>
|
||||||
#include <OpenGl_ShaderProgram.hxx>
|
#include <OpenGl_ShaderProgram.hxx>
|
||||||
#include <OpenGl_ShaderStates.hxx>
|
#include <OpenGl_ShaderStates.hxx>
|
||||||
#include <OpenGl_Sampler.hxx>
|
|
||||||
#include <OpenGl_Text.hxx>
|
#include <OpenGl_Text.hxx>
|
||||||
#include <OpenGl_Utils.hxx>
|
#include <OpenGl_Utils.hxx>
|
||||||
#include <OpenGl_Workspace.hxx>
|
#include <OpenGl_Workspace.hxx>
|
||||||
@ -382,11 +381,6 @@ void OpenGl_Text::Render (const Handle(OpenGl_Workspace)& theWorkspace) const
|
|||||||
const OpenGl_AspectText* aTextAspect = theWorkspace->AspectText (Standard_True);
|
const OpenGl_AspectText* aTextAspect = theWorkspace->AspectText (Standard_True);
|
||||||
const Handle(OpenGl_Texture) aPrevTexture = theWorkspace->DisableTexture();
|
const Handle(OpenGl_Texture) aPrevTexture = theWorkspace->DisableTexture();
|
||||||
const Handle(OpenGl_Context)& aCtx = theWorkspace->GetGlContext();
|
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))
|
if (aCtx->IsGlGreaterEqual (2, 0))
|
||||||
{
|
{
|
||||||
@ -424,10 +418,6 @@ void OpenGl_Text::Render (const Handle(OpenGl_Workspace)& theWorkspace) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
// restore aspects
|
// restore aspects
|
||||||
if (!aSampler.IsNull())
|
|
||||||
{
|
|
||||||
aSampler->Bind (*aCtx);
|
|
||||||
}
|
|
||||||
if (!aPrevTexture.IsNull())
|
if (!aPrevTexture.IsNull())
|
||||||
{
|
{
|
||||||
theWorkspace->EnableTexture (aPrevTexture);
|
theWorkspace->EnableTexture (aPrevTexture);
|
||||||
@ -759,13 +749,6 @@ void OpenGl_Text::render (const Handle(OpenGl_PrinterContext)& thePrintCtx,
|
|||||||
theCtx->core15fwd->glActiveTexture (GL_TEXTURE0);
|
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
|
// extra drawings
|
||||||
switch (theTextAspect.DisplayType())
|
switch (theTextAspect.DisplayType())
|
||||||
{
|
{
|
||||||
@ -855,11 +838,5 @@ void OpenGl_Text::render (const Handle(OpenGl_PrinterContext)& thePrintCtx,
|
|||||||
// model view matrix was modified
|
// model view matrix was modified
|
||||||
theCtx->WorldViewState.Pop();
|
theCtx->WorldViewState.Pop();
|
||||||
theCtx->ApplyModelViewMatrix();
|
theCtx->ApplyModelViewMatrix();
|
||||||
|
|
||||||
// revert custom OpenGL sampler
|
|
||||||
if (!aSampler.IsNull() && aSampler->IsValid())
|
|
||||||
{
|
|
||||||
aSampler->Bind (*theCtx);
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -292,6 +292,12 @@ Handle(OpenGl_Texture) OpenGl_Workspace::DisableTexture()
|
|||||||
return myTextureBound;
|
return myTextureBound;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const Handle(OpenGl_Sampler)& aSampler = myGlContext->TextureSampler();
|
||||||
|
if (!aSampler.IsNull())
|
||||||
|
{
|
||||||
|
aSampler->Unbind (*myGlContext);
|
||||||
|
}
|
||||||
|
|
||||||
#if !defined(GL_ES_VERSION_2_0)
|
#if !defined(GL_ES_VERSION_2_0)
|
||||||
// reset texture matrix because some code may expect it is identity
|
// reset texture matrix because some code may expect it is identity
|
||||||
GLint aMatrixMode = GL_TEXTURE;
|
GLint aMatrixMode = GL_TEXTURE;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user