1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-19 13:40:49 +03:00

0026122: Visualization, TKOpenGl - clipping and capping is broken when ffp is disabled on Linux

OpenGl_Clipping - do not setup clipping planes using FFP when it is disabled.

OpenGl_ShaderManager - apply 2d texture coordinates transformation in GLSL programs.
OpenGl_Context::SetTextureMatrix() - move texture matrix assignment from OpenGl_Workspace::setTextureParams() to OpenGl_Context.

Add test case demo/samples/dimensionsglsl with FFP turned OFF.
Add test case v3d/glsl/texture_trsf applying texture transformation.

Small correction of test case for issue CR26122
This commit is contained in:
kgv
2015-10-16 08:50:46 +03:00
committed by bugmaster
parent 3a398392b4
commit 79f4f03618
18 changed files with 245 additions and 104 deletions

View File

@@ -29,6 +29,7 @@
#include <OpenGl_FrameBuffer.hxx>
#include <OpenGl_Sampler.hxx>
#include <OpenGl_ShaderManager.hxx>
#include <Graphic3d_TransformUtils.hxx>
#include <Message_Messenger.hxx>
@@ -2584,6 +2585,53 @@ void OpenGl_Context::SetLineWidth (const Standard_ShortReal theWidth)
#endif
}
// =======================================================================
// function : SetTextureMatrix
// purpose :
// =======================================================================
void OpenGl_Context::SetTextureMatrix (const Handle(Graphic3d_TextureParams)& theParams)
{
if (theParams.IsNull())
{
return;
}
else if (!myActiveProgram.IsNull())
{
const GLint aUniLoc = myActiveProgram->GetStateLocation (OpenGl_OCCT_TEXTURE_TRSF2D);
if (aUniLoc == OpenGl_ShaderProgram::INVALID_LOCATION)
{
return;
}
// pack transformation parameters
OpenGl_Vec4 aTrsf[2];
aTrsf[0].xy() = theParams->Translation();
aTrsf[0].zw() = theParams->Scale();
aTrsf[1].x() = std::sin (-theParams->Rotation() * static_cast<float> (M_PI / 180.0));
aTrsf[1].y() = std::cos (-theParams->Rotation() * static_cast<float> (M_PI / 180.0));
myActiveProgram->SetUniform (this, aUniLoc, 2, aTrsf);
return;
}
#if !defined(GL_ES_VERSION_2_0)
if (core11 != NULL)
{
GLint aMatrixMode = GL_TEXTURE;
::glGetIntegerv (GL_MATRIX_MODE, &aMatrixMode);
core11->glMatrixMode (GL_TEXTURE);
OpenGl_Mat4 aTextureMat;
const Graphic3d_Vec2& aScale = theParams->Scale();
const Graphic3d_Vec2& aTrans = theParams->Translation();
Graphic3d_TransformUtils::Scale (aTextureMat, aScale.x(), aScale.y(), 1.0f);
Graphic3d_TransformUtils::Translate (aTextureMat, -aTrans.x(), -aTrans.y(), 0.0f);
Graphic3d_TransformUtils::Rotate (aTextureMat, -theParams->Rotation(), 0.0f, 0.0f, 1.0f);
core11->glLoadMatrixf (aTextureMat);
core11->glMatrixMode (aMatrixMode);
}
#endif
}
// =======================================================================
// function : SetPointSize
// purpose :