portable opengl in autotools (Mac aqua)

This commit is contained in:
Joachim Schoeberl 2009-02-04 23:09:28 +00:00
parent e6b39d89a8
commit 22d86c1838
7 changed files with 61 additions and 66 deletions

View File

@ -83,6 +83,7 @@ AC_SUBST([TOGLLIBDIR], ["$togllibfl"])
AC_CHECK_HEADER(pthread.h)
AC_CHECK_HEADER([togl.h])
AC_CHECK_HEADER([GL/gl.h])
AC_CHECK_HEADER([iostream],[OCCFLAGS="$OCCFLAGS -DHAVE_IOSTREAM"])
AC_CHECK_HEADER([iostream.h],[OCC_FLAGS="$OCCFLAGS -DHAVE_IOSTREAM_H"])
@ -93,6 +94,43 @@ AC_CHECK_LIB(pthread, pthread_create)
# AC_SEARCH_LIBS(Tcl_Init, [tcl8.5 tcl8.4])
#--------------------------------------------------------------------
# __CHANGE__
# Choose OpenGL platform (borrowed from Togl1.7)
#--------------------------------------------------------------------
case "${TEA_WINDOWINGSYSTEM}" in
aqua)
AC_SUBST(TOGL_WINDOWINGSYSTEM,TOGL_AGL)
TEA_ADD_LIBS([-framework AGL -framework OpenGL -framework ApplicationServices])
# libGLU is implicit in OpenGL framework
LIBGLU=
;;
x11)
AC_SUBST(TOGL_WINDOWINGSYSTEM,TOGL_X11)
TEA_ADD_LIBS([-lGL -lXmu])
LIBGLU=-lGLU
;;
win32)
AC_SUBST(TOGL_WINDOWINGSYSTEM,TOGL_WGL)
TEA_ADD_LIBS([opengl32.lib user32.lib gdi32.lib])
if test "$GCC" = "yes" ; then
LIBGLU=-lglu32
else
LIBGLU=glu32.lib
fi
;;
*)
AC_MSG_ERROR([Unsupported windowing system: ${TEA_WINDOWINGSYSTEM}])
;;
esac
AC_SUBST(LIBGLU)
AC_CHECK_FUNCS([pow])
AC_CHECK_FUNCS([floor])
AC_CHECK_HEADERS([limits.h])

View File

@ -5,6 +5,9 @@
#include <tcl.h>
#include <tk.h>
// #include "/opt/tcltk86/include/tcl.h"
// #include "/opt/tcltk86/include/tk.h"
#if TK_MAJOR_VERSION==8 && TK_MINOR_VERSION>=4
#define tcl_const const

View File

@ -73,7 +73,6 @@ namespace netgen
return;
}
}
/*
if (invert)
swap (el.PNum(2), el.PNum(3));

View File

@ -10,14 +10,14 @@
#ifndef WIN32
#ifndef WIN32
#define GLX_GLXEXT_LEGACY
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/Xatom.h> /* for XA_RGB_DEFAULT_MAP atom */
#include <GL/glx.h>
// #include <GL/glx.h> // for parallel GL ???
#endif

View File

@ -16,9 +16,8 @@ netgen_LDADD = $(top_builddir)/libsrc/visualization/libvisual.a \
$(top_builddir)/libsrc/gprim/libgprim.la \
$(top_builddir)/libsrc/linalg/libla.la \
$(top_builddir)/libsrc/general/libgeneral.la \
$(OCCLIBS) -L$(TK_BIN_DIR)/Togl1.7 $(TOGLLIBDIR) -lTogl1.7 -lGLU $(TK_LIB_SPEC) $(TCL_LIB_SPEC) $(MPI_LIBS)
$(OCCLIBS) -L$(TK_BIN_DIR)/Togl1.7 $(TOGLLIBDIR) -lTogl1.7 $(LIBGLU) $(TK_LIB_SPEC) $(TCL_LIB_SPEC) $(MPI_LIBS)
#-lGLU -lGL
dist_bin_SCRIPTS = dialog.tcl menustat.tcl ngicon.tcl ng.tcl \

View File

