Mercurial > hg > octave-nkf
changeset 8724:a50228129dba
Introduce new macro OCTAVE_GLUTESSCALLBACK_THREEDOTS. Use definitions HAVE_FRAMEWORK_OPENGL and HAVE_GLUTESSCALLBACK_THREEDOTS for Mac's framework OpenGL implementation.
author | Ben Abbott <bpabbott@mac.com> |
---|---|
date | Wed, 11 Feb 2009 19:46:23 -0500 |
parents | 0899370cce9f |
children | d5af326a3ede |
files | ChangeLog aclocal.m4 src/ChangeLog src/gl-render.cc src/gl-render.h |
diffstat | 5 files changed, 97 insertions(+), 39 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2009-02-11 Thomas Treichl <Thomas.Treichl@gmx.net> + + * aclocal.m4 (OCTAVE_GLUTESSCALLBACK_THREEDOTS): New macro. + (OCTAVE_OPENGL): Use it in OpenGL check. + 2009-02-11 Ben Abbott <bpabbott@mac.com> * configure.in: Include FTGLTextureFont.h when FTGL_UPPER_CASE is
--- a/aclocal.m4 +++ b/aclocal.m4 @@ -1014,36 +1014,48 @@ dnl dnl Check for OpenGL. If found, define OPENGL_LIBS dnl -dnl FIXME -- add tests for apple -dnl AC_DEFUN([OCTAVE_OPENGL], [ OPENGL_LIBS= -case $canonical_host_type in - *-*-mingw32* | *-*-msdosmsvc) - AC_CHECK_HEADERS(windows.h) + +### On MacOSX systems the OpenGL framework can be used +OCTAVE_HAVE_FRAMEWORK(OpenGL, [ +#include <OpenGL/gl.h> +#include <OpenGL/glu.h> ], [GLint par; glGetIntegerv (GL_VIEWPORT, &par);], + [have_framework_opengl="yes"], [have_framework_opengl="no"]) + +if test $have_framework_opengl = "yes"; then + AC_DEFINE(HAVE_FRAMEWORK_OPENGL, 1, [Define if framework OPENGL is available.]) + OPENGL_LIBS="-Wl,-framework -Wl,OpenGL" + AC_MSG_NOTICE([adding -Wl,-framework -Wl,OpenGL to OPENGL_LIBS]) + OCTAVE_GLUTESSCALLBACK_THREEDOTS +else + case $canonical_host_type in + *-*-mingw32* | *-*-msdosmsvc) + AC_CHECK_HEADERS(windows.h) ;; -esac -have_opengl_incs=no -AC_CHECK_HEADERS([GL/gl.h OpenGL/gl.h], [ - AC_CHECK_HEADERS([GL/glu.h OpenGL/glu.h], [ - have_opengl_incs=yes; break], [], [ + esac + have_opengl_incs=no + AC_CHECK_HEADERS([GL/gl.h OpenGL/gl.h], [ + AC_CHECK_HEADERS([GL/glu.h OpenGL/glu.h], [ + have_opengl_incs=yes; break], [], [ #ifdef HAVE_WINDOWS_H #include <windows.h> #endif -]) -break -], [], [ + ]) + break + ], [], [ #ifdef HAVE_WINDOWS_H #include <windows.h> #endif -]) -if test "$have_opengl_incs" = "yes"; then - case $canonical_host_type in - *-*-mingw32* | *-*-msdosmsvc) - save_LIBS="$LIBS" - LIBS="$LIBS -lopengl32" - AC_MSG_CHECKING([for glEnable in -lopengl32]) - AC_TRY_LINK([ + ]) + + if test "$have_opengl_incs" = "yes"; then + case $canonical_host_type in + *-*-mingw32* | *-*-msdosmsvc) + save_LIBS="$LIBS" + LIBS="$LIBS -lopengl32" + AC_MSG_CHECKING([for glEnable in -lopengl32]) + AC_TRY_LINK([ #if HAVE_WINDOWS_H #include <windows.h> #endif @@ -1052,26 +1064,48 @@ #elif defined (HAVE_OPENGL_GL_H) #include <OpenGL/gl.h> #endif -], [ -glEnable(GL_SMOOTH);], OPENGL_LIBS="-lopengl32 -lglu32") - LIBS="$save_LIBS" - if test "x$OPENGL_LIBS" != "x"; then - AC_MSG_RESULT(yes) - else - AC_MSG_RESULT(no) - fi - ;; - *) - save_LDFLAGS="$LDFLAGS" - LDFLAGS="$LDFLAGS -L/usr/X11R6/lib" - AC_CHECK_LIB(GL, glEnable, OPENGL_LIBS="-L/usr/X11R6/lib -lGL -lGLU") - LDFLAGS="$save_LDFLAGS" - ;; - esac +], [glEnable(GL_SMOOTH);], OPENGL_LIBS="-lopengl32 -lglu32") + LIBS="$save_LIBS" + if test "x$OPENGL_LIBS" != "x"; then + AC_MSG_RESULT(yes) + else + AC_MSG_RESULT(no) + fi + ;; + *) + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS -L/usr/X11R6/lib" + AC_CHECK_LIB(GL, glEnable, OPENGL_LIBS="-L/usr/X11R6/lib -lGL -lGLU") + LDFLAGS="$save_LDFLAGS" + ;; + esac + fi fi AC_SUBST(OPENGL_LIBS) ]) dnl +dnl See if function gluTessCallback is called with "(...)" +dnl +dnl OCTAVE_GLUTESSCALLBACK_THREEDOTS +AC_DEFUN(OCTAVE_GLUTESSCALLBACK_THREEDOTS, +[AC_CACHE_CHECK([whether gluTessCallback is called with "(...)"], +octave_cv_glutesscallback_threedots, +[AC_LANG_PUSH(C++) +AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ +#ifdef HAVE_GL_GLU_H +#include <GL/glu.h> +#elif defined HAVE_OPENGL_GLU_H || defined HAVE_FRAMEWORK_OPENGL +#include <OpenGL/glu.h> +#endif]], +[[GLvoid (*func)(...); gluTessCallback(0, 0, func);]])], +octave_cv_glutesscallback_threedots="yes", octave_cv_glutesscallback_threedots="no")]) +AC_LANG_POP(C++) +if test $octave_cv_glutesscallback_threedots = "yes"; then + AC_DEFINE(HAVE_GLUTESSCALLBACK_THREEDOTS, 1, + [Define if gluTessCallback is called with (...)]) +fi +]) +dnl dnl Configure paths for FreeType2 dnl Marcelo Magallon 2001-10-26, based on gtk.m4 by Owen Taylor dnl
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2009-02-11 Thomas Treichl <Thomas.Treichl@gmx.net> + + * gl-render.h: Use HAVE_FRAMEWORK_OPENGL. + * gl-render.cc (opengl_tesselator, opengl_renderer::draw, + opengl_renderer::init_marker): Use HAVE_FRAMEWORK_OPENGL. + 2009-02-11 Jaroslav Hajek <highegg@gmail.com> * ov.h (octave_value::issorted, octave_value::sortrows_idx,
--- a/src/gl-render.cc +++ b/src/gl-render.cc @@ -221,7 +221,11 @@ opengl_tesselator { public: +#if defined (HAVE_FRAMEWORK_OPENGL) && defined (HAVE_GLUTESSCALLBACK_THREEDOTS) + typedef GLvoid (CALLBACK *fcn) (...); +#else typedef void (CALLBACK *fcn) (void); +#endif public: @@ -591,7 +595,12 @@ xZ1 = x_zlim(0)-(x_zlim(1)-x_zlim(0))/2; xZ2 = x_zlim(1)+(x_zlim(1)-x_zlim(0))/2; +#if defined (HAVE_FRAMEWORK_OPENGL) + GLint vw[4]; +#else int vw[4]; +#endif + glGetIntegerv (GL_VIEWPORT, vw); glMatrixMode (GL_MODELVIEW); @@ -2672,7 +2681,11 @@ void opengl_renderer::init_marker (const std::string& m, double size, float width) { +#if defined (HAVE_FRAMEWORK_OPENGL) + GLint vw[4]; +#else int vw[4]; +#endif glGetIntegerv (GL_VIEWPORT, vw);
--- a/src/gl-render.h +++ b/src/gl-render.h @@ -29,13 +29,13 @@ #ifdef HAVE_GL_GL_H #include <GL/gl.h> -#elif defined HAVE_OPENGL_GL_H +#elif defined HAVE_OPENGL_GL_H || defined HAVE_FRAMEWORK_OPENGL #include <OpenGL/gl.h> #endif #ifdef HAVE_GL_GLU_H #include <GL/glu.h> -#elif defined HAVE_OPENGL_GLU_H +#elif defined HAVE_OPENGL_GLU_H || defined HAVE_FRAMEWORK_OPENGL #include <OpenGL/glu.h> #endif