mirror of
https://github.com/NGSolve/netgen.git
synced 2025-01-27 13:20:34 +05:00
prepare for togl2.0
This commit is contained in:
parent
975d220350
commit
7d961851fb
@ -31,13 +31,6 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#ifndef NOTCL
|
|
||||||
// #include <togl.h>
|
|
||||||
// #include "../../togl/togl.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// part of OpenGL 1.2, but not in Microsoft's OpenGL 1.1 header:
|
// part of OpenGL 1.2, but not in Microsoft's OpenGL 1.1 header:
|
||||||
// GL version sould be checked at runtime
|
// GL version sould be checked at runtime
|
||||||
|
@ -29,7 +29,15 @@ namespace netgen
|
|||||||
Point3d VisualScene :: center;
|
Point3d VisualScene :: center;
|
||||||
double VisualScene :: rad;
|
double VisualScene :: rad;
|
||||||
GLdouble VisualScene :: backcolor;
|
GLdouble VisualScene :: backcolor;
|
||||||
|
|
||||||
|
/*
|
||||||
|
#if TOGL_MAJOR_VERSION!=2
|
||||||
GLuint VisualScene :: fontbase = 0;
|
GLuint VisualScene :: fontbase = 0;
|
||||||
|
#else
|
||||||
|
Tcl_Obj * VisualScene :: fontbase = NULL;
|
||||||
|
Togl * VisualScene :: globtogl;
|
||||||
|
#endif
|
||||||
|
*/
|
||||||
|
|
||||||
// texture for color decoding
|
// texture for color decoding
|
||||||
// GLubyte * VisualScene :: colortexture = NULL;
|
// GLubyte * VisualScene :: colortexture = NULL;
|
||||||
@ -740,7 +748,7 @@ namespace netgen
|
|||||||
glColor3fv (textcol);
|
glColor3fv (textcol);
|
||||||
|
|
||||||
glPushAttrib (GL_LIST_BIT);
|
glPushAttrib (GL_LIST_BIT);
|
||||||
glListBase (fontbase);
|
// glListBase (fontbase);
|
||||||
|
|
||||||
char buf[20];
|
char buf[20];
|
||||||
for (int i = 0; i <= 4; i++)
|
for (int i = 0; i <= 4; i++)
|
||||||
@ -755,7 +763,8 @@ namespace netgen
|
|||||||
val = minval + i * (maxval-minval) / 4;
|
val = minval + i * (maxval-minval) / 4;
|
||||||
|
|
||||||
sprintf (buf, "%8.3e", val);
|
sprintf (buf, "%8.3e", val);
|
||||||
glCallLists (GLsizei(strlen (buf)), GL_UNSIGNED_BYTE, buf);
|
// glCallLists (GLsizei(strlen (buf)), GL_UNSIGNED_BYTE, buf);
|
||||||
|
MyOpenGLText (buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
glPopAttrib ();
|
glPopAttrib ();
|
||||||
@ -808,19 +817,22 @@ namespace netgen
|
|||||||
glEnd ();
|
glEnd ();
|
||||||
|
|
||||||
glPushAttrib (GL_LIST_BIT);
|
glPushAttrib (GL_LIST_BIT);
|
||||||
glListBase (fontbase);
|
// glListBase (fontbase);
|
||||||
|
|
||||||
char buf[20];
|
char buf[20];
|
||||||
|
|
||||||
glRasterPos3d (len, 0.0f, 0.0f);
|
glRasterPos3d (len, 0.0f, 0.0f);
|
||||||
sprintf (buf, "x");
|
sprintf (buf, "x");
|
||||||
glCallLists (GLsizei(strlen (buf)), GL_UNSIGNED_BYTE, buf);
|
// glCallLists (GLsizei(strlen (buf)), GL_UNSIGNED_BYTE, buf);
|
||||||
|
MyOpenGLText (buf);
|
||||||
glRasterPos3d (0.0f, len, 0.0f);
|
glRasterPos3d (0.0f, len, 0.0f);
|
||||||
sprintf (buf, "y");
|
sprintf (buf, "y");
|
||||||
glCallLists (GLsizei(strlen (buf)), GL_UNSIGNED_BYTE, buf);
|
// glCallLists (GLsizei(strlen (buf)), GL_UNSIGNED_BYTE, buf);
|
||||||
|
MyOpenGLText (buf);
|
||||||
glRasterPos3d (0.0f, 0.0f, len);
|
glRasterPos3d (0.0f, 0.0f, len);
|
||||||
sprintf (buf, "z");
|
sprintf (buf, "z");
|
||||||
glCallLists (GLsizei(strlen (buf)), GL_UNSIGNED_BYTE, buf);
|
// glCallLists (GLsizei(strlen (buf)), GL_UNSIGNED_BYTE, buf);
|
||||||
|
MyOpenGLText (buf);
|
||||||
|
|
||||||
glPopAttrib ();
|
glPopAttrib ();
|
||||||
|
|
||||||
@ -865,12 +877,13 @@ namespace netgen
|
|||||||
glLineWidth (1.0f);
|
glLineWidth (1.0f);
|
||||||
|
|
||||||
glPushAttrib (GL_LIST_BIT);
|
glPushAttrib (GL_LIST_BIT);
|
||||||
glListBase (fontbase);
|
// glListBase (fontbase);
|
||||||
|
|
||||||
char buf[] = "Netgen " PACKAGE_VERSION;
|
char buf[] = "Netgen " PACKAGE_VERSION;
|
||||||
|
|
||||||
glRasterPos3d (0.0f, 0.0f, 0.0f);
|
glRasterPos3d (0.0f, 0.0f, 0.0f);
|
||||||
glCallLists (GLsizei(strlen (buf)), GL_UNSIGNED_BYTE, buf);
|
// glCallLists (GLsizei(strlen (buf)), GL_UNSIGNED_BYTE, buf);
|
||||||
|
MyOpenGLText (buf);
|
||||||
|
|
||||||
glPopAttrib ();
|
glPopAttrib ();
|
||||||
|
|
||||||
@ -1310,7 +1323,7 @@ namespace netgen
|
|||||||
glColor3fv (textcol);
|
glColor3fv (textcol);
|
||||||
glNormal3d (0, 0, 1);
|
glNormal3d (0, 0, 1);
|
||||||
glPushAttrib (GL_LIST_BIT);
|
glPushAttrib (GL_LIST_BIT);
|
||||||
glListBase (fontbase);
|
// glListBase (fontbase);
|
||||||
|
|
||||||
char buf[20];
|
char buf[20];
|
||||||
for (int i = 1; i <= mesh->GetNSeg(); i++)
|
for (int i = 1; i <= mesh->GetNSeg(); i++)
|
||||||
@ -1323,7 +1336,8 @@ namespace netgen
|
|||||||
glRasterPos3d (p.X(), p.Y(), p.Z());
|
glRasterPos3d (p.X(), p.Y(), p.Z());
|
||||||
|
|
||||||
sprintf (buf, "%d", seg.edgenr);
|
sprintf (buf, "%d", seg.edgenr);
|
||||||
glCallLists (GLsizei(strlen (buf)), GL_UNSIGNED_BYTE, buf);
|
// glCallLists (GLsizei(strlen (buf)), GL_UNSIGNED_BYTE, buf);
|
||||||
|
MyOpenGLText (buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
glPopAttrib ();
|
glPopAttrib ();
|
||||||
@ -1380,7 +1394,7 @@ namespace netgen
|
|||||||
glColor3fv (textcol);
|
glColor3fv (textcol);
|
||||||
glNormal3d (0, 0, 1);
|
glNormal3d (0, 0, 1);
|
||||||
glPushAttrib (GL_LIST_BIT);
|
glPushAttrib (GL_LIST_BIT);
|
||||||
glListBase (fontbase);
|
// glListBase (fontbase);
|
||||||
|
|
||||||
char buf[20];
|
char buf[20];
|
||||||
for (int i = 1; i <= mesh->GetNP(); i++)
|
for (int i = 1; i <= mesh->GetNP(); i++)
|
||||||
@ -1389,7 +1403,8 @@ namespace netgen
|
|||||||
glRasterPos3d (p.X(), p.Y(), p.Z());
|
glRasterPos3d (p.X(), p.Y(), p.Z());
|
||||||
|
|
||||||
sprintf (buf, "%d", i);
|
sprintf (buf, "%d", i);
|
||||||
glCallLists (GLsizei(strlen (buf)), GL_UNSIGNED_BYTE, buf);
|
// glCallLists (GLsizei(strlen (buf)), GL_UNSIGNED_BYTE, buf);
|
||||||
|
MyOpenGLText (buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
glPopAttrib ();
|
glPopAttrib ();
|
||||||
|
@ -15,6 +15,8 @@ namespace netgen
|
|||||||
extern void Render ();
|
extern void Render ();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class VisualScene
|
class VisualScene
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
@ -42,8 +44,6 @@ namespace netgen
|
|||||||
static int selecttimestamp;
|
static int selecttimestamp;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static GLuint fontbase;
|
|
||||||
// static Tcl_Obj* fontbase; // Togl 2.0
|
|
||||||
|
|
||||||
// static GLubyte * colortexture;
|
// static GLubyte * colortexture;
|
||||||
static GLuint coltexname;
|
static GLuint coltexname;
|
||||||
@ -93,6 +93,10 @@ namespace netgen
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
extern void MyOpenGLText (const char * text);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class VisualSceneGeometry : public VisualScene
|
class VisualSceneGeometry : public VisualScene
|
||||||
{
|
{
|
||||||
Array<int> trilists;
|
Array<int> trilists;
|
||||||
|
@ -419,7 +419,7 @@ namespace netgen
|
|||||||
glColor3fv (textcol);
|
glColor3fv (textcol);
|
||||||
glNormal3d (0, 0, 1);
|
glNormal3d (0, 0, 1);
|
||||||
glPushAttrib (GL_LIST_BIT);
|
glPushAttrib (GL_LIST_BIT);
|
||||||
glListBase (fontbase);
|
// glListBase (fontbase);
|
||||||
|
|
||||||
char buf[30];
|
char buf[30];
|
||||||
|
|
||||||
@ -431,7 +431,8 @@ namespace netgen
|
|||||||
|
|
||||||
sprintf (buf, "%d", i);
|
sprintf (buf, "%d", i);
|
||||||
|
|
||||||
glCallLists (strlen (buf), GL_UNSIGNED_BYTE, buf);
|
// glCallLists (strlen (buf), GL_UNSIGNED_BYTE, buf);
|
||||||
|
MyOpenGLText (buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (vispar.drawedgenumbers)
|
if (vispar.drawedgenumbers)
|
||||||
@ -462,7 +463,9 @@ namespace netgen
|
|||||||
glRasterPos3d (p.X(), p.Y(), p.Z());
|
glRasterPos3d (p.X(), p.Y(), p.Z());
|
||||||
|
|
||||||
sprintf (buf, "%d", i);
|
sprintf (buf, "%d", i);
|
||||||
glCallLists (strlen (buf), GL_UNSIGNED_BYTE, buf);
|
// glCallLists (strlen (buf), GL_UNSIGNED_BYTE, buf);
|
||||||
|
MyOpenGLText (buf);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -493,7 +496,8 @@ namespace netgen
|
|||||||
|
|
||||||
glRasterPos3d (p.X(), p.Y(), p.Z());
|
glRasterPos3d (p.X(), p.Y(), p.Z());
|
||||||
sprintf (buf, "%d", i);
|
sprintf (buf, "%d", i);
|
||||||
glCallLists (strlen (buf), GL_UNSIGNED_BYTE, buf);
|
// glCallLists (strlen (buf), GL_UNSIGNED_BYTE, buf);
|
||||||
|
MyOpenGLText (buf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -577,7 +581,8 @@ namespace netgen
|
|||||||
|
|
||||||
glRasterPos3d (p.X(), p.Y(), p.Z());
|
glRasterPos3d (p.X(), p.Y(), p.Z());
|
||||||
sprintf (buf, "%d", i);
|
sprintf (buf, "%d", i);
|
||||||
glCallLists (strlen (buf), GL_UNSIGNED_BYTE, buf);
|
// glCallLists (strlen (buf), GL_UNSIGNED_BYTE, buf);
|
||||||
|
MyOpenGLText (buf);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,8 +6,13 @@ set oldmousey 0
|
|||||||
#
|
#
|
||||||
|
|
||||||
# if { 1 } {
|
# if { 1 } {
|
||||||
|
|
||||||
|
# if {[catch {togl .ndraw -width 400 -height 300 -rgba true -double true -depth true -privatecmap false -stereo false -indirect true -create create_cb -display display_cb -reshape reshape_cb }] } {
|
||||||
|
# puts "no OpenGL20"
|
||||||
|
# } {
|
||||||
|
|
||||||
if {[catch {togl .ndraw -width 400 -height 300 -rgba true -double true -depth true -privatecmap false -stereo false -indirect true }] } {
|
if {[catch {togl .ndraw -width 400 -height 300 -rgba true -double true -depth true -privatecmap false -stereo false -indirect true }] } {
|
||||||
puts "no OpenGL"
|
puts "no OpenGL"
|
||||||
} {
|
} {
|
||||||
#
|
#
|
||||||
pack .ndraw -expand true -fill both -padx 10 -pady 10
|
pack .ndraw -expand true -fill both -padx 10 -pady 10
|
||||||
|
@ -5,9 +5,9 @@ if {[catch {package require Tix } result ]} {
|
|||||||
puts "error : $result"
|
puts "error : $result"
|
||||||
}
|
}
|
||||||
|
|
||||||
# if {[catch {package require Togl 2.0 }]} {
|
# if {[catch {package require Togl } result ]} {
|
||||||
# puts "cannot find package Togl 2.0"
|
# puts "cannot find package Togl 2.0"
|
||||||
# }
|
# puts "error : $result"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
12
ng/ngpkg.cpp
12
ng/ngpkg.cpp
@ -3116,10 +3116,20 @@ namespace netgen
|
|||||||
|
|
||||||
|
|
||||||
// Togl
|
// Togl
|
||||||
|
|
||||||
|
static int fontbase = 0;
|
||||||
|
|
||||||
|
void MyOpenGLText (const char * text)
|
||||||
|
{
|
||||||
|
glListBase (fontbase);
|
||||||
|
glCallLists (GLsizei(strlen(text)), GL_UNSIGNED_BYTE, text);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static void init( struct Togl *togl )
|
static void init( struct Togl *togl )
|
||||||
{
|
{
|
||||||
VisualScene::fontbase = Togl_LoadBitmapFont( togl, TOGL_BITMAP_8_BY_13 );
|
fontbase = Togl_LoadBitmapFont( togl, TOGL_BITMAP_8_BY_13 );
|
||||||
|
|
||||||
glMatrixMode(GL_PROJECTION);
|
glMatrixMode(GL_PROJECTION);
|
||||||
glLoadIdentity();
|
glLoadIdentity();
|
||||||
|
Loading…
Reference in New Issue
Block a user