[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: gl-render.cc: framework OpenGL on MacOSX
From: |
Thomas Treichl |
Subject: |
Re: gl-render.cc: framework OpenGL on MacOSX |
Date: |
Sun, 08 Feb 2009 10:31:28 +0100 |
User-agent: |
Thunderbird 2.0.0.19 (Macintosh/20081209) |
Ben Abbott schrieb:
Send all the files you want. I'm happy to do testing on Leopard.
Hi Ben,
I think I got it. I did some more Internet search and found a nice
implementation that (from my point of view) is not the way how we should do it:
#if defined(__APPLE_CC__) && __APPLE_CC__ > 4000 &&
__APPLE_CC__ < 5450 && !defined(__INTEL_COMPILER)
typedef GLvoid (*GLUTesselatorFunction)(...);
#elif defined( __mips ) || defined( __linux__ ) || defined( __FreeBSD__ ) ||
defined( __OpenBSD__ ) || defined( __sun ) || defined (__CYGWIN__) ||
defined (__APPLE__)
typedef GLvoid (*GLUTesselatorFunction)();
<SNIP>
but there are also some good implementations for this problem, eg.
http://autoconf-archive.cryp.to/ax_check_glu.html
I created another macro "OCTAVE_GLUTESSCALLBACK_THREEDOTS" that is called if a
valid framework OpenGL is found. It separates the way of calling gluTessCallback
on our different Mac systems.
I attached a script "configure.in" to this email, can you please try this on
your system (there are some files created while doing autoheader and autoconf,
so the best would be if you put configure.in into /tmp and work there):
bash$ autoheader && autoconf && ./configure
The relevant output on my machine that should be checked on your Mac is:
checking whether ld accepts -framework OpenGL... yes
configure: adding -Wl,-framework -Wl,OpenGL to OPENGL_LIBS
checking whether gluTessCallback is called with "(...)"... yes
OPENGL_LIBS: -Wl,-framework -Wl,OpenGL
On your Mac it should be "checking whether gluTessCallback is called with
"(...)"... no". The second test is
bash$ autoheader && autoconf && ./configure --without-framework-opengl
my output once again then is
checking whether ld accepts -framework OpenGL... yes
configure: Framework rejected by --without-framework-opengl
checking for GL/gl.h... no
checking for OpenGL/gl.h... yes
checking for GL/glu.h... no
checking for OpenGL/glu.h... yes
checking for glEnable in -lGL... yes
OPENGL_LIBS: -L/usr/X11R6/lib -lGL -lGLU
ie. the OpenGL libs from our X11 system are taken. If this works and there is no
other objection then I'll prepare the changeset for Octave and Mac's framework
OpenGL.
Best regards,
Thomas
PS. Can somebody on a GNU/Linux box please check this, too, so that I can be
sure that I didn't damage anything else.
AC_INIT
AC_REVISION($Revision: 1.0 $)
AC_PREREQ(2.57)
AC_CONFIG_HEADER(config.h)
dnl
dnl Check to see if the compiler and the linker can handle the flags
dnl "-framework $1" for the given prologue $2 and the given body $3 of
dnl a source file. Arguments 2 and 3 optionally can also be empty.
dnl Add options (lower case letters $1) "--with-framework-$1" and
dnl "--without-framework-$1". If this test is successful then perform
dnl $4, otherwise do $5.
dnl
dnl OCTAVE_HAVE_FRAMEWORK
AC_DEFUN(OCTAVE_HAVE_FRAMEWORK, [
AC_MSG_CHECKING(whether ${LD-ld} accepts -framework $1)
AC_CACHE_VAL(octave_cv_framework_$1, [
XLDFLAGS="$LDFLAGS"
LDFLAGS="$LDFLAGS -framework $1"
AC_LANG_PUSH(C++)
AC_LINK_IFELSE([AC_LANG_PROGRAM([$2], [$3])],
eval "octave_cv_framework_$1=yes",
eval "octave_cv_framework_$1=no")
AC_LANG_POP(C++)
LDFLAGS="$XLDFLAGS"
])
if test "$octave_cv_framework_$1" = "yes"; then
AC_MSG_RESULT(yes)
AC_ARG_WITH(framework-m4_tolower($1),
[AS_HELP_STRING([--without-framework-m4_tolower($1)],
[don't use framework $1])],
with_have_framework=$withval, with_have_framework="yes")
if test "$with_have_framework" = "yes"; then
[$4]
else
AC_MSG_NOTICE([Framework rejected by --without-framework-m4_tolower($1)])
[$5]
fi
else
AC_MSG_RESULT(no)
[$5]
fi
])
dnl
dnl See if function gluTessCallback is called with "(...)"
dnl
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 Check for OpenGL. If found, define OPENGL_LIBS
dnl
AC_DEFUN([OCTAVE_OPENGL], [
OPENGL_LIBS=
### 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], [], [
#ifdef HAVE_WINDOWS_H
#include <windows.h>
#endif
])
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 HAVE_WINDOWS_H
#include <windows.h>
#endif
#if defined (HAVE_GL_GL_H)
#include <GL/gl.h>
#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
fi
fi
AC_SUBST(OPENGL_LIBS)
])
dnl
dnl
dnl
OCTAVE_OPENGL
echo "OPENGL_LIBS: $OPENGL_LIBS"
AC_OUTPUT
- Re: gl-render.cc: framework OpenGL on MacOSX,
Thomas Treichl <=