mirror of
https://github.com/NGSolve/netgen.git
synced 2024-12-24 04:50:34 +05:00
include togl_1_7.h into netgen sources
This commit is contained in:
parent
ef5cd51543
commit
abb11321c0
4
configure
vendored
4
configure
vendored
@ -3242,11 +3242,11 @@ fi
|
||||
if test "${with_togl+set}" = set; then
|
||||
withval=$with_togl; togldir=$withval
|
||||
togllibfl="-L$withval$"
|
||||
else
|
||||
togllibfl="-L/usr/local/lib/Togl1.7"
|
||||
|
||||
fi
|
||||
|
||||
# [togllibfl="-L$(TK_BIN_DIR)/Togl1.7"]
|
||||
# [togllibfl="-L/usr/local/lib/Togl1.7"]
|
||||
|
||||
|
||||
# Check whether --enable-nglib was given.
|
||||
|
@ -39,9 +39,10 @@ AC_ARG_WITH([occ],
|
||||
AC_ARG_WITH([togl],
|
||||
[ --with-togl=dir directory containing libTogl1.7],
|
||||
[togldir=$withval]
|
||||
[togllibfl="-L$withval$"],
|
||||
[togllibfl="-L/usr/local/lib/Togl1.7"]
|
||||
[togllibfl="-L$withval$"]
|
||||
)
|
||||
# [togllibfl="-L$(TK_BIN_DIR)/Togl1.7"]
|
||||
# [togllibfl="-L/usr/local/lib/Togl1.7"]
|
||||
|
||||
|
||||
AC_ARG_ENABLE([nglib],
|
||||
|
@ -17,7 +17,7 @@
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glu.h>
|
||||
#ifndef NOTCL
|
||||
#include <togl.h>
|
||||
// #include <togl.h>
|
||||
// #include "../../togl/togl.h"
|
||||
#endif
|
||||
|
||||
|
@ -17,7 +17,7 @@ netgen_LDADD = $(top_builddir)/libsrc/visualization/libvisual.a \
|
||||
$(top_builddir)/libsrc/opti/libopti.la \
|
||||
$(top_builddir)/libsrc/linalg/libla.la \
|
||||
$(top_builddir)/libsrc/general/libgeneral.la \
|
||||
$(OCCLIBS) $(TOGLLIBDIR) -lTogl1.7 -lGLU $(TK_LIB_SPEC) $(TCL_LIB_SPEC)
|
||||
$(OCCLIBS) -L$(TK_BIN_DIR)/Togl1.7 $(TOGLLIBDIR) -lTogl1.7 -lGLU $(TK_LIB_SPEC) $(TCL_LIB_SPEC)
|
||||
|
||||
|
||||
|
||||
|
@ -260,7 +260,7 @@ netgen_LDADD = $(top_builddir)/libsrc/visualization/libvisual.a \
|
||||
$(top_builddir)/libsrc/opti/libopti.la \
|
||||
$(top_builddir)/libsrc/linalg/libla.la \
|
||||
$(top_builddir)/libsrc/general/libgeneral.la \
|
||||
$(OCCLIBS) $(TOGLLIBDIR) -lTogl1.7 -lGLU $(TK_LIB_SPEC) $(TCL_LIB_SPEC)
|
||||
$(OCCLIBS) -L$(TK_BIN_DIR)/Togl1.7 $(TOGLLIBDIR) -lTogl1.7 -lGLU $(TK_LIB_SPEC) $(TCL_LIB_SPEC)
|
||||
|
||||
dist_bin_SCRIPTS = dialog.tcl menustat.tcl ngicon.tcl ng.tcl \
|
||||
ngvisual.tcl sockets.tcl drawing.tcl nghelp.tcl ngshell.tcl \
|
||||
|
17
ng/ng.tcl
17
ng/ng.tcl
@ -5,8 +5,8 @@ if {[catch {package require Tix }]} {
|
||||
puts "cannot find package Tix"
|
||||
}
|
||||
|
||||
# if {[catch {package require Togl 1.7}]} {
|
||||
# puts "cannot find package Togl 1.7"
|
||||
# if {[catch {package require Togl 2.0 }]} {
|
||||
# puts "cannot find package Togl 2.0"
|
||||
# }
|
||||
|
||||
|
||||
@ -285,18 +285,17 @@ catch {
|
||||
# source ngusers/ebg/elasticity/ebgelast.tcl
|
||||
|
||||
|
||||
if { [catch { load libngsolve.so ngsolve }] } {
|
||||
puts "cannot load ngsolve"
|
||||
if { [catch { load libngsolve.so ngsolve } result ] } {
|
||||
# puts "cannot load ngsolve"
|
||||
# puts "error: $result"
|
||||
} {
|
||||
source ${ngdir}/ngsolve.tcl
|
||||
}
|
||||
|
||||
|
||||
catch { source ${ngdir}/demoapp.tcl }
|
||||
|
||||
|
||||
if { [catch { load libdemoapp.so demoapp }] } {
|
||||
puts "cannot load demoapp"
|
||||
if { [catch { load libdemoapp.so demoapp } result ] } {
|
||||
# puts "cannot load demoapp"
|
||||
# puts "error: $result"
|
||||
} {
|
||||
}
|
||||
|
||||
|
86
ng/ngpkg.cpp
86
ng/ngpkg.cpp
@ -37,6 +37,10 @@ The interface between the GUI and the netgen library
|
||||
#include <parallel.hpp>
|
||||
|
||||
|
||||
// to be sure to include the 'right' togl-version
|
||||
#include "togl_1_7.h"
|
||||
|
||||
|
||||
extern bool nodisplay;
|
||||
|
||||
namespace netgen
|
||||
@ -648,7 +652,7 @@ namespace netgen
|
||||
PrintMessage (1, "Load IGES geometry file ", lgfilename);
|
||||
occgeometry = LoadOCC_IGES (lgfilename);
|
||||
#else
|
||||
Tcl_SetResult (interp, "IGES import requires the OpenCascade geometry kernel. "
|
||||
Tcl_SetResult (interp, (char*)"IGES import requires the OpenCascade geometry kernel. "
|
||||
"Please install OpenCascade as described in the Netgen-website",
|
||||
TCL_STATIC);
|
||||
return TCL_ERROR;
|
||||
@ -676,7 +680,7 @@ namespace netgen
|
||||
PrintMessage (1, "Load STEP geometry file ", lgfilename);
|
||||
occgeometry = LoadOCC_STEP (lgfilename);
|
||||
#else
|
||||
Tcl_SetResult (interp, "IGES import requires the OpenCascade geometry kernel. "
|
||||
Tcl_SetResult (interp, (char*)"IGES import requires the OpenCascade geometry kernel. "
|
||||
"Please install OpenCascade as described in the Netgen-website",
|
||||
TCL_STATIC);
|
||||
return TCL_ERROR;
|
||||
@ -692,7 +696,7 @@ namespace netgen
|
||||
PrintMessage (1, "Load BREP geometry file ", lgfilename);
|
||||
occgeometry = LoadOCC_BREP (lgfilename);
|
||||
#else
|
||||
Tcl_SetResult (interp, "BREP import requires the OpenCascade geometry kernel. "
|
||||
Tcl_SetResult (interp, (char*)"BREP import requires the OpenCascade geometry kernel. "
|
||||
"Please install OpenCascade as described in the Netgen-website",
|
||||
TCL_STATIC);
|
||||
return TCL_ERROR;
|
||||
@ -3004,7 +3008,6 @@ namespace netgen
|
||||
|
||||
|
||||
|
||||
// Togl
|
||||
|
||||
SYMBOLTABLE<VisualScene*> & GetVisualizationScenes ()
|
||||
{
|
||||
@ -3067,6 +3070,15 @@ namespace netgen
|
||||
#endif // OPENGL
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#if TOGL_MAJOR_VERSION==1
|
||||
|
||||
|
||||
// Togl
|
||||
|
||||
static void init( struct Togl *togl )
|
||||
{
|
||||
@ -3080,7 +3092,6 @@ namespace netgen
|
||||
vs->DrawScene();
|
||||
}
|
||||
|
||||
|
||||
static void zap( struct Togl *togl )
|
||||
{
|
||||
;
|
||||
@ -3127,6 +3138,36 @@ namespace netgen
|
||||
}
|
||||
}
|
||||
|
||||
static void reshape( struct Togl *togl)
|
||||
{
|
||||
int w = Togl_Width (togl);
|
||||
int h = Togl_Height (togl);
|
||||
|
||||
glViewport(0, 0, w, h);
|
||||
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity();
|
||||
gluPerspective(20.0f, double(w) / h, pnear, pfar);
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
|
||||
draw (togl);
|
||||
}
|
||||
|
||||
|
||||
|
||||
#else
|
||||
|
||||
|
||||
// Sorry, Togl 2.0 not supported
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#if TOGL_MAJOR_VERSION==1
|
||||
|
||||
#ifndef VIDEOCLIP
|
||||
static int Ng_SnapShot (struct Togl * togl,
|
||||
@ -3509,6 +3550,7 @@ namespace netgen
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
@ -3521,29 +3563,6 @@ namespace netgen
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
static void reshape( struct Togl *togl)
|
||||
{
|
||||
int w = Togl_Width (togl);
|
||||
int h = Togl_Height (togl);
|
||||
|
||||
glViewport(0, 0, w, h);
|
||||
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity();
|
||||
gluPerspective(20.0f, double(w) / h, pnear, pfar);
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
|
||||
draw (togl);
|
||||
}
|
||||
|
||||
int Ng_MouseMove (ClientData clientData,
|
||||
Tcl_Interp * interp,
|
||||
int argc, tcl_const char *argv[])
|
||||
@ -4228,11 +4247,11 @@ namespace netgen
|
||||
{
|
||||
if (strcmp (argv[1], "isACISavailable") == 0)
|
||||
{
|
||||
Tcl_SetResult (interp, "no", TCL_STATIC);
|
||||
Tcl_SetResult (interp, (char*)"no", TCL_STATIC);
|
||||
return TCL_OK;
|
||||
}
|
||||
}
|
||||
Tcl_SetResult (interp, "undefined ACiS command", TCL_STATIC);
|
||||
Tcl_SetResult (interp, (char*)"undefined ACiS command", TCL_STATIC);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
#endif
|
||||
@ -4999,15 +5018,18 @@ namespace netgen
|
||||
(ClientData)NULL,
|
||||
(Tcl_CmdDeleteProc*) NULL);
|
||||
|
||||
#if TOGL_MAJOR_VERSION==1
|
||||
if (!nodisplay && Togl_Init(interp) == TCL_ERROR) {
|
||||
return TCL_ERROR;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* Specify the C callback functions for widget creation, display,
|
||||
* and reshape.
|
||||
*/
|
||||
#if TOGL_MAJOR_VERSION==1
|
||||
if(!nodisplay)
|
||||
{
|
||||
Togl_CreateFunc( init );
|
||||
@ -5019,6 +5041,10 @@ namespace netgen
|
||||
Togl_CreateCommand( (char*)"Ng_VideoClip", Ng_VideoClip);
|
||||
// Togl_CreateCommand("position",position);
|
||||
}
|
||||
#else
|
||||
cout << "togl 2.0 setup missing" << endl;
|
||||
#endif
|
||||
|
||||
|
||||
multithread.pause = 0;
|
||||
multithread.testmode = 0;
|
||||
|
242
ng/togl_1_7.h
Normal file
242
ng/togl_1_7.h
Normal file
@ -0,0 +1,242 @@
|
||||
/* $Id: togl.h,v 1.28 2005/10/27 07:45:48 gregcouch Exp $ */
|
||||
|
||||
/* vi:set sw=4: */
|
||||
|
||||
/*
|
||||
* Togl - a Tk OpenGL widget
|
||||
*
|
||||
* Copyright (C) 1996-1998 Brian Paul and Ben Bederson
|
||||
* See the LICENSE file for copyright details.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef TOGL_H
|
||||
# define TOGL_H
|
||||
|
||||
# include "togl_ws.h"
|
||||
|
||||
# ifdef TOGL_WGL
|
||||
# define WIN32_LEAN_AND_MEAN
|
||||
# include <windows.h>
|
||||
# undef WIN32_LEAN_AND_MEAN
|
||||
# if defined(_MSC_VER)
|
||||
# define DllEntryPoint DllMain
|
||||
# endif
|
||||
# endif
|
||||
|
||||
# ifdef _WIN32
|
||||
# define TOGL_EXTERN __declspec(dllexport) extern
|
||||
# else
|
||||
# define TOGL_EXTERN extern
|
||||
# endif /* _WIN32 */
|
||||
|
||||
# ifdef TOGL_AGL_CLASSIC
|
||||
# ifndef MAC_TCL
|
||||
# define MAC_TCL 1
|
||||
# endif
|
||||
# endif
|
||||
|
||||
# ifdef TOGL_AGL
|
||||
# ifndef MAC_OSX_TCL
|
||||
# define MAC_OSX_TCL 1
|
||||
# endif
|
||||
# ifndef MAC_OSX_TK
|
||||
# define MAC_OSX_TK 1
|
||||
# endif
|
||||
# endif
|
||||
|
||||
# include <tcl.h>
|
||||
# include <tk.h>
|
||||
# if defined(TOGL_AGL) || defined(TOGL_AGL_CLASSIC)
|
||||
# include <OpenGL/gl.h>
|
||||
# else
|
||||
# include <GL/gl.h>
|
||||
# endif
|
||||
|
||||
# ifdef __sgi
|
||||
# include <GL/glx.h>
|
||||
# include <X11/extensions/SGIStereo.h>
|
||||
# endif
|
||||
|
||||
# ifndef CONST84
|
||||
# define CONST84
|
||||
# endif
|
||||
|
||||
# ifndef NULL
|
||||
# define NULL 0
|
||||
# endif
|
||||
|
||||
# ifndef TOGL_USE_FONTS
|
||||
# define TOGL_USE_FONTS 1 /* needed for demos */
|
||||
# endif
|
||||
|
||||
# ifdef __cplusplus
|
||||
/* *INDENT-OFF* */
|
||||
extern "C" {
|
||||
/* *INDENT-ON* */
|
||||
# endif
|
||||
|
||||
# define TOGL_VERSION "1.7"
|
||||
# define TOGL_MAJOR_VERSION 1
|
||||
# define TOGL_MINOR_VERSION 7
|
||||
|
||||
/*
|
||||
* "Standard" fonts which can be specified to Togl_LoadBitmapFont()
|
||||
*/
|
||||
# define TOGL_BITMAP_8_BY_13 ((char *) 1)
|
||||
# define TOGL_BITMAP_9_BY_15 ((char *) 2)
|
||||
# define TOGL_BITMAP_TIMES_ROMAN_10 ((char *) 3)
|
||||
# define TOGL_BITMAP_TIMES_ROMAN_24 ((char *) 4)
|
||||
# define TOGL_BITMAP_HELVETICA_10 ((char *) 5)
|
||||
# define TOGL_BITMAP_HELVETICA_12 ((char *) 6)
|
||||
# define TOGL_BITMAP_HELVETICA_18 ((char *) 7)
|
||||
|
||||
/*
|
||||
* Normal and overlay plane constants
|
||||
*/
|
||||
# define TOGL_NORMAL 1
|
||||
# define TOGL_OVERLAY 2
|
||||
|
||||
struct Togl;
|
||||
typedef struct Togl Togl;
|
||||
|
||||
typedef void (Togl_Callback) (Togl *togl);
|
||||
typedef int (Togl_CmdProc) (Togl *togl, int argc, CONST84 char *argv[]);
|
||||
|
||||
TOGL_EXTERN int Togl_Init(Tcl_Interp *interp);
|
||||
|
||||
/*
|
||||
* Default/initial callback setup functions
|
||||
*/
|
||||
|
||||
TOGL_EXTERN void Togl_CreateFunc(Togl_Callback *proc);
|
||||
TOGL_EXTERN void Togl_DisplayFunc(Togl_Callback *proc);
|
||||
TOGL_EXTERN void Togl_ReshapeFunc(Togl_Callback *proc);
|
||||
TOGL_EXTERN void Togl_DestroyFunc(Togl_Callback *proc);
|
||||
TOGL_EXTERN void Togl_TimerFunc(Togl_Callback *proc);
|
||||
TOGL_EXTERN void Togl_ResetDefaultCallbacks(void);
|
||||
|
||||
/*
|
||||
* Change callbacks for existing widget
|
||||
*/
|
||||
|
||||
TOGL_EXTERN void Togl_SetCreateFunc(Togl *togl, Togl_Callback *proc);
|
||||
TOGL_EXTERN void Togl_SetDisplayFunc(Togl *togl, Togl_Callback *proc);
|
||||
TOGL_EXTERN void Togl_SetReshapeFunc(Togl *togl, Togl_Callback *proc);
|
||||
TOGL_EXTERN void Togl_SetDestroyFunc(Togl *togl, Togl_Callback *proc);
|
||||
TOGL_EXTERN void Togl_SetTimerFunc(Togl *togl, Togl_Callback *proc);
|
||||
|
||||
/*
|
||||
* Miscellaneous
|
||||
*/
|
||||
|
||||
TOGL_EXTERN int Togl_Configure(Tcl_Interp *interp, Togl *togl,
|
||||
int argc, const char *argv[], int flags);
|
||||
TOGL_EXTERN void Togl_MakeCurrent(const Togl *togl);
|
||||
TOGL_EXTERN void Togl_CreateCommand(char *cmd_name, Togl_CmdProc *cmd_proc);
|
||||
TOGL_EXTERN void Togl_PostRedisplay(Togl *togl);
|
||||
TOGL_EXTERN void Togl_SwapBuffers(const Togl *togl);
|
||||
|
||||
/*
|
||||
* Query functions
|
||||
*/
|
||||
|
||||
TOGL_EXTERN const char *Togl_Ident(const Togl *togl);
|
||||
TOGL_EXTERN int Togl_Width(const Togl *togl);
|
||||
TOGL_EXTERN int Togl_Height(const Togl *togl);
|
||||
TOGL_EXTERN Tcl_Interp *Togl_Interp(const Togl *togl);
|
||||
TOGL_EXTERN Tk_Window Togl_TkWin(const Togl *togl);
|
||||
|
||||
/*
|
||||
* Color Index mode
|
||||
*/
|
||||
|
||||
TOGL_EXTERN unsigned long Togl_AllocColor(const Togl *togl, float red,
|
||||
float green, float blue);
|
||||
TOGL_EXTERN void Togl_FreeColor(const Togl *togl, unsigned long index);
|
||||
TOGL_EXTERN void Togl_SetColor(const Togl *togl, unsigned long index,
|
||||
float red, float green, float blue);
|
||||
|
||||
# if TOGL_USE_FONTS == 1
|
||||
/*
|
||||
* Bitmap fonts
|
||||
*/
|
||||
|
||||
TOGL_EXTERN GLuint Togl_LoadBitmapFont(const Togl *togl, const char *fontname);
|
||||
TOGL_EXTERN void Togl_UnloadBitmapFont(const Togl *togl, GLuint fontbase);
|
||||
|
||||
# endif
|
||||
/*
|
||||
* Overlay functions
|
||||
*/
|
||||
|
||||
TOGL_EXTERN void Togl_UseLayer(Togl *togl, int layer);
|
||||
TOGL_EXTERN void Togl_ShowOverlay(Togl *togl);
|
||||
TOGL_EXTERN void Togl_HideOverlay(Togl *togl);
|
||||
TOGL_EXTERN void Togl_PostOverlayRedisplay(Togl *togl);
|
||||
TOGL_EXTERN void Togl_OverlayDisplayFunc(Togl_Callback *proc);
|
||||
TOGL_EXTERN int Togl_ExistsOverlay(const Togl *togl);
|
||||
TOGL_EXTERN int Togl_GetOverlayTransparentValue(const Togl *togl);
|
||||
TOGL_EXTERN int Togl_IsMappedOverlay(const Togl *togl);
|
||||
TOGL_EXTERN unsigned long Togl_AllocColorOverlay(const Togl *togl,
|
||||
float red, float green, float blue);
|
||||
TOGL_EXTERN void Togl_FreeColorOverlay(const Togl *togl, unsigned long index);
|
||||
|
||||
/*
|
||||
* User client data
|
||||
*/
|
||||
|
||||
TOGL_EXTERN void Togl_ClientData(ClientData clientData);
|
||||
TOGL_EXTERN ClientData Togl_GetClientData(const Togl *togl);
|
||||
TOGL_EXTERN void Togl_SetClientData(Togl *togl, ClientData clientData);
|
||||
|
||||
# ifdef TOGL_X11
|
||||
/*
|
||||
* X11-only commands.
|
||||
* Contributed by Miguel A. De Riera Pasenau (miguel@DALILA.UPC.ES)
|
||||
*/
|
||||
|
||||
TOGL_EXTERN Display *Togl_Display(const Togl *togl);
|
||||
TOGL_EXTERN Screen *Togl_Screen(const Togl *togl);
|
||||
TOGL_EXTERN int Togl_ScreenNumber(const Togl *togl);
|
||||
TOGL_EXTERN Colormap Togl_Colormap(const Togl *togl);
|
||||
|
||||
# endif
|
||||
# ifdef __sgi
|
||||
/*
|
||||
* SGI stereo-only commands.
|
||||
* Contributed by Ben Evans (Ben.Evans@anusf.anu.edu.au)
|
||||
*/
|
||||
|
||||
TOGL_EXTERN void Togl_OldStereoDrawBuffer(GLenum mode);
|
||||
TOGL_EXTERN void Togl_OldStereoClear(GLbitfield mask);
|
||||
# endif
|
||||
|
||||
TOGL_EXTERN void Togl_StereoFrustum(GLfloat left, GLfloat right, GLfloat bottom,
|
||||
GLfloat top, GLfloat near, GLfloat far, GLfloat eyeDist,
|
||||
GLfloat eyeOffset);
|
||||
|
||||
/*
|
||||
* Generate EPS file.
|
||||
* Contributed by Miguel A. De Riera Pasenau (miguel@DALILA.UPC.ES)
|
||||
*/
|
||||
|
||||
TOGL_EXTERN int Togl_DumpToEpsFile(const Togl *togl, const char *filename,
|
||||
int inColor, void (*user_redraw) (const Togl *));
|
||||
|
||||
# ifdef TOGL_AGL_CLASSIC
|
||||
/*
|
||||
* Mac-specific setup functions
|
||||
*/
|
||||
extern int Togl_MacInit(void);
|
||||
extern int Togl_MacSetupMainInterp(Tcl_Interp *interp);
|
||||
# endif
|
||||
|
||||
# ifdef __cplusplus
|
||||
/* *INDENT-OFF* */
|
||||
}
|
||||
/* *INDENT-ON* */
|
||||
# endif
|
||||
|
||||
|
||||
#endif
|
@ -7,7 +7,6 @@ libnglib_la_SOURCES = nglib.cpp
|
||||
|
||||
libnglib_la_LIBADD = \
|
||||
$(top_builddir)/libsrc/interface/libinterface.la \
|
||||
$(top_builddir)/libsrc/occ/libocc.la \
|
||||
$(top_builddir)/libsrc/geom2d/libgeom2d.la \
|
||||
$(top_builddir)/libsrc/csg/libcsg.la \
|
||||
$(top_builddir)/libsrc/stlgeom/libstl.la \
|
||||
|
Loading…
Reference in New Issue
Block a user