Back to index

salome-gui  6.5.0
Defines | Functions
OCCViewer_Trihedron.cxx File Reference
#include <GL/gl.h>
#include "OCCViewer_Trihedron.h"
#include <SUIT_ResourceMgr.h>
#include <SUIT_Session.h>
#include <Graphic3d_AspectFillArea3d.hxx>
#include <Graphic3d_Group.hxx>
#include <Graphic3d_MaterialAspect.hxx>
#include <Prs3d_Presentation.hxx>
#include <Prs3d_Root.hxx>
#include <PrsMgr_PresentationManager3d.hxx>
#include <GL/glx.h>

Go to the source code of this file.

Defines

#define PI   3.14159265359

Functions

GLuint generateTextList ()
 Generates text list.
void drawText (GLuint theTextList, const char *theText, GLdouble thePosition[3], GLfloat theColor[3])
 Draws text string.

Define Documentation

#define PI   3.14159265359

Definition at line 46 of file OCCViewer_Trihedron.cxx.


Function Documentation

void drawText ( GLuint  theTextList,
const char *  theText,
GLdouble  thePosition[3],
GLfloat  theColor[3] 
)

Draws text string.

Definition at line 162 of file OCCViewer_Trihedron.cxx.

{
  glColor3fv( theColor );
  glRasterPos3dv( thePosition );
  glListBase( theTextList );
  glCallLists( strlen( theText ), GL_UNSIGNED_BYTE, (GLubyte*)theText );
}

Here is the caller graph for this function:

GLuint generateTextList ( )

Generates text list.

Definition at line 110 of file OCCViewer_Trihedron.cxx.

{
  bool ok = false;
  GLuint aList = glGenLists( 256 );

#ifdef WIN32
  HGLRC hglrc = wglGetCurrentContext();
  if( hglrc )
  {
    HDC hdc = ::wglGetCurrentDC();
    HFONT font = CreateFont( -12, 0, 0, 0, 
                             FW_BOLD,
                             0, 0, 0,
                             ANSI_CHARSET,
                             OUT_TT_PRECIS,
                             CLIP_DEFAULT_PRECIS,
                             ANTIALIASED_QUALITY,
                             FF_DONTCARE | DEFAULT_PITCH,
                             "Courier New" );
    HFONT oldFont = (HFONT)SelectObject( hdc, font );

    ok = ::wglUseFontBitmaps( hdc, 0, 256, aList );
    SelectObject( hdc, oldFont );
    DeleteObject( font );
  }
#else // X Window
  Display* dpy = glXGetCurrentDisplay();
  if( dpy )
  {
    int aFontCount = 0;
    char** aFontList = XListFonts( dpy, "*-courier-*", 1, &aFontCount  );
    if( aFontCount > 0 )
    {
      //XFontStruct* fontInfo = XLoadQueryFont( dpy, "-*-courier-*-r-*-*-14-*-*-*-m-*-*-*" );
      Font aFont = XLoadFont( dpy, aFontList[0] );
      glXUseXFont( aFont, 0, 256, aList );
      XUnloadFont( dpy, aFont );
      ok = true;
    }
    XFreeFontNames( aFontList );
  }
#endif

  if( !ok )
    glDeleteLists( aList, 256 );

  return aList;
}

Here is the caller graph for this function: