mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-10 18:51:21 +03:00
Extend OpenGl_Context to provide GL2.0 core functionality Added 'glext.h' header provided by Khronos group with definitions and GL functions' types. Added OpenGl_GlCoreXX structures with function list to appropriate GL core functionality. Fixed memory leak in OpenGl_Context destructor. Eliminate inclusions of gl.h header Use OpenGl_GlCore11.hxx instead. Removed obsolote M_PI redefinitions. Slightly cleaned up included headers. Reuse definitions from glext.h OpenGl_ArbVBO and OpenGl_ExtFBO originally provide own definitions for OpenGL extensions.
93 lines
2.9 KiB
C++
93 lines
2.9 KiB
C++
// File: OpenGl_Marker.cxx
|
|
// Created: 13 July 2011
|
|
// Author: Sergey ZERCHANINOV
|
|
// Copyright: OPEN CASCADE 2011
|
|
|
|
#include <OpenGl_GlCore11.hxx>
|
|
|
|
#include <OpenGl_Marker.hxx>
|
|
|
|
#include <OpenGl_AspectMarker.hxx>
|
|
#include <OpenGl_Structure.hxx>
|
|
#include <OpenGl_Display.hxx>
|
|
|
|
/*----------------------------------------------------------------------*/
|
|
|
|
void OpenGl_Marker::Render (const Handle(OpenGl_Workspace) &AWorkspace) const
|
|
{
|
|
const OpenGl_AspectMarker *aspect_marker = AWorkspace->AspectMarker( Standard_True );
|
|
|
|
// Use highlight colours
|
|
glColor3fv( (AWorkspace->NamedStatus & OPENGL_NS_HIGHLIGHT)? AWorkspace->HighlightColor->rgb : aspect_marker->Color().rgb );
|
|
|
|
switch ( aspect_marker->Type() )
|
|
{
|
|
case Aspect_TOM_O_POINT :
|
|
{
|
|
const char *str = AWorkspace->GetDisplay()->GetStringForMarker( Aspect_TOM_O, aspect_marker->Scale() );
|
|
glRasterPos3fv( myPoint.xyz );
|
|
AWorkspace->GetDisplay()->SetBaseForMarker();
|
|
glCallLists( strlen( str ), GL_UNSIGNED_BYTE, (const GLubyte *) str );
|
|
}
|
|
case Aspect_TOM_POINT :
|
|
{
|
|
glPointSize( aspect_marker->Scale() );
|
|
glBegin( GL_POINTS );
|
|
glVertex3fv( myPoint.xyz );
|
|
glEnd();
|
|
break;
|
|
}
|
|
default:
|
|
{
|
|
glRasterPos3fv( myPoint.xyz );
|
|
switch ( aspect_marker->Type() )
|
|
{
|
|
case Aspect_TOM_RING1 :
|
|
case Aspect_TOM_RING2 :
|
|
case Aspect_TOM_RING3 :
|
|
{
|
|
const float ADelta = 0.1f;
|
|
float AScale = aspect_marker->Scale();
|
|
float ALimit = 0.f;
|
|
if (aspect_marker->Type() == Aspect_TOM_RING1)
|
|
ALimit = AScale * 0.2f;
|
|
else if (aspect_marker->Type() == Aspect_TOM_RING2)
|
|
ALimit = AScale * 0.5f;
|
|
else
|
|
ALimit = AScale * 0.8f;
|
|
AWorkspace->GetDisplay()->SetBaseForMarker();
|
|
while (AScale > ALimit && AScale >= 1.f)
|
|
{
|
|
const char *str = AWorkspace->GetDisplay()->GetStringForMarker( Aspect_TOM_O, AScale );
|
|
glCallLists( strlen( str ), GL_UNSIGNED_BYTE, (const GLubyte *) str );
|
|
AScale -= ADelta;
|
|
}
|
|
break;
|
|
}
|
|
case Aspect_TOM_USERDEFINED :
|
|
{
|
|
glCallList( openglDisplay->GetUserMarkerListIndex( (int)aspect_marker->Scale() ) );
|
|
break;
|
|
}
|
|
default :
|
|
{
|
|
AWorkspace->GetDisplay()->SetBaseForMarker();
|
|
const char *str = AWorkspace->GetDisplay()->GetStringForMarker( aspect_marker->Type(), aspect_marker->Scale() );
|
|
glCallLists( strlen( str ), GL_UNSIGNED_BYTE, (const GLubyte *)str );
|
|
}
|
|
}
|
|
GLint mode;
|
|
glGetIntegerv( GL_RENDER_MODE, &mode );
|
|
if( mode==GL_FEEDBACK )
|
|
{
|
|
glBegin( GL_POINTS );
|
|
glVertex3fv( myPoint.xyz );
|
|
glEnd();
|
|
/* it is necessary to indicate end of marker information*/
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
/*----------------------------------------------------------------------*/
|