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

0025305: Visualization, TKOpenGl - support stipple line aspects within built-in GLSL programs

OpenGl_LineAttributes - drop display lists for stipple lines.
OpenGl_Context - add methods OpenGl_Context::SetTypeOfLine() and OpenGl_Context::SetLineWidth() to setup line aspects.
OpenGl_ShaderManager::prepareStdProgramFlat() - support new bit OpenGl_PO_StippleLine.

vaspects command - add -setlinetype option.
This commit is contained in:
isk
2015-06-08 16:13:31 +03:00
committed by bugmaster
parent 751955d4d7
commit ac116c221f
13 changed files with 282 additions and 114 deletions

View File

@@ -49,6 +49,13 @@
#include <GL/glx.h> // glXGetProcAddress()
#endif
#ifdef HAVE_GL2PS
#include <gl2ps.h>
#ifdef _MSC_VER
#pragma comment (lib, "gl2ps.lib")
#endif
#endif
IMPLEMENT_STANDARD_HANDLE (OpenGl_Context, Standard_Transient)
IMPLEMENT_STANDARD_RTTIEXT(OpenGl_Context, Standard_Transient)
@@ -2411,6 +2418,104 @@ void OpenGl_Context::SetColor4fv (const OpenGl_Vec4& theColor)
#endif
}
// =======================================================================
// function : SetTypeOfLine
// purpose :
// =======================================================================
void OpenGl_Context::SetTypeOfLine (const Aspect_TypeOfLine theType,
const Standard_ShortReal theFactor)
{
Standard_Integer aPattern = 0xFFFF;
switch (theType)
{
case Aspect_TOL_DASH:
{
aPattern = 0xFFC0;
break;
}
case Aspect_TOL_DOT:
{
aPattern = 0xCCCC;
break;
}
case Aspect_TOL_DOTDASH:
{
aPattern = 0xFF18;
break;
}
case Aspect_TOL_SOLID:
{
aPattern = 0xFFFF;
break;
}
case Aspect_TOL_USERDEFINED:
{
aPattern = 0xFF24;
break;
}
}
if (myActiveProgram != NULL)
{
myActiveProgram->SetUniform (this, "uPattern", aPattern);
myActiveProgram->SetUniform (this, "uFactor", theFactor);
return;
}
#if !defined(GL_ES_VERSION_2_0)
if (theType != Aspect_TOL_SOLID)
{
#ifdef HAVE_GL2PS
if (IsFeedback())
{
gl2psEnable (GL2PS_LINE_STIPPLE);
}
#endif
if (core11 != NULL)
{
core11fwd->glEnable (GL_LINE_STIPPLE);
core11->glLineStipple (static_cast<GLint> (theFactor),
static_cast<GLushort> (aPattern));
}
}
else
{
if (core11 != NULL)
{
core11fwd->glDisable (GL_LINE_STIPPLE);
}
#ifdef HAVE_GL2PS
if (IsFeedback())
{
gl2psDisable (GL2PS_LINE_STIPPLE);
}
#endif
}
#endif
}
// =======================================================================
// function : SetLineWidth
// purpose :
// =======================================================================
void OpenGl_Context::SetLineWidth (const Standard_ShortReal theWidth)
{
if (core11 != NULL)
{
// glLineWidth() is still defined within Core Profile, but has no effect with values != 1.0f
core11fwd->glLineWidth (theWidth);
}
#ifdef HAVE_GL2PS
if (IsFeedback())
{
gl2psLineWidth (theWidth);
}
#endif
}
// =======================================================================
// function : SetPointSize
// purpose :