summaryrefslogtreecommitdiff
path: root/src/glut
diff options
context:
space:
mode:
authorJouk <joukj@tarantella.nano.tudelft.nl>2007-10-02 15:17:23 +0200
committerJouk <joukj@tarantella.nano.tudelft.nl>2007-10-02 15:17:23 +0200
commit584b84256b07e106cd7295495355eb21226465d7 (patch)
tree028d47d265d01f3f96787792fbd41d495d60856c /src/glut
parenteb9a5b6d5127858b01ec12672c999e7d25cd7aed (diff)
parentde1d725f442caa4d8ecbac3256b5a33d1f4a1257 (diff)
Merge branch 'master' of git+ssh://joukj@git.freedesktop.org/git/mesa/mesa
Diffstat (limited to 'src/glut')
-rw-r--r--src/glut/beos/Makefile3
-rw-r--r--src/glut/directfb/Makefile2
-rw-r--r--src/glut/fbdev/Makefile10
-rw-r--r--src/glut/ggi/Makefile2
-rw-r--r--src/glut/glx/Makefile23
-rw-r--r--src/glut/glx/Makefile.mgw41
-rw-r--r--src/glut/glx/glut.pc.in11
-rw-r--r--src/glut/glx/glut_dstr.c1
-rw-r--r--src/glut/glx/glut_event.c8
-rw-r--r--src/glut/glx/glut_fcb.c164
-rw-r--r--src/glut/mini/Makefile2
11 files changed, 226 insertions, 41 deletions
diff --git a/src/glut/beos/Makefile b/src/glut/beos/Makefile
index 3ff928bfd7..165f43a6ce 100644
--- a/src/glut/beos/Makefile
+++ b/src/glut/beos/Makefile
@@ -83,7 +83,8 @@ $(TOP)/$(LIB_DIR):
# Make the library
$(TOP)/$(LIB_DIR)/$(GLUT_LIB_NAME): depend $(OBJECTS)
- @$(TOP)/bin/mklib -o $(GLUT_LIB) -major $(GLUT_MAJOR) -minor $(GLUT_MINOR) -patch $(GLUT_TINY) \
+ @$(TOP)/bin/mklib -o $(GLUT_LIB) -ldflags '$(LDFLAGS)' \
+ -major $(GLUT_MAJOR) -minor $(GLUT_MINOR) -patch $(GLUT_TINY) \
-install $(TOP)/$(LIB_DIR) $(MKLIB_OPTIONS) $(GLUT_LIB_DEPS) \
$(OBJECTS)
diff --git a/src/glut/directfb/Makefile b/src/glut/directfb/Makefile
index 3791b16df8..aa77db91c6 100644
--- a/src/glut/directfb/Makefile
+++ b/src/glut/directfb/Makefile
@@ -61,7 +61,7 @@ default: depend $(TOP)/$(LIB_DIR)/$(GLUT_LIB_NAME)
# Make the library
$(TOP)/$(LIB_DIR)/$(GLUT_LIB_NAME): depend $(OBJECTS)
- $(TOP)/bin/mklib -o $(GLUT_LIB) -linker '$(CC)' \
+ $(TOP)/bin/mklib -o $(GLUT_LIB) -linker '$(CC)' -ldflags '$(LDFLAGS)' \
-major $(GLUT_MAJOR) -minor $(GLUT_MINOR) -patch $(GLUT_TINY) \
$(GLUT_LIB_DEPS) -install $(TOP)/$(LIB_DIR) \
$(MKLIB_OPTIONS) $(OBJECTS)
diff --git a/src/glut/fbdev/Makefile b/src/glut/fbdev/Makefile
index 254ff8c098..948be0c7ba 100644
--- a/src/glut/fbdev/Makefile
+++ b/src/glut/fbdev/Makefile
@@ -63,16 +63,16 @@ default: depend $(TOP)/$(LIB_DIR)/$(GLUT_LIB_NAME)
# Make the library
$(TOP)/$(LIB_DIR)/$(GLUT_LIB_NAME): depend $(OBJECTS)
- $(TOP)/bin/mklib -o $(GLUT_LIB) -linker '$(CC)' \
+ $(TOP)/bin/mklib -o $(GLUT_LIB) -linker '$(CC)' -ldflags '$(LDFLAGS)' \
-major $(GLUT_MAJOR) -minor $(GLUT_MINOR) -patch $(GLUT_TINY) \
$(GLUT_LIB_DEPS) -install $(TOP)/$(LIB_DIR) \
$(MKLIB_OPTIONS) $(OBJECTS)
install:
- $(INSTALL) -d $(INSTALL_DIR)/include/GL
- $(INSTALL) -d $(INSTALL_DIR)/$(LIB_DIR)
- $(INSTALL) -m 644 $(TOP)/include/GL/glut.h $(INSTALL_DIR)/include/GL
- $(INSTALL) $(TOP)/$(LIB_DIR)/libglut* $(INSTALL_DIR)/$(LIB_DIR)
+ $(INSTALL) -d $(DESTDIR)$(INSTALL_DIR)/include/GL
+ $(INSTALL) -d $(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR)
+ $(INSTALL) -m 644 $(TOP)/include/GL/glut.h $(DESTDIR)$(INSTALL_DIR)/include/GL
+ $(INSTALL) $(TOP)/$(LIB_DIR)/libglut* $(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR)
# Run 'make -f Makefile.solo dep' to update the dependencies if you change
# what's included by any source file.
diff --git a/src/glut/ggi/Makefile b/src/glut/ggi/Makefile
index 1bef6c23a3..c8805c27c0 100644
--- a/src/glut/ggi/Makefile
+++ b/src/glut/ggi/Makefile
@@ -32,7 +32,7 @@ default: $(TOP)/$(LIB_DIR)/$(GLUT_LIB_NAME)
# Make the library
$(TOP)/$(LIB_DIR)/$(GLUT_LIB_NAME): depend $(OBJECTS)
- $(TOP)/bin/mklib -o $(GLUT_LIB) -linker '$(CC)' \
+ $(TOP)/bin/mklib -o $(GLUT_LIB) -linker '$(CC)' -ldflags '$(LDFLAGS)' \
-major $(GLUT_MAJOR) -minor $(GLUT_MINOR) \
-patch $(GLUT_TINY) $(MKLIB_OPTIONS) -install $(TOP)/$(LIB_DIR) \
$(GLUT_LIB_DEPS) $(OBJECTS)
diff --git a/src/glut/glx/Makefile b/src/glut/glx/Makefile
index 7e1d56b327..9f995667b4 100644
--- a/src/glut/glx/Makefile
+++ b/src/glut/glx/Makefile
@@ -36,6 +36,7 @@ SOURCES = \
glut_dstr.c \
glut_event.c \
glut_ext.c \
+ glut_fcb.c \
glut_fullscrn.c \
glut_gamemode.c \
glut_get.c \
@@ -90,17 +91,27 @@ default: $(TOP)/$(LIB_DIR)/$(GLUT_LIB_NAME)
# Make the library
$(TOP)/$(LIB_DIR)/$(GLUT_LIB_NAME): depend $(OBJECTS)
- $(TOP)/bin/mklib -o $(GLUT_LIB) -linker '$(CC)' \
+ $(TOP)/bin/mklib -o $(GLUT_LIB) -linker '$(CC)' -ldflags '$(LDFLAGS)' \
-major $(GLUT_MAJOR) -minor $(GLUT_MINOR) -patch $(GLUT_TINY) \
$(MKLIB_OPTIONS) -install $(TOP)/$(LIB_DIR) \
$(GLUT_LIB_DEPS) $(OBJECTS)
-install:
- $(INSTALL) -d $(INSTALL_DIR)/include/GL
- $(INSTALL) -d $(INSTALL_DIR)/$(LIB_DIR)
- $(INSTALL) -m 644 $(TOP)/include/GL/glut.h $(INSTALL_DIR)/include/GL
- $(INSTALL) $(TOP)/$(LIB_DIR)/libglut* $(INSTALL_DIR)/$(LIB_DIR)
+# glut pkgconfig file
+pcedit = sed \
+ -e 's,@INSTALL_DIR@,$(INSTALL_DIR),' \
+ -e 's,@LIB_DIR@,$(LIB_DIR),' \
+ -e 's,@VERSION@,$(GLUT_MAJOR).$(GLUT_MINOR).$(GLUT_TINY),'
+glut.pc: glut.pc.in
+ $(pcedit) $< > $@
+
+install: glut.pc
+ $(INSTALL) -d $(DESTDIR)$(INSTALL_DIR)/include/GL
+ $(INSTALL) -d $(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR)
+ $(INSTALL) -d $(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR)/pkgconfig
+ $(INSTALL) -m 644 $(TOP)/include/GL/glut.h $(DESTDIR)$(INSTALL_DIR)/include/GL
+ $(INSTALL) $(TOP)/$(LIB_DIR)/libglut* $(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR)
+ $(INSTALL) -m 644 glut.pc $(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR)/pkgconfig
clean:
diff --git a/src/glut/glx/Makefile.mgw b/src/glut/glx/Makefile.mgw
index ae4eb6addc..9fff2e1503 100644
--- a/src/glut/glx/Makefile.mgw
+++ b/src/glut/glx/Makefile.mgw
@@ -74,35 +74,29 @@ TOP = ../../..
LIBDIR = $(TOP)/lib
-GLUT_DLL = glut32.dll
-GLUT_IMP = libglut32.a
-GLUT_DEF = glut.def
+LIB_NAME = glut32
-include $(TOP)/configs/config.mgw
-GLUT_USING_STDCALL ?= 1
+DLL_EXT = .dll
+IMP_EXT = .a
+LIB_PRE = lib
+STRIP = -s
+AR = ar
+ARFLAGS = crus
+DLLTOOL = dlltool
+GLUT_DLL = $(LIB_NAME)$(DLL_EXT)
+GLUT_IMP = $(LIB_PRE)$(LIB_NAME)$(IMP_EXT)
+GLUT_DEF = $(LIB_NAME).def
LDLIBS = -L$(LIBDIR) -lwinmm -lgdi32 -luser32 -lopengl32 -lglu32
-LDFLAGS = -Wl,--out-implib=$(LIBDIR)/$(GLUT_IMP) -Wl,--output-def=$(LIBDIR)/$(GLUT_DEF)
+LDFLAGS = $(STRIP) -shared -fPIC -Wl,--kill-at
CFLAGS += -DBUILD_GLUT32 -DGLUT_BUILDING_LIB -DMESA -D_DLL
-
-ifeq ($(GL_USING_STDCALL),0)
- CFLAGS += -DGL_NO_STDCALL
-endif
-
-ifeq ($(GLUT_USING_STDCALL),1)
- CFLAGS += -D_STDCALL_SUPPORTED
- LDFLAGS += -Wl,--add-stdcall-alias
-else
- CFLAGS += -DGLUT_NO_STDCALL
-endif
-
CFLAGS += -DNDEBUG -DLIBRARYBUILD -I$(TOP)/include
-CC = gcc
-CXX = g++
+CC = $(TOOLS_PREFIX)gcc
+CXX = $(TOOLS_PREFIX)g++
CXXFLAGS = $(CFLAGS)
AR = ar
@@ -189,10 +183,9 @@ $(LIBDIR):
mkdir -p $(LIBDIR)
$(LIBDIR)/$(GLUT_DLL) $(LIBDIR)/$(GLUT_IMP): $(OBJECTS)
- $(CXX) -shared -fPIC -o $(LIBDIR)/$(GLUT_DLL) $(LDFLAGS) \
- $^ $(LDLIBS)
-
-
+ $(CXX) $(LDFLAGS) -o $(LIBDIR)/$(GLUT_DLL) $^ $(LDLIBS)
+ $(DLLTOOL) --as=as --dllname $(LIB_NAME) --output-def $(LIBDIR)/$(GLUT_DEF) $^
+ $(DLLTOOL) --as=as -k --dllname $(LIB_NAME) --output-lib $(LIBDIR)/$(GLUT_IMP) --def $(LIBDIR)/$(GLUT_DEF)
clean:
-$(call UNLINK,*.o) \ No newline at end of file
diff --git a/src/glut/glx/glut.pc.in b/src/glut/glx/glut.pc.in
new file mode 100644
index 0000000000..f732f2990d
--- /dev/null
+++ b/src/glut/glx/glut.pc.in
@@ -0,0 +1,11 @@
+prefix=@INSTALL_DIR@
+exec_prefix=${prefix}
+libdir=${exec_prefix}/@LIB_DIR@
+includedir=${prefix}/include
+
+Name: glut
+Description: Mesa OpenGL Utility Toolkit library
+Requires: gl glu
+Version: @VERSION@
+Libs: -L${libdir} -lglut
+Cflags: -I${includedir}
diff --git a/src/glut/glx/glut_dstr.c b/src/glut/glx/glut_dstr.c
index ec9386f3e5..2513af4539 100644
--- a/src/glut/glx/glut_dstr.c
+++ b/src/glut/glx/glut_dstr.c
@@ -291,6 +291,7 @@ loadVisuals(int *nitems_return)
fbmodes = (FrameBufferMode *) malloc(n * sizeof(FrameBufferMode));
if (fbmodes == NULL) {
*nitems_return = -1;
+ free(vlist);
return NULL;
}
for (i = 0; i < n; i++) {
diff --git a/src/glut/glx/glut_event.c b/src/glut/glx/glut_event.c
index 4e67da674e..b5df7b2311 100644
--- a/src/glut/glx/glut_event.c
+++ b/src/glut/glx/glut_event.c
@@ -24,7 +24,7 @@
# ifdef __sgi
# include <bstring.h> /* prototype for bzero used by FD_ZERO */
# endif
-# if (defined(SVR4) || defined(CRAY) || defined(AIXV3)) && !defined(FD_SETSIZE)
+# if (defined(__FreeBSD__) || defined(SVR4) || defined(CRAY) || defined(AIXV3)) && !defined(FD_SETSIZE)
# include <sys/select.h> /* select system call interface */
# ifdef luna
# include <sysent.h>
@@ -172,10 +172,14 @@ handleTimeouts(void)
GETTIMEOFDAY(&now);
while (IS_AT_OR_AFTER(__glutTimerList->timeout, now)) {
timer = __glutTimerList;
- __glutTimerList = timer->next;
+ /* call the timer function */
timer->func(timer->value);
+ /* remove from the linked list */
+ __glutTimerList = timer->next;
+ /* put this timer on the "free" list */
timer->next = freeTimerList;
freeTimerList = timer;
+
if (!__glutTimerList)
break;
}
diff --git a/src/glut/glx/glut_fcb.c b/src/glut/glx/glut_fcb.c
new file mode 100644
index 0000000000..c8a3422b36
--- /dev/null
+++ b/src/glut/glx/glut_fcb.c
@@ -0,0 +1,164 @@
+
+/* Copyright (c) Mark J. Kilgard, 1998. */
+
+/* This program is freely distributable without licensing fees
+ and is provided without guarantee or warrantee expressed or
+ implied. This program is -not- in the public domain. */
+
+/* I appreciate the guidance from William Mitchell
+ (mitchell@cam.nist.gov) in developing this friend interface
+ for use by the f90gl package. See ../../README.fortran */
+
+#include "glutint.h"
+
+/* FCB stands for Fortran CallBack. */
+
+/* There is only one idleFunc, menuStateFunc, and menuStatusFunc, so they
+ can be saved in the wrappers for Fortran rather than the C structures. */
+
+/* Set a Fortran callback function. */
+
+void APIENTRY
+__glutSetFCB(int which, GLUTproc func)
+{
+#ifdef SUPPORT_FORTRAN
+ switch (which) {
+ case GLUT_FCB_DISPLAY:
+ __glutCurrentWindow->fdisplay = (GLUTdisplayFCB) func;
+ break;
+ case GLUT_FCB_RESHAPE:
+ __glutCurrentWindow->freshape = (GLUTreshapeFCB) func;
+ break;
+ case GLUT_FCB_MOUSE:
+ __glutCurrentWindow->fmouse = (GLUTmouseFCB) func;
+ break;
+ case GLUT_FCB_MOTION:
+ __glutCurrentWindow->fmotion = (GLUTmotionFCB) func;
+ break;
+ case GLUT_FCB_PASSIVE:
+ __glutCurrentWindow->fpassive = (GLUTpassiveFCB) func;
+ break;
+ case GLUT_FCB_ENTRY:
+ __glutCurrentWindow->fentry = (GLUTentryFCB) func;
+ break;
+ case GLUT_FCB_KEYBOARD:
+ __glutCurrentWindow->fkeyboard = (GLUTkeyboardFCB) func;
+ break;
+ case GLUT_FCB_KEYBOARD_UP:
+ __glutCurrentWindow->fkeyboardUp = (GLUTkeyboardFCB) func;
+ break;
+ case GLUT_FCB_WINDOW_STATUS:
+ __glutCurrentWindow->fwindowStatus = (GLUTwindowStatusFCB) func;
+ break;
+ case GLUT_FCB_VISIBILITY:
+ __glutCurrentWindow->fvisibility = (GLUTvisibilityFCB) func;
+ break;
+ case GLUT_FCB_SPECIAL:
+ __glutCurrentWindow->fspecial = (GLUTspecialFCB) func;
+ break;
+ case GLUT_FCB_SPECIAL_UP:
+ __glutCurrentWindow->fspecialUp = (GLUTspecialFCB) func;
+ break;
+ case GLUT_FCB_BUTTON_BOX:
+ __glutCurrentWindow->fbuttonBox = (GLUTbuttonBoxFCB) func;
+ break;
+ case GLUT_FCB_DIALS:
+ __glutCurrentWindow->fdials = (GLUTdialsFCB) func;
+ break;
+ case GLUT_FCB_SPACE_MOTION:
+ __glutCurrentWindow->fspaceMotion = (GLUTspaceMotionFCB) func;
+ break;
+ case GLUT_FCB_SPACE_ROTATE:
+ __glutCurrentWindow->fspaceRotate = (GLUTspaceRotateFCB) func;
+ break;
+ case GLUT_FCB_SPACE_BUTTON:
+ __glutCurrentWindow->fspaceButton = (GLUTspaceButtonFCB) func;
+ break;
+ case GLUT_FCB_TABLET_MOTION:
+ __glutCurrentWindow->ftabletMotion = (GLUTtabletMotionFCB) func;
+ break;
+ case GLUT_FCB_TABLET_BUTTON:
+ __glutCurrentWindow->ftabletButton = (GLUTtabletButtonFCB) func;
+ break;
+#ifdef _WIN32
+ case GLUT_FCB_JOYSTICK:
+ __glutCurrentWindow->fjoystick = (GLUTjoystickFCB) func;
+ break;
+#endif
+ case GLUT_FCB_OVERLAY_DISPLAY:
+ __glutCurrentWindow->overlay->fdisplay = (GLUTdisplayFCB) func;
+ break;
+ case GLUT_FCB_SELECT:
+ __glutCurrentMenu->fselect = (GLUTselectFCB) func;
+ break;
+ case GLUT_FCB_TIMER:
+ __glutNewTimer->ffunc = (GLUTtimerFCB) func;
+ break;
+ }
+#endif
+}
+
+/* Get a Fortran callback function. */
+
+GLUTproc APIENTRY
+__glutGetFCB(int which)
+{
+#ifdef SUPPORT_FORTRAN
+ switch (which) {
+ case GLUT_FCB_DISPLAY:
+ return __glutCurrentWindow->fdisplay;
+ case GLUT_FCB_RESHAPE:
+ return __glutCurrentWindow->freshape;
+ case GLUT_FCB_MOUSE:
+ return __glutCurrentWindow->fmouse;
+ case GLUT_FCB_MOTION:
+ return __glutCurrentWindow->fmotion;
+ case GLUT_FCB_PASSIVE:
+ return __glutCurrentWindow->fpassive;
+ case GLUT_FCB_ENTRY:
+ return __glutCurrentWindow->fentry;
+ case GLUT_FCB_KEYBOARD:
+ return __glutCurrentWindow->fkeyboard;
+ case GLUT_FCB_KEYBOARD_UP:
+ return __glutCurrentWindow->fkeyboardUp;
+ case GLUT_FCB_WINDOW_STATUS:
+ return __glutCurrentWindow->fwindowStatus;
+ case GLUT_FCB_VISIBILITY:
+ return __glutCurrentWindow->fvisibility;
+ case GLUT_FCB_SPECIAL:
+ return __glutCurrentWindow->fspecial;
+ case GLUT_FCB_SPECIAL_UP:
+ return __glutCurrentWindow->fspecialUp;
+ case GLUT_FCB_BUTTON_BOX:
+ return __glutCurrentWindow->fbuttonBox;
+ case GLUT_FCB_DIALS:
+ return __glutCurrentWindow->fdials;
+ case GLUT_FCB_SPACE_MOTION:
+ return __glutCurrentWindow->fspaceMotion;
+ case GLUT_FCB_SPACE_ROTATE:
+ return __glutCurrentWindow->fspaceRotate;
+ case GLUT_FCB_SPACE_BUTTON:
+ return __glutCurrentWindow->fspaceButton;
+ case GLUT_FCB_TABLET_MOTION:
+ return __glutCurrentWindow->ftabletMotion;
+ case GLUT_FCB_TABLET_BUTTON:
+ return __glutCurrentWindow->ftabletButton;
+ case GLUT_FCB_JOYSTICK:
+#ifdef _WIN32
+ return __glutCurrentWindow->fjoystick;
+#else
+ return NULL;
+#endif
+ case GLUT_FCB_OVERLAY_DISPLAY:
+ return __glutCurrentWindow->overlay->fdisplay;
+ case GLUT_FCB_SELECT:
+ return __glutCurrentMenu->fselect;
+ case GLUT_FCB_TIMER:
+ return __glutTimerList ? __glutTimerList->ffunc : NULL;
+ default:
+ return NULL;
+ }
+#else
+ return NULL;
+#endif
+}
diff --git a/src/glut/mini/Makefile b/src/glut/mini/Makefile
index 177bfe2d2b..87ff43ce56 100644
--- a/src/glut/mini/Makefile
+++ b/src/glut/mini/Makefile
@@ -55,7 +55,7 @@ default: depend $(TOP)/$(LIB_DIR)/$(GLUT_LIB_NAME)
# Make the library
$(TOP)/$(LIB_DIR)/$(GLUT_LIB_NAME): depend $(OBJECTS)
- $(TOP)/bin/mklib -o $(GLUT_LIB) -linker '$(CC)' \
+ $(TOP)/bin/mklib -o $(GLUT_LIB) -linker '$(CC)' -ldflags '$(LDFLAGS)' \
-major $(GLUT_MAJOR) -minor $(GLUT_MINOR) -patch $(GLUT_TINY) \
$(GLUT_LIB_DEPS) -install $(TOP)/$(LIB_DIR) \
$(MKLIB_OPTIONS) $(OBJECTS)