mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-06 18:26:22 +03:00
0029286: Visualization, TKOpenGl - do not update FFP state when OpenGl_Caps::ffpEnable is disabled
This commit is contained in:
parent
93964cc239
commit
dd1ae9df09
@ -448,13 +448,6 @@ void OpenGl_PrimitiveArray::drawEdges (const OpenGl_Vec4& theEdgeCo
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !defined(GL_ES_VERSION_2_0)
|
|
||||||
if (aGlContext->core11 != NULL)
|
|
||||||
{
|
|
||||||
glDisable (GL_LIGHTING);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
const OpenGl_AspectLine* anAspectLineOld = theWorkspace->SetAspectLine (theWorkspace->AspectFace()->AspectEdge());
|
const OpenGl_AspectLine* anAspectLineOld = theWorkspace->SetAspectLine (theWorkspace->AspectFace()->AspectEdge());
|
||||||
const OpenGl_AspectLine* anAspect = theWorkspace->ApplyAspectLine();
|
const OpenGl_AspectLine* anAspect = theWorkspace->ApplyAspectLine();
|
||||||
|
|
||||||
@ -474,6 +467,13 @@ void OpenGl_PrimitiveArray::drawEdges (const OpenGl_Vec4& theEdgeCo
|
|||||||
&& aGlContext->ActiveProgram()->HasTessellationStage()
|
&& aGlContext->ActiveProgram()->HasTessellationStage()
|
||||||
? GL_PATCHES
|
? GL_PATCHES
|
||||||
: myDrawMode;
|
: myDrawMode;
|
||||||
|
#if !defined(GL_ES_VERSION_2_0)
|
||||||
|
if (aGlContext->ActiveProgram().IsNull()
|
||||||
|
&& aGlContext->core11 != NULL)
|
||||||
|
{
|
||||||
|
glDisable (GL_LIGHTING);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/// OCC22236 NOTE: draw edges for all situations:
|
/// OCC22236 NOTE: draw edges for all situations:
|
||||||
/// 1) draw elements with GL_LINE style as edges from myPArray->bufferVBO[VBOEdges] indices array
|
/// 1) draw elements with GL_LINE style as edges from myPArray->bufferVBO[VBOEdges] indices array
|
||||||
|
@ -849,7 +849,8 @@ void OpenGl_Text::render (const Handle(OpenGl_Context)& theCtx,
|
|||||||
myExportHeight = aPointSize / myExportHeight;
|
myExportHeight = aPointSize / myExportHeight;
|
||||||
|
|
||||||
#if !defined(GL_ES_VERSION_2_0)
|
#if !defined(GL_ES_VERSION_2_0)
|
||||||
if (theCtx->core11 != NULL)
|
if (theCtx->core11 != NULL
|
||||||
|
&& theCtx->caps->ffpEnable)
|
||||||
{
|
{
|
||||||
glDisable (GL_LIGHTING);
|
glDisable (GL_LIGHTING);
|
||||||
}
|
}
|
||||||
|
@ -97,7 +97,8 @@ void OpenGl_View::drawBackground (const Handle(OpenGl_Workspace)& theWorkspace)
|
|||||||
{
|
{
|
||||||
#if !defined(GL_ES_VERSION_2_0)
|
#if !defined(GL_ES_VERSION_2_0)
|
||||||
GLint aShadingModelOld = GL_SMOOTH;
|
GLint aShadingModelOld = GL_SMOOTH;
|
||||||
if (aCtx->core11 != NULL)
|
if (aCtx->core11 != NULL
|
||||||
|
&& aCtx->caps->ffpEnable)
|
||||||
{
|
{
|
||||||
aCtx->core11fwd->glDisable (GL_LIGHTING);
|
aCtx->core11fwd->glDisable (GL_LIGHTING);
|
||||||
aCtx->core11fwd->glGetIntegerv (GL_SHADE_MODEL, &aShadingModelOld);
|
aCtx->core11fwd->glGetIntegerv (GL_SHADE_MODEL, &aShadingModelOld);
|
||||||
@ -108,7 +109,8 @@ void OpenGl_View::drawBackground (const Handle(OpenGl_Workspace)& theWorkspace)
|
|||||||
myBgGradientArray->Render (theWorkspace);
|
myBgGradientArray->Render (theWorkspace);
|
||||||
|
|
||||||
#if !defined(GL_ES_VERSION_2_0)
|
#if !defined(GL_ES_VERSION_2_0)
|
||||||
if (aCtx->core11 != NULL)
|
if (aCtx->core11 != NULL
|
||||||
|
&& aCtx->caps->ffpEnable)
|
||||||
{
|
{
|
||||||
aCtx->core11->glShadeModel (aShadingModelOld);
|
aCtx->core11->glShadeModel (aShadingModelOld);
|
||||||
}
|
}
|
||||||
@ -541,7 +543,10 @@ void OpenGl_View::Redraw()
|
|||||||
|
|
||||||
// reset state for safety
|
// reset state for safety
|
||||||
aCtx->BindProgram (Handle(OpenGl_ShaderProgram)());
|
aCtx->BindProgram (Handle(OpenGl_ShaderProgram)());
|
||||||
aCtx->ShaderManager()->PushState (Handle(OpenGl_ShaderProgram)());
|
if (aCtx->caps->ffpEnable)
|
||||||
|
{
|
||||||
|
aCtx->ShaderManager()->PushState (Handle(OpenGl_ShaderProgram)());
|
||||||
|
}
|
||||||
|
|
||||||
// Swap the buffers
|
// Swap the buffers
|
||||||
if (toSwap)
|
if (toSwap)
|
||||||
@ -711,7 +716,10 @@ void OpenGl_View::RedrawImmediate()
|
|||||||
|
|
||||||
// reset state for safety
|
// reset state for safety
|
||||||
aCtx->BindProgram (Handle(OpenGl_ShaderProgram)());
|
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)
|
if (toSwap && !aCtx->caps->buffersNoSwap)
|
||||||
{
|
{
|
||||||
@ -910,7 +918,8 @@ void OpenGl_View::render (Graphic3d_Camera::Projection theProjection,
|
|||||||
|
|
||||||
#if !defined(GL_ES_VERSION_2_0)
|
#if !defined(GL_ES_VERSION_2_0)
|
||||||
// Switch off lighting by default
|
// Switch off lighting by default
|
||||||
if (aContext->core11 != NULL)
|
if (aContext->core11 != NULL
|
||||||
|
&& aContext->caps->ffpEnable)
|
||||||
{
|
{
|
||||||
glDisable(GL_LIGHTING);
|
glDisable(GL_LIGHTING);
|
||||||
}
|
}
|
||||||
@ -1006,7 +1015,10 @@ void OpenGl_View::render (Graphic3d_Camera::Projection theProjection,
|
|||||||
|
|
||||||
// reset FFP state for safety
|
// reset FFP state for safety
|
||||||
aContext->BindProgram (Handle(OpenGl_ShaderProgram)());
|
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
|
// Step 6: Keep shader manager informed about last View
|
||||||
|
@ -153,13 +153,13 @@ OpenGl_Workspace::OpenGl_Workspace (OpenGl_View* theView, const Handle(OpenGl_Wi
|
|||||||
#if !defined(GL_ES_VERSION_2_0)
|
#if !defined(GL_ES_VERSION_2_0)
|
||||||
if (myGlContext->core11 != NULL)
|
if (myGlContext->core11 != NULL)
|
||||||
{
|
{
|
||||||
// Eviter d'avoir les faces mal orientees en noir.
|
// enable two-side lighting by default
|
||||||
// Pourrait etre utiliser pour detecter les problemes d'orientation
|
|
||||||
glLightModeli ((GLenum )GL_LIGHT_MODEL_TWO_SIDE, GL_TRUE);
|
glLightModeli ((GLenum )GL_LIGHT_MODEL_TWO_SIDE, GL_TRUE);
|
||||||
|
glHint (GL_POINT_SMOOTH_HINT, GL_FASTEST);
|
||||||
// Optimisation pour le Fog et l'antialiasing
|
if (myGlContext->caps->ffpEnable)
|
||||||
glHint (GL_FOG_HINT, GL_FASTEST);
|
{
|
||||||
glHint (GL_POINT_SMOOTH_HINT, GL_FASTEST);
|
glHint (GL_FOG_HINT, GL_FASTEST);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
glHint (GL_LINE_SMOOTH_HINT, GL_FASTEST);
|
glHint (GL_LINE_SMOOTH_HINT, GL_FASTEST);
|
||||||
@ -197,7 +197,10 @@ Standard_Boolean OpenGl_Workspace::Activate()
|
|||||||
{
|
{
|
||||||
myGlContext->core20fwd->glUseProgram (OpenGl_ShaderProgram::NO_PROGRAM);
|
myGlContext->core20fwd->glUseProgram (OpenGl_ShaderProgram::NO_PROGRAM);
|
||||||
}
|
}
|
||||||
myGlContext->ShaderManager()->PushState (Handle(OpenGl_ShaderProgram)());
|
if (myGlContext->caps->ffpEnable)
|
||||||
|
{
|
||||||
|
myGlContext->ShaderManager()->PushState (Handle(OpenGl_ShaderProgram)());
|
||||||
|
}
|
||||||
return Standard_True;
|
return Standard_True;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user