├── .gitignore ├── README.md ├── glew ├── LICENSE.txt ├── glewlib_2003.vcproj ├── glewlib_2005.vcproj ├── glewlib_2008.vcproj ├── glewlib_2010.vcxproj ├── glewlib_2012.vcxproj ├── glewlib_2013.vcxproj ├── glewlib_2015.vcxproj ├── include │ └── GL │ │ ├── GNUmakefile │ │ ├── glew.h │ │ ├── glxew.h │ │ └── wglew.h └── src │ ├── GNUmakefile │ ├── glew.c │ ├── glewinfo.c │ └── visualinfo.c ├── glut ├── glut_2008.vcproj ├── glut_2010.vcxproj ├── glut_2012.vcxproj ├── glut_2013.vcxproj ├── glut_2015.vcxproj ├── include │ └── GL │ │ ├── fglut.h │ │ ├── glut.h │ │ └── glutf90.h └── lib │ └── glut │ ├── GNUmakefile │ ├── Imakefile │ ├── Makefile.sgi │ ├── Makefile.win │ ├── MonoRoman.stroke │ ├── ObjectType.mk │ ├── Roman.stroke │ ├── capturexfont.c │ ├── glut.def │ ├── glut.nvmk │ ├── 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_fbc.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_wglext.c │ ├── glut_win.c │ ├── glut_winmisc.c │ ├── glutbitmap.h │ ├── glutint.h │ ├── glutstroke.h │ ├── glutwin32.h │ ├── layerutil.c │ ├── layerutil.h │ ├── makefile.nvmk │ ├── stroke.h │ ├── strokegen.y │ ├── strokelex.l │ ├── win32_glx.c │ ├── win32_glx.h │ ├── win32_menu.c │ ├── win32_util.c │ ├── win32_winproc.c │ ├── win32_x11.c │ └── win32_x11.h ├── interop ├── GNUmakefile ├── ReadMe.txt ├── fps_text_image.h ├── interop.cpp ├── interop_2015.vcxproj ├── interop_2015.vcxproj.user ├── request_vsync.c ├── request_vsync.h ├── sRGB_math.c ├── sRGB_math.h ├── showfps.c └── showfps.h └── interop_2015.sln /.gitignore: -------------------------------------------------------------------------------- 1 | Win32_*/ 2 | glew/Win32_*/ 3 | glut/Win32_*/ 4 | interop/Win32_*/ 5 | glew/x64_*/ 6 | glut/x64_*/ 7 | interop/x64_*/ 8 | interop_2015.VC.VC.opendb 9 | interop_2015.VC.db 10 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # opengl_interop 2 | 3 | This standalone example demonstrates sandboxed async renderer process 4 | generating sharing frames for master process via OpenGL interop using 5 | the WGL_NV_DX_interop2 extension. 6 | 7 | For more information about WGL_NV_DX_interop2: 8 | 9 | https://www.khronos.org/registry/OpenGL/extensions/NV/WGL_NV_DX_interop2.txt 10 | 11 | See interop/ReadMe.txt for details. 12 | 13 | Build instructions: open and build with the Visual Studio 2015 the 14 | solution named interop/interop_2015.sln 15 | 16 | This repo includes GLEW and GLUT. 17 | 18 | - Mark Kilgard 19 | March 7, 2018 20 | -------------------------------------------------------------------------------- /glew/LICENSE.txt: -------------------------------------------------------------------------------- 1 | The OpenGL Extension Wrangler Library 2 | Copyright (C) 2002-2007, Milan Ikits 3 | Copyright (C) 2002-2007, Marcelo E. Magallon 4 | Copyright (C) 2002, Lev Povalahev 5 | All rights reserved. 6 | 7 | Redistribution and use in source and binary forms, with or without 8 | modification, are permitted provided that the following conditions are met: 9 | 10 | * Redistributions of source code must retain the above copyright notice, 11 | this list of conditions and the following disclaimer. 12 | * Redistributions in binary form must reproduce the above copyright notice, 13 | this list of conditions and the following disclaimer in the documentation 14 | and/or other materials provided with the distribution. 15 | * The name of the author may be used to endorse or promote products 16 | derived from this software without specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 22 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 28 | THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | 31 | Mesa 3-D graphics library 32 | Version: 7.0 33 | 34 | Copyright (C) 1999-2007 Brian Paul All Rights Reserved. 35 | 36 | Permission is hereby granted, free of charge, to any person obtaining a 37 | copy of this software and associated documentation files (the "Software"), 38 | to deal in the Software without restriction, including without limitation 39 | the rights to use, copy, modify, merge, publish, distribute, sublicense, 40 | and/or sell copies of the Software, and to permit persons to whom the 41 | Software is furnished to do so, subject to the following conditions: 42 | 43 | The above copyright notice and this permission notice shall be included 44 | in all copies or substantial portions of the Software. 45 | 46 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 47 | OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 48 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 49 | BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN 50 | AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 51 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 52 | 53 | 54 | Copyright (c) 2007 The Khronos Group Inc. 55 | 56 | Permission is hereby granted, free of charge, to any person obtaining a 57 | copy of this software and/or associated documentation files (the 58 | "Materials"), to deal in the Materials without restriction, including 59 | without limitation the rights to use, copy, modify, merge, publish, 60 | distribute, sublicense, and/or sell copies of the Materials, and to 61 | permit persons to whom the Materials are furnished to do so, subject to 62 | the following conditions: 63 | 64 | The above copyright notice and this permission notice shall be included 65 | in all copies or substantial portions of the Materials. 66 | 67 | THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 68 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 69 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 70 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 71 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 72 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 73 | MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. 74 | -------------------------------------------------------------------------------- /glew/glewlib_2003.vcproj: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | 10 | 11 | 19 | 36 | 38 | 48 | 51 | 53 | 55 | 57 | 61 | 63 | 65 | 67 | 69 | 71 | 72 | 80 | 96 | 98 | 109 | 112 | 114 | 116 | 118 | 122 | 124 | 126 | 128 | 130 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | -------------------------------------------------------------------------------- /glew/glewlib_2008.vcproj: -------------------------------------------------------------------------------- 1 | 2 | 10 | 11 | 14 | 17 | 18 | 19 | 20 | 21 | 31 | 34 | 37 | 40 | 43 | 47 | 64 | 67 | 72 | 75 | 78 | 81 | 84 | 87 | 90 | 93 | 94 | 104 | 107 | 110 | 113 | 116 | 121 | 138 | 141 | 146 | 149 | 152 | 155 | 158 | 161 | 164 | 167 | 168 | 178 | 181 | 184 | 187 | 190 | 194 | 210 | 213 | 218 | 221 | 224 | 227 | 230 | 233 | 236 | 239 | 240 | 250 | 253 | 256 | 259 | 262 | 267 | 283 | 286 | 291 | 294 | 297 | 300 | 303 | 306 | 309 | 312 | 313 | 314 | 315 | 316 | 317 | 321 | 324 | 325 | 326 | 329 | 332 | 333 | 336 | 337 | 340 | 341 | 342 | 343 | 344 | 345 | 346 | -------------------------------------------------------------------------------- /glew/include/GL/GNUmakefile: -------------------------------------------------------------------------------- 1 | PACKAGEONLY=1 2 | 3 | CG_TOP := ../../../../.. 4 | 5 | include $(CG_TOP)/src/build_tools/cg/common.mk 6 | 7 | # how to get to this directory from src/build directory 8 | SOLNDIR := ../examples/OpenGL/glew/include/GL 9 | 10 | DEST_DIR=$(EXAMPLES_BUILTDIR)/OpenGL/glew/include/GL 11 | 12 | PACKAGE_FILES := 13 | PACKAGE_FILES += glew.h 14 | PACKAGE_FILES += glxew.h 15 | PACKAGE_FILES += wglew.h 16 | 17 | package:: 18 | $(foreach file,$(PACKAGE_FILES),$(call PACKAGE_FILE,$(file),$(DEST_DIR))) 19 | -------------------------------------------------------------------------------- /glew/src/GNUmakefile: -------------------------------------------------------------------------------- 1 | PACKAGEONLY=1 2 | 3 | CG_TOP := ../../../.. 4 | 5 | include $(CG_TOP)/src/build_tools/cg/common.mk 6 | 7 | # how to get to this directory from src/build directory 8 | SOLNDIR := ../examples/OpenGL/glew/src 9 | 10 | DEST_DIR=$(EXAMPLES_BUILTDIR)/OpenGL/glew/src 11 | 12 | PACKAGE_FILES := 13 | PACKAGE_FILES += glew.c 14 | 15 | package:: 16 | $(foreach file,$(PACKAGE_FILES),$(call PACKAGE_FILE,$(file),$(DEST_DIR))) 17 | -------------------------------------------------------------------------------- /glut/include/GL/glutf90.h: -------------------------------------------------------------------------------- 1 | #ifndef __glutf90_h__ 2 | #define __glutf90_h__ 3 | 4 | /* Copyright (c) Mark J. Kilgard & Willam F. Mitchell, 1998. */ 5 | 6 | /* This program is freely distributable without licensing fees 7 | and is provided without guarantee or warrantee expressed or 8 | implied. This program is -not- in the public domain. */ 9 | 10 | /* This header provides the binding interface for William Mitchell's 11 | f90gl Fortran 90 GLUT binding. Other GLUT language bindings 12 | can and should use this interace. */ 13 | 14 | /* I appreciate the guidance from William Mitchell 15 | (mitchell@cam.nist.gov) in developing this friend interface 16 | for use by the f90gl package. See ../../README.fortran */ 17 | 18 | #include 19 | 20 | /* Which callback enumerants for the __glutSetFCB/__glutGetFCB routines. */ 21 | /* NOTE These values are part of a binary interface for the f90gl Fortran 22 | 90 binding and so must NOT changes (additions are allowed). */ 23 | 24 | /* GLUTwindow callbacks. */ 25 | #define GLUT_FCB_DISPLAY 0 /* GLUTdisplayFCB */ 26 | #define GLUT_FCB_RESHAPE 1 /* GLUTreshapeFCB */ 27 | #define GLUT_FCB_MOUSE 2 /* GLUTmouseFCB */ 28 | #define GLUT_FCB_MOTION 3 /* GLUTmotionFCB */ 29 | #define GLUT_FCB_PASSIVE 4 /* GLUTpassiveFCB */ 30 | #define GLUT_FCB_ENTRY 5 /* GLUTentryFCB */ 31 | #define GLUT_FCB_KEYBOARD 6 /* GLUTkeyboardFCB */ 32 | #define GLUT_FCB_KEYBOARD_UP 7 /* GLUTkeyboardFCB */ 33 | #define GLUT_FCB_WINDOW_STATUS 8 /* GLUTwindowStatusFCB */ 34 | #define GLUT_FCB_VISIBILITY 9 /* GLUTvisibilityFCB */ 35 | #define GLUT_FCB_SPECIAL 10 /* GLUTspecialFCB */ 36 | #define GLUT_FCB_SPECIAL_UP 11 /* GLUTspecialFCB */ 37 | #define GLUT_FCB_BUTTON_BOX 12 /* GLUTbuttonBoxFCB */ 38 | #define GLUT_FCB_DIALS 13 /* GLUTdialsFCB */ 39 | #define GLUT_FCB_SPACE_MOTION 14 /* GLUTspaceMotionFCB */ 40 | #define GLUT_FCB_SPACE_ROTATE 15 /* GLUTspaceRotateFCB */ 41 | #define GLUT_FCB_SPACE_BUTTON 16 /* GLUTspaceButtonFCB */ 42 | #define GLUT_FCB_TABLET_MOTION 17 /* GLUTtabletMotionFCB */ 43 | #define GLUT_FCB_TABLET_BUTTON 18 /* GLUTtabletButtonFCB */ 44 | #define GLUT_FCB_JOYSTICK 19 /* GLUTjoystickFCB */ 45 | /* Non-GLUTwindow callbacks. */ 46 | #define GLUT_FCB_OVERLAY_DISPLAY 100 /* GLUTdisplayFCB */ 47 | #define GLUT_FCB_SELECT 101 /* GLUTselectFCB */ 48 | #define GLUT_FCB_TIMER 102 /* GLUTtimerFCB */ 49 | 50 | /* GLUT Fortran callback function types. */ 51 | typedef void (GLUTCALLBACK *GLUTdisplayFCB) (void); 52 | typedef void (GLUTCALLBACK *GLUTreshapeFCB) (int *, int *); 53 | /* NOTE the pressed key is int, not unsigned char for Fortran! */ 54 | typedef void (GLUTCALLBACK *GLUTkeyboardFCB) (int *, int *, int *); 55 | typedef void (GLUTCALLBACK *GLUTmouseFCB) (int *, int *, int *, int *); 56 | typedef void (GLUTCALLBACK *GLUTmotionFCB) (int *, int *); 57 | typedef void (GLUTCALLBACK *GLUTpassiveFCB) (int *, int *); 58 | typedef void (GLUTCALLBACK *GLUTentryFCB) (int *); 59 | typedef void (GLUTCALLBACK *GLUTwindowStatusFCB) (int *); 60 | typedef void (GLUTCALLBACK *GLUTvisibilityFCB) (int *); 61 | typedef void (GLUTCALLBACK *GLUTspecialFCB) (int *, int *, int *); 62 | typedef void (GLUTCALLBACK *GLUTbuttonBoxFCB) (int *, int *); 63 | typedef void (GLUTCALLBACK *GLUTdialsFCB) (int *, int *); 64 | typedef void (GLUTCALLBACK *GLUTspaceMotionFCB) (int *, int *, int *); 65 | typedef void (GLUTCALLBACK *GLUTspaceRotateFCB) (int *, int *, int *); 66 | typedef void (GLUTCALLBACK *GLUTspaceButtonFCB) (int *, int *); 67 | typedef void (GLUTCALLBACK *GLUTtabletMotionFCB) (int *, int *); 68 | typedef void (GLUTCALLBACK *GLUTtabletButtonFCB) (int *, int *, int *, int *); 69 | typedef void (GLUTCALLBACK *GLUTjoystickFCB) (unsigned int *buttonMask, int *x, int *y, int *z); 70 | 71 | typedef void (GLUTCALLBACK *GLUTselectFCB) (int *); 72 | typedef void (GLUTCALLBACK *GLUTtimerFCB) (int *); 73 | typedef void (GLUTCALLBACK *GLUTmenuStateFCB) (int *); /* DEPRICATED. */ 74 | typedef void (GLUTCALLBACK *GLUTmenuStatusFCB) (int *, int *, int *); 75 | typedef void (GLUTCALLBACK *GLUTidleFCB) (void); 76 | 77 | /* Functions that set and return Fortran callback functions. */ 78 | GLUTAPI void* GLUTAPIENTRY __glutGetFCB(int which); 79 | GLUTAPI void GLUTAPIENTRY __glutSetFCB(int which, void *func); 80 | 81 | #endif /* __glutf90_h__ */ 82 | -------------------------------------------------------------------------------- /glut/lib/glut/GNUmakefile: -------------------------------------------------------------------------------- 1 | #! smake 2 | # 3 | # Copyright (c) Mark J. Kilgard, 1995, 1998. 4 | # 5 | 6 | # NOTE: In my GLUT development tree, many of the C source files for 7 | # GLUT are generated. For this reason, "make full_clobber" will remove 8 | # these generated C files, while "make clobber" will not. 9 | 10 | TOP = ../.. 11 | 12 | # NOTE: 13 | # Don't build a .so, just a .a. This way, we don't need a runtime. 14 | # One less dependency to worry about. Besides, mjk wants it this way. 15 | # For a change, I agree with him.. --gk. 16 | TARGETS = libglut.a 17 | 18 | HDRS = glutint.h glutstroke.h layerutil.h glutbitmap.h 19 | 20 | SRCS = \ 21 | glut_bitmap.c \ 22 | glut_bwidth.c \ 23 | glut_cindex.c \ 24 | glut_cmap.c \ 25 | glut_cursor.c \ 26 | glut_dials.c \ 27 | glut_dstr.c \ 28 | glut_event.c \ 29 | glut_ext.c \ 30 | glut_fbc.c \ 31 | glut_fullscrn.c \ 32 | glut_gamemode.c \ 33 | glut_get.c \ 34 | glut_glxext.c \ 35 | glut_init.c \ 36 | glut_input.c \ 37 | glut_joy.c \ 38 | glut_key.c \ 39 | glut_keyctrl.c \ 40 | glut_keyup.c \ 41 | glut_menu.c \ 42 | glut_menu2.c \ 43 | glut_mesa.c \ 44 | glut_modifier.c \ 45 | glut_overlay.c \ 46 | glut_shapes.c \ 47 | glut_space.c \ 48 | glut_stroke.c \ 49 | glut_swap.c \ 50 | glut_swidth.c \ 51 | glut_tablet.c \ 52 | glut_teapot.c \ 53 | glut_util.c \ 54 | glut_vidresize.c \ 55 | glut_warp.c \ 56 | glut_win.c \ 57 | glut_winmisc.c \ 58 | layerutil.c 59 | 60 | SRCSSEMIGENS = \ 61 | glut_8x13.c \ 62 | glut_9x15.c \ 63 | glut_hel10.c \ 64 | glut_hel12.c \ 65 | glut_hel18.c \ 66 | glut_mroman.c \ 67 | glut_roman.c \ 68 | glut_tr10.c \ 69 | glut_tr24.c 70 | 71 | OBJS = $(SRCS:.c=.o) $(SRCSSEMIGENS:.c=.o) 72 | OTHERGENS = y.tab.c y.tab.h strokegen.c strokegen.h strokelex.c 73 | OTHERSRCS = strokegen.y strokelex.l stroke.h 74 | FONTS = Roman.stroke MonoRoman.stroke 75 | 76 | # Uncomment the LCDEFS line below if you want to build a version of 77 | # libglut.a that avoids using the SGI "fast atoms" optimization 78 | # introduced in IRIX 6.3. This optimization eliminates serveral X server 79 | # round-trips. If you are building libglut.a on an IRIX 6.3 or later 80 | # machine and want a chance (no guarantees) that GLUT executables built 81 | # against your libglut.a will work on IRIX 6.2 machines, uncomment out 82 | # the LCDEFS line below. Otherwise, you'll get a run-time message about 83 | # "attempted access to unresolvable symbol in XXX: _XSGIFastInternAtom" 84 | #LCDEFS = -DNO_FAST_ATOMS 85 | 86 | LCOPTS = -I$(VPATHPREFIX)$(TOP)/include 87 | LDIRT = *~ $(OTHERGENS) strokegen *.bak hardcopy glutsrc.ps capturexfont *.pure dstr dstr.c *.gen 88 | 89 | CFLAGS += $(LCOPTS) 90 | CFLAGS += -O2 91 | 92 | default: $(TARGETS) 93 | 94 | $(OBJS) : $(HDRS) 95 | 96 | install libs_install: default 97 | $(INSTALL) -F $(LIB_LOCATION) $(TARGETS) 98 | 99 | libglut.a: $(OBJS) 100 | $(RM) $@ 101 | $(AR) crl $@ $(OBJS) 102 | 103 | .ORDER : strokegen.h strokegen.c 104 | 105 | strokegen.h strokegen.c : strokegen.y 106 | $(YACC) -d strokegen.y 107 | $(MV) y.tab.c strokegen.c 108 | $(MV) y.tab.h strokegen.h 109 | 110 | # avoid warnings when compiling lex generated code 111 | strokegen.o : strokegen.c 112 | $(CC) $(CFLAGS) -woff 726,825,635,818,819,820,824,831,835,822,821,1167,1498,1116,1136,1174,1196,803 -c -MDupdate Makedepend strokegen.c 113 | 114 | strokelex.c : strokelex.l 115 | $(LEX) strokelex.l 116 | $(MV) lex.yy.c strokelex.c 117 | 118 | # avoid warnings when compiling lex generated code 119 | strokelex.o : strokelex.c 120 | $(CC) $(CFLAGS) -woff 831,825,817,835,702,819,635,824,822,1167,1498,1110,1196,1174,803 -c -MDupdate Makedepend strokelex.c 121 | 122 | strokegen : strokegen.o strokelex.o 123 | $(CC) -o $@ $(LDFLAGS) strokegen.o strokelex.o -ll 124 | 125 | capturexfont : capturexfont.o 126 | $(CC) -o $@ $(LDFLAGS) capturexfont.o -lX11 127 | 128 | # glut_roman.c and glut_mroman.c are now checked in, but here are rules to generate them 129 | glut_roman.c.gen : Roman.stroke strokegen 130 | ./strokegen -s glutStrokeRoman < Roman.stroke > $@ 131 | glut_mroman.c.gen : MonoRoman.stroke strokegen 132 | ./strokegen -s glutStrokeMonoRoman < MonoRoman.stroke > $@ 133 | 134 | glutsrc.ps : $(SRCS) 135 | $(RM) hardcopy 136 | mkdir -p hardcopy 137 | for i in $(SRCS) ;\ 138 | do \ 139 | grep -v CENTRY $$i | grep -v INDENT- > hardcopy/$$i; \ 140 | done 141 | cd hardcopy ; enscript -p ../$@ -G -2r `echo $(SRCS) | fmt -1 | sort` 142 | $(RM) hardcopy 143 | 144 | # The bitmap files can be generated using capturexfont, but because 145 | # they require a connection to an X server and potentially different 146 | # X servers have different fonts, these generated files are part 147 | # of the GLUT distribution. 148 | 149 | 9_BY_15 = -misc-fixed-medium-r-normal--15-140-75-75-C-90-iso8859-1 150 | 8_BY_13 = -misc-fixed-medium-r-normal--13-120-75-75-C-80-iso8859-1 151 | TR10 = -adobe-times-medium-r-normal--10-100-75-75-p-54-iso8859-1 152 | TR24 = -adobe-times-medium-r-normal--24-240-75-75-p-124-iso8859-1 153 | HEL10 = -adobe-helvetica-medium-r-normal--10-100-75-75-p-56-iso8859-1 154 | HEL12 = -adobe-helvetica-medium-r-normal--12-120-75-75-p-67-iso8859-1 155 | HEL18 = -adobe-helvetica-medium-r-normal--18-180-75-75-p-98-iso8859-1 156 | 157 | semigens : capturexfont 158 | ./capturexfont $(9_BY_15) glutBitmap9By15 > glut_9x15.c.gen 159 | ./capturexfont $(8_BY_13) glutBitmap8By13 > glut_8x13.c.gen 160 | ./capturexfont $(TR10) glutBitmapTimesRoman10 > glut_tr10.c.gen 161 | ./capturexfont $(TR24) glutBitmapTimesRoman24 > glut_tr24.c.gen 162 | ./capturexfont $(HEL10) glutBitmapHelvetica10 > glut_hel10.c.gen 163 | ./capturexfont $(HEL12) glutBitmapHelvetica12 > glut_hel12.c.gen 164 | ./capturexfont $(HEL18) glutBitmapHelvetica18 > glut_hel18.c.gen 165 | 166 | # unused test rule for test building 16-bit font 167 | JIS = -jis-fixed-medium-r-normal--24-230-75-75-c-240-jisx0208.1983-0 168 | glut_jis.c : 169 | ./capturexfont $(JIS) glutBitmapJis > $@ 170 | 171 | sources: $(SRCS) 172 | 173 | symcheck: libglut.a 174 | -nm -Bo $< | grep -v ' d ' | grep -v ' T glut' | grep -v ' D glut' | grep -v ' U ' | grep -v ' T __glut' | grep -v ' t ' | grep -v ' b ' | grep -v ' D __glut' | grep -v ' B __glut' 175 | 176 | dstr.c: glut_dstr.c 177 | ln -s glut_dstr.c $@ 178 | 179 | dstr: dstr.c glut_util.o glut_glxext.o 180 | $(RM) $@ 181 | $(CC) -g -o $@ $(CFLAGS) -DTEST dstr.c glut_util.o glut_glxext.o -lGLU -lGL -lXext -lX11 -lm 182 | 183 | ./glut.h : glut.h 184 | ./strokegen.h : strokegen.h 185 | ./stroke.h : stroke.h 186 | strokelex.o: strokelex.c strokegen.h 187 | 188 | clean: 189 | $(RM) $(LDIRT) 190 | $(RM) *.o 191 | $(RM) $(TARGETS) 192 | -------------------------------------------------------------------------------- /glut/lib/glut/Imakefile: -------------------------------------------------------------------------------- 1 | 2 | /* Copyright (c) Mark J. Kilgard, 1994, 1998. */ 3 | 4 | #define DoNormalLib YES 5 | #define DoSharedLib NO 6 | #define DoDebugLib NO 7 | #define DoProfileLib NO 8 | 9 | #define SoRev 3.7 10 | 11 | #include 12 | 13 | #include "../../Glut.cf" 14 | 15 | HDRS = \ 16 | glutint.h \ 17 | glutstroke.h \ 18 | layerutil.h 19 | 20 | SRCS = \ 21 | glut_8x13.c \ 22 | glut_9x15.c \ 23 | glut_bitmap.c \ 24 | glut_bwidth.c \ 25 | glut_cindex.c \ 26 | glut_cmap.c \ 27 | glut_cursor.c \ 28 | glut_dials.c \ 29 | glut_dstr.c \ 30 | glut_event.c \ 31 | glut_ext.c \ 32 | glut_fbc.c \ 33 | glut_fullscrn.c \ 34 | glut_gamemode.c \ 35 | glut_get.c \ 36 | glut_glxext.c \ 37 | glut_hel10.c \ 38 | glut_hel12.c \ 39 | glut_hel18.c \ 40 | glut_init.c \ 41 | glut_input.c \ 42 | glut_joy.c \ 43 | glut_key.c \ 44 | glut_keyctrl.c \ 45 | glut_keyup.c \ 46 | glut_menu.c \ 47 | glut_menu2.c \ 48 | glut_mesa.c \ 49 | glut_modifier.c \ 50 | glut_mroman.c \ 51 | glut_overlay.c \ 52 | glut_roman.c \ 53 | glut_shapes.c \ 54 | glut_space.c \ 55 | glut_stroke.c \ 56 | glut_swap.c \ 57 | glut_swidth.c \ 58 | glut_tablet.c \ 59 | glut_teapot.c \ 60 | glut_tr10.c \ 61 | glut_tr24.c \ 62 | glut_util.c \ 63 | glut_vidresize.c \ 64 | glut_warp.c \ 65 | glut_win.c \ 66 | glut_winmisc.c \ 67 | layerutil.c 68 | 69 | OBJS = \ 70 | glut_8x13.o \ 71 | glut_9x15.o \ 72 | glut_bitmap.o \ 73 | glut_bwidth.o \ 74 | glut_cindex.o \ 75 | glut_cmap.o \ 76 | glut_cursor.o \ 77 | glut_dials.o \ 78 | glut_dstr.o \ 79 | glut_event.o \ 80 | glut_ext.o \ 81 | glut_fbc.o \ 82 | glut_fullscrn.o \ 83 | glut_gamemode.o \ 84 | glut_get.o \ 85 | glut_glxext.o \ 86 | glut_hel10.o \ 87 | glut_hel12.o \ 88 | glut_hel18.o \ 89 | glut_init.o \ 90 | glut_input.o \ 91 | glut_joy.o \ 92 | glut_key.o \ 93 | glut_keyctrl.o \ 94 | glut_keyup.o \ 95 | glut_menu.o \ 96 | glut_menu2.o \ 97 | glut_mesa.o \ 98 | glut_modifier.o \ 99 | glut_mroman.o \ 100 | glut_overlay.o \ 101 | glut_roman.o \ 102 | glut_shapes.o \ 103 | glut_space.o \ 104 | glut_stroke.o \ 105 | glut_swap.o \ 106 | glut_swidth.o \ 107 | glut_tablet.o \ 108 | glut_teapot.o \ 109 | glut_tr10.o \ 110 | glut_tr24.o \ 111 | glut_util.o \ 112 | glut_vidresize.o \ 113 | glut_warp.o \ 114 | glut_win.o \ 115 | glut_winmisc.o \ 116 | layerutil.o 117 | 118 | #ifdef LibraryObjectRule 119 | LibraryObjectRule() 120 | #else 121 | /* XXX Very lame, you must be using pre-R5 config files! This 122 | will probably do essentially what LibraryObjectRule does. */ 123 | # if DoNormalLib 124 | NormalLibraryObjectRule() 125 | # endif 126 | # if DoSharedLib 127 | SharedLibraryObjectRule() 128 | # endif 129 | # if DoDebugLib 130 | DebuggedLibraryObjectRule() 131 | # endif 132 | # if DoProfileLib 133 | ProfiledLibraryObjectRule() 134 | # endif 135 | #endif 136 | 137 | #if DoNormalLib 138 | NormalLibraryTarget(glut,$(OBJS)) 139 | #endif 140 | #if DoSharedLib 141 | SharedLibraryTarget(glut,SoRev,$(OBJS),.,.) 142 | #endif 143 | #if DoDebugLib 144 | DebuggedLibraryTarget(glut,$(OBJS)) 145 | #endif 146 | #if DoProfileLib 147 | ProfiledLibraryTarget(glut,$(OBJS)) 148 | #endif 149 | 150 | /* I've gotten too many complaints from people (mostly Linux users) 151 | trying to build GLUT that have problems using lex and yacc to 152 | build the stroke fonts for GLUT so I will simply supply the 153 | generated C stroke fonts files. If you would like to build the 154 | fonts, please uncomment the following define of BuildStrokeFontsWithLex 155 | and regenerate the Makefile. */ 156 | 157 | /* #define BuildStrokeFontsWithLex */ 158 | 159 | #ifdef BuildStrokeFontsWithLex 160 | 161 | # for SGI's parallel make 162 | .ORDER : strokegen.h strokegen.c 163 | 164 | strokegen.h strokegen.c : strokegen.y 165 | $(YACC) -d strokegen.y 166 | $(MV) y.tab.c strokegen.c 167 | $(MV) y.tab.h strokegen.h 168 | 169 | /* XXX Attempt to make up for the lack of lex support in pre-R6 imake 170 | config files. */ 171 | #ifndef LexCmd 172 | #define LexCmd lex 173 | LEX = LexCmd 174 | #endif 175 | #ifndef LexLib 176 | #define LexLib -ll 177 | LEXLIB = LexLib 178 | #endif 179 | 180 | strokelex.c : strokelex.l 181 | $(LEX) strokelex.l 182 | $(MV) lex.yy.c strokelex.c 183 | 184 | strokegen : strokegen.o strokelex.o 185 | $(CC) -o $@ $(CFLAGS) strokegen.o strokelex.o $(LEXLIB) 186 | 187 | glut_roman.c : Roman.stroke strokegen 188 | ./strokegen -s glutStrokeRoman < Roman.stroke > $@ 189 | 190 | glut_mroman.c : MonoRoman.stroke strokegen 191 | ./strokegen -s glutStrokeMonoRoman < MonoRoman.stroke > $@ 192 | 193 | GEN_STROKES = glut_roman.c glut_mroman.c 194 | 195 | depend:: glut_roman.c glut_mroman.c 196 | 197 | #endif /* BuildStrokeFontsWithLex */ 198 | 199 | clean:: 200 | $(RM) y.tab.h y.tab.c lex.yy.c gram.h gram.c lex.c 201 | $(RM) strokelex.c strokegen.c $(GEN_STROKES) strokegen capturexfont 202 | 203 | DependTarget() 204 | -------------------------------------------------------------------------------- /glut/lib/glut/Makefile.sgi: -------------------------------------------------------------------------------- 1 | #! smake 2 | # 3 | # Copyright (c) Mark J. Kilgard, 1995, 1998. 4 | # 5 | include $(ROOT)/usr/include/make/commondefs 6 | 7 | # NOTE: In my GLUT development tree, many of the C source files for 8 | # GLUT are generated. For this reason, "make full_clobber" will remove 9 | # these generated C files, while "make clobber" will not. 10 | 11 | TOP = ../.. 12 | 13 | TARGETS = libglut.a 14 | 15 | LN = ln -s 16 | MV = mv 17 | RM = -rm -rf 18 | 19 | HDRS = glutint.h glutstroke.h layerutil.h glutbitmap.h 20 | 21 | SRCS = \ 22 | glut_bitmap.c \ 23 | glut_bwidth.c \ 24 | glut_cindex.c \ 25 | glut_cmap.c \ 26 | glut_cursor.c \ 27 | glut_dials.c \ 28 | glut_dstr.c \ 29 | glut_event.c \ 30 | glut_ext.c \ 31 | glut_fbc.c \ 32 | glut_fullscrn.c \ 33 | glut_gamemode.c \ 34 | glut_get.c \ 35 | glut_glxext.c \ 36 | glut_init.c \ 37 | glut_input.c \ 38 | glut_joy.c \ 39 | glut_key.c \ 40 | glut_keyctrl.c \ 41 | glut_keyup.c \ 42 | glut_menu.c \ 43 | glut_menu2.c \ 44 | glut_mesa.c \ 45 | glut_modifier.c \ 46 | glut_overlay.c \ 47 | glut_shapes.c \ 48 | glut_space.c \ 49 | glut_stroke.c \ 50 | glut_swap.c \ 51 | glut_swidth.c \ 52 | glut_tablet.c \ 53 | glut_teapot.c \ 54 | glut_util.c \ 55 | glut_vidresize.c \ 56 | glut_warp.c \ 57 | glut_win.c \ 58 | glut_winmisc.c \ 59 | layerutil.c 60 | 61 | SRCSSEMIGENS = \ 62 | glut_8x13.c \ 63 | glut_9x15.c \ 64 | glut_hel10.c \ 65 | glut_hel12.c \ 66 | glut_hel18.c \ 67 | glut_mroman.c \ 68 | glut_roman.c \ 69 | glut_tr10.c \ 70 | glut_tr24.c 71 | 72 | OBJS = $(SRCS:.c=.o) $(SRCSSEMIGENS:.c=.o) 73 | OTHERGENS = y.tab.c y.tab.h strokegen.c strokegen.h strokelex.c 74 | OTHERSRCS = strokegen.y strokelex.l stroke.h 75 | FONTS = Roman.stroke MonoRoman.stroke 76 | 77 | # Uncomment the LCDEFS line below if you want to build a version of 78 | # libglut.a that avoids using the SGI "fast atoms" optimization 79 | # introduced in IRIX 6.3. This optimization eliminates serveral X server 80 | # round-trips. If you are building libglut.a on an IRIX 6.3 or later 81 | # machine and want a chance (no guarantees) that GLUT executables built 82 | # against your libglut.a will work on IRIX 6.2 machines, uncomment out 83 | # the LCDEFS line below. Otherwise, you'll get a run-time message about 84 | # "attempted access to unresolvable symbol in XXX: _XSGIFastInternAtom" 85 | #LCDEFS = -DNO_FAST_ATOMS 86 | 87 | LCOPTS = -I$(TOP)/include -fullwarn 88 | LWOFF = ,813,852,827,826 89 | LDIRT = *~ $(OTHERGENS) strokegen *.bak hardcopy glutsrc.ps capturexfont *.pure dstr dstr.c *.gen 90 | 91 | default: $(TARGETS) 92 | 93 | sinclude ObjectType.mk 94 | 95 | $(OBJS) : $(HDRS) 96 | 97 | libglut.a : $(OBJS) 98 | $(RM) $@ 99 | $(AR) crl $@ $(OBJS) 100 | 101 | .ORDER : strokegen.h strokegen.c 102 | 103 | strokegen.h strokegen.c : strokegen.y 104 | $(YACC) -d strokegen.y 105 | $(MV) y.tab.c strokegen.c 106 | $(MV) y.tab.h strokegen.h 107 | 108 | # avoid warnings when compiling lex generated code 109 | strokegen.o : strokegen.c 110 | $(CC) $(CFLAGS) -woff 726,825,635,818,819,820,824,831,835,822,821,1167,1498,1116,1136,1174,1196,803 -c -MDupdate Makedepend strokegen.c 111 | 112 | strokelex.c : strokelex.l 113 | $(LEX) strokelex.l 114 | $(MV) lex.yy.c strokelex.c 115 | 116 | # avoid warnings when compiling lex generated code 117 | strokelex.o : strokelex.c 118 | $(CC) $(CFLAGS) -woff 831,825,817,835,702,819,635,824,822,1167,1498,1110,1196,1174,803 -c -MDupdate Makedepend strokelex.c 119 | 120 | strokegen : strokegen.o strokelex.o 121 | $(CC) -o $@ $(LDFLAGS) strokegen.o strokelex.o -ll 122 | 123 | capturexfont : capturexfont.o 124 | $(CC) -o $@ $(LDFLAGS) capturexfont.o -lX11 125 | 126 | # glut_roman.c and glut_mroman.c are now checked in, but here are rules to generate them 127 | glut_roman.c.gen : Roman.stroke strokegen 128 | ./strokegen -s glutStrokeRoman < Roman.stroke > $@ 129 | glut_mroman.c.gen : MonoRoman.stroke strokegen 130 | ./strokegen -s glutStrokeMonoRoman < MonoRoman.stroke > $@ 131 | 132 | glutsrc.ps : $(SRCS) 133 | $(RM) hardcopy 134 | mkdir -p hardcopy 135 | for i in $(SRCS) ;\ 136 | do \ 137 | grep -v CENTRY $$i | grep -v INDENT- > hardcopy/$$i; \ 138 | done 139 | cd hardcopy ; enscript -p ../$@ -G -2r `echo $(SRCS) | fmt -1 | sort` 140 | $(RM) hardcopy 141 | 142 | # The bitmap files can be generated using capturexfont, but because 143 | # they require a connection to an X server and potentially different 144 | # X servers have different fonts, these generated files are part 145 | # of the GLUT distribution. 146 | 147 | 9_BY_15 = -misc-fixed-medium-r-normal--15-140-75-75-C-90-iso8859-1 148 | 8_BY_13 = -misc-fixed-medium-r-normal--13-120-75-75-C-80-iso8859-1 149 | TR10 = -adobe-times-medium-r-normal--10-100-75-75-p-54-iso8859-1 150 | TR24 = -adobe-times-medium-r-normal--24-240-75-75-p-124-iso8859-1 151 | HEL10 = -adobe-helvetica-medium-r-normal--10-100-75-75-p-56-iso8859-1 152 | HEL12 = -adobe-helvetica-medium-r-normal--12-120-75-75-p-67-iso8859-1 153 | HEL18 = -adobe-helvetica-medium-r-normal--18-180-75-75-p-98-iso8859-1 154 | 155 | semigens : capturexfont 156 | ./capturexfont $(9_BY_15) glutBitmap9By15 > glut_9x15.c.gen 157 | ./capturexfont $(8_BY_13) glutBitmap8By13 > glut_8x13.c.gen 158 | ./capturexfont $(TR10) glutBitmapTimesRoman10 > glut_tr10.c.gen 159 | ./capturexfont $(TR24) glutBitmapTimesRoman24 > glut_tr24.c.gen 160 | ./capturexfont $(HEL10) glutBitmapHelvetica10 > glut_hel10.c.gen 161 | ./capturexfont $(HEL12) glutBitmapHelvetica12 > glut_hel12.c.gen 162 | ./capturexfont $(HEL18) glutBitmapHelvetica18 > glut_hel18.c.gen 163 | 164 | # unused test rule for test building 16-bit font 165 | JIS = -jis-fixed-medium-r-normal--24-230-75-75-c-240-jisx0208.1983-0 166 | glut_jis.c : 167 | ./capturexfont $(JIS) glutBitmapJis > $@ 168 | 169 | sources: $(SRCS) 170 | 171 | symcheck: libglut.a 172 | -nm -Bo libglut.a | grep -v ' d ' | grep -v ' T glut' | grep -v ' D glut' | grep -v ' U ' | grep -v ' T __glut' | grep -v ' t ' | grep -v ' b ' | grep -v ' D __glut' | grep -v ' B __glut' 173 | 174 | dstr.c: glut_dstr.c 175 | ln -s glut_dstr.c $@ 176 | 177 | dstr: dstr.c glut_util.o glut_glxext.o 178 | $(RM) $@ 179 | $(CC) -g -o $@ $(CFLAGS) -DTEST dstr.c glut_util.o glut_glxext.o -lGLU -lGL -lXext -lX11 -lm 180 | 181 | ./glut.h : glut.h 182 | ./glutint.h : glutint.h 183 | ./glutstroke.h : glutstroke.h 184 | ./strokegen.h : strokegen.h 185 | ./stroke.h : stroke.h 186 | ./layerutil.h : layerutil.h 187 | strokelex.o: strokelex.c strokegen.h 188 | 189 | include $(COMMONRULES) 190 | -------------------------------------------------------------------------------- /glut/lib/glut/Makefile.win: -------------------------------------------------------------------------------- 1 | # Makefile for Win32 2 | 3 | TOP = ..\.. 4 | 5 | !ifdef WOA 6 | !include "$(TOP)\woa.mak" 7 | !else 8 | !include 9 | !endif 10 | 11 | # NOTE: glut_menu.c and glut_glxext.c are NOT compiled into Win32 GLUT 12 | 13 | SRCS = 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_fbc.c glut_fullscrn.c glut_gamemode.c glut_get.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_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 win32_glx.c win32_menu.c win32_util.c win32_winproc.c win32_x11.c glut_wglext.c 14 | 15 | all : glutdll install 16 | 17 | !include "$(TOP)/glutwin32.mak" 18 | 19 | glutdll : $(GLUTDLL) 20 | 21 | !IFDEF NODEBUG 22 | OPTIMIZE_CFLAGS = -DNDEBUG 23 | !ENDIF 24 | 25 | CFLAGS = $(cvarsdll) $(CFLAGS) $(OPTIMIZE_CFLAGS) 26 | LFLAGS = $(dlllflags) $(LFLAGS) 27 | 28 | OBJS = $(SRCS:.c=.obj) 29 | MS_LIBS = $(MS_OPENGL) $(MS_GLU) winmm.lib $(guilibsdll) 30 | SGI_LIBS = $(SGI_OPENGL) $(SGI_GLU) winmm.lib $(guilibsdll) 31 | 32 | glut32.dll : $(OBJS) glut.def 33 | $(link) $(LFLAGS) -out:glut32.dll -def:glut.def $(OBJS) $(MS_LIBS) 34 | 35 | glut.dll : $(OBJS) glut.def 36 | $(link) $(LFLAGS) -out:glut.dll -def:glut.def $(OBJS) $(SGI_LIBS) 37 | 38 | install : $(GLUTDLL) 39 | !ifndef WOA 40 | $(ECHO) copying GLUT dynamic link library to system directory... 41 | -copy $(GLUTDLL) $(DLLINSTALL) 42 | $(ECHO) copying GLUT header file to Visual C 4.x include directory... 43 | -if exist $(VC4_INCLUDEINSTALL) copy ..\..\include\GL\glut.h $(VC4_INCLUDEINSTALL) 44 | $(ECHO) copying GLUT import library to Visual C 4.x library directory... 45 | -if exist $(VC4_LIBINSTALL) copy $(GLUTLIB) $(VC4_LIBINSTALL) 46 | $(ECHO) copying GLUT header file to Visual C 5.x include directory... 47 | -if exist $(VC5_INCLUDEINSTALL) copy ..\..\include\GL\glut.h $(VC5_INCLUDEINSTALL) 48 | $(ECHO) copying GLUT import library to Visual C 5.x library directory... 49 | -if exist $(VC5_LIBINSTALL) copy $(GLUTLIB) $(VC5_LIBINSTALL) 50 | $(ECHO) copying GLUT header file to Visual C 6.x include directory... 51 | -if exist $(VC6_INCLUDEINSTALL) copy ..\..\include\GL\glut.h $(VC6_INCLUDEINSTALL) 52 | $(ECHO) copying GLUT import library to Visual C 6.x library directory... 53 | -if exist $(VC6_LIBINSTALL) copy $(GLUTLIB) $(VC6_LIBINSTALL) 54 | $(ECHO) copying GLUT header file to Visual C 7.x include directory... 55 | -if exist $(VC7_INCLUDEINSTALL) copy ..\..\include\GL\glut.h $(VC7_INCLUDEINSTALL) 56 | $(ECHO) copying GLUT import library to Visual C 7.x library directory... 57 | -if exist $(VC7_LIBINSTALL) copy $(GLUTLIB) $(VC7_LIBINSTALL) 58 | $(ECHO) copying GLUT header file to Visual C 8.x include directory... 59 | -if exist $(VC8_INCLUDEINSTALL) copy ..\..\include\GL\glut.h $(VC8_INCLUDEINSTALL) 60 | $(ECHO) copying GLUT import library to Visual C 8.x library directory... 61 | -if exist $(VC8_LIBINSTALL) copy $(GLUTLIB) $(VC8_LIBINSTALL) 62 | !endif 63 | 64 | .c.obj : 65 | $(cc) $(CFLAGS) -I . $*.c 66 | 67 | NMSYM = nmsym 68 | 69 | glut32.nms : $(GLUTDLL) 70 | $(NMSYM) -translate:source,package -source:. glut32.dll 71 | 72 | # explicit object dependencies for all source files 73 | 74 | win32_glx.obj: win32_glx.c win32_glx.h 75 | win32_x11.obj: win32_x11.c win32_x11.h 76 | win32_menu.obj: win32_menu.c glutint.h ..\..\include\GL\glutf90.h ..\..\include\GL\glut.h 77 | win32_util.obj: win32_util.c glutint.h ..\..\include\GL\glutf90.h 78 | win32_winproc.obj: win32_winproc.c glutint.h ..\..\include\GL\glutf90.h 79 | 80 | glut_mroman.obj: glut_mroman.c glutstroke.h glutint.h ..\..\include\GL\glutf90.h 81 | glut_roman.obj: glut_roman.c glutstroke.h glutint.h ..\..\include\GL\glutf90.h 82 | glut_hel12.obj: glut_hel12.c glutbitmap.h glutint.h ..\..\include\GL\glutf90.h 83 | glut_8x13.obj: glut_8x13.c glutbitmap.h glutint.h ..\..\include\GL\glutf90.h 84 | glut_hel18.obj: glut_hel18.c glutbitmap.h glutint.h ..\..\include\GL\glutf90.h 85 | glut_9x15.obj: glut_9x15.c glutbitmap.h glutint.h ..\..\include\GL\glutf90.h 86 | glut_tr10.obj: glut_tr10.c glutbitmap.h glutint.h ..\..\include\GL\glutf90.h 87 | glut_hel10.obj: glut_hel10.c glutbitmap.h glutint.h ..\..\include\GL\glutf90.h 88 | glut_tr24.obj: glut_tr24.c glutbitmap.h glutint.h ..\..\include\GL\glutf90.h 89 | 90 | glut_bitmap.obj: glut_bitmap.c glutint.h ..\..\include\GL\glutf90.h ..\..\include\GL\glut.h glutwin32.h win32_glx.h win32_x11.h 91 | glut_bwidth.obj: glut_bwidth.c glutint.h ..\..\include\GL\glutf90.h ..\..\include\GL\glut.h glutwin32.h win32_glx.h win32_x11.h 92 | glut_cindex.obj: glut_cindex.c glutint.h ..\..\include\GL\glutf90.h ..\..\include\GL\glut.h glutwin32.h win32_glx.h win32_x11.h 93 | glut_cmap.obj: glut_cmap.c glutint.h ..\..\include\GL\glutf90.h ..\..\include\GL\glut.h glutwin32.h win32_glx.h win32_x11.h 94 | glut_cursor.obj: glut_cursor.c glutint.h ..\..\include\GL\glutf90.h ..\..\include\GL\glut.h glutwin32.h win32_glx.h win32_x11.h 95 | glut_dials.obj: glut_dials.c glutint.h ..\..\include\GL\glutf90.h ..\..\include\GL\glut.h glutwin32.h win32_glx.h win32_x11.h 96 | glut_dstr.obj: glut_dstr.c glutint.h ..\..\include\GL\glutf90.h ..\..\include\GL\glut.h glutwin32.h win32_glx.h win32_x11.h 97 | glut_event.obj: glut_event.c glutint.h ..\..\include\GL\glutf90.h ..\..\include\GL\glut.h glutwin32.h win32_glx.h win32_x11.h 98 | glut_ext.obj: glut_ext.c glutint.h ..\..\include\GL\glutf90.h ..\..\include\GL\glut.h glutwin32.h win32_glx.h win32_x11.h 99 | glut_fullscrn.obj: glut_fullscrn.c glutint.h ..\..\include\GL\glutf90.h ..\..\include\GL\glut.h glutwin32.h win32_glx.h win32_x11.h 100 | glut_gamemode.obj: glut_gamemode.c glutint.h ..\..\include\GL\glutf90.h ..\..\include\GL\glut.h glutwin32.h win32_glx.h win32_x11.h 101 | glut_get.obj: glut_get.c glutint.h ..\..\include\GL\glutf90.h ..\..\include\GL\glut.h glutwin32.h win32_glx.h win32_x11.h 102 | glut_init.obj: glut_init.c glutint.h ..\..\include\GL\glutf90.h ..\..\include\GL\glut.h glutwin32.h win32_glx.h win32_x11.h 103 | glut_input.obj: glut_input.c glutint.h ..\..\include\GL\glutf90.h ..\..\include\GL\glut.h glutwin32.h win32_glx.h win32_x11.h 104 | glut_joy.obj: glut_joy.c glutint.h ..\..\include\GL\glutf90.h ..\..\include\GL\glut.h glutwin32.h win32_glx.h win32_x11.h 105 | glut_key.obj: glut_key.c glutint.h ..\..\include\GL\glutf90.h ..\..\include\GL\glut.h glutwin32.h win32_glx.h win32_x11.h 106 | glut_keyctrl.obj: glut_keyctrl.c glutint.h ..\..\include\GL\glutf90.h ..\..\include\GL\glut.h glutwin32.h win32_glx.h win32_x11.h 107 | glut_keyup.obj: glut_keyup.c glutint.h ..\..\include\GL\glutf90.h ..\..\include\GL\glut.h glutwin32.h win32_glx.h win32_x11.h 108 | glut_mesa.obj: glut_mesa.c glutint.h ..\..\include\GL\glutf90.h ..\..\include\GL\glut.h glutwin32.h win32_glx.h win32_x11.h 109 | glut_modifier.obj: glut_modifier.c glutint.h ..\..\include\GL\glutf90.h ..\..\include\GL\glut.h glutwin32.h win32_glx.h win32_x11.h 110 | glut_overlay.obj: glut_overlay.c glutint.h ..\..\include\GL\glutf90.h ..\..\include\GL\glut.h glutwin32.h win32_glx.h win32_x11.h 111 | glut_shapes.obj: glut_shapes.c glutint.h ..\..\include\GL\glutf90.h ..\..\include\GL\glut.h glutwin32.h win32_glx.h win32_x11.h 112 | glut_space.obj: glut_space.c glutint.h ..\..\include\GL\glutf90.h ..\..\include\GL\glut.h glutwin32.h win32_glx.h win32_x11.h 113 | glut_swap.obj: glut_swap.c glutint.h ..\..\include\GL\glutf90.h ..\..\include\GL\glut.h glutwin32.h win32_glx.h win32_x11.h 114 | glut_swidth.obj: glut_swidth.c glutint.h ..\..\include\GL\glutf90.h ..\..\include\GL\glut.h glutwin32.h win32_glx.h win32_x11.h 115 | glut_tablet.obj: glut_tablet.c glutint.h ..\..\include\GL\glutf90.h ..\..\include\GL\glut.h glutwin32.h win32_glx.h win32_x11.h 116 | glut_teapot.obj: glut_teapot.c glutint.h ..\..\include\GL\glutf90.h ..\..\include\GL\glut.h glutwin32.h win32_glx.h win32_x11.h 117 | glut_util.obj: glut_util.c glutint.h ..\..\include\GL\glutf90.h ..\..\include\GL\glut.h glutwin32.h win32_glx.h win32_x11.h 118 | glut_vidresize.obj: glut_vidresize.c glutint.h ..\..\include\GL\glutf90.h ..\..\include\GL\glut.h glutwin32.h win32_glx.h win32_x11.h 119 | glut_warp.obj: glut_warp.c glutint.h ..\..\include\GL\glutf90.h ..\..\include\GL\glut.h glutwin32.h win32_glx.h win32_x11.h 120 | glut_win.obj: glut_win.c glutint.h ..\..\include\GL\glutf90.h ..\..\include\GL\glut.h glutwin32.h 121 | glut_winmisc.obj: glut_winmisc.c glutint.h ..\..\include\GL\glutf90.h ..\..\include\GL\glut.h glutwin32.h win32_glx.h win32_x11.h 122 | 123 | -------------------------------------------------------------------------------- /glut/lib/glut/ObjectType.mk: -------------------------------------------------------------------------------- 1 | LDOPTS = $(LDOPTS_32) 2 | CSTYLE = $(CSTYLE_32) 3 | -------------------------------------------------------------------------------- /glut/lib/glut/glut.def: -------------------------------------------------------------------------------- 1 | VERSION 3.8 2 | 3 | EXPORTS 4 | glutAddMenuEntry 5 | glutAddSubMenu 6 | glutAttachMenu 7 | glutBitmapCharacter 8 | glutBitmapLength 9 | glutBitmapWidth 10 | glutButtonBoxFunc 11 | glutChangeToMenuEntry 12 | glutChangeToSubMenu 13 | glutCopyColormap 14 | glutCreateMenu 15 | __glutCreateMenuWithExit 16 | glutCreateSubWindow 17 | glutCreateWindow 18 | __glutCreateWindowWithExit 19 | glutDestroyMenu 20 | glutDestroyWindow 21 | glutDetachMenu 22 | glutDeviceGet 23 | glutDialsFunc 24 | glutDisplayFunc 25 | glutEnterGameMode 26 | glutEntryFunc 27 | glutEstablishOverlay 28 | glutExtensionSupported 29 | glutForceJoystickFunc 30 | glutFullScreen 31 | glutGameModeGet 32 | glutGameModeString 33 | glutGet 34 | glutGetColor 35 | glutGetMenu 36 | glutGetModifiers 37 | glutGetWindow 38 | glutHideOverlay 39 | glutHideWindow 40 | glutIconifyWindow 41 | glutIdleFunc 42 | glutIgnoreKeyRepeat 43 | glutInit 44 | __glutInitWithExit 45 | glutInitDisplayMode 46 | glutInitDisplayString 47 | glutInitWindowPosition 48 | glutInitWindowSize 49 | glutJoystickFunc 50 | glutKeyboardFunc 51 | glutKeyboardUpFunc 52 | glutLayerGet 53 | glutLeaveGameMode 54 | glutMainLoop 55 | glutMenuStateFunc 56 | glutMenuStatusFunc 57 | glutMotionFunc 58 | glutMouseFunc 59 | glutOverlayDisplayFunc 60 | glutPassiveMotionFunc 61 | glutPopWindow 62 | glutPositionWindow 63 | glutPostOverlayRedisplay 64 | glutPostRedisplay 65 | glutPostWindowOverlayRedisplay 66 | glutPostWindowRedisplay 67 | glutPushWindow 68 | glutRemoveMenuItem 69 | glutRemoveOverlay 70 | glutReportErrors 71 | glutReshapeFunc 72 | glutReshapeWindow 73 | glutSetColor 74 | glutSetCursor 75 | glutSetIconTitle 76 | glutSetKeyRepeat 77 | glutSetMenu 78 | glutSetWindow 79 | glutSetWindowTitle 80 | glutSetupVideoResizing 81 | glutShowOverlay 82 | glutShowWindow 83 | glutSolidCone 84 | glutSolidCube 85 | glutSolidDodecahedron 86 | glutSolidIcosahedron 87 | glutSolidOctahedron 88 | glutSolidSphere 89 | glutSolidTeapot 90 | glutSolidTetrahedron 91 | glutSolidTorus 92 | glutSpaceballButtonFunc 93 | glutSpaceballMotionFunc 94 | glutSpaceballRotateFunc 95 | glutSpecialFunc 96 | glutSpecialUpFunc 97 | glutStopVideoResizing 98 | glutStrokeCharacter 99 | glutStrokeLength 100 | glutStrokeLengthf 101 | glutStrokeWidth 102 | glutStrokeWidthf 103 | glutSwapBuffers 104 | glutTabletButtonFunc 105 | glutTabletMotionFunc 106 | glutTimerFunc 107 | glutUseLayer 108 | glutVideoPan 109 | glutVideoResize 110 | glutVideoResizeGet 111 | glutVisibilityFunc 112 | glutWarpPointer 113 | glutWindowStatusFunc 114 | glutWireCone 115 | glutWireCube 116 | glutWireDodecahedron 117 | glutWireIcosahedron 118 | glutWireOctahedron 119 | glutWireSphere 120 | glutWireTeapot 121 | glutWireTetrahedron 122 | glutWireTorus 123 | __glutSetFCB 124 | __glutGetFCB 125 | -------------------------------------------------------------------------------- /glut/lib/glut/glut.nvmk: -------------------------------------------------------------------------------- 1 | ############################################################################## 2 | # //sw/apps/gpu/drivers/opengl/glut/lib/glut/glut.nvmk 3 | # 4 | # unix-build/nvmake makefile fragment for building the glut source files; 5 | # based on: 6 | # //sw/apps/gpu/drivers/opengl/glut/lib/glut/GNUmakefile 7 | ############################################################################## 8 | 9 | GLUT_SOURCES += glut_bitmap.c 10 | GLUT_SOURCES += glut_bwidth.c 11 | GLUT_SOURCES += glut_cindex.c 12 | GLUT_SOURCES += glut_cmap.c 13 | GLUT_SOURCES += glut_cursor.c 14 | GLUT_SOURCES += glut_dials.c 15 | GLUT_SOURCES += glut_dstr.c 16 | GLUT_SOURCES += glut_event.c 17 | GLUT_SOURCES += glut_ext.c 18 | GLUT_SOURCES += glut_fbc.c 19 | GLUT_SOURCES += glut_fullscrn.c 20 | GLUT_SOURCES += glut_gamemode.c 21 | GLUT_SOURCES += glut_get.c 22 | GLUT_SOURCES += glut_glxext.c 23 | GLUT_SOURCES += glut_init.c 24 | GLUT_SOURCES += glut_input.c 25 | GLUT_SOURCES += glut_joy.c 26 | GLUT_SOURCES += glut_key.c 27 | GLUT_SOURCES += glut_keyctrl.c 28 | GLUT_SOURCES += glut_keyup.c 29 | GLUT_SOURCES += glut_menu.c 30 | GLUT_SOURCES += glut_menu2.c 31 | GLUT_SOURCES += glut_mesa.c 32 | GLUT_SOURCES += glut_modifier.c 33 | GLUT_SOURCES += glut_overlay.c 34 | GLUT_SOURCES += glut_shapes.c 35 | GLUT_SOURCES += glut_space.c 36 | GLUT_SOURCES += glut_stroke.c 37 | GLUT_SOURCES += glut_swap.c 38 | GLUT_SOURCES += glut_swidth.c 39 | GLUT_SOURCES += glut_tablet.c 40 | GLUT_SOURCES += glut_teapot.c 41 | GLUT_SOURCES += glut_util.c 42 | GLUT_SOURCES += glut_vidresize.c 43 | GLUT_SOURCES += glut_warp.c 44 | GLUT_SOURCES += glut_win.c 45 | GLUT_SOURCES += glut_winmisc.c 46 | GLUT_SOURCES += layerutil.c 47 | 48 | GLUT_SOURCES += glut_8x13.c 49 | GLUT_SOURCES += glut_9x15.c 50 | GLUT_SOURCES += glut_hel10.c 51 | GLUT_SOURCES += glut_hel12.c 52 | GLUT_SOURCES += glut_hel18.c 53 | GLUT_SOURCES += glut_mroman.c 54 | GLUT_SOURCES += glut_roman.c 55 | GLUT_SOURCES += glut_tr10.c 56 | GLUT_SOURCES += glut_tr24.c 57 | 58 | # The below comment is taken from 59 | # //sw/apps/gpu/drivers/opengl/glut/lib/glut/GNUmakefile: 60 | # 61 | # Uncomment the NV_DEFINES line below if you want to build a version of 62 | # libglut.a that avoids using the SGI "fast atoms" optimization 63 | # introduced in IRIX 6.3. This optimization eliminates serveral X server 64 | # round-trips. If you are building libglut.a on an IRIX 6.3 or later 65 | # machine and want a chance (no guarantees) that GLUT executables built 66 | # against your libglut.a will work on IRIX 6.2 machines, uncomment out 67 | # the LCDEFS line below. Otherwise, you'll get a run-time message about 68 | # "attempted access to unresolvable symbol in XXX: _XSGIFastInternAtom" 69 | GLUT_DEFINES += NO_FAST_ATOMS 70 | 71 | GLUT_DIR = $(NV_SOURCE)/gpu/drivers/opengl/glut 72 | GLUT_SOURCE_DIR = $(GLUT_DIR)/lib/glut 73 | 74 | GLUT_INCLUDES += $(GLUT_DIR)/include 75 | GLUT_INCLUDES += $(NV_SOURCE)/gpu/drivers/opengl/include 76 | GLUT_INCLUDES += $(NV_TOOLS)/unix/targets/common/xorg-server/include 77 | 78 | $(call BUILD_OBJECT_LIST,$(GLUT_SOURCES)): NV_DEFINES += $(GLUT_DEFINES) 79 | $(call BUILD_OBJECT_LIST,$(GLUT_SOURCES)): NV_INCLUDES += $(GLUT_INCLUDES) 80 | 81 | SOURCES += $(addprefix $(GLUT_SOURCE_DIR)/,$(GLUT_SOURCES)) 82 | 83 | -------------------------------------------------------------------------------- /glut/lib/glut/glut_bitmap.c: -------------------------------------------------------------------------------- 1 | 2 | /* Copyright (c) Mark J. Kilgard, 1994. */ 3 | 4 | /* This program is freely distributable without licensing fees 5 | and is provided without guarantee or warrantee expressed or 6 | implied. This program is -not- in the public domain. */ 7 | 8 | #include "glutint.h" 9 | #include "glutbitmap.h" 10 | 11 | void GLUTAPIENTRY 12 | glutBitmapCharacter(GLUTbitmapFont font, int c) 13 | { 14 | const BitmapCharRec *ch; 15 | BitmapFontPtr fontinfo; 16 | GLint swapbytes, lsbfirst, rowlength; 17 | GLint skiprows, skippixels, alignment; 18 | 19 | #if defined(_WIN32) 20 | fontinfo = (BitmapFontPtr) __glutFont(font); 21 | #else 22 | fontinfo = (BitmapFontPtr) font; 23 | #endif 24 | 25 | if (c < fontinfo->first || 26 | c >= fontinfo->first + fontinfo->num_chars) 27 | return; 28 | ch = fontinfo->ch[c - fontinfo->first]; 29 | if (ch) { 30 | /* Save current modes. */ 31 | glGetIntegerv(GL_UNPACK_SWAP_BYTES, &swapbytes); 32 | glGetIntegerv(GL_UNPACK_LSB_FIRST, &lsbfirst); 33 | glGetIntegerv(GL_UNPACK_ROW_LENGTH, &rowlength); 34 | glGetIntegerv(GL_UNPACK_SKIP_ROWS, &skiprows); 35 | glGetIntegerv(GL_UNPACK_SKIP_PIXELS, &skippixels); 36 | glGetIntegerv(GL_UNPACK_ALIGNMENT, &alignment); 37 | /* Little endian machines (DEC Alpha for example) could 38 | benefit from setting GL_UNPACK_LSB_FIRST to GL_TRUE 39 | instead of GL_FALSE, but this would require changing the 40 | generated bitmaps too. */ 41 | glPixelStorei(GL_UNPACK_SWAP_BYTES, GL_FALSE); 42 | glPixelStorei(GL_UNPACK_LSB_FIRST, GL_FALSE); 43 | glPixelStorei(GL_UNPACK_ROW_LENGTH, 0); 44 | glPixelStorei(GL_UNPACK_SKIP_ROWS, 0); 45 | glPixelStorei(GL_UNPACK_SKIP_PIXELS, 0); 46 | glPixelStorei(GL_UNPACK_ALIGNMENT, 1); 47 | glBitmap(ch->width, ch->height, ch->xorig, ch->yorig, 48 | ch->advance, 0, ch->bitmap); 49 | /* Restore saved modes. */ 50 | glPixelStorei(GL_UNPACK_SWAP_BYTES, swapbytes); 51 | glPixelStorei(GL_UNPACK_LSB_FIRST, lsbfirst); 52 | glPixelStorei(GL_UNPACK_ROW_LENGTH, rowlength); 53 | glPixelStorei(GL_UNPACK_SKIP_ROWS, skiprows); 54 | glPixelStorei(GL_UNPACK_SKIP_PIXELS, skippixels); 55 | glPixelStorei(GL_UNPACK_ALIGNMENT, alignment); 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /glut/lib/glut/glut_bwidth.c: -------------------------------------------------------------------------------- 1 | 2 | /* Copyright (c) Mark J. Kilgard, 1994. */ 3 | 4 | /* This program is freely distributable without licensing fees 5 | and is provided without guarantee or warrantee expressed or 6 | implied. This program is -not- in the public domain. */ 7 | 8 | #include "glutint.h" 9 | #include "glutbitmap.h" 10 | 11 | /* CENTRY */ 12 | int GLUTAPIENTRY 13 | glutBitmapWidth(GLUTbitmapFont font, int c) 14 | { 15 | BitmapFontPtr fontinfo; 16 | const BitmapCharRec *ch; 17 | 18 | #ifdef _WIN32 19 | fontinfo = (BitmapFontPtr) __glutFont(font); 20 | #else 21 | fontinfo = (BitmapFontPtr) font; 22 | #endif 23 | 24 | if (c < fontinfo->first || c >= fontinfo->first + fontinfo->num_chars) { 25 | return 0; 26 | } 27 | ch = fontinfo->ch[c - fontinfo->first]; 28 | if (ch) { 29 | return ch->advance; 30 | } else { 31 | return 0; 32 | } 33 | } 34 | 35 | int GLUTAPIENTRY 36 | glutBitmapLength(GLUTbitmapFont font, const unsigned char *string) 37 | { 38 | int c, length; 39 | BitmapFontPtr fontinfo; 40 | const BitmapCharRec *ch; 41 | 42 | #ifdef _WIN32 43 | fontinfo = (BitmapFontPtr) __glutFont(font); 44 | #else 45 | fontinfo = (BitmapFontPtr) font; 46 | #endif 47 | 48 | length = 0; 49 | for (; *string != '\0'; string++) { 50 | c = *string; 51 | if (c >= fontinfo->first && c < fontinfo->first + fontinfo->num_chars) { 52 | ch = fontinfo->ch[c - fontinfo->first]; 53 | if (ch) { 54 | length += ch->advance; 55 | } 56 | } 57 | } 58 | return length; 59 | } 60 | 61 | /* ENDCENTRY */ 62 | -------------------------------------------------------------------------------- /glut/lib/glut/glut_cindex.c: -------------------------------------------------------------------------------- 1 | 2 | /* Copyright (c) Mark J. Kilgard, 1994, 1996, 1997. */ 3 | 4 | /* This program is freely distributable without licensing fees 5 | and is provided without guarantee or warrantee expressed or 6 | implied. This program is -not- in the public domain. */ 7 | 8 | #include 9 | #include "glutint.h" 10 | 11 | #define CLAMP(i) ((i) > 1.0 ? 1.0 : ((i) < 0.0 ? 0.0 : (i))) 12 | 13 | /* CENTRY */ 14 | void GLUTAPIENTRY 15 | glutSetColor(int ndx, GLfloat red, GLfloat green, GLfloat blue) 16 | { 17 | GLUTcolormap *cmap, *newcmap; 18 | XVisualInfo *vis; 19 | XColor color; 20 | int i; 21 | 22 | if (__glutCurrentWindow->renderWin == __glutCurrentWindow->win) { 23 | cmap = __glutCurrentWindow->colormap; 24 | vis = __glutCurrentWindow->vis; 25 | } else { 26 | cmap = __glutCurrentWindow->overlay->colormap; 27 | vis = __glutCurrentWindow->overlay->vis; 28 | if (ndx == __glutCurrentWindow->overlay->transparentPixel) { 29 | __glutWarning( 30 | "glutSetColor: cannot set color of overlay transparent index %d\n", 31 | ndx); 32 | return; 33 | } 34 | } 35 | 36 | if (!cmap) { 37 | __glutWarning("glutSetColor: current window is RGBA"); 38 | return; 39 | } 40 | #if defined(_WIN32) 41 | if (ndx >= 256 || /* always assume 256 colors on Win32 */ 42 | #else 43 | if (ndx >= vis->visual->map_entries || 44 | #endif 45 | ndx < 0) { 46 | __glutWarning("glutSetColor: index %d out of range", ndx); 47 | return; 48 | } 49 | if (cmap->refcnt > 1) { 50 | newcmap = __glutAssociateNewColormap(vis); 51 | cmap->refcnt--; 52 | /* Wouldn't it be nice if XCopyColormapAndFree could be 53 | told not to free the old colormap's entries! */ 54 | for (i = cmap->size - 1; i >= 0; i--) { 55 | if (i == ndx) { 56 | /* We are going to set this cell shortly! */ 57 | continue; 58 | } 59 | if (cmap->cells[i].component[GLUT_RED] >= 0.0) { 60 | color.pixel = i; 61 | newcmap->cells[i].component[GLUT_RED] = 62 | cmap->cells[i].component[GLUT_RED]; 63 | color.red = (GLfloat) 0xffff * 64 | cmap->cells[i].component[GLUT_RED]; 65 | newcmap->cells[i].component[GLUT_GREEN] = 66 | cmap->cells[i].component[GLUT_GREEN]; 67 | color.green = (GLfloat) 0xffff * 68 | cmap->cells[i].component[GLUT_GREEN]; 69 | newcmap->cells[i].component[GLUT_BLUE] = 70 | cmap->cells[i].component[GLUT_BLUE]; 71 | color.blue = (GLfloat) 0xffff * 72 | cmap->cells[i].component[GLUT_BLUE]; 73 | color.flags = DoRed | DoGreen | DoBlue; 74 | #if defined(_WIN32) 75 | if (IsWindowVisible(__glutCurrentWindow->win)) { 76 | XHDC = __glutCurrentWindow->hdc; 77 | } else { 78 | XHDC = 0; 79 | } 80 | #endif 81 | XStoreColor(__glutDisplay, newcmap->cmap, &color); 82 | } else { 83 | /* Leave unallocated entries unallocated. */ 84 | } 85 | } 86 | cmap = newcmap; 87 | if (__glutCurrentWindow->renderWin == __glutCurrentWindow->win) { 88 | __glutCurrentWindow->colormap = cmap; 89 | __glutCurrentWindow->cmap = cmap->cmap; 90 | } else { 91 | __glutCurrentWindow->overlay->colormap = cmap; 92 | __glutCurrentWindow->overlay->cmap = cmap->cmap; 93 | } 94 | XSetWindowColormap(__glutDisplay, 95 | __glutCurrentWindow->renderWin, cmap->cmap); 96 | 97 | #if !defined(_WIN32) 98 | { 99 | GLUTwindow *toplevel; 100 | 101 | toplevel = __glutToplevelOf(__glutCurrentWindow); 102 | if (toplevel->cmap != cmap->cmap) { 103 | __glutPutOnWorkList(toplevel, GLUT_COLORMAP_WORK); 104 | } 105 | } 106 | #endif 107 | } 108 | color.pixel = ndx; 109 | red = CLAMP(red); 110 | cmap->cells[ndx].component[GLUT_RED] = red; 111 | color.red = (GLfloat) 0xffff *red; 112 | green = CLAMP(green); 113 | cmap->cells[ndx].component[GLUT_GREEN] = green; 114 | color.green = (GLfloat) 0xffff *green; 115 | blue = CLAMP(blue); 116 | cmap->cells[ndx].component[GLUT_BLUE] = blue; 117 | color.blue = (GLfloat) 0xffff *blue; 118 | color.flags = DoRed | DoGreen | DoBlue; 119 | #if defined(_WIN32) 120 | if (IsWindowVisible(__glutCurrentWindow->win)) { 121 | XHDC = __glutCurrentWindow->hdc; 122 | } else { 123 | XHDC = 0; 124 | } 125 | #endif 126 | XStoreColor(__glutDisplay, cmap->cmap, &color); 127 | } 128 | 129 | GLfloat GLUTAPIENTRY 130 | glutGetColor(int ndx, int comp) 131 | { 132 | GLUTcolormap *colormap; 133 | XVisualInfo *vis; 134 | 135 | if (__glutCurrentWindow->renderWin == __glutCurrentWindow->win) { 136 | colormap = __glutCurrentWindow->colormap; 137 | vis = __glutCurrentWindow->vis; 138 | } else { 139 | colormap = __glutCurrentWindow->overlay->colormap; 140 | vis = __glutCurrentWindow->overlay->vis; 141 | if (ndx == __glutCurrentWindow->overlay->transparentPixel) { 142 | __glutWarning("glutGetColor: requesting overlay transparent index %d\n", 143 | ndx); 144 | return -1.0; 145 | } 146 | } 147 | 148 | if (!colormap) { 149 | __glutWarning("glutGetColor: current window is RGBA"); 150 | return -1.0; 151 | } 152 | #if defined(_WIN32) 153 | #define OUT_OF_RANGE_NDX(ndx) (ndx >= 256 || ndx < 0) 154 | #else 155 | #define OUT_OF_RANGE_NDX(ndx) (ndx >= vis->visual->map_entries || ndx < 0) 156 | #endif 157 | if (OUT_OF_RANGE_NDX(ndx)) { 158 | __glutWarning("glutGetColor: index %d out of range", ndx); 159 | return -1.0; 160 | } 161 | return colormap->cells[ndx].component[comp]; 162 | } 163 | 164 | void GLUTAPIENTRY 165 | glutCopyColormap(int winnum) 166 | { 167 | GLUTwindow *window = __glutWindowList[winnum - 1]; 168 | GLUTcolormap *oldcmap, *newcmap; 169 | XVisualInfo *dstvis; 170 | 171 | if (__glutCurrentWindow->renderWin == __glutCurrentWindow->win) { 172 | oldcmap = __glutCurrentWindow->colormap; 173 | dstvis = __glutCurrentWindow->vis; 174 | newcmap = window->colormap; 175 | } else { 176 | oldcmap = __glutCurrentWindow->overlay->colormap; 177 | dstvis = __glutCurrentWindow->overlay->vis; 178 | if (!window->overlay) { 179 | __glutWarning("glutCopyColormap: window %d has no overlay", winnum); 180 | return; 181 | } 182 | newcmap = window->overlay->colormap; 183 | } 184 | 185 | if (!oldcmap) { 186 | __glutWarning("glutCopyColormap: destination colormap must be color index"); 187 | return; 188 | } 189 | if (!newcmap) { 190 | __glutWarning( 191 | "glutCopyColormap: source colormap of window %d must be color index", 192 | winnum); 193 | return; 194 | } 195 | if (newcmap == oldcmap) { 196 | /* Source and destination are the same; now copy needed. */ 197 | return; 198 | } 199 | #if !defined(_WIN32) 200 | /* Play safe: compare visual IDs, not Visual*'s. */ 201 | if (newcmap->visual->visualid == oldcmap->visual->visualid) { 202 | #endif 203 | /* Visuals match! "Copy" by reference... */ 204 | __glutFreeColormap(oldcmap); 205 | newcmap->refcnt++; 206 | if (__glutCurrentWindow->renderWin == __glutCurrentWindow->win) { 207 | __glutCurrentWindow->colormap = newcmap; 208 | __glutCurrentWindow->cmap = newcmap->cmap; 209 | } else { 210 | __glutCurrentWindow->overlay->colormap = newcmap; 211 | __glutCurrentWindow->overlay->cmap = newcmap->cmap; 212 | } 213 | XSetWindowColormap(__glutDisplay, __glutCurrentWindow->renderWin, 214 | newcmap->cmap); 215 | #if !defined(_WIN32) 216 | __glutPutOnWorkList(__glutToplevelOf(window), GLUT_COLORMAP_WORK); 217 | } else { 218 | GLUTcolormap *copycmap; 219 | XColor color; 220 | int i, last; 221 | 222 | /* Visuals different - need a distinct X colormap! */ 223 | copycmap = __glutAssociateNewColormap(dstvis); 224 | /* Wouldn't it be nice if XCopyColormapAndFree could be 225 | told not to free the old colormap's entries! */ 226 | last = newcmap->size; 227 | if (last > copycmap->size) { 228 | last = copycmap->size; 229 | } 230 | for (i = last - 1; i >= 0; i--) { 231 | if (newcmap->cells[i].component[GLUT_RED] >= 0.0) { 232 | color.pixel = i; 233 | copycmap->cells[i].component[GLUT_RED] = 234 | newcmap->cells[i].component[GLUT_RED]; 235 | color.red = (GLfloat) 0xffff * 236 | newcmap->cells[i].component[GLUT_RED]; 237 | copycmap->cells[i].component[GLUT_GREEN] = 238 | newcmap->cells[i].component[GLUT_GREEN]; 239 | color.green = (GLfloat) 0xffff * 240 | newcmap->cells[i].component[GLUT_GREEN]; 241 | copycmap->cells[i].component[GLUT_BLUE] = 242 | newcmap->cells[i].component[GLUT_BLUE]; 243 | color.blue = (GLfloat) 0xffff * 244 | newcmap->cells[i].component[GLUT_BLUE]; 245 | color.flags = DoRed | DoGreen | DoBlue; 246 | XStoreColor(__glutDisplay, copycmap->cmap, &color); 247 | } 248 | } 249 | } 250 | #endif 251 | } 252 | /* ENDCENTRY */ 253 | -------------------------------------------------------------------------------- /glut/lib/glut/glut_cursor.c: -------------------------------------------------------------------------------- 1 | 2 | /* Copyright (c) Mark J. Kilgard, 1995, 1998, 2001. */ 3 | 4 | /* This program is freely distributable without licensing fees 5 | and is provided without guarantee or warrantee expressed or 6 | implied. This program is -not- in the public domain. */ 7 | 8 | #include "glutint.h" 9 | 10 | #ifndef _WIN32 11 | #include /* For XA_CURSOR */ 12 | #include 13 | #endif 14 | 15 | typedef struct _CursorTable { 16 | #ifdef _WIN32 17 | char* glyph; 18 | #else 19 | int glyph; 20 | #endif 21 | Cursor cursor; 22 | } CursorTable; 23 | /* *INDENT-OFF* */ 24 | 25 | static CursorTable cursorTable[] = { 26 | {XC_arrow, None}, /* GLUT_CURSOR_RIGHT_ARROW */ 27 | {XC_top_left_arrow, None}, /* GLUT_CURSOR_LEFT_ARROW */ 28 | {XC_hand1, None}, /* GLUT_CURSOR_INFO */ 29 | {XC_pirate, None}, /* GLUT_CURSOR_DESTROY */ 30 | {XC_question_arrow, None}, /* GLUT_CURSOR_HELP */ 31 | {XC_exchange, None}, /* GLUT_CURSOR_CYCLE */ 32 | {XC_spraycan, None}, /* GLUT_CURSOR_SPRAY */ 33 | {XC_watch, None}, /* GLUT_CURSOR_WAIT */ 34 | {XC_xterm, None}, /* GLUT_CURSOR_TEXT */ 35 | {XC_crosshair, None}, /* GLUT_CURSOR_CROSSHAIR */ 36 | {XC_sb_v_double_arrow, None}, /* GLUT_CURSOR_UP_DOWN */ 37 | {XC_sb_h_double_arrow, None}, /* GLUT_CURSOR_LEFT_RIGHT */ 38 | {XC_top_side, None}, /* GLUT_CURSOR_TOP_SIDE */ 39 | {XC_bottom_side, None}, /* GLUT_CURSOR_BOTTOM_SIDE */ 40 | {XC_left_side, None}, /* GLUT_CURSOR_LEFT_SIDE */ 41 | {XC_right_side, None}, /* GLUT_CURSOR_RIGHT_SIDE */ 42 | {XC_top_left_corner, None}, /* GLUT_CURSOR_TOP_LEFT_CORNER */ 43 | {XC_top_right_corner, None}, /* GLUT_CURSOR_TOP_RIGHT_CORNER */ 44 | {XC_bottom_right_corner, None}, /* GLUT_CURSOR_BOTTOM_RIGHT_CORNER */ 45 | {XC_bottom_left_corner, None}, /* GLUT_CURSOR_BOTTOM_LEFT_CORNER */ 46 | }; 47 | /* *INDENT-ON* */ 48 | 49 | #ifndef _WIN32 50 | static Cursor blankCursor = None; 51 | static Cursor fullCrosshairCusor = None; 52 | 53 | /* SGI X server's support a special property called the 54 | _SGI_CROSSHAIR_CURSOR that when installed as a window's 55 | cursor, becomes a full screen crosshair cursor. SGI 56 | has special cursor generation hardware for this case. */ 57 | static Cursor 58 | getFullCrosshairCursor(void) 59 | { 60 | Cursor cursor; 61 | Atom crosshairAtom, actualType; 62 | int rc, actualFormat; 63 | unsigned long n, left; 64 | unsigned long *value; 65 | 66 | if (fullCrosshairCusor == None) { 67 | crosshairAtom = XInternAtom(__glutDisplay, 68 | "_SGI_CROSSHAIR_CURSOR", True); 69 | if (crosshairAtom != None) { 70 | value = 0; /* Make compiler happy. */ 71 | rc = XGetWindowProperty(__glutDisplay, __glutRoot, 72 | crosshairAtom, 0, 1, False, XA_CURSOR, &actualType, 73 | &actualFormat, &n, &left, (unsigned char **) &value); 74 | if (rc == Success && actualFormat == 32 && n >= 1) { 75 | cursor = value[0]; 76 | XFree(value); 77 | return cursor; 78 | } 79 | } 80 | } 81 | return XCreateFontCursor(__glutDisplay, XC_crosshair); 82 | } 83 | 84 | /* X11 forces you to create a blank cursor if you want 85 | to disable the cursor. */ 86 | static Cursor 87 | makeBlankCursor(void) 88 | { 89 | static const char data[1] = {0}; 90 | Cursor cursor; 91 | Pixmap blank; 92 | XColor dummy; 93 | 94 | blank = XCreateBitmapFromData(__glutDisplay, __glutRoot, 95 | data, 1, 1); 96 | if (blank == None) { 97 | __glutFatalError("out of memory."); 98 | } 99 | cursor = XCreatePixmapCursor(__glutDisplay, blank, blank, 100 | &dummy, &dummy, 0, 0); 101 | XFreePixmap(__glutDisplay, blank); 102 | 103 | return cursor; 104 | } 105 | #endif /* !_WIN32 */ 106 | 107 | /* Win32 and X11 use this same function to accomplish 108 | fairly different tasks. X11 lets you just define the 109 | cursor for a window and the window system takes care 110 | of making sure that the window's cursor is installed 111 | when the mouse is in the window. Win32 requires the 112 | application to handle a WM_SETCURSOR message to install 113 | the right cursor when windows are entered. Think of 114 | the Win32 __glutSetCursor (called from __glutWindowProc) 115 | as "install cursor". Think of the X11 __glutSetCursor 116 | (called from glutSetCursor) as "define cursor". */ 117 | void 118 | __glutSetCursor(GLUTwindow *window) 119 | { 120 | int cursor = window->cursor; 121 | Cursor xcursor; 122 | 123 | if (cursor >= 0 && 124 | cursor < sizeof(cursorTable) / sizeof(cursorTable[0])) { 125 | if (cursorTable[cursor].cursor == None) { 126 | cursorTable[cursor].cursor = XCreateFontCursor(__glutDisplay, 127 | cursorTable[cursor].glyph); 128 | } 129 | xcursor = cursorTable[cursor].cursor; 130 | } else { 131 | /* Special cases. */ 132 | switch (cursor) { 133 | case GLUT_CURSOR_INHERIT: 134 | #ifdef _WIN32 135 | while (window->parent) { 136 | window = window->parent; 137 | if (window->cursor != GLUT_CURSOR_INHERIT) { 138 | __glutSetCursor(window); 139 | return; 140 | } 141 | } 142 | /* XXX Default to an arrow cursor. Is this 143 | right or should we be letting the default 144 | window proc be installing some system cursor? */ 145 | xcursor = cursorTable[0].cursor; 146 | if (xcursor == NULL) { 147 | xcursor = 148 | cursorTable[0].cursor = 149 | LoadCursor(NULL, cursorTable[0].glyph); 150 | } 151 | #else 152 | xcursor = None; 153 | #endif 154 | break; 155 | default: /* So all cases are handled. */ 156 | case GLUT_CURSOR_NONE: 157 | #ifdef _WIN32 158 | xcursor = NULL; 159 | #else 160 | if (blankCursor == None) { 161 | blankCursor = makeBlankCursor(); 162 | } 163 | xcursor = blankCursor; 164 | #endif 165 | break; 166 | case GLUT_CURSOR_FULL_CROSSHAIR: 167 | #ifdef _WIN32 168 | xcursor = (Cursor)IDC_CROSS; 169 | #else 170 | if (fullCrosshairCusor == None) { 171 | fullCrosshairCusor = getFullCrosshairCursor(); 172 | } 173 | xcursor = fullCrosshairCusor; 174 | #endif 175 | break; 176 | } 177 | } 178 | XDefineCursor(__glutDisplay, 179 | window->win, xcursor); 180 | XFlush(__glutDisplay); 181 | } 182 | 183 | /* CENTRY */ 184 | void GLUTAPIENTRY 185 | glutSetCursor(int cursor) 186 | { 187 | #ifdef _WIN32 188 | POINT point; 189 | 190 | __glutCurrentWindow->cursor = cursor; 191 | /* Are we in the window right now? If so, 192 | install the cursor. */ 193 | GetCursorPos(&point); 194 | if (__glutCurrentWindow->win == WindowFromPoint(point)) { 195 | __glutSetCursor(__glutCurrentWindow); 196 | } 197 | #else 198 | __glutCurrentWindow->cursor = cursor; 199 | __glutSetCursor(__glutCurrentWindow); 200 | #endif 201 | } 202 | /* ENDCENTRY */ 203 | -------------------------------------------------------------------------------- /glut/lib/glut/glut_dials.c: -------------------------------------------------------------------------------- 1 | 2 | /* Copyright (c) Mark J. Kilgard, 1994. */ 3 | 4 | /* This program is freely distributable without licensing fees 5 | and is provided without guarantee or warrantee expressed or 6 | implied. This program is -not- in the public domain. */ 7 | 8 | #include "glutint.h" 9 | 10 | void GLUTAPIENTRY 11 | glutButtonBoxFunc(GLUTbuttonBoxCB buttonBoxFunc) 12 | { 13 | __glutCurrentWindow->buttonBox = buttonBoxFunc; 14 | __glutUpdateInputDeviceMaskFunc = __glutUpdateInputDeviceMask; 15 | __glutPutOnWorkList(__glutCurrentWindow, 16 | GLUT_DEVICE_MASK_WORK); 17 | } 18 | 19 | void GLUTAPIENTRY 20 | glutDialsFunc(GLUTdialsCB dialsFunc) 21 | { 22 | __glutCurrentWindow->dials = dialsFunc; 23 | __glutUpdateInputDeviceMaskFunc = __glutUpdateInputDeviceMask; 24 | __glutPutOnWorkList(__glutCurrentWindow, 25 | GLUT_DEVICE_MASK_WORK); 26 | } 27 | -------------------------------------------------------------------------------- /glut/lib/glut/glut_ext.c: -------------------------------------------------------------------------------- 1 | 2 | /* Copyright (c) Mark J. Kilgard, 1994, 1997, 2001. */ 3 | 4 | /* This program is freely distributable without licensing fees 5 | and is provided without guarantee or warrantee expressed or 6 | implied. This program is -not- in the public domain. */ 7 | 8 | #include 9 | #include 10 | #include 11 | 12 | #include "glutint.h" 13 | 14 | static const GLubyte *extensions = NULL; 15 | static GLXContext cachedContext = NULL; 16 | 17 | void 18 | __glutInvalidateExtensionStringCacheIfNeeded(GLXContext context) 19 | { 20 | if (cachedContext != context) { 21 | /* No invalidation required. */ 22 | return; 23 | } 24 | cachedContext = NULL; 25 | extensions = NULL; 26 | } 27 | 28 | /* CENTRY */ 29 | int GLUTAPIENTRY 30 | glutExtensionSupported(const char *extension) 31 | { 32 | const GLubyte *start; 33 | const GLubyte *where, *terminator; 34 | 35 | /* Extension names should not have spaces. */ 36 | where = (GLubyte *) strchr(extension, ' '); 37 | if (where || *extension == '\0') { 38 | return 0; 39 | } 40 | 41 | if (!extensions || (GET_CURRENT_CONTEXT() != cachedContext)) { 42 | extensions = glGetString(GL_EXTENSIONS); 43 | assert(extensions); /* If this assets, likely no current GL context. */ 44 | cachedContext = GET_CURRENT_CONTEXT(); 45 | } 46 | if (extensions) { 47 | /* It takes a bit of care to be fool-proof about parsing the 48 | OpenGL extensions string. Don't be fooled by sub-strings, 49 | etc. */ 50 | start = extensions; 51 | for (;;) { 52 | /* If your application crashes in the strstr routine below, 53 | you are probably calling glutExtensionSupported without 54 | having a current window. Calling glGetString without 55 | a current OpenGL context has unpredictable results. 56 | Please fix your program. */ 57 | where = (const GLubyte *)strstr((const char *)start, extension); 58 | if (!where) { 59 | break; 60 | } 61 | terminator = where + strlen(extension); 62 | if (where == start || *(where - 1) == ' ') { 63 | if (*terminator == ' ' || *terminator == '\0') { 64 | return 1; 65 | } 66 | } 67 | start = terminator; 68 | } 69 | } 70 | return 0; 71 | } 72 | 73 | /* ENDCENTRY */ 74 | -------------------------------------------------------------------------------- /glut/lib/glut/glut_fbc.c: -------------------------------------------------------------------------------- 1 | 2 | /* Copyright (c) Mark J. Kilgard, 1998. */ 3 | 4 | /* This program is freely distributable without licensing fees 5 | and is provided without guarantee or warrantee expressed or 6 | implied. This program is -not- in the public domain. */ 7 | 8 | /* I appreciate the guidance from William Mitchell 9 | (mitchell@cam.nist.gov) in developing this friend interface 10 | for use by the f90gl package. See ../../README.fortran */ 11 | 12 | #include "glutint.h" 13 | 14 | /* FCB stands for Fortran CallBack. */ 15 | 16 | /* There is only one idleFunc, menuStateFunc, and menuStatusFunc, so they 17 | can be saved in the wrappers for Fortran rather than the C structures. */ 18 | 19 | /* Set a Fortran callback function. */ 20 | 21 | /* Disable VC 7.1 warning: 'type cast' : from data pointer 'void *' 22 | to function pointer 'GLUTblahFCB' */ 23 | #if defined(_MSC_VER) 24 | #pragma warning( disable : 4055 ) 25 | #endif 26 | 27 | void GLUTAPIENTRY 28 | __glutSetFCB(int which, void *func) 29 | { 30 | #ifdef SUPPORT_FORTRAN 31 | switch (which) { 32 | case GLUT_FCB_DISPLAY: 33 | __glutCurrentWindow->fdisplay = (GLUTdisplayFCB) func; 34 | break; 35 | case GLUT_FCB_RESHAPE: 36 | __glutCurrentWindow->freshape = (GLUTreshapeFCB) func; 37 | break; 38 | case GLUT_FCB_MOUSE: 39 | __glutCurrentWindow->fmouse = (GLUTmouseFCB) func; 40 | break; 41 | case GLUT_FCB_MOTION: 42 | __glutCurrentWindow->fmotion = (GLUTmotionFCB) func; 43 | break; 44 | case GLUT_FCB_PASSIVE: 45 | __glutCurrentWindow->fpassive = (GLUTpassiveFCB) func; 46 | break; 47 | case GLUT_FCB_ENTRY: 48 | __glutCurrentWindow->fentry = (GLUTentryFCB) func; 49 | break; 50 | case GLUT_FCB_KEYBOARD: 51 | __glutCurrentWindow->fkeyboard = (GLUTkeyboardFCB) func; 52 | break; 53 | case GLUT_FCB_KEYBOARD_UP: 54 | __glutCurrentWindow->fkeyboardUp = (GLUTkeyboardFCB) func; 55 | break; 56 | case GLUT_FCB_WINDOW_STATUS: 57 | __glutCurrentWindow->fwindowStatus = (GLUTwindowStatusFCB) func; 58 | break; 59 | case GLUT_FCB_VISIBILITY: 60 | __glutCurrentWindow->fvisibility = (GLUTvisibilityFCB) func; 61 | break; 62 | case GLUT_FCB_SPECIAL: 63 | __glutCurrentWindow->fspecial = (GLUTspecialFCB) func; 64 | break; 65 | case GLUT_FCB_SPECIAL_UP: 66 | __glutCurrentWindow->fspecialUp = (GLUTspecialFCB) func; 67 | break; 68 | case GLUT_FCB_BUTTON_BOX: 69 | __glutCurrentWindow->fbuttonBox = (GLUTbuttonBoxFCB) func; 70 | break; 71 | case GLUT_FCB_DIALS: 72 | __glutCurrentWindow->fdials = (GLUTdialsFCB) func; 73 | break; 74 | case GLUT_FCB_SPACE_MOTION: 75 | __glutCurrentWindow->fspaceMotion = (GLUTspaceMotionFCB) func; 76 | break; 77 | case GLUT_FCB_SPACE_ROTATE: 78 | __glutCurrentWindow->fspaceRotate = (GLUTspaceRotateFCB) func; 79 | break; 80 | case GLUT_FCB_SPACE_BUTTON: 81 | __glutCurrentWindow->fspaceButton = (GLUTspaceButtonFCB) func; 82 | break; 83 | case GLUT_FCB_TABLET_MOTION: 84 | __glutCurrentWindow->ftabletMotion = (GLUTtabletMotionFCB) func; 85 | break; 86 | case GLUT_FCB_TABLET_BUTTON: 87 | __glutCurrentWindow->ftabletButton = (GLUTtabletButtonFCB) func; 88 | break; 89 | #ifdef _WIN32 90 | case GLUT_FCB_JOYSTICK: 91 | __glutCurrentWindow->fjoystick = (GLUTjoystickFCB) func; 92 | break; 93 | #endif 94 | case GLUT_FCB_OVERLAY_DISPLAY: 95 | __glutCurrentWindow->overlay->fdisplay = (GLUTdisplayFCB) func; 96 | break; 97 | case GLUT_FCB_SELECT: 98 | __glutCurrentMenu->fselect = (GLUTselectFCB) func; 99 | break; 100 | case GLUT_FCB_TIMER: 101 | __glutNewTimer->ffunc = (GLUTtimerFCB) func; 102 | break; 103 | } 104 | #endif 105 | } 106 | 107 | /* Get a Fortran callback function. */ 108 | 109 | /* Disable VC 7.1 warning: 'type cast' : from function pointer 110 | 'GLUTblahFCB' to data pointer 'void *' */ 111 | #if defined(_MSC_VER) 112 | #pragma warning( disable : 4054 ) 113 | #endif 114 | 115 | void* GLUTAPIENTRY 116 | __glutGetFCB(int which) 117 | { 118 | #ifdef SUPPORT_FORTRAN 119 | switch (which) { 120 | case GLUT_FCB_DISPLAY: 121 | return (void *) __glutCurrentWindow->fdisplay; 122 | case GLUT_FCB_RESHAPE: 123 | return (void *) __glutCurrentWindow->freshape; 124 | case GLUT_FCB_MOUSE: 125 | return (void *) __glutCurrentWindow->fmouse; 126 | case GLUT_FCB_MOTION: 127 | return (void *) __glutCurrentWindow->fmotion; 128 | case GLUT_FCB_PASSIVE: 129 | return (void *) __glutCurrentWindow->fpassive; 130 | case GLUT_FCB_ENTRY: 131 | return (void *) __glutCurrentWindow->fentry; 132 | case GLUT_FCB_KEYBOARD: 133 | return (void *) __glutCurrentWindow->fkeyboard; 134 | case GLUT_FCB_KEYBOARD_UP: 135 | return (void *) __glutCurrentWindow->fkeyboardUp; 136 | case GLUT_FCB_WINDOW_STATUS: 137 | return (void *) __glutCurrentWindow->fwindowStatus; 138 | case GLUT_FCB_VISIBILITY: 139 | return (void *) __glutCurrentWindow->fvisibility; 140 | case GLUT_FCB_SPECIAL: 141 | return (void *) __glutCurrentWindow->fspecial; 142 | case GLUT_FCB_SPECIAL_UP: 143 | return (void *) __glutCurrentWindow->fspecialUp; 144 | case GLUT_FCB_BUTTON_BOX: 145 | return (void *) __glutCurrentWindow->fbuttonBox; 146 | case GLUT_FCB_DIALS: 147 | return (void *) __glutCurrentWindow->fdials; 148 | case GLUT_FCB_SPACE_MOTION: 149 | return (void *) __glutCurrentWindow->fspaceMotion; 150 | case GLUT_FCB_SPACE_ROTATE: 151 | return (void *) __glutCurrentWindow->fspaceRotate; 152 | case GLUT_FCB_SPACE_BUTTON: 153 | return (void *) __glutCurrentWindow->fspaceButton; 154 | case GLUT_FCB_TABLET_MOTION: 155 | return (void *) __glutCurrentWindow->ftabletMotion; 156 | case GLUT_FCB_TABLET_BUTTON: 157 | return (void *) __glutCurrentWindow->ftabletButton; 158 | case GLUT_FCB_JOYSTICK: 159 | #ifdef _WIN32 160 | return (void *) __glutCurrentWindow->fjoystick; 161 | #else 162 | return NULL; 163 | #endif 164 | case GLUT_FCB_OVERLAY_DISPLAY: 165 | return (void *) __glutCurrentWindow->overlay->fdisplay; 166 | case GLUT_FCB_SELECT: 167 | return (void *) __glutCurrentMenu->fselect; 168 | case GLUT_FCB_TIMER: 169 | return (void *) __glutTimerList->ffunc; 170 | default: 171 | return NULL; 172 | } 173 | #else 174 | return NULL; 175 | #endif 176 | } 177 | -------------------------------------------------------------------------------- /glut/lib/glut/glut_fullscrn.c: -------------------------------------------------------------------------------- 1 | 2 | /* Copyright (c) Mark J. Kilgard, 1995, 1998. */ 3 | 4 | /* This program is freely distributable without licensing fees 5 | and is provided without guarantee or warrantee expressed or 6 | implied. This program is -not- in the public domain. */ 7 | 8 | #include /* SunOS multithreaded assert() needs . Lame. */ 9 | #include 10 | 11 | #ifndef _WIN32 12 | #include 13 | #include 14 | #endif 15 | 16 | /* SGI optimization introduced in IRIX 6.3 to avoid X server 17 | round trips for interning common X atoms. */ 18 | #if defined(_SGI_EXTRA_PREDEFINES) && !defined(NO_FAST_ATOMS) 19 | #include 20 | #else 21 | #define XSGIFastInternAtom(dpy,string,fast_name,how) XInternAtom(dpy,string,how) 22 | #endif 23 | 24 | #include "glutint.h" 25 | 26 | #if !defined(_WIN32) 27 | void __glutMakeFullScreenAtoms() 28 | { 29 | if (__glutMotifHints == None) { 30 | __glutMotifHints = XSGIFastInternAtom(__glutDisplay, "_MOTIF_WM_HINTS", 31 | SGI_XA__MOTIF_WM_HINTS, 0); 32 | if (__glutMotifHints == None) { 33 | __glutWarning("Could not intern X atom for _MOTIF_WM_HINTS."); 34 | } 35 | } 36 | if (__glutNetWMState == None) { 37 | __glutNetWMState = XInternAtom(__glutDisplay, "_NET_WM_STATE", 0); 38 | if (__glutNetWMState == None) { 39 | __glutWarning("Could not intern X atom for _NET_WM_STATE."); 40 | } 41 | } 42 | if (__glutNetWMStateFullscreen == None) { 43 | __glutNetWMStateFullscreen = XInternAtom(__glutDisplay, "_NET_WM_STATE_FULLSCREEN", 0); 44 | if (__glutNetWMStateFullscreen == None) { 45 | __glutWarning("Could not intern X atom for _NET_WM_STATE_FULLSCREEN."); 46 | } 47 | } 48 | } 49 | #endif 50 | 51 | /* CENTRY */ 52 | void GLUTAPIENTRY 53 | glutFullScreen(void) 54 | { 55 | assert(!__glutCurrentWindow->parent); 56 | IGNORE_IN_GAME_MODE(); 57 | #if !defined(_WIN32) 58 | __glutMakeFullScreenAtoms(); 59 | #endif 60 | 61 | __glutCurrentWindow->desiredX = 0; 62 | __glutCurrentWindow->desiredY = 0; 63 | __glutCurrentWindow->desiredWidth = __glutScreenWidth; 64 | __glutCurrentWindow->desiredHeight = __glutScreenHeight; 65 | __glutCurrentWindow->desiredConfMask |= CWX | CWY | CWWidth | CWHeight; 66 | 67 | __glutPutOnWorkList(__glutCurrentWindow, 68 | GLUT_CONFIGURE_WORK | GLUT_FULL_SCREEN_WORK); 69 | } 70 | 71 | /* ENDCENTRY */ 72 | -------------------------------------------------------------------------------- /glut/lib/glut/glut_get.c: -------------------------------------------------------------------------------- 1 | 2 | /* Copyright (c) Mark J. Kilgard, 1994, 1997, 1998, 2001. */ 3 | 4 | /* This program is freely distributable without licensing fees 5 | and is provided without guarantee or warrantee expressed or 6 | implied. This program is -not- in the public domain. */ 7 | 8 | #include 9 | #include /* SunOS 4 needs NULL defined for GETTIMEOFDAY macro. */ 10 | #include "glutint.h" 11 | 12 | /* CENTRY */ 13 | int GLUTAPIENTRY 14 | glutGet(GLenum param) 15 | { 16 | Window win, root; 17 | int x, y, value; 18 | unsigned int width, height, border, depth; 19 | 20 | switch (param) { 21 | case GLUT_INIT_WINDOW_X: 22 | return __glutInitX; 23 | case GLUT_INIT_WINDOW_Y: 24 | return __glutInitY; 25 | case GLUT_INIT_WINDOW_WIDTH: 26 | return __glutInitWidth; 27 | case GLUT_INIT_WINDOW_HEIGHT: 28 | return __glutInitHeight; 29 | case GLUT_INIT_DISPLAY_MODE: 30 | return __glutDisplayMode; 31 | case GLUT_WINDOW_X: 32 | XTranslateCoordinates(__glutDisplay, __glutCurrentWindow->win, 33 | __glutRoot, 0, 0, &x, &y, &win); 34 | return x; 35 | case GLUT_WINDOW_Y: 36 | XTranslateCoordinates(__glutDisplay, __glutCurrentWindow->win, 37 | __glutRoot, 0, 0, &x, &y, &win); 38 | return y; 39 | case GLUT_WINDOW_WIDTH: 40 | if (!__glutCurrentWindow->reshape) { 41 | XGetGeometry(__glutDisplay, __glutCurrentWindow->win, 42 | &root, &x, &y, 43 | &width, &height, &border, &depth); 44 | return width; 45 | } 46 | return __glutCurrentWindow->width; 47 | case GLUT_WINDOW_HEIGHT: 48 | if (!__glutCurrentWindow->reshape) { 49 | XGetGeometry(__glutDisplay, __glutCurrentWindow->win, 50 | &root, &x, &y, 51 | &width, &height, &border, &depth); 52 | return height; 53 | } 54 | return __glutCurrentWindow->height; 55 | 56 | #define GET_CONFIG(attrib) { \ 57 | if (__glutCurrentWindow->renderWin == __glutCurrentWindow->win) { \ 58 | glXGetConfig(__glutDisplay, __glutCurrentWindow->vis, \ 59 | attrib, &value); \ 60 | } else { \ 61 | glXGetConfig(__glutDisplay, __glutCurrentWindow->overlay->vis, \ 62 | attrib, &value); \ 63 | } \ 64 | } 65 | 66 | case GLUT_WINDOW_BUFFER_SIZE: 67 | GET_CONFIG(GLX_BUFFER_SIZE); 68 | return value; 69 | case GLUT_WINDOW_STENCIL_SIZE: 70 | GET_CONFIG(GLX_STENCIL_SIZE); 71 | return value; 72 | case GLUT_WINDOW_DEPTH_SIZE: 73 | GET_CONFIG(GLX_DEPTH_SIZE); 74 | return value; 75 | case GLUT_WINDOW_RED_SIZE: 76 | GET_CONFIG(GLX_RED_SIZE); 77 | return value; 78 | case GLUT_WINDOW_GREEN_SIZE: 79 | GET_CONFIG(GLX_GREEN_SIZE); 80 | return value; 81 | case GLUT_WINDOW_BLUE_SIZE: 82 | GET_CONFIG(GLX_BLUE_SIZE); 83 | return value; 84 | case GLUT_WINDOW_ALPHA_SIZE: 85 | GET_CONFIG(GLX_ALPHA_SIZE); 86 | return value; 87 | case GLUT_WINDOW_ACCUM_RED_SIZE: 88 | GET_CONFIG(GLX_ACCUM_RED_SIZE); 89 | return value; 90 | case GLUT_WINDOW_ACCUM_GREEN_SIZE: 91 | GET_CONFIG(GLX_ACCUM_GREEN_SIZE); 92 | return value; 93 | case GLUT_WINDOW_ACCUM_BLUE_SIZE: 94 | GET_CONFIG(GLX_ACCUM_BLUE_SIZE); 95 | return value; 96 | case GLUT_WINDOW_ACCUM_ALPHA_SIZE: 97 | GET_CONFIG(GLX_ACCUM_ALPHA_SIZE); 98 | return value; 99 | case GLUT_WINDOW_DOUBLEBUFFER: 100 | GET_CONFIG(GLX_DOUBLEBUFFER); 101 | return value; 102 | case GLUT_WINDOW_RGBA: 103 | GET_CONFIG(GLX_RGBA); 104 | return value; 105 | case GLUT_WINDOW_COLORMAP_SIZE: 106 | GET_CONFIG(GLX_RGBA); 107 | if (value) { 108 | return 0; 109 | } else { 110 | #if defined(_WIN32) 111 | /* KLUDGE: we always assume 256 colors in CI mode on 112 | Win32 */ 113 | return 256; 114 | #else 115 | if (__glutCurrentWindow->renderWin == __glutCurrentWindow->win) { 116 | return __glutCurrentWindow->vis->visual->map_entries; 117 | } else { 118 | return __glutCurrentWindow->overlay->vis->visual->map_entries; 119 | } 120 | #endif /* _WIN32 */ 121 | } 122 | case GLUT_WINDOW_PARENT: 123 | return __glutCurrentWindow->parent ? 124 | __glutCurrentWindow->parent->num + 1 : 0; 125 | case GLUT_WINDOW_NUM_CHILDREN: 126 | { 127 | int num = 0; 128 | GLUTwindow *children = __glutCurrentWindow->children; 129 | 130 | while (children) { 131 | num++; 132 | children = children->siblings; 133 | } 134 | return num; 135 | } 136 | case GLUT_WINDOW_NUM_SAMPLES: 137 | #if _WIN32 138 | if (__glutIsSupportedByWGL("WGL_ARB_multisample")) { 139 | /* Note that WGL_SAMPLES_ARB is not the same as GLX_SAMPLES_ARB 140 | and GLX_SAMPLES_SGIS. */ 141 | GET_CONFIG(WGL_SAMPLES_ARB); 142 | return value; 143 | } else { 144 | return 0; 145 | } 146 | #else 147 | 148 | /* GLX_SAMPLES_SGIS has the same value as GLX_SAMPLES_ARB. */ 149 | # ifndef GLX_SAMPLES_ARB 150 | # define GLX_SAMPLES_ARB 100001 151 | # endif 152 | 153 | /* Multisample for GLX (either SGIS or ARB version). */ 154 | if (__glutIsSupportedByGLX("GLX_SGIS_multisample") || 155 | __glutIsSupportedByGLX("GLX_ARB_multisample")) { 156 | GET_CONFIG(GLX_SAMPLES_ARB); 157 | return value; 158 | } else { 159 | return 0; 160 | } 161 | #endif 162 | case GLUT_WINDOW_STEREO: 163 | GET_CONFIG(GLX_STEREO); 164 | return value; 165 | case GLUT_WINDOW_CURSOR: 166 | return __glutCurrentWindow->cursor; 167 | case GLUT_SCREEN_WIDTH: 168 | return DisplayWidth(__glutDisplay, __glutScreen); 169 | case GLUT_SCREEN_HEIGHT: 170 | return DisplayHeight(__glutDisplay, __glutScreen); 171 | case GLUT_SCREEN_WIDTH_MM: 172 | return DisplayWidthMM(__glutDisplay, __glutScreen); 173 | case GLUT_SCREEN_HEIGHT_MM: 174 | return DisplayHeightMM(__glutDisplay, __glutScreen); 175 | case GLUT_MENU_NUM_ITEMS: 176 | return __glutCurrentMenu->num; 177 | case GLUT_DISPLAY_MODE_POSSIBLE: 178 | { 179 | XVisualInfo *vi; 180 | Bool dummy, visAlloced; 181 | void *fbc; 182 | 183 | #if defined(_WIN32) 184 | /* Our fake glXChooseVisual (which is called by 185 | __glutDetermineVisual) needs an HDC to work with, so grab one 186 | from the "root" window. */ 187 | XHDC = GetDC(GetDesktopWindow()); 188 | #endif 189 | vi = __glutDetermineWindowVisual(&dummy, &visAlloced, &fbc); 190 | #if defined(_WIN32) 191 | ReleaseDC(GetDesktopWindow(), XHDC); 192 | #endif 193 | if (vi) { 194 | if (visAlloced) { 195 | XFree(vi); 196 | } 197 | return 1; 198 | } 199 | return 0; 200 | } 201 | case GLUT_ELAPSED_TIME: 202 | { 203 | #ifdef _WIN32 204 | /* The Unix case below actually would work for Win32, but the 205 | Win32 gettimeofday emulation routine has a resolution of about 10 206 | millisecond on Windows NT 4.0 and 50 millisecond on Windows 98. 207 | So use the higher resolution GetTickCount timer. */ 208 | DWORD beginning, now; 209 | 210 | beginning = __glutInitTime(); 211 | /* GetTickCount has 5 millisecond accuracy on Windows 98 212 | and 10 millisecond accuracy on Windows NT 4.0. */ 213 | now = GetTickCount(); 214 | return (int) (now - beginning); 215 | #else 216 | struct timeval elapsed, beginning, now; 217 | 218 | __glutInitTime(&beginning); 219 | GETTIMEOFDAY(&now); 220 | TIMEDELTA(elapsed, now, beginning); 221 | /* Return elapsed milliseconds. */ 222 | # if defined(__vms) && ( __VMS_VER < 70000000 ) 223 | return (int) (elapsed.val / TICKS_PER_MILLISECOND); 224 | # else 225 | return (int) ((elapsed.tv_sec * 1000) + (elapsed.tv_usec / 1000)); 226 | # endif 227 | #endif 228 | } 229 | case GLUT_WINDOW_FORMAT_ID: 230 | #if defined(_WIN32) 231 | return GetPixelFormat(__glutCurrentWindow->hdc); 232 | #else 233 | if (__glutCurrentWindow->renderWin == __glutCurrentWindow->win) { 234 | return (int) __glutCurrentWindow->vis->visualid; 235 | } else { 236 | return (int) __glutCurrentWindow->overlay->vis->visualid; 237 | } 238 | #endif 239 | default: 240 | __glutWarning("invalid glutGet parameter: %d", param); 241 | return -1; 242 | } 243 | } 244 | /* ENDCENTRY */ 245 | -------------------------------------------------------------------------------- /glut/lib/glut/glut_glxext.c: -------------------------------------------------------------------------------- 1 | 2 | /* Copyright (c) Mark J. Kilgard, 1997, 2001. */ 3 | 4 | /* This program is freely distributable without licensing fees 5 | and is provided without guarantee or warrantee expressed or 6 | implied. This program is -not- in the public domain. */ 7 | 8 | #include 9 | #include 10 | #include "glutint.h" 11 | 12 | /* Some Mesa versions define GLX_VERSION_1_2 without defining 13 | GLX_VERSION_1_1. */ 14 | #if defined(GLX_VERSION_1_2) && !defined(GLX_VERSION_1_1) 15 | # define GLX_VERSION_1_1 1 16 | #endif 17 | 18 | int 19 | __glutIsSupportedByGLX(const char *extension) 20 | { 21 | #if defined(GLX_VERSION_1_1) 22 | static const char *extensions = NULL; 23 | const char *start; 24 | char *where, *terminator; 25 | int major, minor; 26 | 27 | glXQueryVersion(__glutDisplay, &major, &minor); 28 | /* Be careful not to call glXQueryExtensionsString if it 29 | looks like the server doesn't support GLX 1.1. 30 | Unfortunately, the original GLX 1.0 didn't have the notion 31 | of GLX extensions. */ 32 | if ((major == 1 && minor >= 1) || (major > 1)) { 33 | if (!extensions) { 34 | extensions = glXQueryExtensionsString(__glutDisplay, __glutScreen); 35 | } 36 | /* It takes a bit of care to be fool-proof about parsing 37 | the GLX extensions string. Don't be fooled by 38 | sub-strings, etc. */ 39 | start = extensions; 40 | for (;;) { 41 | where = strstr(start, extension); 42 | if (!where) { 43 | return 0; 44 | } 45 | terminator = where + strlen(extension); 46 | if (where == start || *(where - 1) == ' ') { 47 | if (*terminator == ' ' || *terminator == '\0') { 48 | return 1; 49 | } 50 | } 51 | start = terminator; 52 | } 53 | } 54 | #endif 55 | return 0; 56 | } 57 | -------------------------------------------------------------------------------- /glut/lib/glut/glut_joy.c: -------------------------------------------------------------------------------- 1 | 2 | /* Copyright (c) Mark J. Kilgard, 1997, 1998, 2000. */ 3 | 4 | /* This program is freely distributable without licensing fees 5 | and is provided without guarantee or warrantee expressed or 6 | implied. This program is -not- in the public domain. */ 7 | 8 | #ifdef _WIN32 9 | # include 10 | # if !defined(__MINGW32__) && !defined(__CYGWIN32__) 11 | # include /* Win32 Multimedia API header. */ 12 | # else 13 | 14 | /* Cygnus B20.1 does not contain a version of so 15 | inline what we need. */ 16 | #define JOYERR_BASE 160 17 | #define JOYERR_NOERROR (0) /* no error */ 18 | #define JOYSTICKID1 0 19 | #define JOY_RETURNX 0x00000001l 20 | #define JOY_RETURNY 0x00000002l 21 | #define JOY_RETURNZ 0x00000004l 22 | #define JOY_RETURNR 0x00000008l 23 | #define JOY_RETURNU 0x00000010l /* axis 5 */ 24 | #define JOY_RETURNV 0x00000020l /* axis 6 */ 25 | #define JOY_RETURNPOV 0x00000040l 26 | #define JOY_RETURNBUTTONS 0x00000080l 27 | #define JOY_RETURNALL (JOY_RETURNX | JOY_RETURNY | JOY_RETURNZ | \ 28 | JOY_RETURNR | JOY_RETURNU | JOY_RETURNV | \ 29 | JOY_RETURNPOV | JOY_RETURNBUTTONS) 30 | typedef UINT MMRESULT; 31 | typedef struct joyinfoex_tag { 32 | DWORD dwSize; /* size of structure */ 33 | DWORD dwFlags; /* flags to indicate what to return */ 34 | DWORD dwXpos; /* x position */ 35 | DWORD dwYpos; /* y position */ 36 | DWORD dwZpos; /* z position */ 37 | DWORD dwRpos; /* rudder/4th axis position */ 38 | DWORD dwUpos; /* 5th axis position */ 39 | DWORD dwVpos; /* 6th axis position */ 40 | DWORD dwButtons; /* button states */ 41 | DWORD dwButtonNumber; /* current button number pressed */ 42 | DWORD dwPOV; /* point of view state */ 43 | DWORD dwReserved1; /* reserved for communication between winmm & driver */ 44 | DWORD dwReserved2; /* reserved for future expansion */ 45 | } JOYINFOEX, FAR *LPJOYINFOEX; 46 | 47 | MMRESULT WINAPI joyGetPosEx(UINT uJoyID, LPJOYINFOEX pji); 48 | MMRESULT WINAPI joyReleaseCapture(UINT uJoyID); 49 | MMRESULT WINAPI joySetCapture(HWND hwnd, UINT uJoyID, UINT uPeriod, BOOL fChanged); 50 | MMRESULT WINAPI joySetThreshold(UINT uJoyID, UINT uThreshold); 51 | 52 | # endif 53 | #endif 54 | 55 | #include "glutint.h" 56 | 57 | /* CENTRY */ 58 | void GLUTAPIENTRY 59 | glutJoystickFunc(GLUTjoystickCB joystickFunc, int pollInterval) 60 | { 61 | #ifdef _WIN32 62 | if (joystickFunc && (pollInterval > 0)) { 63 | if (__glutCurrentWindow->entryState == WM_SETFOCUS) { 64 | MMRESULT result; 65 | 66 | /* Capture joystick focus if current window has 67 | focus now. */ 68 | result = joySetCapture(__glutCurrentWindow->win, 69 | JOYSTICKID1, 0, TRUE); 70 | if (result == JOYERR_NOERROR) { 71 | (void) joySetThreshold(JOYSTICKID1, pollInterval); 72 | } 73 | } 74 | __glutCurrentWindow->joyPollInterval = pollInterval; 75 | } else { 76 | /* Release joystick focus if current window has 77 | focus now. */ 78 | if (__glutCurrentWindow->joystick 79 | && (__glutCurrentWindow->joyPollInterval > 0) 80 | && (__glutCurrentWindow->entryState == WM_SETFOCUS)) { 81 | (void) joyReleaseCapture(JOYSTICKID1); 82 | } 83 | __glutCurrentWindow->joyPollInterval = 0; 84 | } 85 | __glutCurrentWindow->joystick = joystickFunc; 86 | #else 87 | /* XXX No support currently for X11 joysticks. */ 88 | #endif 89 | } 90 | 91 | void GLUTAPIENTRY 92 | glutForceJoystickFunc(void) 93 | { 94 | #ifdef _WIN32 95 | if (__glutCurrentWindow->joystick) { 96 | JOYINFOEX jix; 97 | MMRESULT res; 98 | int x, y, z; 99 | 100 | /* Poll the joystick. */ 101 | jix.dwSize = sizeof(jix); 102 | jix.dwFlags = JOY_RETURNALL; 103 | res = joyGetPosEx(JOYSTICKID1,&jix); 104 | if (res == JOYERR_NOERROR) { 105 | 106 | /* Convert to int for scaling. */ 107 | x = jix.dwXpos; 108 | y = jix.dwYpos; 109 | z = jix.dwZpos; 110 | 111 | #define SCALE(v) ((int) ((v - 32767)/32.768)) 112 | 113 | __glutCurrentWindow->joystick(jix.dwButtons, 114 | SCALE(x), SCALE(y), SCALE(z)); 115 | } 116 | } 117 | #else 118 | /* XXX No support currently for X11 joysticks. */ 119 | #endif 120 | } 121 | 122 | /* ENDCENTRY */ 123 | -------------------------------------------------------------------------------- /glut/lib/glut/glut_key.c: -------------------------------------------------------------------------------- 1 | 2 | /* Copyright (c) Mark J. Kilgard, 1997. */ 3 | 4 | /* This program is freely distributable without licensing fees 5 | and is provided without guarantee or warrantee expressed or 6 | implied. This program is -not- in the public domain. */ 7 | 8 | #include 9 | 10 | #include "glutint.h" 11 | 12 | /* CENTRY */ 13 | void GLUTAPIENTRY 14 | glutKeyboardFunc(GLUTkeyboardCB keyboardFunc) 15 | { 16 | __glutChangeWindowEventMask(KeyPressMask, 17 | keyboardFunc != NULL || __glutCurrentWindow->special != NULL); 18 | __glutCurrentWindow->keyboard = keyboardFunc; 19 | } 20 | 21 | void GLUTAPIENTRY 22 | glutSpecialFunc(GLUTspecialCB specialFunc) 23 | { 24 | __glutChangeWindowEventMask(KeyPressMask, 25 | specialFunc != NULL || __glutCurrentWindow->keyboard != NULL); 26 | __glutCurrentWindow->special = specialFunc; 27 | } 28 | 29 | /* ENDCENTRY */ 30 | -------------------------------------------------------------------------------- /glut/lib/glut/glut_keyctrl.c: -------------------------------------------------------------------------------- 1 | 2 | /* Copyright (c) Mark J. Kilgard, 1996, 1997. */ 3 | 4 | /* This program is freely distributable without licensing fees 5 | and is provided without guarantee or warrantee expressed or 6 | implied. This program is -not- in the public domain. */ 7 | 8 | #include "glutint.h" 9 | 10 | /* CENTRY */ 11 | void GLUTAPIENTRY 12 | glutIgnoreKeyRepeat(int ignore) 13 | { 14 | __glutCurrentWindow->ignoreKeyRepeat = ignore; 15 | } 16 | 17 | void GLUTAPIENTRY 18 | glutSetKeyRepeat(int repeatMode) 19 | { 20 | #if !defined(_WIN32) 21 | XKeyboardControl values; 22 | 23 | /* GLUT's repeatMode #define's match the Xlib API values. */ 24 | values.auto_repeat_mode = repeatMode; 25 | XChangeKeyboardControl(__glutDisplay, KBAutoRepeatMode, &values); 26 | #endif 27 | } 28 | 29 | /* ENDCENTRY */ 30 | -------------------------------------------------------------------------------- /glut/lib/glut/glut_keyup.c: -------------------------------------------------------------------------------- 1 | 2 | /* Copyright (c) Mark J. Kilgard, 1997. */ 3 | 4 | /* This program is freely distributable without licensing fees 5 | and is provided without guarantee or warrantee expressed or 6 | implied. This program is -not- in the public domain. */ 7 | 8 | #include 9 | 10 | #include "glutint.h" 11 | 12 | /* CENTRY */ 13 | void GLUTAPIENTRY 14 | glutKeyboardUpFunc(GLUTkeyboardCB keyboardUpFunc) 15 | { 16 | __glutChangeWindowEventMask(KeyReleaseMask, 17 | keyboardUpFunc != NULL || __glutCurrentWindow->specialUp != NULL); 18 | __glutCurrentWindow->keyboardUp = keyboardUpFunc; 19 | } 20 | 21 | void GLUTAPIENTRY 22 | glutSpecialUpFunc(GLUTspecialCB specialUpFunc) 23 | { 24 | __glutChangeWindowEventMask(KeyReleaseMask, 25 | specialUpFunc != NULL || __glutCurrentWindow->keyboardUp != NULL); 26 | __glutCurrentWindow->specialUp = specialUpFunc; 27 | } 28 | 29 | /* ENDCENTRY */ 30 | -------------------------------------------------------------------------------- /glut/lib/glut/glut_menu2.c: -------------------------------------------------------------------------------- 1 | 2 | /* Copyright (c) Mark J. Kilgard, 1994, 1997, 2001. */ 3 | 4 | /* This program is freely distributable without licensing fees 5 | and is provided without guarantee or warrantee expressed or 6 | implied. This program is -not- in the public domain. */ 7 | 8 | /* glut_menu2.c implements the little used GLUT menu calls in 9 | a distinct file from glut_menu.c for slim static linking. */ 10 | 11 | /* The Win32 GLUT file win32_menu.c completely re-implements all 12 | the menuing functionality implemented. This file is used only by 13 | the X Window System version of GLUT. */ 14 | 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | 21 | #include 22 | 23 | #include "glutint.h" 24 | #include "layerutil.h" 25 | 26 | /* CENTRY */ 27 | /* DEPRICATED, use glutMenuStatusFunc instead. */ 28 | void GLUTAPIENTRY 29 | glutMenuStateFunc(GLUTmenuStateCB menuStateFunc) 30 | { 31 | __glutMenuStatusFunc = (GLUTmenuStatusCB) menuStateFunc; 32 | } 33 | 34 | void GLUTAPIENTRY 35 | glutMenuStatusFunc(GLUTmenuStatusCB menuStatusFunc) 36 | { 37 | __glutMenuStatusFunc = menuStatusFunc; 38 | } 39 | 40 | void GLUTAPIENTRY 41 | glutDestroyMenu(int menunum) 42 | { 43 | GLUTmenu *menu = __glutGetMenuByNum(menunum); 44 | GLUTmenuItem *item, *next; 45 | 46 | if (__glutMappedMenu) { 47 | __glutMenuModificationError(); 48 | } 49 | assert(menu->id == menunum - 1); 50 | XDestroySubwindows(__glutDisplay, menu->win); 51 | XDestroyWindow(__glutDisplay, menu->win); 52 | __glutMenuList[menunum - 1] = NULL; 53 | /* free all menu entries */ 54 | item = menu->list; 55 | while (item) { 56 | assert(item->menu == menu); 57 | next = item->next; 58 | free(item->label); 59 | free(item); 60 | item = next; 61 | } 62 | if (__glutCurrentMenu == menu) { 63 | __glutCurrentMenu = NULL; 64 | } 65 | free(menu); 66 | } 67 | 68 | void GLUTAPIENTRY 69 | glutChangeToMenuEntry(int num, const char *label, int value) 70 | { 71 | GLUTmenuItem *item; 72 | int i; 73 | 74 | if (__glutMappedMenu) { 75 | __glutMenuModificationError(); 76 | } 77 | i = __glutCurrentMenu->num; 78 | item = __glutCurrentMenu->list; 79 | while (item) { 80 | if (i == num) { 81 | if (item->isTrigger) { 82 | /* If changing a submenu trigger to a menu entry, we 83 | need to account for submenus. */ 84 | item->menu->submenus--; 85 | } 86 | free(item->label); 87 | __glutSetMenuItem(item, label, value, False); 88 | return; 89 | } 90 | i--; 91 | item = item->next; 92 | } 93 | __glutWarning("Current menu has no %d item.", num); 94 | } 95 | 96 | void GLUTAPIENTRY 97 | glutChangeToSubMenu(int num, const char *label, int menu) 98 | { 99 | GLUTmenuItem *item; 100 | int i; 101 | 102 | if (__glutMappedMenu) { 103 | __glutMenuModificationError(); 104 | } 105 | i = __glutCurrentMenu->num; 106 | item = __glutCurrentMenu->list; 107 | while (item) { 108 | if (i == num) { 109 | if (!item->isTrigger) { 110 | /* If changing a menu entry to as submenu trigger, we 111 | need to account for submenus. */ 112 | item->menu->submenus++; 113 | } 114 | free(item->label); 115 | __glutSetMenuItem(item, label, /* base 0 */ menu - 1, True); 116 | return; 117 | } 118 | i--; 119 | item = item->next; 120 | } 121 | __glutWarning("Current menu has no %d item.", num); 122 | } 123 | 124 | void GLUTAPIENTRY 125 | glutRemoveMenuItem(int num) 126 | { 127 | GLUTmenuItem *item, **prev, *remaining; 128 | int pixwidth, i; 129 | 130 | if (__glutMappedMenu) { 131 | __glutMenuModificationError(); 132 | } 133 | i = __glutCurrentMenu->num; 134 | prev = &__glutCurrentMenu->list; 135 | item = __glutCurrentMenu->list; 136 | /* If menu item is removed, the menu's pixwidth may need to 137 | be recomputed. */ 138 | pixwidth = 1; 139 | while (item) { 140 | if (i == num) { 141 | /* If this menu item's pixwidth is as wide as the menu's 142 | pixwidth, removing this menu item will necessitate 143 | shrinking the menu's pixwidth. */ 144 | if (item->pixwidth >= __glutCurrentMenu->pixwidth) { 145 | /* Continue recalculating menu pixwidth, first skipping 146 | the removed item. */ 147 | remaining = item->next; 148 | while (remaining) { 149 | if (remaining->pixwidth > pixwidth) { 150 | pixwidth = remaining->pixwidth; 151 | } 152 | remaining = remaining->next; 153 | } 154 | __glutCurrentMenu->pixwidth = pixwidth; 155 | } 156 | __glutCurrentMenu->num--; 157 | __glutCurrentMenu->managed = False; 158 | 159 | /* Patch up menu's item list. */ 160 | *prev = item->next; 161 | 162 | free(item->label); 163 | free(item); 164 | return; 165 | } 166 | if (item->pixwidth > pixwidth) { 167 | pixwidth = item->pixwidth; 168 | } 169 | i--; 170 | prev = &item->next; 171 | item = item->next; 172 | } 173 | __glutWarning("Current menu has no %d item.", num); 174 | } 175 | 176 | void GLUTAPIENTRY 177 | glutDetachMenu(int button) 178 | { 179 | if (__glutMappedMenu) { 180 | __glutMenuModificationError(); 181 | } 182 | if (__glutCurrentWindow->menu[button] > 0) { 183 | __glutCurrentWindow->buttonUses--; 184 | __glutChangeWindowEventMask(ButtonPressMask | ButtonReleaseMask, 185 | __glutCurrentWindow->buttonUses > 0); 186 | __glutCurrentWindow->menu[button] = 0; 187 | } 188 | } 189 | 190 | /* ENDCENTRY */ 191 | -------------------------------------------------------------------------------- /glut/lib/glut/glut_mesa.c: -------------------------------------------------------------------------------- 1 | 2 | /* Copyright (c) Mark J. Kilgard, 1996, 2001. */ 3 | 4 | /* This program is freely distributable without licensing fees 5 | and is provided without guarantee or warrantee expressed or 6 | implied. This program is -not- in the public domain. */ 7 | 8 | #include 9 | #include 10 | #include "glutint.h" 11 | 12 | int __glutMesaSwapHackSupport = 0; /* Not supported until 13 | proven otherwise. */ 14 | 15 | /* Use the "Mesa swap hack" if reasonable if and only if 16 | MESA_SWAP_HACK is set to something whose first character is 17 | not "N" or "n" AND "Brian Paul" is the vendor string AND 18 | "Mesa X11"* (or "Mesa" for backward compatibility) is the 19 | renderer string. 20 | 21 | Anyone who modifies Mesa so that glXSwapBuffers does not 22 | simply blit the previously rendered back buffer should 23 | change either their vendor or renderer string to avoid 24 | confusing GLUT. */ 25 | 26 | void 27 | __glutDetermineMesaSwapHackSupport(void) 28 | { 29 | static int doneAlready = 0; 30 | const char *env, *vendor, *renderer; 31 | 32 | if (doneAlready) { 33 | return; 34 | } 35 | env = getenv("MESA_SWAP_HACK"); 36 | if (env) { 37 | if ((env[0] != 'n') && (env[0] != 'N')) { 38 | vendor = (const char *) glGetString(GL_VENDOR); 39 | renderer = (const char *) glGetString(GL_RENDERER); 40 | 41 | /* Old versions of X11 Mesa uses the renderer string 42 | "Mesa"; Brian plans to start using "Mesa X11" to 43 | distinguish the X version of Mesa from other flavor 44 | such as Windows or 3Dfx. */ 45 | 46 | #define MESA_X11 "Mesa X11" 47 | 48 | /* XXX At some point in the future, eliminate the 49 | backward compatibility for the old "Mesa" renderer 50 | string. */ 51 | 52 | if (!strcmp(vendor, "Brian Paul") && (!strcmp(renderer, "Mesa") || 53 | !strncmp(renderer, MESA_X11, sizeof(MESA_X11) - 1))) { 54 | __glutMesaSwapHackSupport = 1; 55 | } 56 | } 57 | } 58 | doneAlready = 1; 59 | } 60 | -------------------------------------------------------------------------------- /glut/lib/glut/glut_modifier.c: -------------------------------------------------------------------------------- 1 | 2 | /* Copyright (c) Mark J. Kilgard, 1994. */ 3 | 4 | /* This program is freely distributable without licensing fees 5 | and is provided without guarantee or warrantee expressed or 6 | implied. This program is -not- in the public domain. */ 7 | 8 | #include "glutint.h" 9 | 10 | /* CENTRY */ 11 | int GLUTAPIENTRY 12 | glutGetModifiers(void) 13 | { 14 | int modifiers; 15 | 16 | if(__glutModifierMask == (unsigned int) ~0) { 17 | __glutWarning( 18 | "glutCurrentModifiers: do not call outside core input callback."); 19 | return 0; 20 | } 21 | modifiers = 0; 22 | if(__glutModifierMask & (ShiftMask|LockMask)) 23 | modifiers |= GLUT_ACTIVE_SHIFT; 24 | if(__glutModifierMask & ControlMask) 25 | modifiers |= GLUT_ACTIVE_CTRL; 26 | if(__glutModifierMask & Mod1Mask) 27 | modifiers |= GLUT_ACTIVE_ALT; 28 | return modifiers; 29 | } 30 | 31 | /* ENDCENTRY */ 32 | -------------------------------------------------------------------------------- /glut/lib/glut/glut_space.c: -------------------------------------------------------------------------------- 1 | 2 | /* Copyright (c) Mark J. Kilgard, 1994. */ 3 | 4 | /* This program is freely distributable without licensing fees 5 | and is provided without guarantee or warrantee expressed or 6 | implied. This program is -not- in the public domain. */ 7 | 8 | #include "glutint.h" 9 | 10 | void GLUTAPIENTRY 11 | glutSpaceballMotionFunc(GLUTspaceMotionCB spaceMotionFunc) 12 | { 13 | __glutCurrentWindow->spaceMotion = spaceMotionFunc; 14 | __glutUpdateInputDeviceMaskFunc = __glutUpdateInputDeviceMask; 15 | __glutPutOnWorkList(__glutCurrentWindow, 16 | GLUT_DEVICE_MASK_WORK); 17 | } 18 | 19 | void GLUTAPIENTRY 20 | glutSpaceballRotateFunc(GLUTspaceRotateCB spaceRotateFunc) 21 | { 22 | __glutCurrentWindow->spaceRotate = spaceRotateFunc; 23 | __glutUpdateInputDeviceMaskFunc = __glutUpdateInputDeviceMask; 24 | __glutPutOnWorkList(__glutCurrentWindow, 25 | GLUT_DEVICE_MASK_WORK); 26 | } 27 | 28 | void GLUTAPIENTRY 29 | glutSpaceballButtonFunc(GLUTspaceButtonCB spaceButtonFunc) 30 | { 31 | __glutCurrentWindow->spaceButton = spaceButtonFunc; 32 | __glutUpdateInputDeviceMaskFunc = __glutUpdateInputDeviceMask; 33 | __glutPutOnWorkList(__glutCurrentWindow, 34 | GLUT_DEVICE_MASK_WORK); 35 | } 36 | -------------------------------------------------------------------------------- /glut/lib/glut/glut_stroke.c: -------------------------------------------------------------------------------- 1 | 2 | /* Copyright (c) Mark J. Kilgard, 1994, 2001. */ 3 | 4 | /* This program is freely distributable without licensing fees 5 | and is provided without guarantee or warrantee expressed or 6 | implied. This program is -not- in the public domain. */ 7 | 8 | #include "glutint.h" 9 | #include "glutstroke.h" 10 | 11 | void GLUTAPIENTRY 12 | glutStrokeCharacter(GLUTstrokeFont font, int c) 13 | { 14 | const StrokeCharRec *ch; 15 | const StrokeRec *stroke; 16 | const CoordRec *coord; 17 | StrokeFontPtr fontinfo; 18 | int i, j; 19 | 20 | 21 | #if defined(_WIN32) 22 | fontinfo = (StrokeFontPtr) __glutFont(font); 23 | #else 24 | fontinfo = (StrokeFontPtr) font; 25 | #endif 26 | 27 | if (c < 0 || c >= fontinfo->num_chars) { 28 | return; 29 | } 30 | ch = &(fontinfo->ch[c]); 31 | if (ch) { 32 | for (i = ch->num_strokes, stroke = ch->stroke; 33 | i > 0; i--, stroke++) { 34 | glBegin(GL_LINE_STRIP); 35 | for (j = stroke->num_coords, coord = stroke->coord; 36 | j > 0; j--, coord++) { 37 | glVertex2f(coord->x, coord->y); 38 | } 39 | glEnd(); 40 | } 41 | glTranslatef(ch->right, 0.0, 0.0); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /glut/lib/glut/glut_swap.c: -------------------------------------------------------------------------------- 1 | 2 | /* Copyright (c) Mark J. Kilgard, 1994, 1997. */ 3 | 4 | /* This program is freely distributable without licensing fees 5 | and is provided without guarantee or warrantee expressed or 6 | implied. This program is -not- in the public domain. */ 7 | 8 | #include "glutint.h" 9 | 10 | /* CENTRY */ 11 | void GLUTAPIENTRY 12 | glutSwapBuffers(void) 13 | { 14 | GLUTwindow *window = __glutCurrentWindow; 15 | 16 | if (window->renderWin == window->win) { 17 | if (__glutCurrentWindow->treatAsSingle) { 18 | /* Pretend the double buffered window is single buffered, 19 | so treat glutSwapBuffers as a no-op. */ 20 | return; 21 | } 22 | } else { 23 | if (__glutCurrentWindow->overlay->treatAsSingle) { 24 | /* Pretend the double buffered overlay is single 25 | buffered, so treat glutSwapBuffers as a no-op. */ 26 | return; 27 | } 28 | } 29 | 30 | /* For the MESA_SWAP_HACK. */ 31 | window->usedSwapBuffers = 1; 32 | 33 | SWAP_BUFFERS_LAYER(__glutCurrentWindow); 34 | 35 | /* I considered putting the window being swapped on the 36 | GLUT_FINISH_WORK work list because you could call 37 | glutSwapBuffers from an idle callback which doesn't call 38 | __glutSetWindow which normally adds indirect rendering 39 | windows to the GLUT_FINISH_WORK work list. Not being put 40 | on the list could lead to the buffering up of multiple 41 | redisplays and buffer swaps and hamper interactivity. I 42 | consider this an application bug due to not using 43 | glutPostRedisplay to trigger redraws. If 44 | glutPostRedisplay were used, __glutSetWindow would be 45 | called and a glFinish to throttle buffering would occur. */ 46 | } 47 | /* ENDCENTRY */ 48 | -------------------------------------------------------------------------------- /glut/lib/glut/glut_swidth.c: -------------------------------------------------------------------------------- 1 | 2 | /* Copyright (c) Mark J. Kilgard, 1995, 2001. */ 3 | 4 | /* This program is freely distributable without licensing fees 5 | and is provided without guarantee or warrantee expressed or 6 | implied. This program is -not- in the public domain. */ 7 | 8 | #include "glutint.h" 9 | #include "glutstroke.h" 10 | 11 | /* glutStrokeWidth and glutStrokeLength had bugs in their implementation 12 | prior to GLUT 3.8. While the width of a stroke font character is a 13 | float, prior to GLUT 3.8, glutStrokeWidth returns the width truncated 14 | to an integer. Additionally, prior to GLUT 3.8, glutStrokeLength 15 | accumulated the length of a string with integer truncated widths 16 | meaning that glutStrokeLength underestimated the actual stroke font 17 | string length. 18 | 19 | GLUT 3.8 fixes glutStrokeLength to accumulate its string length 20 | with a float. GLUT 3.8 also adds the routines glutStrokeWidthf and 21 | glutStrokeLengthf that return accurate float widths and lengths. 22 | 23 | Use of glutStrokeWidth and glutStrokeLength is deprecated in favor 24 | of using glutStrokeWidthf and glutStrokeLengthf respectively. */ 25 | 26 | /* CENTRY */ 27 | int GLUTAPIENTRY 28 | glutStrokeWidth(GLUTstrokeFont font, int c) 29 | { 30 | StrokeFontPtr fontinfo; 31 | const StrokeCharRec *ch; 32 | 33 | #if defined(_WIN32) 34 | fontinfo = (StrokeFontPtr) __glutFont(font); 35 | #else 36 | fontinfo = (StrokeFontPtr) font; 37 | #endif 38 | 39 | if (c < 0 || c >= fontinfo->num_chars) { 40 | return 0; 41 | } 42 | ch = &(fontinfo->ch[c]); 43 | if (ch) { 44 | return ch->right; 45 | } else { 46 | return 0; 47 | } 48 | } 49 | 50 | float GLUTAPIENTRY 51 | glutStrokeWidthf(GLUTstrokeFont font, int c) 52 | { 53 | StrokeFontPtr fontinfo; 54 | const StrokeCharRec *ch; 55 | 56 | #if defined(_WIN32) 57 | fontinfo = (StrokeFontPtr) __glutFont(font); 58 | #else 59 | fontinfo = (StrokeFontPtr) font; 60 | #endif 61 | 62 | if (c < 0 || c >= fontinfo->num_chars) { 63 | return 0; 64 | } 65 | ch = &(fontinfo->ch[c]); 66 | if (ch) { 67 | return ch->right; 68 | } else { 69 | return 0; 70 | } 71 | } 72 | 73 | int GLUTAPIENTRY 74 | glutStrokeLength(GLUTstrokeFont font, const unsigned char *string) 75 | { 76 | StrokeFontPtr fontinfo; 77 | float length = 0.0; 78 | const StrokeCharRec *ch; 79 | 80 | #if defined(_WIN32) 81 | fontinfo = (StrokeFontPtr) __glutFont(font); 82 | #else 83 | fontinfo = (StrokeFontPtr) font; 84 | #endif 85 | 86 | for (; *string != '\0'; string++) { 87 | unsigned char c; 88 | 89 | c = *string; 90 | if (c < fontinfo->num_chars) { 91 | ch = &(fontinfo->ch[c]); 92 | if (ch) { 93 | length += ch->right; 94 | } 95 | } 96 | } 97 | /* Truncate to an int to conform to glutStrokeLength's unfortunate 98 | return type. */ 99 | return (int) length; 100 | } 101 | 102 | float GLUTAPIENTRY 103 | glutStrokeLengthf(GLUTstrokeFont font, const unsigned char *string) 104 | { 105 | StrokeFontPtr fontinfo; 106 | float length = 0.0; 107 | const StrokeCharRec *ch; 108 | 109 | #if defined(_WIN32) 110 | fontinfo = (StrokeFontPtr) __glutFont(font); 111 | #else 112 | fontinfo = (StrokeFontPtr) font; 113 | #endif 114 | 115 | for (; *string != '\0'; string++) { 116 | unsigned char c; 117 | 118 | c = *string; 119 | if (c < fontinfo->num_chars) { 120 | ch = &(fontinfo->ch[c]); 121 | if (ch) { 122 | length += ch->right; 123 | } 124 | } 125 | } 126 | return length; 127 | } 128 | 129 | /* ENDCENTRY */ 130 | -------------------------------------------------------------------------------- /glut/lib/glut/glut_tablet.c: -------------------------------------------------------------------------------- 1 | 2 | /* Copyright (c) Mark J. Kilgard, 1994. */ 3 | 4 | /* This program is freely distributable without licensing fees 5 | and is provided without guarantee or warrantee expressed or 6 | implied. This program is -not- in the public domain. */ 7 | 8 | #include 9 | 10 | #include "glutint.h" 11 | 12 | void GLUTAPIENTRY 13 | glutTabletMotionFunc(GLUTtabletMotionCB tabletMotionFunc) 14 | { 15 | __glutCurrentWindow->tabletMotion = tabletMotionFunc; 16 | __glutUpdateInputDeviceMaskFunc = __glutUpdateInputDeviceMask; 17 | __glutPutOnWorkList(__glutCurrentWindow, 18 | GLUT_DEVICE_MASK_WORK); 19 | /* If deinstalling callback, invalidate tablet position. */ 20 | if (tabletMotionFunc == NULL) { 21 | __glutCurrentWindow->tabletPos[0] = -1; 22 | __glutCurrentWindow->tabletPos[1] = -1; 23 | } 24 | } 25 | 26 | void GLUTAPIENTRY 27 | glutTabletButtonFunc(GLUTtabletButtonCB tabletButtonFunc) 28 | { 29 | __glutCurrentWindow->tabletButton = tabletButtonFunc; 30 | __glutUpdateInputDeviceMaskFunc = __glutUpdateInputDeviceMask; 31 | __glutPutOnWorkList(__glutCurrentWindow, 32 | GLUT_DEVICE_MASK_WORK); 33 | } 34 | -------------------------------------------------------------------------------- /glut/lib/glut/glut_teapot.c: -------------------------------------------------------------------------------- 1 | 2 | /* Copyright (c) Mark J. Kilgard, 1994, 2001. */ 3 | 4 | /** 5 | (c) Copyright 1993, Silicon Graphics, Inc. 6 | 7 | ALL RIGHTS RESERVED 8 | 9 | Permission to use, copy, modify, and distribute this software 10 | for any purpose and without fee is hereby granted, provided 11 | that the above copyright notice appear in all copies and that 12 | both the copyright notice and this permission notice appear in 13 | supporting documentation, and that the name of Silicon 14 | Graphics, Inc. not be used in advertising or publicity 15 | pertaining to distribution of the software without specific, 16 | written prior permission. 17 | 18 | THE MATERIAL EMBODIED ON THIS SOFTWARE IS PROVIDED TO YOU 19 | "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, EXPRESS, IMPLIED OR 20 | OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF 21 | MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. IN NO 22 | EVENT SHALL SILICON GRAPHICS, INC. BE LIABLE TO YOU OR ANYONE 23 | ELSE FOR ANY DIRECT, SPECIAL, INCIDENTAL, INDIRECT OR 24 | CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER, 25 | INCLUDING WITHOUT LIMITATION, LOSS OF PROFIT, LOSS OF USE, 26 | SAVINGS OR REVENUE, OR THE CLAIMS OF THIRD PARTIES, WHETHER OR 27 | NOT SILICON GRAPHICS, INC. HAS BEEN ADVISED OF THE POSSIBILITY 28 | OF SUCH LOSS, HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 29 | ARISING OUT OF OR IN CONNECTION WITH THE POSSESSION, USE OR 30 | PERFORMANCE OF THIS SOFTWARE. 31 | 32 | US Government Users Restricted Rights 33 | 34 | Use, duplication, or disclosure by the Government is subject to 35 | restrictions set forth in FAR 52.227.19(c)(2) or subparagraph 36 | (c)(1)(ii) of the Rights in Technical Data and Computer 37 | Software clause at DFARS 252.227-7013 and/or in similar or 38 | successor clauses in the FAR or the DOD or NASA FAR 39 | Supplement. Unpublished-- rights reserved under the copyright 40 | laws of the United States. Contractor/manufacturer is Silicon 41 | Graphics, Inc., 2011 N. Shoreline Blvd., Mountain View, CA 42 | 94039-7311. 43 | 44 | OpenGL(TM) is a trademark of Silicon Graphics, Inc. 45 | */ 46 | 47 | #include "glutint.h" 48 | 49 | /* Rim, body, lid, and bottom data must be reflected in x and 50 | y; handle and spout data across the y axis only. */ 51 | 52 | static const int patchdata[][16] = 53 | { 54 | /* rim */ 55 | {102, 103, 104, 105, 4, 5, 6, 7, 8, 9, 10, 11, 56 | 12, 13, 14, 15}, 57 | /* body */ 58 | {12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 59 | 24, 25, 26, 27}, 60 | {24, 25, 26, 27, 29, 30, 31, 32, 33, 34, 35, 36, 61 | 37, 38, 39, 40}, 62 | /* lid */ 63 | {96, 96, 96, 96, 97, 98, 99, 100, 101, 101, 101, 64 | 101, 0, 1, 2, 3,}, 65 | {0, 1, 2, 3, 106, 107, 108, 109, 110, 111, 112, 66 | 113, 114, 115, 116, 117}, 67 | /* bottom */ 68 | {118, 118, 118, 118, 124, 122, 119, 121, 123, 126, 69 | 125, 120, 40, 39, 38, 37}, 70 | /* handle */ 71 | {41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 72 | 53, 54, 55, 56}, 73 | {53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 74 | 28, 65, 66, 67}, 75 | /* spout */ 76 | {68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 77 | 80, 81, 82, 83}, 78 | {80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 79 | 92, 93, 94, 95} 80 | }; 81 | /* *INDENT-OFF* */ 82 | 83 | static const float cpdata[][3] = 84 | { 85 | {0.2, 0, 2.7}, {0.2, -0.112, 2.7}, {0.112, -0.2, 2.7}, {0, 86 | -0.2, 2.7}, {1.3375, 0, 2.53125}, {1.3375, -0.749, 2.53125}, 87 | {0.749, -1.3375, 2.53125}, {0, -1.3375, 2.53125}, {1.4375, 88 | 0, 2.53125}, {1.4375, -0.805, 2.53125}, {0.805, -1.4375, 89 | 2.53125}, {0, -1.4375, 2.53125}, {1.5, 0, 2.4}, {1.5, -0.84, 90 | 2.4}, {0.84, -1.5, 2.4}, {0, -1.5, 2.4}, {1.75, 0, 1.875}, 91 | {1.75, -0.98, 1.875}, {0.98, -1.75, 1.875}, {0, -1.75, 92 | 1.875}, {2, 0, 1.35}, {2, -1.12, 1.35}, {1.12, -2, 1.35}, 93 | {0, -2, 1.35}, {2, 0, 0.9}, {2, -1.12, 0.9}, {1.12, -2, 94 | 0.9}, {0, -2, 0.9}, {-2, 0, 0.9}, {2, 0, 0.45}, {2, -1.12, 95 | 0.45}, {1.12, -2, 0.45}, {0, -2, 0.45}, {1.5, 0, 0.225}, 96 | {1.5, -0.84, 0.225}, {0.84, -1.5, 0.225}, {0, -1.5, 0.225}, 97 | {1.5, 0, 0.15}, {1.5, -0.84, 0.15}, {0.84, -1.5, 0.15}, {0, 98 | -1.5, 0.15}, {-1.6, 0, 2.025}, {-1.6, -0.3, 2.025}, {-1.5, 99 | -0.3, 2.25}, {-1.5, 0, 2.25}, {-2.3, 0, 2.025}, {-2.3, -0.3, 100 | 2.025}, {-2.5, -0.3, 2.25}, {-2.5, 0, 2.25}, {-2.7, 0, 101 | 2.025}, {-2.7, -0.3, 2.025}, {-3, -0.3, 2.25}, {-3, 0, 102 | 2.25}, {-2.7, 0, 1.8}, {-2.7, -0.3, 1.8}, {-3, -0.3, 1.8}, 103 | {-3, 0, 1.8}, {-2.7, 0, 1.575}, {-2.7, -0.3, 1.575}, {-3, 104 | -0.3, 1.35}, {-3, 0, 1.35}, {-2.5, 0, 1.125}, {-2.5, -0.3, 105 | 1.125}, {-2.65, -0.3, 0.9375}, {-2.65, 0, 0.9375}, {-2, 106 | -0.3, 0.9}, {-1.9, -0.3, 0.6}, {-1.9, 0, 0.6}, {1.7, 0, 107 | 1.425}, {1.7, -0.66, 1.425}, {1.7, -0.66, 0.6}, {1.7, 0, 108 | 0.6}, {2.6, 0, 1.425}, {2.6, -0.66, 1.425}, {3.1, -0.66, 109 | 0.825}, {3.1, 0, 0.825}, {2.3, 0, 2.1}, {2.3, -0.25, 2.1}, 110 | {2.4, -0.25, 2.025}, {2.4, 0, 2.025}, {2.7, 0, 2.4}, {2.7, 111 | -0.25, 2.4}, {3.3, -0.25, 2.4}, {3.3, 0, 2.4}, {2.8, 0, 112 | 2.475}, {2.8, -0.25, 2.475}, {3.525, -0.25, 2.49375}, 113 | {3.525, 0, 2.49375}, {2.9, 0, 2.475}, {2.9, -0.15, 2.475}, 114 | {3.45, -0.15, 2.5125}, {3.45, 0, 2.5125}, {2.8, 0, 2.4}, 115 | {2.8, -0.15, 2.4}, {3.2, -0.15, 2.4}, {3.2, 0, 2.4}, {0, 0, 116 | 3.15}, {0.8, 0, 3.15}, {0.8, -0.45, 3.15}, {0.45, -0.8, 117 | 3.15}, {0, -0.8, 3.15}, {0, 0, 2.85}, {1.4, 0, 2.4}, {1.4, 118 | -0.784, 2.4}, {0.784, -1.4, 2.4}, {0, -1.4, 2.4}, {0.4, 0, 119 | 2.55}, {0.4, -0.224, 2.55}, {0.224, -0.4, 2.55}, {0, -0.4, 120 | 2.55}, {1.3, 0, 2.55}, {1.3, -0.728, 2.55}, {0.728, -1.3, 121 | 2.55}, {0, -1.3, 2.55}, {1.3, 0, 2.4}, {1.3, -0.728, 2.4}, 122 | {0.728, -1.3, 2.4}, {0, -1.3, 2.4}, {0, 0, 0}, {1.425, 123 | -0.798, 0}, {1.5, 0, 0.075}, {1.425, 0, 0}, {0.798, -1.425, 124 | 0}, {0, -1.5, 0.075}, {0, -1.425, 0}, {1.5, -0.84, 0.075}, 125 | {0.84, -1.5, 0.075} 126 | }; 127 | 128 | static const float tex[2][2][2] = 129 | { 130 | { {0, 0}, 131 | {1, 0}}, 132 | { {0, 1}, 133 | {1, 1}} 134 | }; 135 | 136 | /* *INDENT-ON* */ 137 | 138 | static void 139 | teapot(GLint grid, GLdouble scale, GLenum type) 140 | { 141 | float p[4][4][3], q[4][4][3], r[4][4][3], s[4][4][3]; 142 | long i, j, k, l; 143 | 144 | glPushAttrib(GL_ENABLE_BIT | GL_EVAL_BIT); 145 | glEnable(GL_AUTO_NORMAL); 146 | glEnable(GL_NORMALIZE); 147 | glEnable(GL_MAP2_VERTEX_3); 148 | glEnable(GL_MAP2_TEXTURE_COORD_2); 149 | glPushMatrix(); 150 | glRotatef(270.0, 1.0, 0.0, 0.0); 151 | glScalef(0.5 * scale, 0.5 * scale, 0.5 * scale); 152 | glTranslatef(0.0, 0.0, -1.5); 153 | for (i = 0; i < 10; i++) { 154 | for (j = 0; j < 4; j++) { 155 | for (k = 0; k < 4; k++) { 156 | for (l = 0; l < 3; l++) { 157 | p[j][k][l] = cpdata[patchdata[i][j * 4 + k]][l]; 158 | q[j][k][l] = cpdata[patchdata[i][j * 4 + (3 - k)]][l]; 159 | if (l == 1) { 160 | q[j][k][l] *= -1.0; 161 | } 162 | if (i < 6) { 163 | r[j][k][l] = 164 | cpdata[patchdata[i][j * 4 + (3 - k)]][l]; 165 | if (l == 0) { 166 | r[j][k][l] *= -1.0; 167 | } 168 | s[j][k][l] = cpdata[patchdata[i][j * 4 + k]][l]; 169 | if (l == 0) { 170 | s[j][k][l] *= -1.0; 171 | } 172 | if (l == 1) { 173 | s[j][k][l] *= -1.0; 174 | } 175 | } 176 | } 177 | } 178 | } 179 | glMap2f(GL_MAP2_TEXTURE_COORD_2, 0, 1, 2, 2, 0, 1, 4, 2, 180 | &tex[0][0][0]); 181 | glMap2f(GL_MAP2_VERTEX_3, 0, 1, 3, 4, 0, 1, 12, 4, 182 | &p[0][0][0]); 183 | glMapGrid2f(grid, 0.0, 1.0, grid, 0.0, 1.0); 184 | glEvalMesh2(type, 0, grid, 0, grid); 185 | glMap2f(GL_MAP2_VERTEX_3, 0, 1, 3, 4, 0, 1, 12, 4, 186 | &q[0][0][0]); 187 | glEvalMesh2(type, 0, grid, 0, grid); 188 | if (i < 6) { 189 | glMap2f(GL_MAP2_VERTEX_3, 0, 1, 3, 4, 0, 1, 12, 4, 190 | &r[0][0][0]); 191 | glEvalMesh2(type, 0, grid, 0, grid); 192 | glMap2f(GL_MAP2_VERTEX_3, 0, 1, 3, 4, 0, 1, 12, 4, 193 | &s[0][0][0]); 194 | glEvalMesh2(type, 0, grid, 0, grid); 195 | } 196 | } 197 | glPopMatrix(); 198 | glPopAttrib(); 199 | } 200 | 201 | /* CENTRY */ 202 | void GLUTAPIENTRY 203 | glutSolidTeapot(GLdouble scale) 204 | { 205 | teapot(7, scale, GL_FILL); 206 | } 207 | 208 | void GLUTAPIENTRY 209 | glutWireTeapot(GLdouble scale) 210 | { 211 | teapot(10, scale, GL_LINE); 212 | } 213 | 214 | /* ENDCENTRY */ 215 | -------------------------------------------------------------------------------- /glut/lib/glut/glut_util.c: -------------------------------------------------------------------------------- 1 | 2 | /* Copyright (c) Mark J. Kilgard, 1994, 2001. */ 3 | 4 | /* This program is freely distributable without licensing fees 5 | and is provided without guarantee or warrantee expressed or 6 | implied. This program is -not- in the public domain. */ 7 | 8 | #include 9 | #include 10 | #include 11 | #include 12 | 13 | #include "glutint.h" 14 | 15 | /* strdup is actually not a standard ANSI C or POSIX routine 16 | so implement a private one for GLUT. OpenVMS does not have a 17 | strdup; Linux's standard libc doesn't declare strdup by default 18 | (unless BSD or SVID interfaces are requested). */ 19 | char * 20 | __glutStrdup(const char *string) 21 | { 22 | char *copy; 23 | 24 | copy = (char*) malloc(strlen(string) + 1); 25 | if (copy == NULL) { 26 | return NULL; 27 | } 28 | strcpy(copy, string); 29 | return copy; 30 | } 31 | 32 | void 33 | __glutWarning(char *format,...) 34 | { 35 | va_list args; 36 | 37 | va_start(args, format); 38 | fprintf(stderr, "GLUT: Warning in %s: ", 39 | __glutProgramName ? __glutProgramName : "(unamed)"); 40 | vfprintf(stderr, format, args); 41 | va_end(args); 42 | putc('\n', stderr); 43 | } 44 | 45 | /* CENTRY */ 46 | void GLUTAPIENTRY 47 | glutReportErrors(void) 48 | { 49 | GLenum error; 50 | 51 | while ((error = glGetError()) != GL_NO_ERROR) 52 | __glutWarning("GL error: %s", gluErrorString(error)); 53 | } 54 | /* ENDCENTRY */ 55 | 56 | #ifndef NORETURN 57 | # if defined(__clang__) || defined(__GNUC__) 58 | /* The `volatile' keyword tells GCC that a function never returns. */ 59 | # define NORETURN void __attribute__((noreturn)) 60 | # else /* Not GCC. */ 61 | # if defined(_MSC_VER) && _MSC_VER >= 1310 62 | # define NORETURN __declspec(noreturn) void 63 | # else 64 | # define NORETURN void 65 | # endif 66 | # endif /* GCC. */ 67 | #endif /* __NORETURN not defined. */ 68 | 69 | NORETURN 70 | __glutFatalError(char *format,...) 71 | { 72 | va_list args; 73 | 74 | va_start(args, format); 75 | fprintf(stderr, "GLUT: Fatal Error in %s: ", 76 | __glutProgramName ? __glutProgramName : "(unamed)"); 77 | vfprintf(stderr, format, args); 78 | va_end(args); 79 | putc('\n', stderr); 80 | #ifdef _WIN32 81 | if (__glutExitFunc) { 82 | __glutExitFunc(1); 83 | } 84 | #endif 85 | exit(1); 86 | } 87 | 88 | NORETURN 89 | __glutFatalUsage(char *format,...) 90 | { 91 | va_list args; 92 | 93 | va_start(args, format); 94 | fprintf(stderr, "GLUT: Fatal API Usage in %s: ", 95 | __glutProgramName ? __glutProgramName : "(unamed)"); 96 | vfprintf(stderr, format, args); 97 | va_end(args); 98 | putc('\n', stderr); 99 | abort(); 100 | } 101 | -------------------------------------------------------------------------------- /glut/lib/glut/glut_vidresize.c: -------------------------------------------------------------------------------- 1 | 2 | /* Copyright (c) Mark J. Kilgard, 1996. */ 3 | 4 | /* This program is freely distributable without licensing fees 5 | and is provided without guarantee or warrantee expressed or 6 | implied. This program is -not- in the public domain. */ 7 | 8 | #include 9 | 10 | #ifndef _WIN32 11 | # define GLX_GLXEXT_LEGACY /* Request glext.h also include glxext.h */ 12 | # include 13 | #endif 14 | 15 | #ifdef __sgi 16 | # include 17 | #endif 18 | 19 | #include "glutint.h" 20 | 21 | /* Some Mesa versions define GLX_VERSION_1_2 without defining 22 | GLX_VERSION_1_1. */ 23 | #if defined(GLX_VERSION_1_2) && !defined(GLX_VERSION_1_1) 24 | # define GLX_VERSION_1_1 1 25 | #endif 26 | 27 | /* Grumble. The IRIX 6.3 and early IRIX 6.4 OpenGL headers 28 | support the video resize extension, but failed to define 29 | GLX_SGIX_video_resize. */ 30 | #ifdef GLX_SYNC_FRAME_SGIX 31 | # define GLX_SGIX_video_resize 1 32 | #endif 33 | 34 | /* Only SGI's InfiniteReality running IRIX supports the 35 | GLX_SGIX_video_resize extension. Just disable GLUT's 36 | video resize sub-API for non-IRIX systems. */ 37 | #ifndef irix 38 | # undef GLX_SGIX_video_resize 39 | #endif 40 | 41 | #if defined(GLX_VERSION_1_1) && defined(GLX_SGIX_video_resize) 42 | static int canVideoResize = -1; 43 | static int videoResizeChannel; 44 | #else 45 | static int canVideoResize = 0; 46 | #endif 47 | static int videoResizeInUse = 0; 48 | static int dx = -1, dy = -1, dw = -1, dh = -1; 49 | 50 | /* XXX Note that IRIX 6.2, 6.3, and some 6.4 versions have a 51 | bug where programs seg-fault when they attempt video 52 | resizing from an indirect OpenGL context (either local or 53 | over a network). */ 54 | 55 | #if defined(GLX_VERSION_1_1) && defined(GLX_SGIX_video_resize) 56 | 57 | static volatile int errorCaught; 58 | 59 | /* ARGSUSED */ 60 | static 61 | catchXSGIvcErrors(Display * dpy, XErrorEvent * event) 62 | { 63 | errorCaught = 1; 64 | return 0; 65 | } 66 | #endif 67 | 68 | /* CENTRY */ 69 | int GLUTAPIENTRY 70 | glutVideoResizeGet(GLenum param) 71 | { 72 | #if defined(GLX_VERSION_1_1) && defined(GLX_SGIX_video_resize) 73 | if (canVideoResize < 0) { 74 | canVideoResize = __glutIsSupportedByGLX("GLX_SGIX_video_resize"); 75 | if (canVideoResize) { 76 | #if __sgi 77 | /* This is a hack because IRIX 6.2, 6.3, and some 6.4 78 | versions were released with GLX_SGIX_video_resize 79 | being advertised by the X server though the video 80 | resize extension is not actually supported. We try to 81 | determine if the libGL.so we are using actually has a 82 | video resize entrypoint before we try to use the 83 | feature. */ 84 | void (*func) (void); 85 | void *glxDso = dlopen("libGL.so", RTLD_LAZY); 86 | 87 | func = (void (*)(void)) dlsym(glxDso, "glXQueryChannelDeltasSGIX"); 88 | if (!func) { 89 | canVideoResize = 0; 90 | } else 91 | #endif 92 | { 93 | char *channelString; 94 | int (*handler) (Display *, XErrorEvent *); 95 | 96 | channelString = getenv("GLUT_VIDEO_RESIZE_CHANNEL"); 97 | videoResizeChannel = channelString ? atoi(channelString) : 0; 98 | 99 | /* Work around another annoying problem with SGI's 100 | GLX_SGIX_video_resize implementation. Early IRIX 101 | 6.4 OpenGL's advertise the extension and have the 102 | video resize API, but an XSGIvc X protocol errors 103 | result trying to use the API. Set up an error 104 | handler to intercept what would otherwise be a fatal 105 | error. If an error was recieved, do not report that 106 | video resize is possible. */ 107 | handler = XSetErrorHandler(catchXSGIvcErrors); 108 | 109 | errorCaught = 0; 110 | 111 | glXQueryChannelDeltasSGIX(__glutDisplay, __glutScreen, 112 | videoResizeChannel, &dx, &dy, &dw, &dh); 113 | 114 | /* glXQueryChannelDeltasSGIX is an inherent X server 115 | round-trip so we know we will have gotten either the 116 | correct reply or and error by this time. */ 117 | XSetErrorHandler(handler); 118 | 119 | /* Still yet another work around. In IRIX 6.4 betas, 120 | glXQueryChannelDeltasSGIX will return as if it 121 | succeeded, but the values are filled with junk. 122 | Watch to make sure the delta variables really make 123 | sense. */ 124 | if (errorCaught || 125 | dx < 0 || dy < 0 || dw < 0 || dh < 0 || 126 | dx > 2048 || dy > 2048 || dw > 2048 || dh > 2048) { 127 | canVideoResize = 0; 128 | } 129 | } 130 | } 131 | } 132 | #endif /* GLX_SGIX_video_resize */ 133 | 134 | switch (param) { 135 | case GLUT_VIDEO_RESIZE_POSSIBLE: 136 | return canVideoResize; 137 | case GLUT_VIDEO_RESIZE_IN_USE: 138 | return videoResizeInUse; 139 | case GLUT_VIDEO_RESIZE_X_DELTA: 140 | return dx; 141 | case GLUT_VIDEO_RESIZE_Y_DELTA: 142 | return dy; 143 | case GLUT_VIDEO_RESIZE_WIDTH_DELTA: 144 | return dw; 145 | case GLUT_VIDEO_RESIZE_HEIGHT_DELTA: 146 | return dh; 147 | case GLUT_VIDEO_RESIZE_X: 148 | case GLUT_VIDEO_RESIZE_Y: 149 | case GLUT_VIDEO_RESIZE_WIDTH: 150 | case GLUT_VIDEO_RESIZE_HEIGHT: 151 | #if defined(GLX_VERSION_1_1) && defined(GLX_SGIX_video_resize) 152 | if (videoResizeInUse) { 153 | int x, y, width, height; 154 | 155 | glXQueryChannelRectSGIX(__glutDisplay, __glutScreen, 156 | videoResizeChannel, &x, &y, &width, &height); 157 | switch (param) { 158 | case GLUT_VIDEO_RESIZE_X: 159 | return x; 160 | case GLUT_VIDEO_RESIZE_Y: 161 | return y; 162 | case GLUT_VIDEO_RESIZE_WIDTH: 163 | return width; 164 | case GLUT_VIDEO_RESIZE_HEIGHT: 165 | return height; 166 | } 167 | } 168 | #endif 169 | return -1; 170 | default: 171 | __glutWarning("invalid glutVideoResizeGet parameter: %d", param); 172 | return -1; 173 | } 174 | } 175 | 176 | void GLUTAPIENTRY 177 | glutSetupVideoResizing(void) 178 | { 179 | #if defined(GLX_VERSION_1_1) && defined(GLX_SGIX_video_resize) 180 | if (glutVideoResizeGet(GLUT_VIDEO_RESIZE_POSSIBLE)) { 181 | glXBindChannelToWindowSGIX(__glutDisplay, __glutScreen, 182 | videoResizeChannel, __glutCurrentWindow->win); 183 | videoResizeInUse = 1; 184 | } else 185 | #endif 186 | __glutFatalError("glutEstablishVideoResizing: video resizing not possible.\n"); 187 | } 188 | 189 | void GLUTAPIENTRY 190 | glutStopVideoResizing(void) 191 | { 192 | #if defined(GLX_VERSION_1_1) && defined(GLX_SGIX_video_resize) 193 | if (glutVideoResizeGet(GLUT_VIDEO_RESIZE_POSSIBLE)) { 194 | if (videoResizeInUse) { 195 | glXBindChannelToWindowSGIX(__glutDisplay, __glutScreen, 196 | videoResizeChannel, None); 197 | videoResizeInUse = 0; 198 | } 199 | } 200 | #endif 201 | } 202 | 203 | /* ARGSUSED */ 204 | void GLUTAPIENTRY 205 | glutVideoResize(int x, int y, int width, int height) 206 | { 207 | #if defined(GLX_VERSION_1_1) && defined(GLX_SGIX_video_resize) 208 | if (videoResizeInUse) { 209 | #ifdef GLX_SYNC_SWAP_SGIX 210 | /* glXChannelRectSyncSGIX introduced in a patch to IRIX 211 | 6.2; the original unpatched IRIX 6.2 behavior is always 212 | GLX_SYNC_SWAP_SGIX. */ 213 | glXChannelRectSyncSGIX(__glutDisplay, __glutScreen, 214 | videoResizeChannel, GLX_SYNC_SWAP_SGIX); 215 | #endif 216 | glXChannelRectSGIX(__glutDisplay, __glutScreen, 217 | videoResizeChannel, x, y, width, height); 218 | } 219 | #endif 220 | } 221 | 222 | /* ARGSUSED */ 223 | void GLUTAPIENTRY 224 | glutVideoPan(int x, int y, int width, int height) 225 | { 226 | #if defined(GLX_VERSION_1_1) && defined(GLX_SGIX_video_resize) 227 | if (videoResizeInUse) { 228 | #ifdef GLX_SYNC_FRAME_SGIX 229 | /* glXChannelRectSyncSGIX introduced in a patch to IRIX 230 | 6.2; the original unpatched IRIX 6.2 behavior is always 231 | GLX_SYNC_SWAP_SGIX. We just ignore that we cannot 232 | accomplish GLX_SYNC_FRAME_SGIX on IRIX unpatched 6.2; 233 | this means you'd need a glutSwapBuffers to actually 234 | realize the video resize. */ 235 | glXChannelRectSyncSGIX(__glutDisplay, __glutScreen, 236 | videoResizeChannel, GLX_SYNC_FRAME_SGIX); 237 | #endif 238 | glXChannelRectSGIX(__glutDisplay, __glutScreen, 239 | videoResizeChannel, x, y, width, height); 240 | } 241 | #endif 242 | } 243 | 244 | /* ENDCENTRY */ 245 | -------------------------------------------------------------------------------- /glut/lib/glut/glut_warp.c: -------------------------------------------------------------------------------- 1 | 2 | /* Copyright (c) Mark J. Kilgard, 1996, 1997. */ 3 | 4 | /* This program is freely distributable without licensing fees 5 | and is provided without guarantee or warrantee expressed or 6 | implied. This program is -not- in the public domain. */ 7 | 8 | #include 9 | #include 10 | #include 11 | 12 | #include "glutint.h" 13 | 14 | /* CENTRY */ 15 | void GLUTAPIENTRY 16 | glutWarpPointer(int x, int y) 17 | { 18 | XWarpPointer(__glutDisplay, None, __glutCurrentWindow->win, 19 | 0, 0, 0, 0, x, y); 20 | XFlush(__glutDisplay); 21 | } 22 | 23 | /* ENDCENTRY */ 24 | -------------------------------------------------------------------------------- /glut/lib/glut/glut_wglext.c: -------------------------------------------------------------------------------- 1 | 2 | /* Copyright (c) Mark J. Kilgard, 1997, 2001. */ 3 | 4 | /* This program is freely distributable without licensing fees 5 | and is provided without guarantee or warrantee expressed or 6 | implied. This program is -not- in the public domain. */ 7 | 8 | #include 9 | #include 10 | #include "glutint.h" 11 | 12 | int 13 | __glutIsSupportedByWGL(const char *extension) 14 | { 15 | if (wglGetExtensionsStringARB) { 16 | static const GLubyte *extensions = NULL; 17 | const GLubyte *start; 18 | GLubyte *where, *terminator; 19 | 20 | /* Extension names should not have spaces. */ 21 | where = (GLubyte *) strchr(extension, ' '); 22 | if (where || *extension == '\0') { 23 | return 0; 24 | } 25 | 26 | if (!extensions) { 27 | extensions = (const GLubyte *) wglGetExtensionsStringARB(GetDC(0)); 28 | } 29 | 30 | if (extensions) { 31 | /* It takes a bit of care to be fool-proof about parsing the 32 | OpenGL extensions string. Don't be fooled by sub-strings, 33 | etc. */ 34 | start = extensions; 35 | for (;;) { 36 | /* If your application crashes in the strstr routine below, 37 | you are probably calling glutExtensionSupported without 38 | having a current window. Calling glGetString without 39 | a current OpenGL context has unpredictable results. 40 | Please fix your program. */ 41 | where = (GLubyte *) strstr((const char *) start, extension); 42 | if (!where) { 43 | break; 44 | } 45 | terminator = where + strlen(extension); 46 | if (where == start || *(where - 1) == ' ') { 47 | if (*terminator == ' ' || *terminator == '\0') { 48 | return 1; 49 | } 50 | } 51 | start = terminator; 52 | } 53 | } 54 | } 55 | 56 | return 0; 57 | } 58 | 59 | -------------------------------------------------------------------------------- /glut/lib/glut/glut_winmisc.c: -------------------------------------------------------------------------------- 1 | 2 | /* Copyright (c) Mark J. Kilgard, 1994, 2001. */ 3 | 4 | /* This program is freely distributable without licensing fees 5 | and is provided without guarantee or warrantee expressed or 6 | implied. This program is -not- in the public domain. */ 7 | 8 | #include 9 | #include 10 | #include 11 | #include 12 | 13 | #ifndef _WIN32 14 | #include 15 | #include 16 | #include /* for XA_STRING atom */ 17 | #endif 18 | 19 | #include "glutint.h" 20 | 21 | /* CENTRY */ 22 | void GLUTAPIENTRY 23 | glutSetWindowTitle(const char *title) 24 | { 25 | XTextProperty textprop; 26 | 27 | assert(!__glutCurrentWindow->parent); 28 | IGNORE_IN_GAME_MODE(); 29 | /* Ok that "cast discards `const' from pointer target type" below. */ 30 | textprop.value = (unsigned char *) title; 31 | textprop.encoding = XA_STRING; 32 | textprop.format = 8; 33 | textprop.nitems = (unsigned long)strlen(title); 34 | XSetWMName(__glutDisplay, 35 | __glutCurrentWindow->win, &textprop); 36 | XFlush(__glutDisplay); 37 | } 38 | 39 | void GLUTAPIENTRY 40 | glutSetIconTitle(const char *title) 41 | { 42 | XTextProperty textprop; 43 | 44 | assert(!__glutCurrentWindow->parent); 45 | IGNORE_IN_GAME_MODE(); 46 | /* Ok that "cast discards `const' from pointer target type" below. */ 47 | textprop.value = (unsigned char *) title; 48 | textprop.encoding = XA_STRING; 49 | textprop.format = 8; 50 | textprop.nitems = (unsigned long)strlen(title); 51 | XSetWMIconName(__glutDisplay, 52 | __glutCurrentWindow->win, &textprop); 53 | XFlush(__glutDisplay); 54 | } 55 | 56 | void GLUTAPIENTRY 57 | glutPositionWindow(int x, int y) 58 | { 59 | IGNORE_IN_GAME_MODE(); 60 | __glutCurrentWindow->desiredX = x; 61 | __glutCurrentWindow->desiredY = y; 62 | __glutCurrentWindow->desiredConfMask |= CWX | CWY; 63 | __glutPutOnWorkList(__glutCurrentWindow, GLUT_CONFIGURE_WORK); 64 | } 65 | 66 | void GLUTAPIENTRY 67 | glutReshapeWindow(int w, int h) 68 | { 69 | IGNORE_IN_GAME_MODE(); 70 | if (w <= 0 || h <= 0) { 71 | __glutWarning("glutReshapeWindow: non-positive width or height not allowed"); 72 | } 73 | 74 | __glutCurrentWindow->desiredWidth = w; 75 | __glutCurrentWindow->desiredHeight = h; 76 | __glutCurrentWindow->desiredConfMask |= CWWidth | CWHeight; 77 | __glutPutOnWorkList(__glutCurrentWindow, GLUT_CONFIGURE_WORK); 78 | } 79 | 80 | void GLUTAPIENTRY 81 | glutPopWindow(void) 82 | { 83 | IGNORE_IN_GAME_MODE(); 84 | __glutCurrentWindow->desiredStack = Above; 85 | __glutCurrentWindow->desiredConfMask |= CWStackMode; 86 | __glutPutOnWorkList(__glutCurrentWindow, GLUT_CONFIGURE_WORK); 87 | } 88 | 89 | void GLUTAPIENTRY 90 | glutPushWindow(void) 91 | { 92 | IGNORE_IN_GAME_MODE(); 93 | __glutCurrentWindow->desiredStack = Below; 94 | __glutCurrentWindow->desiredConfMask |= CWStackMode; 95 | __glutPutOnWorkList(__glutCurrentWindow, GLUT_CONFIGURE_WORK); 96 | } 97 | 98 | void GLUTAPIENTRY 99 | glutIconifyWindow(void) 100 | { 101 | IGNORE_IN_GAME_MODE(); 102 | assert(!__glutCurrentWindow->parent); 103 | __glutCurrentWindow->desiredMapState = IconicState; 104 | __glutPutOnWorkList(__glutCurrentWindow, GLUT_MAP_WORK); 105 | } 106 | 107 | void GLUTAPIENTRY 108 | glutShowWindow(void) 109 | { 110 | IGNORE_IN_GAME_MODE(); 111 | __glutCurrentWindow->desiredMapState = NormalState; 112 | __glutPutOnWorkList(__glutCurrentWindow, GLUT_MAP_WORK); 113 | } 114 | 115 | void GLUTAPIENTRY 116 | glutHideWindow(void) 117 | { 118 | IGNORE_IN_GAME_MODE(); 119 | __glutCurrentWindow->desiredMapState = WithdrawnState; 120 | __glutPutOnWorkList(__glutCurrentWindow, GLUT_MAP_WORK); 121 | } 122 | 123 | /* ENDCENTRY */ 124 | -------------------------------------------------------------------------------- /glut/lib/glut/glutbitmap.h: -------------------------------------------------------------------------------- 1 | #ifndef __glutbitmap_h__ 2 | #define __glutbitmap_h__ 3 | 4 | /* Copyright (c) Mark J. Kilgard, 1994, 1998. */ 5 | 6 | /* This program is freely distributable without licensing fees 7 | and is provided without guarantee or warrantee expressed or 8 | implied. This program is -not- in the public domain. */ 9 | 10 | #define GLUT_NO_LIB_PRAGMA /* Avoid auto library linking when building 11 | the GLUT library itself. */ 12 | #include 13 | 14 | typedef struct { 15 | const GLsizei width; 16 | const GLsizei height; 17 | const GLfloat xorig; 18 | const GLfloat yorig; 19 | const GLfloat advance; 20 | const GLubyte *bitmap; 21 | } BitmapCharRec, *BitmapCharPtr; 22 | 23 | typedef struct { 24 | const int num_chars; 25 | const int first; 26 | const BitmapCharRec * const *ch; 27 | } BitmapFontRec, *BitmapFontPtr; 28 | 29 | typedef void *GLUTbitmapFont; 30 | 31 | #endif /* __glutbitmap_h__ */ 32 | -------------------------------------------------------------------------------- /glut/lib/glut/glutstroke.h: -------------------------------------------------------------------------------- 1 | #ifndef __glutstroke_h__ 2 | #define __glutstroke_h__ 3 | 4 | /* Copyright (c) Mark J. Kilgard, 1994. */ 5 | 6 | /* This program is freely distributable without licensing fees 7 | and is provided without guarantee or warrantee expressed or 8 | implied. This program is -not- in the public domain. */ 9 | 10 | #ifdef _WIN32 11 | #pragma warning (disable:4244) /* disable bogus conversion warnings */ 12 | #pragma warning (disable:4305) /* VC++ 5.0 version of above warning. */ 13 | #endif 14 | 15 | typedef struct { 16 | float x; 17 | float y; 18 | } CoordRec, *CoordPtr; 19 | 20 | typedef struct { 21 | int num_coords; 22 | const CoordRec *coord; 23 | } StrokeRec, *StrokePtr; 24 | 25 | typedef struct { 26 | int num_strokes; 27 | const StrokeRec *stroke; 28 | float center; 29 | float right; 30 | } StrokeCharRec, *StrokeCharPtr; 31 | 32 | typedef struct { 33 | const char *name; 34 | int num_chars; 35 | const StrokeCharRec *ch; 36 | float top; 37 | float bottom; 38 | } StrokeFontRec, *StrokeFontPtr; 39 | 40 | typedef void *GLUTstrokeFont; 41 | 42 | #endif /* __glutstroke_h__ */ 43 | -------------------------------------------------------------------------------- /glut/lib/glut/glutwin32.h: -------------------------------------------------------------------------------- 1 | #ifndef __glutwin32_h__ 2 | #define __glutwin32_h__ 3 | 4 | /* Copyright (c) Nate Robins, 1997. */ 5 | /* portions Copyright (c) Mark Kilgard, 2000. */ 6 | 7 | /* This program is freely distributable without licensing fees 8 | and is provided without guarantee or warrantee expressed or 9 | implied. This program is -not- in the public domain. */ 10 | 11 | #include "win32_x11.h" 12 | #include "win32_glx.h" 13 | 14 | /* We have to undef some things because Microsoft likes to pollute the 15 | global namespace. */ 16 | #undef TRANSPARENT 17 | 18 | /* Polymorphic data type not present in older (32 bit only) header files. */ 19 | #if _MSC_VER < 1200 20 | typedef unsigned int UINT_PTR; 21 | #endif 22 | 23 | /* Win32 "equivalent" cursors - eventually, the X glyphs should be 24 | converted to Win32 cursors -- then they will look the same */ 25 | #define XC_arrow IDC_ARROW 26 | #define XC_top_left_arrow IDC_ARROW 27 | #define XC_hand1 IDC_SIZEALL 28 | #define XC_pirate IDC_NO 29 | #define XC_question_arrow IDC_HELP 30 | #define XC_exchange IDC_NO 31 | #define XC_spraycan IDC_SIZEALL 32 | #define XC_watch IDC_WAIT 33 | #define XC_xterm IDC_IBEAM 34 | #define XC_crosshair IDC_CROSS 35 | #define XC_sb_v_double_arrow IDC_SIZENS 36 | #define XC_sb_h_double_arrow IDC_SIZEWE 37 | #define XC_top_side IDC_UPARROW 38 | #define XC_bottom_side IDC_SIZENS 39 | #define XC_left_side IDC_SIZEWE 40 | #define XC_right_side IDC_SIZEWE 41 | #define XC_top_left_corner IDC_SIZENWSE 42 | #define XC_top_right_corner IDC_SIZENESW 43 | #define XC_bottom_right_corner IDC_SIZENWSE 44 | #define XC_bottom_left_corner IDC_SIZENESW 45 | 46 | #define XA_STRING 0 47 | 48 | /* Use our own typedef for timeval to avoid conflicts with the 49 | struct timeval defined by the Cygwin32 and/or MingW32 headers. */ 50 | struct timevalWIN32 { 51 | long tv_sec; /* seconds */ 52 | long tv_usec; /* microseconds */ 53 | }; 54 | 55 | /* Private routines from win32_util.c */ 56 | extern int gettimeofdayWIN32(struct timevalWIN32* tp); 57 | extern void *__glutFont(void *font); 58 | extern int __glutGetTransparentPixel(Display *dpy, XVisualInfo *vinfo); 59 | extern void __glutAdjustCoords(Window parent, int *x, int *y, int *width, int *height); 60 | 61 | #endif /* __glutwin32_h__ */ 62 | -------------------------------------------------------------------------------- /glut/lib/glut/layerutil.c: -------------------------------------------------------------------------------- 1 | 2 | /* Copyright (c) Mark J. Kilgard, 1993, 1994, 2001. */ 3 | 4 | /* This program is freely distributable without licensing fees 5 | and is provided without guarantee or warrantee expressed or 6 | implied. This program is -not- in the public domain. */ 7 | 8 | /* Based on XLayerUtil.c: Revision: 1.5 */ 9 | 10 | #include 11 | #include 12 | #include "layerutil.h" 13 | 14 | /* SGI optimization introduced in IRIX 6.3 to avoid X server 15 | round trips for interning common X atoms. */ 16 | #include 17 | #if defined(_SGI_EXTRA_PREDEFINES) && !defined(NO_FAST_ATOMS) 18 | #include 19 | #else 20 | #define XSGIFastInternAtom(dpy,string,fast_name,how) XInternAtom(dpy,string,how) 21 | #endif 22 | 23 | static Bool layersRead = False; 24 | static OverlayInfo **overlayInfoPerScreen; 25 | static unsigned long *numOverlaysPerScreen; 26 | 27 | static void 28 | findServerOverlayVisualsInfo(Display * dpy) 29 | { 30 | static Atom overlayVisualsAtom; 31 | Atom actualType; 32 | Status status; 33 | unsigned long sizeData, bytesLeft; 34 | Window root; 35 | int actualFormat, numScreens, i; 36 | 37 | if (layersRead == False) { 38 | overlayVisualsAtom = XSGIFastInternAtom(dpy, 39 | "SERVER_OVERLAY_VISUALS", SGI_XA_SERVER_OVERLAY_VISUALS, True); 40 | if (overlayVisualsAtom != None) { 41 | numScreens = ScreenCount(dpy); 42 | overlayInfoPerScreen = (OverlayInfo **) 43 | malloc(numScreens * sizeof(OverlayInfo *)); 44 | numOverlaysPerScreen = (unsigned long *) 45 | malloc(numScreens * sizeof(unsigned long)); 46 | if (overlayInfoPerScreen != NULL && 47 | numOverlaysPerScreen != NULL) { 48 | for (i = 0; i < numScreens; i++) { 49 | root = RootWindow(dpy, i); 50 | status = XGetWindowProperty(dpy, root, 51 | overlayVisualsAtom, 0L, (long) 10000, False, 52 | overlayVisualsAtom, &actualType, &actualFormat, 53 | &sizeData, &bytesLeft, 54 | (unsigned char **) &overlayInfoPerScreen[i]); 55 | if (status != Success || 56 | actualType != overlayVisualsAtom || 57 | actualFormat != 32 || sizeData < 4) { 58 | numOverlaysPerScreen[i] = 0; 59 | } else { 60 | /* Four 32-bit quantities per 61 | SERVER_OVERLAY_VISUALS entry. */ 62 | numOverlaysPerScreen[i] = sizeData / 4; 63 | } 64 | } 65 | layersRead = True; 66 | } else { 67 | if (overlayInfoPerScreen != NULL) { 68 | free(overlayInfoPerScreen); 69 | } 70 | if (numOverlaysPerScreen != NULL) { 71 | free(numOverlaysPerScreen); 72 | } 73 | } 74 | } 75 | } 76 | } 77 | 78 | int 79 | __glutGetTransparentPixel(Display * dpy, XVisualInfo * vinfo) 80 | { 81 | int i, screen = vinfo->screen; 82 | OverlayInfo *overlayInfo; 83 | 84 | findServerOverlayVisualsInfo(dpy); 85 | if (layersRead) { 86 | for (i = 0; i < numOverlaysPerScreen[screen]; i++) { 87 | overlayInfo = &overlayInfoPerScreen[screen][i]; 88 | if (vinfo->visualid == overlayInfo->overlay_visual) { 89 | if (overlayInfo->transparent_type == TransparentPixel) { 90 | return (int) overlayInfo->value; 91 | } else { 92 | return -1; 93 | } 94 | } 95 | } 96 | } 97 | return -1; 98 | } 99 | 100 | XLayerVisualInfo * 101 | __glutXGetLayerVisualInfo(Display * dpy, long lvinfo_mask, 102 | XLayerVisualInfo * lvinfo_template, int *nitems_return) 103 | { 104 | XVisualInfo *vinfo; 105 | XLayerVisualInfo *layerInfo; 106 | int numVisuals, count, i, j; 107 | 108 | vinfo = XGetVisualInfo(dpy, lvinfo_mask & VisualAllMask, 109 | &lvinfo_template->vinfo, nitems_return); 110 | if (vinfo == NULL) { 111 | return NULL; 112 | } 113 | numVisuals = *nitems_return; 114 | findServerOverlayVisualsInfo(dpy); 115 | layerInfo = (XLayerVisualInfo *) 116 | malloc(numVisuals * sizeof(XLayerVisualInfo)); 117 | if (layerInfo == NULL) { 118 | XFree(vinfo); 119 | return NULL; 120 | } 121 | count = 0; 122 | for (i = 0; i < numVisuals; i++) { 123 | XVisualInfo *pVinfo = &vinfo[i]; 124 | int screen = pVinfo->screen; 125 | OverlayInfo *overlayInfo = NULL; 126 | 127 | overlayInfo = NULL; 128 | if (layersRead) { 129 | for (j = 0; j < numOverlaysPerScreen[screen]; j++) { 130 | if (pVinfo->visualid == 131 | overlayInfoPerScreen[screen][j].overlay_visual) { 132 | overlayInfo = &overlayInfoPerScreen[screen][j]; 133 | break; 134 | } 135 | } 136 | } 137 | if (lvinfo_mask & VisualLayerMask) { 138 | if (overlayInfo == NULL) { 139 | if (lvinfo_template->layer != 0) { 140 | continue; 141 | } 142 | } else if (lvinfo_template->layer != overlayInfo->layer) { 143 | continue; 144 | } 145 | } 146 | if (lvinfo_mask & VisualTransparentType) { 147 | if (overlayInfo == NULL) { 148 | if (lvinfo_template->type != None) { 149 | continue; 150 | } 151 | } else if (lvinfo_template->type != 152 | overlayInfo->transparent_type) { 153 | continue; 154 | } 155 | } 156 | if (lvinfo_mask & VisualTransparentValue) { 157 | if (overlayInfo == NULL) { 158 | /* Non-overlay visuals have no sense of 159 | TransparentValue. */ 160 | continue; 161 | } else if (lvinfo_template->value != overlayInfo->value) { 162 | continue; 163 | } 164 | } 165 | layerInfo[count].vinfo = *pVinfo; 166 | if (overlayInfo == NULL) { 167 | layerInfo[count].layer = 0; 168 | layerInfo[count].type = None; 169 | layerInfo[count].value = 0; /* meaningless */ 170 | } else { 171 | layerInfo[count].layer = overlayInfo->layer; 172 | layerInfo[count].type = overlayInfo->transparent_type; 173 | layerInfo[count].value = overlayInfo->value; 174 | } 175 | count++; 176 | } 177 | XFree(vinfo); 178 | *nitems_return = count; 179 | if (count == 0) { 180 | XFree(layerInfo); 181 | return NULL; 182 | } else { 183 | return layerInfo; 184 | } 185 | } 186 | 187 | #if 0 /* Unused by GLUT. */ 188 | Status 189 | __glutXMatchLayerVisualInfo(Display * dpy, int screen, 190 | int depth, int visualClass, int layer, 191 | XLayerVisualInfo * lvinfo_return) 192 | { 193 | XLayerVisualInfo *lvinfo; 194 | XLayerVisualInfo lvinfoTemplate; 195 | int nitems; 196 | 197 | lvinfoTemplate.vinfo.screen = screen; 198 | lvinfoTemplate.vinfo.depth = depth; 199 | #if defined(__cplusplus) || defined(c_plusplus) 200 | lvinfoTemplate.vinfo.c_class = visualClass; 201 | #else 202 | lvinfoTemplate.vinfo.class = visualClass; 203 | #endif 204 | lvinfoTemplate.layer = layer; 205 | lvinfo = __glutXGetLayerVisualInfo(dpy, 206 | VisualScreenMask | VisualDepthMask | 207 | VisualClassMask | VisualLayerMask, 208 | &lvinfoTemplate, &nitems); 209 | if (lvinfo != NULL && nitems > 0) { 210 | *lvinfo_return = *lvinfo; 211 | return 1; 212 | } else { 213 | return 0; 214 | } 215 | } 216 | #endif 217 | -------------------------------------------------------------------------------- /glut/lib/glut/layerutil.h: -------------------------------------------------------------------------------- 1 | #ifndef __layerutil_h__ 2 | #define __layerutil_h__ 3 | 4 | /* Copyright (c) Mark J. Kilgard, 1993, 1994. */ 5 | 6 | /* This program is freely distributable without licensing fees 7 | and is provided without guarantee or warrantee expressed or 8 | implied. This program is -not- in the public domain. */ 9 | 10 | /* Based on XLayerUtil.h: Revision: 1.3 */ 11 | 12 | #ifndef _WIN32 13 | #include 14 | #include 15 | #include 16 | #endif /* !_WIN32 */ 17 | 18 | /* Transparent type values */ 19 | /* None 0 */ 20 | #define TransparentPixel 1 21 | #define TransparentMask 2 22 | 23 | /* layered visual info template flags */ 24 | #define VisualLayerMask 0x200 25 | #define VisualTransparentType 0x400 26 | #define VisualTransparentValue 0x800 27 | #define VisualAllLayerMask 0xFFF 28 | 29 | /* layered visual info structure */ 30 | typedef struct _XLayerVisualInfo { 31 | XVisualInfo vinfo; 32 | long layer; 33 | long type; 34 | unsigned long value; 35 | } XLayerVisualInfo; 36 | 37 | /* SERVER_OVERLAY_VISUALS property element */ 38 | typedef struct _OverlayInfo { 39 | /* Avoid 64-bit portability problems by being careful to use 40 | longs due to the way XGetWindowProperty is specified. Note 41 | that these parameters are passed as CARD32s over X 42 | protocol. */ 43 | long overlay_visual; 44 | long transparent_type; 45 | long value; 46 | long layer; 47 | } OverlayInfo; 48 | 49 | extern int __glutGetTransparentPixel(Display *, XVisualInfo *); 50 | extern XLayerVisualInfo *__glutXGetLayerVisualInfo(Display *, 51 | long, XLayerVisualInfo *, int *); 52 | extern Status __glutXMatchLayerVisualInfo(Display *, 53 | int, int, int, int, XLayerVisualInfo *); 54 | 55 | #endif /* __layerutil_h__ */ 56 | -------------------------------------------------------------------------------- /glut/lib/glut/makefile.nvmk: -------------------------------------------------------------------------------- 1 | ############################################################################## 2 | # //sw/apps/gpu/drivers/opengl/glut/lib/glut/makefile.nvmk 3 | # 4 | # unix-build/nvmake makefile for building libglut.a; based on 5 | # //sw/apps/gpu/drivers/opengl/glut/lib/glut/GNUmakefile 6 | ############################################################################## 7 | 8 | include $(NV_SOURCE)/common/build/nvCommon.nvmk 9 | 10 | NV_MODULE_LOGGING_NAME = "apps/glut" 11 | 12 | LIBGLUT = $(OUTPUTDIR)/libglut.a 13 | 14 | include $(NV_SOURCE)/gpu/drivers/opengl/glut/lib/glut/glut.nvmk 15 | 16 | build:: $(LIBGLUT) 17 | 18 | $(LIBGLUT): $(OBJECTS) 19 | $(call quiet_cmd,AR) cr $@ $(OBJECTS) 20 | 21 | include $(NV_SOURCE)/common/build/gcc-4.1.1as2.nvmk 22 | include $(NV_SOURCE)/common/build/nvCommonRules.nvmk 23 | -------------------------------------------------------------------------------- /glut/lib/glut/stroke.h: -------------------------------------------------------------------------------- 1 | /* $XConsortium: wfont.h,v 5.1 91/02/16 09:46:37 rws Exp $ */ 2 | 3 | /***************************************************************** 4 | Copyright (c) 1989,1990, 1991 by Sun Microsystems, Inc. and the X Consortium. 5 | 6 | All Rights Reserved 7 | 8 | Permission to use, copy, modify, and distribute this software and its 9 | documentation for any purpose and without fee is hereby granted, 10 | provided that the above copyright notice appear in all copies and that 11 | both that copyright notice and this permission notice appear in 12 | supporting documentation, and that the names of Sun Microsystems, 13 | the X Consortium, and MIT not be used in advertising or publicity 14 | pertaining to distribution of the software without specific, written 15 | prior permission. 16 | 17 | SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, 18 | INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT 19 | SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL 20 | DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, 21 | WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, 22 | ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS 23 | SOFTWARE. 24 | 25 | ******************************************************************/ 26 | 27 | #ifndef WFONT_INCLUDED 28 | #define WFONT_INCLUDED 29 | 30 | #define WFONT_MAGIC 0x813 31 | #define WFONT_MAGIC_PLUS 0x715 32 | #define WFONT_MAGIC_PEX 0x70686e74 33 | #define START_PROPS 0x100 34 | #define START_DISPATCH(_num_props) (START_PROPS + 160 * _num_props) 35 | #define START_PATH(_num_ch_, _num_props) (START_DISPATCH(_num_props) + sizeof(Dispatch) * _num_ch_) 36 | #define NUM_DISPATCH 128 37 | 38 | typedef struct { 39 | unsigned short x; 40 | unsigned short y; 41 | } Path_point2dpx; 42 | 43 | typedef struct { 44 | float x; 45 | float y; 46 | } Path_point2df; 47 | 48 | typedef struct { 49 | int x; 50 | int y; 51 | int z; 52 | } Path_point3di; 53 | 54 | typedef struct { 55 | float x; 56 | float y; 57 | float z; 58 | } Path_point3df; 59 | 60 | typedef struct { 61 | float x; 62 | float y; 63 | float z; 64 | float w; 65 | } Path_point4df; 66 | 67 | typedef union { 68 | Path_point2dpx *pt2dpx; 69 | Path_point2df *pt2df; 70 | Path_point3di *pt3di; 71 | Path_point3df *pt3df; 72 | Path_point4df *pt4df; 73 | } Path_pt_ptr; 74 | 75 | typedef enum { 76 | PATH_2DF, 77 | PATH_2DPX, 78 | PATH_3DF, 79 | PATH_3DI, 80 | PATH_4DF 81 | } Path_type; 82 | 83 | typedef struct { 84 | int n_pts; /* number of points in the subpath */ 85 | Path_pt_ptr pts; /* pointer to them */ 86 | int closed; /* true if the subpath is closed */ 87 | int dcmp_flag; /* flag for pgon dcmp, pgon type 88 | * and dcmped triangle type */ 89 | } Path_subpath; 90 | 91 | typedef struct { 92 | Path_type type; /* type of vertices in this path */ 93 | int n_subpaths; /* number of subpaths */ 94 | int n_vertices; /* total number of vertices */ 95 | Path_subpath *subpaths; /* array of subpaths */ 96 | } Path; 97 | 98 | typedef Path *Path_handle; 99 | 100 | typedef struct { 101 | char propname[80]; /* font property name */ 102 | char propvalue[80]; /* font property value */ 103 | } Property; 104 | 105 | typedef struct { 106 | int magic; /* magic number */ 107 | char name[80]; /* name of this font */ 108 | float top, /* extreme values */ 109 | bottom, max_width; 110 | int num_ch; /* no. of fonts in the set */ 111 | int num_props; /* no. of font properties */ 112 | Property *properties; /* array of properties */ 113 | } Font_header; 114 | 115 | typedef struct { 116 | float center, /* center of the character */ 117 | right; /* right edge */ 118 | long offset; /* offset in the file of the character 119 | * * description */ 120 | } Dispatch; 121 | 122 | typedef struct { 123 | float center, right; 124 | Path strokes; 125 | } Ch_font; 126 | 127 | typedef struct { 128 | char name[80]; 129 | float top, bottom, max_width; 130 | int num_ch; /* # characters in the font */ 131 | Ch_font **ch_data; 132 | } Phg_font; 133 | 134 | #endif /*WFONT_INCLUDED */ 135 | -------------------------------------------------------------------------------- /glut/lib/glut/strokelex.l: -------------------------------------------------------------------------------- 1 | %{ 2 | /* $XConsortium: lex.l,v 5.4 91/08/26 10:55:26 gildea Exp $ */ 3 | 4 | /***************************************************************** 5 | Copyright (c) 1989,1990, 1991 by Sun Microsystems, Inc. and the X Consortium. 6 | 7 | All Rights Reserved 8 | 9 | Permission to use, copy, modify, and distribute this software and its 10 | documentation for any purpose and without fee is hereby granted, 11 | provided that the above copyright notice appear in all copies and that 12 | both that copyright notice and this permission notice appear in 13 | supporting documentation, and that the names of Sun Microsystems, 14 | the X Consortium, and MIT not be used in advertising or publicity 15 | pertaining to distribution of the software without specific, written 16 | prior permission. 17 | 18 | SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, 19 | INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT 20 | SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL 21 | DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, 22 | WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, 23 | ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS 24 | SOFTWARE. 25 | 26 | ******************************************************************/ 27 | 28 | 29 | #include 30 | #include 31 | #include 32 | #include "strokegen.h" 33 | 34 | #if defined(ISC) && defined(SYSV) && defined(SYSV386) && __STDC__ 35 | extern double atof(char *); 36 | #endif 37 | 38 | #ifdef FLEX_SCANNER 39 | int yylineno; 40 | #endif 41 | 42 | %} 43 | %% 44 | \'[^']*\' | 45 | \"[^"]*\" return string(yytext, yyleng); 46 | #.* ; 47 | [ ,;\t\n]* /* natural dilimters */ ; 48 | 49 | [a-zA-Z][a-zA-Z0-9_.]* { 50 | int token; 51 | if (token = res_words(yytext)) 52 | return token; 53 | return string(yytext, yyleng); 54 | } 55 | 56 | [+-]?[0-9]+\.?[0-9]*[eE][+-]?[0-9]+ | 57 | [+-]?[0-9]+\.[0-9]* | 58 | \.[0-9]+ { 59 | yylval.dval = atof(yytext); 60 | return REAL; 61 | } 62 | [+-]?[0-9]+#[0-9]+ { 63 | return INTEGER; 64 | } 65 | [+-]?[0-9]+ { 66 | yylval.ival = atoi(yytext); 67 | return INTEGER; 68 | } 69 | [()] ; 70 | %% 71 | 72 | int 73 | res_words(str) 74 | char str[]; 75 | { 76 | static struct res_strct { 77 | char *word; 78 | int token; 79 | } res_table[] = { 80 | {"BOTTOM", BOTTOM}, 81 | {"CENTER", CENTER}, 82 | {"PROPERTIES", PROPERTIES}, 83 | {"CLOSE", CLOSE}, 84 | {"FONTNAME", FONTNAME}, 85 | {"INDEX", INDEX}, 86 | {"MAGIC", MAGIC}, 87 | {"OPEN", OPEN}, 88 | {"RIGHT", RIGHT}, 89 | {"STROKE", STROKE}, 90 | {"TOP", TOP}, 91 | {"VERTICES", VERTICES}, 92 | {"BEARING", BEARING}, 93 | {"L_SPACE", L_SPACE}, 94 | {"WIDTH", WIDTH}, 95 | {"R_SPACE", R_SPACE}, 96 | {"NUM_CH", NUM_CH}, 97 | {0, 0} 98 | }; 99 | 100 | { 101 | register struct res_strct *reserved; 102 | 103 | reserved = res_table; 104 | 105 | do 106 | if (!strcmp(str, reserved->word)) 107 | break; 108 | while ((++reserved)->word != 0); 109 | return reserved->token; 110 | } 111 | } 112 | 113 | int 114 | string(str, n) 115 | char *str; 116 | int n; 117 | { 118 | if (*str == '\"' || *str == '\'') 119 | { 120 | str++; 121 | n -= 2; /* one for EOL, one for end quote */ 122 | } 123 | if ((yylval.cval = (char *)malloc(n+1)) != NULL) 124 | { 125 | strncpy(yylval.cval, str, n); 126 | yylval.cval[n] = '\0'; 127 | return STRING; 128 | } 129 | else 130 | return 0; 131 | } 132 | -------------------------------------------------------------------------------- /glut/lib/glut/win32_glx.h: -------------------------------------------------------------------------------- 1 | #ifndef __win32_glx_h__ 2 | #define __win32_glx_h__ 3 | 4 | /* Copyright (c) Nate Robins, 1997. */ 5 | /* Copyright (c) Mark Kilgard, 1998, 2001. */ 6 | 7 | /* This program is freely distributable without licensing fees 8 | and is provided without guarantee or warrantee expressed or 9 | implied. This program is -not- in the public domain. */ 10 | 11 | #include "win32_x11.h" 12 | #include 13 | 14 | /* Type definitions (conversions). */ 15 | typedef HGLRC GLXContext; 16 | 17 | #define GLX_USE_GL 1 /* support GLX rendering */ 18 | #define GLX_BUFFER_SIZE 2 /* depth of the color buffer */ 19 | #define GLX_LEVEL 3 /* level in plane stacking */ 20 | #define GLX_RGBA 4 /* true if RGBA mode */ 21 | #define GLX_DOUBLEBUFFER 5 /* double buffering supported */ 22 | #define GLX_STEREO 6 /* stereo buffering supported */ 23 | #define GLX_AUX_BUFFERS 7 /* number of aux buffers */ 24 | #define GLX_RED_SIZE 8 /* number of red component bits */ 25 | #define GLX_GREEN_SIZE 9 /* number of green component bits */ 26 | #define GLX_BLUE_SIZE 10 /* number of blue component bits */ 27 | #define GLX_ALPHA_SIZE 11 /* number of alpha component bits */ 28 | #define GLX_DEPTH_SIZE 12 /* number of depth bits */ 29 | #define GLX_STENCIL_SIZE 13 /* number of stencil bits */ 30 | #define GLX_ACCUM_RED_SIZE 14 /* number of red accum bits */ 31 | #define GLX_ACCUM_GREEN_SIZE 15 /* number of green accum bits */ 32 | #define GLX_ACCUM_BLUE_SIZE 16 /* number of blue accum bits */ 33 | #define GLX_ACCUM_ALPHA_SIZE 17 /* number of alpha accum bits */ 34 | 35 | /* Defines from the GLX visual rating extension. */ 36 | #define GLX_VISUAL_CAVEAT_EXT 0x20 37 | #define GLX_NONE_EXT 0x8000 38 | #define GLX_SLOW_VISUAL_EXT 0x8001 39 | 40 | #define GLX_BAD_ATTRIB 2 41 | #define GLX_BAD_VISUAL 4 42 | 43 | /* WGL_ARB_pixel_format */ 44 | #ifndef WGL_ARB_pixel_format 45 | #define WGL_NUMBER_PIXEL_FORMATS_ARB 0x2000 46 | #define WGL_DRAW_TO_WINDOW_ARB 0x2001 47 | #define WGL_DRAW_TO_BITMAP_ARB 0x2002 48 | #define WGL_ACCELERATION_ARB 0x2003 49 | #define WGL_NEED_PALETTE_ARB 0x2004 50 | #define WGL_NEED_SYSTEM_PALETTE_ARB 0x2005 51 | #define WGL_SWAP_LAYER_BUFFERS_ARB 0x2006 52 | #define WGL_SWAP_METHOD_ARB 0x2007 53 | #define WGL_NUMBER_OVERLAYS_ARB 0x2008 54 | #define WGL_NUMBER_UNDERLAYS_ARB 0x2009 55 | #define WGL_TRANSPARENT_ARB 0x200A 56 | #define WGL_SHARE_DEPTH_ARB 0x200C 57 | #define WGL_SHARE_STENCIL_ARB 0x200D 58 | #define WGL_SHARE_ACCUM_ARB 0x200E 59 | #define WGL_SUPPORT_GDI_ARB 0x200F 60 | #define WGL_SUPPORT_OPENGL_ARB 0x2010 61 | #define WGL_DOUBLE_BUFFER_ARB 0x2011 62 | #define WGL_STEREO_ARB 0x2012 63 | #define WGL_PIXEL_TYPE_ARB 0x2013 64 | #define WGL_COLOR_BITS_ARB 0x2014 65 | #define WGL_RED_BITS_ARB 0x2015 66 | #define WGL_RED_SHIFT_ARB 0x2016 67 | #define WGL_GREEN_BITS_ARB 0x2017 68 | #define WGL_GREEN_SHIFT_ARB 0x2018 69 | #define WGL_BLUE_BITS_ARB 0x2019 70 | #define WGL_BLUE_SHIFT_ARB 0x201A 71 | #define WGL_ALPHA_BITS_ARB 0x201B 72 | #define WGL_ALPHA_SHIFT_ARB 0x201C 73 | #define WGL_ACCUM_BITS_ARB 0x201D 74 | #define WGL_ACCUM_RED_BITS_ARB 0x201E 75 | #define WGL_ACCUM_GREEN_BITS_ARB 0x201F 76 | #define WGL_ACCUM_BLUE_BITS_ARB 0x2020 77 | #define WGL_ACCUM_ALPHA_BITS_ARB 0x2021 78 | #define WGL_DEPTH_BITS_ARB 0x2022 79 | #define WGL_STENCIL_BITS_ARB 0x2023 80 | #define WGL_AUX_BUFFERS_ARB 0x2024 81 | #define WGL_NO_ACCELERATION_ARB 0x2025 82 | #define WGL_GENERIC_ACCELERATION_ARB 0x2026 83 | #define WGL_FULL_ACCELERATION_ARB 0x2027 84 | #define WGL_SWAP_EXCHANGE_ARB 0x2028 85 | #define WGL_SWAP_COPY_ARB 0x2029 86 | #define WGL_SWAP_UNDEFINED_ARB 0x202A 87 | #define WGL_TYPE_RGBA_ARB 0x202B 88 | #define WGL_TYPE_COLORINDEX_ARB 0x202C 89 | #define WGL_TRANSPARENT_RED_VALUE_ARB 0x2037 90 | #define WGL_TRANSPARENT_GREEN_VALUE_ARB 0x2038 91 | #define WGL_TRANSPARENT_BLUE_VALUE_ARB 0x2039 92 | #define WGL_TRANSPARENT_ALPHA_VALUE_ARB 0x203A 93 | #define WGL_TRANSPARENT_INDEX_VALUE_ARB 0x203B 94 | #endif 95 | 96 | /* WGL_ARB_multisample */ 97 | #ifndef WGL_ARB_multisample 98 | #define WGL_SAMPLE_BUFFERS_ARB 0x2041 99 | #define WGL_SAMPLES_ARB 0x2042 100 | #endif 101 | 102 | /* ARB_multisample */ 103 | typedef void (APIENTRY * PFNGLSAMPLECOVERAGEARBPROC) (GLclampf value, GLboolean invert); 104 | 105 | /* WGL_ARB_extensions_string */ 106 | typedef const char * (APIENTRY * PFNWGLGETEXTENSIONSSTRINGARBPROC) (HDC hdc); 107 | 108 | /* WGL_ARB_pixel_format */ 109 | typedef BOOL (APIENTRY * PFNWGLGETPIXELFORMATATTRIBIVARBPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int *piAttributes, int *piValues); 110 | typedef BOOL (APIENTRY * PFNWGLGETPIXELFORMATATTRIBFVARBPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int *piAttributes, FLOAT *pfValues); 111 | typedef BOOL (APIENTRY * PFNWGLCHOOSEPIXELFORMATARBPROC) (HDC hdc, const int *piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats); 112 | 113 | /* ARB_multisample entry point */ 114 | extern PFNGLSAMPLECOVERAGEARBPROC glSampleCoverageARB; 115 | 116 | /* WGL_ARB_extensions_string entry point */ 117 | extern PFNWGLGETEXTENSIONSSTRINGARBPROC wglGetExtensionsStringARB; 118 | 119 | /* WGL_ARB_pixel_format entry points */ 120 | extern PFNWGLGETPIXELFORMATATTRIBIVARBPROC wglGetPixelFormatAttribivARB; 121 | extern PFNWGLGETPIXELFORMATATTRIBFVARBPROC wglGetPixelFormatAttribfvARB; 122 | extern PFNWGLCHOOSEPIXELFORMATARBPROC wglChoosePixelFormatARB; 123 | 124 | /* Variables to record what extensions the ICD supports. */ 125 | extern int has_WGL_ARB_extensions_string; 126 | extern int has_WGL_ARB_pixel_format; 127 | extern int has_WGL_ARB_multisample; 128 | extern int has_GL_ARB_multisample; 129 | 130 | /* GLX functions emulated by macros. */ 131 | 132 | #define glXDestroyContext(display, context) \ 133 | wglDeleteContext(context) 134 | 135 | /* GLX functions emulated by functions. */ 136 | 137 | extern int glXGetConfig( 138 | Display* display, 139 | XVisualInfo* visual, 140 | int attrib, 141 | int* value); 142 | extern XVisualInfo* glXChooseVisual( 143 | Display* display, 144 | int screen, 145 | int* attribList); 146 | 147 | #endif /* __win32_glx_h__ */ 148 | -------------------------------------------------------------------------------- /glut/lib/glut/win32_util.c: -------------------------------------------------------------------------------- 1 | 2 | /* Copyright (c) Nate Robins, 1997. */ 3 | /* portions Copyright (c) Mark Kilgard, 1997, 1998, 2000. */ 4 | 5 | /* This program is freely distributable without licensing fees 6 | and is provided without guarantee or warrantee expressed or 7 | implied. This program is -not- in the public domain. */ 8 | 9 | 10 | #include "glutint.h" 11 | #include "glutstroke.h" 12 | #include "glutbitmap.h" 13 | 14 | #if defined(__MINGW32) 15 | typedef MINMAXINFO *LPMINMAXINFO; 16 | #endif 17 | 18 | extern StrokeFontRec glutStrokeRoman, glutStrokeMonoRoman; 19 | extern BitmapFontRec glutBitmap8By13, glutBitmap9By15, glutBitmapTimesRoman10, glutBitmapTimesRoman24, glutBitmapHelvetica10, glutBitmapHelvetica12, glutBitmapHelvetica18; 20 | 21 | /* Strange, but "ftime" appears to be faster on both Windows 98 and 22 | Windows NT 4.0 than using "GetSystemTime" to return a timeval. 23 | So just keep using ftime, but the "GetSystemTime" code is here 24 | for reference. */ 25 | #define USE_GetSystemTime 0 26 | 27 | #if USE_GetSystemTime && defined(_INTEGRAL_MAX_BITS) && _INTEGRAL_MAX_BITS >= 64 28 | /* 29 | * Number of clock ticks per second. A clock tick is the unit by which 30 | * processor time is measured and is returned by 'clock'. 31 | */ 32 | #define CLOCKS_PER_SEC 1000.0 33 | #define FACTOR (0x19db1ded53ea710ui64) 34 | #define NSPERSEC 10000000ui64 35 | 36 | static unsigned __int64 37 | __to_clock_t (FILETIME * src) 38 | { 39 | unsigned __int64 total = ((unsigned __int64) src->dwHighDateTime << 32) + ((unsigned)src->dwLowDateTime); 40 | 41 | /* Convert into clock ticks - the total is in 10ths of a usec. */ 42 | total -= FACTOR; 43 | 44 | total /= (unsigned __int64) (NSPERSEC / CLOCKS_PER_SEC); 45 | return total; 46 | } 47 | 48 | static void 49 | totimeval (struct timeval *dst, FILETIME *src) 50 | { 51 | __int64 x = __to_clock_t (src); 52 | 53 | x *= (int) (1e6) / CLOCKS_PER_SEC; /* Turn x into usecs */ 54 | 55 | dst->tv_usec = x % (__int64) (1e6); /* And split */ 56 | dst->tv_sec = x / (__int64) (1e6); 57 | } 58 | 59 | int 60 | gettimeofdayWIN32(struct timevalWIN32* tp) 61 | { 62 | SYSTEMTIME t; 63 | FILETIME f; 64 | 65 | GetSystemTime (&t); 66 | if (!SystemTimeToFileTime (&t, &f)) { 67 | /* GLUT never expects this to fail! */ 68 | return -1; 69 | } 70 | totimeval (tp, &f); 71 | 72 | /* 0 indicates that the call succeeded. */ 73 | return 0; 74 | } 75 | 76 | #else /* no 64-bit data type support so use mundane ftime based gettimeofday */ 77 | 78 | #if defined(_INTEGRAL_MAX_BITS) && _INTEGRAL_MAX_BITS >= 64 79 | /* GetSystemTimeAsFileTime has lower latency and more precision (but 80 | apparently no finer granularity) than ftime. */ 81 | int 82 | gettimeofdayWIN32(struct timevalWIN32* tp) 83 | { 84 | union { 85 | LONGLONG ns100; /*time since 1 Jan 1601 in 100ns units */ 86 | FILETIME ft; 87 | } now; 88 | 89 | GetSystemTimeAsFileTime (&now.ft); 90 | tp->tv_usec = (long) ((now.ns100 / 10i64) % 1000000i64); 91 | tp->tv_sec = (long) ((now.ns100 - 116444736000000000i64) / 10000000i64); 92 | return 0; 93 | } 94 | #else 95 | #include /* For the ftime prototype. */ 96 | int 97 | gettimeofdayWIN32(struct timevalWIN32* tp) 98 | { 99 | struct timeb tb; 100 | 101 | ftime(&tb); 102 | tp->tv_sec = tb.time; 103 | tp->tv_usec = tb.millitm * 1000; 104 | 105 | /* 0 indicates that the call succeeded. */ 106 | return 0; 107 | } 108 | #endif 109 | 110 | #endif 111 | 112 | #if _MSC_VER >= 1200 113 | #pragma warning(push) 114 | #pragma warning(disable:4715) 115 | #endif 116 | 117 | /* To get around the fact that Microsoft DLLs only allow functions 118 | to be exported and now data addresses (as Unix DSOs support), the 119 | GLUT API constants such as GLUT_STROKE_ROMAN have to get passed 120 | through a case statement to get mapped to the actual data structure 121 | address. */ 122 | void* 123 | __glutFont(void *font) 124 | { 125 | switch((UINT_PTR)font) { 126 | case (UINT_PTR)GLUT_STROKE_ROMAN: 127 | return &glutStrokeRoman; 128 | case (UINT_PTR)GLUT_STROKE_MONO_ROMAN: 129 | return &glutStrokeMonoRoman; 130 | case (UINT_PTR)GLUT_BITMAP_9_BY_15: 131 | return &glutBitmap9By15; 132 | case (UINT_PTR)GLUT_BITMAP_8_BY_13: 133 | return &glutBitmap8By13; 134 | case (UINT_PTR)GLUT_BITMAP_TIMES_ROMAN_10: 135 | return &glutBitmapTimesRoman10; 136 | case (UINT_PTR)GLUT_BITMAP_TIMES_ROMAN_24: 137 | return &glutBitmapTimesRoman24; 138 | case (UINT_PTR)GLUT_BITMAP_HELVETICA_10: 139 | return &glutBitmapHelvetica10; 140 | case (UINT_PTR)GLUT_BITMAP_HELVETICA_12: 141 | return &glutBitmapHelvetica12; 142 | case (UINT_PTR)GLUT_BITMAP_HELVETICA_18: 143 | return &glutBitmapHelvetica18; 144 | } 145 | __glutFatalError("out of memory."); 146 | /* NOTREACHED */ 147 | } 148 | #if _MSC_VER >= 1200 149 | #pragma warning(pop) 150 | #endif 151 | 152 | int 153 | __glutGetTransparentPixel(Display * dpy, XVisualInfo * vinfo) 154 | { 155 | /* the transparent pixel on Win32 is always index number 0. So if 156 | we put this routine in this file, we can avoid compiling the 157 | whole of layerutil.c which is where this routine normally comes 158 | from. */ 159 | return 0; 160 | } 161 | 162 | void 163 | __glutAdjustCoords(Window parent, int* x, int* y, int* width, int* height) 164 | { 165 | RECT rect; 166 | 167 | /* adjust the window rectangle because Win32 thinks that the x, y, 168 | width & height are the WHOLE window (including decorations), 169 | whereas GLUT treats the x, y, width & height as only the CLIENT 170 | area of the window. */ 171 | rect.left = *x; rect.top = *y; 172 | rect.right = *x + *width; rect.bottom = *y + *height; 173 | 174 | /* must adjust the coordinates according to the correct style 175 | because depending on the style, there may or may not be 176 | borders. */ 177 | AdjustWindowRect(&rect, WS_CLIPSIBLINGS | WS_CLIPCHILDREN | 178 | (parent ? WS_CHILD : WS_OVERLAPPEDWINDOW), 179 | FALSE); 180 | /* FALSE in the third parameter = window has no menu bar */ 181 | 182 | /* readjust if the x and y are offscreen */ 183 | if(rect.left < 0) { 184 | *x = 0; 185 | } else { 186 | *x = rect.left; 187 | } 188 | 189 | if(rect.top < 0) { 190 | *y = 0; 191 | } else { 192 | *y = rect.top; 193 | } 194 | 195 | *width = rect.right - rect.left; /* adjusted width */ 196 | *height = rect.bottom - rect.top; /* adjusted height */ 197 | } 198 | 199 | -------------------------------------------------------------------------------- /glut/lib/glut/win32_x11.h: -------------------------------------------------------------------------------- 1 | #ifndef __win32_x11_h__ 2 | #define __win32_x11_h__ 3 | 4 | /* Copyright (c) Nate Robins, 1997. */ 5 | /* Copyright (c) Mark Kilgard, 1998, 2001. */ 6 | 7 | /* This program is freely distributable without licensing fees 8 | and is provided without guarantee or warrantee expressed or 9 | implied. This program is -not- in the public domain. */ 10 | 11 | #include 12 | #include 13 | 14 | /* Type definitions (conversions) */ 15 | typedef int Visual; /* Win32 equivalent of X11 type */ 16 | typedef HWND Window; 17 | typedef HPALETTE Colormap; 18 | typedef BOOL Bool; 19 | typedef MSG XEvent; 20 | typedef HDC Display; 21 | typedef HCURSOR Cursor; 22 | 23 | typedef struct { 24 | int num; 25 | PIXELFORMATDESCRIPTOR pfd; 26 | } XVisualInfo; 27 | 28 | typedef int Atom; /* dummies */ 29 | typedef int XDevice; 30 | typedef int Status; 31 | 32 | #define True TRUE /* Win32 equivalents of X11 booleans */ 33 | #define False FALSE 34 | 35 | #define None 0L /* universal null resource or null atom */ 36 | 37 | /* Input Event Masks. Used as event-mask window attribute and as arguments 38 | to Grab requests. Not to be confused with event names. */ 39 | 40 | #define NoEventMask 0L 41 | #define KeyPressMask (1L<<0) 42 | #define KeyReleaseMask (1L<<1) 43 | #define ButtonPressMask (1L<<2) 44 | #define ButtonReleaseMask (1L<<3) 45 | #define EnterWindowMask (1L<<4) 46 | #define LeaveWindowMask (1L<<5) 47 | #define PointerMotionMask (1L<<6) 48 | #define PointerMotionHintMask (1L<<7) 49 | #define Button1MotionMask (1L<<8) 50 | #define Button2MotionMask (1L<<9) 51 | #define Button3MotionMask (1L<<10) 52 | #define Button4MotionMask (1L<<11) 53 | #define Button5MotionMask (1L<<12) 54 | #define ButtonMotionMask (1L<<13) 55 | #define KeymapStateMask (1L<<14) 56 | #define ExposureMask (1L<<15) 57 | #define VisibilityChangeMask (1L<<16) 58 | #define StructureNotifyMask (1L<<17) 59 | #define ResizeRedirectMask (1L<<18) 60 | #define SubstructureNotifyMask (1L<<19) 61 | #define SubstructureRedirectMask (1L<<20) 62 | #define FocusChangeMask (1L<<21) 63 | #define PropertyChangeMask (1L<<22) 64 | #define ColormapChangeMask (1L<<23) 65 | #define OwnerGrabButtonMask (1L<<24) 66 | 67 | /* Key masks. Used as modifiers to GrabButton and GrabKey, results of 68 | QueryPointer, state in various key-, mouse-, and button-related 69 | events. */ 70 | 71 | #define ShiftMask (1<<0) 72 | #define LockMask (1<<1) 73 | #define ControlMask (1<<2) 74 | #define Mod1Mask (1<<3) 75 | #define Mod2Mask (1<<4) 76 | #define Mod3Mask (1<<5) 77 | #define Mod4Mask (1<<6) 78 | #define Mod5Mask (1<<7) 79 | 80 | /* Window classes used by CreateWindow */ 81 | /* Note that CopyFromParent is already defined as 0 above */ 82 | 83 | #define InputOutput 1 84 | #define InputOnly 2 85 | 86 | /* Window attributes for CreateWindow and ChangeWindowAttributes */ 87 | 88 | #define CWBackPixmap (1L<<0) 89 | #define CWBackPixel (1L<<1) 90 | #define CWBorderPixmap (1L<<2) 91 | #define CWBorderPixel (1L<<3) 92 | #define CWBitGravity (1L<<4) 93 | #define CWWinGravity (1L<<5) 94 | #define CWBackingStore (1L<<6) 95 | #define CWBackingPlanes (1L<<7) 96 | #define CWBackingPixel (1L<<8) 97 | #define CWOverrideRedirect (1L<<9) 98 | #define CWSaveUnder (1L<<10) 99 | #define CWEventMask (1L<<11) 100 | #define CWDontPropagate (1L<<12) 101 | #define CWColormap (1L<<13) 102 | #define CWCursor (1L<<14) 103 | 104 | /* ConfigureWindow structure */ 105 | 106 | #define CWX (1<<0) 107 | #define CWY (1<<1) 108 | #define CWWidth (1<<2) 109 | #define CWHeight (1<<3) 110 | #define CWBorderWidth (1<<4) 111 | #define CWSibling (1<<5) 112 | #define CWStackMode (1<<6) 113 | 114 | 115 | /* Used in GetWindowAttributes reply */ 116 | 117 | #define IsUnmapped 0 118 | #define IsUnviewable 1 119 | #define IsViewable 2 120 | 121 | /* Window stacking method (in configureWindow) */ 122 | 123 | #define Above 0 124 | #define Below 1 125 | #define TopIf 2 126 | #define BottomIf 3 127 | #define Opposite 4 128 | 129 | /* For CreateColormap */ 130 | 131 | #define AllocNone 0 /* create map with no entries */ 132 | #define AllocAll 1 /* allocate entire map writeable */ 133 | 134 | 135 | /* Flags used in StoreNamedColor, StoreColors */ 136 | 137 | #define DoRed (1<<0) 138 | #define DoGreen (1<<1) 139 | #define DoBlue (1<<2) 140 | 141 | /* 142 | * Bitmask returned by XParseGeometry(). Each bit tells if the corresponding 143 | * value (x, y, width, height) was found in the parsed string. 144 | */ 145 | #define NoValue 0x0000 146 | #define XValue 0x0001 147 | #define YValue 0x0002 148 | #define WidthValue 0x0004 149 | #define HeightValue 0x0008 150 | #define AllValues 0x000F 151 | #define XNegative 0x0010 152 | #define YNegative 0x0020 153 | 154 | /* flags argument in size hints */ 155 | #define USPosition (1L << 0) /* user specified x, y */ 156 | #define USSize (1L << 1) /* user specified width, height */ 157 | 158 | /* definitions for initial window state */ 159 | #define WithdrawnState 0 /* for windows that are not mapped */ 160 | #define NormalState 1 /* most applications want to start this way */ 161 | #define IconicState 3 /* application wants to start as an icon */ 162 | #define GameModeState 4 /* Win32 GLUT only (not in Xlib!). */ 163 | 164 | /* Type definitions */ 165 | 166 | typedef struct { 167 | unsigned int background_pixmap; /* background pixmap */ 168 | unsigned long background_pixel; /* background pixel */ 169 | unsigned long border_pixel; /* border pixel value */ 170 | long event_mask; /* set of events that should be saved */ 171 | long do_not_propagate_mask; /* set of events that should not propagate */ 172 | Bool override_redirect; /* boolean value for override-redirect */ 173 | Colormap colormap; /* color map to be associated with window */ 174 | } XSetWindowAttributes; 175 | 176 | typedef struct { 177 | unsigned long pixel; 178 | unsigned short red, green, blue; 179 | char flags; /* do_red, do_green, do_blue */ 180 | } XColor; 181 | 182 | typedef struct { 183 | unsigned char *value; /* same as Property routines */ 184 | Atom encoding; /* prop type */ 185 | int format; /* prop data format: 8, 16, or 32 */ 186 | unsigned long nitems; /* number of data items in value */ 187 | } XTextProperty; 188 | 189 | typedef struct { 190 | long flags; /* marks which fields in this structure are defined */ 191 | int x, y; /* obsolete for new window mgrs, but clients */ 192 | int width, height; /* should set so old wm's don't mess up */ 193 | } XSizeHints; 194 | 195 | /* Functions emulated by macros. */ 196 | 197 | #define XFreeColormap(display, colormap) \ 198 | DeleteObject(colormap) 199 | 200 | #define XCreateFontCursor(display, shape) \ 201 | LoadCursor(NULL, shape) 202 | 203 | #define XDefineCursor(display, window, cursor) \ 204 | SetCursor(cursor) 205 | 206 | #define XFlush(display) \ 207 | /* Nothing. */ 208 | 209 | #define DisplayWidth(display, screen) \ 210 | GetSystemMetrics(SM_CXSCREEN) 211 | 212 | #define DisplayHeight(display, screen) \ 213 | GetSystemMetrics(SM_CYSCREEN) 214 | 215 | #define XMapWindow(display, window) \ 216 | ShowWindow(window, SW_SHOWNORMAL) 217 | 218 | #define XUnmapWindow(display, window) \ 219 | ShowWindow(window, SW_HIDE) 220 | 221 | #define XIconifyWindow(display, window, screen) \ 222 | ShowWindow(window, SW_MINIMIZE) 223 | 224 | #define XWithdrawWindow(display, window, screen) \ 225 | ShowWindow(window, SW_HIDE) 226 | 227 | #define XLowerWindow(display, window) \ 228 | SetWindowPos(window, HWND_BOTTOM, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE) 229 | 230 | #define XSetWMName(display, window, tp) \ 231 | SetWindowText(window, (LPCSTR)((tp)->value)) 232 | 233 | /* There really isn't a way to set the icon name separate from the 234 | windows name in Win32, so, just set the windows name. */ 235 | #define XSetWMIconName(display, window, tp) \ 236 | XSetWMName(display, window, tp) 237 | 238 | #define XDestroyWindow(display, window) \ 239 | DestroyWindow(window) 240 | 241 | /* Anything that needs to be freed was allocated with malloc in our 242 | fake X windows library for Win32, so free it with plain old 243 | free(). */ 244 | #define XFree(data) \ 245 | free(data) 246 | 247 | /* Nothing to be done for this...the pointer is always 'ungrabbed' 248 | in Win32. */ 249 | #define XUngrabPointer(display, time) \ 250 | /* Nothing. */ 251 | 252 | /* Function prototypes. */ 253 | 254 | extern XVisualInfo* XGetVisualInfo( 255 | Display* display, 256 | long mask, 257 | XVisualInfo* ttemplate, /* Avoid class with C++ keyword. */ 258 | int*nitems); 259 | 260 | extern Colormap XCreateColormap( 261 | Display* display, 262 | Window root, 263 | Visual* visual, 264 | int alloc); 265 | 266 | extern void XAllocColorCells( 267 | Display* display, 268 | Colormap colormap, 269 | Bool contig, 270 | unsigned long plane_masks_return[], 271 | unsigned int nplanes, 272 | unsigned long pixels_return[], 273 | unsigned int npixels); 274 | 275 | extern void XStoreColor( 276 | Display* display, 277 | Colormap colormap, 278 | XColor* color); 279 | 280 | extern void XSetWindowColormap( 281 | Display* display, 282 | Window window, 283 | Colormap colormap); 284 | 285 | extern Bool XTranslateCoordinates( 286 | Display *display, 287 | Window src, Window dst, 288 | int src_x, int src_y, 289 | int* dest_x_return, int* dest_y_return, 290 | Window* child_return); 291 | 292 | extern Status XGetGeometry( 293 | Display* display, 294 | Window window, 295 | Window* root_return, 296 | int* x_return, int* y_return, 297 | unsigned int* width_return, unsigned int* height_return, 298 | unsigned int *border_width_return, 299 | unsigned int* depth_return); 300 | 301 | extern int DisplayWidthMM( 302 | Display* display, 303 | int screen); 304 | 305 | extern int DisplayHeightMM( 306 | Display* display, 307 | int screen); 308 | 309 | extern void XWarpPointer( 310 | Display* display, 311 | Window src, Window dst, 312 | int src_x, int src_y, 313 | int src_width, int src_height, 314 | int dst_x, int dst_y); 315 | 316 | extern int XParseGeometry( 317 | char* string, 318 | int* x, int* y, 319 | unsigned int* width, unsigned int* height); 320 | 321 | extern int XPending( 322 | Display* display); 323 | 324 | #endif /* __win32_x11_h__ */ 325 | -------------------------------------------------------------------------------- /interop/GNUmakefile: -------------------------------------------------------------------------------- 1 | 2 | TARGET = interop 3 | 4 | UNAME := $(shell uname) 5 | 6 | CSRCS = \ 7 | ../glew/src/glew.c \ 8 | $(NULL) 9 | CPPSRCS = $(TARGET:=.cpp) \ 10 | $(NULL) 11 | OBJS = $(CSRCS:.c=.o) $(CPPSRCS:.cpp=.o) 12 | 13 | CC = gcc 14 | CXX = g++ 15 | CFLAGS += -Wall 16 | ifdef RELEASE 17 | CFLAGS += -O2 18 | else 19 | CFLAGS += -g 20 | endif 21 | CFLAGS += -I../common 22 | CFLAGS += -I../glew/include 23 | 24 | ifeq ($(UNAME), Darwin) 25 | CLINKFLAGS += -framework OpenGL -framework GLUT 26 | else 27 | GLUT_DIR := ../glut/lib/glut 28 | GLUT_LIB := $(GLUT_DIR)/libglut.a 29 | ifeq ($(findstring CYGWIN, $(UNAME)), CYGWIN) 30 | CFLAGS += -D_WIN32 -DGLUT_DISABLE_ATEXIT_HACK -DGLEW_STATIC 31 | # Cg Toolkit includes 32 | CFLAGS += -I"C:\Program Files\NVIDIA Corporation\Cg\include" 33 | CLINKFLAGS += -lglut32 -lglu32 -lopengl32 34 | EXE = .exe 35 | else 36 | CLINKFLAGS += -L$(GLUT_DIR) 37 | CLINKFLAGS += -L/usr/X11R6/lib64 -L/usr/X11R6/lib 38 | CLINKFLAGS += -lglut -lGLU -lGL -lXi -lXmu -lX11 -lm -lpthread 39 | endif 40 | endif 41 | 42 | CXXFLAGS=$(CFLAGS) 43 | 44 | BINARY := $(TARGET:=$(EXE)) 45 | 46 | all: $(BINARY) 47 | 48 | run: $(TARGET)$(EXE) 49 | -./$(TARGET)$(EXE) 50 | 51 | release: 52 | $(MAKE) RELEASE=1 53 | 54 | $(BINARY) : $(GLUT_LIB) $(OBJS) 55 | $(CXX) $(CFLAGS) -o $@ $(OBJS) $(CLINKFLAGS) 56 | 57 | clean: 58 | $(RM) $(BINARY) $(OBJS) 59 | 60 | echo: 61 | echo $(OBJS) 62 | 63 | RMDIR = -rm -rf 64 | clobber: clean 65 | $(RM) *.bak *.o *~ 66 | $(RMDIR) Release/ Debug/ 67 | 68 | $(GLUT_LIB): FORCEglut 69 | $(MAKE) -C '$(GLUT_DIR)' -f GNUmakefile 70 | 71 | .PHONY: clean clobber release run FORCEglut 72 | -------------------------------------------------------------------------------- /interop/ReadMe.txt: -------------------------------------------------------------------------------- 1 | 2 | This example demonstrates sandboxed async renderer process generating 3 | sharing frames for master process via OpenGL interop. 4 | 5 | This example uses WGL_NV_DX_interop2. 6 | 7 | When you run the example, you'll see a first window that reports: 8 | 9 | "Waiting for the renderer process to start..." 10 | 11 | After a brief pause, the "interop master (VR app)" window (LEFT) and 12 | "interop renderer (VR webview sandbox)" window (RIGHT) will both appear 13 | and begin animating. 14 | 15 | The LEFT window should refresh at a constant 60 frames per second 16 | while showing a repeated texturing of the most recent rendered image 17 | in the RIGHT window. The textured image "rocks back and forth" to make 18 | it clear that the LEFT window is constantly rendering. 19 | 20 | The RIGHT window renders uses a timer to render once per second 21 | (initially), but you can increase/decrease its timed rendering rate with 22 | the +/- keys. 23 | 24 | If you "hold down" the minus key, you can watch the rendering rate of the RIGHT 25 | window go to 10 milliseconds and the wireframe sphere show will rotate 26 | very fast. 27 | 28 | The text drawn in the RIGHT window (and shown mirrored in the LEFT window) 29 | is drawn with NV_path_rendering. 30 | 31 | - Mark Kilgard 32 | January 12, 2017 33 | -------------------------------------------------------------------------------- /interop/interop_2015.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Debug 10 | x64 11 | 12 | 13 | Release 14 | Win32 15 | 16 | 17 | Release 18 | x64 19 | 20 | 21 | 22 | interop 23 | {FB05FB27-FD69-4269-8568-F34875B69787} 24 | interop 25 | Win32Proj 26 | 27 | 28 | 29 | Application 30 | Unicode 31 | true 32 | v140 33 | 34 | 35 | Application 36 | Unicode 37 | v140 38 | 39 | 40 | Application 41 | Unicode 42 | true 43 | v140 44 | 45 | 46 | Application 47 | Unicode 48 | v140 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | <_ProjectFileVersion>10.0.30319.1 68 | $(SolutionDir)$(Platform)_2015\$(Configuration)\ 69 | $(Platform)_2015\$(Configuration)\ 70 | true 71 | $(SolutionDir)$(Platform)_2015\$(Configuration)\ 72 | $(Platform)_2015\$(Configuration)\ 73 | true 74 | $(SolutionDir)$(Platform)_2015\$(Configuration)\ 75 | $(Platform)_2015\$(Configuration)\ 76 | false 77 | $(SolutionDir)$(Platform)_2015\$(Configuration)\ 78 | $(Platform)_2015\$(Configuration)\ 79 | false 80 | 81 | 82 | 83 | Disabled 84 | ..\glew\include;..\glut\include;SurfaceQueueLib 85 | QUEUE_USE_CONFORMANT_NEW;WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;GLEW_STATIC;GLUT_STATIC_LIB;%(PreprocessorDefinitions) 86 | true 87 | EnableFastChecks 88 | MultiThreadedDebug 89 | 90 | 91 | Level3 92 | ProgramDatabase 93 | 94 | 95 | $(CG_LIB_PATH);c:\Program Files\NVIDIA Corporation\Cg\lib;%(AdditionalLibraryDirectories) 96 | true 97 | Console 98 | MachineX86 99 | 100 | 101 | 102 | 103 | X64 104 | 105 | 106 | Disabled 107 | ..\glew\include;..\glut\include;SurfaceQueueLib 108 | QUEUE_USE_CONFORMANT_NEW;WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;GLEW_STATIC;GLUT_STATIC_LIB;%(PreprocessorDefinitions) 109 | true 110 | EnableFastChecks 111 | MultiThreadedDebug 112 | 113 | 114 | Level3 115 | ProgramDatabase 116 | 117 | 118 | $(CG_LIB64_PATH);c:\Program Files\NVIDIA Corporation\Cg\lib.x64;%(AdditionalLibraryDirectories) 119 | true 120 | Console 121 | MachineX64 122 | 123 | 124 | 125 | 126 | MaxSpeed 127 | true 128 | ..\glew\include;..\glut\include;SurfaceQueueLib 129 | QUEUE_USE_CONFORMANT_NEW;WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;GLEW_STATIC;GLUT_STATIC_LIB;%(PreprocessorDefinitions) 130 | MultiThreaded 131 | true 132 | 133 | 134 | Level3 135 | ProgramDatabase 136 | 137 | 138 | $(CG_LIB_PATH);c:\Program Files\NVIDIA Corporation\Cg\lib;%(AdditionalLibraryDirectories) 139 | true 140 | Console 141 | true 142 | true 143 | MachineX86 144 | 145 | 146 | 147 | 148 | X64 149 | 150 | 151 | MaxSpeed 152 | true 153 | ..\glew\include;..\glut\include;SurfaceQueueLib 154 | QUEUE_USE_CONFORMANT_NEW;WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;GLEW_STATIC;GLUT_STATIC_LIB;%(PreprocessorDefinitions) 155 | MultiThreaded 156 | true 157 | 158 | 159 | Level3 160 | ProgramDatabase 161 | 162 | 163 | $(CG_LIB64_PATH);c:\Program Files\NVIDIA Corporation\Cg\lib.x64;%(AdditionalLibraryDirectories) 164 | true 165 | Console 166 | true 167 | true 168 | MachineX64 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | {05ffade4-2b93-c899-00ca-aa717ca7a077} 180 | 181 | 182 | {216878f4-f20b-4aa3-ba83-e6d37e9a87c6} 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | -------------------------------------------------------------------------------- /interop/interop_2015.vcxproj.user: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -sRGB 5 | WindowsLocalDebugger 6 | 7 | 8 | 9 | 10 | WindowsLocalDebugger 11 | 12 | 13 | 14 | 15 | WindowsLocalDebugger 16 | 17 | 18 | 19 | 20 | WindowsLocalDebugger 21 | 22 | -------------------------------------------------------------------------------- /interop/request_vsync.c: -------------------------------------------------------------------------------- 1 | 2 | /* request_vsync.h - request buffer swap synchroization with vertical sync */ 3 | 4 | /* NVIDIA Corporation, Copyright 2007-2010 */ 5 | 6 | #if defined(__APPLE__) 7 | # include 8 | #elif defined(_WIN32) 9 | # include 10 | # ifndef WGL_EXT_swap_control 11 | typedef int (APIENTRY * PFNWGLSWAPINTERVALEXTPROC)(int); 12 | # endif 13 | #else 14 | # include 15 | # ifndef GLX_SGI_swap_control 16 | typedef int ( * PFNGLXSWAPINTERVALSGIPROC) (int interval); 17 | # endif 18 | #endif 19 | 20 | /* enableSync true means synchronize buffer swaps to monitor refresh; 21 | false means do NOT synchornize. */ 22 | void requestSynchornizedSwapBuffers(int enableSync) 23 | { 24 | #if defined(__APPLE__) 25 | #ifdef GL_VERSION_1_2 26 | const GLint sync = enableSync; 27 | #else 28 | const long sync = enableSync; 29 | #endif 30 | CGLSetParameter(CGLGetCurrentContext(), kCGLCPSwapInterval, &sync); 31 | #elif defined(_WIN32) 32 | PFNWGLSWAPINTERVALEXTPROC wglSwapIntervalEXT = 33 | (PFNWGLSWAPINTERVALEXTPROC) wglGetProcAddress("wglSwapIntervalEXT"); 34 | 35 | if (wglSwapIntervalEXT) { 36 | wglSwapIntervalEXT(enableSync); 37 | } 38 | #else 39 | PFNGLXSWAPINTERVALSGIPROC glXSwapIntervalSGI = 40 | (PFNGLXSWAPINTERVALSGIPROC) glXGetProcAddressARB((const GLubyte*)"glXSwapIntervalSGI"); 41 | if (glXSwapIntervalSGI) { 42 | glXSwapIntervalSGI(enableSync); 43 | } 44 | #endif 45 | } 46 | 47 | -------------------------------------------------------------------------------- /interop/request_vsync.h: -------------------------------------------------------------------------------- 1 | 2 | /* request_vsync.h - request buffer swap synchroization with vertical sync */ 3 | 4 | /* NVIDIA Corporation, Copyright 2007-2010 */ 5 | 6 | /* enableSync true means synchronize buffer swaps to monitor refresh; 7 | false means do NOT synchornize. */ 8 | 9 | #ifdef __cplusplus 10 | extern "C" { 11 | #endif 12 | 13 | extern void requestSynchornizedSwapBuffers(int enableSync); 14 | 15 | #ifdef __cplusplus 16 | } 17 | #endif 18 | 19 | -------------------------------------------------------------------------------- /interop/sRGB_math.c: -------------------------------------------------------------------------------- 1 | 2 | /* sRGB.c - sRGB color space conversion utilities */ 3 | 4 | /* Copyright (c) NVIDIA Corporation. All rights reserved. */ 5 | 6 | #include 7 | 8 | #include "sRGB_math.h" 9 | 10 | #define FLOAT_TO_UB(_f) \ 11 | (unsigned char)(floorf((_f) * 255.0f + 0.5f)) 12 | 13 | float convertLinearColorComponentToSRGBf(const float cl) 14 | { 15 | float csf; 16 | 17 | if (cl > 1.0f) { 18 | csf = 1.0f; 19 | } else if (cl > 0.0f) { 20 | if (cl < 0.0031308f) { 21 | csf = 12.92f * cl; 22 | } else { 23 | csf = 1.055f * (float)pow(cl, 0.41666f) - 0.055f; 24 | } 25 | } else { 26 | /* IEEE NaN should get here since comparisons with NaN always 27 | fail. */ 28 | csf = 0.0f; 29 | } 30 | return csf; 31 | } 32 | 33 | unsigned char convertLinearColorComponentToSRGBub(const float cl) 34 | { 35 | unsigned char cs; 36 | 37 | if (cl > 1.0f) { 38 | cs = 255; 39 | } else if (cl > 0.0f) { 40 | float csf; 41 | 42 | if (cl < 0.0031308f) { 43 | csf = 12.92f * cl; 44 | } else { 45 | csf = 1.055f * (float)pow(cl, 0.41666f) - 0.055f; 46 | } 47 | cs = FLOAT_TO_UB(csf); 48 | } else { 49 | /* IEEE NaN should get here since comparisons with NaN always 50 | fail. */ 51 | cs = 0; 52 | } 53 | return cs; 54 | } 55 | 56 | float convertSRGBColorComponentToLinearf(const float cs) 57 | { 58 | float cl; 59 | 60 | if (cs <= 0.04045f) { 61 | cl = cs / 12.92f; 62 | } else { 63 | cl = (float)pow((cs + 0.055f)/1.055f, 2.4f); 64 | } 65 | return cl; 66 | } 67 | -------------------------------------------------------------------------------- /interop/sRGB_math.h: -------------------------------------------------------------------------------- 1 | 2 | // sRGB.c - sRGB color space conversion utilities 3 | 4 | #ifdef __cplusplus 5 | extern "C" { 6 | #endif 7 | 8 | extern float convertLinearColorComponentToSRGBf(const float cl); 9 | extern unsigned char convertLinearColorComponentToSRGBub(const float cl); 10 | extern float convertSRGBColorComponentToLinearf(const float cs); 11 | 12 | #ifdef __cplusplus 13 | } 14 | #endif 15 | -------------------------------------------------------------------------------- /interop/showfps.h: -------------------------------------------------------------------------------- 1 | #ifndef SHOWFPS_H 2 | #define SHOWFPS_H 3 | 4 | /* showfps.h - OpenGL code for rendering frames per second */ 5 | 6 | /* Call handleFPS in your GLUT display callback every frame. */ 7 | 8 | #ifdef __cplusplus 9 | extern "C" { 10 | #endif 11 | 12 | #define MAX_FPS_QUADS (12*4) 13 | 14 | typedef enum { 15 | FPS_USAGE_TEXTURE, 16 | FPS_USAGE_BITMAP 17 | } FPSusage; 18 | 19 | typedef enum { 20 | FPS_LOWER_RIGHT, 21 | FPS_LOWER_LEFT, 22 | FPS_UPPER_RIGHT, 23 | FPS_UPPER_LEFT 24 | } FPSorigin; 25 | 26 | typedef struct _FPScontext { 27 | FPSusage usage; 28 | int width, height; 29 | GLuint fps_text_texture; 30 | double last_fpsRate; 31 | float last_scale; 32 | GLint count; 33 | GLfloat varray[4*MAX_FPS_QUADS]; 34 | } FPScontext; 35 | 36 | extern void initFPScontext(FPScontext *, FPSusage); 37 | extern void reshapeFPScontext(FPScontext *ctx, int w, int h); 38 | extern void releaseFPScontext(FPScontext *ctx); 39 | 40 | extern double just_handleFPS(void); 41 | extern double handleFPS(FPScontext *); 42 | extern void toggleFPSunits(void); 43 | extern void reportFPSinMS(void); 44 | extern void reportFPSinFPS(void); 45 | extern void toggleFPS(); 46 | extern void enableFPS(); 47 | extern void disableFPS(); 48 | extern void colorFPS(float r, float g, float b); 49 | extern void scaleFPS(float new_scale); 50 | extern double getElapsedTime(); 51 | extern void invalidateFPS(); 52 | extern void setFPSorigin(FPSorigin); 53 | 54 | #ifdef __cplusplus 55 | } 56 | #endif 57 | 58 | #endif /* SHOWFPS_H */ 59 | -------------------------------------------------------------------------------- /interop_2015.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 14 4 | VisualStudioVersion = 14.0.25420.1 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "glewlib", "glew\glewlib_2015.vcxproj", "{05FFADE4-2B93-C899-00CA-AA717CA7A077}" 7 | EndProject 8 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "glutstatic", "glut\glut_2015.vcxproj", "{216878F4-F20B-4AA3-BA83-E6D37E9A87C6}" 9 | EndProject 10 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "interop", "interop\interop_2015.vcxproj", "{FB05FB27-FD69-4269-8568-F34875B69787}" 11 | EndProject 12 | Global 13 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 14 | Debug|Win32 = Debug|Win32 15 | Debug|x64 = Debug|x64 16 | Release|Win32 = Release|Win32 17 | Release|x64 = Release|x64 18 | EndGlobalSection 19 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 20 | {05FFADE4-2B93-C899-00CA-AA717CA7A077}.Debug|Win32.ActiveCfg = Debug|Win32 21 | {05FFADE4-2B93-C899-00CA-AA717CA7A077}.Debug|Win32.Build.0 = Debug|Win32 22 | {05FFADE4-2B93-C899-00CA-AA717CA7A077}.Debug|x64.ActiveCfg = Debug|x64 23 | {05FFADE4-2B93-C899-00CA-AA717CA7A077}.Debug|x64.Build.0 = Debug|x64 24 | {05FFADE4-2B93-C899-00CA-AA717CA7A077}.Release|Win32.ActiveCfg = Release|Win32 25 | {05FFADE4-2B93-C899-00CA-AA717CA7A077}.Release|Win32.Build.0 = Release|Win32 26 | {05FFADE4-2B93-C899-00CA-AA717CA7A077}.Release|x64.ActiveCfg = Release|x64 27 | {05FFADE4-2B93-C899-00CA-AA717CA7A077}.Release|x64.Build.0 = Release|x64 28 | {216878F4-F20B-4AA3-BA83-E6D37E9A87C6}.Debug|Win32.ActiveCfg = Debug|Win32 29 | {216878F4-F20B-4AA3-BA83-E6D37E9A87C6}.Debug|Win32.Build.0 = Debug|Win32 30 | {216878F4-F20B-4AA3-BA83-E6D37E9A87C6}.Debug|Win32.Deploy.0 = Debug|Win32 31 | {216878F4-F20B-4AA3-BA83-E6D37E9A87C6}.Debug|x64.ActiveCfg = Debug|x64 32 | {216878F4-F20B-4AA3-BA83-E6D37E9A87C6}.Debug|x64.Build.0 = Debug|x64 33 | {216878F4-F20B-4AA3-BA83-E6D37E9A87C6}.Debug|x64.Deploy.0 = Debug|x64 34 | {216878F4-F20B-4AA3-BA83-E6D37E9A87C6}.Release|Win32.ActiveCfg = Release|Win32 35 | {216878F4-F20B-4AA3-BA83-E6D37E9A87C6}.Release|Win32.Build.0 = Release|Win32 36 | {216878F4-F20B-4AA3-BA83-E6D37E9A87C6}.Release|Win32.Deploy.0 = Release|Win32 37 | {216878F4-F20B-4AA3-BA83-E6D37E9A87C6}.Release|x64.ActiveCfg = Release|x64 38 | {216878F4-F20B-4AA3-BA83-E6D37E9A87C6}.Release|x64.Build.0 = Release|x64 39 | {216878F4-F20B-4AA3-BA83-E6D37E9A87C6}.Release|x64.Deploy.0 = Release|x64 40 | {FB05FB27-FD69-4269-8568-F34875B69787}.Debug|Win32.ActiveCfg = Debug|Win32 41 | {FB05FB27-FD69-4269-8568-F34875B69787}.Debug|Win32.Build.0 = Debug|Win32 42 | {FB05FB27-FD69-4269-8568-F34875B69787}.Debug|x64.ActiveCfg = Debug|x64 43 | {FB05FB27-FD69-4269-8568-F34875B69787}.Debug|x64.Build.0 = Debug|x64 44 | {FB05FB27-FD69-4269-8568-F34875B69787}.Release|Win32.ActiveCfg = Release|Win32 45 | {FB05FB27-FD69-4269-8568-F34875B69787}.Release|Win32.Build.0 = Release|Win32 46 | {FB05FB27-FD69-4269-8568-F34875B69787}.Release|x64.ActiveCfg = Release|x64 47 | {FB05FB27-FD69-4269-8568-F34875B69787}.Release|x64.Build.0 = Release|x64 48 | EndGlobalSection 49 | GlobalSection(SolutionProperties) = preSolution 50 | HideSolutionNode = FALSE 51 | EndGlobalSection 52 | EndGlobal 53 | --------------------------------------------------------------------------------