diff options
Diffstat (limited to 'src/glut')
-rw-r--r-- | src/glut/beos/Makefile | 1 | ||||
-rw-r--r-- | src/glut/directfb/Makefile | 1 | ||||
-rw-r--r-- | src/glut/dos/Makefile.DJ | 126 | ||||
-rw-r--r-- | src/glut/fbdev/Makefile | 1 | ||||
-rw-r--r-- | src/glut/ggi/Makefile | 1 | ||||
-rw-r--r-- | src/glut/glx/Makefile | 7 | ||||
-rw-r--r-- | src/glut/glx/SConscript | 87 | ||||
-rw-r--r-- | src/glut/glx/descrip.mms | 208 | ||||
-rw-r--r-- | src/glut/glx/glut.def | 6 | ||||
-rw-r--r-- | src/glut/glx/glut.pc.in | 4 | ||||
-rw-r--r-- | src/glut/glx/glut_event.c | 9 | ||||
-rw-r--r-- | src/glut/glx/glut_init.c | 4 | ||||
-rw-r--r-- | src/glut/glx/glut_input.c | 2 | ||||
-rw-r--r-- | src/glut/glx/glut_ppm.c | 80 | ||||
-rw-r--r-- | src/glut/glx/glut_swap.c | 4 | ||||
-rw-r--r-- | src/glut/glx/glutint.h | 43 | ||||
-rw-r--r-- | src/glut/glx/glutstroke.h | 2 | ||||
-rw-r--r-- | src/glut/glx/glutwin32.h | 1 | ||||
-rw-r--r-- | src/glut/glx/mms_depend | 72 | ||||
-rw-r--r-- | src/glut/glx/win32_glx.c | 2 | ||||
-rw-r--r-- | src/glut/glx/win32_winproc.c | 4 | ||||
-rw-r--r-- | src/glut/glx/win32_x11.h | 2 | ||||
-rw-r--r-- | src/glut/mini/Makefile | 6 | ||||
-rw-r--r-- | src/glut/mini/glut.pc.in | 4 |
24 files changed, 223 insertions, 454 deletions
diff --git a/src/glut/beos/Makefile b/src/glut/beos/Makefile index 14f4f43f84..a9f8684c9b 100644 --- a/src/glut/beos/Makefile +++ b/src/glut/beos/Makefile @@ -92,6 +92,7 @@ clean: -rm -f *.o depend: $(SOURCES) + rm -f depend touch depend $(MKDEP) $(MKDEP_OPTIONS) $(INCLUDES) $(SOURCES) > /dev/null diff --git a/src/glut/directfb/Makefile b/src/glut/directfb/Makefile index 34c3743ef4..bf93d63e30 100644 --- a/src/glut/directfb/Makefile +++ b/src/glut/directfb/Makefile @@ -70,6 +70,7 @@ $(TOP)/$(LIB_DIR)/$(GLUT_LIB_NAME): depend $(OBJECTS) # Run 'make -f Makefile.solo dep' to update the dependencies if you change # what's included by any source file. depend: $(SOURCES) + rm -f depend touch depend $(MKDEP) $(MKDEP_OPTIONS) $(INCLUDES) $(SOURCES) > /dev/null diff --git a/src/glut/dos/Makefile.DJ b/src/glut/dos/Makefile.DJ deleted file mode 100644 index 7e4e0b8576..0000000000 --- a/src/glut/dos/Makefile.DJ +++ /dev/null @@ -1,126 +0,0 @@ -# DOS/DJGPP Mesa Utility Toolkit -# Version: 1.0 -# -# Copyright (C) 2005 Daniel Borca All Rights Reserved. -# -# Permission is hereby granted, free of charge, to any person obtaining a -# copy of this software and associated documentation files (the "Software"), -# to deal in the Software without restriction, including without limitation -# the rights to use, copy, modify, merge, publish, distribute, sublicense, -# and/or sell copies of the Software, and to permit persons to whom the -# Software is furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included -# in all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -# DANIEL BORCA BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER -# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - - -# -# Available options: -# -# Environment variables: -# CFLAGS -# -# GLIDE path to Glide3 SDK; used to resolve DXEs. -# default = $(TOP)/glide3 -# -# Targets: -# all: build GLUT -# clean: remove object files -# - - - -.PHONY: all clean - -TOP = ../../.. -GLIDE ?= $(TOP)/glide3 -LIBDIR = $(TOP)/lib -GLUT_LIB = libglut.a -GLUT_DXE = glut.dxe -GLUT_IMP = libiglut.a - -export LD_LIBRARY_PATH := $(LD_LIBRARY_PATH);$(LIBDIR);$(GLIDE)/lib - -CC = gcc -CFLAGS += -I$(TOP)/include -I. -IPC_HW -CFLAGS += -DGLUT_IMPORT_LIB - -AR = ar -ARFLAGS = crus - -HAVEDXE3 = $(wildcard $(DJDIR)/bin/dxe3gen.exe) - -ifeq ($(wildcard $(addsuffix /rm.exe,$(subst ;, ,$(PATH)))),) -UNLINK = del $(subst /,\,$(1)) -else -UNLINK = $(RM) $(1) -endif - -CORE_SOURCES = \ - loop.c \ - callback.c \ - color.c \ - extens.c \ - init.c \ - menu.c \ - mouse.c \ - overlay.c \ - state.c \ - util.c \ - window.c \ - f8x13.c \ - f9x15.c \ - hel10.c \ - hel12.c \ - hel18.c \ - tr10.c \ - tr24.c \ - mroman.c \ - roman.c \ - bitmap.c \ - stroke.c \ - teapot.c \ - shapes.c - -PC_HW_SOURCES = \ - PC_HW/pc_hw.c \ - PC_HW/pc_keyb.c \ - PC_HW/pc_mouse.c \ - PC_HW/pc_timer.c \ - PC_HW/pc_irq.S - -SOURCES = $(CORE_SOURCES) $(PC_HW_SOURCES) - -OBJECTS = $(addsuffix .o,$(basename $(SOURCES))) - -.c.o: - $(CC) -o $@ $(CFLAGS) -c $< -.S.o: - $(CC) -o $@ $(CFLAGS) -c $< -.s.o: - $(CC) -o $@ $(CFLAGS) -x assembler-with-cpp -c $< - -all: $(LIBDIR)/$(GLUT_LIB) $(LIBDIR)/$(GLUT_DXE) $(LIBDIR)/$(GLUT_IMP) - -$(LIBDIR)/$(GLUT_LIB): $(OBJECTS) - $(AR) $(ARFLAGS) $@ $^ - -$(LIBDIR)/$(GLUT_DXE) $(LIBDIR)/$(GLUT_IMP): $(OBJECTS) -ifeq ($(HAVEDXE3),) - $(warning Missing DXE3 package... Skipping $(GLUT_DXE)) -else - -dxe3gen -o $(LIBDIR)/$(GLUT_DXE) -Y $(LIBDIR)/$(GLUT_IMP) -D "MesaGLUT DJGPP" -E _glut -P gl.dxe -U $^ -endif - -clean: - -$(call UNLINK,*.o) - -$(call UNLINK,PC_HW/*.o) - --include depend diff --git a/src/glut/fbdev/Makefile b/src/glut/fbdev/Makefile index 4081ccec74..199d8c390a 100644 --- a/src/glut/fbdev/Makefile +++ b/src/glut/fbdev/Makefile @@ -77,6 +77,7 @@ install: # Run 'make -f Makefile.solo dep' to update the dependencies if you change # what's included by any source file. depend: $(SOURCES) + rm -f depend touch depend $(MKDEP) $(MKDEP_OPTIONS) $(INCLUDES) $(SOURCES) > /dev/null diff --git a/src/glut/ggi/Makefile b/src/glut/ggi/Makefile index 1ae1ba0d70..c23dfcac10 100644 --- a/src/glut/ggi/Makefile +++ b/src/glut/ggi/Makefile @@ -46,6 +46,7 @@ clean: depend: $(SOURCES) + rm -f depend touch depend $(MKDEP) $(MKDEP_OPTIONS) -I$(TOP)/include $(SOURCES) diff --git a/src/glut/glx/Makefile b/src/glut/glx/Makefile index 7f886f775a..9a975bbc60 100644 --- a/src/glut/glx/Makefile +++ b/src/glut/glx/Makefile @@ -56,6 +56,7 @@ SOURCES = \ glut_modifier.c \ glut_mroman.c \ glut_overlay.c \ + glut_ppm.c \ glut_roman.c \ glut_shapes.c \ glut_space.c \ @@ -103,7 +104,10 @@ pcedit = sed \ -e 's,@INSTALL_DIR@,$(INSTALL_DIR),' \ -e 's,@INSTALL_LIB_DIR@,$(INSTALL_LIB_DIR),' \ -e 's,@INSTALL_INC_DIR@,$(INSTALL_INC_DIR),' \ - -e 's,@VERSION@,$(GLUT_MAJOR).$(GLUT_MINOR).$(GLUT_TINY),' + -e 's,@VERSION@,$(GLUT_MAJOR).$(GLUT_MINOR).$(GLUT_TINY),' \ + -e 's,@GLUT_PC_REQ_PRIV@,$(GLUT_PC_REQ_PRIV),' \ + -e 's,@GLUT_PC_LIB_PRIV@,$(GLUT_PC_LIB_PRIV),' \ + -e 's,@GLUT_PC_CFLAGS@,$(GLUT_PC_CFLAGS),' glut.pc: glut.pc.in $(pcedit) $< > $@ @@ -127,6 +131,7 @@ clean: depend: $(SOURCES) @ echo "running $(MKDEP)" + @ rm -f depend @ touch depend @ $(MKDEP) $(MKDEP_OPTIONS) -I$(TOP)/include $(SOURCES) \ $(X11_INCLUDES) > /dev/null diff --git a/src/glut/glx/SConscript b/src/glut/glx/SConscript new file mode 100644 index 0000000000..938fec03df --- /dev/null +++ b/src/glut/glx/SConscript @@ -0,0 +1,87 @@ +Import('*') + +env = env.Clone() + +if env['platform'] != 'windows': + Return() + +target = 'glut32' + +env.Replace(CPPDEFINES = [ + 'BUILD_GLUT32', + 'GLUT_BUILDING_LIB', + 'NDEBUG', + 'GLUT_NO_WARNING_DISABLE', +]) + +env.AppendUnique(CPPPATH = [ + '#/include', +]) + +env.PrependUnique(LIBS = [ + 'winmm', + 'gdi32', + 'user32', + 'opengl32', + 'glu32', +]) + +sources = [ + 'glut_bitmap.c', + 'glut_bwidth.c', + 'glut_cindex.c', + 'glut_cmap.c', + 'glut_cursor.c', + 'glut_dials.c', + 'glut_dstr.c', + 'glut_event.c', + 'glut_ext.c', + 'glut_fullscrn.c', + 'glut_gamemode.c', + 'glut_get.c', + 'glut_init.c', + 'glut_input.c', + 'glut_joy.c', + 'glut_key.c', + 'glut_keyctrl.c', + 'glut_keyup.c', + 'glut_mesa.c', + 'glut_modifier.c', + 'glut_overlay.c', + 'glut_ppm.c', + 'glut_shapes.c', + 'glut_space.c', + 'glut_stroke.c', + 'glut_swap.c', + 'glut_swidth.c', + 'glut_tablet.c', + 'glut_teapot.c', + 'glut_util.c', + 'glut_vidresize.c', + 'glut_warp.c', + 'glut_win.c', + 'glut_winmisc.c', + + 'win32_glx.c', + 'win32_menu.c', + 'win32_util.c', + 'win32_winproc.c', + 'win32_x11.c', + + 'glut_8x13.c', + 'glut_9x15.c', + 'glut_hel10.c', + 'glut_hel12.c', + 'glut_hel18.c', + 'glut_mroman.c', + 'glut_roman.c', + 'glut_tr10.c', + 'glut_tr24.c', + + 'glut.def', +] + +env.SharedLibrary( + target = target, + source = sources, +) diff --git a/src/glut/glx/descrip.mms b/src/glut/glx/descrip.mms deleted file mode 100644 index 2e858309b6..0000000000 --- a/src/glut/glx/descrip.mms +++ /dev/null @@ -1,208 +0,0 @@ -# Makefile for GLUT for VMS -# contributed by Jouk Jansen joukj@hrem.stm.tudelft.nl - -.first - define gl [---.include.gl] - -.include [---]mms-config. - -##### MACROS ##### -GLUT_MAJOR = 3 -GLUT_MINOR = 7 - -VPATH = RCS - -INCDIR = [---.include] -LIBDIR = [---.lib] -CFLAGS = /nowarn/include=$(INCDIR)/prefix=all/name=(as_is,short)/float=ieee/ieee=denorm - -SOURCES = \ -glut_8x13.c \ -glut_9x15.c \ -glut_bitmap.c \ -glut_bwidth.c \ -glut_cindex.c \ -glut_cmap.c \ -glut_cursor.c \ -glut_dials.c \ -glut_dstr.c \ -glut_event.c \ -glut_ext.c \ -glut_fullscrn.c \ -glut_gamemode.c \ -glut_get.c \ -glut_glxext.c \ -glut_hel10.c \ -glut_hel12.c \ -glut_hel18.c \ -glut_init.c \ -glut_input.c \ -glut_joy.c \ -glut_key.c \ -glut_keyctrl.c \ -glut_keyup.c \ -glut_menu.c \ -glut_menu2.c \ -glut_mesa.c \ -glut_modifier.c \ -glut_mroman.c \ -glut_overlay.c \ -glut_roman.c \ -glut_shapes.c \ -glut_space.c \ -glut_stroke.c \ -glut_swap.c \ -glut_swidth.c \ -glut_tablet.c \ -glut_teapot.c \ -glut_tr10.c \ -glut_tr24.c \ -glut_util.c \ -glut_vidresize.c \ -glut_warp.c \ -glut_win.c \ -glut_winmisc.c \ -layerutil.c - -OBJECTS0=glut_8x13.obj,\ -glut_9x15.obj,\ -glut_bitmap.obj,\ -glut_bwidth.obj,\ -glut_cindex.obj,\ -glut_cmap.obj,\ -glut_cursor.obj,\ -glut_dials.obj,\ -glut_dstr.obj,\ -glut_event.obj,\ -glut_ext.obj,\ -glut_fullscrn.obj,\ -glut_gamemode.obj - -OBJECTS1=glut_get.obj,\ -glut_glxext.obj,\ -glut_hel10.obj,\ -glut_hel12.obj,\ -glut_hel18.obj,\ -glut_init.obj,\ -glut_input.obj,\ -glut_joy.obj,\ -glut_key.obj,\ -glut_keyctrl.obj,\ -glut_keyup.obj,\ -glut_menu.obj,\ -glut_menu2.obj,\ -glut_mesa.obj,\ -glut_modifier.obj - -OBJECTS2=glut_mroman.obj,\ -glut_overlay.obj,\ -glut_roman.obj,\ -glut_shapes.obj,\ -glut_space.obj,\ -glut_stroke.obj,\ -glut_swap.obj,\ -glut_swidth.obj,\ -glut_tablet.obj,\ -glut_teapot.obj,\ -glut_tr10.obj,\ -glut_tr24.obj,\ -glut_util.obj,\ -glut_vidresize.obj - -OBJECTS3=glut_warp.obj,\ -glut_win.obj,\ -glut_winmisc.obj,\ -layerutil.obj - -##### RULES ##### - -VERSION=Glut V3.7 - -##### TARGETS ##### - -# Make the library -$(LIBDIR)$(GLUT_LIB) : $(OBJECTS0) $(OBJECTS1) $(OBJECTS2) $(OBJECTS3) - @ $(MAKELIB) $(GLUT_LIB) $(OBJECTS0) - @ library $(GLUT_LIB) $(OBJECTS1) - @ library $(GLUT_LIB) $(OBJECTS2) - @ library $(GLUT_LIB) $(OBJECTS3) - @ rename $(GLUT_LIB)* $(LIBDIR) -.ifdef SHARE - @ WRITE_ SYS$OUTPUT " generating mesagl1.opt" - @ OPEN_/WRITE FILE mesagl1.opt - @ WRITE_ FILE "!" - @ WRITE_ FILE "! mesagl1.opt generated by DESCRIP.$(MMS_EXT)" - @ WRITE_ FILE "!" - @ WRITE_ FILE "IDENTIFICATION=""$(VERSION)""" - @ WRITE_ FILE "GSMATCH=LEQUAL,3,7 - @ WRITE_ FILE "$(OBJECTS0)" - @ WRITE_ FILE "$(OBJECTS1)" - @ WRITE_ FILE "$(OBJECTS2)" - @ WRITE_ FILE "$(OBJECTS3)" - @ WRITE_ FILE "[---.lib]libmesaglu.exe/SHARE" - @ WRITE_ FILE "[---.lib]libmesagl.exe/SHARE" - @ write file "sys$library:decw$xmulibshr.exe/share" - @ WRITE_ FILE "SYS$SHARE:DECW$XEXTLIBSHR/SHARE" - @ WRITE_ FILE "SYS$SHARE:DECW$XLIBSHR/SHARE" - @ CLOSE_ FILE - @ WRITE_ SYS$OUTPUT " generating mesagl.map ..." - @ CXXLINK_/NODEB/NOSHARE/NOEXE/MAP=mesagl.map/FULL mesagl1.opt/OPT - @ WRITE_ SYS$OUTPUT " analyzing mesagl.map ..." - @ @[---.vms]ANALYZE_MAP.COM mesagl.map mesagl.opt - @ WRITE_ SYS$OUTPUT " linking $(GLUT_SHAR) ..." - @ CXXLINK_/NODEB/SHARE=$(GLUT_SHAR)/MAP=mesagl.map/FULL mesagl1.opt/opt,mesagl.opt/opt - @ rename $(GLUT_SHAR)* $(LIBDIR) -.endif - -clean : - delete *.obj;* - purge - -include mms_depend. - -glut_8x13.obj : glut_8x13.c -glut_9x15.obj : glut_9x15.c -glut_bitmap.obj : glut_bitmap.c -glut_bwidth.obj : glut_bwidth.c -glut_cindex.obj : glut_cindex.c -glut_cmap.obj : glut_cmap.c -glut_cursor.obj : glut_cursor.c -glut_dials.obj : glut_dials.c -glut_dstr.obj : glut_dstr.c -glut_event.obj : glut_event.c -glut_ext.obj : glut_ext.c -glut_fullscrn.obj : glut_fullscrn.c -glut_gamemode.obj : glut_gamemode.c -glut_get.obj : glut_get.c -glut_glxext.obj : glut_glxext.c -glut_hel10.obj : glut_hel10.c -glut_hel12.obj : glut_hel12.c -glut_hel18.obj : glut_hel18.c -glut_init.obj : glut_init.c -glut_input.obj : glut_input.c -glut_joy.obj : glut_joy.c -glut_key.obj : glut_key.c -glut_keyctrl.obj : glut_keyctrl.c -glut_keyup.obj : glut_keyup.c -glut_menu.obj : glut_menu.c -glut_menu2.obj : glut_menu2.c -glut_mesa.obj : glut_mesa.c -glut_modifier.obj : glut_modifier.c -glut_mroman.obj : glut_mroman.c -glut_overlay.obj : glut_overlay.c -glut_roman.obj : glut_roman.c -glut_shapes.obj : glut_shapes.c -glut_space.obj : glut_space.c -glut_stroke.obj : glut_stroke.c -glut_swap.obj : glut_swap.c -glut_swidth.obj : glut_swidth.c -glut_tablet.obj : glut_tablet.c -glut_teapot.obj : glut_teapot.c -glut_tr10.obj : glut_tr10.c -glut_tr24.obj : glut_tr24.c -glut_util.obj : glut_util.c -glut_vidresize.obj : glut_vidresize.c -glut_warp.obj : glut_warp.c -glut_win.obj : glut_win.c -glut_winmisc.obj : glut_winmisc.c -layerutil.obj : layerutil.c diff --git a/src/glut/glx/glut.def b/src/glut/glx/glut.def index d5e0e0cf2a..90010815e4 100644 --- a/src/glut/glx/glut.def +++ b/src/glut/glx/glut.def @@ -1,9 +1,4 @@ -DESCRIPTION 'OpenGL Utility Toolkit for Win32' - -VERSION 3.7 - EXPORTS - glutAddMenuEntry glutAddSubMenu glutAttachMenu @@ -128,4 +123,3 @@ EXPORTS glutBitmapTimesRoman24 ; __glutSetFCB ; __glutGetFCB - diff --git a/src/glut/glx/glut.pc.in b/src/glut/glx/glut.pc.in index e8638fe148..ae0689d7e8 100644 --- a/src/glut/glx/glut.pc.in +++ b/src/glut/glx/glut.pc.in @@ -6,6 +6,8 @@ includedir=@INSTALL_INC_DIR@ Name: glut Description: Mesa OpenGL Utility Toolkit library Requires: gl glu +Requires.private: @GLUT_PC_REQ_PRIV@ Version: @VERSION@ Libs: -L${libdir} -lglut -Cflags: -I${includedir} +Libs.private: @GLUT_PC_LIB_PRIV@ +Cflags: -I${includedir} @GLUT_PC_CFLAGS@ diff --git a/src/glut/glx/glut_event.c b/src/glut/glx/glut_event.c index b5df7b2311..d6d963896a 100644 --- a/src/glut/glx/glut_event.c +++ b/src/glut/glx/glut_event.c @@ -1321,7 +1321,12 @@ processWindowWorkList(GLUTwindow * window) is where the finish works gets queued for indirect contexts. */ __glutSetWindow(window); - glFinish(); +#if !defined(_WIN32) + if (!window->isDirect) +#endif + { + glFinish(); + } } if (workMask & GLUT_DEBUG_WORK) { __glutSetWindow(window); @@ -1338,9 +1343,7 @@ processWindowWorkList(GLUTwindow * window) } } -#ifndef _WIN32 static /* X11 implementations do not need this global. */ -#endif void __glutProcessWindowWorkLists(void) { diff --git a/src/glut/glx/glut_init.c b/src/glut/glx/glut_init.c index b1a42a328d..78843e93bc 100644 --- a/src/glut/glx/glut_init.c +++ b/src/glut/glx/glut_init.c @@ -51,6 +51,7 @@ int __glutInitX = -1, __glutInitY = -1; GLboolean __glutForceDirect = GL_FALSE, __glutTryDirect = GL_TRUE; Atom __glutWMDeleteWindow; +char *__glutPPMFile = NULL; /* *INDENT-ON* */ #ifdef _WIN32 @@ -341,6 +342,9 @@ glutInit(int *argcp, char **argv) __glutFPS = 5000; /* 5000 milliseconds */ } } + + /* check if GLUT_PPM_FILE env var is set */ + __glutPPMFile = getenv("GLUT_PPM_FILE"); } #ifdef _WIN32 diff --git a/src/glut/glx/glut_input.c b/src/glut/glx/glut_input.c index a76ff9a435..7d2eda00f7 100644 --- a/src/glut/glx/glut_input.c +++ b/src/glut/glx/glut_input.c @@ -295,6 +295,7 @@ __glutProcessDeviceEvents(XEvent * event) static GLUTeventParser eventParser = {__glutProcessDeviceEvents, NULL}; +#if !defined(_WIN32) static void addDeviceEventParser(void) { @@ -305,6 +306,7 @@ addDeviceEventParser(void) been_here = True; __glutRegisterEventParser(&eventParser); } +#endif static int probeDevices(void) diff --git a/src/glut/glx/glut_ppm.c b/src/glut/glx/glut_ppm.c new file mode 100644 index 0000000000..49dca8532f --- /dev/null +++ b/src/glut/glx/glut_ppm.c @@ -0,0 +1,80 @@ +/* + * PPM file output + * Brian Paul + * 8 Dec 2008 + */ + +#include <assert.h> +#include <stdio.h> +#include <stdlib.h> +#include "glutint.h" + + +static void +write_ppm_file(const char *filename, const GLubyte *buffer, + int width, int height) +{ + const int binary = 1; + FILE *f = fopen( filename, "w" ); + if (f) { + const GLubyte *ptr = buffer; + int i, x, y; + if (binary) { + fprintf(f,"P6\n"); + fprintf(f,"# ppm-file created by GLUT\n"); + fprintf(f,"%i %i\n", width, height); + fprintf(f,"255\n"); + fclose(f); + f = fopen( filename, "ab" ); /* reopen in binary append mode */ + for (y = height - 1; y >= 0; y--) { + for (x = 0; x < width; x++) { + i = (y * width + x) * 4; + fputc(ptr[i], f); /* write red */ + fputc(ptr[i+1], f); /* write green */ + fputc(ptr[i+2], f); /* write blue */ + } + } + } + else { + /*ASCII*/ + int counter = 0; + fprintf(f,"P3\n"); + fprintf(f,"# ascii ppm file created by GLUT\n"); + fprintf(f,"%i %i\n", width, height); + fprintf(f,"255\n"); + for (y = height - 1; y >= 0; y--) { + for (x = 0; x < width; x++) { + i = (y * width + x) * 4; + fprintf(f, " %3d %3d %3d", ptr[i], ptr[i+1], ptr[i+2]); + counter++; + if (counter % 5 == 0) + fprintf(f, "\n"); + } + } + } + fclose(f); + } +} + + +/** + * Called from SwapBuffers if the GLUT_PPM_FILE env var is set. + */ +void __glutWritePPMFile(void) +{ + int w = glutGet(GLUT_WINDOW_WIDTH); + int h = glutGet(GLUT_WINDOW_HEIGHT); + GLubyte *buf; + + assert(__glutPPMFile); + + buf = (GLubyte *) malloc(w * h * 4); + if (buf) { + /* XXX save/restore pixel packing */ + glReadPixels(0, 0, w, h, GL_RGBA, GL_UNSIGNED_BYTE, buf); + write_ppm_file(__glutPPMFile, buf, w, h); + free(buf); + } + + __glutPPMFile = NULL; /* only write one file */ +} diff --git a/src/glut/glx/glut_swap.c b/src/glut/glx/glut_swap.c index 4831b8eb35..07a2da88a2 100644 --- a/src/glut/glx/glut_swap.c +++ b/src/glut/glx/glut_swap.c @@ -18,6 +18,10 @@ glutSwapBuffers(void) { GLUTwindow *window = __glutCurrentWindow; + if (__glutPPMFile) { + __glutWritePPMFile(); + } + if (window->renderWin == window->win) { if (__glutCurrentWindow->treatAsSingle) { /* Pretend the double buffered window is single buffered, diff --git a/src/glut/glx/glutint.h b/src/glut/glx/glutint.h index a962c78023..ba30af60f0 100644 --- a/src/glut/glx/glutint.h +++ b/src/glut/glx/glutint.h @@ -32,10 +32,6 @@ #include <GL/glut.h> -#if defined(MESA) && defined(_WIN32) && !defined(__CYGWIN32__) -#include <gl/mesa_wgl.h> -#endif - #ifndef _WIN32 /* added by BrianP: */ #ifndef APIENTRY @@ -48,24 +44,6 @@ /* GLUT_BUILDING_LIB is used by <GL/glut.h> to 1) not #pragma link with the GLUT library, and 2) avoid the Win32 atexit hack. */ -/* This must be done after <GL/gl.h> is included. MESA is defined - if the <GL/gl.h> is supplied by Brian Paul's Mesa library. */ -#if defined(MESA) && defined(_WIN32) -/* Mesa implements "wgl" versions of GDI entry points needed for - using OpenGL. Map these "wgl" versions to the GDI names via - macros. */ -#define ChoosePixelFormat wglChoosePixelFormat -#define DescribePixelFormat wglDescribePixelFormat -#define GetPixelFormat wglGetPixelFormat -#define SetPixelFormat wglSetPixelFormat -#define SwapBuffers wglSwapBuffers -#define GetCurrentContext wglGetCurrentContext -#define GetCurrentDC wglGetCurrentDC -#define MakeCurrent wglMakeCurrent -#define CreateContext wglCreateContext -#define DeleteContext wglDeleteContext -#endif /* MESA */ - #ifdef SUPPORT_FORTRAN #include <GL/glutf90.h> #endif @@ -572,27 +550,27 @@ typedef struct { #ifdef _WIN32 #define MAKE_CURRENT_LAYER(window) \ { \ - HGLRC currentContext = GetCurrentContext(); \ - HDC currentDc = GetCurrentDC(); \ + HGLRC currentContext = wglGetCurrentContext(); \ + HDC currentDc = wglGetCurrentDC(); \ \ if (currentContext != window->renderCtx \ || currentDc != window->renderDc) { \ - MakeCurrent(window->renderDc, window->renderCtx); \ + wglMakeCurrent(window->renderDc, window->renderCtx); \ } \ } #define MAKE_CURRENT_WINDOW(window) \ { \ - HGLRC currentContext = GetCurrentContext(); \ - HDC currentDc = GetCurrentDC(); \ + HGLRC currentContext = wglGetCurrentContext(); \ + HDC currentDc = wglGetCurrentDC(); \ \ if (currentContext != window->ctx || currentDc != window->hdc) { \ - MakeCurrent(window->hdc, window->ctx); \ + wglMakeCurrent(window->hdc, window->ctx); \ } \ } #define MAKE_CURRENT_OVERLAY(overlay) \ - MakeCurrent(overlay->hdc, overlay->ctx) + wglMakeCurrent(overlay->hdc, overlay->ctx) #define UNMAKE_CURRENT() \ - MakeCurrent(NULL, NULL) + wglMakeCurrent(NULL, NULL) #define SWAP_BUFFERS_WINDOW(window) \ SwapBuffers(window->hdc) #define SWAP_BUFFERS_LAYER(window) \ @@ -664,6 +642,7 @@ extern unsigned int __glutModifierMask; #ifdef _WIN32 extern void (__cdecl *__glutExitFunc)(int retval); #endif +extern char *__glutPPMFile; /* private variables from glut_menu.c */ extern GLUTmenuItem *__glutItemSelected; @@ -684,6 +663,9 @@ extern void __glutFreeOverlay(GLUToverlay * overlay); extern XVisualInfo *__glutDetermineWindowVisual(Bool * treatAsSingle, Bool * visAlloced, void **fbc); +/* private variables from glut_ppm.c */ +extern void __glutWritePPMFile(void); + /* private variables from glut_mesa.c */ extern int __glutMesaSwapHackSupport; @@ -812,4 +794,5 @@ extern LONG WINAPI __glutWindowProc(HWND win, UINT msg, WPARAM w, LPARAM l); extern HDC XHDC; #endif + #endif /* __glutint_h__ */ diff --git a/src/glut/glx/glutstroke.h b/src/glut/glx/glutstroke.h index cbc9e156fe..74b60314aa 100644 --- a/src/glut/glx/glutstroke.h +++ b/src/glut/glx/glutstroke.h @@ -7,7 +7,7 @@ and is provided without guarantee or warrantee expressed or implied. This program is -not- in the public domain. */ -#if defined(_WIN32) +#if defined(_MSC_VER) #pragma warning (disable:4244) /* disable bogus conversion warnings */ #pragma warning (disable:4305) /* VC++ 5.0 version of above warning. */ #endif diff --git a/src/glut/glx/glutwin32.h b/src/glut/glx/glutwin32.h index 304eeb20a2..01db99fad6 100644 --- a/src/glut/glx/glutwin32.h +++ b/src/glut/glx/glutwin32.h @@ -41,6 +41,7 @@ /* Private routines from win32_util.c */ #ifndef __CYGWIN32__ +struct timeval; extern int gettimeofday(struct timeval* tp, void* tzp); #endif extern void *__glutFont(void *font); diff --git a/src/glut/glx/mms_depend b/src/glut/glx/mms_depend deleted file mode 100644 index 98f87c29e2..0000000000 --- a/src/glut/glx/mms_depend +++ /dev/null @@ -1,72 +0,0 @@ -# DO NOT DELETE - -glut_8x13.obj : glutbitmap.h [---.include.gl]gl.h -glut_9x15.obj : glutbitmap.h [---.include.gl]gl.h -glut_bitmap.obj : [---.include.gl]glut.h [---.include.gl]gl.h [---.include.gl]glu.h -glut_bitmap.obj : glutint.h [---.include.gl]glx.h [---.include.gl]xmesa.h -glut_bitmap.obj : glutbitmap.h -glut_bwidth.obj : [---.include.gl]glut.h [---.include.gl]gl.h [---.include.gl]glu.h -glut_bwidth.obj : glutint.h [---.include.gl]glx.h [---.include.gl]xmesa.h -glut_bwidth.obj : glutbitmap.h -glut_cindex.obj : [---.include.gl]glut.h [---.include.gl]gl.h [---.include.gl]glu.h -glut_cindex.obj : glutint.h [---.include.gl]glx.h [---.include.gl]xmesa.h -glut_cindex.obj : layerutil.h -glut_cursor.obj : [---.include.gl]glut.h [---.include.gl]gl.h [---.include.gl]glu.h -glut_cursor.obj : glutint.h [---.include.gl]glx.h [---.include.gl]xmesa.h -glut_dials.obj : glutint.h [---.include.gl]glx.h [---.include.gl]gl.h -glut_dials.obj : [---.include.gl]xmesa.h [---.include.gl]glut.h [---.include.gl]glu.h -glut_dstr.obj : glutint.h [---.include.gl]glx.h [---.include.gl]gl.h -glut_dstr.obj : [---.include.gl]xmesa.h [---.include.gl]glut.h [---.include.gl]glu.h -glut_event.obj : [---.include.gl]glut.h [---.include.gl]gl.h [---.include.gl]glu.h -glut_event.obj : glutint.h [---.include.gl]glx.h [---.include.gl]xmesa.h -glut_ext.obj : [---.include.gl]glut.h [---.include.gl]gl.h [---.include.gl]glu.h -glut_ext.obj : glutint.h [---.include.gl]glx.h [---.include.gl]xmesa.h -glut_fullscrn.obj : glutint.h [---.include.gl]glx.h [---.include.gl]gl.h -glut_fullscrn.obj : [---.include.gl]xmesa.h [---.include.gl]glut.h -glut_fullscrn.obj : [---.include.gl]glu.h -glut_get.obj : [---.include.gl]glut.h [---.include.gl]gl.h [---.include.gl]glu.h -glut_get.obj : glutint.h [---.include.gl]glx.h [---.include.gl]xmesa.h -glut_hel10.obj : glutbitmap.h [---.include.gl]gl.h -glut_hel12.obj : glutbitmap.h [---.include.gl]gl.h -glut_hel18.obj : glutbitmap.h [---.include.gl]gl.h -glut_init.obj : [---.include.gl]glut.h [---.include.gl]gl.h [---.include.gl]glu.h -glut_init.obj : glutint.h [---.include.gl]glx.h [---.include.gl]xmesa.h -glut_menu.obj : [---.include.gl]glut.h [---.include.gl]gl.h [---.include.gl]glu.h -glut_menu.obj : glutint.h [---.include.gl]glx.h [---.include.gl]xmesa.h layerutil.h -glut_mesa.obj : glutint.h [---.include.gl]glx.h [---.include.gl]gl.h -glut_mesa.obj : [---.include.gl]xmesa.h [---.include.gl]glut.h [---.include.gl]glu.h -glut_modifier.obj : glutint.h [---.include.gl]glx.h [---.include.gl]gl.h -glut_modifier.obj : [---.include.gl]xmesa.h [---.include.gl]glut.h -glut_modifier.obj : [---.include.gl]glu.h -glut_mroman.obj : glutstroke.h -glut_overlay.obj : [---.include.gl]glut.h [---.include.gl]gl.h [---.include.gl]glu.h -glut_overlay.obj : glutint.h [---.include.gl]glx.h [---.include.gl]xmesa.h -glut_overlay.obj : layerutil.h -glut_roman.obj : glutstroke.h -glut_shapes.obj : [---.include.gl]glut.h [---.include.gl]gl.h [---.include.gl]glu.h -glut_shapes.obj : glutint.h [---.include.gl]glx.h [---.include.gl]xmesa.h -glut_space.obj : glutint.h [---.include.gl]glx.h [---.include.gl]gl.h -glut_space.obj : [---.include.gl]xmesa.h [---.include.gl]glut.h [---.include.gl]glu.h -glut_stroke.obj : [---.include.gl]glut.h [---.include.gl]gl.h [---.include.gl]glu.h -glut_stroke.obj : glutint.h [---.include.gl]glx.h [---.include.gl]xmesa.h -glut_stroke.obj : glutstroke.h -glut_swidth.obj : [---.include.gl]glut.h [---.include.gl]gl.h [---.include.gl]glu.h -glut_swidth.obj : glutint.h [---.include.gl]glx.h [---.include.gl]xmesa.h -glut_swidth.obj : glutstroke.h -glut_tablet.obj : glutint.h [---.include.gl]glx.h [---.include.gl]gl.h -glut_tablet.obj : [---.include.gl]xmesa.h [---.include.gl]glut.h [---.include.gl]glu.h -glut_teapot.obj : [---.include.gl]glut.h [---.include.gl]gl.h [---.include.gl]glu.h -glut_tr10.obj : glutbitmap.h [---.include.gl]gl.h -glut_tr24.obj : glutbitmap.h [---.include.gl]gl.h -glut_util.obj : [---.include.gl]glut.h [---.include.gl]gl.h [---.include.gl]glu.h -glut_util.obj : glutint.h [---.include.gl]glx.h [---.include.gl]xmesa.h -glut_vidresize.obj : [---.include.gl]glx.h [---.include.gl]gl.h -glut_vidresize.obj : [---.include.gl]xmesa.h glutint.h [---.include.gl]glut.h -glut_vidresize.obj : [---.include.gl]glu.h -glut_warp.obj : [---.include.gl]glut.h [---.include.gl]gl.h [---.include.gl]glu.h -glut_warp.obj : glutint.h [---.include.gl]glx.h [---.include.gl]xmesa.h -glut_win.obj : [---.include.gl]glut.h [---.include.gl]gl.h [---.include.gl]glu.h -glut_win.obj : glutint.h [---.include.gl]glx.h [---.include.gl]xmesa.h -glut_winmisc.obj : [---.include.gl]glut.h [---.include.gl]gl.h [---.include.gl]glu.h -glut_winmisc.obj : glutint.h [---.include.gl]glx.h [---.include.gl]xmesa.h -layerutil.obj : layerutil.h diff --git a/src/glut/glx/win32_glx.c b/src/glut/glx/win32_glx.c index ecfff44b93..3522e606ec 100644 --- a/src/glut/glx/win32_glx.c +++ b/src/glut/glx/win32_glx.c @@ -22,7 +22,7 @@ glXCreateContext(Display * display, XVisualInfo * visinfo, routine. */ HGLRC context; - context = CreateContext(XHDC); + context = wglCreateContext(XHDC); #if 0 /* XXX GLUT doesn't support it now, so don't worry about display list diff --git a/src/glut/glx/win32_winproc.c b/src/glut/glx/win32_winproc.c index e1fc785ebb..4a9dc3781c 100644 --- a/src/glut/glx/win32_winproc.c +++ b/src/glut/glx/win32_winproc.c @@ -20,10 +20,10 @@ extern unsigned __glutMenuButton; extern GLUTidleCB __glutIdleFunc; extern GLUTtimer *__glutTimerList; -extern GLUTmenuItem *__glutGetUniqueMenuItem(GLUTmenu * menu, int unique); +extern GLUTmenuItem *__glutGetUniqueMenuItem(GLUTmenu * menu, UINT unique); static HMENU __glutHMenu; -void +static void updateWindowState(GLUTwindow *window, int visState) { GLUTwindow* child; diff --git a/src/glut/glx/win32_x11.h b/src/glut/glx/win32_x11.h index 6f5c3a9aea..daf065e27b 100644 --- a/src/glut/glx/win32_x11.h +++ b/src/glut/glx/win32_x11.h @@ -228,7 +228,7 @@ typedef struct { SetWindowPos(window, HWND_BOTTOM, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE) #define XSetWMName(display, window, tp) \ - SetWindowText(window, (tp)->value) + SetWindowText(window, (const char *)(tp)->value) /* There really isn't a way to set the icon name separate from the windows name in Win32, so, just set the windows name. */ diff --git a/src/glut/mini/Makefile b/src/glut/mini/Makefile index e47d09edb7..841a473f89 100644 --- a/src/glut/mini/Makefile +++ b/src/glut/mini/Makefile @@ -64,6 +64,7 @@ $(TOP)/$(LIB_DIR)/$(GLUT_LIB_NAME): depend $(OBJECTS) # Run 'make -f Makefile.solo dep' to update the dependencies if you change # what's included by any source file. depend: $(SOURCES) + rm -f depend touch depend $(MKDEP) $(MKDEP_OPTIONS) $(INCLUDES) $(SOURCES) > /dev/null @@ -77,7 +78,10 @@ pcedit = sed \ -e 's,@INSTALL_DIR@,$(INSTALL_DIR),' \ -e 's,@INSTALL_LIB_DIR@,$(INSTALL_LIB_DIR),' \ -e 's,@INSTALL_INC_DIR@,$(INSTALL_INC_DIR),' \ - -e 's,@VERSION@,$(GLUT_MAJOR).$(GLUT_MINOR).$(GLUT_TINY),' + -e 's,@VERSION@,$(GLUT_MAJOR).$(GLUT_MINOR).$(GLUT_TINY),' \ + -e 's,@GLUT_PC_REQ_PRIV@,$(GLUT_PC_REQ_PRIV),' \ + -e 's,@GLUT_PC_LIB_PRIV@,$(GLUT_PC_LIB_PRIV),' \ + -e 's,@GLUT_PC_CFLAGS@,$(GLUT_PC_CFLAGS),' glut.pc: glut.pc.in $(pcedit) $< > $@ diff --git a/src/glut/mini/glut.pc.in b/src/glut/mini/glut.pc.in index e8638fe148..ae0689d7e8 100644 --- a/src/glut/mini/glut.pc.in +++ b/src/glut/mini/glut.pc.in @@ -6,6 +6,8 @@ includedir=@INSTALL_INC_DIR@ Name: glut Description: Mesa OpenGL Utility Toolkit library Requires: gl glu +Requires.private: @GLUT_PC_REQ_PRIV@ Version: @VERSION@ Libs: -L${libdir} -lglut -Cflags: -I${includedir} +Libs.private: @GLUT_PC_LIB_PRIV@ +Cflags: -I${includedir} @GLUT_PC_CFLAGS@ |