@ -1,5 +1,4 @@
puts "found ng.tcl"
puts "Parsing ng.tcl"
if {[catch {package require Tix } result ]} {
puts "cannot find package Tix"

View File

@ -11,9 +11,11 @@
#include <fenv.h>
#endif
/*
#ifndef WIN32
#include <dlfcn.h>
#endif
*/
#ifdef PARALLEL
#include <mpi.h>
@ -27,7 +29,7 @@ namespace netgen
#endif
// #include "../libsrc/parallel/parallel.hpp"
#include "parallelfunc.hpp"
@ -47,13 +49,6 @@ using netgen::Array;
using netgen::RegisterUserFormats;
#ifdef NGSOLVE
extern "C" int NGSolve_Init (Tcl_Interp * interp);
#endif
// void * ngsolve_handle; // dynamic library handle
/*
@ -103,17 +98,9 @@ int main(int argc, char ** argv)
#pragma pomp inst begin(main)
#endif
// ngsolve_handle = dlopen ("libngsolves.so", RTLD_LAZY | RTLD_GLOBAL);
// cout << "ngsolve_handle = " << ngsolve_handle << endl;
if ( netgen::id == 0 )
{
#ifdef NGSOLVE
cout << "NETGEN/NGSolve " << PACKAGE_VERSION << endl;
#else
cout << "NETGEN-" << PACKAGE_VERSION << endl;
#endif
cout << "Developed at RWTH Aachen University, Germany" << endl
<< "and Johannes Kepler University Linz, Austria" << endl;
@ -280,12 +267,11 @@ int main(int argc, char ** argv)
if (errcode)
{
cout << "Error in Tcl-Script:" << endl;
cout << "result = " << myinterp->result << endl;
cout << "in line " << myinterp->errorLine << endl;
if (myinterp->errorLine == 1)
cout << "\nMake sure to set environment variable NETGENDIR" << endl;
// cout << "result = " << myinterp->result << endl;
cout << "result = " << Tcl_GetStringResult (myinterp) << endl;
// cout << "in line " << myinterp->errorLine << endl;
cout << "\nMake sure to set environment variable NETGENDIR to directory containing ng.tcl" << endl;
exit (1);
}
@ -377,13 +363,15 @@ int Tcl_AppInit(Tcl_Interp * interp)
if (Tcl_Init(interp) == TCL_ERROR) {
cerr << "Problem in Tcl_Init: " << endl;
cerr << interp->result << endl;
cout << "result = " << Tcl_GetStringResult (interp) << endl;
// cerr << interp->result << endl;
// return TCL_ERROR;
}
if (!nodisplay && Tk_Init(interp) == TCL_ERROR) {
cerr << "Problem in Tk_Init: " << endl;
cerr << interp->result << endl;
cout << "result = " << Tcl_GetStringResult (interp) << endl;
// cerr << interp->result << endl;
// return TCL_ERROR;
}
@ -412,13 +400,15 @@ int Tcl_AppInit(Tcl_Interp * interp)
if (Ng_Init(interp) == TCL_ERROR) {
cerr << "Problem in Ng_Init: " << endl;
cerr << interp->result << endl;
cout << "result = " << Tcl_GetStringResult (interp) << endl;
// cerr << interp->result << endl;
// return TCL_ERROR;
}
if (!nodisplay && Ng_Vis_Init(interp) == TCL_ERROR) {
cerr << "Problem in Ng_Vis_Init: " << endl;
cerr << interp->result << endl;
cout << "result = " << Tcl_GetStringResult (interp) << endl;
// cerr << interp->result << endl;
// return TCL_ERROR;
}
@ -477,38 +467,6 @@ int Tcl_AppInit(Tcl_Interp * interp)
#endif
/*
if (ngsolve_handle)
{
void (*ngs_init)(Tcl_Interp*);
ngs_init = ( void (*)(Tcl_Interp*) ) dlsym (ngsolve_handle, "NGSolve_Init");
cout << "symbolhandle = " << (void*)ngs_init << endl;
if (ngs_init) (*ngs_init)(interp);
}
*/
#ifdef NGSOLVE
if (NGSolve_Init(interp) == TCL_ERROR)
{
cerr << "Problem in NgSolve_Init: " << endl;
cerr << interp->result << endl;
return TCL_ERROR;
}
#ifdef SOCKETS
extern int NGS_Socket_Init (Tcl_Interp * interp);
if (NGS_Socket_Init(interp) == TCL_ERROR)
{
cerr << "Problem in NGS_Socket_Init: " << endl;
cerr << interp->result << endl;
return TCL_ERROR;
}
#endif // SOCKETS
#endif // NGSOLVE
#ifdef SOCKETS
extern int Ng_Socket_Init (Tcl_Interp * interp);
if ( Ng_Socket_Init(interp) == TCL_ERROR)
@ -521,7 +479,6 @@ int Tcl_AppInit(Tcl_Interp * interp)
#endif
#ifdef ZUGSTANGE
extern int Zugstange_Init (Tcl_Interp * interp);
if (Zugstange_Init(interp) == TCL_ERROR)