From 55f164c6c60cdc7d5d7f8da47847231f0b38921d Mon Sep 17 00:00:00 2001 From: Joachim Schoeberl Date: Tue, 8 Sep 2009 22:14:23 +0000 Subject: [PATCH] togl2.0 --- ng/Makefile.am | 1 - ng/drawing.tcl | 8 +++----- ng/ng.tcl | 2 +- ng/ngpkg.cpp | 34 +++++++++++++++++----------------- 4 files changed, 21 insertions(+), 24 deletions(-) diff --git a/ng/Makefile.am b/ng/Makefile.am index 2e5e4f6d..8e017a63 100644 --- a/ng/Makefile.am +++ b/ng/Makefile.am @@ -17,7 +17,6 @@ netgen_LDADD = $(top_builddir)/libsrc/visualization/libvisual.a \ $(top_builddir)/libsrc/linalg/libla.la \ $(top_builddir)/libsrc/general/libgeneral.la \ $(OCCLIBS) -L$(TK_BIN_DIR)/Togl1.7 $(TOGLLIBDIR) -lTogl1.7 $(LIBGLU) $(TK_LIB_SPEC) $(TCL_LIB_SPEC) $(MPI_LIBS) $(FFMPEG_LIBS) $(JPEGLIB_LIBS) $(PKG_LIBS) - # # add for static linkage of ngsolve: # /opt/netgen/lib/libngsolve.a /opt/netgen/lib/libngcomp.a /opt/netgen/lib/libngcomp.a /opt/netgen/lib/libngfemng.a /opt/netgen/lib/libngmg.a /opt/netgen/lib/libngla.a /opt/netgen/lib/libngbla.a /opt/netgen/lib/libngstd.a -llapack diff --git a/ng/drawing.tcl b/ng/drawing.tcl index 7cf75076..f3ee50ab 100644 --- a/ng/drawing.tcl +++ b/ng/drawing.tcl @@ -7,13 +7,11 @@ set oldmousey 0 # if { 1 } { - - - -# if {[catch {togl .ndraw -width 400 -height 300 -rgba true -double true -depth true -privatecmap false -stereo false -indirect true -create init -display draw -reshape reshape }] } { - +# use this one for Togl 2.0 +# if {[catch {togl .ndraw -width 400 -height 300 -rgba true -double true -depth true -privatecmap false -stereo false -indirect true -create init -display draw -reshape reshape }] } { if {[catch {togl .ndraw -width 400 -height 300 -rgba true -double true -depth true -privatecmap false -stereo false -indirect true }] } { + puts "no OpenGL" } { # diff --git a/ng/ng.tcl b/ng/ng.tcl index 00e718ee..79172e4a 100644 --- a/ng/ng.tcl +++ b/ng/ng.tcl @@ -7,7 +7,7 @@ if {[catch {package require Tix } result ]} { # if {[catch {package require Togl 2.0 } result ]} { # puts "cannot find package Togl 2.0" -# puts "error : $result" +# puts "error : $result" # } diff --git a/ng/ngpkg.cpp b/ng/ngpkg.cpp index 53a4c666..8a9f2a1d 100644 --- a/ng/ngpkg.cpp +++ b/ng/ngpkg.cpp @@ -3224,14 +3224,18 @@ namespace netgen static int init(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const *objv) { - Togl * togl; + cout << "call init" << endl; + + Togl * togl = NULL; + if (Togl_GetToglFromObj(interp, objv[1], &togl) != TCL_OK) return TCL_ERROR; cout << "call Togl - load font (crash on my Linux64)" << endl; // togl_font = Togl_LoadBitmapFont( togl, "Times"); // TOGL_BITMAP_8_BY_13 ); - togl_font = Togl_LoadBitmapFont( togl, TOGL_BITMAP_8_BY_13 ); - cout << "success" << endl; + // togl_font = Togl_LoadBitmapFont( togl, TOGL_BITMAP_8_BY_13 ); + // togl_font = Togl_LoadBitmapFont( togl, NULL ); + // cout << "success" << endl; glMatrixMode(GL_PROJECTION); glLoadIdentity(); @@ -5196,20 +5200,17 @@ 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) + if (!nodisplay) { + if (Togl_Init(interp) == TCL_ERROR) + return TCL_ERROR; + Togl_CreateFunc( init ); Togl_DestroyFunc( zap ); Togl_DisplayFunc( draw ); @@ -5220,18 +5221,17 @@ namespace netgen // Togl_CreateCommand("position",position); } #else - if(!nodisplay) + if (!nodisplay) { + if (Togl_Init(interp) == TCL_ERROR) + return TCL_ERROR; + + Tcl_CreateObjCommand(interp, "init", init, NULL, NULL); Tcl_CreateObjCommand(interp, "zap", zap, NULL, NULL); Tcl_CreateObjCommand(interp, "draw", draw, NULL, NULL); Tcl_CreateObjCommand(interp, "reshape", reshape, NULL, NULL); - /* - Togl_CreateFunc( init ); - Togl_DestroyFunc( zap ); - Togl_DisplayFunc( draw ); - Togl_ReshapeFunc( reshape ); - */ + // Togl_TimerFunc( idle ); // Togl_CreateCommand( (char*)"Ng_SnapShot", Ng_SnapShot); // Togl_CreateCommand( (char*)"Ng_VideoClip", Ng_VideoClip);