1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-09-03 14:10:33 +03:00

0029286: Visualization, TKOpenGl - do not update FFP state when OpenGl_Caps::ffpEnable is disabled

This commit is contained in:
kgv
2017-11-02 10:28:01 +03:00
committed by bugmaster
parent 93964cc239
commit dd1ae9df09
4 changed files with 37 additions and 21 deletions

View File

@@ -97,7 +97,8 @@ void OpenGl_View::drawBackground (const Handle(OpenGl_Workspace)& theWorkspace)
{
#if !defined(GL_ES_VERSION_2_0)
GLint aShadingModelOld = GL_SMOOTH;
if (aCtx->core11 != NULL)
if (aCtx->core11 != NULL
&& aCtx->caps->ffpEnable)
{
aCtx->core11fwd->glDisable (GL_LIGHTING);
aCtx->core11fwd->glGetIntegerv (GL_SHADE_MODEL, &aShadingModelOld);
@@ -108,7 +109,8 @@ void OpenGl_View::drawBackground (const Handle(OpenGl_Workspace)& theWorkspace)
myBgGradientArray->Render (theWorkspace);
#if !defined(GL_ES_VERSION_2_0)
if (aCtx->core11 != NULL)
if (aCtx->core11 != NULL
&& aCtx->caps->ffpEnable)
{
aCtx->core11->glShadeModel (aShadingModelOld);
}
@@ -541,7 +543,10 @@ void OpenGl_View::Redraw()
// reset state for safety
aCtx->BindProgram (Handle(OpenGl_ShaderProgram)());
aCtx->ShaderManager()->PushState (Handle(OpenGl_ShaderProgram)());
if (aCtx->caps->ffpEnable)
{
aCtx->ShaderManager()->PushState (Handle(OpenGl_ShaderProgram)());
}
// Swap the buffers
if (toSwap)
@@ -711,7 +716,10 @@ void OpenGl_View::RedrawImmediate()
// reset state for safety
aCtx->BindProgram (Handle(OpenGl_ShaderProgram)());
aCtx->ShaderManager()->PushState (Handle(OpenGl_ShaderProgram)());
if (aCtx->caps->ffpEnable)
{
aCtx->ShaderManager()->PushState (Handle(OpenGl_ShaderProgram)());
}
if (toSwap && !aCtx->caps->buffersNoSwap)
{
@@ -910,7 +918,8 @@ void OpenGl_View::render (Graphic3d_Camera::Projection theProjection,
#if !defined(GL_ES_VERSION_2_0)
// Switch off lighting by default
if (aContext->core11 != NULL)
if (aContext->core11 != NULL
&& aContext->caps->ffpEnable)
{
glDisable(GL_LIGHTING);
}
@@ -1006,7 +1015,10 @@ void OpenGl_View::render (Graphic3d_Camera::Projection theProjection,
// reset FFP state for safety
aContext->BindProgram (Handle(OpenGl_ShaderProgram)());
aContext->ShaderManager()->PushState (Handle(OpenGl_ShaderProgram)());
if (aContext->caps->ffpEnable)
{
aContext->ShaderManager()->PushState (Handle(OpenGl_ShaderProgram)());
}
// ==============================================================
// Step 6: Keep shader manager informed about last View