Added GLX routines to epplet.c and epplet.h. Added OpenGL lib checking

and header checking (I hope) to configure.in and acconfig.h


SVN revision: 1920
This commit is contained in:
Wayde Milas 2000-01-15 00:42:59 +00:00
parent 07303151ea
commit a7d077c7e4
4 changed files with 69 additions and 1 deletions

View File

@ -283,6 +283,9 @@
/* Do we need libgtop? */
#undef HAVE_LIBGTOP
/* Do we have OpenGL? */
#undef HAVE_LIBGL
/* Leave that blank line there!! Autoheader needs it.
If you're adding to this file, keep in mind:

View File

@ -4957,6 +4957,30 @@ Epplet_free_rgb_buf(RGB_buf buf)
}
}
#ifdef HAVE_LIBGL
GLXContext
Epplet_bind_GL(Window win, Display *dpy)
{
XVisualInfo *vi;
GLXContext cx;
static int attributeListDbl[]={GLX_RGBA, GLX_RED_SIZE, 1,
/*get the deepest buffer with 1 red bit*/ GLX_GREEN_SIZE, 1,
GLX_BLUE_SIZE, 1, None };
vi = glXChooseVisual(dpy, DefaultScreen(dpy), attributeListDbl);
cx = glXCreateContext(dpy, vi, 0, GL_TRUE);
glXMakeCurrent(dpy, win, cx);
return cx;
}
void
Epplet_unbind_GL(Display *dpy, GLXContext cx)
{
glXDestroyContext(dpy, cx);
}
#endif
static void
Epplet_handle_child(int num)
{

View File

@ -26,6 +26,14 @@
#include <sys/types.h>
#include <sys/stat.h>
#define HAVE_GL 1
/* preliminary OpenGL Checking */
#ifdef HAVE_GL
#include <GL/glut.h>
#include <GL/glx.h>
#endif
#if defined(sun) && !defined(__sun__)
# define __sun__
#endif
@ -431,7 +439,21 @@ void Epplet_paste_buf(RGB_buf buf, Window win, int x, int y);
/* free an RGB buffer */
void Epplet_free_rgb_buf(RGB_buf buf);
#ifdef HAVE_GL
/****************************************************************************/
/* OpenGL (GLX) calls. Use these functions to setup and destroy a OpenGL */
/* context for epplets. All glx contexts are linked to an epplet drawing */
/* area. You must have one set up first. Currently ONLY double buffering is */
/* enabled. The calls will fail if it is not available. You must also */
/* remember to glXSwapBuffers at the end of your Drawing cycle. I'll fix */
/* this as the code matures. */
/****************************************************************************/
/* Create an Epplet glx context, pick the default visual, and bind it to a
window (obtained from Epplet_get_drawingarea_window) */
GLXContext Epplet_bind_GL(Window win, Display *dpy);
/* Destroy (unbind) a glx context. */
void Epplet_unbind_GL(Display *dpy, GLXContext cx);
#endif
/* command execution/spawing wrappers to make life easy */

View File

@ -109,6 +109,24 @@ echo " libXext.so installed and that it is located in the X libraries";
echo " directory shown above. If it is in a different directory, try using";
echo " the --x-libraries parameter to configure.";
AC_MSG_ERROR([Fatal: libXext not found.])], $X_LIBS $SUBLIBS)
dnl#
dnl* I hope I'm doing this right
dnl#
AC_CHECK_LIB(GL, glXChooseVisual, GL_LIBS="GL", [
echo "Warning Will Robinson. No OpenGL! Install Mesa or you favorite hardware GLX.";
], $X_LIBS $SUBLIBS)
GL_PROGS=""
if test "$GL_LIBS" = "GL"; then
AC_CHECK_HEADERS(GL/glx.h,[P_GL="GL"], [echo "Warning Will Robinson. No OpenGL headers! Install Mesa our your favorite hardware GLX."])
if test "$P_GL" = "GL"; then
X_LIBS="-lGL $X_LIBS"
AC_DEFINE(HAVE_LIBGL)
GL_PROGS="E-OpenGL-Demo.epplet"
AC_MSG_WARN([*** Building for GLX. Grab your ankles and kiss your ass goodbye! ***])
fi
fi
AC_CHECK_PROG(IMLIB_CONFIG, imlib-config, imlib-config, no)
@ -291,6 +309,7 @@ AC_SUBST(GTLIBS)
AC_SUBST(THREADLIBS)
AC_SUBST(TEST_PROGS)
AC_SUBST(MIXER_PROGS)
AC_SUBST(GL_PROGS)
AC_SUBST(SGI_LIBS)
AC_SUBST(SGI_DEFINES)