From 69ba06b61f904bd8a0228adeacbd9dd39685d1f8 Mon Sep 17 00:00:00 2001 From: Luc Verhaegen Date: Sun, 7 Mar 2010 03:30:37 +0100 Subject: Import ubuntu's 7.4-0ubuntu3 mesa version. Found on jaunty 9/4. --- bin/confdiff.sh | 0 bin/installmesa | 0 configs/.gitignore | 2 - debian/changelog | 1802 ++++++++++++++ debian/compat | 1 + debian/control | 370 +++ debian/copyright | 193 ++ debian/glxdemo.1 | 15 + debian/glxgears.1 | 29 + debian/glxheads.1 | 30 + debian/glxinfo.1 | 41 + debian/libgl1-mesa-dev.install | 2 + debian/libgl1-mesa-dri-i686.install | 1 + debian/libgl1-mesa-dri.install | 1 + debian/libgl1-mesa-glx-i686.install | 1 + debian/libgl1-mesa-glx.install | 1 + debian/libgl1-mesa-glx.shlibs | 1 + debian/libgl1-mesa-swx11-dev.install | 2 + debian/libgl1-mesa-swx11-i686.install | 1 + debian/libgl1-mesa-swx11-i686.shlibs | 1 + debian/libgl1-mesa-swx11.install | 1 + debian/libgl1-mesa-swx11.shlibs | 1 + debian/libglu1-mesa-dev.install | 4 + debian/libglu1-mesa.install | 1 + debian/libglu1-mesa.shlibs | 1 + debian/libglw1-mesa-dev.install | 3 + debian/libglw1-mesa.install | 1 + debian/libglw1-mesa.shlibs | 1 + debian/libosmesa6-dev.install | 7 + debian/libosmesa6.install | 3 + debian/libosmesa6.shlibs | 3 + debian/mesa-common-dev.docs | 8 + debian/mesa-common-dev.install | 5 + debian/mesa-utils.install | 4 + debian/mesa-utils.manpages | 4 + .../patches/02_use-ieee-fp-on-s390-and-m68k.patch | 19 + debian/patches/03_optional-progs-and-install.patch | 55 + debian/patches/04_osmesa_version.diff | 22 + debian/patches/101_ubuntu_hidden_glname.patch | 12 + debian/patches/102_dont_vblank.diff | 14 + debian/patches/103_bump_965_texture_limit.diff | 33 + debian/patches/104_fix_dri2_ext_tfp.diff | 337 +++ debian/patches/105_glXWaitX_segfaults.patch | 11 + debian/patches/series | 8 + debian/rules | 254 ++ debian/scripts/choose-configs | 58 + debian/watch | 3 + docs/OLD/MESA_packed_depth_stencil.spec | 230 -- docs/OLD/MESA_program_debug.spec | 356 --- docs/OLD/MESA_sprite_point.spec | 190 -- docs/OLD/MESA_trace.spec | 359 --- docs/gears.png | Bin 1608 -> 0 bytes doxygen/.gitignore | 15 - doxygen/Makefile | 33 - doxygen/README | 10 - doxygen/common.doxy | 1153 --------- doxygen/core_subset.doxy | 226 -- doxygen/doxy.bat | 19 - doxygen/glapi.doxy | 49 - doxygen/header.html | 17 - doxygen/header_subset.html | 11 - doxygen/main.doxy | 50 - doxygen/math.doxy | 49 - doxygen/math_subset.doxy | 177 -- doxygen/miniglx.doxy | 179 -- doxygen/radeon_subset.doxy | 203 -- doxygen/shader.doxy | 49 - doxygen/swrast.doxy | 48 - doxygen/swrast_setup.doxy | 49 - doxygen/tnl.doxy | 50 - doxygen/tnl_dd.doxy | 49 - doxygen/vbo.doxy | 50 - include/GLES/egl.h | 320 --- include/GLES/egltypes.h | 45 - progs/beos/.gitignore | 3 - progs/demos/.gitignore | 63 - progs/demos/Windows/all.dsp | 101 - progs/demos/Windows/bounce.dsp | 112 - progs/demos/Windows/clearspd.dsp | 112 - progs/demos/Windows/cubemap.dsp | 112 - progs/demos/Windows/demos.dsw | 782 ------ progs/demos/Windows/drawpix.dsp | 112 - progs/demos/Windows/fire.dsp | 112 - progs/demos/Windows/gears.dsp | 112 - progs/demos/Windows/geartrain.dsp | 112 - progs/demos/Windows/glinfo.dsp | 112 - progs/demos/Windows/gloss.dsp | 112 - progs/demos/Windows/gltestperf.dsp | 112 - progs/demos/Windows/glutfx.dsp | 112 - progs/demos/Windows/ipers.dsp | 112 - progs/demos/Windows/isosurf.dsp | 112 - progs/demos/Windows/loadbias.dsp | 112 - progs/demos/Windows/morph3d.dsp | 112 - progs/demos/Windows/multiarb.dsp | 112 - progs/demos/Windows/occlude.dsp | 112 - progs/demos/Windows/osdemo.dsp | 112 - progs/demos/Windows/paltex.dsp | 112 - progs/demos/Windows/pixeltex.dsp | 112 - progs/demos/Windows/pointblast.dsp | 112 - progs/demos/Windows/rain.dsp | 112 - progs/demos/Windows/ray.dsp | 112 - progs/demos/Windows/readpix.dsp | 112 - progs/demos/Windows/reflect.dsp | 112 - progs/demos/Windows/renormal.dsp | 112 - progs/demos/Windows/shadowtex.dsp | 112 - progs/demos/Windows/spectex.dsp | 112 - progs/demos/Windows/spriteblast.dsp | 112 - progs/demos/Windows/stex3d.dsp | 112 - progs/demos/Windows/teapot.dsp | 112 - progs/demos/Windows/terrain.dsp | 112 - progs/demos/Windows/tessdemo.dsp | 112 - progs/demos/Windows/texcyl.dsp | 112 - progs/demos/Windows/texdown.dsp | 112 - progs/demos/Windows/texenv.dsp | 112 - progs/demos/Windows/texobj.dsp | 112 - progs/demos/Windows/trispd.dsp | 112 - progs/demos/Windows/tunnel.dsp | 112 - progs/demos/Windows/tunnel2.dsp | 112 - progs/demos/Windows/winpos.dsp | 112 - progs/demos/extfuncs.h | 162 ++ progs/demos/readtex.c | 454 ++++ progs/demos/readtex.h | 26 + progs/demos/showbuffer.c | 198 ++ progs/demos/showbuffer.h | 36 + progs/demos/trackball.c | 338 +++ progs/demos/trackball.h | 84 + progs/directfb/.gitignore | 4 - progs/directfb/Makefile | 38 - progs/directfb/df_gears.c | 480 ---- progs/directfb/df_morph3d.c | 1013 -------- progs/directfb/df_reflect.c | 489 ---- progs/directfb/multi_window.c | 240 -- progs/egl/.gitignore | 5 - progs/egl/Makefile | 65 - progs/egl/demo1.c | 145 -- progs/egl/demo2.c | 190 -- progs/egl/demo3.c | 636 ----- progs/egl/eglgears.c | 475 ---- progs/egl/eglinfo.c | 166 -- progs/fbdev/.gitignore | 1 - progs/fp/.gitignore | 42 - progs/fp/Makefile | 128 - progs/fp/point-position.c | 119 - progs/fp/tri-abs.c | 107 - progs/fp/tri-add.c | 110 - progs/fp/tri-cmp.c | 110 - progs/fp/tri-cos.c | 113 - progs/fp/tri-depth.c | 111 - progs/fp/tri-depth2.c | 116 - progs/fp/tri-depthwrite.c | 107 - progs/fp/tri-depthwrite2.c | 107 - progs/fp/tri-dp3.c | 109 - progs/fp/tri-dp4.c | 109 - progs/fp/tri-dph.c | 109 - progs/fp/tri-dst.c | 109 - progs/fp/tri-ex2.c | 110 - progs/fp/tri-flr.c | 110 - progs/fp/tri-fp.c | 109 - progs/fp/tri-frc.c | 111 - progs/fp/tri-inv.c | 109 - progs/fp/tri-kil.c | 111 - progs/fp/tri-lg2.c | 110 - progs/fp/tri-lit.c | 111 - progs/fp/tri-lrp.c | 109 - progs/fp/tri-mad.c | 109 - progs/fp/tri-max.c | 109 - progs/fp/tri-min.c | 109 - progs/fp/tri-mov.c | 102 - progs/fp/tri-mul.c | 109 - progs/fp/tri-param.c | 114 - progs/fp/tri-position.c | 109 - progs/fp/tri-pow.c | 109 - progs/fp/tri-rcp.c | 110 - progs/fp/tri-rsq.c | 110 - progs/fp/tri-scs.c | 111 - progs/fp/tri-sge.c | 109 - progs/fp/tri-sge2.c | 114 - progs/fp/tri-sin.c | 114 - progs/fp/tri-slt.c | 109 - progs/fp/tri-sub.c | 109 - progs/fp/tri-swz.c | 109 - progs/fp/tri-swz2.c | 109 - progs/fp/tri-tex.c | 130 - progs/fp/tri-xpd.c | 108 - progs/glsl/.gitignore | 18 - progs/glsl/readtex.c | 454 ++++ progs/glsl/readtex.h | 26 + progs/glsl/shaderutil.c | 168 ++ progs/miniglx/.gitignore | 6 - progs/miniglx/Makefile | 60 - progs/miniglx/glfbdevtest.c | 477 ---- progs/miniglx/manytex.c | 381 --- progs/miniglx/miniglxsample.c | 128 - progs/miniglx/miniglxtest.c | 272 --- progs/miniglx/sample_server.c | 111 - progs/miniglx/sample_server2.c | 228 -- progs/miniglx/texline.c | 267 -- progs/osdemos/.gitignore | 8 - progs/redbook/.gitignore | 64 - progs/redbook/Windows/redbook.dsw | 29 - progs/redbook/Windows/teapots.dsp | 112 - progs/samples/.gitignore | 47 - progs/samples/readtex.c | 454 ++++ progs/slang/.gitignore | 3 - progs/slang/Makefile | 57 - progs/slang/README | 7 - progs/slang/cltest.c | 253 -- progs/slang/cltest.txt | 1615 ------------ progs/slang/framework.c | 145 -- progs/slang/framework.h | 82 - progs/slang/sotest.c | 439 ---- progs/slang/vstest.c | 340 --- progs/slang/vstest.txt | 68 - progs/slang/windows/vc60/cltest.dsp | 94 - progs/slang/windows/vc60/framework.dsp | 92 - progs/slang/windows/vc60/slang.dsw | 74 - progs/slang/windows/vc60/sotest.dsp | 90 - progs/slang/windows/vc60/vstest.dsp | 93 - progs/tests/.gitignore | 81 - progs/tests/Makefile | 201 -- progs/tests/Makefile.win | 43 - progs/tests/afsmultiarb.c | 469 ---- progs/tests/antialias.c | 236 -- progs/tests/api_speed.c | 146 -- progs/tests/api_speed.py | 143 -- progs/tests/arbfpspec.c | 192 -- progs/tests/arbfptest1.c | 210 -- progs/tests/arbfptexture.c | 153 -- progs/tests/arbfptrig.c | 156 -- progs/tests/arbnpot-mipmap.c | 184 -- progs/tests/arbnpot.c | 197 -- progs/tests/arbvptest1.c | 164 -- progs/tests/arbvptest3.c | 127 - progs/tests/arbvptorus.c | 186 -- progs/tests/arbvpwarpmesh.c | 246 -- progs/tests/arraytexture.c | 337 --- progs/tests/auxbuffer.c | 499 ---- progs/tests/blendminmax.c | 209 -- progs/tests/blendsquare.c | 178 -- progs/tests/blendxor.c | 196 -- progs/tests/bufferobj.c | 371 --- progs/tests/bug_3050.c | 162 -- progs/tests/bug_3101.c | 128 - progs/tests/bug_3195.c | 275 --- progs/tests/copypixrate.c | 259 -- progs/tests/crossbar.c | 235 -- progs/tests/cva.c | 159 -- progs/tests/debugger.c | 733 ------ progs/tests/descrip.mms | 84 - progs/tests/dinoshade.c | 910 ------- progs/tests/drawbuffers.c | 303 --- progs/tests/exactrast.c | 200 -- progs/tests/ext422square.c | 258 -- progs/tests/fbotest1.c | 206 -- progs/tests/fbotest2.c | 202 -- progs/tests/fbotexture.c | 451 ---- progs/tests/floattex.c | 239 -- progs/tests/fog.c | 199 -- progs/tests/fogcoord.c | 102 - progs/tests/fptest1.c | 225 -- progs/tests/fptexture.c | 151 -- progs/tests/getprocaddress.c | 556 ----- progs/tests/getprocaddress.py | 92 - progs/tests/interleave.c | 406 --- progs/tests/invert.c | 195 -- progs/tests/jkrahntest.c | 180 -- progs/tests/lineclip.c | 175 -- progs/tests/manytex.c | 381 --- progs/tests/minmag.c | 198 -- progs/tests/mipmap_limits.c | 270 -- progs/tests/multipal.c | 372 --- progs/tests/multitexarray.c | 238 -- progs/tests/multiwindow.c | 167 -- progs/tests/no_s3tc.c | 97 - progs/tests/packedpixels.c | 342 --- progs/tests/pbo.c | 296 --- progs/tests/prog_parameter.c | 285 --- progs/tests/projtex.c | 1028 -------- progs/tests/random.c | 457 ---- progs/tests/readrate.c | 285 --- progs/tests/rubberband.c | 245 -- progs/tests/seccolor.c | 145 -- progs/tests/shader_api.c | 337 --- progs/tests/sharedtex.c | 439 ---- progs/tests/stencil_twoside.c | 299 --- progs/tests/stencil_wrap.c | 257 -- progs/tests/stencilwrap.c | 281 --- progs/tests/subtexrate.c | 350 --- progs/tests/tex1d.c | 139 -- progs/tests/texcmp.c | 414 ---- progs/tests/texcompress2.c | 273 --- progs/tests/texfilt.c | 398 --- progs/tests/texgenmix.c | 640 ----- progs/tests/texline.c | 278 --- progs/tests/texobjshare.c | 219 -- progs/tests/texrect.c | 359 --- progs/tests/texwrap.c | 303 --- progs/tests/unfilledclip.c | 205 -- progs/tests/vao-01.c | 177 -- progs/tests/vao-02.c | 205 -- progs/tests/vparray.c | 294 --- progs/tests/vpeval.c | 231 -- progs/tests/vptest1.c | 170 -- progs/tests/vptest2.c | 151 -- progs/tests/vptest3.c | 120 - progs/tests/vptorus.c | 174 -- progs/tests/vpwarpmesh.c | 236 -- progs/tests/yuvrect.c | 193 -- progs/tests/yuvsquare.c | 232 -- progs/tests/zreaddraw.c | 116 - progs/tools/trace/.gitignore | 1 - progs/tools/trace/Makefile | 30 - progs/tools/trace/README | 23 - progs/tools/trace/gltrace | 82 - progs/tools/trace/gltrace.py | 189 -- progs/tools/trace/gltrace_support.cc | 193 -- progs/tools/trace/gltrace_support.h | 65 - progs/trivial/.gitignore | 65 - progs/trivial/Makefile | 145 -- progs/trivial/clear.c | 126 - progs/trivial/dlist-dangling.c | 149 -- progs/trivial/dlist-degenerate.c | 153 -- progs/trivial/dlist-edgeflag-dangling.c | 154 -- progs/trivial/dlist-edgeflag.c | 158 -- progs/trivial/drawarrays.c | 127 - progs/trivial/drawelements.c | 120 - progs/trivial/drawrange.c | 118 - progs/trivial/line-clip.c | 140 -- progs/trivial/line-cull.c | 136 -- progs/trivial/line-userclip-clip.c | 142 -- progs/trivial/line-userclip-nop-clip.c | 142 -- progs/trivial/line-userclip-nop.c | 142 -- progs/trivial/line-userclip.c | 142 -- progs/trivial/line.c | 140 -- progs/trivial/lineloop-clip.c | 136 -- progs/trivial/lineloop.c | 136 -- progs/trivial/point-clip.c | 138 -- progs/trivial/point-param.c | 156 -- progs/trivial/point-wide.c | 140 -- progs/trivial/point.c | 138 -- progs/trivial/poly-flat.c | 140 -- progs/trivial/poly-unfilled.c | 139 -- progs/trivial/poly.c | 138 -- progs/trivial/quad-clip-all-vertices.c | 138 -- progs/trivial/quad-clip-nearplane.c | 151 -- progs/trivial/quad-clip.c | 138 -- progs/trivial/quad-degenerate.c | 143 -- progs/trivial/quad-flat.c | 148 -- progs/trivial/quad-offset-factor.c | 167 -- progs/trivial/quad-offset-unfilled.c | 167 -- progs/trivial/quad-offset-units.c | 166 -- progs/trivial/quad-tex-2d.c | 169 -- progs/trivial/quad-tex-3d.c | 177 -- progs/trivial/quad-tex-pbo.c | 181 -- progs/trivial/quad-unfilled.c | 139 -- progs/trivial/quad.c | 138 -- progs/trivial/quads.c | 156 -- progs/trivial/quadstrip-flat.c | 150 -- progs/trivial/quadstrip.c | 144 -- progs/trivial/tri-blend.c | 144 -- progs/trivial/tri-clip.c | 137 -- progs/trivial/tri-cull.c | 136 -- progs/trivial/tri-dlist.c | 150 -- progs/trivial/tri-edgeflag.c | 141 -- progs/trivial/tri-flat-clip.c | 137 -- progs/trivial/tri-flat.c | 137 -- progs/trivial/tri-tex-3d.c | 170 -- progs/trivial/tri-unfilled-clip.c | 137 -- progs/trivial/tri-unfilled-smooth.c | 150 -- progs/trivial/tri-unfilled-userclip.c | 141 -- progs/trivial/tri-unfilled.c | 138 -- progs/trivial/tri-userclip.c | 140 -- progs/trivial/tri.c | 139 -- progs/trivial/tristrip-clip.c | 138 -- progs/trivial/tristrip.c | 138 -- progs/trivial/vbo-drawarrays.c | 133 - progs/trivial/vbo-drawelements.c | 137 -- progs/trivial/vbo-drawrange.c | 145 -- progs/trivial/vp-array.c | 117 - progs/trivial/vp-clip.c | 102 - progs/trivial/vp-line-clip.c | 116 - progs/trivial/vp-tri.c | 104 - progs/trivial/vp-unfilled.c | 104 - progs/vp/.gitignore | 1 - progs/vp/Makefile | 53 - progs/vp/abs.txt | 7 - progs/vp/add.txt | 6 - progs/vp/arl.txt | 9 - progs/vp/dp3.txt | 5 - progs/vp/dp4.txt | 5 - progs/vp/dph.txt | 5 - progs/vp/dst.txt | 5 - progs/vp/ex2.txt | 6 - progs/vp/flr.txt | 6 - progs/vp/frc.txt | 6 - progs/vp/lg2.txt | 6 - progs/vp/lit.txt | 6 - progs/vp/mad.txt | 5 - progs/vp/max.txt | 5 - progs/vp/min.txt | 5 - progs/vp/mov.txt | 5 - progs/vp/mul.txt | 5 - progs/vp/pow.txt | 5 - progs/vp/rcp.txt | 7 - progs/vp/rsq.txt | 7 - progs/vp/sge.txt | 5 - progs/vp/slt.txt | 5 - progs/vp/sub.txt | 5 - progs/vp/swz.txt | 5 - progs/vp/swz2.txt | 5 - progs/vp/vp-tris.c | 216 -- progs/vp/xpd.txt | 5 - progs/xdemos/.gitignore | 26 - src/egl/Makefile | 24 - src/egl/docs/EGL_MESA_screen_surface | 564 ----- src/egl/drivers/demo/Makefile | 32 - src/egl/drivers/demo/demo.c | 316 --- src/egl/drivers/dri/Makefile | 62 - src/egl/drivers/dri/egldri.c | 1138 --------- src/egl/drivers/dri/egldri.h | 113 - src/egl/main/Makefile | 67 - src/egl/main/eglapi.c | 586 ----- src/egl/main/eglapi.h | 119 - src/egl/main/eglconfig.c | 638 ----- src/egl/main/eglconfig.h | 67 - src/egl/main/eglcontext.c | 276 --- src/egl/main/eglcontext.h | 71 - src/egl/main/egldisplay.c | 71 - src/egl/main/egldisplay.h | 44 - src/egl/main/egldriver.c | 272 --- src/egl/main/egldriver.h | 81 - src/egl/main/eglglobals.c | 148 -- src/egl/main/eglglobals.h | 68 - src/egl/main/eglhash.c | 347 --- src/egl/main/eglhash.h | 39 - src/egl/main/egllog.c | 94 - src/egl/main/egllog.h | 16 - src/egl/main/eglmode.c | 431 ---- src/egl/main/eglmode.h | 54 - src/egl/main/eglscreen.c | 328 --- src/egl/main/eglscreen.h | 90 - src/egl/main/eglsurface.c | 530 ---- src/egl/main/eglsurface.h | 117 - src/egl/main/egltypedefs.h | 34 - src/glu/mesa/Makefile | 56 - src/glu/mesa/Makefile.DJ | 100 - src/glu/mesa/Makefile.m32 | 63 - src/glu/mesa/Makefile.ugl | 96 - src/glu/mesa/MesaGLU.def | 62 - src/glu/mesa/README1 | 195 -- src/glu/mesa/README2 | 43 - src/glu/mesa/all.h | 54 - src/glu/mesa/descrip.mms | 61 - src/glu/mesa/glu.c | 416 ---- src/glu/mesa/gluP.h | 97 - src/glu/mesa/mipmap.c | 824 ------- src/glu/mesa/mms_depend | 15 - src/glu/mesa/nurbs.c | 628 ----- src/glu/mesa/nurbs.h | 252 -- src/glu/mesa/nurbscrv.c | 444 ---- src/glu/mesa/nurbssrf.c | 1317 ---------- src/glu/mesa/nurbsutl.c | 1309 ---------- src/glu/mesa/polytest.c | 937 ------- src/glu/mesa/project.c | 403 --- src/glu/mesa/quadric.c | 819 ------- src/glu/mesa/tess.c | 327 --- src/glu/mesa/tess.h | 107 - src/glu/mesa/tesselat.c | 406 --- src/glu/mini/all.h | 54 - src/glu/mini/glu.c | 416 ---- src/glu/mini/gluP.h | 141 -- src/glu/mini/mipmap.c | 763 ------ src/glu/mini/nurbs.c | 157 -- src/glu/mini/nurbs.h | 252 -- src/glu/mini/nurbscrv.c | 132 - src/glu/mini/polytest.c | 937 ------- src/glu/mini/project.c | 403 --- src/glu/mini/quadric.c | 773 ------ src/glu/mini/tess.c | 327 --- src/glu/mini/tess.h | 107 - src/glu/mini/tesselat.c | 406 --- src/glut/os2/Makefile | 420 ---- src/glut/os2/WarpWin.cpp | 419 ---- src/glut/os2/glutOverlay.cpp | 133 - src/glut/os2/glut_8x13.cpp | 2076 ---------------- src/glut/os2/glut_9x15.cpp | 2077 ---------------- src/glut/os2/glut_bitmap.cpp | 57 - src/glut/os2/glut_cindex.cpp | 258 -- src/glut/os2/glut_cmap.cpp | 399 --- src/glut/os2/glut_cursor.cpp | 210 -- src/glut/os2/glut_event.cpp | 1399 ----------- src/glut/os2/glut_ext.cpp | 204 -- src/glut/os2/glut_fullscrn.cpp | 38 - src/glut/os2/glut_gamemode.cpp | 679 ------ src/glut/os2/glut_get.cpp | 232 -- src/glut/os2/glut_hel10.cpp | 1781 -------------- src/glut/os2/glut_hel12.cpp | 1791 -------------- src/glut/os2/glut_hel18.cpp | 1900 -------------- src/glut/os2/glut_init.cpp | 451 ---- src/glut/os2/glut_input.cpp | 628 ----- src/glut/os2/glut_key.cpp | 29 - src/glut/os2/glut_keyctrl.cpp | 29 - src/glut/os2/glut_keyup.cpp | 29 - src/glut/os2/glut_mesa.cpp | 57 - src/glut/os2/glut_modifier.cpp | 31 - src/glut/os2/glut_roman.cpp | 2451 ------------------- src/glut/os2/glut_shapes.cpp | 595 ----- src/glut/os2/glut_stroke.cpp | 42 - src/glut/os2/glut_swap.cpp | 67 - src/glut/os2/glut_teapot.cpp | 210 -- src/glut/os2/glut_tr24.cpp | 2063 ---------------- src/glut/os2/glut_util.cpp | 90 - src/glut/os2/glut_vidresize.cpp | 232 -- src/glut/os2/glut_warp.cpp | 29 - src/glut/os2/glut_win.cpp | 1220 --------- src/glut/os2/glut_winmisc.cpp | 126 - src/glut/os2/glutbitmap.h | 32 - src/glut/os2/glutos2.h | 36 - src/glut/os2/glutstroke.h | 42 - src/glut/os2/layerutil.h | 59 - src/glut/os2/libGlut.DEF | 94 - src/glut/os2/os2_glx.cpp | 145 -- src/glut/os2/os2_menu.cpp | 532 ---- src/glut/os2/os2_winproc.cpp | 1296 ---------- src/glut/os2/src-glut_os2pm.zip | Bin 141239 -> 0 bytes src/glx/mini/Makefile | 88 - src/glx/mini/NOTES | 115 - src/glx/mini/dispatch.c | 64 - src/glx/mini/driver.h | 168 -- src/glx/mini/example.miniglx.conf | 36 - src/glx/mini/miniglx.c | 2580 -------------------- src/glx/mini/miniglxP.h | 205 -- src/glx/mini/miniglx_events.c | 983 -------- src/mesa/.gitignore | 2 - src/mesa/drivers/allegro/amesa.c | 414 ---- src/mesa/drivers/allegro/amesa.h | 65 - src/mesa/drivers/allegro/direct.h | 189 -- src/mesa/drivers/allegro/generic.h | 234 -- src/mesa/drivers/d3d/D3DCAPS.CPP | 250 -- src/mesa/drivers/d3d/D3DHAL.H | 68 - src/mesa/drivers/d3d/D3DInit.cpp | 891 ------- src/mesa/drivers/d3d/D3DMESA.H | 84 - src/mesa/drivers/d3d/D3DRaster.cpp | 213 -- src/mesa/drivers/d3d/D3DShared.h | 154 -- src/mesa/drivers/d3d/D3DTEXT.CPP | 576 ----- src/mesa/drivers/d3d/D3DTextureMgr.cpp | 947 ------- src/mesa/drivers/d3d/D3DTextureMgr.h | 62 - src/mesa/drivers/d3d/D3DUTILS.CPP | 638 ----- src/mesa/drivers/d3d/D3Dvbrender.c | 2149 ---------------- src/mesa/drivers/d3d/DDrawPROCS.c | 399 --- src/mesa/drivers/d3d/DEBUG.C | 143 -- src/mesa/drivers/d3d/DEBUG.H | 90 - src/mesa/drivers/d3d/DbgEnv.bat | 25 - src/mesa/drivers/d3d/MAKEFILE | 101 - src/mesa/drivers/d3d/NULLProcs.h | 49 - src/mesa/drivers/d3d/NullProcs.c | 49 - src/mesa/drivers/d3d/OPENGL32.DEF | 442 ---- src/mesa/drivers/d3d/WGL.C | 1262 ---------- src/mesa/drivers/d3d/d3dText.h | 53 - src/mesa/drivers/dri/common/xmlpool/.gitignore | 5 - src/mesa/drivers/dri/r200/.gitignore | 3 - src/mesa/drivers/dri/r300/.gitignore | 4 - src/mesa/drivers/dri/r300/Lindent | 0 src/mesa/drivers/ggi/default/.gitignore | 1 - src/mesa/drivers/ggi/display/.gitignore | 1 - .../drivers/windows/gldirect/dx7/gld_driver_dx7.c | 1196 --------- src/mesa/drivers/windows/gldirect/dx7/gld_dx7.h | 292 --- src/mesa/drivers/windows/gldirect/dx7/gld_dxerr7.h | 77 - .../drivers/windows/gldirect/dx7/gld_ext_dx7.c | 346 --- .../windows/gldirect/dx7/gld_pipeline_dx7.c | 77 - .../windows/gldirect/dx7/gld_primitive_dx7.c | 1448 ----------- .../drivers/windows/gldirect/dx7/gld_texture_dx7.c | 2196 ----------------- .../windows/gldirect/dx7/gld_vb_d3d_render_dx7.c | 257 -- .../windows/gldirect/dx7/gld_vb_mesa_render_dx7.c | 422 ---- .../drivers/windows/gldirect/dx7/gld_wgl_dx7.c | 1611 ------------ .../drivers/windows/gldirect/dx8/gld_driver_dx8.c | 1176 --------- src/mesa/drivers/windows/gldirect/dx8/gld_dx8.h | 324 --- src/mesa/drivers/windows/gldirect/dx8/gld_dxerr8.h | 77 - .../drivers/windows/gldirect/dx8/gld_ext_dx8.c | 344 --- .../windows/gldirect/dx8/gld_pipeline_dx8.c | 77 - .../windows/gldirect/dx8/gld_primitive_dx8.c | 1446 ----------- .../drivers/windows/gldirect/dx8/gld_texture_dx8.c | 2046 ---------------- .../windows/gldirect/dx8/gld_vb_d3d_render_dx8.c | 249 -- .../windows/gldirect/dx8/gld_vb_mesa_render_dx8.c | 448 ---- .../drivers/windows/gldirect/dx8/gld_wgl_dx8.c | 1335 ---------- .../drivers/windows/gldirect/dx9/gld_driver_dx9.c | 1206 --------- src/mesa/drivers/windows/gldirect/dx9/gld_dx9.h | 327 --- src/mesa/drivers/windows/gldirect/dx9/gld_dxerr9.h | 77 - .../drivers/windows/gldirect/dx9/gld_ext_dx9.c | 344 --- .../windows/gldirect/dx9/gld_pipeline_dx9.c | 77 - .../windows/gldirect/dx9/gld_primitive_dx9.c | 1446 ----------- .../drivers/windows/gldirect/dx9/gld_texture_dx9.c | 2104 ---------------- .../windows/gldirect/dx9/gld_vb_d3d_render_dx9.c | 263 -- .../windows/gldirect/dx9/gld_vb_mesa_render_dx9.c | 443 ---- .../drivers/windows/gldirect/dx9/gld_wgl_dx9.c | 1345 ---------- src/mesa/glapi/.gitignore | 11 - src/mesa/glapi/next_available_offset.sh | 0 windows/VC6/mesa/gdi/gdi.dsp | 211 -- windows/VC6/mesa/glu/compileDebug.txt | 82 - windows/VC6/mesa/glu/compileRelease.txt | 82 - windows/VC6/mesa/glu/glu.dsp | 2579 ------------------- windows/VC6/mesa/glu/objectsDebug.txt | 73 - windows/VC6/mesa/glu/objectsRelease.txt | 73 - windows/VC6/mesa/mesa.dsw | 74 - windows/VC6/mesa/mesa/mesa.dsp | 1582 ------------ windows/VC6/mesa/osmesa/osmesa.dsp | 195 -- windows/VC7/mesa/gdi/gdi.vcproj | 195 -- windows/VC7/mesa/glu/glu.vcproj | 766 ------ windows/VC7/mesa/mesa.sln | 47 - windows/VC7/mesa/mesa/mesa.vcproj | 1227 ---------- windows/VC7/mesa/osmesa/osmesa.vcproj | 182 -- 611 files changed, 5765 insertions(+), 148218 deletions(-) mode change 100755 => 100644 bin/confdiff.sh mode change 100755 => 100644 bin/installmesa delete mode 100644 configs/.gitignore create mode 100644 debian/changelog create mode 100644 debian/compat create mode 100644 debian/control create mode 100644 debian/copyright create mode 100644 debian/glxdemo.1 create mode 100644 debian/glxgears.1 create mode 100644 debian/glxheads.1 create mode 100644 debian/glxinfo.1 create mode 100644 debian/libgl1-mesa-dev.install create mode 100644 debian/libgl1-mesa-dri-i686.install create mode 100644 debian/libgl1-mesa-dri.install create mode 100644 debian/libgl1-mesa-glx-i686.install create mode 100644 debian/libgl1-mesa-glx.install create mode 100644 debian/libgl1-mesa-glx.shlibs create mode 100644 debian/libgl1-mesa-swx11-dev.install create mode 100644 debian/libgl1-mesa-swx11-i686.install create mode 100644 debian/libgl1-mesa-swx11-i686.shlibs create mode 100644 debian/libgl1-mesa-swx11.install create mode 100644 debian/libgl1-mesa-swx11.shlibs create mode 100644 debian/libglu1-mesa-dev.install create mode 100644 debian/libglu1-mesa.install create mode 100644 debian/libglu1-mesa.shlibs create mode 100644 debian/libglw1-mesa-dev.install create mode 100644 debian/libglw1-mesa.install create mode 100644 debian/libglw1-mesa.shlibs create mode 100644 debian/libosmesa6-dev.install create mode 100644 debian/libosmesa6.install create mode 100644 debian/libosmesa6.shlibs create mode 100644 debian/mesa-common-dev.docs create mode 100644 debian/mesa-common-dev.install create mode 100644 debian/mesa-utils.install create mode 100644 debian/mesa-utils.manpages create mode 100644 debian/patches/02_use-ieee-fp-on-s390-and-m68k.patch create mode 100644 debian/patches/03_optional-progs-and-install.patch create mode 100644 debian/patches/04_osmesa_version.diff create mode 100644 debian/patches/101_ubuntu_hidden_glname.patch create mode 100644 debian/patches/102_dont_vblank.diff create mode 100644 debian/patches/103_bump_965_texture_limit.diff create mode 100644 debian/patches/104_fix_dri2_ext_tfp.diff create mode 100644 debian/patches/105_glXWaitX_segfaults.patch create mode 100644 debian/patches/series create mode 100755 debian/rules create mode 100644 debian/scripts/choose-configs create mode 100644 debian/watch delete mode 100644 docs/OLD/MESA_packed_depth_stencil.spec delete mode 100644 docs/OLD/MESA_program_debug.spec delete mode 100644 docs/OLD/MESA_sprite_point.spec delete mode 100644 docs/OLD/MESA_trace.spec delete mode 100644 docs/gears.png delete mode 100644 doxygen/.gitignore delete mode 100644 doxygen/Makefile delete mode 100644 doxygen/README delete mode 100644 doxygen/common.doxy delete mode 100644 doxygen/core_subset.doxy delete mode 100644 doxygen/doxy.bat delete mode 100644 doxygen/glapi.doxy delete mode 100644 doxygen/header.html delete mode 100644 doxygen/header_subset.html delete mode 100644 doxygen/main.doxy delete mode 100644 doxygen/math.doxy delete mode 100644 doxygen/math_subset.doxy delete mode 100644 doxygen/miniglx.doxy delete mode 100644 doxygen/radeon_subset.doxy delete mode 100644 doxygen/shader.doxy delete mode 100644 doxygen/swrast.doxy delete mode 100644 doxygen/swrast_setup.doxy delete mode 100644 doxygen/tnl.doxy delete mode 100644 doxygen/tnl_dd.doxy delete mode 100644 doxygen/vbo.doxy delete mode 100644 include/GLES/egl.h delete mode 100644 include/GLES/egltypes.h delete mode 100644 progs/beos/.gitignore delete mode 100644 progs/demos/.gitignore delete mode 100644 progs/demos/Windows/all.dsp delete mode 100644 progs/demos/Windows/bounce.dsp delete mode 100644 progs/demos/Windows/clearspd.dsp delete mode 100644 progs/demos/Windows/cubemap.dsp delete mode 100644 progs/demos/Windows/demos.dsw delete mode 100644 progs/demos/Windows/drawpix.dsp delete mode 100644 progs/demos/Windows/fire.dsp delete mode 100644 progs/demos/Windows/gears.dsp delete mode 100644 progs/demos/Windows/geartrain.dsp delete mode 100644 progs/demos/Windows/glinfo.dsp delete mode 100644 progs/demos/Windows/gloss.dsp delete mode 100644 progs/demos/Windows/gltestperf.dsp delete mode 100644 progs/demos/Windows/glutfx.dsp delete mode 100644 progs/demos/Windows/ipers.dsp delete mode 100644 progs/demos/Windows/isosurf.dsp delete mode 100644 progs/demos/Windows/loadbias.dsp delete mode 100644 progs/demos/Windows/morph3d.dsp delete mode 100644 progs/demos/Windows/multiarb.dsp delete mode 100644 progs/demos/Windows/occlude.dsp delete mode 100644 progs/demos/Windows/osdemo.dsp delete mode 100644 progs/demos/Windows/paltex.dsp delete mode 100644 progs/demos/Windows/pixeltex.dsp delete mode 100644 progs/demos/Windows/pointblast.dsp delete mode 100644 progs/demos/Windows/rain.dsp delete mode 100644 progs/demos/Windows/ray.dsp delete mode 100644 progs/demos/Windows/readpix.dsp delete mode 100644 progs/demos/Windows/reflect.dsp delete mode 100644 progs/demos/Windows/renormal.dsp delete mode 100644 progs/demos/Windows/shadowtex.dsp delete mode 100644 progs/demos/Windows/spectex.dsp delete mode 100644 progs/demos/Windows/spriteblast.dsp delete mode 100644 progs/demos/Windows/stex3d.dsp delete mode 100644 progs/demos/Windows/teapot.dsp delete mode 100644 progs/demos/Windows/terrain.dsp delete mode 100644 progs/demos/Windows/tessdemo.dsp delete mode 100644 progs/demos/Windows/texcyl.dsp delete mode 100644 progs/demos/Windows/texdown.dsp delete mode 100644 progs/demos/Windows/texenv.dsp delete mode 100644 progs/demos/Windows/texobj.dsp delete mode 100644 progs/demos/Windows/trispd.dsp delete mode 100644 progs/demos/Windows/tunnel.dsp delete mode 100644 progs/demos/Windows/tunnel2.dsp delete mode 100644 progs/demos/Windows/winpos.dsp create mode 100644 progs/demos/extfuncs.h create mode 100644 progs/demos/readtex.c create mode 100644 progs/demos/readtex.h create mode 100644 progs/demos/showbuffer.c create mode 100644 progs/demos/showbuffer.h create mode 100644 progs/demos/trackball.c create mode 100644 progs/demos/trackball.h delete mode 100644 progs/directfb/.gitignore delete mode 100644 progs/directfb/Makefile delete mode 100644 progs/directfb/df_gears.c delete mode 100644 progs/directfb/df_morph3d.c delete mode 100644 progs/directfb/df_reflect.c delete mode 100644 progs/directfb/multi_window.c delete mode 100644 progs/egl/.gitignore delete mode 100644 progs/egl/Makefile delete mode 100644 progs/egl/demo1.c delete mode 100644 progs/egl/demo2.c delete mode 100644 progs/egl/demo3.c delete mode 100644 progs/egl/eglgears.c delete mode 100644 progs/egl/eglinfo.c delete mode 100644 progs/fbdev/.gitignore delete mode 100644 progs/fp/.gitignore delete mode 100644 progs/fp/Makefile delete mode 100644 progs/fp/point-position.c delete mode 100644 progs/fp/tri-abs.c delete mode 100644 progs/fp/tri-add.c delete mode 100644 progs/fp/tri-cmp.c delete mode 100644 progs/fp/tri-cos.c delete mode 100644 progs/fp/tri-depth.c delete mode 100644 progs/fp/tri-depth2.c delete mode 100644 progs/fp/tri-depthwrite.c delete mode 100644 progs/fp/tri-depthwrite2.c delete mode 100644 progs/fp/tri-dp3.c delete mode 100644 progs/fp/tri-dp4.c delete mode 100644 progs/fp/tri-dph.c delete mode 100644 progs/fp/tri-dst.c delete mode 100644 progs/fp/tri-ex2.c delete mode 100644 progs/fp/tri-flr.c delete mode 100644 progs/fp/tri-fp.c delete mode 100644 progs/fp/tri-frc.c delete mode 100644 progs/fp/tri-inv.c delete mode 100644 progs/fp/tri-kil.c delete mode 100644 progs/fp/tri-lg2.c delete mode 100644 progs/fp/tri-lit.c delete mode 100644 progs/fp/tri-lrp.c delete mode 100644 progs/fp/tri-mad.c delete mode 100644 progs/fp/tri-max.c delete mode 100644 progs/fp/tri-min.c delete mode 100644 progs/fp/tri-mov.c delete mode 100644 progs/fp/tri-mul.c delete mode 100644 progs/fp/tri-param.c delete mode 100644 progs/fp/tri-position.c delete mode 100644 progs/fp/tri-pow.c delete mode 100644 progs/fp/tri-rcp.c delete mode 100644 progs/fp/tri-rsq.c delete mode 100644 progs/fp/tri-scs.c delete mode 100644 progs/fp/tri-sge.c delete mode 100644 progs/fp/tri-sge2.c delete mode 100644 progs/fp/tri-sin.c delete mode 100644 progs/fp/tri-slt.c delete mode 100644 progs/fp/tri-sub.c delete mode 100644 progs/fp/tri-swz.c delete mode 100644 progs/fp/tri-swz2.c delete mode 100644 progs/fp/tri-tex.c delete mode 100644 progs/fp/tri-xpd.c delete mode 100644 progs/glsl/.gitignore create mode 100644 progs/glsl/readtex.c create mode 100644 progs/glsl/readtex.h create mode 100644 progs/glsl/shaderutil.c delete mode 100644 progs/miniglx/.gitignore delete mode 100644 progs/miniglx/Makefile delete mode 100644 progs/miniglx/glfbdevtest.c delete mode 100644 progs/miniglx/manytex.c delete mode 100644 progs/miniglx/miniglxsample.c delete mode 100644 progs/miniglx/miniglxtest.c delete mode 100644 progs/miniglx/sample_server.c delete mode 100644 progs/miniglx/sample_server2.c delete mode 100644 progs/miniglx/texline.c delete mode 100644 progs/osdemos/.gitignore delete mode 100644 progs/redbook/.gitignore delete mode 100644 progs/redbook/Windows/redbook.dsw delete mode 100644 progs/redbook/Windows/teapots.dsp delete mode 100644 progs/samples/.gitignore create mode 100644 progs/samples/readtex.c delete mode 100644 progs/slang/.gitignore delete mode 100644 progs/slang/Makefile delete mode 100644 progs/slang/README delete mode 100644 progs/slang/cltest.c delete mode 100644 progs/slang/cltest.txt delete mode 100644 progs/slang/framework.c delete mode 100644 progs/slang/framework.h delete mode 100644 progs/slang/sotest.c delete mode 100644 progs/slang/vstest.c delete mode 100644 progs/slang/vstest.txt delete mode 100644 progs/slang/windows/vc60/cltest.dsp delete mode 100644 progs/slang/windows/vc60/framework.dsp delete mode 100644 progs/slang/windows/vc60/slang.dsw delete mode 100644 progs/slang/windows/vc60/sotest.dsp delete mode 100644 progs/slang/windows/vc60/vstest.dsp delete mode 100644 progs/tests/.gitignore delete mode 100644 progs/tests/Makefile delete mode 100644 progs/tests/Makefile.win delete mode 100644 progs/tests/afsmultiarb.c delete mode 100644 progs/tests/antialias.c delete mode 100644 progs/tests/api_speed.c delete mode 100755 progs/tests/api_speed.py delete mode 100644 progs/tests/arbfpspec.c delete mode 100644 progs/tests/arbfptest1.c delete mode 100644 progs/tests/arbfptexture.c delete mode 100644 progs/tests/arbfptrig.c delete mode 100644 progs/tests/arbnpot-mipmap.c delete mode 100644 progs/tests/arbnpot.c delete mode 100644 progs/tests/arbvptest1.c delete mode 100644 progs/tests/arbvptest3.c delete mode 100644 progs/tests/arbvptorus.c delete mode 100644 progs/tests/arbvpwarpmesh.c delete mode 100644 progs/tests/arraytexture.c delete mode 100644 progs/tests/auxbuffer.c delete mode 100644 progs/tests/blendminmax.c delete mode 100644 progs/tests/blendsquare.c delete mode 100644 progs/tests/blendxor.c delete mode 100644 progs/tests/bufferobj.c delete mode 100644 progs/tests/bug_3050.c delete mode 100644 progs/tests/bug_3101.c delete mode 100644 progs/tests/bug_3195.c delete mode 100644 progs/tests/copypixrate.c delete mode 100644 progs/tests/crossbar.c delete mode 100644 progs/tests/cva.c delete mode 100644 progs/tests/debugger.c delete mode 100644 progs/tests/descrip.mms delete mode 100644 progs/tests/dinoshade.c delete mode 100644 progs/tests/drawbuffers.c delete mode 100644 progs/tests/exactrast.c delete mode 100644 progs/tests/ext422square.c delete mode 100644 progs/tests/fbotest1.c delete mode 100644 progs/tests/fbotest2.c delete mode 100644 progs/tests/fbotexture.c delete mode 100644 progs/tests/floattex.c delete mode 100644 progs/tests/fog.c delete mode 100644 progs/tests/fogcoord.c delete mode 100644 progs/tests/fptest1.c delete mode 100644 progs/tests/fptexture.c delete mode 100644 progs/tests/getprocaddress.c delete mode 100644 progs/tests/getprocaddress.py delete mode 100644 progs/tests/interleave.c delete mode 100644 progs/tests/invert.c delete mode 100644 progs/tests/jkrahntest.c delete mode 100644 progs/tests/lineclip.c delete mode 100644 progs/tests/manytex.c delete mode 100644 progs/tests/minmag.c delete mode 100644 progs/tests/mipmap_limits.c delete mode 100644 progs/tests/multipal.c delete mode 100644 progs/tests/multitexarray.c delete mode 100644 progs/tests/multiwindow.c delete mode 100644 progs/tests/no_s3tc.c delete mode 100644 progs/tests/packedpixels.c delete mode 100644 progs/tests/pbo.c delete mode 100644 progs/tests/prog_parameter.c delete mode 100644 progs/tests/projtex.c delete mode 100644 progs/tests/random.c delete mode 100644 progs/tests/readrate.c delete mode 100644 progs/tests/rubberband.c delete mode 100644 progs/tests/seccolor.c delete mode 100644 progs/tests/shader_api.c delete mode 100644 progs/tests/sharedtex.c delete mode 100644 progs/tests/stencil_twoside.c delete mode 100644 progs/tests/stencil_wrap.c delete mode 100644 progs/tests/stencilwrap.c delete mode 100644 progs/tests/subtexrate.c delete mode 100644 progs/tests/tex1d.c delete mode 100644 progs/tests/texcmp.c delete mode 100644 progs/tests/texcompress2.c delete mode 100644 progs/tests/texfilt.c delete mode 100644 progs/tests/texgenmix.c delete mode 100644 progs/tests/texline.c delete mode 100644 progs/tests/texobjshare.c delete mode 100644 progs/tests/texrect.c delete mode 100644 progs/tests/texwrap.c delete mode 100644 progs/tests/unfilledclip.c delete mode 100644 progs/tests/vao-01.c delete mode 100644 progs/tests/vao-02.c delete mode 100644 progs/tests/vparray.c delete mode 100644 progs/tests/vpeval.c delete mode 100644 progs/tests/vptest1.c delete mode 100644 progs/tests/vptest2.c delete mode 100644 progs/tests/vptest3.c delete mode 100644 progs/tests/vptorus.c delete mode 100644 progs/tests/vpwarpmesh.c delete mode 100644 progs/tests/yuvrect.c delete mode 100644 progs/tests/yuvsquare.c delete mode 100644 progs/tests/zreaddraw.c delete mode 100644 progs/tools/trace/.gitignore delete mode 100644 progs/tools/trace/Makefile delete mode 100644 progs/tools/trace/README delete mode 100755 progs/tools/trace/gltrace delete mode 100644 progs/tools/trace/gltrace.py delete mode 100644 progs/tools/trace/gltrace_support.cc delete mode 100644 progs/tools/trace/gltrace_support.h delete mode 100644 progs/trivial/.gitignore delete mode 100644 progs/trivial/Makefile delete mode 100644 progs/trivial/clear.c delete mode 100644 progs/trivial/dlist-dangling.c delete mode 100644 progs/trivial/dlist-degenerate.c delete mode 100644 progs/trivial/dlist-edgeflag-dangling.c delete mode 100644 progs/trivial/dlist-edgeflag.c delete mode 100644 progs/trivial/drawarrays.c delete mode 100644 progs/trivial/drawelements.c delete mode 100644 progs/trivial/drawrange.c delete mode 100644 progs/trivial/line-clip.c delete mode 100644 progs/trivial/line-cull.c delete mode 100644 progs/trivial/line-userclip-clip.c delete mode 100644 progs/trivial/line-userclip-nop-clip.c delete mode 100644 progs/trivial/line-userclip-nop.c delete mode 100644 progs/trivial/line-userclip.c delete mode 100644 progs/trivial/line.c delete mode 100644 progs/trivial/lineloop-clip.c delete mode 100644 progs/trivial/lineloop.c delete mode 100644 progs/trivial/point-clip.c delete mode 100644 progs/trivial/point-param.c delete mode 100644 progs/trivial/point-wide.c delete mode 100644 progs/trivial/point.c delete mode 100644 progs/trivial/poly-flat.c delete mode 100644 progs/trivial/poly-unfilled.c delete mode 100644 progs/trivial/poly.c delete mode 100644 progs/trivial/quad-clip-all-vertices.c delete mode 100644 progs/trivial/quad-clip-nearplane.c delete mode 100644 progs/trivial/quad-clip.c delete mode 100644 progs/trivial/quad-degenerate.c delete mode 100644 progs/trivial/quad-flat.c delete mode 100644 progs/trivial/quad-offset-factor.c delete mode 100644 progs/trivial/quad-offset-unfilled.c delete mode 100644 progs/trivial/quad-offset-units.c delete mode 100644 progs/trivial/quad-tex-2d.c delete mode 100644 progs/trivial/quad-tex-3d.c delete mode 100644 progs/trivial/quad-tex-pbo.c delete mode 100644 progs/trivial/quad-unfilled.c delete mode 100644 progs/trivial/quad.c delete mode 100644 progs/trivial/quads.c delete mode 100644 progs/trivial/quadstrip-flat.c delete mode 100644 progs/trivial/quadstrip.c delete mode 100644 progs/trivial/tri-blend.c delete mode 100644 progs/trivial/tri-clip.c delete mode 100644 progs/trivial/tri-cull.c delete mode 100644 progs/trivial/tri-dlist.c delete mode 100644 progs/trivial/tri-edgeflag.c delete mode 100644 progs/trivial/tri-flat-clip.c delete mode 100644 progs/trivial/tri-flat.c delete mode 100644 progs/trivial/tri-tex-3d.c delete mode 100644 progs/trivial/tri-unfilled-clip.c delete mode 100644 progs/trivial/tri-unfilled-smooth.c delete mode 100644 progs/trivial/tri-unfilled-userclip.c delete mode 100644 progs/trivial/tri-unfilled.c delete mode 100644 progs/trivial/tri-userclip.c delete mode 100644 progs/trivial/tri.c delete mode 100644 progs/trivial/tristrip-clip.c delete mode 100644 progs/trivial/tristrip.c delete mode 100644 progs/trivial/vbo-drawarrays.c delete mode 100644 progs/trivial/vbo-drawelements.c delete mode 100644 progs/trivial/vbo-drawrange.c delete mode 100644 progs/trivial/vp-array.c delete mode 100644 progs/trivial/vp-clip.c delete mode 100644 progs/trivial/vp-line-clip.c delete mode 100644 progs/trivial/vp-tri.c delete mode 100644 progs/trivial/vp-unfilled.c delete mode 100644 progs/vp/.gitignore delete mode 100644 progs/vp/Makefile delete mode 100644 progs/vp/abs.txt delete mode 100644 progs/vp/add.txt delete mode 100644 progs/vp/arl.txt delete mode 100644 progs/vp/dp3.txt delete mode 100644 progs/vp/dp4.txt delete mode 100644 progs/vp/dph.txt delete mode 100644 progs/vp/dst.txt delete mode 100644 progs/vp/ex2.txt delete mode 100644 progs/vp/flr.txt delete mode 100644 progs/vp/frc.txt delete mode 100644 progs/vp/lg2.txt delete mode 100644 progs/vp/lit.txt delete mode 100644 progs/vp/mad.txt delete mode 100644 progs/vp/max.txt delete mode 100644 progs/vp/min.txt delete mode 100644 progs/vp/mov.txt delete mode 100644 progs/vp/mul.txt delete mode 100644 progs/vp/pow.txt delete mode 100644 progs/vp/rcp.txt delete mode 100644 progs/vp/rsq.txt delete mode 100644 progs/vp/sge.txt delete mode 100644 progs/vp/slt.txt delete mode 100644 progs/vp/sub.txt delete mode 100644 progs/vp/swz.txt delete mode 100644 progs/vp/swz2.txt delete mode 100644 progs/vp/vp-tris.c delete mode 100644 progs/vp/xpd.txt delete mode 100644 progs/xdemos/.gitignore delete mode 100644 src/egl/Makefile delete mode 100644 src/egl/docs/EGL_MESA_screen_surface delete mode 100644 src/egl/drivers/demo/Makefile delete mode 100644 src/egl/drivers/demo/demo.c delete mode 100644 src/egl/drivers/dri/Makefile delete mode 100644 src/egl/drivers/dri/egldri.c delete mode 100644 src/egl/drivers/dri/egldri.h delete mode 100644 src/egl/main/Makefile delete mode 100644 src/egl/main/eglapi.c delete mode 100644 src/egl/main/eglapi.h delete mode 100644 src/egl/main/eglconfig.c delete mode 100644 src/egl/main/eglconfig.h delete mode 100644 src/egl/main/eglcontext.c delete mode 100644 src/egl/main/eglcontext.h delete mode 100644 src/egl/main/egldisplay.c delete mode 100644 src/egl/main/egldisplay.h delete mode 100644 src/egl/main/egldriver.c delete mode 100644 src/egl/main/egldriver.h delete mode 100644 src/egl/main/eglglobals.c delete mode 100644 src/egl/main/eglglobals.h delete mode 100644 src/egl/main/eglhash.c delete mode 100644 src/egl/main/eglhash.h delete mode 100644 src/egl/main/egllog.c delete mode 100644 src/egl/main/egllog.h delete mode 100644 src/egl/main/eglmode.c delete mode 100644 src/egl/main/eglmode.h delete mode 100644 src/egl/main/eglscreen.c delete mode 100644 src/egl/main/eglscreen.h delete mode 100644 src/egl/main/eglsurface.c delete mode 100644 src/egl/main/eglsurface.h delete mode 100644 src/egl/main/egltypedefs.h delete mode 100644 src/glu/mesa/Makefile delete mode 100644 src/glu/mesa/Makefile.DJ delete mode 100644 src/glu/mesa/Makefile.m32 delete mode 100644 src/glu/mesa/Makefile.ugl delete mode 100644 src/glu/mesa/MesaGLU.def delete mode 100644 src/glu/mesa/README1 delete mode 100644 src/glu/mesa/README2 delete mode 100644 src/glu/mesa/all.h delete mode 100644 src/glu/mesa/descrip.mms delete mode 100644 src/glu/mesa/glu.c delete mode 100644 src/glu/mesa/gluP.h delete mode 100644 src/glu/mesa/mipmap.c delete mode 100644 src/glu/mesa/mms_depend delete mode 100644 src/glu/mesa/nurbs.c delete mode 100644 src/glu/mesa/nurbs.h delete mode 100644 src/glu/mesa/nurbscrv.c delete mode 100644 src/glu/mesa/nurbssrf.c delete mode 100644 src/glu/mesa/nurbsutl.c delete mode 100644 src/glu/mesa/polytest.c delete mode 100644 src/glu/mesa/project.c delete mode 100644 src/glu/mesa/quadric.c delete mode 100644 src/glu/mesa/tess.c delete mode 100644 src/glu/mesa/tess.h delete mode 100644 src/glu/mesa/tesselat.c delete mode 100644 src/glu/mini/all.h delete mode 100644 src/glu/mini/glu.c delete mode 100644 src/glu/mini/gluP.h delete mode 100644 src/glu/mini/mipmap.c delete mode 100644 src/glu/mini/nurbs.c delete mode 100644 src/glu/mini/nurbs.h delete mode 100644 src/glu/mini/nurbscrv.c delete mode 100644 src/glu/mini/polytest.c delete mode 100644 src/glu/mini/project.c delete mode 100644 src/glu/mini/quadric.c delete mode 100644 src/glu/mini/tess.c delete mode 100644 src/glu/mini/tess.h delete mode 100644 src/glu/mini/tesselat.c delete mode 100644 src/glut/os2/Makefile delete mode 100644 src/glut/os2/WarpWin.cpp delete mode 100644 src/glut/os2/glutOverlay.cpp delete mode 100644 src/glut/os2/glut_8x13.cpp delete mode 100644 src/glut/os2/glut_9x15.cpp delete mode 100644 src/glut/os2/glut_bitmap.cpp delete mode 100644 src/glut/os2/glut_cindex.cpp delete mode 100644 src/glut/os2/glut_cmap.cpp delete mode 100644 src/glut/os2/glut_cursor.cpp delete mode 100644 src/glut/os2/glut_event.cpp delete mode 100644 src/glut/os2/glut_ext.cpp delete mode 100644 src/glut/os2/glut_fullscrn.cpp delete mode 100644 src/glut/os2/glut_gamemode.cpp delete mode 100644 src/glut/os2/glut_get.cpp delete mode 100644 src/glut/os2/glut_hel10.cpp delete mode 100644 src/glut/os2/glut_hel12.cpp delete mode 100644 src/glut/os2/glut_hel18.cpp delete mode 100644 src/glut/os2/glut_init.cpp delete mode 100644 src/glut/os2/glut_input.cpp delete mode 100644 src/glut/os2/glut_key.cpp delete mode 100644 src/glut/os2/glut_keyctrl.cpp delete mode 100644 src/glut/os2/glut_keyup.cpp delete mode 100644 src/glut/os2/glut_mesa.cpp delete mode 100644 src/glut/os2/glut_modifier.cpp delete mode 100644 src/glut/os2/glut_roman.cpp delete mode 100644 src/glut/os2/glut_shapes.cpp delete mode 100644 src/glut/os2/glut_stroke.cpp delete mode 100644 src/glut/os2/glut_swap.cpp delete mode 100644 src/glut/os2/glut_teapot.cpp delete mode 100644 src/glut/os2/glut_tr24.cpp delete mode 100644 src/glut/os2/glut_util.cpp delete mode 100644 src/glut/os2/glut_vidresize.cpp delete mode 100644 src/glut/os2/glut_warp.cpp delete mode 100644 src/glut/os2/glut_win.cpp delete mode 100644 src/glut/os2/glut_winmisc.cpp delete mode 100644 src/glut/os2/glutbitmap.h delete mode 100644 src/glut/os2/glutos2.h delete mode 100644 src/glut/os2/glutstroke.h delete mode 100644 src/glut/os2/layerutil.h delete mode 100644 src/glut/os2/libGlut.DEF delete mode 100644 src/glut/os2/os2_glx.cpp delete mode 100644 src/glut/os2/os2_menu.cpp delete mode 100644 src/glut/os2/os2_winproc.cpp delete mode 100644 src/glut/os2/src-glut_os2pm.zip delete mode 100644 src/glx/mini/Makefile delete mode 100644 src/glx/mini/NOTES delete mode 100644 src/glx/mini/dispatch.c delete mode 100644 src/glx/mini/driver.h delete mode 100644 src/glx/mini/example.miniglx.conf delete mode 100644 src/glx/mini/miniglx.c delete mode 100644 src/glx/mini/miniglxP.h delete mode 100644 src/glx/mini/miniglx_events.c delete mode 100644 src/mesa/.gitignore delete mode 100644 src/mesa/drivers/allegro/amesa.c delete mode 100644 src/mesa/drivers/allegro/amesa.h delete mode 100644 src/mesa/drivers/allegro/direct.h delete mode 100644 src/mesa/drivers/allegro/generic.h delete mode 100644 src/mesa/drivers/d3d/D3DCAPS.CPP delete mode 100644 src/mesa/drivers/d3d/D3DHAL.H delete mode 100644 src/mesa/drivers/d3d/D3DInit.cpp delete mode 100644 src/mesa/drivers/d3d/D3DMESA.H delete mode 100644 src/mesa/drivers/d3d/D3DRaster.cpp delete mode 100644 src/mesa/drivers/d3d/D3DShared.h delete mode 100644 src/mesa/drivers/d3d/D3DTEXT.CPP delete mode 100644 src/mesa/drivers/d3d/D3DTextureMgr.cpp delete mode 100644 src/mesa/drivers/d3d/D3DTextureMgr.h delete mode 100644 src/mesa/drivers/d3d/D3DUTILS.CPP delete mode 100644 src/mesa/drivers/d3d/D3Dvbrender.c delete mode 100644 src/mesa/drivers/d3d/DDrawPROCS.c delete mode 100644 src/mesa/drivers/d3d/DEBUG.C delete mode 100644 src/mesa/drivers/d3d/DEBUG.H delete mode 100644 src/mesa/drivers/d3d/DbgEnv.bat delete mode 100644 src/mesa/drivers/d3d/MAKEFILE delete mode 100644 src/mesa/drivers/d3d/NULLProcs.h delete mode 100644 src/mesa/drivers/d3d/NullProcs.c delete mode 100644 src/mesa/drivers/d3d/OPENGL32.DEF delete mode 100644 src/mesa/drivers/d3d/WGL.C delete mode 100644 src/mesa/drivers/d3d/d3dText.h delete mode 100644 src/mesa/drivers/dri/common/xmlpool/.gitignore delete mode 100644 src/mesa/drivers/dri/r200/.gitignore delete mode 100644 src/mesa/drivers/dri/r300/.gitignore mode change 100755 => 100644 src/mesa/drivers/dri/r300/Lindent delete mode 100644 src/mesa/drivers/ggi/default/.gitignore delete mode 100644 src/mesa/drivers/ggi/display/.gitignore delete mode 100644 src/mesa/drivers/windows/gldirect/dx7/gld_driver_dx7.c delete mode 100644 src/mesa/drivers/windows/gldirect/dx7/gld_dx7.h delete mode 100644 src/mesa/drivers/windows/gldirect/dx7/gld_dxerr7.h delete mode 100644 src/mesa/drivers/windows/gldirect/dx7/gld_ext_dx7.c delete mode 100644 src/mesa/drivers/windows/gldirect/dx7/gld_pipeline_dx7.c delete mode 100644 src/mesa/drivers/windows/gldirect/dx7/gld_primitive_dx7.c delete mode 100644 src/mesa/drivers/windows/gldirect/dx7/gld_texture_dx7.c delete mode 100644 src/mesa/drivers/windows/gldirect/dx7/gld_vb_d3d_render_dx7.c delete mode 100644 src/mesa/drivers/windows/gldirect/dx7/gld_vb_mesa_render_dx7.c delete mode 100644 src/mesa/drivers/windows/gldirect/dx7/gld_wgl_dx7.c delete mode 100644 src/mesa/drivers/windows/gldirect/dx8/gld_driver_dx8.c delete mode 100644 src/mesa/drivers/windows/gldirect/dx8/gld_dx8.h delete mode 100644 src/mesa/drivers/windows/gldirect/dx8/gld_dxerr8.h delete mode 100644 src/mesa/drivers/windows/gldirect/dx8/gld_ext_dx8.c delete mode 100644 src/mesa/drivers/windows/gldirect/dx8/gld_pipeline_dx8.c delete mode 100644 src/mesa/drivers/windows/gldirect/dx8/gld_primitive_dx8.c delete mode 100644 src/mesa/drivers/windows/gldirect/dx8/gld_texture_dx8.c delete mode 100644 src/mesa/drivers/windows/gldirect/dx8/gld_vb_d3d_render_dx8.c delete mode 100644 src/mesa/drivers/windows/gldirect/dx8/gld_vb_mesa_render_dx8.c delete mode 100644 src/mesa/drivers/windows/gldirect/dx8/gld_wgl_dx8.c delete mode 100644 src/mesa/drivers/windows/gldirect/dx9/gld_driver_dx9.c delete mode 100644 src/mesa/drivers/windows/gldirect/dx9/gld_dx9.h delete mode 100644 src/mesa/drivers/windows/gldirect/dx9/gld_dxerr9.h delete mode 100644 src/mesa/drivers/windows/gldirect/dx9/gld_ext_dx9.c delete mode 100644 src/mesa/drivers/windows/gldirect/dx9/gld_pipeline_dx9.c delete mode 100644 src/mesa/drivers/windows/gldirect/dx9/gld_primitive_dx9.c delete mode 100644 src/mesa/drivers/windows/gldirect/dx9/gld_texture_dx9.c delete mode 100644 src/mesa/drivers/windows/gldirect/dx9/gld_vb_d3d_render_dx9.c delete mode 100644 src/mesa/drivers/windows/gldirect/dx9/gld_vb_mesa_render_dx9.c delete mode 100644 src/mesa/drivers/windows/gldirect/dx9/gld_wgl_dx9.c delete mode 100644 src/mesa/glapi/.gitignore mode change 100755 => 100644 src/mesa/glapi/next_available_offset.sh delete mode 100644 windows/VC6/mesa/gdi/gdi.dsp delete mode 100644 windows/VC6/mesa/glu/compileDebug.txt delete mode 100644 windows/VC6/mesa/glu/compileRelease.txt delete mode 100644 windows/VC6/mesa/glu/glu.dsp delete mode 100644 windows/VC6/mesa/glu/objectsDebug.txt delete mode 100644 windows/VC6/mesa/glu/objectsRelease.txt delete mode 100644 windows/VC6/mesa/mesa.dsw delete mode 100644 windows/VC6/mesa/mesa/mesa.dsp delete mode 100644 windows/VC6/mesa/osmesa/osmesa.dsp delete mode 100644 windows/VC7/mesa/gdi/gdi.vcproj delete mode 100644 windows/VC7/mesa/glu/glu.vcproj delete mode 100644 windows/VC7/mesa/mesa.sln delete mode 100644 windows/VC7/mesa/mesa/mesa.vcproj delete mode 100644 windows/VC7/mesa/osmesa/osmesa.vcproj diff --git a/bin/confdiff.sh b/bin/confdiff.sh old mode 100755 new mode 100644 diff --git a/bin/installmesa b/bin/installmesa old mode 100755 new mode 100644 diff --git a/configs/.gitignore b/configs/.gitignore deleted file mode 100644 index 97ac5b7326..0000000000 --- a/configs/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -current -autoconf diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 0000000000..a4640483b9 --- /dev/null +++ b/debian/changelog @@ -0,0 +1,1802 @@ +mesa (7.4-0ubuntu3) jaunty; urgency=low + + * Disable 103_bump_965_texture_limit.diff. This is suspected to cause X + freeze issues. + (LP: 359392, Reopen: 146298) + + -- Bryce Harrington Fri, 17 Apr 2009 12:13:16 -0700 + +mesa (7.4-0ubuntu2) jaunty; urgency=low + + * Add 105_glXWaitX_segfaults.patch. Resolves segfaults from unitialized + variables when using swrast based drivers. (LP: #355242) + + -- Mario Limonciello Wed, 15 Apr 2009 01:03:30 -0500 + +mesa (7.4-0ubuntu1) jaunty; urgency=low + + * New upstream release, merge from debian-experimental + (LP: #330476, #347171, #349127) + * Drop 103_rs600_support.patch, included in this version. + * Drop 104_swrast_fbconfigs.patch, included in this version. + * Add 103_bump_965_texture_limit.diff. (LP: #146298) + * Add 104_fix_dri2_ext_tfp.diff. (LP: #324854) + + -- Timo Aaltonen Fri, 03 Apr 2009 12:42:06 +0300 + +mesa (7.4~rc1-1) experimental; urgency=low + + * New upstream release candidate. + * Fix watch file to make uscan not consider release candidates as newer than + actual releases. + * debian/control: add lpia to the Architecture field for + libgl1-mesa-dri{,-dbg} to match Ubuntu. + * debian/rules: on lpia, only build the i915 and i965 dri drivers (based on + Ubuntu changes). + * Build-depend on linux-libc-dev >= 2.6.29 on linux archs. + + -- Julien Cristau Wed, 25 Mar 2009 11:34:42 +0100 + +mesa (7.3-1ubuntu4) jaunty; urgency=low + + * Backport 104_swrast_fbconfigs.patch from mesa git. + - Properly assigns an fbconfig for the root visual. This fixes + issues with MythTV not being able to show fonts when using a software + rasterizer. (LP: #341898) + + -- Mario Limonciello Fri, 27 Mar 2009 02:50:13 -0500 + +mesa (7.3-1ubuntu3) jaunty; urgency=low + + * Add 103_rs600_support.patch: Adds support for the RS600 chip and sets + the number of gb pipes properly for r3xx/r5xx cards. + + -- Bryce Harrington Tue, 03 Mar 2009 00:26:59 -0800 + +mesa (7.3-1ubuntu2) jaunty; urgency=low + + [ Julien Cristau ] + * Drop CFLAGS mangling for lpia and armel from debian/rules, the issue has + been fixed upstream. + + [ Timo Aaltonen ] + * 102_dont_vblank.patch: Disable vblank again for intel, and revisit it + again during the next cycle. + + -- Timo Aaltonen Mon, 23 Feb 2009 16:48:56 +0200 + +mesa (7.3-1ubuntu1) jaunty; urgency=low + + * Merge with Debian experimental. + * Drop 102_remove_flip.diff, included in 7.3.. + + -- Timo Aaltonen Sat, 31 Jan 2009 12:38:44 +0200 + +mesa (7.3-1) experimental; urgency=low + + [ Timo Aaltonen ] + * New upstream release. + + [ Julien Cristau ] + * Try to make the diff a bit smaller by removing directories that are in + upstream git but not in tarballs. + + -- Julien Cristau Fri, 30 Jan 2009 20:00:34 +0100 + +mesa (7.3~rc3-1ubuntu2) jaunty; urgency=low + + * 102_remove_flip.diff: Add a patch from upstream which removes the + remaining bits of pageflipping support. (LP: #320690) + + -- Timo Aaltonen Sun, 25 Jan 2009 00:00:04 +0200 + +mesa (7.3~rc3-1ubuntu1) jaunty; urgency=low + + * Merge with Debian experimental. + * Drop 102_dont_vblank.patch, since the new drm code in the kernel + fixes the bugs that it worked around. + * Bump the build-dependency of libdrm to 2.4.4. It's the first version + with necessary changes to build this. + + -- Timo Aaltonen Fri, 23 Jan 2009 10:20:24 +0200 + +mesa (7.3~rc3-1) experimental; urgency=low + + [ Timo Aaltonen ] + * New upstream release candidate. + + [ Julien Cristau ] + * Refresh patches 03 and 04. + + -- Julien Cristau Wed, 21 Jan 2009 19:01:21 +0100 + +mesa (7.3~rc1-1) experimental; urgency=low + + * New upstream release candidate. + + provides DRI2 (closes: #411141). + + i915: fallback for cube map texture. Fixes GPU hang with scorched3d + (closes: #484049). + + [ Timo Aaltonen ] + * Remove debian/patches/01_disable-intel-classic-warn.diff, the + warning is gone now. + * debian/control: + - Build-depend on x11proto-dri2-dev (>= 1.99.3) + + [ Julien Cristau ] + * Require libdrm-dev 2.4.3. + * Merge packaging changes from unstable, from 7.0.3-5 to 7.0.3-7. + * Delete unused configs/debian-*, and install-source.sh script. We've + switched to using autoconf, and mesa-swx11-source is gone. + * Delete some now unused code from debian/rules. + + -- Julien Cristau Sat, 10 Jan 2009 22:14:55 +0100 + +mesa (7.2+git20081209.a0d5c3cf-0ubuntu4) jaunty; urgency=low + + * debian/rules: Add -D_GNU_SOURCE for lpia & armel (FTBFS). + + -- Timo Aaltonen Fri, 12 Dec 2008 02:15:40 +0200 + +mesa (7.2+git20081209.a0d5c3cf-0ubuntu3) jaunty; urgency=low + + * debian/rules (CFLAGS): Avoid recursive reference. + + -- Matthias Klose Thu, 11 Dec 2008 22:34:43 +0100 + +mesa (7.2+git20081209.a0d5c3cf-0ubuntu2) jaunty; urgency=low + + * debian/rules: Add -D_BSD_SOURCE to CFLAGS for lpia & armel (FTBFS). + * Drop the Xsession.d hook, not needed anymore. + + -- Timo Aaltonen Thu, 11 Dec 2008 23:20:47 +0200 + +mesa (7.2+git20081209.a0d5c3cf-0ubuntu1) jaunty; urgency=low + + * Merge from debian-experimental git branch. + * 103_fix-crash-in-i830_emit_state.dpatch: deleted, included + upstream. + + -- Timo Aaltonen Tue, 09 Dec 2008 21:54:28 +0200 + +mesa (7.2-1ubuntu2) intrepid; urgency=low + + * debian/patches/103_fix-crash-in-i830_emit_state.dpatch: + - Apply upstream commit to fix a crash in i830_emit_state + (LP: #277709) + + -- Chris Coulson Tue, 21 Oct 2008 17:55:10 +0100 + +mesa (7.2-1ubuntu1) intrepid; urgency=low + + * Merge from Debian experimental. + + -- Timo Aaltonen Wed, 24 Sep 2008 21:00:38 +0300 + +mesa (7.2-1) experimental; urgency=low + + [ Brice Goglin ] + * Fix grammar and punctuation in glxinfo(1), thanks Sam Hocevar, + closes: #498595. + + [ Timo Aaltonen ] + * New upstream release. + * Refresh patch 04_osmesa_version.diff + + [ Julien Cristau ] + * Remove the build-dep on dri2proto, DRI2 support has been removed. + * intel: don't warn about TTM init failure. + + -- Julien Cristau Wed, 24 Sep 2008 14:28:21 +0200 + +mesa (7.1-1ubuntu3) intrepid; urgency=low + + * debian/rules: Build i915 and i965 DRI drivers on lpia. (LP: #270106) + + -- Timo Aaltonen Tue, 16 Sep 2008 13:07:02 +0300 + +mesa (7.1-1ubuntu2) intrepid; urgency=low + + * 102_dont_vblank.patch + - Revert the commit which defaults to vblank on intel. It breaks + DPMS with compiz, resulting in a hang. (LP: 262605) + + -- Timo Aaltonen Fri, 12 Sep 2008 11:25:01 +0300 + +mesa (7.1-1ubuntu1) intrepid; urgency=low + + * Merge from debian experimental, remaining changes: + - debian/control + + Change maintainer address to Ubuntu. + + Drop lesstif-dev from Build-Depends since it's a universe component + that Ubuntu doesn't want in main due to security concerns about it + (it's a large codebase without active development - last release >2 + yrs ago). + + Comment out GLw libs since it depends on lesstif-dev. + + Add lpia to -dri and -dri-dbg package in. + + Add Pre-Depends: dpkg (>= 1.14.12ubuntu3) to ensure dpkg + support for lzma. + - debian/rules + + Unexport LDFLAGS (amd64 FTBFS). + + Add Xsession hook to disable ASM optimizations when running on + 64-but processors that don't support them + (LP: 87661, Deb: 484180, fdo: 8724) + + use --disable-glw for swx11 targets too. + + Build .debs with lzma compression. + - debian/patches + + Add 101_ubuntu_hidden_glname.patch. + + -- Timo Aaltonen Thu, 28 Aug 2008 01:18:35 +0300 + +mesa (7.1-1) experimental; urgency=low + + * Add parallel build support. + * New upstream development release + + libGLU now only exports its public interface (closes: #319388) + * Some more parallel build updates. + + -- Julien Cristau Wed, 27 Aug 2008 19:52:24 +0200 + +mesa (7.1~rc3-1ubuntu4) intrepid; urgency=low + + * debian/control: Add Pre-Depends: dpkg (>= 1.14.12ubuntu3) to ensure dpkg + support for lzma. + + -- Martin Pitt Sun, 11 May 2008 10:42:54 +0200 + +mesa (7.1~rc3-1ubuntu3) intrepid; urgency=low + + * Build .debs with lzma compression to reduce libgl1-mesa-dri from 13.2 to + 2.8 MB. + + -- Martin Pitt Tue, 12 Aug 2008 09:31:01 +0200 + +mesa (7.1~rc3-1ubuntu2) intrepid; urgency=low + + * 102_fix-fdo-14441.diff: fix tfp on i965. (LP: #245888) + + -- Timo Aaltonen Fri, 01 Aug 2008 16:08:01 +0300 + +mesa (7.1~rc3-1ubuntu1) intrepid; urgency=low + + * merged with debian-experimental + + -- Michael Vogt Tue, 15 Jul 2008 15:07:41 +0100 + +mesa (7.1~rc3-1) experimental; urgency=low + + [ Julien Cristau ] + * New upstream release candidate (updated to git commit 4fab47b1). + * Build against libdrm >= 2.3.1. + * 04_osmesa_version.diff: fix libOSMesa versioning, to revert accidental + SONAME bump. + + [ Timo Aaltonen ] + * Refresh patches, and drop obsolete 00_create-libdir.patch and + 01_fix-makefile.patch. + * Build-depend on x11proto-dri2-dev. + * Drop mesa-swx11-source. + * Add dri_interface.h to mesa-common-dev. + * Add gl.pc to libgl1-mesa-dev + * rules: Replace the old build system with the new autotools-based + system. + * Run autoreconf before building the various flavours.. + * Add automake & autoconf to build-deps. + * Use --enable-glx-tls for dri. + + -- Julien Cristau Sun, 13 Jul 2008 19:41:42 +0200 + +mesa (7.1~rc1-0ubuntu2) intrepid; urgency=low + + * Merge with debian git, fixes FTBFS on sparc/hppa/ia64. + + -- Timo Aaltonen Mon, 07 Jul 2008 11:12:26 +0300 + +mesa (7.1~rc1-0ubuntu1) intrepid; urgency=low + + [ Bryce Harrington ] + * Merge from git.debian.org, remaining changes: + - Change maintainer address to Ubuntu. + - Drop lesstif-dev from Build-Depends since it's a universe component + that Ubuntu doesn't want in main due to security concerns about it + (it's a large codebase without active development - last release >2 + yrs ago). + - Comment out GLw libs from control since it depends on lesstif-dev. + - Add lpia to -dri and -dri-dbg package in debian/control. + - Add Xsession hook to disable ASM optimizations when running on + 64-but processors that don't support them + (LP: 87661, Deb: 484180, fdo: 8724) + - Add 101_ubuntu_hidden_glname.patch. + + [ Timo Aaltonen ] + * Dropped patches + 102_ubuntu_no_glw.patch: + - the new build system handles this better + 103_dlopen_in_driveropen.diff and 104_fix_driveropen.diff: + - upstream + * debian/rules: use --disable-glw for swx11 targets too. + * Unexport LDFLAGS (amd64 FTBFS). + + -- Timo Aaltonen Fri, 04 Jul 2008 13:19:57 +0300 + +mesa (7.0.3-7) unstable; urgency=low + + * Cherry-pick patch from upstream: + Use 3Dnow! x86-64 routines only on processors that support 3Dnow! + (closes: #484180). + * Also build the x86-specific dri drivers on kfreebsd (closes: #492894). + + -- Julien Cristau Sun, 14 Dec 2008 07:34:58 +0530 + +mesa (7.0.3-6) unstable; urgency=high + + * Update debian/copyright to the SGI Free Software License B, version 2.0. + It now mirrors the free X11 license used by X.Org (closes: #368560). + http://www.sgi.com/company_info/newsroom/press_releases/2008/september/opengl.html + + -- Julien Cristau Sat, 20 Sep 2008 16:30:44 +0200 + +mesa (7.0.3-5) unstable; urgency=low + + * Disable the i915tex driver, it doesn't build against libdrm 2.3.1. + * Pull from mesa_7_0_branch (27425708). + + -- Julien Cristau Sat, 12 Jul 2008 18:56:19 +0200 + +mesa (7.0.3-4) unstable; urgency=low + + * Pull from mesa_7_0_branch (2ac4919d). + * Put back our configs/ changes into the .diff.gz since choose-configs + needs them before quilt is invoked. Put 04_cleanup-osmesa-configs.patch + there as well for #485161. + + -- Brice Goglin Wed, 18 Jun 2008 20:59:14 +0200 + +mesa (7.0.3-3ubuntu1) intrepid; urgency=low + + * Merge from debian unstable, remaining changes: + - Change maintainer address to Ubuntu. + - Drop lesstif-dev from Build-Depends since it's a universe component + that Ubuntu doesn't want in main due to security concerns about it + (it's a large codebase without active development - last release >2 + yrs ago). + - Comment out GLw libs from control since it depends on lesstif-dev. + - Add lpia to -dri and -dri-dbg package in debian/control. + - Add lpia to ARCH_X86 in configs/debian-dri-default. + - Add 101_ubuntu_hidden_glname.patch + - Add 102_ubuntu_no_glw.patch to remove lesstif build depends since + its a universe component. + - Add 103_dlopen_in_driveropen.diff and 104_fix_driveropen.diff from + upstream; "Always call dlopen in DriverOpen". + (LP: 189580, fdo: 13541) + - Add Xsession hook to disable ASM optimizations when running on + 64-but processors that don't support them + (LP: 87661, Deb: 484180, fdo: 8724) + + -- Bryce Harrington Tue, 17 Jun 2008 16:47:35 -0700 + +mesa (7.0.3-3) unstable; urgency=low + + * Pull from mesa_7_0_branch (718724de). + + Fix intel_batchbuffer_space on i965, closes: #455817. + + Fix busy error in i915_wait_irq for real now, closes: #467319. + * Move our configs/ changes from the .diff.gz into our quilt patches, + with 04_cleanup-osmesa-configs.patch renamed into 04_debian-configs.patch, + closes: #485161. + + -- Brice Goglin Tue, 17 Jun 2008 20:00:51 +0200 + +mesa (7.0.3-2) unstable; urgency=low + + * Pull from mesa_7_0_branch (03447de3). + * Set right cliprects for the current draw region on Intel, closes: #467319. + * Use BRW_TEXCOORDMODE_CLAMP instead of BRW_TEXCOORDMODE_CLAMP_BORDER + to implement GL_CLAMP on i965, closes: #478880. + * Fix segment fault with BASE_LEVEL set to 5 for MipMap on i915, + closes: #451339. + * Disable low impact fallback on r300 by default, closes: #440868. + + -- Brice Goglin Fri, 13 Jun 2008 06:53:29 +0200 + +mesa (7.0.3-1ubuntu2) intrepid; urgency=low + + * Add Xsession hook to disable ASM optimizations when running on + 64-but processors that don't support them (LP: #87661) + + -- Tormod Volden Thu, 05 Jun 2008 12:41:25 +0200 + +mesa (7.0.3-1ubuntu1) intrepid; urgency=low + + * Merge from debian unstable, remaining changes: + - Change maintainer address. + - Drop lesstif-dev from Build-Depends. + - Comment out GLw libs from control. + - Add lpia to -dri and -dri-dbg package in debian/control. + - Add lpia to ARCH_X86 in configs/debian-dri-default. + - Add 101_ubuntu_hidden_glname.patch + - Add 102_ubuntu_no_glw.patch + - Add 103_dlopen_in_driveropen.diff and 104_fix_driveropen.diff from + upstream; "Always call dlopen in DriverOpen". (LP: #189580) + + -- Timo Aaltonen Wed, 04 Jun 2008 18:38:43 +0300 + +mesa (7.0.3-1) unstable; urgency=low + + * New upstream release. + * Only call ProgramStringNotify if program parsing succeeded, + closes: #473551. + + -- Brice Goglin Fri, 11 Apr 2008 08:42:37 +0200 + +mesa (7.0.3~rc2-2) unstable; urgency=low + + * Pull from mesa_7_0_branch (1e83d70b). + * Fixes regression in the i965 dri driver (closes: #470984, #470084) + * Update 02_use-ieee-fp-on-s390-and-m68k.patch. + * Change libgl1-mesa-swx11-i686's pre-dependency on libgl1-mesa-swx11 to a + regular versioned dependency, and add ${shlibs:Depends}. + + -- Julien Cristau Mon, 31 Mar 2008 16:47:31 +0200 + +mesa (7.0.3~rc2-1ubuntu3) hardy; urgency=low + + * debian/patches/107_fix_-ve_rhw_regression.patch: Fixes regression + introduced upstream where a -ve rhw workaround is being applied only + for IGD systems, when it should be applied only for *non*-IGD systems. + This resulted in rendering issues in 3D games and drawing programs. + (LP: #199823, #206287) + + -- Bryce Harrington Fri, 04 Apr 2008 19:46:40 -0700 + +mesa (7.0.3~rc2-1ubuntu2) hardy; urgency=low + + [ Laurent Bigonville ] + * debian/patches/105_vblank_fix.patch: Fix "drmWaitVBlank returned -1" error + (LP: #186764) + + [ Timo Aaltonen ] + * Add 106_i965_wine_fix.diff from upstream, "Only call + ProgramStringNotify if program parsing succeeded". (LP: #178292) + + -- Timo Aaltonen Wed, 12 Mar 2008 12:33:41 +0200 + +mesa (7.0.3~rc2-1ubuntu1) hardy; urgency=low + + * Merge from debian unstable (LP: #189167), remaining changes: + - Change maintainer address. + - Drop lesstif-dev from Build-Depends. + - Comment out GLw libs from control. + - Add lpia to -dri and -dri-dbg package in debian/control. + - Add lpia to ARCH_X86 in configs/debian-dri-default. + - Add 101_ubuntu_hidden_glname.patch + - Add 102_ubuntu_no_glw.patch + * Drop patch 103_fix_rv410se.diff, applied upstream. + * Add 103_dlopen_in_driveropen.diff and 104_fix_driveropen.diff from + upstream; "Always call dlopen in DriverOpen". (LP: #189580) + + -- Timo Aaltonen Tue, 26 Feb 2008 13:07:45 +0200 + +mesa (7.0.3~rc2-1) unstable; urgency=low + + * New upstream release candidate. + + enable user-defined clip planes for R300 (closes: #408679) + + 03_optional-progs-and-install.patch: partly applied upstream, fixed up + * Stop building with -O0 on hppa. Bug #451047 should be fixed in recent gcc + versions. + + -- Julien Cristau Sun, 24 Feb 2008 10:22:54 +0100 + +mesa (7.0.2-4ubuntu2) hardy; urgency=low + + * 103_fix_rv410se.diff: + - patch from upstream; "Fix rendering on x700 SE chips." + (LP: #151974) + + -- Timo Aaltonen Wed, 30 Jan 2008 13:18:23 +0200 + +mesa (7.0.2-4ubuntu1) hardy; urgency=low + + * Merge from debian unstable (LP: #151974), remaining changes: + - Change maintainer address. + - Drop lesstif-dev from Build-Depends. + - Comment out GLw libs from control. + - Add lpia to -dri and -dri-dbg package in debian/control. + - Add lpia to ARCH_X86 in configs/debian-dri-default. + - Add 101_ubuntu_hidden_glname.patch + - Add 102_ubuntu_no_glw.patch + + -- Timo Aaltonen Tue, 29 Jan 2008 12:09:30 +0200 + +mesa (7.0.2-4) unstable; urgency=low + + * Update to mesa_7_0_branch head (commit 48ae5cf0). + * Add Vcs-Git, Vcs-Browser and Homepage fields in debian/control. + + -- Julien Cristau Thu, 17 Jan 2008 22:23:06 +0100 + +mesa (7.0.2-3ubuntu1) hardy; urgency=low + + * Merge from debian unstable, remaining changes: + - Change maintainer address. + - Drop lesstif-dev from Build-Depends. + - Comment out GLw libs from control. + - Add lpia to -dri and -dri-dbg package in debian/control. + - Add lpia to ARCH_X86 in configs/debian-dri-default. + - Add 101_ubuntu_hidden_glname.patch + - Add 102_ubuntu_no_glw.patch + * debian/control: Do not build-depend on gcc-3.4 anymore. + * Drop 110_ubuntu_use_gcc-3.4_for_i965.patch + + -- Timo Aaltonen Sat, 05 Jan 2008 00:45:31 +0200 + +mesa (7.0.2-3) unstable; urgency=low + + * Update to mesa_7_0_branch head (commit 0107acde). + * Bump Standards-Version to 3.7.3. + * Move libgl1-mesa-swx11-dbg, mesa-common-dev and libosmesa6-dev to section + libdevel. + * libgl1-mesa-swx11 conflicts with libgl1-mesa-glx. Move it and + libgl1-mesa-swx11-dev to priority extra. + * Fix typo in mesa-common-dev's long description. + + -- Julien Cristau Tue, 18 Dec 2007 19:13:18 +0100 + +mesa (7.0.2-2ubuntu1) hardy; urgency=low + + * Merge from debian unstable, remaining changes: + - Change maintainer address. + - Add gcc-3.4 as a build dependency for amd64, i386 and lpia. + - Drop lesstif-dev from Build-Depends. + - Comment out GLw libs from control. + - Add lpia to -dri and -dri-dbg package in debian/control. + - Add lpia to ARCH_X86 in configs/debian-dri-default. + - Add 101_ubuntu_hidden_glname.patch + - Add 102_ubuntu_no_glw.patch + - Add 110_ubuntu_use_gcc-3.4_for_i965.patch + + -- Timo Aaltonen Fri, 16 Nov 2007 09:00:24 +0200 + +mesa (7.0.2-2) unstable; urgency=low + + [ Julien Cristau ] + * Don't set -fno-strict-aliasing in configs/debian-default. It is set + upstream now. + * Workaround gcc ICE on hppa: build libOSMesa with -O0 (see bug#451047). + * Add build-dep on libxext-dev. Thanks, Timo Aaltonen! + + -- Brice Goglin Tue, 13 Nov 2007 21:43:40 +0100 + +mesa (7.0.2-1ubuntu2) hardy; urgency=low + + * Add libxext-dev to Build-Depends. + + -- Timo Aaltonen Mon, 12 Nov 2007 14:50:38 +0200 + +mesa (7.0.2-1ubuntu1) hardy; urgency=low + + * Merge from debian unstable, remaining changes: + - Change maintainer address. + - Add gcc-3.4 as a build dependency for amd64, i386 and lpia. + - Drop lesstif-dev from Build-Depends. + - Comment out GLw libs from control. + - Add lpia to -dri and -dri-dbg package in debian/control. + - Add lpia to ARCH_X86 in configs/debian-dri-default. + - Add 101_ubuntu_hidden_glname.patch + - Add 102_ubuntu_no_glw.patch + - Add 110_ubuntu_use_gcc-3.4_for_i965.patch + + -- Timo Aaltonen Mon, 12 Nov 2007 12:55:33 +0200 + +mesa (7.0.2-1) unstable; urgency=low + + * New upstream release. + + Fix Blender crash in triangle_twoside(), closes: #439668, #446315. + + Fix crash in _generic_read_RGBA_span_RGB565_MMX(), closes: #445313. + + Fix the new __gluInvertMatrix() function, closes: #440137 ,#441071. + + Refresh 03_optional-progs-and-install.patch since libGLU is not + built when building progs/xdemos. + + Refresh 04_cleanup-osmesa-configs.patch. + + Drop 05_static-nonpic.patch,, applied upstream. + + Remove DESTDIR from INSTALL_DIR in configs/debian-default since + the upstream Makefiles now support DESTDIR. + * Add myself to Uploaders. + + -- Brice Goglin Sun, 11 Nov 2007 11:53:26 +0100 + +mesa (7.0.1-2) unstable; urgency=low + + * Update to latest git (from mesa_7_0_branch) + + adds support for some new intel chipsets (i915 and i915_tex dri drivers) + (closes: #437333) + + broken inline asm in dri drivers fixed (closes: #423739) + + -- Julien Cristau Tue, 28 Aug 2007 12:11:30 +0200 + +mesa (7.0.1-1ubuntu3) gutsy; urgency=low + + * Add lpia to -dri and -dri-dbg package in debian/control. + * Add lpa top ARCH_X86 in configs/debian-dri-default. + + -- Tollef Fog Heen Fri, 12 Oct 2007 14:12:21 +0200 + +mesa (7.0.1-1ubuntu2) gutsy; urgency=low + + * Add fix-965-vblank.patch, pulled from upstream + b3fc9a1585f390274fa26b3e3f80bc6d16f4388a which fixes missed vbl + interrupts on Intel i965 hardware. + + -- Kyle McMartin Wed, 3 Oct 2007 11:11:22 -0400 + +mesa (7.0.1-1ubuntu1) gutsy; urgency=low + + * Merge from debian unstable, remaining changes: + - Change maintainer to Ubuntu + - Add gcc-3.4 as a build dependency for lpia. + - Add support for Intel 945GME, G33, Q33, Q35 + + 200_945gme.patch, upstream a74eec5af5397b612d60dd4b0d81666027f19bb0, + ad6351a994fd14af9d07da4f06837a7f9b9d0de4 + + 201_g33.patch, upstream 8331d9d7aa7cde7126d38d4e1eb5fe8a168077f3 + - Comment out GLw libs from control file + - Dropped Ubuntu addition of conflicts of libgl1-mesa-glx against + libgl1-mesa-swx11, since Debian has hadded a shlibs file for + libgl1-mesa-swx11-i686 + + -- Bryce Harrington Wed, 15 Aug 2007 15:08:32 -0700 + +mesa (7.0.1-1) unstable; urgency=low + + * New upstream release. + * Upload to unstable. + + -- Julien Cristau Thu, 09 Aug 2007 11:56:16 +0200 + +mesa (7.0.1~rc2-1) experimental; urgency=low + + [ David Nusinow ] + * New upstream release candidate + * Bite the bullet and add myself to uploaders + + [ Julien Cristau ] + * Modify the short descriptions of various packages so they fit in .changes + files without being cut off. Thanks, Marc 'HE' Brockschmidt! + * Add a shlibs file for libgl1-mesa-swx11-i686. + + -- Julien Cristau Fri, 27 Jul 2007 20:17:48 +0200 + +mesa (7.0.0-0ubuntu3) gutsy; urgency=low + + * Add gcc-3.4 as a build dependency for lpia. + + -- Matthias Klose Tue, 07 Aug 2007 17:15:37 +0000 + +mesa (7.0.0-0ubuntu2) gutsy; urgency=low + + [ Kyle McMartin ] + * Add support for Intel 945GME, G33, Q33, Q35 + - 200_945gme.patch, upstream a74eec5af5397b612d60dd4b0d81666027f19bb0, + ad6351a994fd14af9d07da4f06837a7f9b9d0de4 + - 201_g33.patch, upstream 8331d9d7aa7cde7126d38d4e1eb5fe8a168077f3 + + -- Kyle McMartin Tue, 03 Jul 2007 19:32:39 +0000 + +mesa (7.0.0-0ubuntu1) gutsy; urgency=low + + [ Bryce Harrington ] + * New upstream release + - Adds OpenGL 2.0 and 2.1 API support. + - Fixed a few fog-related bugs. + - Fixed broken GLSL mix() function. + - Fixed broken GLSL exp() functions. + - Fixed GLSL mod4(vec4, vec4) bug. + - Implemented GLSL asin(), acos(), atan() functions. + - Fixed an R300 driver bug that caused Xorg composite manager to + crash + - Fixed R300 vertex program/matrix bug (fdo# 10848) + - GLSL dFdx() and dFdy() work for fragment program inputs now + (texcoords) + - Fixed potential crash when specifying an invalid texture unit as a + sampler + - Fixed incorrect GLX protocol request for glXDestroyPBuffer() + (fdo# 10983) + - ARB vp state.light[n].half value was incorrect (fdo# 10987) + - Fixed a positional light source bug (fdo# 11009) + - Fixed point size attenuation problem (fdo# 11042) + - Fixed problem where glPopAttrib didn't restore texture object's + LOD bias (fdo# 11049) + - Fixed a TLS / TEXTREL problem (fdo# 7459) + - Some texture code consolidation and simplifiction + - R300 driver clean-ups. + + [ Sarah Hobbs ] + * Added a conflicts of libgl1-mesa-glx against libgl1-mesa-swx11, and vice + versa + + -- Sarah Hobbs Tue, 26 Jun 2007 15:32:00 +1000 + +mesa (6.5.3-1ubuntu1) gutsy; urgency=low + + * Update Maintainer for Ubuntu + + [ Kyle McMartin ] + * Merge with Debian experimental: + - Remove lesstif-dev from Build-Depends (Timo Aaltonen) + - Comment out GLw libs from control file + - Add 102_ubuntu_no_glw.patch to remove lesstif build depends + - Add libxext-dev to Build-Depends (Paul Sladen) + - Add gcc-3.4 [i386 amd64] to Build-Depends (Ben Collins) + - Add 110_ubuntu_use_gcc-3.4_for_i965.patch (Timo Aaltonen) + - Add 101_ubuntu_hidden_glname.patch + - Add 112_fedora-hush-synthetic-visual-warning.patch (Adam Jackson) + + * Dropped patches: + - 103_ubuntu_fd.org-9686-fog.patch merged upstream + - 104_r300_call_radeonsetcliprects.patch merged upstream + - 105_radeon_call_radeonsetcliprects.patch merged upstream + - 106_r200_call_radeonsetcliprects.patch merged upstream + - 107_r200_simplify_r200setcliprects.patch merged upstream + - 111_unichrome_remove_xdrawoffset.patch merged upstream + + -- Kyle McMartin Fri, 25 May 2007 16:43:31 +0000 + +mesa (6.5.3-1) experimental; urgency=low + + [ David Nusinow ] + * New upstream release + + [ Julien Cristau ] + * Cherry-pick commit 65faf023679988f93da82b4c7ebdc689f2094459 by Michel + Dänzer to fix r300 crash. + + -- Julien Cristau Mon, 21 May 2007 11:34:51 +0200 + +mesa (6.5.3~rc3-1) experimental; urgency=low + + [ Brice Goglin ] + * Split out libGLw libs and headers from libgl1-mesa-swx11 and ship both + static and shared libraries, creating libglw1-mesa and libglw1-mesa-dev + (closes: #374904). + + [ Julien Cristau ] + * New upstream release candidate. + + 06_fix_texture_data_corruption.patch, + 07_call_radeonSetCliprects_from_radeonMakeCurrent.patch, + 08_r300_update_window_state_when_bound_but_stamp_changed.patch, + 09_i915_always_enable_pixel_fog.patch: remove, included upstream. + + 01_fix-makefile.patch, 02_use-ieee-fp-on-s390-and-m68k.patch: refresh. + * Add build-dependencies on libxdamage-dev and libxfixes-dev. + * Resync debian/scripts/install-source.sh. + * Build mesa-swx11-source only in binary-indep. + * Update from upstream git (commit + dee1b0d5bbe91f83854813cbbcd3090327bcb5c2). + + -- Julien Cristau Wed, 25 Apr 2007 10:36:50 +0200 + +mesa (6.5.2-7) unstable; urgency=low + + [ Brice Goglin ] + * libgl1-mesa-dev does not need to depend on libgl1-mesa-dri, + libgl1-mesa-glx is enough (since their split in 6.4.1-0.1); + closes: #432081. Thanks, Samuel Thibault! + + [ Julien Cristau ] + * libgl1-mesa-dev Depends on libgl1-mesa-glx (>= ${source:Upstream-Version}) + instead of >= ${Source-Version}. This way it's still installable on + architectures where mesa isn't built yet when a minor revision is + uploaded. + + -- Julien Cristau Wed, 11 Jul 2007 05:50:45 +0200 + +mesa (6.5.2-6) unstable; urgency=low + + * libgl1-mesa-swx11 needs to depend on libosmesa6 (>= 6.5.2-1) because + it used to contain libOSMesa.so.6. This means that programs linked + against this lib got a dependency on -swx11 which was broken since + 6.5.2-1. + * Fix build on hurd-i386 (build libgl1-mesa-glx without dri support and + don't build the dri drivers); closes: #420403. Thanks, Samuel Thibault! + + -- Julien Cristau Thu, 05 Jul 2007 00:56:35 +0200 + +mesa (6.5.2-5) unstable; urgency=low + + [ Brice Goglin ] + * Add 07_call_radeonSetCliprects_from_radeonMakeCurrent.patch + (closes: #420164). Thanks to Christian Ohm. + * Add 08_r300_update_window_state_when_bound_but_stamp_changed.patch + * Add 09_i915_always_enable_pixel_fog.patch + + -- Julien Cristau Fri, 18 May 2007 13:36:25 +0200 + +mesa (6.5.2-4) unstable; urgency=low + + [ Julien Cristau ] + * debian/control: libgl1-mesa-dri now suggests libglide3, with an + explanation in the description (closes: #387339). + * Upload to unstable. + + [ Brice Goglin ] + * Add 06_fix_texture_data_corruption.patch (closes: #412346). + + -- Julien Cristau Fri, 20 Apr 2007 05:57:35 +0200 + +mesa (6.5.2-3) experimental; urgency=low + + * Set LIB_DIR and EXTRA_LIB_PATH in configs/debian-default to override + settings in configs/linux-x86-64. This fixes a FTBFS on amd64, thanks to + Marc 'HE' Brockschmidt for the report (closes: #410118). + + -- Julien Cristau Wed, 7 Feb 2007 23:04:28 +0100 + +mesa (6.5.2-2) experimental; urgency=low + + * Sync Section/Priority for all packages with the override. + * Build the arch:all debs in binary-indep, and use the debhelper -s option + for commands in binary-arch, to fix FTBFS on non-i386 archs, thanks to + Marc 'HE' Brockschmidt (closes: #409638). + * Add myself to Uploaders. + + -- Julien Cristau Sun, 4 Feb 2007 21:14:02 +0100 + +mesa (6.5.2-1) experimental; urgency=low + + [ Thierry Reding ] + * New upstream release. + * Set the Debian X Strike Force as maintainer. + * Add myself to uploaders. + * Build the i915tex DRI module on the i386 and amd64 architectures. + * Add patch 04_cleanup-osmesa-configs that makes the OSMesa configurations + behave as expected. + * Add patch 05_static-nonpic to build static libraries without -fPIC. + * Make debugging symbol packages depend on the corresponding binary package + and put them into the libdevel section. + * Bump shlibs file for the libosmesa6 package to account for added symbols. + Thanks Julien Cristau. + * Build the DRI modules with the default optimization flags. Thanks Julien + Cristau. + * mesa-common-dev now ships the GLX header files so it needs to replace + libgl1-mesa-swx11-dev and libgl1-mesa-dev. Thanks Julien Cristau. + * All OSMesa libraries were moved to the libosmesa6 and libosmesa6-dev + package, so have them replace libgl1-mesa-swx11, libgl1-mesa-swx11-dev and + mesa-common-dev respectively. Thanks Julien Cristau. + + [ Julien Cristau ] + * Drop obsolete depends on xlibs. + + -- Thierry Reding Thu, 11 Jan 2007 15:06:52 +0100 + +mesa (6.5.2~rc3-0.1) experimental; urgency=low + + * Non-maintainer upload. + * Update to latest upstream release candidate. + + -- Thierry Reding Fri, 1 Dec 2006 01:06:28 +0100 + +mesa (6.5.2~rc2-0.1) experimental; urgency=low + + * Non-maintainer upload. + * New upstream release candidate: + + Refresh 02_use-ieee-fp-on-s390-and-m68k.patch. + * Add manual pages for the glxdemo, glxgears, glxheads and glxinfo + utilities (Closes: #385463). + + -- Thierry Reding Wed, 22 Nov 2006 20:49:06 +0100 + +mesa (6.5.2~rc1-0.1) experimental; urgency=low + + * Non-maintainer upload. + * New upstream release candidate. + * Update patches: + + Drop hunk #2 of 01_fix-makefile.patch, applied upstream. + + Drop 03_handle-sync-and-dont-unlock-display.patch, applied upstream. + * Bump build-dependency on libdrm-dev (>= 2.2.0). + * Use the new upstream minstall utility to install files and directories. + Using /usr/bin/install would result in a symlink's target being copied + instead of the symlink. + + -- Thierry Reding Sat, 18 Nov 2006 22:23:04 +0100 + +mesa (6.5.1-0.6) experimental; urgency=low + + * Non-maintainer upload. + * Rewrote the debian/rules file to make it easier to understand. + * Provide i686 optimized versions in libgl1-mesa-swx11-i686 instead of in + libgl1-mesa-swx11. + * Statically link libOSMesa with the software rasterization code from libGL + so that it works independently of the installed libGL. (Closes: #387706) + * Make libosmesa6-dev depend on mesa-common-dev because it only needs the + gl.h header file and no libGL anymore. + * Move glx*.h headers from libgl1-mesa(-swx11)-dev into mesa-common-dev + because both packages provide identical files. + * Add debugging symbol packages for libgl1-mesa-swx11, libgl1-mesa-glx and + libgl1-mesa-dri. + * Repack the contents of the three Mesa tarballs (MesaDemos, MesaGLUT and + MesaLib) as the original source tarball. (Closes: #392715) + * Make mesa-common-dev depend on libx11-dev. + * Provide a new package: mesa-utils. These utilities are shipped in the + MesaDemos package so mesa is the right package to provide them. + + -- Thierry Reding Sat, 18 Nov 2006 18:50:07 +0100 + +mesa (6.5.1-0.5) unstable; urgency=low + + * Non-maintainer upload. + * Build with -fno-strict-aliasing to fix misbuild of i965_dri.so + (closes: #394311). Thanks to Michel Dänzer for the fix, and to Ryan + Richter for the report and testing. + + -- Julien Cristau Wed, 3 Jan 2007 13:48:20 +0100 + +mesa (6.5.1-0.4) unstable; urgency=medium + + * Non-maintainer upload (and brown paper bag release). + * _Depend_ on libx11-dev from libgl1-mesa-dev; revert previous change. + Fixes FTBFS in other packages. (Really Closes: #396498) + + -- Steinar H. Gunderson Sat, 11 Nov 2006 13:55:20 +0100 + +mesa (6.5.1-0.3) unstable; urgency=medium + + * Non-maintainer upload. + * Build-depend on libx11-dev; fixes FTBFS. (Closes: #396498) + + -- Steinar H. Gunderson Wed, 8 Nov 2006 20:58:40 +0100 + +mesa (6.5.1-0.2) unstable; urgency=low + + * Non-maintainer upload + * Disable generation of SSE instructions (closes: #390560) + * Remove duplicate and unused build configurations + * Remove extra source files left from CVS snapshots (closes: #389283) + * Enable i965 DRI driver on i386 and amd64. Thanks to Ryan Richter + for the patch. (closes: #392030) + * Enable Unichrome DRI driver on amd64 (closes: #391900) + * Enable FFB DRI driver on sparc, not i386 (closes: #388025) + * Consistently compile C sources as C99 (closes: #373623) + * Fix X display locking error in GLX. Thanks to Josh Triplett for + the patch. (closes: #391681) + + -- Ben Hutchings Fri, 13 Oct 2006 02:25:52 +0100 + +mesa (6.5.1-0.1) unstable; urgency=low + + * New upstream version + * Build-dep on x11proto-gl-dev >= 1.4.8 + * Stuff not in the upstream tarballs + + os2 glut stuff + + docs/gears.png + * Bump libdrm-dev build-dep to >= 2.0.2 + * Add libdrm cflags to the debian-dri config. This allows the build system + to find drm.h + * Make sure that libGl looks for the dri drivers in the proper location. Do + this by setting the appropriate variables in the debian config + * Re-add s390 and m68k to the USE_IEEE test in src/mesa/main/imports.h. This + package seriously needs to store patches somewhere that are easy to find + and re-apply. + * Add patch from Cyril Brulebois to allow package to build on HURD, which + lacks DRI and directfb. This includes not using lib-directfb in the + build-depends for hurd-i386. It also creates a new debian config, + debian-indirect, which is used when building for HURD. This config is + invoked in the debian-dri config on hurd-i386. Thanks to Cyril Brulebois + for the patch, Michael Banck, Michel Dänzer, and Samuel Thibault for + input on an appropriate fix. (closes: #358065) + + -- David Nusinow Mon, 25 Sep 2006 21:21:47 -0400 + +mesa (6.5.0.cvs.20060524-1.1) unstable; urgency=medium + + * Non-maintainer upload. + * Upload mesa 6.5 cvs to unstable, because we need it for Xorg 7.1. + * Upload with medium urgency instead of high, since this is a new + upstream that should get some testing in unstable in spite of the + multiple RC bugfixes. + * Update debian/copyright with the full text of the SGI Free B and SGI + MIT-style licenses in use in the package, and take a stab at + cleaning up the list of paths and licenses. + Closes: #368562. + * Make mesa-common-dev Replaces: xlibosmesa-dev from sarge. + Closes: #384057. + * Fix libgl1-mesa-glx to not Provides: libgl1-mesa-dri, since it + definitely doesn't provide DRI support and this Provides: breaks + upgrades from sarge. Closes: #384282. + * debian/libgl1-mesa-swx11.shlibs: create a static shlibs file, + because libOSMesa.so.6 is not provided by all implementations of + libGL and so needs a separate shlibs declaration. Also make + libgl1-mesa-glx the default alternative instead of libgl1-mesa-swx11 + for consistency even when building against libgl1-mesa-swx11, + because to the extent these are interchangeable (i.e., 99%...), + there should be no reason to prefer one over the other -- and to the + extent that they aren't interchangeable, it's wrong to list libgl1 + as an alternative dependency at all. Closes: #386185. + * Don't provide shlibs at all for libgl1-mesa-swx11-dbg; this is an + unnecessary duplication of the existing libgl1-mesa-swx11 shlibs + since packages should not really be linking against /usr/lib/debug/ + separately. + * src/mesa/tnl/t_vb_render.c: Drop a pointless printf() in the + RENDER_LINE macro, getting rid of copious debug output on console. + Closes: #369895. + * libgl1-mesa-swx11 has no reason to depend on libglu, anything that + wants libglu will have its own dependency on it; drop this + hard-coded dependency from debian/control. + * Have libglu1-mesa-dev Provides: xlibmesa-glu-dev, since it's the + successor to that package and xlibmesa-glu-dev is still referenced + in a number of places and this makes for more reliable builds than + depending on alternatives without requiring another dummy -dev + package from xorg. + * Replace references to Source-Version in debian/control with either + binary:Version or source:Version, depending on whether the + relationship references an arch: any or arch: all package, making + mesa binNMU-safe; add build-depends on dpkg-dev (>= 1.13.19) to + ensure these substvars are available. + + -- Steve Langasek Fri, 15 Sep 2006 15:51:16 -0700 + +mesa (6.5.0.cvs.20060524-1) experimental; urgency=low + + * The "-O666 -fwater-c00ling -DBE_F4ST" release + * New pull from CVS + * Merge back and forth with 6.4.2-1 + * configs/debian*_i386: disabled, optimized build fuxxored. + + -- Marcelo E. Magallon Wed, 24 May 2006 14:12:13 -0600 + +mesa (6.5.0.cvs.20060512-0.0.1) experimental; urgency=low + + * New upstream release (6.5.0) + * Pulled CVS as of 2006-05-12 + * debian/control: remove DirectFB packages + + -- Marcelo E. Magallon Fri, 12 May 2006 15:23:49 -0600 + +mesa (6.4.2-1) unstable; urgency=low + + * The "please, please, please don't hate me" release. + * New upstream release. + * Ack NMUs + * debian/control: mesa-common-dev Replaces xlibmesa-gl-dev (<< 1:7) + AGAINST MY BETTER JUDGEMENT. The problem here is gratuitous package + renames within a system that does not support them. (closes: + bug#362063) + * debian/control: hurd-i386 doesn't have drm. Doesn't fix #358065, + yet. + * bin/mklib: fix from Robert Millan to support hurd-i386 and + GNU/kFreeBSD. Thanks Robert. (closes: bug#358066) + * src/glx/x11/indirect_vertex_array.c, src/mesa/main/glheader.h, + src/mesa/drivers/dri/common/glcontextmodes.c: fix broken indirect + rendering on 64-bit platforms. Thanks Aaron M. Ucko. (closes: + bug#364228) + * debian/control: b-d on x11proto-gl-dev. Please don't hate me! + * debian/control: Standards-Version: 3.7.2 + * debian/rules: export DEB_HOST_ARCH + * configs/debian-dri: use DEB_HOST_ARCH to decide if certain DRI drivers + should be built or not. + + Built only for i386: i810 i830 sis. + Rationale: integrated chipsets available only for i386 processors. + + Built only for i386: ffb. + Rationale: Michel Dänzer said so, no idea why. + + Built only for i386, amd64: i915. + Rationale: Apparently this is available in the 64-bit Intel chipset. + Please file a bug report stating which drivers should be included/excluded + for which architectures. Positive lists are preferred. If possible state + why. + * debian/mesa-swx11-source.install: nuke this abomination. Dinamically + generate the list at build time. + * debian/drivers.map: add gl-debian-dri_i386 + * debian/README.build: updated, add big friendly letters in short sentences. + Perhaps I can read it myself this way... + * debian/rules, configs/debian, configs/debian-dri, configs/debian_i386, + configs/debian-dri_i386, debian/libdir.map, debian/drivers.map: hack in + support for variable driver's dir. If you want this for your pet + architecture please provide BOTH configs/debian_arch and + configs/debian-dri_arch. If you just want to include/exclude DRI drivers + on your architecture look in configs/debian-dri. + * configs/debian*_i386: disabled, optimized build fuxxored. + * debian/rules: remove misguided Perl construct, replace by something + simpler in shell. I actually meant to do something else with the Perl + thing, but got distracted and forgot about it. Thanks Aaron M. Ucko! + * debian/rules: make it work like debian/README.build says it works wrt to + building optimized targets. + + -- Marcelo E. Magallon Tue, 16 May 2006 18:07:53 -0600 + +mesa (6.4.1-0.4) unstable; urgency=low + + * NMU + * Add versioned conflict between libgl1-mesa-dri and xlibmesa-dri so that + the xlibmesa-dri transitional upgrade package works + + -- David Nusinow Mon, 6 Mar 2006 21:46:18 -0500 + +mesa (6.4.1-0.3) unstable; urgency=low + + * NMU + * Add s390 and m68k to the USE_IEEE test in src/mesa/main/imports.h. + (closes: #349437) + + -- David Nusinow Sat, 11 Feb 2006 17:59:26 -0500 + +mesa (6.4.1-0.2) unstable; urgency=low + + * NMU + * Re-add dh_installdirs call to binary-indep target so that we get + arch-specific dirs for the mesa-swx11-source package + * Remove makedepend from build-depends. Now we'll just build-dep on xutils + to get the app, which will translate over to our own xorg 7.0 plans. + + -- David Nusinow Tue, 31 Jan 2006 19:21:12 -0500 + +mesa (6.4.1-0.1) unstable; urgency=low + + [ Marcelo E. Magallon ] + * debian/control: build-depend on xutils + * include/GL/glx{int,proto,md,tokens}.h: missing upstream (closes: bug#326466) + * debian/libgl1-mesa-dri-dev.install: install GLX include files here, too. + * debian/rules: GLU and GLW don't have arch-specific targets. + + [ Daniel Stone ] + * New upstream version, incorporating changes from Ubuntu 6.3 packaging. + * Rename packages: + - mesag3 -> libgl1-mesa-swrast + - mesag-dev -> libgl1-mesa-swrast-dev + - libgl1-mesa-dri -> libgl1-mesa + - libgl1-mesa-dri-dev -> libgl1-mesa-dev + - libgl1-mesa-dri still exists, but now contains the DRI modules only. + * Drop dependency *from* mesa-common-dev on libgl1-mesa-dev and + libglu1-mesa-dev; it should be the other way around. (closes: #336565) + * Add Build-Depends on pkg-config to get flags from libdrm, and libexpat-dev + for DRI configuration. Break out xlibs-dev Build-Depends to the + individual libraries required. + * Bump libdrm-dev Build-Depends to >> 1.0.5, in order to get new + via_drm.h to build the unichrome DRI driver. + * Configs: pare DRI drivers down to a sensible set for each architecture. + * Remove completely broken Glide target, which caused FTBFS. + * Add mesa-swrast-source package, providing the source for the software + rasteriser for libGLcore in the X server. + * Drop tight libosmesa6 -> libgl1-mesa-swrast Depends, replace with + shlibs:Depends. + + [ David Nusinow ] + * New upstream version (6.4.1) (closes: #232665) + * Merge changes from Ubuntu version 6.4.1-0ubuntu1. + (closes: #341479, #340168, #334742) + + Add new files required by xorg-server GL build to mesa-swrast-source. + * NMU to begin getting Xorg 7.0 in to Debian + * Change libgl1-mesa-swrast Depends on libx11-6-dev to libx11-dev. + * Change libgl1-mesa-swrast to be named libgl1-mesa-swx11 + * Change libgl1-mesa to be named libgl1-mesa-glx + * mesa-swrast-src.install stop looking for the swx11 dir and look for swrast + + -- David Nusinow Sat, 21 Jan 2006 21:43:37 -0500 + +mesa (6.3.2-2.1) unstable; urgency=low + + * Non-maintainer upload. + * Adjust Build-Depends: + + xlibs transition (Closes: #347129). + + xutils, xlibmesa-gl-dev (Closes: #326466). + * mesag-dev: Depends: libx11-dev (Closes: #347205). + + -- Christoph Berg Fri, 20 Jan 2006 20:45:43 +0100 + +mesa (6.3.2-2) unstable; urgency=low + + * debian/rules: build only whatever needs to be build according to + debian/control. + * debian/libdir.map: it's usr/lib/debug not usr/lib/dbg + * debian/rules: select optimized targets for the current host architecture + only (thanks Michel!) + * debian/README.build: reword some of the directions, add more info. + * debian/control: forgot to add CPR relationships in the new packages + (thanks Michel!) + * debian/control: Set maintainer to pkg-mesa-devel, add myself as uploader + + -- Marcelo E. Magallon Sun, 28 Aug 2005 14:41:15 -0600 + +mesa (6.3.2-1) unstable; urgency=low + + * New upstream + * configs/debian-dri: new target + * debian/control: add build-depends on libdrm-dev + * debian/rules: pass SRC_DIRS instead of SUBDIRS on the command line. + This allows for configurations to override the command line in a + sane way. + * configs/debian-dri: override SRC_DIRS + * configs/debian: add -D_GNU_SOURCE (required by dri drivers) + * debian/control, debian/rules: drop glide out of this package, it + will be moved to the mesa-legacy package, forked from 6.2.1-7. + * debian/drivers.map, debian/rules: take into account that some + drivers have external components. + + To be fixed: debian/drivers.map hardcodes locations + * debian/control: libgl1-mesa-dri, libgl1-mesa-directfb: new drivers + * dh_makeshlibs for libgl1-mesa-dri and libgl1-mesa-directfb + * debian/control: priority is optional... again... + + -- Marcelo E. Magallon Sun, 21 Aug 2005 17:13:19 -0600 + +mesa (6.2.1-7) unstable; urgency=low + + * Previous upload got lost somewhere + + bin/mklib: add GNU/kFreeBSD, patch from Aurelien Jarno (closes: + bug#307154) + + recompile with newer g++ + + -- Marcelo E. Magallon Tue, 02 Aug 2005 06:47:20 -0600 + +mesa (6.2.1-6) unstable; urgency=low + + * bin/mklib: add GNU/kFreeBSD, patch from Aurelien Jarno (closes: + bug#307154) + * recompile with newer g++ + + -- Marcelo E. Magallon Sun, 24 Jul 2005 11:47:16 -0600 + +mesa (6.2.1-5) unstable; urgency=low + + * debian/rules: big mess up, files are not being moved to their proper + places. I naively assumed that command-line options to debhelper + commands would override DH_OPTIONS, that is, that having + DH_OPTIONS=-i (as suggested in the documentation) would mean + something like "use -i unless -p is passed on the command line". It + actually means "use -i in addition to -p passed on the command + line", which does not make any sense, but is consistent with the + wording in the documentation. (closes: bug#306499, bug#306918, + bug#307095) + + -- Marcelo E. Magallon Sun, 01 May 2005 09:45:12 -0600 + +mesa (6.2.1-4) unstable; urgency=low + + * debian/control: fix description to reflect the exact content and + purpose of package (libosmesa-dev, mesag-dev). + * debian/rules: DH_OPTIONS=-s added to binary-arch target. (closes: + bug#306091) + + -- Marcelo E. Magallon Sat, 26 Mar 2005 08:03:44 -0600 + +mesa (6.2.1-3) unstable; urgency=low + + * debian/control: try to match the override file. If mesa is "extra" + (for whatever reason), all the packages should be extra. + * debian/rules: quick workaround for left-over libGL.so in GLU -dev + package. + + -- Marcelo E. Magallon Thu, 24 Mar 2005 19:35:34 -0600 + +mesa (6.2.1-2) unstable; urgency=low + + * The "thank you so much, I'm still voting against you" release. + * debian/rules: correct artifact of me not having had a proper + pbuilder environment to build stuff on and the repackaging from the + previous release. The -glu- and -glw- targets now explicitly depend + on the matching -gl- target, and symlinks are placed in the build + directories in order to actually have a libGL.so to make ld happy + when creating the libraries. + * debian/rules: uncomment dh_install :-\ There was a reason why I had + commented that out... + * First change closes: bug#298922 + * Second change closes: bug#300302, bug#300284, bug#300430 + * debian/control: "An X", whatever, I've been corrected multiple times + in both ways (translators beware). (closes: bug#300012) + + -- Marcelo E. Magallon Sun, 20 Mar 2005 22:03:29 -0600 + +mesa (6.2.1-1) unstable; urgency=low + + * The "autobuilders, please please please don't hate me" release. + * New upstream. + * Repackage: + + Fall prey to debhelper + + Entries below this one preserved for historical reasons or + sentimental value, pick as many as you want. They bear NO + relation to the actual packages! + * configs/debian, configs/debian-debug, configs/debian-debug-i386, + configs/debian-glide, configs/debian-glide-i386, configs/debian-i386, + configs/debian-osmesa16, configs/debian-osmesa16-static, + configs/debian-osmesa32, configs/debian-osmesa32-static, + configs/debian-static, configs/debian-static-i386: new files. + * configs/debian-sparc: Dave Miller confirmed that the sparc assembly + files do work on Linux. I don't know where to install the optimized + libraries, so the file doesn't actually exist. Please read + debian/README.build if you want to have a sparc-optimized library. + * debian/control: GGI and glide2 are gone. glide is glide3. + * debian/rules: modify shlibs file for the glide3 target to require glide3 + and only glide3 because that library exports functions not available in + other libGLs. Rationale: if someone is compiling a Debian package and + uses the glide target either he doesn't know what he is doing or he knows + exactly what he is doing. In the first case the package should not be + installable and in the second case the package requires this particular + version. + * debian/control: libgl1-mesa-glide3-dev does NOT provide a proper OpenGL + development environment (see above). + * PCR is bound to be wrong... *sigh* + + -- Marcelo E. Magallon Sat, 25 Dec 2004 14:50:02 -0600 + +mesa (6.0.1-1) unstable; urgency=low + + * New upstream release. + * debian/rules: redid a bunch of stuff in order to support new build system + without autoconf and automake stuff. The next version is going to change + this _again_. + + -- Marcelo E. Magallon Sun, 11 Apr 2004 07:00:19 -0600 + +mesa (5.0.0-5.1) unstable; urgency=low + + * Non-Maintainer Upload. + * Rename "GGIMesa"-references in src/GGI/default/Makefile.am to + "MesaGGI", which makes the package build again with newer libtool. + (Closes: #213836) + + -- Steinar H. Gunderson Sun, 15 Feb 2004 17:37:08 +0100 + +mesa (5.0.0-5) unstable; urgency=low + + * debian/control: yank and put error? Remove hard-coded + nvidia-glx-dev from mesag-glide2-dev dependencies. + + -- Marcelo E. Magallon Sun, 09 Feb 2003 10:31:51 +0100 + +mesa (5.0.0-4) unstable; urgency=low + + * debian/rules: fix typo in definition of GLIDE_ARCHS. (closes: bug#179622) + + -- Marcelo E. Magallon Mon, 03 Feb 2003 20:19:12 +0100 + +mesa (5.0.0-3) unstable; urgency=low + + * The "it's amazing how people pick severities" release + * debian/control: mesa-common-dev conflicts with xlibmesa-dev. Actually put + dependency of mesa-common-dev on the mesa-*-dev packages to avoid having + to track other libgl-dev packages popping up. IMO this is less error + prone. You can't install mesa-common-dev without installing mesa-*-dev, + and those packages conflict with other libgl-dev packages. (closes: + bug#177996) + * Rename libglu1c102 to libglu1-mesa; the libglu1c102 is incorrent since + this library does not export C++ functions. Sorry about the mess. + * Rename libglu1-dev to libglu1-mesa-dev to be consistent + * debian/rules: use grep-dctrl to extract architectures from debian/control + * debian/control: add grep-dctrl to build-depends + * debian/shlibs.libglu: libglu1-mesa | libglu1 + * debian/rules: install include/GL/xmesa.h in /usr/include/GL/xmesa.h; I'm + not 100% sure this is the right thing to do, but it's a niche so I don't + think it will actually make trouble (closes: bug#148866) + * debian/rules: install include/GL/glx*.h in the common package. (closes: + bug#178562) + * debian/rules: nasty hack to work arround libtool's idea of how libraries + should be linked (closes: bug#178514) + * debian/rules: even nastier hack. Getting environment variables to + percolate thru all the make calls isn't getting anywhere. + * si-glu/Makefile.am: export only glu.* symbols + * si-glu/Makefile.am: add -lm to link line + * src/Makefile.am: god damm it. If you use libm link to it! + * debian/control: mesa-common-dev depends on libglu1-mesa-dev to satisfy + libgl-dev's requirements + + -- Marcelo E. Magallon Mon, 27 Jan 2003 17:15:25 +0100 + +mesa (5.0.0-2) unstable; urgency=low + + * debian/control: Not funny, I'm sure I put lesstif and xlibs-dev in the + build-depends. CVS says I didn't. (closes: bug#176730) + * debian/control, debian/rules: regenerate auto-stuff (closes: bug#176729) + * debian/control, debian/rules: GCC C++ 3.2 transition (libglu1c102 -- ugly!) + * remove Makefile.in from CVS control + * si-glu/libnurbs/interface/Makefile.am: fix INCLUDES macro + + -- Marcelo E. Magallon Sun, 19 Jan 2003 00:48:32 +0100 + +mesa (5.0.0-1) unstable; urgency=low + + * New upstream release, it looks like glide and GGI are in working + condition again. + * FX patches from previous releases gone. They'll be back later. + * debian/rules: some clean ups. + * debian/control: add libglu1 packages + * debian/control: Standards-Version: 3.5.8 + * debian/rules: Build Xt widgets (if you need this stuff, you need to depend + on mesag-dev, libgl-dev is not enough) + * debian/control, debian/rules: add mesa-common-dev package + * debian/control, debian/rules: add osmesa packages. + + -- Marcelo E. Magallon Sun, 15 Dec 2002 12:28:49 +0100 + +mesa (4.0.3-1) unstable; urgency=low + + * New (and long delayed) upstream version + * Redid a bunch of FX patches, probably broke. + + -- Marcelo E. Magallon Thu, 03 Oct 2002 11:27:29 +0200 + +mesa (3.5-1) unstable; urgency=low + + * New upstream version. + * Redid patches. + * Disabled building GGI target. Someone with a good understanding of GGI + needs to write a driver for mesa. The old version doesn't cut it + anymore. + * Most makefiles won't work. Copied them out of CVS. + * src/Makefile.am: add -lm to library list. (closes: bug#102717) + * configure.in: adjust GLU's version info to match previous release. + + -- Marcelo E. Magallon Mon, 25 Jun 2001 22:13:40 +0200 + +mesa3 (3.4.2.1-4) unstable; urgency=low + + * So, here's the deal: the 3Dfx backend is going nowhere in 4.x and 5.x is + just arround the corner. Same thing for the GGI stuff. In order to leave + the people who need this stuff with _something_ to work with, I'll compile + those targets out of the mesa3 source package and the mesa package will + stuck to plain old X. + * debian/control, debian/rules: strip out all the parts concerning to mesa3g + and mesa3g-dev + * debian/control: update GGI architectures, let's see what happens + * debian/rules: special case alpha for stripping options. Chris, did you + ever figure out what the problem actually is? (closes: bug#99284) + * debian/rules: hereby I decree that everything in etc is a conffile. Die + future bugs, die!. + * configure: fix ggi_libdir, ggi_confdir (closes: bug#139598) + + -- Marcelo E. Magallon Sun, 29 Sep 2002 11:21:00 +0200 + +mesa (3.4.2.1-3) unstable; urgency=low + + * Actually install widgets on the mesag-dev package (closes: bug#98988) + + -- Marcelo E. Magallon Sat, 9 Jun 2001 16:39:36 +0200 + +mesa (3.4.2.1-2) unstable; urgency=low + + * src/X/xmesa1.c: I knew it, I knew it. This was bound to break. Stupid + typo. Restored MESA_GLX_FX (got renamed to GLX_FX accidentally, if you + have to know) (closes: bug#94114) + + -- Marcelo E. Magallon Mon, 21 May 2001 08:52:07 +0200 + +mesa (3.4.2.1-1) unstable; urgency=low + + * Upstream released 3.4.2. + * Hmmm... thought about it on my way home. The code to parse 3dfx.conf + is wrong. Redid. Still not tested. (closes: bug#94114) + * debian/README.Debian: document 3dfx.conf + + -- Marcelo E. Magallon Sat, 19 May 2001 11:57:33 +0200 + +mesa (3.4.2-1) unstable; urgency=low + + * New upstream version. + * debian/config.guess, debian/config.sub: newest versions from + http://subversions.gnu.org/cgi-bin/cvsweb/config (closes: bug#95338) + * GAAAAAAARGGH! src/X/xmesa1.c: horrible hack to use /etc/mesa/3dfx.conf + if there's no MESA_GLX_FX environment variable defined. I. Hate. + This. I'll make a deal with you: you find another of these things, + and you send me a nice tested patch. I don't have a 3DFX card and I + *HATE* uploading stuff I can't fully test. (closes: bug#94114) + * debian/rules: use the new files + * debian/rules: s/TMPDIR/DTEMPDIR/g + * gl3DfxSetDitherModeEXT from Zephaniah (closes: bug#65860) + * Disable GL_EXT_shared_texture_palette per default. Patch looks funny, + but I'll blindly trust Zephaniah. + * Hmmm... I hope Zephaniah tested this, because it broke in a rather silly + way at compile time. + * Fancy what people regard as "pretty important". + + -- Marcelo E. Magallon Fri, 18 May 2001 09:23:49 +0200 + +mesa (3.4.1-3) unstable; urgency=low + + * PLEASE SUBMIT NMUs TO THE BTS, DAMN IT! + * debian/control: exclude m68k from libggi2-dev build-dependency. + + -- Marcelo E. Magallon Sat, 17 Mar 2001 19:45:09 +0100 + +mesa (3.4.1-2) unstable; urgency=low + + * debian/control: add missing dependency on xlibs-dev and corrected the + one for libglide2-dev + + -- Marcelo E. Magallon Wed, 14 Mar 2001 00:21:42 +0100 + +mesa (3.4.1-1) unstable; urgency=low + + * New upstream version. + * New maintainer. (closes: bug#81139) + * Some fixes to get it to compile. + * debian/rules: some reorganization happened to allow me test different + builds better. + * debian/control: nuked widgets package, if you miss it, you are doing + something wrong. + * debian/rules: -dev packages will be missing some garbage they used to + install. If you miss any of those files, I'm fairly confident you + are doing something wrong. + * configure, ltmain.sh, aclocal.m4, acinclude.m4, ...: vicious hacks to + allow the GGI version to compile. + * TODO: add the widgets to the packages + * TODO: make OSmesa packages + + -- Marcelo E. Magallon Sat, 10 Feb 2001 18:34:13 +0100 + +mesa (3.2.1-1) unstable; urgency=low + + * New upstream version. + + -- James A. Treacy Mon, 31 Jul 2000 15:13:34 -0400 + +mesa (3.2-2) frozen unstable; urgency=low + + * add MMX and 3Dnow opts for x86. + + -- James A. Treacy Fri, 7 Jul 2000 16:06:43 -0400 + +mesa (3.2-1) frozen unstable; urgency=low + + * New upstream version. + * Made minor changes to README.3DFX. Closes bug#56827 + * Added symlinks for mesa widget libraries. Closes bug#63115 + + -- James A. Treacy Wed, 28 Jun 2000 11:21:09 -0400 + +mesa (3.1-17) frozen unstable; urgency=low + + * Fixed Makefile for demos in mesag-widgets-dev. Closes bug#62674 + + -- James A. Treacy Fri, 19 May 2000 13:23:00 -0400 + +mesa (3.1-16) frozen unstable; urgency=low + + * Add --prefix=/usr to ggi build. Closes bug#61705, #61486 + + -- James A. Treacy Wed, 12 Apr 2000 15:12:48 -0400 + +mesa (3.1-15) frozen unstable; urgency=low + + * Remove ggi from the build on m68k. Closes bug#59273 + + -- James A. Treacy Mon, 6 Mar 2000 13:20:29 -0500 + +mesa (3.1-14) frozen unstable; urgency=low + + * Fixed hard-coded location of config file in library. This is release + critical, even though no bug was filed (relates to bug#58267). + + -- James A. Treacy Mon, 28 Feb 2000 10:58:34 -0500 + +mesa (3.1-13) frozen unstable; urgency=low + + * Add missing ggi libraries. Closes bug#58267, #57760 + + -- James A. Treacy Thu, 24 Feb 2000 00:59:30 -0500 + +mesa (3.1-12) frozen unstable; urgency=low + + * Dependencies are now computed in a more intelligent way. Closes: bug#55861 + + -- James A. Treacy Fri, 21 Jan 2000 16:26:40 -0500 + +mesa (3.1-11) frozen unstable; urgency=low + + * Remove svgalib support from the software only package of mesa + + -- James A. Treacy Sat, 22 Jan 2000 05:33:13 +0000 + +mesa (3.1-10) frozen unstable; urgency=low + + * Fix the mesag3-glide2 postinst. Closes bug#55462 + + -- James A. Treacy Sat, 22 Jan 2000 02:06:27 +0000 + +mesa (3.1-9) frozen unstable; urgency=low + + * The ggi based packages are now built with the other versions of mesa. Closes: bug#49218, #55221 + + -- James A. Treacy Sat, 15 Jan 2000 22:24:13 -0500 + +mesa (3.1-8) unstable; urgency=low + + * fixed the postinst and prerm for the glide packages + * added Provides: mesag-dev to the mesag-glide2-dev package to maintain + backwards compatability + + -- James A. Treacy Sat, 15 Jan 2000 01:01:58 -0500 + +mesa (3.1-7) unstable; urgency=low + + * Fix version number for soname in the shlib file. Closes: bug#54926 + + -- James A. Treacy Thu, 13 Jan 2000 01:37:03 -0500 + +mesa (3.1-6) unstable; urgency=low + + * Include docs/README.3DFX in mesag3-glide2 package. Closes: bug#54625 + * Remove Provides: libgl1 from mesag3-widgets. Closes: bug#54774 + * conflicts with older versions of mesa. Closes: bug#54831 + + -- James A. Treacy Mon, 10 Jan 2000 11:50:49 -0500 + +mesa (3.1-5) unstable; urgency=low + + * now Conflicts: libgl1 + * remove extra '.' in library name + + -- James A. Treacy Sun, 9 Jan 2000 20:47:31 -0500 + +mesa (3.1-4) unstable; urgency=low + + * Added links libGL.so.1 <- libMesaGL.so.3 so existing progs don't break + * Copyright changed for version 3.1 + + -- James A. Treacy Thu, 6 Jan 2000 17:11:11 -0500 + +mesa (3.1-3) unstable; urgency=low + + * copyright file now refers to /usr/share/common-license/LGPL. + + -- James A. Treacy Tue, 4 Jan 2000 11:50:45 -0500 + +mesa (3.1-2) unstable; urgency=low + + * Second try. Fixed shlibs file. + + -- James A. Treacy Tue, 4 Jan 2000 00:00:29 -0500 + +mesa (3.1-1) unstable; urgency=low + + * New upstream version. + * glide version of packages added, since glide is now under the GPL. + * mesa widget libraries are now in a separate package + * library names are changed to lib{GL,GLU}.* + + -- James A. Treacy Tue, 14 Dec 1999 10:06:14 -0500 + +mesa (3.0-2) unstable; urgency=low + + * added symlinks from libMesaGL* -> libGL*. Fixes bug #37160 + * added lines (commented out) for building a glide version of mesa. Fixes bug #39758 + + -- James A. Treacy Thu, 13 May 1999 01:02:42 -0400 + +mesa (3.0-1) unstable; urgency=low + + * mesa libs moved to /usr/lib. Fixes bug #26874 + * motif widget library libMesaGLwM added (compiled using headers from lesstif). Fixes bug #25380 + + -- James A. Treacy Thu, 6 Aug 1998 13:49:37 -0400 + +mesa (2.6-4) unstable; urgency=low + + * call to ldconfig in postinst put back in. Fixes bug #20552 + * changelog.Debian file created for the mesa-doc package. + * deleted miscellaneous files. Fixes bug #21481 + + -- James A. Treacy Sat, 23 May 1998 23:41:34 -0400 + +mesa (2.6-3) frozen unstable; urgency=low + + * No changes. Just trying (again) to get this back in the distribution + + -- James A. Treacy Tue, 24 Mar 1998 00:53:09 -0500 + +mesa (2.6-2) unstable frozen; urgency=low + + * point copyright to LPGL in /usr/doc/copyright. Fixes bug #19633 + + -- James A. Treacy Sun, 15 Mar 1998 14:00:33 -0500 + +mesa (2.6-1) unstable; urgency=low + + * New upstream Release + * strip static lib with --strip-debug and shared with strip--unneeded: Fixes bug#17301 + * create doc package in build-indep: Fixes bug#16090 + * added widgets-mesa library to package: Fixes bug#15729 + * created mesa-glide* packages + + -- James A. Treacy Mon, 19 Jan 1998 23:45:50 -0500 + +mesa (2.5-2) unstable; urgency=low + + * Corrected i386 specific debian/rules file: Fixes bug#15640 + + -- James A. Treacy Fri, 5 Nov 1997 11:46:13 -0500 + +mesa (2.5-1) unstable; urgency=low + + * New upstream release. + + -- James A. Treacy Sun, 23 Nov 1997 20:46:13 -0500 + +mesa (2.4-1) unstable; urgency=low + + * New upstream release. + * New maintainer. + * libc6 release. + + -- James A. Treacy Mon, 3 Nov 1997 01:11:34 -0500 + +mesa (2.2-2) unstable; urgency=low + + * debian/control: mesa-doc no longer depends on mesa (bug #8840). + + -- Karl Sackett Wed, 30 Apr 1997 10:25:25 -0500 + +mesa (2.2-1) unstable; urgency=low + + * New upstream release. + * Make-config: linux-elf libraries compiled with -D_REENTRANT. + + -- Karl Sackett Wed, 19 Mar 1997 09:10:22 -0600 + +mesa (2.1-4) unstable; urgency=low + + * debian/control: lib packages moved from 'graphics' to 'libs'. + * debian/rules: headers moved from /usr/include/mesa to /usr/include + (no more -I/usr/include/mesa). + + -- Karl Sackett Tue, 25 Feb 1997 09:30:23 -0600 + +mesa (2.1-3) unstable; urgency=low + + * debian/control: mesa2 provides mesa and conflicts with mesa + (bug #7394). + + -- Karl Sackett Mon, 17 Feb 1997 09:25:42 -0600 + +mesa (2.1-2) unstable; urgency=low + + * debian/rules: install gmesa.h, osmesa.h, FooMesa.h in mesa-dev + (bug #6864). + + -- Karl Sackett Tue, 28 Jan 1997 09:37:41 -0600 + +mesa (2.1-1) unstable; urgency=low + + * New upstream release. + * Added soname to mesa and mesa-widgets. + * Moved static libraries to mesa2-dbg. + * debian/postinst, postinst-widgets: call ldconfig without explicit + pathname (bugs #6176, 6180). + + -- Karl Sackett Mon, 6 Jan 1997 09:30:10 -0600 + +mesa (2.0-2) unstable; urgency=low + + * Created mesa-widgets and mesa-widgets-dev (Bug #5029). + + -- Karl Sackett Wed, 30 Oct 1996 08:44:19 -0600 + +mesa (2.0-1) unstable; urgency=low + + * src/draw.c: replaced with upstream patch. + * Make-config: linux-elf target builds libMesaGLw.so library, looks + for XLIBS in /usr/X11R6/lib, removed -mieee-mp from CFLAGS. + * widgets-sgi/Makefile: builds libMesaGlw.a library + * New upstream release. + * Converted to new package standard. + * Maintainer address changed. + + -- Karl Sackett Mon, 14 Oct 1996 15:37:19 -0500 + +1.2.8-3 + * Package split into runtime, development, and documentation + packages. + * widgets now made as a sharable library. + * GLUT removed. This will be released as a separate package. + +1.2.8-2 + * Support files now architecture-independent + +1.2.8-1 + * Upgrade to latest release + * Brought support files up to latest packaging requirements + * mondello/Makefile: fixed error in realclean target + +1.2.7-2 + * debian.rules: clean all Makefiles out of widgets directory + * debian.postrm: remove /usr/lib/mesa entry from /etc/ld.so.config + (bug #2817) + +1.2.7-1 + * Added Debian support files + * Included the GLUT OpenGL Utility Toolkit + * Makefile - disable building programs in demos, samples, and book + directories + * mklib.linux - disabled building *.a libraries + * widgets/Makefile.in - disabled building demo programs diff --git a/debian/compat b/debian/compat new file mode 100644 index 0000000000..7ed6ff82de --- /dev/null +++ b/debian/compat @@ -0,0 +1 @@ +5 diff --git a/debian/control b/debian/control new file mode 100644 index 0000000000..8e2acb58e2 --- /dev/null +++ b/debian/control @@ -0,0 +1,370 @@ +Source: mesa +Section: graphics +Priority: optional +Maintainer: Ubuntu X-SWAT +XSBC-Original-Maintainer: Debian X Strike Force +Uploaders: Thierry Reding , Julien Cristau , David Nusinow , Brice Goglin +Standards-Version: 3.7.3 +Build-Depends: debhelper (>= 5), quilt (>= 0.40), pkg-config, + libdrm-dev (>= 2.4.4) [!hurd-i386], libx11-dev, xutils-dev, + x11proto-gl-dev (>= 1.4.8), libxxf86vm-dev, + libexpat1-dev, dpkg-dev (>= 1.13.19), libxfixes-dev, + libxdamage-dev, libxext-dev, autoconf, automake, x11proto-dri2-dev (>= 1.99.3) +Vcs-Git: git://git.debian.org/git/pkg-xorg/lib/mesa +Vcs-Browser: http://git.debian.org/?p=pkg-xorg/lib/mesa.git +Homepage: http://mesa3d.sourceforge.net/ + +Package: libgl1-mesa-swx11 +Section: libs +Priority: extra +Architecture: any +Pre-Depends: dpkg (>= 1.14.12ubuntu3) +Depends: ${shlibs:Depends}, libosmesa6 (>= 6.5.2-1) +Conflicts: mesag3-glide, mesag3-glide2, mesag3+ggi, libgl1, nvidia-glx, mesag3, libgl1-mesa-swrast +Provides: libgl1, mesag3, libgl1-mesa-swrast +Replaces: libgl1, mesag3, libgl1-mesa-swrast +Description: A free implementation of the OpenGL API -- runtime + Mesa is a 3-D graphics library with an API which is very similar to + that of OpenGL. To the extent that Mesa utilizes the OpenGL command + syntax or state machine, it is being used with authorization from + Silicon Graphics, Inc. However, the author makes no claim that Mesa + is in any way a compatible replacement for OpenGL or associated with + Silicon Graphics, Inc. + . + This library provides a pure software rasteriser; it does not provide + a direct rendering-capable library, or one which uses GLX. For that, + please see libgl1-mesa-glx. + . + On Linux, this library is also known as libGL or libGL.so.1. + +Package: libgl1-mesa-swx11-dbg +Section: libdevel +Priority: extra +Architecture: any +Pre-Depends: dpkg (>= 1.14.12ubuntu3) +Depends: libgl1-mesa-swx11 (= ${binary:Version}) +Conflicts: libgl1-mesa-swrast-dbg +Provides: libgl1-mesa-swrast-dbg +Replaces: libgl1-mesa-swrast-dbg +Description: A free implementation of the OpenGL API -- debugging symbols + Mesa is a 3-D graphics library with an API which is very similar to + that of OpenGL. To the extent that Mesa utilizes the OpenGL command + syntax or state machine, it is being used with authorization from + Silicon Graphics, Inc. However, the author makes no claim that Mesa + is in any way a compatible replacement for OpenGL or associated with + Silicon Graphics, Inc. + . + This library provides a pure software rasteriser; it does not provide + a direct rendering-capable library, or one which uses GLX. For that, + please see libgl1-mesa-glx. + . + On Linux, this library is also known as libGL or libGL.so.1. + . + This package contains debugging symbols for the software rasterization GL + library. + +Package: libgl1-mesa-swx11-i686 +Section: libs +Priority: extra +Architecture: i386 +Pre-Depends: dpkg (>= 1.14.12ubuntu3) +Depends: libgl1-mesa-swx11 (= ${binary:Version}), ${shlibs:Depends} +Description: Mesa OpenGL runtime [i686 optimized] + Mesa is a 3-D graphics library with an API which is very similar to + that of OpenGL. To the extent that Mesa utilizes the OpenGL command + syntax or state machine, it is being used with authorization from + Silicon Graphics, Inc. However, the author makes no claim that Mesa + is in any way a compatible replacement for OpenGL or associated with + Silicon Graphics, Inc. + . + This library provides a pure software rasteriser; it does not provide + a direct rendering-capable library, or one which uses GLX. For that, + please see libgl1-mesa-glx. + . + On Linux, this library is also known as libGL or libGL.so.1. + . + This set of libraries is optimized for i686 machines and will only be used if + you are running a 2.6 kernel on an i686 class CPU. This includes Pentium Pro, + Pentium II/II/IV, Celeron CPU's and similar class CPU's (including clones + such as AMD Athlon/Opteron, VIA C3 Nehemiah, but not VIA C3 Ezla). + +Package: libgl1-mesa-swx11-dev +Section: libdevel +Priority: extra +Architecture: any +Pre-Depends: dpkg (>= 1.14.12ubuntu3) +Depends: libgl1-mesa-swx11 (= ${binary:Version}), libc6-dev, libx11-dev, libxext6, mesa-common-dev (= ${source:Version}) +Provides: libgl-dev, mesag-dev, libgl1-mesa-swrast-dev +Conflicts: mesa-dev, libgl-dev, mesag3 (<< 3.1-1), nvidia-glx-dev, mesag-dev, libgl1-mesa-swrast-dev +Replaces: libgl-dev, mesag-dev, libgl1-mesa-swrast-dev +Description: A free implementation of the OpenGL API -- development files + This package provides the development environment required for + compiling programs with Mesa. For a complete description of Mesa, + please look at the libgl1-mesa-swx11 package. + . + This library provides a pure software rasteriser; it does not provide + a direct rendering-capable library, or one which uses GLX. For that, + please see libgl1-mesa-dev. + +Package: libgl1-mesa-glx +Section: libs +Architecture: any +Pre-Depends: dpkg (>= 1.14.12ubuntu3) +Depends: ${shlibs:Depends} +Conflicts: libgl1, libgl1-mesa-dri (<< 6.4.0) +Replaces: libgl1, libgl1-mesa-dri (<< 6.4.0) +Provides: libgl1 +Description: A free implementation of the OpenGL API -- GLX runtime + This version of Mesa provides GLX and DRI capabilities: it is capable of + both direct and indirect rendering. For direct rendering, it can use DRI + modules from the libgl1-mesa-dri package to accelerate drawing. + . + This package does not include the modules themselves: these can be found + in the libgl1-mesa-dri package. + . + For a complete description of Mesa, please look at the + libgl1-mesa-swx11 package. + +Package: libgl1-mesa-glx-dbg +Section: libdevel +Priority: extra +Architecture: any +Pre-Depends: dpkg (>= 1.14.12ubuntu3) +Depends: libgl1-mesa-glx (= ${binary:Version}) +Description: Debugging symbols for the Mesa GLX runtime + This version of Mesa provides GLX and DRI capabilities: it is capable of + both direct and indirect rendering. For direct rendering, it can use DRI + modules from the libgl1-mesa-dri package to accelerate drawing. + . + This package does not include the modules themselves: these can be found + in the libgl1-mesa-dri package. + . + For a complete description of Mesa, please look at the + libgl1-mesa-swx11 package. + . + This package contains debugging symbols for the GL library with GLX and DRI + capabilities. + +#Package: libgl1-mesa-glx-i686 +#Section: libs +#Priority: extra +#Architecture: i386 +#Pre-Depends: libgl1-mesa-glx, dpkg (>= 1.14.12ubuntu3) +#Description: A free implementation of the OpenGL API -- GLX runtime [i686 optimized] +# This version of Mesa provides GLX and DRI capabilities: it is capable of +# both direct and indirect rendering. For direct rendering, it can use DRI +# modules from the libgl1-mesa-dri package to accelerate drawing. +# . +# This package does not include the modules themselves: these can be found +# in the libgl1-mesa-dri package. +# . +# For a complete description of Mesa, please look at the +# libgl1-mesa-swx11 package. +# . +# This set of libraries is optimized for i686 machines and will only be used if +# you are running a 2.6 kernel on an i686 class CPU. This includes Pentium Pro, +# Pentium II/II/IV, Celeron CPU's and similar class CPU's (including clones +# such as AMD Athlon/Opteron, VIA C3 Nehemiah, but not VIA C3 Ezla). + +Package: libgl1-mesa-dri +Section: libs +Priority: optional +Architecture: alpha amd64 arm armeb armel hppa i386 ia64 kfreebsd-i386 kfreebsd-amd64 lpia m68k mips mipsel powerpc s390 sparc +Pre-Depends: dpkg (>= 1.14.12ubuntu3) +Depends: ${shlibs:Depends}, libgl1-mesa-glx (= ${binary:Version}) +Suggests: libglide3 +Conflicts: xlibmesa-dri (<< 1:7.0.0) +Replaces: xlibmesa-dri (<< 1:7.0.0) +Description: A free implementation of the OpenGL API -- DRI modules + This version of Mesa provides GLX and DRI capabilities: it is capable of + both direct and indirect rendering. For direct rendering, it can use DRI + modules from the libgl1-mesa-dri package to accelerate drawing. + . + This package does not include the OpenGL library itself, only the DRI + modules for accelerating direct rendering. + . + For a complete description of Mesa, please look at the + libgl1-mesa-swx11 package. + . + The tdfx DRI module needs libglide3 to enable direct rendering. + +Package: libgl1-mesa-dri-dbg +Section: libdevel +Priority: extra +Architecture: alpha amd64 arm armeb armel hppa i386 ia64 kfreebsd-i386 kfreebsd-amd64 lpia m68k mips mipsel powerpc s390 sparc +Pre-Depends: dpkg (>= 1.14.12ubuntu3) +Depends: libgl1-mesa-dri (= ${binary:Version}) +Description: Debugging symbols for the Mesa DRI modules + This version of Mesa provides GLX and DRI capabilities: it is capable of + both direct and indirect rendering. For direct rendering, it can use DRI + modules from the libgl1-mesa-dri package to accelerate drawing. + . + This package does not include the OpenGL library itself, only the DRI + modules for accelerating direct rendering. + . + For a complete description of Mesa, please look at the + libgl1-mesa-swx11 package. + . + This package contains debugging symbols for the DRI modules. + +#Package: libgl1-mesa-dri-i686 +#Section: libs +#Priority: extra +#Architecture: i386 +#Pre-Depends: libgl1-mesa-dri, dpkg (>= 1.14.12ubuntu3) +#Description: A free implementation of the OpenGL API -- DRI modules [i686 optimized] +# This version of Mesa provides GLX and DRI capabilities: it is capable of +# both direct and indirect rendering. For direct rendering, it can use DRI +# modules from the libgl1-mesa-dri package to accelerate drawing. +# . +# This package does not include the OpenGL library itself, only the DRI +# modules for accelerating direct rendering. +# . +# For a complete description of Mesa, please look at the +# libgl1-mesa-swx11 package. +# . +# This set of libraries is optimized for i686 machines and will only be used if +# you are running a 2.6 kernel on an i686 class CPU. This includes Pentium Pro, +# Pentium II/II/IV, Celeron CPU's and similar class CPU's (including clones +# such as AMD Athlon/Opteron, VIA C3 Nehemiah, but not VIA C3 Ezla). + +Package: libgl1-mesa-dev +Section: libdevel +Architecture: all +Pre-Depends: dpkg (>= 1.14.12ubuntu3) +Depends: libc6-dev, mesa-common-dev (= ${source:Version}), libgl1-mesa-glx (>= ${source:Upstream-Version}) +Conflicts: libgl-dev, libgl1-mesa-dri-dev +Replaces: libgl-dev, libgl1-mesa-dri-dev +Provides: libgl-dev, libgl1-mesa-dri-dev +Description: A free implementation of the OpenGL API -- GLX development files + This version of Mesa provides GLX and DRI capabilities: it is capable of + both direct and indirect rendering. For direct rendering, it can use DRI + modules from the libgl1-mesa-dri package to accelerate drawing. + . + This package includes headers and static libraries for compiling + programs with Mesa. + . + For a complete description of Mesa, please look at the libgl1-mesa-swx11 + package. + +Package: mesa-common-dev +Section: libdevel +Architecture: all +Replaces: xlibmesa-gl-dev (<< 1:7), xlibosmesa-dev, libgl1-mesa-swx11-dev (<< 6.5.2), libgl1-mesa-dev (<< 6.5.2) +Pre-Depends: dpkg (>= 1.14.12ubuntu3) +Depends: libx11-dev +Description: Developer documentation for Mesa + This package includes the specifications for the Mesa-specific OpenGL + extensions, the complete set of release notes and the development header + files common to all Mesa packages. + +Package: libosmesa6 +Section: libs +Architecture: any +Pre-Depends: dpkg (>= 1.14.12ubuntu3) +Depends: ${shlibs:Depends} +Replaces: libgl1-mesa-swx11 (<< 6.5.2) +Description: Mesa Off-screen rendering extension + OSmesa is a Mesa extension that allows programs to render to an + off-screen buffer using the OpenGL API without having to create a + rendering context on an X Server. It uses a pure software renderer. + . + This package provides both 16-bit and 32-bit versions of the off-screen + renderer which do not require external libraries to work. + +Package: libosmesa6-dev +Section: libdevel +Architecture: any +Pre-Depends: dpkg (>= 1.14.12ubuntu3) +Depends: libosmesa6 (= ${binary:Version}), mesa-common-dev (= ${source:Version}) | libgl-dev +Conflicts: xlibosmesa-dev, libosmesa4-dev, libosmesa-dev +Replaces: xlibosmesa-dev, libosmesa-dev, libgl1-mesa-swx11-dev (<< 6.5.2), mesa-common-dev (<< 6.5.2) +Provides: xlibosmesa-dev, libosmesa-dev +Description: Mesa Off-screen rendering extension -- development files + This package provides the required environment for developing programs + that use the off-screen rendering extension of Mesa. + . + For more information on OSmesa see the libosmesa6 package. + +Package: libglu1-mesa +Section: libs +Architecture: any +Pre-Depends: dpkg (>= 1.14.12ubuntu3) +Depends: ${shlibs:Depends}, libgl1-mesa-glx | libgl1 +Provides: libglu1 +Conflicts: mesag3 (<< 5.0.0-1), xlibmesa3, libglu1 +Replaces: libglu1 +Description: The OpenGL utility library (GLU) + GLU offers simple interfaces for building mipmaps; checking for the + presence of extensions in the OpenGL (or other libraries which follow + the same conventions for advertising extensions); drawing + piecewise-linear curves, NURBS, quadrics and other primitives + (including, but not limited to, teapots); tesselating surfaces; setting + up projection matrices and unprojecting screen coordinates to world + coordinates. + . + On Linux, this library is also known as libGLU or libGLU.so.1. + . + This package provides the SGI implementation of GLU shipped with the + Mesa package (ergo the "-mesa" suffix). + +Package: libglu1-mesa-dev +Section: libdevel +Architecture: any +Pre-Depends: dpkg (>= 1.14.12ubuntu3) +Depends: libglu1-mesa (= ${binary:Version}), libgl1-mesa-dev | libgl-dev +Provides: libglu-dev, xlibmesa-glu-dev +Conflicts: mesag-dev (<< 5.0.0-1), mesa-glide2-dev (<< 5.0.0-1), mesag3+ggi-dev (<< 5.0.0-1), xlibmesa-dev +Replaces: libglu-dev +Description: The OpenGL utility library -- development files + Includes headers and static libraries for compiling programs with GLU. + . + For a complete description of GLU, please look at the libglu1-mesa + package. + +#Package: libglw1-mesa +#Section: libs +#Architecture: any +#Pre-Depends: dpkg (>= 1.14.12ubuntu3) +#Depends: ${shlibs:Depends} +#Provides: libglw1 +#Description: A free implementation of the OpenGL API -- runtime +# Mesa is a 3-D graphics library with an API which is very similar to +# that of OpenGL. To the extent that Mesa utilizes the OpenGL command +# syntax or state machine, it is being used with authorization from +# Silicon Graphics, Inc. However, the author makes no claim that Mesa +# is in any way a compatible replacement for OpenGL or associated with +# Silicon Graphics, Inc. +# . +# This package provides a simple widgets library, libGLw, which +# allows Motif-based applications to embed an OpenGL drawing context. +# . +# On Linux, this library is also known as libGLw or libGLw.so.1. + +#Package: libglw1-mesa-dev +#Section: libdevel +#Architecture: any +#Pre-Depends: dpkg (>= 1.14.12ubuntu3) +#Depends: libglw1-mesa (= ${binary:Version}), libc6-dev, libx11-dev, libxext6, mesa-common-dev (= ${source:Version}) +#Provides: mesag3-widgets, mesag-widgets-dev, libglw-dev +#Conflicts: libglw-dev, libgl1-mesa-swx11-dev (<< 6.5.2-4) +#Replaces: libglw-dev +#Description: A free implementation of the OpenGL API -- development files +# This package provides the development environment required for +# compiling programs with the Mesa widgets library, libGLw, which +# allows Motif-based applications to embed an OpenGL drawing context. +# The headers and static libraries for compiling programs that use this +# library are included. + +Package: mesa-utils +Section: x11 +Priority: optional +Architecture: any +Pre-Depends: dpkg (>= 1.14.12ubuntu3) +Depends: ${shlibs:Depends} +Replaces: xbase-clients (<< 6.8.2-38) +Description: Miscellaneous Mesa GL utilities + This package provides several basic GL utilities built by Mesa, including + glxinfo and glxgears. + +# vim: tw=0 diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 0000000000..d38eb4be64 --- /dev/null +++ b/debian/copyright @@ -0,0 +1,193 @@ +This package was debianized by James A. Treacy treacy@debian.org on Thu, +6 Jan 2000 01:11:34 -0500. It was newly debianized by Marcelo E. +Magallon on Sat, 25 Dec 2004 14:50:02 -0600. It was +again debianized by Thierry Reding on Sat, 14 Oct 2006 +02:01:12 +0200. + +It was downloaded from http://www.mesa3d.org/download.html + +For more information see: + + http://www.mesa3d.org/ + +Copyright: + +Upstream Author: Brian Paul + +License: + + License / Copyright Information + + The Mesa distribution consists of several components. Different + copyrights and licenses apply to different components. For + example, GLUT is copyrighted by Mark Kilgard, some demo programs + are copyrighted by SGI, some of the Mesa device drivers are + copyrighted by their authors. See below for a list of Mesa's + components and the copyright/license for each. + + The core Mesa library is licensed according to the terms of the + XFree86 copyright (an MIT-style license). This allows integration + with the XFree86/DRI project. Unless otherwise stated, the Mesa + source code and documentation is licensed as follows: + + Copyright (C) 1999-2003 Brian Paul All Rights Reserved. + + Permission is hereby granted, free of charge, to any person obtaining a + copy of this software and associated documentation files (the "Software"), + to deal in the Software without restriction, including without limitation + the rights to use, copy, modify, merge, publish, distribute, sublicense, + and/or sell copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + Attention, Contributors + + When contributing to the Mesa project you must agree to relinquish + your work to the holder of the copyright for the particular + component you're contributing to. That is, you can't put your own + copyright on the code, unless it's a modular piece that can be + omitted from Mesa (like a new device driver). If for example, you + contribute a bug fix to Mesa's texture mapping code, your code + will become a part of the body of work which is copyrighted by + Brian Paul and licensed by the above terms. + +---------------------------------------------------------------------- + +Some files, as listed below, are made available under the SGI Free B +license. This license is as follows: + +SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) + +Copyright (C) [dates of first publication] Silicon Graphics, Inc. All Rights +Reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: +The above copyright notice including the dates of first publication and either +this permission notice or a reference to http://oss.sgi.com/projects/FreeB/ +shall be included in all copies or substantial portions of the Software. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL SILICON GRAPHICS, INC. BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN +ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +IN THE SOFTWARE. +Except as contained in this notice, the name of Silicon Graphics, Inc. shall +not be used in advertising or otherwise to promote the sale, use or other +dealings in this Software without prior written authorization from Silicon +Graphics, Inc. + +-------------------------------------------------------------------------- + +Some other files listed below are made available from Silicon Graphics, +Inc. under a more liberal, MIT-style license, as follows: + + Permission to use, copy, modify, and distribute this software for + any purpose and without fee is hereby granted, provided that the above + copyright notice appear in all copies and that both the copyright notice + and this permission notice appear in supporting documentation, and that + the name of Silicon Graphics, Inc. not be used in advertising + or publicity pertaining to distribution of the software without specific, + written prior permission. + + THE MATERIAL EMBODIED ON THIS SOFTWARE IS PROVIDED TO YOU "AS-IS" + AND WITHOUT WARRANTY OF ANY KIND, EXPRESS, IMPLIED OR OTHERWISE + INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY OR + FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON + GRAPHICS, INC. BE LIABLE TO YOU OR ANYONE ELSE FOR ANY DIRECT, + SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY + KIND, OR ANY DAMAGES WHATSOEVER, INCLUDING WITHOUT LIMITATION, + LOSS OF PROFIT, LOSS OF USE, SAVINGS OR REVENUE, OR THE CLAIMS OF + THIRD PARTIES, WHETHER OR NOT SILICON GRAPHICS, INC. HAS BEEN + ADVISED OF THE POSSIBILITY OF SUCH LOSS, HOWEVER CAUSED AND ON + ANY THEORY OF LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE + POSSESSION, USE OR PERFORMANCE OF THIS SOFTWARE. + + US Government Users Restricted Rights + Use, duplication, or disclosure by the Government is subject to + restrictions set forth in FAR 52.227.19(c)(2) or subparagraph + (c)(1)(ii) of the Rights in Technical Data and Computer Software + clause at DFARS 252.227-7013 and/or in similar or successor + clauses in the FAR or the DOD or NASA FAR Supplement. + Unpublished-- rights reserved under the copyright laws of the + United States. Contractor/manufacturer is Silicon Graphics, + Inc., 2011 N. Shoreline Blvd., Mountain View, CA 94039-7311. + +-------------------------------------------------------------------------- + + Mesa Component Licenses: + + Component Files Primary Author License + ---------------------------------------------------------------------------- + core Mesa code src/*.[ch] Brian Paul Mesa + include/GL/gl.h + + GLX driver src/X/* Brian Paul Mesa + include/GL/glx.h + include/GL/xmesa.h + + OS/Mesa driver src/OSmesa/* Brian Paul Mesa + include/GL/osmesa.h + + 3Dfx driver src/FX/* David Bucciarelli Mesa + include/GL/fxmesa.h + + BeOS R4 driver mesa/drivers/beos/ Brian Paul Mesa + + MGL driver include/GL/mglmesa.h SciTech, Inc GNU LGPL + + Windows driver mesa/drivers/windows/ Li Wei GNU LGPL + include/GL/wmesa.h + + SVGA driver mesa/drivers/svga/ Brian Paul GNU LGPL + include/GL/svgamesa.h + + DOS driver mesa/drivers/dos/ Charlie Wallace GNU LGPL + include/GL/dosmesa.h + + GGI driver mesa/drivers/ggi/ Uwe Maurer GNU LGPL + include/GL/ggimesa.h + + GLUT src/glut/* Mark Kilgard Mark's copyright + include/GL/*glut*.h + + GLU library src/glu/* Brian Paul GNU LGPL + + SGI GLU library src/glu/sgi/* SGI SGI Free B + include/GL/glu.h + + Ext registry include/GL/glext.h SGI SGI Free B + include/GL/glxext.h + + demo programs progs/demos/* various see source files + + X demos progs/xdemos/* Brian Paul see source files + + SGI demos progs/samples/* SGI SGI MIT-style + + RedBook demos progs/redbook/* SGI SGI MIT-style + + +On Debian systems the full text of the GNU LGPL license is found in +/usr/share/common-licenses/LGPL. + +------------------------------------------------------------------------------ + +The Debian packaging is (C) 2006, Thierry Reding and +is licensed under the GPL, see `/usr/share/common-licenses/GPL'. + diff --git a/debian/glxdemo.1 b/debian/glxdemo.1 new file mode 100644 index 0000000000..fdfed7133e --- /dev/null +++ b/debian/glxdemo.1 @@ -0,0 +1,15 @@ +.TH glxdemo 1 "2006-11-29" +.SH NAME +glxdemo \- a demonstration of the GLX functions +.SH SYNOPSIS +.B glxdemo +.SH DESCRIPTION +The \fIglxdemo\fP program shows how to use the GLX functions in order to +create an OpenGL program running on top of an X server. This program is most +useful when studied in its source code form. +.SH AUTHOR +glxdemo was written by Brian Paul . +.PP +This manual page was written by Thierry Reding , for the +Debian project (but may be used by others). + diff --git a/debian/glxgears.1 b/debian/glxgears.1 new file mode 100644 index 0000000000..92c4f7a432 --- /dev/null +++ b/debian/glxgears.1 @@ -0,0 +1,29 @@ +.TH glxgears 1 "2006-11-29" +.SH NAME +glxgears \- ``gears'' demo for GLX +.SH SYNOPSIS +.B glxgears +.RI [ options ] +.SH DESCRIPTION +The \fIglxgears\fP program is a port of the ``gears'' demo to GLX. It displays +a set of rotating gears and prints out the frame rate at regular intervals. It +has become quite popular as basic benchmarking tool. +.SH OPTIONS +.TP 8 +.B \-display \fIdisplay\fP +Specify which X display to run on. +.TP 8 +.B \-info +Display OpenGL renderer information. +.TP 8 +.B \-stereo +Use a stereo enabled GLX visual. +.TP 8 +.B \-fullscreen +Run in fullscreen mode. +.SH AUTHOR +glxgears was written by Brian Paul . +.PP +This manual page was written by Thierry Reding , for the +Debian project (but may be used by others). + diff --git a/debian/glxheads.1 b/debian/glxheads.1 new file mode 100644 index 0000000000..9502556901 --- /dev/null +++ b/debian/glxheads.1 @@ -0,0 +1,30 @@ +.TH glxheads 1 "2006-11-29" +.SH NAME +glxheads \- exercise multiple GLX connections +.SH SYNOPSIS +.B glxheads +[\fIdisplay\fP ...] +.SH DESCRIPTION +The \fIglxheads\fP program will try to open GLX connections on multiple X +displays as specified on the command-line. If a connection can be made it will +try to create a direct GLX context (and fallback to using indirect contexts if +that fails) and open a window displaying a spinning green triangle. +.PP +If no display names are specified, \fIglxheads\fP will default to opening a +single local connection on display 0. +.SH EXAMPLE +To open a local connection on display 0 and two remote connections to the +hosts \fImars\fP (display 0) and \fIvenus\fP (display 1), run glxheads with +the following command-line: +.PP +.RS 3n +.nf +$ glxheads :0 mars:0 venus:1 +.fi +.RE +.SH AUTHOR +glxheads was written by Brian Paul . +.PP +This manual page was written by Thierry Reding for the +Debian project (but may be used by others). + diff --git a/debian/glxinfo.1 b/debian/glxinfo.1 new file mode 100644 index 0000000000..7a3732e17e --- /dev/null +++ b/debian/glxinfo.1 @@ -0,0 +1,41 @@ +.TH glxinfo 1 "2006-11-29" +.SH NAME +glxinfo \- show information about the GLX implementation +.SH SYNOPSIS +.B glxinfo +.RI [ options ] +.SH DESCRIPTION +The \fIglxinfo\fP program shows information about the OpenGL and GLX +implementations running on a given X display. +.PP +The information includes details about the server- and client-side GLX +implementation, the OpenGL and GLU implementations as well as a list +of available GLX visuals. +.SH OPTIONS +.TP 8 +.B \-v +Print visuals info in verbose form. +.TP 8 +.B \-t +Print verbose table. +.TP 8 +.B \-display \fIdisplay\fP +Specify the X display to interrogate. +.TP 8 +.B \-h +Print usage information. +.TP 8 +.B \-i +Force an indirect rendering context. +.TP 8 +.B \-b +Find the "best" visual and print its number. +.TP 8 +.B \-l +Print interesting OpenGL limits. +.SH AUTHOR +glxinfo was written by Brian Paul . +.PP +This manual page was written by Thierry Reding , for the +Debian project (but may be used by others). + diff --git a/debian/libgl1-mesa-dev.install b/debian/libgl1-mesa-dev.install new file mode 100644 index 0000000000..dac5ebda19 --- /dev/null +++ b/debian/libgl1-mesa-dev.install @@ -0,0 +1,2 @@ +usr/lib/libGL.so +usr/lib/pkgconfig/gl.pc diff --git a/debian/libgl1-mesa-dri-i686.install b/debian/libgl1-mesa-dri-i686.install new file mode 100644 index 0000000000..44b5c55214 --- /dev/null +++ b/debian/libgl1-mesa-dri-i686.install @@ -0,0 +1 @@ +usr/lib/dri/i686/cmov/*.so diff --git a/debian/libgl1-mesa-dri.install b/debian/libgl1-mesa-dri.install new file mode 100644 index 0000000000..55500c8120 --- /dev/null +++ b/debian/libgl1-mesa-dri.install @@ -0,0 +1 @@ +usr/lib/dri/*.so diff --git a/debian/libgl1-mesa-glx-i686.install b/debian/libgl1-mesa-glx-i686.install new file mode 100644 index 0000000000..4c8ef3b34b --- /dev/null +++ b/debian/libgl1-mesa-glx-i686.install @@ -0,0 +1 @@ +usr/lib/glx/i686/cmov/libGL.so.* usr/lib/i686/cmov diff --git a/debian/libgl1-mesa-glx.install b/debian/libgl1-mesa-glx.install new file mode 100644 index 0000000000..1a30ecd7cb --- /dev/null +++ b/debian/libgl1-mesa-glx.install @@ -0,0 +1 @@ +usr/lib/glx/libGL.so.* usr/lib diff --git a/debian/libgl1-mesa-glx.shlibs b/debian/libgl1-mesa-glx.shlibs new file mode 100644 index 0000000000..b8e0fbaaaa --- /dev/null +++ b/debian/libgl1-mesa-glx.shlibs @@ -0,0 +1 @@ +libGL 1 libgl1-mesa-glx | libgl1 diff --git a/debian/libgl1-mesa-swx11-dev.install b/debian/libgl1-mesa-swx11-dev.install new file mode 100644 index 0000000000..f353c5923d --- /dev/null +++ b/debian/libgl1-mesa-swx11-dev.install @@ -0,0 +1,2 @@ +usr/lib/libGL.a +usr/lib/libGL.so diff --git a/debian/libgl1-mesa-swx11-i686.install b/debian/libgl1-mesa-swx11-i686.install new file mode 100644 index 0000000000..2177b0cf15 --- /dev/null +++ b/debian/libgl1-mesa-swx11-i686.install @@ -0,0 +1 @@ +usr/lib/i686/cmov/libGL.so.* diff --git a/debian/libgl1-mesa-swx11-i686.shlibs b/debian/libgl1-mesa-swx11-i686.shlibs new file mode 100644 index 0000000000..b8e0fbaaaa --- /dev/null +++ b/debian/libgl1-mesa-swx11-i686.shlibs @@ -0,0 +1 @@ +libGL 1 libgl1-mesa-glx | libgl1 diff --git a/debian/libgl1-mesa-swx11.install b/debian/libgl1-mesa-swx11.install new file mode 100644 index 0000000000..6d70d0f9f9 --- /dev/null +++ b/debian/libgl1-mesa-swx11.install @@ -0,0 +1 @@ +usr/lib/libGL.so.* diff --git a/debian/libgl1-mesa-swx11.shlibs b/debian/libgl1-mesa-swx11.shlibs new file mode 100644 index 0000000000..b8e0fbaaaa --- /dev/null +++ b/debian/libgl1-mesa-swx11.shlibs @@ -0,0 +1 @@ +libGL 1 libgl1-mesa-glx | libgl1 diff --git a/debian/libglu1-mesa-dev.install b/debian/libglu1-mesa-dev.install new file mode 100644 index 0000000000..78ac2b01ed --- /dev/null +++ b/debian/libglu1-mesa-dev.install @@ -0,0 +1,4 @@ +usr/include/GL/glu.h +usr/include/GL/glu_mangle.h +usr/lib/libGLU.a +usr/lib/libGLU.so diff --git a/debian/libglu1-mesa.install b/debian/libglu1-mesa.install new file mode 100644 index 0000000000..9ad0953c1c --- /dev/null +++ b/debian/libglu1-mesa.install @@ -0,0 +1 @@ +usr/lib/libGLU.so.* diff --git a/debian/libglu1-mesa.shlibs b/debian/libglu1-mesa.shlibs new file mode 100644 index 0000000000..647fc5be38 --- /dev/null +++ b/debian/libglu1-mesa.shlibs @@ -0,0 +1 @@ +libGLU 1 libglu1-mesa | libglu1 diff --git a/debian/libglw1-mesa-dev.install b/debian/libglw1-mesa-dev.install new file mode 100644 index 0000000000..7c03280c33 --- /dev/null +++ b/debian/libglw1-mesa-dev.install @@ -0,0 +1,3 @@ +usr/include/GL/GLw*A.h +usr/lib/libGLw.a +usr/lib/libGLw.so diff --git a/debian/libglw1-mesa.install b/debian/libglw1-mesa.install new file mode 100644 index 0000000000..9d299c81a5 --- /dev/null +++ b/debian/libglw1-mesa.install @@ -0,0 +1 @@ +usr/lib/libGLw.so.* diff --git a/debian/libglw1-mesa.shlibs b/debian/libglw1-mesa.shlibs new file mode 100644 index 0000000000..488d4da327 --- /dev/null +++ b/debian/libglw1-mesa.shlibs @@ -0,0 +1 @@ +libGLw 1 libglw1-mesa | libglw1 diff --git a/debian/libosmesa6-dev.install b/debian/libosmesa6-dev.install new file mode 100644 index 0000000000..149a1bd789 --- /dev/null +++ b/debian/libosmesa6-dev.install @@ -0,0 +1,7 @@ +usr/include/GL/osmesa.h +usr/lib/libOSMesa.a +usr/lib/libOSMesa.so +usr/lib/libOSMesa16.a +usr/lib/libOSMesa16.so +usr/lib/libOSMesa32.a +usr/lib/libOSMesa32.so diff --git a/debian/libosmesa6.install b/debian/libosmesa6.install new file mode 100644 index 0000000000..d1e25b2ffe --- /dev/null +++ b/debian/libosmesa6.install @@ -0,0 +1,3 @@ +usr/lib/libOSMesa.so.* +usr/lib/libOSMesa16.so.* +usr/lib/libOSMesa32.so.* diff --git a/debian/libosmesa6.shlibs b/debian/libosmesa6.shlibs new file mode 100644 index 0000000000..3c9ae1a14b --- /dev/null +++ b/debian/libosmesa6.shlibs @@ -0,0 +1,3 @@ +libOSMesa 6 libosmesa6 (>= 6.5.2-1) | libgl1-mesa-glide3 +libOSMesa16 6 libosmesa6 (>= 6.5.2-1) +libOSMesa32 6 libosmesa6 (>= 6.5.2-1) diff --git a/debian/mesa-common-dev.docs b/debian/mesa-common-dev.docs new file mode 100644 index 0000000000..834e887e4f --- /dev/null +++ b/debian/mesa-common-dev.docs @@ -0,0 +1,8 @@ +docs/bugs.html +docs/debugging.html +docs/envvars.html +docs/faq.html +docs/osmesa.html +docs/RELNOTES-* +docs/relnotes* +docs/*.spec diff --git a/debian/mesa-common-dev.install b/debian/mesa-common-dev.install new file mode 100644 index 0000000000..f4181b91b0 --- /dev/null +++ b/debian/mesa-common-dev.install @@ -0,0 +1,5 @@ +usr/include/GL/gl.h +usr/include/GL/glext.h +usr/include/GL/gl_mangle.h +usr/include/GL/glx*.h +usr/include/GL/internal/dri_interface.h diff --git a/debian/mesa-utils.install b/debian/mesa-utils.install new file mode 100644 index 0000000000..4d4d07e3f0 --- /dev/null +++ b/debian/mesa-utils.install @@ -0,0 +1,4 @@ +usr/bin/glxdemo +usr/bin/glxgears +usr/bin/glxheads +usr/bin/glxinfo diff --git a/debian/mesa-utils.manpages b/debian/mesa-utils.manpages new file mode 100644 index 0000000000..a3cb2dbb5d --- /dev/null +++ b/debian/mesa-utils.manpages @@ -0,0 +1,4 @@ +debian/glxdemo.1 +debian/glxgears.1 +debian/glxheads.1 +debian/glxinfo.1 diff --git a/debian/patches/02_use-ieee-fp-on-s390-and-m68k.patch b/debian/patches/02_use-ieee-fp-on-s390-and-m68k.patch new file mode 100644 index 0000000000..6d12ffff62 --- /dev/null +++ b/debian/patches/02_use-ieee-fp-on-s390-and-m68k.patch @@ -0,0 +1,19 @@ +Patch that fixes Debian bug #349437. + +This patch by David Nusinow. + +Index: mesa/src/mesa/main/imports.h +=================================================================== +--- mesa.orig/src/mesa/main/imports.h 2008-07-01 15:26:57.000000000 +0300 ++++ mesa/src/mesa/main/imports.h 2008-07-01 15:45:49.000000000 +0300 +@@ -158,8 +158,9 @@ + *** USE_IEEE: Determine if we're using IEEE floating point + ***/ + #if defined(__i386__) || defined(__386__) || defined(__sparc__) || \ +- defined(__s390x__) || defined(__powerpc__) || \ ++ defined(__s390__) || defined(__s390x__) || defined(__powerpc__) || \ + defined(__x86_64__) || \ ++ defined(__m68k__) || \ + defined(ia64) || defined(__ia64__) || \ + defined(__hppa__) || defined(hpux) || \ + defined(__mips) || defined(_MIPS_ARCH) || \ diff --git a/debian/patches/03_optional-progs-and-install.patch b/debian/patches/03_optional-progs-and-install.patch new file mode 100644 index 0000000000..6eac84ae2b --- /dev/null +++ b/debian/patches/03_optional-progs-and-install.patch @@ -0,0 +1,55 @@ +Allow the programs that are to be built to be defined in the build +configuration. + +Provide an install target for installing the programs in $(INSTALL_DIR)/bin. + +This patch by Thierry Reding. +Not submitted to Mesa. +-- +Also remove references to GLU library since it is not required +and we don't actually build it at this point. + + +Index: mesa/progs/xdemos/Makefile +=================================================================== +--- mesa.orig/progs/xdemos/Makefile ++++ mesa/progs/xdemos/Makefile +@@ -10,7 +10,7 @@ + + LIBS = -L$(TOP)/$(LIB_DIR) -l$(GL_LIB) $(APP_LIB_DEPS) + +-PROGS = \ ++PROGS ?= \ + corender \ + glsync \ + glthreads \ +@@ -61,6 +61,11 @@ + extra: $(EXTRA_PROGS) + + ++install: $(PROGS) ++ $(INSTALL) -d $(DESTDIR)$(INSTALL_DIR)/bin ++ $(INSTALL) -m 755 $(PROGS) $(DESTDIR)$(INSTALL_DIR)/bin ++ ++ + clean: + -rm -f $(PROGS) $(EXTRA_PROGS) + -rm -f *.o *~ +Index: mesa/progs/Makefile +=================================================================== +--- mesa.orig/progs/Makefile ++++ mesa/progs/Makefile +@@ -21,8 +21,12 @@ + fi \ + done + +-# Dummy install target + install: ++ @for dir in $(SUBDIRS) ; do \ ++ if [ -d $$dir ] ; then \ ++ (cd $$dir ; $(MAKE) install) ; \ ++ fi \ ++ done + + clean: + -@for dir in $(SUBDIRS) tests ; do \ diff --git a/debian/patches/04_osmesa_version.diff b/debian/patches/04_osmesa_version.diff new file mode 100644 index 0000000000..108916c675 --- /dev/null +++ b/debian/patches/04_osmesa_version.diff @@ -0,0 +1,22 @@ +Index: mesa/src/mesa/drivers/osmesa/Makefile +=================================================================== +--- mesa.orig/src/mesa/drivers/osmesa/Makefile ++++ mesa/src/mesa/drivers/osmesa/Makefile +@@ -45,7 +45,7 @@ + + $(TOP)/$(LIB_DIR)/$(OSMESA_LIB_NAME): $(OBJECTS) + $(MKLIB) -o $(OSMESA_LIB) -linker '$(CC)' -ldflags '$(LDFLAGS)' \ +- -major $(MESA_MAJOR) -minor $(MESA_MINOR) -patch $(MESA_TINY) \ ++ -major 6 -minor 5 -patch 3 \ + -install $(TOP)/$(LIB_DIR) $(MKLIB_OPTIONS) \ + -id $(INSTALL_LIB_DIR)/lib$(OSMESA_LIB).$(MESA_MAJOR).dylib \ + $(OSMESA_LIB_DEPS) $(OBJECTS) +@@ -57,7 +57,7 @@ + # with all the other Mesa sources (compiled with -DCHAN_BITS=16/32 + osmesa16: $(OBJECTS) $(CORE_MESA) + $(MKLIB) -o $(OSMESA_LIB) -linker '$(CC)' -ldflags '$(LDFLAGS)' \ +- -major $(MESA_MAJOR) -minor $(MESA_MINOR) -patch $(MESA_TINY) \ ++ -major 6 -minor 5 -patch 3 \ + -install $(TOP)/$(LIB_DIR) $(MKLIB_OPTIONS) \ + -id $(INSTALL_LIB_DIR)/lib$(OSMESA_LIB).$(MESA_MAJOR).dylib \ + $(OSMESA_LIB_DEPS) $(OBJECTS) $(CORE_MESA) diff --git a/debian/patches/101_ubuntu_hidden_glname.patch b/debian/patches/101_ubuntu_hidden_glname.patch new file mode 100644 index 0000000000..1d1d066c7e --- /dev/null +++ b/debian/patches/101_ubuntu_hidden_glname.patch @@ -0,0 +1,12 @@ +Index: mesa-6.5.2/src/mesa/x86/glapi_x86.S +=================================================================== +--- mesa-6.5.2.orig/src/mesa/x86/glapi_x86.S 2006-11-04 01:44:40.000000000 +0200 ++++ mesa-6.5.2/src/mesa/x86/glapi_x86.S 2007-02-09 20:25:45.000000000 +0200 +@@ -139,7 +139,6 @@ + + ALIGNTEXT16 + GLOBL GLNAME(gl_dispatch_functions_start) +- HIDDEN(GLNAME(gl_dispatch_functions_start)) + GLNAME(gl_dispatch_functions_start): + + GL_STUB(NewList, _gloffset_NewList, NewList@8) diff --git a/debian/patches/102_dont_vblank.diff b/debian/patches/102_dont_vblank.diff new file mode 100644 index 0000000000..3f1c3ae615 --- /dev/null +++ b/debian/patches/102_dont_vblank.diff @@ -0,0 +1,14 @@ +diff --git a/src/mesa/drivers/dri/intel/intel_screen.c b/src/mesa/drivers/dri/intel/intel_screen.c +index 5233e58..5dded4b 100644 +--- a/src/mesa/drivers/dri/intel/intel_screen.c ++++ b/src/mesa/drivers/dri/intel/intel_screen.c +@@ -55,7 +55,7 @@ PUBLIC const char __driConfigOptions[] = + DRI_CONF_BEGIN + DRI_CONF_SECTION_PERFORMANCE + DRI_CONF_FTHROTTLE_MODE(DRI_CONF_FTHROTTLE_IRQS) +- DRI_CONF_VBLANK_MODE(DRI_CONF_VBLANK_ALWAYS_SYNC) ++ DRI_CONF_VBLANK_MODE(DRI_CONF_VBLANK_DEF_INTERVAL_0) + /* Options correspond to DRI_CONF_BO_REUSE_DISABLED, + * DRI_CONF_BO_REUSE_ALL + */ + diff --git a/debian/patches/103_bump_965_texture_limit.diff b/debian/patches/103_bump_965_texture_limit.diff new file mode 100644 index 0000000000..385c7d4208 --- /dev/null +++ b/debian/patches/103_bump_965_texture_limit.diff @@ -0,0 +1,33 @@ +commit 954dfba12986f578f2d8461818f9e9ac1f8f2b41 +Author: Keith Packard +Date: Fri Jan 30 21:51:32 2009 -0800 + + i965: bump texture limit to 4kx4k + + Rendering and textures are limited to 8kx8k, but mesa limits things to + 4kx4k, and magic guard band stuff may break on 8kx8k drawing. This is safe + though, and makes compiz work on bigger screens. + + Signed-off-by: Keith Packard + +diff --git a/src/mesa/drivers/dri/i965/brw_context.c b/src/mesa/drivers/dri/i965/brw_context.c +index d7a2bd9..d66781f 100644 +--- a/src/mesa/drivers/dri/i965/brw_context.c ++++ b/src/mesa/drivers/dri/i965/brw_context.c +@@ -135,13 +135,12 @@ GLboolean brwCreateContext( const __GLcontextModes *mesaVis, + ctx->Const.MaxTextureImageUnits); + ctx->Const.MaxVertexTextureImageUnits = 0; /* no vertex shader textures */ + +- /* Advertise the full hardware capabilities. The new memory +- * manager should cope much better with overload situations: ++ /* Mesa limits textures to 4kx4k; it would be nice to fix that someday + */ +- ctx->Const.MaxTextureLevels = 12; ++ ctx->Const.MaxTextureLevels = 13; + ctx->Const.Max3DTextureLevels = 9; + ctx->Const.MaxCubeTextureLevels = 12; +- ctx->Const.MaxTextureRectSize = (1<<11); ++ ctx->Const.MaxTextureRectSize = (1<<12); + + /* if conformance mode is set, swrast can handle any size AA point */ + ctx->Const.MaxPointSizeAA = 255.0; diff --git a/debian/patches/104_fix_dri2_ext_tfp.diff b/debian/patches/104_fix_dri2_ext_tfp.diff new file mode 100644 index 0000000000..75cad56d14 --- /dev/null +++ b/debian/patches/104_fix_dri2_ext_tfp.diff @@ -0,0 +1,337 @@ +Index: mesa/include/GL/internal/dri_interface.h +=================================================================== +--- mesa.orig/include/GL/internal/dri_interface.h 2009-01-25 17:28:10.000000000 +0200 ++++ mesa/include/GL/internal/dri_interface.h 2009-04-03 11:45:43.000000000 +0300 +@@ -230,7 +230,7 @@ + + + #define __DRI_TEX_BUFFER "DRI_TexBuffer" +-#define __DRI_TEX_BUFFER_VERSION 1 ++#define __DRI_TEX_BUFFER_VERSION 2 + struct __DRItexBufferExtensionRec { + __DRIextension base; + +@@ -238,11 +238,23 @@ + * Method to override base texture image with the contents of a + * __DRIdrawable. + * +- * For GLX_EXT_texture_from_pixmap with AIGLX. ++ * For GLX_EXT_texture_from_pixmap with AIGLX. Deprecated in favor of ++ * setTexBuffer2 in version 2 of this interface + */ + void (*setTexBuffer)(__DRIcontext *pDRICtx, + GLint target, + __DRIdrawable *pDraw); ++ ++ /** ++ * Method to override base texture image with the contents of a ++ * __DRIdrawable, including the required texture format attribute. ++ * ++ * For GLX_EXT_texture_from_pixmap with AIGLX. ++ */ ++ void (*setTexBuffer2)(__DRIcontext *pDRICtx, ++ GLint target, ++ GLint format, ++ __DRIdrawable *pDraw); + }; + + +Index: mesa/include/GL/internal/glcore.h +=================================================================== +--- mesa.orig/include/GL/internal/glcore.h 2009-01-16 21:37:10.000000000 +0200 ++++ mesa/include/GL/internal/glcore.h 2009-04-03 11:45:43.000000000 +0300 +@@ -176,4 +176,8 @@ + #define GLX_TEXTURE_2D_BIT_EXT 0x00000002 + #define GLX_TEXTURE_RECTANGLE_BIT_EXT 0x00000004 + ++#define GLX_TEXTURE_FORMAT_NONE_EXT 0x20D8 ++#define GLX_TEXTURE_FORMAT_RGB_EXT 0x20D9 ++#define GLX_TEXTURE_FORMAT_RGBA_EXT 0x20DA ++ + #endif /* __gl_core_h_ */ +Index: mesa/src/glx/x11/glx_pbuffer.c +=================================================================== +--- mesa.orig/src/glx/x11/glx_pbuffer.c 2009-01-16 23:12:40.000000000 +0200 ++++ mesa/src/glx/x11/glx_pbuffer.c 2009-04-03 11:45:43.000000000 +0300 +@@ -189,6 +189,21 @@ + + return target; + } ++ ++ ++static GLenum ++determineTextureFormat(const int *attribs, int numAttribs) ++{ ++ GLenum target = 0; ++ int i; ++ ++ for (i = 0; i < numAttribs; i++) { ++ if (attribs[2 * i] == GLX_TEXTURE_FORMAT_EXT) ++ return attribs[2 * i + 1]; ++ } ++ ++ return 0; ++} + #endif + + /** +@@ -294,6 +309,9 @@ + if (pdraw != NULL && !pdraw->textureTarget) + pdraw->textureTarget = + determineTextureTarget((const int *) data, num_attributes); ++ if (pdraw != NULL && !pdraw->textureFormat) ++ pdraw->textureFormat = ++ determineTextureFormat((const int *) data, num_attributes); + } + #endif + +@@ -374,6 +392,7 @@ + } + + pdraw->textureTarget = determineTextureTarget(attrib_list, i); ++ pdraw->textureFormat = determineTextureFormat(attrib_list, i); + } while (0); + #endif + +Index: mesa/src/glx/x11/glxclient.h +=================================================================== +--- mesa.orig/src/glx/x11/glxclient.h 2009-03-30 10:47:17.000000000 +0300 ++++ mesa/src/glx/x11/glxclient.h 2009-04-03 11:45:43.000000000 +0300 +@@ -161,6 +161,7 @@ + __GLXscreenConfigs *psc; + GLenum textureTarget; + __DRIdrawable *driDrawable; ++ GLenum textureFormat; /* EXT_texture_from_pixmap support */ + }; + + /* +Index: mesa/src/glx/x11/glxcmds.c +=================================================================== +--- mesa.orig/src/glx/x11/glxcmds.c 2009-03-30 10:34:15.000000000 +0300 ++++ mesa/src/glx/x11/glxcmds.c 2009-04-03 11:45:43.000000000 +0300 +@@ -2631,11 +2631,19 @@ + if (gc->driContext) { + __GLXDRIdrawable *pdraw = GetGLXDRIDrawable(dpy, drawable, NULL); + +- if (pdraw != NULL) +- (*pdraw->psc->texBuffer->setTexBuffer)(gc->__driContext, +- pdraw->textureTarget, +- pdraw->driDrawable); +- ++ if (pdraw != NULL) { ++ if (pdraw->psc->texBuffer->base.version >= 2 && ++ pdraw->psc->texBuffer->setTexBuffer2 != NULL) { ++ (*pdraw->psc->texBuffer->setTexBuffer2)(gc->__driContext, ++ pdraw->textureTarget, ++ pdraw->textureFormat, ++ pdraw->driDrawable); ++ } else { ++ (*pdraw->psc->texBuffer->setTexBuffer)(gc->__driContext, ++ pdraw->textureTarget, ++ pdraw->driDrawable); ++ } ++ } + return; + } + #endif +Index: mesa/src/mesa/drivers/dri/i915/i830_texstate.c +=================================================================== +--- mesa.orig/src/mesa/drivers/dri/i915/i830_texstate.c 2009-01-16 21:37:10.000000000 +0200 ++++ mesa/src/mesa/drivers/dri/i915/i830_texstate.c 2009-04-03 11:45:43.000000000 +0300 +@@ -38,7 +38,7 @@ + + + static GLuint +-translate_texture_format(GLuint mesa_format) ++translate_texture_format(GLuint mesa_format, GLuint internal_format) + { + switch (mesa_format) { + case MESA_FORMAT_L8: +@@ -56,7 +56,10 @@ + case MESA_FORMAT_ARGB4444: + return MAPSURF_16BIT | MT_16BIT_ARGB4444; + case MESA_FORMAT_ARGB8888: +- return MAPSURF_32BIT | MT_32BIT_ARGB8888; ++ if (internal_format == GL_RGB) ++ return MAPSURF_32BIT | MT_32BIT_XRGB8888; ++ else ++ return MAPSURF_32BIT | MT_32BIT_ARGB8888; + case MESA_FORMAT_YCBCR_REV: + return (MAPSURF_422 | MT_422_YCRCB_NORMAL); + case MESA_FORMAT_YCBCR: +@@ -162,7 +165,8 @@ + 0, intelObj-> + firstLevel); + +- format = translate_texture_format(firstImage->TexFormat->MesaFormat); ++ format = translate_texture_format(firstImage->TexFormat->MesaFormat, ++ firstImage->InternalFormat); + pitch = intelObj->mt->pitch * intelObj->mt->cpp; + } + +Index: mesa/src/mesa/drivers/dri/i915/i915_texstate.c +=================================================================== +--- mesa.orig/src/mesa/drivers/dri/i915/i915_texstate.c 2009-01-16 21:40:22.000000000 +0200 ++++ mesa/src/mesa/drivers/dri/i915/i915_texstate.c 2009-04-03 11:45:43.000000000 +0300 +@@ -37,7 +37,8 @@ + + + static GLuint +-translate_texture_format(GLuint mesa_format, GLenum DepthMode) ++translate_texture_format(GLuint mesa_format, GLuint internal_format, ++ GLenum DepthMode) + { + switch (mesa_format) { + case MESA_FORMAT_L8: +@@ -55,7 +56,10 @@ + case MESA_FORMAT_ARGB4444: + return MAPSURF_16BIT | MT_16BIT_ARGB4444; + case MESA_FORMAT_ARGB8888: +- return MAPSURF_32BIT | MT_32BIT_ARGB8888; ++ if (internal_format == GL_RGB) ++ return MAPSURF_32BIT | MT_32BIT_XRGB8888; ++ else ++ return MAPSURF_32BIT | MT_32BIT_ARGB8888; + case MESA_FORMAT_YCBCR_REV: + return (MAPSURF_422 | MT_422_YCRCB_NORMAL); + case MESA_FORMAT_YCBCR: +@@ -173,7 +177,8 @@ + firstLevel); + + format = translate_texture_format(firstImage->TexFormat->MesaFormat, +- tObj->DepthMode); ++ firstImage->InternalFormat, ++ tObj->DepthMode); + pitch = intelObj->mt->pitch * intelObj->mt->cpp; + } + +Index: mesa/src/mesa/drivers/dri/i965/brw_wm_surface_state.c +=================================================================== +--- mesa.orig/src/mesa/drivers/dri/i965/brw_wm_surface_state.c 2009-03-30 10:34:15.000000000 +0300 ++++ mesa/src/mesa/drivers/dri/i965/brw_wm_surface_state.c 2009-04-03 11:45:43.000000000 +0300 +@@ -69,7 +69,8 @@ + } + + +-static GLuint translate_tex_format( GLuint mesa_format, GLenum depth_mode ) ++static GLuint translate_tex_format( GLuint mesa_format, GLenum internal_format, ++ GLenum depth_mode ) + { + switch( mesa_format ) { + case MESA_FORMAT_L8: +@@ -89,10 +90,16 @@ + return BRW_SURFACEFORMAT_R8G8B8_UNORM; + + case MESA_FORMAT_ARGB8888: +- return BRW_SURFACEFORMAT_B8G8R8A8_UNORM; ++ if (internal_format == GL_RGB) ++ return BRW_SURFACEFORMAT_B8G8R8X8_UNORM; ++ else ++ return BRW_SURFACEFORMAT_B8G8R8A8_UNORM; + + case MESA_FORMAT_RGBA8888_REV: +- return BRW_SURFACEFORMAT_R8G8B8A8_UNORM; ++ if (internal_format == GL_RGB) ++ return BRW_SURFACEFORMAT_R8G8B8X8_UNORM; ++ else ++ return BRW_SURFACEFORMAT_R8G8B8A8_UNORM; + + case MESA_FORMAT_RGB565: + return BRW_SURFACEFORMAT_B5G6R5_UNORM; +@@ -150,7 +157,7 @@ + struct brw_wm_surface_key { + GLenum target, depthmode; + dri_bo *bo; +- GLint format; ++ GLint format, internal_format; + GLint first_level, last_level; + GLint width, height, depth; + GLint pitch, cpp; +@@ -188,9 +195,11 @@ + + surf.ss0.mipmap_layout_mode = BRW_SURFACE_MIPMAPLAYOUT_BELOW; + surf.ss0.surface_type = translate_tex_target(key->target); +- +- if (key->bo) +- surf.ss0.surface_format = translate_tex_format(key->format, key->depthmode); ++ if (key->bo) { ++ surf.ss0.surface_format = translate_tex_format(key->format, ++ key->internal_format, ++ key->depthmode); ++ } + else { + switch (key->depth) { + case 32: +@@ -267,6 +276,7 @@ + key.offset = intelObj->textureOffset; + } else { + key.format = firstImage->TexFormat->MesaFormat; ++ key.internal_format = firstImage->InternalFormat; + key.pitch = intelObj->mt->pitch; + key.depth = firstImage->Depth; + key.bo = intelObj->mt->region->buffer; +Index: mesa/src/mesa/drivers/dri/intel/intel_screen.c +=================================================================== +--- mesa.orig/src/mesa/drivers/dri/intel/intel_screen.c 2009-04-03 11:45:43.000000000 +0300 ++++ mesa/src/mesa/drivers/dri/intel/intel_screen.c 2009-04-03 11:45:43.000000000 +0300 +@@ -210,6 +210,7 @@ + static const __DRItexBufferExtension intelTexBufferExtension = { + { __DRI_TEX_BUFFER, __DRI_TEX_BUFFER_VERSION }, + intelSetTexBuffer, ++ intelSetTexBuffer2, + }; + + static const __DRIextension *intelScreenExtensions[] = { +Index: mesa/src/mesa/drivers/dri/intel/intel_tex.h +=================================================================== +--- mesa.orig/src/mesa/drivers/dri/intel/intel_tex.h 2009-01-16 21:40:22.000000000 +0200 ++++ mesa/src/mesa/drivers/dri/intel/intel_tex.h 2009-04-03 11:45:43.000000000 +0300 +@@ -149,6 +149,8 @@ + unsigned long long offset, GLint depth, GLuint pitch); + void intelSetTexBuffer(__DRIcontext *pDRICtx, + GLint target, __DRIdrawable *pDraw); ++void intelSetTexBuffer2(__DRIcontext *pDRICtx, ++ GLint target, GLint format, __DRIdrawable *pDraw); + + GLuint intel_finalize_mipmap_tree(struct intel_context *intel, GLuint unit); + +Index: mesa/src/mesa/drivers/dri/intel/intel_tex_image.c +=================================================================== +--- mesa.orig/src/mesa/drivers/dri/intel/intel_tex_image.c 2009-03-30 10:34:15.000000000 +0300 ++++ mesa/src/mesa/drivers/dri/intel/intel_tex_image.c 2009-04-03 11:45:43.000000000 +0300 +@@ -712,7 +712,9 @@ + } + + void +-intelSetTexBuffer(__DRIcontext *pDRICtx, GLint target, __DRIdrawable *dPriv) ++intelSetTexBuffer2(__DRIcontext *pDRICtx, GLint target, ++ GLint glx_texture_format, ++ __DRIdrawable *dPriv) + { + struct intel_framebuffer *intel_fb = dPriv->driverPrivate; + struct intel_context *intel = pDRICtx->driverPrivate; +@@ -743,7 +745,10 @@ + + type = GL_BGRA; + format = GL_UNSIGNED_BYTE; +- internalFormat = (rb->region->cpp == 3 ? 3 : 4); ++ if (glx_texture_format == GLX_TEXTURE_FORMAT_RGB_EXT) ++ internalFormat = GL_RGB; ++ else ++ internalFormat = GL_RGBA; + + mt = intel_miptree_create_for_region(intel, target, + internalFormat, +@@ -783,3 +788,12 @@ + + _mesa_unlock_texture(&intel->ctx, texObj); + } ++ ++void ++intelSetTexBuffer(__DRIcontext *pDRICtx, GLint target, __DRIdrawable *dPriv) ++{ ++ /* The old interface didn't have the format argument, so copy our ++ * implementation's behavior at the time. ++ */ ++ intelSetTexBuffer2(pDRICtx, target, GLX_TEXTURE_FORMAT_RGBA_EXT, dPriv); ++} diff --git a/debian/patches/105_glXWaitX_segfaults.patch b/debian/patches/105_glXWaitX_segfaults.patch new file mode 100644 index 0000000000..985c5dd3c7 --- /dev/null +++ b/debian/patches/105_glXWaitX_segfaults.patch @@ -0,0 +1,11 @@ +--- Mesa-7.4/src/glx/x11/drisw_glx.c 2009-01-22 17:38:33.000000000 +0000 ++++ Mesa-7.4/src/glx/x11/drisw_glx.c.fixed 2009-04-03 23:25:17.000000000 +0100 +@@ -405,6 +405,8 @@ + psp->createContext = driCreateContext; + psp->createDrawable = driCreateDrawable; + psp->swapBuffers = driSwapBuffers; ++ psp->waitX = NULL; ++ psp->waitGL = NULL; + + return psp; + diff --git a/debian/patches/series b/debian/patches/series new file mode 100644 index 0000000000..9e646e47c6 --- /dev/null +++ b/debian/patches/series @@ -0,0 +1,8 @@ +02_use-ieee-fp-on-s390-and-m68k.patch +03_optional-progs-and-install.patch +04_osmesa_version.diff +101_ubuntu_hidden_glname.patch +102_dont_vblank.diff +#103_bump_965_texture_limit.diff +104_fix_dri2_ext_tfp.diff +105_glXWaitX_segfaults.patch diff --git a/debian/rules b/debian/rules new file mode 100755 index 0000000000..b1edec19d1 --- /dev/null +++ b/debian/rules @@ -0,0 +1,254 @@ +#!/usr/bin/make -f +# debian/rules for the Debian mesa package +# Copyright © 2006 Thierry Reding + +# Uncomment this to turn on verbose mode. +#export DH_VERBOSE=1 +unexport LDFLAGS + +CFLAGS = -Wall -g +ifneq (,$(filter noopt,$(DEB_BUILD_OPTIONS))) + CFLAGS += -O0 +else + CFLAGS += -O2 +endif +ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS))) + NUMJOBS = $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS))) + MAKEFLAGS += -j$(NUMJOBS) +endif + +DEB_BUILD_ARCH ?= $(shell dpkg-architecture -qDEB_BUILD_ARCH) +DEB_HOST_ARCH ?= $(shell dpkg-architecture -qDEB_HOST_ARCH) +DEB_HOST_ARCH_OS ?= $(shell dpkg-architecture -qDEB_HOST_ARCH_OS) +DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE) +DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE) +DEB_HOST_GNU_CPU ?= $(shell dpkg-architecture -qDEB_HOST_GNU_CPU) +DEB_BUILD_DIR ?= $(CURDIR)/obj-$(DEB_BUILD_GNU_TYPE) +ifeq ($(DEB_BUILD_GNU_TYPE), $(DEB_HOST_GNU_TYPE)) + confflags += --build=$(DEB_HOST_GNU_TYPE) +else + confflags += --build=$(DEB_BUILD_GNU_TYPE) --host=$(DEB_HOST_GNU_TYPE) +endif + +# choose which configurations to build +include debian/scripts/choose-configs + +# build the following configurations by default +CONFIGS = $(SWX11_GLU_CONFIGS) \ + dri \ + osmesa \ + osmesa-static \ + osmesa16 \ + osmesa16-static \ + osmesa32 \ + osmesa32-static + +STAMP_DIR = debian/stamp +STAMP = $(STAMP_DIR)/$(DEB_BUILD_GNU_TYPE) +BUILD_STAMPS = $(addprefix $(STAMP)-build-, $(CONFIGS)) +INSTALL_TARGETS = $(addprefix install-, $(CONFIGS)) + +QUILT_STAMPFN = $(STAMP_DIR)/patch +include /usr/share/quilt/quilt.make + +confflags-common = \ + --disable-glu \ + --disable-glut \ + --disable-glw \ + CFLAGS="$(CFLAGS)" + +DRI_DRIVERS = swrast + +# hurd doesn't do direct rendering +ifeq ($(DEB_HOST_ARCH_OS), hurd) + DIRECT_RENDERING = --disable-driglx-direct +else + DIRECT_RENDERING = --enable-driglx-direct + ifeq ($(DEB_HOST_ARCH), lpia) + DRI_DRIVERS += i915 i965 + else + DRI_DRIVERS += mach64 mga r128 r200 r300 radeon s3v savage tdfx trident + ifeq ($(DEB_HOST_GNU_CPU), i486) + DRI_DRIVERS += i810 i915 i965 sis unichrome + else ifeq ($(DEB_HOST_GNU_CPU), x86_64) + DRI_DRIVERS += i915 i965 sis unichrome + else ifeq ($(DEB_HOST_ARCH), sparc) + DRI_DRIVERS += ffb + endif + endif +endif + +confflags-dri = \ + --with-driver=dri \ + --with-dri-drivers="$(DRI_DRIVERS)" \ + --with-demos=xdemos \ + --libdir=/usr/lib/glx \ + --with-dri-driverdir=/usr/lib/dri \ + --enable-glx-tls \ + $(DIRECT_RENDERING) \ + $(confflags-common) + +confflags-osmesa = \ + --with-driver=osmesa \ + --with-demos= \ + $(confflags-common) + +confflags-osmesa-static = \ + --with-driver=osmesa \ + --enable-static \ + --with-demos= \ + $(confflags-common) + +confflags-osmesa16 = \ + --with-driver=osmesa \ + --with-osmesa-bits=16 \ + --with-demos= \ + $(confflags-common) + +confflags-osmesa16-static = \ + --with-driver=osmesa \ + --with-osmesa-bits=16 \ + --enable-static \ + --with-demos= \ + $(confflags-common) + +confflags-osmesa32 = \ + --with-driver=osmesa \ + --with-osmesa-bits=32 \ + --with-demos= \ + $(confflags-common) + +confflags-osmesa32-static = \ + --with-driver=osmesa \ + --with-osmesa-bits=32 \ + --enable-static \ + --with-demos= \ + $(confflags-common) + +confflags-swx11+glu = \ + --with-driver=xlib \ + --disable-gl-osmesa \ + --with-demos= \ + --disable-glut \ + --disable-glw \ + CFLAGS="$(CFLAGS)" + +confflags-swx11+glu-static = \ + --with-driver=xlib \ + --disable-gl-osmesa \ + --enable-static \ + --with-demos= \ + --disable-glut \ + --disable-glw \ + CFLAGS="$(CFLAGS)" + +confflags-swx11+glu-i386-i686 = \ + --with-driver=xlib \ + --disable-gl-osmesa \ + --with-demos= \ + --disable-glut \ + --disable-glw \ + --libdir=/usr/lib/i686/cmov \ + CFLAGS="$(CFLAGS) -march=i686" + +configure: $(QUILT_STAMPFN) configure.ac + autoreconf -vfi + +# list the configurations that will built +configs: + @echo Building the following configurations: $(CONFIGS) + +$(STAMP_DIR)/stamp: + dh_testdir + mkdir -p $(STAMP_DIR) + >$@ + +$(QUILT_STAMPFN): $(STAMP_DIR)/stamp + +build: $(BUILD_STAMPS) + +$(STAMP)-build-%: configure + dh_testdir + + mkdir -p $(DEB_BUILD_DIR)/$* + find $(CURDIR)/* -maxdepth 0 -not -path '$(DEB_BUILD_DIR)*' | \ + xargs cp -rlf -t $(DEB_BUILD_DIR)/$* + cd $(DEB_BUILD_DIR)/$* && \ + ../../configure --prefix=/usr --mandir=\$${prefix}/share/man \ + --infodir=\$${prefix}/share/info --sysconfdir=/etc \ + --localstatedir=/var $(confflags) $(confflags-$*) + cd $(DEB_BUILD_DIR)/$* && $(MAKE) + + touch $@ + +install: + # Add here commands to install the package into debian/tmp + dh_testdir + dh_testroot + dh_clean -k + dh_installdirs + $(MAKE) -f debian/rules $(INSTALL_TARGETS) + +install-%: $(STAMP)-build-% + cd $(DEB_BUILD_DIR)/$* && $(MAKE) DESTDIR=$(CURDIR)/debian/tmp install + touch $@ + +clean: unpatch + dh_testdir + dh_testroot + rm -rf .pc + + rm -f config.cache config.log config.status + rm -f */config.cache */config.log */config.status + rm -f conftest* */conftest* + rm -rf autom4te.cache */autom4te.cache + rm -rf obj-* + rm -rf configure config.guess config.sub config.h.in + rm -rf $$(find -name Makefile.in) + rm -rf aclocal.m4 missing depcomp install-sh ltmain.sh + rm -rf $(STAMP_DIR) + + dh_clean + +# Build architecture-independent files here. +binary-indep: install + dh_testdir + dh_testroot + dh_installchangelogs -i + dh_installdocs -i + dh_installexamples -i + dh_install --sourcedir=debian/tmp --list-missing -i + dh_installman -i + dh_link -i + dh_compress -i + dh_fixperms -i + dh_installdeb -i + dh_gencontrol -i + dh_md5sums -i + dh_builddeb -i + +# Build architecture-dependent files here. +binary-arch: install + dh_testdir + dh_testroot + dh_installchangelogs -s + dh_installdocs -s + dh_installexamples -s + dh_install -s --sourcedir=debian/tmp --list-missing + dh_installman -s + dh_link -s + dh_strip -plibgl1-mesa-swx11 --dbg-package=libgl1-mesa-swx11-dbg + dh_strip -plibgl1-mesa-glx --dbg-package=libgl1-mesa-glx-dbg + dh_strip -plibgl1-mesa-dri --dbg-package=libgl1-mesa-dri-dbg + dh_strip -s + dh_compress -s + dh_fixperms -s + dh_makeshlibs -s + dh_installdeb -s + dh_shlibdeps -s + dh_gencontrol -s + dh_md5sums -s + dh_builddeb -s -- -Zlzma + +binary: binary-indep binary-arch +.PHONY: configs build clean binary-indep binary-arch binary install diff --git a/debian/scripts/choose-configs b/debian/scripts/choose-configs new file mode 100644 index 0000000000..96050ecadc --- /dev/null +++ b/debian/scripts/choose-configs @@ -0,0 +1,58 @@ +# Script to choose which configurations are to be built depending on the value +# of the DEB_BUILD_ARCH variable. +# +# Copyright © 2006 Thierry Reding + +############################################################################## +## architecture-specific configurations ###################################### + +# choose an architecture-specific build of swx11 and GLU if a matching +# configuration exists +#ifneq ($(wildcard configs/debian-swx11+glu-$(DEB_BUILD_ARCH)),) +# SWX11_GLU_CONFIGS := debian-swx11+glu-$(DEB_BUILD_ARCH) +#else +# SWX11_GLU_CONFIGS := debian-swx11+glu-any +#endif + +# same for static builds +#ifneq ($(wildcard configs/debian-swx11+glu-static-$(DEB_BUILD_ARCH)),) +# SWX11_GLU_CONFIGS += debian-swx11+glu-static-$(DEB_BUILD_ARCH) +#else +# SWX11_GLU_CONFIGS += debian-swx11+glu-static-any +#endif + +SWX11_GLU_CONFIGS := swx11+glu swx11+glu-static + +# and for the GLX/DRI-enabled libGL +ifneq ($(wildcard configs/debian-indirect-$(DEB_BUILD_ARCH)),) + DRI_CONFIGS := debian-indirect-$(DEB_BUILD_ARCH) +else + ifneq ($(wildcard configs/debian-dri-$(DEB_BUILD_ARCH)),) + DRI_CONFIGS := debian-dri-$(DEB_BUILD_ARCH) + else + DRI_CONFIGS := debian-dri-any + endif +endif + +############################################################################## +## CPU-optimized configurations ############################################## + +ifeq ($(DEB_BUILD_ARCH), i386) + SWX11_GLU_CONFIGS += swx11+glu-i386-i686 +# DRI_CONFIGS += debian-dri-i386-i686 +endif + +#ifeq ($(DEB_BUILD_ARCH), alpha) +# SWX11_GLU_CONFIGS += debian-swx11+glu-alpha-ev5 +#endif + +#ifeq ($(DEB_BUILD_ARCH), powerpc) +# SWX11_GLU_CONFIGS += debian-swx11+glu-powerpc-603 +#endif + +#ifeq ($(DEB_BUILD_ARCH), sparc) +# SWX11_GLU_CONFIGS += debian-swx11+glu-sparc-ultrasparc +#endif + +# vim: ft=make + diff --git a/debian/watch b/debian/watch new file mode 100644 index 0000000000..b3b258a577 --- /dev/null +++ b/debian/watch @@ -0,0 +1,3 @@ +version=3 +opts="uversionmangle=s/-rc/~rc/" \ +http://sf.net/mesa3d/MesaLib-(.*)\.tar\.gz diff --git a/docs/OLD/MESA_packed_depth_stencil.spec b/docs/OLD/MESA_packed_depth_stencil.spec deleted file mode 100644 index 112b730ecc..0000000000 --- a/docs/OLD/MESA_packed_depth_stencil.spec +++ /dev/null @@ -1,230 +0,0 @@ -Name - - MESA_packed_depth_stencil - -Name Strings - - GL_MESA_packed_depth_stencil - -Contact - - Keith Whitwell, VA Linux Systems Inc. (keithw 'at' valinux.com) - Brian Paul, VA Linux Systems Inc. (brianp 'at' valinux.com) - -Status - - Obsolete. - -Version - - -Number - - ??? - -Dependencies - - EXT_abgr affects the definition of this extension - SGIS_texture4D affects the definition of this extension - EXT_cmyka affects the definition of this extension - ARB_packed_pixels affects the definition of this extension - -Overview - - Provides a mechanism for DrawPixels and ReadPixels to efficiently - transfer depth and stencil image data. Specifically, we defined new - packed pixel formats and types which pack both stencil and depth - into one value. - -Issues: - - 1. Is this the right way to distinguish between 24/8 and 8/24 - pixel formats? Should we instead provide both: - - GL_DEPTH_STENCIL_MESA - GL_STENCIL_DEPTH_MESA - - And perhaps just use GL_UNSIGNED_INT, GL_UNSIGNED_SHORT ? - - 2. If not, is it correct to use _REV to indicate that stencil - preceeds depth in the 1_15 and 8_24 formats? - - 3. Do we really want the GL_UNSIGNED_SHORT formats? - - -New Procedures and Functions - - None. - -New Tokens - - Accepted by the parameter of ReadPixels and DrawPixels: - - GL_DEPTH_STENCIL_MESA 0x8750 - - Accepted by the parameter of ReadPixels and DrawPixels: - - GL_UNSIGNED_INT_24_8_MESA 0x8751 - GL_UNSIGNED_INT_8_24_REV_MESA 0x8752 - GL_UNSIGNED_SHORT_15_1_MESA 0x8753 - GL_UNSIGNED_SHORT_1_15_REV_MESA 0x8754 - -Additions to Chapter 2 of the 1.1 Specification (OpenGL Operation) - - None - -Additions to Chapter 3 of the 1.1 Specification (Rasterization) - - One entry is added to table 3.5 (DrawPixels and ReadPixels formats). - The new table is: - - Target - Format Name Buffer Element Meaning and Order - ----------- ------ ------------------------- - COLOR_INDEX Color Color index - STENCIL_INDEX Stencil Stencil index - DEPTH_COMPONENT Depth Depth component - RED Color R component - GREEN Color G component - BLUE Color B component - ALPHA Color A component - RGB Color R, G, B components - RGBA Color R, G, B, A components - BGRA Color B, G, R, A components - ABGR_EXT Color A, B, G, R components - CMYK_EXT Color Cyan, Magenta, Yellow, Black components - CMYKA_EXT Color Cyan, Magenta, Yellow, Black, A components - LUMINANCE Color Luminance component - LUMINANCE_ALPHA Color Luminance, A components - DEPTH_STENCIL Depth, Depth component, stencil index. - Stencil - - Table 3.5: DrawPixels and ReadPixels formats. The third column - gives a description of and the number and order of elements in a - group. - - Add to the description of packed pixel formats: - - Parameter Data of Matching - Token Name Type Elements Pixel Formats - ---------------- ---- -------- ------------- - - UNSIGNED_BYTE_3_3_2 ubyte 3 RGB - UNSIGNED_BYTE_2_3_3_REV ubyte 3 RGB - UNSIGNED_SHORT_5_6_5 ushort 3 RGB - UNSIGNED_SHORT_5_6_5_REV ushort 3 RGB - UNSIGNED_SHORT_4_4_4_4 ushort 4 RGBA,BGRA,ABGR_EXT,CMYK_EXT - UNSIGNED_SHORT_4_4_4_4_REV ushort 4 RGBA,BGRA - UNSIGNED_SHORT_5_5_5_1 ushort 4 RGBA,BGRA,ABGR_EXT,CMYK_EXT - UNSIGNED_SHORT_1_5_5_5_REV ushort 4 RGBA,BGRA - UNSIGNED_INT_8_8_8_8 uint 4 RGBA,BGRA,ABGR_EXT,CMYK_EXT - UNSIGNED_INT_8_8_8_8_REV uint 4 RGBA,BGRA - UNSIGNED_INT_10_10_10_2 uint 4 RGBA,BGRA,ABGR_EXT,CMYK_EXT - UNSIGNED_INT_2_10_10_10_REV uint 4 RGBA,BGRA - UNSIGNED_SHORT_15_1_MESA ushort 2 DEPTH_STENCIL_MESA - UNSIGNED_SHORT_1_15_REV_MESA ushort 2 DEPTH_STENCIL_MESA - UNSIGNED_SHORT_24_8_MESA ushort 2 DEPTH_STENCIL_MESA - UNSIGNED_SHORT_8_24_REV_MESA ushort 2 DEPTH_STENCIL_MESA - - UNSIGNED_INT_8_24: - - 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 - +-----------------------+-----------------------------------------------------------------------+ - | | | - +-----------------------+-----------------------------------------------------------------------+ - - first second - element element - - - UNSIGNED_INT_24_8: - - 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 - +----------------------------------------------------------------------+------------------------+ - | | | - +----------------------------------------------------------------------+------------------------+ - - first second - element element - - UNSIGNED_SHORT_15_1: - - 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 - +-----------------------------------------------------------+---+ - | | | - +-----------------------------------------------------------+---+ - - first second - element element - - - UNSIGNED_SHORT_1_15_REV: - - 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 - +---+-----------------------------------------------------------+ - | | | - +---+-----------------------------------------------------------+ - - second first - element element - - The assignment of elements to fields in the packed pixel is as - described in the table below: - - First Second Third Fourth - Format Element Element Element Element - ------ ------- ------- ------- ------- - RGB red green blue - RGBA red green blue alpha - BGRA blue green red alpha - ABGR_EXT alpha blue green red - CMYK_EXT cyan magenta yellow black - DEPTH_STENCIL_MESA depth stencil - -Additions to Chapter 4 of the 1.1 Specification (Per-Fragment Operations -and the Frame Buffer) - - The new format is added to the discussion of Obtaining Pixels from the - Framebuffer. It should read " If the is one of RED, GREEN, - BLUE, ALPHA, RGB, RGBA, ABGR_EXT, LUMINANCE, or LUMINANCE_ALPHA, and - the GL is in color index mode, then the color index is obtained." - - The new format is added to the discussion of Index Lookup. It should - read "If is one of RED, GREEN, BLUE, ALPHA, RGB, RGBA, - ABGR_EXT, LUMINANCE, or LUMINANCE_ALPHA, then the index is used to - reference 4 tables of color components: PIXEL_MAP_I_TO_R, - PIXEL_MAP_I_TO_G, PIXEL_MAP_I_TO_B, and PIXEL_MAP_I_TO_A." - - -Additions to Chapter 5 of the 1.1 Specification (Special Functions) - - None - -Additions to Chapter 6 of the 1.1 Specification (State and State Requests) - - None - -Additions to the GLX Specification - - None - -GLX Protocol - - TBD - -Errors - - None - -New State - - None - -Revision History - - Version 1.0 - 23 Sep 2000 - Keith's original version. - - Version 1.1 - 3 Nov 2000 - Brian's edits, assigned values to new enums. - diff --git a/docs/OLD/MESA_program_debug.spec b/docs/OLD/MESA_program_debug.spec deleted file mode 100644 index 7694fdcc42..0000000000 --- a/docs/OLD/MESA_program_debug.spec +++ /dev/null @@ -1,356 +0,0 @@ -Name - - MESA_program_debug - -Name Strings - - GL_MESA_program_debug - -Contact - - Brian Paul (brian.paul 'at' tungstengraphics.com) - -Status - - XXX - Not complete yet!!! - -Version - - Last Modified Date: July 20, 2003 - Author Revision: 1.0 - -Number - - TBD - -Dependencies - - OpenGL 1.4 is required - The extension is written against the OpenGL 1.4 specification. - ARB_vertex_program or ARB_fragment_program or NV_vertex_program - or NV_fragment_program is required. - -Overview - - The extension provides facilities for implementing debuggers for - vertex and fragment programs. - - The concept is that vertex and fragment program debuggers will be - implemented outside of the GL as a utility package. This extension - only provides the minimal hooks required to implement a debugger. - - There are facilities to do the following: - 1. Have the GL call a user-specified function prior to executing - each vertex or fragment instruction. - 2. Query the current program string's execution position. - 3. Query the current values of intermediate program values. - - The main feature is the ProgramCallbackMESA function. It allows the - user to register a callback function with the GL. The callback will - be called prior to executing each vertex or fragment program instruction. - - From within the callback, the user may issue Get* commands to - query current GL state. The GetProgramRegisterfvMESA function allows - current program values to be queried (such as temporaries, input - attributes, and result registers). - - There are flags for enabling/disabling the program callbacks. - - The current execution position (as an offset from the start of the - program string) can be queried with - GetIntegerv(GL_FRAGMENT_PROGRAM_POSITION_MESA, &pos) or - GetIntegerv(GL_VERTEX_PROGRAM_POSITION_MESA, &pos). - - -IP Status - - None - -Issues - - 1. Is this the right model for a debugger? - - It seems prudent to minimize the scope of this extension and leave - it up to the developer (or developer community) to write debuggers - that layer on top of this extension. - - If the debugger were fully implemented within the GL it's not - clear how terminal and GUI-based interfaces would work, for - example. - - 2. There aren't any other extensions that register callbacks with - the GL. Isn't there another solution? - - If we want to be able to single-step through vertex/fragment - programs I don't see another way to do it. - - 3. How do we prevent the user from doing something crazy in the - callback function, like trying to call glBegin (leading to - recursion)? - - The rule is that the callback function can only issue glGet*() - functions and no other GL commands. It could be difficult to - enforce this, however. Therefore, calling any non-get GL - command from within the callback will result in undefined - results. - - 4. Is this extension amenable to hardware implementation? - - Hopefully, but if not, the GL implementation will have to fall - back to a software path when debugging. This may be acceptable - for debugging. - - 5. What's the parameter to ProgramCallbackMESA for? - - It's a common programming practice to associate a user-supplied - value with callback functions. - - 6. Debuggers often allow one to modify intermediate program values, - then continue. Does this extension support that? - - No. - - -New Procedures and Functions (and datatypes) - - typedef void (*programcallbackMESA)(enum target, void *data) - - void ProgramCallbackMESA(enum target, programcallbackMESA callback, - void *data) - - void GetProgramRegisterfvMESA(enum target, sizei len, - const ubyte *registerName, float *v) - -New Tokens - - Accepted by the parameter of Enable, Disable, IsEnabled, - GetBooleanv, GetDoublev, GetFloatv and GetIntegerv: - - FRAGMENT_PROGRAM_CALLBACK_MESA 0x8bb1 - VERTEX_PROGRAM_CALLBACK_MESA 0x8bb4 - - Accepted by the parameter GetBooleanv, GetDoublev, - GetFloatv and GetIntegerv: - - FRAGMENT_PROGRAM_POSITION_MESA 0x8bb0 - VERTEX_PROGRAM_POSITION_MESA 0x8bb4 - - Accepted by the parameter of GetPointerv: - - FRAGMENT_PROGRAM_CALLBACK_FUNC_MESA 0x8bb2 - FRAGMENT_PROGRAM_CALLBACK_DATA_MESA 0x8bb3 - VERTEX_PROGRAM_CALLBACK_FUNC_MESA 0x8bb6 - VERTEX_PROGRAM_CALLBACK_DATA_MESA 0x8bb7 - -Additions to Chapter 2 of the OpenGL 1.4 Specification (OpenGL Operation) - - None. - -Additions to Chapter 3 of the OpenGL 1.4 Specification (Rasterization) - - None. - -Additions to Chapter 4 of the OpenGL 1.4 Specification (Per-Fragment -Operations and the Frame Buffer) - - None. - -Additions to Chapter 5 of the OpenGL 1.4 Specification (Special Functions) - - In section 5.4 "Display Lists", page 202, add the following command - to the list of those that are not compiled into display lists: - - ProgramCallbackMESA. - - - Add a new section 5.7 "Callback Functions" - - The function - - void ProgramCallbackMESA(enum target, programcallbackMESA callback, - void *data) - - registers a user-defined callback function with the GL. - may be FRAGMENT_PROGRAM_ARB or VERTEX_PROGRAM_ARB. The enabled - callback functions registered with these targets will be called - prior to executing each instruction in the current fragment or - vertex program, respectively. The callbacks are enabled and - disabled by calling Enable or Disable with - FRAGMENT_PROGRAM_ARB or VERTEX_PROGRAM_ARB. - - The callback function's signature must match the typedef - - typedef void (*programcallbackMESA)(enum target, void *data) - - When the callback function is called, will either be - FRAGMENT_PROGRAM_ARB or VERTEX_PROGRAM_ARB to indicate which - program is currently executing and will be the value - specified when ProgramCallbackMESA was called. - - From within the callback function, only the following GL commands - may be called: - - GetBooleanv - GetDoublev - GetFloatv - GetIntegerv - GetProgramLocalParameter - GetProgramEnvParameter - GetProgramRegisterfvMESA - GetProgramivARB - GetProgramStringARB - GetError - - Calling any other command from within the callback results in - undefined behaviour. - - -Additions to Chapter 6 of the OpenGL 1.4 Specification (State and -State Requests) - - Add a new section 6.1.3 "Program Value Queries": - - The command - - void GetProgramRegisterfvMESA(enum target, sizei len, - const ubyte *registerName, - float *v) - - Is used to query the value of program variables and registers - during program execution. GetProgramRegisterfvMESA may only be - called from within a callback function registered with - ProgramCallbackMESA. - - and specify the name a variable, input - attribute, temporary, or result register in the program string. - The current value of the named variable is returned as four - values in . If doesn't exist in the program string, - the error INVALID_OPERATION is generated. - -Additions to Appendix A of the OpenGL 1.4 Specification (Invariance) - - None. - -Additions to the AGL/GLX/WGL Specifications - - None. - -GLX Protocol - - XXX TBD - -Dependencies on NV_vertex_program and NV_fragment_program - - If NV_vertex_program and/or NV_fragment_program are supported, - vertex and/or fragment programs defined by those extensions may - be debugged as well. Register queries will use the syntax used - by those extensions (i.e. "v[X]" to query vertex attributes, - "o[X]" for vertex outputs, etc.) - -Errors - - INVALID_OPERATION is generated if ProgramCallbackMESA is called - between Begin and End. - - INVALID_ENUM is generated by ProgramCallbackMESA if is not - a supported vertex or fragment program type. - - Note: INVALID_OPERAION IS NOT generated by GetProgramRegisterfvMESA, - GetBooleanv, GetDoublev, GetFloatv, or GetIntegerv if called between - Begin and End when a vertex or fragment program is currently executing. - - INVALID_ENUM is generated by ProgramCallbackMESA, - GetProgramRegisterfvMESA if is not a program target supported - by ARB_vertex_program, ARB_fragment_program (or NV_vertex_program or - NV_fragment_program). - - INVALID_VALUE is generated by GetProgramRegisterfvMESA if - does not name a known program register or variable. - - INVALID_OPERATION is generated by GetProgramRegisterfvMESA when a - register query is attempted for a program target that's not currently - being executed. - - -New State - - XXX finish - -(table 6.N, p. ###) - Initial - Get Value Type Get Command Value Description Sec. Attribute - --------- ---- ----------- ----- ----------- ---- --------- - FRAGMENT_PROGRAM_CALLBACK_MESA B IsEnabled FALSE XXX XXX enable - VERTEX_PROGRAM_CALLBACK_MESA B IsEnabled FALSE XXX XXX enable - FRAGMENT_PROGRAM_POSITION_MESA Z+ GetIntegerv -1 XXX XXX - - VERTEX_PROGRAM_POSITION_MESA Z+ GetIntegerv -1 XXX XXX - - FRAGMENT_PROGRAM_CALLBACK_FUNC_MESA P GetPointerv NULL XXX XXX - - VERTEX_PROGRAM_CALLBACK_FUNC_MESA P GetPointerv NULL XXX XXX - - FRAGMENT_PROGRAM_CALLBACK_DATA_MESA P GetPointerv NULL XXX XXX - - VERTEX_PROGRAM_CALLBACK_DATA_MESA P GetPointerv NULL XXX XXX - - - XXX more? - -New Implementation Dependent State - - None. - -Revision History - - 8 July 2003 - Initial draft. (Brian Paul) - 11 July 2003 - Second draft. (Brian Paul) - 20 July 2003 - Third draft. Lots of fundamental changes. (Brian Paul) - 23 July 2003 - Added chapter 5 and 6 spec language. (Brian Paul) - -Example Usage - - The following is a very simple example of how this extension may - be used to print the values of R0, R1, R2 and R3 while executing - vertex programs. - - - /* This is called by the GL when the vertex program is executing. - * We can only make glGet* calls from within this function! - */ - void DebugCallback(GLenum target, GLvoid *data) - { - GLint pos; - GLuint i; - - /* Get PC and current instruction string */ - glGetIntegerv(GL_VERTEX_PROGRAM_POSITION_ARB, &pos); - - printf("Current position: %d\n", pos); - - printf("Current temporary registers:\n"); - for (i = 0; i < 4; i++) { - GLfloat v[4]; - char s[10]; - sprintf(s, "R%d", i); - glGetProgramRegisterfvMESA(GL_VERTEX_PROGRAM_ARB, strlen(s), s, v); - printf("R%d = %g, %g, %g, %g\n", i, v[0], v[1], v[2], v[3]); - } - } - - - /* - * elsewhere... - */ - - /* Register our debugger callback function */ - glProgramCallbackMESA(GL_VERTEX_PROGRAM_ARB, DebugCallback, NULL); - glEnable(GL_VERTEX_PROGRAM_CALLBACK_MESA); - - /* define/bind a vertex program */ - - glEnable(GL_VERTEX_PROGRAM); - - /* render something */ - glBegin(GL_POINTS); - glVertex2f(0, 0); - glEnd(); - diff --git a/docs/OLD/MESA_sprite_point.spec b/docs/OLD/MESA_sprite_point.spec deleted file mode 100644 index b50d78e9e7..0000000000 --- a/docs/OLD/MESA_sprite_point.spec +++ /dev/null @@ -1,190 +0,0 @@ -Name - - MESA_sprite_point - -Name Strings - - GL_MESA_sprite_point - -Contact - - Brian Paul, VA Linux Systems Inc. (brianp 'at' valinux.com) - -Status - - Obsolete - see GL_ARB_point_sprite. - -Version - - -Number - - ??? - -Dependencies - - GL_EXT_point_parameters effects the definition of this extension - GL_ARB_multitexture effects the definition of this extension - -Overview - - This extension modifies the way in which points are rendered, - specifically when they're textured. When SPRITE_POINT_MESA is enabled - a point is rendered as if it were a quadrilateral with unique texture - coordinates at each vertex. This extension effectively turns points - into sprites which may be rendered more easily and quickly than using - conventional textured quadrilaterals. - - When using point size > 1 or attenuated points this extension is an - effective way to render many small sprite images for particle systems - or other effects. - -Issues: - - 1. How are the texture coordinates computed? - - The lower-left corner has texture coordinate (0,0,r,q). - The lower-right, (1,0,r,q). The upper-right, (1,1,r,q). - The upper-left, (0,1,r,q). - - 2. What about texgen and texture matrices? - - Texgen and the texture matrix have no effect on the point's s and t - texture coordinates. The r and q coordinates may have been computed - by texgen or the texture matrix. Note that with a 3D texture and/or - texgen that the r coordinate could be used to select a slice in the - 3D texture. - - 3. What about point smoothing? - - When point smoothing is enabled, a triangle fan could be rendered - to approximate a circular point. This could be problematic to - define and implement so POINT_SMOOTH is ignored when drawing sprite - points. - - Smoothed points can be approximated by using an appropriate texture - images, alpha testing and blending. - - POLYGON_SMOOTH does effect the rendering of the quadrilateral, however. - - 4. What about sprite rotation? - - There is none. Sprite points are always rendered as window-aligned - squares. One could define rotated texture images if desired. A 3D - texture and appropriate texture r coordinates could be used to - effectively specify image rotation per point. - - 5. What about POLYGON_MODE? - - POLYGON_MODE does not effect the rasterization of the quadrilateral. - - 6. What about POLYGON_CULL? - - TBD. Polygon culling is normally specified and implemented in the - transformation stage of OpenGL. However, some rasterization hardware - implements it later during triangle setup. - - Polygon culling wouldn't be useful for sprite points since the - quadrilaterals are always defined in counter-clockwise order in - window space. For that reason, polygon culling should probably be - ignored. - - 7. Should sprite points be alpha-attenuated if their size is below the - point parameter's threshold size? - - 8. Should there be an advertisized maximum sprite point size? - - No. Since we're rendering the point as a quadrilateral there's no - need to limit the size. - - -New Procedures and Functions - - None. - -New Tokens - - Accepted by the parameter of Enable, Disable, IsEnabled, - GetIntegerv, GetBooleanv, GetFloatv and GetDoublev: - - SPRITE_POINT_MESA 0x???? - MAX_SPRITE_POINT_SIZE_MESA 0x???? (need this?) - -Additions to Chapter 2 of the 1.1 Specification (OpenGL Operation) - - None - -Additions to Chapter 3 of the 1.1 Specification (Rasterization) - - Section ???. - - When SPRITE_POINT_MESA is enabled points are rasterized as screen- - aligned quadrilaterals. If the four vertices of the quadrilateral - are labeled A, B, C, and D, starting at the lower-left corner and moving - counter-clockwise around the quadrilateral, then the vertex and - texture coordinates are computed as follows: - - vertex window coordinate texture coordinate - A (x-r, y-r, z, w) (0, 0, r, q) - B (x+r, y-r, z, w) (1, 0, r, q) - C (x+r, y+r, z, w) (1, 1, r, q) - D (x-r, y+r, z, w) (0, 1, r, q) - - where x, y, z, w are the point's window coordinates, r and q are the - point's 3rd and 4th texture coordinates and r is half the point's - size. The other vertex attributes (such as the color and fog coordinate) - are simply duplicated from the original point vertex. - - Point size may either be specified with PointSize or computed - according to the EXT_point_parameters extension. - - The new texture coordinates are not effected by texgen or the texture - matrix. Note, however, that the texture r and q coordinates are passed - unchanged and may have been computed with texgen and/or the texture - matrix. - - If multiple texture units are present the same texture coordinate is - used for all texture units. - - The point is then rendered as if it were a quadrilateral using the - normal point sampling rules. POLYGON_MODE does not effect the - rasterization of the quadrilateral but POLYGON_SMOOTH does. - - POINT_SMOOTH has no effect when SPRITE_POINT_MESA is enabled. - -Additions to Chapter 4 of the 1.1 Specification (Per-Fragment Operations -and the Frame Buffer) - - None. - -Additions to Chapter 5 of the 1.1 Specification (Special Functions) - - None - -Additions to Chapter 6 of the 1.1 Specification (State and State Requests) - - None - -Additions to the GLX Specification - - None - -GLX Protocol - - TBD - -Errors - - None - -New State - - Add boolean variable SPRITE_POINT_MESA to the point attribute group. - -Revision History - - Version 1.0 - 4 Dec 2000 - Original draft. - - - diff --git a/docs/OLD/MESA_trace.spec b/docs/OLD/MESA_trace.spec deleted file mode 100644 index dc4166e6b6..0000000000 --- a/docs/OLD/MESA_trace.spec +++ /dev/null @@ -1,359 +0,0 @@ -Name - - MESA_trace - -Name Strings - - GL_MESA_trace - -Contact - - Bernd Kreimeier, Loki Entertainment, bk 'at' lokigames.com - Brian Paul, VA Linux Systems, Inc., brianp 'at' valinux.com - -Status - - Obsolete. - -Version - - -Number - - none yet - -Dependencies - - OpenGL 1.2 is required. - The extension is written against the OpenGL 1.2 Specification - -Overview - - Provides the application with means to enable and disable logging - of GL calls including parameters as readable text. The verbosity - of the generated log can be controlled. The resulting logs are - valid (but possibly incomplete) C code and can be compiled and - linked for standalone test programs. The set of calls and the - amount of static data that is logged can be controlled at runtime. - The application can add comments and enable or disable tracing of GL - operations at any time. The data flow from the application to GL - and back is unaffected except for timing. - - Application-side implementation of these features raises namespace - and linkage issues. In the driver dispatch table a simple - "chain of responsibility" pattern (aka "composable piepline") - can be added. - -IP Status - - The extension spec is in the public domain. The current implementation - in Mesa is covered by Mesa's XFree86-style copyright by the authors above. - This extension is partially inspired by the Quake2 QGL wrapper. - -Issues - - - (1) Is this Extension obsolete because it can - be implemented as a wrapper DLL? - - RESOLVED: No. While certain operating systems (Win32) provide linkers - that facilitate this kind of solution, other operating systems - (Linux) do not support hierarchical linking, so a wrapper solution - would result in symbol collisions. - Further, IHV's might have builtin support for tracing GL execution - that enjoys privileged access, or that they do not wish to separate - the tracing code from their driver code base. - - (2) Should the Trace API explicitely support the notion of "frames? - This would require hooking into glXSwapBuffers calls as well. - - RESOLVED: No. The application can use NewTraceMESA/EndTraceMESA - and TraceComment along with external parsing tools to split the - trace into frames, in whatever way considered adequate. - - (2a) Should GLX calls be traced? - - PBuffers and other render-to-texture solutions demonstrate that - context level commands beyond SwapBuffers might have to be - traced. The GL DLL exports the entry points, so this would not - be out of the question. - - (3) Should the specification mandate the actual output format? - - RESOLVED: No. It is sufficient to guarantee that all data and commands - will be traced as requested by Enable/DisableTraceMESA, in the order - encountered. Whether the resulting trace is available as a readable - text file, binary metafile, compilable source code, much less which - indentation and formatting has been used, is up to the implementation. - For the same reason this specification does not enforce or prohibit - additional information added to the trace (statistics, profiling/timing, - warnings on possible error conditions). - - (4) Should the comment strings associated with names and pointer (ranges) - be considered persistent state? - - RESOLVED: No. The implementation is not forced to use this information - on subsequent occurences of name/pointer, and is free to consider it - transient state. - - (5) Should comment commands be prohibited between Begin/End? - - RESOLVED: Yes, with the exception of TraceCommentMESA. TraceCommentMESA - is transient, the other commands might cause storage of persistent - data in the context. There is no need to have the ability mark names - or pointers between Begin and End. - - -New Procedures and Functions - - void NewTraceMESA( bitfield mask, const ubyte * traceName ) - - void EndTraceMESA( void ) - - void EnableTraceMESA( bitfield mask ) - - void DisableTraceMESA( bitfield mask ) - - void TraceAssertAttribMESA( bitfield attribMask ) - - void TraceCommentMESA( const ubyte* comment ) - - void TraceTextureMESA( uint name, const ubyte* comment ) - - void TraceListMESA( uint name, const ubyte* comment ) - - void TracePointerMESA( void* pointer, const ubyte* comment ) - - void TracePointerRangeMESA( const void* first, - const void* last, - const ubyte* comment ) - -New Tokens - - Accepted by the parameter of EnableTrace and DisableTrace: - - TRACE_ALL_BITS_MESA 0xFFFF - TRACE_OPERATIONS_BIT_MESA 0x0001 - TRACE_PRIMITIVES_BIT_MESA 0x0002 - TRACE_ARRAYS_BIT_MESA 0x0004 - TRACE_TEXTURES_BIT_MESA 0x0008 - TRACE_PIXELS_BIT_MESA 0x0010 - TRACE_ERRORS_BIT_MESA 0x0020 - - Accepted by the parameter of GetIntegerv, GetBooleanv, - GetFloatv, and GetDoublev: - - TRACE_MASK_MESA 0x8755 - - Accepted by the parameter to GetString: - - TRACE_NAME_MESA 0x8756 - - -Additions to Chapter 2 of the OpenGL 1.2.1 Specification (OpenGL Operation) - - None. - -Additions to Chapter 3 of the OpenGL 1.2.1 Specification (OpenGL Operation) - - None. - -Additions to Chapter 4 of the OpenGL 1.2.1 Specification (OpenGL Operation) - - None. - -Additions to Chapter 5 of the OpenGL 1.2.1 Specification (Special Functions) - - Add a new section: - - 5.7 Tracing - - The tracing facility is used to record the execution of a GL program - to a human-readable log. The log appears as a sequence of GL commands - using C syntax. The primary intention of tracing is to aid in program - debugging. - - A trace is started with the command - - void NewTraceMESA( bitfield mask, const GLubyte * traceName ) - - may be any value accepted by PushAttrib and specifies a set of - attribute groups. The state values included in those attribute groups - is written to the trace as a sequence of GL commands. - - specifies a name or label for the trace. It is expected - that will be interpreted as a filename in most implementations. - - A trace is ended by calling the command - - void EndTraceMESA( void ) - - It is illegal to call NewTraceMESA or EndTraceMESA between Begin and End. - - The commands - - void EnableTraceMESA( bitfield mask ) - void DisableTraceMESA( bitfield mask ) - - enable or disable tracing of different classes of GL commands. - may be the union of any of TRACE_OPERATIONS_BIT_MESA, - TRACE_PRIMITIVES_BIT_MESA, TRACE_ARRAYS_BIT_MESA, TRACE_TEXTURES_BIT_MESA, - and TRACE_PIXELS_BIT_MESA. The special token TRACE_ALL_BITS_MESA - indicates all classes of commands are to be logged. - - TRACE_OPERATIONS_BIT_MESA controls logging of all commands outside of - Begin/End, including Begin/End. - - TRACE_PRIMITIVES_BIT_MESA controls logging of all commands inside of - Begin/End, including Begin/End. - - TRACE_ARRAYS_BIT_MESA controls logging of VertexPointer, NormalPointer, - ColorPointer, IndexPointer, TexCoordPointer and EdgeFlagPointer commands. - - TRACE_TEXTURES_BIT_MESA controls logging of texture data dereferenced by - TexImage1D, TexImage2D, TexImage3D, TexSubImage1D, TexSubImage2D, and - TexSubImage3D commands. - - TRACE_PIXELS_BIT_MESA controls logging of image data dereferenced by - Bitmap and DrawPixels commands. - - TRACE_ERRORS_BIT_MESA controls logging of all errors. If this bit is - set, GetError will be executed whereever applicable, and the result will - be added to the trace as a comment. The error returns are cached and - returned to the application on its GetError calls. If the user does not - wish the additional GetError calls to be performed, this bit should not - be set. - - The command - - void TraceCommentMESA( const ubyte* comment ) - - immediately adds the string to the trace output, surrounded - by C-style comment delimiters. - - The commands - - void TraceTextureMESA( uint name, const ubyte* comment ) - void TraceListMESA( uint name, const ubyte* comment ) - - associates with the texture object or display list specified - by . Logged commands which reference the named texture object or - display list will be annotated with . If IsTexture(name) or - IsList(name) fail (respectively) the command is quietly ignored. - - The commands - - void TracePointerMESA( void* pointer, const ubyte* comment ) - - void TracePointerRangeMESA( const void* first, - const void* last, - const ubyte* comment ) - - associate with the address specified by or with - a range of addresses specified by through . - Any logged commands which reference or an address between - and will be annotated with . - - The command - - void TraceAssertAttribMESA( bitfield attribMask ) - - will add GL state queries and assertion statements to the log to - confirm that the current state at the time TraceAssertAttrib is - executed matches the current state when the trace log is executed - in the future. - - is any value accepted by PushAttrib and specifies - the groups of state variables which are to be asserted. - - The commands NewTraceMESA, EndTraceMESA, EnableTraceMESA, DisableTraceMESA, - TraceAssertAttribMESA, TraceCommentMESA, TraceTextureMESA, TraceListMESA, - TracePointerMESA and TracePointerRangeMESA are not compiled into display lists. - - - Examples: - - The command NewTraceMESA(DEPTH_BUFFER_BIT, "log") will query the state - variables DEPTH_TEST, DEPTH_FUNC, DEPTH_WRITEMASK, and DEPTH_CLEAR_VALUE - to get the values , , , and respectively. - Statements equivalent to the following will then be logged: - - glEnable(GL_DEPTH_TEST); (if is true) - glDisable(GL_DEPTH_TEST); (if is false) - glDepthFunc(); - glDepthMask(); - glClearDepth(); - - - The command TraceAssertAttribMESA(DEPTH_BUFFER_BIT) will query the state - variables DEPTH_TEST, DEPTH_FUNC, DEPTH_WRITEMASK, and DEPTH_CLEAR_VALUE - to get the values , , , and respectively. - The resulting trace might then look will like this: - - { - GLboolean b; - GLint i; - GLfloat f; - b = glIsEnabled(GL_DEPTH_TEST); - assert(b == ); - glGetIntegerv(GL_DEPTH_FUNC, &i); - assert(i == ); - glGetIntegerv(GL_DEPTH_MASK, &i); - assert(i == ); - glGetFloatv(GL_DEPTH_CLEAR_VALUE, &f); - assert(f == ); - } - - -Additions to Chapter 6 of the OpenGL 1.2.1 Specification - (State and State Requests) - - Querying TRACE_MASK_MESA with GetIntegerv, GetFloatv, GetBooleanv or - GetDoublev returns the current command class trace mask. - - Querying TRACE_NAME_MESA with GetString returns the current trace name. - - -Additions to Appendix A of the OpenGL 1.2.1 Specification (Invariance) - - The MESA_trace extension can be used in a way that does not affect data - flow from application to OpenGL, as well as data flow from OpenGL to - application, except for timing, possible print I/O. TRACE_ERRORS_BIT_MESA - will add additional GetError queries. Setting a trace mask with NewTraceMESA - as well as use of TraceAssertAttribMESA might cause additional state queries. - With the possible exception of performance, OpenGL rendering should not be - affected at all by a properly chosen logging operation. - -Additions to the AGL/GLX/WGL Specifications - - None. - -GLX Protocol - - None. The logging operation is carried out client-side, by exporting - entry points to the wrapper functions that execute the logging operation. - -Errors - - INVALID_OPERATION is generated if any trace command except TraceCommentMESA - is called between Begin and End. - -New State - - The current trace name and current command class mask are stored - per-context. - -New Implementation Dependent State - - None. - -Revision History - - * Revision 0.1 - Initial draft from template (bk000415) - * Revision 0.2 - Draft (bk000906) - * Revision 0.3 - Draft (bk000913) - * Revision 0.4 - Reworked text, fixed typos (bp000914) - * Revision 0.5 - Assigned final GLenum values (bp001103) - * Revision 0.6 - TRACE_ERRORS_BIT_MESA (bk000916) - * Revision 0.7 - Added MESA postfix (bk010126) - diff --git a/docs/gears.png b/docs/gears.png deleted file mode 100644 index 4052b30ed0..0000000000 Binary files a/docs/gears.png and /dev/null differ diff --git a/doxygen/.gitignore b/doxygen/.gitignore deleted file mode 100644 index 1b0edf90a6..0000000000 --- a/doxygen/.gitignore +++ /dev/null @@ -1,15 +0,0 @@ -*.tag -agpgart -array_cache -core -core_subset -math -math_subset -miniglx -radeon_subset -radeondrm -radeonfb -swrast -swrast_setup -tnl -tnl_dd diff --git a/doxygen/Makefile b/doxygen/Makefile deleted file mode 100644 index 15ade4043b..0000000000 --- a/doxygen/Makefile +++ /dev/null @@ -1,33 +0,0 @@ - -default: full - -all: full subset - -%.tag: %.doxy - doxygen $< - -FULL = \ - main.doxy \ - math.doxy \ - vbo.doxy \ - glapi.doxy \ - shader.doxy \ - swrast.doxy \ - swrast_setup.doxy \ - tnl.doxy \ - tnl_dd.doxy - -full: $(FULL:.doxy=.tag) - $(foreach FILE,$(FULL),doxygen $(FILE);) - -SUBSET = \ - main.doxy \ - math.doxy \ - miniglx.doxy - -subset: $(SUBSET:.doxy=.tag) - $(foreach FILE,$(SUBSET),doxygen $(FILE);) - -clean: - -rm -rf $(FULL:.doxy=) $(SUBSET:.doxy=) - -rm -rf *.tag diff --git a/doxygen/README b/doxygen/README deleted file mode 100644 index 9b820041d1..0000000000 --- a/doxygen/README +++ /dev/null @@ -1,10 +0,0 @@ - -This directory is for doxygen (a source code documentation system). - -See http://www.doxygen.org/ for more info. - -Either run 'make' (Unix) or 'doxy.bat' (Windows) to run doxygen -and generate souce code documentation. - -Then, load either doxygen/main/index.html or doxygen/core_subset/index.html into -your web browser. diff --git a/doxygen/common.doxy b/doxygen/common.doxy deleted file mode 100644 index 48f0c95d6d..0000000000 --- a/doxygen/common.doxy +++ /dev/null @@ -1,1153 +0,0 @@ -# Doxyfile 1.3.8 - -# This file describes the settings to be used by the documentation system -# doxygen (www.doxygen.org) for a project -# -# All text after a hash (#) is considered a comment and will be ignored -# The format is: -# TAG = value [value, ...] -# For lists items can also be appended using: -# TAG += value [value, ...] -# Values that contain spaces should be placed between quotes (" ") - -#--------------------------------------------------------------------------- -# Project related configuration options -#--------------------------------------------------------------------------- - -# The PROJECT_NAME tag is a single word (or a sequence of words surrounded -# by quotes) that should identify the project. - -PROJECT_NAME = Mesa - -# The PROJECT_NUMBER tag can be used to enter a project or revision number. -# This could be handy for archiving the generated documentation or -# if some version control system is used. - -PROJECT_NUMBER = 6.5 - -# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) -# base path where the generated documentation will be put. -# If a relative path is entered, it will be relative to the location -# where doxygen was started. If left blank the current directory will be used. - -OUTPUT_DIRECTORY = - -# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create -# 4096 sub-directories (in 2 levels) under the output directory of each output -# format and will distribute the generated files over these directories. -# Enabling this option can be useful when feeding doxygen a huge amount of source -# files, where putting all generated files in the same directory would otherwise -# cause performance problems for the file system. - -CREATE_SUBDIRS = NO - -# The OUTPUT_LANGUAGE tag is used to specify the language in which all -# documentation generated by doxygen is written. Doxygen will use this -# information to generate all constant output in the proper language. -# The default language is English, other supported languages are: -# Brazilian, Catalan, Chinese, Chinese-Traditional, Croatian, Czech, Danish, -# Dutch, Finnish, French, German, Greek, Hungarian, Italian, Japanese, -# Japanese-en (Japanese with English messages), Korean, Korean-en, Norwegian, -# Polish, Portuguese, Romanian, Russian, Serbian, Slovak, Slovene, Spanish, -# Swedish, and Ukrainian. - -OUTPUT_LANGUAGE = English - -# This tag can be used to specify the encoding used in the generated output. -# The encoding is not always determined by the language that is chosen, -# but also whether or not the output is meant for Windows or non-Windows users. -# In case there is a difference, setting the USE_WINDOWS_ENCODING tag to YES -# forces the Windows encoding (this is the default for the Windows binary), -# whereas setting the tag to NO uses a Unix-style encoding (the default for -# all platforms other than Windows). - -USE_WINDOWS_ENCODING = NO - -# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will -# include brief member descriptions after the members that are listed in -# the file and class documentation (similar to JavaDoc). -# Set to NO to disable this. - -BRIEF_MEMBER_DESC = YES - -# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend -# the brief description of a member or function before the detailed description. -# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the -# brief descriptions will be completely suppressed. - -REPEAT_BRIEF = YES - -# This tag implements a quasi-intelligent brief description abbreviator -# that is used to form the text in various listings. Each string -# in this list, if found as the leading text of the brief description, will be -# stripped from the text and the result after processing the whole list, is used -# as the annotated text. Otherwise, the brief description is used as-is. If left -# blank, the following values are used ("$name" is automatically replaced with the -# name of the entity): "The $name class" "The $name widget" "The $name file" -# "is" "provides" "specifies" "contains" "represents" "a" "an" "the" - -ABBREVIATE_BRIEF = - -# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then -# Doxygen will generate a detailed section even if there is only a brief -# description. - -ALWAYS_DETAILED_SEC = NO - -# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all inherited -# members of a class in the documentation of that class as if those members were -# ordinary class members. Constructors, destructors and assignment operators of -# the base classes will not be shown. - -INLINE_INHERITED_MEMB = NO - -# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full -# path before files name in the file list and in the header files. If set -# to NO the shortest path that makes the file name unique will be used. - -FULL_PATH_NAMES = NO - -# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag -# can be used to strip a user-defined part of the path. Stripping is -# only done if one of the specified strings matches the left-hand part of -# the path. The tag can be used to show relative paths in the file list. -# If left blank the directory from which doxygen is run is used as the -# path to strip. - -STRIP_FROM_PATH = - -# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of -# the path mentioned in the documentation of a class, which tells -# the reader which header file to include in order to use a class. -# If left blank only the name of the header file containing the class -# definition is used. Otherwise one should specify the include paths that -# are normally passed to the compiler using the -I flag. - -STRIP_FROM_INC_PATH = - -# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter -# (but less readable) file names. This can be useful is your file systems -# doesn't support long names like on DOS, Mac, or CD-ROM. - -SHORT_NAMES = NO - -# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen -# will interpret the first line (until the first dot) of a JavaDoc-style -# comment as the brief description. If set to NO, the JavaDoc -# comments will behave just like the Qt-style comments (thus requiring an -# explicit @brief command for a brief description. - -JAVADOC_AUTOBRIEF = YES - -# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen -# treat a multi-line C++ special comment block (i.e. a block of //! or /// -# comments) as a brief description. This used to be the default behaviour. -# The new default is to treat a multi-line C++ comment block as a detailed -# description. Set this tag to YES if you prefer the old behaviour instead. - -MULTILINE_CPP_IS_BRIEF = NO - -# If the DETAILS_AT_TOP tag is set to YES then Doxygen -# will output the detailed description near the top, like JavaDoc. -# If set to NO, the detailed description appears after the member -# documentation. - -DETAILS_AT_TOP = YES - -# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented -# member inherits the documentation from any documented member that it -# re-implements. - -INHERIT_DOCS = YES - -# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC -# tag is set to YES, then doxygen will reuse the documentation of the first -# member in the group (if any) for the other members of the group. By default -# all members of a group must be documented explicitly. - -DISTRIBUTE_GROUP_DOC = NO - -# The TAB_SIZE tag can be used to set the number of spaces in a tab. -# Doxygen uses this value to replace tabs by spaces in code fragments. - -TAB_SIZE = 8 - -# This tag can be used to specify a number of aliases that acts -# as commands in the documentation. An alias has the form "name=value". -# For example adding "sideeffect=\par Side Effects:\n" will allow you to -# put the command \sideeffect (or @sideeffect) in the documentation, which -# will result in a user-defined paragraph with heading "Side Effects:". -# You can put \n's in the value part of an alias to insert newlines. - -ALIASES = - -# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources -# only. Doxygen will then generate output that is more tailored for C. -# For instance, some of the names that are used will be different. The list -# of all members will be omitted, etc. - -OPTIMIZE_OUTPUT_FOR_C = YES - -# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java sources -# only. Doxygen will then generate output that is more tailored for Java. -# For instance, namespaces will be presented as packages, qualified scopes -# will look different, etc. - -OPTIMIZE_OUTPUT_JAVA = NO - -# Set the SUBGROUPING tag to YES (the default) to allow class member groups of -# the same type (for instance a group of public functions) to be put as a -# subgroup of that type (e.g. under the Public Functions section). Set it to -# NO to prevent subgrouping. Alternatively, this can be done per class using -# the \nosubgrouping command. - -SUBGROUPING = YES - -#--------------------------------------------------------------------------- -# Build related configuration options -#--------------------------------------------------------------------------- - -# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in -# documentation are documented, even if no documentation was available. -# Private class members and static file members will be hidden unless -# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES - -EXTRACT_ALL = YES - -# If the EXTRACT_PRIVATE tag is set to YES all private members of a class -# will be included in the documentation. - -EXTRACT_PRIVATE = NO - -# If the EXTRACT_STATIC tag is set to YES all static members of a file -# will be included in the documentation. - -EXTRACT_STATIC = YES - -# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) -# defined locally in source files will be included in the documentation. -# If set to NO only classes defined in header files are included. - -EXTRACT_LOCAL_CLASSES = YES - -# This flag is only useful for Objective-C code. When set to YES local -# methods, which are defined in the implementation section but not in -# the interface are included in the documentation. -# If set to NO (the default) only methods in the interface are included. - -EXTRACT_LOCAL_METHODS = NO - -# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all -# undocumented members of documented classes, files or namespaces. -# If set to NO (the default) these members will be included in the -# various overviews, but no documentation section is generated. -# This option has no effect if EXTRACT_ALL is enabled. - -HIDE_UNDOC_MEMBERS = NO - -# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all -# undocumented classes that are normally visible in the class hierarchy. -# If set to NO (the default) these classes will be included in the various -# overviews. This option has no effect if EXTRACT_ALL is enabled. - -HIDE_UNDOC_CLASSES = NO - -# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all -# friend (class|struct|union) declarations. -# If set to NO (the default) these declarations will be included in the -# documentation. - -HIDE_FRIEND_COMPOUNDS = NO - -# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any -# documentation blocks found inside the body of a function. -# If set to NO (the default) these blocks will be appended to the -# function's detailed documentation block. - -HIDE_IN_BODY_DOCS = NO - -# The INTERNAL_DOCS tag determines if documentation -# that is typed after a \internal command is included. If the tag is set -# to NO (the default) then the documentation will be excluded. -# Set it to YES to include the internal documentation. - -INTERNAL_DOCS = NO - -# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate -# file names in lower-case letters. If set to YES upper-case letters are also -# allowed. This is useful if you have classes or files whose names only differ -# in case and if your file system supports case sensitive file names. Windows -# and Mac users are advised to set this option to NO. - -CASE_SENSE_NAMES = YES - -# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen -# will show members with their full class and namespace scopes in the -# documentation. If set to YES the scope will be hidden. - -HIDE_SCOPE_NAMES = NO - -# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen -# will put a list of the files that are included by a file in the documentation -# of that file. - -SHOW_INCLUDE_FILES = YES - -# If the INLINE_INFO tag is set to YES (the default) then a tag [inline] -# is inserted in the documentation for inline members. - -INLINE_INFO = YES - -# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen -# will sort the (detailed) documentation of file and class members -# alphabetically by member name. If set to NO the members will appear in -# declaration order. - -SORT_MEMBER_DOCS = YES - -# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the -# brief documentation of file, namespace and class members alphabetically -# by member name. If set to NO (the default) the members will appear in -# declaration order. - -SORT_BRIEF_DOCS = NO - -# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be -# sorted by fully-qualified names, including namespaces. If set to -# NO (the default), the class list will be sorted only by class name, -# not including the namespace part. -# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. -# Note: This option applies only to the class list, not to the -# alphabetical list. - -SORT_BY_SCOPE_NAME = NO - -# The GENERATE_TODOLIST tag can be used to enable (YES) or -# disable (NO) the todo list. This list is created by putting \todo -# commands in the documentation. - -GENERATE_TODOLIST = YES - -# The GENERATE_TESTLIST tag can be used to enable (YES) or -# disable (NO) the test list. This list is created by putting \test -# commands in the documentation. - -GENERATE_TESTLIST = YES - -# The GENERATE_BUGLIST tag can be used to enable (YES) or -# disable (NO) the bug list. This list is created by putting \bug -# commands in the documentation. - -GENERATE_BUGLIST = YES - -# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or -# disable (NO) the deprecated list. This list is created by putting -# \deprecated commands in the documentation. - -GENERATE_DEPRECATEDLIST= YES - -# The ENABLED_SECTIONS tag can be used to enable conditional -# documentation sections, marked by \if sectionname ... \endif. - -ENABLED_SECTIONS = - -# The MAX_INITIALIZER_LINES tag determines the maximum number of lines -# the initial value of a variable or define consists of for it to appear in -# the documentation. If the initializer consists of more lines than specified -# here it will be hidden. Use a value of 0 to hide initializers completely. -# The appearance of the initializer of individual variables and defines in the -# documentation can be controlled using \showinitializer or \hideinitializer -# command in the documentation regardless of this setting. - -MAX_INITIALIZER_LINES = 30 - -# Set the SHOW_USED_FILES tag to NO to disable the list of files generated -# at the bottom of the documentation of classes and structs. If set to YES the -# list will mention the files that were used to generate the documentation. - -SHOW_USED_FILES = YES - -#--------------------------------------------------------------------------- -# configuration options related to warning and progress messages -#--------------------------------------------------------------------------- - -# The QUIET tag can be used to turn on/off the messages that are generated -# by doxygen. Possible values are YES and NO. If left blank NO is used. - -QUIET = NO - -# The WARNINGS tag can be used to turn on/off the warning messages that are -# generated by doxygen. Possible values are YES and NO. If left blank -# NO is used. - -WARNINGS = YES - -# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings -# for undocumented members. If EXTRACT_ALL is set to YES then this flag will -# automatically be disabled. - -WARN_IF_UNDOCUMENTED = YES - -# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for -# potential errors in the documentation, such as not documenting some -# parameters in a documented function, or documenting parameters that -# don't exist or using markup commands wrongly. - -WARN_IF_DOC_ERROR = YES - -# The WARN_FORMAT tag determines the format of the warning messages that -# doxygen can produce. The string should contain the $file, $line, and $text -# tags, which will be replaced by the file and line number from which the -# warning originated and the warning text. - -WARN_FORMAT = "$file:$line: $text" - -# The WARN_LOGFILE tag can be used to specify a file to which warning -# and error messages should be written. If left blank the output is written -# to stderr. - -WARN_LOGFILE = - -#--------------------------------------------------------------------------- -# configuration options related to the input files -#--------------------------------------------------------------------------- - -# The INPUT tag can be used to specify the files and/or directories that contain -# documented source files. You may enter file names like "myfile.cpp" or -# directories like "/usr/src/myproject". Separate the files or directories -# with spaces. - -INPUT = - -# If the value of the INPUT tag contains directories, you can use the -# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp -# and *.h) to filter out the source-files in the directories. If left -# blank the following patterns are tested: -# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx *.hpp -# *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm - -FILE_PATTERNS = - -# The RECURSIVE tag can be used to turn specify whether or not subdirectories -# should be searched for input files as well. Possible values are YES and NO. -# If left blank NO is used. - -RECURSIVE = NO - -# The EXCLUDE tag can be used to specify files and/or directories that should -# excluded from the INPUT source files. This way you can easily exclude a -# subdirectory from a directory tree whose root is specified with the INPUT tag. - -EXCLUDE = - -# The EXCLUDE_SYMLINKS tag can be used select whether or not files or directories -# that are symbolic links (a Unix filesystem feature) are excluded from the input. - -EXCLUDE_SYMLINKS = NO - -# If the value of the INPUT tag contains directories, you can use the -# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude -# certain files from those directories. - -EXCLUDE_PATTERNS = - -# The EXAMPLE_PATH tag can be used to specify one or more files or -# directories that contain example code fragments that are included (see -# the \include command). - -EXAMPLE_PATH = - -# If the value of the EXAMPLE_PATH tag contains directories, you can use the -# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp -# and *.h) to filter out the source-files in the directories. If left -# blank all files are included. - -EXAMPLE_PATTERNS = - -# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be -# searched for input files to be used with the \include or \dontinclude -# commands irrespective of the value of the RECURSIVE tag. -# Possible values are YES and NO. If left blank NO is used. - -EXAMPLE_RECURSIVE = NO - -# The IMAGE_PATH tag can be used to specify one or more files or -# directories that contain image that are included in the documentation (see -# the \image command). - -IMAGE_PATH = - -# The INPUT_FILTER tag can be used to specify a program that doxygen should -# invoke to filter for each input file. Doxygen will invoke the filter program -# by executing (via popen()) the command , where -# is the value of the INPUT_FILTER tag, and is the name of an -# input file. Doxygen will then use the output that the filter program writes -# to standard output. If FILTER_PATTERNS is specified, this tag will be -# ignored. - -INPUT_FILTER = - -# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern -# basis. Doxygen will compare the file name with each pattern and apply the -# filter if there is a match. The filters are a list of the form: -# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further -# info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER -# is applied to all files. - -FILTER_PATTERNS = - -# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using -# INPUT_FILTER) will be used to filter the input files when producing source -# files to browse (i.e. when SOURCE_BROWSER is set to YES). - -FILTER_SOURCE_FILES = NO - -#--------------------------------------------------------------------------- -# configuration options related to source browsing -#--------------------------------------------------------------------------- - -# If the SOURCE_BROWSER tag is set to YES then a list of source files will -# be generated. Documented entities will be cross-referenced with these sources. -# Note: To get rid of all source code in the generated output, make sure also -# VERBATIM_HEADERS is set to NO. - -SOURCE_BROWSER = NO - -# Setting the INLINE_SOURCES tag to YES will include the body -# of functions and classes directly in the documentation. - -INLINE_SOURCES = NO - -# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct -# doxygen to hide any special comment blocks from generated source code -# fragments. Normal C and C++ comments will always remain visible. - -STRIP_CODE_COMMENTS = YES - -# If the REFERENCED_BY_RELATION tag is set to YES (the default) -# then for each documented function all documented -# functions referencing it will be listed. - -REFERENCED_BY_RELATION = YES - -# If the REFERENCES_RELATION tag is set to YES (the default) -# then for each documented function all documented entities -# called/used by that function will be listed. - -REFERENCES_RELATION = YES - -# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen -# will generate a verbatim copy of the header file for each class for -# which an include is specified. Set to NO to disable this. - -VERBATIM_HEADERS = NO - -#--------------------------------------------------------------------------- -# configuration options related to the alphabetical class index -#--------------------------------------------------------------------------- - -# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index -# of all compounds will be generated. Enable this if the project -# contains a lot of classes, structs, unions or interfaces. - -ALPHABETICAL_INDEX = NO - -# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then -# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns -# in which this list will be split (can be a number in the range [1..20]) - -COLS_IN_ALPHA_INDEX = 5 - -# In case all classes in a project start with a common prefix, all -# classes will be put under the same header in the alphabetical index. -# The IGNORE_PREFIX tag can be used to specify one or more prefixes that -# should be ignored while generating the index headers. - -IGNORE_PREFIX = - -#--------------------------------------------------------------------------- -# configuration options related to the HTML output -#--------------------------------------------------------------------------- - -# If the GENERATE_HTML tag is set to YES (the default) Doxygen will -# generate HTML output. - -GENERATE_HTML = YES - -# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `html' will be used as the default path. - -HTML_OUTPUT = html - -# The HTML_FILE_EXTENSION tag can be used to specify the file extension for -# each generated HTML page (for example: .htm,.php,.asp). If it is left blank -# doxygen will generate files with .html extension. - -HTML_FILE_EXTENSION = .html - -# The HTML_HEADER tag can be used to specify a personal HTML header for -# each generated HTML page. If it is left blank doxygen will generate a -# standard header. - -HTML_HEADER = header.html - -# The HTML_FOOTER tag can be used to specify a personal HTML footer for -# each generated HTML page. If it is left blank doxygen will generate a -# standard footer. - -HTML_FOOTER = - -# The HTML_STYLESHEET tag can be used to specify a user-defined cascading -# style sheet that is used by each HTML page. It can be used to -# fine-tune the look of the HTML output. If the tag is left blank doxygen -# will generate a default style sheet. Note that doxygen will try to copy -# the style sheet file to the HTML output directory, so don't put your own -# stylesheet in the HTML output directory as well, or it will be erased! - -HTML_STYLESHEET = - -# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, -# files or namespaces will be aligned in HTML using tables. If set to -# NO a bullet list will be used. - -HTML_ALIGN_MEMBERS = YES - -# If the GENERATE_HTMLHELP tag is set to YES, additional index files -# will be generated that can be used as input for tools like the -# Microsoft HTML help workshop to generate a compressed HTML help file (.chm) -# of the generated HTML documentation. - -GENERATE_HTMLHELP = NO - -# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can -# be used to specify the file name of the resulting .chm file. You -# can add a path in front of the file if the result should not be -# written to the html output directory. - -CHM_FILE = - -# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can -# be used to specify the location (absolute path including file name) of -# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run -# the HTML help compiler on the generated index.hhp. - -HHC_LOCATION = - -# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag -# controls if a separate .chi index file is generated (YES) or that -# it should be included in the master .chm file (NO). - -GENERATE_CHI = NO - -# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag -# controls whether a binary table of contents is generated (YES) or a -# normal table of contents (NO) in the .chm file. - -BINARY_TOC = NO - -# The TOC_EXPAND flag can be set to YES to add extra items for group members -# to the contents of the HTML help documentation and to the tree view. - -TOC_EXPAND = NO - -# The DISABLE_INDEX tag can be used to turn on/off the condensed index at -# top of each HTML page. The value NO (the default) enables the index and -# the value YES disables it. - -DISABLE_INDEX = NO - -# This tag can be used to set the number of enum values (range [1..20]) -# that doxygen will group on one line in the generated HTML documentation. - -ENUM_VALUES_PER_LINE = 4 - -# If the GENERATE_TREEVIEW tag is set to YES, a side panel will be -# generated containing a tree-like index structure (just like the one that -# is generated for HTML Help). For this to work a browser that supports -# JavaScript, DHTML, CSS and frames is required (for instance Mozilla 1.0+, -# Netscape 6.0+, Internet explorer 5.0+, or Konqueror). Windows users are -# probably better off using the HTML help feature. - -GENERATE_TREEVIEW = NO - -# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be -# used to set the initial width (in pixels) of the frame in which the tree -# is shown. - -TREEVIEW_WIDTH = 250 - -#--------------------------------------------------------------------------- -# configuration options related to the LaTeX output -#--------------------------------------------------------------------------- - -# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will -# generate Latex output. - -GENERATE_LATEX = NO - -# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `latex' will be used as the default path. - -LATEX_OUTPUT = latex - -# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be -# invoked. If left blank `latex' will be used as the default command name. - -LATEX_CMD_NAME = latex - -# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to -# generate index for LaTeX. If left blank `makeindex' will be used as the -# default command name. - -MAKEINDEX_CMD_NAME = makeindex - -# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact -# LaTeX documents. This may be useful for small projects and may help to -# save some trees in general. - -COMPACT_LATEX = NO - -# The PAPER_TYPE tag can be used to set the paper type that is used -# by the printer. Possible values are: a4, a4wide, letter, legal and -# executive. If left blank a4wide will be used. - -PAPER_TYPE = a4wide - -# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX -# packages that should be included in the LaTeX output. - -EXTRA_PACKAGES = - -# The LATEX_HEADER tag can be used to specify a personal LaTeX header for -# the generated latex document. The header should contain everything until -# the first chapter. If it is left blank doxygen will generate a -# standard header. Notice: only use this tag if you know what you are doing! - -LATEX_HEADER = - -# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated -# is prepared for conversion to pdf (using ps2pdf). The pdf file will -# contain links (just like the HTML output) instead of page references -# This makes the output suitable for online browsing using a pdf viewer. - -PDF_HYPERLINKS = NO - -# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of -# plain latex in the generated Makefile. Set this option to YES to get a -# higher quality PDF documentation. - -USE_PDFLATEX = NO - -# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. -# command to the generated LaTeX files. This will instruct LaTeX to keep -# running if errors occur, instead of asking the user for help. -# This option is also used when generating formulas in HTML. - -LATEX_BATCHMODE = NO - -# If LATEX_HIDE_INDICES is set to YES then doxygen will not -# include the index chapters (such as File Index, Compound Index, etc.) -# in the output. - -LATEX_HIDE_INDICES = NO - -#--------------------------------------------------------------------------- -# configuration options related to the RTF output -#--------------------------------------------------------------------------- - -# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output -# The RTF output is optimized for Word 97 and may not look very pretty with -# other RTF readers or editors. - -GENERATE_RTF = NO - -# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `rtf' will be used as the default path. - -RTF_OUTPUT = rtf - -# If the COMPACT_RTF tag is set to YES Doxygen generates more compact -# RTF documents. This may be useful for small projects and may help to -# save some trees in general. - -COMPACT_RTF = NO - -# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated -# will contain hyperlink fields. The RTF file will -# contain links (just like the HTML output) instead of page references. -# This makes the output suitable for online browsing using WORD or other -# programs which support those fields. -# Note: wordpad (write) and others do not support links. - -RTF_HYPERLINKS = NO - -# Load stylesheet definitions from file. Syntax is similar to doxygen's -# config file, i.e. a series of assignments. You only have to provide -# replacements, missing definitions are set to their default value. - -RTF_STYLESHEET_FILE = - -# Set optional variables used in the generation of an rtf document. -# Syntax is similar to doxygen's config file. - -RTF_EXTENSIONS_FILE = - -#--------------------------------------------------------------------------- -# configuration options related to the man page output -#--------------------------------------------------------------------------- - -# If the GENERATE_MAN tag is set to YES (the default) Doxygen will -# generate man pages - -GENERATE_MAN = NO - -# The MAN_OUTPUT tag is used to specify where the man pages will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `man' will be used as the default path. - -MAN_OUTPUT = man - -# The MAN_EXTENSION tag determines the extension that is added to -# the generated man pages (default is the subroutine's section .3) - -MAN_EXTENSION = .3 - -# If the MAN_LINKS tag is set to YES and Doxygen generates man output, -# then it will generate one additional man file for each entity -# documented in the real man page(s). These additional files -# only source the real man page, but without them the man command -# would be unable to find the correct page. The default is NO. - -MAN_LINKS = NO - -#--------------------------------------------------------------------------- -# configuration options related to the XML output -#--------------------------------------------------------------------------- - -# If the GENERATE_XML tag is set to YES Doxygen will -# generate an XML file that captures the structure of -# the code including all documentation. - -GENERATE_XML = NO - -# The XML_OUTPUT tag is used to specify where the XML pages will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `xml' will be used as the default path. - -XML_OUTPUT = xml - -# The XML_SCHEMA tag can be used to specify an XML schema, -# which can be used by a validating XML parser to check the -# syntax of the XML files. - -XML_SCHEMA = - -# The XML_DTD tag can be used to specify an XML DTD, -# which can be used by a validating XML parser to check the -# syntax of the XML files. - -XML_DTD = - -# If the XML_PROGRAMLISTING tag is set to YES Doxygen will -# dump the program listings (including syntax highlighting -# and cross-referencing information) to the XML output. Note that -# enabling this will significantly increase the size of the XML output. - -XML_PROGRAMLISTING = YES - -#--------------------------------------------------------------------------- -# configuration options for the AutoGen Definitions output -#--------------------------------------------------------------------------- - -# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will -# generate an AutoGen Definitions (see autogen.sf.net) file -# that captures the structure of the code including all -# documentation. Note that this feature is still experimental -# and incomplete at the moment. - -GENERATE_AUTOGEN_DEF = NO - -#--------------------------------------------------------------------------- -# configuration options related to the Perl module output -#--------------------------------------------------------------------------- - -# If the GENERATE_PERLMOD tag is set to YES Doxygen will -# generate a Perl module file that captures the structure of -# the code including all documentation. Note that this -# feature is still experimental and incomplete at the -# moment. - -GENERATE_PERLMOD = NO - -# If the PERLMOD_LATEX tag is set to YES Doxygen will generate -# the necessary Makefile rules, Perl scripts and LaTeX code to be able -# to generate PDF and DVI output from the Perl module output. - -PERLMOD_LATEX = NO - -# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be -# nicely formatted so it can be parsed by a human reader. This is useful -# if you want to understand what is going on. On the other hand, if this -# tag is set to NO the size of the Perl module output will be much smaller -# and Perl will parse it just the same. - -PERLMOD_PRETTY = YES - -# The names of the make variables in the generated doxyrules.make file -# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. -# This is useful so different doxyrules.make files included by the same -# Makefile don't overwrite each other's variables. - -PERLMOD_MAKEVAR_PREFIX = - -#--------------------------------------------------------------------------- -# Configuration options related to the preprocessor -#--------------------------------------------------------------------------- - -# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will -# evaluate all C-preprocessor directives found in the sources and include -# files. - -ENABLE_PREPROCESSING = YES - -# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro -# names in the source code. If set to NO (the default) only conditional -# compilation will be performed. Macro expansion can be done in a controlled -# way by setting EXPAND_ONLY_PREDEF to YES. - -MACRO_EXPANSION = NO - -# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES -# then the macro expansion is limited to the macros specified with the -# PREDEFINED and EXPAND_AS_PREDEFINED tags. - -EXPAND_ONLY_PREDEF = NO - -# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files -# in the INCLUDE_PATH (see below) will be search if a #include is found. - -SEARCH_INCLUDES = YES - -# The INCLUDE_PATH tag can be used to specify one or more directories that -# contain include files that are not input files but should be processed by -# the preprocessor. - -INCLUDE_PATH = ../include - -# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard -# patterns (like *.h and *.hpp) to filter out the header-files in the -# directories. If left blank, the patterns specified with FILE_PATTERNS will -# be used. - -INCLUDE_FILE_PATTERNS = - -# The PREDEFINED tag can be used to specify one or more macro names that -# are defined before the preprocessor is started (similar to the -D option of -# gcc). The argument of the tag is a list of macros of the form: name -# or name=definition (no spaces). If the definition and the = are -# omitted =1 is assumed. - -PREDEFINED = - -# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then -# this tag can be used to specify a list of macro names that should be expanded. -# The macro definition that is found in the sources will be used. -# Use the PREDEFINED tag if you want to use a different macro definition. - -EXPAND_AS_DEFINED = - -# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then -# doxygen's preprocessor will remove all function-like macros that are alone -# on a line, have an all uppercase name, and do not end with a semicolon. Such -# function macros are typically used for boiler-plate code, and will confuse the -# parser if not removed. - -SKIP_FUNCTION_MACROS = YES - -#--------------------------------------------------------------------------- -# Configuration::additions related to external references -#--------------------------------------------------------------------------- - -# The TAGFILES option can be used to specify one or more tagfiles. -# Optionally an initial location of the external documentation -# can be added for each tagfile. The format of a tag file without -# this location is as follows: -# TAGFILES = file1 file2 ... -# Adding location for the tag files is done as follows: -# TAGFILES = file1=loc1 "file2 = loc2" ... -# where "loc1" and "loc2" can be relative or absolute paths or -# URLs. If a location is present for each tag, the installdox tool -# does not have to be run to correct the links. -# Note that each tag file must have a unique name -# (where the name does NOT include the path) -# If a tag file is not located in the directory in which doxygen -# is run, you must also specify the path to the tagfile here. - -TAGFILES = - -# When a file name is specified after GENERATE_TAGFILE, doxygen will create -# a tag file that is based on the input files it reads. - -GENERATE_TAGFILE = - -# If the ALLEXTERNALS tag is set to YES all external classes will be listed -# in the class index. If set to NO only the inherited external classes -# will be listed. - -ALLEXTERNALS = NO - -# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed -# in the modules index. If set to NO, only the current project's groups will -# be listed. - -EXTERNAL_GROUPS = NO - -# The PERL_PATH should be the absolute path and name of the perl script -# interpreter (i.e. the result of `which perl'). - -PERL_PATH = /usr/bin/perl - -#--------------------------------------------------------------------------- -# Configuration options related to the dot tool -#--------------------------------------------------------------------------- - -# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will -# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base or -# super classes. Setting the tag to NO turns the diagrams off. Note that this -# option is superseded by the HAVE_DOT option below. This is only a fallback. It is -# recommended to install and use dot, since it yields more powerful graphs. - -CLASS_DIAGRAMS = YES - -# If set to YES, the inheritance and collaboration graphs will hide -# inheritance and usage relations if the target is undocumented -# or is not a class. - -HIDE_UNDOC_RELATIONS = YES - -# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is -# available from the path. This tool is part of Graphviz, a graph visualization -# toolkit from AT&T and Lucent Bell Labs. The other options in this section -# have no effect if this option is set to NO (the default) - -HAVE_DOT = NO - -# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen -# will generate a graph for each documented class showing the direct and -# indirect inheritance relations. Setting this tag to YES will force the -# the CLASS_DIAGRAMS tag to NO. - -CLASS_GRAPH = YES - -# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen -# will generate a graph for each documented class showing the direct and -# indirect implementation dependencies (inheritance, containment, and -# class references variables) of the class with other documented classes. - -COLLABORATION_GRAPH = YES - -# If the UML_LOOK tag is set to YES doxygen will generate inheritance and -# collaboration diagrams in a style similar to the OMG's Unified Modeling -# Language. - -UML_LOOK = NO - -# If set to YES, the inheritance and collaboration graphs will show the -# relations between templates and their instances. - -TEMPLATE_RELATIONS = NO - -# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT -# tags are set to YES then doxygen will generate a graph for each documented -# file showing the direct and indirect include dependencies of the file with -# other documented files. - -INCLUDE_GRAPH = YES - -# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and -# HAVE_DOT tags are set to YES then doxygen will generate a graph for each -# documented header file showing the documented files that directly or -# indirectly include this file. - -INCLUDED_BY_GRAPH = YES - -# If the CALL_GRAPH and HAVE_DOT tags are set to YES then doxygen will -# generate a call dependency graph for every global function or class method. -# Note that enabling this option will significantly increase the time of a run. -# So in most cases it will be better to enable call graphs for selected -# functions only using the \callgraph command. - -CALL_GRAPH = NO - -# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen -# will graphical hierarchy of all classes instead of a textual one. - -GRAPHICAL_HIERARCHY = YES - -# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images -# generated by dot. Possible values are png, jpg, or gif -# If left blank png will be used. - -DOT_IMAGE_FORMAT = png - -# The tag DOT_PATH can be used to specify the path where the dot tool can be -# found. If left blank, it is assumed the dot tool can be found on the path. - -DOT_PATH = - -# The DOTFILE_DIRS tag can be used to specify one or more directories that -# contain dot files that are included in the documentation (see the -# \dotfile command). - -DOTFILE_DIRS = - -# The MAX_DOT_GRAPH_WIDTH tag can be used to set the maximum allowed width -# (in pixels) of the graphs generated by dot. If a graph becomes larger than -# this value, doxygen will try to truncate the graph, so that it fits within -# the specified constraint. Beware that most browsers cannot cope with very -# large images. - -MAX_DOT_GRAPH_WIDTH = 1024 - -# The MAX_DOT_GRAPH_HEIGHT tag can be used to set the maximum allows height -# (in pixels) of the graphs generated by dot. If a graph becomes larger than -# this value, doxygen will try to truncate the graph, so that it fits within -# the specified constraint. Beware that most browsers cannot cope with very -# large images. - -MAX_DOT_GRAPH_HEIGHT = 1024 - -# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the -# graphs generated by dot. A depth value of 3 means that only nodes reachable -# from the root by following a path via at most 3 edges will be shown. Nodes that -# lay further from the root node will be omitted. Note that setting this option to -# 1 or 2 may greatly reduce the computation time needed for large code bases. Also -# note that a graph may be further truncated if the graph's image dimensions are -# not sufficient to fit the graph (see MAX_DOT_GRAPH_WIDTH and MAX_DOT_GRAPH_HEIGHT). -# If 0 is used for the depth value (the default), the graph is not depth-constrained. - -MAX_DOT_GRAPH_DEPTH = 0 - -# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will -# generate a legend page explaining the meaning of the various boxes and -# arrows in the dot generated graphs. - -GENERATE_LEGEND = YES - -# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will -# remove the intermediate dot files that are used to generate -# the various graphs. - -DOT_CLEANUP = YES - -#--------------------------------------------------------------------------- -# Configuration::additions related to the search engine -#--------------------------------------------------------------------------- - -# The SEARCHENGINE tag specifies whether or not a search engine should be -# used. If set to NO the values of all tags below this one will be ignored. - -SEARCHENGINE = NO diff --git a/doxygen/core_subset.doxy b/doxygen/core_subset.doxy deleted file mode 100644 index 35faf565dc..0000000000 --- a/doxygen/core_subset.doxy +++ /dev/null @@ -1,226 +0,0 @@ -# Doxyfile 0.1 - -#--------------------------------------------------------------------------- -# General configuration options -#--------------------------------------------------------------------------- -PROJECT_NAME = "Mesa Main" -PROJECT_NUMBER = -OUTPUT_DIRECTORY = -OUTPUT_LANGUAGE = English -EXTRACT_ALL = NO -EXTRACT_PRIVATE = NO -EXTRACT_STATIC = YES -EXTRACT_LOCAL_CLASSES = YES -HIDE_UNDOC_MEMBERS = NO -HIDE_UNDOC_CLASSES = NO -BRIEF_MEMBER_DESC = YES -REPEAT_BRIEF = YES -ALWAYS_DETAILED_SEC = NO -INLINE_INHERITED_MEMB = NO -FULL_PATH_NAMES = NO -STRIP_FROM_PATH = -INTERNAL_DOCS = YES -STRIP_CODE_COMMENTS = YES -CASE_SENSE_NAMES = YES -SHORT_NAMES = NO -HIDE_SCOPE_NAMES = NO -VERBATIM_HEADERS = YES -SHOW_INCLUDE_FILES = YES -JAVADOC_AUTOBRIEF = NO -INHERIT_DOCS = YES -INLINE_INFO = YES -SORT_MEMBER_DOCS = NO -DISTRIBUTE_GROUP_DOC = NO -TAB_SIZE = 8 -GENERATE_TODOLIST = YES -GENERATE_TESTLIST = YES -GENERATE_BUGLIST = YES -ALIASES = -ENABLED_SECTIONS = subset -MAX_INITIALIZER_LINES = 30 -OPTIMIZE_OUTPUT_FOR_C = NO -SHOW_USED_FILES = YES -#--------------------------------------------------------------------------- -# configuration options related to warning and progress messages -#--------------------------------------------------------------------------- -QUIET = YES -WARNINGS = YES -WARN_IF_UNDOCUMENTED = NO -WARN_FORMAT = -WARN_LOGFILE = -#--------------------------------------------------------------------------- -# configuration options related to the input files -#--------------------------------------------------------------------------- -INPUT = ../src/mesa/main/ -FILE_PATTERNS = \ - accum.h \ - attrib.h \ - blend.[ch] \ - buffers.[ch] \ - dd.h \ - debug.h \ - depth.h \ - dlist.h \ - context.[ch] \ - config.h \ - colormac.h \ - colortab.h \ - enable.h \ - enums.h \ - eval.h \ - extensions.h \ - feedback.[ch] \ - fog.h \ - get.h \ - glheader.h \ - glthread.h \ - hash.[ch] \ - hint.h \ - histogram.h \ - image.[ch] \ - imports.[ch] \ - lines.[ch] \ - light.h \ - matrix.[ch] \ - macros.h \ - mmath.h \ - mtypes.h \ - pixel.h \ - points.[ch] \ - polygon.[ch] \ - rastpos.[ch] \ - simple_list.h \ - state.[ch] \ - stencil.[ch] \ - subset_*.c \ - texformat.h \ - teximage.h \ - texstate.h \ - texstore.h \ - texobj.[ch] \ - texutil_tmp.h \ - varray.h -RECURSIVE = NO -EXCLUDE = -EXCLUDE_PATTERNS = -EXAMPLE_PATH = -EXAMPLE_PATTERNS = -EXAMPLE_RECURSIVE = NO -IMAGE_PATH = -INPUT_FILTER = -FILTER_SOURCE_FILES = NO -#--------------------------------------------------------------------------- -# configuration options related to source browsing -#--------------------------------------------------------------------------- -SOURCE_BROWSER = YES -INLINE_SOURCES = NO -REFERENCED_BY_RELATION = YES -REFERENCES_RELATION = YES -#--------------------------------------------------------------------------- -# configuration options related to the alphabetical class index -#--------------------------------------------------------------------------- -ALPHABETICAL_INDEX = NO -COLS_IN_ALPHA_INDEX = 5 -IGNORE_PREFIX = -#--------------------------------------------------------------------------- -# configuration options related to the HTML output -#--------------------------------------------------------------------------- -GENERATE_HTML = YES -HTML_OUTPUT = core_subset -HTML_HEADER = header_subset.html -HTML_FOOTER = -HTML_STYLESHEET = -HTML_ALIGN_MEMBERS = YES -GENERATE_HTMLHELP = NO -GENERATE_CHI = NO -BINARY_TOC = NO -TOC_EXPAND = NO -DISABLE_INDEX = NO -ENUM_VALUES_PER_LINE = 4 -GENERATE_TREEVIEW = NO -TREEVIEW_WIDTH = 250 -#--------------------------------------------------------------------------- -# configuration options related to the LaTeX output -#--------------------------------------------------------------------------- -GENERATE_LATEX = NO -LATEX_OUTPUT = -COMPACT_LATEX = NO -PAPER_TYPE = a4wide -EXTRA_PACKAGES = -LATEX_HEADER = -PDF_HYPERLINKS = NO -USE_PDFLATEX = NO -LATEX_BATCHMODE = NO -#--------------------------------------------------------------------------- -# configuration options related to the RTF output -#--------------------------------------------------------------------------- -GENERATE_RTF = NO -RTF_OUTPUT = -COMPACT_RTF = NO -RTF_HYPERLINKS = NO -RTF_STYLESHEET_FILE = -RTF_EXTENSIONS_FILE = -#--------------------------------------------------------------------------- -# configuration options related to the man page output -#--------------------------------------------------------------------------- -GENERATE_MAN = NO -MAN_OUTPUT = -MAN_EXTENSION = -MAN_LINKS = NO -#--------------------------------------------------------------------------- -# configuration options related to the XML output -#--------------------------------------------------------------------------- -GENERATE_XML = NO -#--------------------------------------------------------------------------- -# configuration options for the AutoGen Definitions output -#--------------------------------------------------------------------------- -GENERATE_AUTOGEN_DEF = NO -#--------------------------------------------------------------------------- -# Configuration options related to the preprocessor -#--------------------------------------------------------------------------- -ENABLE_PREPROCESSING = YES -MACRO_EXPANSION = NO -EXPAND_ONLY_PREDEF = NO -SEARCH_INCLUDES = YES -INCLUDE_PATH = ../include/ -INCLUDE_FILE_PATTERNS = -PREDEFINED = -EXPAND_AS_DEFINED = -SKIP_FUNCTION_MACROS = YES -#--------------------------------------------------------------------------- -# Configuration::addtions related to external references -#--------------------------------------------------------------------------- -TAGFILES = \ - math_subset.tag=../math_subset \ - miniglx.tag=../miniglx -GENERATE_TAGFILE = core_subset.tag -ALLEXTERNALS = NO -PERL_PATH = -#--------------------------------------------------------------------------- -# Configuration options related to the dot tool -#--------------------------------------------------------------------------- -CLASS_DIAGRAMS = NO -HAVE_DOT = NO -CLASS_GRAPH = YES -COLLABORATION_GRAPH = YES -TEMPLATE_RELATIONS = YES -HIDE_UNDOC_RELATIONS = YES -INCLUDE_GRAPH = YES -INCLUDED_BY_GRAPH = YES -GRAPHICAL_HIERARCHY = YES -DOT_PATH = -DOTFILE_DIRS = -MAX_DOT_GRAPH_WIDTH = 1024 -MAX_DOT_GRAPH_HEIGHT = 1024 -GENERATE_LEGEND = YES -DOT_CLEANUP = YES -#--------------------------------------------------------------------------- -# Configuration::addtions related to the search engine -#--------------------------------------------------------------------------- -SEARCHENGINE = NO -CGI_NAME = -CGI_URL = -DOC_URL = -DOC_ABSPATH = -BIN_ABSPATH = -EXT_DOC_PATHS = diff --git a/doxygen/doxy.bat b/doxygen/doxy.bat deleted file mode 100644 index 331b931928..0000000000 --- a/doxygen/doxy.bat +++ /dev/null @@ -1,19 +0,0 @@ -doxygen tnl_dd.doxy -doxygen vbo.doxy -doxygen math.doxy -doxygen swrast.doxy -doxygen swrast_setup.doxy -doxygen tnl.doxy -doxygen core.doxy -doxygen glapi.doxy -doxygen shader.doxy - -echo Building again, to resolve tags -doxygen tnl_dd.doxy -doxygen vbo.doxy -doxygen math.doxy -doxygen swrast.doxy -doxygen swrast_setup.doxy -doxygen tnl.doxy -doxygen glapi.doxy -doxygen shader.doxy diff --git a/doxygen/glapi.doxy b/doxygen/glapi.doxy deleted file mode 100644 index 3290f8455a..0000000000 --- a/doxygen/glapi.doxy +++ /dev/null @@ -1,49 +0,0 @@ -# Doxyfile 0.1 - -@INCLUDE = common.doxy - -#--------------------------------------------------------------------------- -# General configuration options -#--------------------------------------------------------------------------- -PROJECT_NAME = "Mesa GL API dispatcher" -#--------------------------------------------------------------------------- -# configuration options related to the input files -#--------------------------------------------------------------------------- -INPUT = ../src/mesa/glapi/ -FILE_PATTERNS = *.c *.h -RECURSIVE = NO -EXCLUDE = -EXCLUDE_PATTERNS = -EXAMPLE_PATH = -EXAMPLE_PATTERNS = -EXAMPLE_RECURSIVE = NO -IMAGE_PATH = -INPUT_FILTER = -FILTER_SOURCE_FILES = NO -#--------------------------------------------------------------------------- -# configuration options related to the HTML output -#--------------------------------------------------------------------------- -HTML_OUTPUT = glapi -#--------------------------------------------------------------------------- -# Configuration options related to the preprocessor -#--------------------------------------------------------------------------- -ENABLE_PREPROCESSING = YES -MACRO_EXPANSION = NO -EXPAND_ONLY_PREDEF = NO -SEARCH_INCLUDES = YES -INCLUDE_PATH = ../include/ -INCLUDE_FILE_PATTERNS = -PREDEFINED = -EXPAND_AS_DEFINED = -SKIP_FUNCTION_MACROS = YES -#--------------------------------------------------------------------------- -# Configuration::addtions related to external references -#--------------------------------------------------------------------------- -TAGFILES = main.tag=../core \ - math.tag=../math \ - tnl_dd.tag=../tnl_dd \ - swrast.tag=../swrast \ - swrast_setup.tag=../swrast_setup \ - tnl.tag=../tnl \ - vbo.tag=vbo -GENERATE_TAGFILE = swrast.tag diff --git a/doxygen/header.html b/doxygen/header.html deleted file mode 100644 index 378dc9490c..0000000000 --- a/doxygen/header.html +++ /dev/null @@ -1,17 +0,0 @@ - - -Mesa Source Code Documentation - - - -
-core | -glapi | -vbo | -math | -shader | -swrast | -swrast_setup | -tnl | -tnl_dd -
diff --git a/doxygen/header_subset.html b/doxygen/header_subset.html deleted file mode 100644 index f9a698db84..0000000000 --- a/doxygen/header_subset.html +++ /dev/null @@ -1,11 +0,0 @@ - -Mesa Source Code Documentation - - - - diff --git a/doxygen/main.doxy b/doxygen/main.doxy deleted file mode 100644 index 416b4338e8..0000000000 --- a/doxygen/main.doxy +++ /dev/null @@ -1,50 +0,0 @@ -# Doxyfile 0.1 - -@INCLUDE = common.doxy - -#--------------------------------------------------------------------------- -# General configuration options -#--------------------------------------------------------------------------- -PROJECT_NAME = "Mesa Main" -#--------------------------------------------------------------------------- -# configuration options related to the input files -#--------------------------------------------------------------------------- -INPUT = ../src/mesa/main/ -FILE_PATTERNS = *.c *.h -RECURSIVE = NO -EXCLUDE = ../src/glapitemp.h ../src/glapioffsets.h -EXCLUDE_PATTERNS = subset_* -EXAMPLE_PATH = -EXAMPLE_PATTERNS = -EXAMPLE_RECURSIVE = NO -IMAGE_PATH = -INPUT_FILTER = -FILTER_SOURCE_FILES = NO -#--------------------------------------------------------------------------- -# configuration options related to the HTML output -#--------------------------------------------------------------------------- -HTML_OUTPUT = main -#--------------------------------------------------------------------------- -# Configuration options related to the preprocessor -#--------------------------------------------------------------------------- -ENABLE_PREPROCESSING = YES -MACRO_EXPANSION = YES -EXPAND_ONLY_PREDEF = YES -SEARCH_INCLUDES = YES -INCLUDE_PATH = ../include/ -INCLUDE_FILE_PATTERNS = -PREDEFINED = _HAVE_FULL_GL=1 -EXPAND_AS_DEFINED = _glthread_DECLARE_STATIC_MUTEX -SKIP_FUNCTION_MACROS = YES -#--------------------------------------------------------------------------- -# Configuration::addtions related to external references -#--------------------------------------------------------------------------- -TAGFILES = tnl_dd.tag=../tnl_dd \ - vbo.tag=../vbo \ - glapi.tag=../glapi \ - math.tag=../math \ - shader.tag=../shader \ - swrast.tag=../swrast \ - swrast_setup.tag=../swrast_setup \ - tnl.tag=../tnl -GENERATE_TAGFILE = main.tag diff --git a/doxygen/math.doxy b/doxygen/math.doxy deleted file mode 100644 index 388af40fe5..0000000000 --- a/doxygen/math.doxy +++ /dev/null @@ -1,49 +0,0 @@ -# Doxyfile 0.1 - -@INCLUDE = common.doxy - -#--------------------------------------------------------------------------- -# General configuration options -#--------------------------------------------------------------------------- -PROJECT_NAME = "Mesa math module" -#--------------------------------------------------------------------------- -# configuration options related to the input files -#--------------------------------------------------------------------------- -INPUT = ../src/mesa/math/ -FILE_PATTERNS = *.c \ - *.h -RECURSIVE = NO -EXCLUDE = -EXCLUDE_PATTERNS = -EXAMPLE_PATH = -EXAMPLE_PATTERNS = -EXAMPLE_RECURSIVE = NO -IMAGE_PATH = -INPUT_FILTER = -FILTER_SOURCE_FILES = NO -#--------------------------------------------------------------------------- -# configuration options related to the HTML output -#--------------------------------------------------------------------------- -HTML_OUTPUT = math -#--------------------------------------------------------------------------- -# Configuration options related to the preprocessor -#--------------------------------------------------------------------------- -ENABLE_PREPROCESSING = YES -MACRO_EXPANSION = NO -EXPAND_ONLY_PREDEF = NO -SEARCH_INCLUDES = YES -INCLUDE_PATH = -INCLUDE_FILE_PATTERNS = -PREDEFINED = -EXPAND_AS_DEFINED = -SKIP_FUNCTION_MACROS = YES -#--------------------------------------------------------------------------- -# Configuration::addtions related to external references -#--------------------------------------------------------------------------- -TAGFILES = tnl_dd.tag=../tnl_dd \ - main.tag=../core \ - swrast.tag=../swrast \ - swrast_setup.tag=../swrast_setup \ - tnl.tag=../tnl \ - vbo.tag=../vbo -GENERATE_TAGFILE = math.tag diff --git a/doxygen/math_subset.doxy b/doxygen/math_subset.doxy deleted file mode 100644 index 9f6e95ff62..0000000000 --- a/doxygen/math_subset.doxy +++ /dev/null @@ -1,177 +0,0 @@ -# Doxyfile 0.1 - -#--------------------------------------------------------------------------- -# General configuration options -#--------------------------------------------------------------------------- -PROJECT_NAME = "Mesa math module" -PROJECT_NUMBER = -OUTPUT_DIRECTORY = . -OUTPUT_LANGUAGE = English -EXTRACT_ALL = NO -EXTRACT_PRIVATE = NO -EXTRACT_STATIC = YES -EXTRACT_LOCAL_CLASSES = YES -HIDE_UNDOC_MEMBERS = NO -HIDE_UNDOC_CLASSES = NO -BRIEF_MEMBER_DESC = YES -REPEAT_BRIEF = YES -ALWAYS_DETAILED_SEC = NO -INLINE_INHERITED_MEMB = NO -FULL_PATH_NAMES = NO -STRIP_FROM_PATH = -INTERNAL_DOCS = NO -STRIP_CODE_COMMENTS = YES -CASE_SENSE_NAMES = YES -SHORT_NAMES = NO -HIDE_SCOPE_NAMES = NO -VERBATIM_HEADERS = YES -SHOW_INCLUDE_FILES = YES -JAVADOC_AUTOBRIEF = NO -INHERIT_DOCS = YES -INLINE_INFO = YES -SORT_MEMBER_DOCS = NO -DISTRIBUTE_GROUP_DOC = NO -TAB_SIZE = 8 -GENERATE_TODOLIST = YES -GENERATE_TESTLIST = YES -GENERATE_BUGLIST = YES -ALIASES = -ENABLED_SECTIONS = -MAX_INITIALIZER_LINES = 30 -OPTIMIZE_OUTPUT_FOR_C = YES -SHOW_USED_FILES = YES -#--------------------------------------------------------------------------- -# configuration options related to warning and progress messages -#--------------------------------------------------------------------------- -QUIET = YES -WARNINGS = YES -WARN_IF_UNDOCUMENTED = NO -WARN_FORMAT = -WARN_LOGFILE = -#--------------------------------------------------------------------------- -# configuration options related to the input files -#--------------------------------------------------------------------------- -INPUT = ../src/mesa/math/ -FILE_PATTERNS = m_matrix.[ch] -RECURSIVE = NO -EXCLUDE = -EXCLUDE_PATTERNS = -EXAMPLE_PATH = -EXAMPLE_PATTERNS = -EXAMPLE_RECURSIVE = NO -IMAGE_PATH = -INPUT_FILTER = -FILTER_SOURCE_FILES = NO -#--------------------------------------------------------------------------- -# configuration options related to source browsing -#--------------------------------------------------------------------------- -SOURCE_BROWSER = NO -INLINE_SOURCES = NO -REFERENCED_BY_RELATION = YES -REFERENCES_RELATION = YES -#--------------------------------------------------------------------------- -# configuration options related to the alphabetical class index -#--------------------------------------------------------------------------- -ALPHABETICAL_INDEX = NO -COLS_IN_ALPHA_INDEX = 5 -IGNORE_PREFIX = -#--------------------------------------------------------------------------- -# configuration options related to the HTML output -#--------------------------------------------------------------------------- -GENERATE_HTML = YES -HTML_OUTPUT = math_subset -HTML_HEADER = header_subset.html -HTML_FOOTER = -HTML_STYLESHEET = -HTML_ALIGN_MEMBERS = YES -GENERATE_HTMLHELP = NO -GENERATE_CHI = NO -BINARY_TOC = NO -TOC_EXPAND = NO -DISABLE_INDEX = NO -ENUM_VALUES_PER_LINE = 4 -GENERATE_TREEVIEW = NO -TREEVIEW_WIDTH = 250 -#--------------------------------------------------------------------------- -# configuration options related to the LaTeX output -#--------------------------------------------------------------------------- -GENERATE_LATEX = NO -LATEX_OUTPUT = -COMPACT_LATEX = NO -PAPER_TYPE = a4wide -EXTRA_PACKAGES = -LATEX_HEADER = -PDF_HYPERLINKS = NO -USE_PDFLATEX = NO -LATEX_BATCHMODE = NO -#--------------------------------------------------------------------------- -# configuration options related to the RTF output -#--------------------------------------------------------------------------- -GENERATE_RTF = NO -RTF_OUTPUT = -COMPACT_RTF = NO -RTF_HYPERLINKS = NO -RTF_STYLESHEET_FILE = -RTF_EXTENSIONS_FILE = -#--------------------------------------------------------------------------- -# configuration options related to the man page output -#--------------------------------------------------------------------------- -GENERATE_MAN = NO -MAN_OUTPUT = -MAN_EXTENSION = -MAN_LINKS = NO -#--------------------------------------------------------------------------- -# configuration options related to the XML output -#--------------------------------------------------------------------------- -GENERATE_XML = NO -#--------------------------------------------------------------------------- -# configuration options for the AutoGen Definitions output -#--------------------------------------------------------------------------- -GENERATE_AUTOGEN_DEF = NO -#--------------------------------------------------------------------------- -# Configuration options related to the preprocessor -#--------------------------------------------------------------------------- -ENABLE_PREPROCESSING = YES -MACRO_EXPANSION = NO -EXPAND_ONLY_PREDEF = NO -SEARCH_INCLUDES = YES -INCLUDE_PATH = -INCLUDE_FILE_PATTERNS = -PREDEFINED = -EXPAND_AS_DEFINED = -SKIP_FUNCTION_MACROS = YES -#--------------------------------------------------------------------------- -# Configuration::addtions related to external references -#--------------------------------------------------------------------------- -TAGFILES = core_subset.tag=../core_subset -GENERATE_TAGFILE = math_subset.tag -ALLEXTERNALS = NO -PERL_PATH = -#--------------------------------------------------------------------------- -# Configuration options related to the dot tool -#--------------------------------------------------------------------------- -CLASS_DIAGRAMS = YES -HAVE_DOT = NO -CLASS_GRAPH = YES -COLLABORATION_GRAPH = YES -TEMPLATE_RELATIONS = YES -HIDE_UNDOC_RELATIONS = YES -INCLUDE_GRAPH = YES -INCLUDED_BY_GRAPH = YES -GRAPHICAL_HIERARCHY = YES -DOT_PATH = -DOTFILE_DIRS = -MAX_DOT_GRAPH_WIDTH = 1024 -MAX_DOT_GRAPH_HEIGHT = 1024 -GENERATE_LEGEND = YES -DOT_CLEANUP = YES -#--------------------------------------------------------------------------- -# Configuration::addtions related to the search engine -#--------------------------------------------------------------------------- -SEARCHENGINE = NO -CGI_NAME = -CGI_URL = -DOC_URL = -DOC_ABSPATH = -BIN_ABSPATH = -EXT_DOC_PATHS = diff --git a/doxygen/miniglx.doxy b/doxygen/miniglx.doxy deleted file mode 100644 index 61c376caf2..0000000000 --- a/doxygen/miniglx.doxy +++ /dev/null @@ -1,179 +0,0 @@ -# Doxyfile 0.1 - -#--------------------------------------------------------------------------- -# General configuration options -#--------------------------------------------------------------------------- -PROJECT_NAME = "MiniGLX" -PROJECT_NUMBER = -OUTPUT_DIRECTORY = -OUTPUT_LANGUAGE = English -EXTRACT_ALL = NO -EXTRACT_PRIVATE = NO -EXTRACT_STATIC = YES -EXTRACT_LOCAL_CLASSES = YES -HIDE_UNDOC_MEMBERS = NO -HIDE_UNDOC_CLASSES = NO -BRIEF_MEMBER_DESC = YES -REPEAT_BRIEF = YES -ALWAYS_DETAILED_SEC = NO -INLINE_INHERITED_MEMB = NO -FULL_PATH_NAMES = NO -STRIP_FROM_PATH = -INTERNAL_DOCS = YES -STRIP_CODE_COMMENTS = YES -CASE_SENSE_NAMES = YES -SHORT_NAMES = NO -HIDE_SCOPE_NAMES = NO -VERBATIM_HEADERS = NO -SHOW_INCLUDE_FILES = NO -JAVADOC_AUTOBRIEF = NO -INHERIT_DOCS = YES -INLINE_INFO = YES -SORT_MEMBER_DOCS = NO -DISTRIBUTE_GROUP_DOC = NO -TAB_SIZE = 8 -GENERATE_TODOLIST = YES -GENERATE_TESTLIST = YES -GENERATE_BUGLIST = YES -ALIASES = -ENABLED_SECTIONS = -MAX_INITIALIZER_LINES = 30 -OPTIMIZE_OUTPUT_FOR_C = NO -SHOW_USED_FILES = YES -#--------------------------------------------------------------------------- -# configuration options related to warning and progress messages -#--------------------------------------------------------------------------- -QUIET = YES -WARNINGS = YES -WARN_IF_UNDOCUMENTED = NO -WARN_FORMAT = -WARN_LOGFILE = -#--------------------------------------------------------------------------- -# configuration options related to the input files -#--------------------------------------------------------------------------- -INPUT = ../src/glx/mini/ ../include/GL/miniglx.h -FILE_PATTERNS = *.h *.c -RECURSIVE = NO -EXCLUDE = ../src/glx/mini/glapi.c -EXCLUDE_PATTERNS = -EXAMPLE_PATH = -EXAMPLE_PATTERNS = -EXAMPLE_RECURSIVE = NO -IMAGE_PATH = -INPUT_FILTER = -FILTER_SOURCE_FILES = NO -#--------------------------------------------------------------------------- -# configuration options related to source browsing -#--------------------------------------------------------------------------- -SOURCE_BROWSER = NO -INLINE_SOURCES = NO -REFERENCED_BY_RELATION = YES -REFERENCES_RELATION = YES -#--------------------------------------------------------------------------- -# configuration options related to the alphabetical class index -#--------------------------------------------------------------------------- -ALPHABETICAL_INDEX = NO -COLS_IN_ALPHA_INDEX = 5 -IGNORE_PREFIX = -#--------------------------------------------------------------------------- -# configuration options related to the HTML output -#--------------------------------------------------------------------------- -GENERATE_HTML = YES -HTML_OUTPUT = miniglx -HTML_HEADER = header_subset.html -HTML_FOOTER = -HTML_STYLESHEET = -HTML_ALIGN_MEMBERS = YES -GENERATE_HTMLHELP = NO -GENERATE_CHI = NO -BINARY_TOC = NO -TOC_EXPAND = NO -DISABLE_INDEX = NO -ENUM_VALUES_PER_LINE = 4 -GENERATE_TREEVIEW = NO -TREEVIEW_WIDTH = 250 -#--------------------------------------------------------------------------- -# configuration options related to the LaTeX output -#--------------------------------------------------------------------------- -GENERATE_LATEX = NO -LATEX_OUTPUT = -COMPACT_LATEX = NO -PAPER_TYPE = a4wide -EXTRA_PACKAGES = -LATEX_HEADER = -PDF_HYPERLINKS = NO -USE_PDFLATEX = NO -LATEX_BATCHMODE = NO -#--------------------------------------------------------------------------- -# configuration options related to the RTF output -#--------------------------------------------------------------------------- -GENERATE_RTF = NO -RTF_OUTPUT = -COMPACT_RTF = NO -RTF_HYPERLINKS = NO -RTF_STYLESHEET_FILE = -RTF_EXTENSIONS_FILE = -#--------------------------------------------------------------------------- -# configuration options related to the man page output -#--------------------------------------------------------------------------- -GENERATE_MAN = NO -MAN_OUTPUT = -MAN_EXTENSION = -MAN_LINKS = NO -#--------------------------------------------------------------------------- -# configuration options related to the XML output -#--------------------------------------------------------------------------- -GENERATE_XML = NO -#--------------------------------------------------------------------------- -# configuration options for the AutoGen Definitions output -#--------------------------------------------------------------------------- -GENERATE_AUTOGEN_DEF = NO -#--------------------------------------------------------------------------- -# Configuration options related to the preprocessor -#--------------------------------------------------------------------------- -ENABLE_PREPROCESSING = YES -MACRO_EXPANSION = NO -EXPAND_ONLY_PREDEF = NO -SEARCH_INCLUDES = YES -INCLUDE_PATH = ../include/ -INCLUDE_FILE_PATTERNS = -PREDEFINED = -EXPAND_AS_DEFINED = -SKIP_FUNCTION_MACROS = YES -#--------------------------------------------------------------------------- -# Configuration::addtions related to external references -#--------------------------------------------------------------------------- -TAGFILES = \ - core_subset.tag=../core_subset \ - math_subset.tag=../math_subset -GENERATE_TAGFILE = miniglx.tag -ALLEXTERNALS = NO -PERL_PATH = -#--------------------------------------------------------------------------- -# Configuration options related to the dot tool -#--------------------------------------------------------------------------- -CLASS_DIAGRAMS = NO -HAVE_DOT = NO -CLASS_GRAPH = YES -COLLABORATION_GRAPH = YES -TEMPLATE_RELATIONS = YES -HIDE_UNDOC_RELATIONS = YES -INCLUDE_GRAPH = YES -INCLUDED_BY_GRAPH = YES -GRAPHICAL_HIERARCHY = YES -DOT_PATH = -DOTFILE_DIRS = -MAX_DOT_GRAPH_WIDTH = 1024 -MAX_DOT_GRAPH_HEIGHT = 1024 -GENERATE_LEGEND = YES -DOT_CLEANUP = YES -#--------------------------------------------------------------------------- -# Configuration::addtions related to the search engine -#--------------------------------------------------------------------------- -SEARCHENGINE = NO -CGI_NAME = -CGI_URL = -DOC_URL = -DOC_ABSPATH = -BIN_ABSPATH = -EXT_DOC_PATHS = diff --git a/doxygen/radeon_subset.doxy b/doxygen/radeon_subset.doxy deleted file mode 100644 index fb9d0e9535..0000000000 --- a/doxygen/radeon_subset.doxy +++ /dev/null @@ -1,203 +0,0 @@ -# Doxyfile 0.1 - -#--------------------------------------------------------------------------- -# General configuration options -#--------------------------------------------------------------------------- -PROJECT_NAME = "Radeon Subset Driver" -PROJECT_NUMBER = -OUTPUT_DIRECTORY = -OUTPUT_LANGUAGE = English -EXTRACT_ALL = NO -EXTRACT_PRIVATE = NO -EXTRACT_STATIC = YES -EXTRACT_LOCAL_CLASSES = YES -HIDE_UNDOC_MEMBERS = NO -HIDE_UNDOC_CLASSES = NO -BRIEF_MEMBER_DESC = YES -REPEAT_BRIEF = YES -ALWAYS_DETAILED_SEC = NO -INLINE_INHERITED_MEMB = NO -FULL_PATH_NAMES = NO -STRIP_FROM_PATH = -INTERNAL_DOCS = YES -STRIP_CODE_COMMENTS = YES -CASE_SENSE_NAMES = YES -SHORT_NAMES = NO -HIDE_SCOPE_NAMES = NO -VERBATIM_HEADERS = NO -SHOW_INCLUDE_FILES = NO -JAVADOC_AUTOBRIEF = NO -INHERIT_DOCS = YES -INLINE_INFO = YES -SORT_MEMBER_DOCS = NO -DISTRIBUTE_GROUP_DOC = NO -TAB_SIZE = 8 -GENERATE_TODOLIST = YES -GENERATE_TESTLIST = YES -GENERATE_BUGLIST = YES -ALIASES = -ENABLED_SECTIONS = -MAX_INITIALIZER_LINES = 30 -OPTIMIZE_OUTPUT_FOR_C = NO -SHOW_USED_FILES = YES -#--------------------------------------------------------------------------- -# configuration options related to warning and progress messages -#--------------------------------------------------------------------------- -QUIET = YES -WARNINGS = YES -WARN_IF_UNDOCUMENTED = NO -WARN_FORMAT = -WARN_LOGFILE = -#--------------------------------------------------------------------------- -# configuration options related to the input files -#--------------------------------------------------------------------------- -INPUT = \ - ../src/mesa/drivers/dri/common/mm.c \ - ../src/mesa/drivers/dri/common/mm.h \ - ../src/mesa/drivers/dri/radeon/radeon_context.c \ - ../src/mesa/drivers/dri/radeon/radeon_context.h \ - ../src/mesa/drivers/dri/radeon/radeon_ioctl.c \ - ../src/mesa/drivers/dri/radeon/radeon_ioctl.h \ - ../src/mesa/drivers/dri/radeon/radeon_lock.c \ - ../src/mesa/drivers/dri/radeon/radeon_lock.h \ - ../src/mesa/drivers/dri/radeon/radeon_screen.c \ - ../src/mesa/drivers/dri/radeon/radeon_screen.h \ - ../src/mesa/drivers/dri/radeon/radeon_state.c \ - ../src/mesa/drivers/dri/radeon/radeon_state.h \ - ../src/mesa/drivers/dri/radeon/radeon_state_init.c \ - ../src/mesa/drivers/dri/radeon/radeon_subset.h \ - ../src/mesa/drivers/dri/radeon/radeon_subset_bitmap.c \ - ../src/mesa/drivers/dri/radeon/radeon_subset_readpix.c \ - ../src/mesa/drivers/dri/radeon/radeon_subset_select.c \ - ../src/mesa/drivers/dri/radeon/radeon_subset_tex.c \ - ../src/mesa/drivers/dri/radeon/radeon_subset_vtx.c \ - ../src/mesa/drivers/dri/radeon/radeon_tcl.h \ - ../src/mesa/drivers/dri/radeon/radeon_tex.h \ - ../src/mesa/drivers/dri/radeon/radeon_vtxfmt.h \ - ../src/mesa/drivers/dri/radeon/server -FILE_PATTERNS = *.h *.c -RECURSIVE = NO -EXCLUDE = -EXCLUDE_PATTERNS = -EXAMPLE_PATH = -EXAMPLE_PATTERNS = -EXAMPLE_RECURSIVE = NO -IMAGE_PATH = -INPUT_FILTER = -FILTER_SOURCE_FILES = NO -#--------------------------------------------------------------------------- -# configuration options related to source browsing -#--------------------------------------------------------------------------- -SOURCE_BROWSER = NO -INLINE_SOURCES = NO -REFERENCED_BY_RELATION = YES -REFERENCES_RELATION = YES -#--------------------------------------------------------------------------- -# configuration options related to the alphabetical class index -#--------------------------------------------------------------------------- -ALPHABETICAL_INDEX = NO -COLS_IN_ALPHA_INDEX = 5 -IGNORE_PREFIX = -#--------------------------------------------------------------------------- -# configuration options related to the HTML output -#--------------------------------------------------------------------------- -GENERATE_HTML = YES -HTML_OUTPUT = radeon_subset -HTML_HEADER = header_subset.html -HTML_FOOTER = -HTML_STYLESHEET = -HTML_ALIGN_MEMBERS = YES -GENERATE_HTMLHELP = NO -GENERATE_CHI = NO -BINARY_TOC = NO -TOC_EXPAND = NO -DISABLE_INDEX = NO -ENUM_VALUES_PER_LINE = 4 -GENERATE_TREEVIEW = NO -TREEVIEW_WIDTH = 250 -#--------------------------------------------------------------------------- -# configuration options related to the LaTeX output -#--------------------------------------------------------------------------- -GENERATE_LATEX = NO -LATEX_OUTPUT = -COMPACT_LATEX = NO -PAPER_TYPE = a4wide -EXTRA_PACKAGES = -LATEX_HEADER = -PDF_HYPERLINKS = NO -USE_PDFLATEX = NO -LATEX_BATCHMODE = NO -#--------------------------------------------------------------------------- -# configuration options related to the RTF output -#--------------------------------------------------------------------------- -GENERATE_RTF = NO -RTF_OUTPUT = -COMPACT_RTF = NO -RTF_HYPERLINKS = NO -RTF_STYLESHEET_FILE = -RTF_EXTENSIONS_FILE = -#--------------------------------------------------------------------------- -# configuration options related to the man page output -#--------------------------------------------------------------------------- -GENERATE_MAN = NO -MAN_OUTPUT = -MAN_EXTENSION = -MAN_LINKS = NO -#--------------------------------------------------------------------------- -# configuration options related to the XML output -#--------------------------------------------------------------------------- -GENERATE_XML = NO -#--------------------------------------------------------------------------- -# configuration options for the AutoGen Definitions output -#--------------------------------------------------------------------------- -GENERATE_AUTOGEN_DEF = NO -#--------------------------------------------------------------------------- -# Configuration options related to the preprocessor -#--------------------------------------------------------------------------- -ENABLE_PREPROCESSING = YES -MACRO_EXPANSION = NO -EXPAND_ONLY_PREDEF = NO -SEARCH_INCLUDES = YES -INCLUDE_PATH = ../include/ -INCLUDE_FILE_PATTERNS = -PREDEFINED = -EXPAND_AS_DEFINED = -SKIP_FUNCTION_MACROS = YES -#--------------------------------------------------------------------------- -# Configuration::addtions related to external references -#--------------------------------------------------------------------------- -TAGFILES = \ - core_subset.tag=../core_subset \ - math_subset.tag=../math_subset \ - miniglx.tag=../miniglx -GENERATE_TAGFILE = radeon_subset.tag -ALLEXTERNALS = NO -PERL_PATH = -#--------------------------------------------------------------------------- -# Configuration options related to the dot tool -#--------------------------------------------------------------------------- -CLASS_DIAGRAMS = NO -HAVE_DOT = NO -CLASS_GRAPH = YES -COLLABORATION_GRAPH = YES -TEMPLATE_RELATIONS = YES -HIDE_UNDOC_RELATIONS = YES -INCLUDE_GRAPH = YES -INCLUDED_BY_GRAPH = YES -GRAPHICAL_HIERARCHY = YES -DOT_PATH = -DOTFILE_DIRS = -MAX_DOT_GRAPH_WIDTH = 1024 -MAX_DOT_GRAPH_HEIGHT = 1024 -GENERATE_LEGEND = YES -DOT_CLEANUP = YES -#--------------------------------------------------------------------------- -# Configuration::addtions related to the search engine -#--------------------------------------------------------------------------- -SEARCHENGINE = NO -CGI_NAME = -CGI_URL = -DOC_URL = -DOC_ABSPATH = -BIN_ABSPATH = -EXT_DOC_PATHS = diff --git a/doxygen/shader.doxy b/doxygen/shader.doxy deleted file mode 100644 index d8ad14cc76..0000000000 --- a/doxygen/shader.doxy +++ /dev/null @@ -1,49 +0,0 @@ -# Doxyfile 0.1 - -@INCLUDE = common.doxy - -#--------------------------------------------------------------------------- -# General configuration options -#--------------------------------------------------------------------------- -PROJECT_NAME = "Mesa Vertex and Fragment Program code" -#--------------------------------------------------------------------------- -# configuration options related to the input files -#--------------------------------------------------------------------------- -INPUT = ../src/mesa/shader/ -FILE_PATTERNS = *.c *.h -RECURSIVE = NO -EXCLUDE = -EXCLUDE_PATTERNS = -EXAMPLE_PATH = -EXAMPLE_PATTERNS = -EXAMPLE_RECURSIVE = NO -IMAGE_PATH = -INPUT_FILTER = -FILTER_SOURCE_FILES = NO -#--------------------------------------------------------------------------- -# configuration options related to the HTML output -#--------------------------------------------------------------------------- -HTML_OUTPUT = shader -#--------------------------------------------------------------------------- -# Configuration options related to the preprocessor -#--------------------------------------------------------------------------- -ENABLE_PREPROCESSING = YES -MACRO_EXPANSION = NO -EXPAND_ONLY_PREDEF = NO -SEARCH_INCLUDES = YES -INCLUDE_PATH = ../include/ -INCLUDE_FILE_PATTERNS = -PREDEFINED = -EXPAND_AS_DEFINED = -SKIP_FUNCTION_MACROS = YES -#--------------------------------------------------------------------------- -# Configuration::addtions related to external references -#--------------------------------------------------------------------------- -TAGFILES = main.tag=../core \ - math.tag=../math \ - tnl_dd.tag=../tnl_dd \ - swrast.tag=../swrast \ - swrast_setup.tag=../swrast_setup \ - tnl.tag=../tnl \ - vbo.tag=vbo -GENERATE_TAGFILE = swrast.tag diff --git a/doxygen/swrast.doxy b/doxygen/swrast.doxy deleted file mode 100644 index fa07afd594..0000000000 --- a/doxygen/swrast.doxy +++ /dev/null @@ -1,48 +0,0 @@ -# Doxyfile 0.1 - -@INCLUDE = common.doxy - -#--------------------------------------------------------------------------- -# General configuration options -#--------------------------------------------------------------------------- -PROJECT_NAME = "Mesa Software Rasterization (swrast)" -#--------------------------------------------------------------------------- -# configuration options related to the input files -#--------------------------------------------------------------------------- -INPUT = ../src/mesa/swrast/ -FILE_PATTERNS = *.c *.h -RECURSIVE = NO -EXCLUDE = -EXCLUDE_PATTERNS = -EXAMPLE_PATH = -EXAMPLE_PATTERNS = -EXAMPLE_RECURSIVE = NO -IMAGE_PATH = -INPUT_FILTER = -FILTER_SOURCE_FILES = NO -#--------------------------------------------------------------------------- -# configuration options related to the HTML output -#--------------------------------------------------------------------------- -HTML_OUTPUT = swrast -#--------------------------------------------------------------------------- -# Configuration options related to the preprocessor -#--------------------------------------------------------------------------- -ENABLE_PREPROCESSING = YES -MACRO_EXPANSION = NO -EXPAND_ONLY_PREDEF = NO -SEARCH_INCLUDES = YES -INCLUDE_PATH = ../include/ -INCLUDE_FILE_PATTERNS = -PREDEFINED = -EXPAND_AS_DEFINED = -SKIP_FUNCTION_MACROS = YES -#--------------------------------------------------------------------------- -# Configuration::addtions related to external references -#--------------------------------------------------------------------------- -TAGFILES = main.tag=../core \ - math.tag=../math \ - tnl_dd.tag=../tnl_dd \ - swrast_setup.tag=../swrast_setup \ - tnl.tag=../tnl \ - vbo.tag=vbo -GENERATE_TAGFILE = swrast.tag diff --git a/doxygen/swrast_setup.doxy b/doxygen/swrast_setup.doxy deleted file mode 100644 index ee6f3ffdc8..0000000000 --- a/doxygen/swrast_setup.doxy +++ /dev/null @@ -1,49 +0,0 @@ -# Doxyfile 0.1 - -@INCLUDE = common.doxy - -#--------------------------------------------------------------------------- -# General configuration options -#--------------------------------------------------------------------------- -PROJECT_NAME = "Mesa swrast_setup" -#--------------------------------------------------------------------------- -# configuration options related to the input files -#--------------------------------------------------------------------------- -INPUT = ../src/mesa/swrast_setup/ -FILE_PATTERNS = *.c \ - *.h -RECURSIVE = NO -EXCLUDE = -EXCLUDE_PATTERNS = -EXAMPLE_PATH = -EXAMPLE_PATTERNS = -EXAMPLE_RECURSIVE = NO -IMAGE_PATH = -INPUT_FILTER = -FILTER_SOURCE_FILES = NO -#--------------------------------------------------------------------------- -# configuration options related to the HTML output -#--------------------------------------------------------------------------- -HTML_OUTPUT = swrast_setup -#--------------------------------------------------------------------------- -# Configuration options related to the preprocessor -#--------------------------------------------------------------------------- -ENABLE_PREPROCESSING = YES -MACRO_EXPANSION = NO -EXPAND_ONLY_PREDEF = NO -SEARCH_INCLUDES = YES -INCLUDE_PATH = -INCLUDE_FILE_PATTERNS = -PREDEFINED = -EXPAND_AS_DEFINED = -SKIP_FUNCTION_MACROS = YES -#--------------------------------------------------------------------------- -# Configuration::addtions related to external references -#--------------------------------------------------------------------------- -TAGFILES = tnl_dd.tag=../tnl_dd \ - main.tag=../core \ - math.tag=../math \ - swrast.tag=../swrast \ - tnl.tag=../tnl \ - vbo.tag=../vbo -GENERATE_TAGFILE = swrast_setup.tag diff --git a/doxygen/tnl.doxy b/doxygen/tnl.doxy deleted file mode 100644 index a4f76a2953..0000000000 --- a/doxygen/tnl.doxy +++ /dev/null @@ -1,50 +0,0 @@ -# Doxyfile 0.1 - -@INCLUDE = common.doxy - -#--------------------------------------------------------------------------- -# General configuration options -#--------------------------------------------------------------------------- -PROJECT_NAME = "Mesa Transform and Lighting (tnl)" -#--------------------------------------------------------------------------- -# configuration options related to the input files -#--------------------------------------------------------------------------- -INPUT = ../src/mesa/tnl/ -FILE_PATTERNS = *.c \ - *.h -RECURSIVE = NO -EXCLUDE = -EXCLUDE_PATTERNS = -EXAMPLE_PATH = -EXAMPLE_PATTERNS = -EXAMPLE_RECURSIVE = NO -IMAGE_PATH = -INPUT_FILTER = -FILTER_SOURCE_FILES = NO -#--------------------------------------------------------------------------- -# configuration options related to the HTML output -#--------------------------------------------------------------------------- -HTML_OUTPUT = tnl -#--------------------------------------------------------------------------- -# Configuration options related to the preprocessor -#--------------------------------------------------------------------------- -ENABLE_PREPROCESSING = YES -MACRO_EXPANSION = NO -EXPAND_ONLY_PREDEF = NO -SEARCH_INCLUDES = YES -INCLUDE_PATH = -INCLUDE_FILE_PATTERNS = -PREDEFINED = -EXPAND_AS_DEFINED = -SKIP_FUNCTION_MACROS = YES -#--------------------------------------------------------------------------- -# Configuration::addtions related to external references -#--------------------------------------------------------------------------- -TAGFILES = tnl_dd.tag=../tnl \ - main.tag=../core \ - math.tag=../math \ - shader.tag=../shader \ - swrast.tag=../swrast \ - swrast_setup.tag=swrast_setup \ - vbo.tag=vbo -GENERATE_TAGFILE = tnl.tag diff --git a/doxygen/tnl_dd.doxy b/doxygen/tnl_dd.doxy deleted file mode 100644 index b241f67f4b..0000000000 --- a/doxygen/tnl_dd.doxy +++ /dev/null @@ -1,49 +0,0 @@ -# Doxyfile 0.1 - -@INCLUDE = common.doxy - -#--------------------------------------------------------------------------- -# General configuration options -#--------------------------------------------------------------------------- -PROJECT_NAME = "Mesa tnl_dd" -#--------------------------------------------------------------------------- -# configuration options related to the input files -#--------------------------------------------------------------------------- -INPUT = ../src/mesa/tnl_dd/ -FILE_PATTERNS = *.c *.h -RECURSIVE = YES -EXCLUDE = -EXCLUDE_PATTERNS = -EXAMPLE_PATH = -EXAMPLE_PATTERNS = -EXAMPLE_RECURSIVE = NO -IMAGE_PATH = -INPUT_FILTER = -FILTER_SOURCE_FILES = NO -#--------------------------------------------------------------------------- -# configuration options related to the HTML output -#--------------------------------------------------------------------------- -HTML_OUTPUT = tnl_dd -#--------------------------------------------------------------------------- -# Configuration options related to the preprocessor -#--------------------------------------------------------------------------- -ENABLE_PREPROCESSING = YES -MACRO_EXPANSION = NO -EXPAND_ONLY_PREDEF = NO -SEARCH_INCLUDES = YES -INCLUDE_PATH = -INCLUDE_FILE_PATTERNS = -PREDEFINED = -EXPAND_AS_DEFINED = -SKIP_FUNCTION_MACROS = YES -#--------------------------------------------------------------------------- -# Configuration::addtions related to external references -#--------------------------------------------------------------------------- -TAGFILES = main.tag=../core \ - math.tag=../math \ - shader.tag=../shader \ - swrast.tag=../swrast \ - swrast_setup.tag=../swrast_setup \ - tnl.tag=../tnl \ - vbo.tag=vbo -GENERATE_TAGFILE = tnl_dd.tag diff --git a/doxygen/vbo.doxy b/doxygen/vbo.doxy deleted file mode 100644 index 6dfb21cf4f..0000000000 --- a/doxygen/vbo.doxy +++ /dev/null @@ -1,50 +0,0 @@ -# Doxyfile 0.1 - -@INCLUDE = common.doxy - -#--------------------------------------------------------------------------- -# General configuration options -#--------------------------------------------------------------------------- -PROJECT_NAME = "Mesa vbo" -#--------------------------------------------------------------------------- -# configuration options related to the input files -#--------------------------------------------------------------------------- -INPUT = ../src/mesa/vbo/ -FILE_PATTERNS = *.c \ - *.h -RECURSIVE = NO -EXCLUDE = -EXCLUDE_PATTERNS = -EXAMPLE_PATH = -EXAMPLE_PATTERNS = -EXAMPLE_RECURSIVE = NO -IMAGE_PATH = -INPUT_FILTER = -FILTER_SOURCE_FILES = NO -#--------------------------------------------------------------------------- -# configuration options related to the HTML output -#--------------------------------------------------------------------------- -HTML_OUTPUT = vbo -#--------------------------------------------------------------------------- -# Configuration options related to the preprocessor -#--------------------------------------------------------------------------- -ENABLE_PREPROCESSING = YES -MACRO_EXPANSION = NO -EXPAND_ONLY_PREDEF = NO -SEARCH_INCLUDES = YES -INCLUDE_PATH = -INCLUDE_FILE_PATTERNS = -PREDEFINED = -EXPAND_AS_DEFINED = -SKIP_FUNCTION_MACROS = YES -#--------------------------------------------------------------------------- -# Configuration::addtions related to external references -#--------------------------------------------------------------------------- -TAGFILES = main.tag=../core \ - math.tag=../math \ - shader.tag=../shader \ - swrast.tag=../swrast \ - swrast_setup.tag=../swrast_setup \ - tnl.tag=../tnl \ - tnl_dd.tag=../tnl_dd -GENERATE_TAGFILE = vbo.tag diff --git a/include/GLES/egl.h b/include/GLES/egl.h deleted file mode 100644 index 61a2cc3c9b..0000000000 --- a/include/GLES/egl.h +++ /dev/null @@ -1,320 +0,0 @@ -#ifndef _EGL_H -#define _EGL_H - -/* - * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) - * Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice including the dates of first publication and - * either this permission notice or a reference to - * http://oss.sgi.com/projects/FreeB/ - * shall be included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * SILICON GRAPHICS, INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF - * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - * Except as contained in this notice, the name of Silicon Graphics, Inc. - * shall not be used in advertising or otherwise to promote the sale, use or - * other dealings in this Software without prior written authorization from - * Silicon Graphics, Inc. - */ - -#if 0/*XXX TEMPORARY HACK*/ -#include -#else -#include -#endif -#include - -/* XXX should go in eglext.h */ -#define GL_OES_VERSION_1_0 1 -#define GL_OES_read_format 1 -#define GL_OES_compressed_paletted_texture 1 -#define GL_IMPLEMENTATION_COLOR_READ_TYPE_OES 0x8B9A -#define GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES 0x8B9B -#define GL_PALETTE4_RGB8_OES 0x8B90 -#define GL_PALETTE4_RGBA8_OES 0x8B91 -#define GL_PALETTE4_R5_G6_B5_OES 0x8B92 -#define GL_PALETTE4_RGBA4_OES 0x8B93 -#define GL_PALETTE4_RGB5_A1_OES 0x8B94 -#define GL_PALETTE8_RGB8_OES 0x8B95 -#define GL_PALETTE8_RGBA8_OES 0x8B96 -#define GL_PALETTE8_R5_G6_B5_OES 0x8B97 -#define GL_PALETTE8_RGBA4_OES 0x8B98 -#define GL_PALETTE8_RGB5_A1_OES 0x8B99 -/* XXX */ - -/* -** Versioning and extensions -*/ -#define EGL_VERSION_1_0 1 -#define EGL_VERSION_1_1 1 - -/* -** Boolean -*/ -#define EGL_FALSE 0 -#define EGL_TRUE 1 - -/* -** Errors -*/ -#define EGL_SUCCESS 0x3000 -#define EGL_NOT_INITIALIZED 0x3001 -#define EGL_BAD_ACCESS 0x3002 -#define EGL_BAD_ALLOC 0x3003 -#define EGL_BAD_ATTRIBUTE 0x3004 -#define EGL_BAD_CONFIG 0x3005 -#define EGL_BAD_CONTEXT 0x3006 -#define EGL_BAD_CURRENT_SURFACE 0x3007 -#define EGL_BAD_DISPLAY 0x3008 -#define EGL_BAD_MATCH 0x3009 -#define EGL_BAD_NATIVE_PIXMAP 0x300A -#define EGL_BAD_NATIVE_WINDOW 0x300B -#define EGL_BAD_PARAMETER 0x300C -#define EGL_BAD_SURFACE 0x300D -#define EGL_CONTEXT_LOST 0x300E -/* 0x300F - 0x301F reserved for additional errors. */ - -/* -** Config attributes -*/ -#define EGL_BUFFER_SIZE 0x3020 -#define EGL_ALPHA_SIZE 0x3021 -#define EGL_BLUE_SIZE 0x3022 -#define EGL_GREEN_SIZE 0x3023 -#define EGL_RED_SIZE 0x3024 -#define EGL_DEPTH_SIZE 0x3025 -#define EGL_STENCIL_SIZE 0x3026 -#define EGL_CONFIG_CAVEAT 0x3027 -#define EGL_CONFIG_ID 0x3028 -#define EGL_LEVEL 0x3029 -#define EGL_MAX_PBUFFER_HEIGHT 0x302A -#define EGL_MAX_PBUFFER_PIXELS 0x302B -#define EGL_MAX_PBUFFER_WIDTH 0x302C -#define EGL_NATIVE_RENDERABLE 0x302D -#define EGL_NATIVE_VISUAL_ID 0x302E -#define EGL_NATIVE_VISUAL_TYPE 0x302F -/*#define EGL_PRESERVED_RESOURCES 0x3030*/ -#define EGL_SAMPLES 0x3031 -#define EGL_SAMPLE_BUFFERS 0x3032 -#define EGL_SURFACE_TYPE 0x3033 -#define EGL_TRANSPARENT_TYPE 0x3034 -#define EGL_TRANSPARENT_BLUE_VALUE 0x3035 -#define EGL_TRANSPARENT_GREEN_VALUE 0x3036 -#define EGL_TRANSPARENT_RED_VALUE 0x3037 -#define EGL_NONE 0x3038 /* Also a config value */ -#define EGL_BIND_TO_TEXTURE_RGB 0x3039 -#define EGL_BIND_TO_TEXTURE_RGBA 0x303A -#define EGL_MIN_SWAP_INTERVAL 0x303B -#define EGL_MAX_SWAP_INTERVAL 0x303C - -/* -** Config values -*/ -#define EGL_DONT_CARE ((EGLint) -1) - -#define EGL_SLOW_CONFIG 0x3050 /* EGL_CONFIG_CAVEAT value */ -#define EGL_NON_CONFORMANT_CONFIG 0x3051 /* " */ -#define EGL_TRANSPARENT_RGB 0x3052 /* EGL_TRANSPARENT_TYPE value */ -#define EGL_NO_TEXTURE 0x305C /* EGL_TEXTURE_FORMAT/TARGET value */ -#define EGL_TEXTURE_RGB 0x305D /* EGL_TEXTURE_FORMAT value */ -#define EGL_TEXTURE_RGBA 0x305E /* " */ -#define EGL_TEXTURE_2D 0x305F /* EGL_TEXTURE_TARGET value */ - -/* -** Config attribute mask bits -*/ -#define EGL_PBUFFER_BIT 0x01 /* EGL_SURFACE_TYPE mask bit */ -#define EGL_PIXMAP_BIT 0x02 /* " */ -#define EGL_WINDOW_BIT 0x04 /* " */ - -/* -** String names -*/ -#define EGL_VENDOR 0x3053 /* eglQueryString target */ -#define EGL_VERSION 0x3054 /* " */ -#define EGL_EXTENSIONS 0x3055 /* " */ - -/* -** Surface attributes -*/ -#define EGL_HEIGHT 0x3056 -#define EGL_WIDTH 0x3057 -#define EGL_LARGEST_PBUFFER 0x3058 -#define EGL_TEXTURE_FORMAT 0x3080 /* For pbuffers bound as textures */ -#define EGL_TEXTURE_TARGET 0x3081 /* " */ -#define EGL_MIPMAP_TEXTURE 0x3082 /* " */ -#define EGL_MIPMAP_LEVEL 0x3083 /* " */ - -/* -** BindTexImage / ReleaseTexImage buffer target -*/ -#define EGL_BACK_BUFFER 0x3084 - -/* -** Current surfaces -*/ -#define EGL_DRAW 0x3059 -#define EGL_READ 0x305A - -/* -** Engines -*/ -#define EGL_CORE_NATIVE_ENGINE 0x305B - -/* 0x305C-0x3FFFF reserved for future use */ - -/* -** Functions -*/ -#ifdef __cplusplus -extern "C" { -#endif - -GLAPI EGLint APIENTRY eglGetError (void); - -GLAPI EGLDisplay APIENTRY eglGetDisplay (NativeDisplayType display); -GLAPI EGLBoolean APIENTRY eglInitialize (EGLDisplay dpy, EGLint *major, EGLint *minor); -GLAPI EGLBoolean APIENTRY eglTerminate (EGLDisplay dpy); -GLAPI const char * APIENTRY eglQueryString (EGLDisplay dpy, EGLint name); -GLAPI void (* APIENTRY eglGetProcAddress (const char *procname))(void); - -GLAPI EGLBoolean APIENTRY eglGetConfigs (EGLDisplay dpy, EGLConfig *configs, EGLint config_size, EGLint *num_config); -GLAPI EGLBoolean APIENTRY eglChooseConfig (EGLDisplay dpy, const EGLint *attrib_list, EGLConfig *configs, EGLint config_size, EGLint *num_config); -GLAPI EGLBoolean APIENTRY eglGetConfigAttrib (EGLDisplay dpy, EGLConfig config, EGLint attribute, EGLint *value); - -GLAPI EGLSurface APIENTRY eglCreateWindowSurface (EGLDisplay dpy, EGLConfig config, NativeWindowType window, const EGLint *attrib_list); -GLAPI EGLSurface APIENTRY eglCreatePixmapSurface (EGLDisplay dpy, EGLConfig config, NativePixmapType pixmap, const EGLint *attrib_list); -GLAPI EGLSurface APIENTRY eglCreatePbufferSurface (EGLDisplay dpy, EGLConfig config, const EGLint *attrib_list); -GLAPI EGLBoolean APIENTRY eglDestroySurface (EGLDisplay dpy, EGLSurface surface); -GLAPI EGLBoolean APIENTRY eglQuerySurface (EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint *value); - -/* EGL 1.1 render-to-texture APIs */ -GLAPI EGLBoolean APIENTRY eglSurfaceAttrib (EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint value); -GLAPI EGLBoolean APIENTRY eglBindTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer); -GLAPI EGLBoolean APIENTRY eglReleaseTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer); - -/* EGL 1.1 swap control API */ -GLAPI EGLBoolean APIENTRY eglSwapInterval(EGLDisplay dpy, EGLint interval); - -GLAPI EGLContext APIENTRY eglCreateContext (EGLDisplay dpy, EGLConfig config, EGLContext share_list, const EGLint *attrib_list); -GLAPI EGLBoolean APIENTRY eglDestroyContext (EGLDisplay dpy, EGLContext ctx); -GLAPI EGLBoolean APIENTRY eglMakeCurrent (EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext ctx); -GLAPI EGLContext APIENTRY eglGetCurrentContext (void); -GLAPI EGLSurface APIENTRY eglGetCurrentSurface (EGLint readdraw); -GLAPI EGLDisplay APIENTRY eglGetCurrentDisplay (void); -GLAPI EGLBoolean APIENTRY eglQueryContext (EGLDisplay dpy, EGLContext ctx, EGLint attribute, EGLint *value); - -GLAPI EGLBoolean APIENTRY eglWaitGL (void); -GLAPI EGLBoolean APIENTRY eglWaitNative (EGLint engine); -GLAPI EGLBoolean APIENTRY eglSwapBuffers (EGLDisplay dpy, EGLSurface draw); -GLAPI EGLBoolean APIENTRY eglCopyBuffers (EGLDisplay dpy, EGLSurface surface, NativePixmapType target); - - - -/* EGL_MESA_screen extension >>> PRELIMINARY <<< */ -#ifndef EGL_MESA_screen_surface -#define EGL_MESA_screen_surface 1 - -#define EGL_BAD_SCREEN_MESA 0x4000 -#define EGL_BAD_MODE_MESA 0x4001 -#define EGL_SCREEN_COUNT_MESA 0x4002 -#define EGL_SCREEN_POSITION_MESA 0x4003 -#define EGL_SCREEN_POSITION_GRANULARITY_MESA 0x4004 -#define EGL_MODE_ID_MESA 0x4005 -#define EGL_REFRESH_RATE_MESA 0x4006 -#define EGL_OPTIMAL_MESA 0x4007 -#define EGL_INTERLACED_MESA 0x4008 -#define EGL_SCREEN_BIT_MESA 0x08 - -GLAPI EGLBoolean APIENTRY eglChooseModeMESA(EGLDisplay dpy, EGLScreenMESA screen, const EGLint *attrib_list, EGLModeMESA *modes, EGLint modes_size, EGLint *num_modes); -GLAPI EGLBoolean APIENTRY eglGetModesMESA(EGLDisplay dpy, EGLScreenMESA screen, EGLModeMESA *modes, EGLint modes_size, EGLint *num_modes); -GLAPI EGLBoolean APIENTRY eglGetModeAttribMESA(EGLDisplay dpy, EGLModeMESA mode, EGLint attribute, EGLint *value); -GLAPI EGLBoolean APIENTRY eglGetScreensMESA(EGLDisplay dpy, EGLScreenMESA *screens, EGLint max_screens, EGLint *num_screens); -GLAPI EGLSurface APIENTRY eglCreateScreenSurfaceMESA(EGLDisplay dpy, EGLConfig config, const EGLint *attrib_list); -GLAPI EGLBoolean APIENTRY eglShowScreenSurfaceMESA(EGLDisplay dpy, EGLint screen, EGLSurface surface, EGLModeMESA mode); -GLAPI EGLBoolean APIENTRY eglScreenPositionMESA(EGLDisplay dpy, EGLScreenMESA screen, EGLint x, EGLint y); -GLAPI EGLBoolean APIENTRY eglQueryScreenMESA(EGLDisplay dpy, EGLScreenMESA screen, EGLint attribute, EGLint *value); -GLAPI EGLBoolean APIENTRY eglQueryScreenSurfaceMESA(EGLDisplay dpy, EGLScreenMESA screen, EGLSurface *surface); -GLAPI EGLBoolean APIENTRY eglQueryScreenModeMESA(EGLDisplay dpy, EGLScreenMESA screen, EGLModeMESA *mode); -GLAPI const char * APIENTRY eglQueryModeStringMESA(EGLDisplay dpy, EGLModeMESA mode); - -#endif /* EGL_MESA_screen_surface */ - - -#ifndef EGL_MESA_copy_context -#define EGL_MESA_copy_context 1 - -GLAPI EGLBoolean APIENTRY eglCopyContextMESA(EGLDisplay dpy, EGLContext source, EGLContext dest, EGLint mask); - -#endif /* EGL_MESA_copy_context */ - - -/* XXX this is preliminary! */ -#ifndef EGL_VERSION_1_2 -#define EGL_VERSION_1_2 1 - -typedef int EGLenum; -typedef int EGLClientBuffer; - -#define EGL_DISPLAY_SCALING 10000 -#define EGL_UNKNOWN ((EGLint)-1) - -#define EGL_OPENGL_ES_BIT 0x1 -#define EGL_OPENVG_BIT 0x2 - -#define EGL_OPENGL_ES_API 0x30A0 -#define EGL_OPENVG_API 0x30A1 - -#define EGL_LUMINANCE_SIZE 0x303D -#define EGL_ALPHA_MASK_SIZE 0x303E -#define EGL_COLOR_BUFFER_TYPE 0x303F -#define EGL_RENDERABLE_TYPE 0x3040 - -#define EGL_SINGLE_BUFFER 0x3085 -#define EGL_RENDER_BUFFER 0x3086 -#define EGL_COLORSPACE 0x3087 -#define EGL_ALPHA_FORMAT 0x3088 -#define EGL_COLORSPACE_sRGB 0x3089 -#define EGL_COLORSPACE_LINEAR 0x308A -#define EGL_ALPHA_FORMAT_NONPRE 0x308B -#define EGL_ALPHA_FORMAT_PRE 0x308C -#define EGL_CLIENT_APIS 0x308D -#define EGL_RGB_BUFFER 0x308E -#define EGL_LUMINANCE_BUFFER 0x308F -#define EGL_HORIZONTAL_RESOLUTION 0x3090 -#define EGL_VERTICAL_RESOLUTION 0x3091 -#define EGL_PIXEL_ASPECT_RATIO 0x3092 -#define EGL_SWAP_BEHAVIOR 0x3093 -#define EGL_BUFFER_PRESERVED 0x3094 -#define EGL_BUFFER_DESTROYED 0x3095 -#define EGL_OPENVG_IMAGE 0x3096 -#define EGL_CONTEXT_CLIENT_TYPE 0x3097 - -GLAPI EGLBoolean APIENTRY eglBindAPI(EGLenum api); -GLAPI EGLenum APIENTRY eglQueryAPI(void); -GLAPI EGLBoolean APIENTRY eglWaitClient(void); -GLAPI EGLBoolean APIENTRY eglReleaseThread(void); -GLAPI EGLSurface APIENTRY eglCreatePbufferFromClientBuffer(EGLDisplay dpy, EGLenum buftype, EGLClientBuffer buffer, EGLConfig config, const EGLint *attrib_list); - -#endif /* EGL_VERSION_1_2 */ - - -#ifdef __cplusplus -} -#endif - -#endif /* _EGL_H */ diff --git a/include/GLES/egltypes.h b/include/GLES/egltypes.h deleted file mode 100644 index 6e98265043..0000000000 --- a/include/GLES/egltypes.h +++ /dev/null @@ -1,45 +0,0 @@ -/* -** egltypes.h for Mesa -** -** ONLY egl.h SHOULD INCLUDE THIS FILE! -** -** See comments about egltypes.h in the standard egl.h file. -*/ - - -#include - - -/* -** These opaque EGL types are implemented as unsigned 32-bit integers: -*/ -typedef uint32_t EGLDisplay; -typedef uint32_t EGLConfig; -typedef uint32_t EGLSurface; -typedef uint32_t EGLContext; - -/* EGL_MESA_screen_surface */ -typedef uint32_t EGLModeMESA; -typedef uint32_t EGLScreenMESA; - - -/* -** Other basic EGL types: -*/ -typedef uint8_t EGLBoolean; -typedef int32_t EGLint; - -typedef void * NativeDisplayType; -typedef int NativePixmapType; -typedef int NativeWindowType; - -/* -** EGL and native handle null values: -*/ -#define EGL_DEFAULT_DISPLAY ((NativeDisplayType) 0) -#define EGL_NO_CONTEXT ((EGLContext) 0) -#define EGL_NO_DISPLAY ((EGLDisplay) 0) -#define EGL_NO_SURFACE ((EGLSurface) 0) - -/* EGL_MESA_screen_surface */ -#define EGL_NO_MODE_MESA ((EGLModeMESA) 0) diff --git a/progs/beos/.gitignore b/progs/beos/.gitignore deleted file mode 100644 index 53011ca2e6..0000000000 --- a/progs/beos/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -demo -GLInfo -sample diff --git a/progs/demos/.gitignore b/progs/demos/.gitignore deleted file mode 100644 index ab836eb834..0000000000 --- a/progs/demos/.gitignore +++ /dev/null @@ -1,63 +0,0 @@ -.cvsignore -arbfplight -arbfslight -arbocclude -bounce -clearspd -copypix -cubemap -drawpix -engine -extfuncs.h -fire -fogcoord -fplight -fslight -gamma -gearbox -gears -geartrain -glinfo -gloss -glslnoise -gltestperf -glutfx -ipers -isosurf -lodbias -morph3d -multiarb -occlude -osdemo -paltex -pixeltex -pointblast -rain -ray -readpix -readtex.c -readtex.h -reflect -renormal -shadowtex -showbuffer.c -showbuffer.h -singlebuffer -spectex -spriteblast -stex3d -streaming_rect -teapot -terrain -tessdemo -texcyl -texdown -texenv -texobj -trackball.c -trackball.h -trispd -tunnel -tunnel2 -vao_demo -winpos diff --git a/progs/demos/Windows/all.dsp b/progs/demos/Windows/all.dsp deleted file mode 100644 index b47283c588..0000000000 --- a/progs/demos/Windows/all.dsp +++ /dev/null @@ -1,101 +0,0 @@ -# Microsoft Developer Studio Project File - Name="all" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Application" 0x0101 - -CFG=all - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "all.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "all.mak" CFG="all - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "all - Win32 Release" (based on "Win32 (x86) Application") -!MESSAGE "all - Win32 Debug" (based on "Win32 (x86) Application") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "all - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 - -!ELSEIF "$(CFG)" == "all - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /GZ /c -# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /GZ /c -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept - -!ENDIF - -# Begin Target - -# Name "all - Win32 Release" -# Name "all - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# End Group -# Begin Group "Resource Files" - -# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" -# End Group -# End Target -# End Project diff --git a/progs/demos/Windows/bounce.dsp b/progs/demos/Windows/bounce.dsp deleted file mode 100644 index 0510e77d99..0000000000 --- a/progs/demos/Windows/bounce.dsp +++ /dev/null @@ -1,112 +0,0 @@ -# Microsoft Developer Studio Project File - Name="bounce" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Console Application" 0x0103 - -CFG=bounce - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "bounce.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "bounce.mak" CFG="bounce - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "bounce - Win32 Release" (based on "Win32 (x86) Console Application") -!MESSAGE "bounce - Win32 Debug" (based on "Win32 (x86) Console Application") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "bounce - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /W3 /GX /O2 /I "../../../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /machine:I386 /out:"../bounce.exe" -# Begin Special Build Tool -SOURCE="$(InputPath)" -PostBuild_Desc=Copy DLLs -PostBuild_Cmds=copy ..\..\..\lib\*.dll .. -# End Special Build Tool - -!ELSEIF "$(CFG)" == "bounce - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c -# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../../../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /debug /machine:I386 /out:"../bounce.exe" /pdbtype:sept -# Begin Special Build Tool -SOURCE="$(InputPath)" -PostBuild_Desc=Copy DLLs -PostBuild_Cmds=copy ..\..\..\lib\*.dll .. -# End Special Build Tool - -!ENDIF - -# Begin Target - -# Name "bounce - Win32 Release" -# Name "bounce - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=..\bounce.c -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# End Group -# Begin Group "Resource Files" - -# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" -# End Group -# End Target -# End Project diff --git a/progs/demos/Windows/clearspd.dsp b/progs/demos/Windows/clearspd.dsp deleted file mode 100644 index 440c7ae64e..0000000000 --- a/progs/demos/Windows/clearspd.dsp +++ /dev/null @@ -1,112 +0,0 @@ -# Microsoft Developer Studio Project File - Name="clearspd" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Console Application" 0x0103 - -CFG=clearspd - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "clearspd.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "clearspd.mak" CFG="clearspd - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "clearspd - Win32 Release" (based on "Win32 (x86) Console Application") -!MESSAGE "clearspd - Win32 Debug" (based on "Win32 (x86) Console Application") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "clearspd - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /W3 /GX /O2 /I "../../../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /machine:I386 /out:"../clearspd.exe" -# Begin Special Build Tool -SOURCE="$(InputPath)" -PostBuild_Desc=Copy DLLs -PostBuild_Cmds=copy ..\..\..\lib\*.dll .. -# End Special Build Tool - -!ELSEIF "$(CFG)" == "clearspd - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c -# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../../../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /debug /machine:I386 /out:"../clearspd.exe" /pdbtype:sept -# Begin Special Build Tool -SOURCE="$(InputPath)" -PostBuild_Desc=Copy DLLs -PostBuild_Cmds=copy ..\..\..\lib\*.dll .. -# End Special Build Tool - -!ENDIF - -# Begin Target - -# Name "clearspd - Win32 Release" -# Name "clearspd - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=..\clearspd.c -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# End Group -# Begin Group "Resource Files" - -# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" -# End Group -# End Target -# End Project diff --git a/progs/demos/Windows/cubemap.dsp b/progs/demos/Windows/cubemap.dsp deleted file mode 100644 index 220a3a0df6..0000000000 --- a/progs/demos/Windows/cubemap.dsp +++ /dev/null @@ -1,112 +0,0 @@ -# Microsoft Developer Studio Project File - Name="cubemap" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Console Application" 0x0103 - -CFG=cubemap - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "cubemap.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "cubemap.mak" CFG="cubemap - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "cubemap - Win32 Release" (based on "Win32 (x86) Console Application") -!MESSAGE "cubemap - Win32 Debug" (based on "Win32 (x86) Console Application") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "cubemap - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /W3 /GX /O2 /I "../../../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /machine:I386 /out:"../cubemap.exe" -# Begin Special Build Tool -SOURCE="$(InputPath)" -PostBuild_Desc=Copy DLLs -PostBuild_Cmds=copy ..\..\..\lib\*.dll .. -# End Special Build Tool - -!ELSEIF "$(CFG)" == "cubemap - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c -# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../../../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /debug /machine:I386 /out:"../cubemap.exe" /pdbtype:sept -# Begin Special Build Tool -SOURCE="$(InputPath)" -PostBuild_Desc=Copy DLLs -PostBuild_Cmds=copy ..\..\..\lib\*.dll .. -# End Special Build Tool - -!ENDIF - -# Begin Target - -# Name "cubemap - Win32 Release" -# Name "cubemap - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=..\cubemap.c -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# End Group -# Begin Group "Resource Files" - -# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" -# End Group -# End Target -# End Project diff --git a/progs/demos/Windows/demos.dsw b/progs/demos/Windows/demos.dsw deleted file mode 100644 index 2d6f629e07..0000000000 --- a/progs/demos/Windows/demos.dsw +++ /dev/null @@ -1,782 +0,0 @@ -Microsoft Developer Studio Workspace File, Format Version 6.00 -# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! - -############################################################################### - -Project: "all"=".\all.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ - Begin Project Dependency - Project_Dep_Name bounce - End Project Dependency - Begin Project Dependency - Project_Dep_Name clearspd - End Project Dependency - Begin Project Dependency - Project_Dep_Name cubemap - End Project Dependency - Begin Project Dependency - Project_Dep_Name drawpix - End Project Dependency - Begin Project Dependency - Project_Dep_Name fire - End Project Dependency - Begin Project Dependency - Project_Dep_Name gears - End Project Dependency - Begin Project Dependency - Project_Dep_Name geartrain - End Project Dependency - Begin Project Dependency - Project_Dep_Name glinfo - End Project Dependency - Begin Project Dependency - Project_Dep_Name gloss - End Project Dependency - Begin Project Dependency - Project_Dep_Name gltestperf - End Project Dependency - Begin Project Dependency - Project_Dep_Name glutfx - End Project Dependency - Begin Project Dependency - Project_Dep_Name ipers - End Project Dependency - Begin Project Dependency - Project_Dep_Name isosurf - End Project Dependency - Begin Project Dependency - Project_Dep_Name lodbias - End Project Dependency - Begin Project Dependency - Project_Dep_Name morph3d - End Project Dependency - Begin Project Dependency - Project_Dep_Name multiarb - End Project Dependency - Begin Project Dependency - Project_Dep_Name occlude - End Project Dependency - Begin Project Dependency - Project_Dep_Name osdemo - End Project Dependency - Begin Project Dependency - Project_Dep_Name paltex - End Project Dependency - Begin Project Dependency - Project_Dep_Name pixeltex - End Project Dependency - Begin Project Dependency - Project_Dep_Name pointblast - End Project Dependency - Begin Project Dependency - Project_Dep_Name rain - End Project Dependency - Begin Project Dependency - Project_Dep_Name ray - End Project Dependency - Begin Project Dependency - Project_Dep_Name readpix - End Project Dependency - Begin Project Dependency - Project_Dep_Name reflect - End Project Dependency - Begin Project Dependency - Project_Dep_Name renormal - End Project Dependency - Begin Project Dependency - Project_Dep_Name shadowtex - End Project Dependency - Begin Project Dependency - Project_Dep_Name spectex - End Project Dependency - Begin Project Dependency - Project_Dep_Name stex3d - End Project Dependency - Begin Project Dependency - Project_Dep_Name teapot - End Project Dependency - Begin Project Dependency - Project_Dep_Name terrain - End Project Dependency - Begin Project Dependency - Project_Dep_Name tessdemo - End Project Dependency - Begin Project Dependency - Project_Dep_Name texcyl - End Project Dependency - Begin Project Dependency - Project_Dep_Name texdown - End Project Dependency - Begin Project Dependency - Project_Dep_Name texenv - End Project Dependency - Begin Project Dependency - Project_Dep_Name texobj - End Project Dependency - Begin Project Dependency - Project_Dep_Name trispd - End Project Dependency - Begin Project Dependency - Project_Dep_Name tunnel - End Project Dependency - Begin Project Dependency - Project_Dep_Name tunnel2 - End Project Dependency - Begin Project Dependency - Project_Dep_Name winpos - End Project Dependency - Begin Project Dependency - Project_Dep_Name spriteblast - End Project Dependency - Begin Project Dependency - Project_Dep_Name glut - End Project Dependency -}}} - -############################################################################### - -Project: "bounce"=".\bounce.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ - Begin Project Dependency - Project_Dep_Name glut - End Project Dependency -}}} - -############################################################################### - -Project: "clearspd"=".\clearspd.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ - Begin Project Dependency - Project_Dep_Name glut - End Project Dependency -}}} - -############################################################################### - -Project: "cubemap"=".\cubemap.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ - Begin Project Dependency - Project_Dep_Name glut - End Project Dependency -}}} - -############################################################################### - -Project: "drawpix"=".\drawpix.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ - Begin Project Dependency - Project_Dep_Name glut - End Project Dependency -}}} - -############################################################################### - -Project: "fire"=".\fire.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ - Begin Project Dependency - Project_Dep_Name glut - End Project Dependency -}}} - -############################################################################### - -Project: "gears"=".\gears.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ - Begin Project Dependency - Project_Dep_Name glut - End Project Dependency -}}} - -############################################################################### - -Project: "geartrain"=".\geartrain.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ - Begin Project Dependency - Project_Dep_Name glut - End Project Dependency -}}} - -############################################################################### - -Project: "glinfo"=".\glinfo.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ - Begin Project Dependency - Project_Dep_Name glut - End Project Dependency -}}} - -############################################################################### - -Project: "gloss"=".\gloss.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ - Begin Project Dependency - Project_Dep_Name glut - End Project Dependency -}}} - -############################################################################### - -Project: "gltestperf"=".\gltestperf.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ - Begin Project Dependency - Project_Dep_Name glut - End Project Dependency -}}} - -############################################################################### - -Project: "glut"="..\..\..\src\glut\glx\glut.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Project: "glutfx"=".\glutfx.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ - Begin Project Dependency - Project_Dep_Name glut - End Project Dependency -}}} - -############################################################################### - -Project: "ipers"=".\ipers.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ - Begin Project Dependency - Project_Dep_Name glut - End Project Dependency -}}} - -############################################################################### - -Project: "isosurf"=".\isosurf.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ - Begin Project Dependency - Project_Dep_Name glut - End Project Dependency -}}} - -############################################################################### - -Project: "lodbias"=".\loadbias.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ - Begin Project Dependency - Project_Dep_Name glut - End Project Dependency -}}} - -############################################################################### - -Project: "morph3d"=".\morph3d.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ - Begin Project Dependency - Project_Dep_Name glut - End Project Dependency -}}} - -############################################################################### - -Project: "multiarb"=".\multiarb.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ - Begin Project Dependency - Project_Dep_Name glut - End Project Dependency -}}} - -############################################################################### - -Project: "occlude"=".\occlude.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ - Begin Project Dependency - Project_Dep_Name glut - End Project Dependency -}}} - -############################################################################### - -Project: "osdemo"=".\osdemo.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ - Begin Project Dependency - Project_Dep_Name glut - End Project Dependency -}}} - -############################################################################### - -Project: "paltex"=".\paltex.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ - Begin Project Dependency - Project_Dep_Name glut - End Project Dependency -}}} - -############################################################################### - -Project: "pixeltex"=".\pixeltex.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ - Begin Project Dependency - Project_Dep_Name glut - End Project Dependency -}}} - -############################################################################### - -Project: "pointblast"=".\pointblast.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ - Begin Project Dependency - Project_Dep_Name glut - End Project Dependency -}}} - -############################################################################### - -Project: "rain"=".\rain.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ - Begin Project Dependency - Project_Dep_Name glut - End Project Dependency -}}} - -############################################################################### - -Project: "ray"=".\ray.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ - Begin Project Dependency - Project_Dep_Name glut - End Project Dependency -}}} - -############################################################################### - -Project: "readpix"=".\readpix.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ - Begin Project Dependency - Project_Dep_Name glut - End Project Dependency -}}} - -############################################################################### - -Project: "reflect"=".\reflect.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ - Begin Project Dependency - Project_Dep_Name glut - End Project Dependency -}}} - -############################################################################### - -Project: "renormal"=".\renormal.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ - Begin Project Dependency - Project_Dep_Name glut - End Project Dependency -}}} - -############################################################################### - -Project: "shadowtex"=".\shadowtex.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ - Begin Project Dependency - Project_Dep_Name glut - End Project Dependency -}}} - -############################################################################### - -Project: "spectex"=".\spectex.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ - Begin Project Dependency - Project_Dep_Name glut - End Project Dependency -}}} - -############################################################################### - -Project: "spriteblast"=".\spriteblast.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ - Begin Project Dependency - Project_Dep_Name glut - End Project Dependency -}}} - -############################################################################### - -Project: "stex3d"=".\stex3d.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ - Begin Project Dependency - Project_Dep_Name glut - End Project Dependency -}}} - -############################################################################### - -Project: "teapot"=".\teapot.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ - Begin Project Dependency - Project_Dep_Name glut - End Project Dependency -}}} - -############################################################################### - -Project: "terrain"=".\terrain.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ - Begin Project Dependency - Project_Dep_Name glut - End Project Dependency -}}} - -############################################################################### - -Project: "tessdemo"=".\tessdemo.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ - Begin Project Dependency - Project_Dep_Name glut - End Project Dependency -}}} - -############################################################################### - -Project: "texcyl"=".\texcyl.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ - Begin Project Dependency - Project_Dep_Name glut - End Project Dependency -}}} - -############################################################################### - -Project: "texdown"=".\texdown.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ - Begin Project Dependency - Project_Dep_Name glut - End Project Dependency -}}} - -############################################################################### - -Project: "texenv"=".\texenv.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ - Begin Project Dependency - Project_Dep_Name glut - End Project Dependency -}}} - -############################################################################### - -Project: "texobj"=".\texobj.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ - Begin Project Dependency - Project_Dep_Name glut - End Project Dependency -}}} - -############################################################################### - -Project: "trispd"=".\trispd.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ - Begin Project Dependency - Project_Dep_Name glut - End Project Dependency -}}} - -############################################################################### - -Project: "tunnel"=".\tunnel.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ - Begin Project Dependency - Project_Dep_Name glut - End Project Dependency -}}} - -############################################################################### - -Project: "tunnel2"=".\tunnel2.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ - Begin Project Dependency - Project_Dep_Name glut - End Project Dependency -}}} - -############################################################################### - -Project: "winpos"=".\winpos.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ - Begin Project Dependency - Project_Dep_Name glut - End Project Dependency -}}} - -############################################################################### - -Global: - -Package=<5> -{{{ -}}} - -Package=<3> -{{{ -}}} - -############################################################################### - diff --git a/progs/demos/Windows/drawpix.dsp b/progs/demos/Windows/drawpix.dsp deleted file mode 100644 index 57003e616b..0000000000 --- a/progs/demos/Windows/drawpix.dsp +++ /dev/null @@ -1,112 +0,0 @@ -# Microsoft Developer Studio Project File - Name="drawpix" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Console Application" 0x0103 - -CFG=drawpix - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "drawpix.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "drawpix.mak" CFG="drawpix - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "drawpix - Win32 Release" (based on "Win32 (x86) Console Application") -!MESSAGE "drawpix - Win32 Debug" (based on "Win32 (x86) Console Application") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "drawpix - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /W3 /GX /O2 /I "../" /I "../../../include" /I "../../util" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /machine:I386 /out:"../drawpix.exe" -# Begin Special Build Tool -SOURCE="$(InputPath)" -PostBuild_Desc=Copy DLLs -PostBuild_Cmds=copy ..\..\..\lib\*.dll .. -# End Special Build Tool - -!ELSEIF "$(CFG)" == "drawpix - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c -# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../../util" /I "../../../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /debug /machine:I386 /out:"../drawpix.exe" /pdbtype:sept -# Begin Special Build Tool -SOURCE="$(InputPath)" -PostBuild_Desc=Copy DLLs -PostBuild_Cmds=copy ..\..\..\lib\*.dll .. -# End Special Build Tool - -!ENDIF - -# Begin Target - -# Name "drawpix - Win32 Release" -# Name "drawpix - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=..\drawpix.c -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# End Group -# Begin Group "Resource Files" - -# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" -# End Group -# End Target -# End Project diff --git a/progs/demos/Windows/fire.dsp b/progs/demos/Windows/fire.dsp deleted file mode 100644 index f8a536d334..0000000000 --- a/progs/demos/Windows/fire.dsp +++ /dev/null @@ -1,112 +0,0 @@ -# Microsoft Developer Studio Project File - Name="fire" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Console Application" 0x0103 - -CFG=fire - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "fire.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "fire.mak" CFG="fire - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "fire - Win32 Release" (based on "Win32 (x86) Console Application") -!MESSAGE "fire - Win32 Debug" (based on "Win32 (x86) Console Application") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "fire - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /W3 /GX /O2 /I "../../util" /I "../../../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /machine:I386 /out:"../fire.exe" -# Begin Special Build Tool -SOURCE="$(InputPath)" -PostBuild_Desc=Copy DLLs -PostBuild_Cmds=copy ..\..\..\lib\*.dll .. -# End Special Build Tool - -!ELSEIF "$(CFG)" == "fire - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c -# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../../util" /I "../../../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /debug /machine:I386 /out:"../fire.exe" /pdbtype:sept -# Begin Special Build Tool -SOURCE="$(InputPath)" -PostBuild_Desc=Copy DLLs -PostBuild_Cmds=copy ..\..\..\lib\*.dll .. -# End Special Build Tool - -!ENDIF - -# Begin Target - -# Name "fire - Win32 Release" -# Name "fire - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=..\fire.c -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# End Group -# Begin Group "Resource Files" - -# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" -# End Group -# End Target -# End Project diff --git a/progs/demos/Windows/gears.dsp b/progs/demos/Windows/gears.dsp deleted file mode 100644 index 43a588dc68..0000000000 --- a/progs/demos/Windows/gears.dsp +++ /dev/null @@ -1,112 +0,0 @@ -# Microsoft Developer Studio Project File - Name="gears" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Console Application" 0x0103 - -CFG=gears - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "gears.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "gears.mak" CFG="gears - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "gears - Win32 Release" (based on "Win32 (x86) Console Application") -!MESSAGE "gears - Win32 Debug" (based on "Win32 (x86) Console Application") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "gears - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /W3 /GX /O2 /I "../../../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /machine:I386 /out:"../gears.exe" -# Begin Special Build Tool -SOURCE="$(InputPath)" -PostBuild_Desc=Copy DLLs -PostBuild_Cmds=copy ..\..\..\lib\*.dll .. -# End Special Build Tool - -!ELSEIF "$(CFG)" == "gears - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c -# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../../../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /debug /machine:I386 /out:"../gears.exe" /pdbtype:sept -# Begin Special Build Tool -SOURCE="$(InputPath)" -PostBuild_Desc=Copy DLLs -PostBuild_Cmds=copy ..\..\..\lib\*.dll .. -# End Special Build Tool - -!ENDIF - -# Begin Target - -# Name "gears - Win32 Release" -# Name "gears - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=..\gears.c -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# End Group -# Begin Group "Resource Files" - -# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" -# End Group -# End Target -# End Project diff --git a/progs/demos/Windows/geartrain.dsp b/progs/demos/Windows/geartrain.dsp deleted file mode 100644 index 8dee77de4d..0000000000 --- a/progs/demos/Windows/geartrain.dsp +++ /dev/null @@ -1,112 +0,0 @@ -# Microsoft Developer Studio Project File - Name="geartrain" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Console Application" 0x0103 - -CFG=geartrain - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "geartrain.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "geartrain.mak" CFG="geartrain - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "geartrain - Win32 Release" (based on "Win32 (x86) Console Application") -!MESSAGE "geartrain - Win32 Debug" (based on "Win32 (x86) Console Application") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "geartrain - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /W3 /GX /O2 /I "../../../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /machine:I386 /out:"../geartrain.exe" -# Begin Special Build Tool -SOURCE="$(InputPath)" -PostBuild_Desc=Copy DLLs -PostBuild_Cmds=copy ..\..\..\lib\*.dll .. -# End Special Build Tool - -!ELSEIF "$(CFG)" == "geartrain - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c -# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../../../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /debug /machine:I386 /out:"../geartrain.exe" /pdbtype:sept -# Begin Special Build Tool -SOURCE="$(InputPath)" -PostBuild_Desc=Copy DLLs -PostBuild_Cmds=copy ..\..\..\lib\*.dll .. -# End Special Build Tool - -!ENDIF - -# Begin Target - -# Name "geartrain - Win32 Release" -# Name "geartrain - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=..\geartrain.c -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# End Group -# Begin Group "Resource Files" - -# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" -# End Group -# End Target -# End Project diff --git a/progs/demos/Windows/glinfo.dsp b/progs/demos/Windows/glinfo.dsp deleted file mode 100644 index d9d61eb424..0000000000 --- a/progs/demos/Windows/glinfo.dsp +++ /dev/null @@ -1,112 +0,0 @@ -# Microsoft Developer Studio Project File - Name="glinfo" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Console Application" 0x0103 - -CFG=glinfo - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "glinfo.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "glinfo.mak" CFG="glinfo - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "glinfo - Win32 Release" (based on "Win32 (x86) Console Application") -!MESSAGE "glinfo - Win32 Debug" (based on "Win32 (x86) Console Application") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "glinfo - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /W3 /GX /O2 /I "../../../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /machine:I386 /out:"../glinfo.exe" -# Begin Special Build Tool -SOURCE="$(InputPath)" -PostBuild_Desc=Copy DLLs -PostBuild_Cmds=copy ..\..\..\lib\*.dll .. -# End Special Build Tool - -!ELSEIF "$(CFG)" == "glinfo - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c -# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../../../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /debug /machine:I386 /out:"../glinfo.exe" /pdbtype:sept -# Begin Special Build Tool -SOURCE="$(InputPath)" -PostBuild_Desc=Copy DLLs -PostBuild_Cmds=copy ..\..\..\lib\*.dll .. -# End Special Build Tool - -!ENDIF - -# Begin Target - -# Name "glinfo - Win32 Release" -# Name "glinfo - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=..\glinfo.c -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# End Group -# Begin Group "Resource Files" - -# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" -# End Group -# End Target -# End Project diff --git a/progs/demos/Windows/gloss.dsp b/progs/demos/Windows/gloss.dsp deleted file mode 100644 index 402d291f4d..0000000000 --- a/progs/demos/Windows/gloss.dsp +++ /dev/null @@ -1,112 +0,0 @@ -# Microsoft Developer Studio Project File - Name="gloss" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Console Application" 0x0103 - -CFG=gloss - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "gloss.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "gloss.mak" CFG="gloss - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "gloss - Win32 Release" (based on "Win32 (x86) Console Application") -!MESSAGE "gloss - Win32 Debug" (based on "Win32 (x86) Console Application") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "gloss - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /W3 /GX /O2 /I "../../util" /I "../../../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /machine:I386 /out:"../gloss.exe" -# Begin Special Build Tool -SOURCE="$(InputPath)" -PostBuild_Desc=Copy DLLs -PostBuild_Cmds=copy ..\..\..\lib\*.dll .. -# End Special Build Tool - -!ELSEIF "$(CFG)" == "gloss - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c -# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../../util" /I "../../../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /debug /machine:I386 /out:"../gloss.exe" /pdbtype:sept -# Begin Special Build Tool -SOURCE="$(InputPath)" -PostBuild_Desc=Copy DLLs -PostBuild_Cmds=copy ..\..\..\lib\*.dll .. -# End Special Build Tool - -!ENDIF - -# Begin Target - -# Name "gloss - Win32 Release" -# Name "gloss - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=..\gloss.c -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# End Group -# Begin Group "Resource Files" - -# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" -# End Group -# End Target -# End Project diff --git a/progs/demos/Windows/gltestperf.dsp b/progs/demos/Windows/gltestperf.dsp deleted file mode 100644 index e506620152..0000000000 --- a/progs/demos/Windows/gltestperf.dsp +++ /dev/null @@ -1,112 +0,0 @@ -# Microsoft Developer Studio Project File - Name="gltestperf" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Console Application" 0x0103 - -CFG=gltestperf - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "gltestperf.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "gltestperf.mak" CFG="gltestperf - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "gltestperf - Win32 Release" (based on "Win32 (x86) Console Application") -!MESSAGE "gltestperf - Win32 Debug" (based on "Win32 (x86) Console Application") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "gltestperf - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /W3 /GX /O2 /I "../../../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /machine:I386 /out:"../gltestperf.exe" -# Begin Special Build Tool -SOURCE="$(InputPath)" -PostBuild_Desc=Copy DLLs -PostBuild_Cmds=copy ..\..\..\lib\*.dll .. -# End Special Build Tool - -!ELSEIF "$(CFG)" == "gltestperf - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c -# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../../../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /debug /machine:I386 /out:"../gltestperf.exe" /pdbtype:sept -# Begin Special Build Tool -SOURCE="$(InputPath)" -PostBuild_Desc=Copy DLLs -PostBuild_Cmds=copy ..\..\..\lib\*.dll .. -# End Special Build Tool - -!ENDIF - -# Begin Target - -# Name "gltestperf - Win32 Release" -# Name "gltestperf - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=..\gltestperf.c -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# End Group -# Begin Group "Resource Files" - -# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" -# End Group -# End Target -# End Project diff --git a/progs/demos/Windows/glutfx.dsp b/progs/demos/Windows/glutfx.dsp deleted file mode 100644 index 90eca930d2..0000000000 --- a/progs/demos/Windows/glutfx.dsp +++ /dev/null @@ -1,112 +0,0 @@ -# Microsoft Developer Studio Project File - Name="glutfx" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Console Application" 0x0103 - -CFG=glutfx - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "glutfx.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "glutfx.mak" CFG="glutfx - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "glutfx - Win32 Release" (based on "Win32 (x86) Console Application") -!MESSAGE "glutfx - Win32 Debug" (based on "Win32 (x86) Console Application") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "glutfx - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /W3 /GX /O2 /I "../../../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /machine:I386 /out:"../glutfx.exe" -# Begin Special Build Tool -SOURCE="$(InputPath)" -PostBuild_Desc=Copy DLLs -PostBuild_Cmds=copy ..\..\..\lib\*.dll .. -# End Special Build Tool - -!ELSEIF "$(CFG)" == "glutfx - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c -# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../../../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /debug /machine:I386 /out:"../glutfx.exe" /pdbtype:sept -# Begin Special Build Tool -SOURCE="$(InputPath)" -PostBuild_Desc=Copy DLLs -PostBuild_Cmds=copy ..\..\..\lib\*.dll .. -# End Special Build Tool - -!ENDIF - -# Begin Target - -# Name "glutfx - Win32 Release" -# Name "glutfx - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=..\glutfx.c -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# End Group -# Begin Group "Resource Files" - -# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" -# End Group -# End Target -# End Project diff --git a/progs/demos/Windows/ipers.dsp b/progs/demos/Windows/ipers.dsp deleted file mode 100644 index 430f1b6258..0000000000 --- a/progs/demos/Windows/ipers.dsp +++ /dev/null @@ -1,112 +0,0 @@ -# Microsoft Developer Studio Project File - Name="ipers" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Console Application" 0x0103 - -CFG=ipers - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "ipers.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "ipers.mak" CFG="ipers - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "ipers - Win32 Release" (based on "Win32 (x86) Console Application") -!MESSAGE "ipers - Win32 Debug" (based on "Win32 (x86) Console Application") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "ipers - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /W3 /GX /O2 /I "../../util" /I "../../../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /machine:I386 /out:"../ipers.exe" -# Begin Special Build Tool -SOURCE="$(InputPath)" -PostBuild_Desc=Copy DLLs -PostBuild_Cmds=copy ..\..\..\lib\*.dll .. -# End Special Build Tool - -!ELSEIF "$(CFG)" == "ipers - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c -# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../../util" /I "../../../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /debug /machine:I386 /out:"../ipers.exe" /pdbtype:sept -# Begin Special Build Tool -SOURCE="$(InputPath)" -PostBuild_Desc=Copy DLLs -PostBuild_Cmds=copy ..\..\..\lib\*.dll .. -# End Special Build Tool - -!ENDIF - -# Begin Target - -# Name "ipers - Win32 Release" -# Name "ipers - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=..\ipers.c -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# End Group -# Begin Group "Resource Files" - -# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" -# End Group -# End Target -# End Project diff --git a/progs/demos/Windows/isosurf.dsp b/progs/demos/Windows/isosurf.dsp deleted file mode 100644 index 1c59d40081..0000000000 --- a/progs/demos/Windows/isosurf.dsp +++ /dev/null @@ -1,112 +0,0 @@ -# Microsoft Developer Studio Project File - Name="isosurf" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Console Application" 0x0103 - -CFG=isosurf - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "isosurf.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "isosurf.mak" CFG="isosurf - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "isosurf - Win32 Release" (based on "Win32 (x86) Console Application") -!MESSAGE "isosurf - Win32 Debug" (based on "Win32 (x86) Console Application") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "isosurf - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /W3 /GX /O2 /I "../../util" /I "../../../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /machine:I386 /out:"../isosurf.exe" -# Begin Special Build Tool -SOURCE="$(InputPath)" -PostBuild_Desc=Copy DLLs -PostBuild_Cmds=copy ..\..\..\lib\*.dll .. -# End Special Build Tool - -!ELSEIF "$(CFG)" == "isosurf - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c -# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../../util" /I "../../../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /debug /machine:I386 /out:"../isosurf.exe" /pdbtype:sept -# Begin Special Build Tool -SOURCE="$(InputPath)" -PostBuild_Desc=Copy DLLs -PostBuild_Cmds=copy ..\..\..\lib\*.dll .. -# End Special Build Tool - -!ENDIF - -# Begin Target - -# Name "isosurf - Win32 Release" -# Name "isosurf - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=..\isosurf.c -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# End Group -# Begin Group "Resource Files" - -# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" -# End Group -# End Target -# End Project diff --git a/progs/demos/Windows/loadbias.dsp b/progs/demos/Windows/loadbias.dsp deleted file mode 100644 index ed51960e49..0000000000 --- a/progs/demos/Windows/loadbias.dsp +++ /dev/null @@ -1,112 +0,0 @@ -# Microsoft Developer Studio Project File - Name="lodbias" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Console Application" 0x0103 - -CFG=lodbias - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "lodbias.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "lodbias.mak" CFG="lodbias - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "lodbias - Win32 Release" (based on "Win32 (x86) Console Application") -!MESSAGE "lodbias - Win32 Debug" (based on "Win32 (x86) Console Application") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "lodbias - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /W3 /GX /O2 /I "../../util" /I "../../../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /machine:I386 /out:"../lodbias.exe" -# Begin Special Build Tool -SOURCE="$(InputPath)" -PostBuild_Desc=Copy DLLs -PostBuild_Cmds=copy ..\..\..\lib\*.dll .. -# End Special Build Tool - -!ELSEIF "$(CFG)" == "lodbias - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c -# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../../util" /I "../../../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /debug /machine:I386 /out:"../lodbias.exe" /pdbtype:sept -# Begin Special Build Tool -SOURCE="$(InputPath)" -PostBuild_Desc=Copy DLLs -PostBuild_Cmds=copy ..\..\..\lib\*.dll .. -# End Special Build Tool - -!ENDIF - -# Begin Target - -# Name "lodbias - Win32 Release" -# Name "lodbias - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=..\lodbias.c -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# End Group -# Begin Group "Resource Files" - -# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" -# End Group -# End Target -# End Project diff --git a/progs/demos/Windows/morph3d.dsp b/progs/demos/Windows/morph3d.dsp deleted file mode 100644 index 247dbf03d7..0000000000 --- a/progs/demos/Windows/morph3d.dsp +++ /dev/null @@ -1,112 +0,0 @@ -# Microsoft Developer Studio Project File - Name="morph3d" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Console Application" 0x0103 - -CFG=morph3d - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "morph3d.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "morph3d.mak" CFG="morph3d - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "morph3d - Win32 Release" (based on "Win32 (x86) Console Application") -!MESSAGE "morph3d - Win32 Debug" (based on "Win32 (x86) Console Application") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "morph3d - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /W3 /GX /O2 /I "../../../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /machine:I386 /out:"../morph3d.exe" -# Begin Special Build Tool -SOURCE="$(InputPath)" -PostBuild_Desc=Copy DLLs -PostBuild_Cmds=copy ..\..\..\lib\*.dll .. -# End Special Build Tool - -!ELSEIF "$(CFG)" == "morph3d - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c -# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../../../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /debug /machine:I386 /out:"../morph3d.exe" /pdbtype:sept -# Begin Special Build Tool -SOURCE="$(InputPath)" -PostBuild_Desc=Copy DLLs -PostBuild_Cmds=copy ..\..\..\lib\*.dll .. -# End Special Build Tool - -!ENDIF - -# Begin Target - -# Name "morph3d - Win32 Release" -# Name "morph3d - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=..\morph3d.c -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# End Group -# Begin Group "Resource Files" - -# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" -# End Group -# End Target -# End Project diff --git a/progs/demos/Windows/multiarb.dsp b/progs/demos/Windows/multiarb.dsp deleted file mode 100644 index 57c32deb29..0000000000 --- a/progs/demos/Windows/multiarb.dsp +++ /dev/null @@ -1,112 +0,0 @@ -# Microsoft Developer Studio Project File - Name="multiarb" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Console Application" 0x0103 - -CFG=multiarb - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "multiarb.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "multiarb.mak" CFG="multiarb - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "multiarb - Win32 Release" (based on "Win32 (x86) Console Application") -!MESSAGE "multiarb - Win32 Debug" (based on "Win32 (x86) Console Application") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "multiarb - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /W3 /GX /O2 /I "../../util" /I "../../../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /machine:I386 /out:"../multiarb.exe" -# Begin Special Build Tool -SOURCE="$(InputPath)" -PostBuild_Desc=Copy DLLs -PostBuild_Cmds=copy ..\..\..\lib\*.dll .. -# End Special Build Tool - -!ELSEIF "$(CFG)" == "multiarb - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c -# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../../util" /I "../../../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /debug /machine:I386 /out:"../multiarb.exe" /pdbtype:sept -# Begin Special Build Tool -SOURCE="$(InputPath)" -PostBuild_Desc=Copy DLLs -PostBuild_Cmds=copy ..\..\..\lib\*.dll .. -# End Special Build Tool - -!ENDIF - -# Begin Target - -# Name "multiarb - Win32 Release" -# Name "multiarb - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=..\multiarb.c -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# End Group -# Begin Group "Resource Files" - -# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" -# End Group -# End Target -# End Project diff --git a/progs/demos/Windows/occlude.dsp b/progs/demos/Windows/occlude.dsp deleted file mode 100644 index ca4afa579e..0000000000 --- a/progs/demos/Windows/occlude.dsp +++ /dev/null @@ -1,112 +0,0 @@ -# Microsoft Developer Studio Project File - Name="occlude" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Console Application" 0x0103 - -CFG=occlude - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "occlude.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "occlude.mak" CFG="occlude - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "occlude - Win32 Release" (based on "Win32 (x86) Console Application") -!MESSAGE "occlude - Win32 Debug" (based on "Win32 (x86) Console Application") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "occlude - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /W3 /GX /O2 /I "../../../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /machine:I386 /out:"../occlude.exe" -# Begin Special Build Tool -SOURCE="$(InputPath)" -PostBuild_Desc=Copy DLLs -PostBuild_Cmds=copy ..\..\..\lib\*.dll .. -# End Special Build Tool - -!ELSEIF "$(CFG)" == "occlude - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c -# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../../../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /debug /machine:I386 /out:"../occlude.exe" /pdbtype:sept -# Begin Special Build Tool -SOURCE="$(InputPath)" -PostBuild_Desc=Copy DLLs -PostBuild_Cmds=copy ..\..\..\lib\*.dll .. -# End Special Build Tool - -!ENDIF - -# Begin Target - -# Name "occlude - Win32 Release" -# Name "occlude - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=..\occlude.c -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# End Group -# Begin Group "Resource Files" - -# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" -# End Group -# End Target -# End Project diff --git a/progs/demos/Windows/osdemo.dsp b/progs/demos/Windows/osdemo.dsp deleted file mode 100644 index ccaa6d2b42..0000000000 --- a/progs/demos/Windows/osdemo.dsp +++ /dev/null @@ -1,112 +0,0 @@ -# Microsoft Developer Studio Project File - Name="osdemo" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Console Application" 0x0103 - -CFG=osdemo - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "osdemo.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "osdemo.mak" CFG="osdemo - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "osdemo - Win32 Release" (based on "Win32 (x86) Console Application") -!MESSAGE "osdemo - Win32 Debug" (based on "Win32 (x86) Console Application") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "osdemo - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /W3 /GX /O2 /I "../../../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB ../../../lib/OSMESA32.LIB /nologo /subsystem:console /machine:I386 /out:"../osdemo.exe" -# Begin Special Build Tool -SOURCE="$(InputPath)" -PostBuild_Desc=Copy DLLs -PostBuild_Cmds=copy ..\..\..\lib\*.dll .. -# End Special Build Tool - -!ELSEIF "$(CFG)" == "osdemo - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c -# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../../../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB ../../../lib/OSMESA32.LIB /nologo /subsystem:console /debug /machine:I386 /out:"../osdemo.exe" /pdbtype:sept -# Begin Special Build Tool -SOURCE="$(InputPath)" -PostBuild_Desc=Copy DLLs -PostBuild_Cmds=copy ..\..\..\lib\*.dll .. -# End Special Build Tool - -!ENDIF - -# Begin Target - -# Name "osdemo - Win32 Release" -# Name "osdemo - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=..\osdemo.c -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# End Group -# Begin Group "Resource Files" - -# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" -# End Group -# End Target -# End Project diff --git a/progs/demos/Windows/paltex.dsp b/progs/demos/Windows/paltex.dsp deleted file mode 100644 index efc6384211..0000000000 --- a/progs/demos/Windows/paltex.dsp +++ /dev/null @@ -1,112 +0,0 @@ -# Microsoft Developer Studio Project File - Name="paltex" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Console Application" 0x0103 - -CFG=paltex - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "paltex.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "paltex.mak" CFG="paltex - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "paltex - Win32 Release" (based on "Win32 (x86) Console Application") -!MESSAGE "paltex - Win32 Debug" (based on "Win32 (x86) Console Application") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "paltex - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /W3 /GX /O2 /I "../../../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /machine:I386 /out:"../paltex.exe" -# Begin Special Build Tool -SOURCE="$(InputPath)" -PostBuild_Desc=Copy DLLs -PostBuild_Cmds=copy ..\..\..\lib\*.dll .. -# End Special Build Tool - -!ELSEIF "$(CFG)" == "paltex - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c -# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../../../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /debug /machine:I386 /out:"../paltex.exe" /pdbtype:sept -# Begin Special Build Tool -SOURCE="$(InputPath)" -PostBuild_Desc=Copy DLLs -PostBuild_Cmds=copy ..\..\..\lib\*.dll .. -# End Special Build Tool - -!ENDIF - -# Begin Target - -# Name "paltex - Win32 Release" -# Name "paltex - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=..\paltex.c -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# End Group -# Begin Group "Resource Files" - -# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" -# End Group -# End Target -# End Project diff --git a/progs/demos/Windows/pixeltex.dsp b/progs/demos/Windows/pixeltex.dsp deleted file mode 100644 index d09f9f312c..0000000000 --- a/progs/demos/Windows/pixeltex.dsp +++ /dev/null @@ -1,112 +0,0 @@ -# Microsoft Developer Studio Project File - Name="pixeltex" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Console Application" 0x0103 - -CFG=pixeltex - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "pixeltex.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "pixeltex.mak" CFG="pixeltex - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "pixeltex - Win32 Release" (based on "Win32 (x86) Console Application") -!MESSAGE "pixeltex - Win32 Debug" (based on "Win32 (x86) Console Application") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "pixeltex - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /W3 /GX /O2 /I "../../util" /I "../../../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /machine:I386 /out:"../pixeltex.exe" -# Begin Special Build Tool -SOURCE="$(InputPath)" -PostBuild_Desc=Copy DLLs -PostBuild_Cmds=copy ..\..\..\lib\*.dll .. -# End Special Build Tool - -!ELSEIF "$(CFG)" == "pixeltex - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c -# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../../util" /I "../../../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /debug /machine:I386 /out:"../pixeltex.exe" /pdbtype:sept -# Begin Special Build Tool -SOURCE="$(InputPath)" -PostBuild_Desc=Copy DLLs -PostBuild_Cmds=copy ..\..\..\lib\*.dll .. -# End Special Build Tool - -!ENDIF - -# Begin Target - -# Name "pixeltex - Win32 Release" -# Name "pixeltex - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=..\pixeltex.c -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# End Group -# Begin Group "Resource Files" - -# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" -# End Group -# End Target -# End Project diff --git a/progs/demos/Windows/pointblast.dsp b/progs/demos/Windows/pointblast.dsp deleted file mode 100644 index 7be695839f..0000000000 --- a/progs/demos/Windows/pointblast.dsp +++ /dev/null @@ -1,112 +0,0 @@ -# Microsoft Developer Studio Project File - Name="pointblast" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Console Application" 0x0103 - -CFG=pointblast - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "pointblast.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "pointblast.mak" CFG="pointblast - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "pointblast - Win32 Release" (based on "Win32 (x86) Console Application") -!MESSAGE "pointblast - Win32 Debug" (based on "Win32 (x86) Console Application") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "pointblast - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /W3 /GX /O2 /I "../../../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /machine:I386 /out:"../pointblast.exe" -# Begin Special Build Tool -SOURCE="$(InputPath)" -PostBuild_Desc=Copy DLLs -PostBuild_Cmds=copy ..\..\..\lib\*.dll .. -# End Special Build Tool - -!ELSEIF "$(CFG)" == "pointblast - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c -# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../../../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /debug /machine:I386 /out:"../pointblast.exe" /pdbtype:sept -# Begin Special Build Tool -SOURCE="$(InputPath)" -PostBuild_Desc=Copy DLLs -PostBuild_Cmds=copy ..\..\..\lib\*.dll .. -# End Special Build Tool - -!ENDIF - -# Begin Target - -# Name "pointblast - Win32 Release" -# Name "pointblast - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=..\pointblast.c -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# End Group -# Begin Group "Resource Files" - -# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" -# End Group -# End Target -# End Project diff --git a/progs/demos/Windows/rain.dsp b/progs/demos/Windows/rain.dsp deleted file mode 100644 index 7e380e66aa..0000000000 --- a/progs/demos/Windows/rain.dsp +++ /dev/null @@ -1,112 +0,0 @@ -# Microsoft Developer Studio Project File - Name="rain" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Console Application" 0x0103 - -CFG=rain - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "rain.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "rain.mak" CFG="rain - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "rain - Win32 Release" (based on "Win32 (x86) Console Application") -!MESSAGE "rain - Win32 Debug" (based on "Win32 (x86) Console Application") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "rain - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /W3 /GX /O2 /I "../../util" /I "../../../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /machine:I386 /out:"../rain.exe" -# Begin Special Build Tool -SOURCE="$(InputPath)" -PostBuild_Desc=Copy DLLs -PostBuild_Cmds=copy ..\..\..\lib\*.dll .. -# End Special Build Tool - -!ELSEIF "$(CFG)" == "rain - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c -# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../../util" /I "../../../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /debug /machine:I386 /out:"../rain.exe" /pdbtype:sept -# Begin Special Build Tool -SOURCE="$(InputPath)" -PostBuild_Desc=Copy DLLs -PostBuild_Cmds=copy ..\..\..\lib\*.dll .. -# End Special Build Tool - -!ENDIF - -# Begin Target - -# Name "rain - Win32 Release" -# Name "rain - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=..\rain.cxx -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# End Group -# Begin Group "Resource Files" - -# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" -# End Group -# End Target -# End Project diff --git a/progs/demos/Windows/ray.dsp b/progs/demos/Windows/ray.dsp deleted file mode 100644 index dfa26e7755..0000000000 --- a/progs/demos/Windows/ray.dsp +++ /dev/null @@ -1,112 +0,0 @@ -# Microsoft Developer Studio Project File - Name="ray" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Console Application" 0x0103 - -CFG=ray - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "ray.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "ray.mak" CFG="ray - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "ray - Win32 Release" (based on "Win32 (x86) Console Application") -!MESSAGE "ray - Win32 Debug" (based on "Win32 (x86) Console Application") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "ray - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /W3 /GX /O2 /I "../../../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /machine:I386 /out:"../ray.exe" -# Begin Special Build Tool -SOURCE="$(InputPath)" -PostBuild_Desc=Copy DLLs -PostBuild_Cmds=copy ..\..\..\lib\*.dll .. -# End Special Build Tool - -!ELSEIF "$(CFG)" == "ray - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c -# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../../../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /debug /machine:I386 /out:"../ray.exe" /pdbtype:sept -# Begin Special Build Tool -SOURCE="$(InputPath)" -PostBuild_Desc=Copy DLLs -PostBuild_Cmds=copy ..\..\..\lib\*.dll .. -# End Special Build Tool - -!ENDIF - -# Begin Target - -# Name "ray - Win32 Release" -# Name "ray - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=..\ray.c -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# End Group -# Begin Group "Resource Files" - -# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" -# End Group -# End Target -# End Project diff --git a/progs/demos/Windows/readpix.dsp b/progs/demos/Windows/readpix.dsp deleted file mode 100644 index 8097d10625..0000000000 --- a/progs/demos/Windows/readpix.dsp +++ /dev/null @@ -1,112 +0,0 @@ -# Microsoft Developer Studio Project File - Name="readpix" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Console Application" 0x0103 - -CFG=readpix - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "readpix.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "readpix.mak" CFG="readpix - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "readpix - Win32 Release" (based on "Win32 (x86) Console Application") -!MESSAGE "readpix - Win32 Debug" (based on "Win32 (x86) Console Application") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "readpix - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /W3 /GX /O2 /I "../../util" /I "../../../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /machine:I386 /out:"../readpix.exe" -# Begin Special Build Tool -SOURCE="$(InputPath)" -PostBuild_Desc=Copy DLLs -PostBuild_Cmds=copy ..\..\..\lib\*.dll .. -# End Special Build Tool - -!ELSEIF "$(CFG)" == "readpix - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c -# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../../util" /I "../../../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /debug /machine:I386 /out:"../readpix.exe" /pdbtype:sept -# Begin Special Build Tool -SOURCE="$(InputPath)" -PostBuild_Desc=Copy DLLs -PostBuild_Cmds=copy ..\..\..\lib\*.dll .. -# End Special Build Tool - -!ENDIF - -# Begin Target - -# Name "readpix - Win32 Release" -# Name "readpix - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=..\readpix.c -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# End Group -# Begin Group "Resource Files" - -# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" -# End Group -# End Target -# End Project diff --git a/progs/demos/Windows/reflect.dsp b/progs/demos/Windows/reflect.dsp deleted file mode 100644 index fa09700afe..0000000000 --- a/progs/demos/Windows/reflect.dsp +++ /dev/null @@ -1,112 +0,0 @@ -# Microsoft Developer Studio Project File - Name="reflect" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Console Application" 0x0103 - -CFG=reflect - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "reflect.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "reflect.mak" CFG="reflect - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "reflect - Win32 Release" (based on "Win32 (x86) Console Application") -!MESSAGE "reflect - Win32 Debug" (based on "Win32 (x86) Console Application") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "reflect - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /W3 /GX /O2 /I "../../util" /I "../../../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /machine:I386 /out:"../reflect.exe" -# Begin Special Build Tool -SOURCE="$(InputPath)" -PostBuild_Desc=Copy DLLs -PostBuild_Cmds=copy ..\..\..\lib\*.dll .. -# End Special Build Tool - -!ELSEIF "$(CFG)" == "reflect - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c -# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../../util" /I "../../../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /debug /machine:I386 /out:"../reflect.exe" /pdbtype:sept -# Begin Special Build Tool -SOURCE="$(InputPath)" -PostBuild_Desc=Copy DLLs -PostBuild_Cmds=copy ..\..\..\lib\*.dll .. -# End Special Build Tool - -!ENDIF - -# Begin Target - -# Name "reflect - Win32 Release" -# Name "reflect - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=..\reflect.c -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# End Group -# Begin Group "Resource Files" - -# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" -# End Group -# End Target -# End Project diff --git a/progs/demos/Windows/renormal.dsp b/progs/demos/Windows/renormal.dsp deleted file mode 100644 index 4d72e88d8e..0000000000 --- a/progs/demos/Windows/renormal.dsp +++ /dev/null @@ -1,112 +0,0 @@ -# Microsoft Developer Studio Project File - Name="renormal" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Console Application" 0x0103 - -CFG=renormal - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "renormal.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "renormal.mak" CFG="bounce - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "renormal - Win32 Release" (based on "Win32 (x86) Console Application") -!MESSAGE "renormal - Win32 Debug" (based on "Win32 (x86) Console Application") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "renormal - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /W3 /GX /O2 /I "../../../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /machine:I386 /out:"../renormal.exe" -# Begin Special Build Tool -SOURCE="$(InputPath)" -PostBuild_Desc=Copy DLLs -PostBuild_Cmds=copy ..\..\..\lib\*.dll .. -# End Special Build Tool - -!ELSEIF "$(CFG)" == "renormal - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c -# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../../../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /debug /machine:I386 /out:"../renormal.exe" /pdbtype:sept -# Begin Special Build Tool -SOURCE="$(InputPath)" -PostBuild_Desc=Copy DLLs -PostBuild_Cmds=copy ..\..\..\lib\*.dll .. -# End Special Build Tool - -!ENDIF - -# Begin Target - -# Name "renormal - Win32 Release" -# Name "renormal - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=..\renormal.c -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# End Group -# Begin Group "Resource Files" - -# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" -# End Group -# End Target -# End Project diff --git a/progs/demos/Windows/shadowtex.dsp b/progs/demos/Windows/shadowtex.dsp deleted file mode 100644 index 419ec24138..0000000000 --- a/progs/demos/Windows/shadowtex.dsp +++ /dev/null @@ -1,112 +0,0 @@ -# Microsoft Developer Studio Project File - Name="shadowtex" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Console Application" 0x0103 - -CFG=shadowtex - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "shadowtex.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "shadowtex.mak" CFG="bounce - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "shadowtex - Win32 Release" (based on "Win32 (x86) Console Application") -!MESSAGE "shadowtex - Win32 Debug" (based on "Win32 (x86) Console Application") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "shadowtex - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /W3 /GX /O2 /I "../../../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /machine:I386 /out:"../shadowtex.exe" -# Begin Special Build Tool -SOURCE="$(InputPath)" -PostBuild_Desc=Copy DLLs -PostBuild_Cmds=copy ..\..\..\lib\*.dll .. -# End Special Build Tool - -!ELSEIF "$(CFG)" == "shadowtex - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c -# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../../../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /debug /machine:I386 /out:"../shadowtex.exe" /pdbtype:sept -# Begin Special Build Tool -SOURCE="$(InputPath)" -PostBuild_Desc=Copy DLLs -PostBuild_Cmds=copy ..\..\..\lib\*.dll .. -# End Special Build Tool - -!ENDIF - -# Begin Target - -# Name "shadowtex - Win32 Release" -# Name "shadowtex - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=..\shadowtex.c -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# End Group -# Begin Group "Resource Files" - -# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" -# End Group -# End Target -# End Project diff --git a/progs/demos/Windows/spectex.dsp b/progs/demos/Windows/spectex.dsp deleted file mode 100644 index d1960b3d13..0000000000 --- a/progs/demos/Windows/spectex.dsp +++ /dev/null @@ -1,112 +0,0 @@ -# Microsoft Developer Studio Project File - Name="spectex" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Console Application" 0x0103 - -CFG=spectex - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "spectex.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "spectex.mak" CFG="bounce - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "spectex - Win32 Release" (based on "Win32 (x86) Console Application") -!MESSAGE "spectex - Win32 Debug" (based on "Win32 (x86) Console Application") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "spectex - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /W3 /GX /O2 /I "../../../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /machine:I386 /out:"../spectex.exe" -# Begin Special Build Tool -SOURCE="$(InputPath)" -PostBuild_Desc=Copy DLLs -PostBuild_Cmds=copy ..\..\..\lib\*.dll .. -# End Special Build Tool - -!ELSEIF "$(CFG)" == "spectex - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c -# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../../../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /debug /machine:I386 /out:"../spectex.exe" /pdbtype:sept -# Begin Special Build Tool -SOURCE="$(InputPath)" -PostBuild_Desc=Copy DLLs -PostBuild_Cmds=copy ..\..\..\lib\*.dll .. -# End Special Build Tool - -!ENDIF - -# Begin Target - -# Name "spectex - Win32 Release" -# Name "spectex - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=..\spectex.c -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# End Group -# Begin Group "Resource Files" - -# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" -# End Group -# End Target -# End Project diff --git a/progs/demos/Windows/spriteblast.dsp b/progs/demos/Windows/spriteblast.dsp deleted file mode 100644 index 8a02ed50d3..0000000000 --- a/progs/demos/Windows/spriteblast.dsp +++ /dev/null @@ -1,112 +0,0 @@ -# Microsoft Developer Studio Project File - Name="spriteblast" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Console Application" 0x0103 - -CFG=spriteblast - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "spriteblast.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "spriteblast.mak" CFG="bounce - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "spriteblast - Win32 Release" (based on "Win32 (x86) Console Application") -!MESSAGE "spriteblast - Win32 Debug" (based on "Win32 (x86) Console Application") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "spriteblast - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /W3 /GX /O2 /I "../../../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /machine:I386 /out:"../spriteblast.exe" -# Begin Special Build Tool -SOURCE="$(InputPath)" -PostBuild_Desc=Copy DLLs -PostBuild_Cmds=copy ..\..\..\lib\*.dll .. -# End Special Build Tool - -!ELSEIF "$(CFG)" == "spriteblast - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c -# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../../../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /debug /machine:I386 /out:"../spriteblast.exe" /pdbtype:sept -# Begin Special Build Tool -SOURCE="$(InputPath)" -PostBuild_Desc=Copy DLLs -PostBuild_Cmds=copy ..\..\..\lib\*.dll .. -# End Special Build Tool - -!ENDIF - -# Begin Target - -# Name "spriteblast - Win32 Release" -# Name "spriteblast - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=..\spriteblast.c -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# End Group -# Begin Group "Resource Files" - -# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" -# End Group -# End Target -# End Project diff --git a/progs/demos/Windows/stex3d.dsp b/progs/demos/Windows/stex3d.dsp deleted file mode 100644 index 7c112d62ca..0000000000 --- a/progs/demos/Windows/stex3d.dsp +++ /dev/null @@ -1,112 +0,0 @@ -# Microsoft Developer Studio Project File - Name="stex3d" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Console Application" 0x0103 - -CFG=stex3d - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "stex3d.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "stex3d.mak" CFG="bounce - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "stex3d - Win32 Release" (based on "Win32 (x86) Console Application") -!MESSAGE "stex3d - Win32 Debug" (based on "Win32 (x86) Console Application") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "stex3d - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /W3 /GX /O2 /I "../../../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /machine:I386 /out:"../stex3d.exe" -# Begin Special Build Tool -SOURCE="$(InputPath)" -PostBuild_Desc=Copy DLLs -PostBuild_Cmds=copy ..\..\..\lib\*.dll .. -# End Special Build Tool - -!ELSEIF "$(CFG)" == "stex3d - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c -# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../../../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /debug /machine:I386 /out:"../stex3d.exe" /pdbtype:sept -# Begin Special Build Tool -SOURCE="$(InputPath)" -PostBuild_Desc=Copy DLLs -PostBuild_Cmds=copy ..\..\..\lib\*.dll .. -# End Special Build Tool - -!ENDIF - -# Begin Target - -# Name "stex3d - Win32 Release" -# Name "stex3d - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=..\stex3d.c -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# End Group -# Begin Group "Resource Files" - -# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" -# End Group -# End Target -# End Project diff --git a/progs/demos/Windows/teapot.dsp b/progs/demos/Windows/teapot.dsp deleted file mode 100644 index 3260e635a4..0000000000 --- a/progs/demos/Windows/teapot.dsp +++ /dev/null @@ -1,112 +0,0 @@ -# Microsoft Developer Studio Project File - Name="teapot" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Console Application" 0x0103 - -CFG=teapot - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "teapot.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "teapot.mak" CFG="gloss - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "teapot - Win32 Release" (based on "Win32 (x86) Console Application") -!MESSAGE "teapot - Win32 Debug" (based on "Win32 (x86) Console Application") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "teapot - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /W3 /GX /O2 /I "../../util" /I "../../../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /machine:I386 /out:"../teapot.exe" -# Begin Special Build Tool -SOURCE="$(InputPath)" -PostBuild_Desc=Copy DLLs -PostBuild_Cmds=copy ..\..\..\lib\*.dll .. -# End Special Build Tool - -!ELSEIF "$(CFG)" == "teapot - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c -# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../../util" /I "../../../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /debug /machine:I386 /out:"../teapot.exe" /pdbtype:sept -# Begin Special Build Tool -SOURCE="$(InputPath)" -PostBuild_Desc=Copy DLLs -PostBuild_Cmds=copy ..\..\..\lib\*.dll .. -# End Special Build Tool - -!ENDIF - -# Begin Target - -# Name "teapot - Win32 Release" -# Name "teapot - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=..\teapot.c -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# End Group -# Begin Group "Resource Files" - -# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" -# End Group -# End Target -# End Project diff --git a/progs/demos/Windows/terrain.dsp b/progs/demos/Windows/terrain.dsp deleted file mode 100644 index 9fe490db81..0000000000 --- a/progs/demos/Windows/terrain.dsp +++ /dev/null @@ -1,112 +0,0 @@ -# Microsoft Developer Studio Project File - Name="terrain" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Console Application" 0x0103 - -CFG=terrain - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "terrain.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "terrain.mak" CFG="bounce - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "terrain - Win32 Release" (based on "Win32 (x86) Console Application") -!MESSAGE "terrain - Win32 Debug" (based on "Win32 (x86) Console Application") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "terrain - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /W3 /GX /O2 /I "../../../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /machine:I386 /out:"../terrain.exe" -# Begin Special Build Tool -SOURCE="$(InputPath)" -PostBuild_Desc=Copy DLLs -PostBuild_Cmds=copy ..\..\..\lib\*.dll .. -# End Special Build Tool - -!ELSEIF "$(CFG)" == "terrain - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c -# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../../../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /debug /machine:I386 /out:"../terrain.exe" /pdbtype:sept -# Begin Special Build Tool -SOURCE="$(InputPath)" -PostBuild_Desc=Copy DLLs -PostBuild_Cmds=copy ..\..\..\lib\*.dll .. -# End Special Build Tool - -!ENDIF - -# Begin Target - -# Name "terrain - Win32 Release" -# Name "terrain - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=..\terrain.c -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# End Group -# Begin Group "Resource Files" - -# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" -# End Group -# End Target -# End Project diff --git a/progs/demos/Windows/tessdemo.dsp b/progs/demos/Windows/tessdemo.dsp deleted file mode 100644 index 61345c79e6..0000000000 --- a/progs/demos/Windows/tessdemo.dsp +++ /dev/null @@ -1,112 +0,0 @@ -# Microsoft Developer Studio Project File - Name="tessdemo" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Console Application" 0x0103 - -CFG=tessdemo - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "tessdemo.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "tessdemo.mak" CFG="bounce - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "tessdemo - Win32 Release" (based on "Win32 (x86) Console Application") -!MESSAGE "tessdemo - Win32 Debug" (based on "Win32 (x86) Console Application") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "tessdemo - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /W3 /GX /O2 /I "../../../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /machine:I386 /out:"../tessdemo.exe" -# Begin Special Build Tool -SOURCE="$(InputPath)" -PostBuild_Desc=Copy DLLs -PostBuild_Cmds=copy ..\..\..\lib\*.dll .. -# End Special Build Tool - -!ELSEIF "$(CFG)" == "tessdemo - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c -# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../../../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /debug /machine:I386 /out:"../tessdemo.exe" /pdbtype:sept -# Begin Special Build Tool -SOURCE="$(InputPath)" -PostBuild_Desc=Copy DLLs -PostBuild_Cmds=copy ..\..\..\lib\*.dll .. -# End Special Build Tool - -!ENDIF - -# Begin Target - -# Name "tessdemo - Win32 Release" -# Name "tessdemo - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=..\tessdemo.c -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# End Group -# Begin Group "Resource Files" - -# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" -# End Group -# End Target -# End Project diff --git a/progs/demos/Windows/texcyl.dsp b/progs/demos/Windows/texcyl.dsp deleted file mode 100644 index b227e02c29..0000000000 --- a/progs/demos/Windows/texcyl.dsp +++ /dev/null @@ -1,112 +0,0 @@ -# Microsoft Developer Studio Project File - Name="texcyl" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Console Application" 0x0103 - -CFG=texcyl - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "texcyl.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "texcyl.mak" CFG="gloss - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "texcyl - Win32 Release" (based on "Win32 (x86) Console Application") -!MESSAGE "texcyl - Win32 Debug" (based on "Win32 (x86) Console Application") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "texcyl - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /W3 /GX /O2 /I "../../util" /I "../../../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /machine:I386 /out:"../texcyl.exe" -# Begin Special Build Tool -SOURCE="$(InputPath)" -PostBuild_Desc=Copy DLLs -PostBuild_Cmds=copy ..\..\..\lib\*.dll .. -# End Special Build Tool - -!ELSEIF "$(CFG)" == "texcyl - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c -# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../../util" /I "../../../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /debug /machine:I386 /out:"../texcyl.exe" /pdbtype:sept -# Begin Special Build Tool -SOURCE="$(InputPath)" -PostBuild_Desc=Copy DLLs -PostBuild_Cmds=copy ..\..\..\lib\*.dll .. -# End Special Build Tool - -!ENDIF - -# Begin Target - -# Name "texcyl - Win32 Release" -# Name "texcyl - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=..\texcyl.c -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# End Group -# Begin Group "Resource Files" - -# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" -# End Group -# End Target -# End Project diff --git a/progs/demos/Windows/texdown.dsp b/progs/demos/Windows/texdown.dsp deleted file mode 100644 index acea7666af..0000000000 --- a/progs/demos/Windows/texdown.dsp +++ /dev/null @@ -1,112 +0,0 @@ -# Microsoft Developer Studio Project File - Name="texdown" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Console Application" 0x0103 - -CFG=texdown - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "texdown.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "texdown.mak" CFG="bounce - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "texdown - Win32 Release" (based on "Win32 (x86) Console Application") -!MESSAGE "texdown - Win32 Debug" (based on "Win32 (x86) Console Application") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "texdown - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /W3 /GX /O2 /I "../../../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /machine:I386 /out:"../texdown.exe" -# Begin Special Build Tool -SOURCE="$(InputPath)" -PostBuild_Desc=Copy DLLs -PostBuild_Cmds=copy ..\..\..\lib\*.dll .. -# End Special Build Tool - -!ELSEIF "$(CFG)" == "texdown - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c -# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../../../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /debug /machine:I386 /out:"../texdown.exe" /pdbtype:sept -# Begin Special Build Tool -SOURCE="$(InputPath)" -PostBuild_Desc=Copy DLLs -PostBuild_Cmds=copy ..\..\..\lib\*.dll .. -# End Special Build Tool - -!ENDIF - -# Begin Target - -# Name "texdown - Win32 Release" -# Name "texdown - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=..\texdown.c -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# End Group -# Begin Group "Resource Files" - -# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" -# End Group -# End Target -# End Project diff --git a/progs/demos/Windows/texenv.dsp b/progs/demos/Windows/texenv.dsp deleted file mode 100644 index 3eb7eecdb7..0000000000 --- a/progs/demos/Windows/texenv.dsp +++ /dev/null @@ -1,112 +0,0 @@ -# Microsoft Developer Studio Project File - Name="texenv" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Console Application" 0x0103 - -CFG=texenv - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "texenv.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "texenv.mak" CFG="bounce - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "texenv - Win32 Release" (based on "Win32 (x86) Console Application") -!MESSAGE "texenv - Win32 Debug" (based on "Win32 (x86) Console Application") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "texenv - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /W3 /GX /O2 /I "../../../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /machine:I386 /out:"../texenv.exe" -# Begin Special Build Tool -SOURCE="$(InputPath)" -PostBuild_Desc=Copy DLLs -PostBuild_Cmds=copy ..\..\..\lib\*.dll .. -# End Special Build Tool - -!ELSEIF "$(CFG)" == "texenv - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c -# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../../../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /debug /machine:I386 /out:"../texenv.exe" /pdbtype:sept -# Begin Special Build Tool -SOURCE="$(InputPath)" -PostBuild_Desc=Copy DLLs -PostBuild_Cmds=copy ..\..\..\lib\*.dll .. -# End Special Build Tool - -!ENDIF - -# Begin Target - -# Name "texenv - Win32 Release" -# Name "texenv - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=..\texenv.c -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# End Group -# Begin Group "Resource Files" - -# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" -# End Group -# End Target -# End Project diff --git a/progs/demos/Windows/texobj.dsp b/progs/demos/Windows/texobj.dsp deleted file mode 100644 index 5db5f2ee79..0000000000 --- a/progs/demos/Windows/texobj.dsp +++ /dev/null @@ -1,112 +0,0 @@ -# Microsoft Developer Studio Project File - Name="texobj" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Console Application" 0x0103 - -CFG=texobj - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "texobj.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "texobj.mak" CFG="bounce - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "texobj - Win32 Release" (based on "Win32 (x86) Console Application") -!MESSAGE "texobj - Win32 Debug" (based on "Win32 (x86) Console Application") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "texobj - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /W3 /GX /O2 /I "../../../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /machine:I386 /out:"../texobj.exe" -# Begin Special Build Tool -SOURCE="$(InputPath)" -PostBuild_Desc=Copy DLLs -PostBuild_Cmds=copy ..\..\..\lib\*.dll .. -# End Special Build Tool - -!ELSEIF "$(CFG)" == "texobj - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c -# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../../../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /debug /machine:I386 /out:"../texobj.exe" /pdbtype:sept -# Begin Special Build Tool -SOURCE="$(InputPath)" -PostBuild_Desc=Copy DLLs -PostBuild_Cmds=copy ..\..\..\lib\*.dll .. -# End Special Build Tool - -!ENDIF - -# Begin Target - -# Name "texobj - Win32 Release" -# Name "texobj - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=..\texobj.c -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# End Group -# Begin Group "Resource Files" - -# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" -# End Group -# End Target -# End Project diff --git a/progs/demos/Windows/trispd.dsp b/progs/demos/Windows/trispd.dsp deleted file mode 100644 index 7e27cf3d04..0000000000 --- a/progs/demos/Windows/trispd.dsp +++ /dev/null @@ -1,112 +0,0 @@ -# Microsoft Developer Studio Project File - Name="trispd" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Console Application" 0x0103 - -CFG=trispd - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "trispd.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "trispd.mak" CFG="bounce - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "trispd - Win32 Release" (based on "Win32 (x86) Console Application") -!MESSAGE "trispd - Win32 Debug" (based on "Win32 (x86) Console Application") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "trispd - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /W3 /GX /O2 /I "../../../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /machine:I386 /out:"../trispd.exe" -# Begin Special Build Tool -SOURCE="$(InputPath)" -PostBuild_Desc=Copy DLLs -PostBuild_Cmds=copy ..\..\..\lib\*.dll .. -# End Special Build Tool - -!ELSEIF "$(CFG)" == "trispd - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c -# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../../../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /debug /machine:I386 /out:"../trispd.exe" /pdbtype:sept -# Begin Special Build Tool -SOURCE="$(InputPath)" -PostBuild_Desc=Copy DLLs -PostBuild_Cmds=copy ..\..\..\lib\*.dll .. -# End Special Build Tool - -!ENDIF - -# Begin Target - -# Name "trispd - Win32 Release" -# Name "trispd - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=..\trispd.c -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# End Group -# Begin Group "Resource Files" - -# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" -# End Group -# End Target -# End Project diff --git a/progs/demos/Windows/tunnel.dsp b/progs/demos/Windows/tunnel.dsp deleted file mode 100644 index 965f109c33..0000000000 --- a/progs/demos/Windows/tunnel.dsp +++ /dev/null @@ -1,112 +0,0 @@ -# Microsoft Developer Studio Project File - Name="tunnel" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Console Application" 0x0103 - -CFG=tunnel - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "tunnel.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "tunnel.mak" CFG="gloss - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "tunnel - Win32 Release" (based on "Win32 (x86) Console Application") -!MESSAGE "tunnel - Win32 Debug" (based on "Win32 (x86) Console Application") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "tunnel - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /W3 /GX /O2 /I "../../util" /I "../../../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /machine:I386 /out:"../tunnel.exe" -# Begin Special Build Tool -SOURCE="$(InputPath)" -PostBuild_Desc=Copy DLLs -PostBuild_Cmds=copy ..\..\..\lib\*.dll .. -# End Special Build Tool - -!ELSEIF "$(CFG)" == "tunnel - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c -# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../../util" /I "../../../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /debug /machine:I386 /out:"../tunnel.exe" /pdbtype:sept -# Begin Special Build Tool -SOURCE="$(InputPath)" -PostBuild_Desc=Copy DLLs -PostBuild_Cmds=copy ..\..\..\lib\*.dll .. -# End Special Build Tool - -!ENDIF - -# Begin Target - -# Name "tunnel - Win32 Release" -# Name "tunnel - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=..\tunnel.c -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# End Group -# Begin Group "Resource Files" - -# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" -# End Group -# End Target -# End Project diff --git a/progs/demos/Windows/tunnel2.dsp b/progs/demos/Windows/tunnel2.dsp deleted file mode 100644 index 3ae2800a04..0000000000 --- a/progs/demos/Windows/tunnel2.dsp +++ /dev/null @@ -1,112 +0,0 @@ -# Microsoft Developer Studio Project File - Name="tunnel2" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Console Application" 0x0103 - -CFG=tunnel2 - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "tunnel2.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "tunnel2.mak" CFG="gloss - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "tunnel2 - Win32 Release" (based on "Win32 (x86) Console Application") -!MESSAGE "tunnel2 - Win32 Debug" (based on "Win32 (x86) Console Application") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "tunnel2 - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /W3 /GX /O2 /I "../../util" /I "../../../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /machine:I386 /out:"../tunnel2.exe" -# Begin Special Build Tool -SOURCE="$(InputPath)" -PostBuild_Desc=Copy DLLs -PostBuild_Cmds=copy ..\..\..\lib\*.dll .. -# End Special Build Tool - -!ELSEIF "$(CFG)" == "tunnel2 - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c -# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../../util" /I "../../../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /debug /machine:I386 /out:"../tunnel2.exe" /pdbtype:sept -# Begin Special Build Tool -SOURCE="$(InputPath)" -PostBuild_Desc=Copy DLLs -PostBuild_Cmds=copy ..\..\..\lib\*.dll .. -# End Special Build Tool - -!ENDIF - -# Begin Target - -# Name "tunnel2 - Win32 Release" -# Name "tunnel2 - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=..\tunnel2.c -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# End Group -# Begin Group "Resource Files" - -# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" -# End Group -# End Target -# End Project diff --git a/progs/demos/Windows/winpos.dsp b/progs/demos/Windows/winpos.dsp deleted file mode 100644 index b7b569e640..0000000000 --- a/progs/demos/Windows/winpos.dsp +++ /dev/null @@ -1,112 +0,0 @@ -# Microsoft Developer Studio Project File - Name="winpos" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Console Application" 0x0103 - -CFG=winpos - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "winpos.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "winpos.mak" CFG="gloss - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "winpos - Win32 Release" (based on "Win32 (x86) Console Application") -!MESSAGE "winpos - Win32 Debug" (based on "Win32 (x86) Console Application") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "winpos - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /W3 /GX /O2 /I "../../util" /I "../../../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /machine:I386 /out:"../winpos.exe" -# Begin Special Build Tool -SOURCE="$(InputPath)" -PostBuild_Desc=Copy DLLs -PostBuild_Cmds=copy ..\..\..\lib\*.dll .. -# End Special Build Tool - -!ELSEIF "$(CFG)" == "winpos - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c -# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../../util" /I "../../../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /debug /machine:I386 /out:"../winpos.exe" /pdbtype:sept -# Begin Special Build Tool -SOURCE="$(InputPath)" -PostBuild_Desc=Copy DLLs -PostBuild_Cmds=copy ..\..\..\lib\*.dll .. -# End Special Build Tool - -!ENDIF - -# Begin Target - -# Name "winpos - Win32 Release" -# Name "winpos - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=..\winpos.c -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# End Group -# Begin Group "Resource Files" - -# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" -# End Group -# End Target -# End Project diff --git a/progs/demos/extfuncs.h b/progs/demos/extfuncs.h new file mode 100644 index 0000000000..cf6b29d0e3 --- /dev/null +++ b/progs/demos/extfuncs.h @@ -0,0 +1,162 @@ +/** + * Utility for getting OpenGL extension function pointers + * Meant to be #included. + */ + +/* OpenGL 2.0 */ +static PFNGLATTACHSHADERPROC glAttachShader_func = NULL; +static PFNGLBINDATTRIBLOCATIONPROC glBindAttribLocation_func = NULL; +static PFNGLCOMPILESHADERPROC glCompileShader_func = NULL; +static PFNGLCREATEPROGRAMPROC glCreateProgram_func = NULL; +static PFNGLCREATESHADERPROC glCreateShader_func = NULL; +static PFNGLDELETEPROGRAMPROC glDeleteProgram_func = NULL; +static PFNGLDELETESHADERPROC glDeleteShader_func = NULL; +static PFNGLGETACTIVEATTRIBPROC glGetActiveAttrib_func = NULL; +static PFNGLGETACTIVEUNIFORMPROC glGetActiveUniform_func = NULL; +static PFNGLGETATTACHEDSHADERSPROC glGetAttachedShaders_func = NULL; +static PFNGLGETATTRIBLOCATIONPROC glGetAttribLocation_func = NULL; +static PFNGLGETPROGRAMINFOLOGPROC glGetProgramInfoLog_func = NULL; +static PFNGLGETSHADERINFOLOGPROC glGetShaderInfoLog_func = NULL; +static PFNGLGETSHADERIVPROC glGetShaderiv_func = NULL; +static PFNGLGETPROGRAMIVPROC glGetProgramiv_func = NULL; +static PFNGLGETSHADERSOURCEPROC glGetShaderSource_func = NULL; +static PFNGLGETUNIFORMFVPROC glGetUniformfv_func = NULL; +static PFNGLGETUNIFORMLOCATIONPROC glGetUniformLocation_func = NULL; +static PFNGLISPROGRAMPROC glIsProgram_func = NULL; +static PFNGLISSHADERPROC glIsShader_func = NULL; +static PFNGLLINKPROGRAMPROC glLinkProgram_func = NULL; +static PFNGLSHADERSOURCEPROC glShaderSource_func = NULL; +static PFNGLUNIFORM1IPROC glUniform1i_func = NULL; +static PFNGLUNIFORM2IPROC glUniform2i_func = NULL; +static PFNGLUNIFORM3IPROC glUniform3i_func = NULL; +static PFNGLUNIFORM4IPROC glUniform4i_func = NULL; +static PFNGLUNIFORM1FPROC glUniform1f_func = NULL; +static PFNGLUNIFORM2FPROC glUniform2f_func = NULL; +static PFNGLUNIFORM3FPROC glUniform3f_func = NULL; +static PFNGLUNIFORM4FPROC glUniform4f_func = NULL; +static PFNGLUNIFORM1FVPROC glUniform1fv_func = NULL; +static PFNGLUNIFORM2FVPROC glUniform2fv_func = NULL; +static PFNGLUNIFORM3FVPROC glUniform3fv_func = NULL; +static PFNGLUNIFORM4FVPROC glUniform4fv_func = NULL; +static PFNGLUNIFORMMATRIX2FVPROC glUniformMatrix2fv_func = NULL; +static PFNGLUNIFORMMATRIX3FVPROC glUniformMatrix3fv_func = NULL; +static PFNGLUNIFORMMATRIX4FVPROC glUniformMatrix4fv_func = NULL; +static PFNGLUSEPROGRAMPROC glUseProgram_func = NULL; +static PFNGLVERTEXATTRIB1FPROC glVertexAttrib1f_func = NULL; +static PFNGLVERTEXATTRIB2FPROC glVertexAttrib2f_func = NULL; +static PFNGLVERTEXATTRIB3FPROC glVertexAttrib3f_func = NULL; +static PFNGLVERTEXATTRIB4FPROC glVertexAttrib4f_func = NULL; + +/* OpenGL 2.1 */ +static PFNGLUNIFORMMATRIX2X3FVPROC glUniformMatrix2x3fv_func = NULL; +static PFNGLUNIFORMMATRIX3X2FVPROC glUniformMatrix3x2fv_func = NULL; +static PFNGLUNIFORMMATRIX2X4FVPROC glUniformMatrix2x4fv_func = NULL; +static PFNGLUNIFORMMATRIX4X2FVPROC glUniformMatrix4x2fv_func = NULL; +static PFNGLUNIFORMMATRIX3X4FVPROC glUniformMatrix3x4fv_func = NULL; +static PFNGLUNIFORMMATRIX4X3FVPROC glUniformMatrix4x3fv_func = NULL; + +/* OpenGL 1.4 */ +static PFNGLPOINTPARAMETERFVPROC glPointParameterfv_func = NULL; +static PFNGLSECONDARYCOLOR3FVPROC glSecondaryColor3fv_func = NULL; + +/* GL_ARB_vertex/fragment_program */ +static PFNGLBINDPROGRAMARBPROC glBindProgramARB_func = NULL; +static PFNGLDELETEPROGRAMSARBPROC glDeleteProgramsARB_func = NULL; +static PFNGLGENPROGRAMSARBPROC glGenProgramsARB_func = NULL; +static PFNGLGETPROGRAMLOCALPARAMETERDVARBPROC glGetProgramLocalParameterdvARB_func = NULL; +static PFNGLISPROGRAMARBPROC glIsProgramARB_func = NULL; +static PFNGLPROGRAMLOCALPARAMETER4DARBPROC glProgramLocalParameter4dARB_func = NULL; +static PFNGLPROGRAMLOCALPARAMETER4FVARBPROC glProgramLocalParameter4fvARB_func = NULL; +static PFNGLPROGRAMSTRINGARBPROC glProgramStringARB_func = NULL; +static PFNGLVERTEXATTRIB1FARBPROC glVertexAttrib1fARB_func = NULL; + +/* GL_APPLE_vertex_array_object */ +static PFNGLBINDVERTEXARRAYAPPLEPROC glBindVertexArrayAPPLE_func = NULL; +static PFNGLDELETEVERTEXARRAYSAPPLEPROC glDeleteVertexArraysAPPLE_func = NULL; +static PFNGLGENVERTEXARRAYSAPPLEPROC glGenVertexArraysAPPLE_func = NULL; +static PFNGLISVERTEXARRAYAPPLEPROC glIsVertexArrayAPPLE_func = NULL; + +/* GL_EXT_stencil_two_side */ +static PFNGLACTIVESTENCILFACEEXTPROC glActiveStencilFaceEXT_func = NULL; + + +static void +GetExtensionFuncs(void) +{ + /* OpenGL 2.0 */ + glAttachShader_func = (PFNGLATTACHSHADERPROC) glutGetProcAddress("glAttachShader"); + glBindAttribLocation_func = (PFNGLBINDATTRIBLOCATIONPROC) glutGetProcAddress("glBindAttribLocation"); + glCompileShader_func = (PFNGLCOMPILESHADERPROC) glutGetProcAddress("glCompileShader"); + glCreateProgram_func = (PFNGLCREATEPROGRAMPROC) glutGetProcAddress("glCreateProgram"); + glCreateShader_func = (PFNGLCREATESHADERPROC) glutGetProcAddress("glCreateShader"); + glDeleteProgram_func = (PFNGLDELETEPROGRAMPROC) glutGetProcAddress("glDeleteProgram"); + glDeleteShader_func = (PFNGLDELETESHADERPROC) glutGetProcAddress("glDeleteShader"); + glGetActiveAttrib_func = (PFNGLGETACTIVEATTRIBPROC) glutGetProcAddress("glGetActiveAttrib"); + glGetActiveUniform_func = (PFNGLGETACTIVEUNIFORMPROC) glutGetProcAddress("glGetActiveUniform"); + glGetAttachedShaders_func = (PFNGLGETATTACHEDSHADERSPROC) glutGetProcAddress("glGetAttachedShaders"); + glGetAttribLocation_func = (PFNGLGETATTRIBLOCATIONPROC) glutGetProcAddress("glGetAttribLocation"); + glGetProgramInfoLog_func = (PFNGLGETPROGRAMINFOLOGPROC) glutGetProcAddress("glGetProgramInfoLog"); + glGetShaderInfoLog_func = (PFNGLGETSHADERINFOLOGPROC) glutGetProcAddress("glGetShaderInfoLog"); + glGetProgramiv_func = (PFNGLGETPROGRAMIVPROC) glutGetProcAddress("glGetProgramiv"); + glGetShaderiv_func = (PFNGLGETSHADERIVPROC) glutGetProcAddress("glGetShaderiv"); + glGetShaderSource_func = (PFNGLGETSHADERSOURCEPROC) glutGetProcAddress("glGetShaderSource"); + glGetUniformLocation_func = (PFNGLGETUNIFORMLOCATIONPROC) glutGetProcAddress("glGetUniformLocation"); + glGetUniformfv_func = (PFNGLGETUNIFORMFVPROC) glutGetProcAddress("glGetUniformfv"); + glIsProgram_func = (PFNGLISPROGRAMPROC) glutGetProcAddress("glIsProgram"); + glIsShader_func = (PFNGLISSHADERPROC) glutGetProcAddress("glIsShader"); + glLinkProgram_func = (PFNGLLINKPROGRAMPROC) glutGetProcAddress("glLinkProgram"); + glShaderSource_func = (PFNGLSHADERSOURCEPROC) glutGetProcAddress("glShaderSource"); + glUniform1i_func = (PFNGLUNIFORM1IPROC) glutGetProcAddress("glUniform1i"); + glUniform2i_func = (PFNGLUNIFORM2IPROC) glutGetProcAddress("glUniform2i"); + glUniform3i_func = (PFNGLUNIFORM3IPROC) glutGetProcAddress("glUniform3i"); + glUniform4i_func = (PFNGLUNIFORM4IPROC) glutGetProcAddress("glUniform3i"); + glUniform1f_func = (PFNGLUNIFORM1FPROC) glutGetProcAddress("glUniform1f"); + glUniform2f_func = (PFNGLUNIFORM2FPROC) glutGetProcAddress("glUniform2f"); + glUniform3f_func = (PFNGLUNIFORM3FPROC) glutGetProcAddress("glUniform3f"); + glUniform4f_func = (PFNGLUNIFORM4FPROC) glutGetProcAddress("glUniform4f"); + glUniform1fv_func = (PFNGLUNIFORM1FVPROC) glutGetProcAddress("glUniform1fv"); + glUniform2fv_func = (PFNGLUNIFORM2FVPROC) glutGetProcAddress("glUniform2fv"); + glUniform3fv_func = (PFNGLUNIFORM3FVPROC) glutGetProcAddress("glUniform3fv"); + glUniform4fv_func = (PFNGLUNIFORM3FVPROC) glutGetProcAddress("glUniform4fv"); + glUniformMatrix2fv_func = (PFNGLUNIFORMMATRIX2FVPROC) glutGetProcAddress("glUniformMatrix2fv"); + glUniformMatrix3fv_func = (PFNGLUNIFORMMATRIX3FVPROC) glutGetProcAddress("glUniformMatrix3fv"); + glUniformMatrix4fv_func = (PFNGLUNIFORMMATRIX4FVPROC) glutGetProcAddress("glUniformMatrix4fv"); + glUseProgram_func = (PFNGLUSEPROGRAMPROC) glutGetProcAddress("glUseProgram"); + glVertexAttrib1f_func = (PFNGLVERTEXATTRIB1FPROC) glutGetProcAddress("glVertexAttrib1f"); + glVertexAttrib2f_func = (PFNGLVERTEXATTRIB2FPROC) glutGetProcAddress("glVertexAttrib2f"); + glVertexAttrib3f_func = (PFNGLVERTEXATTRIB3FPROC) glutGetProcAddress("glVertexAttrib3f"); + glVertexAttrib4f_func = (PFNGLVERTEXATTRIB4FPROC) glutGetProcAddress("glVertexAttrib4f"); + + /* OpenGL 2.1 */ + glUniformMatrix2x3fv_func = (PFNGLUNIFORMMATRIX2X3FVPROC) glutGetProcAddress("glUniformMatrix2x3fv"); + glUniformMatrix3x2fv_func = (PFNGLUNIFORMMATRIX3X2FVPROC) glutGetProcAddress("glUniformMatrix3x2fv"); + glUniformMatrix2x4fv_func = (PFNGLUNIFORMMATRIX2X4FVPROC) glutGetProcAddress("glUniformMatrix2x4fv"); + glUniformMatrix4x2fv_func = (PFNGLUNIFORMMATRIX4X2FVPROC) glutGetProcAddress("glUniformMatrix4x2fv"); + glUniformMatrix3x4fv_func = (PFNGLUNIFORMMATRIX3X4FVPROC) glutGetProcAddress("glUniformMatrix3x4fv"); + glUniformMatrix4x3fv_func = (PFNGLUNIFORMMATRIX4X3FVPROC) glutGetProcAddress("glUniformMatrix4x3fv"); + + /* OpenGL 1.4 */ + glPointParameterfv_func = (PFNGLPOINTPARAMETERFVPROC) glutGetProcAddress("glPointParameterfv"); + glSecondaryColor3fv_func = (PFNGLSECONDARYCOLOR3FVPROC) glutGetProcAddress("glSecondaryColor3fv"); + + /* GL_ARB_vertex/fragment_program */ + glBindProgramARB_func = (PFNGLBINDPROGRAMARBPROC) glutGetProcAddress("glBindProgramARB"); + glDeleteProgramsARB_func = (PFNGLDELETEPROGRAMSARBPROC) glutGetProcAddress("glDeleteProgramsARB"); + glGenProgramsARB_func = (PFNGLGENPROGRAMSARBPROC) glutGetProcAddress("glGenProgramsARB"); + glGetProgramLocalParameterdvARB_func = (PFNGLGETPROGRAMLOCALPARAMETERDVARBPROC) glutGetProcAddress("glGetProgramLocalParameterdvARB"); + glIsProgramARB_func = (PFNGLISPROGRAMARBPROC) glutGetProcAddress("glIsProgramARB"); + glProgramLocalParameter4dARB_func = (PFNGLPROGRAMLOCALPARAMETER4DARBPROC) glutGetProcAddress("glProgramLocalParameter4dARB"); + glProgramLocalParameter4fvARB_func = (PFNGLPROGRAMLOCALPARAMETER4FVARBPROC) glutGetProcAddress("glProgramLocalParameter4fvARB"); + glProgramStringARB_func = (PFNGLPROGRAMSTRINGARBPROC) glutGetProcAddress("glProgramStringARB"); + glVertexAttrib1fARB_func = (PFNGLVERTEXATTRIB1FARBPROC) glutGetProcAddress("glVertexAttrib1fARB"); + + /* GL_APPLE_vertex_array_object */ + glBindVertexArrayAPPLE_func = (PFNGLBINDVERTEXARRAYAPPLEPROC) glutGetProcAddress("glBindVertexArrayAPPLE"); + glDeleteVertexArraysAPPLE_func = (PFNGLDELETEVERTEXARRAYSAPPLEPROC) glutGetProcAddress("glDeleteVertexArraysAPPLE"); + glGenVertexArraysAPPLE_func = (PFNGLGENVERTEXARRAYSAPPLEPROC) glutGetProcAddress("glGenVertexArraysAPPLE"); + glIsVertexArrayAPPLE_func = (PFNGLISVERTEXARRAYAPPLEPROC) glutGetProcAddress("glIsVertexArrayAPPLE"); + + /* GL_EXT_stencil_two_side */ + glActiveStencilFaceEXT_func = (PFNGLACTIVESTENCILFACEEXTPROC) glutGetProcAddress("glActiveStencilFaceEXT"); +} + diff --git a/progs/demos/readtex.c b/progs/demos/readtex.c new file mode 100644 index 0000000000..37d5fcd0d3 --- /dev/null +++ b/progs/demos/readtex.c @@ -0,0 +1,454 @@ +/* readtex.c */ + +/* + * Read an SGI .rgb image file and generate a mipmap texture set. + * Much of this code was borrowed from SGI's tk OpenGL toolkit. + */ + + + +#include +#include +#include +#include +#include +#include "readtex.h" + + +#ifndef SEEK_SET +# define SEEK_SET 0 +#endif + + +/* +** RGB Image Structure +*/ + +typedef struct _TK_RGBImageRec { + GLint sizeX, sizeY; + GLint components; + unsigned char *data; +} TK_RGBImageRec; + + + +/******************************************************************************/ + +typedef struct _rawImageRec { + unsigned short imagic; + unsigned short type; + unsigned short dim; + unsigned short sizeX, sizeY, sizeZ; + unsigned long min, max; + unsigned long wasteBytes; + char name[80]; + unsigned long colorMap; + FILE *file; + unsigned char *tmp, *tmpR, *tmpG, *tmpB, *tmpA; + unsigned long rleEnd; + GLuint *rowStart; + GLint *rowSize; +} rawImageRec; + +/******************************************************************************/ + +static void ConvertShort(unsigned short *array, long length) +{ + unsigned long b1, b2; + unsigned char *ptr; + + ptr = (unsigned char *)array; + while (length--) { + b1 = *ptr++; + b2 = *ptr++; + *array++ = (unsigned short) ((b1 << 8) | (b2)); + } +} + +static void ConvertLong(GLuint *array, long length) +{ + unsigned long b1, b2, b3, b4; + unsigned char *ptr; + + ptr = (unsigned char *)array; + while (length--) { + b1 = *ptr++; + b2 = *ptr++; + b3 = *ptr++; + b4 = *ptr++; + *array++ = (b1 << 24) | (b2 << 16) | (b3 << 8) | (b4); + } +} + +static rawImageRec *RawImageOpen(const char *fileName) +{ + union { + int testWord; + char testByte[4]; + } endianTest; + rawImageRec *raw; + GLenum swapFlag; + int x; + + endianTest.testWord = 1; + if (endianTest.testByte[0] == 1) { + swapFlag = GL_TRUE; + } else { + swapFlag = GL_FALSE; + } + + raw = (rawImageRec *)calloc(1, sizeof(rawImageRec)); + if (raw == NULL) { + fprintf(stderr, "Out of memory!\n"); + return NULL; + } + if ((raw->file = fopen(fileName, "rb")) == NULL) { + perror(fileName); + return NULL; + } + + fread(raw, 1, 12, raw->file); + + if (swapFlag) { + ConvertShort(&raw->imagic, 6); + } + + raw->tmp = (unsigned char *)malloc(raw->sizeX*256); + raw->tmpR = (unsigned char *)malloc(raw->sizeX*256); + raw->tmpG = (unsigned char *)malloc(raw->sizeX*256); + raw->tmpB = (unsigned char *)malloc(raw->sizeX*256); + if (raw->sizeZ==4) { + raw->tmpA = (unsigned char *)malloc(raw->sizeX*256); + } + if (raw->tmp == NULL || raw->tmpR == NULL || raw->tmpG == NULL || + raw->tmpB == NULL) { + fprintf(stderr, "Out of memory!\n"); + return NULL; + } + + if ((raw->type & 0xFF00) == 0x0100) { + x = raw->sizeY * raw->sizeZ * sizeof(GLuint); + raw->rowStart = (GLuint *)malloc(x); + raw->rowSize = (GLint *)malloc(x); + if (raw->rowStart == NULL || raw->rowSize == NULL) { + fprintf(stderr, "Out of memory!\n"); + return NULL; + } + raw->rleEnd = 512 + (2 * x); + fseek(raw->file, 512, SEEK_SET); + fread(raw->rowStart, 1, x, raw->file); + fread(raw->rowSize, 1, x, raw->file); + if (swapFlag) { + ConvertLong(raw->rowStart, (long) (x/sizeof(GLuint))); + ConvertLong((GLuint *)raw->rowSize, (long) (x/sizeof(GLint))); + } + } + return raw; +} + +static void RawImageClose(rawImageRec *raw) +{ + fclose(raw->file); + free(raw->tmp); + free(raw->tmpR); + free(raw->tmpG); + free(raw->tmpB); + if (raw->rowStart) + free(raw->rowStart); + if (raw->rowSize) + free(raw->rowSize); + if (raw->sizeZ>3) { + free(raw->tmpA); + } + free(raw); +} + +static void RawImageGetRow(rawImageRec *raw, unsigned char *buf, int y, int z) +{ + unsigned char *iPtr, *oPtr, pixel; + int count, done = 0; + + if ((raw->type & 0xFF00) == 0x0100) { + fseek(raw->file, (long) raw->rowStart[y+z*raw->sizeY], SEEK_SET); + fread(raw->tmp, 1, (unsigned int)raw->rowSize[y+z*raw->sizeY], + raw->file); + + iPtr = raw->tmp; + oPtr = buf; + while (!done) { + pixel = *iPtr++; + count = (int)(pixel & 0x7F); + if (!count) { + done = 1; + return; + } + if (pixel & 0x80) { + while (count--) { + *oPtr++ = *iPtr++; + } + } else { + pixel = *iPtr++; + while (count--) { + *oPtr++ = pixel; + } + } + } + } else { + fseek(raw->file, 512+(y*raw->sizeX)+(z*raw->sizeX*raw->sizeY), + SEEK_SET); + fread(buf, 1, raw->sizeX, raw->file); + } +} + + +static void RawImageGetData(rawImageRec *raw, TK_RGBImageRec *final) +{ + unsigned char *ptr; + int i, j; + + final->data = (unsigned char *)malloc((raw->sizeX+1)*(raw->sizeY+1)*4); + if (final->data == NULL) { + fprintf(stderr, "Out of memory!\n"); + } + + ptr = final->data; + for (i = 0; i < (int)(raw->sizeY); i++) { + RawImageGetRow(raw, raw->tmpR, i, 0); + RawImageGetRow(raw, raw->tmpG, i, 1); + RawImageGetRow(raw, raw->tmpB, i, 2); + if (raw->sizeZ>3) { + RawImageGetRow(raw, raw->tmpA, i, 3); + } + for (j = 0; j < (int)(raw->sizeX); j++) { + *ptr++ = *(raw->tmpR + j); + *ptr++ = *(raw->tmpG + j); + *ptr++ = *(raw->tmpB + j); + if (raw->sizeZ>3) { + *ptr++ = *(raw->tmpA + j); + } + } + } +} + + +static TK_RGBImageRec *tkRGBImageLoad(const char *fileName) +{ + rawImageRec *raw; + TK_RGBImageRec *final; + + raw = RawImageOpen(fileName); + if (!raw) { + fprintf(stderr, "File not found\n"); + return NULL; + } + final = (TK_RGBImageRec *)malloc(sizeof(TK_RGBImageRec)); + if (final == NULL) { + fprintf(stderr, "Out of memory!\n"); + return NULL; + } + final->sizeX = raw->sizeX; + final->sizeY = raw->sizeY; + final->components = raw->sizeZ; + RawImageGetData(raw, final); + RawImageClose(raw); + return final; +} + + +static void FreeImage( TK_RGBImageRec *image ) +{ + free(image->data); + free(image); +} + + +/* + * Load an SGI .rgb file and generate a set of 2-D mipmaps from it. + * Input: imageFile - name of .rgb to read + * intFormat - internal texture format to use, or number of components + * Return: GL_TRUE if success, GL_FALSE if error. + */ +GLboolean LoadRGBMipmaps( const char *imageFile, GLint intFormat ) +{ + GLint w, h; + return LoadRGBMipmaps2( imageFile, GL_TEXTURE_2D, intFormat, &w, &h ); +} + + + +GLboolean LoadRGBMipmaps2( const char *imageFile, GLenum target, + GLint intFormat, GLint *width, GLint *height ) +{ + GLint error; + GLenum format; + TK_RGBImageRec *image; + + image = tkRGBImageLoad( imageFile ); + if (!image) { + return GL_FALSE; + } + + if (image->components==3) { + format = GL_RGB; + } + else if (image->components==4) { + format = GL_RGBA; + } + else { + /* not implemented */ + fprintf(stderr, + "Error in LoadRGBMipmaps %d-component images not implemented\n", + image->components ); + return GL_FALSE; + } + + error = gluBuild2DMipmaps( target, + intFormat, + image->sizeX, image->sizeY, + format, + GL_UNSIGNED_BYTE, + image->data ); + + *width = image->sizeX; + *height = image->sizeY; + + FreeImage(image); + + return error ? GL_FALSE : GL_TRUE; +} + + + +/* + * Load an SGI .rgb file and return a pointer to the image data. + * Input: imageFile - name of .rgb to read + * Output: width - width of image + * height - height of image + * format - format of image (GL_RGB or GL_RGBA) + * Return: pointer to image data or NULL if error + */ +GLubyte *LoadRGBImage( const char *imageFile, GLint *width, GLint *height, + GLenum *format ) +{ + TK_RGBImageRec *image; + GLint bytes; + GLubyte *buffer; + + image = tkRGBImageLoad( imageFile ); + if (!image) { + return NULL; + } + + if (image->components==3) { + *format = GL_RGB; + } + else if (image->components==4) { + *format = GL_RGBA; + } + else { + /* not implemented */ + fprintf(stderr, + "Error in LoadRGBImage %d-component images not implemented\n", + image->components ); + return NULL; + } + + *width = image->sizeX; + *height = image->sizeY; + + bytes = image->sizeX * image->sizeY * image->components; + buffer = (GLubyte *) malloc(bytes); + if (!buffer) + return NULL; + + memcpy( (void *) buffer, (void *) image->data, bytes ); + + FreeImage(image); + + return buffer; +} + +#define CLAMP( X, MIN, MAX ) ( (X)<(MIN) ? (MIN) : ((X)>(MAX) ? (MAX) : (X)) ) + + +static void ConvertRGBtoYUV(GLint w, GLint h, GLint texel_bytes, + const GLubyte *src, + GLushort *dest) +{ + GLint i, j; + + for (i = 0; i < h; i++) { + for (j = 0; j < w; j++) { + const GLfloat r = (src[0]) / 255.0; + const GLfloat g = (src[1]) / 255.0; + const GLfloat b = (src[2]) / 255.0; + GLfloat y, cr, cb; + GLint iy, icr, icb; + + y = r * 65.481 + g * 128.553 + b * 24.966 + 16; + cb = r * -37.797 + g * -74.203 + b * 112.0 + 128; + cr = r * 112.0 + g * -93.786 + b * -18.214 + 128; + /*printf("%f %f %f -> %f %f %f\n", r, g, b, y, cb, cr);*/ + iy = (GLint) CLAMP(y, 0, 254); + icb = (GLint) CLAMP(cb, 0, 254); + icr = (GLint) CLAMP(cr, 0, 254); + + if (j & 1) { + /* odd */ + *dest = (iy << 8) | icr; + } + else { + /* even */ + *dest = (iy << 8) | icb; + } + dest++; + src += texel_bytes; + } + } +} + + +/* + * Load an SGI .rgb file and return a pointer to the image data, converted + * to 422 yuv. + * + * Input: imageFile - name of .rgb to read + * Output: width - width of image + * height - height of image + * Return: pointer to image data or NULL if error + */ +GLushort *LoadYUVImage( const char *imageFile, GLint *width, GLint *height ) +{ + TK_RGBImageRec *image; + GLushort *buffer; + + image = tkRGBImageLoad( imageFile ); + if (!image) { + return NULL; + } + + if (image->components != 3 && image->components !=4 ) { + /* not implemented */ + fprintf(stderr, + "Error in LoadYUVImage %d-component images not implemented\n", + image->components ); + return NULL; + } + + *width = image->sizeX; + *height = image->sizeY; + + buffer = (GLushort *) malloc( image->sizeX * image->sizeY * 2 ); + + if (buffer) + ConvertRGBtoYUV( image->sizeX, + image->sizeY, + image->components, + image->data, + buffer ); + + + FreeImage(image); + return buffer; +} + diff --git a/progs/demos/readtex.h b/progs/demos/readtex.h new file mode 100644 index 0000000000..6c9a3828d3 --- /dev/null +++ b/progs/demos/readtex.h @@ -0,0 +1,26 @@ +/* readtex.h */ + +#ifndef READTEX_H +#define READTEX_H + + +#include + + +extern GLboolean +LoadRGBMipmaps( const char *imageFile, GLint intFormat ); + + +extern GLboolean +LoadRGBMipmaps2( const char *imageFile, GLenum target, + GLint intFormat, GLint *width, GLint *height ); + + +extern GLubyte * +LoadRGBImage( const char *imageFile, + GLint *width, GLint *height, GLenum *format ); + +extern GLushort * +LoadYUVImage( const char *imageFile, GLint *width, GLint *height ); + +#endif diff --git a/progs/demos/showbuffer.c b/progs/demos/showbuffer.c new file mode 100644 index 0000000000..b0cedea217 --- /dev/null +++ b/progs/demos/showbuffer.c @@ -0,0 +1,198 @@ +/* showbuffer.c */ + + +/* + * Copy the depth buffer to the color buffer as a grayscale image. + * Useful for inspecting the depth buffer values. + * + * This program is in the public domain. + * + * Brian Paul November 4, 1998 + */ + + +#include +#include +#include +#include "showbuffer.h" + + + +/* + * Copy the depth buffer values into the current color buffer as a + * grayscale image. + * Input: winWidth, winHeight - size of the window + * zBlack - the Z value which should map to black (usually 1) + * zWhite - the Z value which should map to white (usually 0) + */ +void +ShowDepthBuffer( GLsizei winWidth, GLsizei winHeight, + GLfloat zBlack, GLfloat zWhite ) +{ + GLfloat *depthValues; + + assert(zBlack >= 0.0); + assert(zBlack <= 1.0); + assert(zWhite >= 0.0); + assert(zWhite <= 1.0); + assert(zBlack != zWhite); + + glPixelStorei(GL_UNPACK_ALIGNMENT, 1); + glPixelStorei(GL_PACK_ALIGNMENT, 1); + + /* Read depth values */ + depthValues = (GLfloat *) malloc(winWidth * winHeight * sizeof(GLfloat)); + assert(depthValues); + glReadPixels(0, 0, winWidth, winHeight, GL_DEPTH_COMPONENT, + GL_FLOAT, depthValues); + + /* Map Z values from [zBlack, zWhite] to gray levels in [0, 1] */ + /* Not using glPixelTransfer() because it's broke on some systems! */ + if (zBlack != 0.0 || zWhite != 1.0) { + GLfloat scale = 1.0 / (zWhite - zBlack); + GLfloat bias = -zBlack * scale; + int n = winWidth * winHeight; + int i; + for (i = 0; i < n; i++) + depthValues[i] = depthValues[i] * scale + bias; + } + + /* save GL state */ + glPushAttrib(GL_CURRENT_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT | + GL_TRANSFORM_BIT | GL_VIEWPORT_BIT); + + /* setup raster pos for glDrawPixels */ + glMatrixMode(GL_PROJECTION); + glPushMatrix(); + glLoadIdentity(); + + glOrtho(0.0, (GLdouble) winWidth, 0.0, (GLdouble) winHeight, -1.0, 1.0); + glMatrixMode(GL_MODELVIEW); + glPushMatrix(); + glLoadIdentity(); + + glViewport(0, 0, winWidth, winHeight); + + glDisable(GL_STENCIL_TEST); + glDisable(GL_DEPTH_TEST); + glRasterPos2f(0, 0); + + glDrawPixels(winWidth, winHeight, GL_LUMINANCE, GL_FLOAT, depthValues); + + glPopMatrix(); + glMatrixMode(GL_PROJECTION); + glPopMatrix(); + free(depthValues); + + glPopAttrib(); +} + + + + +/* + * Copy the alpha channel values into the current color buffer as a + * grayscale image. + * Input: winWidth, winHeight - size of the window + */ +void +ShowAlphaBuffer( GLsizei winWidth, GLsizei winHeight ) +{ + GLubyte *alphaValues; + + glPixelStorei(GL_UNPACK_ALIGNMENT, 1); + glPixelStorei(GL_PACK_ALIGNMENT, 1); + + /* Read alpha values */ + alphaValues = (GLubyte *) malloc(winWidth * winHeight * sizeof(GLubyte)); + assert(alphaValues); + glReadPixels(0, 0, winWidth, winHeight, GL_ALPHA, GL_UNSIGNED_BYTE, alphaValues); + + /* save GL state */ + glPushAttrib(GL_CURRENT_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL | + GL_TRANSFORM_BIT | GL_VIEWPORT_BIT); + + /* setup raster pos for glDrawPixels */ + glMatrixMode(GL_PROJECTION); + glPushMatrix(); + glLoadIdentity(); + + glOrtho(0.0, (GLdouble) winWidth, 0.0, (GLdouble) winHeight, -1.0, 1.0); + glMatrixMode(GL_MODELVIEW); + glPushMatrix(); + glLoadIdentity(); + + glViewport(0, 0, winWidth, winHeight); + + glDisable(GL_STENCIL_TEST); + glDisable(GL_DEPTH_TEST); + glRasterPos2f(0, 0); + + glDrawPixels(winWidth, winHeight, GL_LUMINANCE, GL_UNSIGNED_BYTE, alphaValues); + + glPopMatrix(); + glMatrixMode(GL_PROJECTION); + glPopMatrix(); + free(alphaValues); + + glPopAttrib(); +} + + + +/* + * Copy the stencil buffer values into the current color buffer as a + * grayscale image. + * Input: winWidth, winHeight - size of the window + * scale, bias - scale and bias to apply to stencil values for display + */ +void +ShowStencilBuffer( GLsizei winWidth, GLsizei winHeight, + GLfloat scale, GLfloat bias ) +{ + GLubyte *stencilValues; + + glPixelStorei(GL_UNPACK_ALIGNMENT, 1); + glPixelStorei(GL_PACK_ALIGNMENT, 1); + + /* Read stencil values */ + stencilValues = (GLubyte *) malloc(winWidth * winHeight * sizeof(GLubyte)); + assert(stencilValues); + glReadPixels(0, 0, winWidth, winHeight, GL_STENCIL_INDEX, GL_UNSIGNED_BYTE, stencilValues); + + /* save GL state */ + glPushAttrib(GL_CURRENT_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT | + GL_PIXEL_MODE_BIT | GL_TRANSFORM_BIT | GL_VIEWPORT_BIT); + + /* setup raster pos for glDrawPixels */ + glMatrixMode(GL_PROJECTION); + glPushMatrix(); + glLoadIdentity(); + + glOrtho(0.0, (GLdouble) winWidth, 0.0, (GLdouble) winHeight, -1.0, 1.0); + glMatrixMode(GL_MODELVIEW); + glPushMatrix(); + glLoadIdentity(); + + glViewport(0, 0, winWidth, winHeight); + + glDisable(GL_STENCIL_TEST); + glDisable(GL_DEPTH_TEST); + glRasterPos2f(0, 0); + + glPixelTransferf(GL_RED_SCALE, scale); + glPixelTransferf(GL_RED_BIAS, bias); + glPixelTransferf(GL_GREEN_SCALE, scale); + glPixelTransferf(GL_GREEN_BIAS, bias); + glPixelTransferf(GL_BLUE_SCALE, scale); + glPixelTransferf(GL_BLUE_BIAS, bias); + + glDrawPixels(winWidth, winHeight, GL_LUMINANCE, GL_UNSIGNED_BYTE, stencilValues); + + glPopMatrix(); + glMatrixMode(GL_PROJECTION); + glPopMatrix(); + free(stencilValues); + + glPopAttrib(); +} diff --git a/progs/demos/showbuffer.h b/progs/demos/showbuffer.h new file mode 100644 index 0000000000..63533d8e9b --- /dev/null +++ b/progs/demos/showbuffer.h @@ -0,0 +1,36 @@ +/* showbuffer. h*/ + +/* + * Copy the depth buffer to the color buffer as a grayscale image. + * Useful for inspecting the depth buffer values. + * + * This program is in the public domain. + * + * Brian Paul November 4, 1998 + */ + + +#ifndef SHOWBUFFER_H +#define SHOWBUFFER_H + + +#include + + + +extern void +ShowDepthBuffer( GLsizei winWidth, GLsizei winHeight, + GLfloat zBlack, GLfloat zWhite ); + + +extern void +ShowAlphaBuffer( GLsizei winWidth, GLsizei winHeight ); + + +extern void +ShowStencilBuffer( GLsizei winWidth, GLsizei winHeight, + GLfloat scale, GLfloat bias ); + + + +#endif diff --git a/progs/demos/trackball.c b/progs/demos/trackball.c new file mode 100644 index 0000000000..a6c4c60d06 --- /dev/null +++ b/progs/demos/trackball.c @@ -0,0 +1,338 @@ +#include +/* + * (c) Copyright 1993, 1994, Silicon Graphics, Inc. + * ALL RIGHTS RESERVED + * Permission to use, copy, modify, and distribute this software for + * any purpose and without fee is hereby granted, provided that the above + * copyright notice appear in all copies and that both the copyright notice + * and this permission notice appear in supporting documentation, and that + * the name of Silicon Graphics, Inc. not be used in advertising + * or publicity pertaining to distribution of the software without specific, + * written prior permission. + * + * THE MATERIAL EMBODIED ON THIS SOFTWARE IS PROVIDED TO YOU "AS-IS" + * AND WITHOUT WARRANTY OF ANY KIND, EXPRESS, IMPLIED OR OTHERWISE, + * INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY OR + * FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON + * GRAPHICS, INC. BE LIABLE TO YOU OR ANYONE ELSE FOR ANY DIRECT, + * SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY + * KIND, OR ANY DAMAGES WHATSOEVER, INCLUDING WITHOUT LIMITATION, + * LOSS OF PROFIT, LOSS OF USE, SAVINGS OR REVENUE, OR THE CLAIMS OF + * THIRD PARTIES, WHETHER OR NOT SILICON GRAPHICS, INC. HAS BEEN + * ADVISED OF THE POSSIBILITY OF SUCH LOSS, HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE + * POSSESSION, USE OR PERFORMANCE OF THIS SOFTWARE. + * + * US Government Users Restricted Rights + * Use, duplication, or disclosure by the Government is subject to + * restrictions set forth in FAR 52.227.19(c)(2) or subparagraph + * (c)(1)(ii) of the Rights in Technical Data and Computer Software + * clause at DFARS 252.227-7013 and/or in similar or successor + * clauses in the FAR or the DOD or NASA FAR Supplement. + * Unpublished-- rights reserved under the copyright laws of the + * United States. Contractor/manufacturer is Silicon Graphics, + * Inc., 2011 N. Shoreline Blvd., Mountain View, CA 94039-7311. + * + * OpenGL(TM) is a trademark of Silicon Graphics, Inc. + */ +/* + * Trackball code: + * + * Implementation of a virtual trackball. + * Implemented by Gavin Bell, lots of ideas from Thant Tessman and + * the August '88 issue of Siggraph's "Computer Graphics," pp. 121-129. + * + * Vector manip code: + * + * Original code from: + * David M. Ciemiewicz, Mark Grossman, Henry Moreton, and Paul Haeberli + * + * Much mucking with by: + * Gavin Bell + */ +#if defined(_WIN32) +#pragma warning (disable:4244) /* disable bogus conversion warnings */ +#endif +#include +#include "trackball.h" + +/* + * This size should really be based on the distance from the center of + * rotation to the point on the object underneath the mouse. That + * point would then track the mouse as closely as possible. This is a + * simple example, though, so that is left as an Exercise for the + * Programmer. + */ +#define TRACKBALLSIZE (0.8f) + +/* + * Local function prototypes (not defined in trackball.h) + */ +static float tb_project_to_sphere(float, float, float); +static void normalize_quat(float [4]); + +static void +vzero(float v[3]) +{ + v[0] = 0.0; + v[1] = 0.0; + v[2] = 0.0; +} + +static void +vset(float v[3], float x, float y, float z) +{ + v[0] = x; + v[1] = y; + v[2] = z; +} + +static void +vsub(const float src1[3], const float src2[3], float dst[3]) +{ + dst[0] = src1[0] - src2[0]; + dst[1] = src1[1] - src2[1]; + dst[2] = src1[2] - src2[2]; +} + +static void +vcopy(const float v1[3], float v2[3]) +{ + register int i; + for (i = 0 ; i < 3 ; i++) + v2[i] = v1[i]; +} + +static void +vcross(const float v1[3], const float v2[3], float cross[3]) +{ + float temp[3]; + + temp[0] = (v1[1] * v2[2]) - (v1[2] * v2[1]); + temp[1] = (v1[2] * v2[0]) - (v1[0] * v2[2]); + temp[2] = (v1[0] * v2[1]) - (v1[1] * v2[0]); + vcopy(temp, cross); +} + +static float +vlength(const float v[3]) +{ + return sqrt(v[0] * v[0] + v[1] * v[1] + v[2] * v[2]); +} + +static void +vscale(float v[3], float div) +{ + v[0] *= div; + v[1] *= div; + v[2] *= div; +} + +static void +vnormal(float v[3]) +{ + vscale(v,1.0/vlength(v)); +} + +static float +vdot(const float v1[3], const float v2[3]) +{ + return v1[0]*v2[0] + v1[1]*v2[1] + v1[2]*v2[2]; +} + +static void +vadd(const float src1[3], const float src2[3], float dst[3]) +{ + dst[0] = src1[0] + src2[0]; + dst[1] = src1[1] + src2[1]; + dst[2] = src1[2] + src2[2]; +} + +/* + * Ok, simulate a track-ball. Project the points onto the virtual + * trackball, then figure out the axis of rotation, which is the cross + * product of P1 P2 and O P1 (O is the center of the ball, 0,0,0) + * Note: This is a deformed trackball-- is a trackball in the center, + * but is deformed into a hyperbolic sheet of rotation away from the + * center. This particular function was chosen after trying out + * several variations. + * + * It is assumed that the arguments to this routine are in the range + * (-1.0 ... 1.0) + */ +void +trackball(float q[4], float p1x, float p1y, float p2x, float p2y) +{ + float a[3]; /* Axis of rotation */ + float phi; /* how much to rotate about axis */ + float p1[3], p2[3], d[3]; + float t; + + if (p1x == p2x && p1y == p2y) { + /* Zero rotation */ + vzero(q); + q[3] = 1.0; + return; + } + + /* + * First, figure out z-coordinates for projection of P1 and P2 to + * deformed sphere + */ + vset(p1,p1x,p1y,tb_project_to_sphere(TRACKBALLSIZE,p1x,p1y)); + vset(p2,p2x,p2y,tb_project_to_sphere(TRACKBALLSIZE,p2x,p2y)); + + /* + * Now, we want the cross product of P1 and P2 + */ + vcross(p2,p1,a); + + /* + * Figure out how much to rotate around that axis. + */ + vsub(p1,p2,d); + t = vlength(d) / (2.0*TRACKBALLSIZE); + + /* + * Avoid problems with out-of-control values... + */ + if (t > 1.0) t = 1.0; + if (t < -1.0) t = -1.0; + phi = 2.0 * asin(t); + + axis_to_quat(a,phi,q); +} + +/* + * Given an axis and angle, compute quaternion. + */ +void +axis_to_quat(const float a[3], float phi, float q[4]) +{ + vcopy(a,q); + vnormal(q); + vscale(q, sin(phi/2.0)); + q[3] = cos(phi/2.0); +} + +/* + * Project an x,y pair onto a sphere of radius r OR a hyperbolic sheet + * if we are away from the center of the sphere. + */ +static float +tb_project_to_sphere(float r, float x, float y) +{ + float d, t, z; + + d = sqrt(x*x + y*y); + if (d < r * 0.70710678118654752440) { /* Inside sphere */ + z = sqrt(r*r - d*d); + } else { /* On hyperbola */ + t = r / 1.41421356237309504880; + z = t*t / d; + } + return z; +} + +/* + * Given two rotations, e1 and e2, expressed as quaternion rotations, + * figure out the equivalent single rotation and stuff it into dest. + * + * This routine also normalizes the result every RENORMCOUNT times it is + * called, to keep error from creeping in. + * + * NOTE: This routine is written so that q1 or q2 may be the same + * as dest (or each other). + */ + +#define RENORMCOUNT 97 + +void +add_quats(const float q1[4], const float q2[4], float dest[4]) +{ + static int count=0; + float t1[4], t2[4], t3[4]; + float tf[4]; + +#if 0 +printf("q1 = %f %f %f %f\n", q1[0], q1[1], q1[2], q1[3]); +printf("q2 = %f %f %f %f\n", q2[0], q2[1], q2[2], q2[3]); +#endif + + vcopy(q1,t1); + vscale(t1,q2[3]); + + vcopy(q2,t2); + vscale(t2,q1[3]); + + vcross(q2,q1,t3); + vadd(t1,t2,tf); + vadd(t3,tf,tf); + tf[3] = q1[3] * q2[3] - vdot(q1,q2); + +#if 0 +printf("tf = %f %f %f %f\n", tf[0], tf[1], tf[2], tf[3]); +#endif + + dest[0] = tf[0]; + dest[1] = tf[1]; + dest[2] = tf[2]; + dest[3] = tf[3]; + + if (++count > RENORMCOUNT) { + count = 0; + normalize_quat(dest); + } +} + +/* + * Quaternions always obey: a^2 + b^2 + c^2 + d^2 = 1.0 + * If they don't add up to 1.0, dividing by their magnitued will + * renormalize them. + * + * Note: See the following for more information on quaternions: + * + * - Shoemake, K., Animating rotation with quaternion curves, Computer + * Graphics 19, No 3 (Proc. SIGGRAPH'85), 245-254, 1985. + * - Pletinckx, D., Quaternion calculus as a basic tool in computer + * graphics, The Visual Computer 5, 2-13, 1989. + */ +static void +normalize_quat(float q[4]) +{ + int i; + float mag; + + mag = sqrt(q[0]*q[0] + q[1]*q[1] + q[2]*q[2] + q[3]*q[3]); + for (i = 0; i < 4; i++) + q[i] /= mag; +} + +/* + * Build a rotation matrix, given a quaternion rotation. + * + */ +void +build_rotmatrix(float m[4][4], const float q[4]) +{ + m[0][0] = 1.0 - 2.0 * (q[1] * q[1] + q[2] * q[2]); + m[0][1] = 2.0 * (q[0] * q[1] - q[2] * q[3]); + m[0][2] = 2.0 * (q[2] * q[0] + q[1] * q[3]); + m[0][3] = 0.0; + + m[1][0] = 2.0 * (q[0] * q[1] + q[2] * q[3]); + m[1][1]= 1.0 - 2.0 * (q[2] * q[2] + q[0] * q[0]); + m[1][2] = 2.0 * (q[1] * q[2] - q[0] * q[3]); + m[1][3] = 0.0; + + m[2][0] = 2.0 * (q[2] * q[0] - q[1] * q[3]); + m[2][1] = 2.0 * (q[1] * q[2] + q[0] * q[3]); + m[2][2] = 1.0 - 2.0 * (q[1] * q[1] + q[0] * q[0]); + m[2][3] = 0.0; + + m[3][0] = 0.0; + m[3][1] = 0.0; + m[3][2] = 0.0; + m[3][3] = 1.0; +} + diff --git a/progs/demos/trackball.h b/progs/demos/trackball.h new file mode 100644 index 0000000000..9b278640e1 --- /dev/null +++ b/progs/demos/trackball.h @@ -0,0 +1,84 @@ +/* + * (c) Copyright 1993, 1994, Silicon Graphics, Inc. + * ALL RIGHTS RESERVED + * Permission to use, copy, modify, and distribute this software for + * any purpose and without fee is hereby granted, provided that the above + * copyright notice appear in all copies and that both the copyright notice + * and this permission notice appear in supporting documentation, and that + * the name of Silicon Graphics, Inc. not be used in advertising + * or publicity pertaining to distribution of the software without specific, + * written prior permission. + * + * THE MATERIAL EMBODIED ON THIS SOFTWARE IS PROVIDED TO YOU "AS-IS" + * AND WITHOUT WARRANTY OF ANY KIND, EXPRESS, IMPLIED OR OTHERWISE, + * INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY OR + * FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON + * GRAPHICS, INC. BE LIABLE TO YOU OR ANYONE ELSE FOR ANY DIRECT, + * SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY + * KIND, OR ANY DAMAGES WHATSOEVER, INCLUDING WITHOUT LIMITATION, + * LOSS OF PROFIT, LOSS OF USE, SAVINGS OR REVENUE, OR THE CLAIMS OF + * THIRD PARTIES, WHETHER OR NOT SILICON GRAPHICS, INC. HAS BEEN + * ADVISED OF THE POSSIBILITY OF SUCH LOSS, HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE + * POSSESSION, USE OR PERFORMANCE OF THIS SOFTWARE. + * + * US Government Users Restricted Rights + * Use, duplication, or disclosure by the Government is subject to + * restrictions set forth in FAR 52.227.19(c)(2) or subparagraph + * (c)(1)(ii) of the Rights in Technical Data and Computer Software + * clause at DFARS 252.227-7013 and/or in similar or successor + * clauses in the FAR or the DOD or NASA FAR Supplement. + * Unpublished-- rights reserved under the copyright laws of the + * United States. Contractor/manufacturer is Silicon Graphics, + * Inc., 2011 N. Shoreline Blvd., Mountain View, CA 94039-7311. + * + * OpenGL(TM) is a trademark of Silicon Graphics, Inc. + */ +/* + * trackball.h + * A virtual trackball implementation + * Written by Gavin Bell for Silicon Graphics, November 1988. + */ + +#ifndef TRACKBALL_H +#define TRACKBALL_H + + +/* + * Pass the x and y coordinates of the last and current positions of + * the mouse, scaled so they are from (-1.0 ... 1.0). + * + * The resulting rotation is returned as a quaternion rotation in the + * first paramater. + */ +void +trackball(float q[4], float p1x, float p1y, float p2x, float p2y); + +/* + * Given two quaternions, add them together to get a third quaternion. + * Adding quaternions to get a compound rotation is analagous to adding + * translations to get a compound translation. When incrementally + * adding rotations, the first argument here should be the new + * rotation, the second and third the total rotation (which will be + * over-written with the resulting new total rotation). + */ +void +add_quats(const float q1[4], const float q2[4], float dest[4]); + +/* + * A useful function, builds a rotation matrix in Matrix based on + * given quaternion. + */ +void +build_rotmatrix(float m[4][4], const float q[4]); + +/* + * This function computes a quaternion based on an axis (defined by + * the given vector) and an angle about which to rotate. The angle is + * expressed in radians. The result is put into the third argument. + */ +void +axis_to_quat(const float a[3], float phi, float q[4]); + + +#endif /* TRACKBALL_H */ diff --git a/progs/directfb/.gitignore b/progs/directfb/.gitignore deleted file mode 100644 index 55d65fb5b0..0000000000 --- a/progs/directfb/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -df_gears -df_morph3d -df_reflect -multi_window diff --git a/progs/directfb/Makefile b/progs/directfb/Makefile deleted file mode 100644 index 93c2a7df14..0000000000 --- a/progs/directfb/Makefile +++ /dev/null @@ -1,38 +0,0 @@ -# progs/directfb/Makefile - -TOP = ../.. -include $(TOP)/configs/current - - -INCDIR = $(TOP)/include -I$(TOP)/progs - -LIB_DEP = $(TOP)/$(LIB_DIR)/$(GL_LIB_NAME) $(TOP)/$(LIB_DIR)/$(GLU_LIB_NAME) - -CFLAGS += $(shell pkg-config --cflags directfb) -APP_LIB_DEPS += $(shell pkg-config --libs directfb) - -LIBS = -L$(TOP)/$(LIB_DIR) -l$(GLU_LIB) -l$(GL_LIB) $(APP_LIB_DEPS) - -PROGS = df_gears \ - df_reflect \ - df_morph3d \ - multi_window - -##### RULES ##### - -.SUFFIXES: -.SUFFIXES: .c - -.c: $(LIB_DEP) - $(CC) -I$(INCDIR) $(CFLAGS) $(LDFLAGS) $< $(LIBS) -o $@ - - -##### TARGETS ##### - -default: $(PROGS) - - -clean: - -rm -f $(PROGS) - -rm -f *.o *~ - diff --git a/progs/directfb/df_gears.c b/progs/directfb/df_gears.c deleted file mode 100644 index c480767bd3..0000000000 --- a/progs/directfb/df_gears.c +++ /dev/null @@ -1,480 +0,0 @@ -/* - (c) Copyright 2001 convergence integrated media GmbH. - All rights reserved. - - Written by Denis Oliver Kropp and - Andreas Hundt . - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the - Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. -*/ - -#include -#include -#include -#include - -#include -#include - -#include - - -/* the super interface */ -IDirectFB *dfb; - -/* the primary surface (surface of primary layer) */ -IDirectFBSurface *primary; - -/* the GL context */ -IDirectFBGL *primary_gl; - -/* our font */ -IDirectFBFont *font; - -/* event buffer */ -IDirectFBEventBuffer *events; - -/* macro for a safe call to DirectFB functions */ -#define DFBCHECK(x...) \ - { \ - err = x; \ - if (err != DFB_OK) { \ - fprintf( stderr, "%s <%d>:\n\t", __FILE__, __LINE__ ); \ - DirectFBErrorFatal( #x, err ); \ - } \ - } - -static int screen_width, screen_height; - -static unsigned long T0 = 0; -static GLint Frames = 0; -static GLfloat fps = 0; - -static inline unsigned long get_millis() -{ - struct timeval tv; - - gettimeofday (&tv, NULL); - return (tv.tv_sec * 1000 + tv.tv_usec / 1000); -} - - -#ifndef M_PI -#define M_PI 3.14159265 -#endif - -/** - - Draw a gear wheel. You'll probably want to call this function when - building a display list since we do a lot of trig here. - - Input: inner_radius - radius of hole at center - outer_radius - radius at center of teeth - width - width of gear - teeth - number of teeth - tooth_depth - depth of tooth - - **/ - -static void -gear(GLfloat inner_radius, GLfloat outer_radius, GLfloat width, - GLint teeth, GLfloat tooth_depth) -{ - GLint i; - GLfloat r0, r1, r2; - GLfloat angle, da; - GLfloat u, v, len; - - r0 = inner_radius; - r1 = outer_radius - tooth_depth / 2.0; - r2 = outer_radius + tooth_depth / 2.0; - - da = 2.0 * M_PI / teeth / 4.0; - - glShadeModel(GL_FLAT); - - glNormal3f(0.0, 0.0, 1.0); - - /* draw front face */ - glBegin(GL_QUAD_STRIP); - for (i = 0; i <= teeth; i++) { - angle = i * 2.0 * M_PI / teeth; - glVertex3f(r0 * cos(angle), r0 * sin(angle), width * 0.5); - glVertex3f(r1 * cos(angle), r1 * sin(angle), width * 0.5); - if (i < teeth) { - glVertex3f(r0 * cos(angle), r0 * sin(angle), width * 0.5); - glVertex3f(r1 * cos(angle + 3 * da), r1 * sin(angle + 3 * da), width * 0.5); - } - } - glEnd(); - - /* draw front sides of teeth */ - glBegin(GL_QUADS); - da = 2.0 * M_PI / teeth / 4.0; - for (i = 0; i < teeth; i++) { - angle = i * 2.0 * M_PI / teeth; - - glVertex3f(r1 * cos(angle), r1 * sin(angle), width * 0.5); - glVertex3f(r2 * cos(angle + da), r2 * sin(angle + da), width * 0.5); - glVertex3f(r2 * cos(angle + 2 * da), r2 * sin(angle + 2 * da), width * 0.5); - glVertex3f(r1 * cos(angle + 3 * da), r1 * sin(angle + 3 * da), width * 0.5); - } - glEnd(); - - glNormal3f(0.0, 0.0, -1.0); - - /* draw back face */ - glBegin(GL_QUAD_STRIP); - for (i = 0; i <= teeth; i++) { - angle = i * 2.0 * M_PI / teeth; - glVertex3f(r1 * cos(angle), r1 * sin(angle), -width * 0.5); - glVertex3f(r0 * cos(angle), r0 * sin(angle), -width * 0.5); - if (i < teeth) { - glVertex3f(r1 * cos(angle + 3 * da), r1 * sin(angle + 3 * da), -width * 0.5); - glVertex3f(r0 * cos(angle), r0 * sin(angle), -width * 0.5); - } - } - glEnd(); - - /* draw back sides of teeth */ - glBegin(GL_QUADS); - da = 2.0 * M_PI / teeth / 4.0; - for (i = 0; i < teeth; i++) { - angle = i * 2.0 * M_PI / teeth; - - glVertex3f(r1 * cos(angle + 3 * da), r1 * sin(angle + 3 * da), -width * 0.5); - glVertex3f(r2 * cos(angle + 2 * da), r2 * sin(angle + 2 * da), -width * 0.5); - glVertex3f(r2 * cos(angle + da), r2 * sin(angle + da), -width * 0.5); - glVertex3f(r1 * cos(angle), r1 * sin(angle), -width * 0.5); - } - glEnd(); - - /* draw outward faces of teeth */ - glBegin(GL_QUAD_STRIP); - for (i = 0; i < teeth; i++) { - angle = i * 2.0 * M_PI / teeth; - - glVertex3f(r1 * cos(angle), r1 * sin(angle), width * 0.5); - glVertex3f(r1 * cos(angle), r1 * sin(angle), -width * 0.5); - u = r2 * cos(angle + da) - r1 * cos(angle); - v = r2 * sin(angle + da) - r1 * sin(angle); - len = sqrt(u * u + v * v); - u /= len; - v /= len; - glNormal3f(v, -u, 0.0); - glVertex3f(r2 * cos(angle + da), r2 * sin(angle + da), width * 0.5); - glVertex3f(r2 * cos(angle + da), r2 * sin(angle + da), -width * 0.5); - glNormal3f(cos(angle), sin(angle), 0.0); - glVertex3f(r2 * cos(angle + 2 * da), r2 * sin(angle + 2 * da), width * 0.5); - glVertex3f(r2 * cos(angle + 2 * da), r2 * sin(angle + 2 * da), -width * 0.5); - u = r1 * cos(angle + 3 * da) - r2 * cos(angle + 2 * da); - v = r1 * sin(angle + 3 * da) - r2 * sin(angle + 2 * da); - glNormal3f(v, -u, 0.0); - glVertex3f(r1 * cos(angle + 3 * da), r1 * sin(angle + 3 * da), width * 0.5); - glVertex3f(r1 * cos(angle + 3 * da), r1 * sin(angle + 3 * da), -width * 0.5); - glNormal3f(cos(angle), sin(angle), 0.0); - } - - glVertex3f(r1 * cos(0), r1 * sin(0), width * 0.5); - glVertex3f(r1 * cos(0), r1 * sin(0), -width * 0.5); - - glEnd(); - - glShadeModel(GL_SMOOTH); - - /* draw inside radius cylinder */ - glBegin(GL_QUAD_STRIP); - for (i = 0; i <= teeth; i++) { - angle = i * 2.0 * M_PI / teeth; - glNormal3f(-cos(angle), -sin(angle), 0.0); - glVertex3f(r0 * cos(angle), r0 * sin(angle), -width * 0.5); - glVertex3f(r0 * cos(angle), r0 * sin(angle), width * 0.5); - } - glEnd(); - -} - -static GLfloat view_rotx = 20.0, view_roty = 30.0, view_rotz = 0.0; -static GLfloat inc_rotx = 0, inc_roty = 0, inc_rotz = 0; -static GLint gear1, gear2, gear3; -static GLfloat angle = 0.0; - -static void -draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); - - glPushMatrix(); - glRotatef(view_rotx, 1.0, 0.0, 0.0); - glRotatef(view_roty, 0.0, 1.0, 0.0); - glRotatef(view_rotz, 0.0, 0.0, 1.0); - - glPushMatrix(); - glTranslatef(-3.0, -2.0, 0.0); - glRotatef(angle, 0.0, 0.0, 1.0); - glCallList(gear1); - glPopMatrix(); - - glPushMatrix(); - glTranslatef(3.1, -2.0, 0.0); - glRotatef(-2.0 * angle - 9.0, 0.0, 0.0, 1.0); - glCallList(gear2); - glPopMatrix(); - - glPushMatrix(); - glTranslatef(-3.1, 4.2, 0.0); - glRotatef(-2.0 * angle - 25.0, 0.0, 0.0, 1.0); - glCallList(gear3); - glPopMatrix(); - - glPopMatrix(); -} - -/* new window size or exposure */ -static void -reshape(int width, int height) -{ - GLfloat h = (GLfloat) height / (GLfloat) width; - - glViewport(0, 0, (GLint) width, (GLint) height); - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glFrustum(-1.0, 1.0, -h, h, 5.0, 60.0); - glMatrixMode(GL_MODELVIEW); - glLoadIdentity(); - glTranslatef(0.0, 0.0, -40.0); -} - -static void -init(int argc, char *argv[]) -{ - static GLfloat pos[4] = {5.0, 5.0, 10.0, 0.0}; - static GLfloat red[4] = {0.8, 0.1, 0.0, 1.0}; - static GLfloat green[4] = {0.0, 0.8, 0.2, 1.0}; - static GLfloat blue[4] = {0.2, 0.2, 1.0, 1.0}; - GLint i; - - glLightfv(GL_LIGHT0, GL_POSITION, pos); - glEnable(GL_CULL_FACE); - glEnable(GL_LIGHTING); - glEnable(GL_LIGHT0); - glEnable(GL_DEPTH_TEST); - - /* make the gears */ - gear1 = glGenLists(1); - glNewList(gear1, GL_COMPILE); - glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, red); - gear(1.0, 4.0, 1.0, 20, 0.7); - glEndList(); - - gear2 = glGenLists(1); - glNewList(gear2, GL_COMPILE); - glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, green); - gear(0.5, 2.0, 2.0, 10, 0.7); - glEndList(); - - gear3 = glGenLists(1); - glNewList(gear3, GL_COMPILE); - glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, blue); - gear(1.3, 2.0, 0.5, 10, 0.7); - glEndList(); - - glEnable(GL_NORMALIZE); - - for ( i=1; iCreateInputEventBuffer( dfb, DICAPS_KEYS | DICAPS_AXES, - DFB_FALSE, &events )); - - /* set our cooperative level to DFSCL_FULLSCREEN - for exclusive access to the primary layer */ - dfb->SetCooperativeLevel( dfb, DFSCL_FULLSCREEN ); - - /* get the primary surface, i.e. the surface of the - primary layer we have exclusive access to */ - dsc.flags = DSDESC_CAPS; - dsc.caps = DSCAPS_PRIMARY | DSCAPS_DOUBLE; - - DFBCHECK(dfb->CreateSurface( dfb, &dsc, &primary )); - - /* get the size of the surface and fill it */ - DFBCHECK(primary->GetSize( primary, &screen_width, &screen_height )); - DFBCHECK(primary->FillRectangle( primary, 0, 0, - screen_width, screen_height )); - primary->Flip( primary, NULL, 0 ); - - /* create the default font and set it */ - DFBCHECK(dfb->CreateFont( dfb, NULL, NULL, &font )); - DFBCHECK(primary->SetFont( primary, font )); - - /* get the GL context */ - DFBCHECK(primary->GetGL( primary, &primary_gl )); - - DFBCHECK(primary_gl->Lock( primary_gl )); - - init(argc, argv); - reshape(screen_width, screen_height); - - DFBCHECK(primary_gl->Unlock( primary_gl )); - - T0 = get_millis(); - - while (!quit) { - DFBInputEvent evt; - unsigned long t; - - DFBCHECK(primary_gl->Lock( primary_gl )); - - draw(); - - DFBCHECK(primary_gl->Unlock( primary_gl )); - - if (fps) { - char buf[64]; - - snprintf(buf, 64, "%4.1f FPS\n", fps); - - primary->SetColor( primary, 0xff, 0, 0, 0xff ); - primary->DrawString( primary, buf, -1, screen_width - 5, 5, DSTF_TOPRIGHT ); - } - - primary->Flip( primary, NULL, 0 ); - Frames++; - - - t = get_millis(); - if (t - T0 >= 2000) { - GLfloat seconds = (t - T0) / 1000.0; - - fps = Frames / seconds; - - T0 = t; - Frames = 0; - } - - - while (events->GetEvent( events, DFB_EVENT(&evt) ) == DFB_OK) { - switch (evt.type) { - case DIET_KEYPRESS: - switch (evt.key_symbol) { - case DIKS_ESCAPE: - quit = 1; - break; - case DIKS_CURSOR_UP: - inc_rotx = 5.0; - break; - case DIKS_CURSOR_DOWN: - inc_rotx = -5.0; - break; - case DIKS_CURSOR_LEFT: - inc_roty = 5.0; - break; - case DIKS_CURSOR_RIGHT: - inc_roty = -5.0; - break; - case DIKS_PAGE_UP: - inc_rotz = 5.0; - break; - case DIKS_PAGE_DOWN: - inc_rotz = -5.0; - break; - default: - ; - } - break; - case DIET_KEYRELEASE: - switch (evt.key_symbol) { - case DIKS_CURSOR_UP: - inc_rotx = 0; - break; - case DIKS_CURSOR_DOWN: - inc_rotx = 0; - break; - case DIKS_CURSOR_LEFT: - inc_roty = 0; - break; - case DIKS_CURSOR_RIGHT: - inc_roty = 0; - break; - case DIKS_PAGE_UP: - inc_rotz = 0; - break; - case DIKS_PAGE_DOWN: - inc_rotz = 0; - break; - default: - ; - } - break; - case DIET_AXISMOTION: - if (evt.flags & DIEF_AXISREL) { - switch (evt.axis) { - case DIAI_X: - view_roty += evt.axisrel / 2.0; - break; - case DIAI_Y: - view_rotx += evt.axisrel / 2.0; - break; - case DIAI_Z: - view_rotz += evt.axisrel / 2.0; - break; - default: - ; - } - } - break; - default: - ; - } - } - - angle += 2.0; - - view_rotx += inc_rotx; - view_roty += inc_roty; - view_rotz += inc_rotz; - } - - /* release our interfaces to shutdown DirectFB */ - primary_gl->Release( primary_gl ); - primary->Release( primary ); - font->Release( font ); - events->Release( events ); - dfb->Release( dfb ); - - return 0; -} - diff --git a/progs/directfb/df_morph3d.c b/progs/directfb/df_morph3d.c deleted file mode 100644 index 2730fa6156..0000000000 --- a/progs/directfb/df_morph3d.c +++ /dev/null @@ -1,1013 +0,0 @@ -/* - (c) Copyright 2001 convergence integrated media GmbH. - All rights reserved. - - Written by Denis Oliver Kropp and - Andreas Hundt . - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the - Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. -*/ - -/*- - * morph3d.c - Shows 3D morphing objects - * - * Converted to GLUT by brianp on 1/1/98 - * - * This program was inspired on a WindowsNT(R)'s screen saver. It was written - * from scratch and it was not based on any other source code. - * - * Porting it to xlock (the final objective of this code since the moment I - * decided to create it) was possible by comparing the original Mesa's gear - * demo with it's ported version, so thanks for Danny Sung for his indirect - * help (look at gear.c in xlock source tree). NOTE: At the moment this code - * was sent to Brian Paul for package inclusion, the XLock Version was not - * available. In fact, I'll wait it to appear on the next Mesa release (If you - * are reading this, it means THIS release) to send it for xlock package - * inclusion). It will probably there be a GLUT version too. - * - * Thanks goes also to Brian Paul for making it possible and inexpensive - * to use OpenGL at home. - * - * Since I'm not a native english speaker, my apologies for any gramatical - * mistake. - * - * My e-mail addresses are - * - * vianna@cat.cbpf.br - * and - * marcelo@venus.rdc.puc-rio.br - * - * Marcelo F. Vianna (Feb-13-1997) - */ - -/* -This document is VERY incomplete, but tries to describe the mathematics used -in the program. At this moment it just describes how the polyhedra are -generated. On futhurer versions, this document will be probabbly improved. - -Since I'm not a native english speaker, my apologies for any gramatical -mistake. - -Marcelo Fernandes Vianna -- Undergraduate in Computer Engeneering at Catholic Pontifical University -- of Rio de Janeiro (PUC-Rio) Brasil. -- e-mail: vianna@cat.cbpf.br or marcelo@venus.rdc.puc-rio.br -- Feb-13-1997 - -POLYHEDRA GENERATION - -For the purpose of this program it's not sufficient to know the polyhedra -vertexes coordinates. Since the morphing algorithm applies a nonlinear -transformation over the surfaces (faces) of the polyhedron, each face has -to be divided into smaller ones. The morphing algorithm needs to transform -each vertex of these smaller faces individually. It's a very time consoming -task. - -In order to reduce calculation overload, and since all the macro faces of -the polyhedron are transformed by the same way, the generation is made by -creating only one face of the polyhedron, morphing it and then rotating it -around the polyhedron center. - -What we need to know is the face radius of the polyhedron (the radius of -the inscribed sphere) and the angle between the center of two adjacent -faces using the center of the sphere as the angle's vertex. - -The face radius of the regular polyhedra are known values which I decided -to not waste my time calculating. Following is a table of face radius for -the regular polyhedra with edge length = 1: - - TETRAHEDRON : 1/(2*sqrt(2))/sqrt(3) - CUBE : 1/2 - OCTAHEDRON : 1/sqrt(6) - DODECAHEDRON : T^2 * sqrt((T+2)/5) / 2 -> where T=(sqrt(5)+1)/2 - ICOSAHEDRON : (3*sqrt(3)+sqrt(15))/12 - -I've not found any reference about the mentioned angles, so I needed to -calculate them, not a trivial task until I figured out how :) -Curiously these angles are the same for the tetrahedron and octahedron. -A way to obtain this value is inscribing the tetrahedron inside the cube -by matching their vertexes. So you'll notice that the remaining unmatched -vertexes are in the same straight line starting in the cube/tetrahedron -center and crossing the center of each tetrahedron's face. At this point -it's easy to obtain the bigger angle of the isosceles triangle formed by -the center of the cube and two opposite vertexes on the same cube face. -The edges of this triangle have the following lenghts: sqrt(2) for the base -and sqrt(3)/2 for the other two other edges. So the angle we want is: - +-----------------------------------------------------------+ - | 2*ARCSIN(sqrt(2)/sqrt(3)) = 109.47122063449069174 degrees | - +-----------------------------------------------------------+ -For the cube this angle is obvious, but just for formality it can be -easily obtained because we also know it's isosceles edge lenghts: -sqrt(2)/2 for the base and 1/2 for the other two edges. So the angle we -want is: - +-----------------------------------------------------------+ - | 2*ARCSIN((sqrt(2)/2)/1) = 90.000000000000000000 degrees | - +-----------------------------------------------------------+ -For the octahedron we use the same idea used for the tetrahedron, but now -we inscribe the cube inside the octahedron so that all cubes's vertexes -matches excatly the center of each octahedron's face. It's now clear that -this angle is the same of the thetrahedron one: - +-----------------------------------------------------------+ - | 2*ARCSIN(sqrt(2)/sqrt(3)) = 109.47122063449069174 degrees | - +-----------------------------------------------------------+ -For the dodecahedron it's a little bit harder because it's only relationship -with the cube is useless to us. So we need to solve the problem by another -way. The concept of Face radius also exists on 2D polygons with the name -Edge radius: - Edge Radius For Pentagon (ERp) - ERp = (1/2)/TAN(36 degrees) * VRp = 0.6881909602355867905 - (VRp is the pentagon's vertex radio). - Face Radius For Dodecahedron - FRd = T^2 * sqrt((T+2)/5) / 2 = 1.1135163644116068404 -Why we need ERp? Well, ERp and FRd segments forms a 90 degrees angle, -completing this triangle, the lesser angle is a half of the angle we are -looking for, so this angle is: - +-----------------------------------------------------------+ - | 2*ARCTAN(ERp/FRd) = 63.434948822922009981 degrees | - +-----------------------------------------------------------+ -For the icosahedron we can use the same method used for dodecahedron (well -the method used for dodecahedron may be used for all regular polyhedra) - Edge Radius For Triangle (this one is well known: 1/3 of the triangle height) - ERt = sin(60)/3 = sqrt(3)/6 = 0.2886751345948128655 - Face Radius For Icosahedron - FRi= (3*sqrt(3)+sqrt(15))/12 = 0.7557613140761707538 -So the angle is: - +-----------------------------------------------------------+ - | 2*ARCTAN(ERt/FRi) = 41.810314895778596167 degrees | - +-----------------------------------------------------------+ - -*/ - - -#include -#include -#include -#include -#include - -#include -#include - -#include - - -/* the super interface */ -IDirectFB *dfb; - -/* the primary surface (surface of primary layer) */ -IDirectFBSurface *primary; - -/* the GL context */ -IDirectFBGL *primary_gl; - -/* our font */ -IDirectFBFont *font; - -/* event buffer */ -IDirectFBEventBuffer *events; - -/* macro for a safe call to DirectFB functions */ -#define DFBCHECK(x...) \ - { \ - err = x; \ - if (err != DFB_OK) { \ - fprintf( stderr, "%s <%d>:\n\t", __FILE__, __LINE__ ); \ - DirectFBErrorFatal( #x, err ); \ - } \ - } - -static int screen_width, screen_height; - -static unsigned long T0 = 0; -static GLint Frames = 0; -static GLfloat fps = 0; - -static inline unsigned long get_millis() -{ - struct timeval tv; - - gettimeofday (&tv, NULL); - return (tv.tv_sec * 1000 + tv.tv_usec / 1000); -} - - - -#define Scale 0.3 - -#define VectMul(X1,Y1,Z1,X2,Y2,Z2) (Y1)*(Z2)-(Z1)*(Y2),(Z1)*(X2)-(X1)*(Z2),(X1)*(Y2)-(Y1)*(X2) -#define sqr(A) ((A)*(A)) - -/* Increasing this values produces better image quality, the price is speed. */ -/* Very low values produces erroneous/incorrect plotting */ -#define tetradivisions 23 -#define cubedivisions 20 -#define octadivisions 21 -#define dodecadivisions 10 -#define icodivisions 15 - -#define tetraangle 109.47122063449069174 -#define cubeangle 90.000000000000000000 -#define octaangle 109.47122063449069174 -#define dodecaangle 63.434948822922009981 -#define icoangle 41.810314895778596167 - -#ifndef Pi -#define Pi 3.1415926535897932385 -#endif -#define SQRT2 1.4142135623730951455 -#define SQRT3 1.7320508075688771932 -#define SQRT5 2.2360679774997898051 -#define SQRT6 2.4494897427831778813 -#define SQRT15 3.8729833462074170214 -#define cossec36_2 0.8506508083520399322 -#define cos72 0.3090169943749474241 -#define sin72 0.9510565162951535721 -#define cos36 0.8090169943749474241 -#define sin36 0.5877852522924731292 - -/*************************************************************************/ - -static int mono=0; -static int smooth=1; -static GLint WindH, WindW; -static GLfloat step=0; -static GLfloat seno; -static int object; -static int edgedivisions; -static void (*draw_object)( void ); -static float Magnitude; -static float *MaterialColor[20]; - -static float front_shininess[] = {60.0}; -static float front_specular[] = { 0.7, 0.7, 0.7, 1.0 }; -static float ambient[] = { 0.0, 0.0, 0.0, 1.0 }; -static float diffuse[] = { 1.0, 1.0, 1.0, 1.0 }; -static float position0[] = { 1.0, 1.0, 1.0, 0.0 }; -static float position1[] = {-1.0,-1.0, 1.0, 0.0 }; -static float lmodel_ambient[] = { 0.5, 0.5, 0.5, 1.0 }; -static float lmodel_twoside[] = {GL_TRUE}; - -static float MaterialRed[] = { 0.7, 0.0, 0.0, 1.0 }; -static float MaterialGreen[] = { 0.1, 0.5, 0.2, 1.0 }; -static float MaterialBlue[] = { 0.0, 0.0, 0.7, 1.0 }; -static float MaterialCyan[] = { 0.2, 0.5, 0.7, 1.0 }; -static float MaterialYellow[] = { 0.7, 0.7, 0.0, 1.0 }; -static float MaterialMagenta[] = { 0.6, 0.2, 0.5, 1.0 }; -static float MaterialWhite[] = { 0.7, 0.7, 0.7, 1.0 }; -static float MaterialGray[] = { 0.2, 0.2, 0.2, 1.0 }; - -#define TRIANGLE(Edge, Amp, Divisions, Z) \ -{ \ - GLfloat Xf,Yf,Xa,Yb,Xf2,Yf2; \ - GLfloat Factor,Factor1,Factor2; \ - GLfloat VertX,VertY,VertZ,NeiAX,NeiAY,NeiAZ,NeiBX,NeiBY,NeiBZ; \ - GLfloat Ax,Ay,Bx; \ - int Ri,Ti; \ - GLfloat Vr=(Edge)*SQRT3/3; \ - GLfloat AmpVr2=(Amp)/sqr(Vr); \ - GLfloat Zf=(Edge)*(Z); \ - \ - Ax=(Edge)*(+0.5/(Divisions)), Ay=(Edge)*(-SQRT3/(2*Divisions)); \ - Bx=(Edge)*(-0.5/(Divisions)); \ - \ - for (Ri=1; Ri<=(Divisions); Ri++) { \ - glBegin(GL_TRIANGLE_STRIP); \ - for (Ti=0; TiFlip( primary, NULL, 0 ); - - glLightfv(GL_LIGHT0, GL_AMBIENT, ambient); - glLightfv(GL_LIGHT0, GL_DIFFUSE, diffuse); - glLightfv(GL_LIGHT0, GL_POSITION, position0); - glLightfv(GL_LIGHT1, GL_AMBIENT, ambient); - glLightfv(GL_LIGHT1, GL_DIFFUSE, diffuse); - glLightfv(GL_LIGHT1, GL_POSITION, position1); - glLightModelfv(GL_LIGHT_MODEL_AMBIENT, lmodel_ambient); - glLightModelfv(GL_LIGHT_MODEL_TWO_SIDE, lmodel_twoside); - glEnable(GL_LIGHTING); - glEnable(GL_LIGHT0); - glEnable(GL_LIGHT1); - glEnable(GL_DEPTH_TEST); - glEnable(GL_NORMALIZE); - - glMaterialfv(GL_FRONT_AND_BACK, GL_SHININESS, front_shininess); - glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, front_specular); - - glHint(GL_FOG_HINT, GL_FASTEST); - glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_FASTEST); - glHint(GL_POLYGON_SMOOTH_HINT, GL_FASTEST); - - pinit(); -} - -int main( int argc, char *argv[] ) -{ - int quit = 0; - DFBResult err; - DFBSurfaceDescription dsc; - - DFBCHECK(DirectFBInit( &argc, &argv )); - - /* create the super interface */ - DFBCHECK(DirectFBCreate( &dfb )); - - /* create an event buffer for all devices with these caps */ - DFBCHECK(dfb->CreateInputEventBuffer( dfb, DICAPS_KEYS, DFB_FALSE, &events )); - - /* set our cooperative level to DFSCL_FULLSCREEN - for exclusive access to the primary layer */ - dfb->SetCooperativeLevel( dfb, DFSCL_FULLSCREEN ); - - /* get the primary surface, i.e. the surface of the - primary layer we have exclusive access to */ - dsc.flags = DSDESC_CAPS; - dsc.caps = DSCAPS_PRIMARY | DSCAPS_DOUBLE; - - DFBCHECK(dfb->CreateSurface( dfb, &dsc, &primary )); - - /* get the size of the surface and fill it */ - DFBCHECK(primary->GetSize( primary, &screen_width, &screen_height )); - DFBCHECK(primary->FillRectangle( primary, 0, 0, - screen_width, screen_height )); - - /* create the default font and set it */ - DFBCHECK(dfb->CreateFont( dfb, NULL, NULL, &font )); - DFBCHECK(primary->SetFont( primary, font )); - - /* get the GL context */ - DFBCHECK(primary->GetGL( primary, &primary_gl )); - - DFBCHECK(primary_gl->Lock( primary_gl )); - - init(); - reshape(screen_width, screen_height); - - DFBCHECK(primary_gl->Unlock( primary_gl )); - - T0 = get_millis(); - - while (!quit) { - DFBInputEvent evt; - unsigned long t; - - primary->Clear( primary, 0, 0, 0, 0 ); - - DFBCHECK(primary_gl->Lock( primary_gl )); - - draw(); - - DFBCHECK(primary_gl->Unlock( primary_gl )); - - if (fps) { - char buf[64]; - - sprintf(buf, "%4.1f FPS\n", fps); - primary->SetColor( primary, 0xff, 0, 0, 0xff ); - primary->DrawString( primary, buf, -1, screen_width - 5, 5, DSTF_TOPRIGHT ); - } - - primary->Flip( primary, NULL, 0 ); - Frames++; - - - t = get_millis(); - if (t - T0 >= 1000) { - GLfloat seconds = (t - T0) / 1000.0; - - fps = Frames / seconds; - - T0 = t; - Frames = 0; - } - - - while (events->GetEvent( events, DFB_EVENT(&evt) ) == DFB_OK) { - switch (evt.type) { - case DIET_KEYPRESS: - switch (evt.key_symbol) { - case DIKS_ESCAPE: - quit = 1; - break; - case DIKS_1: object=1; break; - case DIKS_2: object=2; break; - case DIKS_3: object=3; break; - case DIKS_4: object=4; break; - case DIKS_5: object=5; break; - case DIKS_SPACE: mono^=1; break; - case DIKS_ENTER: smooth^=1; break; - default: - ; - } - pinit(); - break; - default: - ; - } - } - } - - /* release our interfaces to shutdown DirectFB */ - primary_gl->Release( primary_gl ); - primary->Release( primary ); - font->Release( font ); - events->Release( events ); - dfb->Release( dfb ); - - return 0; -} - diff --git a/progs/directfb/df_reflect.c b/progs/directfb/df_reflect.c deleted file mode 100644 index a0e789c387..0000000000 --- a/progs/directfb/df_reflect.c +++ /dev/null @@ -1,489 +0,0 @@ -/* - (c) Copyright 2001 convergence integrated media GmbH. - All rights reserved. - - Written by Denis Oliver Kropp and - Andreas Hundt . - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the - Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. -*/ - -#include -#include -#include -#include - -#include -#include - -#include - -#include "util/showbuffer.c" -#include "util/readtex.c" - - -/* the super interface */ -IDirectFB *dfb; - -/* the primary surface (surface of primary layer) */ -IDirectFBSurface *primary; - -/* the GL context */ -IDirectFBGL *primary_gl; - -/* our font */ -IDirectFBFont *font; - -/* event buffer */ -IDirectFBEventBuffer *events; - -/* macro for a safe call to DirectFB functions */ -#define DFBCHECK(x...) \ - { \ - err = x; \ - if (err != DFB_OK) { \ - fprintf( stderr, "%s <%d>:\n\t", __FILE__, __LINE__ ); \ - DirectFBErrorFatal( #x, err ); \ - } \ - } - -static int screen_width, screen_height; - -static unsigned long T0 = 0; -static GLint Frames = 0; -static GLfloat fps = 0; - -static inline unsigned long get_millis() -{ - struct timeval tv; - - gettimeofday (&tv, NULL); - return (tv.tv_sec * 1000 + tv.tv_usec / 1000); -} - -/*******************************/ - -#define DEG2RAD (3.14159/180.0) - -#define TABLE_TEXTURE "../images/tile.rgb" - -static GLint ImgWidth, ImgHeight; -static GLenum ImgFormat; -static GLubyte *Image = NULL; - -#define MAX_OBJECTS 2 -static GLint table_list; -static GLint objects_list[MAX_OBJECTS]; - -static GLfloat xrot, yrot; -static GLfloat spin; - -static GLint Width = 400, Height = 300; -static GLenum ShowBuffer = GL_NONE; - - -static void make_table( void ) -{ - static GLfloat table_mat[] = { 1.0, 1.0, 1.0, 0.6 }; - static GLfloat gray[] = { 0.4, 0.4, 0.4, 1.0 }; - - table_list = glGenLists(1); - glNewList( table_list, GL_COMPILE ); - - /* load table's texture */ - glMaterialfv( GL_FRONT, GL_AMBIENT_AND_DIFFUSE, table_mat ); -/* glMaterialfv( GL_FRONT, GL_EMISSION, gray );*/ - glMaterialfv( GL_FRONT, GL_DIFFUSE, table_mat ); - glMaterialfv( GL_FRONT, GL_AMBIENT, gray ); - - /* draw textured square for the table */ - glPushMatrix(); - glScalef( 4.0, 4.0, 4.0 ); - glBegin( GL_POLYGON ); - glNormal3f( 0.0, 1.0, 0.0 ); - glTexCoord2f( 0.0, 0.0 ); glVertex3f( -1.0, 0.0, 1.0 ); - glTexCoord2f( 1.0, 0.0 ); glVertex3f( 1.0, 0.0, 1.0 ); - glTexCoord2f( 1.0, 1.0 ); glVertex3f( 1.0, 0.0, -1.0 ); - glTexCoord2f( 0.0, 1.0 ); glVertex3f( -1.0, 0.0, -1.0 ); - glEnd(); - glPopMatrix(); - - glDisable( GL_TEXTURE_2D ); - - glEndList(); -} - - -static void make_objects( void ) -{ - GLUquadricObj *q; - - static GLfloat cyan[] = { 0.0, 1.0, 1.0, 1.0 }; - static GLfloat green[] = { 0.2, 1.0, 0.2, 1.0 }; - static GLfloat black[] = { 0.0, 0.0, 0.0, 0.0 }; - - q = gluNewQuadric(); - gluQuadricDrawStyle( q, GLU_FILL ); - gluQuadricNormals( q, GLU_SMOOTH ); - - objects_list[0] = glGenLists(1); - glNewList( objects_list[0], GL_COMPILE ); - glMaterialfv( GL_FRONT, GL_AMBIENT_AND_DIFFUSE, cyan ); - glMaterialfv( GL_FRONT, GL_EMISSION, black ); - gluCylinder( q, 0.5, 0.5, 1.0, 15, 1 ); - glEndList(); - - objects_list[1] = glGenLists(1); - glNewList( objects_list[1], GL_COMPILE ); - glMaterialfv( GL_FRONT, GL_AMBIENT_AND_DIFFUSE, green ); - glMaterialfv( GL_FRONT, GL_EMISSION, black ); - gluCylinder( q, 1.5, 0.0, 2.5, 15, 1 ); - glEndList(); -} - - -static void init( void ) -{ - make_table(); - make_objects(); - - Image = LoadRGBImage( TABLE_TEXTURE, &ImgWidth, &ImgHeight, &ImgFormat ); - if (!Image) { - printf("Couldn't read %s\n", TABLE_TEXTURE); - exit(0); - } - - gluBuild2DMipmaps(GL_TEXTURE_2D, 3, ImgWidth, ImgHeight, - ImgFormat, GL_UNSIGNED_BYTE, Image); - - glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT ); - glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT ); - glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST ); - glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST ); - - xrot = 30.0; - yrot = 50.0; - spin = 0.0; - - glShadeModel( GL_FLAT ); - - glEnable( GL_LIGHT0 ); - glEnable( GL_LIGHTING ); - - glClearColor( 0.5, 0.5, 0.9, 0.0 ); - - glEnable( GL_NORMALIZE ); -} - - - -static void reshape(int w, int h) -{ - GLfloat yAspect = 2.5; - GLfloat xAspect = yAspect * (float) w / (float) h; - Width = w; - Height = h; - glViewport(0, 0, w, h); - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glFrustum( -xAspect, xAspect, -yAspect, yAspect, 10.0, 30.0 ); - glMatrixMode(GL_MODELVIEW); - glLoadIdentity(); -} - - - -static void draw_objects( GLfloat eyex, GLfloat eyey, GLfloat eyez ) -{ - (void) eyex; - (void) eyey; - (void) eyez; -#ifndef USE_ZBUFFER - if (eyex<0.5) { -#endif - glPushMatrix(); - glTranslatef( 1.0, 1.5, 0.0 ); - glRotatef( spin, 1.0, 0.5, 0.0 ); - glRotatef( 0.5*spin, 0.0, 0.5, 1.0 ); - glCallList( objects_list[0] ); - glPopMatrix(); - - glPushMatrix(); - glTranslatef( -1.0, 0.85+3.0*fabs( cos(0.01*spin) ), 0.0 ); - glRotatef( 0.5*spin, 0.0, 0.5, 1.0 ); - glRotatef( spin, 1.0, 0.5, 0.0 ); - glScalef( 0.5, 0.5, 0.5 ); - glCallList( objects_list[1] ); - glPopMatrix(); -#ifndef USE_ZBUFFER - } - else { - glPushMatrix(); - glTranslatef( -1.0, 0.85+3.0*fabs( cos(0.01*spin) ), 0.0 ); - glRotatef( 0.5*spin, 0.0, 0.5, 1.0 ); - glRotatef( spin, 1.0, 0.5, 0.0 ); - glScalef( 0.5, 0.5, 0.5 ); - glCallList( objects_list[1] ); - glPopMatrix(); - - glPushMatrix(); - glTranslatef( 1.0, 1.5, 0.0 ); - glRotatef( spin, 1.0, 0.5, 0.0 ); - glRotatef( 0.5*spin, 0.0, 0.5, 1.0 ); - glCallList( objects_list[0] ); - glPopMatrix(); - } -#endif -} - - - -static void draw_table( void ) -{ - glCallList( table_list ); -} - - - -static void draw( void ) -{ - static GLfloat light_pos[] = { 0.0, 20.0, 0.0, 1.0 }; - GLfloat dist = 20.0; - GLfloat eyex, eyey, eyez; - - glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); - - - eyex = dist * cos(yrot*DEG2RAD) * cos(xrot*DEG2RAD); - eyez = dist * sin(yrot*DEG2RAD) * cos(xrot*DEG2RAD); - eyey = dist * sin(xrot*DEG2RAD); - - /* view from top */ - glPushMatrix(); - gluLookAt( eyex, eyey, eyez, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0 ); - - glLightfv( GL_LIGHT0, GL_POSITION, light_pos ); - - /* draw table into stencil planes */ - glDisable( GL_DEPTH_TEST ); - glEnable( GL_STENCIL_TEST ); - glStencilFunc( GL_ALWAYS, 1, 0xffffffff ); - glStencilOp( GL_REPLACE, GL_REPLACE, GL_REPLACE ); - glColorMask( GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE ); - draw_table(); - glColorMask( GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE ); - - glEnable( GL_DEPTH_TEST ); - - /* render view from below (reflected viewport) */ - /* only draw where stencil==1 */ - if (eyey>0.0) { - glPushMatrix(); - - glStencilFunc( GL_EQUAL, 1, 0xffffffff ); /* draw if ==1 */ - glStencilOp( GL_KEEP, GL_KEEP, GL_KEEP ); - glScalef( 1.0, -1.0, 1.0 ); - - /* Reposition light in reflected space. */ - glLightfv(GL_LIGHT0, GL_POSITION, light_pos); - - draw_objects(eyex, eyey, eyez); - glPopMatrix(); - - /* Restore light's original unreflected position. */ - glLightfv(GL_LIGHT0, GL_POSITION, light_pos); - } - - glDisable( GL_STENCIL_TEST ); - - glEnable( GL_BLEND ); - glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA ); - - glEnable( GL_TEXTURE_2D ); - draw_table(); - glDisable( GL_TEXTURE_2D ); - glDisable( GL_BLEND ); - - /* view from top */ - glPushMatrix(); - - draw_objects(eyex, eyey, eyez); - - glPopMatrix(); - - glPopMatrix(); - - if (ShowBuffer == GL_DEPTH) { - ShowDepthBuffer(Width, Height, 1.0, 0.0); - } - else if (ShowBuffer == GL_STENCIL) { - ShowStencilBuffer(Width, Height, 255.0, 0.0); - } - else if (ShowBuffer == GL_ALPHA) { - ShowAlphaBuffer(Width, Height); - } -} - -/*******************************/ - -int main( int argc, char *argv[] ) -{ - int quit = 0; - DFBResult err; - DFBSurfaceDescription dsc; - - DFBCHECK(DirectFBInit( &argc, &argv )); - - /* create the super interface */ - DFBCHECK(DirectFBCreate( &dfb )); - - /* create an event buffer for all devices with these caps */ - DFBCHECK(dfb->CreateInputEventBuffer( dfb, DICAPS_ALL, DFB_FALSE, &events )); - - /* set our cooperative level to DFSCL_FULLSCREEN - for exclusive access to the primary layer */ - dfb->SetCooperativeLevel( dfb, DFSCL_FULLSCREEN ); - - /* get the primary surface, i.e. the surface of the - primary layer we have exclusive access to */ - dsc.flags = DSDESC_CAPS; - dsc.caps = (DFBSurfaceCapabilities)(DSCAPS_PRIMARY | DSCAPS_DOUBLE); - - DFBCHECK(dfb->CreateSurface( dfb, &dsc, &primary )); - - /* get the size of the surface and fill it */ - DFBCHECK(primary->GetSize( primary, &screen_width, &screen_height )); - DFBCHECK(primary->FillRectangle( primary, 0, 0, - screen_width, screen_height )); - - /* create the default font and set it */ - DFBCHECK(dfb->CreateFont( dfb, NULL, NULL, &font )); - DFBCHECK(primary->SetFont( primary, font )); - - /* get the GL context */ - DFBCHECK(primary->GetGL( primary, &primary_gl )); - - DFBCHECK(primary_gl->Lock( primary_gl )); - - init(); - reshape(screen_width, screen_height); - - DFBCHECK(primary_gl->Unlock( primary_gl )); - - T0 = get_millis(); - - while (!quit) { - DFBInputEvent evt; - unsigned long t; - - DFBCHECK(primary_gl->Lock( primary_gl )); - - draw(); - - DFBCHECK(primary_gl->Unlock( primary_gl )); - - if (fps) { - char buf[64]; - - sprintf(buf, "%4.1f FPS\n", fps); - primary->SetColor( primary, 0xff, 0, 0, 0xff ); - primary->DrawString( primary, buf, -1, screen_width - 5, 5, DSTF_TOPRIGHT ); - } - - primary->Flip( primary, NULL, (DFBSurfaceFlipFlags)0 ); - Frames++; - - - t = get_millis(); - if (t - T0 >= 1000) { - GLfloat seconds = (t - T0) / 1000.0; - - fps = Frames / seconds; - - T0 = t; - Frames = 0; - } - - - while (events->GetEvent( events, DFB_EVENT(&evt) ) == DFB_OK) { - switch (evt.type) { - case DIET_KEYPRESS: - switch (DFB_LOWER_CASE(evt.key_symbol)) { - case DIKS_ESCAPE: - quit = 1; - break; - case DIKS_CURSOR_UP: - xrot += 3.0; - if ( xrot > 85 ) - xrot = 85; - break; - case DIKS_CURSOR_DOWN: - xrot -= 3.0; - if ( xrot < 5 ) - xrot = 5; - break; - case DIKS_CURSOR_LEFT: - yrot += 3.0; - break; - case DIKS_CURSOR_RIGHT: - yrot -= 3.0; - break; - case DIKS_SMALL_D: - ShowBuffer = GL_DEPTH; - break; - case DIKS_SMALL_S: - ShowBuffer = GL_STENCIL; - break; - case DIKS_SMALL_A: - ShowBuffer = GL_ALPHA; - break; - default: - ShowBuffer = GL_NONE; - } - break; - case DIET_AXISMOTION: - if (evt.flags & DIEF_AXISREL) { - switch (evt.axis) { - case DIAI_X: - yrot += evt.axisrel / 2.0; - break; - case DIAI_Y: - xrot += evt.axisrel / 2.0; - break; - default: - ; - } - } - break; - default: - ; - } - } - - spin += 2.0; - yrot += 3.0; - } - - /* release our interfaces to shutdown DirectFB */ - primary_gl->Release( primary_gl ); - primary->Release( primary ); - font->Release( font ); - events->Release( events ); - dfb->Release( dfb ); - - return 0; -} - diff --git a/progs/directfb/multi_window.c b/progs/directfb/multi_window.c deleted file mode 100644 index 9bb0e4be8e..0000000000 --- a/progs/directfb/multi_window.c +++ /dev/null @@ -1,240 +0,0 @@ -/* - (c) Copyright 2001 convergence integrated media GmbH. - All rights reserved. - - Written by Denis Oliver Kropp and - Andreas Hundt . - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the - Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. -*/ - -#include -#include -#include -#include - -#include -#include - -#include -#include - - -typedef struct { - IDirectFBWindow *window; - IDirectFBSurface *surface; - IDirectFBGL *gl; - - int width; - int height; - - unsigned long last_time; - int frames; - float fps; -} Context; - -static const GLfloat blue[4] = {0.2, 0.2, 1.0, 1.0}; - -static IDirectFB *dfb; -static IDirectFBDisplayLayer *layer; -static IDirectFBFont *font; -static IDirectFBEventBuffer *events = NULL; - -/* macro for a safe call to DirectFB functions */ -#define DFBCHECK(x...) \ - do { \ - ret = x; \ - if (ret != DFB_OK) { \ - fprintf( stderr, "%s <%d>:\n\t", __FILE__, __LINE__ ); \ - DirectFBErrorFatal( #x, ret ); \ - } \ - } while (0) - - -static inline unsigned long get_millis() -{ - struct timeval tv; - - gettimeofday (&tv, NULL); - return (tv.tv_sec * 1000 + tv.tv_usec / 1000); -} - - -static void -setup( Context *context ) -{ - GLfloat pos[4] = {5.0, 5.0, 10.0, 0.0}; - - context->surface->GetSize( context->surface, - &context->width, &context->height ); - - context->gl->Lock( context->gl ); - - glLightfv(GL_LIGHT0, GL_POSITION, pos); - glEnable(GL_CULL_FACE); - glEnable(GL_LIGHTING); - glEnable(GL_LIGHT0); - glEnable(GL_DEPTH_TEST); - - glViewport(0, 0, context->width, context->height); - - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - gluPerspective(70.0, context->width / (float) context->height, 1.0, 80.0); - - glMatrixMode(GL_MODELVIEW); - glLoadIdentity(); - glTranslatef(0.0, 0.0, -40.0); - - context->gl->Unlock( context->gl ); -} - -static void -update( Context *context ) -{ - unsigned long t; - IDirectFBSurface *surface = context->surface; - static __u8 r = 0, g = 0, b = 0; - - - context->gl->Lock( context->gl ); - - glClearColor( r++/255.0, g++/255.0, b++/255.0, 1.0 ); - glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); - - context->gl->Unlock( context->gl ); - - if (context->fps) { - char buf[16]; - - snprintf(buf, sizeof(buf), "%.1f FPS\n", context->fps); - - surface->SetColor( surface, 0xff, 0x00, 0x00, 0xff ); - surface->DrawString( surface, buf, -1, - context->width - 5, 5, DSTF_TOPRIGHT ); - } - - surface->Flip( surface, NULL, 0 ); - - context->frames++; - - t = get_millis(); - if (t - context->last_time >= 2000) { - float seconds = (t - context->last_time) / 1000.0f; - - context->fps = context->frames / seconds; - - context->last_time = t; - context->frames = 0; - } -} - -int -main( int argc, char *argv[] ) -{ - DFBResult ret; - int i; - int quit = 0; - const int num = 2; - Context contexts[num]; - - DFBCHECK(DirectFBInit( &argc, &argv )); - - /* create the super interface */ - DFBCHECK(DirectFBCreate( &dfb )); - - DFBCHECK(dfb->GetDisplayLayer( dfb, DLID_PRIMARY, &layer )); - - /* create the default font */ - DFBCHECK(dfb->CreateFont( dfb, NULL, NULL, &font )); - - for (i=0; iCreateWindow( layer, &desc, &window )); - DFBCHECK(window->GetSurface( window, &surface )); - DFBCHECK(surface->GetGL( surface, &gl )); - - contexts[i].window = window; - contexts[i].surface = surface; - contexts[i].gl = gl; - - contexts[i].last_time = get_millis(); - contexts[i].frames = 0; - contexts[i].fps = 0; - - setup( &contexts[i] ); - - if (events) - DFBCHECK(window->AttachEventBuffer( window, events )); - else - DFBCHECK(window->CreateEventBuffer( window, &events )); - - DFBCHECK(surface->SetFont( surface, font )); - - window->SetOpacity( window, 0xff ); - } - - while (!quit) { - DFBWindowEvent evt; - - for (i=0; iGetEvent( events, DFB_EVENT(&evt) ) == DFB_OK) { - switch (evt.type) { - case DWET_KEYDOWN: - switch (evt.key_symbol) { - case DIKS_ESCAPE: - quit = 1; - break; - - default: - break; - } - break; - - default: - break; - } - } - } - - events->Release( events ); - - for (i=0; iRelease( contexts[i].gl ); - contexts[i].surface->Release( contexts[i].surface ); - contexts[i].window->Release( contexts[i].window ); - } - - font->Release( font ); - layer->Release( layer ); - dfb->Release( dfb ); - - return 0; -} - diff --git a/progs/egl/.gitignore b/progs/egl/.gitignore deleted file mode 100644 index 1751108235..0000000000 --- a/progs/egl/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -demo1 -demo2 -demo3 -eglgears -eglinfo diff --git a/progs/egl/Makefile b/progs/egl/Makefile deleted file mode 100644 index 416d2c04b2..0000000000 --- a/progs/egl/Makefile +++ /dev/null @@ -1,65 +0,0 @@ -# progs/egl/Makefile - -TOP = ../.. -include $(TOP)/configs/current - - -INCLUDE_DIRS = -I$(TOP)/include - -HEADERS = $(TOP)/include/GLES/egl.h - -PROGRAMS = \ - demo1 \ - demo2 \ - demo3 \ - eglinfo \ - eglgears - - -.c.o: - $(CC) -c $(INCLUDE_DIRS) $(CFLAGS) $< -o $@ - - - -default: $(PROGRAMS) - - -demo1: demo1.o $(TOP)/$(LIB_DIR)/libEGL.so - $(CC) $(CFLAGS) $(LDFLAGS) demo1.o -L$(TOP)/$(LIB_DIR) -lEGL $(LIBDRM_LIB) -o $@ - -demo1.o: demo1.c $(HEADERS) - $(CC) -c $(CFLAGS) -I$(TOP)/include demo1.c - - -demo2: demo2.o $(TOP)/$(LIB_DIR)/libEGL.so - $(CC) $(CFLAGS) $(LDFLAGS) demo2.o -L$(TOP)/$(LIB_DIR) -lEGL $(LIBDRM_LIB) $(APP_LIB_DEPS) -o $@ - -demo2.o: demo2.c $(HEADERS) - $(CC) -c $(CFLAGS) -I$(TOP)/include demo2.c - - -demo3: demo3.o $(TOP)/$(LIB_DIR)/libEGL.so - $(CC) $(CFLAGS) $(LDFLAGS) demo3.o -L$(TOP)/$(LIB_DIR) -lEGL $(LIBDRM_LIB) $(APP_LIB_DEPS) -o $@ - -demo3.o: demo3.c $(HEADERS) - $(CC) -c $(CFLAGS) -I$(TOP)/include demo3.c - - -eglinfo: eglinfo.o $(TOP)/$(LIB_DIR)/libEGL.so - $(CC) $(CFLAGS) $(LDFLAGS) eglinfo.o -L$(TOP)/$(LIB_DIR) -lEGL $(LIBDRM_LIB) -o $@ - -eglinfo.o: eglinfo.c $(HEADERS) - $(CC) -c $(CFLAGS) -I$(TOP)/include eglinfo.c - - -eglgears: eglgears.o $(TOP)/$(LIB_DIR)/libEGL.so - $(CC) $(CFLAGS) $(LDFLAGS) eglgears.o -L$(TOP)/$(LIB_DIR) -lEGL $(LIBDRM_LIB) $(APP_LIB_DEPS) -o $@ - -eglgears.o: eglgears.c $(HEADERS) - $(CC) -c $(CFLAGS) -I$(TOP)/include eglgears.c - - -clean: - -rm -f *.o *~ - -rm -f *.so - -rm -f $(PROGRAMS) diff --git a/progs/egl/demo1.c b/progs/egl/demo1.c deleted file mode 100644 index 9ef17e38b7..0000000000 --- a/progs/egl/demo1.c +++ /dev/null @@ -1,145 +0,0 @@ -/* - * Exercise EGL API functions - */ - -#include -#include -#include -#include -#include - - -/** - * Test EGL_MESA_screen_surface functions - */ -static void -TestScreens(EGLDisplay dpy) -{ -#define MAX 8 - EGLScreenMESA screens[MAX]; - EGLint numScreens; - EGLint i; - - eglGetScreensMESA(dpy, screens, MAX, &numScreens); - printf("Found %d screens\n", numScreens); - for (i = 0; i < numScreens; i++) { - printf(" Screen %d handle: %d\n", i, (int) screens[i]); - } -} - -/** - * Print table of all available configurations. - */ -static void -PrintConfigs(EGLDisplay d) -{ - EGLConfig *configs; - EGLint numConfigs, i; - - eglGetConfigs(d, NULL, 0, &numConfigs); - configs = malloc(sizeof(*configs) *numConfigs); - eglGetConfigs(d, configs, numConfigs, &numConfigs); - - printf("Configurations:\n"); - printf(" bf lv d st colorbuffer dp st supported \n"); - printf(" id sz l b ro r g b a th cl surfaces \n"); - printf("----------------------------------------------\n"); - for (i = 0; i < numConfigs; i++) { - EGLint id, size, level; - EGLint red, green, blue, alpha; - EGLint depth, stencil; - EGLint surfaces; - EGLint doubleBuf = 1, stereo = 0; - char surfString[100] = ""; - - eglGetConfigAttrib(d, configs[i], EGL_CONFIG_ID, &id); - eglGetConfigAttrib(d, configs[i], EGL_BUFFER_SIZE, &size); - eglGetConfigAttrib(d, configs[i], EGL_LEVEL, &level); - - eglGetConfigAttrib(d, configs[i], EGL_RED_SIZE, &red); - eglGetConfigAttrib(d, configs[i], EGL_GREEN_SIZE, &green); - eglGetConfigAttrib(d, configs[i], EGL_BLUE_SIZE, &blue); - eglGetConfigAttrib(d, configs[i], EGL_ALPHA_SIZE, &alpha); - eglGetConfigAttrib(d, configs[i], EGL_DEPTH_SIZE, &depth); - eglGetConfigAttrib(d, configs[i], EGL_STENCIL_SIZE, &stencil); - eglGetConfigAttrib(d, configs[i], EGL_SURFACE_TYPE, &surfaces); - - if (surfaces & EGL_WINDOW_BIT) - strcat(surfString, "win,"); - if (surfaces & EGL_PBUFFER_BIT) - strcat(surfString, "pb,"); - if (surfaces & EGL_PIXMAP_BIT) - strcat(surfString, "pix,"); - if (strlen(surfString) > 0) - surfString[strlen(surfString) - 1] = 0; - - printf("0x%02x %2d %2d %c %c %2d %2d %2d %2d %2d %2d %-12s\n", - id, size, level, - doubleBuf ? 'y' : '.', - stereo ? 'y' : '.', - red, green, blue, alpha, - depth, stencil, surfString); - } - free(configs); -} - - - -int -main(int argc, char *argv[]) -{ - int maj, min; - EGLContext ctx; - EGLSurface pbuffer; - EGLConfig configs[10]; - EGLBoolean b; - const EGLint pbufAttribs[] = { - EGL_WIDTH, 500, - EGL_HEIGHT, 500, - EGL_NONE - }; - - /* - EGLDisplay d = eglGetDisplay(EGL_DEFAULT_DISPLAY); - */ - EGLDisplay d = eglGetDisplay("!fb_dri"); - assert(d); - - if (!eglInitialize(d, &maj, &min)) { - printf("demo: eglInitialize failed\n"); - exit(1); - } - - printf("EGL version = %d.%d\n", maj, min); - printf("EGL_VENDOR = %s\n", eglQueryString(d, EGL_VENDOR)); - - PrintConfigs(d); - - ctx = eglCreateContext(d, configs[0], EGL_NO_CONTEXT, NULL); - if (ctx == EGL_NO_CONTEXT) { - printf("failed to create context\n"); - return 0; - } - - pbuffer = eglCreatePbufferSurface(d, configs[0], pbufAttribs); - if (pbuffer == EGL_NO_SURFACE) { - printf("failed to create pbuffer\n"); - return 0; - } - - b = eglMakeCurrent(d, pbuffer, pbuffer, ctx); - if (!b) { - printf("make current failed\n"); - return 0; - } - - b = eglMakeCurrent(d, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); - - TestScreens(d); - - eglDestroySurface(d, pbuffer); - eglDestroyContext(d, ctx); - eglTerminate(d); - - return 0; -} diff --git a/progs/egl/demo2.c b/progs/egl/demo2.c deleted file mode 100644 index 17bbca6158..0000000000 --- a/progs/egl/demo2.c +++ /dev/null @@ -1,190 +0,0 @@ -/* - * Exercise EGL API functions - */ - -#include -#include -#include -#include - -#include - -/*#define FRONTBUFFER*/ - -static void _subset_Rectf(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2) -{ - glBegin( GL_QUADS ); - glVertex2f( x1, y1 ); - glVertex2f( x2, y1 ); - glVertex2f( x2, y2 ); - glVertex2f( x1, y2 ); - glEnd(); -} - - -static void redraw(EGLDisplay dpy, EGLSurface surf, int rot) -{ - printf("Redraw event\n"); - -#ifdef FRONTBUFFER - glDrawBuffer( GL_FRONT ); -#else - glDrawBuffer( GL_BACK ); -#endif - - glClearColor( rand()/(float)RAND_MAX, - rand()/(float)RAND_MAX, - rand()/(float)RAND_MAX, - 1); - - glClear( GL_COLOR_BUFFER_BIT ); - - glColor3f( rand()/(float)RAND_MAX, - rand()/(float)RAND_MAX, - rand()/(float)RAND_MAX ); - glPushMatrix(); - glRotatef(rot, 0, 0, 1); - glScalef(.5, .5, .5); - _subset_Rectf( -1, -1, 1, 1 ); - glPopMatrix(); - -#ifdef FRONTBUFFER - glFlush(); -#else - eglSwapBuffers( dpy, surf ); -#endif - glFinish(); -} - - -/** - * Test EGL_MESA_screen_surface functions - */ -static void -TestScreens(EGLDisplay dpy) -{ -#define MAX 8 - EGLScreenMESA screens[MAX]; - EGLint numScreens; - EGLint i; - - eglGetScreensMESA(dpy, screens, MAX, &numScreens); - printf("Found %d screens\n", numScreens); - for (i = 0; i < numScreens; i++) { - printf(" Screen %d handle: %d\n", i, (int) screens[i]); - } -} - - -int -main(int argc, char *argv[]) -{ - int maj, min; - EGLContext ctx; - EGLSurface pbuffer, screen_surf; - EGLConfig configs[10]; - EGLint numConfigs, i; - EGLBoolean b; - const EGLint pbufAttribs[] = { - EGL_WIDTH, 500, - EGL_HEIGHT, 500, - EGL_NONE - }; - const EGLint screenAttribs[] = { - EGL_WIDTH, 1024, - EGL_HEIGHT, 768, - EGL_NONE - }; - EGLModeMESA mode; - EGLScreenMESA screen; - EGLint count; - - /* - EGLDisplay d = eglGetDisplay(EGL_DEFAULT_DISPLAY); - */ - EGLDisplay d = eglGetDisplay("!fb_dri"); - assert(d); - - if (!eglInitialize(d, &maj, &min)) { - printf("demo: eglInitialize failed\n"); - exit(1); - } - - printf("EGL version = %d.%d\n", maj, min); - printf("EGL_VENDOR = %s\n", eglQueryString(d, EGL_VENDOR)); - - eglGetConfigs(d, configs, 10, &numConfigs); - printf("Got %d EGL configs:\n", numConfigs); - for (i = 0; i < numConfigs; i++) { - EGLint id, red, depth; - eglGetConfigAttrib(d, configs[i], EGL_CONFIG_ID, &id); - eglGetConfigAttrib(d, configs[i], EGL_RED_SIZE, &red); - eglGetConfigAttrib(d, configs[i], EGL_DEPTH_SIZE, &depth); - printf("%2d: Red Size = %d Depth Size = %d\n", id, red, depth); - } - - eglGetScreensMESA(d, &screen, 1, &count); - eglGetModesMESA(d, screen, &mode, 1, &count); - - ctx = eglCreateContext(d, configs[0], EGL_NO_CONTEXT, NULL); - if (ctx == EGL_NO_CONTEXT) { - printf("failed to create context\n"); - return 0; - } - - pbuffer = eglCreatePbufferSurface(d, configs[0], pbufAttribs); - if (pbuffer == EGL_NO_SURFACE) { - printf("failed to create pbuffer\n"); - return 0; - } - - b = eglMakeCurrent(d, pbuffer, pbuffer, ctx); - if (!b) { - printf("make current failed\n"); - return 0; - } - - b = eglMakeCurrent(d, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); - - screen_surf = eglCreateScreenSurfaceMESA(d, configs[0], screenAttribs); - if (screen_surf == EGL_NO_SURFACE) { - printf("failed to create screen surface\n"); - return 0; - } - - eglShowScreenSurfaceMESA(d, screen, screen_surf, mode); - - b = eglMakeCurrent(d, screen_surf, screen_surf, ctx); - if (!b) { - printf("make current failed\n"); - return 0; - } - - glViewport(0, 0, 1024, 768); - glDrawBuffer( GL_FRONT ); - - glClearColor( 0, - 1.0, - 0, - 1); - - glClear( GL_COLOR_BUFFER_BIT ); - - - TestScreens(d); - - glShadeModel( GL_FLAT ); - - for (i = 0; i < 6; i++) { - redraw(d, screen_surf, i*10 ); - - printf("sleep(1)\n"); - sleep(1); - } - - eglDestroySurface(d, pbuffer); - eglDestroyContext(d, ctx); - eglTerminate(d); - - return 0; -} diff --git a/progs/egl/demo3.c b/progs/egl/demo3.c deleted file mode 100644 index 9edf7c952b..0000000000 --- a/progs/egl/demo3.c +++ /dev/null @@ -1,636 +0,0 @@ -/* - * Exercise EGL API functions - */ - -#include -#include -#include -#include -#include - - - -#define PIXEL_CENTER(x) ((long)(x) + 0.5) - -#define GAP 10 -#define ROWS 3 -#define COLS 4 - -#define OPENGL_WIDTH 48 -#define OPENGL_HEIGHT 13 - - -GLenum rgb, doubleBuffer, windType; -GLint windW, windH; - -GLenum mode1, mode2; -GLint boxW, boxH; -GLubyte OpenGL_bits[] = { - 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, - 0x7f, 0xfb, 0xff, 0xff, 0xff, 0x01, - 0x7f, 0xfb, 0xff, 0xff, 0xff, 0x01, - 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, - 0x3e, 0x8f, 0xb7, 0xf9, 0xfc, 0x01, - 0x63, 0xdb, 0xb0, 0x8d, 0x0d, 0x00, - 0x63, 0xdb, 0xb7, 0x8d, 0x0d, 0x00, - 0x63, 0xdb, 0xb6, 0x8d, 0x0d, 0x00, - 0x63, 0x8f, 0xf3, 0xcc, 0x0d, 0x00, - 0x63, 0x00, 0x00, 0x0c, 0x4c, 0x0a, - 0x63, 0x00, 0x00, 0x0c, 0x4c, 0x0e, - 0x63, 0x00, 0x00, 0x8c, 0xed, 0x0e, - 0x3e, 0x00, 0x00, 0xf8, 0x0c, 0x00, -}; - - -static void Init(void) -{ - - mode1 = GL_TRUE; - mode2 = GL_TRUE; -} - -static void Reshape(int width, int height) -{ - - windW = (GLint)width; - windH = (GLint)height; -} - -#if 0 -static void RotateColorMask(void) -{ - static GLint rotation = 0; - - rotation = (rotation + 1) & 0x3; - switch (rotation) { - case 0: - glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); - glIndexMask( 0xff ); - break; - case 1: - glColorMask(GL_FALSE, GL_TRUE, GL_TRUE, GL_TRUE); - glIndexMask(0xFE); - break; - case 2: - glColorMask(GL_TRUE, GL_FALSE, GL_TRUE, GL_TRUE); - glIndexMask(0xFD); - break; - case 3: - glColorMask(GL_TRUE, GL_TRUE, GL_FALSE, GL_TRUE); - glIndexMask(0xFB); - break; - } -} -#endif - -static void Viewport(GLint row, GLint column) -{ - GLint x, y; - - boxW = (windW - (COLS + 1) * GAP) / COLS; - boxH = (windH - (ROWS + 1) * GAP) / ROWS; - - x = GAP + column * (boxW + GAP); - y = GAP + row * (boxH + GAP); - - glViewport(x, y, boxW, boxH); - - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glOrtho(-boxW/2, boxW/2, -boxH/2, boxH/2, 0.0, 1.0); - glMatrixMode(GL_MODELVIEW); - - glEnable(GL_SCISSOR_TEST); - glScissor(x, y, boxW, boxH); -} - -enum { - COLOR_BLACK = 0, - COLOR_RED, - COLOR_GREEN, - COLOR_YELLOW, - COLOR_BLUE, - COLOR_MAGENTA, - COLOR_CYAN, - COLOR_WHITE -}; - -static float RGBMap[9][3] = { - {0, 0, 0}, - {1, 0, 0}, - {0, 1, 0}, - {1, 1, 0}, - {0, 0, 1}, - {1, 0, 1}, - {0, 1, 1}, - {1, 1, 1}, - {0.5, 0.5, 0.5} -}; - -static void SetColor(int c) -{ - glColor3fv(RGBMap[c]); -} - -static void Point(void) -{ - GLint i; - - glBegin(GL_POINTS); - SetColor(COLOR_WHITE); - glVertex2i(0, 0); - for (i = 1; i < 8; i++) { - GLint j = i * 2; - SetColor(COLOR_BLACK+i); - glVertex2i(-j, -j); - glVertex2i(-j, 0); - glVertex2i(-j, j); - glVertex2i(0, j); - glVertex2i(j, j); - glVertex2i(j, 0); - glVertex2i(j, -j); - glVertex2i(0, -j); - } - glEnd(); -} - -static void Lines(void) -{ - GLint i; - - glPushMatrix(); - - glTranslatef(-12, 0, 0); - for (i = 1; i < 8; i++) { - SetColor(COLOR_BLACK+i); - glBegin(GL_LINES); - glVertex2i(-boxW/4, -boxH/4); - glVertex2i(boxW/4, boxH/4); - glEnd(); - glTranslatef(4, 0, 0); - } - - glPopMatrix(); - - glBegin(GL_LINES); - glVertex2i(0, 0); - glEnd(); -} - -static void LineStrip(void) -{ - - glBegin(GL_LINE_STRIP); - SetColor(COLOR_RED); - glVertex2f(PIXEL_CENTER(-boxW/4), PIXEL_CENTER(-boxH/4)); - SetColor(COLOR_GREEN); - glVertex2f(PIXEL_CENTER(-boxW/4), PIXEL_CENTER(boxH/4)); - SetColor(COLOR_BLUE); - glVertex2f(PIXEL_CENTER(boxW/4), PIXEL_CENTER(boxH/4)); - SetColor(COLOR_WHITE); - glVertex2f(PIXEL_CENTER(boxW/4), PIXEL_CENTER(-boxH/4)); - glEnd(); - - glBegin(GL_LINE_STRIP); - glVertex2i(0, 0); - glEnd(); -} - -static void LineLoop(void) -{ - - glBegin(GL_LINE_LOOP); - SetColor(COLOR_RED); - glVertex2f(PIXEL_CENTER(-boxW/4), PIXEL_CENTER(-boxH/4)); - SetColor(COLOR_GREEN); - glVertex2f(PIXEL_CENTER(-boxW/4), PIXEL_CENTER(boxH/4)); - SetColor(COLOR_BLUE); - glVertex2f(PIXEL_CENTER(boxW/4), PIXEL_CENTER(boxH/4)); - SetColor(COLOR_WHITE); - glVertex2f(PIXEL_CENTER(boxW/4), PIXEL_CENTER(-boxH/4)); - glEnd(); - - glEnable(GL_LOGIC_OP); - glLogicOp(GL_XOR); - - glEnable(GL_BLEND); - glBlendFunc(GL_ONE, GL_ONE); - - SetColor(COLOR_MAGENTA); - glBegin(GL_LINE_LOOP); - glVertex2f(PIXEL_CENTER(-boxW/8), PIXEL_CENTER(-boxH/8)); - glVertex2f(PIXEL_CENTER(-boxW/8), PIXEL_CENTER(boxH/8)); - glEnd(); - glBegin(GL_LINE_LOOP); - glVertex2f(PIXEL_CENTER(-boxW/8), PIXEL_CENTER(boxH/8+5)); - glVertex2f(PIXEL_CENTER(boxW/8), PIXEL_CENTER(boxH/8+5)); - glEnd(); - glDisable(GL_LOGIC_OP); - glDisable(GL_BLEND); - - SetColor(COLOR_GREEN); - glBegin(GL_POINTS); - glVertex2i(0, 0); - glEnd(); - - glBegin(GL_LINE_LOOP); - glVertex2i(0, 0); - glEnd(); -} - -static void Bitmap(void) -{ - - glBegin(GL_LINES); - SetColor(COLOR_GREEN); - glVertex2i(-boxW/2, 0); - glVertex2i(boxW/2, 0); - glVertex2i(0, -boxH/2); - glVertex2i(0, boxH/2); - SetColor(COLOR_RED); - glVertex2i(0, -3); - glVertex2i(0, -3+OPENGL_HEIGHT); - SetColor(COLOR_BLUE); - glVertex2i(0, -3); - glVertex2i(OPENGL_WIDTH, -3); - glEnd(); - - SetColor(COLOR_GREEN); - - glPixelStorei(GL_UNPACK_LSB_FIRST, GL_TRUE); - glPixelStorei(GL_UNPACK_ALIGNMENT, 1); - - glRasterPos2i(0, 0); - glBitmap(OPENGL_WIDTH, OPENGL_HEIGHT, 0, 3, 0.0, 0.0, OpenGL_bits); -} - -static void Triangles(void) -{ - - glBegin(GL_TRIANGLES); - SetColor(COLOR_GREEN); - glVertex2i(-boxW/4, -boxH/4); - SetColor(COLOR_RED); - glVertex2i(-boxW/8, -boxH/16); - SetColor(COLOR_BLUE); - glVertex2i(boxW/8, -boxH/16); - - SetColor(COLOR_GREEN); - glVertex2i(-boxW/4, boxH/4); - SetColor(COLOR_RED); - glVertex2i(-boxW/8, boxH/16); - SetColor(COLOR_BLUE); - glVertex2i(boxW/8, boxH/16); - glEnd(); - - glBegin(GL_TRIANGLES); - glVertex2i(0, 0); - glVertex2i(-100, 100); - glEnd(); -} - -static void TriangleStrip(void) -{ - - glBegin(GL_TRIANGLE_STRIP); - SetColor(COLOR_GREEN); - glVertex2i(-boxW/4, -boxH/4); - SetColor(COLOR_RED); - glVertex2i(-boxW/4, boxH/4); - SetColor(COLOR_BLUE); - glVertex2i(0, -boxH/4); - SetColor(COLOR_WHITE); - glVertex2i(0, boxH/4); - SetColor(COLOR_CYAN); - glVertex2i(boxW/4, -boxH/4); - SetColor(COLOR_YELLOW); - glVertex2i(boxW/4, boxH/4); - glEnd(); - - glBegin(GL_TRIANGLE_STRIP); - glVertex2i(0, 0); - glVertex2i(-100, 100); - glEnd(); -} - -static void TriangleFan(void) -{ - GLint vx[8][2]; - GLint x0, y0, x1, y1, x2, y2, x3, y3; - GLint i; - - y0 = -boxH/4; - y1 = y0 + boxH/2/3; - y2 = y1 + boxH/2/3; - y3 = boxH/4; - x0 = -boxW/4; - x1 = x0 + boxW/2/3; - x2 = x1 + boxW/2/3; - x3 = boxW/4; - - vx[0][0] = x0; vx[0][1] = y1; - vx[1][0] = x0; vx[1][1] = y2; - vx[2][0] = x1; vx[2][1] = y3; - vx[3][0] = x2; vx[3][1] = y3; - vx[4][0] = x3; vx[4][1] = y2; - vx[5][0] = x3; vx[5][1] = y1; - vx[6][0] = x2; vx[6][1] = y0; - vx[7][0] = x1; vx[7][1] = y0; - - glBegin(GL_TRIANGLE_FAN); - SetColor(COLOR_WHITE); - glVertex2i(0, 0); - for (i = 0; i < 8; i++) { - SetColor(COLOR_WHITE-i); - glVertex2iv(vx[i]); - } - glEnd(); - - glBegin(GL_TRIANGLE_FAN); - glVertex2i(0, 0); - glVertex2i(-100, 100); - glEnd(); -} - -static void Rect(void) -{ - - SetColor(COLOR_GREEN); - glRecti(-boxW/4, -boxH/4, boxW/4, boxH/4); -} - -static void PolygonFunc(void) -{ - GLint vx[8][2]; - GLint x0, y0, x1, y1, x2, y2, x3, y3; - GLint i; - - y0 = -boxH/4; - y1 = y0 + boxH/2/3; - y2 = y1 + boxH/2/3; - y3 = boxH/4; - x0 = -boxW/4; - x1 = x0 + boxW/2/3; - x2 = x1 + boxW/2/3; - x3 = boxW/4; - - vx[0][0] = x0; vx[0][1] = y1; - vx[1][0] = x0; vx[1][1] = y2; - vx[2][0] = x1; vx[2][1] = y3; - vx[3][0] = x2; vx[3][1] = y3; - vx[4][0] = x3; vx[4][1] = y2; - vx[5][0] = x3; vx[5][1] = y1; - vx[6][0] = x2; vx[6][1] = y0; - vx[7][0] = x1; vx[7][1] = y0; - - glBegin(GL_POLYGON); - for (i = 0; i < 8; i++) { - SetColor(COLOR_WHITE-i); - glVertex2iv(vx[i]); - } - glEnd(); - - glBegin(GL_POLYGON); - glVertex2i(0, 0); - glVertex2i(100, 100); - glEnd(); -} - -static void Quads(void) -{ - - glBegin(GL_QUADS); - SetColor(COLOR_GREEN); - glVertex2i(-boxW/4, -boxH/4); - SetColor(COLOR_RED); - glVertex2i(-boxW/8, -boxH/16); - SetColor(COLOR_BLUE); - glVertex2i(boxW/8, -boxH/16); - SetColor(COLOR_WHITE); - glVertex2i(boxW/4, -boxH/4); - - SetColor(COLOR_GREEN); - glVertex2i(-boxW/4, boxH/4); - SetColor(COLOR_RED); - glVertex2i(-boxW/8, boxH/16); - SetColor(COLOR_BLUE); - glVertex2i(boxW/8, boxH/16); - SetColor(COLOR_WHITE); - glVertex2i(boxW/4, boxH/4); - glEnd(); - - glBegin(GL_QUADS); - glVertex2i(0, 0); - glVertex2i(100, 100); - glVertex2i(-100, 100); - glEnd(); -} - -static void QuadStrip(void) -{ - - glBegin(GL_QUAD_STRIP); - SetColor(COLOR_GREEN); - glVertex2i(-boxW/4, -boxH/4); - SetColor(COLOR_RED); - glVertex2i(-boxW/4, boxH/4); - SetColor(COLOR_BLUE); - glVertex2i(0, -boxH/4); - SetColor(COLOR_WHITE); - glVertex2i(0, boxH/4); - SetColor(COLOR_CYAN); - glVertex2i(boxW/4, -boxH/4); - SetColor(COLOR_YELLOW); - glVertex2i(boxW/4, boxH/4); - glEnd(); - - glBegin(GL_QUAD_STRIP); - glVertex2i(0, 0); - glVertex2i(100, 100); - glVertex2i(-100, 100); - glEnd(); -} - -static void Draw(EGLDisplay dpy, EGLSurface surf) -{ - - glViewport(0, 0, windW, windH); - glDisable(GL_SCISSOR_TEST); - - glPushAttrib(GL_COLOR_BUFFER_BIT); - - glColorMask(1, 1, 1, 1); - glIndexMask(~0); - - glClearColor(0.0, 0.0, 0.0, 0.0); - glClear(GL_COLOR_BUFFER_BIT); - - glPopAttrib(); - - if (mode1) { - glShadeModel(GL_SMOOTH); - } else { - glShadeModel(GL_FLAT); - } - - if (mode2) { - glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); - } else { - glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); - } - - Viewport(0, 0); Point(); - Viewport(0, 1); Lines(); - Viewport(0, 2); LineStrip(); - Viewport(0, 3); LineLoop(); - - Viewport(1, 0); Bitmap(); - - Viewport(1, 1); TriangleFan(); - Viewport(1, 2); Triangles(); - Viewport(1, 3); TriangleStrip(); - - Viewport(2, 0); Rect(); - Viewport(2, 1); PolygonFunc(); - Viewport(2, 2); Quads(); - Viewport(2, 3); QuadStrip(); - - glFlush(); - - if (doubleBuffer) { - eglSwapBuffers(dpy, surf); - } -} - -static void -write_ppm(const char *filename, const GLubyte *buffer, int width, int height) -{ - const int binary = 0; - FILE *f = fopen( filename, "w" ); - if (f) { - int i, x, y; - const GLubyte *ptr = buffer; - if (binary) { - fprintf(f,"P6\n"); - fprintf(f,"# ppm-file created by osdemo.c\n"); - fprintf(f,"%i %i\n", width,height); - fprintf(f,"255\n"); - fclose(f); - f = fopen( filename, "ab" ); /* reopen in binary append mode */ - for (y=height-1; y>=0; y--) { - for (x=0; x=0; y--) { - for (x=0; xpFB, 1024, 768); - - eglDestroySurface(d, screen_surf); - eglDestroyContext(d, ctx); - eglTerminate(d); - - return 0; -} diff --git a/progs/egl/eglgears.c b/progs/egl/eglgears.c deleted file mode 100644 index 9feee20d88..0000000000 --- a/progs/egl/eglgears.c +++ /dev/null @@ -1,475 +0,0 @@ -/* - * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -/* - * This is a port of the infamous "glxgears" demo to straight EGL - * Port by Dane Rushton 10 July 2005 - * - * No command line options. - * Program runs for 5 seconds then exits, outputing framerate to console - */ - -#include -#include -#include -#include -#include -#include -#include - -#define MAX_CONFIGS 10 -#define MAX_MODES 100 - -#define BENCHMARK - -#ifdef BENCHMARK - -/* XXX this probably isn't very portable */ - -#include -#include - -/* return current time (in seconds) */ -static double -current_time(void) -{ - struct timeval tv; -#ifdef __VMS - (void) gettimeofday(&tv, NULL ); -#else - struct timezone tz; - (void) gettimeofday(&tv, &tz); -#endif - return (double) tv.tv_sec + tv.tv_usec / 1000000.0; -} - -#else /*BENCHMARK*/ - -/* dummy */ -static double -current_time(void) -{ - /* update this function for other platforms! */ - static double t = 0.0; - static int warn = 1; - if (warn) { - fprintf(stderr, "Warning: current_time() not implemented!!\n"); - warn = 0; - } - return t += 1.0; -} - -#endif /*BENCHMARK*/ - - -#ifndef M_PI -#define M_PI 3.14159265 -#endif - - -static GLfloat view_rotx = 20.0, view_roty = 30.0, view_rotz = 0.0; -static GLint gear1, gear2, gear3; -static GLfloat angle = 0.0; - -#if 0 -static GLfloat eyesep = 5.0; /* Eye separation. */ -static GLfloat fix_point = 40.0; /* Fixation point distance. */ -static GLfloat left, right, asp; /* Stereo frustum params. */ -#endif - - -/* - * - * Draw a gear wheel. You'll probably want to call this function when - * building a display list since we do a lot of trig here. - * - * Input: inner_radius - radius of hole at center - * outer_radius - radius at center of teeth - * width - width of gear - * teeth - number of teeth - * tooth_depth - depth of tooth - */ -static void -gear(GLfloat inner_radius, GLfloat outer_radius, GLfloat width, - GLint teeth, GLfloat tooth_depth) -{ - GLint i; - GLfloat r0, r1, r2; - GLfloat angle, da; - GLfloat u, v, len; - - r0 = inner_radius; - r1 = outer_radius - tooth_depth / 2.0; - r2 = outer_radius + tooth_depth / 2.0; - - da = 2.0 * M_PI / teeth / 4.0; - - glShadeModel(GL_FLAT); - - glNormal3f(0.0, 0.0, 1.0); - - /* draw front face */ - glBegin(GL_QUAD_STRIP); - for (i = 0; i <= teeth; i++) { - angle = i * 2.0 * M_PI / teeth; - glVertex3f(r0 * cos(angle), r0 * sin(angle), width * 0.5); - glVertex3f(r1 * cos(angle), r1 * sin(angle), width * 0.5); - if (i < teeth) { - glVertex3f(r0 * cos(angle), r0 * sin(angle), width * 0.5); - glVertex3f(r1 * cos(angle + 3 * da), r1 * sin(angle + 3 * da), - width * 0.5); - } - } - glEnd(); - - /* draw front sides of teeth */ - glBegin(GL_QUADS); - da = 2.0 * M_PI / teeth / 4.0; - for (i = 0; i < teeth; i++) { - angle = i * 2.0 * M_PI / teeth; - - glVertex3f(r1 * cos(angle), r1 * sin(angle), width * 0.5); - glVertex3f(r2 * cos(angle + da), r2 * sin(angle + da), width * 0.5); - glVertex3f(r2 * cos(angle + 2 * da), r2 * sin(angle + 2 * da), - width * 0.5); - glVertex3f(r1 * cos(angle + 3 * da), r1 * sin(angle + 3 * da), - width * 0.5); - } - glEnd(); - - glNormal3f(0.0, 0.0, -1.0); - - /* draw back face */ - glBegin(GL_QUAD_STRIP); - for (i = 0; i <= teeth; i++) { - angle = i * 2.0 * M_PI / teeth; - glVertex3f(r1 * cos(angle), r1 * sin(angle), -width * 0.5); - glVertex3f(r0 * cos(angle), r0 * sin(angle), -width * 0.5); - if (i < teeth) { - glVertex3f(r1 * cos(angle + 3 * da), r1 * sin(angle + 3 * da), - -width * 0.5); - glVertex3f(r0 * cos(angle), r0 * sin(angle), -width * 0.5); - } - } - glEnd(); - - /* draw back sides of teeth */ - glBegin(GL_QUADS); - da = 2.0 * M_PI / teeth / 4.0; - for (i = 0; i < teeth; i++) { - angle = i * 2.0 * M_PI / teeth; - - glVertex3f(r1 * cos(angle + 3 * da), r1 * sin(angle + 3 * da), - -width * 0.5); - glVertex3f(r2 * cos(angle + 2 * da), r2 * sin(angle + 2 * da), - -width * 0.5); - glVertex3f(r2 * cos(angle + da), r2 * sin(angle + da), -width * 0.5); - glVertex3f(r1 * cos(angle), r1 * sin(angle), -width * 0.5); - } - glEnd(); - - /* draw outward faces of teeth */ - glBegin(GL_QUAD_STRIP); - for (i = 0; i < teeth; i++) { - angle = i * 2.0 * M_PI / teeth; - - glVertex3f(r1 * cos(angle), r1 * sin(angle), width * 0.5); - glVertex3f(r1 * cos(angle), r1 * sin(angle), -width * 0.5); - u = r2 * cos(angle + da) - r1 * cos(angle); - v = r2 * sin(angle + da) - r1 * sin(angle); - len = sqrt(u * u + v * v); - u /= len; - v /= len; - glNormal3f(v, -u, 0.0); - glVertex3f(r2 * cos(angle + da), r2 * sin(angle + da), width * 0.5); - glVertex3f(r2 * cos(angle + da), r2 * sin(angle + da), -width * 0.5); - glNormal3f(cos(angle), sin(angle), 0.0); - glVertex3f(r2 * cos(angle + 2 * da), r2 * sin(angle + 2 * da), - width * 0.5); - glVertex3f(r2 * cos(angle + 2 * da), r2 * sin(angle + 2 * da), - -width * 0.5); - u = r1 * cos(angle + 3 * da) - r2 * cos(angle + 2 * da); - v = r1 * sin(angle + 3 * da) - r2 * sin(angle + 2 * da); - glNormal3f(v, -u, 0.0); - glVertex3f(r1 * cos(angle + 3 * da), r1 * sin(angle + 3 * da), - width * 0.5); - glVertex3f(r1 * cos(angle + 3 * da), r1 * sin(angle + 3 * da), - -width * 0.5); - glNormal3f(cos(angle), sin(angle), 0.0); - } - - glVertex3f(r1 * cos(0), r1 * sin(0), width * 0.5); - glVertex3f(r1 * cos(0), r1 * sin(0), -width * 0.5); - - glEnd(); - - glShadeModel(GL_SMOOTH); - - /* draw inside radius cylinder */ - glBegin(GL_QUAD_STRIP); - for (i = 0; i <= teeth; i++) { - angle = i * 2.0 * M_PI / teeth; - glNormal3f(-cos(angle), -sin(angle), 0.0); - glVertex3f(r0 * cos(angle), r0 * sin(angle), -width * 0.5); - glVertex3f(r0 * cos(angle), r0 * sin(angle), width * 0.5); - } - glEnd(); -} - - -static void -draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); - - glPushMatrix(); - glRotatef(view_rotx, 1.0, 0.0, 0.0); - glRotatef(view_roty, 0.0, 1.0, 0.0); - glRotatef(view_rotz, 0.0, 0.0, 1.0); - - glPushMatrix(); - glTranslatef(-3.0, -2.0, 0.0); - glRotatef(angle, 0.0, 0.0, 1.0); - glCallList(gear1); - glPopMatrix(); - - glPushMatrix(); - glTranslatef(3.1, -2.0, 0.0); - glRotatef(-2.0 * angle - 9.0, 0.0, 0.0, 1.0); - glCallList(gear2); - glPopMatrix(); - - glPushMatrix(); - glTranslatef(-3.1, 4.2, 0.0); - glRotatef(-2.0 * angle - 25.0, 0.0, 0.0, 1.0); - glCallList(gear3); - glPopMatrix(); - - glPopMatrix(); -} - - -/* new window size or exposure */ -static void -reshape(int width, int height) -{ - glViewport(0, 0, (GLint) width, (GLint) height); - - GLfloat h = (GLfloat) height / (GLfloat) width; - - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glFrustum(-1.0, 1.0, -h, h, 5.0, 60.0); - - glMatrixMode(GL_MODELVIEW); - glLoadIdentity(); - glTranslatef(0.0, 0.0, -40.0); -} - - - -static void -init(void) -{ - static GLfloat pos[4] = { 5.0, 5.0, 10.0, 0.0 }; - static GLfloat red[4] = { 0.8, 0.1, 0.0, 1.0 }; - static GLfloat green[4] = { 0.0, 0.8, 0.2, 1.0 }; - static GLfloat blue[4] = { 0.2, 0.2, 1.0, 1.0 }; - - glLightfv(GL_LIGHT0, GL_POSITION, pos); - glEnable(GL_CULL_FACE); - glEnable(GL_LIGHTING); - glEnable(GL_LIGHT0); - glEnable(GL_DEPTH_TEST); - - /* make the gears */ - gear1 = glGenLists(1); - glNewList(gear1, GL_COMPILE); - glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, red); - gear(1.0, 4.0, 1.0, 20, 0.7); - glEndList(); - - gear2 = glGenLists(1); - glNewList(gear2, GL_COMPILE); - glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, green); - gear(0.5, 2.0, 2.0, 10, 0.7); - glEndList(); - - gear3 = glGenLists(1); - glNewList(gear3, GL_COMPILE); - glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, blue); - gear(1.3, 2.0, 0.5, 10, 0.7); - glEndList(); - - glEnable(GL_NORMALIZE); -} - - - - -static void run_gears(EGLDisplay dpy, EGLSurface surf, int ttr) -{ - double st = current_time(); - double ct = st; - int frames = 0; - while (ct - st < ttr) - { - double tt = current_time(); - double dt = tt - ct; - ct = tt; - - /* advance rotation for next frame */ - angle += 70.0 * dt; /* 70 degrees per second */ - if (angle > 3600.0) - angle -= 3600.0; - - draw(); - - eglSwapBuffers(dpy, surf); - - - frames++; - } - - GLfloat seconds = ct - st; - GLfloat fps = frames / seconds; - printf("%d frames in %3.1f seconds = %6.3f FPS\n", frames, seconds, fps); - -} - - -int -main(int argc, char *argv[]) -{ - int maj, min; - EGLContext ctx; - EGLSurface screen_surf; - EGLConfig configs[MAX_CONFIGS]; - EGLint numConfigs, i; - EGLBoolean b; - EGLDisplay d; - EGLint screenAttribs[10]; - EGLModeMESA mode[MAX_MODES]; - EGLScreenMESA screen; - EGLint count, chosenMode; - GLboolean printInfo = GL_FALSE; - EGLint width = 0, height = 0; - - /* parse cmd line args */ - for (i = 1; i < argc; i++) - { - if (strcmp(argv[i], "-info") == 0) - { - printInfo = GL_TRUE; - } - else - printf("Warning: unknown parameter: %s\n", argv[i]); - } - - /* DBR : Create EGL context/surface etc */ - d = eglGetDisplay(":0"); - assert(d); - - if (!eglInitialize(d, &maj, &min)) { - printf("eglgears: eglInitialize failed\n"); - exit(1); - } - - printf("eglgears: EGL version = %d.%d\n", maj, min); - printf("eglgears: EGL_VENDOR = %s\n", eglQueryString(d, EGL_VENDOR)); - - /* XXX use ChooseConfig */ - eglGetConfigs(d, configs, MAX_CONFIGS, &numConfigs); - eglGetScreensMESA(d, &screen, 1, &count); - - if (!eglGetModesMESA(d, screen, mode, MAX_MODES, &count) || count == 0) { - printf("eglgears: eglGetModesMESA failed!\n"); - return 0; - } - - /* Print list of modes, and find the one to use */ - printf("eglgears: Found %d modes:\n", count); - for (i = 0; i < count; i++) { - EGLint w, h; - eglGetModeAttribMESA(d, mode[i], EGL_WIDTH, &w); - eglGetModeAttribMESA(d, mode[i], EGL_HEIGHT, &h); - printf("%3d: %d x %d\n", i, w, h); - if (w > width && h > height && w <= 1280 && h <= 1024) { - width = w; - height = h; - chosenMode = i; - } - } - printf("eglgears: Using screen mode/size %d: %d x %d\n", chosenMode, width, height); - - ctx = eglCreateContext(d, configs[0], EGL_NO_CONTEXT, NULL); - if (ctx == EGL_NO_CONTEXT) { - printf("eglgears: failed to create context\n"); - return 0; - } - - /* build up screenAttribs array */ - i = 0; - screenAttribs[i++] = EGL_WIDTH; - screenAttribs[i++] = width; - screenAttribs[i++] = EGL_HEIGHT; - screenAttribs[i++] = height; - screenAttribs[i++] = EGL_NONE; - - screen_surf = eglCreateScreenSurfaceMESA(d, configs[0], screenAttribs); - if (screen_surf == EGL_NO_SURFACE) { - printf("eglgears: failed to create screen surface\n"); - return 0; - } - - b = eglShowScreenSurfaceMESA(d, screen, screen_surf, mode[chosenMode]); - if (!b) { - printf("eglgears: show surface failed\n"); - return 0; - } - - b = eglMakeCurrent(d, screen_surf, screen_surf, ctx); - if (!b) { - printf("eglgears: make current failed\n"); - return 0; - } - - if (printInfo) - { - printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - printf("GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - printf("GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - printf("GL_EXTENSIONS = %s\n", (char *) glGetString(GL_EXTENSIONS)); - } - - init(); - reshape(width, height); - - glDrawBuffer( GL_BACK ); - - run_gears(d, screen_surf, 5.0); - - eglDestroySurface(d, screen_surf); - eglDestroyContext(d, ctx); - eglTerminate(d); - - return 0; -} diff --git a/progs/egl/eglinfo.c b/progs/egl/eglinfo.c deleted file mode 100644 index f9c2475445..0000000000 --- a/progs/egl/eglinfo.c +++ /dev/null @@ -1,166 +0,0 @@ -/* - * eglinfo - like glxinfo but for EGL - * - * Brian Paul - * 11 March 2005 - * - * Copyright (C) 2005 Brian Paul All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - - -#include -#include -#include -#include -#include - -#define MAX_CONFIGS 1000 -#define MAX_MODES 1000 -#define MAX_SCREENS 10 - - -/** - * Print table of all available configurations. - */ -static void -PrintConfigs(EGLDisplay d) -{ - EGLConfig configs[MAX_CONFIGS]; - EGLint numConfigs, i; - - eglGetConfigs(d, configs, MAX_CONFIGS, &numConfigs); - - printf("Configurations:\n"); - printf(" bf lv d st colorbuffer dp st supported\n"); - printf(" id sz l b ro r g b a th cl surfaces \n"); - printf("---------------------------------------------------\n"); - for (i = 0; i < numConfigs; i++) { - EGLint id, size, level; - EGLint red, green, blue, alpha; - EGLint depth, stencil; - EGLint surfaces; - EGLint doubleBuf = 1, stereo = 0; - char surfString[100] = ""; - - eglGetConfigAttrib(d, configs[i], EGL_CONFIG_ID, &id); - eglGetConfigAttrib(d, configs[i], EGL_BUFFER_SIZE, &size); - eglGetConfigAttrib(d, configs[i], EGL_LEVEL, &level); - - eglGetConfigAttrib(d, configs[i], EGL_RED_SIZE, &red); - eglGetConfigAttrib(d, configs[i], EGL_GREEN_SIZE, &green); - eglGetConfigAttrib(d, configs[i], EGL_BLUE_SIZE, &blue); - eglGetConfigAttrib(d, configs[i], EGL_ALPHA_SIZE, &alpha); - eglGetConfigAttrib(d, configs[i], EGL_DEPTH_SIZE, &depth); - eglGetConfigAttrib(d, configs[i], EGL_STENCIL_SIZE, &stencil); - eglGetConfigAttrib(d, configs[i], EGL_SURFACE_TYPE, &surfaces); - - if (surfaces & EGL_WINDOW_BIT) - strcat(surfString, "win,"); - if (surfaces & EGL_PBUFFER_BIT) - strcat(surfString, "pb,"); - if (surfaces & EGL_PIXMAP_BIT) - strcat(surfString, "pix,"); -#ifdef EGL_MESA_screen_surface - if (surfaces & EGL_SCREEN_BIT_MESA) - strcat(surfString, "scrn,"); -#endif - if (strlen(surfString) > 0) - surfString[strlen(surfString) - 1] = 0; - - printf("0x%02x %2d %2d %c %c %2d %2d %2d %2d %2d %2d %-12s\n", - id, size, level, - doubleBuf ? 'y' : '.', - stereo ? 'y' : '.', - red, green, blue, alpha, - depth, stencil, surfString); - } -} - - -/** - * Print table of all available configurations. - */ -static void -PrintModes(EGLDisplay d) -{ -#ifdef EGL_MESA_screen_surface - const char *extensions = eglQueryString(d, EGL_EXTENSIONS); - if (strstr(extensions, "EGL_MESA_screen_surface")) { - EGLScreenMESA screens[MAX_SCREENS]; - EGLint numScreens = 1, scrn; - EGLModeMESA modes[MAX_MODES]; - - eglGetScreensMESA(d, screens, MAX_SCREENS, &numScreens); - printf("Number of Screens: %d\n\n", numScreens); - - for (scrn = 0; scrn < numScreens; scrn++) { - EGLint numModes, i; - - eglGetModesMESA(d, screens[scrn], modes, MAX_MODES, &numModes); - - printf("Screen %d Modes:\n", scrn); - printf(" id width height refresh name\n"); - printf("-----------------------------------------\n"); - for (i = 0; i < numModes; i++) { - EGLint id, w, h, r; - const char *str; - eglGetModeAttribMESA(d, modes[i], EGL_MODE_ID_MESA, &id); - eglGetModeAttribMESA(d, modes[i], EGL_WIDTH, &w); - eglGetModeAttribMESA(d, modes[i], EGL_HEIGHT, &h); - eglGetModeAttribMESA(d, modes[i], EGL_REFRESH_RATE_MESA, &r); - str = eglQueryModeStringMESA(d, modes[i]); - printf("0x%02x %5d %5d %.3f %s\n", id, w, h, r / 1000.0, str); - } - } - } -#endif -} - - - -int -main(int argc, char *argv[]) -{ - int maj, min; - /*EGLDisplay d = eglGetDisplay(EGL_DEFAULT_DISPLAY);*/ - EGLDisplay d = eglGetDisplay(":0"); - - if (!eglInitialize(d, &maj, &min)) { - printf("eglinfo: eglInitialize failed\n"); - exit(1); - } - - printf("EGL API version: %d.%d\n", maj, min); - printf("EGL vendor string: %s\n", eglQueryString(d, EGL_VENDOR)); - printf("EGL version string: %s\n", eglQueryString(d, EGL_VERSION)); - printf("EGL extensions string:\n"); - printf(" %s\n", eglQueryString(d, EGL_EXTENSIONS)); - printf("\n"); - - PrintConfigs(d); - - printf("\n"); - - PrintModes(d); - - eglTerminate(d); - - return 0; -} diff --git a/progs/fbdev/.gitignore b/progs/fbdev/.gitignore deleted file mode 100644 index b9ddf559fd..0000000000 --- a/progs/fbdev/.gitignore +++ /dev/null @@ -1 +0,0 @@ -glfbdevtest diff --git a/progs/fp/.gitignore b/progs/fp/.gitignore deleted file mode 100644 index b265f1fed7..0000000000 --- a/progs/fp/.gitignore +++ /dev/null @@ -1,42 +0,0 @@ -point-position -readtex.c -readtex.h -tri-abs -tri-add -tri-cmp -tri-cos -tri-depth -tri-depth2 -tri-depthwrite -tri-depthwrite2 -tri-dp3 -tri-dp4 -tri-dph -tri-dst -tri-ex2 -tri-flr -tri-frc -tri-kil -tri-lg2 -tri-lit -tri-lrp -tri-mad -tri-max -tri-min -tri-mov -tri-mul -tri-param -tri-position -tri-pow -tri-rcp -tri-rsq -tri-scs -tri-sge -tri-sge2 -tri-sin -tri-slt -tri-sub -tri-swz -tri-swz2 -tri-tex -tri-xpd diff --git a/progs/fp/Makefile b/progs/fp/Makefile deleted file mode 100644 index 3e52474777..0000000000 --- a/progs/fp/Makefile +++ /dev/null @@ -1,128 +0,0 @@ -# progs/tests/Makefile - - -# These programs aren't intended to be included with the normal distro. -# They're not too interesting but they're good for testing. - -TOP = ../.. -include $(TOP)/configs/current - - -LIBS = -L$(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) $(APP_LIB_DEPS) - -SOURCES = \ - tri-abs.c \ - tri-add.c \ - tri-cmp.c \ - tri-cos.c \ - tri-dp3.c \ - tri-dp4.c \ - tri-dph.c \ - tri-dst.c \ - tri-ex2.c \ - tri-flr.c \ - tri-frc.c \ - tri-kil.c \ - tri-lg2.c \ - tri-lit.c \ - tri-lrp.c \ - tri-mad.c \ - tri-max.c \ - tri-min.c \ - tri-mov.c \ - tri-mul.c \ - tri-pow.c \ - tri-param.c \ - tri-rcp.c \ - tri-rsq.c \ - tri-scs.c \ - tri-sge.c \ - tri-sge2.c \ - tri-sin.c \ - tri-slt.c \ - tri-sub.c \ - tri-swz.c \ - tri-swz2.c \ - tri-tex.c \ - tri-xpd.c \ - tri-position.c \ - point-position.c \ - tri-depth.c \ - tri-depth2.c \ - tri-depthwrite.c \ - tri-depthwrite2.c \ - -NOTDONE=\ - tri-txb.c \ - tri-txp.c \ - tri-depthwrite.c \ - tri-fogoption.c - - -PROGS = $(SOURCES:%.c=%) - -INCLUDES = -I. -I$(TOP)/include -I../samples - -UTIL_FILES = readtex.h readtex.c - - -##### RULES ##### - -.SUFFIXES: -.SUFFIXES: .c - -.c: - $(CC) $(INCLUDES) $(CFLAGS) $(LDFLAGS) $< $(LIBS) -o $@ - -.c.o: - $(CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) $< -o $@ - -.S.o: - $(CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) $< -o $@ - - -##### TARGETS ##### - -default: $(UTIL_FILES) $(PROGS) - -clean: - -rm -f $(PROGS) - -rm -f *.o - -rm -f getproclist.h - - -# auto code generation -getprocaddress: getprocaddress.c getproclist.h - -getproclist.h: $(TOP)/src/mesa/glapi/gl_API.xml getprocaddress.c getprocaddress.py - python getprocaddress.py > getproclist.h - - -texrect: texrect.o readtex.o - $(CC) $(CFLAGS) $(LDFLAGS) texrect.o readtex.o $(LIBS) -o $@ - -texrect.o: texrect.c readtex.h - $(CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) $< -o $@ - -invert: invert.o readtex.o - $(CC) $(CFLAGS) $(LDFLAGS) invert.o readtex.o $(LIBS) -o $@ - -invert.o: invert.c readtex.h - $(CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) $< -o $@ - -readtex.o: readtex.c - $(CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) $< -o $@ - - -readtex.h: $(TOP)/progs/util/readtex.h - ln -s $(TOP)/progs/util/readtex.h . - -readtex.c: $(TOP)/progs/util/readtex.c - ln -s $(TOP)/progs/util/readtex.c . - - - - -# Emacs tags -tags: - etags `find . -name \*.[ch]` `find ../include` diff --git a/progs/fp/point-position.c b/progs/fp/point-position.c deleted file mode 100644 index c352a939cb..0000000000 --- a/progs/fp/point-position.c +++ /dev/null @@ -1,119 +0,0 @@ - -#include -#include -#include -#define GL_GLEXT_PROTOTYPES -#include -#include "GL/gl.h" - - - -static void Init( void ) -{ - static const char *modulate2D = - "!!ARBfp1.0\n" - "MUL result.color, fragment.position, {.005}.x; \n" - "END" - ; - GLuint modulateProg; - - if (!glutExtensionSupported("GL_ARB_fragment_program")) { - printf("Error: GL_ARB_fragment_program not supported!\n"); - exit(1); - } - printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - - /* Setup the fragment program */ - glGenProgramsARB(1, &modulateProg); - glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg); - glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, - strlen(modulate2D), (const GLubyte *)modulate2D); - - printf("glGetError = 0x%x\n", (int) glGetError()); - printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n", - (char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB)); - - glEnable(GL_FRAGMENT_PROGRAM_ARB); - - glClearColor(.3, .3, .3, 0); -} - -static void Reshape(int width, int height) -{ - - glViewport(0, 0, (GLint)width, (GLint)height); - - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0); - glMatrixMode(GL_MODELVIEW); -} - -static void Key(unsigned char key, int x, int y) -{ - - switch (key) { - case 27: - exit(1); - default: - return; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - -#if 0 - glBegin(GL_QUADS); - glTexCoord2f(1,0); - glVertex3f( 0.9, -0.9, -30.0); - glTexCoord2f(1,1); - glVertex3f( 0.9, 0.9, -30.0); - glTexCoord2f(0,1); - glVertex3f(-0.9, 0.9, -30.0); - glTexCoord2f(0,0); - glVertex3f(-0.9, -0.9, -30.0); - glEnd(); -#else - glPointSize(100); - glBegin(GL_POINTS); - glColor3f(0,0,1); - glVertex3f( 0, 0, -30.0); - glEnd(); -#endif - - glFlush(); - - -} - - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB; - type |= GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow("First Tri") == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/fp/tri-abs.c b/progs/fp/tri-abs.c deleted file mode 100644 index 44aa2cfa3a..0000000000 --- a/progs/fp/tri-abs.c +++ /dev/null @@ -1,107 +0,0 @@ - -#include -#include -#include -#define GL_GLEXT_PROTOTYPES -#include - - - -static void Init( void ) -{ - static const char *modulate2D = - "!!ARBfp1.0\n" - "TEMP R0;\n" - "SUB R0, {0.5}.x, fragment.color; \n" - "ABS result.color, R0; \n" - "END" - ; - GLuint modulateProg; - - if (!glutExtensionSupported("GL_ARB_fragment_program")) { - printf("Error: GL_ARB_fragment_program not supported!\n"); - exit(1); - } - printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - - /* Setup the fragment program */ - glGenProgramsARB(1, &modulateProg); - glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg); - glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, - strlen(modulate2D), (const GLubyte *)modulate2D); - - printf("glGetError = 0x%x\n", (int) glGetError()); - printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n", - (char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB)); - - glEnable(GL_FRAGMENT_PROGRAM_ARB); - - glClearColor(.3, .3, .3, 0); -} - -static void Reshape(int width, int height) -{ - - glViewport(0, 0, (GLint)width, (GLint)height); - - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0); - glMatrixMode(GL_MODELVIEW); -} - -static void Key(unsigned char key, int x, int y) -{ - - switch (key) { - case 27: - exit(1); - default: - return; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - - glBegin(GL_TRIANGLES); - glColor3f(0,0,1); - glVertex3f( 0.9, -0.9, -30.0); - glColor3f(1,0,0); - glVertex3f( 0.9, 0.9, -30.0); - glColor3f(0,1,0); - glVertex3f(-0.9, 0.0, -30.0); - glEnd(); - - glFlush(); - -} - - - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB; - type |= GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow("First Tri") == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/fp/tri-add.c b/progs/fp/tri-add.c deleted file mode 100644 index b086126c86..0000000000 --- a/progs/fp/tri-add.c +++ /dev/null @@ -1,110 +0,0 @@ - -#include -#include -#include -#define GL_GLEXT_PROTOTYPES -#include - - - -static void Init( void ) -{ - static const char *modulate2D = - "!!ARBfp1.0\n" - "TEMP R0;\n" - "ADD R0, fragment.color, fragment.color; \n" - "ADD result.color, R0, R0; \n" - "END" - ; - GLuint modulateProg; - - if (!glutExtensionSupported("GL_ARB_fragment_program")) { - printf("Error: GL_ARB_fragment_program not supported!\n"); - exit(1); - } - printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - - /* Setup the fragment program */ - glGenProgramsARB(1, &modulateProg); - glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg); - glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, - strlen(modulate2D), (const GLubyte *)modulate2D); - - printf("glGetError = 0x%x\n", (int) glGetError()); - printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n", - (char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB)); - - glEnable(GL_FRAGMENT_PROGRAM_ARB); - - glClearColor(.3, .3, .3, 0); -} - -static void Reshape(int width, int height) -{ - - glViewport(0, 0, (GLint)width, (GLint)height); - - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0); - glMatrixMode(GL_MODELVIEW); -} - -static void Key(unsigned char key, int x, int y) -{ - - switch (key) { - case 27: - exit(1); - default: - return; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - - glBegin(GL_TRIANGLES); - glColor3f(0,0,1); - glVertex3f( 0.9, -0.9, -30.0); - glColor3f(1,0,0); - glVertex3f( 0.9, 0.9, -30.0); - glColor3f(0,1,0); - glVertex3f(-0.9, 0.0, -30.0); - glEnd(); - - glFlush(); - - -} - - - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB; - type |= GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow("First Tri") == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/fp/tri-cmp.c b/progs/fp/tri-cmp.c deleted file mode 100644 index 968b67f3d9..0000000000 --- a/progs/fp/tri-cmp.c +++ /dev/null @@ -1,110 +0,0 @@ - -#include -#include -#include -#define GL_GLEXT_PROTOTYPES -#include - - - -static void Init( void ) -{ - static const char *modulate2D = - "!!ARBfp1.0\n" - "TEMP R0;\n" - "SUB R0, {0.5}.x, fragment.color; \n" - "CMP result.color, R0, fragment.color, {0.0}.x; \n" - "END" - ; - GLuint modulateProg; - - if (!glutExtensionSupported("GL_ARB_fragment_program")) { - printf("Error: GL_ARB_fragment_program not supported!\n"); - exit(1); - } - printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - - /* Setup the fragment program */ - glGenProgramsARB(1, &modulateProg); - glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg); - glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, - strlen(modulate2D), (const GLubyte *)modulate2D); - - printf("glGetError = 0x%x\n", (int) glGetError()); - printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n", - (char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB)); - - glEnable(GL_FRAGMENT_PROGRAM_ARB); - - glClearColor(.3, .3, .3, 0); -} - -static void Reshape(int width, int height) -{ - - glViewport(0, 0, (GLint)width, (GLint)height); - - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0); - glMatrixMode(GL_MODELVIEW); -} - -static void Key(unsigned char key, int x, int y) -{ - - switch (key) { - case 27: - exit(1); - default: - return; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - - glBegin(GL_TRIANGLES); - glColor3f(0,0,1); - glVertex3f( 0.9, -0.9, -30.0); - glColor3f(1,0,0); - glVertex3f( 0.9, 0.9, -30.0); - glColor3f(0,1,0); - glVertex3f(-0.9, 0.0, -30.0); - glEnd(); - - glFlush(); - - -} - - - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB; - type |= GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow("First Tri") == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/fp/tri-cos.c b/progs/fp/tri-cos.c deleted file mode 100644 index 7ea2453218..0000000000 --- a/progs/fp/tri-cos.c +++ /dev/null @@ -1,113 +0,0 @@ - -#include -#include -#include -#define GL_GLEXT_PROTOTYPES -#include -#include "GL/gl.h" - - - -static void Init( void ) -{ - static const char *modulate2D = - "!!ARBfp1.0\n" - "TEMP R0; \n" - "MUL R0, fragment.color, {3.14}.x; \n" - "COS result.color.x, R0.x; \n" - "COS result.color.y, R0.y; \n" - "COS result.color.z, R0.z; \n" - "END" - ; - GLuint modulateProg; - - if (!glutExtensionSupported("GL_ARB_fragment_program")) { - printf("Error: GL_ARB_fragment_program not supported!\n"); - exit(1); - } - printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - - /* Setup the fragment program */ - glGenProgramsARB(1, &modulateProg); - glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg); - glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, - strlen(modulate2D), (const GLubyte *)modulate2D); - - printf("glGetError = 0x%x\n", (int) glGetError()); - printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n", - (char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB)); - - glEnable(GL_FRAGMENT_PROGRAM_ARB); - - glClearColor(.3, .3, .3, 0); -} - -static void Reshape(int width, int height) -{ - - glViewport(0, 0, (GLint)width, (GLint)height); - - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0); - glMatrixMode(GL_MODELVIEW); -} - -static void Key(unsigned char key, int x, int y) -{ - - switch (key) { - case 27: - exit(1); - default: - return; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - - glBegin(GL_TRIANGLES); - glColor3f(0,0,1); - glVertex3f( 0.9, -0.9, -30.0); - glColor3f(1,0,0); - glVertex3f( 0.9, 0.9, -30.0); - glColor3f(0,1,0); - glVertex3f(-0.9, 0.0, -30.0); - glEnd(); - - glFlush(); - - -} - - - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB; - type |= GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow("First Tri") == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/fp/tri-depth.c b/progs/fp/tri-depth.c deleted file mode 100644 index a1f0579c8e..0000000000 --- a/progs/fp/tri-depth.c +++ /dev/null @@ -1,111 +0,0 @@ - -#include -#include -#include -#define GL_GLEXT_PROTOTYPES -#include -#include "GL/gl.h" - - - -static void Init( void ) -{ - /* scale of 10.0 gives me a visible result on nv hardware. - */ - static const char *modulate2D = - "!!ARBfp1.0\n" - "MUL result.color, fragment.position.z, {10.0}.x; \n" - "END" - ; - GLuint modulateProg; - - if (!glutExtensionSupported("GL_ARB_fragment_program")) { - printf("Error: GL_ARB_fragment_program not supported!\n"); - exit(1); - } - printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - - /* Setup the fragment program */ - glGenProgramsARB(1, &modulateProg); - glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg); - glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, - strlen(modulate2D), (const GLubyte *)modulate2D); - - printf("glGetError = 0x%x\n", (int) glGetError()); - printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n", - (char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB)); - - glEnable(GL_FRAGMENT_PROGRAM_ARB); - - glClearColor(.3, .3, .3, 0); -} - -static void Reshape(int width, int height) -{ - - glViewport(0, 0, (GLint)width, (GLint)height); - - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0); - glMatrixMode(GL_MODELVIEW); -} - -static void Key(unsigned char key, int x, int y) -{ - - switch (key) { - case 27: - exit(1); - default: - return; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - - glBegin(GL_TRIANGLES); - glColor3f(0,0,1); - glVertex3f( 0.9, -0.9, -40.0); - glColor3f(1,0,0); - glVertex3f( 0.9, 0.9, -40.0); - glColor3f(0,1,0); - glVertex3f(-0.9, 0.0, -25.0); - glEnd(); - - glFlush(); - - -} - - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB; - type |= GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow("First Tri") == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/fp/tri-depth2.c b/progs/fp/tri-depth2.c deleted file mode 100644 index f309628283..0000000000 --- a/progs/fp/tri-depth2.c +++ /dev/null @@ -1,116 +0,0 @@ - -#include -#include -#include -#define GL_GLEXT_PROTOTYPES -#include -#include "GL/gl.h" - - - -static void Init( void ) -{ - /* scale of 10.0 gives me a visible result on nv hardware. - */ - static const char *modulate2D = - "!!ARBfp1.0\n" - "TEMP R0;\n" - "MUL R0, fragment.position.z, {10.0}.x;\n" - "MOV result.color, R0; \n" - "END" - ; - GLuint modulateProg; - - if (!glutExtensionSupported("GL_ARB_fragment_program")) { - printf("Error: GL_ARB_fragment_program not supported!\n"); - exit(1); - } - printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - - /* Setup the fragment program */ - glGenProgramsARB(1, &modulateProg); - glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg); - glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, - strlen(modulate2D), (const GLubyte *)modulate2D); - - printf("glGetError = 0x%x\n", (int) glGetError()); - printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n", - (char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB)); - - glEnable(GL_FRAGMENT_PROGRAM_ARB); - - glClearColor(.3, .3, .3, 0); -} - -static void Reshape(int width, int height) -{ - - glViewport(0, 0, (GLint)width, (GLint)height); - - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0); - glMatrixMode(GL_MODELVIEW); -} - -static void Key(unsigned char key, int x, int y) -{ - - switch (key) { - case 27: - exit(1); - default: - return; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT); - glEnable(GL_DEPTH_TEST); - - glBegin(GL_TRIANGLES); - glColor3f(0,0,1); - glVertex3f( 0.9, -0.9, -30.0); - glVertex3f( 0.9, 0.9, -30.0); - glVertex3f(-0.9, 0.0, -30.0); - glColor3f(0,1,0); - glVertex3f(-0.9, -0.9, -40.0); - glVertex3f(-0.9, 0.9, -40.0); - glVertex3f( 0.9, 0.0, -25.0); - glEnd(); - - glFlush(); - - -} - - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB | GLUT_DEPTH; - type |= GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow("First Tri") == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/fp/tri-depthwrite.c b/progs/fp/tri-depthwrite.c deleted file mode 100644 index fedeec4577..0000000000 --- a/progs/fp/tri-depthwrite.c +++ /dev/null @@ -1,107 +0,0 @@ - -#include -#include -#include -#define GL_GLEXT_PROTOTYPES -#include - - -static void Init(void) -{ - static const char *modulate2D = - "!!ARBfp1.0\n" - "MUL result.depth.z, fragment.color.z, {.1}.x; \n" - "MOV result.color.xy, fragment.color; \n" - "END" - ; - GLuint modulateProg; - - if (!glutExtensionSupported("GL_ARB_fragment_program")) { - printf("Error: GL_ARB_fragment_program not supported!\n"); - exit(1); - } - printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - - /* Setup the fragment program */ - glGenProgramsARB(1, &modulateProg); - glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg); - glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, - strlen(modulate2D), (const GLubyte *)modulate2D); - - printf("glGetError = 0x%x\n", (int) glGetError()); - printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n", - (char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB)); - - glEnable(GL_FRAGMENT_PROGRAM_ARB); - - glClearColor(.3, .3, .3, 0); -} - -static void Reshape(int width, int height) -{ - - glViewport(0, 0, (GLint)width, (GLint)height); - - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0); - glMatrixMode(GL_MODELVIEW); -} - -static void Key(unsigned char key, int x, int y) -{ - - switch (key) { - case 27: - exit(1); - default: - return; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT); - glEnable(GL_DEPTH_TEST); - - - glBegin(GL_TRIANGLES); - glColor4f(.8,0,.5,0); - glVertex3f( 0.9, -0.9, -30.0); - glVertex3f( 0.9, 0.9, -30.0); - glVertex3f(-0.9, 0.0, -30.0); - - glColor4f(0,.8,.7,0); - glVertex3f(-0.9, -0.9, -40.0); - glColor4f(0,.8,.7,0); - glVertex3f(-0.9, 0.9, -40.0); - glColor4f(0,.8,.3,0); - glVertex3f( 0.9, 0.0, -40.0); - glEnd(); - - glFlush(); -} - - -int main(int argc, char **argv) -{ - glutInit(&argc, argv); - - glutInitWindowPosition(0, 0); glutInitWindowSize( 300, 300); - - glutInitDisplayMode(GLUT_DEPTH | GLUT_RGB | GLUT_SINGLE); - - if (glutCreateWindow("Depth Test") == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/fp/tri-depthwrite2.c b/progs/fp/tri-depthwrite2.c deleted file mode 100644 index 5547092ec9..0000000000 --- a/progs/fp/tri-depthwrite2.c +++ /dev/null @@ -1,107 +0,0 @@ - -#include -#include -#include -#define GL_GLEXT_PROTOTYPES -#include - - -static void Init(void) -{ - static const char *modulate2D = - "!!ARBfp1.0\n" - "MUL result.depth.z, fragment.color.z, {.1}.x; \n" - "MOV result.color, fragment.color.z; \n" - "END" - ; - GLuint modulateProg; - - if (!glutExtensionSupported("GL_ARB_fragment_program")) { - printf("Error: GL_ARB_fragment_program not supported!\n"); - exit(1); - } - printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - - /* Setup the fragment program */ - glGenProgramsARB(1, &modulateProg); - glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg); - glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, - strlen(modulate2D), (const GLubyte *)modulate2D); - - printf("glGetError = 0x%x\n", (int) glGetError()); - printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n", - (char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB)); - - glEnable(GL_FRAGMENT_PROGRAM_ARB); - - glClearColor(.3, .3, .3, 0); -} - -static void Reshape(int width, int height) -{ - - glViewport(0, 0, (GLint)width, (GLint)height); - - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0); - glMatrixMode(GL_MODELVIEW); -} - -static void Key(unsigned char key, int x, int y) -{ - - switch (key) { - case 27: - exit(1); - default: - return; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT); - glEnable(GL_DEPTH_TEST); - - - glBegin(GL_TRIANGLES); - glColor4f(.8,0,.5,0); - glVertex3f( 0.9, -0.9, -30.0); - glVertex3f( 0.9, 0.9, -30.0); - glVertex3f(-0.9, 0.0, -30.0); - - glColor4f(0,.8,.7,0); - glVertex3f(-0.9, -0.9, -40.0); - glColor4f(0,.8,.7,0); - glVertex3f(-0.9, 0.9, -40.0); - glColor4f(0,.8,.3,0); - glVertex3f( 0.9, 0.0, -40.0); - glEnd(); - - glFlush(); -} - - -int main(int argc, char **argv) -{ - glutInit(&argc, argv); - - glutInitWindowPosition(0, 0); glutInitWindowSize( 300, 300); - - glutInitDisplayMode(GLUT_DEPTH | GLUT_RGB | GLUT_SINGLE); - - if (glutCreateWindow("Depth Test") == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/fp/tri-dp3.c b/progs/fp/tri-dp3.c deleted file mode 100644 index 0e18de2dc4..0000000000 --- a/progs/fp/tri-dp3.c +++ /dev/null @@ -1,109 +0,0 @@ - -#include -#include -#include -#define GL_GLEXT_PROTOTYPES -#include - - - -static void Init( void ) -{ - static const char *modulate2D = - "!!ARBfp1.0\n" - "TEMP R0;\n" - "DP3 result.color, fragment.color, fragment.color; \n" - "END" - ; - GLuint modulateProg; - - if (!glutExtensionSupported("GL_ARB_fragment_program")) { - printf("Error: GL_ARB_fragment_program not supported!\n"); - exit(1); - } - printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - - /* Setup the fragment program */ - glGenProgramsARB(1, &modulateProg); - glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg); - glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, - strlen(modulate2D), (const GLubyte *)modulate2D); - - printf("glGetError = 0x%x\n", (int) glGetError()); - printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n", - (char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB)); - - glEnable(GL_FRAGMENT_PROGRAM_ARB); - - glClearColor(.3, .3, .3, 0); -} - -static void Reshape(int width, int height) -{ - - glViewport(0, 0, (GLint)width, (GLint)height); - - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0); - glMatrixMode(GL_MODELVIEW); -} - -static void Key(unsigned char key, int x, int y) -{ - - switch (key) { - case 27: - exit(1); - default: - return; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - - glBegin(GL_TRIANGLES); - glColor3f(0,0,1); - glVertex3f( 0.9, -0.9, -30.0); - glColor3f(1,0,0); - glVertex3f( 0.9, 0.9, -30.0); - glColor3f(0,1,0); - glVertex3f(-0.9, 0.0, -30.0); - glEnd(); - - glFlush(); - - -} - - - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB; - type |= GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow("First Tri") == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/fp/tri-dp4.c b/progs/fp/tri-dp4.c deleted file mode 100644 index 400bbf4da2..0000000000 --- a/progs/fp/tri-dp4.c +++ /dev/null @@ -1,109 +0,0 @@ - -#include -#include -#include -#define GL_GLEXT_PROTOTYPES -#include - - - -static void Init( void ) -{ - static const char *modulate2D = - "!!ARBfp1.0\n" - "TEMP R0;\n" - "DP4 result.color, fragment.color.xxxx, fragment.color; \n" - "END" - ; - GLuint modulateProg; - - if (!glutExtensionSupported("GL_ARB_fragment_program")) { - printf("Error: GL_ARB_fragment_program not supported!\n"); - exit(1); - } - printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - - /* Setup the fragment program */ - glGenProgramsARB(1, &modulateProg); - glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg); - glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, - strlen(modulate2D), (const GLubyte *)modulate2D); - - printf("glGetError = 0x%x\n", (int) glGetError()); - printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n", - (char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB)); - - glEnable(GL_FRAGMENT_PROGRAM_ARB); - - glClearColor(.3, .3, .3, 0); -} - -static void Reshape(int width, int height) -{ - - glViewport(0, 0, (GLint)width, (GLint)height); - - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0); - glMatrixMode(GL_MODELVIEW); -} - -static void Key(unsigned char key, int x, int y) -{ - - switch (key) { - case 27: - exit(1); - default: - return; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - - glBegin(GL_TRIANGLES); - glColor3f(0,0,1); - glVertex3f( 0.9, -0.9, -30.0); - glColor3f(1,0,0); - glVertex3f( 0.9, 0.9, -30.0); - glColor3f(0,1,0); - glVertex3f(-0.9, 0.0, -30.0); - glEnd(); - - glFlush(); - - -} - - - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB; - type |= GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow("First Tri") == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/fp/tri-dph.c b/progs/fp/tri-dph.c deleted file mode 100644 index 958073c413..0000000000 --- a/progs/fp/tri-dph.c +++ /dev/null @@ -1,109 +0,0 @@ - -#include -#include -#include -#define GL_GLEXT_PROTOTYPES -#include - - - -static void Init( void ) -{ - static const char *modulate2D = - "!!ARBfp1.0\n" - "TEMP R0;\n" - "DPH result.color, fragment.color, fragment.color.xyzx; \n" - "END" - ; - GLuint modulateProg; - - if (!glutExtensionSupported("GL_ARB_fragment_program")) { - printf("Error: GL_ARB_fragment_program not supported!\n"); - exit(1); - } - printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - - /* Setup the fragment program */ - glGenProgramsARB(1, &modulateProg); - glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg); - glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, - strlen(modulate2D), (const GLubyte *)modulate2D); - - printf("glGetError = 0x%x\n", (int) glGetError()); - printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n", - (char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB)); - - glEnable(GL_FRAGMENT_PROGRAM_ARB); - - glClearColor(.3, .3, .3, 0); -} - -static void Reshape(int width, int height) -{ - - glViewport(0, 0, (GLint)width, (GLint)height); - - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0); - glMatrixMode(GL_MODELVIEW); -} - -static void Key(unsigned char key, int x, int y) -{ - - switch (key) { - case 27: - exit(1); - default: - return; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - - glBegin(GL_TRIANGLES); - glColor3f(0,0,1); - glVertex3f( 0.9, -0.9, -30.0); - glColor3f(1,0,0); - glVertex3f( 0.9, 0.9, -30.0); - glColor3f(0,1,0); - glVertex3f(-0.9, 0.0, -30.0); - glEnd(); - - glFlush(); - - -} - - - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB; - type |= GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow("First Tri") == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/fp/tri-dst.c b/progs/fp/tri-dst.c deleted file mode 100644 index 3d85e85643..0000000000 --- a/progs/fp/tri-dst.c +++ /dev/null @@ -1,109 +0,0 @@ - -#include -#include -#include -#define GL_GLEXT_PROTOTYPES -#include -#include "GL/gl.h" - - - -static void Init( void ) -{ - static const char *modulate2D = - "!!ARBfp1.0\n" - "DST result.color, fragment.color, fragment.color; \n" - "END" - ; - GLuint modulateProg; - - if (!glutExtensionSupported("GL_ARB_fragment_program")) { - printf("Error: GL_ARB_fragment_program not supported!\n"); - exit(1); - } - printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - - /* Setup the fragment program */ - glGenProgramsARB(1, &modulateProg); - glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg); - glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, - strlen(modulate2D), (const GLubyte *)modulate2D); - - printf("glGetError = 0x%x\n", (int) glGetError()); - printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n", - (char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB)); - - glEnable(GL_FRAGMENT_PROGRAM_ARB); - - glClearColor(.3, .3, .3, 0); -} - -static void Reshape(int width, int height) -{ - - glViewport(0, 0, (GLint)width, (GLint)height); - - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0); - glMatrixMode(GL_MODELVIEW); -} - -static void Key(unsigned char key, int x, int y) -{ - - switch (key) { - case 27: - exit(1); - default: - return; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - - glBegin(GL_TRIANGLES); - glColor3f(0,0,1); - glVertex3f( 0.9, -0.9, -30.0); - glColor3f(1,0,0); - glVertex3f( 0.9, 0.9, -30.0); - glColor3f(0,1,0); - glVertex3f(-0.9, 0.0, -30.0); - glEnd(); - - glFlush(); - - -} - - - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB; - type |= GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow("First Tri") == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/fp/tri-ex2.c b/progs/fp/tri-ex2.c deleted file mode 100644 index f09b1d7846..0000000000 --- a/progs/fp/tri-ex2.c +++ /dev/null @@ -1,110 +0,0 @@ - -#include -#include -#include -#define GL_GLEXT_PROTOTYPES -#include - - - -static void Init( void ) -{ - static const char *modulate2D = - "!!ARBfp1.0\n" - "TEMP R0;\n" - "EX2 R0, fragment.color.x; \n" - "SUB result.color, R0, {1.0}.x; \n" - "END" - ; - GLuint modulateProg; - - if (!glutExtensionSupported("GL_ARB_fragment_program")) { - printf("Error: GL_ARB_fragment_program not supported!\n"); - exit(1); - } - printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - - /* Setup the fragment program */ - glGenProgramsARB(1, &modulateProg); - glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg); - glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, - strlen(modulate2D), (const GLubyte *)modulate2D); - - printf("glGetError = 0x%x\n", (int) glGetError()); - printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n", - (char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB)); - - glEnable(GL_FRAGMENT_PROGRAM_ARB); - - glClearColor(.3, .3, .3, 0); -} - -static void Reshape(int width, int height) -{ - - glViewport(0, 0, (GLint)width, (GLint)height); - - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0); - glMatrixMode(GL_MODELVIEW); -} - -static void Key(unsigned char key, int x, int y) -{ - - switch (key) { - case 27: - exit(1); - default: - return; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - - glBegin(GL_TRIANGLES); - glColor3f(0,0,1); - glVertex3f( 0.9, -0.9, -30.0); - glColor3f(1,0,0); - glVertex3f( 0.9, 0.9, -30.0); - glColor3f(0,1,0); - glVertex3f(-0.9, 0.0, -30.0); - glEnd(); - - glFlush(); - - -} - - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB; - type |= GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow("First Tri") == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/fp/tri-flr.c b/progs/fp/tri-flr.c deleted file mode 100644 index 059f6b6754..0000000000 --- a/progs/fp/tri-flr.c +++ /dev/null @@ -1,110 +0,0 @@ - -#include -#include -#include -#define GL_GLEXT_PROTOTYPES -#include - - - -static void Init( void ) -{ - static const char *modulate2D = - "!!ARBfp1.0\n" - "TEMP R0;\n" - "ADD R0, fragment.color, {0.5}.x; \n" - "FLR result.color, R0; \n" - "END" - ; - GLuint modulateProg; - - if (!glutExtensionSupported("GL_ARB_fragment_program")) { - printf("Error: GL_ARB_fragment_program not supported!\n"); - exit(1); - } - printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - - /* Setup the fragment program */ - glGenProgramsARB(1, &modulateProg); - glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg); - glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, - strlen(modulate2D), (const GLubyte *)modulate2D); - - printf("glGetError = 0x%x\n", (int) glGetError()); - printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n", - (char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB)); - - glEnable(GL_FRAGMENT_PROGRAM_ARB); - - glClearColor(.3, .3, .3, 0); -} - -static void Reshape(int width, int height) -{ - - glViewport(0, 0, (GLint)width, (GLint)height); - - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0); - glMatrixMode(GL_MODELVIEW); -} - -static void Key(unsigned char key, int x, int y) -{ - - switch (key) { - case 27: - exit(1); - default: - return; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - - glBegin(GL_TRIANGLES); - glColor3f(0,0,1); - glVertex3f( 0.9, -0.9, -30.0); - glColor3f(1,0,0); - glVertex3f( 0.9, 0.9, -30.0); - glColor3f(0,1,0); - glVertex3f(-0.9, 0.0, -30.0); - glEnd(); - - glFlush(); - - -} - - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB; - type |= GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow("First Tri") == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/fp/tri-fp.c b/progs/fp/tri-fp.c deleted file mode 100644 index 4148a8def3..0000000000 --- a/progs/fp/tri-fp.c +++ /dev/null @@ -1,109 +0,0 @@ - -#include -#include -#include -#define GL_GLEXT_PROTOTYPES -#include -#include "GL/gl.h" - - - -static void Init( void ) -{ - static const char *modulate2D = - "!!ARBfp1.0\n" - "SLT result.color, {0.5}.x, fragment.color; \n" - "END" - ; - GLuint modulateProg; - - if (!glutExtensionSupported("GL_ARB_fragment_program")) { - printf("Error: GL_ARB_fragment_program not supported!\n"); - exit(1); - } - printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - - /* Setup the fragment program */ - glGenProgramsARB(1, &modulateProg); - glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg); - glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, - strlen(modulate2D), (const GLubyte *)modulate2D); - - printf("glGetError = 0x%x\n", (int) glGetError()); - printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n", - (char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB)); - - glEnable(GL_FRAGMENT_PROGRAM_ARB); - - glClearColor(.3, .3, .3, 0); -} - -static void Reshape(int width, int height) -{ - - glViewport(0, 0, (GLint)width, (GLint)height); - - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0); - glMatrixMode(GL_MODELVIEW); -} - -static void Key(unsigned char key, int x, int y) -{ - - switch (key) { - case 27: - exit(1); - default: - return; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - - glBegin(GL_TRIANGLES); - glColor3f(0,0,1); - glVertex3f( 0.9, -0.9, -30.0); - glColor3f(1,0,0); - glVertex3f( 0.9, 0.9, -30.0); - glColor3f(0,1,0); - glVertex3f(-0.9, 0.0, -30.0); - glEnd(); - - glFlush(); - - -} - - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB; - type |= GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow("First Tri") == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/fp/tri-frc.c b/progs/fp/tri-frc.c deleted file mode 100644 index 8d60c9dc20..0000000000 --- a/progs/fp/tri-frc.c +++ /dev/null @@ -1,111 +0,0 @@ - -#include -#include -#include -#define GL_GLEXT_PROTOTYPES -#include -#include "GL/gl.h" - - - -static void Init( void ) -{ - static const char *modulate2D = - "!!ARBfp1.0\n" - "TEMP R0; \n" - "MUL R0, fragment.color, {3.0}.x; \n" - "FRC result.color, R0; \n" - "END" - ; - GLuint modulateProg; - - if (!glutExtensionSupported("GL_ARB_fragment_program")) { - printf("Error: GL_ARB_fragment_program not supported!\n"); - exit(1); - } - printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - - /* Setup the fragment program */ - glGenProgramsARB(1, &modulateProg); - glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg); - glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, - strlen(modulate2D), (const GLubyte *)modulate2D); - - printf("glGetError = 0x%x\n", (int) glGetError()); - printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n", - (char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB)); - - glEnable(GL_FRAGMENT_PROGRAM_ARB); - - glClearColor(.3, .3, .3, 0); -} - -static void Reshape(int width, int height) -{ - - glViewport(0, 0, (GLint)width, (GLint)height); - - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0); - glMatrixMode(GL_MODELVIEW); -} - -static void Key(unsigned char key, int x, int y) -{ - - switch (key) { - case 27: - exit(1); - default: - return; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - - glBegin(GL_TRIANGLES); - glColor3f(0,0,1); - glVertex3f( 0.9, -0.9, -30.0); - glColor3f(1,0,0); - glVertex3f( 0.9, 0.9, -30.0); - glColor3f(0,1,0); - glVertex3f(-0.9, 0.0, -30.0); - glEnd(); - - glFlush(); - - -} - - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB; - type |= GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow("First Tri") == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/fp/tri-inv.c b/progs/fp/tri-inv.c deleted file mode 100644 index e902332386..0000000000 --- a/progs/fp/tri-inv.c +++ /dev/null @@ -1,109 +0,0 @@ - -#include -#include -#include -#define GL_GLEXT_PROTOTYPES -#include - - - -static void Init( void ) -{ - static const char *modulate2D = - "!!ARBfp1.0\n" - "TEMP R0;\n" - "INV result.color, fragment.color; \n" - "END" - ; - GLuint modulateProg; - - if (!glutExtensionSupported("GL_ARB_fragment_program")) { - printf("Error: GL_ARB_fragment_program not supported!\n"); - exit(1); - } - printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - - /* Setup the fragment program */ - glGenProgramsARB(1, &modulateProg); - glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg); - glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, - strlen(modulate2D), (const GLubyte *)modulate2D); - - printf("glGetError = 0x%x\n", (int) glGetError()); - printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n", - (char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB)); - - glEnable(GL_FRAGMENT_PROGRAM_ARB); - - glClearColor(.3, .3, .3, 0); -} - -static void Reshape(int width, int height) -{ - - glViewport(0, 0, (GLint)width, (GLint)height); - - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0); - glMatrixMode(GL_MODELVIEW); -} - -static void Key(unsigned char key, int x, int y) -{ - - switch (key) { - case 27: - exit(1); - default: - return; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - - glBegin(GL_TRIANGLES); - glColor3f(0,0,1); - glVertex3f( 0.9, -0.9, -30.0); - glColor3f(1,0,0); - glVertex3f( 0.9, 0.9, -30.0); - glColor3f(0,1,0); - glVertex3f(-0.9, 0.0, -30.0); - glEnd(); - - glFlush(); - - -} - - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB; - type |= GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow("First Tri") == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/fp/tri-kil.c b/progs/fp/tri-kil.c deleted file mode 100644 index 47dbd04964..0000000000 --- a/progs/fp/tri-kil.c +++ /dev/null @@ -1,111 +0,0 @@ - -#include -#include -#include -#define GL_GLEXT_PROTOTYPES -#include - - - -static void Init( void ) -{ - static const char *modulate2D = - "!!ARBfp1.0\n" - "TEMP R0;\n" - "SUB R0, fragment.color, {0.5,0,0,0}; \n" - "KIL R0;" - "MOV result.color, R0;" - "END" - ; - GLuint modulateProg; - - if (!glutExtensionSupported("GL_ARB_fragment_program")) { - printf("Error: GL_ARB_fragment_program not supported!\n"); - exit(1); - } - printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - - /* Setup the fragment program */ - glGenProgramsARB(1, &modulateProg); - glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg); - glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, - strlen(modulate2D), (const GLubyte *)modulate2D); - - printf("glGetError = 0x%x\n", (int) glGetError()); - printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n", - (char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB)); - - glEnable(GL_FRAGMENT_PROGRAM_ARB); - - glClearColor(.3, .3, .3, 0); -} - -static void Reshape(int width, int height) -{ - - glViewport(0, 0, (GLint)width, (GLint)height); - - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0); - glMatrixMode(GL_MODELVIEW); -} - -static void Key(unsigned char key, int x, int y) -{ - - switch (key) { - case 27: - exit(1); - default: - return; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - - glBegin(GL_TRIANGLES); - glColor3f(0,0,1); - glVertex3f( 0.9, -0.9, -30.0); - glColor3f(1,0,0); - glVertex3f( 0.9, 0.9, -30.0); - glColor3f(0,1,0); - glVertex3f(-0.9, 0.0, -30.0); - glEnd(); - - glFlush(); - - -} - - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB; - type |= GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow("First Tri") == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/fp/tri-lg2.c b/progs/fp/tri-lg2.c deleted file mode 100644 index c7eec46974..0000000000 --- a/progs/fp/tri-lg2.c +++ /dev/null @@ -1,110 +0,0 @@ - -#include -#include -#include -#define GL_GLEXT_PROTOTYPES -#include - - - -static void Init( void ) -{ - static const char *modulate2D = - "!!ARBfp1.0\n" - "TEMP R0;\n" - "MUL R0, fragment.color, {4.0}.x; \n" - "LG2 result.color, R0.x; \n" - "END" - ; - GLuint modulateProg; - - if (!glutExtensionSupported("GL_ARB_fragment_program")) { - printf("Error: GL_ARB_fragment_program not supported!\n"); - exit(1); - } - printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - - /* Setup the fragment program */ - glGenProgramsARB(1, &modulateProg); - glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg); - glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, - strlen(modulate2D), (const GLubyte *)modulate2D); - - printf("glGetError = 0x%x\n", (int) glGetError()); - printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n", - (char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB)); - - glEnable(GL_FRAGMENT_PROGRAM_ARB); - - glClearColor(.3, .3, .3, 0); -} - -static void Reshape(int width, int height) -{ - - glViewport(0, 0, (GLint)width, (GLint)height); - - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0); - glMatrixMode(GL_MODELVIEW); -} - -static void Key(unsigned char key, int x, int y) -{ - - switch (key) { - case 27: - exit(1); - default: - return; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - - glBegin(GL_TRIANGLES); - glColor3f(0,0,1); - glVertex3f( 0.9, -0.9, -30.0); - glColor3f(1,0,0); - glVertex3f( 0.9, 0.9, -30.0); - glColor3f(0,1,0); - glVertex3f(-0.9, 0.0, -30.0); - glEnd(); - - glFlush(); - - -} - - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB; - type |= GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow("First Tri") == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/fp/tri-lit.c b/progs/fp/tri-lit.c deleted file mode 100644 index 21e3b6f216..0000000000 --- a/progs/fp/tri-lit.c +++ /dev/null @@ -1,111 +0,0 @@ - -#include -#include -#include -#define GL_GLEXT_PROTOTYPES -#include -#include "GL/gl.h" - - - -static void Init( void ) -{ - static const char *modulate2D = - "!!ARBfp1.0\n" - "TEMP R0;\n" - "SUB R0, {0.5}.x, fragment.color; \n" - "LIT result.color, R0; \n" - "END" - ; - GLuint modulateProg; - - if (!glutExtensionSupported("GL_ARB_fragment_program")) { - printf("Error: GL_ARB_fragment_program not supported!\n"); - exit(1); - } - printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - - /* Setup the fragment program */ - glGenProgramsARB(1, &modulateProg); - glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg); - glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, - strlen(modulate2D), (const GLubyte *)modulate2D); - - printf("glGetError = 0x%x\n", (int) glGetError()); - printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n", - (char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB)); - - glEnable(GL_FRAGMENT_PROGRAM_ARB); - - glClearColor(.3, .3, .3, 0); -} - -static void Reshape(int width, int height) -{ - - glViewport(0, 0, (GLint)width, (GLint)height); - - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0); - glMatrixMode(GL_MODELVIEW); -} - -static void Key(unsigned char key, int x, int y) -{ - - switch (key) { - case 27: - exit(1); - default: - return; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - - glBegin(GL_TRIANGLES); - glColor3f(0,0,1); - glVertex3f( 0.9, -0.9, -30.0); - glColor3f(1,0,0); - glVertex3f( 0.9, 0.9, -30.0); - glColor3f(0,1,0); - glVertex3f(-0.9, 0.0, -30.0); - glEnd(); - - glFlush(); - - -} - - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB; - type |= GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow("First Tri") == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/fp/tri-lrp.c b/progs/fp/tri-lrp.c deleted file mode 100644 index a5659eed60..0000000000 --- a/progs/fp/tri-lrp.c +++ /dev/null @@ -1,109 +0,0 @@ - -#include -#include -#include -#define GL_GLEXT_PROTOTYPES -#include - - - -static void Init( void ) -{ - static const char *modulate2D = - "!!ARBfp1.0\n" - "TEMP R0, R1;\n" - "LRP result.color, fragment.color.z, {1,0,0,1}, {0,1,0,1}; \n" - "END" - ; - GLuint modulateProg; - - if (!glutExtensionSupported("GL_ARB_fragment_program")) { - printf("Error: GL_ARB_fragment_program not supported!\n"); - exit(1); - } - printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - - /* Setup the fragment program */ - glGenProgramsARB(1, &modulateProg); - glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg); - glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, - strlen(modulate2D), (const GLubyte *)modulate2D); - - printf("glGetError = 0x%x\n", (int) glGetError()); - printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n", - (char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB)); - - glEnable(GL_FRAGMENT_PROGRAM_ARB); - - glClearColor(.3, .3, .3, 0); -} - -static void Reshape(int width, int height) -{ - - glViewport(0, 0, (GLint)width, (GLint)height); - - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0); - glMatrixMode(GL_MODELVIEW); -} - -static void Key(unsigned char key, int x, int y) -{ - - switch (key) { - case 27: - exit(1); - default: - return; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - - glBegin(GL_TRIANGLES); - glColor3f(0,0,1); - glVertex3f( 0.9, -0.9, -30.0); - glColor3f(1,0,0); - glVertex3f( 0.9, 0.9, -30.0); - glColor3f(0,1,0); - glVertex3f(-0.9, 0.0, -30.0); - glEnd(); - - glFlush(); - - -} - - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB; - type |= GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow("First Tri") == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/fp/tri-mad.c b/progs/fp/tri-mad.c deleted file mode 100644 index b46d139fb3..0000000000 --- a/progs/fp/tri-mad.c +++ /dev/null @@ -1,109 +0,0 @@ - -#include -#include -#include -#define GL_GLEXT_PROTOTYPES -#include - - - -static void Init( void ) -{ - static const char *modulate2D = - "!!ARBfp1.0\n" - "TEMP R0, R1;\n" - "MAD result.color, fragment.color.z, {1,0,0,1}, fragment.color; \n" - "END" - ; - GLuint modulateProg; - - if (!glutExtensionSupported("GL_ARB_fragment_program")) { - printf("Error: GL_ARB_fragment_program not supported!\n"); - exit(1); - } - printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - - /* Setup the fragment program */ - glGenProgramsARB(1, &modulateProg); - glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg); - glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, - strlen(modulate2D), (const GLubyte *)modulate2D); - - printf("glGetError = 0x%x\n", (int) glGetError()); - printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n", - (char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB)); - - glEnable(GL_FRAGMENT_PROGRAM_ARB); - - glClearColor(.3, .3, .3, 0); -} - -static void Reshape(int width, int height) -{ - - glViewport(0, 0, (GLint)width, (GLint)height); - - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0); - glMatrixMode(GL_MODELVIEW); -} - -static void Key(unsigned char key, int x, int y) -{ - - switch (key) { - case 27: - exit(1); - default: - return; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - - glBegin(GL_TRIANGLES); - glColor3f(0,0,1); - glVertex3f( 0.9, -0.9, -30.0); - glColor3f(1,0,0); - glVertex3f( 0.9, 0.9, -30.0); - glColor3f(0,1,0); - glVertex3f(-0.9, 0.0, -30.0); - glEnd(); - - glFlush(); - - -} - - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB; - type |= GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow("First Tri") == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/fp/tri-max.c b/progs/fp/tri-max.c deleted file mode 100644 index 481a067916..0000000000 --- a/progs/fp/tri-max.c +++ /dev/null @@ -1,109 +0,0 @@ - -#include -#include -#include -#define GL_GLEXT_PROTOTYPES -#include -#include "GL/gl.h" - - - -static void Init( void ) -{ - static const char *modulate2D = - "!!ARBfp1.0\n" - "MAX result.color, {0.5}.x, fragment.color; \n" - "END" - ; - GLuint modulateProg; - - if (!glutExtensionSupported("GL_ARB_fragment_program")) { - printf("Error: GL_ARB_fragment_program not supported!\n"); - exit(1); - } - printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - - /* Setup the fragment program */ - glGenProgramsARB(1, &modulateProg); - glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg); - glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, - strlen(modulate2D), (const GLubyte *)modulate2D); - - printf("glGetError = 0x%x\n", (int) glGetError()); - printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n", - (char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB)); - - glEnable(GL_FRAGMENT_PROGRAM_ARB); - - glClearColor(.3, .3, .3, 0); -} - -static void Reshape(int width, int height) -{ - - glViewport(0, 0, (GLint)width, (GLint)height); - - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0); - glMatrixMode(GL_MODELVIEW); -} - -static void Key(unsigned char key, int x, int y) -{ - - switch (key) { - case 27: - exit(1); - default: - return; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - - glBegin(GL_TRIANGLES); - glColor3f(0,0,1); - glVertex3f( 0.9, -0.9, -30.0); - glColor3f(1,0,0); - glVertex3f( 0.9, 0.9, -30.0); - glColor3f(0,1,0); - glVertex3f(-0.9, 0.0, -30.0); - glEnd(); - - glFlush(); - - -} - - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB; - type |= GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow("First Tri") == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/fp/tri-min.c b/progs/fp/tri-min.c deleted file mode 100644 index 7bb722f85f..0000000000 --- a/progs/fp/tri-min.c +++ /dev/null @@ -1,109 +0,0 @@ - -#include -#include -#include -#define GL_GLEXT_PROTOTYPES -#include -#include "GL/gl.h" - - - -static void Init( void ) -{ - static const char *modulate2D = - "!!ARBfp1.0\n" - "MIN result.color, {0.5}.x, fragment.color; \n" - "END" - ; - GLuint modulateProg; - - if (!glutExtensionSupported("GL_ARB_fragment_program")) { - printf("Error: GL_ARB_fragment_program not supported!\n"); - exit(1); - } - printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - - /* Setup the fragment program */ - glGenProgramsARB(1, &modulateProg); - glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg); - glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, - strlen(modulate2D), (const GLubyte *)modulate2D); - - printf("glGetError = 0x%x\n", (int) glGetError()); - printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n", - (char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB)); - - glEnable(GL_FRAGMENT_PROGRAM_ARB); - - glClearColor(.3, .3, .3, 0); -} - -static void Reshape(int width, int height) -{ - - glViewport(0, 0, (GLint)width, (GLint)height); - - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0); - glMatrixMode(GL_MODELVIEW); -} - -static void Key(unsigned char key, int x, int y) -{ - - switch (key) { - case 27: - exit(1); - default: - return; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - - glBegin(GL_TRIANGLES); - glColor3f(0,0,1); - glVertex3f( 0.9, -0.9, -30.0); - glColor3f(1,0,0); - glVertex3f( 0.9, 0.9, -30.0); - glColor3f(0,1,0); - glVertex3f(-0.9, 0.0, -30.0); - glEnd(); - - glFlush(); - - -} - - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB; - type |= GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow("First Tri") == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/fp/tri-mov.c b/progs/fp/tri-mov.c deleted file mode 100644 index 40b5b66f5c..0000000000 --- a/progs/fp/tri-mov.c +++ /dev/null @@ -1,102 +0,0 @@ - -#include -#include -#include -#define GL_GLEXT_PROTOTYPES -#include -#include "GL/gl.h" - -static void Init( void ) -{ - static const char *modulate2D = - "!!ARBfp1.0\n" - "MOV result.color, fragment.color; \n" - "END" - ; - GLuint modulateProg; - - if (!glutExtensionSupported("GL_ARB_fragment_program")) { - printf("Error: GL_ARB_fragment_program not supported!\n"); - exit(1); - } - printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - - /* Setup the fragment program */ - glGenProgramsARB(1, &modulateProg); - glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg); - glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, - strlen(modulate2D), (const GLubyte *)modulate2D); - - printf("glGetError = 0x%x\n", (int) glGetError()); - printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n", - (char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB)); - - glEnable(GL_FRAGMENT_PROGRAM_ARB); - - glClearColor(.3, .3, .3, 0); -} - -static void Reshape(int width, int height) -{ - - glViewport(0, 0, (GLint)width, (GLint)height); - - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0); - glMatrixMode(GL_MODELVIEW); -} - -static void Key(unsigned char key, int x, int y) -{ - - switch (key) { - case 27: - exit(1); - default: - return; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - - glBegin(GL_TRIANGLES); - glColor3f(0,0,1); - glVertex3f( 0.9, -0.9, -30.0); - glColor3f(1,0,0); - glVertex3f( 0.9, 0.9, -30.0); - glColor3f(0,1,0); - glVertex3f(-0.9, 0.0, -30.0); - glEnd(); - - glFlush(); -} - - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB | GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow("First Tri") == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/fp/tri-mul.c b/progs/fp/tri-mul.c deleted file mode 100644 index 61dd3e0458..0000000000 --- a/progs/fp/tri-mul.c +++ /dev/null @@ -1,109 +0,0 @@ - -#include -#include -#include -#define GL_GLEXT_PROTOTYPES -#include -#include "GL/gl.h" - - - -static void Init( void ) -{ - static const char *modulate2D = - "!!ARBfp1.0\n" - "MUL result.color, fragment.color, fragment.color; \n" - "END" - ; - GLuint modulateProg; - - if (!glutExtensionSupported("GL_ARB_fragment_program")) { - printf("Error: GL_ARB_fragment_program not supported!\n"); - exit(1); - } - printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - - /* Setup the fragment program */ - glGenProgramsARB(1, &modulateProg); - glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg); - glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, - strlen(modulate2D), (const GLubyte *)modulate2D); - - printf("glGetError = 0x%x\n", (int) glGetError()); - printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n", - (char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB)); - - glEnable(GL_FRAGMENT_PROGRAM_ARB); - - glClearColor(.3, .3, .3, 0); -} - -static void Reshape(int width, int height) -{ - - glViewport(0, 0, (GLint)width, (GLint)height); - - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0); - glMatrixMode(GL_MODELVIEW); -} - -static void Key(unsigned char key, int x, int y) -{ - - switch (key) { - case 27: - exit(1); - default: - return; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - - glBegin(GL_TRIANGLES); - glColor3f(0,0,1); - glVertex3f( 0.9, -0.9, -30.0); - glColor3f(1,0,0); - glVertex3f( 0.9, 0.9, -30.0); - glColor3f(0,1,0); - glVertex3f(-0.9, 0.0, -30.0); - glEnd(); - - glFlush(); - - -} - - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB; - type |= GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow("First Tri") == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/fp/tri-param.c b/progs/fp/tri-param.c deleted file mode 100644 index f3e55af3f1..0000000000 --- a/progs/fp/tri-param.c +++ /dev/null @@ -1,114 +0,0 @@ - -#include -#include -#include -#define GL_GLEXT_PROTOTYPES -#include -#include "GL/gl.h" - -static void Init( void ) -{ - static const char *modulate2D = - "!!ARBfp1.0\n" - "MOV result.color, program.local[32]; \n" - "END" - ; - GLuint modulateProg; - - if (!glutExtensionSupported("GL_ARB_fragment_program")) { - printf("Error: GL_ARB_fragment_program not supported!\n"); - exit(1); - } - printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - - /* Setup the fragment program */ - glGenProgramsARB(1, &modulateProg); - glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg); - glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, - strlen(modulate2D), (const GLubyte *)modulate2D); - - printf("glGetError = 0x%x\n", (int) glGetError()); - printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n", - (char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB)); - - glEnable(GL_FRAGMENT_PROGRAM_ARB); - - glClearColor(.3, .3, .3, 0); -} - -static void Reshape(int width, int height) -{ - - glViewport(0, 0, (GLint)width, (GLint)height); - - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0); - glMatrixMode(GL_MODELVIEW); -} - -static void Key(unsigned char key, int x, int y) -{ - - switch (key) { - case 27: - exit(1); - default: - return; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - glProgramLocalParameter4fARB(GL_FRAGMENT_PROGRAM_ARB, 32, 0.25, .5, 0.25, 1); - - glBegin(GL_TRIANGLES); - glColor3f(0,0,1); - glVertex3f( 0.9, -0.9, -30.0); - glColor3f(1,0,0); - glVertex3f( 0.9, 0.0, -30.0); - glColor3f(0,1,0); - glVertex3f(-0.9, 0.0, -30.0); - glEnd(); - - glProgramLocalParameter4fARB(GL_FRAGMENT_PROGRAM_ARB, 32, 0.25, 0, 0.25, 1); - - glBegin(GL_TRIANGLES); - glColor3f(0,0,1); - glVertex3f( 0.9, 0.0, -30.0); - glColor3f(1,0,0); - glVertex3f( 0.9, 0.9, -30.0); - glColor3f(0,1,0); - glVertex3f(-0.9, 0.0, -30.0); - glEnd(); - - glFlush(); -} - - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB | GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow("First Tri") == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/fp/tri-position.c b/progs/fp/tri-position.c deleted file mode 100644 index 18e8182a68..0000000000 --- a/progs/fp/tri-position.c +++ /dev/null @@ -1,109 +0,0 @@ - -#include -#include -#include -#define GL_GLEXT_PROTOTYPES -#include -#include "GL/gl.h" - - - -static void Init( void ) -{ - static const char *modulate2D = - "!!ARBfp1.0\n" - "MUL result.color, fragment.position, {.005}.x; \n" - "END" - ; - GLuint modulateProg; - - if (!glutExtensionSupported("GL_ARB_fragment_program")) { - printf("Error: GL_ARB_fragment_program not supported!\n"); - exit(1); - } - printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - - /* Setup the fragment program */ - glGenProgramsARB(1, &modulateProg); - glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg); - glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, - strlen(modulate2D), (const GLubyte *)modulate2D); - - printf("glGetError = 0x%x\n", (int) glGetError()); - printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n", - (char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB)); - - glEnable(GL_FRAGMENT_PROGRAM_ARB); - - glClearColor(.3, .3, .3, 0); -} - -static void Reshape(int width, int height) -{ - - glViewport(0, 0, (GLint)width, (GLint)height); - - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0); - glMatrixMode(GL_MODELVIEW); -} - -static void Key(unsigned char key, int x, int y) -{ - - switch (key) { - case 27: - exit(1); - default: - return; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - - glBegin(GL_TRIANGLES); - glColor3f(0,0,1); - glVertex3f( 0.9, -0.9, -30.0); - glColor3f(1,0,0); - glVertex3f( 0.9, 0.9, -30.0); - glColor3f(0,1,0); - glVertex3f(-0.9, 0.0, -30.0); - glEnd(); - - glFlush(); - - -} - - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB; - type |= GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow("First Tri") == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/fp/tri-pow.c b/progs/fp/tri-pow.c deleted file mode 100644 index ef91e43e99..0000000000 --- a/progs/fp/tri-pow.c +++ /dev/null @@ -1,109 +0,0 @@ - -#include -#include -#include -#define GL_GLEXT_PROTOTYPES -#include - - - -static void Init( void ) -{ - static const char *modulate2D = - "!!ARBfp1.0\n" - "TEMP R0;\n" - "POW result.color, fragment.color.x, fragment.color.y; \n" - "END" - ; - GLuint modulateProg; - - if (!glutExtensionSupported("GL_ARB_fragment_program")) { - printf("Error: GL_ARB_fragment_program not supported!\n"); - exit(1); - } - printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - - /* Setup the fragment program */ - glGenProgramsARB(1, &modulateProg); - glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg); - glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, - strlen(modulate2D), (const GLubyte *)modulate2D); - - printf("glGetError = 0x%x\n", (int) glGetError()); - printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n", - (char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB)); - - glEnable(GL_FRAGMENT_PROGRAM_ARB); - - glClearColor(.3, .3, .3, 0); -} - -static void Reshape(int width, int height) -{ - - glViewport(0, 0, (GLint)width, (GLint)height); - - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0); - glMatrixMode(GL_MODELVIEW); -} - -static void Key(unsigned char key, int x, int y) -{ - - switch (key) { - case 27: - exit(1); - default: - return; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - - glBegin(GL_TRIANGLES); - glColor3f(0,0,1); - glVertex3f( 0.9, -0.9, -30.0); - glColor3f(1,0,0); - glVertex3f( 0.9, 0.9, -30.0); - glColor3f(0,1,0); - glVertex3f(-0.9, 0.0, -30.0); - glEnd(); - - glFlush(); - - -} - - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB; - type |= GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow("First Tri") == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/fp/tri-rcp.c b/progs/fp/tri-rcp.c deleted file mode 100644 index e2a2704934..0000000000 --- a/progs/fp/tri-rcp.c +++ /dev/null @@ -1,110 +0,0 @@ - -#include -#include -#include -#define GL_GLEXT_PROTOTYPES -#include - - - -static void Init( void ) -{ - static const char *modulate2D = - "!!ARBfp1.0\n" - "TEMP R0;\n" - "ADD R0, fragment.color.x, fragment.color.x; \n" - "RCP result.color, R0.x; \n" - "END" - ; - GLuint modulateProg; - - if (!glutExtensionSupported("GL_ARB_fragment_program")) { - printf("Error: GL_ARB_fragment_program not supported!\n"); - exit(1); - } - printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - - /* Setup the fragment program */ - glGenProgramsARB(1, &modulateProg); - glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg); - glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, - strlen(modulate2D), (const GLubyte *)modulate2D); - - printf("glGetError = 0x%x\n", (int) glGetError()); - printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n", - (char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB)); - - glEnable(GL_FRAGMENT_PROGRAM_ARB); - - glClearColor(.3, .3, .3, 0); -} - -static void Reshape(int width, int height) -{ - - glViewport(0, 0, (GLint)width, (GLint)height); - - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0); - glMatrixMode(GL_MODELVIEW); -} - -static void Key(unsigned char key, int x, int y) -{ - - switch (key) { - case 27: - exit(1); - default: - return; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - - glBegin(GL_TRIANGLES); - glColor3f(0,0,1); - glVertex3f( 0.9, -0.9, -30.0); - glColor3f(1,0,0); - glVertex3f( 0.9, 0.9, -30.0); - glColor3f(0,1,0); - glVertex3f(-0.9, 0.0, -30.0); - glEnd(); - - glFlush(); - - -} - - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB; - type |= GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow("First Tri") == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/fp/tri-rsq.c b/progs/fp/tri-rsq.c deleted file mode 100644 index c5b2c1b32e..0000000000 --- a/progs/fp/tri-rsq.c +++ /dev/null @@ -1,110 +0,0 @@ - -#include -#include -#include -#define GL_GLEXT_PROTOTYPES -#include - - - -static void Init( void ) -{ - static const char *modulate2D = - "!!ARBfp1.0\n" - "TEMP R0;\n" - "MUL R0, fragment.color, {3.0}.x; \n" - "RSQ result.color, R0.x; \n" - "END" - ; - GLuint modulateProg; - - if (!glutExtensionSupported("GL_ARB_fragment_program")) { - printf("Error: GL_ARB_fragment_program not supported!\n"); - exit(1); - } - printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - - /* Setup the fragment program */ - glGenProgramsARB(1, &modulateProg); - glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg); - glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, - strlen(modulate2D), (const GLubyte *)modulate2D); - - printf("glGetError = 0x%x\n", (int) glGetError()); - printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n", - (char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB)); - - glEnable(GL_FRAGMENT_PROGRAM_ARB); - - glClearColor(.3, .3, .3, 0); -} - -static void Reshape(int width, int height) -{ - - glViewport(0, 0, (GLint)width, (GLint)height); - - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0); - glMatrixMode(GL_MODELVIEW); -} - -static void Key(unsigned char key, int x, int y) -{ - - switch (key) { - case 27: - exit(1); - default: - return; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - - glBegin(GL_TRIANGLES); - glColor3f(0,0,1); - glVertex3f( 0.9, -0.9, -30.0); - glColor3f(1,0,0); - glVertex3f( 0.9, 0.9, -30.0); - glColor3f(0,1,0); - glVertex3f(-0.9, 0.0, -30.0); - glEnd(); - - glFlush(); - - -} - - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB; - type |= GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow("First Tri") == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/fp/tri-scs.c b/progs/fp/tri-scs.c deleted file mode 100644 index ce7c0062c3..0000000000 --- a/progs/fp/tri-scs.c +++ /dev/null @@ -1,111 +0,0 @@ - -#include -#include -#include -#define GL_GLEXT_PROTOTYPES -#include -#include "GL/gl.h" - - - -static void Init( void ) -{ - static const char *modulate2D = - "!!ARBfp1.0\n" - "TEMP R0; \n" - "MUL R0, fragment.color, {3.14}.x; \n" - "SCS result.color, R0.x; \n" - "END" - ; - GLuint modulateProg; - - if (!glutExtensionSupported("GL_ARB_fragment_program")) { - printf("Error: GL_ARB_fragment_program not supported!\n"); - exit(1); - } - printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - - /* Setup the fragment program */ - glGenProgramsARB(1, &modulateProg); - glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg); - glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, - strlen(modulate2D), (const GLubyte *)modulate2D); - - printf("glGetError = 0x%x\n", (int) glGetError()); - printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n", - (char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB)); - - glEnable(GL_FRAGMENT_PROGRAM_ARB); - - glClearColor(.3, .3, .3, 0); -} - -static void Reshape(int width, int height) -{ - - glViewport(0, 0, (GLint)width, (GLint)height); - - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0); - glMatrixMode(GL_MODELVIEW); -} - -static void Key(unsigned char key, int x, int y) -{ - - switch (key) { - case 27: - exit(1); - default: - return; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - - glBegin(GL_TRIANGLES); - glColor3f(0,0,1); - glVertex3f( 0.9, -0.9, -30.0); - glColor3f(1,0,0); - glVertex3f( 0.9, 0.9, -30.0); - glColor3f(0,1,0); - glVertex3f(-0.9, 0.0, -30.0); - glEnd(); - - glFlush(); - - -} - - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB; - type |= GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow("First Tri") == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/fp/tri-sge.c b/progs/fp/tri-sge.c deleted file mode 100644 index 6a360ca932..0000000000 --- a/progs/fp/tri-sge.c +++ /dev/null @@ -1,109 +0,0 @@ - -#include -#include -#include -#define GL_GLEXT_PROTOTYPES -#include -#include "GL/gl.h" - - - -static void Init( void ) -{ - static const char *modulate2D = - "!!ARBfp1.0\n" - "SGE result.color, {0.5}.x, fragment.color; \n" - "END" - ; - GLuint modulateProg; - - if (!glutExtensionSupported("GL_ARB_fragment_program")) { - printf("Error: GL_ARB_fragment_program not supported!\n"); - exit(1); - } - printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - - /* Setup the fragment program */ - glGenProgramsARB(1, &modulateProg); - glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg); - glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, - strlen(modulate2D), (const GLubyte *)modulate2D); - - printf("glGetError = 0x%x\n", (int) glGetError()); - printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n", - (char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB)); - - glEnable(GL_FRAGMENT_PROGRAM_ARB); - - glClearColor(.3, .3, .3, 0); -} - -static void Reshape(int width, int height) -{ - - glViewport(0, 0, (GLint)width, (GLint)height); - - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0); - glMatrixMode(GL_MODELVIEW); -} - -static void Key(unsigned char key, int x, int y) -{ - - switch (key) { - case 27: - exit(1); - default: - return; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - - glBegin(GL_TRIANGLES); - glColor3f(0,0,1); - glVertex3f( 0.9, -0.9, -30.0); - glColor3f(1,0,0); - glVertex3f( 0.9, 0.9, -30.0); - glColor3f(0,1,0); - glVertex3f(-0.9, 0.0, -30.0); - glEnd(); - - glFlush(); - - -} - - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB; - type |= GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow("First Tri") == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/fp/tri-sge2.c b/progs/fp/tri-sge2.c deleted file mode 100644 index c4330098ed..0000000000 --- a/progs/fp/tri-sge2.c +++ /dev/null @@ -1,114 +0,0 @@ - -#include -#include -#include -#define GL_GLEXT_PROTOTYPES -#include -#include "GL/gl.h" - - - -static void Init( void ) -{ - static const char *modulate2D = - "!!ARBfp1.0\n" - "TEMP R0;\n" - "TEMP R1;\n" - "SGE R0, fragment.color, fragment.color.yzxw; \n" - "SGE R1, fragment.color, fragment.color.zxyw; \n" - "MUL R0, R0, R1; \n" - "MUL result.color, R0, fragment.color; \n" - "END" - ; - GLuint modulateProg; - - if (!glutExtensionSupported("GL_ARB_fragment_program")) { - printf("Error: GL_ARB_fragment_program not supported!\n"); - exit(1); - } - printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - - /* Setup the fragment program */ - glGenProgramsARB(1, &modulateProg); - glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg); - glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, - strlen(modulate2D), (const GLubyte *)modulate2D); - - printf("glGetError = 0x%x\n", (int) glGetError()); - printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n", - (char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB)); - - glEnable(GL_FRAGMENT_PROGRAM_ARB); - - glClearColor(.3, .3, .3, 0); -} - -static void Reshape(int width, int height) -{ - - glViewport(0, 0, (GLint)width, (GLint)height); - - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0); - glMatrixMode(GL_MODELVIEW); -} - -static void Key(unsigned char key, int x, int y) -{ - - switch (key) { - case 27: - exit(1); - default: - return; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - - glBegin(GL_TRIANGLES); - glColor3f(0,0,1); - glVertex3f( 0.9, -0.9, -30.0); - glColor3f(1,0,0); - glVertex3f( 0.9, 0.9, -30.0); - glColor3f(0,1,0); - glVertex3f(-0.9, 0.0, -30.0); - glEnd(); - - glFlush(); - - -} - - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB; - type |= GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow("First Tri") == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/fp/tri-sin.c b/progs/fp/tri-sin.c deleted file mode 100644 index 772903e4b2..0000000000 --- a/progs/fp/tri-sin.c +++ /dev/null @@ -1,114 +0,0 @@ - -#include -#include -#include -#define GL_GLEXT_PROTOTYPES -#include -#include "GL/gl.h" - - - -static void Init( void ) -{ - static const char *modulate2D = - "!!ARBfp1.0\n" - "TEMP R0; \n" - "MUL R0, fragment.color, {3.14}.x; \n" - "MOV result.color, {0.0}.x; \n" - "SIN result.color.x, R0.x; \n" - "SIN result.color.y, R0.y; \n" - "SIN result.color.z, R0.z; \n" - "END" - ; - GLuint modulateProg; - - if (!glutExtensionSupported("GL_ARB_fragment_program")) { - printf("Error: GL_ARB_fragment_program not supported!\n"); - exit(1); - } - printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - - /* Setup the fragment program */ - glGenProgramsARB(1, &modulateProg); - glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg); - glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, - strlen(modulate2D), (const GLubyte *)modulate2D); - - printf("glGetError = 0x%x\n", (int) glGetError()); - printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n", - (char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB)); - - glEnable(GL_FRAGMENT_PROGRAM_ARB); - - glClearColor(.3, .3, .3, 0); -} - -static void Reshape(int width, int height) -{ - - glViewport(0, 0, (GLint)width, (GLint)height); - - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0); - glMatrixMode(GL_MODELVIEW); -} - -static void Key(unsigned char key, int x, int y) -{ - - switch (key) { - case 27: - exit(1); - default: - return; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - - glBegin(GL_TRIANGLES); - glColor3f(0,0,1); - glVertex3f( 0.9, -0.9, -30.0); - glColor3f(1,0,0); - glVertex3f( 0.9, 0.9, -30.0); - glColor3f(0,1,0); - glVertex3f(-0.9, 0.0, -30.0); - glEnd(); - - glFlush(); - - -} - - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB; - type |= GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow("First Tri") == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/fp/tri-slt.c b/progs/fp/tri-slt.c deleted file mode 100644 index 4148a8def3..0000000000 --- a/progs/fp/tri-slt.c +++ /dev/null @@ -1,109 +0,0 @@ - -#include -#include -#include -#define GL_GLEXT_PROTOTYPES -#include -#include "GL/gl.h" - - - -static void Init( void ) -{ - static const char *modulate2D = - "!!ARBfp1.0\n" - "SLT result.color, {0.5}.x, fragment.color; \n" - "END" - ; - GLuint modulateProg; - - if (!glutExtensionSupported("GL_ARB_fragment_program")) { - printf("Error: GL_ARB_fragment_program not supported!\n"); - exit(1); - } - printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - - /* Setup the fragment program */ - glGenProgramsARB(1, &modulateProg); - glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg); - glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, - strlen(modulate2D), (const GLubyte *)modulate2D); - - printf("glGetError = 0x%x\n", (int) glGetError()); - printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n", - (char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB)); - - glEnable(GL_FRAGMENT_PROGRAM_ARB); - - glClearColor(.3, .3, .3, 0); -} - -static void Reshape(int width, int height) -{ - - glViewport(0, 0, (GLint)width, (GLint)height); - - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0); - glMatrixMode(GL_MODELVIEW); -} - -static void Key(unsigned char key, int x, int y) -{ - - switch (key) { - case 27: - exit(1); - default: - return; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - - glBegin(GL_TRIANGLES); - glColor3f(0,0,1); - glVertex3f( 0.9, -0.9, -30.0); - glColor3f(1,0,0); - glVertex3f( 0.9, 0.9, -30.0); - glColor3f(0,1,0); - glVertex3f(-0.9, 0.0, -30.0); - glEnd(); - - glFlush(); - - -} - - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB; - type |= GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow("First Tri") == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/fp/tri-sub.c b/progs/fp/tri-sub.c deleted file mode 100644 index 6faa414550..0000000000 --- a/progs/fp/tri-sub.c +++ /dev/null @@ -1,109 +0,0 @@ - -#include -#include -#include -#define GL_GLEXT_PROTOTYPES -#include -#include "GL/gl.h" - - - -static void Init( void ) -{ - static const char *modulate2D = - "!!ARBfp1.0\n" - "SUB result.color, fragment.color.yzxw, fragment.color; \n" - "END" - ; - GLuint modulateProg; - - if (!glutExtensionSupported("GL_ARB_fragment_program")) { - printf("Error: GL_ARB_fragment_program not supported!\n"); - exit(1); - } - printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - - /* Setup the fragment program */ - glGenProgramsARB(1, &modulateProg); - glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg); - glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, - strlen(modulate2D), (const GLubyte *)modulate2D); - - printf("glGetError = 0x%x\n", (int) glGetError()); - printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n", - (char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB)); - - glEnable(GL_FRAGMENT_PROGRAM_ARB); - - glClearColor(.3, .3, .3, 0); -} - -static void Reshape(int width, int height) -{ - - glViewport(0, 0, (GLint)width, (GLint)height); - - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0); - glMatrixMode(GL_MODELVIEW); -} - -static void Key(unsigned char key, int x, int y) -{ - - switch (key) { - case 27: - exit(1); - default: - return; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - - glBegin(GL_TRIANGLES); - glColor3f(0,0,1); - glVertex3f( 0.9, -0.9, -30.0); - glColor3f(1,0,0); - glVertex3f( 0.9, 0.9, -30.0); - glColor3f(0,1,0); - glVertex3f(-0.9, 0.0, -30.0); - glEnd(); - - glFlush(); - - -} - - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB; - type |= GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow("First Tri") == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/fp/tri-swz.c b/progs/fp/tri-swz.c deleted file mode 100644 index 5f34f7a322..0000000000 --- a/progs/fp/tri-swz.c +++ /dev/null @@ -1,109 +0,0 @@ - -#include -#include -#include -#define GL_GLEXT_PROTOTYPES -#include -#include "GL/gl.h" - - - -static void Init( void ) -{ - static const char *modulate2D = - "!!ARBfp1.0\n" - "SWZ result.color, fragment.color, 1,x,y,z; \n" - "END" - ; - GLuint modulateProg; - - if (!glutExtensionSupported("GL_ARB_fragment_program")) { - printf("Error: GL_ARB_fragment_program not supported!\n"); - exit(1); - } - printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - - /* Setup the fragment program */ - glGenProgramsARB(1, &modulateProg); - glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg); - glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, - strlen(modulate2D), (const GLubyte *)modulate2D); - - printf("glGetError = 0x%x\n", (int) glGetError()); - printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n", - (char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB)); - - glEnable(GL_FRAGMENT_PROGRAM_ARB); - - glClearColor(.3, .3, .3, 0); -} - -static void Reshape(int width, int height) -{ - - glViewport(0, 0, (GLint)width, (GLint)height); - - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0); - glMatrixMode(GL_MODELVIEW); -} - -static void Key(unsigned char key, int x, int y) -{ - - switch (key) { - case 27: - exit(1); - default: - return; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - - glBegin(GL_TRIANGLES); - glColor3f(0,0,1); - glVertex3f( 0.9, -0.9, -30.0); - glColor3f(1,0,0); - glVertex3f( 0.9, 0.9, -30.0); - glColor3f(0,1,0); - glVertex3f(-0.9, 0.0, -30.0); - glEnd(); - - glFlush(); - - -} - - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB; - type |= GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow("First Tri") == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/fp/tri-swz2.c b/progs/fp/tri-swz2.c deleted file mode 100644 index fd76b58f53..0000000000 --- a/progs/fp/tri-swz2.c +++ /dev/null @@ -1,109 +0,0 @@ - -#include -#include -#include -#define GL_GLEXT_PROTOTYPES -#include - - - -static void Init( void ) -{ - static const char *modulate2D = - "!!ARBfp1.0\n" - "TEMP R0, R1;\n" - "SWZ result.color, fragment.color, 1, 0, 0, 1; \n" - "END" - ; - GLuint modulateProg; - - if (!glutExtensionSupported("GL_ARB_fragment_program")) { - printf("Error: GL_ARB_fragment_program not supported!\n"); - exit(1); - } - printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - - /* Setup the fragment program */ - glGenProgramsARB(1, &modulateProg); - glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg); - glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, - strlen(modulate2D), (const GLubyte *)modulate2D); - - printf("glGetError = 0x%x\n", (int) glGetError()); - printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n", - (char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB)); - - glEnable(GL_FRAGMENT_PROGRAM_ARB); - - glClearColor(.3, .3, .3, 0); -} - -static void Reshape(int width, int height) -{ - - glViewport(0, 0, (GLint)width, (GLint)height); - - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0); - glMatrixMode(GL_MODELVIEW); -} - -static void Key(unsigned char key, int x, int y) -{ - - switch (key) { - case 27: - exit(1); - default: - return; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - - glBegin(GL_TRIANGLES); - glColor3f(0,0,1); - glVertex3f( 0.9, -0.9, -30.0); - glColor3f(1,0,0); - glVertex3f( 0.9, 0.9, -30.0); - glColor3f(0,1,0); - glVertex3f(-0.9, 0.0, -30.0); - glEnd(); - - glFlush(); - - -} - - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB; - type |= GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow("First Tri") == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/fp/tri-tex.c b/progs/fp/tri-tex.c deleted file mode 100644 index 87f63894ce..0000000000 --- a/progs/fp/tri-tex.c +++ /dev/null @@ -1,130 +0,0 @@ - -#include -#include -#include -#include -#define GL_GLEXT_PROTOTYPES -#include - -#include "readtex.c" - - -#define TEXTURE_FILE "../images/girl.rgb" - - - -static void Init( void ) -{ - static const char *modulate2D = - "!!ARBfp1.0\n" - "TEX result.color, fragment.color, texture[0], 2D; \n" - "END" - ; - GLuint modulateProg; - GLuint Texture; - - if (!glutExtensionSupported("GL_ARB_fragment_program")) { - printf("Error: GL_ARB_fragment_program not supported!\n"); - exit(1); - } - printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - - /* Setup the fragment program */ - glGenProgramsARB(1, &modulateProg); - glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg); - glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, - strlen(modulate2D), (const GLubyte *)modulate2D); - - printf("glGetError = 0x%x\n", (int) glGetError()); - printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n", - (char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB)); - assert(glIsProgramARB(modulateProg)); - - glEnable(GL_FRAGMENT_PROGRAM_ARB); - - /* Load texture */ - glGenTextures(1, &Texture); - glBindTexture(GL_TEXTURE_2D, Texture); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - glPixelStorei(GL_UNPACK_ALIGNMENT, 1); - if (!LoadRGBMipmaps(TEXTURE_FILE, GL_RGB)) { - printf("Error: couldn't load texture image file %s\n", TEXTURE_FILE); - exit(1); - } - /* XXX this enable shouldn't really be needed!!! */ - glEnable(GL_TEXTURE_2D); - - glClearColor(.3, .3, .3, 0); -} - -static void Reshape(int width, int height) -{ - - glViewport(0, 0, (GLint)width, (GLint)height); - - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0); - glMatrixMode(GL_MODELVIEW); -} - -static void Key(unsigned char key, int x, int y) -{ - - switch (key) { - case 27: - exit(1); - default: - return; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - - glBegin(GL_TRIANGLES); - glColor3f(0,0,1); -/* glTexCoord2f(1, 0); */ - glVertex3f( 0.9, -0.9, -30.0); - glColor3f(1,0,0); -/* glTexCoord2f(1, 1); */ - glVertex3f( 0.9, 0.9, -30.0); - glColor3f(0,1,0); -/* glTexCoord2f(0, .5); */ - glVertex3f(-0.9, 0.0, -30.0); - glEnd(); - - glFlush(); -} - - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB; - type |= GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow("First Tri") == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/fp/tri-xpd.c b/progs/fp/tri-xpd.c deleted file mode 100644 index 9aca46b2fa..0000000000 --- a/progs/fp/tri-xpd.c +++ /dev/null @@ -1,108 +0,0 @@ - -#include -#include -#include -#define GL_GLEXT_PROTOTYPES -#include -#include "GL/gl.h" - - - -static void Init( void ) -{ - static const char *modulate2D = - "!!ARBfp1.0\n" - "XPD result.color, fragment.color, {2,2,2,0}; \n" - "END" - ; - GLuint modulateProg; - - if (!glutExtensionSupported("GL_ARB_fragment_program")) { - printf("Error: GL_ARB_fragment_program not supported!\n"); - exit(1); - } - printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - - /* Setup the fragment program */ - glGenProgramsARB(1, &modulateProg); - glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg); - glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, - strlen(modulate2D), (const GLubyte *)modulate2D); - - printf("glGetError = 0x%x\n", (int) glGetError()); - printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n", - (char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB)); - - glEnable(GL_FRAGMENT_PROGRAM_ARB); - - glClearColor(.3, .3, .3, 0); -} - -static void Reshape(int width, int height) -{ - - glViewport(0, 0, (GLint)width, (GLint)height); - - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0); - glMatrixMode(GL_MODELVIEW); -} - -static void Key(unsigned char key, int x, int y) -{ - - switch (key) { - case 27: - exit(1); - default: - return; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - - glBegin(GL_TRIANGLES); - glColor3f(0,0,1); - glVertex3f( 0.9, -0.9, -30.0); - glColor3f(1,0,0); - glVertex3f( 0.9, 0.9, -30.0); - glColor3f(0,1,0); - glVertex3f(-0.9, 0.0, -30.0); - glEnd(); - - glFlush(); - - -} - - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB; - type |= GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow("First Tri") == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/glsl/.gitignore b/progs/glsl/.gitignore deleted file mode 100644 index 21c41da0cd..0000000000 --- a/progs/glsl/.gitignore +++ /dev/null @@ -1,18 +0,0 @@ -bitmap -brick -bump -deriv -extfuncs.h -mandelbrot -multinoise -multitex -noise -points -readtex.c -readtex.h -shaderutil.c -shaderutil.h -texdemo1 -toyball -trirast -twoside diff --git a/progs/glsl/readtex.c b/progs/glsl/readtex.c new file mode 100644 index 0000000000..37d5fcd0d3 --- /dev/null +++ b/progs/glsl/readtex.c @@ -0,0 +1,454 @@ +/* readtex.c */ + +/* + * Read an SGI .rgb image file and generate a mipmap texture set. + * Much of this code was borrowed from SGI's tk OpenGL toolkit. + */ + + + +#include +#include +#include +#include +#include +#include "readtex.h" + + +#ifndef SEEK_SET +# define SEEK_SET 0 +#endif + + +/* +** RGB Image Structure +*/ + +typedef struct _TK_RGBImageRec { + GLint sizeX, sizeY; + GLint components; + unsigned char *data; +} TK_RGBImageRec; + + + +/******************************************************************************/ + +typedef struct _rawImageRec { + unsigned short imagic; + unsigned short type; + unsigned short dim; + unsigned short sizeX, sizeY, sizeZ; + unsigned long min, max; + unsigned long wasteBytes; + char name[80]; + unsigned long colorMap; + FILE *file; + unsigned char *tmp, *tmpR, *tmpG, *tmpB, *tmpA; + unsigned long rleEnd; + GLuint *rowStart; + GLint *rowSize; +} rawImageRec; + +/******************************************************************************/ + +static void ConvertShort(unsigned short *array, long length) +{ + unsigned long b1, b2; + unsigned char *ptr; + + ptr = (unsigned char *)array; + while (length--) { + b1 = *ptr++; + b2 = *ptr++; + *array++ = (unsigned short) ((b1 << 8) | (b2)); + } +} + +static void ConvertLong(GLuint *array, long length) +{ + unsigned long b1, b2, b3, b4; + unsigned char *ptr; + + ptr = (unsigned char *)array; + while (length--) { + b1 = *ptr++; + b2 = *ptr++; + b3 = *ptr++; + b4 = *ptr++; + *array++ = (b1 << 24) | (b2 << 16) | (b3 << 8) | (b4); + } +} + +static rawImageRec *RawImageOpen(const char *fileName) +{ + union { + int testWord; + char testByte[4]; + } endianTest; + rawImageRec *raw; + GLenum swapFlag; + int x; + + endianTest.testWord = 1; + if (endianTest.testByte[0] == 1) { + swapFlag = GL_TRUE; + } else { + swapFlag = GL_FALSE; + } + + raw = (rawImageRec *)calloc(1, sizeof(rawImageRec)); + if (raw == NULL) { + fprintf(stderr, "Out of memory!\n"); + return NULL; + } + if ((raw->file = fopen(fileName, "rb")) == NULL) { + perror(fileName); + return NULL; + } + + fread(raw, 1, 12, raw->file); + + if (swapFlag) { + ConvertShort(&raw->imagic, 6); + } + + raw->tmp = (unsigned char *)malloc(raw->sizeX*256); + raw->tmpR = (unsigned char *)malloc(raw->sizeX*256); + raw->tmpG = (unsigned char *)malloc(raw->sizeX*256); + raw->tmpB = (unsigned char *)malloc(raw->sizeX*256); + if (raw->sizeZ==4) { + raw->tmpA = (unsigned char *)malloc(raw->sizeX*256); + } + if (raw->tmp == NULL || raw->tmpR == NULL || raw->tmpG == NULL || + raw->tmpB == NULL) { + fprintf(stderr, "Out of memory!\n"); + return NULL; + } + + if ((raw->type & 0xFF00) == 0x0100) { + x = raw->sizeY * raw->sizeZ * sizeof(GLuint); + raw->rowStart = (GLuint *)malloc(x); + raw->rowSize = (GLint *)malloc(x); + if (raw->rowStart == NULL || raw->rowSize == NULL) { + fprintf(stderr, "Out of memory!\n"); + return NULL; + } + raw->rleEnd = 512 + (2 * x); + fseek(raw->file, 512, SEEK_SET); + fread(raw->rowStart, 1, x, raw->file); + fread(raw->rowSize, 1, x, raw->file); + if (swapFlag) { + ConvertLong(raw->rowStart, (long) (x/sizeof(GLuint))); + ConvertLong((GLuint *)raw->rowSize, (long) (x/sizeof(GLint))); + } + } + return raw; +} + +static void RawImageClose(rawImageRec *raw) +{ + fclose(raw->file); + free(raw->tmp); + free(raw->tmpR); + free(raw->tmpG); + free(raw->tmpB); + if (raw->rowStart) + free(raw->rowStart); + if (raw->rowSize) + free(raw->rowSize); + if (raw->sizeZ>3) { + free(raw->tmpA); + } + free(raw); +} + +static void RawImageGetRow(rawImageRec *raw, unsigned char *buf, int y, int z) +{ + unsigned char *iPtr, *oPtr, pixel; + int count, done = 0; + + if ((raw->type & 0xFF00) == 0x0100) { + fseek(raw->file, (long) raw->rowStart[y+z*raw->sizeY], SEEK_SET); + fread(raw->tmp, 1, (unsigned int)raw->rowSize[y+z*raw->sizeY], + raw->file); + + iPtr = raw->tmp; + oPtr = buf; + while (!done) { + pixel = *iPtr++; + count = (int)(pixel & 0x7F); + if (!count) { + done = 1; + return; + } + if (pixel & 0x80) { + while (count--) { + *oPtr++ = *iPtr++; + } + } else { + pixel = *iPtr++; + while (count--) { + *oPtr++ = pixel; + } + } + } + } else { + fseek(raw->file, 512+(y*raw->sizeX)+(z*raw->sizeX*raw->sizeY), + SEEK_SET); + fread(buf, 1, raw->sizeX, raw->file); + } +} + + +static void RawImageGetData(rawImageRec *raw, TK_RGBImageRec *final) +{ + unsigned char *ptr; + int i, j; + + final->data = (unsigned char *)malloc((raw->sizeX+1)*(raw->sizeY+1)*4); + if (final->data == NULL) { + fprintf(stderr, "Out of memory!\n"); + } + + ptr = final->data; + for (i = 0; i < (int)(raw->sizeY); i++) { + RawImageGetRow(raw, raw->tmpR, i, 0); + RawImageGetRow(raw, raw->tmpG, i, 1); + RawImageGetRow(raw, raw->tmpB, i, 2); + if (raw->sizeZ>3) { + RawImageGetRow(raw, raw->tmpA, i, 3); + } + for (j = 0; j < (int)(raw->sizeX); j++) { + *ptr++ = *(raw->tmpR + j); + *ptr++ = *(raw->tmpG + j); + *ptr++ = *(raw->tmpB + j); + if (raw->sizeZ>3) { + *ptr++ = *(raw->tmpA + j); + } + } + } +} + + +static TK_RGBImageRec *tkRGBImageLoad(const char *fileName) +{ + rawImageRec *raw; + TK_RGBImageRec *final; + + raw = RawImageOpen(fileName); + if (!raw) { + fprintf(stderr, "File not found\n"); + return NULL; + } + final = (TK_RGBImageRec *)malloc(sizeof(TK_RGBImageRec)); + if (final == NULL) { + fprintf(stderr, "Out of memory!\n"); + return NULL; + } + final->sizeX = raw->sizeX; + final->sizeY = raw->sizeY; + final->components = raw->sizeZ; + RawImageGetData(raw, final); + RawImageClose(raw); + return final; +} + + +static void FreeImage( TK_RGBImageRec *image ) +{ + free(image->data); + free(image); +} + + +/* + * Load an SGI .rgb file and generate a set of 2-D mipmaps from it. + * Input: imageFile - name of .rgb to read + * intFormat - internal texture format to use, or number of components + * Return: GL_TRUE if success, GL_FALSE if error. + */ +GLboolean LoadRGBMipmaps( const char *imageFile, GLint intFormat ) +{ + GLint w, h; + return LoadRGBMipmaps2( imageFile, GL_TEXTURE_2D, intFormat, &w, &h ); +} + + + +GLboolean LoadRGBMipmaps2( const char *imageFile, GLenum target, + GLint intFormat, GLint *width, GLint *height ) +{ + GLint error; + GLenum format; + TK_RGBImageRec *image; + + image = tkRGBImageLoad( imageFile ); + if (!image) { + return GL_FALSE; + } + + if (image->components==3) { + format = GL_RGB; + } + else if (image->components==4) { + format = GL_RGBA; + } + else { + /* not implemented */ + fprintf(stderr, + "Error in LoadRGBMipmaps %d-component images not implemented\n", + image->components ); + return GL_FALSE; + } + + error = gluBuild2DMipmaps( target, + intFormat, + image->sizeX, image->sizeY, + format, + GL_UNSIGNED_BYTE, + image->data ); + + *width = image->sizeX; + *height = image->sizeY; + + FreeImage(image); + + return error ? GL_FALSE : GL_TRUE; +} + + + +/* + * Load an SGI .rgb file and return a pointer to the image data. + * Input: imageFile - name of .rgb to read + * Output: width - width of image + * height - height of image + * format - format of image (GL_RGB or GL_RGBA) + * Return: pointer to image data or NULL if error + */ +GLubyte *LoadRGBImage( const char *imageFile, GLint *width, GLint *height, + GLenum *format ) +{ + TK_RGBImageRec *image; + GLint bytes; + GLubyte *buffer; + + image = tkRGBImageLoad( imageFile ); + if (!image) { + return NULL; + } + + if (image->components==3) { + *format = GL_RGB; + } + else if (image->components==4) { + *format = GL_RGBA; + } + else { + /* not implemented */ + fprintf(stderr, + "Error in LoadRGBImage %d-component images not implemented\n", + image->components ); + return NULL; + } + + *width = image->sizeX; + *height = image->sizeY; + + bytes = image->sizeX * image->sizeY * image->components; + buffer = (GLubyte *) malloc(bytes); + if (!buffer) + return NULL; + + memcpy( (void *) buffer, (void *) image->data, bytes ); + + FreeImage(image); + + return buffer; +} + +#define CLAMP( X, MIN, MAX ) ( (X)<(MIN) ? (MIN) : ((X)>(MAX) ? (MAX) : (X)) ) + + +static void ConvertRGBtoYUV(GLint w, GLint h, GLint texel_bytes, + const GLubyte *src, + GLushort *dest) +{ + GLint i, j; + + for (i = 0; i < h; i++) { + for (j = 0; j < w; j++) { + const GLfloat r = (src[0]) / 255.0; + const GLfloat g = (src[1]) / 255.0; + const GLfloat b = (src[2]) / 255.0; + GLfloat y, cr, cb; + GLint iy, icr, icb; + + y = r * 65.481 + g * 128.553 + b * 24.966 + 16; + cb = r * -37.797 + g * -74.203 + b * 112.0 + 128; + cr = r * 112.0 + g * -93.786 + b * -18.214 + 128; + /*printf("%f %f %f -> %f %f %f\n", r, g, b, y, cb, cr);*/ + iy = (GLint) CLAMP(y, 0, 254); + icb = (GLint) CLAMP(cb, 0, 254); + icr = (GLint) CLAMP(cr, 0, 254); + + if (j & 1) { + /* odd */ + *dest = (iy << 8) | icr; + } + else { + /* even */ + *dest = (iy << 8) | icb; + } + dest++; + src += texel_bytes; + } + } +} + + +/* + * Load an SGI .rgb file and return a pointer to the image data, converted + * to 422 yuv. + * + * Input: imageFile - name of .rgb to read + * Output: width - width of image + * height - height of image + * Return: pointer to image data or NULL if error + */ +GLushort *LoadYUVImage( const char *imageFile, GLint *width, GLint *height ) +{ + TK_RGBImageRec *image; + GLushort *buffer; + + image = tkRGBImageLoad( imageFile ); + if (!image) { + return NULL; + } + + if (image->components != 3 && image->components !=4 ) { + /* not implemented */ + fprintf(stderr, + "Error in LoadYUVImage %d-component images not implemented\n", + image->components ); + return NULL; + } + + *width = image->sizeX; + *height = image->sizeY; + + buffer = (GLushort *) malloc( image->sizeX * image->sizeY * 2 ); + + if (buffer) + ConvertRGBtoYUV( image->sizeX, + image->sizeY, + image->components, + image->data, + buffer ); + + + FreeImage(image); + return buffer; +} + diff --git a/progs/glsl/readtex.h b/progs/glsl/readtex.h new file mode 100644 index 0000000000..6c9a3828d3 --- /dev/null +++ b/progs/glsl/readtex.h @@ -0,0 +1,26 @@ +/* readtex.h */ + +#ifndef READTEX_H +#define READTEX_H + + +#include + + +extern GLboolean +LoadRGBMipmaps( const char *imageFile, GLint intFormat ); + + +extern GLboolean +LoadRGBMipmaps2( const char *imageFile, GLenum target, + GLint intFormat, GLint *width, GLint *height ); + + +extern GLubyte * +LoadRGBImage( const char *imageFile, + GLint *width, GLint *height, GLenum *format ); + +extern GLushort * +LoadYUVImage( const char *imageFile, GLint *width, GLint *height ); + +#endif diff --git a/progs/glsl/shaderutil.c b/progs/glsl/shaderutil.c new file mode 100644 index 0000000000..2f1c4e38b3 --- /dev/null +++ b/progs/glsl/shaderutil.c @@ -0,0 +1,168 @@ +/** + * Utilities for OpenGL shading language + * + * Brian Paul + * 9 April 2008 + */ + + +#include +#include +#include +#include +#include "extfuncs.h" +#include "shaderutil.h" + + +static void +Init(void) +{ + static GLboolean firstCall = GL_TRUE; + if (firstCall) { + GetExtensionFuncs(); + firstCall = GL_FALSE; + } +} + + +GLboolean +ShadersSupported(void) +{ + const char *version = (const char *) glGetString(GL_VERSION); + if (version[0] == '2' && version[1] == '.') { + return GL_TRUE; + } + else if (glutExtensionSupported("GL_ARB_vertex_shader") + && glutExtensionSupported("GL_ARB_fragment_shader") + && glutExtensionSupported("GL_ARB_shader_objects")) { + fprintf(stderr, "Warning: Trying ARB GLSL instead of OpenGL 2.x. This may not work.\n"); + return GL_TRUE; + } + return GL_TRUE; +} + + +GLuint +CompileShaderText(GLenum shaderType, const char *text) +{ + GLuint shader; + GLint stat; + + Init(); + + shader = glCreateShader_func(shaderType); + glShaderSource_func(shader, 1, (const GLchar **) &text, NULL); + glCompileShader_func(shader); + glGetShaderiv_func(shader, GL_COMPILE_STATUS, &stat); + if (!stat) { + GLchar log[1000]; + GLsizei len; + glGetShaderInfoLog_func(shader, 1000, &len, log); + fprintf(stderr, "Error: problem compiling shader: %s\n", log); + exit(1); + } + else { + /*printf("Shader compiled OK\n");*/ + } + return shader; +} + + +/** + * Read a shader from a file. + */ +GLuint +CompileShaderFile(GLenum shaderType, const char *filename) +{ + const int max = 100*1000; + int n; + char *buffer = (char*) malloc(max); + GLuint shader; + + FILE *f = fopen(filename, "r"); + if (!f) { + fprintf(stderr, "Unable to open shader file %s\n", filename); + return 0; + } + + n = fread(buffer, 1, max, f); + /*printf("read %d bytes from shader file %s\n", n, filename);*/ + if (n > 0) { + buffer[n] = 0; + shader = CompileShaderText(shaderType, buffer); + } + else { + return 0; + } + + fclose(f); + free(buffer); + + return shader; +} + + +GLuint +LinkShaders(GLuint vertShader, GLuint fragShader) +{ + GLuint program = glCreateProgram_func(); + + assert(vertShader || fragShader); + + if (fragShader) + glAttachShader_func(program, fragShader); + if (vertShader) + glAttachShader_func(program, vertShader); + glLinkProgram_func(program); + + /* check link */ + { + GLint stat; + glGetProgramiv_func(program, GL_LINK_STATUS, &stat); + if (!stat) { + GLchar log[1000]; + GLsizei len; + glGetProgramInfoLog_func(program, 1000, &len, log); + fprintf(stderr, "Shader link error:\n%s\n", log); + return 0; + } + } + + return program; +} + + +void +InitUniforms(GLuint program, struct uniform_info uniforms[]) +{ + GLuint i; + + for (i = 0; uniforms[i].name; i++) { + uniforms[i].location + = glGetUniformLocation_func(program, uniforms[i].name); + + printf("Uniform %s location: %d\n", uniforms[i].name, + uniforms[i].location); + + switch (uniforms[i].size) { + case 1: + if (uniforms[i].type == GL_INT) + glUniform1i_func(uniforms[i].location, + (GLint) uniforms[i].value[0]); + else + glUniform1fv_func(uniforms[i].location, 1, uniforms[i].value); + break; + case 2: + glUniform2fv_func(uniforms[i].location, 1, uniforms[i].value); + break; + case 3: + glUniform3fv_func(uniforms[i].location, 1, uniforms[i].value); + break; + case 4: + glUniform4fv_func(uniforms[i].location, 1, uniforms[i].value); + break; + default: + abort(); + } + } +} diff --git a/progs/miniglx/.gitignore b/progs/miniglx/.gitignore deleted file mode 100644 index f630f591f6..0000000000 --- a/progs/miniglx/.gitignore +++ /dev/null @@ -1,6 +0,0 @@ -manytex -miniglxsample -miniglxtest -sample_server -sample_server2 -texline diff --git a/progs/miniglx/Makefile b/progs/miniglx/Makefile deleted file mode 100644 index d5258b0a96..0000000000 --- a/progs/miniglx/Makefile +++ /dev/null @@ -1,60 +0,0 @@ -# Makefile for miniglx demo programs - -TOP = ../.. - -include $(TOP)/configs/current - - -SOURCES = miniglxtest.c \ - miniglxsample.c \ - sample_server.c \ - sample_server2.c \ - manytex.c \ - texline.c - -OBJECTS = $(SOURCES:.c=.o) - -PROGS = $(SOURCES:%.c=%) - -INCLUDES = \ - -I. \ - -I$(TOP)/include - -LIBS = -L$(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) $(APP_LIB_DEPS) - - -##### RULES ##### - -.SUFFIXES: -.SUFFIXES: .c - -.c: - $(CC) $(INCLUDES) $(CFLAGS) $(LDFLAGS) $< $(LIBS) -o $@ - -.c.o: - $(CC) -c $(INCLUDES) $(CFLAGS) $< -o $@ - -.S.o: - $(CC) -c $(INCLUDES) $(CFLAGS) $< -o $@ - - -##### TARGETS ##### - -default: depend $(PROGS) - -clean: - -rm -f $(PROGS) - -rm -f *.o - - -depend: $(SOURCES) - touch depend - $(MKDEP) $(MKDEP_OPTIONS) $(INCLUDES) $(SOURCES) > /dev/null - - -# Emacs tags -tags: - etags `find . -name \*.[ch]` `find ../include` - - -include depend diff --git a/progs/miniglx/glfbdevtest.c b/progs/miniglx/glfbdevtest.c deleted file mode 100644 index d4efb96930..0000000000 --- a/progs/miniglx/glfbdevtest.c +++ /dev/null @@ -1,477 +0,0 @@ - -/* - * Test the GLFBDev interface. Only tested with radeonfb driver!!!! - */ - - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "GL/glfbdev.h" - -#define DEFAULT_DEPTH 8 - -static struct fb_fix_screeninfo FixedInfo; -static struct fb_var_screeninfo VarInfo, OrigVarInfo; -static int DesiredDepth = 0; -static int OriginalVT = -1; -static int ConsoleFD = -1; -static int FrameBufferFD = -1; -static caddr_t FrameBuffer = (caddr_t) -1; -static caddr_t MMIOAddress = (caddr_t) -1; - - -static void -print_fixed_info(const struct fb_fix_screeninfo *fixed, const char *s) -{ - static const char *visuals[] = { - "MONO01", "MONO10", "TRUECOLOR", "PSEUDOCOLOR", - "DIRECTCOLOR", "STATIC_PSEUDOCOLOR" - }; - - printf("%s info -----------------------\n", s); - printf("id = %16s\n", fixed->id); - printf("smem_start = 0x%x\n", fixed->smem_start); - printf("smem_len = %d (0x%x)\n", fixed->smem_len, fixed->smem_len); - printf("type = 0x%x\n", fixed->type); - printf("type_aux = 0x%x\n", fixed->type_aux); - printf("visual = 0x%x (%s)\n", fixed->visual, visuals[fixed->visual]); - printf("xpanstep = %d\n", fixed->xpanstep); - printf("ypanstep = %d\n", fixed->ypanstep); - printf("ywrapstep = %d\n", fixed->ywrapstep); - printf("line_length = %d\n", fixed->line_length); - printf("mmio_start = 0x%x\n", fixed->mmio_start); - printf("mmio_len = %d (0x%x)\n", fixed->mmio_len, fixed->mmio_len); - printf("accel = 0x%x\n", fixed->accel); -} - - -static void -print_var_info(const struct fb_var_screeninfo *var, const char *s) -{ - printf("%s info -----------------------\n", s); - printf("xres = %d\n", var->xres); - printf("yres = %d\n", var->yres); - printf("xres_virtual = %d\n", var->xres_virtual); - printf("yres_virtual = %d\n", var->yres_virtual); - printf("xoffset = %d\n", var->xoffset); - printf("yoffset = %d\n", var->yoffset); - printf("bits_per_pixel = %d\n", var->bits_per_pixel); - printf("grayscale = %d\n", var->grayscale); - - printf("red.offset = %d length = %d msb_right = %d\n", - var->red.offset, var->red.length, var->red.msb_right); - printf("green.offset = %d length = %d msb_right = %d\n", - var->green.offset, var->green.length, var->green.msb_right); - printf("blue.offset = %d length = %d msb_right = %d\n", - var->blue.offset, var->blue.length, var->blue.msb_right); - printf("transp.offset = %d length = %d msb_right = %d\n", - var->transp.offset, var->transp.length, var->transp.msb_right); - - printf("nonstd = %d\n", var->nonstd); - printf("activate = %d\n", var->activate); - printf("height = %d mm\n", var->height); - printf("width = %d mm\n", var->width); - printf("accel_flags = 0x%x\n", var->accel_flags); - printf("pixclock = %d\n", var->pixclock); - printf("left_margin = %d\n", var->left_margin); - printf("right_margin = %d\n", var->right_margin); - printf("upper_margin = %d\n", var->upper_margin); - printf("lower_margin = %d\n", var->lower_margin); - printf("hsync_len = %d\n", var->hsync_len); - printf("vsync_len = %d\n", var->vsync_len); - printf("sync = %d\n", var->sync); - printf("vmode = %d\n", var->vmode); -} - - -static void -signal_handler(int signumber) -{ - signal(signumber, SIG_IGN); /* prevent recursion! */ - fprintf(stderr, "error: got signal %d (exiting)\n", signumber); - exit(1); -} - - -static void -initialize_fbdev( void ) -{ - char ttystr[1000]; - int fd, vtnumber, ttyfd; - int sz; - - if (geteuid()) { - fprintf(stderr, "error: you need to be root\n"); - exit(1); - } - -#if 1 - /* open the framebuffer device */ - FrameBufferFD = open("/dev/fb0", O_RDWR); - if (FrameBufferFD < 0) { - fprintf(stderr, "Error opening /dev/fb0: %s\n", strerror(errno)); - exit(1); - } -#endif - - /* open /dev/tty0 and get the vt number */ - if ((fd = open("/dev/tty0", O_WRONLY, 0)) < 0) { - fprintf(stderr, "error opening /dev/tty0\n"); - exit(1); - } - if (ioctl(fd, VT_OPENQRY, &vtnumber) < 0 || vtnumber < 0) { - fprintf(stderr, "error: couldn't get a free vt\n"); - exit(1); - } - close(fd); - - /* open the console tty */ - sprintf(ttystr, "/dev/tty%d", vtnumber); /* /dev/tty1-64 */ - ConsoleFD = open(ttystr, O_RDWR | O_NDELAY, 0); - if (ConsoleFD < 0) { - fprintf(stderr, "error couldn't open console fd\n"); - exit(1); - } - - /* save current vt number */ - { - struct vt_stat vts; - if (ioctl(ConsoleFD, VT_GETSTATE, &vts) == 0) - OriginalVT = vts.v_active; - } - - /* disconnect from controlling tty */ - ttyfd = open("/dev/tty", O_RDWR); - if (ttyfd >= 0) { - ioctl(ttyfd, TIOCNOTTY, 0); - close(ttyfd); - } - - /* some magic to restore the vt when we exit */ - { - struct vt_mode vt; - if (ioctl(ConsoleFD, VT_ACTIVATE, vtnumber) != 0) - printf("ioctl VT_ACTIVATE: %s\n", strerror(errno)); - if (ioctl(ConsoleFD, VT_WAITACTIVE, vtnumber) != 0) - printf("ioctl VT_WAITACTIVE: %s\n", strerror(errno)); - - if (ioctl(ConsoleFD, VT_GETMODE, &vt) < 0) { - fprintf(stderr, "error: ioctl VT_GETMODE: %s\n", strerror(errno)); - exit(1); - } - - vt.mode = VT_PROCESS; - vt.relsig = SIGUSR1; - vt.acqsig = SIGUSR1; - if (ioctl(ConsoleFD, VT_SETMODE, &vt) < 0) { - fprintf(stderr, "error: ioctl(VT_SETMODE) failed: %s\n", - strerror(errno)); - exit(1); - } - } - - /* go into graphics mode */ - if (ioctl(ConsoleFD, KDSETMODE, KD_GRAPHICS) < 0) { - fprintf(stderr, "error: ioctl(KDSETMODE, KD_GRAPHICS) failed: %s\n", - strerror(errno)); - exit(1); - } - - -#if 0 - /* open the framebuffer device */ - FrameBufferFD = open("/dev/fb0", O_RDWR); - if (FrameBufferFD < 0) { - fprintf(stderr, "Error opening /dev/fb0: %s\n", strerror(errno)); - exit(1); - } -#endif - - /* Get the fixed screen info */ - if (ioctl(FrameBufferFD, FBIOGET_FSCREENINFO, &FixedInfo)) { - fprintf(stderr, "error: ioctl(FBIOGET_FSCREENINFO) failed: %s\n", - strerror(errno)); - exit(1); - } - - print_fixed_info(&FixedInfo, "Fixed"); - - - /* get the variable screen info */ - if (ioctl(FrameBufferFD, FBIOGET_VSCREENINFO, &OrigVarInfo)) { - fprintf(stderr, "error: ioctl(FBIOGET_VSCREENINFO) failed: %s\n", - strerror(errno)); - exit(1); - } - - print_var_info(&OrigVarInfo, "Orig Var"); - - /* operate on a copy */ - VarInfo = OrigVarInfo; - - /* set the depth, resolution, etc */ - DesiredDepth = 32; - if (DesiredDepth) - VarInfo.bits_per_pixel = DesiredDepth; - - if (VarInfo.bits_per_pixel == 16) { - VarInfo.red.offset = 11; - VarInfo.green.offset = 5; - VarInfo.blue.offset = 0; - VarInfo.red.length = 5; - VarInfo.green.length = 6; - VarInfo.blue.length = 5; - VarInfo.transp.offset = 0; - VarInfo.transp.length = 0; - } - else if (VarInfo.bits_per_pixel == 32) { - VarInfo.red.offset = 16; - VarInfo.green.offset = 8; - VarInfo.blue.offset = 0; - VarInfo.transp.offset = 24; - VarInfo.red.length = 8; - VarInfo.green.length = 8; - VarInfo.blue.length = 8; - VarInfo.transp.length = 8; - } - /* timing values taken from /etc/fb.modes (1280x1024 @ 75Hz) */ - VarInfo.xres_virtual = VarInfo.xres = 1280; - VarInfo.yres_virtual = VarInfo.yres = 1024; - VarInfo.pixclock = 7408; - VarInfo.left_margin = 248; - VarInfo.right_margin = 16; - VarInfo.upper_margin = 38; - VarInfo.lower_margin = 1; - VarInfo.hsync_len = 144; - VarInfo.vsync_len = 3; - - VarInfo.xoffset = 0; - VarInfo.yoffset = 0; - VarInfo.nonstd = 0; - VarInfo.vmode &= ~FB_VMODE_YWRAP; /* turn off scrolling */ - - /* set new variable screen info */ - if (ioctl(FrameBufferFD, FBIOPUT_VSCREENINFO, &VarInfo)) { - fprintf(stderr, "ioctl(FBIOPUT_VSCREENINFO failed): %s\n", - strerror(errno)); - exit(1); - } - - print_var_info(&VarInfo, "New Var"); - - if (FixedInfo.visual != FB_VISUAL_TRUECOLOR && - FixedInfo.visual != FB_VISUAL_DIRECTCOLOR) { - fprintf(stderr, "non-TRUE/DIRECT-COLOR visuals (0x%x) not supported by this demo.\n", FixedInfo.visual); - exit(1); - } - - /* initialize colormap */ - if (FixedInfo.visual == FB_VISUAL_DIRECTCOLOR) { - struct fb_cmap cmap; - unsigned short red[256], green[256], blue[256]; - int i; - - /* we're assuming 256 entries here */ - printf("initializing directcolor colormap\n"); - cmap.start = 0; - cmap.len = 256; - cmap.red = red; - cmap.green = green; - cmap.blue = blue; - cmap.transp = NULL; - for (i = 0; i < cmap.len; i++) { - red[i] = green[i] = blue[i] = (i << 8) | i; - } - if (ioctl(FrameBufferFD, FBIOPUTCMAP, (void *) &cmap) < 0) { - fprintf(stderr, "ioctl(FBIOPUTCMAP) failed [%d]\n", i); - } - } - - /* - * fbdev says the frame buffer is at offset zero, and the mmio region - * is immediately after. - */ - - /* mmap the framebuffer into our address space */ - FrameBuffer = (caddr_t) mmap(0, /* start */ - FixedInfo.smem_len, /* bytes */ - PROT_READ | PROT_WRITE, /* prot */ - MAP_SHARED, /* flags */ - FrameBufferFD, /* fd */ - 0 /* offset */); - if (FrameBuffer == (caddr_t) - 1) { - fprintf(stderr, "error: unable to mmap framebuffer: %s\n", - strerror(errno)); - exit(1); - } - printf("FrameBuffer = %p\n", FrameBuffer); - -#if 1 - /* mmap the MMIO region into our address space */ - MMIOAddress = (caddr_t) mmap(0, /* start */ - FixedInfo.mmio_len, /* bytes */ - PROT_READ | PROT_WRITE, /* prot */ - MAP_SHARED, /* flags */ - FrameBufferFD, /* fd */ - FixedInfo.smem_len /* offset */); - if (MMIOAddress == (caddr_t) - 1) { - fprintf(stderr, "error: unable to mmap mmio region: %s\n", - strerror(errno)); - } - printf("MMIOAddress = %p\n", MMIOAddress); - - /* try out some simple MMIO register reads */ - if (1) - { - typedef unsigned int CARD32; - typedef unsigned char CARD8; -#define RADEON_CONFIG_MEMSIZE 0x00f8 -#define RADEON_MEM_SDRAM_MODE_REG 0x0158 -#define MMIO_IN32(base, offset) \ - *(volatile CARD32 *)(void *)(((CARD8*)(base)) + (offset)) -#define INREG(addr) MMIO_IN32(MMIOAddress, addr) - int sz, type; - const char *typeStr[] = {"SDR", "DDR", "64-bit SDR"}; - sz = INREG(RADEON_CONFIG_MEMSIZE); - type = INREG(RADEON_MEM_SDRAM_MODE_REG); - printf("RADEON_CONFIG_MEMSIZE = %d (%d MB)\n", sz, sz / 1024 / 1024); - printf("RADEON_MEM_SDRAM_MODE_REG >> 30 = %d (%s)\n", - type >> 30, typeStr[type>>30]); - } -#endif - -} - - -static void -shutdown_fbdev( void ) -{ - struct vt_mode VT; - - printf("cleaning up...\n"); - /* restore original variable screen info */ - if (ioctl(FrameBufferFD, FBIOPUT_VSCREENINFO, &OrigVarInfo)) { - fprintf(stderr, "ioctl(FBIOPUT_VSCREENINFO failed): %s\n", - strerror(errno)); - exit(1); - } - - munmap(MMIOAddress, FixedInfo.mmio_len); - munmap(FrameBuffer, FixedInfo.smem_len); - close(FrameBufferFD); - - /* restore text mode */ - ioctl(ConsoleFD, KDSETMODE, KD_TEXT); - - /* set vt */ - if (ioctl(ConsoleFD, VT_GETMODE, &VT) != -1) { - VT.mode = VT_AUTO; - ioctl(ConsoleFD, VT_SETMODE, &VT); - } - - /* restore original vt */ - if (OriginalVT >= 0) { - ioctl(ConsoleFD, VT_ACTIVATE, OriginalVT); - OriginalVT = -1; - } - - close(ConsoleFD); -} - - -static void -gltest( void ) -{ - static const int attribs[] = { - GLFBDEV_DOUBLE_BUFFER, - GLFBDEV_DEPTH_SIZE, 16, - GLFBDEV_NONE - }; - GLFBDevContextPtr ctx; - GLFBDevBufferPtr buf; - GLFBDevVisualPtr vis; - int bytes, r, g, b, a; - float ang; - - printf("GLFBDEV_VENDOR = %s\n", glFBDevGetString(GLFBDEV_VENDOR)); - printf("GLFBDEV_VERSION = %s\n", glFBDevGetString(GLFBDEV_VERSION)); - - /* framebuffer size */ - bytes = VarInfo.xres_virtual * VarInfo.yres_virtual * VarInfo.bits_per_pixel / 8; - - vis = glFBDevCreateVisual( &FixedInfo, &VarInfo, attribs ); - assert(vis); - - buf = glFBDevCreateBuffer( &FixedInfo, &VarInfo, vis, FrameBuffer, NULL, bytes ); - assert(buf); - - ctx = glFBDevCreateContext( vis, NULL ); - assert(buf); - - b = glFBDevMakeCurrent( ctx, buf, buf ); - assert(b); - - /*printf("GL_EXTENSIONS: %s\n", glGetString(GL_EXTENSIONS));*/ - glGetIntegerv(GL_RED_BITS, &r); - glGetIntegerv(GL_GREEN_BITS, &g); - glGetIntegerv(GL_BLUE_BITS, &b); - glGetIntegerv(GL_ALPHA_BITS, &a); - printf("RED_BITS=%d GREEN_BITS=%d BLUE_BITS=%d ALPHA_BITS=%d\n", - r, g, b, a); - - glClearColor(0.5, 0.5, 1.0, 0); - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glFrustum(-1, 1, -1, 1, 2, 30); - glMatrixMode(GL_MODELVIEW); - glLoadIdentity(); - glTranslatef(0, 0, -15); - glViewport(0, 0, VarInfo.xres_virtual, VarInfo.yres_virtual); - glEnable(GL_LIGHTING); - glEnable(GL_LIGHT0); - glEnable(GL_DEPTH_TEST); - - for (ang = 0; ang <= 180; ang += 15) { - glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); - glPushMatrix(); - glRotatef(ang, 1, 0, 0); - glutSolidTorus(1, 3, 40, 20); - glPopMatrix(); - glFBDevSwapBuffers(buf); - } - - /* clean up */ - b = glFBDevMakeCurrent( NULL, NULL, NULL); - assert(b); - - glFBDevDestroyContext(ctx); - glFBDevDestroyBuffer(buf); - glFBDevDestroyVisual(vis); -} - - -int -main( int argc, char *argv[] ) -{ - signal(SIGUSR1, signal_handler); /* exit if someone tries a vt switch */ - signal(SIGSEGV, signal_handler); /* catch segfaults */ - - initialize_fbdev(); - gltest(); - shutdown_fbdev(); - - return 0; -} diff --git a/progs/miniglx/manytex.c b/progs/miniglx/manytex.c deleted file mode 100644 index 74b06649f6..0000000000 --- a/progs/miniglx/manytex.c +++ /dev/null @@ -1,381 +0,0 @@ - -/* - * test handling of many texture maps - * Also tests texture priority and residency. - * - * Brian Paul - * August 2, 2000 - */ - - -#include -#include -#include -#include -#include -#include - - -static GLint NumTextures = 20; -static GLuint *TextureID = NULL; -static GLint *TextureWidth = NULL, *TextureHeight = NULL; -static GLboolean *TextureResidency = NULL; -static GLint TexWidth = 128, TexHeight = 128; -static GLfloat Zrot = 0; -static GLboolean Anim = GL_TRUE; -static GLint WinWidth = 500, WinHeight = 400; -static GLboolean MipMap = GL_FALSE; -static GLboolean LinearFilter = GL_FALSE; -static GLboolean RandomSize = GL_FALSE; -static GLint Rows, Columns; -static GLint LowPriorityCount = 0; - - -static void Idle( void ) -{ - Zrot += 1.0; - glutPostRedisplay(); -} - - -static void Display( void ) -{ - GLfloat spacing = WinWidth / Columns; - GLfloat size = spacing * 0.4; - GLint i; - - /* test residency */ - if (0) - { - GLboolean b; - GLint i, resident; - b = glAreTexturesResident(NumTextures, TextureID, TextureResidency); - if (b) { - printf("all resident\n"); - } - else { - resident = 0; - for (i = 0; i < NumTextures; i++) { - if (TextureResidency[i]) { - resident++; - } - } - printf("%d of %d texture resident\n", resident, NumTextures); - } - } - - /* render the textured quads */ - glClear( GL_COLOR_BUFFER_BIT ); - for (i = 0; i < NumTextures; i++) { - GLint row = i / Columns; - GLint col = i % Columns; - GLfloat x = col * spacing + spacing * 0.5; - GLfloat y = row * spacing + spacing * 0.5; - - GLfloat maxDim = (TextureWidth[i] > TextureHeight[i]) - ? TextureWidth[i] : TextureHeight[i]; - GLfloat w = TextureWidth[i] / maxDim; - GLfloat h = TextureHeight[i] / maxDim; - - glPushMatrix(); - glTranslatef(x, y, 0.0); - glRotatef(Zrot, 0, 0, 1); - glScalef(size, size, 1); - - glBindTexture(GL_TEXTURE_2D, TextureID[i]); - glBegin(GL_POLYGON); -#if 0 - glTexCoord2f(0, 0); glVertex2f(-1, -1); - glTexCoord2f(1, 0); glVertex2f( 1, -1); - glTexCoord2f(1, 1); glVertex2f( 1, 1); - glTexCoord2f(0, 1); glVertex2f(-1, 1); -#else - glTexCoord2f(0, 0); glVertex2f(-w, -h); - glTexCoord2f(1, 0); glVertex2f( w, -h); - glTexCoord2f(1, 1); glVertex2f( w, h); - glTexCoord2f(0, 1); glVertex2f(-w, h); -#endif - glEnd(); - glPopMatrix(); - } - - glutSwapBuffers(); -} - - -static void Reshape( int width, int height ) -{ - WinWidth = width; - WinHeight = height; - glViewport( 0, 0, width, height ); - glMatrixMode( GL_PROJECTION ); - glLoadIdentity(); - glOrtho(0, width, 0, height, -1, 1); - glMatrixMode( GL_MODELVIEW ); - glLoadIdentity(); -} - - -/* - * Return a random int in [min, max]. - */ -static int RandomInt(int min, int max) -{ - int i = rand(); - int j = i % (max - min + 1); - return min + j; -} - - - -static void Init( void ) -{ - GLint i; - - if (RandomSize) { - printf("Creating %d %s random-size textures, ", NumTextures, - MipMap ? "Mipmapped" : "non-Mipmapped"); - } - else { - printf("Creating %d %s %d x %d textures, ", NumTextures, - MipMap ? "Mipmapped" : "non-Mipmapped", - TexWidth, TexHeight); - } - - if (LinearFilter) { - printf("bilinear filtering\n"); - } - else { - printf("nearest filtering\n"); - } - - - /* compute number of rows and columns of rects */ - { - GLfloat area = (GLfloat) (WinWidth * WinHeight) / (GLfloat) NumTextures; - GLfloat edgeLen = sqrt(area); - - Columns = WinWidth / edgeLen; - Rows = (NumTextures + Columns - 1) / Columns; - printf("Rows: %d Cols: %d\n", Rows, Columns); - } - - - if (!TextureID) { - TextureID = (GLuint *) malloc(sizeof(GLuint) * NumTextures); - assert(TextureID); - glGenTextures(NumTextures, TextureID); - } - - if (!TextureResidency) { - TextureResidency = (GLboolean *) malloc(sizeof(GLboolean) * NumTextures); - assert(TextureResidency); - } - - if (!TextureWidth) { - TextureWidth = (GLint *) malloc(sizeof(GLint) * NumTextures); - assert(TextureWidth); - } - if (!TextureHeight) { - TextureHeight = (GLint *) malloc(sizeof(GLint) * NumTextures); - assert(TextureHeight); - } - - for (i = 0; i < NumTextures; i++) { - GLubyte color[4]; - GLubyte *texImage; - GLint j, row, col; - - row = i / Columns; - col = i % Columns; - - glBindTexture(GL_TEXTURE_2D, TextureID[i]); - - if (i < LowPriorityCount) - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_PRIORITY, 0.5F); - - if (RandomSize) { -#if 0 - int k = (glutGet(GLUT_ELAPSED_TIME) % 7) + 2; - TexWidth = 1 << k; - TexHeight = 1 << k; -#else - TexWidth = 1 << RandomInt(2, 7); - TexHeight = 1 << RandomInt(2, 7); - printf("Random size of %3d: %d x %d\n", i, TexWidth, TexHeight); -#endif - } - - TextureWidth[i] = TexWidth; - TextureHeight[i] = TexHeight; - - texImage = (GLubyte*) malloc(4 * TexWidth * TexHeight * sizeof(GLubyte)); - assert(texImage); - - /* determine texture color */ - color[0] = (GLint) (255.0 * ((float) col / (Columns - 1))); - color[1] = 127; - color[2] = (GLint) (255.0 * ((float) row / (Rows - 1))); - color[3] = 255; - - /* fill in solid-colored teximage */ - for (j = 0; j < TexWidth * TexHeight; j++) { - texImage[j*4+0] = color[0]; - texImage[j*4+1] = color[1]; - texImage[j*4+2] = color[2]; - texImage[j*4+3] = color[3]; - } - - if (MipMap) { - GLint level = 0; - GLint w = TexWidth, h = TexHeight; - while (1) { - glTexImage2D(GL_TEXTURE_2D, level, GL_RGBA, w, h, 0, - GL_RGBA, GL_UNSIGNED_BYTE, texImage); - if (w == 1 && h == 1) - break; - if (w > 1) - w /= 2; - if (h > 1) - h /= 2; - level++; - /*printf("%d: %d x %d\n", level, w, h);*/ - } - if (LinearFilter) { - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, - GL_LINEAR_MIPMAP_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - } - else { - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, - GL_NEAREST_MIPMAP_NEAREST); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - } - } - else { - /* Set corners to white */ - int k = 0; - texImage[k+0] = texImage[k+1] = texImage[k+2] = texImage[k+3] = 255; - k = (TexWidth - 1) * 4; - texImage[k+0] = texImage[k+1] = texImage[k+2] = texImage[k+3] = 255; - k = (TexWidth * TexHeight - TexWidth) * 4; - texImage[k+0] = texImage[k+1] = texImage[k+2] = texImage[k+3] = 255; - k = (TexWidth * TexHeight - 1) * 4; - texImage[k+0] = texImage[k+1] = texImage[k+2] = texImage[k+3] = 255; - - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, TexWidth, TexHeight, 0, - GL_RGBA, GL_UNSIGNED_BYTE, texImage); - if (LinearFilter) { - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - } - else { - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - } - } - - free(texImage); - } - - glEnable(GL_TEXTURE_2D); -} - - -static void Key( unsigned char key, int x, int y ) -{ - const GLfloat step = 3.0; - (void) x; - (void) y; - switch (key) { - case 'a': - Anim = !Anim; - if (Anim) - glutIdleFunc(Idle); - else - glutIdleFunc(NULL); - break; - case 's': - Idle(); - break; - case 'z': - Zrot -= step; - break; - case 'Z': - Zrot += step; - break; - case ' ': - Init(); - break; - case 27: - exit(0); - break; - } - glutPostRedisplay(); -} - - -int main( int argc, char *argv[] ) -{ - GLint i; - - glutInit( &argc, argv ); - glutInitWindowPosition( 0, 0 ); - glutInitWindowSize( WinWidth, WinHeight ); - glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE ); - glutCreateWindow(argv[0]); - glutReshapeFunc( Reshape ); - glutKeyboardFunc( Key ); - glutDisplayFunc( Display ); - if (Anim) - glutIdleFunc(Idle); - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-n") == 0) { - NumTextures = atoi(argv[i+1]); - if (NumTextures <= 0) { - printf("Error, bad number of textures\n"); - return 1; - } - i++; - } - else if (strcmp(argv[i], "-mipmap") == 0) { - MipMap = GL_TRUE; - } - else if (strcmp(argv[i], "-linear") == 0) { - LinearFilter = GL_TRUE; - } - else if (strcmp(argv[i], "-size") == 0) { - TexWidth = atoi(argv[i+1]); - TexHeight = atoi(argv[i+2]); - assert(TexWidth >= 1); - assert(TexHeight >= 1); - i += 2; - } - else if (strcmp(argv[i], "-randomsize") == 0) { - RandomSize = GL_TRUE; - } - else if (strcmp(argv[i], "-lowpri") == 0) { - LowPriorityCount = atoi(argv[i+1]); - i++; - } - else { - printf("Usage:\n"); - printf(" manytex [options]\n"); - printf("Options:\n"); - printf(" -n \n"); - printf(" -size - specify texture size\n"); - printf(" -randomsize - use random size textures\n"); - printf(" -mipmap - generate mipmaps\n"); - printf(" -linear - use linear filtering instead of nearest\n"); - printf(" -lowpri - Set lower priority on textures\n"); - return 0; - } - } - - Init(); - - glutMainLoop(); - - return 0; -} diff --git a/progs/miniglx/miniglxsample.c b/progs/miniglx/miniglxsample.c deleted file mode 100644 index d4d6729f93..0000000000 --- a/progs/miniglx/miniglxsample.c +++ /dev/null @@ -1,128 +0,0 @@ - -#define USE_MINIGLX 1 /* 1 = use Mini GLX, 0 = use Xlib/GLX */ - -#include -#include -#include -#include - -#if USE_MINIGLX -#include -#else -#include -#include -#endif - -static void _subset_Rectf( GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2 ) -{ - glBegin( GL_QUADS ); - glVertex2f( x1, y1 ); - glVertex2f( x2, y1 ); - glVertex2f( x2, y2 ); - glVertex2f( x1, y2 ); - glEnd(); -} - - -/* - * Create a simple double-buffered RGBA window. - */ -static Window -MakeWindow(Display * dpy, unsigned int width, unsigned int height) -{ - int visAttributes[] = { - GLX_RGBA, - GLX_RED_SIZE, 1, - GLX_GREEN_SIZE, 1, - GLX_BLUE_SIZE, 1, - GLX_DOUBLEBUFFER, - None - }; - XSetWindowAttributes attr; - unsigned long attrMask; - Window root; - Window win; - GLXContext ctx; - XVisualInfo *visinfo; - - root = RootWindow(dpy, 0); - - /* Choose GLX visual / pixel format */ - visinfo = glXChooseVisual(dpy, 0, visAttributes); - if (!visinfo) { - printf("Error: couldn't get an RGB, Double-buffered visual\n"); - exit(1); - } - - /* Create the window */ - attr.background_pixel = 0; - attr.border_pixel = 0; - attr.colormap = XCreateColormap(dpy, root, visinfo->visual, AllocNone); - attrMask = CWBackPixel | CWBorderPixel | CWColormap; - win = XCreateWindow(dpy, root, 0, 0, width, height, - 0, visinfo->depth, InputOutput, - visinfo->visual, attrMask, &attr); - if (!win) { - printf("Error: XCreateWindow failed\n"); - exit(1); - } - - /* Display the window */ - XMapWindow(dpy, win); - - /* Create GLX rendering context */ - ctx = glXCreateContext(dpy, visinfo, NULL, True); - if (!ctx) { - printf("Error: glXCreateContext failed\n"); - exit(1); - } - - /* Bind the rendering context and window */ - glXMakeCurrent(dpy, win, ctx); - - glViewport(0, 0, width, height); - - return win; -} - - -/* - * Draw a few frames of a rotating square. - */ -static void -DrawFrames(Display * dpy, Window win) -{ - int angle; - glShadeModel(GL_FLAT); - glClearColor(0.5, 0.5, 0.5, 1.0); - for (angle = 0; angle < 360; angle += 10) { - glClear(GL_COLOR_BUFFER_BIT); - glColor3f(1.0, 1.0, 0.0); - glPushMatrix(); - glRotatef(angle, 0, 0, 1); - _subset_Rectf(-0.8, -0.8, 0.8, 0.8); - glPopMatrix(); - glXSwapBuffers(dpy, win); - sleep(1); - } -} - - -int -main(int argc, char *argv[]) -{ - Display *dpy; - Window win; - - dpy = XOpenDisplay(NULL); - if (!dpy) { - printf("Error: XOpenDisplay failed\n"); - return 1; - } - - win = MakeWindow(dpy, 300, 300); - - DrawFrames(dpy, win); - - return 0; -} diff --git a/progs/miniglx/miniglxtest.c b/progs/miniglx/miniglxtest.c deleted file mode 100644 index 85c25be4ed..0000000000 --- a/progs/miniglx/miniglxtest.c +++ /dev/null @@ -1,272 +0,0 @@ -/* - * Test the mini GLX interface. - */ - - -#include -#include -#include -#include -#include -#define USE_MINI_GLX 1 -#if USE_MINI_GLX -#include -#else -#include -#endif - -static GLXContext ctx; - -static GLuint NumFrames = 100; -static GLuint NumDisplays = 1; -static GLboolean Texture = GL_FALSE; -static GLboolean SingleBuffer = GL_FALSE; -static GLboolean Sleeps = GL_TRUE; - - -static void -rect(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2) -{ - glBegin(GL_QUADS); - glTexCoord2f(0, 0); glColor3f(0, 0, 1); glVertex2f(x1, y1); - glTexCoord2f(1, 0); glColor3f(1, 0, 0); glVertex2f(x2, y1); - glTexCoord2f(1, 1); glColor3f(0, 1, 0); glVertex2f(x2, y2); - glTexCoord2f(0, 1); glColor3f(0, 0, 0); glVertex2f(x1, y2); - glEnd(); -} - - -static void -redraw(Display *dpy, Window w, int rot) -{ - GLfloat a; - - glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); - - glPushMatrix(); - glRotatef(rot, 0, 0, 1); - glScalef(.5, .5, .5); - for (a = 0.0; a < 360.0; a += 30.0) { - glPushMatrix(); - glRotatef(a, 0, 0, 1); - glRotatef(40, 1, 0, 0); - glColor3f(a / 360.0, 1-a/360.0, 0); - rect(0.3, -0.25, 1.5, 0.25); - glPopMatrix(); - } - glPopMatrix(); - - if (SingleBuffer) - glFlush(); - else - glXSwapBuffers(dpy, w); -} - - -static Window -make_window(Display *dpy, unsigned int width, unsigned int height) -{ - int attrib_single[] = { GLX_RGBA, - GLX_RED_SIZE, 1, - GLX_GREEN_SIZE, 1, - GLX_BLUE_SIZE, 1, - GLX_DEPTH_SIZE, 1, - None }; - int attrib_double[] = { GLX_RGBA, - GLX_RED_SIZE, 1, - GLX_GREEN_SIZE, 1, - GLX_BLUE_SIZE, 1, - GLX_DEPTH_SIZE, 1, - GLX_DOUBLEBUFFER, - None }; - int *attrib = SingleBuffer ? attrib_single : attrib_double; - int scrnum = 0; - XSetWindowAttributes attr; - unsigned long mask; - Window root; - Window win; - XVisualInfo *visinfo; - - root = RootWindow(dpy, scrnum); - - if (!(visinfo = glXChooseVisual(dpy, scrnum, attrib))) { - printf("Error: couldn't get an RGB, Double-buffered visual\n"); - exit(1); - } - - if (!(ctx = glXCreateContext(dpy, visinfo, NULL, True))) { - printf("Error: glXCreateContext failed\n"); - exit(1); - } - - /* window attributes */ - attr.background_pixel = 0; - attr.border_pixel = 0; - attr.colormap = XCreateColormap(dpy, root, visinfo->visual, AllocNone); - attr.event_mask = StructureNotifyMask | ExposureMask; - mask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask; - - win = XCreateWindow(dpy, root, 0, 0, width, height, - 0, visinfo->depth, InputOutput, - visinfo->visual, mask, &attr); - if (!win) { - printf("Error: XCreateWindow failed\n"); - exit(1); - } - - glXMakeCurrent(dpy, win, ctx); - - glViewport(0, 0, width, height); - - return win; -} - - -static void -event_loop(Display *dpy, Window win) -{ - int i; - - printf("Drawing %d frames\n", NumFrames); - - for (i = 0; i < NumFrames; i++) { - redraw(dpy, win, -i*2); - if (Sleeps) { - usleep(20000); - } - } -} - - -static int -runtest(void) -{ - Display *dpy; - Window win; - - dpy = XOpenDisplay(NULL); - if (!dpy) { - printf("Error: XOpenDisplay failed\n"); - return 1; - } - - win = make_window(dpy, 800, 600); - - srand(getpid()); - - /* init GL state */ - glClearColor(0.5, 0.5, 0.5, 1.0); - glEnable(GL_DEPTH_TEST); - if (Texture) { - GLubyte image[16][16][4]; - GLint i, j; - for (i = 0; i < 16; i++) { - for (j = 0; j < 16; j++) { - if (((i / 2) ^ (j / 2)) & 1) { - image[i][j][0] = 255; - image[i][j][1] = 255; - image[i][j][2] = 255; - image[i][j][3] = 255; - } - else { - image[i][j][0] = 128; - image[i][j][1] = 128; - image[i][j][2] = 128; - image[i][j][3] = 128; - } - } - } - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 16, 16, 0, - GL_RGBA, GL_UNSIGNED_BYTE, image); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - glEnable(GL_TEXTURE_2D); - } - if (SingleBuffer) { - glDrawBuffer(GL_FRONT); - glReadBuffer(GL_FRONT); - } - else { - glDrawBuffer(GL_BACK); - } - - XMapWindow(dpy, win); - - /* wait for window to get mapped */ - { - XEvent e; - while (1) { - XNextEvent(dpy, &e); - if (e.type == MapNotify && e.xmap.window == win) { - break; - } - } - } - - event_loop(dpy, win); - - glXDestroyContext(dpy, ctx); - XDestroyWindow(dpy, win); - - XCloseDisplay(dpy); - - return 0; -} - - -static void -usage(void) -{ - printf("Usage:\n"); - printf(" -f N render N frames (default %d)\n", NumFrames); - printf(" -d N do N display cycles\n"); - printf(" -t texturing\n"); - printf(" -s single buffering\n"); - printf(" -n no usleep() delay\n"); -} - - -static void -parse_args(int argc, char *argv[]) -{ - int i; - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-f") == 0) { - NumFrames = atoi(argv[i + 1]); - i++; - } - else if (strcmp(argv[i], "-d") == 0) { - NumDisplays = atoi(argv[i + 1]); - i++; - } - else if (strcmp(argv[i], "-n") == 0) { - Sleeps = GL_FALSE; - } - else if (strcmp(argv[i], "-s") == 0) { - SingleBuffer = GL_TRUE; - } - else if (strcmp(argv[i], "-t") == 0) { - Texture = GL_TRUE; - } - else { - usage(); - exit(1); - } - } -} - - -int -main(int argc, char *argv[]) -{ - int i; - - parse_args(argc, argv); - - for (i = 0; i < NumDisplays; i++) { - if (runtest() != 0) - break; - } - - return 0; -} diff --git a/progs/miniglx/sample_server.c b/progs/miniglx/sample_server.c deleted file mode 100644 index 62456eca25..0000000000 --- a/progs/miniglx/sample_server.c +++ /dev/null @@ -1,111 +0,0 @@ - -/* - * Sample server that just keeps first available window mapped. - */ - - -#include -#include -#include -#include - -struct client { - struct client *next; - Window windowid; - int mappable; -}; - -struct client *clients = 0, *mapped_client = 0; - - -static struct client *find_client( Window id ) -{ - struct client *c; - - for (c = clients ; c ; c = c->next) - if (c->windowid == id) - return c; - - return 0; -} - -int main( int argc, char *argv[] ) -{ - Display *dpy; - XEvent ev; - - dpy = __miniglx_StartServer(NULL); - if (!dpy) { - fprintf(stderr, "Error: __miniglx_StartServer failed\n"); - return 1; - } - - while (XNextEvent( dpy, &ev )) { - struct client *c; - - switch (ev.type) { - case MapRequest: - fprintf(stderr, "MapRequest\n"); - c = find_client(ev.xmaprequest.window); - if (!c) break; - c->mappable = True; - break; - - case UnmapNotify: - fprintf(stderr, "UnmapNotify\n"); - c = find_client(ev.xunmap.window); - if (!c) break; - c->mappable = False; - if (c == mapped_client) - mapped_client = 0; - break; - - case CreateNotify: - fprintf(stderr, "CreateNotify\n"); - c = malloc(sizeof(*c)); - c->next = clients; - c->windowid = ev.xcreatewindow.window; - c->mappable = False; - clients = c; - break; - - case DestroyNotify: - fprintf(stderr, "DestroyNotify\n"); - c = find_client(ev.xdestroywindow.window); - if (!c) break; - if (c == clients) - clients = c->next; - else { - struct client *t; - for (t = clients ; t->next != c ; t = t->next) - ; - t->next = c->next; - } - - if (c == mapped_client) - mapped_client = 0; - - free(c); - break; - - default: - break; - } - - /* Search for first mappable client if none already mapped. - */ - if (!mapped_client) { - for (c = clients ; c ; c = c->next) { - if (c->mappable) { - XMapWindow( dpy, c->windowid ); - mapped_client = c; - break; - } - } - } - } - - XCloseDisplay( dpy ); - - return 0; -} diff --git a/progs/miniglx/sample_server2.c b/progs/miniglx/sample_server2.c deleted file mode 100644 index efd382a6d9..0000000000 --- a/progs/miniglx/sample_server2.c +++ /dev/null @@ -1,228 +0,0 @@ - -/* - * Sample server that just keeps first available window mapped. - * - * It also reads and echos anything that happens on stdin as an - * example of tracking events from sources other than miniglx clients. - * - * It reads & writes without blocking, so that eg. piping a lot of - * text to stdin and then hitting 'ctrl-S' on the output stream won't - * cause it to stop handling miniglx events. - * - * See select_tut in the linux manual pages for a good overview of the - * select(2) system call. - */ - - -#include -#include -#include -#include -#include -#include -#include -#include - -struct client { - struct client *next; - Window windowid; - int mappable; -}; - -struct client *clients = 0, *mapped_client = 0; - -#define BUFSZ 4096 -char rbuf[BUFSZ]; -int rbuf_count; - - -static struct client *find_client( Window id ) -{ - struct client *c; - - for (c = clients ; c ; c = c->next) - if (c->windowid == id) - return c; - - return 0; -} - -int main( int argc, char *argv[] ) -{ - Display *dpy; - XEvent ev; - int autostart = 0; - - if (argc == 2 && strcmp(argv[1], "-autostart") == 0) - autostart = 1; - - dpy = __miniglx_StartServer(NULL); - if (!dpy) { - fprintf(stderr, "Error: __miniglx_StartServer failed\n"); - return 1; - } - - /* How is vt switching communicated through the XNextEvent interface? - */ - while (1) { - int r, n; - struct timeval tv; - fd_set rfds, wfds; - int bored = 0; - - FD_ZERO(&rfds); - FD_ZERO(&wfds); - tv.tv_sec = 1; - tv.tv_usec = 0; - - if (rbuf_count) { - FD_SET( 1, &wfds ); /* notify when we can write out buffer */ - n = 1; - } - else { - FD_SET( 0, &rfds ); /* else notify when new data to read */ - n = 0; - } - - /* __miniglx_Select waits until any of these file groups becomes - * readable/writable/etc (like regular select), until timeout - * expires (like regular select), until a signal is received - * (like regular select) or until an event is available for - * XCheckMaskEvent(). - */ - r = __miniglx_Select( dpy, n+1, &rfds, &wfds, 0, &tv ); - - /* This can happen if select() is interrupted by a signal: - */ - if (r < 0 && errno != EINTR && errno != EAGAIN) { - perror ("select()"); - exit (1); - } - - if (tv.tv_sec == 0 && tv.tv_usec == 0) - bored = 1; - - /* Check and handle events on our local file descriptors - */ - if (FD_ISSET( 0, &rfds )) { - /* Something on stdin */ - assert(rbuf_count == 0); - r = read(0, rbuf, BUFSZ); - if (r < 1) { - perror("read"); - abort(); - } - rbuf_count = r; - } - - if (FD_ISSET( 1, &wfds )) { - /* Can write to stdout */ - assert(rbuf_count > 0); - r = write(1, rbuf, rbuf_count); - if (r < 1) { - perror("write"); - abort(); - } - rbuf_count -= r; - if (rbuf_count) - memmove(rbuf + r, rbuf, rbuf_count); - } - - - /* Check and handle events generated by miniglx: - */ - while (XCheckMaskEvent( dpy, ~0, &ev )) { - struct client *c; - bored = 0; - - fprintf(stderr, "Received event %d\n", ev.type); - - switch (ev.type) { - case CreateNotify: - fprintf(stderr, "CreateNotify -- new client\n"); - c = malloc(sizeof(*c)); - c->next = clients; - c->windowid = ev.xcreatewindow.window; - c->mappable = False; - clients = c; - break; - - case DestroyNotify: - fprintf(stderr, "DestroyNotify\n"); - c = find_client(ev.xdestroywindow.window); - if (!c) break; - if (c == clients) - clients = c->next; - else { - struct client *t; - for (t = clients ; t->next != c ; t = t->next) - ; - t->next = c->next; - } - - if (c == mapped_client) - mapped_client = 0; - - free(c); - break; - - case MapRequest: - fprintf(stderr, "MapRequest\n"); - c = find_client(ev.xmaprequest.window); - if (!c) break; - c->mappable = True; - break; - - case UnmapNotify: - fprintf(stderr, "UnmapNotify\n"); - c = find_client(ev.xunmap.window); - if (!c) break; - c->mappable = False; - if (c == mapped_client) - mapped_client = 0; - break; - - default: - break; - } - } - - - /* Search for first mappable client if none already mapped. - */ - if (!mapped_client) { - struct client *c; - for (c = clients ; c ; c = c->next) { - if (c->mappable) { - XMapWindow( dpy, c->windowid ); - mapped_client = c; - break; - } - } - if (!clients && autostart) { - system("nohup ./texline &"); - system("nohup ./manytex &"); - } - } - else if (bored) { - struct client *c; - /* bored of mapped client now, let's try & find another one */ - for (c = mapped_client->next ; c && !c->mappable ; c = c->next) - ; - if (!c) - for (c = clients ; c && !c->mappable ; c = c->next) - ; - if (c && c != mapped_client) { - XUnmapWindow( dpy, mapped_client->windowid ); - XMapWindow( dpy, c->windowid ); - mapped_client = c; - } - else - fprintf(stderr, "I'm bored!\n"); - } - } - - XCloseDisplay( dpy ); - - return 0; -} diff --git a/progs/miniglx/texline.c b/progs/miniglx/texline.c deleted file mode 100644 index 098077f247..0000000000 --- a/progs/miniglx/texline.c +++ /dev/null @@ -1,267 +0,0 @@ - -/* - * Test textured lines. - * - * Brian Paul - * September 2000 - */ - - -#include -#include -#include -#include -#include "../util/readtex.c" /* I know, this is a hack. */ - -#define TEXTURE_FILE "../images/girl.rgb" - -static GLboolean Antialias = GL_FALSE; -static GLboolean Animate = GL_FALSE; -static GLint Texture = 1; -static GLboolean Stipple = GL_FALSE; -static GLfloat LineWidth = 1.0; - -static GLfloat Xrot = -60.0, Yrot = 0.0, Zrot = 0.0; -static GLfloat DYrot = 1.0; -static GLboolean Points = GL_FALSE; -static GLfloat Scale = 1.0; - -static void Idle( void ) -{ - if (Animate) { - Zrot += DYrot; - glutPostRedisplay(); - } -} - - -static void Display( void ) -{ - GLfloat x, y, s, t; - - glClear( GL_COLOR_BUFFER_BIT ); - - glPushMatrix(); - glRotatef(Xrot, 1.0, 0.0, 0.0); - glRotatef(Yrot, 0.0, 1.0, 0.0); - glRotatef(Zrot, 0.0, 0.0, 1.0); - glScalef(Scale, Scale, Scale); - - if (Texture) - glColor3f(1, 1, 1); - - if (Points) { - glBegin(GL_POINTS); - for (t = 0.0; t <= 1.0; t += 0.025) { - for (s = 0.0; s <= 1.0; s += 0.025) { - x = s * 2.0 - 1.0; - y = t * 2.0 - 1.0; - if (!Texture) - glColor3f(1, 0, 1); - glMultiTexCoord2fARB(GL_TEXTURE1_ARB, t, s); - glTexCoord2f(s, t); - glVertex2f(x, y); - } - } - glEnd(); - } - else { - glBegin(GL_LINES); - for (t = 0.0; t <= 1.0; t += 0.025) { - x = t * 2.0 - 1.0; - if (!Texture) - glColor3f(1, 0, 1); - glTexCoord2f(t, 0.0); - glMultiTexCoord2fARB(GL_TEXTURE1_ARB, 0.0, t); - glVertex2f(x, -1.0); - if (!Texture) - glColor3f(0, 1, 0); - glTexCoord2f(t, 1.0); - glMultiTexCoord2fARB(GL_TEXTURE1_ARB, 1.0, t); - glVertex2f(x, 1.0); - } - glEnd(); - } - - glPopMatrix(); - - glutSwapBuffers(); -} - - -static void Reshape( int width, int height ) -{ - GLfloat ar = (float) width / height; - glViewport( 0, 0, width, height ); - glMatrixMode( GL_PROJECTION ); - glLoadIdentity(); - glFrustum( -ar, ar, -1.0, 1.0, 10.0, 100.0 ); - glMatrixMode( GL_MODELVIEW ); - glLoadIdentity(); - glTranslatef( 0.0, 0.0, -12.0 ); -} - - -static void Key( unsigned char key, int x, int y ) -{ - (void) x; - (void) y; - switch (key) { - case 'a': - Antialias = !Antialias; - if (Antialias) { - glEnable(GL_LINE_SMOOTH); - glEnable(GL_POINT_SMOOTH); - glEnable(GL_BLEND); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - } - else { - glDisable(GL_LINE_SMOOTH); - glDisable(GL_POINT_SMOOTH); - glDisable(GL_BLEND); - } - break; - case 't': - Texture++; - if (Texture > 2) - Texture = 0; - if (Texture == 0) { - glActiveTextureARB(GL_TEXTURE0_ARB); - glDisable(GL_TEXTURE_2D); - glActiveTextureARB(GL_TEXTURE1_ARB); - glDisable(GL_TEXTURE_2D); - } - else if (Texture == 1) { - glActiveTextureARB(GL_TEXTURE0_ARB); - glEnable(GL_TEXTURE_2D); - glActiveTextureARB(GL_TEXTURE1_ARB); - glDisable(GL_TEXTURE_2D); - } - else { - glActiveTextureARB(GL_TEXTURE0_ARB); - glEnable(GL_TEXTURE_2D); - glActiveTextureARB(GL_TEXTURE1_ARB); - glEnable(GL_TEXTURE_2D); - } - break; - case 'w': - LineWidth -= 0.25; - if (LineWidth < 0.25) - LineWidth = 0.25; - glLineWidth(LineWidth); - glPointSize(LineWidth); - break; - case 'W': - LineWidth += 0.25; - if (LineWidth > 8.0) - LineWidth = 8.0; - glLineWidth(LineWidth); - glPointSize(LineWidth); - break; - case 'p': - Points = !Points; - break; - case 's': - Stipple = !Stipple; - if (Stipple) - glEnable(GL_LINE_STIPPLE); - else - glDisable(GL_LINE_STIPPLE); - break; - case ' ': - Animate = !Animate; - if (Animate) - glutIdleFunc(Idle); - else - glutIdleFunc(NULL); - break; - case 27: - exit(0); - break; - } - printf("LineWidth, PointSize = %f\n", LineWidth); - glutPostRedisplay(); -} - - -static void SpecialKey( int key, int x, int y ) -{ - float step = 3.0; - (void) x; - (void) y; - - switch (key) { - case GLUT_KEY_UP: - Xrot += step; - break; - case GLUT_KEY_DOWN: - Xrot -= step; - break; - case GLUT_KEY_LEFT: - Yrot += step; - break; - case GLUT_KEY_RIGHT: - Yrot -= step; - break; - } - glutPostRedisplay(); -} - - -static void Init( int argc, char *argv[] ) -{ - GLuint u; - for (u = 0; u < 2; u++) { - glActiveTextureARB(GL_TEXTURE0_ARB + u); - glBindTexture(GL_TEXTURE_2D, 10+u); - if (u == 0) - glEnable(GL_TEXTURE_2D); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - - if (u == 0) - glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); - else - glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_ADD); - - glPixelStorei(GL_UNPACK_ALIGNMENT, 1); - if (!LoadRGBMipmaps(TEXTURE_FILE, GL_RGB)) { - printf("Error: couldn't load texture image\n"); - exit(1); - } - } - - glLineStipple(1, 0xff); - - if (argc > 1 && strcmp(argv[1], "-info")==0) { - printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - printf("GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - printf("GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - printf("GL_EXTENSIONS = %s\n", (char *) glGetString(GL_EXTENSIONS)); - } -} - - -int main( int argc, char *argv[] ) -{ - glutInit( &argc, argv ); - glutInitWindowSize( 400, 300 ); - - glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE ); - - glutCreateWindow(argv[0] ); - - Init(argc, argv); - - glutReshapeFunc( Reshape ); - glutKeyboardFunc( Key ); - glutSpecialFunc( SpecialKey ); - glutDisplayFunc( Display ); - if (Animate) - glutIdleFunc( Idle ); - - glutMainLoop(); - return 0; -} diff --git a/progs/osdemos/.gitignore b/progs/osdemos/.gitignore deleted file mode 100644 index 5c78f12481..0000000000 --- a/progs/osdemos/.gitignore +++ /dev/null @@ -1,8 +0,0 @@ -osdemo -osdemo16 -osdemo32 -ostest1 -readtex.c -readtex.h -showbuffer.c -showbuffer.h diff --git a/progs/redbook/.gitignore b/progs/redbook/.gitignore deleted file mode 100644 index 8ed3efe3e2..0000000000 --- a/progs/redbook/.gitignore +++ /dev/null @@ -1,64 +0,0 @@ -.cvsignore -aaindex -aapoly -aargb -accanti -accpersp -alpha -alpha3D -anti -bezcurve -bezmesh -checker -clip -colormat -cube -depthcue -dof -double -drawf -feedback -fog -fogindex -font -hello -image -light -lines -list -material -mipmap -model -movelight -nurbs -pickdepth -picksquare -plane -planet -polyoff -polys -quadric -robot -sccolorlight -scene -scenebamb -sceneflat -select -smooth -stencil -stroke -surface -teaambient -teapots -tess -tesswind -texbind -texgen -texprox -texsub -texturesurf -torus -trim -unproject -varray -wrap diff --git a/progs/redbook/Windows/redbook.dsw b/progs/redbook/Windows/redbook.dsw deleted file mode 100644 index 71ba7e89e3..0000000000 --- a/progs/redbook/Windows/redbook.dsw +++ /dev/null @@ -1,29 +0,0 @@ -Microsoft Developer Studio Workspace File, Format Version 6.00 -# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! - -############################################################################### - -Project: "teapots"=".\teapots.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Global: - -Package=<5> -{{{ -}}} - -Package=<3> -{{{ -}}} - -############################################################################### - diff --git a/progs/redbook/Windows/teapots.dsp b/progs/redbook/Windows/teapots.dsp deleted file mode 100644 index 4d39865810..0000000000 --- a/progs/redbook/Windows/teapots.dsp +++ /dev/null @@ -1,112 +0,0 @@ -# Microsoft Developer Studio Project File - Name="teapots" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Console Application" 0x0103 - -CFG=teapots - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "teapots.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "teapots.mak" CFG="teapots - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "teapots - Win32 Release" (based on "Win32 (x86) Console Application") -!MESSAGE "teapots - Win32 Debug" (based on "Win32 (x86) Console Application") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "teapots - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /W3 /GX /O2 /I "../../../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /machine:I386 /out:"../teapots.exe" -# Begin Special Build Tool -SOURCE="$(InputPath)" -PostBuild_Desc=Copy DLLs -PostBuild_Cmds=copy ..\..\..\lib\*.dll .. -# End Special Build Tool - -!ELSEIF "$(CFG)" == "teapots - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c -# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../../../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /debug /machine:I386 /out:"../teapots.exe" /pdbtype:sept -# Begin Special Build Tool -SOURCE="$(InputPath)" -PostBuild_Desc=Copy DLLs -PostBuild_Cmds=copy ..\..\..\lib\*.dll .. -# End Special Build Tool - -!ENDIF - -# Begin Target - -# Name "teapots - Win32 Release" -# Name "teapots - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=..\teapots.c -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# End Group -# Begin Group "Resource Files" - -# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" -# End Group -# End Target -# End Project diff --git a/progs/samples/.gitignore b/progs/samples/.gitignore deleted file mode 100644 index f60d6e94ea..0000000000 --- a/progs/samples/.gitignore +++ /dev/null @@ -1,47 +0,0 @@ -.cvsignore -accum -anywin -bdemo -binfo -bitmap1 -bitmap2 -blendeq -blendxor -bugger -copy -cursor -demo -depth -eval -ffset -fog -font -font -incopy -line -logo -lthreads -lxdemo -lxgears -lxheads -lxinfo -lxpixmap -nurb -oglinfo -olympic -overlay -pend -point -prim -quad -readtex.c -readtex.h -select -shape -sphere -star -stencil -stretch -texture -tri -wave diff --git a/progs/samples/readtex.c b/progs/samples/readtex.c new file mode 100644 index 0000000000..37d5fcd0d3 --- /dev/null +++ b/progs/samples/readtex.c @@ -0,0 +1,454 @@ +/* readtex.c */ + +/* + * Read an SGI .rgb image file and generate a mipmap texture set. + * Much of this code was borrowed from SGI's tk OpenGL toolkit. + */ + + + +#include +#include +#include +#include +#include +#include "readtex.h" + + +#ifndef SEEK_SET +# define SEEK_SET 0 +#endif + + +/* +** RGB Image Structure +*/ + +typedef struct _TK_RGBImageRec { + GLint sizeX, sizeY; + GLint components; + unsigned char *data; +} TK_RGBImageRec; + + + +/******************************************************************************/ + +typedef struct _rawImageRec { + unsigned short imagic; + unsigned short type; + unsigned short dim; + unsigned short sizeX, sizeY, sizeZ; + unsigned long min, max; + unsigned long wasteBytes; + char name[80]; + unsigned long colorMap; + FILE *file; + unsigned char *tmp, *tmpR, *tmpG, *tmpB, *tmpA; + unsigned long rleEnd; + GLuint *rowStart; + GLint *rowSize; +} rawImageRec; + +/******************************************************************************/ + +static void ConvertShort(unsigned short *array, long length) +{ + unsigned long b1, b2; + unsigned char *ptr; + + ptr = (unsigned char *)array; + while (length--) { + b1 = *ptr++; + b2 = *ptr++; + *array++ = (unsigned short) ((b1 << 8) | (b2)); + } +} + +static void ConvertLong(GLuint *array, long length) +{ + unsigned long b1, b2, b3, b4; + unsigned char *ptr; + + ptr = (unsigned char *)array; + while (length--) { + b1 = *ptr++; + b2 = *ptr++; + b3 = *ptr++; + b4 = *ptr++; + *array++ = (b1 << 24) | (b2 << 16) | (b3 << 8) | (b4); + } +} + +static rawImageRec *RawImageOpen(const char *fileName) +{ + union { + int testWord; + char testByte[4]; + } endianTest; + rawImageRec *raw; + GLenum swapFlag; + int x; + + endianTest.testWord = 1; + if (endianTest.testByte[0] == 1) { + swapFlag = GL_TRUE; + } else { + swapFlag = GL_FALSE; + } + + raw = (rawImageRec *)calloc(1, sizeof(rawImageRec)); + if (raw == NULL) { + fprintf(stderr, "Out of memory!\n"); + return NULL; + } + if ((raw->file = fopen(fileName, "rb")) == NULL) { + perror(fileName); + return NULL; + } + + fread(raw, 1, 12, raw->file); + + if (swapFlag) { + ConvertShort(&raw->imagic, 6); + } + + raw->tmp = (unsigned char *)malloc(raw->sizeX*256); + raw->tmpR = (unsigned char *)malloc(raw->sizeX*256); + raw->tmpG = (unsigned char *)malloc(raw->sizeX*256); + raw->tmpB = (unsigned char *)malloc(raw->sizeX*256); + if (raw->sizeZ==4) { + raw->tmpA = (unsigned char *)malloc(raw->sizeX*256); + } + if (raw->tmp == NULL || raw->tmpR == NULL || raw->tmpG == NULL || + raw->tmpB == NULL) { + fprintf(stderr, "Out of memory!\n"); + return NULL; + } + + if ((raw->type & 0xFF00) == 0x0100) { + x = raw->sizeY * raw->sizeZ * sizeof(GLuint); + raw->rowStart = (GLuint *)malloc(x); + raw->rowSize = (GLint *)malloc(x); + if (raw->rowStart == NULL || raw->rowSize == NULL) { + fprintf(stderr, "Out of memory!\n"); + return NULL; + } + raw->rleEnd = 512 + (2 * x); + fseek(raw->file, 512, SEEK_SET); + fread(raw->rowStart, 1, x, raw->file); + fread(raw->rowSize, 1, x, raw->file); + if (swapFlag) { + ConvertLong(raw->rowStart, (long) (x/sizeof(GLuint))); + ConvertLong((GLuint *)raw->rowSize, (long) (x/sizeof(GLint))); + } + } + return raw; +} + +static void RawImageClose(rawImageRec *raw) +{ + fclose(raw->file); + free(raw->tmp); + free(raw->tmpR); + free(raw->tmpG); + free(raw->tmpB); + if (raw->rowStart) + free(raw->rowStart); + if (raw->rowSize) + free(raw->rowSize); + if (raw->sizeZ>3) { + free(raw->tmpA); + } + free(raw); +} + +static void RawImageGetRow(rawImageRec *raw, unsigned char *buf, int y, int z) +{ + unsigned char *iPtr, *oPtr, pixel; + int count, done = 0; + + if ((raw->type & 0xFF00) == 0x0100) { + fseek(raw->file, (long) raw->rowStart[y+z*raw->sizeY], SEEK_SET); + fread(raw->tmp, 1, (unsigned int)raw->rowSize[y+z*raw->sizeY], + raw->file); + + iPtr = raw->tmp; + oPtr = buf; + while (!done) { + pixel = *iPtr++; + count = (int)(pixel & 0x7F); + if (!count) { + done = 1; + return; + } + if (pixel & 0x80) { + while (count--) { + *oPtr++ = *iPtr++; + } + } else { + pixel = *iPtr++; + while (count--) { + *oPtr++ = pixel; + } + } + } + } else { + fseek(raw->file, 512+(y*raw->sizeX)+(z*raw->sizeX*raw->sizeY), + SEEK_SET); + fread(buf, 1, raw->sizeX, raw->file); + } +} + + +static void RawImageGetData(rawImageRec *raw, TK_RGBImageRec *final) +{ + unsigned char *ptr; + int i, j; + + final->data = (unsigned char *)malloc((raw->sizeX+1)*(raw->sizeY+1)*4); + if (final->data == NULL) { + fprintf(stderr, "Out of memory!\n"); + } + + ptr = final->data; + for (i = 0; i < (int)(raw->sizeY); i++) { + RawImageGetRow(raw, raw->tmpR, i, 0); + RawImageGetRow(raw, raw->tmpG, i, 1); + RawImageGetRow(raw, raw->tmpB, i, 2); + if (raw->sizeZ>3) { + RawImageGetRow(raw, raw->tmpA, i, 3); + } + for (j = 0; j < (int)(raw->sizeX); j++) { + *ptr++ = *(raw->tmpR + j); + *ptr++ = *(raw->tmpG + j); + *ptr++ = *(raw->tmpB + j); + if (raw->sizeZ>3) { + *ptr++ = *(raw->tmpA + j); + } + } + } +} + + +static TK_RGBImageRec *tkRGBImageLoad(const char *fileName) +{ + rawImageRec *raw; + TK_RGBImageRec *final; + + raw = RawImageOpen(fileName); + if (!raw) { + fprintf(stderr, "File not found\n"); + return NULL; + } + final = (TK_RGBImageRec *)malloc(sizeof(TK_RGBImageRec)); + if (final == NULL) { + fprintf(stderr, "Out of memory!\n"); + return NULL; + } + final->sizeX = raw->sizeX; + final->sizeY = raw->sizeY; + final->components = raw->sizeZ; + RawImageGetData(raw, final); + RawImageClose(raw); + return final; +} + + +static void FreeImage( TK_RGBImageRec *image ) +{ + free(image->data); + free(image); +} + + +/* + * Load an SGI .rgb file and generate a set of 2-D mipmaps from it. + * Input: imageFile - name of .rgb to read + * intFormat - internal texture format to use, or number of components + * Return: GL_TRUE if success, GL_FALSE if error. + */ +GLboolean LoadRGBMipmaps( const char *imageFile, GLint intFormat ) +{ + GLint w, h; + return LoadRGBMipmaps2( imageFile, GL_TEXTURE_2D, intFormat, &w, &h ); +} + + + +GLboolean LoadRGBMipmaps2( const char *imageFile, GLenum target, + GLint intFormat, GLint *width, GLint *height ) +{ + GLint error; + GLenum format; + TK_RGBImageRec *image; + + image = tkRGBImageLoad( imageFile ); + if (!image) { + return GL_FALSE; + } + + if (image->components==3) { + format = GL_RGB; + } + else if (image->components==4) { + format = GL_RGBA; + } + else { + /* not implemented */ + fprintf(stderr, + "Error in LoadRGBMipmaps %d-component images not implemented\n", + image->components ); + return GL_FALSE; + } + + error = gluBuild2DMipmaps( target, + intFormat, + image->sizeX, image->sizeY, + format, + GL_UNSIGNED_BYTE, + image->data ); + + *width = image->sizeX; + *height = image->sizeY; + + FreeImage(image); + + return error ? GL_FALSE : GL_TRUE; +} + + + +/* + * Load an SGI .rgb file and return a pointer to the image data. + * Input: imageFile - name of .rgb to read + * Output: width - width of image + * height - height of image + * format - format of image (GL_RGB or GL_RGBA) + * Return: pointer to image data or NULL if error + */ +GLubyte *LoadRGBImage( const char *imageFile, GLint *width, GLint *height, + GLenum *format ) +{ + TK_RGBImageRec *image; + GLint bytes; + GLubyte *buffer; + + image = tkRGBImageLoad( imageFile ); + if (!image) { + return NULL; + } + + if (image->components==3) { + *format = GL_RGB; + } + else if (image->components==4) { + *format = GL_RGBA; + } + else { + /* not implemented */ + fprintf(stderr, + "Error in LoadRGBImage %d-component images not implemented\n", + image->components ); + return NULL; + } + + *width = image->sizeX; + *height = image->sizeY; + + bytes = image->sizeX * image->sizeY * image->components; + buffer = (GLubyte *) malloc(bytes); + if (!buffer) + return NULL; + + memcpy( (void *) buffer, (void *) image->data, bytes ); + + FreeImage(image); + + return buffer; +} + +#define CLAMP( X, MIN, MAX ) ( (X)<(MIN) ? (MIN) : ((X)>(MAX) ? (MAX) : (X)) ) + + +static void ConvertRGBtoYUV(GLint w, GLint h, GLint texel_bytes, + const GLubyte *src, + GLushort *dest) +{ + GLint i, j; + + for (i = 0; i < h; i++) { + for (j = 0; j < w; j++) { + const GLfloat r = (src[0]) / 255.0; + const GLfloat g = (src[1]) / 255.0; + const GLfloat b = (src[2]) / 255.0; + GLfloat y, cr, cb; + GLint iy, icr, icb; + + y = r * 65.481 + g * 128.553 + b * 24.966 + 16; + cb = r * -37.797 + g * -74.203 + b * 112.0 + 128; + cr = r * 112.0 + g * -93.786 + b * -18.214 + 128; + /*printf("%f %f %f -> %f %f %f\n", r, g, b, y, cb, cr);*/ + iy = (GLint) CLAMP(y, 0, 254); + icb = (GLint) CLAMP(cb, 0, 254); + icr = (GLint) CLAMP(cr, 0, 254); + + if (j & 1) { + /* odd */ + *dest = (iy << 8) | icr; + } + else { + /* even */ + *dest = (iy << 8) | icb; + } + dest++; + src += texel_bytes; + } + } +} + + +/* + * Load an SGI .rgb file and return a pointer to the image data, converted + * to 422 yuv. + * + * Input: imageFile - name of .rgb to read + * Output: width - width of image + * height - height of image + * Return: pointer to image data or NULL if error + */ +GLushort *LoadYUVImage( const char *imageFile, GLint *width, GLint *height ) +{ + TK_RGBImageRec *image; + GLushort *buffer; + + image = tkRGBImageLoad( imageFile ); + if (!image) { + return NULL; + } + + if (image->components != 3 && image->components !=4 ) { + /* not implemented */ + fprintf(stderr, + "Error in LoadYUVImage %d-component images not implemented\n", + image->components ); + return NULL; + } + + *width = image->sizeX; + *height = image->sizeY; + + buffer = (GLushort *) malloc( image->sizeX * image->sizeY * 2 ); + + if (buffer) + ConvertRGBtoYUV( image->sizeX, + image->sizeY, + image->components, + image->data, + buffer ); + + + FreeImage(image); + return buffer; +} + diff --git a/progs/slang/.gitignore b/progs/slang/.gitignore deleted file mode 100644 index 8a42b018e6..0000000000 --- a/progs/slang/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -cltest -sotest -vstest diff --git a/progs/slang/Makefile b/progs/slang/Makefile deleted file mode 100644 index f6f34fcd25..0000000000 --- a/progs/slang/Makefile +++ /dev/null @@ -1,57 +0,0 @@ -# progs/slang/Makefile - -TOP = ../.. - -include $(TOP)/configs/current - -INCDIR = $(TOP)/include - -LIB_DEP = $(TOP)/$(LIB_DIR)/$(GL_LIB_NAME) - -LIBS = -L$(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) $(APP_LIB_DEPS) - -# -# targets -# - -.PHONY: default tests clean - -default: cltest sotest vstest - -tests: default - ! ./sotest 2> /dev/null | (grep -e ^[*][*][*]) - ! ./vstest 2> /dev/null | (grep -e ^[*][*][*]) - ! ./cltest 2> /dev/null | (grep -e ^[*][*][*]) - -clean: - -rm -f cltest.o sotest.o vstest.o framework.o cltest sotest vstest - -# -# executables -# - -cltest: cltest.o framework.o $(LIB_DEP) - $(CC) $(CFLAGS) $(LDFLAGS) cltest.o framework.o $(LIBS) -o cltest - -sotest: sotest.o framework.o $(LIB_DEP) - $(CC) $(CFLAGS) $(LDFLAGS) sotest.o framework.o $(LIBS) -o sotest - -vstest: vstest.o framework.o $(LIB_DEP) - $(CC) $(CFLAGS) $(LDFLAGS) vstest.o framework.o $(LIBS) -o vstest - -# -# objects -# - -framework.o: framework.c framework.h - $(CC) -c -I$(INCDIR) $(CFLAGS) framework.c -o framework.o - -cltest.o: cltest.c framework.h - $(CC) -c -I$(INCDIR) $(CFLAGS) cltest.c -o cltest.o - -sotest.o: sotest.c framework.h - $(CC) -c -I$(INCDIR) $(CFLAGS) sotest.c -o sotest.o - -vstest.o: vstest.c framework.h - $(CC) -c -I$(INCDIR) $(CFLAGS) vstest.c -o vstest.o - diff --git a/progs/slang/README b/progs/slang/README deleted file mode 100644 index 13a6aaad34..0000000000 --- a/progs/slang/README +++ /dev/null @@ -1,7 +0,0 @@ -GLSL regression tests. - -Type "make" to build all test apps. - -Type "make tests" to build and run all test apps. If any -error is detected, a line starting with *** is output. - diff --git a/progs/slang/cltest.c b/progs/slang/cltest.c deleted file mode 100644 index 2753f59f85..0000000000 --- a/progs/slang/cltest.c +++ /dev/null @@ -1,253 +0,0 @@ -/* - * GL_ARB_shading_language_100 test application. - * - * Tests correctness of emited code. Runs multiple well-formed shaders and checks if - * they produce valid results. - * - * Requires specific support on the GL implementation side. A special function printMESA() - * must be supported in the language that prints current values of generic type - * to the appropriate shader's info log, and optionally to the screen. - * - * Author: Michal Krol - */ - -#include "framework.h" - -#define EPSILON 0.0001f - -static GLhandleARB vert = 0; -static GLhandleARB prog = 0; - -static int get_line (FILE *f, char *line, int size) -{ - if (fgets (line, size, f) == NULL) - return 0; - if (line[strlen (line) - 1] == '\n') - line[strlen (line) - 1] = '\0'; - return 1; -} - -struct ATTRIB -{ - char name[32]; - GLfloat value[64][4]; - GLuint count; -}; - -struct ATTRIBS -{ - struct ATTRIB attrib[32]; - GLuint count; -}; - -struct SHADER -{ - char code[16000]; - GLfloat output[1000]; - GLuint count; -}; - -enum SHADER_LOAD_STATE -{ - SLS_NONE, - SLS_CODE, - SLS_OUTPUT -}; - -struct PROGRAM -{ - struct PROGRAM *next; - char name[256]; - struct ATTRIBS attribs; - struct SHADER vertex; -}; - -enum PROGRAM_LOAD_STATE -{ - PLS_NONE, - PLS_ATTRIB, - PLS_VERTEX -}; - -static struct PROGRAM *program = NULL; - -static void load_test_file (const char *filename, struct PROGRAM **program) -{ - struct PROGRAM **currprog = program; - FILE *f; - char line[256]; - enum PROGRAM_LOAD_STATE pls = PLS_NONE; - enum SHADER_LOAD_STATE sls = SLS_NONE; - - f = fopen (filename, "r"); - if (f == NULL) - return; - - while (get_line (f, line, sizeof (line))) { - if (line[0] == '$') { - if (strncmp (line + 1, "program", 7) == 0) { - if (*currprog != NULL) - currprog = &(**currprog).next; - *currprog = (struct PROGRAM *) (malloc (sizeof (struct PROGRAM))); - if (*currprog == NULL) - break; - (**currprog).next = NULL; - strcpy ((**currprog).name, line + 9); - (**currprog).attribs.count = 0; - (**currprog).vertex.code[0] = '\0'; - (**currprog).vertex.count = 0; - pls = PLS_NONE; - } - else if (strncmp (line + 1, "attrib", 6) == 0) { - if (*currprog == NULL) - break; - strcpy ((**currprog).attribs.attrib[(**currprog).attribs.count].name, line + 8); - (**currprog).attribs.attrib[(**currprog).attribs.count].count = 0; - (**currprog).attribs.count++; - pls = PLS_ATTRIB; - } - else if (strcmp (line + 1, "vertex") == 0) { - if (*currprog == NULL) - break; - pls = PLS_VERTEX; - sls = SLS_NONE; - } - else if (strcmp (line + 1, "code") == 0) { - if (*currprog == NULL || pls != PLS_VERTEX) - break; - sls = SLS_CODE; - } - else if (strcmp (line + 1, "output") == 0) { - if (*currprog == NULL || pls != PLS_VERTEX) - break; - sls = SLS_OUTPUT; - } - } - else { - if ((*currprog == NULL || pls == PLS_NONE || sls == SLS_NONE) && line[0] != '\0') - break; - if (*currprog != NULL && pls == PLS_VERTEX) { - if (sls == SLS_CODE) { - strcat ((**currprog).vertex.code, line); - strcat ((**currprog).vertex.code, "\n"); - } - else if (sls == SLS_OUTPUT && line[0] != '\0') { - if (strcmp (line, "true") == 0) - (**currprog).vertex.output[(**currprog).vertex.count] = 1.0f; - else if (strcmp (line, "false") == 0) - (**currprog).vertex.output[(**currprog).vertex.count] = 0.0f; - else - sscanf (line, "%f", &(**currprog).vertex.output[(**currprog).vertex.count]); - (**currprog).vertex.count++; - } - } - else if (*currprog != NULL && pls == PLS_ATTRIB && line[0] != '\0') { - struct ATTRIB *att = &(**currprog).attribs.attrib[(**currprog).attribs.count - 1]; - GLfloat *vec = att->value[att->count]; - sscanf (line, "%f %f %f %f", &vec[0], &vec[1], &vec[2], &vec[3]); - att->count++; - } - } - } - - fclose (f); -} - -void InitScene (void) -{ - prog = glCreateProgramObjectARB (); - vert = glCreateShaderObjectARB (GL_VERTEX_SHADER_ARB); - glAttachObjectARB (prog, vert); - glDeleteObjectARB (vert); - load_test_file ("cltest.txt", &program); -} - -void RenderScene (void) -{ - struct PROGRAM *nextprogram; - char *code; - GLint info_length, length; - char output[65000], *p; - GLuint i; - - if (program == NULL) - exit (0); - - code = program->vertex.code; - glShaderSourceARB (vert, 1, (const GLcharARB **) (&code), NULL); - glCompileShaderARB (vert); - CheckObjectStatus (vert); - - for (i = 0; i < program->attribs.count; i++) { - const char *name = program->attribs.attrib[i].name; - if (strcmp (name, "gl_Vertex") != 0) - glBindAttribLocationARB (prog, i, name); - } - - glLinkProgramARB (prog); - CheckObjectStatus (prog); - glUseProgramObjectARB (prog); - - printf ("\n--- %s\n", program->name); - - glGetObjectParameterivARB (vert, GL_OBJECT_INFO_LOG_LENGTH_ARB, &info_length); - - glBegin (GL_POINTS); - if (program->attribs.count == 0) { - glVertex2f (0.0f, 0.0f); - } - else { - for (i = 0; i < program->attribs.attrib[0].count; i++) { - GLuint j; - for (j = 0; j < program->attribs.count; j++) { - GLuint n = (j + 1) % program->attribs.count; - GLfloat *vec = program->attribs.attrib[n].value[i]; - const char *name = program->attribs.attrib[n].name; - if (strcmp (name, "gl_Vertex") == 0) - glVertex4fv (vec); - else - glVertexAttrib4fvARB (n, vec); - } - } - } - glEnd (); - glFlush (); - - glGetInfoLogARB (vert, sizeof (output), &length, output); - p = output + info_length - 1; - for (i = 0; i < program->vertex.count; i++) { - GLfloat value; - if (p == NULL) { - printf ("*** %s\n", "I/O error"); - break; - } - if (strncmp (p, "true", 4) == 0) - value = 1.0f; - else if (strncmp (p, "false", 5) == 0) - value = 0.0f; - else if (sscanf (p, "%f", &value) != 1) { - printf ("*** %s\n", "I/O error"); - break; - } - if (fabs (value - program->vertex.output[i]) > EPSILON) { - printf ("*** Values are different, is %f, should be %f\n", value, - program->vertex.output[i]); - } - p = strchr (p, '\n'); - if (p != NULL) - p++; - } - if (*p != '\0') - printf ("*** %s\n", "I/O error"); - - nextprogram = program->next; - free (program); - program = nextprogram; -} - -int main (int argc, char *argv[]) -{ - InitFramework (&argc, argv); - return 0; -} - diff --git a/progs/slang/cltest.txt b/progs/slang/cltest.txt deleted file mode 100644 index 97cc177c9f..0000000000 --- a/progs/slang/cltest.txt +++ /dev/null @@ -1,1615 +0,0 @@ -$ /* -$ Shader test script. -$ -$ Author: Michal Krol -$ -$ Comment line starts with dollar sign and white space. -$ -$ $program starts a new test program section called . Contains all other sections. -$ -$ $attrib starts vertex data input section for attrib called . Each line consists of -$ four values that form single vertex attrib. -$ -$ $vertex starts vertex shader section. Contains $code and &output sections. -$ -$ $code starts source code section. All text in this section gets compiled into appropriate -$ shader object. -$ -$ $output starts shader execution results section. These are compared, value-by-value, -$ with results of executing printMESA() functions within a shader. -$ */ - - -$ /* -$ -------------------------------------------------------------------------------------------------- -$ Test printMESA() function. -$ */ - -$program PRINT TEST - -$vertex - -$code - -#version 110 - -#extension MESA_shader_debug: require - -void main () { - gl_Position = gl_ModelViewMatrix * gl_Vertex; - gl_FrontColor = vec4 (1.0); - - printMESA (11.1); - printMESA (111); - printMESA (true); - - printMESA (vec2 (22.1, 22.2)); - printMESA (vec3 (33.1, 33.2, 33.3)); - printMESA (vec4 (44.1, 44.2, 44.3, 44.4)); - - printMESA (ivec2 (221, 222)); - printMESA (ivec3 (331, 332, 333)); - printMESA (ivec4 (441, 442, 443, 444)); - - printMESA (bvec2 (false, true)); - printMESA (bvec3 (true, true, false)); - printMESA (bvec4 (true, false, true, false)); - - printMESA (mat2 (55.11, 55.12, 55.21, 55.22)); - printMESA (mat3 (66.11, 66.12, 66.13, - 66.21, 66.22, 66.23, - 66.31, 66.32, 66.33)); - printMESA (mat4 (77.11, 77.12, 77.13, 77.14, - 77.21, 77.22, 77.23, 77.24, - 77.31, 77.32, 77.33, 77.34, - 77.41, 77.42, 77.43, 77.44)); -} - -$output - -11.1 -111 -true - -22.1 -22.2 -33.1 -33.2 -33.3 -44.1 -44.2 -44.3 -44.4 - -221 -222 -331 -332 -333 -441 -442 -443 -444 - -false -true -true -true -false -true -false -true -false - -55.11 -55.12 -55.21 -55.22 - -66.11 -66.12 -66.13 -66.21 -66.22 -66.23 -66.31 -66.32 -66.33 - -77.11 -77.12 -77.13 -77.14 -77.21 -77.22 -77.23 -77.24 -77.31 -77.32 -77.33 -77.34 -77.41 -77.42 -77.43 -77.44 - - -$ /* -$ -------------------------------------------------------------------------------------------------- -$ Test type casting. -$ */ - -$program TYPE CAST TEST - -$attrib gl_Vertex -0.0 0.0 0.0 1.0 - -$attrib _Zero -0.0 0.0 0.0 0.0 - -$attrib _One -1.1 0.0 0.0 0.0 - -$attrib _Two -2.2 0.0 0.0 0.0 - -$attrib _MinusThree --3.3 0.0 0.0 0.0 - -$vertex - -$code - -#version 110 - -#extension MESA_shader_debug: require - -attribute float _Zero; -attribute float _One; -attribute float _Two; -attribute float _MinusThree; - -void main () { - gl_Position = gl_ModelViewMatrix * gl_Vertex; - gl_FrontColor = vec4 (1.0); - - printMESA (_Zero); - printMESA (_One); - printMESA (_Two); - printMESA (_MinusThree); - - printMESA (float (_Zero)); - printMESA (float (_One)); - printMESA (float (_Two)); - printMESA (float (_MinusThree)); - printMESA (float (45.99)); - printMESA (float (-6.17)); - - printMESA (bool (_Zero)); - printMESA (bool (_One)); - printMESA (bool (_Two)); - printMESA (bool (_MinusThree)); - printMESA (bool (45.99)); - printMESA (bool (-6.17)); - printMESA (bool (0.0001)); - printMESA (bool (0.0)); - - printMESA (int (_Zero)); - printMESA (int (_One)); - printMESA (int (_Two)); - printMESA (int (_MinusThree)); - printMESA (int (45.99)); - printMESA (int (45.22)); - printMESA (int (-6.17)); - printMESA (int (-6.87)); -} - -$output - -0.0 -1.1 -2.2 --3.3 - -0.0 -1.1 -2.2 --3.3 -45.99 --6.17 - -false -true -true -true -true -true -true -false - -0 -1 -2 --3 -45 -45 --6 --6 - -$ /* -$ -------------------------------------------------------------------------------------------------- -$ Test vector swizzles. -$ */ - -$program SWIZZLE TEST - -$attrib gl_Vertex -0.0 0.0 0.0 1.0 - -$attrib _One -1.1 1.2 1.3 1.4 - -$attrib _Two -2.1 2.2 2.3 2.4 - -$vertex - -$code - -#version 110 - -#extension MESA_shader_debug: require - -attribute vec4 _One; -attribute vec4 _Two; - -void assign5678 (out vec4 v) -{ - v.x = 5.5; - v.y = 6.6; - v.z = 7.7; - v.w = 8.8; -} - -void main () { - gl_Position = gl_ModelViewMatrix * gl_Vertex; - gl_FrontColor = vec4 (1.0); - - printMESA (_One); - printMESA (_Two); - - printMESA (_One.x); - printMESA (_One.y); - printMESA (_One.z); - printMESA (_One.w); - - printMESA (_Two.xy); - printMESA (_Two.yx); - printMESA (_Two.xw); - printMESA (_Two.wx); - printMESA (_Two.yz); - printMESA (_Two.zy); - printMESA (_Two.xz); - printMESA (_Two.zx); - printMESA (_Two.zw); - printMESA (_Two.wz); - - printMESA (_One.xyz); - printMESA (_One.yzx); - printMESA (_One.zxy); - printMESA (_One.xzy); - printMESA (_One.yzw); - printMESA (_One.zwx); - - printMESA (_Two.xyzw); - printMESA (_Two.yzwx); - printMESA (_Two.wzyx); - printMESA (_Two.zwyx); - - printMESA (_One.xx); - printMESA (_One.zz); - printMESA (_One.ww); - - printMESA (_Two.xxx); - printMESA (_Two.yyy); - printMESA (_Two.www); - - printMESA (_One.xxxx); - printMESA (_One.zzzz); - - printMESA (_Two.xxyy); - printMESA (_Two.wwxx); - printMESA (_Two.zxxw); - - vec4 v; - - v.zxwy = vec4 (5.5, 6.6, 7.7, 8.8); - printMESA (v); - - assign5678 (v.ywxz); - printMESA (v); -} - -$output - -1.1 -1.2 -1.3 -1.4 -2.1 -2.2 -2.3 -2.4 - -1.1 -1.2 -1.3 -1.4 - -2.1 -2.2 -2.2 -2.1 -2.1 -2.4 -2.4 -2.1 -2.2 -2.3 -2.3 -2.2 -2.1 -2.3 -2.3 -2.1 -2.3 -2.4 -2.4 -2.3 - -1.1 -1.2 -1.3 -1.2 -1.3 -1.1 -1.3 -1.1 -1.2 -1.1 -1.3 -1.2 -1.2 -1.3 -1.4 -1.3 -1.4 -1.1 - -2.1 -2.2 -2.3 -2.4 -2.2 -2.3 -2.4 -2.1 -2.4 -2.3 -2.2 -2.1 -2.3 -2.4 -2.2 -2.1 - -1.1 -1.1 -1.3 -1.3 -1.4 -1.4 - -2.1 -2.1 -2.1 -2.2 -2.2 -2.2 -2.4 -2.4 -2.4 - -1.1 -1.1 -1.1 -1.1 -1.3 -1.3 -1.3 -1.3 - -2.1 -2.1 -2.2 -2.2 -2.4 -2.4 -2.1 -2.1 -2.3 -2.1 -2.1 -2.4 - -6.6 -8.8 -5.5 -7.7 - -7.7 -5.5 -8.8 -6.6 - - -$ /* -$ -------------------------------------------------------------------------------------------------- -$ Test relational operators. -$ */ - -$program RELATIONAL OPERATOR TEST - -$attrib gl_Vertex -0.0 0.0 0.0 1.0 - -$attrib _Two -2.0 0.0 0.0 0.0 - -$attrib _Two2 -2.0 0.0 0.0 0.0 - -$attrib _MinusThree --3.0 0.0 0.0 0.0 - -$vertex - -$code - -#version 110 - -#extension MESA_shader_debug: require - -attribute float _Two; -attribute float _Two2; -attribute float _MinusThree; - -struct foo -{ - float f; - vec4 v4; - vec3 v3; - mat4 m4; - int i; - bool b; -}; - -void printMESA (const in foo bar) -{ - printMESA (bar.f); - printMESA (bar.v4); - printMESA (bar.v3); - printMESA (bar.m4); - printMESA (bar.i); - printMESA (bar.b); -} - -void main () { - gl_Position = gl_ModelViewMatrix * gl_Vertex; - gl_FrontColor = vec4 (1.0); - - int iTwo = int (_Two); - int iTwo2 = int (_Two2); - int iMinusThree = int (_MinusThree); - - printMESA (_Two <= _Two); - printMESA (_Two <= _Two2); - printMESA (_Two <= _MinusThree); - printMESA (_MinusThree <= _Two); - printMESA (iTwo <= iTwo); - printMESA (iTwo <= iTwo2); - printMESA (iTwo <= iMinusThree); - printMESA (iMinusThree <= iTwo); - - printMESA (_Two >= _Two); - printMESA (_Two >= _Two2); - printMESA (_Two >= _MinusThree); - printMESA (_MinusThree >= _Two); - printMESA (iTwo >= iTwo); - printMESA (iTwo >= iTwo2); - printMESA (iTwo >= iMinusThree); - printMESA (iMinusThree >= iTwo); - - printMESA (_Two < _Two); - printMESA (_Two < _Two2); - printMESA (_Two < _MinusThree); - printMESA (_MinusThree < _Two); - printMESA (iTwo < iTwo); - printMESA (iTwo < iTwo2); - printMESA (iTwo < iMinusThree); - printMESA (iMinusThree < iTwo); - - printMESA (_Two > _Two); - printMESA (_Two > _Two2); - printMESA (_Two > _MinusThree); - printMESA (_MinusThree > _Two); - printMESA (iTwo > iTwo); - printMESA (iTwo > iTwo2); - printMESA (iTwo > iMinusThree); - printMESA (iMinusThree > iTwo); - - printMESA (_Two == _Two); - printMESA (_Two == _Two2); - printMESA (_Two == _MinusThree); - printMESA (_MinusThree == _MinusThree); - printMESA (iTwo == iTwo); - printMESA (iTwo == iTwo2); - printMESA (iTwo == iMinusThree); - printMESA (iMinusThree == iMinusThree); - - printMESA (_Two != _Two); - printMESA (_Two != _Two2); - printMESA (_Two != _MinusThree); - printMESA (_MinusThree != _MinusThree); - printMESA (iTwo != iTwo); - printMESA (iTwo != iTwo2); - printMESA (iTwo != iMinusThree); - printMESA (iMinusThree != iMinusThree); - - foo foo1; - foo1.f = 13.31; - foo1.v4 = vec4 (44.11, 44.22, 44.33, 44.44); - foo1.v3 = vec3 (33.11, 33.22, 33.33); - foo1.m4 = mat4 (17.88); - foo1.i = 666; - foo1.b = true; - printMESA (foo1); - - // make foo2 the same as foo1 - foo foo2; - foo2.f = 13.31; - foo2.v4 = vec4 (44.11, 44.22, 44.33, 44.44); - foo2.v3 = vec3 (33.11, 33.22, 33.33); - foo2.m4 = mat4 (17.88); - foo2.i = 666; - foo2.b = true; - - printMESA (foo1 == foo2); - printMESA (foo1 != foo2); - - // make them a little bit different - foo2.m4[2].y = 333.333; - printMESA (foo2); - - printMESA (foo1 == foo2); - printMESA (foo1 != foo2); -} - -$output - -true -true -false -true -true -true -false -true - -true -true -true -false -true -true -true -false - -false -false -false -true -false -false -false -true - -false -false -true -false -false -false -true -false - -true -true -false -true -true -true -false -true - -false -false -true -false -false -false -true -false - -13.31 -44.11 -44.22 -44.33 -44.44 -33.11 -33.22 -33.33 -17.88 -0.0 -0.0 -0.0 -0.0 -17.88 -0.0 -0.0 -0.0 -0.0 -17.88 -0.0 -0.0 -0.0 -0.0 -17.88 -666 -true - -true -false - -13.31 -44.11 -44.22 -44.33 -44.44 -33.11 -33.22 -33.33 -17.88 -0.0 -0.0 -0.0 -0.0 -17.88 -0.0 -0.0 -0.0 -333.333 -17.88 -0.0 -0.0 -0.0 -0.0 -17.88 -666 -true - -false -true - - -$ /* -$ -------------------------------------------------------------------------------------------------- -$ Test logical operators. -$ */ - -$program LOGICAL OPERATOR TEST - -$attrib gl_Vertex -0.0 0.0 0.0 1.0 - -$attrib _False -0.0 0.0 0.0 0.0 - -$attrib _True -1.0 0.0 0.0 0.0 - -$attrib _False2 -0.0 0.0 0.0 0.0 - -$attrib _True2 -1.0 0.0 0.0 0.0 - -$vertex - -$code - -#version 110 - -#extension MESA_shader_debug: require - -attribute float _False; -attribute float _True; -attribute float _False2; -attribute float _True2; - -void main () { - gl_Position = gl_ModelViewMatrix * gl_Vertex; - gl_FrontColor = vec4 (1.0); - - printMESA (_False); - printMESA (_True); - printMESA (_False2); - printMESA (_True2); - - bool False = bool (_False); - bool True = bool (_True); - bool False2 = bool (_False2); - bool True2 = bool (_True2); - - // - // It is important to test each operator with the following argument types: - // * Both arguments are different variables, even if they have the same values. - // False and False2 are distinct attributes, but are the same in value. - // * Both arguments may be the same variables. This case tests possible - // optimizations, e.g. X && X --> X. - // * Both arguments are constant. This tests constant folding. - // - - printMESA (!False); - printMESA (!True); - printMESA (!false); - printMESA (!true); - - printMESA (False ^^ False2); - printMESA (False ^^ True2); - printMESA (True ^^ False2); - printMESA (True ^^ True2); - printMESA (False ^^ False); - printMESA (False ^^ True); - printMESA (True ^^ False); - printMESA (True ^^ True); - printMESA (false ^^ false); - printMESA (false ^^ true); - printMESA (true ^^ false); - printMESA (true ^^ true); - - printMESA (False && False2); - printMESA (False && True2); - printMESA (True && False2); - printMESA (True && True2); - printMESA (False && False); - printMESA (False && True); - printMESA (True && False); - printMESA (True && True); - printMESA (false && false); - printMESA (false && true); - printMESA (true && false); - printMESA (true && true); - - printMESA (False || False2); - printMESA (False || True2); - printMESA (True || False2); - printMESA (True || True2); - printMESA (False || False); - printMESA (False || True); - printMESA (True || False); - printMESA (True || True); - printMESA (false || false); - printMESA (false || true); - printMESA (true || false); - printMESA (true || true); - - // - // Test short-circuit evaluation of && and ||. The right expression evaluation depends - // on the value of the left expression. If the right expression has side effects, we - // can easily test if it happened. - // - - bool x; - - x = false; - printMESA (x); - printMESA (False && (x = true)); - printMESA (x); - - x = false; - printMESA (x); - printMESA (false && (x = true)); - printMESA (x); - - x = true; - printMESA (x); - printMESA (True || (x = false)); - printMESA (x); - - x = true; - printMESA (x); - printMESA (true || (x = false)); - printMESA (x); -} - -$output - -0.0 -1.0 -0.0 -1.0 - -true -false -true -false - -false -true -true -false -false -true -true -false -false -true -true -false - -false -false -false -true -false -false -false -true -false -false -false -true - -false -true -true -true -false -true -true -true -false -true -true -true - -false -false -false - -false -false -false - -true -true -true - -true -true -true - - -$ /* -$ -------------------------------------------------------------------------------------------------- -$ Test subscript operator/array access. -$ */ - -$program ARRAY ACCESS TEST - -$attrib gl_Vertex -0.0 0.0 0.0 1.0 - -$attrib _Zero -0.0 0.0 0.0 0.0 - -$attrib _One -1.1 0.0 0.0 0.0 - -$attrib _Two -2.9 0.0 0.0 0.0 - -$attrib _Vec -11.11 22.22 33.33 44.44 - -$vertex - -$code - -#version 110 - -#extension MESA_shader_debug: require - -attribute float _Zero; -attribute float _One; -attribute float _Two; -attribute vec4 _Vec; - -void main () { - gl_Position = gl_ModelViewMatrix * gl_Vertex; - gl_FrontColor = vec4 (1.0); - - printMESA (_Zero); - printMESA (_One); - printMESA (_Two); - printMESA (_Vec); - - printMESA (_Vec[0]); - printMESA (_Vec[1]); - printMESA (_Vec[2]); - printMESA (_Vec[3]); - - printMESA (_Vec[int (_Zero)]); - printMESA (_Vec[int (_One)]); - printMESA (_Vec[int (_Two)]); -} - -$output - -0.0 -1.1 -2.9 -11.11 -22.22 -33.33 -44.44 - -11.11 -22.22 -33.33 -44.44 - -11.11 -22.22 -33.33 - - -$ /* -$ -------------------------------------------------------------------------------------------------- -$ Test pre/post-increment/decrement operators. -$ Note: assumes relational operators being correct. -$ */ - -$program PRE/POST-INC/DEC OPERATOR TEST - -$attrib gl_Vertex -0.0 0.0 0.0 1.0 - -$attrib _Zero -0.0 0.0 0.0 0.0 - -$attrib _One -1.1 0.0 0.0 0.0 - -$attrib _Two4 -2.1 2.2 2.3 2.4 - -$vertex - -$code - -#version 110 - -#extension MESA_shader_debug: require - -attribute float _Zero; -attribute float _One; -attribute vec4 _Two4; - -float fZero, fOne; -vec4 fTwo4; -int iZero, iOne; -ivec4 iTwo4; - -void reset () { - fZero = _Zero; - fOne = _One; - fTwo4 = _Two4; - iZero = int (_Zero); - iOne = int (_One); - iTwo4 = ivec4 (_Two4); -} - -void main () { - gl_Position = gl_ModelViewMatrix * gl_Vertex; - gl_FrontColor = vec4 (1.0); - - printMESA (_Zero); - printMESA (_One); - printMESA (_Two4); - - // pre-increment - reset (); - printMESA (++fZero); - printMESA (++fOne); - printMESA (++iZero); - printMESA (++iOne); - printMESA (fZero); - printMESA (fOne); - printMESA (iZero); - printMESA (iOne); - printMESA (++fTwo4 == _Two4 + 1.0); - printMESA (++iTwo4 == ivec4 (_Two4) + 1); - - // pre-decrement - reset (); - printMESA (--fZero); - printMESA (--fOne); - printMESA (--iZero); - printMESA (--iOne); - printMESA (fZero); - printMESA (fOne); - printMESA (iZero); - printMESA (iOne); - printMESA (--fTwo4 == _Two4 - 1.0); - printMESA (--iTwo4 == ivec4 (_Two4) - 1); - - // post-increment - reset (); - printMESA (fZero++); - printMESA (fOne++); - printMESA (iZero++); - printMESA (iOne++); - printMESA (fZero); - printMESA (fOne); - printMESA (iZero); - printMESA (iOne); - printMESA (fTwo4++ == _Two4); - printMESA (iTwo4++ == ivec4 (_Two4)); - - // post-decrement - reset (); - printMESA (fZero--); - printMESA (fOne--); - printMESA (iZero--); - printMESA (iOne--); - printMESA (fZero); - printMESA (fOne); - printMESA (iZero); - printMESA (iOne); - printMESA (fTwo4-- == _Two4); - printMESA (iTwo4-- == ivec4 (_Two4)); -} - -$output - -0.0 -1.1 -2.1 -2.2 -2.3 -2.4 - -1.0 -2.1 -1 -2 -1.0 -2.1 -1 -2 -true -true - --1.0 -0.1 --1 -0 --1.0 -0.1 --1 -0 -true -true - -0.0 -1.1 -0 -1 -1.0 -2.1 -1 -2 -true -true - -0.0 -1.1 -0 -1 --1.0 -0.1 --1 -0 -true -true - - -$ /* -$ -------------------------------------------------------------------------------------------------- -$ Test arithmetical operators. -$ */ - -$program ARITHMETICAL OPERATOR TEST - -$attrib gl_Vertex -0.0 0.0 0.0 1.0 - -$attrib _Zero -0.0 0.0 0.0 0.0 - -$attrib _One -1.1 0.0 0.0 0.0 - -$attrib _Two4 -2.1 2.2 2.3 2.4 - -$vertex - -$code - -#version 110 - -#extension MESA_shader_debug: require - -attribute float _Zero; -attribute float _One; -attribute vec4 _Two4; - -void main () { - gl_Position = gl_ModelViewMatrix * gl_Vertex; - gl_FrontColor = vec4 (1.0); - - printMESA (_Zero); - printMESA (_One); - printMESA (_Two4); - - int iZero = int (_Zero); - int iOne = int (_One); - ivec4 iTwo4 = ivec4 (_Two4); - - printMESA (-_Zero); - printMESA (-_One); - printMESA (-_Two4); - printMESA (-_Two4.z); - - printMESA (_Zero + 0.0); - printMESA (_One + 0.0); - printMESA (_Two4 + 0.0); - printMESA (_Two4.y + 0.0); - - printMESA (_Zero + _Zero); - printMESA (_Zero + _One); - printMESA (_Zero + _Two4); - printMESA (_One + _Zero); - printMESA (_One + _Two4); - printMESA (_Two4 + _Two4); - - printMESA (_Zero - 0.0); - printMESA (_One - 0.0); - printMESA (_Two4 - 0.0); - printMESA (_Two4.y - 0.0); - - printMESA (_Zero - _Zero); - printMESA (_Zero - _One); - printMESA (_Zero - _Two4); - printMESA (_One - _Zero); - printMESA (_One - _Two4); - printMESA (_Two4 - _Two4); - - printMESA (_Zero * 1.0); - printMESA (_One * 1.0); - printMESA (_Two4 * 1.0); - printMESA (_Two4.x * 1.0); - - printMESA (_Zero * _Zero); - printMESA (_Zero * _One); - printMESA (_Zero * _Two4); - printMESA (_One * _Zero); - printMESA (_One * _One); - printMESA (_One * _Two4); - printMESA (_Two4 * _Two4); - - printMESA (_Zero / 1.0); - printMESA (_One / 1.0); - printMESA (_Two4 / 1.0); - printMESA (_Two4.x / 1.0); - - printMESA (_Zero / _One); - printMESA (_Zero / _Two4); - printMESA (_One / _One); - printMESA (_One / _Two4); - printMESA (_Two4 / _Two4); -} - -$output - -0.0 -1.1 -2.1 -2.2 -2.3 -2.4 - -0.0 --1.1 --2.1 --2.2 --2.3 --2.4 --2.3 - -0.0 -1.1 -2.1 -2.2 -2.3 -2.4 -2.2 - -0.0 -1.1 -2.1 -2.2 -2.3 -2.4 -1.1 -3.2 -3.3 -3.4 -3.5 -4.2 -4.4 -4.6 -4.8 - -0.0 -1.1 -2.1 -2.2 -2.3 -2.4 -2.2 - -0.0 --1.1 --2.1 --2.2 --2.3 --2.4 -1.1 --1.0 --1.1 --1.2 --1.3 -0.0 -0.0 -0.0 -0.0 - -0.0 -1.1 -2.1 -2.2 -2.3 -2.4 -2.1 - -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -1.21 -2.31 -2.42 -2.53 -2.64 -4.41 -4.84 -5.29 -5.76 - -0.0 -1.1 -2.1 -2.2 -2.3 -2.4 -2.1 - -0.0 -0.0 -0.0 -0.0 -0.0 -1.0 -0.52381 -0.5 -0.47826 -0.45833 -1.0 -1.0 -1.0 -1.0 - - -$ /* -$ -------------------------------------------------------------------------------------------------- -$ Test matrix operations. -$ Note: assumes relational operators being correct. -$ */ - -$program MATRIX TEST - -$attrib gl_Vertex -0.0 0.0 0.0 1.0 - -$attrib _Zero -0.0 0.0 0.0 0.0 - -$attrib _One -1.0 1.0 1.0 1.0 - -$attrib _Two -2.0 2.0 2.0 2.0 - -$vertex - -$code - -#version 110 - -#extension MESA_shader_debug: require - -attribute vec4 _Zero; -attribute vec4 _One; -attribute vec4 _Two; - -void main () { - gl_Position = gl_ModelViewMatrix * gl_Vertex; - gl_FrontColor = vec4 (1.0); - - printMESA (_Zero); - printMESA (_One); - printMESA (_Two); - - mat4 Identity = mat4 (_One.x); - - printMESA (Identity == mat4 (1.0, 0.0, 0.0, 0.0, - 0.0, 1.0, 0.0, 0.0, - 0.0, 0.0, 1.0, 0.0, - 0.0, 0.0, 0.0, 1.0)); - printMESA (Identity * _Two == _Two); - - mat4 Matrix = mat4 (1.1, 1.2, 1.3, 1.4, - 2.1, 2.2, 2.3, 2.4, - 3.1, 3.2, 3.3, 3.4, - 4.1, 4.2, 4.3, 4.4); - - printMESA (Matrix[2].y); - printMESA (Matrix[1]); -} - -$output - -0.0 -0.0 -0.0 -0.0 -1.0 -1.0 -1.0 -1.0 -2.0 -2.0 -2.0 -2.0 -true -true -3.2 -2.1 -2.2 -2.3 -2.4 - - -$ /* -$ -------------------------------------------------------------------------------------------------- -$ Test vec4 extension operations. -$ */ - -$program VEC4 EXTENSION OPERATIONS - -$attrib gl_Vertex -0.0 0.0 0.0 1.0 - -$attrib _One -1.1 0.0 0.0 0.0 - -$attrib _Two4 -2.1 2.2 2.3 2.4 - -$attrib _Three4 -3.1 3.2 3.3 3.4 - -$vertex - -$code - -#version 110 - -#extension MESA_shader_debug: require - -attribute float _One; -attribute vec4 _Two4; -attribute vec4 _Three4; - -void main () { - gl_Position = gl_ModelViewMatrix * gl_Vertex; - gl_FrontColor = vec4 (1.0); - - printMESA (_One); - printMESA (_Two4); - printMESA (_Three4); - - printMESA (vec4 (_One)); - - printMESA (_Two4 + _Three4); - printMESA (_Two4 - _Three4); - printMESA (_Two4 * _Three4); - printMESA (_Two4 / _Three4); - - printMESA (_Two4 + _One); - printMESA (_Two4 - _One); - printMESA (_Two4 * _One); - printMESA (_Two4 / _One); - - printMESA (_One + _Two4); - printMESA (_One - _Two4); - printMESA (_One * _Two4); - printMESA (_One / _Two4); - - printMESA (-_Three4); - - printMESA (dot (_Two4.xyz, _Three4.xyz)); - printMESA (dot (_Two4, _Three4)); - - printMESA (length (_Two4.xyz)); - printMESA (length (_Three4)); - - printMESA (normalize (_Two4.xyz)); - printMESA (normalize (_Three4)); - - vec4 tmp = _Two4; - printMESA (tmp); - - printMESA (_Two4 == _Three4); - printMESA (_Two4 != _Three4); - printMESA (_Two4 == _Two4); - printMESA (_Three4 != _Three4); - printMESA (_Two4 != vec4 (_Two4.xyz, 999.0)); - printMESA (_Two4 != vec4 (999.0, _Two4.yzw)); -} - -$output - -1.1 -2.1 -2.2 -2.3 -2.4 -3.1 -3.2 -3.3 -3.4 - -1.1 -1.1 -1.1 -1.1 - -5.2 -5.4 -5.6 -5.8 --1.0 --1.0 --1.0 --1.0 -6.51 -7.04 -7.59 -8.16 -0.677419 -0.6875 -0.69697 -0.705882 - -3.2 -3.3 -3.4 -3.5 -1.0 -1.1 -1.2 -1.3 -2.31 -2.42 -2.53 -2.64 -1.909091 -2.0 -2.090909 -2.181818 - -3.2 -3.3 -3.4 -3.5 --1.0 --1.1 --1.2 --1.3 -2.31 -2.42 -2.53 -2.64 -0.52381 -0.5 -0.478261 -0.458333 - --3.1 --3.2 --3.3 --3.4 - -21.14 -29.3 - -3.813135 -6.503845 - -0.550728 -0.576953 -0.603178 -0.476641 -0.492017 -0.507392 -0.522768 - -2.1 -2.2 -2.3 -2.4 - -false -true -true -false -true -true diff --git a/progs/slang/framework.c b/progs/slang/framework.c deleted file mode 100644 index 692cef9c8c..0000000000 --- a/progs/slang/framework.c +++ /dev/null @@ -1,145 +0,0 @@ -#include "framework.h" - -/* - * GL_ARB_multitexture - */ -#ifndef GL_ARB_multitexture -PFNGLCLIENTACTIVETEXTUREARBPROC glClientActiveTextureARB; -PFNGLMULTITEXCOORD4FVARBPROC glMultiTexCoord4fvARB; -#endif - -/* - * GL_ARB_shader_objects - */ -PFNGLDELETEOBJECTARBPROC glDeleteObjectARB; -PFNGLGETHANDLEARBPROC glGetHandleARB; -PFNGLDETACHOBJECTARBPROC glDetachObjectARB; -PFNGLCREATESHADEROBJECTARBPROC glCreateShaderObjectARB; -PFNGLSHADERSOURCEARBPROC glShaderSourceARB; -PFNGLCOMPILESHADERARBPROC glCompileShaderARB; -PFNGLCREATEPROGRAMOBJECTARBPROC glCreateProgramObjectARB; -PFNGLATTACHOBJECTARBPROC glAttachObjectARB; -PFNGLLINKPROGRAMARBPROC glLinkProgramARB; -PFNGLUSEPROGRAMOBJECTARBPROC glUseProgramObjectARB; -PFNGLGETOBJECTPARAMETERIVARBPROC glGetObjectParameterivARB; -PFNGLGETINFOLOGARBPROC glGetInfoLogARB; -PFNGLGETUNIFORMLOCATIONARBPROC glGetUniformLocationARB; - -/* - * GL_ARB_vertex_shader - */ -PFNGLVERTEXATTRIB4FVARBPROC glVertexAttrib4fvARB; -PFNGLVERTEXATTRIBPOINTERARBPROC glVertexAttribPointerARB; -PFNGLENABLEVERTEXATTRIBARRAYARBPROC glEnableVertexAttribArrayARB; -PFNGLDISABLEVERTEXATTRIBARRAYARBPROC glDisableVertexAttribArrayARB; -PFNGLBINDATTRIBLOCATIONARBPROC glBindAttribLocationARB; -PFNGLGETATTRIBLOCATIONARBPROC glGetAttribLocationARB; - -/* - * GL_EXT_fog_coord - */ -PFNGLFOGCOORDFVEXTPROC glFogCoordfvEXT; -PFNGLFOGCOORDPOINTEREXTPROC glFogCoordPointerEXT; - -/* - * GL_EXT_secondary_color - */ -PFNGLSECONDARYCOLOR3FVEXTPROC glSecondaryColor3fvEXT; -PFNGLSECONDARYCOLORPOINTEREXTPROC glSecondaryColorPointerEXT; - -static void Display (void) -{ - glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); - RenderScene (); - glutSwapBuffers (); -} - -static void Idle (void) -{ - glutPostRedisplay (); -} - -void InitFramework (int *argc, char *argv[]) -{ - glutInit (argc, argv); - glutInitWindowPosition (0, 0); - glutInitWindowSize (200, 200); - glutInitDisplayMode (GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH); - glutCreateWindow (argv[0]); - -#ifndef GL_ARB_multitexture - GETPROCADDR(glClientActiveTextureARB, PFNGLCLIENTACTIVETEXTUREARBPROC); - GETPROCADDR(glMultiTexCoord4fvARB, PFNGLMULTITEXCOORD4FVARBPROC); -#endif - - GETPROCADDR(glDeleteObjectARB, PFNGLDELETEOBJECTARBPROC); - GETPROCADDR(glGetHandleARB, PFNGLGETHANDLEARBPROC); - GETPROCADDR(glDetachObjectARB, PFNGLDETACHOBJECTARBPROC); - GETPROCADDR(glCreateShaderObjectARB, PFNGLCREATESHADEROBJECTARBPROC); - GETPROCADDR(glShaderSourceARB, PFNGLSHADERSOURCEARBPROC); - GETPROCADDR(glCompileShaderARB, PFNGLCOMPILESHADERARBPROC); - GETPROCADDR(glCreateProgramObjectARB, PFNGLCREATEPROGRAMOBJECTARBPROC); - GETPROCADDR(glAttachObjectARB, PFNGLATTACHOBJECTARBPROC); - GETPROCADDR(glLinkProgramARB, PFNGLLINKPROGRAMARBPROC); - GETPROCADDR(glUseProgramObjectARB, PFNGLUSEPROGRAMOBJECTARBPROC); - GETPROCADDR(glGetObjectParameterivARB, PFNGLGETOBJECTPARAMETERIVARBPROC); - GETPROCADDR(glGetInfoLogARB, PFNGLGETINFOLOGARBPROC); - GETPROCADDR(glGetUniformLocationARB, PFNGLGETUNIFORMLOCATIONARBPROC); - - GETPROCADDR(glVertexAttrib4fvARB, PFNGLVERTEXATTRIB4FVARBPROC); - GETPROCADDR(glVertexAttribPointerARB, PFNGLVERTEXATTRIBPOINTERARBPROC); - GETPROCADDR(glEnableVertexAttribArrayARB, PFNGLENABLEVERTEXATTRIBARRAYARBPROC); - GETPROCADDR(glDisableVertexAttribArrayARB, PFNGLDISABLEVERTEXATTRIBARRAYARBPROC); - GETPROCADDR(glBindAttribLocationARB, PFNGLBINDATTRIBLOCATIONARBPROC); - GETPROCADDR(glGetAttribLocationARB, PFNGLGETATTRIBLOCATIONARBPROC); - - GETPROCADDR(glFogCoordfvEXT, PFNGLFOGCOORDFVEXTPROC); - GETPROCADDR(glFogCoordPointerEXT, PFNGLFOGCOORDPOINTEREXTPROC); - - GETPROCADDR(glSecondaryColor3fvEXT, PFNGLSECONDARYCOLOR3FVEXTPROC); - GETPROCADDR(glSecondaryColorPointerEXT, PFNGLSECONDARYCOLORPOINTEREXTPROC); - - printf ("VENDOR: %s\n", glGetString (GL_VENDOR)); - printf ("RENDERER: %s\n", glGetString (GL_RENDERER)); - - InitScene (); - - glutDisplayFunc (Display); - glutIdleFunc (Idle); - glutMainLoop (); -} - -GLboolean CheckObjectStatus (GLhandleARB handle) -{ - GLint type, status, length; - GLcharARB *infolog; - - glGetObjectParameterivARB (handle, GL_OBJECT_TYPE_ARB, &type); - if (type == GL_SHADER_OBJECT_ARB) - glGetObjectParameterivARB (handle, GL_OBJECT_COMPILE_STATUS_ARB, &status); - else if (type == GL_PROGRAM_OBJECT_ARB) - glGetObjectParameterivARB (handle, GL_OBJECT_LINK_STATUS_ARB, &status); - else { - assert (0); - return GL_FALSE; - } - - if (status) - return GL_TRUE; - - printf ("\n%s FAILED. INFO LOG FOLLOWS:\n", - type == GL_SHADER_OBJECT_ARB ? "SHADER COMPILE" : "PROGRAM LINK"); - - glGetObjectParameterivARB (handle, GL_OBJECT_INFO_LOG_LENGTH_ARB, &length); - infolog = (GLcharARB *) (malloc (length)); - if (infolog != NULL) { - glGetInfoLogARB (handle, length, NULL, infolog); - printf ("%s", infolog); - free (infolog); - } - - printf ("\n"); - - return GL_FALSE; -} - diff --git a/progs/slang/framework.h b/progs/slang/framework.h deleted file mode 100644 index e023f7da8a..0000000000 --- a/progs/slang/framework.h +++ /dev/null @@ -1,82 +0,0 @@ -#ifndef _FRAMEWORK_H_ -#define _FRAMEWORK_H_ - -#ifdef WIN32 -#define WIN32_LEAN_AND_MEAN -#include -#endif - -#include -#include -#include -#include -#include -#include -#include -#include - -#ifdef WIN32 -#define GETPROCADDRESS(x) wglGetProcAddress (x) -#else -#define GETPROCADDRESS(x) glutGetProcAddress (x) -#endif - -#define GETPROCADDR(x,T) do { x = (T) (GETPROCADDRESS(#x)); assert (x != NULL); } while (0) - -/* - * GL_ARB_multitexture - */ -#ifndef GL_ARB_multitexture -extern PFNGLCLIENTACTIVETEXTUREARBPROC glClientActiveTextureARB; -extern PFNGLMULTITEXCOORD4FVARBPROC glMultiTexCoord4fvARB; -#endif - -/* - * GL_ARB_shader_objects - */ -extern PFNGLDELETEOBJECTARBPROC glDeleteObjectARB; -extern PFNGLGETHANDLEARBPROC glGetHandleARB; -extern PFNGLDETACHOBJECTARBPROC glDetachObjectARB; -extern PFNGLCREATESHADEROBJECTARBPROC glCreateShaderObjectARB; -extern PFNGLSHADERSOURCEARBPROC glShaderSourceARB; -extern PFNGLCOMPILESHADERARBPROC glCompileShaderARB; -extern PFNGLCREATEPROGRAMOBJECTARBPROC glCreateProgramObjectARB; -extern PFNGLATTACHOBJECTARBPROC glAttachObjectARB; -extern PFNGLLINKPROGRAMARBPROC glLinkProgramARB; -extern PFNGLUSEPROGRAMOBJECTARBPROC glUseProgramObjectARB; -extern PFNGLGETOBJECTPARAMETERIVARBPROC glGetObjectParameterivARB; -extern PFNGLGETINFOLOGARBPROC glGetInfoLogARB; -extern PFNGLGETUNIFORMLOCATIONARBPROC glGetUniformLocationARB; -/*static PFNGLUNIFORM4FVARBPROC glUniform4fvARB = NULL;*/ - -/* - * GL_ARB_vertex_shader - */ -extern PFNGLVERTEXATTRIB4FVARBPROC glVertexAttrib4fvARB; -extern PFNGLVERTEXATTRIBPOINTERARBPROC glVertexAttribPointerARB; -extern PFNGLENABLEVERTEXATTRIBARRAYARBPROC glEnableVertexAttribArrayARB; -extern PFNGLDISABLEVERTEXATTRIBARRAYARBPROC glDisableVertexAttribArrayARB; -extern PFNGLBINDATTRIBLOCATIONARBPROC glBindAttribLocationARB; -extern PFNGLGETATTRIBLOCATIONARBPROC glGetAttribLocationARB; - -/* - * GL_EXT_fog_coord - */ -extern PFNGLFOGCOORDFVEXTPROC glFogCoordfvEXT; -extern PFNGLFOGCOORDPOINTEREXTPROC glFogCoordPointerEXT; - -/* - * GL_EXT_secondary_color - */ -extern PFNGLSECONDARYCOLOR3FVEXTPROC glSecondaryColor3fvEXT; -extern PFNGLSECONDARYCOLORPOINTEREXTPROC glSecondaryColorPointerEXT; - -extern void InitFramework (int *argc, char *argv[]); - -extern void InitScene (void); -extern void RenderScene (void); - -extern GLboolean CheckObjectStatus (GLhandleARB); - -#endif - diff --git a/progs/slang/sotest.c b/progs/slang/sotest.c deleted file mode 100644 index 4bd3bc23c9..0000000000 --- a/progs/slang/sotest.c +++ /dev/null @@ -1,439 +0,0 @@ -/* - * GL_ARB_shader_objects & GL_ARB_vertex_shader interface test application. - * Neither compiler nor executor is being tested here, although some simple shader - * compilation tests are performed. - * - * Perfectly valid behaviour produces output that does not have a line - * beginning with three stars (***). - * - * Author: Michal Krol - */ - -#include "framework.h" - -enum TEST_TYPE -{ - TT_GETERROR_NOERROR, - TT_GETERROR_INVALIDVALUE, - TT_GETERROR_INVALIDOPERATION, - TT_PARAM1_ZERO, - TT_PARAM1_NONZERO -}; - -static enum TEST_TYPE current_test; - -static void begintest (enum TEST_TYPE type, const char *name) -{ - current_test = type; - printf ("\n BEGIN TEST: %s\n", name); - while (glGetError () != GL_NO_ERROR) - ; -} - -static void endtest1 (GLuint param1) -{ - const char *msg = NULL; - - switch (current_test) - { - case TT_GETERROR_NOERROR: - if (glGetError () != GL_NO_ERROR) - msg = "glGetError () does not return GL_NO_ERROR"; - break; - case TT_GETERROR_INVALIDVALUE: - if (glGetError () != GL_INVALID_VALUE) - msg = "glGetError () does not return GL_INVALID_VALUE"; - break; - case TT_GETERROR_INVALIDOPERATION: - if (glGetError () != GL_INVALID_OPERATION) - msg = "glGetError () does not return GL_INVALID_OPERATION"; - break; - case TT_PARAM1_ZERO: - if (param1) - msg = "The parameter is not zero"; - break; - case TT_PARAM1_NONZERO: - if (!param1) - msg = "The parameter is not non-zero"; - break; - default: - assert (0); - } - - if (msg == NULL) - printf (" OK\n"); - else - printf ("*** %s\n", msg); - - while (glGetError () != GL_NO_ERROR) - ; -} - -static void endtest () -{ - endtest1 (0); -} - -static GLhandleARB vert = 0; -static GLhandleARB frag = 0; -static GLhandleARB prog = 0; - -static GLhandleARB find_invalid_handle () -{ - GLhandleARB handle; - - for (handle = 1; handle < 16; handle++) - if (handle != vert && handle != frag && handle != prog) - return handle; - assert (0); - return 0; -} - -static const char *invsynvertsrc = - "void main () {\n" - " gl_Position = gl_ModelViewMatrix ! gl_Vertex;\n" /* unexpected token */ - "}\n" -; - -static const char *invsemvertsrc = - "void main () {\n" - " gl_Position = gl_ModelviewMatrix * gl_Vertex;\n" /* undeclared identifier */ - "}\n" -; - -static const char *uniforms = - "uniform vec4 CommonUniform;\n" -; - -static const char *validvertsrc = - "uniform vec4 VertexUniform;\n" - "attribute vec4 FirstAttrib;\n" - "attribute vec4 SecondAttrib;\n" - "void main () {\n" - " gl_Position = gl_ModelViewMatrix * gl_Vertex + CommonUniform + VertexUniform\n" - " + FirstAttrib + SecondAttrib;\n" - "}\n" -; - -static const char *invsynfragsrc = - "void main () {\n" - " gl_FragColor = gl_Color\n" /* missing ; */ - "}\n" -; - -static const char *invsemfragsrc = - "void main () {\n" - " gl_FragColor = gl_FrontColor;\n" /* gl_FrontColor only in vertex shader */ - "}\n" -; - -static const char *validfragsrc = - "uniform vec4 FragmentUniform;\n" - "void main () {\n" - " gl_FragColor = gl_Color + CommonUniform + FragmentUniform;\n" - "}\n" -; - -void InitScene (void) -{ - GLint params[1]; - const char *tab[2]; - - /* - * GL should silently ignore calls that delete object 0. - */ - begintest (TT_GETERROR_NOERROR, "glDeleteObject(0)"); - glDeleteObjectARB (0); - endtest (); - - /* - * GL generates an error on invalid object handle. - */ - begintest (TT_GETERROR_INVALIDVALUE, "Pass invalid non-zero object handle"); - glDeleteObjectARB (find_invalid_handle ()); - endtest (); - glUseProgramObjectARB (find_invalid_handle ()); - endtest (); - - /* - * Create object. GL should return unique non-zero values. - */ - begintest (TT_PARAM1_NONZERO, "Create object"); - vert = glCreateShaderObjectARB (GL_VERTEX_SHADER_ARB); - endtest1 (vert); - frag = glCreateShaderObjectARB (GL_FRAGMENT_SHADER_ARB); - endtest1 (frag); - prog = glCreateProgramObjectARB (); - endtest1 (prog); - endtest1 (vert != frag && frag != prog && prog != vert); - - /* - * Link empty program. - */ - begintest (TT_PARAM1_NONZERO, "Link empty program"); - glLinkProgramARB (prog); - endtest1 (CheckObjectStatus (prog)); - - /* - * Use empty program object. Empty program objects are valid. - */ - begintest (TT_GETERROR_NOERROR, "Use empty program object"); - glUseProgramObjectARB (prog); - endtest (); - - /* - * Attach invalid object handles. Program object 0 should not be accepted. - */ - begintest (TT_GETERROR_INVALIDVALUE, "Attach invalid object handle"); - glAttachObjectARB (0, find_invalid_handle ()); - endtest (); - glAttachObjectARB (0, frag); - endtest (); - glAttachObjectARB (find_invalid_handle (), find_invalid_handle ()); - endtest (); - glAttachObjectARB (find_invalid_handle (), frag); - endtest (); - glAttachObjectARB (prog, find_invalid_handle ()); - endtest (); - - /* - * Attach valid object handles with wrong semantics. - */ - begintest (TT_GETERROR_INVALIDOPERATION, "Attach object badly"); - glAttachObjectARB (vert, frag); - endtest (); - glAttachObjectARB (vert, prog); - endtest (); - glAttachObjectARB (prog, prog); - endtest (); - - /* - * Detach non-attached object. - */ - begintest (TT_GETERROR_INVALIDOPERATION, "Detach non-attached object"); - glDetachObjectARB (prog, vert); - endtest (); - glDetachObjectARB (prog, frag); - endtest (); - - /* - * Attach shader. - */ - begintest (TT_GETERROR_NOERROR, "Attach shader to program object"); - glAttachObjectARB (prog, vert); - endtest (); - glAttachObjectARB (prog, frag); - endtest (); - - /* - * Attach object twice. - */ - begintest (TT_GETERROR_INVALIDOPERATION, "Attach object twice"); - glAttachObjectARB (prog, vert); - endtest (); - glAttachObjectARB (prog, frag); - endtest (); - - /* - * Detach attached object. - */ - begintest (TT_GETERROR_NOERROR, "Detach attached object"); - glDetachObjectARB (prog, vert); - endtest (); - glDetachObjectARB (prog, frag); - endtest (); - - /* - * Attach shader again. - */ - begintest (TT_GETERROR_NOERROR, "Attach shader again"); - glAttachObjectARB (prog, vert); - endtest (); - glAttachObjectARB (prog, frag); - endtest (); - - /* - * Delete attached object. - */ - begintest (TT_GETERROR_NOERROR, "Delete attached object"); - glDeleteObjectARB (vert); - endtest (); - glDeleteObjectARB (frag); - endtest (); - - /* - * Query delete status. It should return TRUE. Object handles are still valid - * as they are referenced by program object container. - */ - begintest (TT_PARAM1_NONZERO, "Query delete status"); - glGetObjectParameterivARB (vert, GL_OBJECT_DELETE_STATUS_ARB, params); - endtest1 (params[0]); - glGetObjectParameterivARB (frag, GL_OBJECT_DELETE_STATUS_ARB, params); - endtest1 (params[0]); - - /* - * Delete already deleted attached object. The behaviour is undefined, but we - * check for no errors. The object still exists, so the handle value is okay. - * In other words, these calls should be silently ignored by GL. - */ - begintest (TT_GETERROR_NOERROR, "Delete already deleted attached object"); - glDeleteObjectARB (vert); - endtest (); - glDeleteObjectARB (frag); - endtest (); - - /* - * Compile shader source with syntax error. - */ - begintest (TT_PARAM1_ZERO, "Compile shader source with syntax error"); - glShaderSourceARB (vert, 1, &invsynvertsrc, NULL); - glCompileShaderARB (vert); - endtest1 (CheckObjectStatus (vert)); - glShaderSourceARB (frag, 1, &invsynfragsrc, NULL); - glCompileShaderARB (frag); - endtest1 (CheckObjectStatus (frag)); - - /* - * Compile shader source with semantic error. - */ - begintest (TT_PARAM1_ZERO, "Compile shader source with semantic error"); - glShaderSourceARB (vert, 1, &invsemvertsrc, NULL); - glCompileShaderARB (vert); - endtest1 (CheckObjectStatus (vert)); - glShaderSourceARB (frag, 1, &invsemfragsrc, NULL); - glCompileShaderARB (frag); - endtest1 (CheckObjectStatus (frag)); - - /* - * Link ill-formed vertex-fragment program. - */ - begintest (TT_PARAM1_ZERO, "Link ill-formed vertex-fragment program"); - glLinkProgramARB (prog); - endtest1 (CheckObjectStatus (prog)); - - /* - * Use badly linked program object. - */ - begintest (TT_GETERROR_INVALIDOPERATION, "Use badly linked program object"); - glUseProgramObjectARB (prog); - endtest (); - - /* - * Compile well-formed shader source. Check if multi-string sources can be handled. - */ - begintest (TT_PARAM1_NONZERO, "Compile well-formed shader source"); - tab[0] = uniforms; - tab[1] = validvertsrc; - glShaderSourceARB (vert, 2, tab, NULL); - glCompileShaderARB (vert); - endtest1 (CheckObjectStatus (vert)); - tab[0] = uniforms; - tab[1] = validfragsrc; - glShaderSourceARB (frag, 2, tab, NULL); - glCompileShaderARB (frag); - endtest1 (CheckObjectStatus (frag)); - - /* - * Link vertex-fragment program. - */ - begintest (TT_PARAM1_NONZERO, "Link vertex-fragment program"); - glLinkProgramARB (prog); - endtest1 (CheckObjectStatus (prog)); - - /* - * Use valid linked program object. - */ - begintest (TT_GETERROR_NOERROR, "Use linked program object"); - glUseProgramObjectARB (prog); - endtest (); - - /* - * Get current program. - */ - begintest (TT_PARAM1_NONZERO, "Get current program"); - endtest1 (glGetHandleARB (GL_PROGRAM_OBJECT_ARB) == prog); - - /* - * Use 0 program object. - */ - begintest (TT_GETERROR_NOERROR, "Use 0 program object"); - glUseProgramObjectARB (0); - endtest (); - - /* - * Query uniform location. Uniforms with gl_ prefix cannot be queried. - */ - begintest (TT_PARAM1_NONZERO, "Query uniform location"); - endtest1 (glGetUniformLocationARB (prog, "gl_ModelViewMatrix") == -1); - endtest1 (glGetUniformLocationARB (prog, "UniformThatDoesNotExist") == -1); - endtest1 (glGetUniformLocationARB (prog, "") == -1); - endtest1 (glGetUniformLocationARB (prog, "CommonUniform") != -1); - endtest1 (glGetUniformLocationARB (prog, "VertexUniform") != -1); - endtest1 (glGetUniformLocationARB (prog, "FragmentUniform") != -1); - - /* - * Query attrib location. Attribs with gl_ prefix cannot be queried. - * When gl_Vertex is used, none of the generic attribs can have index 0. - */ - begintest (TT_PARAM1_NONZERO, "Query attrib location"); - endtest1 (glGetAttribLocationARB (prog, "gl_Vertex") == -1); - endtest1 (glGetAttribLocationARB (prog, "AttribThatDoesNotExist") == -1); - endtest1 (glGetAttribLocationARB (prog, "") == -1); - endtest1 (glGetAttribLocationARB (prog, "FirstAttrib") > 0); - endtest1 (glGetAttribLocationARB (prog, "SecondAttrib") > 0); - - /* - * Bind attrib locations, link and check if locations are correct. - */ - begintest (TT_PARAM1_NONZERO, "Bind attrib location #1"); - glBindAttribLocationARB (prog, 1, "FirstAttrib"); - glBindAttribLocationARB (prog, 2, "SecondAttrib"); - glLinkProgramARB (prog); - endtest1 (CheckObjectStatus (prog)); - endtest1 (glGetAttribLocationARB (prog, "FirstAttrib") == 1); - endtest1 (glGetAttribLocationARB (prog, "SecondAttrib") == 2); - - /* - * Bind attrib locations in different order. Link and check if locations are correct. - */ - begintest (TT_PARAM1_NONZERO, "Bind attrib location #2"); - glBindAttribLocationARB (prog, 1, "SecondAttrib"); - glBindAttribLocationARB (prog, 2, "FirstAttrib"); - glLinkProgramARB (prog); - endtest1 (CheckObjectStatus (prog)); - endtest1 (glGetAttribLocationARB (prog, "SecondAttrib") == 1); - endtest1 (glGetAttribLocationARB (prog, "FirstAttrib") == 2); - - /* - * Detach deleted object. - */ - begintest (TT_GETERROR_NOERROR, "Detach deleted object"); - glDetachObjectARB (prog, vert); - endtest (); - glDetachObjectARB (prog, frag); - endtest (); - - /* - * Delete deleted detached object. - */ - begintest (TT_GETERROR_INVALIDVALUE, "Delete deleted detached object"); - glDeleteObjectARB (vert); - endtest (); - glDeleteObjectARB (frag); - endtest (); - - exit (0); -} - -void RenderScene (void) -{ - /* never reached */ - assert (0); -} - -int main (int argc, char *argv[]) -{ - InitFramework (&argc, argv); - return 0; -} - diff --git a/progs/slang/vstest.c b/progs/slang/vstest.c deleted file mode 100644 index 5108d15742..0000000000 --- a/progs/slang/vstest.c +++ /dev/null @@ -1,340 +0,0 @@ -/* - * GL_ARB_vertex_shader test application. Feeds a vertex shader with attributes that - * that have magic values and check if the values received by the shader are the same. - * - * Requires specific support on the GL implementation side. A special function printMESA() - * must be supported in the language that prints variable's current value of generic type - * to the appropriate shader's info log, and optionally to the screen. - * - * Perfectly valid behaviour produces output that does not have a line - * beginning with three stars (***). - * - * Author: Michal Krol - */ - -#include "framework.h" - -#define EPSILON 0.0001f - -static GLhandleARB vert = 0; -static GLhandleARB prog = 0; - -enum SUBMIT_MODE -{ - SM_IM, - SM_VA, - SM_IM_DL, - SM_VA_DL, - SM_MAX -}; - -static enum SUBMIT_MODE submit_method = SM_IM; - -#define C 0 -#define S 1 -#define N 2 -#define V 3 -#define T 4 -#define F 5 -#define A 6 - -struct ATTRIB_DATA -{ - const char *name; - GLuint dispatch; - GLint index; - GLint bind; - GLuint size; - GLfloat data[4]; -}; - -static struct ATTRIB_DATA attribs[] = { - { "gl_Color", C, -1, -1, 4, { 4.2f, 0.56f, -2.1f, 0.29f } }, - { "gl_SecondaryColor", S, -1, -1, 4, { 0.38f, 2.0f, 0.99f, 1.0f } }, - { "gl_Normal", N, -1, -1, 3, { 54.0f, 77.0f, 1.15f, 0.0f } }, - { "gl_MultiTexCoord0", T, 0, -1, 4, { 11.1f, 11.2f, 11.3f, 11.4f } }, - { "gl_MultiTexCoord1", T, 1, -1, 4, { 22.1f, 22.2f, 22.3f, 22.4f } }, - { "gl_MultiTexCoord2", T, 2, -1, 4, { 33.1f, 33.2f, 33.3f, 33.4f } }, - { "gl_MultiTexCoord3", T, 3, -1, 4, { 44.1f, 44.2f, 44.3f, 44.4f } }, - { "gl_MultiTexCoord4", T, 4, -1, 4, { 55.1f, 55.2f, 55.3f, 55.4f } }, - { "gl_MultiTexCoord5", T, 5, -1, 4, { 66.1f, 66.2f, 66.3f, 66.4f } }, - { "gl_MultiTexCoord6", T, 6, -1, 4, { 77.1f, 77.2f, 77.3f, 77.4f } }, - { "gl_MultiTexCoord7", T, 7, -1, 4, { 88.1f, 88.2f, 88.3f, 88.4f } }, - { "gl_FogCoord", F, -1, -1, 1, { 0.63f, 0.0f, 0.0f, 0.0f } }, - { "Attribute1", A, 1, 1, 4, { 1.11f, 1.22f, 1.33f, 1.44f } }, - { "Attribute2", A, 2, 2, 4, { 2.11f, 2.22f, 2.33f, 2.44f } }, - { "Attribute3", A, 3, 3, 4, { 3.11f, 3.22f, 3.33f, 3.44f } }, - { "Attribute4", A, 4, 4, 1, { 4.11f, 0.0f, 0.0f, 0.0f } }, - { "Attribute5", A, 5, 5, 2, { 5.11f, 5.22f, 0.0f, 0.0f } }, - { "Attribute6", A, 6, 6, 3, { 6.11f, 6.22f, 6.33f, 0.0f } }, - { "Attribute7", A, 7, 7, 2, { 7.11f, 7.22f, 0.0f, 0.0f } }, - { "Attribute7", A, 8, -1, 2, { 8.11f, 8.22f, 0.0f, 0.0f } }, - { "Attribute9", A, 9, 9, 3, { 9.11f, 9.22f, 9.33f, 0.0f } }, - { "Attribute9", A, 10, -1, 3, { 10.11f, 10.22f, 10.33f, 0.0f } }, - { "Attribute9", A, 11, -1, 3, { 11.11f, 11.22f, 11.33f, 0.0f } }, - { "Attribute12", A, 12, 12, 4, { 12.11f, 12.22f, 12.33f, 12.44f } }, - { "Attribute12", A, 13, -1, 4, { 13.11f, 13.22f, 13.33f, 13.44f } }, - { "Attribute12", A, 14, -1, 4, { 14.11f, 14.22f, 14.33f, 14.44f } }, - { "Attribute12", A, 15, -1, 4, { 15.11f, 15.22f, 15.33f, 15.44f } }, - { "gl_Vertex", V, 16, -1, 4, { 0.25f, -0.14f, 0.01f, 1.0f } } -}; - -static void im_render () -{ - GLint i; - - glBegin (GL_POINTS); - for (i = 0; i < sizeof (attribs) / sizeof (*attribs); i++) { - struct ATTRIB_DATA *att = &attribs[i]; - switch (att->dispatch) - { - case C: - glColor4fv (att->data); - break; - case S: - glSecondaryColor3fvEXT (att->data); - break; - case N: - glNormal3fv (att->data); - break; - case V: - glVertex4fv (att->data); - break; - case T: - assert (att->index >= 0 && att->index < 8); - glMultiTexCoord4fvARB (GL_TEXTURE0_ARB + att->index, att->data); - break; - case F: - glFogCoordfvEXT (att->data); - break; - case A: - assert (att->index > 0 && att->index < 16); - glVertexAttrib4fvARB (att->index, att->data); - break; - default: - assert (0); - } - } - glEnd (); -} - -static void va_render () -{ - GLint i; - - for (i = 0; i < sizeof (attribs) / sizeof (*attribs); i++) { - struct ATTRIB_DATA *att = &attribs[i]; - switch (att->dispatch) - { - case C: - glColorPointer (4, GL_FLOAT, 0, att->data); - glEnable (GL_COLOR_ARRAY); - break; - case S: - glSecondaryColorPointerEXT (4, GL_FLOAT, 0, att->data); - glEnable (GL_SECONDARY_COLOR_ARRAY_EXT); - break; - case N: - glNormalPointer (GL_FLOAT, 0, att->data); - glEnable (GL_NORMAL_ARRAY); - break; - case V: - glVertexPointer (4, GL_FLOAT, 0, att->data); - glEnable (GL_VERTEX_ARRAY); - break; - case T: - assert (att->index >= 0 && att->index < 8); - glClientActiveTextureARB (GL_TEXTURE0_ARB + att->index); - glTexCoordPointer (4, GL_FLOAT, 0, att->data); - glEnable (GL_TEXTURE_COORD_ARRAY); - break; - case F: - glFogCoordPointerEXT (GL_FLOAT, 0, att->data); - glEnable (GL_FOG_COORDINATE_ARRAY_EXT); - break; - case A: - assert (att->index > 0 && att->index < 16); - glVertexAttribPointerARB (att->index, 4, GL_FLOAT, GL_FALSE, 0, att->data); - glEnableVertexAttribArrayARB (att->index); - break; - default: - assert (0); - } - } - - glDrawArrays (GL_POINTS, 0, 1); - - for (i = 0; i < sizeof (attribs) / sizeof (*attribs); i++) { - struct ATTRIB_DATA *att = &attribs[i]; - switch (att->dispatch) - { - case C: - glDisable (GL_COLOR_ARRAY); - break; - case S: - glDisable (GL_SECONDARY_COLOR_ARRAY_EXT); - break; - case N: - glDisable (GL_NORMAL_ARRAY); - break; - case V: - glDisable (GL_VERTEX_ARRAY); - break; - case T: - glClientActiveTextureARB (GL_TEXTURE0_ARB + att->index); - glDisable (GL_TEXTURE_COORD_ARRAY); - break; - case F: - glDisable (GL_FOG_COORDINATE_ARRAY_EXT); - break; - case A: - glDisableVertexAttribArrayARB (att->index); - break; - default: - assert (0); - } - } -} - -static void dl_start () -{ - glNewList (GL_COMPILE, 1); -} - -static void dl_end () -{ - glEndList (); - glCallList (1); -} - -static void load_test_file (const char *filename) -{ - FILE *f; - GLint size; - char *code; - GLint i; - - f = fopen (filename, "r"); - if (f == NULL) - return; - - fseek (f, 0, SEEK_END); - size = ftell (f); - fseek (f, 0, SEEK_SET); - - code = (char *) (malloc (size)); - if (code == NULL) { - fclose (f); - return; - } - size = fread (code, 1, size, f); - fclose (f); - - glShaderSourceARB (vert, 1, (const GLcharARB **) (&code), &size); - glCompileShaderARB (vert); - if (!CheckObjectStatus (vert)) - exit (0); - - for (i = 0; i < sizeof (attribs) / sizeof (*attribs); i++) - if (attribs[i].dispatch == A && attribs[i].bind != -1) - glBindAttribLocationARB (prog, attribs[i].bind, attribs[i].name); -} - -void InitScene (void) -{ - prog = glCreateProgramObjectARB (); - vert = glCreateShaderObjectARB (GL_VERTEX_SHADER_ARB); - glAttachObjectARB (prog, vert); - glDeleteObjectARB (vert); - load_test_file ("vstest.txt"); - glLinkProgramARB (prog); - if (!CheckObjectStatus (prog)) - exit (0); - glUseProgramObjectARB (prog); -} - -void RenderScene (void) -{ - GLint info_length, length; - char output[65000], *p; - GLint i; - - if (submit_method == SM_MAX) - exit (0); - - /* - * Get the current size of the info log. Any text output produced by executed - * shader will be appended to the end of log. - */ - glGetObjectParameterivARB (vert, GL_OBJECT_INFO_LOG_LENGTH_ARB, &info_length); - - switch (submit_method) - { - case SM_IM: - printf ("\n--- TESTING IMMEDIATE MODE\n"); - im_render (); - break; - case SM_VA: - printf ("\n--- TESTING VERTEX ARRAY MODE\n"); - va_render (); - break; - case SM_IM_DL: - printf ("\n--- TESTING IMMEDIATE + DISPLAY LIST MODE\n"); - dl_start (); - im_render (); - dl_end (); - break; - case SM_VA_DL: - printf ("\n--- TESTING VERTEX ARRAY + DISPLAY LIST MODE\n"); - dl_start (); - va_render (); - dl_end (); - break; - default: - assert (0); - } - - glFlush (); - - /* - * Get the info log and set the pointer to the beginning of the output. - */ - glGetInfoLogARB (vert, sizeof (output), &length, output); - p = output + info_length - 1; - - for (i = 0; i < sizeof (attribs) / sizeof (*attribs); i++) { - GLuint j; - for (j = 0; j < attribs[i].size; j++) { - GLfloat value; - if (p == NULL) { - printf ("*** %s\n", "I/O error"); - break; - } - if (strncmp (p, "true", 4) == 0) - value = 1.0f; - else if (strncmp (p, "false", 5) == 0) - value = 0.0f; - else if (sscanf (p, "%f", &value) != 1) { - printf ("*** %s\n", "I/O error"); - p = NULL; - break; - } - if (fabs (value - attribs[i].data[j]) > EPSILON) - printf ("*** %s, is %f, should be %f\n", "Values are different", value, attribs[i].data[j]); - p = strchr (p, '\n'); - if (p != NULL) - p++; - } - if (p == NULL) - break; - } - - submit_method++; -} - -int main (int argc, char *argv[]) -{ - InitFramework (&argc, argv); - return 0; -} - diff --git a/progs/slang/vstest.txt b/progs/slang/vstest.txt deleted file mode 100644 index 7f51d0bc81..0000000000 --- a/progs/slang/vstest.txt +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Vertex shader test. - * Uses all conventional attributes and 15 generic attributes to print - * their values, using printMESA() extension function, to the debugger - * to compare them with the actual passed-in values. - * Use different types for generic attributes to check matrix handling. - * - * Author: Michal Krol - */ - -#version 110 - -#extension MESA_shader_debug: require - -attribute vec4 Attribute1; -attribute vec4 Attribute2; -attribute vec4 Attribute3; -attribute float Attribute4; -attribute vec2 Attribute5; -attribute vec3 Attribute6; -attribute mat2 Attribute7; -attribute mat3 Attribute9; -attribute mat4 Attribute12; - -void main () -{ - // - // Do some legal stuff. - // - gl_Position = gl_ModelViewMatrix * gl_Vertex; - gl_FrontColor = vec4 (1.0); - - // - // Conventional attributes - except for gl_Vertex. - // - printMESA (gl_Color); - printMESA (gl_SecondaryColor); - printMESA (gl_Normal); - printMESA (gl_MultiTexCoord0); - printMESA (gl_MultiTexCoord1); - printMESA (gl_MultiTexCoord2); - printMESA (gl_MultiTexCoord3); - printMESA (gl_MultiTexCoord4); - printMESA (gl_MultiTexCoord5); - printMESA (gl_MultiTexCoord6); - printMESA (gl_MultiTexCoord7); - printMESA (gl_FogCoord); - - // - // Generic attributes - attrib with index 0 is not used because it would - // alias with gl_Vertex, which is not allowed. - // - printMESA (Attribute1); - printMESA (Attribute2); - printMESA (Attribute3); - printMESA (Attribute4); - printMESA (Attribute5); - printMESA (Attribute6); - printMESA (Attribute7); - printMESA (Attribute9); - printMESA (Attribute12); - - // - // Vertex position goes last. - // - printMESA (gl_Vertex); -} - diff --git a/progs/slang/windows/vc60/cltest.dsp b/progs/slang/windows/vc60/cltest.dsp deleted file mode 100644 index 4c0c2e26b4..0000000000 --- a/progs/slang/windows/vc60/cltest.dsp +++ /dev/null @@ -1,94 +0,0 @@ -# Microsoft Developer Studio Project File - Name="cltest" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Console Application" 0x0103 - -CFG=cltest - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "cltest.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "cltest.mak" CFG="cltest - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "cltest - Win32 Release" (based on "Win32 (x86) Console Application") -!MESSAGE "cltest - Win32 Debug" (based on "Win32 (x86) Console Application") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "cltest - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "cltest_release" -# PROP Intermediate_Dir "cltest_release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD BASE RSC /l 0x415 /d "NDEBUG" -# ADD RSC /l 0x415 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 - -!ELSEIF "$(CFG)" == "cltest - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "cltest_debug" -# PROP Intermediate_Dir "cltest_debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c -# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c -# ADD BASE RSC /l 0x415 /d "_DEBUG" -# ADD RSC /l 0x415 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept - -!ENDIF - -# Begin Target - -# Name "cltest - Win32 Release" -# Name "cltest - Win32 Debug" -# Begin Source File - -SOURCE=..\..\cltest.c -# End Source File -# Begin Source File - -SOURCE=..\..\cltest.txt -# End Source File -# End Target -# End Project diff --git a/progs/slang/windows/vc60/framework.dsp b/progs/slang/windows/vc60/framework.dsp deleted file mode 100644 index 76ed7d388c..0000000000 --- a/progs/slang/windows/vc60/framework.dsp +++ /dev/null @@ -1,92 +0,0 @@ -# Microsoft Developer Studio Project File - Name="framework" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Static Library" 0x0104 - -CFG=framework - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "framework.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "framework.mak" CFG="framework - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "framework - Win32 Release" (based on "Win32 (x86) Static Library") -!MESSAGE "framework - Win32 Debug" (based on "Win32 (x86) Static Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "framework - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "framework_release" -# PROP Intermediate_Dir "framework_release" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c -# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c -# ADD BASE RSC /l 0x415 /d "NDEBUG" -# ADD RSC /l 0x415 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LIB32=link.exe -lib -# ADD BASE LIB32 /nologo -# ADD LIB32 /nologo - -!ELSEIF "$(CFG)" == "framework - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "framework_debug" -# PROP Intermediate_Dir "framework_debug" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c -# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c -# ADD BASE RSC /l 0x415 /d "_DEBUG" -# ADD RSC /l 0x415 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LIB32=link.exe -lib -# ADD BASE LIB32 /nologo -# ADD LIB32 /nologo - -!ENDIF - -# Begin Target - -# Name "framework - Win32 Release" -# Name "framework - Win32 Debug" -# Begin Source File - -SOURCE=..\..\framework.c -# End Source File -# Begin Source File - -SOURCE=..\..\framework.h -# End Source File -# End Target -# End Project diff --git a/progs/slang/windows/vc60/slang.dsw b/progs/slang/windows/vc60/slang.dsw deleted file mode 100644 index 60536c1b0d..0000000000 --- a/progs/slang/windows/vc60/slang.dsw +++ /dev/null @@ -1,74 +0,0 @@ -Microsoft Developer Studio Workspace File, Format Version 6.00 -# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! - -############################################################################### - -Project: "cltest"=".\cltest.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ - Begin Project Dependency - Project_Dep_Name framework - End Project Dependency -}}} - -############################################################################### - -Project: "framework"=".\framework.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Project: "sotest"=".\sotest.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ - Begin Project Dependency - Project_Dep_Name framework - End Project Dependency -}}} - -############################################################################### - -Project: "vstest"=".\vstest.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ - Begin Project Dependency - Project_Dep_Name framework - End Project Dependency -}}} - -############################################################################### - -Global: - -Package=<5> -{{{ -}}} - -Package=<3> -{{{ -}}} - -############################################################################### - diff --git a/progs/slang/windows/vc60/sotest.dsp b/progs/slang/windows/vc60/sotest.dsp deleted file mode 100644 index 105924943b..0000000000 --- a/progs/slang/windows/vc60/sotest.dsp +++ /dev/null @@ -1,90 +0,0 @@ -# Microsoft Developer Studio Project File - Name="sotest" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Console Application" 0x0103 - -CFG=sotest - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "sotest.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "sotest.mak" CFG="sotest - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "sotest - Win32 Release" (based on "Win32 (x86) Console Application") -!MESSAGE "sotest - Win32 Debug" (based on "Win32 (x86) Console Application") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "sotest - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "sotest_release" -# PROP Intermediate_Dir "sotest_release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD BASE RSC /l 0x415 /d "NDEBUG" -# ADD RSC /l 0x415 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 - -!ELSEIF "$(CFG)" == "sotest - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "sotest_debug" -# PROP Intermediate_Dir "sotest_debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c -# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c -# ADD BASE RSC /l 0x415 /d "_DEBUG" -# ADD RSC /l 0x415 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept - -!ENDIF - -# Begin Target - -# Name "sotest - Win32 Release" -# Name "sotest - Win32 Debug" -# Begin Source File - -SOURCE=..\..\sotest.c -# End Source File -# End Target -# End Project diff --git a/progs/slang/windows/vc60/vstest.dsp b/progs/slang/windows/vc60/vstest.dsp deleted file mode 100644 index a3a2c707f0..0000000000 --- a/progs/slang/windows/vc60/vstest.dsp +++ /dev/null @@ -1,93 +0,0 @@ -# Microsoft Developer Studio Project File - Name="vstest" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Console Application" 0x0103 - -CFG=vstest - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "vstest.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "vstest.mak" CFG="vstest - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "vstest - Win32 Release" (based on "Win32 (x86) Console Application") -!MESSAGE "vstest - Win32 Debug" (based on "Win32 (x86) Console Application") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "vstest - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "vstest_release" -# PROP Intermediate_Dir "vstest_release" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD BASE RSC /l 0x415 /d "NDEBUG" -# ADD RSC /l 0x415 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 - -!ELSEIF "$(CFG)" == "vstest - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "vstest_debug" -# PROP Intermediate_Dir "vstest_debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c -# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c -# ADD BASE RSC /l 0x415 /d "_DEBUG" -# ADD RSC /l 0x415 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept - -!ENDIF - -# Begin Target - -# Name "vstest - Win32 Release" -# Name "vstest - Win32 Debug" -# Begin Source File - -SOURCE=..\..\vstest.c -# End Source File -# Begin Source File - -SOURCE=..\..\vstest.txt -# End Source File -# End Target -# End Project diff --git a/progs/tests/.gitignore b/progs/tests/.gitignore deleted file mode 100644 index 6505c315a6..0000000000 --- a/progs/tests/.gitignore +++ /dev/null @@ -1,81 +0,0 @@ -.cvsignore -afsmultiarb -antialias -arbfpspec -arbfptest1 -arbfptexture -arbfptrig -arbnpot -arbnpot-mipmap -arbvptest1 -arbvptest3 -arbvptorus -arbvpwarpmesh -arraytexture -blendminmax -blendsquare -bufferobj -bug_3050 -bug_3101 -bug_3195 -copypixrate -crossbar -cva -dinoshade -drawbuffers -extfuncs.h -exactrast -fbotest1 -fbotest2 -fbotexture -floattex -fog -fogcoord -fptest1 -fptexture -getprocaddress -getproclist.h -interleave -invert -jkrahntest -lineclip -manytex -mipmap_limits -multipal -no_s3tc -packedpixels -pbo -prog_parameter -projtex -random -readrate -readtex.c -readtex.h -seccolor -sharedtex -shader_api -stencil_twoside -stencil_wrap -stencilwrap -subtexrate -tex1d -texcmp -texcompress2 -texfilt -texgenmix -texline -texobjshare -texrect -texwrap -unfilledclip -vao-01 -vao-02 -vparray -vptest1 -vptest2 -vptest3 -vptorus -vpwarpmesh -yuvrect -yuvsquare -zreaddraw diff --git a/progs/tests/Makefile b/progs/tests/Makefile deleted file mode 100644 index 5f17f88d36..0000000000 --- a/progs/tests/Makefile +++ /dev/null @@ -1,201 +0,0 @@ -# progs/tests/Makefile - - -# These programs aren't intended to be included with the normal distro. -# They're not too interesting but they're good for testing. - -TOP = ../.. -include $(TOP)/configs/current - - -LIBS = -L$(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) $(APP_LIB_DEPS) - -SOURCES = \ - afsmultiarb.c \ - antialias.c \ - arbfpspec.c \ - arbfptest1.c \ - arbfptexture.c \ - arbfptrig.c \ - arbnpot.c \ - arbnpot-mipmap.c \ - arbvptest1.c \ - arbvptest3.c \ - arbvptorus.c \ - arbvpwarpmesh.c \ - arraytexture.c \ - blendminmax.c \ - blendsquare.c \ - blendxor.c \ - bufferobj.c \ - bug_3050.c \ - bug_3101.c \ - bug_3195.c \ - copypixrate.c \ - crossbar.c \ - cva.c \ - dinoshade.c \ - drawbuffers.c \ - exactrast.c \ - floattex.c \ - fbotest1.c \ - fbotest2.c \ - fbotexture.c \ - fog.c \ - fogcoord.c \ - fptest1.c \ - fptexture.c \ - getprocaddress.c \ - interleave.c \ - invert.c \ - jkrahntest.c \ - lineclip.c \ - manytex.c \ - minmag.c \ - mipmap_limits.c \ - multipal.c \ - no_s3tc.c \ - packedpixels.c \ - pbo.c \ - prog_parameter.c \ - projtex.c \ - random.c \ - readrate.c \ - rubberband.c \ - seccolor.c \ - shader_api.c \ - sharedtex.c \ - stencil_twoside.c \ - stencilwrap.c \ - stencil_wrap.c \ - subtexrate.c \ - tex1d.c \ - texcompress2.c \ - texfilt.c \ - texline.c \ - texobjshare.c \ - texrect.c \ - texwrap.c \ - unfilledclip.c \ - vao-01.c \ - vao-02.c \ - vparray.c \ - vptest1.c \ - vptest2.c \ - vptest3.c \ - vptorus.c \ - vpwarpmesh.c \ - yuvrect.c \ - yuvsquare.c \ - zreaddraw.c - -PROGS = $(SOURCES:%.c=%) - -INCLUDES = -I. -I$(TOP)/include - -UTIL_FILES = readtex.h readtex.c - - -##### TARGETS ##### - -default: $(UTIL_FILES) $(PROGS) - -clean: - -rm -f $(PROGS) - -rm -f *.o - -rm -f getproclist.h - -##### RULES ##### - -.SUFFIXES: -.SUFFIXES: .c - -.c: - $(CC) $(INCLUDES) $(CFLAGS) $(LDFLAGS) $< $(LIBS) -o $@ - -.c.o: - $(CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) $< -o $@ - -.S.o: - $(CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) $< -o $@ - -# auto code generation -getprocaddress: getprocaddress.c getproclist.h - -getproclist.h: $(TOP)/src/mesa/glapi/gl_API.xml getprocaddress.c getprocaddress.py - python getprocaddress.py > getproclist.h - -arraytexture: arraytexture.o readtex.o - $(CC) $(CFLAGS) arraytexture.o readtex.o $(LIBS) -o $@ - -arraytexture.o: arraytexture.c readtex.h - $(CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) arraytexture.c -o $@ - -afsmultiarb: afsmultiarb.o readtex.o - $(CC) $(CFLAGS) $(LDFLAGS) afsmultiarb.o readtex.o $(LIBS) -o $@ - -afsmultiarb.o: afsmultiarb.c readtex.h - $(CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) afsmultiarb.c -o $@ - -drawbuffers: drawbuffers.o - $(CC) $(CFLAGS) $(LDFLAGS) drawbuffers.o $(LIBS) -o $@ - -drawbuffers.o: drawbuffers.c extfuncs.h - $(CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) drawbuffers.c -o $@ - -texrect: texrect.o readtex.o - $(CC) $(CFLAGS) $(LDFLAGS) texrect.o readtex.o $(LIBS) -o $@ - -texrect.o: texrect.c readtex.h - $(CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) texrect.c -o $@ - -bug_3195: bug_3195.o readtex.o - $(CC) $(CFLAGS) $(LDFLAGS) bug_3195.o readtex.o $(LIBS) -o $@ - -bug_3195.o: bug_3195.c readtex.h - $(CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) bug_3195.c -o $@ - -invert: invert.o readtex.o - $(CC) $(CFLAGS) $(LDFLAGS) invert.o readtex.o $(LIBS) -o $@ - -invert.o: invert.c readtex.h - $(CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) invert.c -o $@ - - -floattex: floattex.o readtex.o shaderutil.o - $(CC) $(CFLAGS) $(LDFLAGS) floattex.o readtex.o shaderutil.o $(LIBS) -o $@ - -floattex.o: floattex.c readtex.h shaderutil.h - $(CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) floattex.c -o $@ - - -readtex.o: readtex.c - $(CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) readtex.c -o $@ - -readtex.h: $(TOP)/progs/util/readtex.h - ln -s $(TOP)/progs/util/readtex.h . - -readtex.c: $(TOP)/progs/util/readtex.c - ln -s $(TOP)/progs/util/readtex.c . - - - -extfuncs.h: $(TOP)/progs/util/extfuncs.h - ln -s $(TOP)/progs/util/extfuncs.h . - - - -shaderutil.c: $(TOP)/progs/util/shaderutil.c - cp $< . - -shaderutil.h: $(TOP)/progs/util/shaderutil.h - cp $< . - -shaderutil.o: shaderutil.c shaderutil.h - $(CC) -c -I$(INCDIR) $(CFLAGS) shaderutil.c - - - -# Emacs tags -tags: - etags `find . -name \*.[ch]` `find ../include` diff --git a/progs/tests/Makefile.win b/progs/tests/Makefile.win deleted file mode 100644 index d42e3cb654..0000000000 --- a/progs/tests/Makefile.win +++ /dev/null @@ -1,43 +0,0 @@ - -# Mesa 3-D graphics library -# Version: 3.5 -# Copyright (C) 1995-2001 Brian Paul - -# Makefile for GLUT-based demo programs for Windows - -!include - -##### MACROS ##### - -TOP = .. -INCDIR = ..\include -LIBDIR = ..\lib - -SRCS = cva.c \ - dinoshade.c \ - fogcoord.c \ - manytex.c \ - multipal.c \ - projtex.c \ - seccolor.c \ -# sharedtex.c \ - texline.c \ - texwrap.c \ - vptest1.c \ - vptest2.c \ - vptest3.c \ - vptorus.c \ - vpwarpmesh.c - -!include "../mesawin32.mak" - -##### TARGETS ##### - -clean:: - -clobber:: - @del readtex.c readtex.h - -$(EXES) :$*.obj - @echo $@ - $(link) -out:$@ $* /LIBPATH:$(LIBDIR) $(LIBS) diff --git a/progs/tests/afsmultiarb.c b/progs/tests/afsmultiarb.c deleted file mode 100644 index c026ecd4ce..0000000000 --- a/progs/tests/afsmultiarb.c +++ /dev/null @@ -1,469 +0,0 @@ -/* - * GL_ATI_fragment_shader test - * Roland Scheidegger - * - * Command line options: - * -info print GL implementation information - */ - - -#include -#include -#include -#include -#define GL_GLEXT_PROTOTYPES -#include - -#include "readtex.h" - -#define TEXTURE_1_FILE "../images/girl.rgb" -#define TEXTURE_2_FILE "../images/reflect.rgb" - -#define TEX0 1 -#define TEX7 8 -#define ANIMATE 10 -#define SHADER 20 -#define QUIT 100 - -static GLboolean Animate = GL_TRUE; -static GLint NumUnits = 6; -static GLboolean TexEnabled[8]; -static GLuint boringshaderID = 0; -static GLuint boring2passID = 0; -static GLboolean Shader = GL_FALSE; - -static GLfloat Drift = 0.0; -static GLfloat drift_increment = 0.005; -static GLfloat Xrot = 20.0, Yrot = 30.0, Zrot = 0.0; -static GLfloat shaderconstant[4] = {0.5, 0.0, 0.0, 0.0}; - -static void Idle( void ) -{ - if (Animate) { - GLint i; - - Drift += drift_increment; - if (Drift >= 1.0) - Drift = 0.0; - - for (i = 0; i < NumUnits; i++) { - glActiveTextureARB(GL_TEXTURE0_ARB + i); - glMatrixMode(GL_TEXTURE); - glLoadIdentity(); - if (i == 0) { - glTranslatef(Drift, 0.0, 0.0); - glScalef(2, 2, 1); - } - else if (i == 1) { - glTranslatef(0.0, Drift, 0.0); - } - else { - glTranslatef(0.5, 0.5, 0.0); - glRotatef(180.0 * Drift, 0, 0, 1); - glScalef(1.0/i, 1.0/i, 1.0/i); - glTranslatef(-0.5, -0.5, 0.0); - } - } - glMatrixMode(GL_MODELVIEW); - - glutPostRedisplay(); - } -} - - -static void DrawObject(void) -{ - GLint i; - GLint j; - static const GLfloat tex_coords[] = { 0.0, 0.0, 1.0, 1.0, 0.0 }; - static const GLfloat vtx_coords[] = { -1.0, -1.0, 1.0, 1.0, -1.0 }; - - if (!TexEnabled[0] && !TexEnabled[1]) - glColor3f(0.1, 0.1, 0.1); /* add onto this */ - else - glColor3f(1, 1, 1); /* modulate this */ - - glBegin(GL_QUADS); - - /* Toggle between the vector and scalar entry points. This is done purely - * to hit multiple paths in the driver. - */ - if ( Drift > 0.49 ) { - for (j = 0; j < 4; j++ ) { - for (i = 0; i < NumUnits; i++) - glMultiTexCoord2fARB(GL_TEXTURE0_ARB + i, - tex_coords[j], tex_coords[j+1]); - glVertex2f( vtx_coords[j], vtx_coords[j+1] ); - } - } - else { - for (j = 0; j < 4; j++ ) { - for (i = 0; i < NumUnits; i++) - glMultiTexCoord2fvARB(GL_TEXTURE0_ARB + i, & tex_coords[j]); - glVertex2fv( & vtx_coords[j] ); - } - } - - glEnd(); -} - - - -static void Display( void ) -{ - static GLint T0 = 0; - static GLint Frames = 0; - GLint t; - - glClear( GL_COLOR_BUFFER_BIT ); - - glPushMatrix(); - glRotatef(Xrot, 1.0, 0.0, 0.0); - glRotatef(Yrot, 0.0, 1.0, 0.0); - glRotatef(Zrot, 0.0, 0.0, 1.0); - glScalef(5.0, 5.0, 5.0); - DrawObject(); - glPopMatrix(); - - glutSwapBuffers(); - - Frames++; - - t = glutGet(GLUT_ELAPSED_TIME); - if (t - T0 >= 2500) { - GLfloat seconds = (t - T0) / 1000.0; - GLfloat fps = Frames / seconds; - drift_increment = 2.2 * seconds / Frames; - printf("%d frames in %6.3f seconds = %6.3f FPS\n", Frames, seconds, fps); - T0 = t; - Frames = 0; - } -} - - -static void Reshape( int width, int height ) -{ - glViewport( 0, 0, width, height ); - glMatrixMode( GL_PROJECTION ); - glLoadIdentity(); - glFrustum( -1.0, 1.0, -1.0, 1.0, 10.0, 100.0 ); - /*glOrtho( -6.0, 6.0, -6.0, 6.0, 10.0, 100.0 );*/ - glMatrixMode( GL_MODELVIEW ); - glLoadIdentity(); - glTranslatef( 0.0, 0.0, -70.0 ); -} - - -static void ModeMenu(int entry) -{ - if (entry >= TEX0 && entry <= TEX7) { - /* toggle */ - GLint i = entry - TEX0; - TexEnabled[i] = !TexEnabled[i]; - glActiveTextureARB(GL_TEXTURE0_ARB + i); - if (TexEnabled[i]) - glEnable(GL_TEXTURE_2D); - else - glDisable(GL_TEXTURE_2D); - printf("Enabled: "); - for (i = 0; i < NumUnits; i++) - printf("%d ", (int) TexEnabled[i]); - printf("\n"); - } - else if (entry==ANIMATE) { - Animate = !Animate; - } - else if (entry==SHADER) { - Shader = !Shader; - if (Shader) { - fprintf(stderr, "using 2-pass shader\n"); - glBindFragmentShaderATI(boring2passID); - } - else { - fprintf(stderr, "using 1-pass shader\n"); - glBindFragmentShaderATI(boringshaderID); - } - } - else if (entry==QUIT) { - exit(0); - } - - glutPostRedisplay(); -} - - -static void Key( unsigned char key, int x, int y ) -{ - (void) x; - (void) y; - switch (key) { - case 27: - exit(0); - break; - } - glutPostRedisplay(); -} - - -static void SpecialKey( int key, int x, int y ) -{ - float step = 3.0; - (void) x; - (void) y; - - switch (key) { - case GLUT_KEY_UP: - Xrot += step; - break; - case GLUT_KEY_DOWN: - Xrot -= step; - break; - case GLUT_KEY_LEFT: - Yrot += step; - break; - case GLUT_KEY_RIGHT: - Yrot -= step; - break; - } - glutPostRedisplay(); -} - - -static void Init( int argc, char *argv[] ) -{ - GLuint texObj[8]; - GLint size, i; - - const char *exten = (const char *) glGetString(GL_EXTENSIONS); - if (!strstr(exten, "GL_ATI_fragment_shader")) { - printf("Sorry, GL_ATI_fragment_shader not supported by this renderer.\n"); - exit(1); - } - - - glGetIntegerv(GL_MAX_TEXTURE_SIZE, &size); - printf("%d x %d max texture size\n", size, size); - - glPixelStorei(GL_UNPACK_ALIGNMENT, 1); - - for (i = 0; i < NumUnits; i++) { - if (i < 6) - TexEnabled[i] = GL_TRUE; - else - TexEnabled[i] = GL_FALSE; - } - - /* allocate two texture objects */ - glGenTextures(NumUnits, texObj); - - /* setup the texture objects */ - for (i = 0; i < NumUnits; i++) { - - glActiveTextureARB(GL_TEXTURE0_ARB + i); - glBindTexture(GL_TEXTURE_2D, texObj[i]); - - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - - if (i == 0) { - if (!LoadRGBMipmaps(TEXTURE_1_FILE, GL_RGB)) { - printf("Error: couldn't load texture image\n"); - exit(1); - } - } - else if (i == 1) { - if (!LoadRGBMipmaps(TEXTURE_2_FILE, GL_RGB)) { - printf("Error: couldn't load texture image\n"); - exit(1); - } - } - else { - /* checker */ - GLubyte image[8][8][3]; - GLint i, j; - for (i = 0; i < 8; i++) { - for (j = 0; j < 8; j++) { - if ((i + j) & 1) { - image[i][j][0] = 50; - image[i][j][1] = 50; - image[i][j][2] = 50; - } - else { - image[i][j][0] = 25; - image[i][j][1] = 25; - image[i][j][2] = 25; - } - } - } - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 8, 8, 0, - GL_RGB, GL_UNSIGNED_BYTE, (GLvoid *) image); - } - - /* Bind texObj[i] to ith texture unit */ -/* if (i < 2) - glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); - else - glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_ADD);*/ - - if (TexEnabled[i]) - glEnable(GL_TEXTURE_2D); - } - - boringshaderID = glGenFragmentShadersATI(1); - boring2passID = glGenFragmentShadersATI(1); - if (boring2passID == 0) - { - fprintf(stderr, "couldn't get frag shader id\n"); - exit(1); - } - glBindFragmentShaderATI(boringshaderID); -/* maybe not the most creative shader but at least I know how it should look like! */ - glBeginFragmentShaderATI(); - glSampleMapATI(GL_REG_0_ATI, GL_TEXTURE0_ARB, GL_SWIZZLE_STR_ATI); - glSampleMapATI(GL_REG_1_ATI, GL_TEXTURE1_ARB, GL_SWIZZLE_STR_ATI); - glSampleMapATI(GL_REG_2_ATI, GL_TEXTURE2_ARB, GL_SWIZZLE_STR_ATI); - glSampleMapATI(GL_REG_3_ATI, GL_TEXTURE3_ARB, GL_SWIZZLE_STR_ATI); - glSampleMapATI(GL_REG_4_ATI, GL_TEXTURE4_ARB, GL_SWIZZLE_STR_ATI); - glSampleMapATI(GL_REG_5_ATI, GL_TEXTURE5_ARB, GL_SWIZZLE_STR_ATI); - glColorFragmentOp2ATI(GL_MUL_ATI, - GL_REG_0_ATI, GL_NONE, GL_SATURATE_BIT_ATI, - GL_REG_0_ATI, GL_NONE, GL_NONE, - GL_PRIMARY_COLOR, GL_NONE, GL_NONE); - glAlphaFragmentOp1ATI(GL_MOV_ATI, - GL_REG_0_ATI, GL_NONE, - GL_PRIMARY_COLOR, GL_NONE, GL_NONE); - glColorFragmentOp3ATI(GL_MAD_ATI, - GL_REG_0_ATI, GL_NONE, GL_SATURATE_BIT_ATI, - GL_REG_0_ATI, GL_NONE, GL_NONE, - GL_REG_1_ATI, GL_NONE, GL_NONE, - GL_REG_2_ATI, GL_NONE, GL_NONE); - glColorFragmentOp2ATI(GL_ADD_ATI, - GL_REG_0_ATI, GL_NONE, GL_SATURATE_BIT_ATI, - GL_REG_0_ATI, GL_NONE, GL_NONE, - GL_REG_3_ATI, GL_NONE, GL_NONE); - glColorFragmentOp2ATI(GL_ADD_ATI, - GL_REG_0_ATI, GL_NONE, GL_SATURATE_BIT_ATI, - GL_REG_0_ATI, GL_NONE, GL_NONE, - GL_REG_4_ATI, GL_NONE, GL_NONE); - glColorFragmentOp2ATI(GL_ADD_ATI, - GL_REG_0_ATI, GL_NONE, GL_SATURATE_BIT_ATI, - GL_REG_0_ATI, GL_NONE, GL_NONE, - GL_REG_5_ATI, GL_NONE, GL_NONE); - glEndFragmentShaderATI(); - -/* mathematically equivalent to first shader but using 2 passes together with - some tex coord rerouting */ - glBindFragmentShaderATI(boring2passID); - glBeginFragmentShaderATI(); - glPassTexCoordATI(GL_REG_1_ATI, GL_TEXTURE0_ARB, GL_SWIZZLE_STR_ATI); - glSampleMapATI(GL_REG_2_ATI, GL_TEXTURE2_ARB, GL_SWIZZLE_STR_ATI); - glSampleMapATI(GL_REG_3_ATI, GL_TEXTURE3_ARB, GL_SWIZZLE_STR_ATI); - glSampleMapATI(GL_REG_4_ATI, GL_TEXTURE4_ARB, GL_SWIZZLE_STR_ATI); - glSampleMapATI(GL_REG_5_ATI, GL_TEXTURE5_ARB, GL_SWIZZLE_STR_ATI); - glColorFragmentOp2ATI(GL_ADD_ATI, - GL_REG_0_ATI, GL_NONE, GL_SATURATE_BIT_ATI, - GL_REG_2_ATI, GL_NONE, GL_NONE, - GL_REG_3_ATI, GL_NONE, GL_NONE); - glColorFragmentOp2ATI(GL_ADD_ATI, - GL_REG_0_ATI, GL_NONE, GL_SATURATE_BIT_ATI, - GL_REG_0_ATI, GL_NONE, GL_NONE, - GL_REG_4_ATI, GL_NONE, GL_NONE); - glColorFragmentOp2ATI(GL_ADD_ATI, - GL_REG_0_ATI, GL_NONE, GL_SATURATE_BIT_ATI, - GL_REG_0_ATI, GL_NONE, GL_NONE, - GL_REG_5_ATI, GL_NONE, GL_NONE); - /* not really a dependant read */ - glSampleMapATI(GL_REG_0_ATI, GL_REG_1_ATI, GL_SWIZZLE_STR_ATI); - glSampleMapATI(GL_REG_1_ATI, GL_TEXTURE1_ARB, GL_SWIZZLE_STR_ATI); - glPassTexCoordATI(GL_REG_5_ATI, GL_REG_0_ATI, GL_SWIZZLE_STR_ATI); - glColorFragmentOp2ATI(GL_MUL_ATI, - GL_REG_0_ATI, GL_NONE, GL_SATURATE_BIT_ATI, - GL_REG_0_ATI, GL_NONE, GL_NONE, - GL_PRIMARY_COLOR, GL_NONE, GL_NONE); - glAlphaFragmentOp1ATI(GL_MOV_ATI, - GL_REG_0_ATI, GL_NONE, - GL_PRIMARY_COLOR, GL_NONE, GL_NONE); - glColorFragmentOp3ATI(GL_MAD_ATI, - GL_REG_0_ATI, GL_NONE, GL_SATURATE_BIT_ATI, - GL_REG_0_ATI, GL_NONE, GL_NONE, - GL_REG_1_ATI, GL_NONE, GL_NONE, - GL_REG_5_ATI, GL_NONE, GL_NONE); - /* in principle we're finished here, but to test a bit more - we do some fun with dot ops, replication et al. */ - glSetFragmentShaderConstantATI(GL_CON_3_ATI, shaderconstant); - glColorFragmentOp2ATI(GL_DOT4_ATI, - GL_REG_3_ATI, GL_GREEN_BIT_ATI, GL_EIGHTH_BIT_ATI, - GL_ZERO, GL_NONE, GL_COMP_BIT_ATI | GL_NEGATE_BIT_ATI, - GL_CON_3_ATI, GL_RED, GL_2X_BIT_ATI); - /* those args must get ignored, except dstReg */ - glAlphaFragmentOp2ATI(GL_DOT4_ATI, - GL_REG_4_ATI, GL_NONE, - GL_ZERO, GL_NONE, GL_NONE, - GL_ZERO, GL_NONE, GL_NONE); - /* -> reg3 g = reg4 alpha = -0.5 */ - glAlphaFragmentOp2ATI(GL_ADD_ATI, - GL_REG_5_ATI, GL_NONE, - GL_REG_3_ATI, GL_GREEN, GL_NONE, - GL_REG_4_ATI, GL_NONE, GL_NONE); - /* -> reg5 a = -1 */ - glColorFragmentOp3ATI(GL_DOT2_ADD_ATI, - GL_REG_4_ATI, GL_BLUE_BIT_ATI, GL_HALF_BIT_ATI, - GL_REG_5_ATI, GL_ALPHA, GL_NEGATE_BIT_ATI, - GL_ONE, GL_NONE, GL_BIAS_BIT_ATI, - GL_ONE, GL_ALPHA, GL_2X_BIT_ATI | GL_NEGATE_BIT_ATI); - /* -> reg 4 b = -0.5 */ - glColorFragmentOp2ATI(GL_MUL_ATI, - GL_REG_0_ATI, GL_NONE, GL_NONE, - GL_REG_4_ATI, GL_BLUE, GL_NEGATE_BIT_ATI | GL_2X_BIT_ATI, - GL_REG_0_ATI, GL_NONE, GL_NONE); - glEndFragmentShaderATI(); - - glBindFragmentShaderATI(boringshaderID); - glEnable(GL_FRAGMENT_SHADER_ATI); - - glShadeModel(GL_FLAT); - glClearColor(0.3, 0.3, 0.4, 1.0); - - if (argc > 1 && strcmp(argv[1], "-info")==0) { - printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - printf("GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - printf("GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - printf("GL_EXTENSIONS = %s\n", (char *) glGetString(GL_EXTENSIONS)); - } - printf("output should be identical with both shaders to multiarb demo when 6 textures are enabled\n"); -} - - -int main( int argc, char *argv[] ) -{ -/* GLint i;*/ - - glutInit( &argc, argv ); - glutInitWindowSize( 300, 300 ); - glutInitWindowPosition( 0, 0 ); - glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE ); - glutCreateWindow(argv[0] ); - - Init( argc, argv ); - - glutReshapeFunc( Reshape ); - glutKeyboardFunc( Key ); - glutSpecialFunc( SpecialKey ); - glutDisplayFunc( Display ); - glutIdleFunc( Idle ); - - glutCreateMenu(ModeMenu); - -/* for (i = 0; i < NumUnits; i++) { - char s[100]; - sprintf(s, "Toggle Texture %d", i); - glutAddMenuEntry(s, TEX0 + i); - }*/ - glutAddMenuEntry("Toggle 1/2 Pass Shader", SHADER); - glutAddMenuEntry("Toggle Animation", ANIMATE); - glutAddMenuEntry("Quit", QUIT); - glutAttachMenu(GLUT_RIGHT_BUTTON); - - glutMainLoop(); - return 0; -} diff --git a/progs/tests/antialias.c b/progs/tests/antialias.c deleted file mode 100644 index f23b5aff32..0000000000 --- a/progs/tests/antialias.c +++ /dev/null @@ -1,236 +0,0 @@ - -/* - * Test multisampling and polygon smoothing. - * - * Brian Paul - * 4 November 2002 - */ - -#include -#include -#include -#include - - -static GLfloat Zrot = 0; -static GLboolean Anim = GL_TRUE; -static GLboolean HaveMultisample = GL_TRUE; -static GLboolean DoMultisample = GL_TRUE; - - -static void -PrintString(const char *s) -{ - while (*s) { - glutBitmapCharacter(GLUT_BITMAP_8_BY_13, (int) *s); - s++; - } -} - - -static void -Polygon( GLint verts, GLfloat radius, GLfloat z ) -{ - int i; - for (i = 0; i < verts; i++) { - float a = (i * 2.0 * 3.14159) / verts; - float x = radius * cos(a); - float y = radius * sin(a); - glVertex3f(x, y, z); - } -} - - -static void -DrawObject( void ) -{ - glLineWidth(3.0); - glColor3f(1, 1, 1); - glBegin(GL_LINE_LOOP); - Polygon(12, 1.2, 0); - glEnd(); - - glLineWidth(1.0); - glColor3f(1, 1, 1); - glBegin(GL_LINE_LOOP); - Polygon(12, 1.1, 0); - glEnd(); - - glColor3f(1, 0, 0); - glBegin(GL_POLYGON); - Polygon(12, 0.4, 0.3); - glEnd(); - - glColor3f(0, 1, 0); - glBegin(GL_POLYGON); - Polygon(12, 0.6, 0.2); - glEnd(); - - glColor3f(0, 0, 1); - glBegin(GL_POLYGON); - Polygon(12, 0.8, 0.1); - glEnd(); - - glColor3f(1, 1, 1); - glBegin(GL_POLYGON); - Polygon(12, 1.0, 0); - glEnd(); -} - - -static void -Display( void ) -{ - glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); - - glColor3f(1, 1, 1); - if (HaveMultisample) { - glRasterPos2f(-3.1, -1.6); - if (DoMultisample) - PrintString("MULTISAMPLE"); - else - PrintString("MULTISAMPLE (off)"); - } - glRasterPos2f(-0.8, -1.6); - PrintString("No antialiasing"); - glRasterPos2f(1.6, -1.6); - PrintString("GL_POLYGON_SMOOTH"); - - /* multisample */ - if (HaveMultisample) { - glEnable(GL_DEPTH_TEST); - if (DoMultisample) - glEnable(GL_MULTISAMPLE_ARB); - glPushMatrix(); - glTranslatef(-2.5, 0, 0); - glPushMatrix(); - glRotatef(Zrot, 0, 0, 1); - DrawObject(); - glPopMatrix(); - glPopMatrix(); - glDisable(GL_MULTISAMPLE_ARB); - glDisable(GL_DEPTH_TEST); - } - - /* non-aa */ - glEnable(GL_DEPTH_TEST); - glPushMatrix(); - glTranslatef(0, 0, 0); - glPushMatrix(); - glRotatef(Zrot, 0, 0, 1); - DrawObject(); - glPopMatrix(); - glPopMatrix(); - glDisable(GL_DEPTH_TEST); - - /* polygon smooth */ - glEnable(GL_POLYGON_SMOOTH); - glEnable(GL_LINE_SMOOTH); - glEnable(GL_BLEND); - glPushMatrix(); - glTranslatef(2.5, 0, 0); - glPushMatrix(); - glRotatef(Zrot, 0, 0, 1); - DrawObject(); - glPopMatrix(); - glPopMatrix(); - glDisable(GL_LINE_SMOOTH); - glDisable(GL_POLYGON_SMOOTH); - glDisable(GL_BLEND); - - glutSwapBuffers(); -} - - -static void -Reshape( int width, int height ) -{ - GLfloat ar = (float) width / (float) height; - glViewport( 0, 0, width, height ); - glMatrixMode( GL_PROJECTION ); - glLoadIdentity(); - glOrtho(-2.0*ar, 2.0*ar, -2.0, 2.0, -1.0, 1.0); - glMatrixMode( GL_MODELVIEW ); - glLoadIdentity(); -} - - -static void -Idle( void ) -{ - Zrot = 0.01 * glutGet(GLUT_ELAPSED_TIME); - glutPostRedisplay(); -} - - -static void -Key( unsigned char key, int x, int y ) -{ - const GLfloat step = 1.0; - (void) x; - (void) y; - switch (key) { - case 'a': - Anim = !Anim; - if (Anim) - glutIdleFunc(Idle); - else - glutIdleFunc(NULL); - break; - case 'm': - DoMultisample = !DoMultisample; - break; - case 'z': - Zrot = (int) (Zrot - step); - break; - case 'Z': - Zrot = (int) (Zrot + step); - break; - case 27: - exit(0); - break; - } - glutPostRedisplay(); -} - - -static void -Init( void ) -{ - /* GLUT imposes the four samples/pixel requirement */ - int s; - glGetIntegerv(GL_SAMPLES_ARB, &s); - if (!glutExtensionSupported("GL_ARB_multisample") || s < 1) { - printf("Warning: multisample antialiasing not supported.\n"); - HaveMultisample = GL_FALSE; - } - printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - printf("GL_SAMPLES_ARB = %d\n", s); - - glBlendFunc(GL_SRC_ALPHA, GL_ONE); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glBlendFunc(GL_SRC_ALPHA_SATURATE, GL_ONE); - - glGetIntegerv(GL_MULTISAMPLE_ARB, &s); - printf("GL_MULTISAMPLE_ARB = %d\n", s); -} - - -int -main( int argc, char *argv[] ) -{ - glutInit( &argc, argv ); - glutInitWindowPosition( 0, 0 ); - glutInitWindowSize( 600, 300 ); - glutInitDisplayMode( GLUT_RGB | GLUT_ALPHA | GLUT_DOUBLE | - GLUT_DEPTH | GLUT_MULTISAMPLE ); - glutCreateWindow(argv[0]); - glutReshapeFunc( Reshape ); - glutKeyboardFunc( Key ); - glutDisplayFunc( Display ); - if (Anim) - glutIdleFunc( Idle ); - Init(); - glutMainLoop(); - return 0; -} diff --git a/progs/tests/api_speed.c b/progs/tests/api_speed.c deleted file mode 100644 index aed65b35fe..0000000000 --- a/progs/tests/api_speed.c +++ /dev/null @@ -1,146 +0,0 @@ -/* - * (C) Copyright IBM Corporation 2002 - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * on the rights to use, copy, modify, merge, publish, distribute, sub - * license, and/or sell copies of the Software, and to permit persons to whom - * the Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL - * VA LINUX SYSTEM, IBM AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, - * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR - * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE - * USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -/** - * \file api_speed.c - * Simple test to measure the overhead of making GL calls. - * - * The main purpose of this test is to measure the difference in calling - * overhead of different dispatch methods. Since it uses asm/timex.h to - * access the Pentium's cycle counters, it will probably only compile on - * Linux (though most architectures have a get_cycles function in timex.h). - * That is why it isn't in the default Makefile. - * - * \author Ian Romanick - */ - -#include -#include -#define GL_GLEXT_PROTOTYPES -#include -#include -#include - -#define inline __inline__ -#include - -static float Width = 400; -static float Height = 400; -static unsigned count = 1000000; - - -static void Idle( void ) -{ - glutPostRedisplay(); -} - -#define DO_FUNC(f,p) \ - do { \ - t0 = get_cycles(); \ - for ( i = 0 ; i < count ; i++ ) { \ - f p ; \ - } \ - t1 = get_cycles(); \ - printf("%u calls to % 20s required %llu cycles.\n", count, # f, t1 - t0); \ - } while( 0 ) - -/** - * Main display function. This is the place to add more API calls. - */ -static void Display( void ) -{ - int i; - const float v[3] = { 1.0, 0.0, 0.0 }; - cycles_t t0; - cycles_t t1; - - glBegin(GL_TRIANGLE_STRIP); - - DO_FUNC( glColor3fv, (v) ); - DO_FUNC( glNormal3fv, (v) ); - DO_FUNC( glTexCoord2fv, (v) ); - DO_FUNC( glTexCoord3fv, (v) ); - DO_FUNC( glMultiTexCoord2fv, (GL_TEXTURE0, v) ); - DO_FUNC( glMultiTexCoord2f, (GL_TEXTURE0, 0.0, 0.0) ); - DO_FUNC( glFogCoordfvEXT, (v) ); - DO_FUNC( glFogCoordfEXT, (0.5) ); - - glEnd(); - - exit(0); -} - - -static void Reshape( int width, int height ) -{ - Width = width; - Height = height; - glViewport( 0, 0, width, height ); - glMatrixMode( GL_PROJECTION ); - glLoadIdentity(); - glOrtho(0.0, width, 0.0, height, -1.0, 1.0); - glMatrixMode( GL_MODELVIEW ); - glLoadIdentity(); -} - - -static void Key( unsigned char key, int x, int y ) -{ - (void) x; - (void) y; - switch (key) { - case 27: - exit(0); - break; - } - glutPostRedisplay(); -} - - -int main( int argc, char *argv[] ) -{ - glutInit( &argc, argv ); - glutInitWindowSize( (int) Width, (int) Height ); - glutInitWindowPosition( 0, 0 ); - - glutInitDisplayMode( GLUT_RGB ); - - glutCreateWindow( argv[0] ); - - if ( argc > 1 ) { - count = strtoul( argv[1], NULL, 0 ); - if ( count == 0 ) { - fprintf( stderr, "Usage: %s [iterations]\n", argv[0] ); - exit(1); - } - } - - glutReshapeFunc( Reshape ); - glutKeyboardFunc( Key ); - glutDisplayFunc( Display ); - glutIdleFunc( Idle ); - - glutMainLoop(); - return 0; -} diff --git a/progs/tests/api_speed.py b/progs/tests/api_speed.py deleted file mode 100755 index 0ddaf5836c..0000000000 --- a/progs/tests/api_speed.py +++ /dev/null @@ -1,143 +0,0 @@ -#!/usr/bin/env python2 - -# (C) Copyright IBM Corporation 2004 -# All Rights Reserved. -# -# Permission is hereby granted, free of charge, to any person obtaining a -# copy of this software and associated documentation files (the "Software"), -# to deal in the Software without restriction, including without limitation -# on the rights to use, copy, modify, merge, publish, distribute, sub -# license, and/or sell copies of the Software, and to permit persons to whom -# the Software is furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice (including the next -# paragraph) shall be included in all copies or substantial portions of the -# Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL -# IBM AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -# IN THE SOFTWARE. -# -# Authors: -# Ian Romanick - - -# This script is used to run api_speed against several different libGL -# libraries and compare the results. See the show_usage function for more -# details on how to use it. - - -import re, os, sys, getopt - -class results: - def process_file(self, f): - self.cycles = {} - self.iterations = -1 - - for line in f.readlines(): - m = re.match("(\d+) calls to (.{20}) required (\d+) cycles.", line) - - if self.iterations != -1 and int(m.group(1)) != self.iterations: - raise - - # This could be done with lstrip, but the version of - # the Python library on my system doesn't have it. - # The installed version of Python is quite old. :( - - temp = m.group(2) - function_name = None - for i in range(len(temp)): - if temp[i] != ' ': - function_name = temp[i:] - break - - if function_name == None: - raise - - self.cycles[ function_name ] = int(m.group(3)) - self.iterations = int(m.group(1)) - - - def show_results(self): - for name in self.cycles: - print "%s -> %f" % (name, float(self.cycles[name]) / self.iterations) - - - def compare_results(self, other): - for name in self.cycles: - if other.cycles.has_key(name): - a = float(self.cycles[name]) / float(self.iterations) - b = float(other.cycles[name]) / float(other.iterations) - if abs( a ) < 0.000001: - print "a = %f, b = %f" % (a, b) - else: - p = (100.0 * b / a) - 100.0 - print "%- 20s %7.2f - %7.2f = % -6.2f (%+.1f%%)" % (name, a, b, a - b, p) - return - - -def make_execution_string(lib, iterations): - if lib == None: - return "./api_speed %u" % (iterations) - else: - return "LD_PRELOAD=%s ./api_speed %u" % (lib, iterations) - - -def show_usage(): - print """Usage: %s [-i iterations] {library ...} - -The full path to one or more libGL libraries (including the full name of the -library) can be included on the command-line. Each library will be tested, -and the results compared. The first library listed will be used as the -"base line" for all comparisons.""" % (sys.argv[0]) - sys.exit(1) - - -if __name__ == '__main__': - try: - (args, trail) = getopt.getopt(sys.argv[1:], "i:") - except Exception,e: - show_usage() - - iterations = 1000000 - try: - for (arg,val) in args: - if arg == "-i": - iterations = int(val) - except Exception,e: - show_usage() - - - # If no libraries were specifically named, just run the test against - # the default system libGL. - - if len(trail) == 0: - trail.append(None) - - - result_array = [] - names = [] - - for lib in trail: - s = make_execution_string( lib, iterations ) - r = results() - r.process_file( os.popen(s) ) - names.append(lib) - result_array.append(r) - - - # If the test was only run against one library, just show the results - # of the test run. Otherwise, compare each successive run against - # the first run. - - if len( result_array ) == 1: - result_array[0].show_results() - else: - for i in range(1, len( result_array )): - print "%s vs. %s" % (names[0], names[i]) - result_array[0].compare_results( result_array[i] ) - print "" diff --git a/progs/tests/arbfpspec.c b/progs/tests/arbfpspec.c deleted file mode 100644 index eac2a9100f..0000000000 --- a/progs/tests/arbfpspec.c +++ /dev/null @@ -1,192 +0,0 @@ -/* - * To demo that specular color gets lost someplace after vertex - * program completion and fragment program startup - */ - -#include -#include -#include -#include -#include -#define GL_GLEXT_PROTOTYPES -#include - -static float Xrot = 0.0, Yrot = 0.0, Zrot = 0.0; -static GLboolean Anim = GL_TRUE; - - -static void Idle( void ) -{ - Xrot += .3; - Yrot += .4; - Zrot += .2; - glutPostRedisplay(); -} - - -static void Display( void ) -{ - glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); - - glPushMatrix(); - glRotatef(Xrot, 1, 0, 0); - glRotatef(Yrot, 0, 1, 0); - glRotatef(Zrot, 0, 0, 1); - glutSolidTorus(0.75, 2.0, 10, 20); - glPopMatrix(); - - glutSwapBuffers(); -} - - -static void Reshape( int width, int height ) -{ - glViewport( 0, 0, width, height ); - glMatrixMode( GL_PROJECTION ); - glLoadIdentity(); - glFrustum( -2.0, 2.0, -2.0, 2.0, 5.0, 25.0 ); - glMatrixMode( GL_MODELVIEW ); - glLoadIdentity(); - glTranslatef( 0.0, 0.0, -12.0 ); -} - - -static void Key( unsigned char key, int x, int y ) -{ - (void) x; - (void) y; - switch (key) { - case ' ': - Xrot = Yrot = Zrot = 0; - break; - case 'a': - Anim = !Anim; - if (Anim) - glutIdleFunc(Idle); - else - glutIdleFunc(NULL); - break; - case 'z': - Zrot -= 5.0; - break; - case 'Z': - Zrot += 5.0; - break; - case 27: - exit(0); - break; - } - glutPostRedisplay(); -} - - -static void SpecialKey( int key, int x, int y ) -{ - const GLfloat step = 3.0; - (void) x; - (void) y; - switch (key) { - case GLUT_KEY_UP: - Xrot -= step; - break; - case GLUT_KEY_DOWN: - Xrot += step; - break; - case GLUT_KEY_LEFT: - Yrot -= step; - break; - case GLUT_KEY_RIGHT: - Yrot += step; - break; - } - glutPostRedisplay(); -} - - -static void Init( void ) -{ - GLint errno; - GLuint prognum, fprognum; - - static const char prog[] = - "!!ARBvp1.0\n" - "DP4 result.position.x, state.matrix.mvp.row[0], vertex.position ;\n" - "DP4 result.position.y, state.matrix.mvp.row[1], vertex.position ;\n" - "DP4 result.position.z, state.matrix.mvp.row[2], vertex.position ;\n" - "DP4 result.position.w, state.matrix.mvp.row[3], vertex.position ;\n" - "MOV result.color.front.primary, {.5, .5, .5, 1};\n" - "MOV result.color.front.secondary, {1, 1, 1, 1};\n" - "END"; - - static const char fprog[] = - "!!ARBfp1.0\n" - "MOV result.color, fragment.color.secondary;\n" - "END"; - - if (!glutExtensionSupported("GL_ARB_vertex_program")) { - printf("Sorry, this program requires GL_ARB_vertex_program"); - exit(1); - } - - if (!glutExtensionSupported("GL_ARB_fragment_program")) { - printf("Sorry, this program requires GL_ARB_fragment_program"); - exit(1); - } - - glGenProgramsARB(1, &prognum); - glGenProgramsARB(1, &fprognum); - - glBindProgramARB(GL_VERTEX_PROGRAM_ARB, prognum); - glProgramStringARB(GL_VERTEX_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, - strlen(prog), (const GLubyte *) prog); - - assert(glIsProgramARB(prognum)); - errno = glGetError(); - printf("glGetError = %d\n", errno); - if (errno != GL_NO_ERROR) - { - GLint errorpos; - - glGetIntegerv(GL_PROGRAM_ERROR_POSITION_ARB, &errorpos); - printf("errorpos: %d\n", errorpos); - printf("%s\n", (char *)glGetString(GL_PROGRAM_ERROR_STRING_ARB)); - } - - glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, fprognum); - glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, - strlen(fprog), (const GLubyte *) fprog); - errno = glGetError(); - printf("glGetError = %d\n", errno); - if (errno != GL_NO_ERROR) - { - GLint errorpos; - - glGetIntegerv(GL_PROGRAM_ERROR_POSITION_ARB, &errorpos); - printf("errorpos: %d\n", errorpos); - printf("%s\n", (char *)glGetString(GL_PROGRAM_ERROR_STRING_ARB)); - } - - glEnable(GL_VERTEX_PROGRAM_ARB); - glEnable(GL_FRAGMENT_PROGRAM_ARB); - glEnable(GL_DEPTH_TEST); - glClearColor(0.3, 0.3, 0.3, 1); -} - - -int main( int argc, char *argv[] ) -{ - glutInit( &argc, argv ); - glutInitWindowPosition( 0, 0 ); - glutInitWindowSize( 250, 250 ); - glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH ); - glutCreateWindow(argv[0]); - glutReshapeFunc( Reshape ); - glutKeyboardFunc( Key ); - glutSpecialFunc( SpecialKey ); - glutDisplayFunc( Display ); - if (Anim) - glutIdleFunc(Idle); - Init(); - glutMainLoop(); - return 0; -} diff --git a/progs/tests/arbfptest1.c b/progs/tests/arbfptest1.c deleted file mode 100644 index 7949f87edd..0000000000 --- a/progs/tests/arbfptest1.c +++ /dev/null @@ -1,210 +0,0 @@ -/* Test GL_ARB_fragment_program */ - -#include -#include -#include -#include -#include -#define GL_GLEXT_PROTOTYPES -#include - - - -static void Display( void ) -{ - glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); - - glPushMatrix(); - - glColor4f(0, 0.5, 0, 1); - glColor4f(0, 1, 0, 1); - glBegin(GL_POLYGON); - glVertex2f(-1, -1); - glVertex2f( 1, -1); - glVertex2f( 0, 1); - glEnd(); - - glPopMatrix(); - - glutSwapBuffers(); -} - - -static void Reshape( int width, int height ) -{ - glViewport( 0, 0, width, height ); - glMatrixMode( GL_PROJECTION ); - glLoadIdentity(); - glFrustum( -1.0, 1.0, -1.0, 1.0, 5.0, 25.0 ); - glMatrixMode( GL_MODELVIEW ); - glLoadIdentity(); - glTranslatef( 0.0, 0.0, -15.0 ); -} - - -static void Key( unsigned char key, int x, int y ) -{ - (void) x; - (void) y; - switch (key) { - case 27: - exit(0); - break; - } - glutPostRedisplay(); -} - -static void load_program(const char *prog, GLuint prognum) -{ - int a; - GLint errorpos, errno; - - glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, prognum); - glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, - strlen(prog), (const GLubyte *) prog); - - assert(glIsProgramARB(prognum)); - errno = glGetError(); - printf("glGetError = %d\n", errno); - if (errno != GL_NO_ERROR) - { - glGetIntegerv(GL_PROGRAM_ERROR_POSITION_ARB, &errorpos); - printf("errorpos: %d\n", errorpos); - printf("%s\n", (char *)glGetString(GL_PROGRAM_ERROR_STRING_ARB)); - - for (a=-10; a<10; a++) - { - if ((errorpos+a < 0) || (errorpos+a >= strlen(prog))) continue; - printf("%c", prog[errorpos+a]); - } - printf("\n"); - exit(1); - } -} - -static void Init( void ) -{ - static const char *prog0 = - "!!ARBfp1.0\n" - "TEMP R0, RC, HC, H0, H1, H2, H3, H30 ;\n" - "MUL result.color, R0, fragment.position; \n" - "ADD result.color, H3, fragment.texcoord; \n" - "ADD_SAT result.color, H3, fragment.texcoord; \n" - "MUL result.color.xy, R0.wzyx, fragment.position; \n" - "MUL result.color, H0, fragment.position; \n" - "MUL result.color, -H0, fragment.position; \n" - "MOV RC, H1; \n" - "MOV HC, H2; \n" - "END \n" - ; - /* masked updates, defines, declarations */ - static const char *prog1 = - "!!ARBfp1.0\n" - "PARAM foo = {1., 2., 3., 4.}; \n" - "PARAM foo2 = 5.; \n" - "PARAM foo3 = {5., 6., 7., 8.}; \n" - "PARAM bar = 3.; \n" - "TEMP R0, R1, RC, EQ, NE, bar2; \n" - "ALIAS bar3 = bar; \n" - "MOV result.color.xy, R0; \n" - "MOV result.color, R0; \n" - "MOV result.color.xyzw, R0; \n" - "MOV result.color.xy, R0; \n" - "MOV RC.x, R1.x; \n" - "KIL NE; \n" - "KIL EQ.xyxy; \n" - "END \n" - ; - - /* texture instructions */ - static const char *prog2 = - "!!ARBfp1.0\n" - "TEMP R0, R1, R2, R3;\n" - "TEX R0, fragment.texcoord, texture[0], 2D; \n" - "TEX R1, fragment.texcoord[1], texture[1], CUBE; \n" - "TEX R2, fragment.texcoord[2], texture[2], 3D; \n" - "TXP R3, fragment.texcoord[3], texture[3], RECT; \n" - "MUL result.color, R0, fragment.color; \n" - "END \n" - ; - - /* test negation, absolute value */ - static const char *prog3 = - "!!ARBfp1.0\n" - "TEMP R0, R1;\n" - "MOV R0, R1; \n" - "MOV R0, -R1; \n" - "MOV result.color, R0; \n" - "END \n" - ; - - /* literal constant sources */ - static const char *prog4 = - "!!ARBfp1.0\n" - "TEMP R0, R1;\n" - "PARAM Pi = 3.14159; \n" - "MOV R0, {1., -2., +3., 4.}; \n" - "MOV R0, 5.; \n" - "MOV R0, -5.; \n" - "MOV R0, 5.; \n" - "MOV R0, Pi; \n" - "MOV result.color, R0; \n" - "END \n" - ; - - /* change the fragment color in a simple way */ - static const char *prog10 = - "!!ARBfp1.0\n" - "PARAM blue = {0., 0., 1., 0.};\n" - "PARAM color = {1., 0., 0., 1.};\n" - "TEMP R0; \n" - "MOV R0, fragment.color; \n" - "#ADD result.color, R0, fragment.color; \n" - "#ADD result.color, blue, fragment.color; \n" - "#ADD result.color, {1., 0., 0., 0.}, fragment.color; \n" - "ADD result.color, color, fragment.color; \n" - "END \n" - ; - - GLuint progs[20]; - - glGenProgramsARB(20, progs); - assert(progs[0]); - assert(progs[1]); - assert(progs[0] != progs[1]); - - - printf("program 0:\n"); - load_program(prog0, progs[0]); - printf("program 1:\n"); - load_program(prog1, progs[1]); - printf("program 2:\n"); - load_program(prog2, progs[2]); - printf("program 3:\n"); - load_program(prog3, progs[3]); - printf("program 4:\n"); - load_program(prog4, progs[4]); - printf("program 10:\n"); - load_program(prog10, progs[5]); - - - glEnable(GL_FRAGMENT_PROGRAM_ARB); - glEnable(GL_ALPHA_TEST); - glAlphaFunc(GL_ALWAYS, 0.0); -} - - -int main( int argc, char *argv[] ) -{ - glutInit( &argc, argv ); - glutInitWindowPosition( 0, 0 ); - glutInitWindowSize( 250, 250 ); - glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH ); - glutCreateWindow(argv[0]); - glutReshapeFunc( Reshape ); - glutKeyboardFunc( Key ); - glutDisplayFunc( Display ); - Init(); - glutMainLoop(); - return 0; -} diff --git a/progs/tests/arbfptexture.c b/progs/tests/arbfptexture.c deleted file mode 100644 index a854908c31..0000000000 --- a/progs/tests/arbfptexture.c +++ /dev/null @@ -1,153 +0,0 @@ -/* GL_ARB_fragment_program texture test */ - -#include -#include -#include -#include -#include -#define GL_GLEXT_PROTOTYPES -#include - -#include "readtex.c" - - -#define TEXTURE_FILE "../images/girl.rgb" - -static GLfloat Xrot = 0.0, Yrot = 0.0, Zrot = 0.0; - - -static void Display( void ) -{ - glClear( GL_COLOR_BUFFER_BIT ); - - glPushMatrix(); - glRotatef(Xrot, 1.0, 0.0, 0.0); - glRotatef(Yrot, 0.0, 1.0, 0.0); - glRotatef(Zrot, 0.0, 0.0, 1.0); - - glBegin(GL_POLYGON); -#define Q 2 - glColor4f(1.0, 1.0, 1.0, 1); glTexCoord4f(0, 0, 0, Q); glVertex2f(-1, -1); - glColor4f(0.2, 0.2, 1.0, 1); glTexCoord4f(1, 0, 0, Q); glVertex2f( 1, -1); - glColor4f(0.2, 1.0, 0.2, 1); glTexCoord4f(1, 1, 0, Q); glVertex2f( 1, 1); - glColor4f(1.0, 0.2, 0.2, 1); glTexCoord4f(0, 1, 0, Q); glVertex2f(-1, 1); - glEnd(); - - glPopMatrix(); - - glutSwapBuffers(); -} - - -static void Reshape( int width, int height ) -{ - glViewport( 0, 0, width, height ); - glMatrixMode( GL_PROJECTION ); - glLoadIdentity(); - glFrustum( -1.0, 1.0, -1.0, 1.0, 5.0, 25.0 ); - glMatrixMode( GL_MODELVIEW ); - glLoadIdentity(); - glTranslatef( 0.0, 0.0, -8.0 ); -} - - -static void SpecialKey( int key, int x, int y ) -{ - float step = 3.0; - (void) x; - (void) y; - - switch (key) { - case GLUT_KEY_UP: - Xrot += step; - break; - case GLUT_KEY_DOWN: - Xrot -= step; - break; - case GLUT_KEY_LEFT: - Yrot += step; - break; - case GLUT_KEY_RIGHT: - Yrot -= step; - break; - } - glutPostRedisplay(); -} - - -static void Key( unsigned char key, int x, int y ) -{ - (void) x; - (void) y; - switch (key) { - case 27: - exit(0); - break; - } - glutPostRedisplay(); -} - - -static void Init( void ) -{ - static const char *modulate2D = - "!!ARBfp1.0\n" - "TEMP R0;\n" - "TEX R0, fragment.texcoord[0], texture[0], 2D; \n" - "MUL result.color, R0, fragment.color; \n" - "END" - ; - GLuint modulateProg; - GLuint Texture; - - if (!glutExtensionSupported("GL_ARB_fragment_program")) { - printf("Error: GL_ARB_fragment_program not supported!\n"); - exit(1); - } - printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - - /* Setup the fragment program */ - glGenProgramsARB(1, &modulateProg); - glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg); - glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, - strlen(modulate2D), (const GLubyte *)modulate2D); - - printf("glGetError = 0x%x\n", (int) glGetError()); - printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n", - (char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB)); - assert(glIsProgramARB(modulateProg)); - - glEnable(GL_FRAGMENT_PROGRAM_ARB); - - /* Load texture */ - glGenTextures(1, &Texture); - glBindTexture(GL_TEXTURE_2D, Texture); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - glPixelStorei(GL_UNPACK_ALIGNMENT, 1); - if (!LoadRGBMipmaps(TEXTURE_FILE, GL_RGB)) { - printf("Error: couldn't load texture image file %s\n", TEXTURE_FILE); - exit(1); - } - /* XXX this enable shouldn't really be needed!!! */ - glEnable(GL_TEXTURE_2D); - - glClearColor(.3, .3, .3, 0); -} - - -int main( int argc, char *argv[] ) -{ - glutInit( &argc, argv ); - glutInitWindowPosition( 0, 0 ); - glutInitWindowSize( 250, 250 ); - glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH ); - glutCreateWindow(argv[0]); - glutReshapeFunc( Reshape ); - glutKeyboardFunc( Key ); - glutSpecialFunc( SpecialKey ); - glutDisplayFunc( Display ); - Init(); - glutMainLoop(); - return 0; -} diff --git a/progs/tests/arbfptrig.c b/progs/tests/arbfptrig.c deleted file mode 100644 index 26b68c6b41..0000000000 --- a/progs/tests/arbfptrig.c +++ /dev/null @@ -1,156 +0,0 @@ -/* GL_ARB_fragment_program texture test */ - -#include -#include -#include -#include -#include -#define GL_GLEXT_PROTOTYPES -#include - -#include "readtex.c" - - -#define TEXTURE_FILE "../images/girl.rgb" - -static GLfloat Xrot = 0.0, Yrot = 0.0, Zrot = 0.0; - -#define PI 3.141592 - -static void Display( void ) -{ - glClear( GL_COLOR_BUFFER_BIT ); - - glPushMatrix(); - glRotatef(Xrot, 1.0, 0.0, 0.0); - glRotatef(Yrot, 0.0, 1.0, 0.0); - glRotatef(Zrot, 0.0, 0.0, 1.0); - - glBegin(GL_POLYGON); - glTexCoord2f(-PI, 0); glVertex2f(-1, -1); - glTexCoord2f(PI, 0); glVertex2f( 1, -1); - glTexCoord2f(PI, 1); glVertex2f( 1, 1); - glTexCoord2f(-PI, 1); glVertex2f(-1, 1); - glEnd(); - - glPopMatrix(); - - glutSwapBuffers(); -} - - -static void Reshape( int width, int height ) -{ - glViewport( 0, 0, width, height ); - glMatrixMode( GL_PROJECTION ); - glLoadIdentity(); - glFrustum( -1.0, 1.0, -1.0, 1.0, 5.0, 25.0 ); - glMatrixMode( GL_MODELVIEW ); - glLoadIdentity(); - glTranslatef( 0.0, 0.0, -8.0 ); -} - - -static void SpecialKey( int key, int x, int y ) -{ - float step = 3.0; - (void) x; - (void) y; - - switch (key) { - case GLUT_KEY_UP: - Xrot += step; - break; - case GLUT_KEY_DOWN: - Xrot -= step; - break; - case GLUT_KEY_LEFT: - Yrot += step; - break; - case GLUT_KEY_RIGHT: - Yrot -= step; - break; - } - glutPostRedisplay(); -} - - -static void Key( unsigned char key, int x, int y ) -{ - (void) x; - (void) y; - switch (key) { - case 27: - exit(0); - break; - } - glutPostRedisplay(); -} - - -static void Init( void ) -{ - static const char *modulate2D = - "!!ARBfp1.0\n" - "TEMP R0;\n" - "MOV R0, {0,0,0,1};\n" - "SCS R0, fragment.texcoord[0].x; \n" - "ADD R0, R0, {1.0}.x;\n" - "MUL R0, R0, {0.5}.x;\n" - "MOV result.color, R0; \n" - "END" - ; - GLuint modulateProg; - GLuint Texture; - - if (!glutExtensionSupported("GL_ARB_fragment_program")) { - printf("Error: GL_ARB_fragment_program not supported!\n"); - exit(1); - } - printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - - /* Setup the fragment program */ - glGenProgramsARB(1, &modulateProg); - glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg); - glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, - strlen(modulate2D), (const GLubyte *)modulate2D); - - printf("glGetError = 0x%x\n", (int) glGetError()); - printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n", - (char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB)); - assert(glIsProgramARB(modulateProg)); - - glEnable(GL_FRAGMENT_PROGRAM_ARB); - - /* Load texture */ - glGenTextures(1, &Texture); - glBindTexture(GL_TEXTURE_2D, Texture); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - glPixelStorei(GL_UNPACK_ALIGNMENT, 1); - if (!LoadRGBMipmaps(TEXTURE_FILE, GL_RGB)) { - printf("Error: couldn't load texture image file %s\n", TEXTURE_FILE); - exit(1); - } - /* XXX this enable shouldn't really be needed!!! */ - glEnable(GL_TEXTURE_2D); - - glClearColor(.3, .3, .3, 0); -} - - -int main( int argc, char *argv[] ) -{ - glutInit( &argc, argv ); - glutInitWindowPosition( 0, 0 ); - glutInitWindowSize( 250, 250 ); - glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH ); - glutCreateWindow(argv[0]); - glutReshapeFunc( Reshape ); - glutKeyboardFunc( Key ); - glutSpecialFunc( SpecialKey ); - glutDisplayFunc( Display ); - Init(); - glutMainLoop(); - return 0; -} diff --git a/progs/tests/arbnpot-mipmap.c b/progs/tests/arbnpot-mipmap.c deleted file mode 100644 index 4ed84e7ace..0000000000 --- a/progs/tests/arbnpot-mipmap.c +++ /dev/null @@ -1,184 +0,0 @@ - -/* Copyright (c) Mark J. Kilgard, 1994. */ - -/* - * (c) Copyright 1993, Silicon Graphics, Inc. - * ALL RIGHTS RESERVED - * Permission to use, copy, modify, and distribute this software for - * any purpose and without fee is hereby granted, provided that the above - * copyright notice appear in all copies and that both the copyright notice - * and this permission notice appear in supporting documentation, and that - * the name of Silicon Graphics, Inc. not be used in advertising - * or publicity pertaining to distribution of the software without specific, - * written prior permission. - * - * THE MATERIAL EMBODIED ON THIS SOFTWARE IS PROVIDED TO YOU "AS-IS" - * AND WITHOUT WARRANTY OF ANY KIND, EXPRESS, IMPLIED OR OTHERWISE, - * INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY OR - * FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON - * GRAPHICS, INC. BE LIABLE TO YOU OR ANYONE ELSE FOR ANY DIRECT, - * SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY - * KIND, OR ANY DAMAGES WHATSOEVER, INCLUDING WITHOUT LIMITATION, - * LOSS OF PROFIT, LOSS OF USE, SAVINGS OR REVENUE, OR THE CLAIMS OF - * THIRD PARTIES, WHETHER OR NOT SILICON GRAPHICS, INC. HAS BEEN - * ADVISED OF THE POSSIBILITY OF SUCH LOSS, HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE - * POSSESSION, USE OR PERFORMANCE OF THIS SOFTWARE. - * - * US Government Users Restricted Rights - * Use, duplication, or disclosure by the Government is subject to - * restrictions set forth in FAR 52.227.19(c)(2) or subparagraph - * (c)(1)(ii) of the Rights in Technical Data and Computer Software - * clause at DFARS 252.227-7013 and/or in similar or successor - * clauses in the FAR or the DOD or NASA FAR Supplement. - * Unpublished-- rights reserved under the copyright laws of the - * United States. Contractor/manufacturer is Silicon Graphics, - * Inc., 2011 N. Shoreline Blvd., Mountain View, CA 94039-7311. - * - * OpenGL(TM) is a trademark of Silicon Graphics, Inc. - */ -/* mipmap.c - * This program demonstrates using mipmaps for texture maps. - * To overtly show the effect of mipmaps, each mipmap reduction - * level has a solidly colored, contrasting texture image. - * Thus, the quadrilateral which is drawn is drawn with several - * different colors. - */ -#include -#include -#include - -GLubyte mipmapImage32[40][46][3]; -GLubyte mipmapImage16[20][23][3]; -GLubyte mipmapImage8[10][11][3]; -GLubyte mipmapImage4[5][5][3]; -GLubyte mipmapImage2[2][2][3]; -GLubyte mipmapImage1[1][1][3]; - -static void makeImages(void) -{ - int i, j; - - for (i = 0; i < 40; i++) { - for (j = 0; j < 46; j++) { - mipmapImage32[i][j][0] = 255; - mipmapImage32[i][j][1] = 255; - mipmapImage32[i][j][2] = 0; - } - } - for (i = 0; i < 20; i++) { - for (j = 0; j < 23; j++) { - mipmapImage16[i][j][0] = 255; - mipmapImage16[i][j][1] = 0; - mipmapImage16[i][j][2] = 255; - } - } - for (i = 0; i < 10; i++) { - for (j = 0; j < 11; j++) { - mipmapImage8[i][j][0] = 255; - mipmapImage8[i][j][1] = 0; - mipmapImage8[i][j][2] = 0; - } - } - for (i = 0; i < 5; i++) { - for (j = 0; j < 5; j++) { - mipmapImage4[i][j][0] = 0; - mipmapImage4[i][j][1] = 255; - mipmapImage4[i][j][2] = 0; - } - } - for (i = 0; i < 2; i++) { - for (j = 0; j < 2; j++) { - mipmapImage2[i][j][0] = 0; - mipmapImage2[i][j][1] = 0; - mipmapImage2[i][j][2] = 255; - } - } - mipmapImage1[0][0][0] = 255; - mipmapImage1[0][0][1] = 255; - mipmapImage1[0][0][2] = 255; -} - -static void myinit(void) -{ - if (!glutExtensionSupported("GL_ARB_texture_non_power_of_two")) { - printf("Sorry, this program requires GL_ARB_texture_non_power_of_two\n"); - exit(1); - } - - glEnable(GL_DEPTH_TEST); - glDepthFunc(GL_LESS); - glShadeModel(GL_FLAT); - - glTranslatef(0.0, 0.0, -3.6); - makeImages(); - glPixelStorei(GL_UNPACK_ALIGNMENT, 1); - glTexImage2D(GL_TEXTURE_2D, 0, 3, 40, 46, 0, - GL_RGB, GL_UNSIGNED_BYTE, &mipmapImage32[0][0][0]); - glTexImage2D(GL_TEXTURE_2D, 1, 3, 20, 23, 0, - GL_RGB, GL_UNSIGNED_BYTE, &mipmapImage16[0][0][0]); - glTexImage2D(GL_TEXTURE_2D, 2, 3, 10, 11, 0, - GL_RGB, GL_UNSIGNED_BYTE, &mipmapImage8[0][0][0]); - glTexImage2D(GL_TEXTURE_2D, 3, 3, 5, 5, 0, - GL_RGB, GL_UNSIGNED_BYTE, &mipmapImage4[0][0][0]); - glTexImage2D(GL_TEXTURE_2D, 4, 3, 2, 2, 0, - GL_RGB, GL_UNSIGNED_BYTE, &mipmapImage2[0][0][0]); - glTexImage2D(GL_TEXTURE_2D, 5, 3, 1, 1, 0, - GL_RGB, GL_UNSIGNED_BYTE, &mipmapImage1[0][0][0]); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, - GL_NEAREST_MIPMAP_NEAREST); - glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL); - glEnable(GL_TEXTURE_2D); -} - -static void display(void) -{ - glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); - glBegin(GL_QUADS); - glTexCoord2f(0.0, 0.0); glVertex3f(-2.0, -1.0, 0.0); - glTexCoord2f(0.0, 8.0); glVertex3f(-2.0, 1.0, 0.0); - glTexCoord2f(8.0, 8.0); glVertex3f(2000.0, 1.0, -6000.0); - glTexCoord2f(8.0, 0.0); glVertex3f(2000.0, -1.0, -6000.0); - glEnd(); - glFlush(); -} - -static void myReshape(int w, int h) -{ - glViewport(0, 0, w, h); - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - gluPerspective(60.0, 1.0*(GLfloat)w/(GLfloat)h, 1.0, 30000.0); - glMatrixMode(GL_MODELVIEW); - glLoadIdentity(); -} - -static void -key(unsigned char k, int x, int y) -{ - switch (k) { - case 27: /* Escape */ - exit(0); - break; - default: - return; - } - glutPostRedisplay(); -} - -int main(int argc, char** argv) -{ - glutInit(&argc, argv); - glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB | GLUT_DEPTH); - glutInitWindowSize (500, 500); - glutCreateWindow (argv[0]); - myinit(); - glutReshapeFunc (myReshape); - glutDisplayFunc(display); - glutKeyboardFunc(key); - glutMainLoop(); - return 0; /* ANSI C requires main to return int. */ -} diff --git a/progs/tests/arbnpot.c b/progs/tests/arbnpot.c deleted file mode 100644 index 05ba85dad9..0000000000 --- a/progs/tests/arbnpot.c +++ /dev/null @@ -1,197 +0,0 @@ -/* - * Test NPOT textures with the GL_ARB_texture_non_power_of_two extension. - * Brian Paul - * 2 July 2003 - */ - -#include -#include -#include -#include -#include -#include "../util/readtex.c" - -#define IMAGE_FILE "../images/girl.rgb" - -static GLfloat Zrot = 0; - -static void Display( void ) -{ - glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); - - glPushMatrix(); - glRotatef(Zrot, 0, 0, 1); - glBegin(GL_POLYGON); - glTexCoord2f(0, 0); - glVertex2f(-1, -1); - glTexCoord2f(1, 0); - glVertex2f(1, -1); - glTexCoord2f(1, 1); - glVertex2f(1, 1); - glTexCoord2f(0, 1); - glVertex2f(-1, 1); - glEnd(); - glPopMatrix(); - - glutSwapBuffers(); -} - - -static void Reshape( int width, int height ) -{ - glViewport( 0, 0, width, height ); - glMatrixMode( GL_PROJECTION ); - glLoadIdentity(); - glFrustum( -1.0, 1.0, -1.0, 1.0, 5.0, 25.0 ); - glMatrixMode( GL_MODELVIEW ); - glLoadIdentity(); - glTranslatef( 0.0, 0.0, -7.0 ); -} - - -static void Key( unsigned char key, int x, int y ) -{ - (void) x; - (void) y; - switch (key) { - case 'z': - Zrot -= 1.0; - break; - case 'Z': - Zrot += 1.0; - break; - case 27: - exit(0); - break; - } - glutPostRedisplay(); -} - - -static void Init( void ) -{ - GLubyte *image; - int imgWidth, imgHeight, minDim, w; - GLenum imgFormat; - - if (!glutExtensionSupported("GL_ARB_texture_non_power_of_two")) { - printf("Sorry, this program requires GL_ARB_texture_non_power_of_two\n"); - exit(1); - } - -#if 1 - image = LoadRGBImage( IMAGE_FILE, &imgWidth, &imgHeight, &imgFormat ); - if (!image) { - printf("Couldn't read %s\n", IMAGE_FILE); - exit(0); - } -#else - int i, j; - imgFormat = GL_RGB; - imgWidth = 3; - imgHeight = 3; - image = malloc(imgWidth * imgHeight * 3); - for (i = 0; i < imgHeight; i++) { - for (j = 0; j < imgWidth; j++) { - int k = (i * imgWidth + j) * 3; - if ((i + j) & 1) { - image[k+0] = 255; - image[k+1] = 0; - image[k+2] = 0; - } - else { - image[k+0] = 0; - image[k+1] = 255; - image[k+2] = 0; - } - } - } -#endif - - printf("Read %d x %d\n", imgWidth, imgHeight); - - minDim = imgWidth < imgHeight ? imgWidth : imgHeight; - - glPixelStorei(GL_UNPACK_ALIGNMENT, 1); - - /* - * 1D Texture. Test proxy first, if that works, test non-proxy target. - */ - glTexImage1D(GL_PROXY_TEXTURE_1D, 0, GL_RGB, imgWidth, 0, - imgFormat, GL_UNSIGNED_BYTE, image); - glGetTexLevelParameteriv(GL_PROXY_TEXTURE_1D, 0, GL_TEXTURE_WIDTH, &w); - assert(w == imgWidth || w == 0); - - if (w) { - glTexImage1D(GL_TEXTURE_1D, 0, GL_RGB, imgWidth, 0, - imgFormat, GL_UNSIGNED_BYTE, image); - assert(glGetError() == GL_NO_ERROR); - } - - - /* - * 2D Texture - */ - glTexImage2D(GL_PROXY_TEXTURE_2D, 0, GL_RGB, imgWidth, imgHeight, 0, - imgFormat, GL_UNSIGNED_BYTE, image); - glGetTexLevelParameteriv(GL_PROXY_TEXTURE_2D, 0, GL_TEXTURE_WIDTH, &w); - assert(w == imgWidth || w == 0); - - if (w) { - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, imgWidth, imgHeight, 0, - imgFormat, GL_UNSIGNED_BYTE, image); - assert(glGetError() == GL_NO_ERROR); - } - - - /* - * 3D Texture - */ - glTexImage3D(GL_PROXY_TEXTURE_3D, 0, GL_RGB, imgWidth, imgHeight, 1, 0, - imgFormat, GL_UNSIGNED_BYTE, image); - glGetTexLevelParameteriv(GL_PROXY_TEXTURE_3D, 0, GL_TEXTURE_WIDTH, &w); - assert(w == imgWidth || w == 0); - - if (w) { - glTexImage3D(GL_TEXTURE_3D, 0, GL_RGB, imgWidth, imgHeight, 1, 0, - imgFormat, GL_UNSIGNED_BYTE, image); - assert(glGetError() == GL_NO_ERROR); - } - - - /* - * Cube Texture - */ - glTexImage2D(GL_PROXY_TEXTURE_CUBE_MAP, 0, GL_RGB, - minDim, minDim, 0, - imgFormat, GL_UNSIGNED_BYTE, image); - glGetTexLevelParameteriv(GL_PROXY_TEXTURE_CUBE_MAP, 0, GL_TEXTURE_WIDTH, &w); - assert(w == minDim || w == 0); - - if (w) { - glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, GL_RGB, - minDim, minDim, 0, - imgFormat, GL_UNSIGNED_BYTE, image); - assert(glGetError() == GL_NO_ERROR); - } - - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - glEnable(GL_TEXTURE_2D); -} - - -int main( int argc, char *argv[] ) -{ - glutInit( &argc, argv ); - glutInitWindowPosition( 0, 0 ); - glutInitWindowSize( 400, 400 ); - glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH ); - glutCreateWindow(argv[0]); - glutReshapeFunc( Reshape ); - glutKeyboardFunc( Key ); - glutDisplayFunc( Display ); - Init(); - glutMainLoop(); - return 0; -} diff --git a/progs/tests/arbvptest1.c b/progs/tests/arbvptest1.c deleted file mode 100644 index 0ebd3987f5..0000000000 --- a/progs/tests/arbvptest1.c +++ /dev/null @@ -1,164 +0,0 @@ -/* Test glGenProgramsARB(), glIsProgramARB(), glLoadProgramARB() */ - -#include -#include -#include -#include -#include -#define GL_GLEXT_PROTOTYPES -#include - -static void Display( void ) -{ - glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); - - glPushMatrix(); - - glBegin(GL_POLYGON); - glVertexAttrib2fARB(0, -1, -1); - glVertexAttrib2fARB(0, 1, -1); - glVertexAttrib2fARB(0, 0, 1); - glEnd(); - - glPopMatrix(); - - glutSwapBuffers(); -} - - -static void Reshape( int width, int height ) -{ - glViewport( 0, 0, width, height ); - glMatrixMode( GL_PROJECTION ); - glLoadIdentity(); - glFrustum( -1.0, 1.0, -1.0, 1.0, 5.0, 25.0 ); - glMatrixMode( GL_MODELVIEW ); - glLoadIdentity(); - glTranslatef( 0.0, 0.0, -15.0 ); -} - - -static void Key( unsigned char key, int x, int y ) -{ - (void) x; - (void) y; - switch (key) { - case 27: - exit(0); - break; - } - glutPostRedisplay(); -} - -static void load_program(const char *prog, GLuint prognum) -{ - int a; - GLint errorpos, errno; - - glBindProgramARB(GL_VERTEX_PROGRAM_ARB, prognum); - glProgramStringARB(GL_VERTEX_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, - strlen(prog), (const GLubyte *) prog); - - assert(glIsProgramARB(prognum)); - errno = glGetError(); - printf("glGetError = %d\n", errno); - if (errno != GL_NO_ERROR) - { - glGetIntegerv(GL_PROGRAM_ERROR_POSITION_ARB, &errorpos); - printf("errorpos: %d\n", errorpos); - printf("%s\n", (char *)glGetString(GL_PROGRAM_ERROR_STRING_ARB)); - - for (a=-10; a<10; a++) - { - if ((errorpos+a < 0) || (errorpos+a >= strlen(prog))) continue; - printf("%c", prog[errorpos+a]); - } - printf("\n"); - exit(1); - } -} - -static void Init( void ) -{ - GLuint prognum[4]; - - static const char *prog1 = - "!!ARBvp1.0\n" - "TEMP R0;\n" - "MUL result.color.primary.xyz, R0, program.local[35]; \n" - "END\n"; - static const char *prog2 = - "!!ARBvp1.0\n" - "#\n" - "# c[0-3] = modelview projection (composite) matrix\n" - "# c[32] = normalized light direction in object-space\n" - "# c[35] = yellow diffuse material, (1.0, 1.0, 0.0, 1.0)\n" - "# c[64].x = 0.0\n" - "# c[64].z = 0.125, a scaling factor\n" - "TEMP R0, R1;\n" - "#\n" - "# outputs diffuse illumination for color and perturbed position\n" - "#\n" - "DP3 R0, program.local[32], vertex.normal; # light direction DOT normal\n" - "MUL result.color.primary.xyz, R0, program.local[35]; \n" - "MAX R0, program.local[64].x, R0; \n" - "MUL R0, R0, vertex.normal; \n" - "MUL R0, R0, program.local[64].z; \n" - "ADD R1, vertex.position, -R0; # perturb object space position\n" - "DP4 result.position.x, state.matrix.mvp.row[3], R1; \n" - "DP4 result.position.y, state.matrix.mvp.row[1], R1; \n" - "DP4 result.position.z, state.matrix.mvp.row[2], R1; \n" - "DP4 result.position.w, state.matrix.mvp.row[3], R1; \n" - "END\n"; - static const char *prog3 = - "!!ARBvp1.0\n" - "TEMP R0, R1, R2, R3;\n" - "DP4 result.position.x, state.matrix.mvp.row[0], vertex.position;\n" - "DP4 result.position.y, state.matrix.mvp.row[1], vertex.position;\n" - "DP4 result.position.z, state.matrix.mvp.row[2], vertex.position;\n" - "DP4 result.position.w, state.matrix.mvp.row[3], vertex.position;\n" - "DP3 R0.x, state.matrix.modelview.inverse.row[0], vertex.normal;\n" - "DP3 R0.y, state.matrix.modelview.inverse.row[1], vertex.normal;\n" - "DP3 R0.z, state.matrix.modelview.inverse.row[2], vertex.normal;\n" - "DP3 R1.x, program.env[32], R0; # R1.x = Lpos DOT n'\n" - "DP3 R1.y, program.env[33], R0; # R1.y = hHat DOT n'\n" - "MOV R1.w, program.local[38].x; # R1.w = specular power\n" - "LIT R2, R1; # Compute lighting values\n" - "MAD R3, program.env[35].x, R2.y, program.env[35].y; # diffuse + emissive\n" - "MAD result.color.primary.xyz, program.env[36], R2.z, R3; # + specular\n" - "END\n"; - static const char *prog4 = - "!!ARBvp1.0\n" - "TEMP R2, R3;\n" - "PARAM foo = {0., 0., 0., 1.};\n" - "PARAM blah[] = { program.local[0..8] };\n" - "ADDRESS A0;\n" - "ARL A0.x, foo.x;\n" - "DP4 R2, R3, blah[A0.x].x;\n" - "DP4 R2, R3, blah[A0.x + 5];\n" - "DP4 result.position, R3, blah[A0.x - 4];\n" - "END\n"; - - glGenProgramsARB(4, prognum); - - load_program(prog1, prognum[0]); - load_program(prog2, prognum[1]); - load_program(prog3, prognum[2]); - load_program(prog4, prognum[3]); -} - - -int main( int argc, char *argv[] ) -{ - glutInit( &argc, argv ); - glutInitWindowPosition( 0, 0 ); - glutInitWindowSize( 250, 250 ); - glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH ); - glutCreateWindow(argv[0]); - glutReshapeFunc( Reshape ); - glutKeyboardFunc( Key ); - glutDisplayFunc( Display ); - Init(); - glutMainLoop(); - return 0; -} diff --git a/progs/tests/arbvptest3.c b/progs/tests/arbvptest3.c deleted file mode 100644 index 6437062900..0000000000 --- a/progs/tests/arbvptest3.c +++ /dev/null @@ -1,127 +0,0 @@ - -#include -#include -#include -#include -#include -#define GL_GLEXT_PROTOTYPES -#include - -static float Zrot = 0.0; - - -static void Display( void ) -{ - glClearColor(0.3, 0.3, 0.3, 1); - glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); - - glEnable(GL_VERTEX_PROGRAM_ARB); - - glLoadIdentity(); - glRotatef(Zrot, 0, 0, 1); - - glPushMatrix(); - - glVertexAttrib3fARB(3, 1, 0.5, 0.25); - glBegin(GL_TRIANGLES); -#if 1 - glVertexAttrib3fARB(3, 1.0, 0.0, 0.0); - glVertexAttrib2fARB(0, -0.5, -0.5); - glVertexAttrib3fARB(3, 0.0, 1.0, 0.0); - glVertexAttrib2fARB(0, 0.5, -0.5); - glVertexAttrib3fARB(3, 0.0, 0.0, 1.0); - glVertexAttrib2fARB(0, 0, 0.5); -#else - glVertex2f( -1, -1); - glVertex2f( 1, -1); - glVertex2f( 0, 1); -#endif - glEnd(); - - glPopMatrix(); - - glutSwapBuffers(); -} - - -static void Reshape( int width, int height ) -{ - glViewport( 0, 0, width, height ); - glMatrixMode( GL_PROJECTION ); - glLoadIdentity(); - /* glFrustum( -2.0, 2.0, -2.0, 2.0, 5.0, 25.0 );*/ - glOrtho(-2.0, 2.0, -2.0, 2.0, -2.0, 2.0 ); - glMatrixMode( GL_MODELVIEW ); - glLoadIdentity(); - /*glTranslatef( 0.0, 0.0, -15.0 );*/ -} - - -static void Key( unsigned char key, int x, int y ) -{ - (void) x; - (void) y; - switch (key) { - case 'z': - Zrot -= 5.0; - break; - case 'Z': - Zrot += 5.0; - break; - case 27: - exit(0); - break; - } - glutPostRedisplay(); -} - - -static void Init( void ) -{ - GLint errno; - GLuint prognum; - - static const char *prog1 = - "!!ARBvp1.0\n" - "MOV result.color, vertex.attrib[3];\n" - - "DP4 result.position.x, vertex.position, state.matrix.modelview.row[0];\n" - "DP4 result.position.y, vertex.position, state.matrix.modelview.row[1];\n" - "DP4 result.position.z, vertex.position, state.matrix.modelview.row[2];\n" - "DP4 result.position.w, vertex.position, state.matrix.modelview.row[3];\n" - "END\n"; - - glGenProgramsARB(1, &prognum); - - glBindProgramARB(GL_VERTEX_PROGRAM_ARB, prognum); - glProgramStringARB(GL_VERTEX_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, - strlen(prog1), (const GLubyte *) prog1); - - assert(glIsProgramARB(prognum)); - errno = glGetError(); - printf("glGetError = %d\n", errno); - if (errno != GL_NO_ERROR) - { - GLint errorpos; - - glGetIntegerv(GL_PROGRAM_ERROR_POSITION_ARB, &errorpos); - printf("errorpos: %d\n", errorpos); - printf("%s\n", (char *)glGetString(GL_PROGRAM_ERROR_STRING_ARB)); - } -} - - -int main( int argc, char *argv[] ) -{ - glutInit( &argc, argv ); - glutInitWindowPosition( 0, 0 ); - glutInitWindowSize( 250, 250 ); - glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH ); - glutCreateWindow(argv[0]); - glutReshapeFunc( Reshape ); - glutKeyboardFunc( Key ); - glutDisplayFunc( Display ); - Init(); - glutMainLoop(); - return 0; -} diff --git a/progs/tests/arbvptorus.c b/progs/tests/arbvptorus.c deleted file mode 100644 index 9d19ef90da..0000000000 --- a/progs/tests/arbvptorus.c +++ /dev/null @@ -1,186 +0,0 @@ -/* - * A lit, rotating torus via vertex program - */ - -#include -#include -#include -#include -#include -#define GL_GLEXT_PROTOTYPES -#include - -static float Xrot = 0.0, Yrot = 0.0, Zrot = 0.0; -static GLboolean Anim = GL_TRUE; - - -static void Idle( void ) -{ - Xrot += .3; - Yrot += .4; - Zrot += .2; - glutPostRedisplay(); -} - - -static void Display( void ) -{ - glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); - - glPushMatrix(); - glRotatef(Xrot, 1, 0, 0); - glRotatef(Yrot, 0, 1, 0); - glRotatef(Zrot, 0, 0, 1); - glutSolidTorus(0.75, 2.0, 10, 20); - glPopMatrix(); - - glutSwapBuffers(); -} - - -static void Reshape( int width, int height ) -{ - glViewport( 0, 0, width, height ); - glMatrixMode( GL_PROJECTION ); - glLoadIdentity(); - glFrustum( -2.0, 2.0, -2.0, 2.0, 5.0, 25.0 ); - glMatrixMode( GL_MODELVIEW ); - glLoadIdentity(); - glTranslatef( 0.0, 0.0, -12.0 ); -} - - -static void Key( unsigned char key, int x, int y ) -{ - (void) x; - (void) y; - switch (key) { - case ' ': - Xrot = Yrot = Zrot = 0; - break; - case 'a': - Anim = !Anim; - if (Anim) - glutIdleFunc(Idle); - else - glutIdleFunc(NULL); - break; - case 'z': - Zrot -= 5.0; - break; - case 'Z': - Zrot += 5.0; - break; - case 27: - exit(0); - break; - } - glutPostRedisplay(); -} - - -static void SpecialKey( int key, int x, int y ) -{ - const GLfloat step = 3.0; - (void) x; - (void) y; - switch (key) { - case GLUT_KEY_UP: - Xrot -= step; - break; - case GLUT_KEY_DOWN: - Xrot += step; - break; - case GLUT_KEY_LEFT: - Yrot -= step; - break; - case GLUT_KEY_RIGHT: - Yrot += step; - break; - } - glutPostRedisplay(); -} - - -static void Init( void ) -{ - GLint errno; - GLuint prognum; - - /* borrowed from an nvidia demo: - * c[0..3] = modelview matrix - * c[4..7] = invtrans modelview matrix - * c[32] = light pos - * c[35] = diffuse color - */ - static const char prog[] = - "!!ARBvp1.0\n" - "OPTION ARB_position_invariant ;" - "TEMP R0, R1; \n" - - "# normal x MV-1T -> lighting normal\n" - "DP3 R1.x, state.matrix.modelview.invtrans.row[0], vertex.normal ;\n" - "DP3 R1.y, state.matrix.modelview.invtrans.row[1], vertex.normal;\n" - "DP3 R1.z, state.matrix.modelview.invtrans.row[2], vertex.normal;\n" - - "DP3 R0, program.local[32], R1; # L.N\n" -#if 0 - "MUL result.color.xyz, R0, program.local[35] ; # col = L.N * diffuse\n" -#else - "MUL result.color.primary.xyz, R0, program.local[35] ; # col = L.N * diffuse\n" -#endif - "MOV result.texcoord, vertex.texcoord;\n" - "END"; - - if (!glutExtensionSupported("GL_ARB_vertex_program")) { - printf("Sorry, this program requires GL_ARB_vertex_program"); - exit(1); - } - - - glGenProgramsARB(1, &prognum); - - glBindProgramARB(GL_VERTEX_PROGRAM_ARB, prognum); - glProgramStringARB(GL_VERTEX_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, - strlen(prog), (const GLubyte *) prog); - - assert(glIsProgramARB(prognum)); - errno = glGetError(); - printf("glGetError = %d\n", errno); - if (errno != GL_NO_ERROR) - { - GLint errorpos; - - glGetIntegerv(GL_PROGRAM_ERROR_POSITION_ARB, &errorpos); - printf("errorpos: %d\n", errorpos); - printf("%s\n", (char *)glGetString(GL_PROGRAM_ERROR_STRING_ARB)); - } - - /* Light position */ - glProgramLocalParameter4fARB(GL_VERTEX_PROGRAM_ARB, 32, 2, 2, 4, 1); - /* Diffuse material color */ - glProgramLocalParameter4fARB(GL_VERTEX_PROGRAM_ARB, 35, 0.25, 0, 0.25, 1); - - glEnable(GL_VERTEX_PROGRAM_ARB); - glEnable(GL_DEPTH_TEST); - glClearColor(0.3, 0.3, 0.3, 1); -} - - -int main( int argc, char *argv[] ) -{ - glutInit( &argc, argv ); - glutInitWindowPosition( 0, 0 ); - glutInitWindowSize( 250, 250 ); - glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH ); - glutCreateWindow(argv[0]); - glutReshapeFunc( Reshape ); - glutKeyboardFunc( Key ); - glutSpecialFunc( SpecialKey ); - glutDisplayFunc( Display ); - if (Anim) - glutIdleFunc(Idle); - Init(); - glutMainLoop(); - return 0; -} diff --git a/progs/tests/arbvpwarpmesh.c b/progs/tests/arbvpwarpmesh.c deleted file mode 100644 index 3dfe94f759..0000000000 --- a/progs/tests/arbvpwarpmesh.c +++ /dev/null @@ -1,246 +0,0 @@ -/* - * Warp a triangle mesh with a vertex program. - */ - -#include -#include -#include -#include -#include -#define GL_GLEXT_PROTOTYPES -#include - -static float Xrot = -60.0, Yrot = 0.0, Zrot = 0.0; -static GLboolean Anim = GL_TRUE; -static GLfloat Phi = 0.0; - - -static void Idle( void ) -{ - Phi += 0.01; - glutPostRedisplay(); -} - - -static void DrawMesh( int rows, int cols ) -{ - static const GLfloat colorA[3] = { 0, 1, 0 }; - static const GLfloat colorB[3] = { 0, 0, 1 }; - const float dx = 2.0 / (cols - 1); - const float dy = 2.0 / (rows - 1); - float x, y; - int i, j; - -#if 1 -#define COLOR3FV(c) glVertexAttrib3fvARB(3, c) -#define VERTEX2F(x, y) glVertexAttrib2fARB(0, x, y) -#else -#define COLOR3FV(c) glColor3fv(c) -#define VERTEX2F(x, y) glVertex2f(x, y) -#endif - - y = -1.0; - for (i = 0; i < rows - 1; i++) { - glBegin(GL_QUAD_STRIP); - x = -1.0; - for (j = 0; j < cols; j++) { - if ((i + j) & 1) - COLOR3FV(colorA); - else - COLOR3FV(colorB); - VERTEX2F(x, y); - VERTEX2F(x, y + dy); - x += dx; - } - glEnd(); - y += dy; - } -} - - -static void Display( void ) -{ - glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); - - glPushMatrix(); - glRotatef(Xrot, 1, 0, 0); - glRotatef(Yrot, 0, 1, 0); - glRotatef(Zrot, 0, 0, 1); - - /* Position the gravity source */ - { - GLfloat x, y, z, r = 0.5; - x = r * cos(Phi); - y = r * sin(Phi); - z = 1.0; - glProgramLocalParameter4fARB(GL_VERTEX_PROGRAM_ARB, 30, x, y, z, 1); - glDisable(GL_VERTEX_PROGRAM_ARB); - glBegin(GL_POINTS); - glColor3f(1,1,1); - glVertex3f(x, y, z); - glEnd(); - } - - glEnable(GL_VERTEX_PROGRAM_ARB); - DrawMesh(8, 8); - glPopMatrix(); - - glutSwapBuffers(); -} - - -static void Reshape( int width, int height ) -{ - float ar = (float) width / (float) height; - glViewport( 0, 0, width, height ); - glMatrixMode( GL_PROJECTION ); - glLoadIdentity(); - glFrustum( -1.0 * ar, 1.0 * ar, -1.0, 1.0, 5.0, 25.0 ); - glMatrixMode( GL_MODELVIEW ); - glLoadIdentity(); - glTranslatef( 0.0, 0.0, -12.0 ); - glScalef(2, 2, 2); -} - - -static void Key( unsigned char key, int x, int y ) -{ - (void) x; - (void) y; - switch (key) { - case 'a': - Anim = !Anim; - if (Anim) - glutIdleFunc(Idle); - else - glutIdleFunc(NULL); - break; - case 'p': - Phi += 0.2; - break; - case 'z': - Zrot -= 5.0; - break; - case 'Z': - Zrot += 5.0; - break; - case 27: - exit(0); - break; - } - glutPostRedisplay(); -} - - -static void SpecialKey( int key, int x, int y ) -{ - const GLfloat step = 3.0; - (void) x; - (void) y; - switch (key) { - case GLUT_KEY_UP: - Xrot -= step; - break; - case GLUT_KEY_DOWN: - Xrot += step; - break; - case GLUT_KEY_LEFT: - Yrot -= step; - break; - case GLUT_KEY_RIGHT: - Yrot += step; - break; - } - glutPostRedisplay(); -} - - -static void Init( void ) -{ - GLuint prognum; - GLint errno; - - /* - * c[0..3] = modelview matrix - * c[4..7] = inverse modelview matrix - * c[30] = gravity source location - * c[31] = gravity source strength - * c[32] = light pos - * c[35] = diffuse color - */ - static const char prog[] = - "!!ARBvp1.0\n" - "TEMP R1, R2, R3; " - - "# Compute distance from vertex to gravity source\n" - "ADD R1, program.local[30], -vertex.position; # vector from vertex to gravity\n" - "DP3 R2, R1, R1; # dot product\n" - "RSQ R2, R2.x; # square root = distance\n" - "MUL R2, R2, program.local[31].xxxx; # scale by the gravity factor\n" - - "# Displace vertex by gravity factor along R1 vector\n" - "MAD R3, R1, R2, vertex.position;\n" - - "# Continue with typical modelview/projection\n" - "DP4 result.position.x, state.matrix.mvp.row[0], R3 ; # object x MVP -> clip\n" - "DP4 result.position.y, state.matrix.mvp.row[1], R3 ;\n" - "DP4 result.position.z, state.matrix.mvp.row[2], R3 ;\n" - "DP4 result.position.w, state.matrix.mvp.row[3], R3 ;\n" - - "MOV result.color, vertex.attrib[3];\n # copy input color to output color\n" - - "END"; - - if (!glutExtensionSupported("GL_ARB_vertex_program")) { - printf("Sorry, this program requires GL_ARB_vertex_program\n"); - exit(1); - } - - glGenProgramsARB(1, &prognum); - glBindProgramARB(GL_VERTEX_PROGRAM_ARB, prognum); - glProgramStringARB(GL_VERTEX_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, - strlen(prog), (const GLubyte *)prog); - errno = glGetError(); - printf("glGetError = %d\n", errno); - - if (errno != GL_NO_ERROR) - { - GLint errorpos; - - glGetIntegerv(GL_PROGRAM_ERROR_POSITION_ARB, &errorpos); - printf("errorpos: %d\n", errorpos); - printf("%s\n", glGetString(GL_PROGRAM_ERROR_STRING_ARB)); - } - - /* Light position */ - glProgramLocalParameter4fARB(GL_VERTEX_PROGRAM_ARB, 32, 2, 2, 4, 1); - /* Diffuse material color */ - glProgramLocalParameter4fARB(GL_VERTEX_PROGRAM_ARB, 35, 0.25, 0, 0.25, 1); - - /* Gravity strength */ - glProgramLocalParameter4fARB(GL_VERTEX_PROGRAM_ARB, 31, .5, 0, 0, 0); - - glEnable(GL_DEPTH_TEST); - glClearColor(0.3, 0.3, 0.3, 1); - glShadeModel(GL_FLAT); - glPointSize(3); -} - - -int main( int argc, char *argv[] ) -{ - glutInit( &argc, argv ); - glutInitWindowPosition( 0, 0 ); - glutInitWindowSize( 250, 250 ); - glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH ); - glutCreateWindow(argv[0]); - glutReshapeFunc( Reshape ); - glutKeyboardFunc( Key ); - glutSpecialFunc( SpecialKey ); - glutDisplayFunc( Display ); - if (Anim) - glutIdleFunc(Idle); - Init(); - glutMainLoop(); - return 0; -} diff --git a/progs/tests/arraytexture.c b/progs/tests/arraytexture.c deleted file mode 100644 index 48c622be30..0000000000 --- a/progs/tests/arraytexture.c +++ /dev/null @@ -1,337 +0,0 @@ -/* - * (C) Copyright IBM Corporation 2007 - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * on the rights to use, copy, modify, merge, publish, distribute, sub - * license, and/or sell copies of the Software, and to permit persons to whom - * the Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL - * IBM AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. - */ - -/** - * \file arraytexture.c - * - * - * \author Ian Romanick - */ - -#include -#include -#include -#include -#include -#include -#include - -#if !defined(GL_EXT_texture_array) && !defined(GL_MESA_texture_array) -# error "This demo requires enums for either GL_EXT_texture_array or GL_MESA_texture_array to build." -#endif - -#include "readtex.h" - -#define GL_CHECK_ERROR() \ - do { \ - GLenum err = glGetError(); \ - if (err) { \ - printf("%s:%u: %s (0x%04x)\n", __FILE__, __LINE__, \ - gluErrorString(err), err); \ - } \ - } while (0) - -static const char *const textures[] = { - "../images/girl.rgb", - "../images/girl2.rgb", - "../images/arch.rgb", - "../images/s128.rgb", - - "../images/tree3.rgb", - "../images/bw.rgb", - "../images/reflect.rgb", - "../images/wrs_logo.rgb", - NULL -}; - -static const char frag_prog[] = - "!!ARBfp1.0\n" - "OPTION MESA_texture_array;\n" - "TEX result.color, fragment.texcoord[0], texture[0], ARRAY2D;\n" - "END\n"; - -static GLfloat Xrot = 0, Yrot = -30, Zrot = 0; -static GLfloat texZ = 0.0; -static GLfloat texZ_dir = 0.01; -static GLint num_layers; - -static PFNGLBINDPROGRAMARBPROC bind_program; -static PFNGLPROGRAMSTRINGARBPROC program_string; -static PFNGLGENPROGRAMSARBPROC gen_programs; - - -static void -PrintString(const char *s) -{ - while (*s) { - glutBitmapCharacter(GLUT_BITMAP_8_BY_13, (int) *s); - s++; - } -} - - -static void Idle(void) -{ - static int lastTime = 0; - int t = glutGet(GLUT_ELAPSED_TIME); - - if (lastTime == 0) - lastTime = t; - else if (t - lastTime < 10) - return; - - lastTime = t; - - texZ += texZ_dir; - if ((texZ < 0.0) || ((GLint) texZ > num_layers)) { - texZ_dir = -texZ_dir; - } - - glutPostRedisplay(); -} - - -static void Display(void) -{ - char str[100]; - - glClear(GL_COLOR_BUFFER_BIT); - - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glOrtho(-1, 1, -1, 1, -1, 1); - glMatrixMode(GL_MODELVIEW); - glLoadIdentity(); - - (*bind_program)(GL_FRAGMENT_PROGRAM_ARB, 0); - glColor3f(1,1,1); - glRasterPos3f(-0.9, -0.9, 0.0); - sprintf(str, "Texture Z coordinate = %4.1f", texZ); - PrintString(str); - - (*bind_program)(GL_FRAGMENT_PROGRAM_ARB, 1); - GL_CHECK_ERROR(); - glEnable(GL_TEXTURE_2D_ARRAY_EXT); - GL_CHECK_ERROR(); - - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glFrustum(-1.0, 1.0, -1.0, 1.0, 5.0, 25.0); - glMatrixMode(GL_MODELVIEW); - glLoadIdentity(); - glTranslatef(0.0, 0.0, -8.0); - - glPushMatrix(); - glRotatef(Xrot, 1, 0, 0); - glRotatef(Yrot, 0, 1, 0); - glRotatef(Zrot, 0, 0, 1); - - glBegin(GL_QUADS); - glTexCoord3f(0.0, 0.0, texZ); glVertex2f(-1.0, -1.0); - glTexCoord3f(2.0, 0.0, texZ); glVertex2f(1.0, -1.0); - glTexCoord3f(2.0, 2.0, texZ); glVertex2f(1.0, 1.0); - glTexCoord3f(0.0, 2.0, texZ); glVertex2f(-1.0, 1.0); - glEnd(); - - glPopMatrix(); - - glDisable(GL_TEXTURE_2D_ARRAY_EXT); - GL_CHECK_ERROR(); - (*bind_program)(GL_FRAGMENT_PROGRAM_ARB, 0); - GL_CHECK_ERROR(); - - glutSwapBuffers(); -} - - -static void Reshape(int width, int height) -{ - glViewport(0, 0, width, height); -} - - -static void Key(unsigned char key, int x, int y) -{ - (void) x; - (void) y; - switch (key) { - case 27: - exit(0); - break; - } - glutPostRedisplay(); -} - - -static void SpecialKey(int key, int x, int y) -{ - const GLfloat step = 3.0; - (void) x; - (void) y; - switch (key) { - case GLUT_KEY_UP: - Xrot -= step; - break; - case GLUT_KEY_DOWN: - Xrot += step; - break; - case GLUT_KEY_LEFT: - Yrot -= step; - break; - case GLUT_KEY_RIGHT: - Yrot += step; - break; - } - glutPostRedisplay(); -} - - -static int FindLine(const char *program, int position) -{ - int i, line = 1; - for (i = 0; i < position; i++) { - if (program[i] == '\n') - line++; - } - return line; -} - - -static void -compile_fragment_program(GLuint id, const char *prog) -{ - int errorPos; - int err; - - err = glGetError(); - (*bind_program)(GL_FRAGMENT_PROGRAM_ARB, id); - (*program_string)(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, - strlen(prog), (const GLubyte *) prog); - - glGetIntegerv(GL_PROGRAM_ERROR_POSITION_ARB, &errorPos); - err = glGetError(); - if (err != GL_NO_ERROR || errorPos != -1) { - int l = FindLine(prog, errorPos); - - printf("Fragment Program Error (err=%d, pos=%d line=%d): %s\n", - err, errorPos, l, - (char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB)); - exit(0); - } -} - - -static void require_extension(const char *ext) -{ - if (!glutExtensionSupported(ext)) { - printf("Sorry, %s not supported by this renderer.\n", ext); - exit(1); - } -} - - -static void Init(void) -{ - const char *const ver_string = (const char *const) glGetString(GL_VERSION); - unsigned i; - - printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - printf("GL_VERSION = %s\n", ver_string); - - require_extension("GL_ARB_fragment_program"); - require_extension("GL_MESA_texture_array"); - require_extension("GL_SGIS_generate_mipmap"); - - bind_program = glutGetProcAddress("glBindProgramARB"); - program_string = glutGetProcAddress("glProgramStringARB"); - gen_programs = glutGetProcAddress("glGenProgramsARB"); - - - for (num_layers = 0; textures[num_layers] != NULL; num_layers++) - /* empty */ ; - - glBindTexture(GL_TEXTURE_2D_ARRAY_EXT, 1); - glTexImage3D(GL_TEXTURE_2D_ARRAY_EXT, 0, GL_RGB8, - 256, 256, num_layers, 0, GL_RGB, GL_UNSIGNED_BYTE, NULL); - GL_CHECK_ERROR(); - - glTexParameteri(GL_TEXTURE_2D_ARRAY_EXT, GL_GENERATE_MIPMAP_SGIS, - GL_TRUE); - - for (i = 0; textures[i] != NULL; i++) { - GLint width, height; - GLenum format; - - GLubyte *image = LoadRGBImage(textures[i], &width, &height, &format); - if (!image) { - printf("Error: could not load texture image %s\n", textures[i]); - exit(1); - } - - /* resize to 256 x 256 */ - if (width != 256 || height != 256) { - GLubyte *newImage = malloc(256 * 256 * 4); - gluScaleImage(format, width, height, GL_UNSIGNED_BYTE, image, - 256, 256, GL_UNSIGNED_BYTE, newImage); - free(image); - image = newImage; - } - - glTexSubImage3D(GL_TEXTURE_2D_ARRAY_EXT, 0, - 0, 0, i, 256, 256, 1, - format, GL_UNSIGNED_BYTE, image); - free(image); - } - GL_CHECK_ERROR(); - - glTexParameteri(GL_TEXTURE_2D_ARRAY_EXT, GL_TEXTURE_WRAP_S, GL_REPEAT); - glTexParameteri(GL_TEXTURE_2D_ARRAY_EXT, GL_TEXTURE_WRAP_T, GL_REPEAT); - glTexParameteri(GL_TEXTURE_2D_ARRAY_EXT, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE); - - glTexParameteri(GL_TEXTURE_2D_ARRAY_EXT, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); - GL_CHECK_ERROR(); - glTexParameteri(GL_TEXTURE_2D_ARRAY_EXT, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - GL_CHECK_ERROR(); - - compile_fragment_program(1, frag_prog); - GL_CHECK_ERROR(); -} - - -int main(int argc, char *argv[]) -{ - glutInit(&argc, argv); - glutInitWindowPosition(0, 0); - glutInitWindowSize(350, 350); - glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE); - glutCreateWindow("Array texture test"); - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutSpecialFunc(SpecialKey); - glutDisplayFunc(Display); - glutIdleFunc(Idle); - Init(); - glutMainLoop(); - return 0; -} diff --git a/progs/tests/auxbuffer.c b/progs/tests/auxbuffer.c deleted file mode 100644 index 70f0b73910..0000000000 --- a/progs/tests/auxbuffer.c +++ /dev/null @@ -1,499 +0,0 @@ -/* - * Test AUX buffer rendering - * Use GLX since GLUT doesn't support AUX buffers - */ - - -/* - * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -/* - * This is a port of the infamous "gears" demo to straight GLX (i.e. no GLUT) - * Port by Brian Paul 23 March 2001 - * - * Command line options: - * -info print GL implementation information - * - */ - - -#include -#include -#include -#include -#include -#include -#include -#include - - -static int -current_time(void) -{ - return 0; -} - - - - -#ifndef M_PI -#define M_PI 3.14159265 -#endif - -static int WinWidth = 300, WinHeight = 300; -static GLfloat view_rotx = 20.0, view_roty = 30.0, view_rotz = 0.0; -static GLint gear1, gear2, gear3; -static GLfloat angle = 0.0; - - -/* - * - * Draw a gear wheel. You'll probably want to call this function when - * building a display list since we do a lot of trig here. - * - * Input: inner_radius - radius of hole at center - * outer_radius - radius at center of teeth - * width - width of gear - * teeth - number of teeth - * tooth_depth - depth of tooth - */ -static void -gear(GLfloat inner_radius, GLfloat outer_radius, GLfloat width, - GLint teeth, GLfloat tooth_depth) -{ - GLint i; - GLfloat r0, r1, r2; - GLfloat angle, da; - GLfloat u, v, len; - - r0 = inner_radius; - r1 = outer_radius - tooth_depth / 2.0; - r2 = outer_radius + tooth_depth / 2.0; - - da = 2.0 * M_PI / teeth / 4.0; - - glShadeModel(GL_FLAT); - - glNormal3f(0.0, 0.0, 1.0); - - /* draw front face */ - glBegin(GL_QUAD_STRIP); - for (i = 0; i <= teeth; i++) { - angle = i * 2.0 * M_PI / teeth; - glVertex3f(r0 * cos(angle), r0 * sin(angle), width * 0.5); - glVertex3f(r1 * cos(angle), r1 * sin(angle), width * 0.5); - if (i < teeth) { - glVertex3f(r0 * cos(angle), r0 * sin(angle), width * 0.5); - glVertex3f(r1 * cos(angle + 3 * da), r1 * sin(angle + 3 * da), - width * 0.5); - } - } - glEnd(); - - /* draw front sides of teeth */ - glBegin(GL_QUADS); - da = 2.0 * M_PI / teeth / 4.0; - for (i = 0; i < teeth; i++) { - angle = i * 2.0 * M_PI / teeth; - - glVertex3f(r1 * cos(angle), r1 * sin(angle), width * 0.5); - glVertex3f(r2 * cos(angle + da), r2 * sin(angle + da), width * 0.5); - glVertex3f(r2 * cos(angle + 2 * da), r2 * sin(angle + 2 * da), - width * 0.5); - glVertex3f(r1 * cos(angle + 3 * da), r1 * sin(angle + 3 * da), - width * 0.5); - } - glEnd(); - - glNormal3f(0.0, 0.0, -1.0); - - /* draw back face */ - glBegin(GL_QUAD_STRIP); - for (i = 0; i <= teeth; i++) { - angle = i * 2.0 * M_PI / teeth; - glVertex3f(r1 * cos(angle), r1 * sin(angle), -width * 0.5); - glVertex3f(r0 * cos(angle), r0 * sin(angle), -width * 0.5); - if (i < teeth) { - glVertex3f(r1 * cos(angle + 3 * da), r1 * sin(angle + 3 * da), - -width * 0.5); - glVertex3f(r0 * cos(angle), r0 * sin(angle), -width * 0.5); - } - } - glEnd(); - - /* draw back sides of teeth */ - glBegin(GL_QUADS); - da = 2.0 * M_PI / teeth / 4.0; - for (i = 0; i < teeth; i++) { - angle = i * 2.0 * M_PI / teeth; - - glVertex3f(r1 * cos(angle + 3 * da), r1 * sin(angle + 3 * da), - -width * 0.5); - glVertex3f(r2 * cos(angle + 2 * da), r2 * sin(angle + 2 * da), - -width * 0.5); - glVertex3f(r2 * cos(angle + da), r2 * sin(angle + da), -width * 0.5); - glVertex3f(r1 * cos(angle), r1 * sin(angle), -width * 0.5); - } - glEnd(); - - /* draw outward faces of teeth */ - glBegin(GL_QUAD_STRIP); - for (i = 0; i < teeth; i++) { - angle = i * 2.0 * M_PI / teeth; - - glVertex3f(r1 * cos(angle), r1 * sin(angle), width * 0.5); - glVertex3f(r1 * cos(angle), r1 * sin(angle), -width * 0.5); - u = r2 * cos(angle + da) - r1 * cos(angle); - v = r2 * sin(angle + da) - r1 * sin(angle); - len = sqrt(u * u + v * v); - u /= len; - v /= len; - glNormal3f(v, -u, 0.0); - glVertex3f(r2 * cos(angle + da), r2 * sin(angle + da), width * 0.5); - glVertex3f(r2 * cos(angle + da), r2 * sin(angle + da), -width * 0.5); - glNormal3f(cos(angle), sin(angle), 0.0); - glVertex3f(r2 * cos(angle + 2 * da), r2 * sin(angle + 2 * da), - width * 0.5); - glVertex3f(r2 * cos(angle + 2 * da), r2 * sin(angle + 2 * da), - -width * 0.5); - u = r1 * cos(angle + 3 * da) - r2 * cos(angle + 2 * da); - v = r1 * sin(angle + 3 * da) - r2 * sin(angle + 2 * da); - glNormal3f(v, -u, 0.0); - glVertex3f(r1 * cos(angle + 3 * da), r1 * sin(angle + 3 * da), - width * 0.5); - glVertex3f(r1 * cos(angle + 3 * da), r1 * sin(angle + 3 * da), - -width * 0.5); - glNormal3f(cos(angle), sin(angle), 0.0); - } - - glVertex3f(r1 * cos(0), r1 * sin(0), width * 0.5); - glVertex3f(r1 * cos(0), r1 * sin(0), -width * 0.5); - - glEnd(); - - glShadeModel(GL_SMOOTH); - - /* draw inside radius cylinder */ - glBegin(GL_QUAD_STRIP); - for (i = 0; i <= teeth; i++) { - angle = i * 2.0 * M_PI / teeth; - glNormal3f(-cos(angle), -sin(angle), 0.0); - glVertex3f(r0 * cos(angle), r0 * sin(angle), -width * 0.5); - glVertex3f(r0 * cos(angle), r0 * sin(angle), width * 0.5); - } - glEnd(); -} - - -static void -draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); - - glPushMatrix(); - glRotatef(view_rotx, 1.0, 0.0, 0.0); - glRotatef(view_roty, 0.0, 1.0, 0.0); - glRotatef(view_rotz, 0.0, 0.0, 1.0); - - glPushMatrix(); - glTranslatef(-3.0, -2.0, 0.0); - glRotatef(angle, 0.0, 0.0, 1.0); - glCallList(gear1); - glPopMatrix(); - - glPushMatrix(); - glTranslatef(3.1, -2.0, 0.0); - glRotatef(-2.0 * angle - 9.0, 0.0, 0.0, 1.0); - glCallList(gear2); - glPopMatrix(); - - glPushMatrix(); - glTranslatef(-3.1, 4.2, 0.0); - glRotatef(-2.0 * angle - 25.0, 0.0, 0.0, 1.0); - glCallList(gear3); - glPopMatrix(); - - glPopMatrix(); -} - - -/* new window size or exposure */ -static void -reshape(int width, int height) -{ - GLfloat h = (GLfloat) height / (GLfloat) width; - - WinWidth = width; - WinHeight = height; - glViewport(0, 0, (GLint) width, (GLint) height); - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glFrustum(-1.0, 1.0, -h, h, 5.0, 60.0); - glMatrixMode(GL_MODELVIEW); - glLoadIdentity(); - glTranslatef(0.0, 0.0, -40.0); -} - - -static void -init(void) -{ - static GLfloat pos[4] = { 5.0, 5.0, 10.0, 0.0 }; - static GLfloat red[4] = { 0.8, 0.1, 0.0, 1.0 }; - static GLfloat green[4] = { 0.0, 0.8, 0.2, 1.0 }; - static GLfloat blue[4] = { 0.2, 0.2, 1.0, 1.0 }; - int i; - - glGetIntegerv(GL_AUX_BUFFERS, &i); - printf("AUX BUFFERS: %d\n", i); - - glLightfv(GL_LIGHT0, GL_POSITION, pos); - glEnable(GL_CULL_FACE); - glEnable(GL_LIGHTING); - glEnable(GL_LIGHT0); - glEnable(GL_DEPTH_TEST); - - /* make the gears */ - gear1 = glGenLists(1); - glNewList(gear1, GL_COMPILE); - glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, red); - gear(1.0, 4.0, 1.0, 20, 0.7); - glEndList(); - - gear2 = glGenLists(1); - glNewList(gear2, GL_COMPILE); - glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, green); - gear(0.5, 2.0, 2.0, 10, 0.7); - glEndList(); - - gear3 = glGenLists(1); - glNewList(gear3, GL_COMPILE); - glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, blue); - gear(1.3, 2.0, 0.5, 10, 0.7); - glEndList(); - - glEnable(GL_NORMALIZE); -} - - -/* - * Create an RGB, double-buffered window. - * Return the window and context handles. - */ -static void -make_window( Display *dpy, const char *name, - int x, int y, int width, int height, - Window *winRet, GLXContext *ctxRet) -{ - int attrib[] = { GLX_RGBA, - GLX_RED_SIZE, 1, - GLX_GREEN_SIZE, 1, - GLX_BLUE_SIZE, 1, - GLX_DOUBLEBUFFER, - GLX_DEPTH_SIZE, 1, - GLX_AUX_BUFFERS, 1, - None }; - int scrnum; - XSetWindowAttributes attr; - unsigned long mask; - Window root; - Window win; - GLXContext ctx; - XVisualInfo *visinfo; - - scrnum = DefaultScreen( dpy ); - root = RootWindow( dpy, scrnum ); - - visinfo = glXChooseVisual( dpy, scrnum, attrib ); - if (!visinfo) { - printf("Error: couldn't get an RGB, Double-buffered visual\n"); - exit(1); - } - - /* window attributes */ - attr.background_pixel = 0; - attr.border_pixel = 0; - attr.colormap = XCreateColormap( dpy, root, visinfo->visual, AllocNone); - attr.event_mask = StructureNotifyMask | ExposureMask | KeyPressMask; - mask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask; - - win = XCreateWindow( dpy, root, 0, 0, width, height, - 0, visinfo->depth, InputOutput, - visinfo->visual, mask, &attr ); - - /* set hints and properties */ - { - XSizeHints sizehints; - sizehints.x = x; - sizehints.y = y; - sizehints.width = width; - sizehints.height = height; - sizehints.flags = USSize | USPosition; - XSetNormalHints(dpy, win, &sizehints); - XSetStandardProperties(dpy, win, name, name, - None, (char **)NULL, 0, &sizehints); - } - - ctx = glXCreateContext( dpy, visinfo, NULL, True ); - if (!ctx) { - printf("Error: glXCreateContext failed\n"); - exit(1); - } - - XFree(visinfo); - - *winRet = win; - *ctxRet = ctx; -} - - -static void -event_loop(Display *dpy, Window win) -{ - while (1) { - while (XPending(dpy) > 0) { - XEvent event; - XNextEvent(dpy, &event); - switch (event.type) { - case Expose: - /* we'll redraw below */ - break; - case ConfigureNotify: - reshape(event.xconfigure.width, event.xconfigure.height); - break; - case KeyPress: - { - char buffer[10]; - int r, code; - code = XLookupKeysym(&event.xkey, 0); - if (code == XK_Left) { - view_roty += 5.0; - } - else if (code == XK_Right) { - view_roty -= 5.0; - } - else if (code == XK_Up) { - view_rotx += 5.0; - } - else if (code == XK_Down) { - view_rotx -= 5.0; - } - else { - r = XLookupString(&event.xkey, buffer, sizeof(buffer), - NULL, NULL); - if (buffer[0] == 27) { - /* escape */ - return; - } - } - } - } - } - - /* next frame */ - angle += 2.0; - - /* draw to aux buffer */ - glDrawBuffer(GL_AUX0); - - draw(); - - /* Copy aux buffer image to back color buffer */ - glReadBuffer(GL_AUX0); - glDrawBuffer(GL_BACK); - glWindowPos2iARB(0, 0); - glDisable(GL_DEPTH_TEST); - glCopyPixels(0, 0, WinWidth, WinHeight, GL_COLOR); - glEnable(GL_DEPTH_TEST); - - glXSwapBuffers(dpy, win); - - /* calc framerate */ - { - static int t0 = -1; - static int frames = 0; - int t = current_time(); - - if (t0 < 0) - t0 = t; - - frames++; - - if (t - t0 >= 5.0) { - GLfloat seconds = t - t0; - GLfloat fps = frames / seconds; - printf("%d frames in %3.1f seconds = %6.3f FPS\n", frames, seconds, - fps); - t0 = t; - frames = 0; - } - } - } -} - - -int -main(int argc, char *argv[]) -{ - Display *dpy; - Window win; - GLXContext ctx; - char *dpyName = ":0"; - GLboolean printInfo = GL_FALSE; - int i; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-display") == 0) { - dpyName = argv[i+1]; - i++; - } - else if (strcmp(argv[i], "-info") == 0) { - printInfo = GL_TRUE; - } - } - - dpy = XOpenDisplay(dpyName); - if (!dpy) { - printf("Error: couldn't open display %s\n", dpyName); - return -1; - } - - make_window(dpy, "glxgears", 0, 0, WinWidth, WinHeight, &win, &ctx); - XMapWindow(dpy, win); - glXMakeCurrent(dpy, win, ctx); - - if (printInfo) { - printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - printf("GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - printf("GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - printf("GL_EXTENSIONS = %s\n", (char *) glGetString(GL_EXTENSIONS)); - } - - init(); - - event_loop(dpy, win); - - glXDestroyContext(dpy, ctx); - XDestroyWindow(dpy, win); - XCloseDisplay(dpy); - - return 0; -} diff --git a/progs/tests/blendminmax.c b/progs/tests/blendminmax.c deleted file mode 100644 index 2aab1a39d2..0000000000 --- a/progs/tests/blendminmax.c +++ /dev/null @@ -1,209 +0,0 @@ -/* - * (C) Copyright IBM Corporation 2004 - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * on the rights to use, copy, modify, merge, publish, distribute, sub - * license, and/or sell copies of the Software, and to permit persons to whom - * the Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL - * VA LINUX SYSTEM, IBM AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, - * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR - * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE - * USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -/** - * \file blendminmax.c - * - * Simple test of GL_EXT_blend_minmax functionality. Four squares are drawn - * with different blending modes, but all should be rendered with the same - * final color. - * - * \author Ian Romanick - */ - -#include -#include -#include - -static int Width = 400; -static int Height = 200; -static const GLfloat Near = 5.0, Far = 25.0; - - -static void Display( void ) -{ - glClearColor(0.2, 0.2, 0.8, 0); - glClear( GL_COLOR_BUFFER_BIT ); - - glPushMatrix(); - - /* This is the "reference" square. - */ - - glTranslatef(-4.5, 0, 0); - glBlendEquation( GL_FUNC_ADD ); - glBlendFunc( GL_ONE, GL_ZERO ); - glBegin(GL_QUADS); - glColor3f( 0.5, 0.5, 0.5 ); - glVertex2f(-1, -1); - glVertex2f( 1, -1); - glVertex2f( 1, 1); - glVertex2f(-1, 1); - glEnd(); - - - /* GL_MIN and GL_MAX are supposed to ignore the blend function setting. - * To test that, we set the blend function to GL_ZERO for both color and - * alpha each time GL_MIN or GL_MAX is used. - * - * Apple ships an extension called GL_ATI_blend_weighted_minmax (supported - * on Mac OS X 10.2 and later). I believe the difference with that - * extension is that it uses the blend function. However, I have no idea - * what the enums are for it. The extension is listed at Apple's developer - * site, but there is no documentation. - * - * http://developer.apple.com/opengl/extensions.html - */ - - glTranslatef(3.0, 0, 0); - glBlendEquation( GL_FUNC_ADD ); - glBlendFunc( GL_ONE, GL_ZERO ); - glBegin(GL_QUADS); - glColor3f( 0.5, 0.5, 0.5 ); - glVertex2f(-1, -1); - glVertex2f( 1, -1); - glVertex2f( 1, 1); - glVertex2f(-1, 1); - glEnd(); - - glBlendEquation( GL_MAX ); - glBlendFunc( GL_ZERO, GL_ZERO ); - glBegin(GL_QUADS); - glColor3f( 0.2, 0.2, 0.2 ); - glVertex2f(-1, -1); - glVertex2f( 1, -1); - glVertex2f( 1, 1); - glVertex2f(-1, 1); - glEnd(); - - - glTranslatef(3.0, 0, 0); - glBlendEquation( GL_FUNC_ADD ); - glBlendFunc( GL_ONE, GL_ZERO ); - glBegin(GL_QUADS); - glColor3f( 0.5, 0.5, 0.5 ); - glVertex2f(-1, -1); - glVertex2f( 1, -1); - glVertex2f( 1, 1); - glVertex2f(-1, 1); - glEnd(); - - glBlendEquation( GL_MIN ); - glBlendFunc( GL_ZERO, GL_ZERO ); - glBegin(GL_QUADS); - glColor3f( 0.8, 0.8, 0.8 ); - glVertex2f(-1, -1); - glVertex2f( 1, -1); - glVertex2f( 1, 1); - glVertex2f(-1, 1); - glEnd(); - - - glTranslatef(3.0, 0, 0); - glBlendEquation( GL_FUNC_ADD ); - glBlendFunc( GL_ONE, GL_ZERO ); - glBegin(GL_QUADS); - glColor3f( 0.8, 0.8, 0.8 ); - glVertex2f(-1, -1); - glVertex2f( 1, -1); - glVertex2f( 1, 1); - glVertex2f(-1, 1); - glEnd(); - - glBlendEquation( GL_MIN ); - glBlendFunc( GL_ZERO, GL_ZERO ); - glBegin(GL_QUADS); - glColor3f( 0.5, 0.5, 0.5 ); - glVertex2f(-1, -1); - glVertex2f( 1, -1); - glVertex2f( 1, 1); - glVertex2f(-1, 1); - glEnd(); - - glPopMatrix(); - - glutSwapBuffers(); -} - - -static void Reshape( int width, int height ) -{ - GLfloat ar = (float) width / (float) height; - Width = width; - Height = height; - glViewport( 0, 0, width, height ); - glMatrixMode( GL_PROJECTION ); - glLoadIdentity(); - glFrustum( -ar, ar, -1.0, 1.0, Near, Far ); - glMatrixMode( GL_MODELVIEW ); - glLoadIdentity(); - glTranslatef( 0.0, 0.0, -15.0 ); -} - - -static void Key( unsigned char key, int x, int y ) -{ - (void) x; - (void) y; - switch (key) { - case 27: - exit(0); - break; - } - glutPostRedisplay(); -} - - -static void Init( void ) -{ - const char * const ver_string = (const char * const) - glGetString( GL_VERSION ); - - printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - printf("GL_VERSION = %s\n", ver_string); - - if ( !glutExtensionSupported("GL_ARB_imaging") && !glutExtensionSupported("GL_EXT_blend_minmax")) { - printf("Sorry, this program requires either GL_ARB_imaging or GL_EXT_blend_minmax.\n"); - exit(1); - } - - printf("\nAll 4 squares should be the same color.\n"); - glEnable( GL_BLEND ); -} - - -int main( int argc, char *argv[] ) -{ - glutInit( &argc, argv ); - glutInitWindowPosition( 0, 0 ); - glutInitWindowSize( Width, Height ); - glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE ); - glutCreateWindow( "GL_EXT_blend_minmax test" ); - glutReshapeFunc( Reshape ); - glutKeyboardFunc( Key ); - glutDisplayFunc( Display ); - Init(); - glutMainLoop(); - return 0; -} diff --git a/progs/tests/blendsquare.c b/progs/tests/blendsquare.c deleted file mode 100644 index 1694866a55..0000000000 --- a/progs/tests/blendsquare.c +++ /dev/null @@ -1,178 +0,0 @@ -/* - * (C) Copyright IBM Corporation 2004 - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * on the rights to use, copy, modify, merge, publish, distribute, sub - * license, and/or sell copies of the Software, and to permit persons to whom - * the Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL - * VA LINUX SYSTEM, IBM AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, - * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR - * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE - * USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -/** - * \file blendsquare.c - * - * Simple test of GL_NV_blend_square functionality. Four squares are drawn - * with different blending modes, but all should be rendered with the same - * final color. - * - * \author Ian Romanick - */ - -#include -#include -#include - -static int Width = 400; -static int Height = 200; -static const GLfloat Near = 5.0, Far = 25.0; - - -static void Display( void ) -{ - glClearColor(0.2, 0.2, 0.8, 0); - glClear( GL_COLOR_BUFFER_BIT ); - - glPushMatrix(); - - glTranslatef(-4.5, 0, 0); - glBlendFunc( GL_ONE, GL_ZERO ); - glBegin(GL_QUADS); - glColor3f( 0.5 * 0.5, 0.5 * 0.5, 0.5 * 0.5 ); - glVertex2f(-1, -1); - glVertex2f( 1, -1); - glVertex2f( 1, 1); - glVertex2f(-1, 1); - glEnd(); - - - glTranslatef(3.0, 0, 0); - glBlendFunc( GL_ONE, GL_ZERO ); - glBegin(GL_QUADS); - glColor3f( 0.5, 0.5, 0.5 ); - glVertex2f(-1, -1); - glVertex2f( 1, -1); - glVertex2f( 1, 1); - glVertex2f(-1, 1); - glEnd(); - - glBlendFunc( GL_DST_COLOR, GL_ZERO ); - glBegin(GL_QUADS); - glVertex2f(-1, -1); - glVertex2f( 1, -1); - glVertex2f( 1, 1); - glVertex2f(-1, 1); - glEnd(); - - - glTranslatef(3.0, 0, 0); - glBlendFunc( GL_SRC_COLOR, GL_ZERO ); - glBegin(GL_QUADS); - glVertex2f(-1, -1); - glVertex2f( 1, -1); - glVertex2f( 1, 1); - glVertex2f(-1, 1); - glEnd(); - - - glTranslatef(3.0, 0, 0); - glBlendFunc( GL_ONE, GL_ZERO ); - glBegin(GL_QUADS); - glVertex2f(-1, -1); - glVertex2f( 1, -1); - glVertex2f( 1, 1); - glVertex2f(-1, 1); - glEnd(); - - glBlendFunc( GL_ZERO, GL_DST_COLOR ); - glBegin(GL_QUADS); - glVertex2f(-1, -1); - glVertex2f( 1, -1); - glVertex2f( 1, 1); - glVertex2f(-1, 1); - glEnd(); - - glPopMatrix(); - - glutSwapBuffers(); -} - - -static void Reshape( int width, int height ) -{ - GLfloat ar = (float) width / (float) height; - Width = width; - Height = height; - glViewport( 0, 0, width, height ); - glMatrixMode( GL_PROJECTION ); - glLoadIdentity(); - glFrustum( -ar, ar, -1.0, 1.0, Near, Far ); - glMatrixMode( GL_MODELVIEW ); - glLoadIdentity(); - glTranslatef( 0.0, 0.0, -15.0 ); -} - - -static void Key( unsigned char key, int x, int y ) -{ - (void) x; - (void) y; - switch (key) { - case 27: - exit(0); - break; - } - glutPostRedisplay(); -} - - -static void Init( void ) -{ - const char * const ver_string = (const char * const) - glGetString( GL_VERSION ); - const double version = strtod( ver_string, NULL ); - - printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - printf("GL_VERSION = %s\n", ver_string); - - if ( (version < 1.4) && !glutExtensionSupported("GL_NV_blend_square")) { - printf("Sorry, this program requires either OpenGL 1.4 or GL_NV_blend_square\n"); - exit(1); - } - - printf("\nAll 4 squares should be the same color. The two on the left are drawn\n" - "without NV_blend_square functionality, and the two on the right are drawn\n" - "with NV_blend_square functionality. If the two on the left are dark, but\n" - "the two on the right are not, then NV_blend_square is broken.\n"); - glEnable( GL_BLEND ); - glBlendEquation( GL_FUNC_ADD ); -} - - -int main( int argc, char *argv[] ) -{ - glutInit( &argc, argv ); - glutInitWindowPosition( 0, 0 ); - glutInitWindowSize( Width, Height ); - glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE ); - glutCreateWindow( "GL_NV_blend_square test" ); - glutReshapeFunc( Reshape ); - glutKeyboardFunc( Key ); - glutDisplayFunc( Display ); - Init(); - glutMainLoop(); - return 0; -} diff --git a/progs/tests/blendxor.c b/progs/tests/blendxor.c deleted file mode 100644 index 8961a827ea..0000000000 --- a/progs/tests/blendxor.c +++ /dev/null @@ -1,196 +0,0 @@ -/** - * Test XOR emulation with blending. - * - */ - -#define GL_GLEXT_PROTOTYPES -#include -#include -#include -#include -#include "readtex.c" - -#define IMAGE_FILE "../images/arch.rgb" - -static int ImgWidth, ImgHeight; -static GLenum ImgFormat; -static GLubyte *Image = NULL; - -static int Win; -static int Width = 600, Height = 600; - -struct rect -{ - int x0, y0, x1, y1; -}; - -static struct rect OldRect, NewRect; - -static GLboolean ButtonDown = GL_FALSE; -static GLboolean LogicOp = 0*GL_TRUE; - - -static const GLfloat red[4] = {1.0, 0.2, 0.2, 1.0}; -static const GLfloat green[4] = {0.2, 1.0, 0.2, 1.0}; -static const GLfloat blue[4] = {0.2, 0.2, 1.0, 1.0}; - - -static void -PrintString(const char *s) -{ - while (*s) { - glutBitmapCharacter(GLUT_BITMAP_8_BY_13, (int) *s); - s++; - } -} - - -static void -Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - - glWindowPos2i((Width - ImgWidth) / 2, (Height - ImgHeight) / 2); - glDrawPixels(ImgWidth, ImgHeight, ImgFormat, GL_UNSIGNED_BYTE, Image); - - /* - * Draw 2D XOR rects - */ - glColor3f(1, 1, 1); - - glWindowPos2i(100, Height - 20); - PrintString("XOR LogicOp:"); - glLogicOp(GL_XOR); - glEnable(GL_COLOR_LOGIC_OP); - glRecti(100, 30, 250, Height - 30); - glDisable(GL_COLOR_LOGIC_OP); - - glWindowPos2i(Width/2 + 10, Height - 20); - PrintString("Invert Blending:"); - glBlendFunc(GL_ONE, GL_ONE); - glBlendEquation(GL_FUNC_SUBTRACT); - glEnable(GL_BLEND); - glRecti(Width / 2, 30, Width / 2 + 150, Height - 30); - glDisable(GL_BLEND); - - glutSwapBuffers(); -} - - -static void -Reshape(int width, int height) -{ - Width = width; - Height = height; - glViewport(0, 0, width, height); - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glOrtho(0, Width, 0, Height, -1, 1); - glMatrixMode(GL_MODELVIEW); - glLoadIdentity(); -} - - -static void -Key(unsigned char key, int x, int y) -{ - (void) x; - (void) y; - switch (key) { - case 'b': - case 'B': - LogicOp = GL_FALSE; - break; - case 'l': - case 'L': - LogicOp = GL_TRUE; - break; - case 27: - glutDestroyWindow(Win); - exit(0); - break; - } - glutPostRedisplay(); -} - - -static void -SpecialKey(int key, int x, int y) -{ - (void) x; - (void) y; - switch (key) { - case GLUT_KEY_UP: - break; - case GLUT_KEY_DOWN: - break; - case GLUT_KEY_LEFT: - break; - case GLUT_KEY_RIGHT: - break; - } - glutPostRedisplay(); -} - - -static void -MouseMotion(int x, int y) -{ - if (ButtonDown) { - NewRect.x1 = x; - NewRect.y1 = y; - glutPostRedisplay(); - } -} - - -static void -MouseButton(int button, int state, int x, int y) -{ - if (button == GLUT_LEFT_BUTTON && state == GLUT_DOWN) { - ButtonDown = GL_TRUE; - NewRect.x0 = NewRect.x1 = x; - NewRect.y0 = NewRect.y1 = y; - OldRect = NewRect; - } - else if (button == GLUT_LEFT_BUTTON && state == GLUT_UP) { - ButtonDown = GL_FALSE; - } -} - - -static void -Init(void) -{ - /* - * Load image and scale if needed. - */ - Image = LoadRGBImage(IMAGE_FILE, &ImgWidth, &ImgHeight, &ImgFormat); - if (!Image) { - printf("Couldn't read %s\n", IMAGE_FILE); - exit(0); - } - - glPixelStorei(GL_UNPACK_ALIGNMENT, 1); - glPixelStorei(GL_PACK_ALIGNMENT, 1); -} - - -int -main(int argc, char *argv[]) -{ - glutInit(&argc, argv); - glutInitWindowSize(Width, Height); - glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE); - Win = glutCreateWindow(argv[0]); - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutSpecialFunc(SpecialKey); - glutMotionFunc(MouseMotion); - glutMouseFunc(MouseButton); - glutDisplayFunc(Draw); - Init(); - glutPostRedisplay(); - glutMainLoop(); - return 0; -} diff --git a/progs/tests/bufferobj.c b/progs/tests/bufferobj.c deleted file mode 100644 index 50ab5cdfa8..0000000000 --- a/progs/tests/bufferobj.c +++ /dev/null @@ -1,371 +0,0 @@ -/* - * Test GL_ARB_vertex_buffer_object - * - * Brian Paul - * 16 Sep 2003 - */ - - -#define GL_GLEXT_PROTOTYPES -#include -#include -#include -#include -#include - -#define NUM_OBJECTS 10 - -struct object -{ - GLuint BufferID; - GLuint ElementsBufferID; - GLuint NumVerts; - GLuint VertexOffset; - GLuint ColorOffset; - GLuint NumElements; -}; - -static struct object Objects[NUM_OBJECTS]; -static GLuint NumObjects; - -static GLuint Win; - -static GLfloat Xrot = 0, Yrot = 0, Zrot = 0; -static GLboolean Anim = GL_TRUE; - - -static void CheckError(int line) -{ - GLenum err = glGetError(); - if (err) { - printf("GL Error 0x%x at line %d\n", (int) err, line); - } -} - - -static void DrawObject( const struct object *obj ) -{ - glBindBufferARB(GL_ARRAY_BUFFER_ARB, obj->BufferID); - glVertexPointer(3, GL_FLOAT, 0, (void *) obj->VertexOffset); - glEnable(GL_VERTEX_ARRAY); - - /* test push/pop attrib */ - /* XXX this leads to a segfault with NVIDIA's 53.36 driver */ -#if 0 - if (1) - { - glPushClientAttrib(GL_CLIENT_VERTEX_ARRAY_BIT); - /*glVertexPointer(3, GL_FLOAT, 0, (void *) (obj->VertexOffset + 10000));*/ - glBindBufferARB(GL_ARRAY_BUFFER_ARB, 999999); - glPopClientAttrib(); - } -#endif - glColorPointer(3, GL_FLOAT, 0, (void *) obj->ColorOffset); - glEnable(GL_COLOR_ARRAY); - - if (obj->NumElements > 0) { - /* indexed arrays */ - glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, obj->ElementsBufferID); - glDrawElements(GL_LINE_LOOP, obj->NumElements, GL_UNSIGNED_INT, NULL); - } - else { - /* non-indexed arrays */ - glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, 0); - glDrawArrays(GL_LINE_LOOP, 0, obj->NumVerts); - } -} - - -static void Idle( void ) -{ - Zrot = 0.05 * glutGet(GLUT_ELAPSED_TIME); - glutPostRedisplay(); -} - - -static void Display( void ) -{ - int i; - - glClear( GL_COLOR_BUFFER_BIT ); - - for (i = 0; i < NumObjects; i++) { - float x = 5.0 * ((float) i / (NumObjects-1) - 0.5); - glPushMatrix(); - glTranslatef(x, 0, 0); - glRotatef(Xrot, 1, 0, 0); - glRotatef(Yrot, 0, 1, 0); - glRotatef(Zrot, 0, 0, 1); - - DrawObject(Objects + i); - - glPopMatrix(); - } - - CheckError(__LINE__); - glutSwapBuffers(); -} - - -static void Reshape( int width, int height ) -{ - float ar = (float) width / (float) height; - glViewport( 0, 0, width, height ); - glMatrixMode( GL_PROJECTION ); - glLoadIdentity(); - glFrustum( -ar, ar, -1.0, 1.0, 5.0, 25.0 ); - glMatrixMode( GL_MODELVIEW ); - glLoadIdentity(); - glTranslatef( 0.0, 0.0, -15.0 ); -} - - -static void FreeBuffers(void) -{ - int i; - for (i = 0; i < NUM_OBJECTS; i++) - glDeleteBuffersARB(1, &Objects[i].BufferID); -} - - -static void Key( unsigned char key, int x, int y ) -{ - const GLfloat step = 3.0; - (void) x; - (void) y; - switch (key) { - case 'a': - Anim = !Anim; - if (Anim) - glutIdleFunc(Idle); - else - glutIdleFunc(NULL); - break; - case 'z': - Zrot -= step; - break; - case 'Z': - Zrot += step; - break; - case 27: - FreeBuffers(); - glutDestroyWindow(Win); - exit(0); - break; - } - glutPostRedisplay(); -} - - -static void SpecialKey( int key, int x, int y ) -{ - const GLfloat step = 3.0; - (void) x; - (void) y; - switch (key) { - case GLUT_KEY_UP: - Xrot -= step; - break; - case GLUT_KEY_DOWN: - Xrot += step; - break; - case GLUT_KEY_LEFT: - Yrot -= step; - break; - case GLUT_KEY_RIGHT: - Yrot += step; - break; - } - glutPostRedisplay(); -} - - - -static void MakeObject1(struct object *obj) -{ - GLfloat *v, *c; - void *p; - int i; - GLubyte buffer[500]; - - for (i = 0; i < 500; i++) - buffer[i] = i & 0xff; - - obj->BufferID = 0; - glGenBuffersARB(1, &obj->BufferID); - assert(obj->BufferID != 0); - glBindBufferARB(GL_ARRAY_BUFFER_ARB, obj->BufferID); - glBufferDataARB(GL_ARRAY_BUFFER_ARB, 500, buffer, GL_STATIC_DRAW_ARB); - - for (i = 0; i < 500; i++) - buffer[i] = 0; - - glGetBufferSubDataARB(GL_ARRAY_BUFFER_ARB, 0, 500, buffer); - - for (i = 0; i < 500; i++) - assert(buffer[i] == (i & 0xff)); - - glGetBufferParameterivARB(GL_ARRAY_BUFFER_ARB, GL_BUFFER_MAPPED_ARB, &i); - assert(!i); - - glGetBufferParameterivARB(GL_ARRAY_BUFFER_ARB, GL_BUFFER_USAGE_ARB, &i); - - v = (GLfloat *) glMapBufferARB(GL_ARRAY_BUFFER_ARB, GL_WRITE_ONLY_ARB); - - /* do some sanity tests */ - glGetBufferPointervARB(GL_ARRAY_BUFFER_ARB, GL_BUFFER_MAP_POINTER_ARB, &p); - assert(p == v); - - glGetBufferParameterivARB(GL_ARRAY_BUFFER_ARB, GL_BUFFER_SIZE_ARB, &i); - assert(i == 500); - - glGetBufferParameterivARB(GL_ARRAY_BUFFER_ARB, GL_BUFFER_USAGE_ARB, &i); - assert(i == GL_STATIC_DRAW_ARB); - - glGetBufferParameterivARB(GL_ARRAY_BUFFER_ARB, GL_BUFFER_ACCESS_ARB, &i); - assert(i == GL_WRITE_ONLY_ARB); - - glGetBufferParameterivARB(GL_ARRAY_BUFFER_ARB, GL_BUFFER_MAPPED_ARB, &i); - assert(i); - - /* Make rectangle */ - v[0] = -1; v[1] = -1; v[2] = 0; - v[3] = 1; v[4] = -1; v[5] = 0; - v[6] = 1; v[7] = 1; v[8] = 0; - v[9] = -1; v[10] = 1; v[11] = 0; - c = v + 12; - c[0] = 1; c[1] = 0; c[2] = 0; - c[3] = 1; c[4] = 0; c[5] = 0; - c[6] = 1; c[7] = 0; c[8] = 1; - c[9] = 1; c[10] = 0; c[11] = 1; - obj->NumVerts = 4; - obj->VertexOffset = 0; - obj->ColorOffset = 3 * sizeof(GLfloat) * obj->NumVerts; - obj->NumElements = 0; - - glUnmapBufferARB(GL_ARRAY_BUFFER_ARB); - - glGetBufferPointervARB(GL_ARRAY_BUFFER_ARB, GL_BUFFER_MAP_POINTER_ARB, &p); - assert(!p); - - glGetBufferParameterivARB(GL_ARRAY_BUFFER_ARB, GL_BUFFER_MAPPED_ARB, &i); - assert(!i); -} - - -static void MakeObject2(struct object *obj) -{ - GLfloat *v, *c; - - glGenBuffersARB(1, &obj->BufferID); - glBindBufferARB(GL_ARRAY_BUFFER_ARB, obj->BufferID); - glBufferDataARB(GL_ARRAY_BUFFER_ARB, 1000, NULL, GL_STATIC_DRAW_ARB); - v = (GLfloat *) glMapBufferARB(GL_ARRAY_BUFFER_ARB, GL_WRITE_ONLY_ARB); - - /* Make triangle */ - v[0] = -1; v[1] = -1; v[2] = 0; - v[3] = 1; v[4] = -1; v[5] = 0; - v[6] = 0; v[7] = 1; v[8] = 0; - c = v + 9; - c[0] = 0; c[1] = 1; c[2] = 0; - c[3] = 0; c[4] = 1; c[5] = 0; - c[6] = 1; c[7] = 1; c[8] = 0; - obj->NumVerts = 3; - obj->VertexOffset = 0; - obj->ColorOffset = 3 * sizeof(GLfloat) * obj->NumVerts; - obj->NumElements = 0; - - glUnmapBufferARB(GL_ARRAY_BUFFER_ARB); -} - - -static void MakeObject3(struct object *obj) -{ - GLfloat vertexData[1000]; - GLfloat *v, *c; - GLuint *i; - int bytes; - - /* Make rectangle */ - v = vertexData; - v[0] = -1; v[1] = -0.5; v[2] = 0; - v[3] = 1; v[4] = -0.5; v[5] = 0; - v[6] = 1; v[7] = 0.5; v[8] = 0; - v[9] = -1; v[10] = 0.5; v[11] = 0; - c = vertexData + 12; - c[0] = 0; c[1] = 0; c[2] = 1; - c[3] = 0; c[4] = 0; c[5] = 1; - c[6] = 0; c[7] = 1; c[8] = 1; - c[9] = 0; c[10] = 1; c[11] = 1; - obj->NumVerts = 4; - obj->VertexOffset = 0; - obj->ColorOffset = 3 * sizeof(GLfloat) * obj->NumVerts; - - bytes = obj->NumVerts * (3 + 3) * sizeof(GLfloat); - - /* Don't use glMap/UnmapBuffer for this object */ - glGenBuffersARB(1, &obj->BufferID); - glBindBufferARB(GL_ARRAY_BUFFER_ARB, obj->BufferID); - glBufferDataARB(GL_ARRAY_BUFFER_ARB, bytes, vertexData, GL_STATIC_DRAW_ARB); - - /* Setup a buffer of indices to test the ELEMENTS path */ - glGenBuffersARB(1, &obj->ElementsBufferID); - glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, obj->ElementsBufferID); - glBufferDataARB(GL_ELEMENT_ARRAY_BUFFER_ARB, 100, NULL, GL_STATIC_DRAW_ARB); - i = (GLuint *) glMapBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, GL_READ_WRITE_ARB); - i[0] = 0; - i[1] = 1; - i[2] = 2; - i[3] = 3; - glUnmapBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB); - obj->NumElements = 4; -} - - - -static void Init( void ) -{ - if (!glutExtensionSupported("GL_ARB_vertex_buffer_object")) { - printf("GL_ARB_vertex_buffer_object not found!\n"); - exit(0); - } - printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - - /* Test buffer object deletion */ - if (1) { - static GLubyte data[1000]; - GLuint id = 999; - glBindBufferARB(GL_ARRAY_BUFFER_ARB, id); - glBufferDataARB(GL_ARRAY_BUFFER_ARB, 1000, data, GL_STATIC_DRAW_ARB); - glVertexPointer(3, GL_FLOAT, 0, (void *) 0); - glDeleteBuffersARB(1, &id); - assert(!glIsBufferARB(id)); - glBindBufferARB(GL_ARRAY_BUFFER_ARB, 0); - glVertexPointer(3, GL_FLOAT, 0, (void *) 0); - assert(!glIsBufferARB(id)); - } - - MakeObject1(Objects + 0); - MakeObject2(Objects + 1); - MakeObject3(Objects + 2); - NumObjects = 3; -} - - -int main( int argc, char *argv[] ) -{ - glutInit( &argc, argv ); - glutInitWindowPosition( 0, 0 ); - glutInitWindowSize( 600, 300 ); - glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE ); - Win = glutCreateWindow(argv[0]); - glutReshapeFunc( Reshape ); - glutKeyboardFunc( Key ); - glutSpecialFunc( SpecialKey ); - glutDisplayFunc( Display ); - if (Anim) - glutIdleFunc(Idle); - Init(); - glutMainLoop(); - return 0; -} diff --git a/progs/tests/bug_3050.c b/progs/tests/bug_3050.c deleted file mode 100644 index 4ea7b80f23..0000000000 --- a/progs/tests/bug_3050.c +++ /dev/null @@ -1,162 +0,0 @@ -/* - * (C) Copyright IBM Corporation 2006 - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * on the rights to use, copy, modify, merge, publish, distribute, sub - * license, and/or sell copies of the Software, and to permit persons to whom - * the Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL - * VA LINUX SYSTEM, IBM AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, - * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR - * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE - * USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -/** - * \file bug_3050.c - * - * Simple regression test for bug #3050. Create a texture and make a few - * calls to \c glGetTexLevelParameteriv. If the bug still exists, trying - * to get \c GL_TEXTURE_WITDH will cause a protocol error. - * - * This test \b only applies to indirect-rendering. This may mean that the - * test needs to be run with the environment variable \c LIBGL_ALWAYS_INDIRECT - * set to a non-zero value. - * - * \author Ian Romanick - */ - -#include -#include -#include -#include - -static int Width = 400; -static int Height = 200; -static const GLfloat Near = 5.0, Far = 25.0; - - -static void Display( void ) -{ -} - - -static void Reshape( int width, int height ) -{ -} - - -static void Key( unsigned char key, int x, int y ) -{ - (void) x; - (void) y; - switch (key) { - case 27: - exit(0); - break; - } - glutPostRedisplay(); -} - - -static void Init( void ) -{ - unsigned i; - static const GLenum pnames[] = { - GL_TEXTURE_RED_SIZE, - GL_TEXTURE_GREEN_SIZE, - GL_TEXTURE_BLUE_SIZE, - GL_TEXTURE_ALPHA_SIZE, - GL_TEXTURE_LUMINANCE_SIZE, - GL_TEXTURE_INTENSITY_SIZE, - GL_TEXTURE_BORDER, - GL_TEXTURE_INTERNAL_FORMAT, - GL_TEXTURE_WIDTH, - GL_TEXTURE_HEIGHT, - GL_TEXTURE_DEPTH, - ~0 - }; - - - printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - printf("GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - - printf("\nThis program should log some data about a texture and exit.\n"); - printf("This is a regression test for bug #3050. If the bug still\n"); - printf("exists, a GLX protocol error will be generated.\n"); - printf("https://bugs.freedesktop.org/show_bug.cgi?id=3050\n\n"); - - - if ( ! glutExtensionSupported( "GL_NV_texture_rectangle" ) - && ! glutExtensionSupported( "GL_EXT_texture_rectangle" ) - && ! glutExtensionSupported( "GL_ARB_texture_rectangle" ) ) { - printf( "This test requires one of GL_ARB_texture_rectangle, GL_EXT_texture_rectangle,\n" - "or GL_NV_texture_rectangle be supported\n." ); - exit( 1 ); - } - - - glBindTexture( GL_TEXTURE_RECTANGLE_NV, 1 ); - glTexImage2D( GL_PROXY_TEXTURE_RECTANGLE_NV, 0, GL_RGBA, 8, 8, 0, - GL_RGBA, GL_UNSIGNED_BYTE, NULL ); - - for ( i = 0 ; pnames[i] != ~0 ; i++ ) { - GLint param_i; - GLfloat param_f; - GLenum err; - - glGetTexLevelParameteriv( GL_PROXY_TEXTURE_RECTANGLE_NV, 0, pnames[i], & param_i ); - err = glGetError(); - - if ( err ) { - printf("glGetTexLevelParameteriv(GL_PROXY_TEXTURE_RECTANGLE_NV, 0, 0x%04x, & param) generated a GL\n" - "error of 0x%04x!", - pnames[i], err ); - exit( 1 ); - } - else { - printf("glGetTexLevelParameteriv(GL_PROXY_TEXTURE_RECTANGLE_NV, 0, 0x%04x, & param) = 0x%04x\n", - pnames[i], param_i ); - } - - - glGetTexLevelParameterfv( GL_PROXY_TEXTURE_RECTANGLE_NV, 0, pnames[i], & param_f ); - err = glGetError(); - - if ( err ) { - printf("glGetTexLevelParameterfv(GL_PROXY_TEXTURE_RECTANGLE_NV, 0, 0x%04x, & param) generated a GL\n" - "error of 0x%04x!\n", - pnames[i], err ); - exit( 1 ); - } - else { - printf("glGetTexLevelParameterfv(GL_PROXY_TEXTURE_RECTANGLE_NV, 0, 0x%04x, & param) = %.1f (0x%04x)\n", - pnames[i], param_f, (GLint) param_f ); - } - } -} - - -int main( int argc, char *argv[] ) -{ - glutInit( &argc, argv ); - glutInitWindowPosition( 0, 0 ); - glutInitWindowSize( Width, Height ); - glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE ); - glutCreateWindow( "Bug #3050 Test" ); - glutReshapeFunc( Reshape ); - glutKeyboardFunc( Key ); - glutDisplayFunc( Display ); - Init(); - return 0; -} diff --git a/progs/tests/bug_3101.c b/progs/tests/bug_3101.c deleted file mode 100644 index 761dcbb951..0000000000 --- a/progs/tests/bug_3101.c +++ /dev/null @@ -1,128 +0,0 @@ -/* - * (C) Copyright IBM Corporation 2005 - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * on the rights to use, copy, modify, merge, publish, distribute, sub - * license, and/or sell copies of the Software, and to permit persons to whom - * the Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL - * VA LINUX SYSTEM, IBM AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, - * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR - * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE - * USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -/** - * \file bug_3101.c - * - * Simple regression test for bug #3101. Attempt to draw a single square. - * After emiting the first vertex, call \c glEdgeFlag to change the vertex - * format. If the bug still exists, this will cause a segfault. - * - * \author Ian Romanick - */ - -#include -#include -#include - -static int Width = 400; -static int Height = 200; -static const GLfloat Near = 5.0, Far = 25.0; - - -static void Display( void ) -{ - glClearColor(0.2, 0.2, 0.8, 0); - glClear( GL_COLOR_BUFFER_BIT ); - - glPushMatrix(); - - /* This is the "reference" square. - */ - - glTranslatef(-4.5, 0, 0); - glBlendEquation( GL_FUNC_ADD ); - glBlendFunc( GL_ONE, GL_ZERO ); - glBegin(GL_QUADS); - glColor3f( 0.5, 0.5, 0.5 ); - glVertex2f(-1, -1); - glVertex2f( 1, -1); - glEdgeFlag(GL_TRUE); - glVertex2f( 1, 1); - glVertex2f(-1, 1); - glEnd(); - - glPopMatrix(); - - glutSwapBuffers(); -} - - -static void Reshape( int width, int height ) -{ - GLfloat ar = (float) width / (float) height; - Width = width; - Height = height; - glViewport( 0, 0, width, height ); - glMatrixMode( GL_PROJECTION ); - glLoadIdentity(); - glFrustum( -ar, ar, -1.0, 1.0, Near, Far ); - glMatrixMode( GL_MODELVIEW ); - glLoadIdentity(); - glTranslatef( 0.0, 0.0, -15.0 ); -} - - -static void Key( unsigned char key, int x, int y ) -{ - (void) x; - (void) y; - switch (key) { - case 27: - exit(0); - break; - } - glutPostRedisplay(); -} - - -static void Init( void ) -{ - const char * const ver_string = (const char * const) - glGetString( GL_VERSION ); - - printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - printf("GL_VERSION = %s\n", ver_string); - - printf("\nThis program should draw a single square, but not crash.\n"); - printf("This is a regression test for bug #3101.\n"); - printf("https://bugs.freedesktop.org/show_bug.cgi?id=3101\n"); - glEnable( GL_BLEND ); -} - - -int main( int argc, char *argv[] ) -{ - glutInit( &argc, argv ); - glutInitWindowPosition( 0, 0 ); - glutInitWindowSize( Width, Height ); - glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE ); - glutCreateWindow( "Bug #3101 Test" ); - glutReshapeFunc( Reshape ); - glutKeyboardFunc( Key ); - glutDisplayFunc( Display ); - Init(); - glutMainLoop(); - return 0; -} diff --git a/progs/tests/bug_3195.c b/progs/tests/bug_3195.c deleted file mode 100644 index 4aceae04ab..0000000000 --- a/progs/tests/bug_3195.c +++ /dev/null @@ -1,275 +0,0 @@ -/* - * Copyright (C) 2000 Brian Paul All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -/** - * \file bug_3195.c - * - * Simple regression test for bug #3195. A bug in the i180 driver caused - * a segfault (inside the driver) when the LOD bias is adjusted and no texture - * is enabled. This test, which is based on progs/demos/lodbias.c, sets up - * all the texturing, disables all textures, adjusts the LOD bias, then - * re-enables \c GL_TEXTURE_2D. - * - * \author Brian Paul - * \author Ian Romanick - */ - -#include -#include -#include -#include -#include -#include - -#include "readtex.h" - -#define TEXTURE_FILE "../images/girl.rgb" - -static GLfloat Xrot = 0, Yrot = -30, Zrot = 0; -static GLint Bias = 0, BiasStepSign = +1; /* ints avoid fp precision problem */ -static GLint BiasMin = -400, BiasMax = 400; - - - -static void -PrintString(const char *s) -{ - while (*s) { - glutBitmapCharacter(GLUT_BITMAP_8_BY_13, (int) *s); - s++; - } -} - -static void Idle( void ) -{ - static int lastTime = 0; - int time = glutGet(GLUT_ELAPSED_TIME); - int step; - - if (lastTime == 0) - lastTime = time; - else if (time - lastTime < 10) - return; - - step = (time - lastTime) / 10 * BiasStepSign; - lastTime = time; - - Bias += step; - if (Bias < BiasMin) { - exit(0); - } - else if (Bias > BiasMax) { - Bias = BiasMax; - BiasStepSign = -1; - } - - glutPostRedisplay(); -} - - -static void Display( void ) -{ - char str[100]; - - glClear( GL_COLOR_BUFFER_BIT ); - - glMatrixMode( GL_PROJECTION ); - glLoadIdentity(); - glOrtho(-1, 1, -1, 1, -1, 1); - glMatrixMode( GL_MODELVIEW ); - glLoadIdentity(); - - glDisable(GL_TEXTURE_2D); - glColor3f(1,1,1); - glRasterPos3f(-0.9, -0.9, 0.0); - sprintf(str, "Texture LOD Bias = %4.1f", Bias * 0.01); - PrintString(str); - - glMatrixMode( GL_PROJECTION ); - glLoadIdentity(); - glFrustum( -1.0, 1.0, -1.0, 1.0, 5.0, 25.0 ); - glMatrixMode( GL_MODELVIEW ); - glLoadIdentity(); - glTranslatef( 0.0, 0.0, -8.0 ); - - glPushMatrix(); - glRotatef(Xrot, 1, 0, 0); - glRotatef(Yrot, 0, 1, 0); - glRotatef(Zrot, 0, 0, 1); - - glTexEnvf(GL_TEXTURE_FILTER_CONTROL_EXT, GL_TEXTURE_LOD_BIAS_EXT, 0.01 * Bias); - glEnable(GL_TEXTURE_2D); - - glBegin(GL_POLYGON); - glTexCoord2f(0, 0); glVertex2f(-1, -1); - glTexCoord2f(2, 0); glVertex2f( 1, -1); - glTexCoord2f(2, 2); glVertex2f( 1, 1); - glTexCoord2f(0, 2); glVertex2f(-1, 1); - glEnd(); - - glPopMatrix(); - - glutSwapBuffers(); -} - - -static void Reshape( int width, int height ) -{ - glViewport( 0, 0, width, height ); -} - - -static void Key( unsigned char key, int x, int y ) -{ - (void) x; - (void) y; - switch (key) { - case 27: - exit(0); - break; - } - glutPostRedisplay(); -} - - -static void SpecialKey( int key, int x, int y ) -{ - const GLfloat step = 3.0; - (void) x; - (void) y; - switch (key) { - case GLUT_KEY_UP: - Xrot -= step; - break; - case GLUT_KEY_DOWN: - Xrot += step; - break; - case GLUT_KEY_LEFT: - Yrot -= step; - break; - case GLUT_KEY_RIGHT: - Yrot += step; - break; - } - glutPostRedisplay(); -} - - -static void Init( void ) -{ - GLfloat maxBias; - const char * const ver_string = (const char * const) - glGetString( GL_VERSION ); - - printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - printf("GL_VERSION = %s\n", ver_string); - - printf("\nThis program should function nearly identically to Mesa's lodbias demo.\n" - "It should cycle through the complet LOD bias range once and exit. If bug\n" - "#3195 still exists, the demo should crash almost immediatly.\n"); - printf("This is a regression test for bug #3195.\n"); - printf("https://bugs.freedesktop.org/show_bug.cgi?id=3195\n"); - - if (!glutExtensionSupported("GL_EXT_texture_lod_bias")) { - printf("Sorry, GL_EXT_texture_lod_bias not supported by this renderer.\n"); - exit(1); - } - - glPixelStorei(GL_UNPACK_ALIGNMENT, 1); - - if (glutExtensionSupported("GL_SGIS_generate_mipmap")) { - /* test auto mipmap generation */ - GLint width, height, i; - GLenum format; - GLubyte *image = LoadRGBImage(TEXTURE_FILE, &width, &height, &format); - if (!image) { - printf("Error: could not load texture image %s\n", TEXTURE_FILE); - exit(1); - } - /* resize to 256 x 256 */ - if (width != 256 || height != 256) { - GLubyte *newImage = malloc(256 * 256 * 4); - gluScaleImage(format, width, height, GL_UNSIGNED_BYTE, image, - 256, 256, GL_UNSIGNED_BYTE, newImage); - free(image); - image = newImage; - } - printf("Using GL_SGIS_generate_mipmap\n"); - glTexParameteri(GL_TEXTURE_2D, GL_GENERATE_MIPMAP_SGIS, GL_TRUE); - glTexImage2D(GL_TEXTURE_2D, 0, format, 256, 256, 0, - format, GL_UNSIGNED_BYTE, image); - free(image); - - /* make sure mipmap was really generated correctly */ - width = height = 256; - for (i = 0; i < 9; i++) { - GLint w, h; - glGetTexLevelParameteriv(GL_TEXTURE_2D, i, GL_TEXTURE_WIDTH, &w); - glGetTexLevelParameteriv(GL_TEXTURE_2D, i, GL_TEXTURE_HEIGHT, &h); - printf("Level %d size: %d x %d\n", i, w, h); - assert(w == width); - assert(h == height); - width /= 2; - height /= 2; - } - - } - else if (!LoadRGBMipmaps(TEXTURE_FILE, GL_RGB)) { - printf("Error: could not load texture image %s\n", TEXTURE_FILE); - exit(1); - } - - /* mipmapping required for this extension */ - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); - - glGetFloatv(GL_MAX_TEXTURE_LOD_BIAS_EXT, &maxBias); - printf("LOD bias range: [%g, %g]\n", -maxBias, maxBias); - BiasMin = -100 * maxBias; - BiasMax = 100 * maxBias; - - /* Since we have (about) 8 mipmap levels, no need to bias beyond - * the range [-1, +8]. - */ - if (BiasMin < -100) - BiasMin = -100; - if (BiasMax > 800) - BiasMax = 800; -} - - -int main( int argc, char *argv[] ) -{ - glutInit( &argc, argv ); - glutInitWindowPosition( 0, 0 ); - glutInitWindowSize( 350, 350 ); - glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE ); - glutCreateWindow( "Bug #3195 Test" ); - glutReshapeFunc( Reshape ); - glutKeyboardFunc( Key ); - glutSpecialFunc( SpecialKey ); - glutDisplayFunc( Display ); - glutIdleFunc(Idle); - Init(); - glutMainLoop(); - return 0; -} diff --git a/progs/tests/copypixrate.c b/progs/tests/copypixrate.c deleted file mode 100644 index e9a42a1c8c..0000000000 --- a/progs/tests/copypixrate.c +++ /dev/null @@ -1,259 +0,0 @@ -/* - * Measure glCopyPixels speed - * - * Brian Paul - * 26 Jan 2006 - */ - -#define GL_GLEXT_PROTOTYPES -#include -#include -#include -#include -#include - -static GLint WinWidth = 1000, WinHeight = 800; -static GLint ImgWidth, ImgHeight; - -static GLenum Buffer = GL_FRONT; -static GLenum AlphaTest = GL_FALSE; -static GLboolean UseBlit = GL_FALSE; - -static PFNGLBLITFRAMEBUFFEREXTPROC glBlitFramebufferEXT_func = NULL; - - -/** - * draw teapot in lower-left corner of window - */ -static void -DrawTestImage(void) -{ - GLfloat ar; - - ImgWidth = WinWidth / 3; - ImgHeight = WinHeight / 3; - - glViewport(0, 0, ImgWidth, ImgHeight); - glScissor(0, 0, ImgWidth, ImgHeight); - glEnable(GL_SCISSOR_TEST); - - glClearColor(0.5, 0.5, 0.5, 0.0); - glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); - - ar = (float) WinWidth / WinHeight; - - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glFrustum(-ar, ar, -1.0, 1.0, 5.0, 25.0); - glMatrixMode(GL_MODELVIEW); - - glEnable(GL_LIGHTING); - glEnable(GL_LIGHT0); - glEnable(GL_DEPTH_TEST); - glFrontFace(GL_CW); - glPushMatrix(); - glRotatef(45, 1, 0, 0); - glutSolidTeapot(2.0); - glPopMatrix(); - glFrontFace(GL_CCW); - glDisable(GL_DEPTH_TEST); - glDisable(GL_LIGHTING); - - glDisable(GL_SCISSOR_TEST); - - glViewport(0, 0, WinWidth, WinHeight); - glFinish(); -} - - -static int -Rand(int max) -{ - return ((int) random()) % max; -} - - -/** - * Measure glCopyPixels rate - */ -static void -RunTest(void) -{ - double t1, t0 = glutGet(GLUT_ELAPSED_TIME) / 1000.0; - int iters = 0; - float copyRate, mbRate; - int r, g, b, a, bpp; - - if (AlphaTest) { - glEnable(GL_ALPHA_TEST); - glAlphaFunc(GL_GREATER, 0.0); - } - - glGetIntegerv(GL_RED_BITS, &r); - glGetIntegerv(GL_GREEN_BITS, &g); - glGetIntegerv(GL_BLUE_BITS, &b); - glGetIntegerv(GL_ALPHA_BITS, &a); - bpp = (r + g + b + a) / 8; - - do { - int x, y; - x = Rand(WinWidth); - y = Rand(WinHeight); - - if (x > ImgWidth || y > ImgHeight) { -#ifdef GL_EXT_framebuffer_blit - if (UseBlit) - { - glBlitFramebufferEXT_func(0, 0, ImgWidth, ImgHeight, - x, y, x + ImgWidth, y + ImgHeight, - GL_COLOR_BUFFER_BIT, GL_LINEAR); - } - else -#endif - { - glWindowPos2iARB(x, y); - glCopyPixels(0, 0, ImgWidth, ImgHeight, GL_COLOR); - } - glFinish(); /* XXX OK? */ - - iters++; - - t1 = glutGet(GLUT_ELAPSED_TIME) / 1000.0; - } - } while (t1 - t0 < 5.0); - - glDisable(GL_ALPHA_TEST); - - copyRate = iters / (t1 - t0); - mbRate = ImgWidth * ImgHeight * bpp * copyRate / (1024 * 1024); - - printf("Image size: %d x %d, %d Bpp\n", ImgWidth, ImgHeight, bpp); - printf("%d copies in %.2f = %.2f copies/sec, %.2f MB/s\n", - iters, t1-t0, copyRate, mbRate); -} - - -static void -Draw(void) -{ - glClearColor(0.0, 0.0, 0.0, 0.0); - glClearColor(0.2, 0.2, 0.8, 0); - glReadBuffer(Buffer); - glDrawBuffer(Buffer); - glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); - - DrawTestImage(); - - RunTest(); - - if (Buffer == GL_FRONT) - glFinish(); - else - glutSwapBuffers(); - - printf("exiting\n"); - exit(0); -} - - -static void -Reshape(int width, int height) -{ - glViewport(0, 0, width, height); - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glFrustum(-1.0, 1.0, -1.0, 1.0, 5.0, 25.0); - glMatrixMode(GL_MODELVIEW); - glLoadIdentity(); - glTranslatef(0.0, 0.0, -15.0); -} - - -static void -Key(unsigned char key, int x, int y) -{ - (void) x; - (void) y; - switch (key) { - case 27: - exit(0); - break; - } - glutPostRedisplay(); -} - - -static void -SpecialKey(int key, int x, int y) -{ - (void) x; - (void) y; - switch (key) { - case GLUT_KEY_UP: - break; - case GLUT_KEY_DOWN: - break; - case GLUT_KEY_LEFT: - break; - case GLUT_KEY_RIGHT: - break; - } - glutPostRedisplay(); -} - - -static void -ParseArgs(int argc, char *argv[]) -{ - int i; - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-back") == 0) - Buffer = GL_BACK; - else if (strcmp(argv[i], "-alpha") == 0) - AlphaTest = GL_TRUE; - else if (strcmp(argv[i], "-blit") == 0) - UseBlit = GL_TRUE; - } -} - - -static void -Init(void) -{ - if (glutExtensionSupported("GL_EXT_framebuffer_blit")) { - glBlitFramebufferEXT_func = (PFNGLBLITFRAMEBUFFEREXTPROC) - glutGetProcAddress("glBlitFramebufferEXT"); - } - else if (UseBlit) { - printf("Warning: GL_EXT_framebuffer_blit not supported.\n"); - UseBlit = GL_FALSE; - } -} - - -int -main(int argc, char *argv[]) -{ - GLint mode = GLUT_RGB | GLUT_ALPHA | GLUT_DOUBLE | GLUT_DEPTH; - glutInit(&argc, argv); - - ParseArgs(argc, argv); - if (AlphaTest) - mode |= GLUT_ALPHA; - - glutInitWindowPosition(0, 0); - glutInitWindowSize(WinWidth, WinHeight); - glutInitDisplayMode(mode); - glutCreateWindow(argv[0]); - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutSpecialFunc(SpecialKey); - glutDisplayFunc(Draw); - - printf("GL_RENDERER: %s\n", (char *) glGetString(GL_RENDERER)); - printf("Draw Buffer: %s\n", (Buffer == GL_BACK) ? "Back" : "Front"); - Init(); - - glutMainLoop(); - return 0; -} diff --git a/progs/tests/crossbar.c b/progs/tests/crossbar.c deleted file mode 100644 index 12aabb1c9a..0000000000 --- a/progs/tests/crossbar.c +++ /dev/null @@ -1,235 +0,0 @@ -/* - * (C) Copyright IBM Corporation 2005 - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * on the rights to use, copy, modify, merge, publish, distribute, sub - * license, and/or sell copies of the Software, and to permit persons to whom - * the Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL - * VA LINUX SYSTEM, IBM AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, - * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR - * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE - * USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -/** - * \file crossbar.c - * - * Simple test of GL_ARB_texture_env_crossbar functionality. Several squares - * are drawn with different texture combine modes, but all should be rendered - * with the same final color. - * - * \author Ian Romanick - */ - -#include -#include -#include -#include - -static const GLint tests[][8] = { - { 1, GL_REPLACE, GL_PRIMARY_COLOR, GL_PRIMARY_COLOR, - 2, GL_REPLACE, GL_TEXTURE, GL_PRIMARY_COLOR }, - { 3, GL_REPLACE, GL_PRIMARY_COLOR, GL_PRIMARY_COLOR, - 2, GL_SUBTRACT, GL_TEXTURE0, GL_TEXTURE1 }, - { 2, GL_REPLACE, GL_PRIMARY_COLOR, GL_PRIMARY_COLOR, - 2, GL_REPLACE, GL_TEXTURE0, GL_TEXTURE0 }, - { 2, GL_REPLACE, GL_PRIMARY_COLOR, GL_PRIMARY_COLOR, - 1, GL_SUBTRACT, GL_TEXTURE0, GL_TEXTURE1 }, - { 3, GL_ADD, GL_TEXTURE1, GL_TEXTURE1, - 2, GL_MODULATE, GL_TEXTURE1, GL_PREVIOUS }, - { 3, GL_ADD, GL_TEXTURE1, GL_TEXTURE1, - 4, GL_MODULATE, GL_TEXTURE0, GL_PREVIOUS }, -}; - -#define NUM_TESTS (sizeof(tests) / sizeof(tests[0])) - -static int Width = 100 * (NUM_TESTS + 1); -static int Height = 200; -static const GLfloat Near = 5.0, Far = 25.0; - - -static void Display( void ) -{ - unsigned i; - - - glClearColor(0.2, 0.2, 0.8, 0); - glClear( GL_COLOR_BUFFER_BIT ); - - glPushMatrix(); - - /* This is the "reference" square. - */ - - glActiveTexture( GL_TEXTURE0 ); - glDisable( GL_TEXTURE_2D ); - glActiveTexture( GL_TEXTURE1 ); - glDisable( GL_TEXTURE_2D ); - - glTranslatef(-(NUM_TESTS * 1.5), 0, 0); - glBegin(GL_QUADS); - glColor3f( 0.5, 0.5, 0.5 ); - glVertex2f(-1, -1); - glVertex2f( 1, -1); - glVertex2f( 1, 1); - glVertex2f(-1, 1); - glEnd(); - - for ( i = 0 ; i < NUM_TESTS ; i++ ) { - glActiveTexture( GL_TEXTURE0 ); - glEnable( GL_TEXTURE_2D ); - glBindTexture( GL_TEXTURE_2D, tests[i][0] ); - glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE ); - glTexEnvi( GL_TEXTURE_ENV, GL_COMBINE_RGB, tests[i][1] ); - glTexEnvi( GL_TEXTURE_ENV, GL_SOURCE0_RGB, tests[i][2] ); - glTexEnvi( GL_TEXTURE_ENV, GL_SOURCE1_RGB, tests[i][3] ); - - glActiveTexture( GL_TEXTURE1 ); - glEnable( GL_TEXTURE_2D ); - glBindTexture( GL_TEXTURE_2D, tests[i][4] ); - glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE ); - glTexEnvi( GL_TEXTURE_ENV, GL_COMBINE_RGB, tests[i][5] ); - glTexEnvi( GL_TEXTURE_ENV, GL_SOURCE0_RGB, tests[i][6] ); - glTexEnvi( GL_TEXTURE_ENV, GL_SOURCE1_RGB, tests[i][7] ); - - glCallList(1); - } - - glPopMatrix(); - - glutSwapBuffers(); -} - - -static void Reshape( int width, int height ) -{ - GLfloat ar = (float) width / (float) height; - Width = width; - Height = height; - glViewport( 0, 0, width, height ); - glMatrixMode( GL_PROJECTION ); - glLoadIdentity(); - glFrustum( -ar, ar, -1.0, 1.0, Near, Far ); - glMatrixMode( GL_MODELVIEW ); - glLoadIdentity(); - glTranslatef( 0.0, 0.0, -15.0 ); -} - - -static void Key( unsigned char key, int x, int y ) -{ - (void) x; - (void) y; - switch (key) { - case 27: - exit(0); - break; - } - glutPostRedisplay(); -} - - -static void Init( void ) -{ - const char * const ver_string = (const char * const) - glGetString( GL_VERSION ); - float ver = strtof( ver_string, NULL ); - GLint tex_units; - GLint temp[ 256 ]; - - - printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - printf("GL_VERSION = %s\n", ver_string); - - if ( (!glutExtensionSupported("GL_ARB_multitexture") - && (ver < 1.3)) - || (!glutExtensionSupported("GL_ARB_texture_env_combine") - && !glutExtensionSupported("GL_EXT_texture_env_combine") - && (ver < 1.3)) - || (!glutExtensionSupported("GL_ARB_texture_env_crossbar") - && !glutExtensionSupported("GL_NV_texture_env_combine4") - && (ver < 1.4)) ) { - printf("\nSorry, this program requires GL_ARB_multitexture and either\n" - "GL_ARB_texture_env_combine or GL_EXT_texture_env_combine (or OpenGL 1.3).\n" - "Either GL_ARB_texture_env_crossbar or GL_NV_texture_env_combine4 (or\n" - "OpenGL 1.4) are also required.\n"); - exit(1); - } - - glGetIntegerv( GL_MAX_TEXTURE_UNITS, & tex_units ); - if ( tex_units < 2 ) { - printf("\nSorry, this program requires at least 2 texture units.\n"); - exit(1); - } - - printf("\nAll %u squares should be the same color.\n", NUM_TESTS + 1); - - (void) memset( temp, 0x00, sizeof( temp ) ); - glBindTexture( GL_TEXTURE_2D, 1 ); - glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST ); - glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST ); - glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, 8, 8, 0, - GL_RGBA, GL_UNSIGNED_BYTE, temp ); - - (void) memset( temp, 0x7f, sizeof( temp ) ); - glBindTexture( GL_TEXTURE_2D, 2 ); - glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST ); - glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST ); - glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, 8, 8, 0, - GL_RGBA, GL_UNSIGNED_BYTE, temp ); - - (void) memset( temp, 0xff, sizeof( temp ) ); - glBindTexture( GL_TEXTURE_2D, 3 ); - glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST ); - glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST ); - glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, 8, 8, 0, - GL_RGBA, GL_UNSIGNED_BYTE, temp ); - - (void) memset( temp, 0x3f, sizeof( temp ) ); - glBindTexture( GL_TEXTURE_2D, 4 ); - glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST ); - glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST ); - glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, 8, 8, 0, - GL_RGBA, GL_UNSIGNED_BYTE, temp ); - - - glNewList( 1, GL_COMPILE ); - glTranslatef(3.0, 0, 0); - glBegin(GL_QUADS); - glColor3f( 0.9, 0.0, 0.0 ); - glMultiTexCoord2f( GL_TEXTURE0, 0.5, 0.5 ); - glMultiTexCoord2f( GL_TEXTURE1, 0.5, 0.5 ); - glVertex2f(-1, -1); - glVertex2f( 1, -1); - glVertex2f( 1, 1); - glVertex2f(-1, 1); - glEnd(); - glEndList(); -} - - -int main( int argc, char *argv[] ) -{ - glutInit( &argc, argv ); - glutInitWindowPosition( 0, 0 ); - glutInitWindowSize( Width, Height ); - glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE ); - glutCreateWindow( "GL_ARB_texture_env_crossbar test" ); - glutReshapeFunc( Reshape ); - glutKeyboardFunc( Key ); - glutDisplayFunc( Display ); - Init(); - glutMainLoop(); - return 0; -} diff --git a/progs/tests/cva.c b/progs/tests/cva.c deleted file mode 100644 index a9393aef0c..0000000000 --- a/progs/tests/cva.c +++ /dev/null @@ -1,159 +0,0 @@ - -/* - * Trivial CVA test, good for testing driver fastpaths (especially - * indexed vertex buffers if they are supported). - * - * Gareth Hughes - * November 2000 - */ - -#include -#include -#include -#include /* for ptrdiff_t, referenced by GL.h when GL_GLEXT_LEGACY defined */ -#ifdef _WIN32 -#include -#endif -#define GL_GLEXT_LEGACY -#include -#include - -GLfloat verts[][4] = { - { -0.5, -0.5, -2.0, 0.0 }, - { 0.5, -0.5, -2.0, 0.0 }, - { -0.5, 0.5, -2.0, 0.0 }, - { 0.5, 0.5, -2.0, 0.0 }, -}; - -GLubyte color[][4] = { - { 0xff, 0x00, 0x00, 0x00 }, - { 0x00, 0xff, 0x00, 0x00 }, - { 0x00, 0x00, 0xff, 0x00 }, - { 0xff, 0xff, 0xff, 0x00 }, -}; - -GLuint indices[] = { 0, 1, 2, 3 }; - -GLboolean compiled = GL_TRUE; -GLboolean doubleBuffer = GL_TRUE; - - -void init( void ) -{ - glClearColor( 0.0, 0.0, 0.0, 0.0 ); - glShadeModel( GL_SMOOTH ); - - glFrontFace( GL_CCW ); - glCullFace( GL_BACK ); - glEnable( GL_CULL_FACE ); - - glEnable( GL_DEPTH_TEST ); - - glEnableClientState( GL_VERTEX_ARRAY ); - glEnableClientState( GL_COLOR_ARRAY ); - - glMatrixMode( GL_PROJECTION ); - glLoadIdentity(); - glFrustum( -1.0, 1.0, -1.0, 1.0, 2.0, 10.0 ); - glMatrixMode( GL_MODELVIEW ); - glLoadIdentity(); - - glVertexPointer( 3, GL_FLOAT, sizeof(verts[0]), verts ); - glColorPointer( 4, GL_UNSIGNED_BYTE, 0, color ); - -#ifdef GL_EXT_compiled_vertex_array - if ( compiled ) { - glLockArraysEXT( 0, 4 ); - } -#endif -} - -void display( void ) -{ - glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); - - glDrawElements( GL_TRIANGLES, 3, GL_UNSIGNED_INT, indices ); - - glFlush(); - if ( doubleBuffer ) { - glutSwapBuffers(); - } -} - -void keyboard( unsigned char key, int x, int y ) -{ - switch ( key ) { - case 27: - exit( 0 ); - break; - } - - glutPostRedisplay(); -} - -GLboolean args( int argc, char **argv ) -{ - GLint i; - - doubleBuffer = GL_TRUE; - - for ( i = 1 ; i < argc ; i++ ) { - if ( strcmp( argv[i], "-sb" ) == 0 ) { - doubleBuffer = GL_FALSE; - } else if ( strcmp( argv[i], "-db" ) == 0 ) { - doubleBuffer = GL_TRUE; - } else { - fprintf( stderr, "%s (Bad option).\n", argv[i] ); - return GL_FALSE; - } - } - return GL_TRUE; -} - -int main( int argc, char **argv ) -{ - GLenum type; - char *string; - double version; - - glutInit( &argc, argv ); - - if ( args( argc, argv ) == GL_FALSE ) { - exit( 1 ); - } - - type = GLUT_RGB | GLUT_DEPTH; - type |= ( doubleBuffer ) ? GLUT_DOUBLE : GLUT_SINGLE; - - glutInitDisplayMode( type ); - glutInitWindowSize( 250, 250 ); - glutInitWindowPosition( 100, 100 ); - glutCreateWindow( "CVA Test" ); - - /* Make sure the server supports GL 1.2 vertex arrays. - */ - string = (char *) glGetString( GL_VERSION ); - - version = atof(string); - if ( version < 1.2 ) { - fprintf( stderr, "This program requires OpenGL 1.2 vertex arrays.\n" ); - exit( -1 ); - } - - /* See if the server supports compiled vertex arrays. - */ - string = (char *) glGetString( GL_EXTENSIONS ); - - if ( !strstr( string, "GL_EXT_compiled_vertex_array" ) ) { - fprintf( stderr, "Compiled vertex arrays not supported by this renderer.\n" ); - compiled = GL_FALSE; - } - - init(); - - glutDisplayFunc( display ); - glutKeyboardFunc( keyboard ); - glutMainLoop(); - - return 0; -} diff --git a/progs/tests/debugger.c b/progs/tests/debugger.c deleted file mode 100644 index 4c6955bcfc..0000000000 --- a/progs/tests/debugger.c +++ /dev/null @@ -1,733 +0,0 @@ -/* - * Test the GL_MESA_program_debug extension - */ - - -#include -#include -#include -#include -#include -#include -#define GL_GLEXT_PROTOTYPES -#include - - -/* - * Print the string with line numbers - */ -static void list_program(const GLubyte *string, GLsizei len) -{ - const char *c = (const char *) string; - int i, line = 1, printNumber = 1; - - for (i = 0; i < len; i++) { - if (printNumber) { - printf("%3d ", line); - printNumber = 0; - } - if (*c == '\n') { - line++; - printNumber = 1; - } - putchar(*c); - c++; - } - putchar('\n'); -} - - -/* - * Return the line number and column number that corresponds to the - * given program position. Also return a null-terminated copy of that - * line of the program string. - */ -static const GLubyte * -find_line_column(const GLubyte *string, const GLubyte *pos, - GLint *line, GLint *col) -{ - const GLubyte *lineStart = string; - const GLubyte *p = string; - GLubyte *s; - int len; - - *line = 1; - - while (p != pos) { - if (*p == (GLubyte) '\n') { - (*line)++; - lineStart = p + 1; - } - p++; - } - - *col = (pos - lineStart) + 1; - - /* return copy of this line */ - while (*p != 0 && *p != '\n') - p++; - len = p - lineStart; - s = (GLubyte *) malloc(len + 1); - memcpy(s, lineStart, len); - s[len] = 0; - - return s; -} - - -#define ARB_VERTEX_PROGRAM 1 -#define ARB_FRAGMENT_PROGRAM 2 -#define NV_VERTEX_PROGRAM 3 -#define NV_FRAGMENT_PROGRAM 4 - - -struct breakpoint { - enum {PIXEL, LINE} type; - int x, y; - int line; - GLboolean enabled; -}; - -#define MAX_BREAKPOINTS 100 -static struct breakpoint Breakpoints[MAX_BREAKPOINTS]; -static int NumBreakpoints = 0; - - - -/* - * Interactive debugger - */ -static void Debugger2(GLenum target, GLvoid *data) -{ - static GLuint skipCount = 0; - const GLubyte *ln; - GLint pos, line, column; - GLint id; - int progType; - GLint len; - GLubyte *program; - GLboolean stop; - int i; - - /* Sigh, GL_VERTEX_PROGRAM_ARB == GL_VERTEX_PROGRAM_NV so it's a bit - * hard to distinguish between them. - */ - if (target == GL_FRAGMENT_PROGRAM_ARB) - progType = ARB_FRAGMENT_PROGRAM; - else if (target == GL_FRAGMENT_PROGRAM_NV) - progType = NV_FRAGMENT_PROGRAM; - else - progType = NV_VERTEX_PROGRAM; - - /* Until we hit zero, continue rendering */ - if (skipCount > 0) { - skipCount--; - return; - } - - /* Get id of the program and current position */ - switch (progType) { - case ARB_FRAGMENT_PROGRAM: - glGetProgramivARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_BINDING_ARB, &id); - glGetIntegerv(GL_FRAGMENT_PROGRAM_POSITION_MESA, &pos); - break; - case NV_FRAGMENT_PROGRAM: - glGetIntegerv(GL_FRAGMENT_PROGRAM_BINDING_NV, &id); - glGetIntegerv(GL_FRAGMENT_PROGRAM_POSITION_MESA, &pos); - break; - case ARB_VERTEX_PROGRAM: - glGetProgramivARB(GL_VERTEX_PROGRAM_ARB, GL_PROGRAM_BINDING_ARB, &id); - glGetIntegerv(GL_VERTEX_PROGRAM_POSITION_MESA, &pos); - break; - case NV_VERTEX_PROGRAM: - glGetIntegerv(GL_VERTEX_PROGRAM_BINDING_NV, &id); - glGetIntegerv(GL_VERTEX_PROGRAM_POSITION_MESA, &pos); - break; - default: - abort(); - } - - /* get program string */ - if (progType == ARB_VERTEX_PROGRAM || - progType == ARB_FRAGMENT_PROGRAM) - glGetProgramivARB(target, GL_PROGRAM_LENGTH_ARB, &len); - else - glGetProgramivNV(id, GL_PROGRAM_LENGTH_NV, &len); - program = malloc(len + 1); - if (progType == ARB_VERTEX_PROGRAM || - progType == ARB_FRAGMENT_PROGRAM) - glGetProgramStringARB(target, GL_PROGRAM_STRING_ARB, program); - else - glGetProgramStringNV(id, GL_PROGRAM_STRING_NV, program); - - - /* Get current line number, column, line string */ - ln = find_line_column(program, program + pos, &line, &column); - - /* test breakpoints */ - if (NumBreakpoints > 0) - stop = GL_FALSE; - else - stop = GL_TRUE; - for (i = 0; i < NumBreakpoints; i++) { - if (Breakpoints[i].enabled) { - switch (Breakpoints[i].type) { - case PIXEL: - if (progType == ARB_FRAGMENT_PROGRAM) { - - } - else if (progType == NV_FRAGMENT_PROGRAM) { - GLfloat pos[4]; - int px, py; - glGetProgramRegisterfvMESA(GL_FRAGMENT_PROGRAM_NV, - 6, (GLubyte *) "f[WPOS]", pos); - px = (int) pos[0]; - py = (int) pos[1]; - printf("%d, %d\n", px, py); - if (px == Breakpoints[i].x && - py == Breakpoints[i].y) { - printf("Break at pixel (%d, %d)\n", px, py); - stop = GL_TRUE; - } - } - break; - case LINE: - if (line == Breakpoints[i].line) { - /* hit a breakpoint! */ - printf("Break at line %d\n", line); - stop = GL_TRUE; - } - break; - } - } - } - if (!stop) { - free(program); - return; - } - - printf("%d: %s\n", line, ln); - - /* get commands from stdin */ - while (1) { - char command[1000], *cmd; - - /* print prompt and get command */ - printf("(%s %d) ", (target == GL_VERTEX_PROGRAM_ARB ? "vert" : "frag"), - line); - fgets(command, 999, stdin); - - /* skip leading whitespace */ - for (cmd = command; cmd[0] == ' '; cmd++) - ; - - if (!cmd[0]) - /* nothing (repeat the previous cmd?) */ - continue; - - switch (cmd[0]) { - case 's': - /* skip N instructions */ - i = atoi(cmd + 2); - skipCount = i; - printf("Skipping %d instructions\n", i); - return; - case 'n': - /* next */ - return; - case 'c': - return; - case 'd': - /* dump machine state */ - if (progType == NV_FRAGMENT_PROGRAM) { - static const char *inRegs[] = { - "f[WPOS]", "f[COL0]", "f[COL1]", "f[FOGC]", - "f[TEX0]", "f[TEX1]", "f[TEX2]", "f[TEX3]", - NULL - }; - static const char *outRegs[] = { - "o[COLR]", "o[COLH]", "o[DEPR]", NULL - }; - GLfloat v[4]; - int i; - printf("Fragment input attributes:\n"); - for (i = 0; inRegs[i]; i++) { - glGetProgramRegisterfvMESA(GL_FRAGMENT_PROGRAM_NV, - strlen(inRegs[i]), - (const GLubyte *) inRegs[i], v); - printf(" %s: %g, %g, %g, %g\n", inRegs[i], - v[0], v[1], v[2], v[3]); - } - printf("Fragment output attributes:\n"); - for (i = 0; outRegs[i]; i++) { - glGetProgramRegisterfvMESA(GL_FRAGMENT_PROGRAM_NV, - strlen(outRegs[i]), - (const GLubyte *) outRegs[i], v); - printf(" %s: %g, %g, %g, %g\n", outRegs[i], - v[0], v[1], v[2], v[3]); - } - printf("Temporaries:\n"); - for (i = 0; i < 4; i++) { - char temp[100]; - GLfloat v[4]; - sprintf(temp, "R%d", i); - glGetProgramRegisterfvMESA(GL_FRAGMENT_PROGRAM_NV, - strlen(temp), - (const GLubyte *) temp, v); - printf(" %s: %g, %g, %g, %g\n", temp, v[0],v[1],v[2],v[3]); - } - } - else if (progType == NV_VERTEX_PROGRAM) { - GLfloat v[4]; - int i; - static const char *inRegs[] = { - "v[OPOS]", "v[WGHT]", "v[NRML]", "v[COL0]", - "v[COL1]", "v[FOGC]", "v[6]", "v[7]", - "v[TEX0]", "v[TEX1]", "v[TEX2]", "v[TEX3]", - "v[TEX4]", "v[TEX5]", "v[TEX6]", "v[TEX7]", - NULL - }; - static const char *outRegs[] = { - "o[HPOS]", "o[COL0]", "o[COL1]", "o[BFC0]", - "o[BFC1]", "o[FOGC]", "o[PSIZ]", - "o[TEX0]", "o[TEX1]", "o[TEX2]", "o[TEX3]", - "o[TEX4]", "o[TEX5]", "o[TEX6]", "o[TEX7]", - NULL - }; - printf("Vertex input attributes:\n"); - for (i = 0; inRegs[i]; i++) { - glGetProgramRegisterfvMESA(GL_VERTEX_PROGRAM_NV, - strlen(inRegs[i]), - (const GLubyte *) inRegs[i], v); - printf(" %s: %g, %g, %g, %g\n", inRegs[i], - v[0], v[1], v[2], v[3]); - } - printf("Vertex output attributes:\n"); - for (i = 0; outRegs[i]; i++) { - glGetProgramRegisterfvMESA(GL_VERTEX_PROGRAM_NV, - strlen(outRegs[i]), - (const GLubyte *) outRegs[i], v); - printf(" %s: %g, %g, %g, %g\n", outRegs[i], - v[0], v[1], v[2], v[3]); - } - printf("Temporaries:\n"); - for (i = 0; i < 4; i++) { - char temp[100]; - GLfloat v[4]; - sprintf(temp, "R%d", i); - glGetProgramRegisterfvMESA(GL_VERTEX_PROGRAM_NV, - strlen(temp), - (const GLubyte *) temp, v); - printf(" %s: %g, %g, %g, %g\n", temp, v[0],v[1],v[2],v[3]); - } - } - break; - case 'l': - /* list */ - list_program(program, len); - break; - case 'p': - /* print */ - { - GLfloat v[4]; - char *c; - cmd++; - while (*cmd == ' ') - cmd++; - c = cmd; - while (*c) { - if (*c == '\n' || *c == '\r') - *c = 0; - else - c++; - } - glGetProgramRegisterfvMESA(target, strlen(cmd), - (const GLubyte *) cmd, v); - if (glGetError() == GL_NO_ERROR) - printf("%s = %g, %g, %g, %g\n", cmd, v[0], v[1], v[2], v[3]); - else - printf("Invalid expression\n"); - } - break; - case 'b': - if (cmd[1] == ' ' && isdigit(cmd[2])) { - char *comma = strchr(cmd, ','); - if (comma) { - /* break at pixel */ - int x = atoi(cmd + 2); - int y = atoi(comma + 1); - if (NumBreakpoints < MAX_BREAKPOINTS) { - Breakpoints[NumBreakpoints].type = PIXEL; - Breakpoints[NumBreakpoints].x = x; - Breakpoints[NumBreakpoints].y = y; - Breakpoints[NumBreakpoints].enabled = GL_TRUE; - NumBreakpoints++; - printf("Breakpoint %d: break at pixel (%d, %d)\n", - NumBreakpoints, x, y); - } - } - else { - /* break at line */ - int l = atoi(cmd + 2); - if (l && NumBreakpoints < MAX_BREAKPOINTS) { - Breakpoints[NumBreakpoints].type = LINE; - Breakpoints[NumBreakpoints].line = l; - Breakpoints[NumBreakpoints].enabled = GL_TRUE; - NumBreakpoints++; - printf("Breakpoint %d: break at line %d\n", - NumBreakpoints, l); - } - } - } - else { - /* list breakpoints */ - printf("Breakpoints:\n"); - for (i = 0; i < NumBreakpoints; i++) { - switch (Breakpoints[i].type) { - case LINE: - printf(" %d: break at line %d\n", - i + 1, Breakpoints[i].line); - break; - case PIXEL: - printf(" %d: break at pixel (%d, %d)\n", - i + 1, Breakpoints[i].x, Breakpoints[i].y); - break; - } - } - } - break; - case 'h': - /* help */ - printf("Debugger commands:\n"); - printf(" b list breakpoints\n"); - printf(" b N break at line N\n"); - printf(" b x,y break at pixel x,y\n"); - printf(" c continue execution\n"); - printf(" d display register values\n"); - printf(" h help\n"); - printf(" l list program\n"); - printf(" n next instruction\n"); - printf(" p V print value V\n"); - printf(" s N skip N instructions\n"); - break; - default: - printf("Unknown command: %c\n", cmd[0]); - } - } -} - - -/* - * Print current line, some registers, and continue. - */ -static void Debugger(GLenum target, GLvoid *data) -{ - GLint pos; - const GLubyte *ln; - GLint line, column; - GLfloat v[4]; - - assert(target == GL_FRAGMENT_PROGRAM_NV); - - glGetIntegerv(GL_FRAGMENT_PROGRAM_POSITION_MESA, &pos); - - ln = find_line_column((const GLubyte *) data, (const GLubyte *) data + pos, - &line, &column); - printf("%d:%d: %s\n", line, column, (char *) ln); - - glGetProgramRegisterfvMESA(GL_FRAGMENT_PROGRAM_NV, - 2, (const GLubyte *) "R0", v); - printf(" R0 = %g, %g, %g, %g\n", v[0], v[1], v[2], v[3]); - glGetProgramRegisterfvMESA(GL_FRAGMENT_PROGRAM_NV, - 7, (const GLubyte *) "f[WPOS]", v); - printf(" o[WPOS] = %g, %g, %g, %g\n", v[0], v[1], v[2], v[3]); - glGetProgramRegisterfvMESA(GL_FRAGMENT_PROGRAM_NV, - 7, (const GLubyte *) "o[COLR]", v); - printf(" o[COLR] = %g, %g, %g, %g\n", v[0], v[1], v[2], v[3]); - - free((void *) ln); -} - - - - -/**********************************************************************/ - -static GLfloat Diffuse[4] = { 0.5, 0.5, 1.0, 1.0 }; -static GLfloat Specular[4] = { 0.8, 0.8, 0.8, 1.0 }; -static GLfloat LightPos[4] = { 0.0, 10.0, 20.0, 1.0 }; -static GLfloat Delta = 1.0; - -static GLuint FragProg; -static GLuint VertProg; -static GLboolean Anim = GL_TRUE; -static GLboolean Wire = GL_FALSE; -static GLboolean PixelLight = GL_TRUE; - -static GLfloat Xrot = 0, Yrot = 0; - - -#define NAMED_PARAMETER4FV(prog, name, v) \ - glProgramNamedParameter4fvNV(prog, strlen(name), (const GLubyte *) name, v) - - -static void Display( void ) -{ - glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); - - if (PixelLight) { - NAMED_PARAMETER4FV(FragProg, "LightPos", LightPos); - glEnable(GL_FRAGMENT_PROGRAM_NV); - glEnable(GL_VERTEX_PROGRAM_NV); - glDisable(GL_LIGHTING); - } - else { - glLightfv(GL_LIGHT0, GL_POSITION, LightPos); - glDisable(GL_FRAGMENT_PROGRAM_NV); - glDisable(GL_VERTEX_PROGRAM_NV); - glEnable(GL_LIGHTING); - } - - glPushMatrix(); - glRotatef(Xrot, 1, 0, 0); - glRotatef(Yrot, 0, 1, 0); - -#if 1 - glutSolidSphere(2.0, 10, 5); -#else - { - GLUquadricObj *q = gluNewQuadric(); - gluQuadricNormals(q, GL_SMOOTH); - gluQuadricTexture(q, GL_TRUE); - glRotatef(90, 1, 0, 0); - glTranslatef(0, 0, -1); - gluCylinder(q, 1.0, 1.0, 2.0, 24, 1); - gluDeleteQuadric(q); - } -#endif - - glPopMatrix(); - - glutSwapBuffers(); -} - - -static void Idle(void) -{ - LightPos[0] += Delta; - if (LightPos[0] > 25.0) - Delta = -1.0; - else if (LightPos[0] <- 25.0) - Delta = 1.0; - glutPostRedisplay(); -} - - -static void Reshape( int width, int height ) -{ - glViewport( 0, 0, width, height ); - glMatrixMode( GL_PROJECTION ); - glLoadIdentity(); - glFrustum( -1.0, 1.0, -1.0, 1.0, 5.0, 25.0 ); - /*glOrtho( -2.0, 2.0, -2.0, 2.0, 5.0, 25.0 );*/ - glMatrixMode( GL_MODELVIEW ); - glLoadIdentity(); - glTranslatef( 0.0, 0.0, -15.0 ); -} - - -static void Key( unsigned char key, int x, int y ) -{ - (void) x; - (void) y; - switch (key) { - case ' ': - Anim = !Anim; - if (Anim) - glutIdleFunc(Idle); - else - glutIdleFunc(NULL); - break; - case 'x': - LightPos[0] -= 1.0; - break; - case 'X': - LightPos[0] += 1.0; - break; - case 'w': - Wire = !Wire; - if (Wire) - glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); - else - glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); - break; - case 'p': - PixelLight = !PixelLight; - if (PixelLight) { - printf("Per-pixel lighting\n"); - } - else { - printf("Conventional lighting\n"); - } - break; - case 27: - exit(0); - break; - } - glutPostRedisplay(); -} - -static void SpecialKey( int key, int x, int y ) -{ - const GLfloat step = 3.0; - (void) x; - (void) y; - switch (key) { - case GLUT_KEY_UP: - Xrot -= step; - break; - case GLUT_KEY_DOWN: - Xrot += step; - break; - case GLUT_KEY_LEFT: - Yrot -= step; - break; - case GLUT_KEY_RIGHT: - Yrot += step; - break; - } - glutPostRedisplay(); -} - - -static void Init( int argc, char *argv[] ) -{ - static const char *fragProgramText = - "!!FP1.0\n" - "DECLARE Diffuse; \n" - "DECLARE Specular; \n" - "DECLARE LightPos; \n" - - "# Compute normalized LightPos, put it in R0\n" - "DP3 R0.x, LightPos, LightPos;\n" - "RSQ R0.y, R0.x;\n" - "MUL R0, LightPos, R0.y;\n" - - "# Compute normalized normal, put it in R1\n" - "DP3 R1, f[TEX0], f[TEX0]; \n" - "RSQ R1.y, R1.x;\n" - "MUL R1, f[TEX0], R1.y;\n" - - "# Compute dot product of light direction and normal vector\n" - "DP3 R2, R0, R1;\n" - - "MUL R3, Diffuse, R2; # diffuse attenuation\n" - - "POW R4, R2.x, {20.0}.x; # specular exponent\n" - - "MUL R5, Specular, R4; # specular attenuation\n" - - "ADD o[COLR], R3, R5; # add diffuse and specular colors\n" - "END \n" - ; - - static const char *vertProgramText = - "!!VP1.0\n" - "# typical modelview/projection transform\n" - "DP4 o[HPOS].x, c[0], v[OPOS] ;\n" - "DP4 o[HPOS].y, c[1], v[OPOS] ;\n" - "DP4 o[HPOS].z, c[2], v[OPOS] ;\n" - "DP4 o[HPOS].w, c[3], v[OPOS] ;\n" - "# transform normal by inv transpose of modelview, put in tex0\n" - "DP4 o[TEX0].x, c[4], v[NRML] ;\n" - "DP4 o[TEX0].y, c[5], v[NRML] ;\n" - "DP4 o[TEX0].z, c[6], v[NRML] ;\n" - "DP4 o[TEX0].w, c[7], v[NRML] ;\n" - "END\n"; - ; - - if (!glutExtensionSupported("GL_NV_vertex_program")) { - printf("Sorry, this demo requires GL_NV_vertex_program\n"); - exit(1); - } - if (!glutExtensionSupported("GL_NV_fragment_program")) { - printf("Sorry, this demo requires GL_NV_fragment_program\n"); - exit(1); - } - - glGenProgramsNV(1, &FragProg); - assert(FragProg > 0); - glGenProgramsNV(1, &VertProg); - assert(VertProg > 0); - - /* - * Fragment program - */ - glLoadProgramNV(GL_FRAGMENT_PROGRAM_NV, FragProg, - strlen(fragProgramText), - (const GLubyte *) fragProgramText); - assert(glIsProgramNV(FragProg)); - glBindProgramNV(GL_FRAGMENT_PROGRAM_NV, FragProg); - - NAMED_PARAMETER4FV(FragProg, "Diffuse", Diffuse); - NAMED_PARAMETER4FV(FragProg, "Specular", Specular); - - /* - * Vertex program - */ - glLoadProgramNV(GL_VERTEX_PROGRAM_NV, VertProg, - strlen(vertProgramText), - (const GLubyte *) vertProgramText); - assert(glIsProgramNV(VertProg)); - glBindProgramNV(GL_VERTEX_PROGRAM_NV, VertProg); - glTrackMatrixNV(GL_VERTEX_PROGRAM_NV, 0, GL_MODELVIEW_PROJECTION_NV, GL_IDENTITY_NV); - glTrackMatrixNV(GL_VERTEX_PROGRAM_NV, 4, GL_MODELVIEW, GL_INVERSE_TRANSPOSE_NV); - - /* - * Misc init - */ - glClearColor(0.3, 0.3, 0.3, 0.0); - glEnable(GL_DEPTH_TEST); - glEnable(GL_LIGHT0); - glEnable(GL_LIGHTING); - glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, Diffuse); - glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, Specular); - glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, 20.0); - - printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - printf("Press p to toggle between per-pixel and per-vertex lighting\n"); - -#ifdef GL_MESA_program_debug - if (argc > 1 && strcmp(argv[1], "fragment") == 0) { - printf(">> Debugging fragment program\n"); - glProgramCallbackMESA(GL_FRAGMENT_PROGRAM_ARB, Debugger2, - (GLvoid *) fragProgramText); - glEnable(GL_FRAGMENT_PROGRAM_CALLBACK_MESA); - } - else { - printf(">> Debugging vertex program\n"); - glProgramCallbackMESA(GL_VERTEX_PROGRAM_ARB, Debugger2, - (GLvoid *) fragProgramText); - glEnable(GL_VERTEX_PROGRAM_CALLBACK_MESA); - } -#endif -} - - -int main( int argc, char *argv[] ) -{ - glutInit( &argc, argv ); - glutInitWindowPosition( 0, 0 ); - glutInitWindowSize( 200, 200 ); - glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH ); - glutCreateWindow(argv[0]); - glutReshapeFunc( Reshape ); - glutKeyboardFunc( Key ); - glutSpecialFunc( SpecialKey ); - glutDisplayFunc( Display ); - if (Anim) - glutIdleFunc(Idle); - Init(argc, argv); - glutMainLoop(); - return 0; -} diff --git a/progs/tests/descrip.mms b/progs/tests/descrip.mms deleted file mode 100644 index b6ba3e1aeb..0000000000 --- a/progs/tests/descrip.mms +++ /dev/null @@ -1,84 +0,0 @@ -# Makefile for GLUT-based demo programs for VMS -# contributed by Jouk Jansen joukj@hrem.stm.tudelft.nl - - -.first - define gl [--.include.gl] - -.include [--]mms-config. - -##### MACROS ##### - -INCDIR = ([--.include],[-.util]) -CFLAGS = /include=$(INCDIR)/prefix=all/name=(as_is,short)/float=ieee/ieee=denorm - -.ifdef SHARE -GL_LIBS = $(XLIBS) -.else -GL_LIBS = [--.lib]libGLUT/l,libMesaGLU/l,libMesaGL/l,$(XLIBS) -.endif - -LIB_DEP = [--.lib]$(GL_LIB) [--.lib]$(GLU_LIB) [--.lib]$(GLUT_LIB) - -PROGS = cva.exe,\ - dinoshade.exe,\ - fogcoord.exe,\ - manytex.exe,\ - multipal.exe,\ - projtex.exe,\ - seccolor.exe,\ - sharedtex.exe,\ - texline.exe,\ - texwrap.exe,\ - vptest1.exe,\ - vptest2.exe,\ - vptest3.exe,\ - vptorus.exe,\ - vpwarpmesh.exe - -##### RULES ##### -.obj.exe : - cxxlink $(MMS$TARGET_NAME),$(GL_LIBS) - -##### TARGETS ##### -default : - $(MMS)$(MMSQUALIFIERS) $(PROGS) - -clean : - delete *.obj;* - -realclean : - delete $(PROGS) - delete *.obj;* - -cva.exe : cva.obj $(LIB_DEP) -dinoshade.exe : dinoshade.obj $(LIB_DEP) -fogcoord.exe : fogcoord.obj $(LIB_DEP) -manytex.exe : manytex.obj $(LIB_DEP) -multipal.exe : multipal.obj $(LIB_DEP) -projtex.exe : projtex.obj $(LIB_DEP) -seccolor.exe : seccolor.obj $(LIB_DEP) -sharedtex.exe : sharedtex.obj $(LIB_DEP) -texline.exe : texline.obj $(LIB_DEP) -texwrap.exe : texwrap.obj $(LIB_DEP) -vptest1.exe : vptest1.obj $(LIB_DEP) -vptest2.exe : vptest2.obj $(LIB_DEP) -vptest3.exe : vptest3.obj $(LIB_DEP) -vptorus.exe : vptorus.obj $(LIB_DEP) -vpwarpmesh.exe : vpwarpmesh.obj $(LIB_DEP) - -cva.obj : cva.c -dinoshade.obj : dinoshade.c -fogcoord.obj : fogcoord.c -manytex.obj : manytex.c -multipal.obj : multipal.c -projtex.obj : projtex.c -seccolor.obj : seccolor.c -sharedtex.obj : sharedtex.c -texline.obj : texline.c -texwrap.obj : texwrap.c -vptest1.obj : vptest1.c -vptest2.obj : vptest2.c -vptest3.obj : vptest3.c -vptorus.obj : vptorus.c -vpwarpmesh.obj : vpwarpmesh.c diff --git a/progs/tests/dinoshade.c b/progs/tests/dinoshade.c deleted file mode 100644 index 44115b9209..0000000000 --- a/progs/tests/dinoshade.c +++ /dev/null @@ -1,910 +0,0 @@ - -/* Copyright (c) Mark J. Kilgard, 1994, 1997. */ - -/* This program is freely distributable without licensing fees - and is provided without guarantee or warrantee expressed or - implied. This program is -not- in the public domain. */ - -/* Example for PC game developers to show how to *combine* texturing, - reflections, and projected shadows all in real-time with OpenGL. - Robust reflections use stenciling. Robust projected shadows - use both stenciling and polygon offset. PC game programmers - should realize that neither stenciling nor polygon offset are - supported by Direct3D, so these real-time rendering algorithms - are only really viable with OpenGL. - - The program has modes for disabling the stenciling and polygon - offset uses. It is worth running this example with these features - toggled off so you can see the sort of artifacts that result. - - Notice that the floor texturing, reflections, and shadowing - all co-exist properly. */ - -/* When you run this program: Left mouse button controls the - view. Middle mouse button controls light position (left & - right rotates light around dino; up & down moves light - position up and down). Right mouse button pops up menu. */ - -/* Check out the comments in the "redraw" routine to see how the - reflection blending and surface stenciling is done. You can - also see in "redraw" how the projected shadows are rendered, - including the use of stenciling and polygon offset. */ - -/* This program is derived from glutdino.c */ - -/* Compile: cc -o dinoshade dinoshade.c -lglut -lGLU -lGL -lXmu -lXext -lX11 -lm */ - -#include -#include -#include -#include /* for cos(), sin(), and sqrt() */ -#include /* for ptrdiff_t, referenced by GL.h when GL_GLEXT_LEGACY defined */ -#ifdef _WIN32 -#include -#endif -#define GL_GLEXT_LEGACY -#include /* OpenGL Utility Toolkit header */ - -/* Some files do not define M_PI... */ -#ifndef M_PI -#define M_PI 3.14159265358979323846 -#endif - -/* Variable controlling various rendering modes. */ -static int stencilReflection = 1, stencilShadow = 1, offsetShadow = 1; -static int renderShadow = 1, renderDinosaur = 1, renderReflection = 1; -static int linearFiltering = 0, useMipmaps = 0, useTexture = 1; -static int reportSpeed = 0; -static int animation = 1; -static GLboolean lightSwitch = GL_TRUE; -static int directionalLight = 1; -static int forceExtension = 0; - -/* Time varying or user-controled variables. */ -static float jump = 0.0; -static float lightAngle = 0.0, lightHeight = 20; -GLfloat angle = -150; /* in degrees */ -GLfloat angle2 = 30; /* in degrees */ - -int moving, startx, starty; -int lightMoving = 0, lightStartX, lightStartY; - -enum { - MISSING, EXTENSION, ONE_DOT_ONE -}; -int polygonOffsetVersion; - -static GLdouble bodyWidth = 3.0; -/* *INDENT-OFF* */ -static GLfloat body[][2] = { {0, 3}, {1, 1}, {5, 1}, {8, 4}, {10, 4}, {11, 5}, - {11, 11.5}, {13, 12}, {13, 13}, {10, 13.5}, {13, 14}, {13, 15}, {11, 16}, - {8, 16}, {7, 15}, {7, 13}, {8, 12}, {7, 11}, {6, 6}, {4, 3}, {3, 2}, - {1, 2} }; -static GLfloat arm[][2] = { {8, 10}, {9, 9}, {10, 9}, {13, 8}, {14, 9}, {16, 9}, - {15, 9.5}, {16, 10}, {15, 10}, {15.5, 11}, {14.5, 10}, {14, 11}, {14, 10}, - {13, 9}, {11, 11}, {9, 11} }; -static GLfloat leg[][2] = { {8, 6}, {8, 4}, {9, 3}, {9, 2}, {8, 1}, {8, 0.5}, {9, 0}, - {12, 0}, {10, 1}, {10, 2}, {12, 4}, {11, 6}, {10, 7}, {9, 7} }; -static GLfloat eye[][2] = { {8.75, 15}, {9, 14.7}, {9.6, 14.7}, {10.1, 15}, - {9.6, 15.25}, {9, 15.25} }; -static GLfloat lightPosition[4]; -static GLfloat lightColor[] = {0.8, 1.0, 0.8, 1.0}; /* green-tinted */ -static GLfloat skinColor[] = {0.1, 1.0, 0.1, 1.0}, eyeColor[] = {1.0, 0.2, 0.2, 1.0}; -/* *INDENT-ON* */ - -/* Nice floor texture tiling pattern. */ -static char *circles[] = { - "....xxxx........", - "..xxxxxxxx......", - ".xxxxxxxxxx.....", - ".xxx....xxx.....", - "xxx......xxx....", - "xxx......xxx....", - "xxx......xxx....", - "xxx......xxx....", - ".xxx....xxx.....", - ".xxxxxxxxxx.....", - "..xxxxxxxx......", - "....xxxx........", - "................", - "................", - "................", - "................", -}; - -static void -makeFloorTexture(void) -{ - GLubyte floorTexture[16][16][3]; - GLubyte *loc; - int s, t; - - /* Setup RGB image for the texture. */ - loc = (GLubyte*) floorTexture; - for (t = 0; t < 16; t++) { - for (s = 0; s < 16; s++) { - if (circles[t][s] == 'x') { - /* Nice green. */ - loc[0] = 0x1f; - loc[1] = 0x8f; - loc[2] = 0x1f; - } else { - /* Light gray. */ - loc[0] = 0xaa; - loc[1] = 0xaa; - loc[2] = 0xaa; - } - loc += 3; - } - } - - glPixelStorei(GL_UNPACK_ALIGNMENT, 1); - - if (useMipmaps) { - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, - GL_LINEAR_MIPMAP_LINEAR); - gluBuild2DMipmaps(GL_TEXTURE_2D, 3, 16, 16, - GL_RGB, GL_UNSIGNED_BYTE, floorTexture); - } else { - if (linearFiltering) { - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - } else { - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - } - glTexImage2D(GL_TEXTURE_2D, 0, 3, 16, 16, 0, - GL_RGB, GL_UNSIGNED_BYTE, floorTexture); - } -} - -enum { - X, Y, Z, W -}; -enum { - A, B, C, D -}; - -/* Create a matrix that will project the desired shadow. */ -void -shadowMatrix(GLfloat shadowMat[4][4], - GLfloat groundplane[4], - GLfloat lightpos[4]) -{ - GLfloat dot; - - /* Find dot product between light position vector and ground plane normal. */ - dot = groundplane[X] * lightpos[X] + - groundplane[Y] * lightpos[Y] + - groundplane[Z] * lightpos[Z] + - groundplane[W] * lightpos[W]; - - shadowMat[0][0] = dot - lightpos[X] * groundplane[X]; - shadowMat[1][0] = 0.f - lightpos[X] * groundplane[Y]; - shadowMat[2][0] = 0.f - lightpos[X] * groundplane[Z]; - shadowMat[3][0] = 0.f - lightpos[X] * groundplane[W]; - - shadowMat[X][1] = 0.f - lightpos[Y] * groundplane[X]; - shadowMat[1][1] = dot - lightpos[Y] * groundplane[Y]; - shadowMat[2][1] = 0.f - lightpos[Y] * groundplane[Z]; - shadowMat[3][1] = 0.f - lightpos[Y] * groundplane[W]; - - shadowMat[X][2] = 0.f - lightpos[Z] * groundplane[X]; - shadowMat[1][2] = 0.f - lightpos[Z] * groundplane[Y]; - shadowMat[2][2] = dot - lightpos[Z] * groundplane[Z]; - shadowMat[3][2] = 0.f - lightpos[Z] * groundplane[W]; - - shadowMat[X][3] = 0.f - lightpos[W] * groundplane[X]; - shadowMat[1][3] = 0.f - lightpos[W] * groundplane[Y]; - shadowMat[2][3] = 0.f - lightpos[W] * groundplane[Z]; - shadowMat[3][3] = dot - lightpos[W] * groundplane[W]; - -} - -/* Find the plane equation given 3 points. */ -void -findPlane(GLfloat plane[4], - GLfloat v0[3], GLfloat v1[3], GLfloat v2[3]) -{ - GLfloat vec0[3], vec1[3]; - - /* Need 2 vectors to find cross product. */ - vec0[X] = v1[X] - v0[X]; - vec0[Y] = v1[Y] - v0[Y]; - vec0[Z] = v1[Z] - v0[Z]; - - vec1[X] = v2[X] - v0[X]; - vec1[Y] = v2[Y] - v0[Y]; - vec1[Z] = v2[Z] - v0[Z]; - - /* find cross product to get A, B, and C of plane equation */ - plane[A] = vec0[Y] * vec1[Z] - vec0[Z] * vec1[Y]; - plane[B] = -(vec0[X] * vec1[Z] - vec0[Z] * vec1[X]); - plane[C] = vec0[X] * vec1[Y] - vec0[Y] * vec1[X]; - - plane[D] = -(plane[A] * v0[X] + plane[B] * v0[Y] + plane[C] * v0[Z]); -} - -void -extrudeSolidFromPolygon(GLfloat data[][2], unsigned int dataSize, - GLdouble thickness, GLuint side, GLuint edge, GLuint whole) -{ - static GLUtriangulatorObj *tobj = NULL; - GLdouble vertex[3], dx, dy, len; - int i; - int count = (int) (dataSize / (2 * sizeof(GLfloat))); - - if (tobj == NULL) { - tobj = gluNewTess(); /* create and initialize a GLU - polygon tesselation object */ - gluTessCallback(tobj, GLU_BEGIN, glBegin); - gluTessCallback(tobj, GLU_VERTEX, glVertex2fv); /* semi-tricky */ - gluTessCallback(tobj, GLU_END, glEnd); - } - glNewList(side, GL_COMPILE); - glShadeModel(GL_SMOOTH); /* smooth minimizes seeing - tessellation */ - gluBeginPolygon(tobj); - for (i = 0; i < count; i++) { - vertex[0] = data[i][0]; - vertex[1] = data[i][1]; - vertex[2] = 0; - gluTessVertex(tobj, vertex, data[i]); - } - gluEndPolygon(tobj); - glEndList(); - glNewList(edge, GL_COMPILE); - glShadeModel(GL_FLAT); /* flat shade keeps angular hands - from being "smoothed" */ - glBegin(GL_QUAD_STRIP); - for (i = 0; i <= count; i++) { -#if 1 /* weird, but seems to be legal */ - /* mod function handles closing the edge */ - glVertex3f(data[i % count][0], data[i % count][1], 0.0); - glVertex3f(data[i % count][0], data[i % count][1], thickness); - /* Calculate a unit normal by dividing by Euclidean - distance. We * could be lazy and use - glEnable(GL_NORMALIZE) so we could pass in * arbitrary - normals for a very slight performance hit. */ - dx = data[(i + 1) % count][1] - data[i % count][1]; - dy = data[i % count][0] - data[(i + 1) % count][0]; - len = sqrt(dx * dx + dy * dy); - glNormal3f(dx / len, dy / len, 0.0); -#else /* the nice way of doing it */ - /* Calculate a unit normal by dividing by Euclidean - distance. We * could be lazy and use - glEnable(GL_NORMALIZE) so we could pass in * arbitrary - normals for a very slight performance hit. */ - dx = data[i % count][1] - data[(i - 1 + count) % count][1]; - dy = data[(i - 1 + count) % count][0] - data[i % count][0]; - len = sqrt(dx * dx + dy * dy); - glNormal3f(dx / len, dy / len, 0.0); - /* mod function handles closing the edge */ - glVertex3f(data[i % count][0], data[i % count][1], 0.0); - glVertex3f(data[i % count][0], data[i % count][1], thickness); -#endif - } - glEnd(); - glEndList(); - glNewList(whole, GL_COMPILE); - glFrontFace(GL_CW); - glCallList(edge); - glNormal3f(0.0, 0.0, -1.0); /* constant normal for side */ - glCallList(side); - glPushMatrix(); - glTranslatef(0.0, 0.0, thickness); - glFrontFace(GL_CCW); - glNormal3f(0.0, 0.0, 1.0); /* opposite normal for other side */ - glCallList(side); - glPopMatrix(); - glEndList(); -} - -/* Enumerants for refering to display lists. */ -typedef enum { - RESERVED, BODY_SIDE, BODY_EDGE, BODY_WHOLE, ARM_SIDE, ARM_EDGE, ARM_WHOLE, - LEG_SIDE, LEG_EDGE, LEG_WHOLE, EYE_SIDE, EYE_EDGE, EYE_WHOLE -} displayLists; - -static void -makeDinosaur(void) -{ - extrudeSolidFromPolygon(body, sizeof(body), bodyWidth, - BODY_SIDE, BODY_EDGE, BODY_WHOLE); - extrudeSolidFromPolygon(arm, sizeof(arm), bodyWidth / 4, - ARM_SIDE, ARM_EDGE, ARM_WHOLE); - extrudeSolidFromPolygon(leg, sizeof(leg), bodyWidth / 2, - LEG_SIDE, LEG_EDGE, LEG_WHOLE); - extrudeSolidFromPolygon(eye, sizeof(eye), bodyWidth + 0.2, - EYE_SIDE, EYE_EDGE, EYE_WHOLE); -} - -static void -drawDinosaur(void) - -{ - glPushMatrix(); - /* Translate the dinosaur to be at (0,8,0). */ - glTranslatef(-8, 0, -bodyWidth / 2); - glTranslatef(0.0, jump, 0.0); - glMaterialfv(GL_FRONT, GL_DIFFUSE, skinColor); - glCallList(BODY_WHOLE); - glTranslatef(0.0, 0.0, bodyWidth); - glCallList(ARM_WHOLE); - glCallList(LEG_WHOLE); - glTranslatef(0.0, 0.0, -bodyWidth - bodyWidth / 4); - glCallList(ARM_WHOLE); - glTranslatef(0.0, 0.0, -bodyWidth / 4); - glCallList(LEG_WHOLE); - glTranslatef(0.0, 0.0, bodyWidth / 2 - 0.1); - glMaterialfv(GL_FRONT, GL_DIFFUSE, eyeColor); - glCallList(EYE_WHOLE); - glPopMatrix(); -} - -static GLfloat floorVertices[4][3] = { - { -20.0, 0.0, 20.0 }, - { 20.0, 0.0, 20.0 }, - { 20.0, 0.0, -20.0 }, - { -20.0, 0.0, -20.0 }, -}; - -/* Draw a floor (possibly textured). */ -static void -drawFloor(void) -{ - glDisable(GL_LIGHTING); - - if (useTexture) { - glEnable(GL_TEXTURE_2D); - } - - glBegin(GL_QUADS); - glTexCoord2f(0.0, 0.0); - glVertex3fv(floorVertices[0]); - glTexCoord2f(0.0, 16.0); - glVertex3fv(floorVertices[1]); - glTexCoord2f(16.0, 16.0); - glVertex3fv(floorVertices[2]); - glTexCoord2f(16.0, 0.0); - glVertex3fv(floorVertices[3]); - glEnd(); - - if (useTexture) { - glDisable(GL_TEXTURE_2D); - } - - glEnable(GL_LIGHTING); -} - -static GLfloat floorPlane[4]; -static GLfloat floorShadow[4][4]; - -static void -redraw(void) -{ - int start, end; - - if (reportSpeed) { - start = glutGet(GLUT_ELAPSED_TIME); - } - - /* Clear; default stencil clears to zero. */ - if ((stencilReflection && renderReflection) || (stencilShadow && renderShadow)) { - glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); - } else { - /* Avoid clearing stencil when not using it. */ - glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); - } - - /* Reposition the light source. */ - lightPosition[0] = 12*cos(lightAngle); - lightPosition[1] = lightHeight; - lightPosition[2] = 12*sin(lightAngle); - if (directionalLight) { - lightPosition[3] = 0.0; - } else { - lightPosition[3] = 1.0; - } - - shadowMatrix(floorShadow, floorPlane, lightPosition); - - glPushMatrix(); - /* Perform scene rotations based on user mouse input. */ - glRotatef(angle2, 1.0, 0.0, 0.0); - glRotatef(angle, 0.0, 1.0, 0.0); - - /* Tell GL new light source position. */ - glLightfv(GL_LIGHT0, GL_POSITION, lightPosition); - - if (renderReflection) { - if (stencilReflection) { - /* We can eliminate the visual "artifact" of seeing the "flipped" - dinosaur underneath the floor by using stencil. The idea is - draw the floor without color or depth update but so that - a stencil value of one is where the floor will be. Later when - rendering the dinosaur reflection, we will only update pixels - with a stencil value of 1 to make sure the reflection only - lives on the floor, not below the floor. */ - - /* Don't update color or depth. */ - glDisable(GL_DEPTH_TEST); - glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE); - - /* Draw 1 into the stencil buffer. */ - glEnable(GL_STENCIL_TEST); - glStencilOp(GL_REPLACE, GL_REPLACE, GL_REPLACE); - glStencilFunc(GL_ALWAYS, 1, 0xffffffff); - - /* Now render floor; floor pixels just get their stencil set to 1. */ - drawFloor(); - - /* Re-enable update of color and depth. */ - glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); - glEnable(GL_DEPTH_TEST); - - /* Now, only render where stencil is set to 1. */ - glStencilFunc(GL_EQUAL, 1, 0xffffffff); /* draw if ==1 */ - glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP); - } - - glPushMatrix(); - - /* The critical reflection step: Reflect dinosaur through the floor - (the Y=0 plane) to make a relection. */ - glScalef(1.0, -1.0, 1.0); - - /* Reflect the light position. */ - glLightfv(GL_LIGHT0, GL_POSITION, lightPosition); - - /* To avoid our normals getting reversed and hence botched lighting - on the reflection, turn on normalize. */ - glEnable(GL_NORMALIZE); - glCullFace(GL_FRONT); - - /* Draw the reflected dinosaur. */ - drawDinosaur(); - - /* Disable noramlize again and re-enable back face culling. */ - glDisable(GL_NORMALIZE); - glCullFace(GL_BACK); - - glPopMatrix(); - - /* Switch back to the unreflected light position. */ - glLightfv(GL_LIGHT0, GL_POSITION, lightPosition); - - if (stencilReflection) { - glDisable(GL_STENCIL_TEST); - } - } - - /* Back face culling will get used to only draw either the top or the - bottom floor. This let's us get a floor with two distinct - appearances. The top floor surface is reflective and kind of red. - The bottom floor surface is not reflective and blue. */ - - /* Draw "bottom" of floor in blue. */ - glFrontFace(GL_CW); /* Switch face orientation. */ - glColor4f(0.1, 0.1, 0.7, 1.0); - drawFloor(); - glFrontFace(GL_CCW); - - if (renderShadow) { - if (stencilShadow) { - /* Draw the floor with stencil value 3. This helps us only - draw the shadow once per floor pixel (and only on the - floor pixels). */ - glEnable(GL_STENCIL_TEST); - glStencilFunc(GL_ALWAYS, 3, 0xffffffff); - glStencilOp(GL_KEEP, GL_KEEP, GL_REPLACE); - } - } - - /* Draw "top" of floor. Use blending to blend in reflection. */ - glEnable(GL_BLEND); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glColor4f(0.7, 0.0, 0.0, 0.3); - glColor4f(1.0, 1.0, 1.0, 0.3); - drawFloor(); - glDisable(GL_BLEND); - - if (renderDinosaur) { - /* Draw "actual" dinosaur, not its reflection. */ - drawDinosaur(); - } - - if (renderShadow) { - - /* Render the projected shadow. */ - - if (stencilShadow) { - - /* Now, only render where stencil is set above 2 (ie, 3 where - the top floor is). Update stencil with 2 where the shadow - gets drawn so we don't redraw (and accidently reblend) the - shadow). */ - glStencilFunc(GL_LESS, 2, 0xffffffff); /* draw if ==1 */ - glStencilOp(GL_REPLACE, GL_REPLACE, GL_REPLACE); - } - - /* To eliminate depth buffer artifacts, we use polygon offset - to raise the depth of the projected shadow slightly so - that it does not depth buffer alias with the floor. */ - if (offsetShadow) { - switch (polygonOffsetVersion) { - case EXTENSION: -#ifdef GL_EXT_polygon_offset - glEnable(GL_POLYGON_OFFSET_EXT); - break; -#endif -#ifdef GL_VERSION_1_1 - case ONE_DOT_ONE: - glEnable(GL_POLYGON_OFFSET_FILL); - break; -#endif - case MISSING: - /* Oh well. */ - break; - } - } - - /* Render 50% black shadow color on top of whatever the - floor appareance is. */ - glEnable(GL_BLEND); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glDisable(GL_LIGHTING); /* Force the 50% black. */ - glColor4f(0.0, 0.0, 0.0, 0.5); - - glPushMatrix(); - /* Project the shadow. */ - glMultMatrixf((GLfloat *) floorShadow); - drawDinosaur(); - glPopMatrix(); - - glDisable(GL_BLEND); - glEnable(GL_LIGHTING); - - if (offsetShadow) { - switch (polygonOffsetVersion) { -#ifdef GL_EXT_polygon_offset - case EXTENSION: - glDisable(GL_POLYGON_OFFSET_EXT); - break; -#endif -#ifdef GL_VERSION_1_1 - case ONE_DOT_ONE: - glDisable(GL_POLYGON_OFFSET_FILL); - break; -#endif - case MISSING: - /* Oh well. */ - break; - } - } - if (stencilShadow) { - glDisable(GL_STENCIL_TEST); - } - } - - glPushMatrix(); - glDisable(GL_LIGHTING); - glColor3f(1.0, 1.0, 0.0); - if (directionalLight) { - /* Draw an arrowhead. */ - glDisable(GL_CULL_FACE); - glTranslatef(lightPosition[0], lightPosition[1], lightPosition[2]); - glRotatef(lightAngle * -180.0 / M_PI, 0, 1, 0); - glRotatef(atan(lightHeight/12) * 180.0 / M_PI, 0, 0, 1); - glBegin(GL_TRIANGLE_FAN); - glVertex3f(0, 0, 0); - glVertex3f(2, 1, 1); - glVertex3f(2, -1, 1); - glVertex3f(2, -1, -1); - glVertex3f(2, 1, -1); - glVertex3f(2, 1, 1); - glEnd(); - /* Draw a white line from light direction. */ - glColor3f(1.0, 1.0, 1.0); - glBegin(GL_LINES); - glVertex3f(0, 0, 0); - glVertex3f(5, 0, 0); - glEnd(); - glEnable(GL_CULL_FACE); - } else { - /* Draw a yellow ball at the light source. */ - glTranslatef(lightPosition[0], lightPosition[1], lightPosition[2]); - glutSolidSphere(1.0, 5, 5); - } - glEnable(GL_LIGHTING); - glPopMatrix(); - - glPopMatrix(); - - if (reportSpeed) { - glFinish(); - end = glutGet(GLUT_ELAPSED_TIME); - printf("Speed %.3g frames/sec (%d ms)\n", 1000.0/(end-start), end-start); - } - - glutSwapBuffers(); -} - -/* ARGSUSED2 */ -static void -mouse(int button, int state, int x, int y) -{ - if (button == GLUT_LEFT_BUTTON) { - if (state == GLUT_DOWN) { - moving = 1; - startx = x; - starty = y; - } - if (state == GLUT_UP) { - moving = 0; - } - } - if (button == GLUT_MIDDLE_BUTTON) { - if (state == GLUT_DOWN) { - lightMoving = 1; - lightStartX = x; - lightStartY = y; - } - if (state == GLUT_UP) { - lightMoving = 0; - } - } -} - -/* ARGSUSED1 */ -static void -motion(int x, int y) -{ - if (moving) { - angle = angle + (x - startx); - angle2 = angle2 + (y - starty); - startx = x; - starty = y; - glutPostRedisplay(); - } - if (lightMoving) { - lightAngle += (x - lightStartX)/40.0; - lightHeight += (lightStartY - y)/20.0; - lightStartX = x; - lightStartY = y; - glutPostRedisplay(); - } -} - -/* Advance time varying state when idle callback registered. */ -static void -idle(void) -{ - static float time = 0.0; - - time = glutGet(GLUT_ELAPSED_TIME) / 500.0; - - jump = 4.0 * fabs(sin(time)*0.5); - if (!lightMoving) { - lightAngle += 0.03; - } - glutPostRedisplay(); -} - -enum { - M_NONE, M_MOTION, M_LIGHT, M_TEXTURE, M_SHADOWS, M_REFLECTION, M_DINOSAUR, - M_STENCIL_REFLECTION, M_STENCIL_SHADOW, M_OFFSET_SHADOW, - M_POSITIONAL, M_DIRECTIONAL, M_PERFORMANCE -}; - -static void -controlLights(int value) -{ - switch (value) { - case M_NONE: - return; - case M_MOTION: - animation = 1 - animation; - if (animation) { - glutIdleFunc(idle); - } else { - glutIdleFunc(NULL); - } - break; - case M_LIGHT: - lightSwitch = !lightSwitch; - if (lightSwitch) { - glEnable(GL_LIGHT0); - } else { - glDisable(GL_LIGHT0); - } - break; - case M_TEXTURE: - useTexture = !useTexture; - break; - case M_SHADOWS: - renderShadow = 1 - renderShadow; - break; - case M_REFLECTION: - renderReflection = 1 - renderReflection; - break; - case M_DINOSAUR: - renderDinosaur = 1 - renderDinosaur; - break; - case M_STENCIL_REFLECTION: - stencilReflection = 1 - stencilReflection; - break; - case M_STENCIL_SHADOW: - stencilShadow = 1 - stencilShadow; - break; - case M_OFFSET_SHADOW: - offsetShadow = 1 - offsetShadow; - break; - case M_POSITIONAL: - directionalLight = 0; - break; - case M_DIRECTIONAL: - directionalLight = 1; - break; - case M_PERFORMANCE: - reportSpeed = 1 - reportSpeed; - break; - } - glutPostRedisplay(); -} - -/* When not visible, stop animating. Restart when visible again. */ -static void -visible(int vis) -{ - if (vis == GLUT_VISIBLE) { - if (animation) - glutIdleFunc(idle); - } else { - if (!animation) - glutIdleFunc(NULL); - } -} - -/* Press any key to redraw; good when motion stopped and - performance reporting on. */ -/* ARGSUSED */ -static void -key(unsigned char c, int x, int y) -{ - if (c == 27) { - exit(0); /* IRIS GLism, Escape quits. */ - } - glutPostRedisplay(); -} - -/* Press any key to redraw; good when motion stopped and - performance reporting on. */ -/* ARGSUSED */ -static void -special(int k, int x, int y) -{ - glutPostRedisplay(); -} - -static int -supportsOneDotOne(void) -{ - const char *version; - int major, minor; - - version = (char *) glGetString(GL_VERSION); - if (sscanf(version, "%d.%d", &major, &minor) == 2) - return major * 10 + minor >= 11; - return 0; /* OpenGL version string malformed! */ -} - -int -main(int argc, char **argv) -{ - int i; - - glutInit(&argc, argv); - - for (i=1; i=2 rgb double depth"); -#endif - - glutCreateWindow("Shadowy Leapin' Lizards"); - - if (glutGet(GLUT_WINDOW_STENCIL_SIZE) <= 1) { - printf("dinoshade: Sorry, I need at least 2 bits of stencil.\n"); - exit(1); - } - - /* Register GLUT callbacks. */ - glutDisplayFunc(redraw); - glutMouseFunc(mouse); - glutMotionFunc(motion); - glutVisibilityFunc(visible); - glutKeyboardFunc(key); - glutSpecialFunc(special); - - glutCreateMenu(controlLights); - - glutAddMenuEntry("Toggle motion", M_MOTION); - glutAddMenuEntry("-----------------------", M_NONE); - glutAddMenuEntry("Toggle light", M_LIGHT); - glutAddMenuEntry("Toggle texture", M_TEXTURE); - glutAddMenuEntry("Toggle shadows", M_SHADOWS); - glutAddMenuEntry("Toggle reflection", M_REFLECTION); - glutAddMenuEntry("Toggle dinosaur", M_DINOSAUR); - glutAddMenuEntry("-----------------------", M_NONE); - glutAddMenuEntry("Toggle reflection stenciling", M_STENCIL_REFLECTION); - glutAddMenuEntry("Toggle shadow stenciling", M_STENCIL_SHADOW); - glutAddMenuEntry("Toggle shadow offset", M_OFFSET_SHADOW); - glutAddMenuEntry("----------------------", M_NONE); - glutAddMenuEntry("Positional light", M_POSITIONAL); - glutAddMenuEntry("Directional light", M_DIRECTIONAL); - glutAddMenuEntry("-----------------------", M_NONE); - glutAddMenuEntry("Toggle performance", M_PERFORMANCE); - glutAttachMenu(GLUT_RIGHT_BUTTON); - makeDinosaur(); - -#ifdef GL_VERSION_1_1 - if (supportsOneDotOne() && !forceExtension) { - polygonOffsetVersion = ONE_DOT_ONE; - glPolygonOffset(-2.0, -9.0); - } else -#endif - { -#ifdef GL_EXT_polygon_offset - /* check for the polygon offset extension */ - if (glutExtensionSupported("GL_EXT_polygon_offset")) { - polygonOffsetVersion = EXTENSION; - glPolygonOffsetEXT(-2.0, -0.002); - } else -#endif - { - polygonOffsetVersion = MISSING; - printf("\ndinoshine: Missing polygon offset.\n"); - printf(" Expect shadow depth aliasing artifacts.\n\n"); - } - } - - glEnable(GL_CULL_FACE); - glEnable(GL_DEPTH_TEST); - glEnable(GL_TEXTURE_2D); - glLineWidth(3.0); - - glMatrixMode(GL_PROJECTION); - gluPerspective( /* field of view in degree */ 40.0, - /* aspect ratio */ 1.0, - /* Z near */ 20.0, /* Z far */ 100.0); - glMatrixMode(GL_MODELVIEW); - gluLookAt(0.0, 8.0, 60.0, /* eye is at (0,8,60) */ - 0.0, 8.0, 0.0, /* center is at (0,8,0) */ - 0.0, 1.0, 0.); /* up is in postivie Y direction */ - - glLightModeli(GL_LIGHT_MODEL_LOCAL_VIEWER, 1); - glLightfv(GL_LIGHT0, GL_DIFFUSE, lightColor); - glLightf(GL_LIGHT0, GL_CONSTANT_ATTENUATION, 0.1); - glLightf(GL_LIGHT0, GL_LINEAR_ATTENUATION, 0.05); - glEnable(GL_LIGHT0); - glEnable(GL_LIGHTING); - - makeFloorTexture(); - - /* Setup floor plane for projected shadow calculations. */ - findPlane(floorPlane, floorVertices[1], floorVertices[2], floorVertices[3]); - - glutMainLoop(); - return 0; /* ANSI C requires main to return int. */ -} diff --git a/progs/tests/drawbuffers.c b/progs/tests/drawbuffers.c deleted file mode 100644 index 5e89569380..0000000000 --- a/progs/tests/drawbuffers.c +++ /dev/null @@ -1,303 +0,0 @@ -/* - * Test GL_ARB_draw_buffers, GL_EXT_framebuffer_object - * and GLSL's gl_FragData[]. - * - * Brian Paul - * 11 March 2007 - */ - - -#define GL_GLEXT_PROTOTYPES -#include -#include -#include -#include -#include -#include "extfuncs.h" - -static int Win; -static int Width = 400, Height = 400; -static GLuint FBobject, RBobjects[3]; -static GLfloat Xrot = 0.0, Yrot = 0.0; -static GLuint Program; - - -static void -CheckError(int line) -{ - GLenum err = glGetError(); - if (err) { - printf("GL Error 0x%x at line %d\n", (int) err, line); - } -} - - -static void -Display(void) -{ - GLubyte *buffer = malloc(Width * Height * 4); - static const GLenum buffers[2] = { - GL_COLOR_ATTACHMENT0_EXT, - GL_COLOR_ATTACHMENT1_EXT - }; - - glUseProgram_func(Program); - - /* draw to user framebuffer */ - glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, FBobject); - - /* Clear color buffer 0 (blue) */ - glDrawBuffer(GL_COLOR_ATTACHMENT0_EXT); - glClearColor(0.5, 0.5, 1.0, 0.0); - glClear(GL_COLOR_BUFFER_BIT); - - /* Clear color buffer 1 (1 - blue) */ - glDrawBuffer(GL_COLOR_ATTACHMENT1_EXT); - glClearColor(0.5, 0.5, 0.0, 0.0); - glClear(GL_COLOR_BUFFER_BIT); - - glClear(GL_DEPTH_BUFFER_BIT); - - /* draw to two buffers w/ fragment shader */ - glDrawBuffersARB(2, buffers); - - glPushMatrix(); - glRotatef(Xrot, 1, 0, 0); - glRotatef(Yrot, 0, 1, 0); - glutSolidTorus(0.75, 2.0, 10, 20); - glPopMatrix(); - - /* read from user framebuffer */ - /* bottom half = colorbuffer 0 */ - glReadBuffer(GL_COLOR_ATTACHMENT0_EXT); - glReadPixels(0, 0, Width, Height / 2, GL_RGBA, GL_UNSIGNED_BYTE, - buffer); - /* top half = colorbuffer 1 */ - glReadBuffer(GL_COLOR_ATTACHMENT1_EXT); - glReadPixels(0, Height/2, Width, Height - Height / 2, - GL_RGBA, GL_UNSIGNED_BYTE, - buffer + Width * (Height / 2) * 4); - - /* draw to window */ - glUseProgram_func(0); - glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); - glWindowPos2iARB(0, 0); - glDrawPixels(Width, Height, GL_RGBA, GL_UNSIGNED_BYTE, buffer); - - free(buffer); - glutSwapBuffers(); - CheckError(__LINE__); -} - - -static void -Reshape(int width, int height) -{ - float ar = (float) width / (float) height; - - glViewport(0, 0, width, height); - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glFrustum(-ar, ar, -1.0, 1.0, 5.0, 35.0); - glMatrixMode(GL_MODELVIEW); - glLoadIdentity(); - glTranslatef(0.0, 0.0, -20.0); - - Width = width; - Height = height; - - glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, RBobjects[0]); - glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_RGB, Width, Height); - glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, RBobjects[1]); - glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_RGB, Width, Height); - glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, RBobjects[2]); - glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_DEPTH_COMPONENT, - Width, Height); -} - - -static void -CleanUp(void) -{ - glDeleteFramebuffersEXT(1, &FBobject); - glDeleteRenderbuffersEXT(3, RBobjects); - glutDestroyWindow(Win); - exit(0); -} - - -static void -Key(unsigned char key, int x, int y) -{ - (void) x; - (void) y; - switch (key) { - case 'x': - Xrot += 5.0; - break; - case 'y': - Yrot += 5.0; - break; - case 27: - CleanUp(); - break; - } - glutPostRedisplay(); -} - - -static void -CheckExtensions(void) -{ - const char *version = (const char *) glGetString(GL_VERSION); - GLint numBuf; - - if (!glutExtensionSupported("GL_EXT_framebuffer_object")) { - printf("Sorry, GL_EXT_framebuffer_object is required!\n"); - exit(1); - } - if (!glutExtensionSupported("GL_ARB_draw_buffers")) { - printf("Sorry, GL_ARB_draw_buffers is required!\n"); - exit(1); - } - if (version[0] != '2') { - printf("Sorry, OpenGL 2.0 is required!\n"); - exit(1); - } - - glGetIntegerv(GL_MAX_DRAW_BUFFERS_ARB, &numBuf); - printf("GL_MAX_DRAW_BUFFERS_ARB = %d\n", numBuf); - if (numBuf < 2) { - printf("Sorry, GL_MAX_DRAW_BUFFERS_ARB needs to be >= 2\n"); - exit(1); - } - - printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); -} - - -static void -SetupRenderbuffers(void) -{ - glGenFramebuffersEXT(1, &FBobject); - glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, FBobject); - - glGenRenderbuffersEXT(3, RBobjects); - - glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, RBobjects[0]); - glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_RGB, Width, Height); - - glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, RBobjects[1]); - glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_RGB, Width, Height); - - glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, RBobjects[2]); - glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_DEPTH_COMPONENT, - Width, Height); - - glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, - GL_RENDERBUFFER_EXT, RBobjects[0]); - glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT1_EXT, - GL_RENDERBUFFER_EXT, RBobjects[1]); - glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, - GL_RENDERBUFFER_EXT, RBobjects[2]); - - CheckError(__LINE__); -} - - -static GLuint -LoadAndCompileShader(GLenum target, const char *text) -{ - GLint stat; - GLuint shader = glCreateShader_func(target); - glShaderSource_func(shader, 1, (const GLchar **) &text, NULL); - glCompileShader_func(shader); - glGetShaderiv_func(shader, GL_COMPILE_STATUS, &stat); - if (!stat) { - GLchar log[1000]; - GLsizei len; - glGetShaderInfoLog_func(shader, 1000, &len, log); - fprintf(stderr, "drawbuffers: problem compiling shader:\n%s\n", log); - exit(1); - } - return shader; -} - - -static void -CheckLink(GLuint prog) -{ - GLint stat; - glGetProgramiv_func(prog, GL_LINK_STATUS, &stat); - if (!stat) { - GLchar log[1000]; - GLsizei len; - glGetProgramInfoLog_func(prog, 1000, &len, log); - fprintf(stderr, "drawbuffers: shader link error:\n%s\n", log); - } -} - - -static void -SetupShaders(void) -{ - /* second color output = 1 - first color */ - static const char *fragShaderText = - "void main() {\n" - " gl_FragData[0] = gl_Color; \n" - " gl_FragData[1] = vec4(1.0) - gl_Color; \n" - "}\n"; - - GLuint fragShader; - - fragShader = LoadAndCompileShader(GL_FRAGMENT_SHADER, fragShaderText); - Program = glCreateProgram_func(); - - glAttachShader_func(Program, fragShader); - glLinkProgram_func(Program); - CheckLink(Program); - glUseProgram_func(Program); -} - - -static void -SetupLighting(void) -{ - static const GLfloat frontMat[4] = { 1.0, 0.5, 0.5, 1.0 }; - static const GLfloat backMat[4] = { 1.0, 0.5, 0.5, 1.0 }; - - glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, frontMat); - glMaterialfv(GL_BACK, GL_AMBIENT_AND_DIFFUSE, backMat); - glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, 1); - glEnable(GL_LIGHT0); - glEnable(GL_LIGHTING); -} - - -static void -Init(void) -{ - CheckExtensions(); - GetExtensionFuncs(); - SetupRenderbuffers(); - SetupShaders(); - SetupLighting(); - glEnable(GL_DEPTH_TEST); -} - - -int -main(int argc, char *argv[]) -{ - glutInit(&argc, argv); - glutInitWindowPosition(0, 0); - glutInitWindowSize(Width, Height); - glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE); - Win = glutCreateWindow(argv[0]); - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Display); - Init(); - glutMainLoop(); - return 0; -} diff --git a/progs/tests/exactrast.c b/progs/tests/exactrast.c deleted file mode 100644 index 56c0c79c3f..0000000000 --- a/progs/tests/exactrast.c +++ /dev/null @@ -1,200 +0,0 @@ -/** - * Test for exact point/line/polygon rasterization, or at least rasterization - * that fits the tolerance of the OpenGL spec. - * - * Brian Paul - * 9 Nov 2007 - */ - -/* - * Notes: - * - 'm' to cycle through point, hline, vline and quad drawing - * - Use cursor keys to translate coordinates (z to reset) - * - Resize window to check for proper rasterization - * - Make sure your LCD is running in its native resolution - * - * If translation is (0,0): - * a point will be drawn where x%2==0 and y%2==0, - * a horizontal line will be drawn where x%2==0, - * a vertical line will be drawn where y%2==0, - * for quads, pixels will be set where (x%4)!=3 and (y%4)!=3 - * - * XXX todo: do glReadPixels and test that the results are what's expected. - * Upon failure, iterate over sub-pixel translations to find the ideal offset. - */ - - -#include -#include -#include - -static int Width = 400, Height = 400; -static int Win; -static float Xtrans = 0, Ytrans = 0; -static float Step = 0.125; - -enum { - POINTS, - HLINES, - VLINES, - QUADS, - NUM_MODES -}; - -static int Mode = POINTS; - - -static void -Draw(void) -{ - /* See the OpenGL Programming Guide, Appendix H, "OpenGL Correctness Tips" - * for information about the 0.375 translation factor. - */ - float tx = 0.375, ty = 0.375; - int i, j; - - glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); - - glPushMatrix(); - glTranslatef(tx + Xtrans, ty + Ytrans, 0); - - if (Mode == POINTS) { - glBegin(GL_POINTS); - for (j = 0; j < Height; j += 2) { - for (i = 0; i < Width; i += 2) { - glVertex2f(i, j); - } - } - glEnd(); - } - else if (Mode == HLINES) { - glBegin(GL_LINES); - for (i = 0; i < Height; i += 2) { - glVertex2f(0, i); - glVertex2f(Width, i); - } - glEnd(); - } - else if (Mode == VLINES) { - glBegin(GL_LINES); - for (i = 0; i < Width; i += 2) { - glVertex2f(i, 0 ); - glVertex2f(i, Height); - } - glEnd(); - } - else if (Mode == QUADS) { - glBegin(GL_QUADS); - for (j = 0; j < Height; j += 4) { - for (i = 0; i < Width; i += 4) { - glVertex2f(i, j ); - glVertex2f(i + 3, j ); - glVertex2f(i + 3, j + 3); - glVertex2f(i, j + 3); - } - } - glEnd(); - } - - glPopMatrix(); - - glutSwapBuffers(); -} - - -static void -Reshape(int width, int height) -{ - Width = width; - Height = height; - glViewport(0, 0, width, height); - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glOrtho(0, width, 0, height, -1, 1); - glMatrixMode(GL_MODELVIEW); - glLoadIdentity(); -} - - -static void -Key(unsigned char key, int x, int y) -{ - (void) x; - (void) y; - switch (key) { - case 'm': - case 'M': - Mode = (Mode + 1) % NUM_MODES; - break; - case 'z': - case 'Z': - Xtrans = Ytrans = 0; - printf("Translation: %f, %f\n", Xtrans, Ytrans); - break; - case 27: - glutDestroyWindow(Win); - exit(0); - break; - } - glutPostRedisplay(); -} - - -static void -SpecialKey(int key, int x, int y) -{ - (void) x; - (void) y; - switch (key) { - case GLUT_KEY_UP: - Ytrans += Step; - break; - case GLUT_KEY_DOWN: - Ytrans -= Step; - break; - case GLUT_KEY_LEFT: - Xtrans -= Step; - break; - case GLUT_KEY_RIGHT: - Xtrans += Step; - break; - } - glutPostRedisplay(); - printf("Translation: %f, %f\n", Xtrans, Ytrans); -} - - -static void -Init(void) -{ -} - - -static void -Usage(void) -{ - printf("Keys:\n"); - printf(" up/down/left/right - translate by %f\n", Step); - printf(" z - reset translation to zero\n"); - printf(" m - change rendering mode (points, hlines, vlines, quads)\n"); - printf(" Esc - exit\n"); -} - - -int -main(int argc, char *argv[]) -{ - glutInit(&argc, argv); - glutInitWindowPosition(0, 0); - glutInitWindowSize(Width, Height); - glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE); - Win = glutCreateWindow(argv[0]); - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutSpecialFunc(SpecialKey); - glutDisplayFunc(Draw); - Init(); - Usage(); - glutMainLoop(); - return 0; -} diff --git a/progs/tests/ext422square.c b/progs/tests/ext422square.c deleted file mode 100644 index 6533514d69..0000000000 --- a/progs/tests/ext422square.c +++ /dev/null @@ -1,258 +0,0 @@ -/* - * Exercise the EXT_422_pixels extension, a less convenient - * alternative to MESA_ycbcr_texture. Requires ARB_fragment_program - * to perform the final YUV->RGB conversion. - * - * Brian Paul 13 September 2002 - * Keith Whitwell 30 November 2004 - */ - - -#include -#include -#include -#include -#define GL_GLEXT_PROTOTYPES -#include -#include - -#include "../util/readtex.c" /* I know, this is a hack. */ - -#define TEXTURE_FILE "../images/tile.rgb" - -static GLfloat Xrot = 0, Yrot = 0, Zrot = 0; -static GLint ImgWidth, ImgHeight; -static GLushort *ImageYUV = NULL; -static const GLuint yuvObj = 100; -static const GLuint rgbObj = 101; - -static void Init( int argc, char *argv[] ); - -static void DrawObject(void) -{ - glBegin(GL_QUADS); - - glTexCoord2f(0, 0); - glVertex2f(-1.0, -1.0); - - glTexCoord2f(1, 0); - glVertex2f(1.0, -1.0); - - glTexCoord2f(1, 1); - glVertex2f(1.0, 1.0); - - glTexCoord2f(0, 1); - glVertex2f(-1.0, 1.0); - - glEnd(); -} - -static void Display( void ) -{ - static int firsttime = 1; - - if (firsttime) { - firsttime = 0; - Init( 0, 0 ); /* don't ask */ - } - - glClear( GL_COLOR_BUFFER_BIT ); - glBindTexture(GL_TEXTURE_2D, yuvObj); - - glPushMatrix(); - glEnable(GL_FRAGMENT_PROGRAM_ARB); - glTranslatef( -1.1, 0.0, -15.0 ); - glRotatef(Xrot, 1.0, 0.0, 0.0); - glRotatef(Yrot, 0.0, 1.0, 0.0); - glRotatef(Zrot, 0.0, 0.0, 1.0); - glBindTexture(GL_TEXTURE_2D, yuvObj); - DrawObject(); - glPopMatrix(); - - glPushMatrix(); - glDisable(GL_FRAGMENT_PROGRAM_ARB); - glTranslatef( 1.1, 0.0, -15.0 ); - glRotatef(Xrot, 1.0, 0.0, 0.0); - glRotatef(Yrot, 0.0, 1.0, 0.0); - glRotatef(Zrot, 0.0, 0.0, 1.0); - glBindTexture(GL_TEXTURE_2D, rgbObj); - DrawObject(); - glPopMatrix(); - - glutSwapBuffers(); -} - - -static void Reshape( int width, int height ) -{ - glViewport( 0, 0, width, height ); - glMatrixMode( GL_PROJECTION ); - glLoadIdentity(); - glFrustum( -1.1, 1.1, -1.1, 1.1, 10.0, 100.0 ); - glMatrixMode( GL_MODELVIEW ); - glLoadIdentity(); - glTranslatef( 0.0, 0.0, -15.0 ); -} - - -static void Key( unsigned char key, int x, int y ) -{ - (void) x; - (void) y; - switch (key) { - case 27: - exit(0); - break; - } - glutPostRedisplay(); -} - - -static void SpecialKey( int key, int x, int y ) -{ - float step = 3.0; - (void) x; - (void) y; - - switch (key) { - case GLUT_KEY_UP: - Xrot += step; - break; - case GLUT_KEY_DOWN: - Xrot -= step; - break; - case GLUT_KEY_LEFT: - Yrot += step; - break; - case GLUT_KEY_RIGHT: - Yrot -= step; - break; - } - glutPostRedisplay(); -} - - - - -/* #define LINEAR_FILTER */ - -static void Init( int argc, char *argv[] ) -{ - const char *file; - const GLfloat yuvtorgb[16] = { - 1.164, 1.164, 1.164, 0, - 0, -.391, 2.018, 0, - 1.596, -.813, 0.0, 0, - (-.0625*1.164 + -.5*1.596), (-.0625*1.164 + -.5*-.813 + -.5*-.391), (-.0625*1.164 + -.5*2.018), 1 - }; - - if (!glutExtensionSupported("GL_ARB_fragment_program")) { - printf("Error: GL_ARB_fragment_program not supported!\n"); - exit(1); - } - - if (!glutExtensionSupported("GL_EXT_422_pixels")) { - printf("Error: GL_EXT_422_pixels not supported!\n"); - exit(1); - } - - glPixelStorei(GL_UNPACK_ALIGNMENT, 1); - - file = TEXTURE_FILE; - - /* Load the texture as YCbCr. - */ - glBindTexture(GL_TEXTURE_2D, yuvObj); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - - ImageYUV = LoadYUVImage(file, &ImgWidth, &ImgHeight ); - if (!ImageYUV) { - printf("Couldn't read %s\n", TEXTURE_FILE); - exit(0); - } - - glTexImage2D(GL_TEXTURE_2D, 0, - GL_RGB, - ImgWidth, ImgHeight, 0, - GL_422_EXT, - GL_UNSIGNED_BYTE, ImageYUV); - - glEnable(GL_TEXTURE_2D); - - glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); - - { - static const char *modulateYUV = - "!!ARBfp1.0\n" - "TEMP R0;\n" - "TEX R0, fragment.texcoord[0], texture[0], 2D; \n" - - "ADD R0, R0, {-0.0625, -0.5, -0.5, 0.0}; \n" - "DP3 result.color.x, R0, {1.164, 1.596, 0.0}; \n" - "DP3 result.color.y, R0, {1.164, -0.813, -0.391}; \n" - "DP3 result.color.z, R0, {1.164, 0.0, 2.018}; \n" - "MOV result.color.w, R0.w; \n" - - "END" - ; - - GLuint modulateProg; - - - /* Setup the fragment program */ - glGenProgramsARB(1, &modulateProg); - glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg); - glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, - strlen(modulateYUV), (const GLubyte *)modulateYUV); - - printf("glGetError = 0x%x\n", (int) glGetError()); - printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n", - (char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB)); - assert(glIsProgramARB(modulateProg)); - - } - - /* Now the same, but use a color matrix to do the conversion at - * upload time: - */ - glBindTexture(GL_TEXTURE_2D, rgbObj); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - - glMatrixMode( GL_COLOR_MATRIX ); - glLoadMatrixf( yuvtorgb ); - - glTexImage2D(GL_TEXTURE_2D, 0, - GL_RGB, - ImgWidth, ImgHeight, 0, - GL_422_EXT, - GL_UNSIGNED_BYTE, ImageYUV); - - glLoadIdentity(); - glMatrixMode( GL_MODELVIEW ); - - glEnable(GL_TEXTURE_2D); - - glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); - - - glShadeModel(GL_FLAT); - glClearColor(0.3, 0.3, 0.4, 1.0); -} - - -int main( int argc, char *argv[] ) -{ - glutInit( &argc, argv ); - glutInitWindowSize( 300, 300 ); - glutInitWindowPosition( 0, 0 ); - glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE ); - glutCreateWindow(argv[0] ); - glutReshapeFunc( Reshape ); - glutKeyboardFunc( Key ); - glutSpecialFunc( SpecialKey ); - glutDisplayFunc( Display ); - glutMainLoop(); - return 0; -} diff --git a/progs/tests/fbotest1.c b/progs/tests/fbotest1.c deleted file mode 100644 index 8f4569ff3b..0000000000 --- a/progs/tests/fbotest1.c +++ /dev/null @@ -1,206 +0,0 @@ -/* - * Test GL_EXT_framebuffer_object - * - * Brian Paul - * 7 Feb 2005 - */ - - -#define GL_GLEXT_PROTOTYPES -#include -#include -#include -#include -#include - -static int Win; -static int Width = 400, Height = 400; -static GLuint MyFB, MyRB; - - -static void -CheckError(int line) -{ - GLenum err = glGetError(); - if (err) { - printf("GL Error 0x%x at line %d\n", (int) err, line); - } -} - - -static void -Display( void ) -{ - GLubyte *buffer = malloc(Width * Height * 4); - GLenum status; - - /* draw to user framebuffer */ - glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, MyFB); - glDrawBuffer(GL_COLOR_ATTACHMENT1_EXT); - glReadBuffer(GL_COLOR_ATTACHMENT1_EXT); - - status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT); - if (status != GL_FRAMEBUFFER_COMPLETE_EXT) { - printf("Framebuffer incomplete!!!\n"); - } - - glClearColor(0.5, 0.5, 1.0, 0.0); - glClear( GL_COLOR_BUFFER_BIT ); - - glBegin(GL_POLYGON); - glColor3f(1, 0, 0); - glVertex2f(-1, -1); - glColor3f(0, 1, 0); - glVertex2f(1, -1); - glColor3f(0, 0, 1); - glVertex2f(0, 1); - glEnd(); - - /* read from user framebuffer */ - glReadPixels(0, 0, Width, Height, GL_RGBA, GL_UNSIGNED_BYTE, buffer); - - /* draw to window */ - glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); - glWindowPos2iARB(0, 0); - glDrawPixels(Width, Height, GL_RGBA, GL_UNSIGNED_BYTE, buffer); - - free(buffer); - glutSwapBuffers(); - CheckError(__LINE__); -} - - -static void -Reshape( int width, int height ) -{ -#if 0 - float ar = (float) width / (float) height; -#endif - glViewport( 0, 0, width, height ); - glMatrixMode( GL_PROJECTION ); - glLoadIdentity(); -#if 0 - glFrustum( -ar, ar, -1.0, 1.0, 5.0, 25.0 ); -#else - glOrtho(-1.0, 1.0, -1.0, 1.0, 5.0, 25.0 ); -#endif - glMatrixMode( GL_MODELVIEW ); - glLoadIdentity(); - glTranslatef( 0.0, 0.0, -15.0 ); - Width = width; - Height = height; - glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_RGB, Width, Height); -} - - -static void -CleanUp(void) -{ - glDeleteFramebuffersEXT(1, &MyFB); - glDeleteRenderbuffersEXT(1, &MyRB); - assert(!glIsFramebufferEXT(MyFB)); - assert(!glIsRenderbufferEXT(MyRB)); - glutDestroyWindow(Win); - exit(0); -} - - -static void -Key( unsigned char key, int x, int y ) -{ - (void) x; - (void) y; - switch (key) { - case 27: - CleanUp(); - break; - } - glutPostRedisplay(); -} - - -static void -Init( void ) -{ - GLint i; - - if (!glutExtensionSupported("GL_EXT_framebuffer_object")) { - printf("GL_EXT_framebuffer_object not found!\n"); - /*exit(0);*/ - } - printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - - glGenFramebuffersEXT(1, &MyFB); - assert(MyFB); - assert(!glIsFramebufferEXT(MyFB)); - glDeleteFramebuffersEXT(1, &MyFB); - assert(!glIsFramebufferEXT(MyFB)); - /* Note, continue to use MyFB below */ - - glGenRenderbuffersEXT(1, &MyRB); - assert(MyRB); - assert(!glIsRenderbufferEXT(MyRB)); - glDeleteRenderbuffersEXT(1, &MyRB); - assert(!glIsRenderbufferEXT(MyRB)); - MyRB = 42; /* an arbitrary ID */ - - glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, MyFB); - assert(glIsFramebufferEXT(MyFB)); - glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, MyRB); - assert(glIsRenderbufferEXT(MyRB)); - - glGetIntegerv(GL_RENDERBUFFER_BINDING_EXT, &i); - assert(i == MyRB); - - glGetIntegerv(GL_FRAMEBUFFER_BINDING_EXT, &i); - assert(i == MyFB); - - CheckError(__LINE__); - glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT1_EXT, - GL_RENDERBUFFER_EXT, MyRB); - - glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_RGB, Width, Height); - - CheckError(__LINE__); - - { - GLint r, g, b, a; - glGetRenderbufferParameterivEXT(GL_RENDERBUFFER_EXT, - GL_RENDERBUFFER_RED_SIZE_EXT, &r); - glGetRenderbufferParameterivEXT(GL_RENDERBUFFER_EXT, - GL_RENDERBUFFER_GREEN_SIZE_EXT, &g); - glGetRenderbufferParameterivEXT(GL_RENDERBUFFER_EXT, - GL_RENDERBUFFER_BLUE_SIZE_EXT, &b); - glGetRenderbufferParameterivEXT(GL_RENDERBUFFER_EXT, - GL_RENDERBUFFER_ALPHA_SIZE_EXT, &a); - CheckError(__LINE__); - printf("renderbuffer RGBA sizes = %d %d %d %d\n", r, g, b, a); - - glGetIntegerv(GL_RED_BITS, &r); - glGetIntegerv(GL_GREEN_BITS, &g); - glGetIntegerv(GL_BLUE_BITS, &b); - glGetIntegerv(GL_ALPHA_BITS, &a); - printf("Visual RGBA sizes = %d %d %d %d\n", r, g, b, a); - } - - /* restore to default */ - glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); - CheckError(__LINE__); -} - - -int -main( int argc, char *argv[] ) -{ - glutInit( &argc, argv ); - glutInitWindowPosition( 0, 0 ); - glutInitWindowSize(Width, Height); - glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE ); - Win = glutCreateWindow(argv[0]); - glutReshapeFunc( Reshape ); - glutKeyboardFunc( Key ); - glutDisplayFunc( Display ); - Init(); - glutMainLoop(); - return 0; -} diff --git a/progs/tests/fbotest2.c b/progs/tests/fbotest2.c deleted file mode 100644 index 5283c7e1fd..0000000000 --- a/progs/tests/fbotest2.c +++ /dev/null @@ -1,202 +0,0 @@ -/* - * Test GL_EXT_framebuffer_object - * - * Brian Paul - * 19 Mar 2006 - */ - - -#define GL_GLEXT_PROTOTYPES -#include -#include -#include -#include -#include - -static int Win = 0; -static int Width = 400, Height = 400; -static GLuint MyFB, ColorRb, DepthRb; -static GLboolean Animate = GL_TRUE; -static GLfloat Rotation = 0.0; - - -static void -CheckError(int line) -{ - GLenum err = glGetError(); - if (err) { - printf("fbotest2: GL Error 0x%x at line %d\n", (int) err, line); - } -} - - -static void -Display( void ) -{ - GLubyte *buffer = malloc(Width * Height * 4); - GLenum status; - - CheckError(__LINE__); - - /* draw to user framebuffer */ - glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, MyFB); - glDrawBuffer(GL_COLOR_ATTACHMENT1_EXT); - glReadBuffer(GL_COLOR_ATTACHMENT1_EXT); - - status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT); - if (status != GL_FRAMEBUFFER_COMPLETE_EXT) { - printf("fbotest2: Error: Framebuffer is incomplete!!!\n"); - } - - CheckError(__LINE__); - - glClearColor(0.5, 0.5, 1.0, 0.0); - glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); - - glEnable(GL_DEPTH_TEST); - glEnable(GL_LIGHTING); - glEnable(GL_LIGHT0); - - glPushMatrix(); - glRotatef(30.0, 1, 0, 0); - glRotatef(Rotation, 0, 1, 0); - glutSolidTeapot(2.0); - glPopMatrix(); - - /* read from user framebuffer */ - glReadPixels(0, 0, Width, Height, GL_RGBA, GL_UNSIGNED_BYTE, buffer); - - /* draw to window */ - glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); - glDisable(GL_DEPTH_TEST); /* in case window has depth buffer */ - glWindowPos2iARB(0, 0); - glDrawPixels(Width, Height, GL_RGBA, GL_UNSIGNED_BYTE, buffer); - - free(buffer); - glutSwapBuffers(); - CheckError(__LINE__); -} - - -static void -Reshape( int width, int height ) -{ - float ar = (float) width / (float) height; - - glViewport( 0, 0, width, height ); - glMatrixMode( GL_PROJECTION ); - glLoadIdentity(); - glFrustum( -ar, ar, -1.0, 1.0, 5.0, 25.0 ); - - glMatrixMode( GL_MODELVIEW ); - glLoadIdentity(); - glTranslatef( 0.0, 0.0, -15.0 ); - - glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, ColorRb); - glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_RGB, width, height); - glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, DepthRb); - glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_DEPTH_COMPONENT, - width, height); - - Width = width; - Height = height; -} - - -static void -CleanUp(void) -{ - glDeleteFramebuffersEXT(1, &MyFB); - glDeleteRenderbuffersEXT(1, &ColorRb); - glDeleteRenderbuffersEXT(1, &DepthRb); - assert(!glIsFramebufferEXT(MyFB)); - assert(!glIsRenderbufferEXT(ColorRb)); - assert(!glIsRenderbufferEXT(DepthRb)); - glutDestroyWindow(Win); - exit(0); -} - - -static void -Idle(void) -{ - Rotation = glutGet(GLUT_ELAPSED_TIME) * 0.1; - glutPostRedisplay(); -} - - -static void -Key( unsigned char key, int x, int y ) -{ - (void) x; - (void) y; - switch (key) { - case 'a': - Animate = !Animate; - if (Animate) - glutIdleFunc(Idle); - else - glutIdleFunc(NULL); - break; - case 27: - CleanUp(); - break; - } - glutPostRedisplay(); -} - - -static void -Init( void ) -{ - if (!glutExtensionSupported("GL_EXT_framebuffer_object")) { - printf("fbotest2: GL_EXT_framebuffer_object not found!\n"); - exit(0); - } - printf("fbotest2: GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - - glGenFramebuffersEXT(1, &MyFB); - glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, MyFB); - assert(glIsFramebufferEXT(MyFB)); - - /* set color buffer */ - glGenRenderbuffersEXT(1, &ColorRb); - glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, ColorRb); - assert(glIsRenderbufferEXT(ColorRb)); - glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT1_EXT, - GL_RENDERBUFFER_EXT, ColorRb); - glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_RGB, Width, Height); - - /* setup depth buffer */ - glGenRenderbuffersEXT(1, &DepthRb); - glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, DepthRb); - assert(glIsRenderbufferEXT(DepthRb)); - glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, - GL_RENDERBUFFER_EXT, DepthRb); - glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_DEPTH_COMPONENT, Width, Height); - - CheckError(__LINE__); - - /* restore to default */ - glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); - CheckError(__LINE__); -} - - -int -main( int argc, char *argv[] ) -{ - glutInit( &argc, argv ); - glutInitWindowPosition( 0, 0 ); - glutInitWindowSize(Width, Height); - glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE ); - Win = glutCreateWindow(argv[0]); - glutReshapeFunc( Reshape ); - glutKeyboardFunc( Key ); - glutDisplayFunc( Display ); - if (Animate) - glutIdleFunc(Idle); - Init(); - glutMainLoop(); - return 0; -} diff --git a/progs/tests/fbotexture.c b/progs/tests/fbotexture.c deleted file mode 100644 index 88d0549c80..0000000000 --- a/progs/tests/fbotexture.c +++ /dev/null @@ -1,451 +0,0 @@ -/* - * Test GL_EXT_framebuffer_object render-to-texture - * - * Draw a teapot into a texture image with stenciling. - * Then draw a textured quad using that texture. - * - * Brian Paul - * 18 Apr 2005 - */ - - -#define GL_GLEXT_PROTOTYPES -#include -#include -#include -#include -#include -#include - -/* For debug */ -#define DEPTH 1 -#define STENCIL 1 -#define DRAW 1 - - -static int Win = 0; -static int Width = 400, Height = 400; - -static GLenum TexTarget = GL_TEXTURE_2D; /*GL_TEXTURE_RECTANGLE_ARB;*/ -static int TexWidth = 512, TexHeight = 512; -/*static int TexWidth = 600, TexHeight = 600;*/ - -static GLuint MyFB; -static GLuint TexObj; -static GLuint DepthRB, StencilRB; -static GLboolean Anim = GL_FALSE; -static GLfloat Rot = 0.0; -static GLboolean UsePackedDepthStencil = GL_FALSE; -static GLuint TextureLevel = 1; /* which texture level to render to */ -static GLenum TexIntFormat = GL_RGB; /* either GL_RGB or GL_RGBA */ -static GLboolean Cull = GL_FALSE; -static GLboolean Wireframe = GL_FALSE; - - -static void -CheckError(int line) -{ - GLenum err = glGetError(); - if (err) { - printf("GL Error 0x%x at line %d\n", (int) err, line); - } -} - - -static void -Idle(void) -{ - Rot = glutGet(GLUT_ELAPSED_TIME) * 0.1; - glutPostRedisplay(); -} - - -static void -RenderTexture(void) -{ - GLenum status; - - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glOrtho(-1.0, 1.0, -1.0, 1.0, 5.0, 25.0); - glMatrixMode(GL_MODELVIEW); - glLoadIdentity(); - glTranslatef(0.0, 0.0, -15.0); - - /* draw to texture image */ - glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, MyFB); - - status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT); - if (status != GL_FRAMEBUFFER_COMPLETE_EXT) { - printf("Framebuffer incomplete!!!\n"); - } - - glViewport(0, 0, TexWidth, TexHeight); - - glClearColor(0.5, 0.5, 1.0, 0.0); - glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); - CheckError(__LINE__); - -#if DEPTH - glEnable(GL_DEPTH_TEST); -#endif - -#if STENCIL - glEnable(GL_STENCIL_TEST); - glStencilFunc(GL_NEVER, 1, ~0); - glStencilOp(GL_REPLACE, GL_KEEP, GL_REPLACE); -#endif - - CheckError(__LINE__); - -#if DEPTH || STENCIL - /* draw diamond-shaped stencil pattern */ - glColor3f(0, 1, 0); - glBegin(GL_POLYGON); - glVertex2f(-0.2, 0.0); - glVertex2f( 0.0, -0.2); - glVertex2f( 0.2, 0.0); - glVertex2f( 0.0, 0.2); - glEnd(); -#endif - - /* draw teapot where stencil != 1 */ -#if STENCIL - glStencilFunc(GL_NOTEQUAL, 1, ~0); - glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP); -#endif - - CheckError(__LINE__); - - if (Wireframe) { - glPolygonMode(GL_FRONT, GL_LINE); - } - else { - glPolygonMode(GL_FRONT, GL_FILL); - } - - if (Cull) { - /* cull back */ - glCullFace(GL_BACK); - glEnable(GL_CULL_FACE); - } - else { - glDisable(GL_CULL_FACE); - } - -#if 0 - glBegin(GL_POLYGON); - glColor3f(1, 0, 0); - glVertex2f(-1, -1); - glColor3f(0, 1, 0); - glVertex2f(1, -1); - glColor3f(0, 0, 1); - glVertex2f(0, 1); - glEnd(); -#else - glEnable(GL_LIGHTING); - glEnable(GL_LIGHT0); - glPushMatrix(); - glRotatef(0.5 * Rot, 1.0, 0.0, 0.0); - glFrontFace(GL_CW); /* Teapot patches backward */ - glutSolidTeapot(0.5); - glFrontFace(GL_CCW); - glPopMatrix(); - glDisable(GL_LIGHTING); - /* - PrintStencilHistogram(TexWidth, TexHeight); - */ -#endif - - glDisable(GL_DEPTH_TEST); - glDisable(GL_STENCIL_TEST); - glDisable(GL_CULL_FACE); - glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); - -#if DRAW - /* Bind normal framebuffer */ - glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); -#endif - - CheckError(__LINE__); -} - - - -static void -Display(void) -{ - float ar = (float) Width / (float) Height; - - RenderTexture(); - - /* draw textured quad in the window */ -#if DRAW - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glFrustum(-ar, ar, -1.0, 1.0, 5.0, 25.0); - glMatrixMode(GL_MODELVIEW); - glLoadIdentity(); - glTranslatef(0.0, 0.0, -7.0); - - glViewport(0, 0, Width, Height); - - glClearColor(0.25, 0.25, 0.25, 0); - glClear(GL_COLOR_BUFFER_BIT); - - glPushMatrix(); - glRotatef(Rot, 0, 1, 0); - glEnable(TexTarget); - glBindTexture(TexTarget, TexObj); - glBegin(GL_POLYGON); - glColor3f(0.25, 0.25, 0.25); - if (TexTarget == GL_TEXTURE_2D) { - glTexCoord2f(0, 0); - glVertex2f(-1, -1); - glTexCoord2f(1, 0); - glVertex2f(1, -1); - glColor3f(1.0, 1.0, 1.0); - glTexCoord2f(1, 1); - glVertex2f(1, 1); - glTexCoord2f(0, 1); - glVertex2f(-1, 1); - } - else { - assert(TexTarget == GL_TEXTURE_RECTANGLE_ARB); - glTexCoord2f(0, 0); - glVertex2f(-1, -1); - glTexCoord2f(TexWidth, 0); - glVertex2f(1, -1); - glColor3f(1.0, 1.0, 1.0); - glTexCoord2f(TexWidth, TexHeight); - glVertex2f(1, 1); - glTexCoord2f(0, TexHeight); - glVertex2f(-1, 1); - } - glEnd(); - glPopMatrix(); - glDisable(TexTarget); -#endif - - glutSwapBuffers(); - CheckError(__LINE__); -} - - -static void -Reshape(int width, int height) -{ - glViewport(0, 0, width, height); - Width = width; - Height = height; -} - - -static void -CleanUp(void) -{ -#if DEPTH - glDeleteRenderbuffersEXT(1, &DepthRB); -#endif -#if STENCIL - if (!UsePackedDepthStencil) - glDeleteRenderbuffersEXT(1, &StencilRB); -#endif - glDeleteFramebuffersEXT(1, &MyFB); - - glDeleteTextures(1, &TexObj); - - glutDestroyWindow(Win); - - exit(0); -} - - -static void -Key(unsigned char key, int x, int y) -{ - (void) x; - (void) y; - switch (key) { - case 'a': - Anim = !Anim; - if (Anim) - glutIdleFunc(Idle); - else - glutIdleFunc(NULL); - break; - case 'c': - Cull = !Cull; - break; - case 'w': - Wireframe = !Wireframe; - break; - case 's': - Rot += 2.0; - break; - case 'S': - Rot -= 2.0; - break; - case 27: - CleanUp(); - break; - } - glutPostRedisplay(); -} - - -static void -Usage(void) -{ - printf("Usage:\n"); - printf(" a Toggle animation\n"); - printf(" s/s Step/rotate\n"); - printf(" c Toggle back-face culling\n"); - printf(" w Toggle wireframe mode (front-face only)\n"); - printf(" Esc Exit\n"); -} - - -static void -Init(int argc, char *argv[]) -{ - static const GLfloat mat[4] = { 1.0, 0.5, 0.5, 1.0 }; - GLint i; - - if (!glutExtensionSupported("GL_EXT_framebuffer_object")) { - printf("GL_EXT_framebuffer_object not found!\n"); - exit(0); - } - - if (argc > 1 && strcmp(argv[1], "-ds") == 0) { - if (!glutExtensionSupported("GL_EXT_packed_depth_stencil")) { - printf("GL_EXT_packed_depth_stencil not found!\n"); - exit(0); - } - UsePackedDepthStencil = GL_TRUE; - printf("Using GL_EXT_packed_depth_stencil\n"); - } - - printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - - /* gen framebuffer id, delete it, do some assertions, just for testing */ - glGenFramebuffersEXT(1, &MyFB); - assert(MyFB); - assert(!glIsFramebufferEXT(MyFB)); - glDeleteFramebuffersEXT(1, &MyFB); - assert(!glIsFramebufferEXT(MyFB)); - /* Note, continue to use MyFB below */ - - glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, MyFB); - assert(glIsFramebufferEXT(MyFB)); - glGetIntegerv(GL_FRAMEBUFFER_BINDING_EXT, &i); - assert(i == MyFB); - - /* Make texture object/image */ - glGenTextures(1, &TexObj); - glBindTexture(TexTarget, TexObj); - /* make two image levels */ - glTexImage2D(TexTarget, 0, TexIntFormat, TexWidth, TexHeight, 0, - GL_RGBA, GL_UNSIGNED_BYTE, NULL); - glTexImage2D(TexTarget, 1, TexIntFormat, TexWidth/2, TexHeight/2, 0, - GL_RGBA, GL_UNSIGNED_BYTE, NULL); - TexWidth = TexWidth >> TextureLevel; - TexHeight = TexHeight >> TextureLevel; - - glTexParameteri(TexTarget, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - glTexParameteri(TexTarget, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); - glTexParameteri(TexTarget, GL_TEXTURE_BASE_LEVEL, TextureLevel); - glTexParameteri(TexTarget, GL_TEXTURE_MAX_LEVEL, TextureLevel); - - CheckError(__LINE__); - - /* Render color to texture */ - glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, - TexTarget, TexObj, TextureLevel); - - -#if DEPTH - /* make depth renderbuffer */ - glGenRenderbuffersEXT(1, &DepthRB); - assert(DepthRB); - assert(!glIsRenderbufferEXT(DepthRB)); - glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, DepthRB); - assert(glIsRenderbufferEXT(DepthRB)); - if (UsePackedDepthStencil) - glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_DEPTH_STENCIL_EXT, - TexWidth, TexHeight); - else - glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_DEPTH_COMPONENT, - TexWidth, TexHeight); - CheckError(__LINE__); - glGetRenderbufferParameterivEXT(GL_RENDERBUFFER_EXT, - GL_RENDERBUFFER_DEPTH_SIZE_EXT, &i); - CheckError(__LINE__); - printf("Depth renderbuffer size = %d bits\n", i); - assert(i > 0); - - /* attach DepthRB to MyFB */ - glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, - GL_RENDERBUFFER_EXT, DepthRB); -#endif - - CheckError(__LINE__); - -#if STENCIL - if (UsePackedDepthStencil) { - /* DepthRb is a combined depth/stencil renderbuffer */ - glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, - GL_STENCIL_ATTACHMENT_EXT, - GL_RENDERBUFFER_EXT, DepthRB); - } - else { - /* make stencil renderbuffer */ - glGenRenderbuffersEXT(1, &StencilRB); - assert(StencilRB); - assert(!glIsRenderbufferEXT(StencilRB)); - glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, StencilRB); - assert(glIsRenderbufferEXT(StencilRB)); - glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_STENCIL_INDEX, - TexWidth, TexHeight); - /* attach StencilRB to MyFB */ - glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, - GL_STENCIL_ATTACHMENT_EXT, - GL_RENDERBUFFER_EXT, StencilRB); - } - glGetRenderbufferParameterivEXT(GL_RENDERBUFFER_EXT, - GL_RENDERBUFFER_STENCIL_SIZE_EXT, &i); - CheckError(__LINE__); - printf("Stencil renderbuffer size = %d bits\n", i); - assert(i > 0); -#endif - - CheckError(__LINE__); - - /* bind regular framebuffer */ - glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); - - - /* lighting */ - glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, mat); -} - - -int -main(int argc, char *argv[]) -{ - glutInit(&argc, argv); - glutInitWindowPosition(0, 0); - glutInitWindowSize(Width, Height); - glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE); - Win = glutCreateWindow(argv[0]); - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Display); - if (Anim) - glutIdleFunc(Idle); - Init(argc, argv); - Usage(); - glutMainLoop(); - return 0; -} diff --git a/progs/tests/floattex.c b/progs/tests/floattex.c deleted file mode 100644 index dd6d882089..0000000000 --- a/progs/tests/floattex.c +++ /dev/null @@ -1,239 +0,0 @@ -/* - * Test floating point textures. - * No actual rendering, yet. - */ - - -#include -#include -#include -#include -#include -#include "extfuncs.h" -#include "readtex.h" -#include "shaderutil.h" - - -static const char *TexFile = "../images/arch.rgb"; - -static const char *FragShaderText = - "uniform sampler2D tex1; \n" - "void main() \n" - "{ \n" - " vec4 t = texture2D(tex1, gl_TexCoord[0].xy); \n" - " // convert from [-255,0] to [0,1] \n" - " gl_FragColor = t * (-1.0 / 255.0); \n" - "} \n"; - -static const char *VertShaderText = - "void main() \n" - "{ \n" - " gl_TexCoord[0] = gl_MultiTexCoord0; \n" - " gl_Position = ftransform(); \n" - "} \n"; - -static struct uniform_info Uniforms[] = { - { "tex1", 1, GL_INT, { 0, 0, 0, 0 }, -1 }, - END_OF_UNIFORMS -}; - - -static GLuint Program; - - - -static GLboolean -CheckError( int line ) -{ - GLenum error = glGetError(); - if (error) { - char *err = (char *) gluErrorString( error ); - fprintf( stderr, "GL Error: %s at line %d\n", err, line ); - return GL_TRUE; - } - return GL_FALSE; -} - - -static void -Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); - - glPushMatrix(); - - glBegin(GL_POLYGON); - glTexCoord2f( 0.0, 0.0 ); glVertex2f( -1.0, -1.0 ); - glTexCoord2f( 1.0, 0.0 ); glVertex2f( 1.0, -1.0 ); - glTexCoord2f( 1.0, 1.0 ); glVertex2f( 1.0, 1.0 ); - glTexCoord2f( 0.0, 1.0 ); glVertex2f( -1.0, 1.0 ); - glEnd(); - - glPopMatrix(); - - glutSwapBuffers(); -} - - -static void -Reshape(int width, int height) -{ - glViewport(0, 0, width, height); - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glFrustum(-1.0, 1.0, -1.0, 1.0, 5.0, 25.0); - glMatrixMode(GL_MODELVIEW); - glLoadIdentity(); - glTranslatef(0.0, 0.0, -8.0); -} - - -static void -Key(unsigned char key, int x, int y) -{ - (void) x; - (void) y; - switch (key) { - case 27: - exit(0); - break; - } - glutPostRedisplay(); -} - - - -static void -InitTexture(void) -{ - GLenum filter = GL_LINEAR; - GLint imgWidth, imgHeight; - GLenum imgFormat; - GLubyte *image = NULL; - GLfloat *ftex; - GLint i, t; - - image = LoadRGBImage(TexFile, &imgWidth, &imgHeight, &imgFormat); - if (!image) { - printf("Couldn't read %s\n", TexFile); - exit(0); - } - - assert(imgFormat == GL_RGB); - - ftex = (float *) malloc(imgWidth * imgHeight * 4 * sizeof(float)); - if (!ftex) { - printf("out of memory\n"); - exit(0); - } - - /* convert ubytes to floats, negated */ - for (i = 0; i < imgWidth * imgHeight * 3; i++) { - ftex[i] = -1.0f * image[i]; - } - - glActiveTexture(GL_TEXTURE0); - glBindTexture(GL_TEXTURE_2D, 42); - - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA32F_ARB, - imgWidth, imgHeight, 0, - GL_RGB, GL_FLOAT, ftex); - - - /* sanity checks */ - glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_RED_TYPE_ARB, &t); - assert(t == GL_FLOAT); - glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_GREEN_TYPE_ARB, &t); - assert(t == GL_FLOAT); - glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_BLUE_TYPE_ARB, &t); - assert(t == GL_FLOAT); - glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_ALPHA_TYPE_ARB, &t); - assert(t == GL_FLOAT); - - free(image); - free(ftex); - - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, filter); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, filter); - -#if 0 - /* read back the texture and make sure values are correct */ - glGetTexImage(GL_TEXTURE_2D, 0, GL_RGBA, GL_FLOAT, tex2); - CheckError(__LINE__); - for (i = 0; i < 16; i++) { - for (j = 0; j < 16; j++) { - if (tex[i][j][0] != tex2[i][j][0] || - tex[i][j][1] != tex2[i][j][1] || - tex[i][j][2] != tex2[i][j][2] || - tex[i][j][3] != tex2[i][j][3]) { - printf("tex[%d][%d] %g %g %g %g != tex2[%d][%d] %g %g %g %g\n", - i, j, - tex[i][j][0], tex[i][j][1], tex[i][j][2], tex[i][j][3], - i, j, - tex2[i][j][0], tex2[i][j][1], tex2[i][j][2], tex2[i][j][3]); - } - } - } -#endif -} - - -static GLuint -CreateProgram(void) -{ - GLuint fragShader, vertShader, program; - - vertShader = CompileShaderText(GL_VERTEX_SHADER, VertShaderText); - fragShader = CompileShaderText(GL_FRAGMENT_SHADER, FragShaderText); - assert(vertShader); - program = LinkShaders(vertShader, fragShader); - - assert(program); - - // InitUniforms(program, Uniforms); - - return program; -} - - -static void -Init(void) -{ - glClearColor(0.25, 0.25, 0.25, 0.0); - - GetExtensionFuncs(); - - if (!ShadersSupported()) { - printf("Sorry, this test requires GLSL\n"); - exit(1); - } - - if (!glutExtensionSupported("GL_MESAX_texture_float")) { - printf("Sorry, this test requires GL_MESAX_texture_float\n"); - exit(1); - } - - InitTexture(); - - Program = CreateProgram(); - glUseProgram_func(Program); -} - - -int -main(int argc, char *argv[]) -{ - glutInit(&argc, argv); - glutInitWindowPosition(0, 0); - glutInitWindowSize(400, 400); - glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH); - glutCreateWindow(argv[0]); - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - Init(); - glutMainLoop(); - return 0; -} diff --git a/progs/tests/fog.c b/progs/tests/fog.c deleted file mode 100644 index ecd9f533f9..0000000000 --- a/progs/tests/fog.c +++ /dev/null @@ -1,199 +0,0 @@ -/* - * Copyright 2005 Eric Anholt - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - * Authors: - * Eric Anholt - * Brian Paul (fogcoord.c used as a skeleton) - */ - -/* - * Test to exercise fog modes and for comparison with GL_EXT_fog_coord. - */ - -#define GL_GLEXT_PROTOTYPES -#include -#include -#include -#include - -static int Width = 600; -static int Height = 600; -static GLfloat Near = 0.0, Far = 1.0; -GLboolean has_fogcoord; - -static void drawString( const char *string ) -{ - glRasterPos2f(0, .5); - while ( *string ) { - glutBitmapCharacter( GLUT_BITMAP_TIMES_ROMAN_10, *string ); - string++; - } -} - -static void Display( void ) -{ - GLint i, depthi; - GLfloat fogcolor[4] = {1, 1, 1, 1}; - - glEnable(GL_FOG); - glFogfv(GL_FOG_COLOR, fogcolor); - - glClearColor(0.2, 0.2, 0.8, 0); - glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); - - glPushMatrix(); - for (i = 0; i < 6; i++) { - if (i >= 3 && !has_fogcoord) - break; - - glPushMatrix(); - for (depthi = 0; depthi < 5; depthi++) { - GLfloat depth = Near + (Far - Near) * depthi / 4; - - switch (i % 3) { - case 0: - glFogi(GL_FOG_MODE, GL_LINEAR); - glFogf(GL_FOG_START, Near); - glFogf(GL_FOG_END, Far); - break; - case 1: - glFogi(GL_FOG_MODE, GL_EXP); - glFogf(GL_FOG_DENSITY, 2); - break; - case 2: - glFogi(GL_FOG_MODE, GL_EXP2); - glFogf(GL_FOG_DENSITY, 2); - break; - } - - glColor4f(0, 0, 0, 0); - if (i < 3) { - if (has_fogcoord) - glFogi(GL_FOG_COORDINATE_SOURCE_EXT, GL_FRAGMENT_DEPTH_EXT); - - glBegin(GL_POLYGON); - glVertex3f(0, 0, depth); - glVertex3f(1, 0, depth); - glVertex3f(1, 1, depth); - glVertex3f(0, 1, depth); - glEnd(); - } else { - glFogi(GL_FOG_COORDINATE_SOURCE_EXT, GL_FOG_COORDINATE_EXT); - glFogCoordfEXT(depth); - - glBegin(GL_POLYGON); - glVertex3f(0, 0, (Near + Far) / 2); - glVertex3f(1, 0, (Near + Far) / 2); - glVertex3f(1, 1, (Near + Far) / 2); - glVertex3f(0, 1, (Near + Far) / 2); - glEnd(); - } - glTranslatef(1.5, 0, 0); - } - - glTranslatef(.1, 0, 0); - switch (i) { - case 0: - drawString("GL_LINEAR"); - break; - case 1: - drawString("GL_EXP"); - break; - case 2: - drawString("GL_EXP2"); - break; - case 3: - drawString("GL_FOGCOORD GL_LINEAR"); - break; - case 4: - drawString("GL_FOGCOORD GL_EXP"); - break; - case 5: - drawString("GL_FOGCOORD GL_EXP2"); - break; - } - - glPopMatrix(); - glTranslatef(0, 1.5, 0); - } - glPopMatrix(); - - glutSwapBuffers(); -} - - -static void Reshape( int width, int height ) -{ - Width = width; - Height = height; - glViewport( 0, 0, width, height ); - - glMatrixMode( GL_PROJECTION ); - glLoadIdentity(); - glOrtho( 0, 11, 9, 0, -Near, -Far ); - - glMatrixMode( GL_MODELVIEW ); - glLoadIdentity(); - glTranslatef(.25, .25, 0); -} - - -static void Key( unsigned char key, int x, int y ) -{ - (void) x; - (void) y; - switch (key) { - case 27: - exit(0); - break; - } - glutPostRedisplay(); -} - - -static void Init( void ) -{ - printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - printf("GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - /* setup lighting, etc */ - has_fogcoord = glutExtensionSupported("GL_EXT_fog_coord"); - if (!has_fogcoord) { - printf("Some output of this program requires GL_EXT_fog_coord\n"); - } -} - - -int main( int argc, char *argv[] ) -{ - glutInit( &argc, argv ); - glutInitWindowPosition( 0, 0 ); - glutInitWindowSize( Width, Height ); - glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH ); - glutCreateWindow(argv[0]); - glutReshapeFunc( Reshape ); - glutKeyboardFunc( Key ); - glutDisplayFunc( Display ); - Init(); - glutMainLoop(); - return 0; -} diff --git a/progs/tests/fogcoord.c b/progs/tests/fogcoord.c deleted file mode 100644 index 89355742aa..0000000000 --- a/progs/tests/fogcoord.c +++ /dev/null @@ -1,102 +0,0 @@ -/* - * Exercise GL_EXT_fog_coord - */ - - -#define GL_GLEXT_PROTOTYPES -#include -#include -#include -#include - -static int Width = 600; -static int Height = 200; -static GLfloat Near = 5.0, Far = 25.0; - - -static void Display( void ) -{ - GLfloat t; - - glClearColor(0.2, 0.2, 0.8, 0); - glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); - - for (t = 0.0; t <= 1.0; t += 0.25) { - GLfloat f = Near + t * (Far - Near); - printf("glFogCoord(%4.1f)\n", f); - glFogCoordfEXT(f); - - glPushMatrix(); - glTranslatef(t * 10.0 - 5.0, 0, 0); - glBegin(GL_POLYGON); - glVertex2f(-1, -1); - glVertex2f( 1, -1); - glVertex2f( 1, 1); - glVertex2f(-1, 1); - glEnd(); - glPopMatrix(); - } - glutSwapBuffers(); -} - - -static void Reshape( int width, int height ) -{ - GLfloat ar = (float) width / (float) height; - Width = width; - Height = height; - glViewport( 0, 0, width, height ); - glMatrixMode( GL_PROJECTION ); - glLoadIdentity(); - glFrustum( -ar, ar, -1.0, 1.0, Near, Far ); - glMatrixMode( GL_MODELVIEW ); - glLoadIdentity(); - glTranslatef( 0.0, 0.0, -15.0 ); -} - - -static void Key( unsigned char key, int x, int y ) -{ - (void) x; - (void) y; - switch (key) { - case 27: - exit(0); - break; - } - glutPostRedisplay(); -} - - -static void Init( void ) -{ - printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - printf("GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - /* setup lighting, etc */ - if (!glutExtensionSupported("GL_EXT_fog_coord")) { - printf("Sorry, this program requires GL_EXT_fog_coord\n"); - exit(1); - } - glFogi(GL_FOG_COORDINATE_SOURCE_EXT, GL_FOG_COORDINATE_EXT); - glFogi(GL_FOG_MODE, GL_LINEAR); - glFogf(GL_FOG_START, Near); - glFogf(GL_FOG_END, Far); - glEnable(GL_FOG); - printf("Squares should be colored from white -> gray -> black.\n"); -} - - -int main( int argc, char *argv[] ) -{ - glutInit( &argc, argv ); - glutInitWindowPosition( 0, 0 ); - glutInitWindowSize( Width, Height ); - glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH ); - glutCreateWindow(argv[0]); - glutReshapeFunc( Reshape ); - glutKeyboardFunc( Key ); - glutDisplayFunc( Display ); - Init(); - glutMainLoop(); - return 0; -} diff --git a/progs/tests/fptest1.c b/progs/tests/fptest1.c deleted file mode 100644 index 095190a8ae..0000000000 --- a/progs/tests/fptest1.c +++ /dev/null @@ -1,225 +0,0 @@ -/* Test GL_NV_fragment_program */ - -#include -#include -#include -#include -#include -#define GL_GLEXT_PROTOTYPES -#include - - - -static void Display( void ) -{ - glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); - - glPushMatrix(); - - glColor4f(0, 0.5, 0, 1); - glColor4f(0, 1, 0, 1); - glBegin(GL_POLYGON); - glVertex2f(-1, -1); - glVertex2f( 1, -1); - glVertex2f( 0, 1); - glEnd(); - - glPopMatrix(); - - glutSwapBuffers(); -} - - -static void Reshape( int width, int height ) -{ - glViewport( 0, 0, width, height ); - glMatrixMode( GL_PROJECTION ); - glLoadIdentity(); - glFrustum( -1.0, 1.0, -1.0, 1.0, 5.0, 25.0 ); - glMatrixMode( GL_MODELVIEW ); - glLoadIdentity(); - glTranslatef( 0.0, 0.0, -15.0 ); -} - - -static void Key( unsigned char key, int x, int y ) -{ - (void) x; - (void) y; - switch (key) { - case 27: - exit(0); - break; - } - glutPostRedisplay(); -} - - -static void Init( void ) -{ - static const char *prog0 = - "!!FP1.0\n" - "MUL o[COLR], R0, f[WPOS]; \n" - "ADD o[COLH], H3, f[TEX0]; \n" - "ADD_SAT o[COLH], H3, f[TEX0]; \n" - "ADDX o[COLH], H3, f[TEX0]; \n" - "ADDHC o[COLH], H3, f[TEX0]; \n" - "ADDXC o[COLH], H3, f[TEX0]; \n" - "ADDXC_SAT o[COLH], H30, f[TEX0]; \n" - "MUL o[COLR].xy, R0.wzyx, f[WPOS]; \n" - "MUL o[COLR], H0, f[WPOS]; \n" - "MUL o[COLR], -H0, f[WPOS]; \n" - "MOV RC, H1; \n" - "MOV HC, H2; \n" - "END \n" - ; - - /* masked updates, defines, declarations */ - static const char *prog1 = - "!!FP1.0\n" - "DEFINE foo = {1, 2, 3, 4}; \n" - "DEFINE foo2 = 5; \n" - "DECLARE foo3 = {5, 6, 7, 8}; \n" - "DECLARE bar = 3; \n" - "DECLARE bar2; \n" - "DECLARE bar3 = bar; \n" - "#DECLARE bar4 = { a, b, c, d }; \n" - "MOV o[COLR].xy, R0; \n" - "MOV o[COLR] (NE), R0; \n" - "MOV o[COLR] (NE.wzyx), R0; \n" - "MOV o[COLR].xy (NE.wzyx), R0; \n" - "MOV RC.x (EQ), R1.x; \n" - "KIL NE; \n" - "KIL EQ.xyxy; \n" - "END \n" - ; - - /* texture instructions */ - static const char *prog2 = - "!!FP1.0\n" - "TEX R0, f[TEX0], TEX0, 2D; \n" - "TEX R1, f[TEX1], TEX1, CUBE; \n" - "TEX R2, f[TEX2], TEX2, 3D; \n" - "TXP R3, f[TEX3], TEX3, RECT; \n" - "TXD R3, R2, R1, f[TEX3], TEX3, RECT; \n" - "MUL o[COLR], R0, f[COL0]; \n" - "END \n" - ; - - /* test negation, absolute value */ - static const char *prog3 = - "!!FP1.0\n" - "MOV R0, -R1; \n" - "MOV R0, +R1; \n" - "MOV R0, |-R1|; \n" - "MOV R0, |+R1|; \n" - "MOV R0, -|R1|; \n" - "MOV R0, +|R1|; \n" - "MOV R0, -|-R1|; \n" - "MOV R0, -|+R1|; \n" - "MOV o[COLR], R0; \n" - "END \n" - ; - - /* literal constant sources */ - static const char *prog4 = - "!!FP1.0\n" - "DEFINE Pi = 3.14159; \n" - "MOV R0, {1, -2, +3, 4}; \n" - "MOV R0, 5; \n" - "MOV R0, -5; \n" - "MOV R0, +5; \n" - "MOV R0, Pi; \n" - "MOV o[COLR], R0; \n" - "END \n" - ; - - /* change the fragment color in a simple way */ - static const char *prog10 = - "!!FP1.0\n" - "DEFINE blue = {0, 0, 1, 0};\n" - "DECLARE color; \n" - "MOV R0, f[COL0]; \n" - "#ADD o[COLR], R0, f[COL0]; \n" - "#ADD o[COLR], blue, f[COL0]; \n" - "#ADD o[COLR], {1, 0, 0, 0}, f[COL0]; \n" - "ADD o[COLR], color, f[COL0]; \n" - "END \n" - ; - - GLuint progs[20]; - - if (!glutExtensionSupported ("GL_NV_fragment_program")) { - printf("Sorry, this program requires GL_NV_fragment_program\n"); - exit(1); - } - - glGenProgramsNV(20, progs); - assert(progs[0]); - assert(progs[1]); - assert(progs[0] != progs[1]); - -#if 0 - glLoadProgramNV(GL_FRAGMENT_PROGRAM_NV, progs[0], - strlen(prog0), - (const GLubyte *) prog0); - assert(glIsProgramNV(progs[0])); -#endif - - glLoadProgramNV(GL_FRAGMENT_PROGRAM_NV, progs[1], - strlen(prog1), - (const GLubyte *) prog1); - assert(glIsProgramNV(progs[1])); - - glLoadProgramNV(GL_FRAGMENT_PROGRAM_NV, progs[2], - strlen(prog2), - (const GLubyte *) prog2); - assert(glIsProgramNV(progs[2])); - glBindProgramNV(GL_FRAGMENT_PROGRAM_NV, progs[2]); - - glLoadProgramNV(GL_FRAGMENT_PROGRAM_NV, progs[3], - strlen(prog3), - (const GLubyte *) prog3); - assert(glIsProgramNV(progs[3])); - glBindProgramNV(GL_FRAGMENT_PROGRAM_NV, progs[3]); - - glLoadProgramNV(GL_FRAGMENT_PROGRAM_NV, progs[4], - strlen(prog4), - (const GLubyte *) prog4); - assert(glIsProgramNV(progs[4])); - glBindProgramNV(GL_FRAGMENT_PROGRAM_NV, progs[4]); - - - /* a real program */ - glLoadProgramNV(GL_FRAGMENT_PROGRAM_NV, progs[10], - strlen(prog10), - (const GLubyte *) prog10); - assert(glIsProgramNV(progs[10])); - glBindProgramNV(GL_FRAGMENT_PROGRAM_NV, progs[10]); - - glProgramNamedParameter4fNV(progs[10], - strlen("color"), (const GLubyte *) "color", - 1, 0, 0, 1); - - glEnable(GL_FRAGMENT_PROGRAM_NV); - glEnable(GL_ALPHA_TEST); - glAlphaFunc(GL_ALWAYS, 0.0); - - printf("glGetError = %d\n", (int) glGetError()); -} - - -int main( int argc, char *argv[] ) -{ - glutInit( &argc, argv ); - glutInitWindowPosition( 0, 0 ); - glutInitWindowSize( 250, 250 ); - glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH ); - glutCreateWindow(argv[0]); - glutReshapeFunc( Reshape ); - glutKeyboardFunc( Key ); - glutDisplayFunc( Display ); - Init(); - glutMainLoop(); - return 0; -} diff --git a/progs/tests/fptexture.c b/progs/tests/fptexture.c deleted file mode 100644 index f57ad62828..0000000000 --- a/progs/tests/fptexture.c +++ /dev/null @@ -1,151 +0,0 @@ -/* GL_NV_fragment_program texture test */ - -#include -#include -#include -#include -#include -#define GL_GLEXT_PROTOTYPES -#include - -#include "../util/readtex.c" - - -#define TEXTURE_FILE "../images/girl.rgb" - -static GLfloat Xrot = 0.0, Yrot = 0.0, Zrot = 0.0; - - -static void Display( void ) -{ - glClear( GL_COLOR_BUFFER_BIT ); - - glPushMatrix(); - glRotatef(Xrot, 1.0, 0.0, 0.0); - glRotatef(Yrot, 0.0, 1.0, 0.0); - glRotatef(Zrot, 0.0, 0.0, 1.0); - - glBegin(GL_POLYGON); - glColor4f(1.0, 1.0, 1.0, 1); glTexCoord2f(0, 0); glVertex2f(-1, -1); - glColor4f(0.2, 0.2, 1.0, 1); glTexCoord2f(1, 0); glVertex2f( 1, -1); - glColor4f(0.2, 1.0, 0.2, 1); glTexCoord2f(1, 1); glVertex2f( 1, 1); - glColor4f(1.0, 0.2, 0.2, 1); glTexCoord2f(0, 1); glVertex2f(-1, 1); - glEnd(); - - glPopMatrix(); - - glutSwapBuffers(); -} - - -static void Reshape( int width, int height ) -{ - glViewport( 0, 0, width, height ); - glMatrixMode( GL_PROJECTION ); - glLoadIdentity(); - glFrustum( -1.0, 1.0, -1.0, 1.0, 5.0, 25.0 ); - glMatrixMode( GL_MODELVIEW ); - glLoadIdentity(); - glTranslatef( 0.0, 0.0, -8.0 ); -} - - -static void SpecialKey( int key, int x, int y ) -{ - float step = 3.0; - (void) x; - (void) y; - - switch (key) { - case GLUT_KEY_UP: - Xrot += step; - break; - case GLUT_KEY_DOWN: - Xrot -= step; - break; - case GLUT_KEY_LEFT: - Yrot += step; - break; - case GLUT_KEY_RIGHT: - Yrot -= step; - break; - } - glutPostRedisplay(); -} - - -static void Key( unsigned char key, int x, int y ) -{ - (void) x; - (void) y; - switch (key) { - case 27: - exit(0); - break; - } - glutPostRedisplay(); -} - - -static void Init( void ) -{ - static const char *modulate2D = - "!!FP1.0\n" - "TEX R0, f[TEX0], TEX0, 2D; \n" - "MUL o[COLR], R0, f[COL0]; \n" - "END" - ; - GLuint modulateProg; - GLuint Texture; - - if (!glutExtensionSupported("GL_NV_fragment_program")) { - printf("Error: GL_NV_fragment_program not supported!\n"); - exit(1); - } - printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - - /* Setup the fragment program */ - glGenProgramsNV(1, &modulateProg); - glLoadProgramNV(GL_FRAGMENT_PROGRAM_NV, modulateProg, - strlen(modulate2D), - (const GLubyte *) modulate2D); - printf("glGetError = 0x%x\n", (int) glGetError()); - printf("glError(GL_PROGRAM_ERROR_STRING_NV) = %s\n", - (char *) glGetString(GL_PROGRAM_ERROR_STRING_NV)); - assert(glIsProgramNV(modulateProg)); - - glBindProgramNV(GL_FRAGMENT_PROGRAM_NV, modulateProg); - glEnable(GL_FRAGMENT_PROGRAM_NV); - - /* Load texture */ - glGenTextures(1, &Texture); - glBindTexture(GL_TEXTURE_2D, Texture); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - glPixelStorei(GL_UNPACK_ALIGNMENT, 1); - if (!LoadRGBMipmaps(TEXTURE_FILE, GL_RGB)) { - printf("Error: couldn't load texture image file %s\n", TEXTURE_FILE); - exit(1); - } - /* XXX this enable shouldn't really be needed!!! */ - glEnable(GL_TEXTURE_2D); - - glClearColor(.3, .3, .3, 0); -} - - -int main( int argc, char *argv[] ) -{ - glutInit( &argc, argv ); - glutInitWindowPosition( 0, 0 ); - glutInitWindowSize( 250, 250 ); - glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH ); - glutCreateWindow(argv[0]); - glutReshapeFunc( Reshape ); - glutKeyboardFunc( Key ); - glutSpecialFunc( SpecialKey ); - glutDisplayFunc( Display ); - Init(); - glutMainLoop(); - return 0; -} diff --git a/progs/tests/getprocaddress.c b/progs/tests/getprocaddress.c deleted file mode 100644 index ca66025d2d..0000000000 --- a/progs/tests/getprocaddress.c +++ /dev/null @@ -1,556 +0,0 @@ -/* - * Copyright (C) 1999-2002 Brian Paul All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -/* - * Test that glXGetProcAddress works. - */ - -#define GLX_GLXEXT_PROTOTYPES - -#include -#include -#include -#include -#include -#include -#include -#include - - -typedef void (*generic_func)(); - -#define EQUAL(X, Y) (fabs((X) - (Y)) < 0.001) - -/** - * The following functions are used to check that the named OpenGL function - * actually does what it's supposed to do. - * The naming of these functions is signficant. The getprocaddress.py script - * scans this file and extracts these function names. - */ - - -static GLboolean -test_ActiveTextureARB(generic_func func) -{ - PFNGLACTIVETEXTUREARBPROC activeTexture = (PFNGLACTIVETEXTUREARBPROC) func; - GLint t; - GLboolean pass; - (*activeTexture)(GL_TEXTURE1_ARB); - glGetIntegerv(GL_ACTIVE_TEXTURE_ARB, &t); - pass = (t == GL_TEXTURE1_ARB); - (*activeTexture)(GL_TEXTURE0_ARB); /* restore default */ - return pass; -} - - -static GLboolean -test_SecondaryColor3fEXT(generic_func func) -{ - PFNGLSECONDARYCOLOR3FEXTPROC secColor3f = (PFNGLSECONDARYCOLOR3FEXTPROC) func; - GLfloat color[4]; - GLboolean pass; - (*secColor3f)(1.0, 1.0, 0.0); - glGetFloatv(GL_CURRENT_SECONDARY_COLOR_EXT, color); - pass = (color[0] == 1.0 && color[1] == 1.0 && color[2] == 0.0); - (*secColor3f)(0.0, 0.0, 0.0); /* restore default */ - return pass; -} - - -static GLboolean -test_ActiveStencilFaceEXT(generic_func func) -{ - PFNGLACTIVESTENCILFACEEXTPROC activeFace = (PFNGLACTIVESTENCILFACEEXTPROC) func; - GLint face; - GLboolean pass; - (*activeFace)(GL_BACK); - glGetIntegerv(GL_ACTIVE_STENCIL_FACE_EXT, &face); - pass = (face == GL_BACK); - (*activeFace)(GL_FRONT); /* restore default */ - return pass; -} - - -static GLboolean -test_VertexAttrib1fvARB(generic_func func) -{ - PFNGLVERTEXATTRIB1FVARBPROC vertexAttrib1fvARB = (PFNGLVERTEXATTRIB1FVARBPROC) func; - PFNGLGETVERTEXATTRIBFVARBPROC getVertexAttribfvARB = (PFNGLGETVERTEXATTRIBFVARBPROC) glXGetProcAddressARB((const GLubyte *) "glGetVertexAttribfvARB"); - - const GLfloat v[1] = {25.0}; - const GLfloat def[1] = {0}; - GLfloat res[4]; - GLboolean pass; - (*vertexAttrib1fvARB)(6, v); - (*getVertexAttribfvARB)(6, GL_CURRENT_VERTEX_ATTRIB_ARB, res); - pass = (res[0] == 25.0 && res[1] == 0.0 && res[2] == 0.0 && res[3] == 1.0); - (*vertexAttrib1fvARB)(6, def); - return pass; -} - -static GLboolean -test_VertexAttrib4NubvARB(generic_func func) -{ - PFNGLVERTEXATTRIB4NUBVARBPROC vertexAttrib4NubvARB = (PFNGLVERTEXATTRIB4NUBVARBPROC) func; - PFNGLGETVERTEXATTRIBFVARBPROC getVertexAttribfvARB = (PFNGLGETVERTEXATTRIBFVARBPROC) glXGetProcAddressARB((const GLubyte *) "glGetVertexAttribfvARB"); - - const GLubyte v[4] = {255, 0, 255, 0}; - const GLubyte def[4] = {0, 0, 0, 255}; - GLfloat res[4]; - GLboolean pass; - (*vertexAttrib4NubvARB)(6, v); - (*getVertexAttribfvARB)(6, GL_CURRENT_VERTEX_ATTRIB_ARB, res); - pass = (res[0] == 1.0 && res[1] == 0.0 && res[2] == 1.0 && res[3] == 0.0); - (*vertexAttrib4NubvARB)(6, def); - return pass; -} - - -static GLboolean -test_VertexAttrib4NuivARB(generic_func func) -{ - PFNGLVERTEXATTRIB4NUIVARBPROC vertexAttrib4NuivARB = (PFNGLVERTEXATTRIB4NUIVARBPROC) func; - PFNGLGETVERTEXATTRIBFVARBPROC getVertexAttribfvARB = (PFNGLGETVERTEXATTRIBFVARBPROC) glXGetProcAddressARB((const GLubyte *) "glGetVertexAttribfvARB"); - - const GLuint v[4] = {0xffffffff, 0, 0xffffffff, 0}; - const GLuint def[4] = {0, 0, 0, 0xffffffff}; - GLfloat res[4]; - GLboolean pass; - (*vertexAttrib4NuivARB)(6, v); - (*getVertexAttribfvARB)(6, GL_CURRENT_VERTEX_ATTRIB_ARB, res); - pass = (EQUAL(res[0], 1.0) && EQUAL(res[1], 0.0) && EQUAL(res[2], 1.0) && EQUAL(res[3], 0.0)); - (*vertexAttrib4NuivARB)(6, def); - return pass; -} - - -static GLboolean -test_VertexAttrib4ivARB(generic_func func) -{ - PFNGLVERTEXATTRIB4IVARBPROC vertexAttrib4ivARB = (PFNGLVERTEXATTRIB4IVARBPROC) func; - PFNGLGETVERTEXATTRIBFVARBPROC getVertexAttribfvARB = (PFNGLGETVERTEXATTRIBFVARBPROC) glXGetProcAddressARB((const GLubyte *) "glGetVertexAttribfvARB"); - - const GLint v[4] = {1, 2, -3, 4}; - const GLint def[4] = {0, 0, 0, 1}; - GLfloat res[4]; - GLboolean pass; - (*vertexAttrib4ivARB)(6, v); - (*getVertexAttribfvARB)(6, GL_CURRENT_VERTEX_ATTRIB_ARB, res); - pass = (EQUAL(res[0], 1.0) && EQUAL(res[1], 2.0) && EQUAL(res[2], -3.0) && EQUAL(res[3], 4.0)); - (*vertexAttrib4ivARB)(6, def); - return pass; -} - - -static GLboolean -test_VertexAttrib4NsvARB(generic_func func) -{ - PFNGLVERTEXATTRIB4NSVARBPROC vertexAttrib4NsvARB = (PFNGLVERTEXATTRIB4NSVARBPROC) func; - PFNGLGETVERTEXATTRIBFVARBPROC getVertexAttribfvARB = (PFNGLGETVERTEXATTRIBFVARBPROC) glXGetProcAddressARB((const GLubyte *) "glGetVertexAttribfvARB"); - - const GLshort v[4] = {0, 32767, 32767, 0}; - const GLshort def[4] = {0, 0, 0, 32767}; - GLfloat res[4]; - GLboolean pass; - (*vertexAttrib4NsvARB)(6, v); - (*getVertexAttribfvARB)(6, GL_CURRENT_VERTEX_ATTRIB_ARB, res); - pass = (EQUAL(res[0], 0.0) && EQUAL(res[1], 1.0) && EQUAL(res[2], 1.0) && EQUAL(res[3], 0.0)); - (*vertexAttrib4NsvARB)(6, def); - return pass; -} - - -static GLboolean -test_VertexAttrib4NusvARB(generic_func func) -{ - PFNGLVERTEXATTRIB4NUSVARBPROC vertexAttrib4NusvARB = (PFNGLVERTEXATTRIB4NUSVARBPROC) func; - PFNGLGETVERTEXATTRIBFVARBPROC getVertexAttribfvARB = (PFNGLGETVERTEXATTRIBFVARBPROC) glXGetProcAddressARB((const GLubyte *) "glGetVertexAttribfvARB"); - - const GLushort v[4] = {0xffff, 0, 0xffff, 0}; - const GLushort def[4] = {0, 0, 0, 0xffff}; - GLfloat res[4]; - GLboolean pass; - (*vertexAttrib4NusvARB)(6, v); - (*getVertexAttribfvARB)(6, GL_CURRENT_VERTEX_ATTRIB_ARB, res); - pass = (EQUAL(res[0], 1.0) && EQUAL(res[1], 0.0) && EQUAL(res[2], 1.0) && EQUAL(res[3], 0.0)); - (*vertexAttrib4NusvARB)(6, def); - return pass; -} - - -static GLboolean -test_VertexAttrib4ubNV(generic_func func) -{ - PFNGLVERTEXATTRIB4UBNVPROC vertexAttrib4ubNV = (PFNGLVERTEXATTRIB4UBNVPROC) func; - PFNGLGETVERTEXATTRIBFVNVPROC getVertexAttribfvNV = (PFNGLGETVERTEXATTRIBFVNVPROC) glXGetProcAddressARB((const GLubyte *) "glGetVertexAttribfvNV"); - - const GLubyte v[4] = {255, 0, 255, 0}; - const GLubyte def[4] = {0, 0, 0, 255}; - GLfloat res[4]; - GLboolean pass; - (*vertexAttrib4ubNV)(6, v[0], v[1], v[2], v[3]); - (*getVertexAttribfvNV)(6, GL_CURRENT_ATTRIB_NV, res); - pass = (res[0] == 1.0 && res[1] == 0.0 && res[2] == 1.0 && res[3] == 0.0); - (*vertexAttrib4ubNV)(6, def[0], def[1], def[2], def[3]); - return pass; -} - - -static GLboolean -test_VertexAttrib2sNV(generic_func func) -{ - PFNGLVERTEXATTRIB2SNVPROC vertexAttrib2sNV = (PFNGLVERTEXATTRIB2SNVPROC) func; - PFNGLGETVERTEXATTRIBFVNVPROC getVertexAttribfvNV = (PFNGLGETVERTEXATTRIBFVNVPROC) glXGetProcAddressARB((const GLubyte *) "glGetVertexAttribfvNV"); - - const GLshort v[2] = {2, -4,}; - const GLshort def[2] = {0, 0}; - GLfloat res[4]; - GLboolean pass; - (*vertexAttrib2sNV)(6, v[0], v[1]); - (*getVertexAttribfvNV)(6, GL_CURRENT_ATTRIB_NV, res); - pass = (EQUAL(res[0], 2) && EQUAL(res[1], -4) && EQUAL(res[2], 0) && res[3] == 1.0); - (*vertexAttrib2sNV)(6, def[0], def[1]); - return pass; -} - - -static GLboolean -test_VertexAttrib3fNV(generic_func func) -{ - PFNGLVERTEXATTRIB3FNVPROC vertexAttrib3fNV = (PFNGLVERTEXATTRIB3FNVPROC) func; - PFNGLGETVERTEXATTRIBFVNVPROC getVertexAttribfvNV = (PFNGLGETVERTEXATTRIBFVNVPROC) glXGetProcAddressARB((const GLubyte *) "glGetVertexAttribfvNV"); - - const GLfloat v[3] = {0.2, 0.4, 0.8}; - const GLfloat def[3] = {0, 0, 0}; - GLfloat res[4]; - GLboolean pass; - (*vertexAttrib3fNV)(6, v[0], v[1], v[2]); - (*getVertexAttribfvNV)(6, GL_CURRENT_ATTRIB_NV, res); - pass = (EQUAL(res[0], 0.2) && EQUAL(res[1], 0.4) && EQUAL(res[2], 0.8) && res[3] == 1.0); - (*vertexAttrib3fNV)(6, def[0], def[1], def[2]); - return pass; -} - - -static GLboolean -test_VertexAttrib4dvNV(generic_func func) -{ - PFNGLVERTEXATTRIB4DVNVPROC vertexAttrib4dvNV = (PFNGLVERTEXATTRIB4DVNVPROC) func; - PFNGLGETVERTEXATTRIBFVNVPROC getVertexAttribfvNV = (PFNGLGETVERTEXATTRIBFVNVPROC) glXGetProcAddressARB((const GLubyte *) "glGetVertexAttribfvNV"); - - const GLdouble v[4] = {0.2, 0.4, 0.8, 1.2}; - const GLdouble def[4] = {0, 0, 0, 1}; - GLfloat res[4]; - GLboolean pass; - (*vertexAttrib4dvNV)(6, v); - (*getVertexAttribfvNV)(6, GL_CURRENT_ATTRIB_NV, res); - pass = (EQUAL(res[0], 0.2) && EQUAL(res[1], 0.4) && EQUAL(res[2], 0.8) && EQUAL(res[3], 1.2)); - (*vertexAttrib4dvNV)(6, def); - return pass; -} - - -static GLboolean -test_StencilFuncSeparateATI(generic_func func) -{ -#ifdef GL_ATI_separate_stencil - PFNGLSTENCILFUNCSEPARATEATIPROC stencilFuncSeparateATI = (PFNGLSTENCILFUNCSEPARATEATIPROC) func; - GLint frontFunc, backFunc; - GLint frontRef, backRef; - GLint frontMask, backMask; - (*stencilFuncSeparateATI)(GL_LESS, GL_GREATER, 2, 0xa); - glGetIntegerv(GL_STENCIL_FUNC, &frontFunc); - glGetIntegerv(GL_STENCIL_BACK_FUNC, &backFunc); - glGetIntegerv(GL_STENCIL_REF, &frontRef); - glGetIntegerv(GL_STENCIL_BACK_REF, &backRef); - glGetIntegerv(GL_STENCIL_VALUE_MASK, &frontMask); - glGetIntegerv(GL_STENCIL_BACK_VALUE_MASK, &backMask); - if (frontFunc != GL_LESS || - backFunc != GL_GREATER || - frontRef != 2 || - backRef != 2 || - frontMask != 0xa || - backMask != 0xa) - return GL_FALSE; -#endif - return GL_TRUE; -} - -static GLboolean -test_StencilFuncSeparate(generic_func func) -{ -#ifdef GL_VERSION_2_0 - PFNGLSTENCILFUNCSEPARATEPROC stencilFuncSeparate = (PFNGLSTENCILFUNCSEPARATEPROC) func; - GLint frontFunc, backFunc; - GLint frontRef, backRef; - GLint frontMask, backMask; - (*stencilFuncSeparate)(GL_BACK, GL_GREATER, 2, 0xa); - glGetIntegerv(GL_STENCIL_FUNC, &frontFunc); - glGetIntegerv(GL_STENCIL_BACK_FUNC, &backFunc); - glGetIntegerv(GL_STENCIL_REF, &frontRef); - glGetIntegerv(GL_STENCIL_BACK_REF, &backRef); - glGetIntegerv(GL_STENCIL_VALUE_MASK, &frontMask); - glGetIntegerv(GL_STENCIL_BACK_VALUE_MASK, &backMask); - if (frontFunc != GL_ALWAYS || - backFunc != GL_GREATER || - frontRef != 0 || - backRef != 2 || - frontMask == 0xa || /* might be 0xff or ~0 */ - backMask != 0xa) - return GL_FALSE; -#endif - return GL_TRUE; -} - -static GLboolean -test_StencilOpSeparate(generic_func func) -{ -#ifdef GL_VERSION_2_0 - PFNGLSTENCILOPSEPARATEPROC stencilOpSeparate = (PFNGLSTENCILOPSEPARATEPROC) func; - GLint frontFail, backFail; - GLint frontZFail, backZFail; - GLint frontZPass, backZPass; - (*stencilOpSeparate)(GL_BACK, GL_INCR, GL_DECR, GL_INVERT); - glGetIntegerv(GL_STENCIL_FAIL, &frontFail); - glGetIntegerv(GL_STENCIL_BACK_FAIL, &backFail); - glGetIntegerv(GL_STENCIL_PASS_DEPTH_FAIL, &frontZFail); - glGetIntegerv(GL_STENCIL_BACK_PASS_DEPTH_FAIL, &backZFail); - glGetIntegerv(GL_STENCIL_PASS_DEPTH_PASS, &frontZPass); - glGetIntegerv(GL_STENCIL_BACK_PASS_DEPTH_PASS, &backZPass); - if (frontFail != GL_KEEP || - backFail != GL_INCR || - frontZFail != GL_KEEP || - backZFail != GL_DECR || - frontZPass != GL_KEEP || - backZPass != GL_INVERT) - return GL_FALSE; -#endif - return GL_TRUE; -} - -static GLboolean -test_StencilMaskSeparate(generic_func func) -{ -#ifdef GL_VERSION_2_0 - PFNGLSTENCILMASKSEPARATEPROC stencilMaskSeparate = (PFNGLSTENCILMASKSEPARATEPROC) func; - GLint frontMask, backMask; - (*stencilMaskSeparate)(GL_BACK, 0x1b); - glGetIntegerv(GL_STENCIL_WRITEMASK, &frontMask); - glGetIntegerv(GL_STENCIL_BACK_WRITEMASK, &backMask); - if (frontMask == 0x1b || - backMask != 0x1b) - return GL_FALSE; -#endif - return GL_TRUE; -} - - -/* - * The following file is auto-generated with Python. - */ -#include "getproclist.h" - - - -static int -extension_supported(const char *haystack, const char *needle) -{ - const char *p = strstr(haystack, needle); - if (p) { - /* found string, make sure next char is space or zero */ - const int len = strlen(needle); - if (p[len] == ' ' || p[len] == 0) - return 1; - else - return 0; - } - else - return 0; -} - - -static void -check_functions( const char *extensions ) -{ - struct name_test_pair *entry; - int failures = 0, passes = 0; - int totalFail = 0, totalPass = 0; - int doTests; - - for (entry = functions; entry->name; entry++) { - if (entry->name[0] == '-') { - const char *version = (const char *) glGetString(GL_VERSION); - if (entry->name[1] == '1') { - /* check GL version 1.x */ - if (version[0] == '1' && - version[1] == '.' && - version[2] >= entry->name[3]) - doTests = 1; - else - doTests = 0; - } - else if (entry->name[1] == '2') { - if (version[0] == '2' && - version[1] == '.' && - version[2] >= entry->name[3]) - doTests = 1; - else - doTests = 0; - } - else { - /* check if the named extension is available */ - doTests = extension_supported(extensions, entry->name+1); - } - if (doTests) - printf("Testing %s functions\n", entry->name + 1); - totalFail += failures; - totalPass += passes; - failures = 0; - passes = 0; - } - else if (doTests) { - generic_func funcPtr = (generic_func) glXGetProcAddressARB((const GLubyte *) entry->name); - if (funcPtr) { - if (entry->test) { - GLboolean b; - printf(" Validating %s:", entry->name); - b = (*entry->test)(funcPtr); - if (b) { - printf(" Pass\n"); - passes++; - } - else { - printf(" FAIL!!!\n"); - failures++; - } - } - else { - passes++; - } - } - else { - printf(" glXGetProcAddress(%s) failed!\n", entry->name); - failures++; - } - } - - if (doTests && (!(entry+1)->name || (entry+1)->name[0] == '-')) { - if (failures > 0) { - printf(" %d failed.\n", failures); - } - if (passes > 0) { - printf(" %d passed.\n", passes); - } - } - } - totalFail += failures; - totalPass += passes; - - printf("-----------------------------\n"); - printf("Total: %d pass %d fail\n", totalPass, totalFail); -} - - - -static void -print_screen_info(Display *dpy, int scrnum, Bool allowDirect) -{ - Window win; - int attribSingle[] = { - GLX_RGBA, - GLX_RED_SIZE, 1, - GLX_GREEN_SIZE, 1, - GLX_BLUE_SIZE, 1, - GLX_STENCIL_SIZE, 1, - None }; - int attribDouble[] = { - GLX_RGBA, - GLX_RED_SIZE, 1, - GLX_GREEN_SIZE, 1, - GLX_BLUE_SIZE, 1, - GLX_STENCIL_SIZE, 1, - GLX_DOUBLEBUFFER, - None }; - - XSetWindowAttributes attr; - unsigned long mask; - Window root; - GLXContext ctx; - XVisualInfo *visinfo; - int width = 100, height = 100; - - root = RootWindow(dpy, scrnum); - - visinfo = glXChooseVisual(dpy, scrnum, attribSingle); - if (!visinfo) { - visinfo = glXChooseVisual(dpy, scrnum, attribDouble); - if (!visinfo) { - fprintf(stderr, "Error: couldn't find RGB GLX visual\n"); - return; - } - } - - attr.background_pixel = 0; - attr.border_pixel = 0; - attr.colormap = XCreateColormap(dpy, root, visinfo->visual, AllocNone); - attr.event_mask = StructureNotifyMask | ExposureMask; - mask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask; - win = XCreateWindow(dpy, root, 0, 0, width, height, - 0, visinfo->depth, InputOutput, - visinfo->visual, mask, &attr); - - ctx = glXCreateContext( dpy, visinfo, NULL, allowDirect ); - if (!ctx) { - fprintf(stderr, "Error: glXCreateContext failed\n"); - XDestroyWindow(dpy, win); - return; - } - - if (glXMakeCurrent(dpy, win, ctx)) { - check_functions( (const char *) glGetString(GL_EXTENSIONS) ); - } - else { - fprintf(stderr, "Error: glXMakeCurrent failed\n"); - } - - glXDestroyContext(dpy, ctx); - XDestroyWindow(dpy, win); -} - - -int -main(int argc, char *argv[]) -{ - char *displayName = NULL; - Display *dpy; - - dpy = XOpenDisplay(displayName); - if (!dpy) { - fprintf(stderr, "Error: unable to open display %s\n", displayName); - return -1; - } - - print_screen_info(dpy, 0, GL_TRUE); - - XCloseDisplay(dpy); - - return 0; -} diff --git a/progs/tests/getprocaddress.py b/progs/tests/getprocaddress.py deleted file mode 100644 index 8adfc51bd6..0000000000 --- a/progs/tests/getprocaddress.py +++ /dev/null @@ -1,92 +0,0 @@ -#!/usr/bin/env python - - -# Helper for the getprocaddress.c test. - -import sys, getopt, re -sys.path.append("../../src/mesa/glapi/" ) -import gl_XML -import license - - -def FindTestFunctions(): - """Scan getprocaddress.c for lines that start with "test_" to find - extension function tests. Return a list of names found.""" - functions = [] - f = open("getprocaddress.c") - if not f: - return functions - for line in f.readlines(): - v = re.search("^test_([a-zA-Z0-9]+)", line) - if v: - func = v.group(1) - functions.append(func) - f.close - return functions - - -class PrintExports(gl_XML.gl_print_base): - def __init__(self): - gl_XML.gl_print_base.__init__(self) - - self.name = "getprocaddress.py (from Mesa)" - self.license = license.bsd_license_template % ( \ -"""Copyright (C) 1999-2001 Brian Paul All Rights Reserved. -(C) Copyright IBM Corporation 2004""", "BRIAN PAUL, IBM") - - self.tests = FindTestFunctions() - self.prevCategory = "" - return - - - def printRealHeader(self): - print """ -struct name_test_pair { - const char *name; - GLboolean (*test)(generic_func); -}; - -static struct name_test_pair functions[] = {""" - - def printBody(self, api): - prev_category = None - - - for f in api.functionIterateByOffset(): - [category, num] = api.get_category_for_name( f.name ) - if category != prev_category: - print ' { "-%s", NULL},' % category - prev_category = category - - test = "NULL" - for name in f.entry_points: - if name in self.tests: - test = "test_%s" % name - break - - print ' { "gl%s", %s },' % (f.name, test) - - print '' - print ' { NULL, NULL }' - print '};' - print '' - return - - -if __name__ == '__main__': - file_name = "../../src/mesa/glapi/gl_API.xml" - - try: - (args, trail) = getopt.getopt(sys.argv[1:], "f:") - except Exception,e: - show_usage() - - for (arg,val) in args: - if arg == "-f": - file_name = val - - printer = PrintExports() - - api = gl_XML.parse_GL_API( file_name, gl_XML.gl_item_factory() ) - - printer.Print( api ) diff --git a/progs/tests/interleave.c b/progs/tests/interleave.c deleted file mode 100644 index e98b3ed046..0000000000 --- a/progs/tests/interleave.c +++ /dev/null @@ -1,406 +0,0 @@ -/* - * (C) Copyright IBM Corporation 2005 - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * on the rights to use, copy, modify, merge, publish, distribute, sub - * license, and/or sell copies of the Software, and to permit persons to whom - * the Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL - * VA LINUX SYSTEM, IBM AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, - * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR - * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE - * USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -/** - * \file interleave.c - * - * Simple test of glInterleavedArrays functionality. For each mode, two - * meshes are drawn. One is drawn using interleaved arrays and the othe is - * drawn using immediate mode. Both should look identical. - * - * \author Ian Romanick - */ - -#include -#include -#include -#include -#include - -static int Width = 400; -static int Height = 300; -static const GLfloat Near = 5.0, Far = 25.0; - -static const GLfloat t[][4] = { - { 0.5, 0.0, 0.0, 1.0 }, - - { 0.25, 0.5, 0.0, 1.0 }, - { 0.75, 0.5, 0.0, 1.0 }, - - { 0.0, 1.0, 0.0, 1.0 }, - { 0.5, 1.0, 0.0, 1.0 }, - { 1.0, 1.0, 0.0, 1.0 }, -}; - -static const GLfloat c_f[][4] = { - { 1.0, 0.0, 0.0, 1.0 }, - - { 0.0, 1.0, 0.0, 1.0 }, - { 0.0, 1.0, 0.0, 1.0 }, - - { 0.0, 0.0, 1.0, 1.0 }, - { 1.0, 0.0, 1.0, 1.0 }, - { 0.0, 0.0, 1.0, 1.0 }, -}; - -static const GLubyte c_ub[][4] = { - { 0xff, 0x00, 0x00, 0xff }, - - { 0x00, 0xff, 0x00, 0xff }, - { 0x00, 0xff, 0x00, 0xff }, - - { 0x00, 0x00, 0xff, 0xff }, - { 0xff, 0x00, 0xff, 0xff }, - { 0x00, 0x00, 0xff, 0xff }, -}; - -static const GLfloat n[][3] = { - { 0.0, 0.0, -1.0 }, - - { 0.0, 0.0, -1.0 }, - { 0.0, 0.0, -1.0 }, - - { 0.0, 0.0, -1.0 }, - { 0.0, 0.0, -1.0 }, - { 0.0, 0.0, -1.0 }, -}; - -static const GLfloat v[][4] = { - { 0.0, 1.0, 0.0, 1.0, }, - - { -0.5, 0.0, 0.0, 1.0, }, - { 0.5, 0.0, 0.0, 1.0, }, - - { -1.0, -1.0, 0.0, 1.0, }, - { 0.0, -1.0, 0.0, 1.0, }, - { 1.0, -1.0, 0.0, 1.0, }, -}; - -static const unsigned indicies[12] = { - 0, 1, 2, - 1, 3, 4, - 2, 4, 5, - 1, 4, 2 -}; - -#define NONE { NULL, 0, 0, 0 } -#define V2F { v, 2, 2 * sizeof( GLfloat ), GL_FLOAT, sizeof( v[0] ) } -#define V3F { v, 3, 3 * sizeof( GLfloat ), GL_FLOAT, sizeof( v[0] ) } -#define V4F { v, 4, 4 * sizeof( GLfloat ), GL_FLOAT, sizeof( v[0] ) } - -#define C4UB { c_ub, 4, 4 * sizeof( GLubyte ), GL_UNSIGNED_BYTE, sizeof( c_ub[0] ) } -#define C3F { c_f, 3, 3 * sizeof( GLfloat ), GL_FLOAT, sizeof( c_f[0] ) } -#define C4F { c_f, 4, 4 * sizeof( GLfloat ), GL_FLOAT, sizeof( c_f[0] ) } - -#define T2F { t, 2, 2 * sizeof( GLfloat ), GL_FLOAT, sizeof( t[0] ) } -#define T4F { t, 4, 4 * sizeof( GLfloat ), GL_FLOAT, sizeof( t[0] ) } - -#define N3F { n, 3, 3 * sizeof( GLfloat ), GL_FLOAT, sizeof( n[0] ) } - -struct interleave_info { - const void * data; - unsigned count; - unsigned size; - GLenum type; - unsigned stride; -}; - -#define NUM_MODES 14 -#define INVALID_MODE 14 -#define INVALID_STRIDE 15 - -struct interleave_info info[ NUM_MODES ][4] = { - { NONE, NONE, NONE, V2F }, - { NONE, NONE, NONE, V3F }, - { NONE, C4UB, NONE, V2F }, - { NONE, C4UB, NONE, V3F }, - { NONE, C3F, NONE, V3F }, - - { NONE, NONE, N3F, V3F }, - { NONE, C4F, N3F, V3F }, - - { T2F, NONE, NONE, V3F }, - { T4F, NONE, NONE, V4F }, - - { T2F, C4UB, NONE, V3F }, - { T2F, C3F, NONE, V3F }, - { T2F, NONE, N3F, V3F }, - { T2F, C4F, N3F, V3F }, - { T4F, C4F, N3F, V4F }, -}; - -const char * const mode_names[ NUM_MODES ] = { - "GL_V2F", - "GL_V3F", - "GL_C4UB_V2F", - "GL_C4UB_V3F", - "GL_C3F_V3F", - "GL_N3F_V3F", - "GL_C4F_N3F_V3F", - "GL_T2F_V3F", - "GL_T4F_V4F", - "GL_T2F_C4UB_V3F", - "GL_T2F_C3F_V3F", - "GL_T2F_N3F_V3F", - "GL_T2F_C4F_N3F_V3F", - "GL_T4F_C4F_N3F_V4F", -}; - -static unsigned interleave_mode = 0; -static GLboolean use_invalid_mode = GL_FALSE; -static GLboolean use_invalid_stride = GL_FALSE; - -#define DEREF(item,idx) (void *) & ((char *)curr_info[item].data)[idx * curr_info[item].stride] - -static void Display( void ) -{ - const struct interleave_info * const curr_info = info[ interleave_mode ]; - - /* 4 floats for 12 verticies for 4 data elements. - */ - char data[ (sizeof( GLfloat ) * 4) * 12 * 4 ]; - - unsigned i; - unsigned offset; - GLenum err; - GLenum format; - GLsizei stride; - - - glClearColor(0.2, 0.2, 0.8, 0); - glClear( GL_COLOR_BUFFER_BIT ); - - glPushMatrix(); - - glTranslatef(-1.5, 0, 0); - - glColor3fv( c_f[0] ); - - if ( curr_info[0].data != NULL ) { - glEnable( GL_TEXTURE_2D ); - } - else { - glDisable( GL_TEXTURE_2D ); - } - - - offset = 0; - glBegin(GL_TRIANGLES); - for ( i = 0 ; i < 12 ; i++ ) { - const unsigned index = indicies[i]; - - - /* Handle the vertex texture coordinate. - */ - if ( curr_info[0].data != NULL ) { - if ( curr_info[0].count == 2 ) { - glTexCoord2fv( DEREF(0, index) ); - } - else { - glTexCoord4fv( DEREF(0, index) ); - } - - (void) memcpy( & data[ offset ], DEREF(0, index), - curr_info[0].size ); - offset += curr_info[0].size; - } - - - /* Handle the vertex color. - */ - if ( curr_info[1].data != NULL ) { - if ( curr_info[1].type == GL_FLOAT ) { - if ( curr_info[1].count == 3 ) { - glColor3fv( DEREF(1, index) ); - } - else { - glColor4fv( DEREF(1, index) ); - } - } - else { - glColor4ubv( DEREF(1, index) ); - } - - (void) memcpy( & data[ offset ], DEREF(1, index), - curr_info[1].size ); - offset += curr_info[1].size; - } - - - /* Handle the vertex normal. - */ - if ( curr_info[2].data != NULL ) { - glNormal3fv( DEREF(2, index) ); - - (void) memcpy( & data[ offset ], DEREF(2, index), - curr_info[2].size ); - offset += curr_info[2].size; - } - - - switch( curr_info[3].count ) { - case 2: - glVertex2fv( DEREF(3, index) ); - break; - case 3: - glVertex3fv( DEREF(3, index) ); - break; - case 4: - glVertex4fv( DEREF(3, index) ); - break; - } - - (void) memcpy( & data[ offset ], DEREF(3, index), - curr_info[3].size ); - offset += curr_info[3].size; - } - glEnd(); - - - glTranslatef(3.0, 0, 0); - - /* The masking with ~0x2A00 is a bit of a hack to make sure that format - * ends up with an invalid value no matter what rand() returns. - */ - format = (use_invalid_mode) - ? (rand() & ~0x2A00) : GL_V2F + interleave_mode; - stride = (use_invalid_stride) ? -abs(rand()) : 0; - - (void) glGetError(); - glInterleavedArrays( format, stride, data ); - err = glGetError(); - if ( err ) { - printf("glInterleavedArrays(0x%04x, %d, %p) generated the error 0x%04x\n", - format, stride, data, err ); - } - else { - glDrawArrays( GL_TRIANGLES, 0, 12 ); - } - - glPopMatrix(); - - glutSwapBuffers(); -} - - -static void Reshape( int width, int height ) -{ - GLfloat ar = (float) width / (float) height; - Width = width; - Height = height; - glViewport( 0, 0, width, height ); - glMatrixMode( GL_PROJECTION ); - glLoadIdentity(); - glFrustum( -ar, ar, -1.0, 1.0, Near, Far ); - glMatrixMode( GL_MODELVIEW ); - glLoadIdentity(); - glTranslatef( 0.0, 0.0, -15.0 ); -} - - -static void Key( unsigned char key, int x, int y ) -{ - (void) x; - (void) y; - switch (key) { - case 27: - exit(0); - break; - } - glutPostRedisplay(); -} - - -static void ModeMenu( int entry ) -{ - if ( entry == INVALID_MODE ) { - use_invalid_mode = GL_TRUE; - use_invalid_stride = GL_FALSE; - } - else if ( entry == INVALID_STRIDE ) { - use_invalid_mode = GL_FALSE; - use_invalid_stride = GL_TRUE; - } - else { - use_invalid_mode = GL_FALSE; - use_invalid_stride = GL_FALSE; - interleave_mode = entry; - } -} - -static void Init( void ) -{ - const char * const ver_string = (const char * const) - glGetString( GL_VERSION ); - const GLubyte tex[16] = { - 0xff, 0x00, 0xff, 0x00, - 0x00, 0xff, 0x00, 0xff, - 0xff, 0x00, 0xff, 0x00, - 0x00, 0xff, 0x00, 0xff, - }; - - printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - printf("GL_VERSION = %s\n", ver_string); - - glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST ); - glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST ); - glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE ); - glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, 4, 4, 0, - GL_LUMINANCE, GL_UNSIGNED_BYTE, tex ); - - printf("Use the context menu (right click) to select the interleaved array mode.\n"); - printf("Press ESCAPE to exit.\n\n"); - printf("NOTE: This is *NOT* a very good test of the modes that use normals.\n"); -} - - -int main( int argc, char *argv[] ) -{ - unsigned i; - - srand( time( NULL ) ); - - glutInit( &argc, argv ); - glutInitWindowPosition( 0, 0 ); - glutInitWindowSize( Width, Height ); - glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE ); - glutCreateWindow( "glInterleavedArrays test" ); - glutReshapeFunc( Reshape ); - glutKeyboardFunc( Key ); - glutDisplayFunc( Display ); - - glutCreateMenu( ModeMenu ); - for ( i = 0 ; i < NUM_MODES ; i++ ) { - glutAddMenuEntry( mode_names[i], i); - } - - glutAddMenuEntry( "Random invalid mode", INVALID_MODE); - glutAddMenuEntry( "Random invalid stride", INVALID_STRIDE); - - glutAttachMenu(GLUT_RIGHT_BUTTON); - - Init(); - glutMainLoop(); - return 0; -} diff --git a/progs/tests/invert.c b/progs/tests/invert.c deleted file mode 100644 index 750592ed79..0000000000 --- a/progs/tests/invert.c +++ /dev/null @@ -1,195 +0,0 @@ -/* - * (C) Copyright IBM Corporation 2005 - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * on the rights to use, copy, modify, merge, publish, distribute, sub - * license, and/or sell copies of the Software, and to permit persons to whom - * the Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL - * VA LINUX SYSTEM, IBM AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, - * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR - * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE - * USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -/** - * \file invert.c - * - * Simple test of GL_MESA_pack_invert functionality. Three squares are - * drawn. The first two should look the same, and the third one should - * look inverted. - * - * \author Ian Romanick - */ - -#include -#include -#include -#include - -#include "readtex.h" - -#define IMAGE_FILE "../images/tree3.rgb" - -static int Width = 420; -static int Height = 150; -static const GLfloat Near = 5.0, Far = 25.0; - -static GLubyte * image = NULL; -static GLubyte * temp_image = NULL; -static GLuint img_width = 0; -static GLuint img_height = 0; -static GLuint img_format = 0; - -PFNGLWINDOWPOS2IPROC win_pos_2i = NULL; - - -static void Display( void ) -{ - GLint err; - - - glClearColor(0.2, 0.2, 0.8, 0); - glClear( GL_COLOR_BUFFER_BIT ); - - - /* This is the "reference" square. - */ - - (*win_pos_2i)( 5, 5 ); - glDrawPixels( img_width, img_height, img_format, GL_UNSIGNED_BYTE, image ); - - glPixelStorei( GL_PACK_INVERT_MESA, GL_FALSE ); - err = glGetError(); - if ( err != GL_NO_ERROR ) { - printf( "Setting PACK_INVERT_MESA to false generated an error (0x%04x).\n", - err ); - } - - glReadPixels( 5, 5, img_width, img_height, img_format, GL_UNSIGNED_BYTE, temp_image ); - (*win_pos_2i)( 5 + 1 * (10 + img_width), 5 ); - glDrawPixels( img_width, img_height, img_format, GL_UNSIGNED_BYTE, temp_image ); - - glPixelStorei( GL_PACK_INVERT_MESA, GL_TRUE ); - err = glGetError(); - if ( err != GL_NO_ERROR ) { - printf( "Setting PACK_INVERT_MESA to true generated an error (0x%04x).\n", - err ); - } - - glReadPixels( 5, 5, img_width, img_height, img_format, GL_UNSIGNED_BYTE, temp_image ); - (*win_pos_2i)( 5 + 2 * (10 + img_width), 5 ); - glDrawPixels( img_width, img_height, img_format, GL_UNSIGNED_BYTE, temp_image ); - - glutSwapBuffers(); -} - - -static void Reshape( int width, int height ) -{ - GLfloat ar = (float) width / (float) height; - Width = width; - Height = height; - glViewport( 0, 0, width, height ); - glMatrixMode( GL_PROJECTION ); - glLoadIdentity(); - glFrustum( -ar, ar, -1.0, 1.0, Near, Far ); - glMatrixMode( GL_MODELVIEW ); - glLoadIdentity(); - glTranslatef( 0.0, 0.0, -15.0 ); -} - - -static void Key( unsigned char key, int x, int y ) -{ - (void) x; - (void) y; - switch (key) { - case 27: - exit(0); - break; - } - glutPostRedisplay(); -} - - -static void Init( void ) -{ - const char * const ver_string = (const char * const) - glGetString( GL_VERSION ); - const float ver = strtof( ver_string, NULL ); - - - printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - printf("GL_VERSION = %s\n", ver_string); - - if ( !glutExtensionSupported("GL_MESA_pack_invert") ) { - printf("\nSorry, this program requires GL_MESA_pack_invert.\n"); - exit(1); - } - - if ( ver >= 1.4 ) { - win_pos_2i = (PFNGLWINDOWPOS2IPROC) glutGetProcAddress( "glWindowPos2i" ); - } - else if ( glutExtensionSupported("GL_ARB_window_pos") ) { - win_pos_2i = (PFNGLWINDOWPOS2IPROC) glutGetProcAddress( "glWindowPos2iARB" ); - } - else if ( glutExtensionSupported("GL_MESA_window_pos") ) { - win_pos_2i = (PFNGLWINDOWPOS2IPROC) glutGetProcAddress( "glWindowPos2iMESA" ); - } - - - /* Do this check as a separate if-statement instead of as an else in case - * one of the required extensions is supported but glutGetProcAddress - * returns NULL. - */ - - if ( win_pos_2i == NULL ) { - printf("\nSorry, this program requires either GL 1.4 (or higher),\n" - "GL_ARB_window_pos, or GL_MESA_window_pos.\n"); - exit(1); - } - - printf("\nThe left 2 squares should be the same color, and the right\n" - "square should look upside-down.\n"); - - - image = LoadRGBImage( IMAGE_FILE, & img_width, & img_height, - & img_format ); - if ( image == NULL ) { - printf( "Could not open image file \"%s\".\n", IMAGE_FILE ); - exit(1); - } - - temp_image = malloc( 3 * img_height * img_width ); - if ( temp_image == NULL ) { - printf( "Could not allocate memory for temporary image.\n" ); - exit(1); - } -} - - -int main( int argc, char *argv[] ) -{ - glutInit( &argc, argv ); - glutInitWindowPosition( 0, 0 ); - glutInitWindowSize( Width, Height ); - glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE ); - glutCreateWindow( "GL_MESA_pack_invert test" ); - glutReshapeFunc( Reshape ); - glutKeyboardFunc( Key ); - glutDisplayFunc( Display ); - Init(); - glutMainLoop(); - return 0; -} diff --git a/progs/tests/jkrahntest.c b/progs/tests/jkrahntest.c deleted file mode 100644 index 08660b8932..0000000000 --- a/progs/tests/jkrahntest.c +++ /dev/null @@ -1,180 +0,0 @@ - -/* This is a good test for glXSwapBuffers on non-current windows, - * and the glXCopyContext function. Fixed several Mesa/DRI bugs with - * this program on 15 June 2002. - * - * Joe's comments follow: - * - * I have tried some different approaches for being able to - * draw to multiple windows using one context, or a copied - * context. Mesa/indirect rendering works to use one context - * for multiple windows, but crashes with glXCopyContext. - * DRI is badly broken, at least for ATI. - * - * I also noticed that glXMakeCurrent allows a window and context - * from different visuals to be attached (haven't tested recently). - * - * Joe Krahn - */ - -#include -#include -#include -#include -#include -#include -#include - -#ifndef M_PI -#define M_PI 3.14159 -#endif - -#define DEGTOR (M_PI/180.0) - -static int AttributeList[] = { GLX_RGBA, GLX_DOUBLEBUFFER, None }; - -int main(int argc, char **argv) -{ - Window win1, win2; - XVisualInfo *vi; - XSetWindowAttributes swa; - Display *dpy; - GLXContext ctx1, ctx2; - float angle; - int test; - - if (argc < 2) { - fprintf(stderr, "This program tests GLX context switching.\n"); - fprintf(stderr, "Usage: cxbug \n"); - fprintf(stderr, "Where n is:\n"); - fprintf(stderr, "\t1) Use two contexts and swap only when the context is current (typical case).\n"); - fprintf(stderr, "\t2) Use two contexts and swap at the same time.\n"); - fprintf(stderr, "\t\t Used to crash Mesa & nVidia, and DRI artifacts. Seems OK now.\n"); - fprintf(stderr, "\t3) Use one context, but only swap when a context is current.\n"); - fprintf(stderr, "\t\t Serious artifacts for DRI at least with ATI.\n"); - fprintf(stderr, "\t4) Use one context, swap both windows at the same time, so the left\n"); - fprintf(stderr, "\t\t window has no context at swap time. Severe artifacts for DRI.\n"); - fprintf(stderr, "\t5) Use two contexts, copying one to the other when switching windows.\n"); - fprintf(stderr, "\t\t DRI gives an error, indirect rendering crashes server.\n"); - - exit(1); - } - test = atoi(argv[1]); - - /* get a connection */ - dpy = XOpenDisplay(NULL); - - /* Get an appropriate visual */ - vi = glXChooseVisual(dpy, DefaultScreen(dpy), AttributeList); - if (vi == 0) { - fprintf(stderr, "No matching visuals found.\n"); - exit(-1); - } - - /* Create two GLX contexts, with list sharing */ - ctx1 = glXCreateContext(dpy, vi, 0, True); - ctx2 = glXCreateContext(dpy, vi, ctx1, True); - - /* create a colormap */ - swa.colormap = XCreateColormap(dpy, RootWindow(dpy, vi->screen), - vi->visual, AllocNone); - swa.border_pixel = 0; - - /* Create two windows */ - win1 = XCreateWindow(dpy, RootWindow(dpy, vi->screen), - 10, 10, 200, 200, - 0, vi->depth, InputOutput, vi->visual, - CWBorderPixel | CWColormap, &swa); - XStoreName(dpy, win1, "Test [L]"); - XMapWindow(dpy, win1); - XMoveWindow(dpy, win1, 10, 10); /* Initial requested x,y may not be honored */ - { - XSizeHints sizehints; - static const char *name = "window"; - sizehints.x = 10; - sizehints.y = 10; - sizehints.width = 200; - sizehints.height = 200; - sizehints.flags = USSize | USPosition; - XSetNormalHints(dpy, win1, &sizehints); - XSetStandardProperties(dpy, win1, name, name, - None, (char **)NULL, 0, &sizehints); - } - - - win2 = XCreateWindow(dpy, RootWindow(dpy, vi->screen), - 250, 10, 200, 200, - 0, vi->depth, InputOutput, vi->visual, - CWBorderPixel | CWColormap, &swa); - XStoreName(dpy, win1, "Test [R]"); - XMapWindow(dpy, win2); - XMoveWindow(dpy, win2, 260, 10); - { - XSizeHints sizehints; - static const char *name = "window"; - sizehints.x = 10; - sizehints.y = 10; - sizehints.width = 200; - sizehints.height = 200; - sizehints.flags = USSize | USPosition; - XSetNormalHints(dpy, win2, &sizehints); - XSetStandardProperties(dpy, win2, name, name, - None, (char **)NULL, 0, &sizehints); - } - - - /* Now draw some spinning things */ - for (angle = 0; angle < 360*4; angle += 10.0) { - /* Connect the context to window 1 */ - glXMakeCurrent(dpy, win1, ctx1); - - /* Clear and draw in window 1 */ - glDrawBuffer(GL_BACK); - glClearColor(1, 1, 0, 1); - glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); - glColor3f(1, 0, 0); - glBegin(GL_TRIANGLES); - glVertex2f(0, 0); - glVertex2f(cos(angle * DEGTOR), sin(angle * DEGTOR)); - glVertex2f(cos((angle + 20.0) * DEGTOR), - sin((angle + 20.0) * DEGTOR)); - glEnd(); - glFlush(); - - if (test == 1 || test == 3 || test == 5) - glXSwapBuffers(dpy, win1); - - if (test == 5) - glXCopyContext(dpy, ctx1, ctx2, GL_ALL_ATTRIB_BITS); - /* Connect the context to window 2 */ - if (test == 3 || test == 4) { - glXMakeCurrent(dpy, win2, ctx1); - } else { - glXMakeCurrent(dpy, win2, ctx2); - } - - /* Clear and draw in window 2 */ - glDrawBuffer(GL_BACK); - glClearColor(0, 0, 1, 1); - glClear(GL_COLOR_BUFFER_BIT); - glColor3f(1, 1, 0); - glBegin(GL_TRIANGLES); - glVertex2f(0, 0); - glVertex2f(cos(angle * DEGTOR), sin(angle * DEGTOR)); - glVertex2f(cos((angle + 20.0) * DEGTOR), - sin((angle + 20.0) * DEGTOR)); - glEnd(); - glFlush(); - - /* Swap buffers */ - if (test == 2 || test == 4) - glXSwapBuffers(dpy, win1); - glXSwapBuffers(dpy, win2); - - /* wait a while */ - glXWaitX(); - usleep(20000); - } - - return 0; -} diff --git a/progs/tests/lineclip.c b/progs/tests/lineclip.c deleted file mode 100644 index 098f5e92eb..0000000000 --- a/progs/tests/lineclip.c +++ /dev/null @@ -1,175 +0,0 @@ -/* - * Copyright © 2008 Intel Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. - * - * Authors: - * Eric Anholt - * - */ - -#include -#include - -static int win_width, win_height; - -static void -line(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2) -{ - glBegin(GL_LINES); - glVertex2f(x1, y1); - glVertex2f(x2, y2); - glEnd(); -} - -static void -line3(GLfloat x1, GLfloat y1, GLfloat z1, GLfloat x2, GLfloat y2, GLfloat z2) -{ - glBegin(GL_LINES); - glVertex3f(x1, y1, z1); - glVertex3f(x2, y2, z2); - glEnd(); -} - -static void -display(void) -{ - glClearColor(0.0, 0.0, 0.0, 0.0); - glClear(GL_COLOR_BUFFER_BIT); - - glColor3f(1.0, 0.0, 0.0); - /* 2 lines clipped along xmin */ - line(-20, win_height / 2 - 20, - 20, win_height / 2 - 20); - line( 20, win_height / 2 + 20, - -20, win_height / 2 + 20); - - glColor3f(0.0, 1.0, 0.0); - /* 2 lines clipped along ymax */ - line(win_width / 2 - 20, win_height + 20, - win_width / 2 - 20, win_height - 20); - line(win_width / 2 + 20, win_height - 20, - win_width / 2 + 20, win_height + 20); - - glColor3f(0.0, 0.0, 1.0); - /* 2 lines clipped along xmax */ - line(win_width - 20, win_height / 2 - 20, - win_width + 20, win_height / 2 - 20); - line(win_width + 20, win_height / 2 + 20, - win_width - 20, win_height / 2 + 20); - - glColor3f(1.0, 1.0, 1.0); - /* 2 lines clipped along ymin */ - line(win_width / 2 - 20, 20, - win_width / 2 - 20, -20); - line(win_width / 2 + 20, -20, - win_width / 2 + 20, 20); - - /* 2 lines clipped along near */ - glColor3f(1.0, 0.0, 1.0); - line3(win_width / 2 - 20 - 20, win_height / 2, 0.5, - win_width / 2 - 20 + 20, win_height / 2, -0.5); - line3(win_width / 2 - 20, win_height / 2 - 20, -0.5, - win_width / 2 - 20, win_height / 2 + 20, 0.5); - - /* 2 lines clipped along far */ - glColor3f(0.0, 1.0, 1.0); - line3(win_width / 2 + 20 - 20, win_height / 2, 1.5, - win_width / 2 + 20 + 20, win_height / 2, 0.5); - line3(win_width / 2 + 20, win_height / 2 - 20, 0.5, - win_width / 2 + 20, win_height / 2 + 20, 1.5); - - /* entirely clipped along near/far */ - glColor3f(.5, .5, .5); - line3(win_width / 2, win_height / 2 - 20, -0.5, - win_width / 2, win_height / 2 + 20, -0.5); - glColor3f(.5, .5, .5); - line3(win_width / 2, win_height / 2 - 20, 1.5, - win_width / 2, win_height / 2 + 20, 1.5); - - glColor3f(1.0, 1.0, 0.0); - /* lines clipped along both x and y limits */ - line(-5, 20, - 20, -5); /* xmin, ymin */ - line(-5, win_height - 20, - 20, win_height + 5); /* xmin, ymax */ - line(win_width - 20, -5, - win_width + 5, 20); /* xmax, ymin */ - line(win_width - 20, win_height + 5, - win_width + 5, win_height - 20); /* xmax, ymax */ - - glutSwapBuffers(); -} - -static void -reshape(int width, int height) -{ - win_width = width; - win_height = height; - glViewport(0, 0, width, height); - - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glOrtho(0, win_width, 0, win_height, 0.0, -1.0); - - glMatrixMode(GL_MODELVIEW); - glLoadIdentity(); - glTranslatef(.25, .25, 0); -} - -static void key( unsigned char key, int x, int y ) -{ - (void) x; - (void) y; - - switch (key) { - case 27: /* esc */ - exit(0); - break; - } - - glutPostRedisplay(); -} - -static void -init(void) -{ -} - -int -main(int argc, char *argv[]) -{ - win_width = 200; - win_height = 200; - - glutInit(&argc, argv); - glutInitWindowPosition(0, 0); - glutInitWindowSize(win_width, win_height); - glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH); - glutCreateWindow(argv[0]); - glutReshapeFunc(reshape); - glutKeyboardFunc(key); - glutDisplayFunc(display); - - init(); - - glutMainLoop(); - return 0; -} diff --git a/progs/tests/manytex.c b/progs/tests/manytex.c deleted file mode 100644 index 74b06649f6..0000000000 --- a/progs/tests/manytex.c +++ /dev/null @@ -1,381 +0,0 @@ - -/* - * test handling of many texture maps - * Also tests texture priority and residency. - * - * Brian Paul - * August 2, 2000 - */ - - -#include -#include -#include -#include -#include -#include - - -static GLint NumTextures = 20; -static GLuint *TextureID = NULL; -static GLint *TextureWidth = NULL, *TextureHeight = NULL; -static GLboolean *TextureResidency = NULL; -static GLint TexWidth = 128, TexHeight = 128; -static GLfloat Zrot = 0; -static GLboolean Anim = GL_TRUE; -static GLint WinWidth = 500, WinHeight = 400; -static GLboolean MipMap = GL_FALSE; -static GLboolean LinearFilter = GL_FALSE; -static GLboolean RandomSize = GL_FALSE; -static GLint Rows, Columns; -static GLint LowPriorityCount = 0; - - -static void Idle( void ) -{ - Zrot += 1.0; - glutPostRedisplay(); -} - - -static void Display( void ) -{ - GLfloat spacing = WinWidth / Columns; - GLfloat size = spacing * 0.4; - GLint i; - - /* test residency */ - if (0) - { - GLboolean b; - GLint i, resident; - b = glAreTexturesResident(NumTextures, TextureID, TextureResidency); - if (b) { - printf("all resident\n"); - } - else { - resident = 0; - for (i = 0; i < NumTextures; i++) { - if (TextureResidency[i]) { - resident++; - } - } - printf("%d of %d texture resident\n", resident, NumTextures); - } - } - - /* render the textured quads */ - glClear( GL_COLOR_BUFFER_BIT ); - for (i = 0; i < NumTextures; i++) { - GLint row = i / Columns; - GLint col = i % Columns; - GLfloat x = col * spacing + spacing * 0.5; - GLfloat y = row * spacing + spacing * 0.5; - - GLfloat maxDim = (TextureWidth[i] > TextureHeight[i]) - ? TextureWidth[i] : TextureHeight[i]; - GLfloat w = TextureWidth[i] / maxDim; - GLfloat h = TextureHeight[i] / maxDim; - - glPushMatrix(); - glTranslatef(x, y, 0.0); - glRotatef(Zrot, 0, 0, 1); - glScalef(size, size, 1); - - glBindTexture(GL_TEXTURE_2D, TextureID[i]); - glBegin(GL_POLYGON); -#if 0 - glTexCoord2f(0, 0); glVertex2f(-1, -1); - glTexCoord2f(1, 0); glVertex2f( 1, -1); - glTexCoord2f(1, 1); glVertex2f( 1, 1); - glTexCoord2f(0, 1); glVertex2f(-1, 1); -#else - glTexCoord2f(0, 0); glVertex2f(-w, -h); - glTexCoord2f(1, 0); glVertex2f( w, -h); - glTexCoord2f(1, 1); glVertex2f( w, h); - glTexCoord2f(0, 1); glVertex2f(-w, h); -#endif - glEnd(); - glPopMatrix(); - } - - glutSwapBuffers(); -} - - -static void Reshape( int width, int height ) -{ - WinWidth = width; - WinHeight = height; - glViewport( 0, 0, width, height ); - glMatrixMode( GL_PROJECTION ); - glLoadIdentity(); - glOrtho(0, width, 0, height, -1, 1); - glMatrixMode( GL_MODELVIEW ); - glLoadIdentity(); -} - - -/* - * Return a random int in [min, max]. - */ -static int RandomInt(int min, int max) -{ - int i = rand(); - int j = i % (max - min + 1); - return min + j; -} - - - -static void Init( void ) -{ - GLint i; - - if (RandomSize) { - printf("Creating %d %s random-size textures, ", NumTextures, - MipMap ? "Mipmapped" : "non-Mipmapped"); - } - else { - printf("Creating %d %s %d x %d textures, ", NumTextures, - MipMap ? "Mipmapped" : "non-Mipmapped", - TexWidth, TexHeight); - } - - if (LinearFilter) { - printf("bilinear filtering\n"); - } - else { - printf("nearest filtering\n"); - } - - - /* compute number of rows and columns of rects */ - { - GLfloat area = (GLfloat) (WinWidth * WinHeight) / (GLfloat) NumTextures; - GLfloat edgeLen = sqrt(area); - - Columns = WinWidth / edgeLen; - Rows = (NumTextures + Columns - 1) / Columns; - printf("Rows: %d Cols: %d\n", Rows, Columns); - } - - - if (!TextureID) { - TextureID = (GLuint *) malloc(sizeof(GLuint) * NumTextures); - assert(TextureID); - glGenTextures(NumTextures, TextureID); - } - - if (!TextureResidency) { - TextureResidency = (GLboolean *) malloc(sizeof(GLboolean) * NumTextures); - assert(TextureResidency); - } - - if (!TextureWidth) { - TextureWidth = (GLint *) malloc(sizeof(GLint) * NumTextures); - assert(TextureWidth); - } - if (!TextureHeight) { - TextureHeight = (GLint *) malloc(sizeof(GLint) * NumTextures); - assert(TextureHeight); - } - - for (i = 0; i < NumTextures; i++) { - GLubyte color[4]; - GLubyte *texImage; - GLint j, row, col; - - row = i / Columns; - col = i % Columns; - - glBindTexture(GL_TEXTURE_2D, TextureID[i]); - - if (i < LowPriorityCount) - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_PRIORITY, 0.5F); - - if (RandomSize) { -#if 0 - int k = (glutGet(GLUT_ELAPSED_TIME) % 7) + 2; - TexWidth = 1 << k; - TexHeight = 1 << k; -#else - TexWidth = 1 << RandomInt(2, 7); - TexHeight = 1 << RandomInt(2, 7); - printf("Random size of %3d: %d x %d\n", i, TexWidth, TexHeight); -#endif - } - - TextureWidth[i] = TexWidth; - TextureHeight[i] = TexHeight; - - texImage = (GLubyte*) malloc(4 * TexWidth * TexHeight * sizeof(GLubyte)); - assert(texImage); - - /* determine texture color */ - color[0] = (GLint) (255.0 * ((float) col / (Columns - 1))); - color[1] = 127; - color[2] = (GLint) (255.0 * ((float) row / (Rows - 1))); - color[3] = 255; - - /* fill in solid-colored teximage */ - for (j = 0; j < TexWidth * TexHeight; j++) { - texImage[j*4+0] = color[0]; - texImage[j*4+1] = color[1]; - texImage[j*4+2] = color[2]; - texImage[j*4+3] = color[3]; - } - - if (MipMap) { - GLint level = 0; - GLint w = TexWidth, h = TexHeight; - while (1) { - glTexImage2D(GL_TEXTURE_2D, level, GL_RGBA, w, h, 0, - GL_RGBA, GL_UNSIGNED_BYTE, texImage); - if (w == 1 && h == 1) - break; - if (w > 1) - w /= 2; - if (h > 1) - h /= 2; - level++; - /*printf("%d: %d x %d\n", level, w, h);*/ - } - if (LinearFilter) { - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, - GL_LINEAR_MIPMAP_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - } - else { - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, - GL_NEAREST_MIPMAP_NEAREST); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - } - } - else { - /* Set corners to white */ - int k = 0; - texImage[k+0] = texImage[k+1] = texImage[k+2] = texImage[k+3] = 255; - k = (TexWidth - 1) * 4; - texImage[k+0] = texImage[k+1] = texImage[k+2] = texImage[k+3] = 255; - k = (TexWidth * TexHeight - TexWidth) * 4; - texImage[k+0] = texImage[k+1] = texImage[k+2] = texImage[k+3] = 255; - k = (TexWidth * TexHeight - 1) * 4; - texImage[k+0] = texImage[k+1] = texImage[k+2] = texImage[k+3] = 255; - - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, TexWidth, TexHeight, 0, - GL_RGBA, GL_UNSIGNED_BYTE, texImage); - if (LinearFilter) { - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - } - else { - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - } - } - - free(texImage); - } - - glEnable(GL_TEXTURE_2D); -} - - -static void Key( unsigned char key, int x, int y ) -{ - const GLfloat step = 3.0; - (void) x; - (void) y; - switch (key) { - case 'a': - Anim = !Anim; - if (Anim) - glutIdleFunc(Idle); - else - glutIdleFunc(NULL); - break; - case 's': - Idle(); - break; - case 'z': - Zrot -= step; - break; - case 'Z': - Zrot += step; - break; - case ' ': - Init(); - break; - case 27: - exit(0); - break; - } - glutPostRedisplay(); -} - - -int main( int argc, char *argv[] ) -{ - GLint i; - - glutInit( &argc, argv ); - glutInitWindowPosition( 0, 0 ); - glutInitWindowSize( WinWidth, WinHeight ); - glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE ); - glutCreateWindow(argv[0]); - glutReshapeFunc( Reshape ); - glutKeyboardFunc( Key ); - glutDisplayFunc( Display ); - if (Anim) - glutIdleFunc(Idle); - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-n") == 0) { - NumTextures = atoi(argv[i+1]); - if (NumTextures <= 0) { - printf("Error, bad number of textures\n"); - return 1; - } - i++; - } - else if (strcmp(argv[i], "-mipmap") == 0) { - MipMap = GL_TRUE; - } - else if (strcmp(argv[i], "-linear") == 0) { - LinearFilter = GL_TRUE; - } - else if (strcmp(argv[i], "-size") == 0) { - TexWidth = atoi(argv[i+1]); - TexHeight = atoi(argv[i+2]); - assert(TexWidth >= 1); - assert(TexHeight >= 1); - i += 2; - } - else if (strcmp(argv[i], "-randomsize") == 0) { - RandomSize = GL_TRUE; - } - else if (strcmp(argv[i], "-lowpri") == 0) { - LowPriorityCount = atoi(argv[i+1]); - i++; - } - else { - printf("Usage:\n"); - printf(" manytex [options]\n"); - printf("Options:\n"); - printf(" -n \n"); - printf(" -size - specify texture size\n"); - printf(" -randomsize - use random size textures\n"); - printf(" -mipmap - generate mipmaps\n"); - printf(" -linear - use linear filtering instead of nearest\n"); - printf(" -lowpri - Set lower priority on textures\n"); - return 0; - } - } - - Init(); - - glutMainLoop(); - - return 0; -} diff --git a/progs/tests/minmag.c b/progs/tests/minmag.c deleted file mode 100644 index 78ef9db03a..0000000000 --- a/progs/tests/minmag.c +++ /dev/null @@ -1,198 +0,0 @@ -/* - * Test minification vs. magnification filtering. - * Draw two quads with different filtering modes: - * - * +--------------------------+ +--------------------------+ - * | MagFilter = GL_LINEAR | | MagFilter = GL_LINEAR | - * | MinFilter = GL_LINEAR | | MinFilter = GL_NEAREST | - * +--------------------------+ +--------------------------+ - * - * They should look different when the quad is smaller than the level 0 - * texture size (when minifying). - */ - -#include -#include -#include -#include -#include -#include -#include - - -static GLint Width = 1000, Height = 500; - - -static GLint TexWidth = 256, TexHeight = 256; -static GLfloat Zpos = 5; -static GLboolean MipMap = 0*GL_TRUE; -static GLboolean LinearFilter = GL_TRUE; - - -static void -redraw(void) -{ - GLfloat w = 1.0; - GLfloat h = 1.0; - - glClear( GL_COLOR_BUFFER_BIT ); - - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - - glPushMatrix(); - glTranslatef(-1.5, 0, -Zpos); - glBegin(GL_POLYGON); - glTexCoord2f(0, 0); glVertex2f(-w, -h); - glTexCoord2f(1, 0); glVertex2f( w, -h); - glTexCoord2f(1, 1); glVertex2f( w, h); - glTexCoord2f(0, 1); glVertex2f(-w, h); - glEnd(); - glPopMatrix(); - - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - - glPushMatrix(); - glTranslatef(1.5, 0, -Zpos); - glBegin(GL_POLYGON); - glTexCoord2f(0, 0); glVertex2f(-w, -h); - glTexCoord2f(1, 0); glVertex2f( w, -h); - glTexCoord2f(1, 1); glVertex2f( w, h); - glTexCoord2f(0, 1); glVertex2f(-w, h); - glEnd(); - glPopMatrix(); - - glutSwapBuffers(); -} - - -static void -init(void) -{ - GLubyte color[10][4] = { - { 0, 0, 0, 0 }, - { 1, 0, 0, 0 }, - { 0, 1, 0, 0 }, - { 0, 0, 1, 0 }, - { 0, 1, 1, 0 }, - { 1, 0, 1, 0 }, - { 1, 1, 0, 0 }, - { 1, 0, 0, 0 }, - { 0, 1, 0, 0 }, - { 0, 0, 1, 0 } - }; - GLubyte *texImage; - - printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - printf("Left quad should be linear filtered and right should be nearest filtered.\n"); - printf("Press z/Z to change quad distance.\n"); - - texImage = (GLubyte*) malloc(4 * TexWidth * TexHeight * sizeof(GLubyte)); - assert(texImage); - - { - GLint level = 0; - GLint w = TexWidth, h = TexHeight; - while (1) { - int i, j; - - for (i = 0; i < h; i++) { - for (j = 0;j < w; j++) { - if (w==1 || h==1 || (((i / 2) ^ (j / 2)) & 1)) { - /*if (j < i) {*/ - texImage[(i*w+j) * 4 + 0] = 255; - texImage[(i*w+j) * 4 + 1] = 255; - texImage[(i*w+j) * 4 + 2] = 255; - texImage[(i*w+j) * 4 + 3] = 255; - } - else { - texImage[(i*w+j) * 4 + 0] = color[level][0] * 255; - texImage[(i*w+j) * 4 + 1] = color[level][1] * 255; - texImage[(i*w+j) * 4 + 2] = color[level][2] * 255; - texImage[(i*w+j) * 4 + 3] = color[level][3] * 255; - } - } - } - - glTexImage2D(GL_TEXTURE_2D, level, GL_RGBA8, w, h, 0, - GL_RGBA, GL_UNSIGNED_BYTE, texImage); - - printf("Texture level %d: %d x %d\n", level, w, h); - if (!MipMap) - break; - - if (w == 1 && h == 1) - break; - if (w > 1) - w /= 2; - if (h > 1) - h /= 2; - level++; - } - } - - free(texImage); - - glClearColor(0.25, 0.25, 0.25, 1.0); - glEnable(GL_TEXTURE_2D); - - glViewport(0, 0, Width, Height); -} - - - -static void -Reshape(int width, int height) -{ - float ar = (float) width /height; - Width = width; - Height = height; - glViewport(0, 0, width, height); - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glFrustum(-ar, ar, -1.0, 1.0, 5.0, 2500.0); - glMatrixMode(GL_MODELVIEW); - glLoadIdentity(); - glTranslatef(0.0, 0.0, -15.0); -} - - -static void -Key(unsigned char key, int x, int y) -{ - (void) x; - (void) y; - switch (key) { - case 'z': - Zpos--; - break; - case 'Z': - Zpos++; - break; - case 'f': - LinearFilter = !LinearFilter; - break; - case 27: - exit(0); - break; - } - glutPostRedisplay(); -} - - -int -main(int argc, char *argv[]) -{ - glutInit(&argc, argv); - glutInitWindowPosition(0, 0); - glutInitWindowSize(Width, Height); - glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH); - glutCreateWindow(argv[0]); - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(redraw); - init(); - glutMainLoop(); - return 0; -} diff --git a/progs/tests/mipmap_limits.c b/progs/tests/mipmap_limits.c deleted file mode 100644 index 8bdad826f7..0000000000 --- a/progs/tests/mipmap_limits.c +++ /dev/null @@ -1,270 +0,0 @@ -/* Test GL_TEXTURE_BASE_LEVEL and GL_TEXTURE_MAX_LEVEL - * Brian Paul - * 10 May 2006 - */ - - -/* Copyright (c) Mark J. Kilgard, 1994. */ - -/* - * (c) Copyright 1993, Silicon Graphics, Inc. - * ALL RIGHTS RESERVED - * Permission to use, copy, modify, and distribute this software for - * any purpose and without fee is hereby granted, provided that the above - * copyright notice appear in all copies and that both the copyright notice - * and this permission notice appear in supporting documentation, and that - * the name of Silicon Graphics, Inc. not be used in advertising - * or publicity pertaining to distribution of the software without specific, - * written prior permission. - * - * THE MATERIAL EMBODIED ON THIS SOFTWARE IS PROVIDED TO YOU "AS-IS" - * AND WITHOUT WARRANTY OF ANY KIND, EXPRESS, IMPLIED OR OTHERWISE, - * INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY OR - * FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON - * GRAPHICS, INC. BE LIABLE TO YOU OR ANYONE ELSE FOR ANY DIRECT, - * SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY - * KIND, OR ANY DAMAGES WHATSOEVER, INCLUDING WITHOUT LIMITATION, - * LOSS OF PROFIT, LOSS OF USE, SAVINGS OR REVENUE, OR THE CLAIMS OF - * THIRD PARTIES, WHETHER OR NOT SILICON GRAPHICS, INC. HAS BEEN - * ADVISED OF THE POSSIBILITY OF SUCH LOSS, HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE - * POSSESSION, USE OR PERFORMANCE OF THIS SOFTWARE. - * - * US Government Users Restricted Rights - * Use, duplication, or disclosure by the Government is subject to - * restrictions set forth in FAR 52.227.19(c)(2) or subparagraph - * (c)(1)(ii) of the Rights in Technical Data and Computer Software - * clause at DFARS 252.227-7013 and/or in similar or successor - * clauses in the FAR or the DOD or NASA FAR Supplement. - * Unpublished-- rights reserved under the copyright laws of the - * United States. Contractor/manufacturer is Silicon Graphics, - * Inc., 2011 N. Shoreline Blvd., Mountain View, CA 94039-7311. - * - * OpenGL(TM) is a trademark of Silicon Graphics, Inc. - */ -/* mipmap.c - * This program demonstrates using mipmaps for texture maps. - * To overtly show the effect of mipmaps, each mipmap reduction - * level has a solidly colored, contrasting texture image. - * Thus, the quadrilateral which is drawn is drawn with several - * different colors. - */ -#include -#include -#include - -static GLint BaseLevel = 0, MaxLevel = 8; -static GLfloat MinLod = -1, MaxLod = 9; -static GLfloat LodBias = 0.0; -static GLboolean NearestFilter = GL_TRUE; - - -static void -InitValues(void) -{ - BaseLevel = 0; - MaxLevel = 8; - MinLod = -1; - MaxLod = 9; - LodBias = 0.0; - NearestFilter = GL_TRUE; -} - - -static void MakeImage(int level, int width, int height, const GLubyte color[4]) -{ - const int makeStripes = 0; - GLubyte img[256*256*3]; - int i, j; - for (i = 0; i < height; i++) { - for (j = 0; j < width; j++) { - int k = (i * width + j) * 3; - int p = (i/8) & makeStripes; - if (p == 0) { - img[k + 0] = color[0]; - img[k + 1] = color[1]; - img[k + 2] = color[2]; - } - else { - img[k + 0] = 0; - img[k + 1] = 0; - img[k + 2] = 0; - } - } - } - - glTexImage2D(GL_TEXTURE_2D, level, GL_RGB, width, height, 0, - GL_RGB, GL_UNSIGNED_BYTE, img); -} - - -static void makeImages(void) -{ - static const GLubyte colors[8][3] = { - {128, 128, 128 }, - { 0, 255, 255 }, - { 255, 255, 0 }, - { 255, 0, 255 }, - { 255, 0, 0 }, - { 0, 255, 0 }, - { 0, 0, 255 }, - { 255, 255, 255 } - }; - int i, sz = 128; - - for (i = 0; i < 8; i++) { - MakeImage(i, sz, sz, colors[i]); - sz /= 2; - } -} - -static void myinit(void) -{ - InitValues(); - - glEnable(GL_DEPTH_TEST); - glDepthFunc(GL_LESS); - glShadeModel(GL_FLAT); - - glTranslatef(0.0, 0.0, -3.6); - - glPixelStorei(GL_UNPACK_ALIGNMENT, 1); - makeImages(); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); - glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL); - glEnable(GL_TEXTURE_2D); -} - -static void display(void) -{ - GLfloat tcm = 4.0; - printf("BASE_LEVEL=%d MAX_LEVEL=%d MIN_LOD=%.2g MAX_LOD=%.2g Bias=%.2g Filter=%s\n", - BaseLevel, MaxLevel, MinLod, MaxLod, LodBias, - NearestFilter ? "NEAREST" : "LINEAR"); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, BaseLevel); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, MaxLevel); - - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_LOD, MinLod); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_LOD, MaxLod); - - if (NearestFilter) { - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, - GL_NEAREST_MIPMAP_NEAREST); - } - else { - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, - GL_LINEAR_MIPMAP_LINEAR); - } - - glTexEnvf(GL_TEXTURE_FILTER_CONTROL_EXT, GL_TEXTURE_LOD_BIAS_EXT, LodBias); - - glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); - glBegin(GL_QUADS); - glTexCoord2f(0.0, 0.0); glVertex3f(-2.0, -1.0, 0.0); - glTexCoord2f(0.0, tcm); glVertex3f(-2.0, 1.0, 0.0); - glTexCoord2f(tcm, tcm); glVertex3f(3000.0, 1.0, -6000.0); - glTexCoord2f(tcm, 0.0); glVertex3f(3000.0, -1.0, -6000.0); - glEnd(); - glFlush(); -} - -static void myReshape(int w, int h) -{ - glViewport(0, 0, w, h); - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - gluPerspective(60.0, 1.0*(GLfloat)w/(GLfloat)h, 1.0, 30000.0); - glMatrixMode(GL_MODELVIEW); - glLoadIdentity(); -} - -static void -key(unsigned char k, int x, int y) -{ - (void) x; - (void) y; - switch (k) { - case 'b': - BaseLevel--; - if (BaseLevel < 0) - BaseLevel = 0; - break; - case 'B': - BaseLevel++; - if (BaseLevel > 10) - BaseLevel = 10; - break; - case 'm': - MaxLevel--; - if (MaxLevel < 0) - MaxLevel = 0; - break; - case 'M': - MaxLevel++; - if (MaxLevel > 10) - MaxLevel = 10; - break; - case 'l': - LodBias -= 0.25; - break; - case 'L': - LodBias += 0.25; - break; - case 'n': - MinLod -= 0.25; - break; - case 'N': - MinLod += 0.25; - break; - case 'x': - MaxLod -= 0.25; - break; - case 'X': - MaxLod += 0.25; - break; - case 'f': - NearestFilter = !NearestFilter; - break; - case ' ': - InitValues(); - break; - case 27: /* Escape */ - exit(0); - break; - default: - return; - } - glutPostRedisplay(); -} - - -static void usage(void) -{ - printf("usage:\n"); - printf(" b/B decrease/increase GL_TEXTURE_BASE_LEVEL\n"); - printf(" m/M decrease/increase GL_TEXTURE_MAX_LEVEL\n"); - printf(" n/N decrease/increase GL_TEXTURE_MIN_LOD\n"); - printf(" x/X decrease/increase GL_TEXTURE_MAX_LOD\n"); - printf(" l/L decrease/increase GL_TEXTURE_LOD_BIAS\n"); - printf(" f toggle nearest/linear filtering\n"); - printf(" SPACE reset values\n"); -} - - -int main(int argc, char** argv) -{ - glutInit(&argc, argv); - glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB | GLUT_DEPTH); - glutInitWindowSize (600, 600); - glutCreateWindow (argv[0]); - myinit(); - glutReshapeFunc (myReshape); - glutDisplayFunc(display); - glutKeyboardFunc(key); - usage(); - glutMainLoop(); - return 0; /* ANSI C requires main to return int. */ -} diff --git a/progs/tests/multipal.c b/progs/tests/multipal.c deleted file mode 100644 index 7bd4473565..0000000000 --- a/progs/tests/multipal.c +++ /dev/null @@ -1,372 +0,0 @@ - -/* - * Test multitexture and paletted textures. - */ - -#include -#include -#include -#include -#include -#include /* for ptrdiff_t, referenced by GL.h when GL_GLEXT_LEGACY defined */ -#ifdef _WIN32 -#include -#endif -#define GL_GLEXT_LEGACY -#include - -#include "../util/readtex.c" /* I know, this is a hack. */ - -#define TEXTURE_1_FILE "../images/tile.rgb" -#define TEXTURE_2_FILE "../images/reflect.rgb" - -#define TEX0 1 -#define TEX1 2 -#define TEXBOTH 3 -#define ANIMATE 10 -#define QUIT 100 - -static GLboolean Animate = GL_TRUE; - -static GLfloat Drift = 0.0; -static GLfloat Xrot = 20.0, Yrot = 30.0, Zrot = 0.0; - - - -static void Idle( void ) -{ - if (Animate) { - Drift += 0.05; - if (Drift >= 1.0) - Drift = 0.0; - -#ifdef GL_ARB_multitexture - glActiveTextureARB(GL_TEXTURE0_ARB); -#endif - glMatrixMode(GL_TEXTURE); - glLoadIdentity(); - glTranslatef(Drift, 0.0, 0.0); - glMatrixMode(GL_MODELVIEW); - -#ifdef GL_ARB_multitexture - glActiveTextureARB(GL_TEXTURE1_ARB); -#endif - glMatrixMode(GL_TEXTURE); - glLoadIdentity(); - glTranslatef(0.0, Drift, 0.0); - glMatrixMode(GL_MODELVIEW); - - glutPostRedisplay(); - } -} - - -static void DrawObject(void) -{ - glBegin(GL_QUADS); - -#ifdef GL_ARB_multitexture - glMultiTexCoord2fARB(GL_TEXTURE0_ARB, 0.0, 0.0); - glMultiTexCoord2fARB(GL_TEXTURE1_ARB, 0.0, 0.0); - glVertex2f(-1.0, -1.0); - - glMultiTexCoord2fARB(GL_TEXTURE0_ARB, 2.0, 0.0); - glMultiTexCoord2fARB(GL_TEXTURE1_ARB, 1.0, 0.0); - glVertex2f(1.0, -1.0); - - glMultiTexCoord2fARB(GL_TEXTURE0_ARB, 2.0, 2.0); - glMultiTexCoord2fARB(GL_TEXTURE1_ARB, 1.0, 1.0); - glVertex2f(1.0, 1.0); - - glMultiTexCoord2fARB(GL_TEXTURE0_ARB, 0.0, 2.0); - glMultiTexCoord2fARB(GL_TEXTURE1_ARB, 0.0, 1.0); - glVertex2f(-1.0, 1.0); -#else - glTexCoord2f(0.0, 0.0); - glVertex2f(-1.0, -1.0); - - glTexCoord2f(1.0, 0.0); - glVertex2f(1.0, -1.0); - - glTexCoord2f(1.0, 1.0); - glVertex2f(1.0, 1.0); - - glTexCoord2f(0.0, 1.0); - glVertex2f(-1.0, 1.0); -#endif - - glEnd(); -} - - - -static void Display( void ) -{ - glClear( GL_COLOR_BUFFER_BIT ); - - glPushMatrix(); - glRotatef(Xrot, 1.0, 0.0, 0.0); - glRotatef(Yrot, 0.0, 1.0, 0.0); - glRotatef(Zrot, 0.0, 0.0, 1.0); - glScalef(5.0, 5.0, 5.0); - DrawObject(); - glPopMatrix(); - - glutSwapBuffers(); -} - - -static void Reshape( int width, int height ) -{ - glViewport( 0, 0, width, height ); - glMatrixMode( GL_PROJECTION ); - glLoadIdentity(); - glFrustum( -1.0, 1.0, -1.0, 1.0, 10.0, 100.0 ); - /*glOrtho( -6.0, 6.0, -6.0, 6.0, 10.0, 100.0 );*/ - glMatrixMode( GL_MODELVIEW ); - glLoadIdentity(); - glTranslatef( 0.0, 0.0, -70.0 ); -} - - -static void ModeMenu(int entry) -{ - GLboolean enable0 = GL_FALSE, enable1 = GL_FALSE; - if (entry==TEX0) { - enable0 = GL_TRUE; - } - else if (entry==TEX1) { - enable1 = GL_TRUE; - } - else if (entry==TEXBOTH) { - enable0 = GL_TRUE; - enable1 = GL_TRUE; - } - else if (entry==ANIMATE) { - Animate = !Animate; - } - else if (entry==QUIT) { - exit(0); - } - - if (entry != ANIMATE) { -#ifdef GL_ARB_multitexture - glActiveTextureARB(GL_TEXTURE0_ARB); -#endif - if (enable0) { - glEnable(GL_TEXTURE_2D); - } - else - glDisable(GL_TEXTURE_2D); - -#ifdef GL_ARB_multitexture - glActiveTextureARB(GL_TEXTURE1_ARB); -#endif - if (enable1) { - glEnable(GL_TEXTURE_2D); - } - else - glDisable(GL_TEXTURE_2D); - } - - glutPostRedisplay(); -} - - -static void Key( unsigned char key, int x, int y ) -{ - (void) x; - (void) y; - switch (key) { - case 27: - exit(0); - break; - } - glutPostRedisplay(); -} - - -static void SpecialKey( int key, int x, int y ) -{ - float step = 3.0; - (void) x; - (void) y; - - switch (key) { - case GLUT_KEY_UP: - Xrot += step; - break; - case GLUT_KEY_DOWN: - Xrot -= step; - break; - case GLUT_KEY_LEFT: - Yrot += step; - break; - case GLUT_KEY_RIGHT: - Yrot -= step; - break; - } - glutPostRedisplay(); -} - - -static void load_tex(const char *fname, int channel) -{ - GLubyte *image; - GLenum format; - GLint w, h; - GLubyte *grayImage; - int i; - GLubyte table[256][4]; - - image = LoadRGBImage(fname, &w, &h, &format); - if (!image) - exit(1); - - printf("%s %d x %d\n", fname, w, h); - grayImage = malloc(w * h * 1); - assert(grayImage); - for (i = 0; i < w * h; i++) { - int g = (image[i*3+0] + image[i*3+1] + image[i*3+2]) / 3; - assert(g < 256); - grayImage[i] = g; - } - - glTexImage2D(GL_TEXTURE_2D, 0, GL_COLOR_INDEX, w, h, 0, GL_COLOR_INDEX, - GL_UNSIGNED_BYTE, grayImage); - - for (i = 0; i < 256; i++) { - table[i][0] = channel ? i : 0; - table[i][1] = i; - table[i][2] = channel ? 0 : i; - table[i][3] = 255; - } - - glColorTableEXT(GL_TEXTURE_2D, /* target */ - GL_RGBA, /* internal format */ - 256, /* table size */ - GL_RGBA, /* table format */ - GL_UNSIGNED_BYTE, /* table type */ - table); /* the color table */ - - free(grayImage); - free(image); -} - - - -static void Init( int argc, char *argv[] ) -{ - GLuint texObj[2]; - GLint units; - - if (!glutExtensionSupported("GL_ARB_multitexture")) { - printf("Sorry, GL_ARB_multitexture not supported by this renderer.\n"); - exit(1); - } - if (!glutExtensionSupported("GL_EXT_paletted_texture")) { - printf("Sorry, GL_EXT_paletted_texture not supported by this renderer.\n"); - exit(1); - } - - glGetIntegerv(GL_MAX_TEXTURE_UNITS_ARB, &units); - printf("%d texture units supported\n", units); - - /* allocate two texture objects */ - glGenTextures(2, texObj); - - /* setup texture obj 0 */ - glBindTexture(GL_TEXTURE_2D, texObj[0]); -#ifdef LINEAR_FILTER - /* linear filtering looks much nicer but is much slower for Mesa */ - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); -foo -#else - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); -#endif - - glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); - - glPixelStorei(GL_UNPACK_ALIGNMENT, 1); - - load_tex(TEXTURE_1_FILE, 0); -#if 0 - if (!LoadRGBMipmaps(TEXTURE_1_FILE, GL_RGB)) { - printf("Error: couldn't load texture image\n"); - exit(1); - } -#endif - - /* setup texture obj 1 */ - glBindTexture(GL_TEXTURE_2D, texObj[1]); -#ifdef LINEAR_FILTER - /* linear filtering looks much nicer but is much slower for Mesa */ - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); -foo -#else - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); -#endif - - glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); - - load_tex(TEXTURE_2_FILE, 1); -#if 0 - if (!LoadRGBMipmaps(TEXTURE_2_FILE, GL_RGB)) { - printf("Error: couldn't load texture image\n"); - exit(1); - } -#endif - - /* now bind the texture objects to the respective texture units */ -#ifdef GL_ARB_multitexture - glActiveTextureARB(GL_TEXTURE0_ARB); - glBindTexture(GL_TEXTURE_2D, texObj[0]); - glActiveTextureARB(GL_TEXTURE1_ARB); - glBindTexture(GL_TEXTURE_2D, texObj[1]); -#endif - - glShadeModel(GL_FLAT); - glClearColor(0.3, 0.3, 0.4, 1.0); - - ModeMenu(TEXBOTH); - - if (argc > 1 && strcmp(argv[1], "-info")==0) { - printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - printf("GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - printf("GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - printf("GL_EXTENSIONS = %s\n", (char *) glGetString(GL_EXTENSIONS)); - } -} - - -int main( int argc, char *argv[] ) -{ - glutInit( &argc, argv ); - glutInitWindowSize( 300, 300 ); - glutInitWindowPosition( 0, 0 ); - glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE ); - glutCreateWindow(argv[0] ); - - Init( argc, argv ); - - glutReshapeFunc( Reshape ); - glutKeyboardFunc( Key ); - glutSpecialFunc( SpecialKey ); - glutDisplayFunc( Display ); - glutIdleFunc( Idle ); - - glutCreateMenu(ModeMenu); - glutAddMenuEntry("Texture 0", TEX0); - glutAddMenuEntry("Texture 1", TEX1); - glutAddMenuEntry("Multi-texture", TEXBOTH); - glutAddMenuEntry("Toggle Animation", ANIMATE); - glutAddMenuEntry("Quit", QUIT); - glutAttachMenu(GLUT_RIGHT_BUTTON); - - glutMainLoop(); - return 0; -} diff --git a/progs/tests/multitexarray.c b/progs/tests/multitexarray.c deleted file mode 100644 index b4fab004a6..0000000000 --- a/progs/tests/multitexarray.c +++ /dev/null @@ -1,238 +0,0 @@ -/* - * Test vertex arrays and multitexture. - * Press 'a' to toggle vertex arrays on/off. - * When you run this program you should see a square with four colors: - * - * +------+------+ - * |yellow| pink | - * +------+------+ - * |green | blue | - * +------+------+ - */ - - -#include -#include -#include -#include -#include -#include "GL/glut.h" - -static GLuint Window = 0; - -static GLuint TexObj[2]; -static GLfloat Angle = 0.0f; -static GLboolean UseArrays = 1, Anim = 0; - -static GLfloat VertArray[4][2] = { - {-1.2, -1.2}, {1.2, -1.2}, {1.2, 1.2}, {-1.2, 1.2} -}; - -static GLfloat Tex0Array[4][2] = { - {0, 0}, {1, 0}, {1, 1}, {0, 1} -}; - -static GLfloat Tex1Array[4][2] = { - {0, 0}, {1, 0}, {1, 1}, {0, 1} -}; - - -static void init_arrays(void) -{ - glVertexPointer(2, GL_FLOAT, 0, VertArray); - glEnableClientState(GL_VERTEX_ARRAY); - - glClientActiveTextureARB(GL_TEXTURE0_ARB); - glTexCoordPointer(2, GL_FLOAT, 0, Tex0Array); - glEnableClientState(GL_TEXTURE_COORD_ARRAY); - - glClientActiveTextureARB(GL_TEXTURE1_ARB); - glTexCoordPointer(2, GL_FLOAT, 0, Tex1Array); - glEnableClientState(GL_TEXTURE_COORD_ARRAY); -} - - -static void draw( void ) -{ - glClear( GL_COLOR_BUFFER_BIT ); - - glColor3f( 0.0, 0.0, 0.0 ); - - /* draw first polygon */ - glPushMatrix(); - glRotatef( Angle, 0.0, 0.0, 1.0 ); - - if (UseArrays) { - glDrawArrays(GL_POLYGON, 0, 4); - } - else { - glBegin( GL_POLYGON ); - glTexCoord2f( 0.0, 0.0 ); - glMultiTexCoord2fARB(GL_TEXTURE1_ARB, 0.0, 0.0); - glVertex2f( -1.0, -1.0 ); - - glTexCoord2f( 1.0, 0.0 ); - glMultiTexCoord2fARB(GL_TEXTURE1_ARB, 1.0, 0.0); - glVertex2f( 1.0, -1.0 ); - - glTexCoord2f( 1.0, 1.0 ); - glMultiTexCoord2fARB(GL_TEXTURE1_ARB, 1.0, 1.0); - glVertex2f( 1.0, 1.0 ); - - glTexCoord2f( 0.0, 1.0 ); - glMultiTexCoord2fARB(GL_TEXTURE1_ARB, 0.0, 1.0); - glVertex2f( -1.0, 1.0 ); - glEnd(); - } - - glPopMatrix(); - - glutSwapBuffers(); -} - - - -static void idle( void ) -{ - Angle += 2.0; - glutPostRedisplay(); -} - - - -/* change view Angle, exit upon ESC */ -static void key(unsigned char k, int x, int y) -{ - (void) x; - (void) y; - switch (k) { - case 'a': - UseArrays = !UseArrays; - printf("UseArrays: %d\n", UseArrays); - break; - case ' ': - Anim = !Anim; - if (Anim) - glutIdleFunc(idle); - else - glutIdleFunc(NULL); - break; - case 27: - glDeleteTextures( 2, TexObj ); - glutDestroyWindow(Window); - exit(0); - } - glutPostRedisplay(); -} - - - -/* new window size or exposure */ -static void reshape( int width, int height ) -{ - glViewport(0, 0, (GLint)width, (GLint)height); - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - /* glOrtho( -3.0, 3.0, -3.0, 3.0, -10.0, 10.0 );*/ - glFrustum( -2.0, 2.0, -2.0, 2.0, 6.0, 20.0 ); - glMatrixMode(GL_MODELVIEW); - glLoadIdentity(); - glTranslatef( 0.0, 0.0, -8.0 ); -} - - -static void init( void ) -{ - static int width=8, height=8; - GLubyte tex[64][3]; - GLint i, j; - - /* generate texture object IDs */ - glGenTextures( 2, TexObj ); - - /* - * setup first texture object - */ - glActiveTextureARB(GL_TEXTURE0_ARB); - glEnable( GL_TEXTURE_2D ); - glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_ADD ); - - glBindTexture( GL_TEXTURE_2D, TexObj[0] ); - assert(glIsTexture(TexObj[0])); - - /* red over black */ - for (i=0;i -#include -#include -#include - - -static GLint Window[2]; - -static GLfloat Xrot = 0, Yrot = 0, Zrot = 0; -static GLboolean Anim = GL_TRUE; - - -static void Idle( void ) -{ - Xrot += 3.0; - Yrot += 4.0; - Zrot += 2.0; - - glutSetWindow(Window[0]); - glutPostRedisplay(); - glutSetWindow(Window[1]); - glutPostRedisplay(); -} - - -static void Display0( void ) -{ - glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); - - glEnable(GL_LIGHTING); - glEnable(GL_LIGHT0); - glEnable(GL_DEPTH_TEST); - - glPushMatrix(); - glRotatef(Xrot, 1, 0, 0); - glRotatef(Yrot, 0, 1, 0); - glRotatef(Zrot, 0, 0, 1); - - glColor3f(0, 1, 0); - glutSolidCube(2.0); - - glPopMatrix(); - - glutSwapBuffers(); -} - - -static void Display1( void ) -{ - glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); - - glPushMatrix(); - glRotatef(Xrot, 1, 0, 0); - glRotatef(Yrot, 0, 1, 0); - glRotatef(Zrot, 0, 0, 1); - - glShadeModel(GL_FLAT); - - glBegin(GL_TRIANGLE_STRIP); - glColor3f(1, 0, 0); - glVertex2f(-1, -1); - glVertex2f( 1, -1); - glColor3f(1, 0, 0); - glVertex2f( -1, 1); - glColor3f(0, 0, 1); - glVertex2f( 1, 1); - glEnd(); - - glPopMatrix(); - - glutSwapBuffers(); -} - - -static void Reshape( int width, int height ) -{ - glViewport( 0, 0, width, height ); - glMatrixMode( GL_PROJECTION ); - glLoadIdentity(); - glFrustum( -1.0, 1.0, -1.0, 1.0, 5.0, 25.0 ); - glMatrixMode( GL_MODELVIEW ); - glLoadIdentity(); - glTranslatef( 0.0, 0.0, -15.0 ); -} - - -static void Key( unsigned char key, int x, int y ) -{ - const GLfloat step = 3.0; - (void) x; - (void) y; - switch (key) { - case 'a': - Anim = !Anim; - if (Anim) - glutIdleFunc(Idle); - else - glutIdleFunc(NULL); - break; - case 'z': - Zrot -= step; - break; - case 'Z': - Zrot += step; - break; - case 27: - exit(0); - break; - } - glutPostRedisplay(); -} - - - - -int main( int argc, char *argv[] ) -{ - glutInit( &argc, argv ); - - glutInitWindowPosition( 0, 0 ); - glutInitWindowSize( 400, 400 ); - glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH ); - Window[0] = glutCreateWindow(argv[0]); - glutReshapeFunc( Reshape ); - glutKeyboardFunc( Key ); - glutDisplayFunc( Display0 ); - glutIdleFunc(Idle); - printf("GL_RENDERER[0] = %s\n", (char *) glGetString(GL_RENDERER)); - - glutInitWindowPosition( 500, 0 ); - glutInitWindowSize( 400, 400 ); - glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH ); - Window[1] = glutCreateWindow(argv[0]); - glutReshapeFunc( Reshape ); - glutKeyboardFunc( Key ); - glutDisplayFunc( Display1 ); - glutIdleFunc(Idle); - printf("GL_RENDERER[1] = %s\n", (char *) glGetString(GL_RENDERER)); - - glutMainLoop(); - - return 0; -} diff --git a/progs/tests/no_s3tc.c b/progs/tests/no_s3tc.c deleted file mode 100644 index d3383ff98a..0000000000 --- a/progs/tests/no_s3tc.c +++ /dev/null @@ -1,97 +0,0 @@ -/* - * (C) Copyright IBM Corporation 2004 - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * on the rights to use, copy, modify, merge, publish, distribute, sub - * license, and/or sell copies of the Software, and to permit persons to whom - * the Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL - * VA LINUX SYSTEM, IBM AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, - * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR - * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE - * USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -/** - * \file no_s3tc.c - * Test program to verify the behavior of an OpenGL implementation when - * an application calls \c glCompressedTexImage2D with an unsupported (but - * valid) compression format. The most common example is calling it with - * \c GL_COMPRESSED_RGBA_S3TC_DXT1_EXT when GL_EXT_texture_compression_s3tc - * is not supported. - * - * This tests Mesa bug #1028405. - * - * \author Ian Romanick - */ - -#include -#include -#include -#include -#include - -static unsigned data[16]; - -int -main( int argc, char ** argv ) -{ - float gl_version; - GLenum format; - GLuint size; - GLuint width; - GLenum err; - - - glutInit( & argc, argv ); - glutInitDisplayMode( GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE ); - - glutInitWindowPosition( 0, 0 ); - glutInitWindowSize( 300, 300 ); - glutCreateWindow( "No S3TC Test" ); - - gl_version = strtod( (const char *) glGetString( GL_VERSION ), NULL ); - if ( ! glutExtensionSupported( "GL_ARB_texture_compression" ) - && (gl_version < 1.3) ) { - fprintf( stderr, "Either OpenGL 1.3 or GL_ARB_texture_compression " - "must be supported.\n" ); - return( EXIT_SUCCESS ); - } - - - if ( ! glutExtensionSupported( "GL_EXT_texture_compression_s3tc" ) ) { - format = GL_COMPRESSED_RGBA_S3TC_DXT1_EXT; - width = 4; - size = 8; - } - else if ( ! glutExtensionSupported( "GL_3DFX_texture_compression_FXT1" ) ) { - format = GL_COMPRESSED_RGBA_FXT1_3DFX; - width = 8; - size = 16; - } - else { - fprintf( stderr, "Either GL_EXT_texture_compression_s3tc or " - "GL_3DFX_texture_compression_FXT1 must NOT be supported.\n" ); - return( EXIT_SUCCESS ); - } - - glCompressedTexImage2D( GL_TEXTURE_2D, 0, format, width, 4, 0, - size, data ); - err = glGetError(); - if ( err != GL_INVALID_ENUM ) { - fprintf( stderr, "GL error 0x%04x should have been generated, but " - "0x%04x was generated instead.\n", GL_INVALID_ENUM, err ); - } - - return (err == GL_INVALID_ENUM) ? EXIT_SUCCESS : EXIT_FAILURE; -} diff --git a/progs/tests/packedpixels.c b/progs/tests/packedpixels.c deleted file mode 100644 index 67ffe08825..0000000000 --- a/progs/tests/packedpixels.c +++ /dev/null @@ -1,342 +0,0 @@ -/* - * Test packed pixel formats for textures. - * Brian Paul - * 12 May 2004 - */ - -#include -#include -#include -#include -#include - - -struct pixel_format { - const char *name; - GLenum format; - GLenum type; - GLint bytes; - GLuint redTexel, greenTexel; -}; - -static const struct pixel_format Formats[] = { - - { "GL_RGBA/GL_UNSIGNED_INT_8_8_8_8", - GL_RGBA, GL_UNSIGNED_INT_8_8_8_8, 4, 0xff000000, 0x00ff0000 }, - { "GL_RGBA/GL_UNSIGNED_INT_8_8_8_8_REV", - GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV, 4, 0x000000ff, 0x0000ff00 }, - { "GL_RGBA/GL_UNSIGNED_INT_10_10_10_2", - GL_RGBA, GL_UNSIGNED_INT_10_10_10_2, 4, 0xffc00000, 0x3ff000 }, - { "GL_RGBA/GL_UNSIGNED_INT_2_10_10_10_REV", - GL_RGBA, GL_UNSIGNED_INT_2_10_10_10_REV, 4, 0x3ff, 0xffc00 }, - { "GL_RGBA/GL_UNSIGNED_SHORT_4_4_4_4", - GL_RGBA, GL_UNSIGNED_SHORT_4_4_4_4, 2, 0xf000, 0x0f00 }, - { "GL_RGBA/GL_UNSIGNED_SHORT_4_4_4_4_REV", - GL_RGBA, GL_UNSIGNED_SHORT_4_4_4_4_REV, 2, 0x000f, 0x00f0 }, - { "GL_RGBA/GL_UNSIGNED_SHORT_5_5_5_1", - GL_RGBA, GL_UNSIGNED_SHORT_5_5_5_1, 2, 0xf800, 0x7c0 }, - { "GL_RGBA/GL_UNSIGNED_SHORT_1_5_5_5_REV", - GL_RGBA, GL_UNSIGNED_SHORT_1_5_5_5_REV, 2, 0x1f, 0x3e0 }, - - { "GL_BGRA/GL_UNSIGNED_INT_8_8_8_8", - GL_BGRA, GL_UNSIGNED_INT_8_8_8_8, 4, 0x0000ff00, 0x00ff0000 }, - { "GL_BGRA/GL_UNSIGNED_INT_8_8_8_8_REV", - GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, 4, 0x00ff0000, 0x0000ff00 }, - { "GL_BGRA/GL_UNSIGNED_SHORT_4_4_4_4", - GL_BGRA, GL_UNSIGNED_SHORT_4_4_4_4, 2, 0x00f0, 0x0f00 }, - { "GL_BGRA/GL_UNSIGNED_SHORT_4_4_4_4_REV", - GL_BGRA, GL_UNSIGNED_SHORT_4_4_4_4_REV, 2, 0x0f00, 0x00f0 }, - { "GL_BGRA/GL_UNSIGNED_SHORT_5_5_5_1", - GL_BGRA, GL_UNSIGNED_SHORT_5_5_5_1, 2, 0x3e, 0x7c0 }, - { "GL_BGRA/GL_UNSIGNED_SHORT_1_5_5_5_REV", - GL_BGRA, GL_UNSIGNED_SHORT_1_5_5_5_REV, 2, 0x7c00, 0x3e0 }, - - { "GL_ABGR_EXT/GL_UNSIGNED_INT_8_8_8_8", - GL_ABGR_EXT, GL_UNSIGNED_INT_8_8_8_8, 4, 0x000000ff, 0x0000ff00 }, - { "GL_ABGR_EXT/GL_UNSIGNED_INT_8_8_8_8_REV", - GL_ABGR_EXT, GL_UNSIGNED_INT_8_8_8_8_REV, 4, 0xff000000, 0x00ff0000 }, - { "GL_ABGR_EXT/GL_UNSIGNED_SHORT_4_4_4_4", - GL_ABGR_EXT, GL_UNSIGNED_SHORT_4_4_4_4, 2, 0x000f, 0x00f0 }, - { "GL_ABGR_EXT/GL_UNSIGNED_SHORT_4_4_4_4_REV", - GL_ABGR_EXT, GL_UNSIGNED_SHORT_4_4_4_4_REV, 2, 0xf000, 0x0f00 }, - { "GL_ABGR_EXT/GL_UNSIGNED_SHORT_5_5_5_1", - GL_ABGR_EXT, GL_UNSIGNED_SHORT_5_5_5_1, 2, 0x1, 0x3e }, - { "GL_ABGR_EXT/GL_UNSIGNED_SHORT_1_5_5_5_REV", - GL_ABGR_EXT, GL_UNSIGNED_SHORT_1_5_5_5_REV, 2, 0x8000, 0x7c00 }, - - { "GL_RGB/GL_UNSIGNED_SHORT_5_6_5", - GL_RGB, GL_UNSIGNED_SHORT_5_6_5, 2, 0xf800, 0x7e0 }, - { "GL_RGB/GL_UNSIGNED_SHORT_5_6_5_REV", - GL_RGB, GL_UNSIGNED_SHORT_5_6_5_REV, 2, 0x1f, 0x7e0 }, - { "GL_RGB/GL_UNSIGNED_BYTE_3_3_2", - GL_RGB, GL_UNSIGNED_BYTE_3_3_2, 1, 0xe0, 0x1c }, - { "GL_RGB/GL_UNSIGNED_BYTE_2_3_3_REV", - GL_RGB, GL_UNSIGNED_BYTE_2_3_3_REV, 1, 0x7, 0x38 }, - - { NULL, 0, 0, 0, 0, 0 } -}; - - -struct name_format { - const char *name; - GLenum format; -}; - -static const struct name_format IntFormats[] = { - { "GL_RGBA", GL_RGBA }, - { "GL_RGBA2", GL_RGBA2 }, - { "GL_RGBA4", GL_RGBA4 }, - { "GL_RGB5_A1", GL_RGB5_A1 }, - { "GL_RGBA8", GL_RGBA8 }, - { "GL_RGBA12", GL_RGBA12 }, - { "GL_RGBA16", GL_RGBA16 }, - { "GL_RGB10_A2", GL_RGB10_A2 }, - - { "GL_RGB", GL_RGB }, - { "GL_R3_G3_B2", GL_R3_G3_B2 }, - { "GL_RGB4", GL_RGB4 }, - { "GL_RGB5", GL_RGB5 }, - { "GL_RGB8", GL_RGB8 }, - { "GL_RGB10", GL_RGB10 }, - { "GL_RGB12", GL_RGB12 }, - { "GL_RGB16", GL_RGB16 }, - -}; - -#define NUM_INT_FORMATS (sizeof(IntFormats) / sizeof(IntFormats[0])) -static GLuint CurFormat = 0; - -static GLboolean Test3D = GL_FALSE; - - - -static void -PrintString(const char *s) -{ - while (*s) { - glutBitmapCharacter(GLUT_BITMAP_8_BY_13, (int) *s); - s++; - } -} - - -static void -MakeTexture(const struct pixel_format *format, GLenum intFormat, GLboolean swap) -{ - GLubyte texBuffer[1000]; - int i; - - glPixelStorei(GL_UNPACK_SWAP_BYTES, swap); - - if (format->bytes == 1) { - for (i = 0; i < 8; i++) { - texBuffer[i] = format->redTexel; - } - for (i = 8; i < 16; i++) { - texBuffer[i] = format->greenTexel; - } - } - else if (format->bytes == 2) { - GLushort *us = (GLushort *) texBuffer; - for (i = 0; i < 8; i++) { - us[i] = format->redTexel; - } - for (i = 8; i < 16; i++) { - us[i] = format->greenTexel; - } - if (swap) { - for (i = 0; i < 16; i++) - us[i] = (us[i] << 8) | (us[i] >> 8); - } - } - else if (format->bytes == 4) { - GLuint *ui = (GLuint *) texBuffer; - for (i = 0; i < 8; i++) { - ui[i] = format->redTexel; - } - for (i = 8; i < 16; i++) { - ui[i] = format->greenTexel; - } - if (swap) { - for (i = 0; i < 16; i++) { - GLuint b = ui[i]; - ui[i] = (b >> 24) - | ((b >> 8) & 0xff00) - | ((b << 8) & 0xff0000) - | ((b << 24) & 0xff000000); - } - } - } - else { - abort(); - } - - if (Test3D) { - /* 4 x 4 x 4 texture, undefined data */ - glTexImage3D(GL_TEXTURE_3D, 0, intFormat, 4, 4, 4, 0, - format->format, format->type, NULL); - /* fill in Z=1 and Z=2 slices with the real texture data */ - glTexSubImage3D(GL_TEXTURE_3D, 0, - 0, 0, 1, /* offset */ - 4, 4, 1, /* size */ - format->format, format->type, texBuffer); - glTexSubImage3D(GL_TEXTURE_3D, 0, - 0, 0, 2, /* offset */ - 4, 4, 1, /* size */ - format->format, format->type, texBuffer); - } - else { - glTexImage2D(GL_TEXTURE_2D, 0, intFormat, 4, 4, 0, - format->format, format->type, texBuffer); - } - - if (glGetError()) { - printf("GL Error for %s\n", format->name); - memset(texBuffer, 255, 1000); - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 4, 4, 0, - GL_RGB, GL_UNSIGNED_BYTE, texBuffer); - } -} - - - -static void -Draw(void) -{ - char s[1000]; - int w = 350, h = 20; - int i, swap; - - glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); - - for (swap = 0; swap < 2; swap++) { - for (i = 0; Formats[i].name; i++) { - glPushMatrix(); - glTranslatef(swap * (w + 2), i * (h + 2), 0); - - MakeTexture(Formats + i, IntFormats[CurFormat].format, swap); - - if (Test3D) - glEnable(GL_TEXTURE_3D); - else - glEnable(GL_TEXTURE_2D); - glBegin(GL_POLYGON); - glTexCoord3f(0, 0, 0.5); glVertex2f(0, 0); - glTexCoord3f(1, 0, 0.5); glVertex2f(w, 0); - glTexCoord3f(1, 1, 0.5); glVertex2f(w, h); - glTexCoord3f(0, 1, 0.5); glVertex2f(0, h); - glEnd(); - - if (Test3D) - glDisable(GL_TEXTURE_3D); - else - glDisable(GL_TEXTURE_2D); - glColor3f(0, 0, 0); - glRasterPos2i(8, 6); - PrintString(Formats[i].name); - - glPopMatrix(); - } - } - - glPushMatrix(); - glTranslatef(2, i * (h + 2), 0); - glColor3f(1, 1, 1); - glRasterPos2i(8, 6); - PrintString("Normal"); - glRasterPos2i(w + 2, 6); - PrintString("Byte Swapped"); - glPopMatrix(); - - glPushMatrix(); - glTranslatef(2, (i + 1) * (h + 2), 0); - glRasterPos2i(8, 6); - sprintf(s, "Internal Texture Format [f/F]: %s (%d of %d)", - IntFormats[CurFormat].name, CurFormat + 1, NUM_INT_FORMATS); - PrintString(s); - glPopMatrix(); - - glPushMatrix(); - glTranslatef(2, (i + 2) * (h + 2), 0); - glRasterPos2i(8, 6); - if (Test3D) - PrintString("Target [2/3]: GL_TEXTURE_3D"); - else - PrintString("Target [2/3]: GL_TEXTURE_2D"); - glPopMatrix(); - - glutSwapBuffers(); -} - - -static void -Reshape(int width, int height) -{ - glViewport(0, 0, width, height); - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glOrtho(0, width, 0, height, -1, 1); - glMatrixMode(GL_MODELVIEW); - glLoadIdentity(); -} - - -static void -Key(unsigned char key, int x, int y) -{ - (void) x; - (void) y; - switch (key) { - case 'F': - if (CurFormat == 0) - CurFormat = NUM_INT_FORMATS - 1; - else - CurFormat--; - break; - case 'f': - CurFormat++; - if (CurFormat == NUM_INT_FORMATS) - CurFormat = 0; - break; - case '2': - Test3D = GL_FALSE; - break; - case '3': - Test3D = GL_TRUE; - break; - case 27: - exit(0); - break; - } - glutPostRedisplay(); -} - - -static void -Init(void) -{ - printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - printf("GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); -} - - -int -main(int argc, char *argv[]) -{ - glutInit(&argc, argv); - glutInitWindowPosition(0, 0); - glutInitWindowSize(700, 800); - glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH); - glutCreateWindow(argv[0]); - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - Init(); - glutMainLoop(); - return 0; -} diff --git a/progs/tests/pbo.c b/progs/tests/pbo.c deleted file mode 100644 index b31b36cc12..0000000000 --- a/progs/tests/pbo.c +++ /dev/null @@ -1,296 +0,0 @@ -/* - * GL_EXT_pixel_buffer_object test - * - * Brian Paul - * 11 March 2004 - */ - -#define GL_GLEXT_PROTOTYPES - -#include -#include -#include -#include -#include - -#include "../util/readtex.c" /* a hack, I know */ - -#define IMAGE_FILE "../images/girl.rgb" - -static int ImgWidth, ImgHeight; -static GLenum ImgFormat; -static GLubyte *Image = NULL; - -static int APosX, APosY; /* simple drawpixels */ -static int BPosX, BPosY; /* read/draw pixels */ -static int CPosX, CPosY; /* copypixels */ - -static GLboolean DrawFront = GL_FALSE; -static GLboolean ScaleAndBias = GL_FALSE; -static GLboolean Benchmark = GL_FALSE; - -static GLuint DrawPBO, TempPBO; - - -static GLenum ReadFormat = GL_BGRA; -static GLenum ReadType = GL_UNSIGNED_INT_8_8_8_8_REV; - - - -static void -CheckError(int line) -{ - GLenum err = glGetError(); - if (err) { - printf("GL Error 0x%x at line %d\n", (int) err, line); - } -} - - -static void -Reset( void ) -{ - APosX = 5; APosY = 20; - BPosX = APosX + ImgWidth + 5; BPosY = 20; - CPosX = BPosX + ImgWidth + 5; CPosY = 20; -} - - -static void -PrintString(const char *s) -{ - while (*s) { - glutBitmapCharacter(GLUT_BITMAP_8_BY_13, (int) *s); - s++; - } -} - - -static void -SetupPixelTransfer(GLboolean invert) -{ - if (invert) { - glPixelTransferf(GL_RED_SCALE, -1.0); - glPixelTransferf(GL_RED_BIAS, 1.0); - glPixelTransferf(GL_GREEN_SCALE, -1.0); - glPixelTransferf(GL_GREEN_BIAS, 1.0); - glPixelTransferf(GL_BLUE_SCALE, -1.0); - glPixelTransferf(GL_BLUE_BIAS, 1.0); - } - else { - glPixelTransferf(GL_RED_SCALE, 1.0); - glPixelTransferf(GL_RED_BIAS, 0.0); - glPixelTransferf(GL_GREEN_SCALE, 1.0); - glPixelTransferf(GL_GREEN_BIAS, 0.0); - glPixelTransferf(GL_BLUE_SCALE, 1.0); - glPixelTransferf(GL_BLUE_BIAS, 0.0); - } -} - - -static void -Display( void ) -{ - glClearColor(.3, .3, .3, 1); - glClear( GL_COLOR_BUFFER_BIT ); - - CheckError(__LINE__); - - /** Unbind UNPACK pixel buffer before calling glBitmap */ - glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_EXT, 0); - - glRasterPos2i(5, ImgHeight+25); - PrintString("f = toggle front/back s = toggle scale/bias b = benchmark"); - - glRasterPos2i(5, ImgHeight+40); - PrintString("GL_EXT_pixel_buffer_object test"); - - /* draw original image */ - glRasterPos2i(APosX, 5); - PrintString("Original"); - glRasterPos2i(APosX, APosY); - glEnable(GL_DITHER); - SetupPixelTransfer(GL_FALSE); - /*** Draw from the DrawPBO */ - glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_EXT, DrawPBO); - glDrawPixels(ImgWidth, ImgHeight, ImgFormat, GL_UNSIGNED_BYTE, 0); - glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_EXT, 0); - - CheckError(__LINE__); - - /* do readpixels, drawpixels */ - glRasterPos2i(BPosX, 5); - PrintString("Read/DrawPixels"); - SetupPixelTransfer(ScaleAndBias); - /*** read into the Temp PBO */ - glBindBufferARB(GL_PIXEL_PACK_BUFFER_EXT, TempPBO); - CheckError(__LINE__); - if (Benchmark) { - GLint reads = 0; - GLint endTime; - GLint startTime = glutGet(GLUT_ELAPSED_TIME); - GLdouble seconds, pixelsPerSecond; - printf("Benchmarking...\n"); - do { - glReadPixels(APosX, APosY, ImgWidth, ImgHeight, - ReadFormat, ReadType, 0); - reads++; - endTime = glutGet(GLUT_ELAPSED_TIME); - } while (endTime - startTime < 4000); /* 4 seconds */ - seconds = (double) (endTime - startTime) / 1000.0; - pixelsPerSecond = reads * ImgWidth * ImgHeight / seconds; - printf("Result: %d reads in %f seconds = %f pixels/sec\n", - reads, seconds, pixelsPerSecond); - Benchmark = GL_FALSE; - } - else { - glReadPixels(APosX, APosY, ImgWidth, ImgHeight, - ReadFormat, ReadType, 0); - } - CheckError(__LINE__); - glRasterPos2i(BPosX, BPosY); - glDisable(GL_DITHER); - SetupPixelTransfer(GL_FALSE); - - CheckError(__LINE__); - - /*** draw from the Temp PBO */ - glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_EXT, TempPBO); - glDrawPixels(ImgWidth, ImgHeight, ReadFormat, ReadType, 0); - glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_EXT, 0); - - CheckError(__LINE__); - - /* do copypixels */ - glRasterPos2i(CPosX, 5); - PrintString("CopyPixels"); - glRasterPos2i(CPosX, CPosY); - glDisable(GL_DITHER); - SetupPixelTransfer(ScaleAndBias); - glCopyPixels(APosX, APosY, ImgWidth, ImgHeight, GL_COLOR); - - CheckError(__LINE__); - - if (!DrawFront) - glutSwapBuffers(); - else - glFinish(); -} - - -static void -Reshape( int width, int height ) -{ - glViewport( 0, 0, width, height ); - glMatrixMode( GL_PROJECTION ); - glLoadIdentity(); - glOrtho( 0.0, width, 0.0, height, -1.0, 1.0 ); - glMatrixMode( GL_MODELVIEW ); - glLoadIdentity(); -} - - -static void -Key( unsigned char key, int x, int y ) -{ - (void) x; - (void) y; - switch (key) { - case 'b': - Benchmark = GL_TRUE; - break; - case 's': - ScaleAndBias = !ScaleAndBias; - break; - case 'f': - DrawFront = !DrawFront; - if (DrawFront) { - glDrawBuffer(GL_FRONT); - glReadBuffer(GL_FRONT); - } - else { - glDrawBuffer(GL_BACK); - glReadBuffer(GL_BACK); - } - printf("glDrawBuffer(%s)\n", DrawFront ? "GL_FRONT" : "GL_BACK"); - break; - case 27: - exit(0); - break; - } - glutPostRedisplay(); -} - - -static void -Init(void) -{ - printf("GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - - if (!glutExtensionSupported("GL_EXT_pixel_buffer_object")) { - printf("Sorry, this demo requires GL_EXT_pixel_buffer_object\n"); - exit(0); - } - - Image = LoadRGBImage( IMAGE_FILE, &ImgWidth, &ImgHeight, &ImgFormat ); - if (!Image) { - printf("Couldn't read %s\n", IMAGE_FILE); - exit(0); - } - - printf("Loaded %d by %d image\n", ImgWidth, ImgHeight ); - - if (ImgFormat == GL_RGB) { - /* convert to RGBA */ - int i; - GLubyte *image2 = (GLubyte *) malloc(ImgWidth * ImgHeight * 4); - printf("Converting RGB image to RGBA\n"); - for (i = 0; i < ImgWidth * ImgHeight; i++) { - image2[i*4+0] = Image[i*3+0]; - image2[i*4+1] = Image[i*3+1]; - image2[i*4+2] = Image[i*3+2]; - image2[i*4+3] = 255; - } - free(Image); - Image = image2; - ImgFormat = GL_RGBA; - } - - glPixelStorei(GL_UNPACK_ALIGNMENT, 1); - glPixelStorei(GL_UNPACK_ROW_LENGTH, ImgWidth); - glPixelStorei(GL_PACK_ALIGNMENT, 1); - glPixelStorei(GL_PACK_ROW_LENGTH, ImgWidth); - - Reset(); - - /* put image into DrawPBO */ - glGenBuffersARB(1, &DrawPBO); - glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_EXT, DrawPBO); - glBufferDataARB(GL_PIXEL_UNPACK_BUFFER_EXT, - ImgWidth * ImgHeight * 4, Image, GL_STATIC_DRAW); - - /* Setup TempPBO - used for glReadPixels & glDrawPixels */ - glGenBuffersARB(1, &TempPBO); - glBindBufferARB(GL_PIXEL_PACK_BUFFER_EXT, TempPBO); - glBufferDataARB(GL_PIXEL_PACK_BUFFER_EXT, - ImgWidth * ImgHeight * 4, NULL, GL_DYNAMIC_COPY); - -} - - -int -main( int argc, char *argv[] ) -{ - glutInit( &argc, argv ); - glutInitWindowPosition( 0, 0 ); - glutInitWindowSize( 750, 250 ); - glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE ); - glutCreateWindow(argv[0]); - Init(); - glutReshapeFunc( Reshape ); - glutKeyboardFunc( Key ); - glutDisplayFunc( Display ); - glutMainLoop(); - return 0; -} diff --git a/progs/tests/prog_parameter.c b/progs/tests/prog_parameter.c deleted file mode 100644 index 96697e5bda..0000000000 --- a/progs/tests/prog_parameter.c +++ /dev/null @@ -1,285 +0,0 @@ -/* - * (C) Copyright IBM Corporation 2006 - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * on the rights to use, copy, modify, merge, publish, distribute, sub - * license, and/or sell copies of the Software, and to permit persons to whom - * the Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL - * IBM AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - */ - -/** - * \file prog_parameter.c - * - * Test various aspects of setting (and getting) low-level program parameters. - * This is primarilly intended as a test for GL_EXT_gpu_program_parameters, - * but it turns out that it hits some other functionality along the way. - * - * \author Ian Romanick - */ - -#include -#include -#include -#include - -#ifndef GL_EXT_gpu_program_parameters -typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETERS4FVEXTPROC)(GLenum, - GLuint, GLsizei, const GLfloat *); -typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETERS4FVEXTPROC)(GLenum, - GLuint, GLsizei, const GLfloat *); -#endif - -static PFNGLPROGRAMLOCALPARAMETER4FVARBPROC program_local_parameter4fv = NULL; -static PFNGLGETPROGRAMLOCALPARAMETERFVARBPROC get_program_local_parameterfv = NULL; -static PFNGLPROGRAMENVPARAMETER4FVARBPROC program_env_parameter4fv = NULL; -static PFNGLGETPROGRAMENVPARAMETERFVARBPROC get_program_env_parameterfv = NULL; -static PFNGLBINDPROGRAMARBPROC bind_program = NULL; -static PFNGLGETPROGRAMIVARBPROC get_program = NULL; - -static PFNGLPROGRAMLOCALPARAMETERS4FVEXTPROC program_local_parameters4fv = NULL; -static PFNGLPROGRAMENVPARAMETERS4FVEXTPROC program_env_parameters4fv = NULL; - -static int Width = 400; -static int Height = 200; -static const GLfloat Near = 5.0, Far = 25.0; - - -static void Display( void ) -{ -} - - -static void Idle( void ) -{ -} - - -static void Visible( int vis ) -{ - if ( vis == GLUT_VISIBLE ) { - glutIdleFunc( Idle ); - } - else { - glutIdleFunc( NULL ); - } -} -static void Reshape( int width, int height ) -{ - GLfloat ar = (float) width / (float) height; - Width = width; - Height = height; - glViewport( 0, 0, width, height ); - glMatrixMode( GL_PROJECTION ); - glLoadIdentity(); - glFrustum( -ar, ar, -1.0, 1.0, Near, Far ); -} - - -static void Key( unsigned char key, int x, int y ) -{ - (void) x; - (void) y; - switch (key) { - case 27: - exit(0); - break; - } - glutPostRedisplay(); -} - - -static int set_parameter_batch( GLsizei count, GLfloat * param, - const char * name, - PFNGLPROGRAMLOCALPARAMETER4FVARBPROC set_parameter, - PFNGLPROGRAMLOCALPARAMETERS4FVEXTPROC set_parameters, - PFNGLGETPROGRAMLOCALPARAMETERFVARBPROC get_parameter - ) -{ - unsigned i; - int pass = 1; - - - for ( i = 0 ; i < (4 * count) ; i++ ) { - param[i] = (GLfloat) random() / (GLfloat) random(); - } - - /* Try using the "classic" interface. - */ - printf("Testing glProgram%sParameter4fvARB (count = %u)...\n", name, count); - for ( i = 0 ; i < count ; i++ ) { - (*set_parameter)(GL_VERTEX_PROGRAM_ARB, i, & param[i * 4]); - } - - for ( i = 0 ; i < count ; i++ ) { - GLfloat temp[4]; - - (*get_parameter)(GL_VERTEX_PROGRAM_ARB, i, temp); - - if ( (temp[0] != param[(i * 4) + 0]) - || (temp[1] != param[(i * 4) + 1]) - || (temp[2] != param[(i * 4) + 2]) - || (temp[3] != param[(i * 4) + 3]) ) { - printf("Mismatch in glProgram%sParameter4fvARB index %u!\n", name, i); - printf("Got { %f, %f, %f, %f }, expected { %f, %f, %f, %f }!\n", - temp[0], temp[1], - temp[2], temp[3], - param[(i * 4) + 0], param[(i * 4) + 1], - param[(i * 4) + 2], param[(i * 4) + 3]); - pass = 0; - break; - } - } - - - if ( set_parameters == NULL ) { - return pass; - } - - - for ( i = 0 ; i < (4 * count) ; i++ ) { - param[i] = (GLfloat) random() / (GLfloat) random(); - } - - printf("Testing glProgram%sParameters4fvEXT (count = %u)...\n", name, count); - (*set_parameters)(GL_VERTEX_PROGRAM_ARB, 0, count, param); - - for ( i = 0 ; i < count ; i++ ) { - GLfloat temp[4]; - - (*get_parameter)(GL_VERTEX_PROGRAM_ARB, i, temp); - - if ( (temp[0] != param[(i * 4) + 0]) - || (temp[1] != param[(i * 4) + 1]) - || (temp[2] != param[(i * 4) + 2]) - || (temp[3] != param[(i * 4) + 3]) ) { - printf("Mismatch in glProgram%sParameters4fvEXT index %u!\n", name, i); - printf("Got { %f, %f, %f, %f }, expected { %f, %f, %f, %f }!\n", - temp[0], temp[1], - temp[2], temp[3], - param[(i * 4) + 0], param[(i * 4) + 1], - param[(i * 4) + 2], param[(i * 4) + 3]); - pass = 0; - break; - } - } - - - return pass; -} - - -static void Init( void ) -{ - const char * const ver_string = (const char * const) - glGetString( GL_VERSION ); - int pass = 1; - GLfloat * params; - GLint max_program_env_parameters; - GLint max_program_local_parameters; - - - printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - printf("GL_VERSION = %s\n\n", ver_string); - - if ( !glutExtensionSupported("GL_ARB_vertex_program") ) { - printf("Sorry, this program requires GL_ARB_vertex_program\n"); - exit(2); - } - - - program_local_parameter4fv = glutGetProcAddress( "glProgramLocalParameter4fvARB" ); - program_env_parameter4fv = glutGetProcAddress( "glProgramEnvParameter4fvARB" ); - - get_program_local_parameterfv = glutGetProcAddress( "glGetProgramLocalParameterfvARB" ); - get_program_env_parameterfv = glutGetProcAddress( "glGetProgramEnvParameterfvARB" ); - - bind_program = glutGetProcAddress( "glBindProgramARB" ); - get_program = glutGetProcAddress( "glGetProgramivARB" ); - - if ( glutExtensionSupported("GL_EXT_gpu_program_parameters") ) { - printf("GL_EXT_gpu_program_parameters available, testing that path.\n"); - - program_local_parameters4fv = glutGetProcAddress( "glProgramLocalParameters4fvEXT" ); - program_env_parameters4fv = glutGetProcAddress( "glProgramEnvParameters4fvEXT" ); - } - else { - printf("GL_EXT_gpu_program_parameters not available.\n"); - - program_local_parameters4fv = NULL; - program_env_parameters4fv = NULL; - } - - - - /* Since the test sets program local parameters, a program must be bound. - * Program source, however, is not needed. - */ - (*bind_program)(GL_VERTEX_PROGRAM_ARB, 1); - - - (*get_program)(GL_VERTEX_PROGRAM_ARB, GL_MAX_PROGRAM_ENV_PARAMETERS_ARB, - & max_program_env_parameters); - - params = malloc(max_program_env_parameters * 4 * sizeof(GLfloat)); - - pass &= set_parameter_batch(max_program_env_parameters, params, "Env", - program_env_parameter4fv, - program_env_parameters4fv, - get_program_env_parameterfv); - - - (*get_program)(GL_VERTEX_PROGRAM_ARB, GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB, - & max_program_local_parameters); - - if (max_program_local_parameters > max_program_env_parameters) { - params = realloc(params, - max_program_local_parameters * 4 * sizeof(GLfloat)); - } - - pass &= set_parameter_batch(max_program_local_parameters, params, "Local", - program_local_parameter4fv, - program_local_parameters4fv, - get_program_local_parameterfv); - - free(params); - - if (! pass) { - printf("FAIL!\n"); - exit(1); - } - - printf("PASS!\n"); -} - - -int main( int argc, char *argv[] ) -{ - glutInit( &argc, argv ); - glutInitWindowPosition( 0, 0 ); - glutInitWindowSize( Width, Height ); - glutInitDisplayMode( GLUT_RGB ); - glutCreateWindow( "Program Parameters Test" ); - glutReshapeFunc( Reshape ); - glutKeyboardFunc( Key ); - glutDisplayFunc( Display ); - glutVisibilityFunc( Visible ); - - Init(); - - return 0; -} diff --git a/progs/tests/projtex.c b/progs/tests/projtex.c deleted file mode 100644 index e3ef948ab6..0000000000 --- a/progs/tests/projtex.c +++ /dev/null @@ -1,1028 +0,0 @@ - -/* projtex.c - by David Yu and David Blythe, SGI */ - -/** - ** Demonstrates simple projective texture mapping. - ** - ** Button1 changes view, Button2 moves texture. - ** - ** (See: Segal, Korobkin, van Widenfelt, Foran, and Haeberli - ** "Fast Shadows and Lighting Effects Using Texture Mapping", SIGGRAPH '92) - ** - ** 1994,1995 -- David G Yu - ** - ** cc -o projtex projtex.c texture.c -lglut -lGLU -lGL -lX11 -lm - **/ - -#include -#include -#include -#include -#include -#if 0 -#include "texture.h" -#else -#include "../util/readtex.c" -#endif - - -/* Some files do not define M_PI... */ -#ifndef M_PI -#define M_PI 3.14159265358979323846 -#endif - -#define MAX_TEX 4 -int NumTextures = 1; - -int winWidth, winHeight; - -GLboolean redrawContinuously = GL_FALSE; - -float angle, axis[3]; -enum MoveModes { - MoveNone, MoveView, MoveObject, MoveTexture -}; -enum MoveModes mode = MoveNone; - -GLfloat objectXform[4][4]; -GLfloat textureXform[MAX_TEX][4][4]; - -void (*drawObject) (void); -void (*loadTexture) (void); -GLboolean textureEnabled = GL_TRUE; -GLboolean showProjection = GL_TRUE; -GLboolean linearFilter = GL_TRUE; - -char *texFilename[MAX_TEX] = { - "../images/girl.rgb", - "../images/tile.rgb", - "../images/bw.rgb", - "../images/reflect.rgb" -}; - - -GLfloat zoomFactor = 1.0; - -/*****************************************************************/ - - -void ActiveTexture(int i) -{ - glActiveTextureARB(i); -} - - -/* matrix = identity */ -void -matrixIdentity(GLfloat matrix[16]) -{ - matrix[0] = 1.0; - matrix[1] = 0.0; - matrix[2] = 0.0; - matrix[3] = 0.0; - matrix[4] = 0.0; - matrix[5] = 1.0; - matrix[6] = 0.0; - matrix[7] = 0.0; - matrix[8] = 0.0; - matrix[9] = 0.0; - matrix[10] = 1.0; - matrix[11] = 0.0; - matrix[12] = 0.0; - matrix[13] = 0.0; - matrix[14] = 0.0; - matrix[15] = 1.0; -} - -/* matrix2 = transpose(matrix1) */ -void -matrixTranspose(GLfloat matrix2[16], GLfloat matrix1[16]) -{ - matrix2[0] = matrix1[0]; - matrix2[1] = matrix1[4]; - matrix2[2] = matrix1[8]; - matrix2[3] = matrix1[12]; - - matrix2[4] = matrix1[1]; - matrix2[5] = matrix1[5]; - matrix2[6] = matrix1[9]; - matrix2[7] = matrix1[13]; - - matrix2[8] = matrix1[2]; - matrix2[9] = matrix1[6]; - matrix2[10] = matrix1[10]; - matrix2[11] = matrix1[14]; - - matrix2[12] = matrix1[3]; - matrix2[13] = matrix1[7]; - matrix2[14] = matrix1[14]; - matrix2[15] = matrix1[15]; -} - -/*****************************************************************/ - -/* load SGI .rgb image (pad with a border of the specified width and color) */ -#if 0 -static void -imgLoad(char *filenameIn, int borderIn, GLfloat borderColorIn[4], - int *wOut, int *hOut, GLubyte ** imgOut) -{ - int border = borderIn; - int width, height; - int w, h; - GLubyte *image, *img, *p; - int i, j, components; - - image = (GLubyte *) read_texture(filenameIn, &width, &height, &components); - w = width + 2 * border; - h = height + 2 * border; - img = (GLubyte *) calloc(w * h, 4 * sizeof(unsigned char)); - - p = img; - for (j = -border; j < height + border; ++j) { - for (i = -border; i < width + border; ++i) { - if (0 <= j && j <= height - 1 && 0 <= i && i <= width - 1) { - p[0] = image[4 * (j * width + i) + 0]; - p[1] = image[4 * (j * width + i) + 1]; - p[2] = image[4 * (j * width + i) + 2]; - p[3] = 0xff; - } else { - p[0] = borderColorIn[0] * 0xff; - p[1] = borderColorIn[1] * 0xff; - p[2] = borderColorIn[2] * 0xff; - p[3] = borderColorIn[3] * 0xff; - } - p += 4; - } - } - free(image); - *wOut = w; - *hOut = h; - *imgOut = img; -} -#endif - - -/*****************************************************************/ - -/* Load the image file specified on the command line as the current texture */ -void -loadImageTextures(void) -{ - GLfloat borderColor[4] = - {1.0, 1.0, 1.0, 1.0}; - int tex; - - for (tex = 0; tex < NumTextures; tex++) { - GLubyte *image, *texData3, *texData4; - GLint imgWidth, imgHeight; - GLenum imgFormat; - int i, j; - - printf("loading %s\n", texFilename[tex]); - image = LoadRGBImage(texFilename[tex], &imgWidth, &imgHeight, &imgFormat); - if (!image) { - printf("can't find %s\n", texFilename[tex]); - exit(1); - } - assert(imgFormat == GL_RGB); - - /* scale to 256x256 */ - texData3 = malloc(256 * 256 * 4); - texData4 = malloc(256 * 256 * 4); - assert(texData3); - assert(texData4); - gluScaleImage(imgFormat, imgWidth, imgHeight, GL_UNSIGNED_BYTE, image, - 256, 256, GL_UNSIGNED_BYTE, texData3); - - /* convert to rgba */ - for (i = 0; i < 256 * 256; i++) { - texData4[i*4+0] = texData3[i*3+0]; - texData4[i*4+1] = texData3[i*3+1]; - texData4[i*4+2] = texData3[i*3+2]; - texData4[i*4+3] = 128; - } - - /* put transparent border around image */ - for (i = 0; i < 256; i++) { - texData4[i*4+0] = 255; - texData4[i*4+1] = 255; - texData4[i*4+2] = 255; - texData4[i*4+3] = 0; - } - j = 256 * 255 * 4; - for (i = 0; i < 256; i++) { - texData4[j + i*4+0] = 255; - texData4[j + i*4+1] = 255; - texData4[j + i*4+2] = 255; - texData4[j + i*4+3] = 0; - } - for (i = 0; i < 256; i++) { - j = i * 256 * 4; - texData4[j+0] = 255; - texData4[j+1] = 255; - texData4[j+2] = 255; - texData4[j+3] = 0; - } - for (i = 0; i < 256; i++) { - j = i * 256 * 4 + 255 * 4; - texData4[j+0] = 255; - texData4[j+1] = 255; - texData4[j+2] = 255; - texData4[j+3] = 0; - } - - ActiveTexture(GL_TEXTURE0_ARB + tex); - glBindTexture(GL_TEXTURE_2D, tex + 1); - - glPixelStorei(GL_UNPACK_ALIGNMENT, 1); - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 256, 256, 0, - GL_RGBA, GL_UNSIGNED_BYTE, texData4); - - if (linearFilter) { - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - } else { - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - } - glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_BORDER_COLOR, borderColor); - } -} - -/* Create a simple spotlight pattern and make it the current texture */ -void -loadSpotlightTexture(void) -{ - static int texWidth = 64, texHeight = 64; - static GLubyte *texData; - GLfloat borderColor[4] = - {0.1, 0.1, 0.1, 1.0}; - - if (!texData) { - GLubyte *p; - int i, j; - - texData = (GLubyte *) malloc(texWidth * texHeight * 4 * sizeof(GLubyte)); - - p = texData; - for (j = 0; j < texHeight; ++j) { - float dy = (texHeight * 0.5 - j + 0.5) / (texHeight * 0.5); - - for (i = 0; i < texWidth; ++i) { - float dx = (texWidth * 0.5 - i + 0.5) / (texWidth * 0.5); - float r = cos(M_PI / 2.0 * sqrt(dx * dx + dy * dy)); - float c; - - r = (r < 0) ? 0 : r * r; - c = 0xff * (r + borderColor[0]); - p[0] = (c <= 0xff) ? c : 0xff; - c = 0xff * (r + borderColor[1]); - p[1] = (c <= 0xff) ? c : 0xff; - c = 0xff * (r + borderColor[2]); - p[2] = (c <= 0xff) ? c : 0xff; - c = 0xff * (r + borderColor[3]); - p[3] = (c <= 0xff) ? c : 0xff; - p += 4; - } - } - } - if (linearFilter) { - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - } else { - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - } - glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_BORDER_COLOR, borderColor); - gluBuild2DMipmaps(GL_TEXTURE_2D, 4, texWidth, texHeight, - GL_RGBA, GL_UNSIGNED_BYTE, texData); -} - -/*****************************************************************/ - -void -checkErrors(void) -{ - GLenum error; - while ((error = glGetError()) != GL_NO_ERROR) { - fprintf(stderr, "Error: %s\n", (char *) gluErrorString(error)); - } -} - -void -drawCube(void) -{ - glBegin(GL_QUADS); - - glNormal3f(-1.0, 0.0, 0.0); - glColor3f(0.80, 0.50, 0.50); - glVertex3f(-0.5, -0.5, -0.5); - glVertex3f(-0.5, -0.5, 0.5); - glVertex3f(-0.5, 0.5, 0.5); - glVertex3f(-0.5, 0.5, -0.5); - - glNormal3f(1.0, 0.0, 0.0); - glColor3f(0.50, 0.80, 0.50); - glVertex3f(0.5, 0.5, 0.5); - glVertex3f(0.5, -0.5, 0.5); - glVertex3f(0.5, -0.5, -0.5); - glVertex3f(0.5, 0.5, -0.5); - - glNormal3f(0.0, -1.0, 0.0); - glColor3f(0.50, 0.50, 0.80); - glVertex3f(-0.5, -0.5, -0.5); - glVertex3f(0.5, -0.5, -0.5); - glVertex3f(0.5, -0.5, 0.5); - glVertex3f(-0.5, -0.5, 0.5); - - glNormal3f(0.0, 1.0, 0.0); - glColor3f(0.50, 0.80, 0.80); - glVertex3f(0.5, 0.5, 0.5); - glVertex3f(0.5, 0.5, -0.5); - glVertex3f(-0.5, 0.5, -0.5); - glVertex3f(-0.5, 0.5, 0.5); - - glNormal3f(0.0, 0.0, -1.0); - glColor3f(0.80, 0.50, 0.80); - glVertex3f(-0.5, -0.5, -0.5); - glVertex3f(-0.5, 0.5, -0.5); - glVertex3f(0.5, 0.5, -0.5); - glVertex3f(0.5, -0.5, -0.5); - - glNormal3f(0.0, 0.0, 1.0); - glColor3f(1.00, 0.80, 0.50); - glVertex3f(0.5, 0.5, 0.5); - glVertex3f(-0.5, 0.5, 0.5); - glVertex3f(-0.5, -0.5, 0.5); - glVertex3f(0.5, -0.5, 0.5); - glEnd(); -} - -void -drawDodecahedron(void) -{ -#define A (0.5 * 1.61803) /* (sqrt(5) + 1) / 2 */ -#define B (0.5 * 0.61803) /* (sqrt(5) - 1) / 2 */ -#define C (0.5 * 1.0) - GLfloat vertexes[20][3] = - { - {-A, 0.0, B}, - {-A, 0.0, -B}, - {A, 0.0, -B}, - {A, 0.0, B}, - {B, -A, 0.0}, - {-B, -A, 0.0}, - {-B, A, 0.0}, - {B, A, 0.0}, - {0.0, B, -A}, - {0.0, -B, -A}, - {0.0, -B, A}, - {0.0, B, A}, - {-C, -C, C}, - {-C, -C, -C}, - {C, -C, -C}, - {C, -C, C}, - {-C, C, C}, - {-C, C, -C}, - {C, C, -C}, - {C, C, C}, - }; -#undef A -#undef B -#undef C - GLint polygons[12][5] = - { - {0, 12, 10, 11, 16}, - {1, 17, 8, 9, 13}, - {2, 14, 9, 8, 18}, - {3, 19, 11, 10, 15}, - {4, 14, 2, 3, 15}, - {5, 12, 0, 1, 13}, - {6, 17, 1, 0, 16}, - {7, 19, 3, 2, 18}, - {8, 17, 6, 7, 18}, - {9, 14, 4, 5, 13}, - {10, 12, 5, 4, 15}, - {11, 19, 7, 6, 16}, - }; - int i; - - glColor3f(0.75, 0.75, 0.75); - for (i = 0; i < 12; ++i) { - GLfloat *p0, *p1, *p2, d; - GLfloat u[3], v[3], n[3]; - - p0 = &vertexes[polygons[i][0]][0]; - p1 = &vertexes[polygons[i][1]][0]; - p2 = &vertexes[polygons[i][2]][0]; - - u[0] = p2[0] - p1[0]; - u[1] = p2[1] - p1[1]; - u[2] = p2[2] - p1[2]; - - v[0] = p0[0] - p1[0]; - v[1] = p0[1] - p1[1]; - v[2] = p0[2] - p1[2]; - - n[0] = u[1] * v[2] - u[2] * v[1]; - n[1] = u[2] * v[0] - u[0] * v[2]; - n[2] = u[0] * v[1] - u[1] * v[0]; - - d = 1.0 / sqrt(n[0] * n[0] + n[1] * n[1] + n[2] * n[2]); - n[0] *= d; - n[1] *= d; - n[2] *= d; - - glBegin(GL_POLYGON); - glNormal3fv(n); - glVertex3fv(p0); - glVertex3fv(p1); - glVertex3fv(p2); - glVertex3fv(vertexes[polygons[i][3]]); - glVertex3fv(vertexes[polygons[i][4]]); - glEnd(); - } -} - -void -drawSphere(void) -{ - int numMajor = 24; - int numMinor = 32; - float radius = 0.8; - double majorStep = (M_PI / numMajor); - double minorStep = (2.0 * M_PI / numMinor); - int i, j; - - glColor3f(0.50, 0.50, 0.50); - for (i = 0; i < numMajor; ++i) { - double a = i * majorStep; - double b = a + majorStep; - double r0 = radius * sin(a); - double r1 = radius * sin(b); - GLfloat z0 = radius * cos(a); - GLfloat z1 = radius * cos(b); - - glBegin(GL_TRIANGLE_STRIP); - for (j = 0; j <= numMinor; ++j) { - double c = j * minorStep; - GLfloat x = cos(c); - GLfloat y = sin(c); - - glNormal3f((x * r0) / radius, (y * r0) / radius, z0 / radius); - glTexCoord2f(j / (GLfloat) numMinor, i / (GLfloat) numMajor); - glVertex3f(x * r0, y * r0, z0); - - glNormal3f((x * r1) / radius, (y * r1) / radius, z1 / radius); - glTexCoord2f(j / (GLfloat) numMinor, (i + 1) / (GLfloat) numMajor); - glVertex3f(x * r1, y * r1, z1); - } - glEnd(); - } -} - -/*****************************************************************/ - -float xmin = -0.035, xmax = 0.035; -float ymin = -0.035, ymax = 0.035; -float nnear = 0.1; -float ffar = 1.9; -float distance = -1.0; - -static void -loadTextureProjection(int texUnit, GLfloat m[16]) -{ - GLfloat mInverse[4][4]; - - /* Should use true inverse, but since m consists only of rotations, we can - just use the transpose. */ - matrixTranspose((GLfloat *) mInverse, m); - - ActiveTexture(GL_TEXTURE0_ARB + texUnit); - glMatrixMode(GL_TEXTURE); - glLoadIdentity(); - glTranslatef(0.5, 0.5, 0.0); - glScalef(0.5, 0.5, 1.0); - glFrustum(xmin, xmax, ymin, ymax, nnear, ffar); - glTranslatef(0.0, 0.0, distance); - glMultMatrixf((GLfloat *) mInverse); - glMatrixMode(GL_MODELVIEW); -} - -static void -drawTextureProjection(void) -{ - float t = ffar / nnear; - GLfloat n[4][3]; - GLfloat f[4][3]; - - n[0][0] = xmin; - n[0][1] = ymin; - n[0][2] = -(nnear + distance); - - n[1][0] = xmax; - n[1][1] = ymin; - n[1][2] = -(nnear + distance); - - n[2][0] = xmax; - n[2][1] = ymax; - n[2][2] = -(nnear + distance); - - n[3][0] = xmin; - n[3][1] = ymax; - n[3][2] = -(nnear + distance); - - f[0][0] = xmin * t; - f[0][1] = ymin * t; - f[0][2] = -(ffar + distance); - - f[1][0] = xmax * t; - f[1][1] = ymin * t; - f[1][2] = -(ffar + distance); - - f[2][0] = xmax * t; - f[2][1] = ymax * t; - f[2][2] = -(ffar + distance); - - f[3][0] = xmin * t; - f[3][1] = ymax * t; - f[3][2] = -(ffar + distance); - - glColor3f(1.0, 1.0, 0.0); - glBegin(GL_LINE_LOOP); - glVertex3fv(n[0]); - glVertex3fv(n[1]); - glVertex3fv(n[2]); - glVertex3fv(n[3]); - glVertex3fv(f[3]); - glVertex3fv(f[2]); - glVertex3fv(f[1]); - glVertex3fv(f[0]); - glVertex3fv(n[0]); - glVertex3fv(n[1]); - glVertex3fv(f[1]); - glVertex3fv(f[0]); - glVertex3fv(f[3]); - glVertex3fv(f[2]); - glVertex3fv(n[2]); - glVertex3fv(n[3]); - glEnd(); -} - -/*****************************************************************/ - -void -initialize(void) -{ - GLfloat light0Pos[4] = - {0.3, 0.3, 0.0, 1.0}; - GLfloat matAmb[4] = - {0.01, 0.01, 0.01, 1.00}; - GLfloat matDiff[4] = - {0.65, 0.65, 0.65, 1.00}; - GLfloat matSpec[4] = - {0.30, 0.30, 0.30, 1.00}; - GLfloat matShine = 10.0; - GLfloat eyePlaneS[] = - {1.0, 0.0, 0.0, 0.0}; - GLfloat eyePlaneT[] = - {0.0, 1.0, 0.0, 0.0}; - GLfloat eyePlaneR[] = - {0.0, 0.0, 1.0, 0.0}; - GLfloat eyePlaneQ[] = - {0.0, 0.0, 0.0, 1.0}; - int i; - - /* Setup Misc. */ - glClearColor(0.41, 0.41, 0.31, 0.0); - - glEnable(GL_DEPTH_TEST); - - /* glLineWidth(2.0);*/ - - glCullFace(GL_FRONT); - glEnable(GL_CULL_FACE); - - glMatrixMode(GL_PROJECTION); - glFrustum(-0.5, 0.5, -0.5, 0.5, 1, 3); - glMatrixMode(GL_MODELVIEW); - glTranslatef(0, 0, -2); - - matrixIdentity((GLfloat *) objectXform); - for (i = 0; i < NumTextures; i++) { - matrixIdentity((GLfloat *) textureXform[i]); - } - - glMatrixMode(GL_PROJECTION); - glPushMatrix(); - glLoadIdentity(); - glOrtho(0, 1, 0, 1, -1, 1); - glMatrixMode(GL_MODELVIEW); - glPushMatrix(); - glLoadIdentity(); - - glRasterPos2i(0, 0); - - glPopMatrix(); - glMatrixMode(GL_PROJECTION); - glPopMatrix(); - glMatrixMode(GL_MODELVIEW); - - /* Setup Lighting */ - glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, matAmb); - glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, matDiff); - glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, matSpec); - glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, matShine); - - glEnable(GL_COLOR_MATERIAL); - - glLightfv(GL_LIGHT0, GL_POSITION, light0Pos); - glEnable(GL_LIGHT0); - - glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, GL_TRUE); - glEnable(GL_LIGHTING); - - /* Setup Texture */ - - (*loadTexture) (); - - - for (i = 0; i < NumTextures; i++) { - ActiveTexture(GL_TEXTURE0_ARB + i); - - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP); - glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); - - glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR); - glTexGenfv(GL_S, GL_EYE_PLANE, eyePlaneS); - - glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR); - glTexGenfv(GL_T, GL_EYE_PLANE, eyePlaneT); - - glTexGeni(GL_R, GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR); - glTexGenfv(GL_R, GL_EYE_PLANE, eyePlaneR); - - glTexGeni(GL_Q, GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR); - glTexGenfv(GL_Q, GL_EYE_PLANE, eyePlaneQ); - } -} - -void -display(void) -{ - int i; - - glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); - - if (textureEnabled) { - if (mode == MoveTexture || mode == MoveView) { - /* Have OpenGL compute the new transformation (simple but slow). */ - for (i = 0; i < NumTextures; i++) { - glPushMatrix(); - glLoadIdentity(); -#if 0 - if (i & 1) - glRotatef(angle, axis[0], axis[1], axis[2]); - else -#endif - glRotatef(angle*(i+1), axis[0], axis[1], axis[2]); - - glMultMatrixf((GLfloat *) textureXform[i]); - glGetFloatv(GL_MODELVIEW_MATRIX, (GLfloat *) textureXform[i]); - glPopMatrix(); - } - } - for (i = 0; i < NumTextures; i++) { - loadTextureProjection(i, (GLfloat *) textureXform[i]); - } - - if (showProjection) { - for (i = 0; i < NumTextures; i++) { - ActiveTexture(GL_TEXTURE0_ARB + i); - glPushMatrix(); - glMultMatrixf((GLfloat *) textureXform[i]); - glDisable(GL_LIGHTING); - drawTextureProjection(); - glEnable(GL_LIGHTING); - glPopMatrix(); - } - } - for (i = 0; i < NumTextures; i++) { - ActiveTexture(GL_TEXTURE0_ARB + i); - glEnable(GL_TEXTURE_2D); - glEnable(GL_TEXTURE_GEN_S); - glEnable(GL_TEXTURE_GEN_T); - glEnable(GL_TEXTURE_GEN_R); - glEnable(GL_TEXTURE_GEN_Q); - } - } - if (mode == MoveObject || mode == MoveView) { - /* Have OpenGL compute the new transformation (simple but slow). */ - glPushMatrix(); - glLoadIdentity(); - glRotatef(angle, axis[0], axis[1], axis[2]); - glMultMatrixf((GLfloat *) objectXform); - glGetFloatv(GL_MODELVIEW_MATRIX, (GLfloat *) objectXform); - glPopMatrix(); - } - glPushMatrix(); - glMultMatrixf((GLfloat *) objectXform); - (*drawObject) (); - glPopMatrix(); - - for (i = 0; i < NumTextures; i++) { - ActiveTexture(GL_TEXTURE0_ARB + i); - glDisable(GL_TEXTURE_2D); - glDisable(GL_TEXTURE_GEN_S); - glDisable(GL_TEXTURE_GEN_T); - glDisable(GL_TEXTURE_GEN_R); - glDisable(GL_TEXTURE_GEN_Q); - } - - if (zoomFactor > 1.0) { - glDisable(GL_DEPTH_TEST); - glCopyPixels(0, 0, winWidth / zoomFactor, winHeight / zoomFactor, GL_COLOR); - glEnable(GL_DEPTH_TEST); - } - glFlush(); - glutSwapBuffers(); - checkErrors(); -} - -/*****************************************************************/ - -/* simple trackball-like motion control */ -float lastPos[3]; -int lastTime; - -void -ptov(int x, int y, int width, int height, float v[3]) -{ - float d, a; - - /* project x,y onto a hemi-sphere centered within width, height */ - v[0] = (2.0 * x - width) / width; - v[1] = (height - 2.0 * y) / height; - d = sqrt(v[0] * v[0] + v[1] * v[1]); - v[2] = cos((M_PI / 2.0) * ((d < 1.0) ? d : 1.0)); - a = 1.0 / sqrt(v[0] * v[0] + v[1] * v[1] + v[2] * v[2]); - v[0] *= a; - v[1] *= a; - v[2] *= a; -} - -void -startMotion(int x, int y, int but, int time) -{ - if (but == GLUT_LEFT_BUTTON) { - mode = MoveView; - } else if (but == GLUT_MIDDLE_BUTTON) { - mode = MoveTexture; - } else { - return; - } - - lastTime = time; - ptov(x, y, winWidth, winHeight, lastPos); -} - -void -animate(void) -{ - glutPostRedisplay(); -} - -void -vis(int visible) -{ - if (visible == GLUT_VISIBLE) { - if (redrawContinuously) - glutIdleFunc(animate); - } else { - if (redrawContinuously) - glutIdleFunc(NULL); - } -} - -void -stopMotion(int but, int time) -{ - if ((but == GLUT_LEFT_BUTTON && mode == MoveView) || - (but == GLUT_MIDDLE_BUTTON && mode == MoveTexture)) { - } else { - return; - } - - if (time == lastTime) { - /* redrawContinuously = GL_TRUE;*/ - glutIdleFunc(animate); - } else { - angle = 0.0; - redrawContinuously = GL_FALSE; - glutIdleFunc(0); - } - if (!redrawContinuously) { - mode = MoveNone; - } -} - -void -trackMotion(int x, int y) -{ - float curPos[3], dx, dy, dz; - - ptov(x, y, winWidth, winHeight, curPos); - - dx = curPos[0] - lastPos[0]; - dy = curPos[1] - lastPos[1]; - dz = curPos[2] - lastPos[2]; - angle = 90.0 * sqrt(dx * dx + dy * dy + dz * dz); - - axis[0] = lastPos[1] * curPos[2] - lastPos[2] * curPos[1]; - axis[1] = lastPos[2] * curPos[0] - lastPos[0] * curPos[2]; - axis[2] = lastPos[0] * curPos[1] - lastPos[1] * curPos[0]; - - lastTime = glutGet(GLUT_ELAPSED_TIME); - lastPos[0] = curPos[0]; - lastPos[1] = curPos[1]; - lastPos[2] = curPos[2]; - glutPostRedisplay(); -} - -/*****************************************************************/ - -void -object(void) -{ - static int object; - - object++; - object %= 3; - switch (object) { - case 0: - drawObject = drawCube; - break; - case 1: - drawObject = drawDodecahedron; - break; - case 2: - drawObject = drawSphere; - break; - default: - break; - } -} - -static void -nop(void) -{ -} - -void -texture(void) -{ - static int texture = 0; - - texture++; - texture %= 3; - if (texture == 1 && texFilename == NULL) { - /* Skip file texture if not loaded. */ - texture++; - } - switch (texture) { - case 0: - loadTexture = nop; - textureEnabled = GL_FALSE; - break; - case 1: - loadTexture = loadImageTextures; - (*loadTexture) (); - textureEnabled = GL_TRUE; - break; - case 2: - loadTexture = loadSpotlightTexture; - (*loadTexture) (); - textureEnabled = GL_TRUE; - break; - default: - break; - } -} - -void -help(void) -{ - printf("'h' - help\n"); - printf("'l' - toggle linear/nearest filter\n"); - printf("'s' - toggle projection frustum\n"); - printf("'t' - toggle projected texture\n"); - printf("'o' - toggle object\n"); - printf("'z' - increase zoom factor\n"); - printf("'Z' - decrease zoom factor\n"); - printf("left mouse - move view\n"); - printf("middle mouse - move projection\n"); -} - -/* ARGSUSED1 */ -void -key(unsigned char key, int x, int y) -{ - switch (key) { - case '\033': - exit(0); - break; - case 'l': - linearFilter = !linearFilter; - (*loadTexture) (); - break; - case 's': - showProjection = !showProjection; - break; - case 't': - texture(); - break; - case 'o': - object(); - break; - case 'z': - zoomFactor += 1.0; - glPixelZoom(zoomFactor, zoomFactor); - glViewport(0, 0, winWidth / zoomFactor, winHeight / zoomFactor); - break; - case 'Z': - zoomFactor -= 1.0; - if (zoomFactor < 1.0) - zoomFactor = 1.0; - glPixelZoom(zoomFactor, zoomFactor); - glViewport(0, 0, winWidth / zoomFactor, winHeight / zoomFactor); - break; - case 'h': - help(); - break; - } - glutPostRedisplay(); -} - -void -mouse(int button, int state, int x, int y) -{ - if (state == GLUT_DOWN) - startMotion(x, y, button, glutGet(GLUT_ELAPSED_TIME)); - else if (state == GLUT_UP) - stopMotion(button, glutGet(GLUT_ELAPSED_TIME)); - glutPostRedisplay(); -} - -void -reshape(int w, int h) -{ - winWidth = w; - winHeight = h; - glViewport(0, 0, w / zoomFactor, h / zoomFactor); -} - - -void -menu(int selection) -{ - if (selection == 666) { - exit(0); - } - key((unsigned char) selection, 0, 0); -} - -int -main(int argc, char **argv) -{ - glutInit(&argc, argv); - - if (argc > 1) { - NumTextures = atoi(argv[1]); - } - assert(NumTextures <= MAX_TEX); - - glutInitDisplayMode(GLUT_RGBA | GLUT_DEPTH | GLUT_DOUBLE); - (void) glutCreateWindow("projtex"); - - loadTexture = loadImageTextures; - drawObject = drawCube; - initialize(); - glutDisplayFunc(display); - glutKeyboardFunc(key); - glutReshapeFunc(reshape); - glutMouseFunc(mouse); - glutMotionFunc(trackMotion); - glutVisibilityFunc(vis); - glutCreateMenu(menu); - glutAddMenuEntry("Toggle showing projection", 's'); - glutAddMenuEntry("Switch texture", 't'); - glutAddMenuEntry("Switch object", 'o'); - glutAddMenuEntry("Toggle filtering", 'l'); - glutAddMenuEntry("Quit", 666); - glutAttachMenu(GLUT_RIGHT_BUTTON); - texture(); - glutMainLoop(); - return 0; /* ANSI C requires main to return int. */ -} diff --git a/progs/tests/random.c b/progs/tests/random.c deleted file mode 100644 index d52c338e0e..0000000000 --- a/progs/tests/random.c +++ /dev/null @@ -1,457 +0,0 @@ -/** - * Random rendering, to check for crashes, hangs, etc. - * - * Brian Paul - * 21 June 2007 - */ - -#define GL_GLEXT_PROTOTYPES - -#include -#include -#include -#include -#include -#include - -static int Win; -static GLboolean Anim = GL_TRUE; -static int Width = 200, Height = 200; -static int DB = 0; -static int MinVertexCount = 0, MaxVertexCount = 1000; -static int Count = 0; - -struct vertex -{ - int type; - float v[4]; -}; - -static int BufferSize = 10000; -static struct vertex *Vbuffer = NULL; -static int Vcount, Vprim; - -enum { - BEGIN, - END, - VERTEX2, - VERTEX3, - VERTEX4, - COLOR3, - COLOR4, - TEX2, - TEX3, - TEX4, - SECCOLOR3, - NORMAL3 -}; - - - -/** - * This can be called from within gdb after a crash: - * (gdb) call ReportState() - */ -static void -ReportState(void) -{ - static const struct { - GLenum token; - char *str; - GLenum type; - } state [] = { - { GL_ALPHA_TEST, "GL_ALPHA_TEST", GL_INT }, - { GL_BLEND, "GL_BLEND", GL_INT }, - { GL_CLIP_PLANE0, "GL_CLIP_PLANE0", GL_INT }, - { GL_DEPTH_TEST, "GL_DEPTH_TEST", GL_INT }, - { GL_LIGHTING, "GL_LIGHTING", GL_INT }, - { GL_LINE_WIDTH, "GL_LINE_WIDTH", GL_FLOAT }, - { GL_POINT_SIZE, "GL_POINT_SIZE", GL_FLOAT }, - { GL_SHADE_MODEL, "GL_SHADE_MODEL", GL_INT }, - { GL_SCISSOR_TEST, "GL_SCISSOR_TEST", GL_INT }, - { 0, NULL, 0 } - }; - - GLint i; - - for (i = 0; state[i].token; i++) { - if (state[i].type == GL_INT) { - GLint v; - glGetIntegerv(state[i].token, &v); - printf("%s = %d\n", state[i].str, v); - } - else { - GLfloat v; - glGetFloatv(state[i].token, &v); - printf("%s = %f\n", state[i].str, v); - } - } -} - -static void -PrintVertex(const char *f, const struct vertex *v, int sz) -{ - int i; - printf("%s(", f); - for (i = 0; i < sz; i++) { - printf("%g%s", v->v[i], (i == sz-1) ? "" : ", "); - } - printf(");\n"); -} - -/** - * This can be called from within gdb after a crash: - * (gdb) call ReportState() - */ -static void -LastPrim(void) -{ - int i; - for (i = 0; i < Vcount; i++) { - switch (Vbuffer[i].type) { - case BEGIN: - printf("glBegin(%d);\n", (int) Vbuffer[i].v[0]); - break; - case END: - printf("glEnd();\n"); - break; - case VERTEX2: - PrintVertex("glVertex2f", Vbuffer + i, 2); - break; - case VERTEX3: - PrintVertex("glVertex3f", Vbuffer + i, 3); - break; - case VERTEX4: - PrintVertex("glVertex4f", Vbuffer + i, 4); - break; - case COLOR3: - PrintVertex("glColor3f", Vbuffer + i, 3); - break; - case COLOR4: - PrintVertex("glColor4f", Vbuffer + i, 4); - break; - case TEX2: - PrintVertex("glTexCoord2f", Vbuffer + i, 2); - break; - case TEX3: - PrintVertex("glTexCoord3f", Vbuffer + i, 3); - break; - case TEX4: - PrintVertex("glTexCoord4f", Vbuffer + i, 4); - break; - case SECCOLOR3: - PrintVertex("glSecondaryColor3f", Vbuffer + i, 3); - break; - case NORMAL3: - PrintVertex("glNormal3f", Vbuffer + i, 3); - break; - default: - abort(); - } - } -} - - -static int -RandomInt(int max) -{ - if (max == 0) - return 0; - return rand() % max; -} - -static float -RandomFloat(float min, float max) -{ - int k = rand() % 10000; - float x = min + (max - min) * k / 10000.0; - return x; -} - -/* - * Return true if random number in [0,1] is <= percentile. - */ -static GLboolean -RandomChoice(float percentile) -{ - return RandomFloat(0.0, 1.0) <= percentile; -} - -static void -RandomStateChange(void) -{ - int k = RandomInt(19); - switch (k) { - case 0: - glEnable(GL_BLEND); - break; - case 1: - glDisable(GL_BLEND); - break; - case 2: - glEnable(GL_ALPHA_TEST); - break; - case 3: - glEnable(GL_ALPHA_TEST); - break; - case 4: - glEnable(GL_DEPTH_TEST); - break; - case 5: - glEnable(GL_DEPTH_TEST); - break; - case 6: - glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); - break; - case 7: - glPointSize(10.0); - break; - case 8: - glPointSize(1.0); - break; - case 9: - glLineWidth(10.0); - break; - case 10: - glLineWidth(1.0); - break; - case 11: - glEnable(GL_LIGHTING); - break; - case 12: - glDisable(GL_LIGHTING); - break; - case 13: - glEnable(GL_SCISSOR_TEST); - break; - case 14: - glDisable(GL_SCISSOR_TEST); - break; - case 15: - glEnable(GL_CLIP_PLANE0); - break; - case 16: - glDisable(GL_CLIP_PLANE0); - break; - case 17: - glShadeModel(GL_FLAT); - break; - case 18: - glShadeModel(GL_SMOOTH); - break; - } -} - - -static void -RandomPrimitive(void) -{ - int i; - int len = MinVertexCount + RandomInt(MaxVertexCount - MinVertexCount); - - Vprim = RandomInt(10); - - glBegin(Vprim); - Vbuffer[Vcount].type = BEGIN; - Vbuffer[Vcount].v[0] = Vprim; - Vcount++; - - for (i = 0; i < len; i++) { - Vbuffer[Vcount].v[0] = RandomFloat(-3, 3); - Vbuffer[Vcount].v[1] = RandomFloat(-3, 3); - Vbuffer[Vcount].v[2] = RandomFloat(-3, 3); - Vbuffer[Vcount].v[3] = RandomFloat(-3, 3); - int k = RandomInt(9); - switch (k) { - case 0: - glVertex2fv(Vbuffer[Vcount].v); - Vbuffer[Vcount].type = VERTEX2; - break; - case 1: - glVertex3fv(Vbuffer[Vcount].v); - Vbuffer[Vcount].type = VERTEX3; - break; - case 2: - glVertex4fv(Vbuffer[Vcount].v); - Vbuffer[Vcount].type = VERTEX4; - break; - case 3: - glColor3fv(Vbuffer[Vcount].v); - Vbuffer[Vcount].type = COLOR3; - break; - case 4: - glColor4fv(Vbuffer[Vcount].v); - Vbuffer[Vcount].type = COLOR4; - break; - case 5: - glTexCoord2fv(Vbuffer[Vcount].v); - Vbuffer[Vcount].type = TEX2; - break; - case 6: - glTexCoord3fv(Vbuffer[Vcount].v); - Vbuffer[Vcount].type = TEX3; - break; - case 7: - glTexCoord4fv(Vbuffer[Vcount].v); - Vbuffer[Vcount].type = TEX4; - break; - case 8: - glSecondaryColor3fv(Vbuffer[Vcount].v); - Vbuffer[Vcount].type = SECCOLOR3; - break; - case 9: - glNormal3fv(Vbuffer[Vcount].v); - Vbuffer[Vcount].type = NORMAL3; - break; - default: - abort(); - } - Vcount++; - - if (Vcount >= BufferSize - 2) { - /* reset */ - Vcount = 0; - } - } - - Vbuffer[Vcount++].type = END; - - glEnd(); -} - - -static void -RandomDraw(void) -{ - int i; - GLboolean dlist = RandomChoice(0.1); - if (dlist) - glNewList(1, GL_COMPILE); - for (i = 0; i < 3; i++) { - RandomStateChange(); - } - RandomPrimitive(); - - if (dlist) { - glEndList(); - glCallList(1); - } -} - - -static void -Idle(void) -{ - glutPostRedisplay(); -} - - -static void -Draw(void) -{ -#if 1 - RandomDraw(); - Count++; -#else - /* cut & paste temp code here */ -#endif - - assert(glGetError() == 0); - - if (DB) - glutSwapBuffers(); - else - glFinish(); -} - - -static void -Reshape(int width, int height) -{ - Width = width; - Height = height; - glViewport(0, 0, width, height); - glScissor(20, 20, Width-40, Height-40); - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glFrustum(-1.0, 1.0, -1.0, 1.0, 5.0, 25.0); - glMatrixMode(GL_MODELVIEW); - glLoadIdentity(); - glTranslatef(0.0, 0.0, -15.0); -} - - -static void -Key(unsigned char key, int x, int y) -{ - (void) x; - (void) y; - switch (key) { - case 27: - glutDestroyWindow(Win); - exit(0); - break; - } - glutPostRedisplay(); -} - - -static void -Init(void) -{ - static const GLdouble plane[4] = {1, 1, 0, 0}; - glDrawBuffer(GL_FRONT); - glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); - glEnable(GL_LIGHT0); - glClipPlane(GL_CLIP_PLANE0, plane); - - Vbuffer = (struct vertex *) - malloc(BufferSize * sizeof(struct vertex)); - - /* silence warnings */ - (void) ReportState; - (void) LastPrim; -} - - -static void -ParseArgs(int argc, char *argv[]) -{ - int i; - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-s") == 0) { - int j = atoi(argv[i + 1]); - printf("Random seed value: %d\n", j); - srand(j); - i++; - } - else if (strcmp(argv[i], "-a") == 0) { - i++; - MinVertexCount = atoi(argv[i]); - } - else if (strcmp(argv[i], "-b") == 0) { - i++; - MaxVertexCount = atoi(argv[i]); - } - } -} - - -int -main(int argc, char *argv[]) -{ - glutInit(&argc, argv); - glutInitWindowPosition(0, 0); - glutInitWindowSize(Width, Height); - glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH); - Win = glutCreateWindow(argv[0]); - ParseArgs(argc, argv); - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - if (Anim) - glutIdleFunc(Idle); - Init(); - glutMainLoop(); - return 0; -} diff --git a/progs/tests/readrate.c b/progs/tests/readrate.c deleted file mode 100644 index 42ae62d48a..0000000000 --- a/progs/tests/readrate.c +++ /dev/null @@ -1,285 +0,0 @@ -/* - * Test glReadPixels speed - * Brian Paul - * 9 April 2004 - * - * Compile: - * gcc readrate.c -L/usr/X11R6/lib -lglut -lGLU -lGL -lX11 -o readrate - */ - -#define GL_GLEXT_PROTOTYPES -#include -#include -#include -#include -#include - -/* Hack, to test drawing instead of reading */ -#define DRAW 0 - -#define MAX_WIDTH 1280 -#define MAX_HEIGHT 1024 - -#define NUM_WIDTHS 4 -#define NUM_HEIGHTS 4 -static const GLint Widths[] = {256, 512, 1024, 1280}; -static const GLint Heights[] = {4, 32, 256, 512, 768, 1024}; -static int WidthIndex = 1, HeightIndex = 3; -static GLubyte *Buffer = NULL; -static GLboolean Benchmark = GL_TRUE; - -#define NUM_PBO 2 - -static GLuint PBObjects[4]; - -static GLboolean HavePBO = GL_FALSE; - - -struct format_type { - const char *Name; - GLuint Bytes; - GLenum Format; - GLenum Type; -}; - -static struct format_type Formats[] = { - { "GL_RGB, GLubyte", 3, GL_RGB, GL_UNSIGNED_BYTE }, - { "GL_BGR, GLubyte", 3, GL_BGR, GL_UNSIGNED_BYTE }, - { "GL_RGBA, GLubyte", 4, GL_RGBA, GL_UNSIGNED_BYTE }, - { "GL_BGRA, GLubyte", 4, GL_BGRA, GL_UNSIGNED_BYTE }, - { "GL_ABGR, GLubyte", 4, GL_ABGR_EXT, GL_UNSIGNED_BYTE }, - { "GL_RGBA, GLuint_8_8_8_8", 4, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8 }, - { "GL_BGRA, GLuint_8_8_8_8", 4, GL_BGRA_EXT, GL_UNSIGNED_INT_8_8_8_8 }, - { "GL_BGRA, GLuint_8_8_8_8_rev", 4, GL_BGRA_EXT, GL_UNSIGNED_INT_8_8_8_8_REV }, -#ifdef GL_EXT_packed_depth_stencil - { "GL_DEPTH_STENCIL_EXT, GLuint24+8", 4, GL_DEPTH_STENCIL_EXT, GL_UNSIGNED_INT_24_8_EXT }, -#endif - { "GL_DEPTH_COMPONENT, GLfloat", 4, GL_DEPTH_COMPONENT, GL_FLOAT }, - { "GL_DEPTH_COMPONENT, GLuint", 4, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT } -}; - -#define NUM_FORMATS (sizeof(Formats) / sizeof(struct format_type)) - - -static void -PrintString(const char *s) -{ - while (*s) { - glutBitmapCharacter(GLUT_BITMAP_8_BY_13, (int) *s); - s++; - } -} - - -static void -MeasureFormat(struct format_type *fmt, GLint width, GLint height, GLuint pbo) -{ - double t0 = glutGet(GLUT_ELAPSED_TIME) * 0.001; - double t1; - int j; - - for (j = 0; ; j++) { - - glBegin(GL_POINTS); - glVertex2f(1,1); - glEnd(); - -#if DRAW - glWindowPos2iARB(0,0); - glDrawPixels(width, height, - fmt->Format, fmt->Type, Buffer); - glFinish(); -#else - if (pbo) { - glBindBufferARB(GL_PIXEL_PACK_BUFFER_EXT, PBObjects[j % NUM_PBO]); - glReadPixels(0, 0, width, height, - fmt->Format, fmt->Type, 0); - } - else { - glReadPixels(0, 0, width, height, - fmt->Format, fmt->Type, Buffer); - } -#endif - - t1 = glutGet(GLUT_ELAPSED_TIME) * 0.001; - if (t1 - t0 > 2.0) { - GLdouble rate = width * height / (1024.0 * 1024.0) * j / (t1 - t0); -#if DRAW - printf("%-32s %.2f draws/sec %.2f MPixels/sec %.2f MBytes/sec\n", - fmt->Name, j / (t1-t0), rate, rate * fmt->Bytes); -#else - printf("%-32s %.2f reads/sec %.2f MPixels/sec %.2f MBytes/sec\n", - fmt->Name, j / (t1-t0), rate, rate * fmt->Bytes); -#endif - break; - } - - if (j == 0) { - /* check for error */ - GLenum err = glGetError(); - if (err) { - printf("GL Error 0x%x for %s\n", err, fmt->Name); - return; - } - } - } -} - - - -static void -Draw(void) -{ - char str[1000]; - int width = Widths[WidthIndex]; - int height = Heights[HeightIndex]; - int y = MAX_HEIGHT - 50; - - glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); - - glWindowPos2iARB(10, y); - sprintf(str, "ReadPixels size: %d x %d", width, height); - PrintString(str); - y -= 14; - - glWindowPos2iARB(10, y); - PrintString("Press up/down/left/right to change image size."); - y -= 14; - - glWindowPos2iARB(10, y); - PrintString("Press 'b' to run benchmark test."); - y -= 14; - - if (Benchmark) { - glWindowPos2iARB(10, y); - PrintString("Testing..."); - } - - glutSwapBuffers(); - - if (Benchmark) { - GLuint i, pbo; -#if DRAW - printf("Draw size: Width=%d Height=%d\n", width, height); -#else - printf("Read size: Width=%d Height=%d\n", width, height); -#endif - for (pbo = 0; pbo <= HavePBO; pbo++) { - printf("Pixel Buffer Object: %d\n", pbo); - - if (pbo == 0) { - glBindBufferARB(GL_PIXEL_PACK_BUFFER_EXT, 0); - } - - for (i = 0; i < NUM_FORMATS; i++) { - MeasureFormat(Formats + i, width, height, pbo); - } - } - - Benchmark = GL_FALSE; - - /* redraw window text */ - glutPostRedisplay(); - } - -} - - -static void -Reshape(int width, int height) -{ - glViewport(0, 0, width, height); - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glOrtho(-1, 1, -1, 1, -1, 1); - glMatrixMode(GL_MODELVIEW); - glLoadIdentity(); -} - - -static void -Key(unsigned char key, int x, int y) -{ - (void) x; - (void) y; - switch (key) { - case 'b': - Benchmark = 1; - break; - case 27: - exit(0); - break; - } - glutPostRedisplay(); -} - - -static void -SpecialKey(int key, int x, int y) -{ - (void) x; - (void) y; - switch (key) { - case GLUT_KEY_UP: - if (HeightIndex + 1 < NUM_WIDTHS) - HeightIndex++; - break; - case GLUT_KEY_DOWN: - if (HeightIndex > 0) - HeightIndex--; - break; - case GLUT_KEY_LEFT: - if (WidthIndex > 0) - WidthIndex--; - break; - case GLUT_KEY_RIGHT: - if (WidthIndex + 1 < NUM_HEIGHTS) - WidthIndex++; - break; - } - glutPostRedisplay(); -} - - -static void -Init(void) -{ - Buffer = malloc(MAX_WIDTH * MAX_HEIGHT * 4); - assert(Buffer); -#if DRAW - printf("glDrawPixels test report:\n"); -#else - printf("glReadPixels test report:\n"); -#endif - printf("GL_RENDERER: %s\n", (char *) glGetString(GL_RENDERER)); - printf("GL_VERSION: %s\n", (char *) glGetString(GL_VERSION)); - - if (glutExtensionSupported("GL_ARB_pixel_buffer_object")) { - int i; - HavePBO = 1; - glGenBuffersARB(NUM_PBO, PBObjects); - for (i = 0; i < NUM_PBO; i++) { - glBindBufferARB(GL_PIXEL_PACK_BUFFER_EXT, PBObjects[i]); - glBufferDataARB(GL_PIXEL_PACK_BUFFER_EXT, - MAX_WIDTH * MAX_HEIGHT * 4, NULL, GL_STREAM_READ); - } - } -} - - -int -main(int argc, char *argv[]) -{ - glutInit(&argc, argv); - glutInitWindowPosition(0, 0); - glutInitWindowSize(MAX_WIDTH, MAX_HEIGHT); - glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH | GLUT_STENCIL); - glutCreateWindow(argv[0]); - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutSpecialFunc(SpecialKey); - glutDisplayFunc(Draw); - Init(); - glutMainLoop(); - return 0; -} diff --git a/progs/tests/rubberband.c b/progs/tests/rubberband.c deleted file mode 100644 index a8e64bc091..0000000000 --- a/progs/tests/rubberband.c +++ /dev/null @@ -1,245 +0,0 @@ -/** - * Test rubber-band selection box w/ logicops and blend. - */ - -#define GL_GLEXT_PROTOTYPES -#include -#include -#include -#include -#include "readtex.c" - -#define IMAGE_FILE "../images/arch.rgb" - -static int ImgWidth, ImgHeight; -static GLenum ImgFormat; -static GLubyte *Image = NULL; - -static int Win; -static int Width = 512, Height = 512; - -struct rect -{ - int x0, y0, x1, y1; -}; - -static struct rect OldRect, NewRect; - -static GLboolean ButtonDown = GL_FALSE; -static GLboolean LogicOp = 0*GL_TRUE; - -static GLboolean RedrawBackground = GL_TRUE; - -static const GLfloat red[4] = {1.0, 0.2, 0.2, 1.0}; -static const GLfloat green[4] = {0.2, 1.0, 0.2, 1.0}; -static const GLfloat blue[4] = {0.2, 0.2, 1.0, 1.0}; - - -/* - * Draw rubberband box in front buffer - */ -static void -DrawRect(const struct rect *r) -{ - glDrawBuffer(GL_FRONT); - - if (LogicOp) { - glLogicOp(GL_XOR); - glEnable(GL_COLOR_LOGIC_OP); - } - else { - glEnable(GL_BLEND); - glBlendFunc(GL_ONE, GL_ONE); - glBlendEquation(GL_FUNC_SUBTRACT); - } - - glColor3f(1, 1, 1); - - glLineWidth(3.0); - - glBegin(GL_LINE_LOOP); - glVertex2i(r->x0, r->y0); - glVertex2i(r->x1, r->y0); - glVertex2i(r->x1, r->y1); - glVertex2i(r->x0, r->y1); - glEnd(); - - glDisable(GL_COLOR_LOGIC_OP); - glDisable(GL_BLEND); - - glDrawBuffer(GL_BACK); -} - - -static void -PrintString(const char *s) -{ - while (*s) { - glutBitmapCharacter(GLUT_BITMAP_8_BY_13, (int) *s); - s++; - } -} - - -static void -DrawBackground(void) -{ - char s[100]; - - sprintf(s, "[L/B] %s mode. Use mouse to make selection box.", - LogicOp ? "LogicOp" : "Blend"); - - glClear(GL_COLOR_BUFFER_BIT); - - glWindowPos2i((Width - ImgWidth) / 2, (Height - ImgHeight) / 2); - glDrawPixels(ImgWidth, ImgHeight, ImgFormat, GL_UNSIGNED_BYTE, Image); - - glWindowPos2i(10, 10); - PrintString(s); - - glutSwapBuffers(); -} - - -static void -Draw(void) -{ - if (RedrawBackground) { - DrawBackground(); - } - - if (ButtonDown) { - if (!RedrawBackground) - DrawRect(&OldRect); /* erase old */ - - DrawRect(&NewRect); /* draw new */ - - OldRect = NewRect; - } - - RedrawBackground = GL_FALSE; -} - - -static void -Reshape(int width, int height) -{ - Width = width; - Height = height; - - glViewport(0, 0, width, height); - - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glOrtho(0, Width, Height, 0, -1, 1); /* Inverted Y! */ - - glMatrixMode(GL_MODELVIEW); - glLoadIdentity(); - - RedrawBackground = GL_TRUE; -} - - -static void -Key(unsigned char key, int x, int y) -{ - (void) x; - (void) y; - switch (key) { - case 'b': - case 'B': - LogicOp = GL_FALSE; - break; - case 'l': - case 'L': - LogicOp = GL_TRUE; - break; - case 27: - glutDestroyWindow(Win); - exit(0); - break; - } - RedrawBackground = GL_TRUE; - glutPostRedisplay(); -} - - -static void -SpecialKey(int key, int x, int y) -{ - (void) x; - (void) y; - switch (key) { - case GLUT_KEY_UP: - break; - case GLUT_KEY_DOWN: - break; - case GLUT_KEY_LEFT: - break; - case GLUT_KEY_RIGHT: - break; - } - glutPostRedisplay(); -} - - -static void -MouseMotion(int x, int y) -{ - if (ButtonDown) { - NewRect.x1 = x; - NewRect.y1 = y; - glutPostRedisplay(); - } -} - - -static void -MouseButton(int button, int state, int x, int y) -{ - if (button == GLUT_LEFT_BUTTON && state == GLUT_DOWN) { - ButtonDown = GL_TRUE; - RedrawBackground = GL_TRUE; - NewRect.x0 = NewRect.x1 = x; - NewRect.y0 = NewRect.y1 = y; - OldRect = NewRect; - } - else if (button == GLUT_LEFT_BUTTON && state == GLUT_UP) { - ButtonDown = GL_FALSE; - } - glutPostRedisplay(); -} - - -static void -Init(void) -{ - Image = LoadRGBImage(IMAGE_FILE, &ImgWidth, &ImgHeight, &ImgFormat); - if (!Image) { - printf("Couldn't read %s\n", IMAGE_FILE); - exit(0); - } - - glPixelStorei(GL_UNPACK_ALIGNMENT, 1); - glPixelStorei(GL_PACK_ALIGNMENT, 1); -} - - -int -main(int argc, char *argv[]) -{ - glutInit(&argc, argv); - glutInitWindowSize(Width, Height); - glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE); - Win = glutCreateWindow(argv[0]); - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutSpecialFunc(SpecialKey); - glutMotionFunc(MouseMotion); - glutMouseFunc(MouseButton); - glutDisplayFunc(Draw); - Init(); - glutPostRedisplay(); - glutMainLoop(); - return 0; -} diff --git a/progs/tests/seccolor.c b/progs/tests/seccolor.c deleted file mode 100644 index 77fd40647b..0000000000 --- a/progs/tests/seccolor.c +++ /dev/null @@ -1,145 +0,0 @@ -/* - * Exercise GL_EXT_secondary_color - */ - - -#define GL_GLEXT_PROTOTYPES -#include -#include -#include -#include - -static int Width = 600; -static int Height = 200; -static GLfloat Near = 5.0, Far = 25.0; - - -static void Display( void ) -{ - GLfloat t; - - glClearColor(0.2, 0.2, 0.8, 0); - glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); - - for (t = 0.0; t <= 1.0; t += 0.25) { - GLfloat x = t * 10.0 - 5.0; - GLfloat g = t; - - /* top row: untextured */ - glColor3f(1, 0, 0); - glPushMatrix(); - glTranslatef(x, 1.2, 0); -#if defined(GL_EXT_secondary_color) - glSecondaryColor3fEXT(0, g, 0); -#endif - glBegin(GL_POLYGON); - glVertex2f(-1, -1); - glVertex2f( 1, -1); - glVertex2f( 1, 1); - glVertex2f(-1, 1); - glEnd(); - glPopMatrix(); - - /* bottom row: textured */ - glColor3f(1, 1, 1); - glEnable(GL_TEXTURE_2D); - glPushMatrix(); - glTranslatef(x, -1.2, 0); -#if defined(GL_EXT_secondary_color) - glSecondaryColor3fEXT(0, g, 0); -#endif - glBegin(GL_POLYGON); - glTexCoord2f(0, 0); glVertex2f(-1, -1); - glTexCoord2f(1, 0); glVertex2f( 1, -1); - glTexCoord2f(1, 1); glVertex2f( 1, 1); - glTexCoord2f(0, 1); glVertex2f(-1, 1); - glEnd(); - glPopMatrix(); - glDisable(GL_TEXTURE_2D); - } - glutSwapBuffers(); -} - - -static void Reshape( int width, int height ) -{ - GLfloat ar = (float) width / (float) height; - Width = width; - Height = height; - glViewport( 0, 0, width, height ); - glMatrixMode( GL_PROJECTION ); - glLoadIdentity(); - glFrustum( -ar, ar, -1.0, 1.0, Near, Far ); - glMatrixMode( GL_MODELVIEW ); - glLoadIdentity(); - glTranslatef( 0.0, 0.0, -15.0 ); -} - - -static void Key( unsigned char key, int x, int y ) -{ - (void) x; - (void) y; - switch (key) { - case 27: - exit(0); - break; - } - glutPostRedisplay(); -} - - -static void Init( void ) -{ - GLubyte image[4*4][3]; - GLint i; - if (!glutExtensionSupported("GL_EXT_secondary_color")) { - printf("Sorry, this program requires GL_EXT_secondary_color\n"); - exit(1); - } - - /* setup red texture with one back texel */ - for (i = 0; i < 4*4; i++) { - if (i == 0) { - image[i][0] = 0; - image[i][1] = 0; - image[i][2] = 0; - } - else { - image[i][0] = 255; - image[i][1] = 0; - image[i][2] = 0; - } - } - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 4, 4, 0, - GL_RGB, GL_UNSIGNED_BYTE, image); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); - -#if defined(GL_EXT_secondary_color) - glEnable(GL_COLOR_SUM_EXT); -#endif - glLightModeli(GL_LIGHT_MODEL_COLOR_CONTROL, GL_SEPARATE_SPECULAR_COLOR); - - printf("Squares should be colored from red -> orange -> yellow.\n"); - printf("Top row is untextured.\n"); - printf("Bottom row is textured (red texture with one black texel).\n"); - printf("Rows should be identical, except for lower-left texel.\n"); -} - - -int main( int argc, char *argv[] ) -{ - glutInit( &argc, argv ); - glutInitWindowPosition( 0, 0 ); - glutInitWindowSize( Width, Height ); - glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE ); - glutCreateWindow(argv[0]); - glutReshapeFunc( Reshape ); - glutKeyboardFunc( Key ); - glutDisplayFunc( Display ); - Init(); - glutMainLoop(); - return 0; -} diff --git a/progs/tests/shader_api.c b/progs/tests/shader_api.c deleted file mode 100644 index 598f029a97..0000000000 --- a/progs/tests/shader_api.c +++ /dev/null @@ -1,337 +0,0 @@ -/* Tests to validate fixes to various bugs in src/mesa/shader/shader_api.c - * - * Written by Bruce Merry - */ -#include -#include -#include -#define GL_GLEXT_PROTOTYPES -#include - -static void assert_test(const char *file, int line, int cond, const char *msg) -{ - if (!cond) - fprintf(stderr, "%s:%d assertion \"%s\" failed\n", file, line, msg); -} - -#undef assert -#define assert(x) assert_test(__FILE__, __LINE__, (x), #x) - -static void assert_no_error_test(const char *file, int line) -{ - GLenum err; - - err = glGetError(); - if (err != GL_NO_ERROR) - fprintf(stderr, "%s:%d received error %s\n", - file, line, gluErrorString(err)); -} - -#define assert_no_error() assert_no_error_test(__FILE__, __LINE__) - -static void assert_error_test(const char *file, int line, GLenum expect) -{ - GLenum err; - - err = glGetError(); - if (err != expect) - fprintf(stderr, "%s:%d expected %s but received %s\n", - file, line, gluErrorString(expect), gluErrorString(err)); - while (glGetError()); /* consume any following errors */ -} - -#define assert_error(err) assert_error_test(__FILE__, __LINE__, (err)) - -static void check_status(GLuint id, GLenum pname, void (*query)(GLuint, GLenum, GLint *)) -{ - GLint status; - - query(id, pname, &status); - if (!status) - { - char info[65536]; - - fprintf(stderr, "Compilation/link failure:\n"); - glGetInfoLogARB(id, sizeof(info), NULL, info); - fprintf(stderr, "%s\n", info); - exit(1); - } -} - -static void check_compile_status(GLuint id) -{ - check_status(id, GL_COMPILE_STATUS, glGetShaderiv); -} - -static void check_link_status(GLuint id) -{ - check_status(id, GL_LINK_STATUS, glGetProgramiv); -} - -static GLuint make_shader(GLenum type, const char *src) -{ - GLuint id; - - assert_no_error(); - id = glCreateShader(type); - glShaderSource(id, 1, &src, NULL); - glCompileShader(id); - check_compile_status(id); - assert_no_error(); - return id; -} - -static GLuint make_program(const char *vs_src, const char *fs_src) -{ - GLuint id, vs, fs; - - assert_no_error(); - id = glCreateProgram(); - if (vs_src) { - vs = make_shader(GL_VERTEX_SHADER, vs_src); - glAttachShader(id, vs); - glDeleteShader(vs); - } - if (fs_src) { - fs = make_shader(GL_FRAGMENT_SHADER, fs_src); - glAttachShader(id, fs); - glDeleteShader(fs); - } - glLinkProgram(id); - check_link_status(id); - glUseProgram(id); - glDeleteProgram(id); - assert_no_error(); - return id; -} - -static void test_uniform_size_type1(const char *glslType, GLenum glType, const char *el) -{ - char buffer[1024]; - GLuint program; - GLint active, i; - GLenum type; - GLint size; - - printf(" Running subtest %s\n", glslType); fflush(stdout); - sprintf(buffer, "#version 120\nuniform %s m[60];\nvoid main() { gl_Position[0] = m[59]%s; }\n", - glslType, el); - - program = make_program(buffer, NULL); - glGetProgramiv(program, GL_ACTIVE_UNIFORMS, &active); - assert_no_error(); - for (i = 0; i < active; i++) { - size = -1; - type = 0; - glGetActiveUniform(program, i, sizeof(buffer), NULL, &size, &type, buffer); - assert_no_error(); - if (strncmp(buffer, "m", 1) == 0) - break; - } - assert(i < active); /* Otherwise the compiler optimised it out */ - assert(type == glType); - assert(size == 60); -} - -static void test_uniform_size_type(void) -{ - test_uniform_size_type1("float", GL_FLOAT, ""); - test_uniform_size_type1("vec2", GL_FLOAT_VEC2, "[0]"); - test_uniform_size_type1("vec3", GL_FLOAT_VEC3, "[0]"); - test_uniform_size_type1("vec4", GL_FLOAT_VEC4, "[0]"); - - test_uniform_size_type1("bool", GL_BOOL, " ? 1.0 : 0.0"); - test_uniform_size_type1("bvec2", GL_BOOL_VEC2, "[0] ? 1.0 : 0.0"); - test_uniform_size_type1("bvec3", GL_BOOL_VEC3, "[0] ? 1.0 : 0.0"); - test_uniform_size_type1("bvec4", GL_BOOL_VEC4, "[0] ? 1.0 : 0.0"); - - test_uniform_size_type1("int", GL_INT, ""); - test_uniform_size_type1("ivec2", GL_INT_VEC2, "[0]"); - test_uniform_size_type1("ivec3", GL_INT_VEC3, "[0]"); - test_uniform_size_type1("ivec4", GL_INT_VEC4, "[0]"); - - test_uniform_size_type1("mat2", GL_FLOAT_MAT2, "[0][0]"); - test_uniform_size_type1("mat3", GL_FLOAT_MAT3, "[0][0]"); - test_uniform_size_type1("mat4", GL_FLOAT_MAT4, "[0][0]"); - test_uniform_size_type1("mat2x3", GL_FLOAT_MAT2x3, "[0][0]"); - test_uniform_size_type1("mat2x4", GL_FLOAT_MAT2x4, "[0][0]"); - test_uniform_size_type1("mat3x2", GL_FLOAT_MAT3x2, "[0][0]"); - test_uniform_size_type1("mat3x4", GL_FLOAT_MAT3x4, "[0][0]"); - test_uniform_size_type1("mat4x2", GL_FLOAT_MAT4x2, "[0][0]"); - test_uniform_size_type1("mat4x3", GL_FLOAT_MAT4x3, "[0][0]"); -} - -static void test_attrib_size_type1(const char *glslType, GLenum glType, const char *el) -{ - char buffer[1024]; - GLuint program; - GLint active, i; - GLenum type; - GLint size; - - printf(" Running subtest %s\n", glslType); fflush(stdout); - sprintf(buffer, "#version 120\nattribute %s m;\nvoid main() { gl_Position[0] = m%s; }\n", - glslType, el); - - program = make_program(buffer, NULL); - glGetProgramiv(program, GL_ACTIVE_ATTRIBUTES, &active); - assert_no_error(); - for (i = 0; i < active; i++) { - size = -1; - type = -1; - glGetActiveAttrib(program, i, sizeof(buffer), NULL, &size, &type, buffer); - assert_no_error(); - if (strncmp(buffer, "m", 1) == 0) - break; - } - assert(i < active); /* Otherwise the compiler optimised it out */ - assert(type == glType); - assert(size == 1); -} - -static void test_attrib_size_type(void) -{ - test_attrib_size_type1("float", GL_FLOAT, ""); - test_attrib_size_type1("vec2", GL_FLOAT_VEC2, "[0]"); - test_attrib_size_type1("vec3", GL_FLOAT_VEC3, "[0]"); - test_attrib_size_type1("vec4", GL_FLOAT_VEC4, "[0]"); - - test_attrib_size_type1("mat2", GL_FLOAT_MAT2, "[0][0]"); - test_attrib_size_type1("mat3", GL_FLOAT_MAT3, "[0][0]"); - test_attrib_size_type1("mat4", GL_FLOAT_MAT4, "[0][0]"); - test_attrib_size_type1("mat2x3", GL_FLOAT_MAT2x3, "[0][0]"); - test_attrib_size_type1("mat2x4", GL_FLOAT_MAT2x4, "[0][0]"); - test_attrib_size_type1("mat3x2", GL_FLOAT_MAT3x2, "[0][0]"); - test_attrib_size_type1("mat3x4", GL_FLOAT_MAT3x4, "[0][0]"); - test_attrib_size_type1("mat4x2", GL_FLOAT_MAT4x2, "[0][0]"); - test_attrib_size_type1("mat4x3", GL_FLOAT_MAT4x3, "[0][0]"); -} - -static void test_uniform_array_overflow(void) -{ - GLuint program; - GLint location; - GLfloat data[128]; - - program = make_program("#version 120\nuniform vec2 x[10];\nvoid main() { gl_Position.xy = x[9]; }\n", NULL); - location = glGetUniformLocation(program, "x"); - assert_no_error(); - glUniform2fv(location, 64, data); - assert_no_error(); -} - -static void test_uniform_scalar_count(void) -{ - GLuint program; - GLint location; - GLfloat data[128]; - - program = make_program("#version 110\nuniform vec2 x;\nvoid main() { gl_Position.xy = x; }\n", NULL); - location = glGetUniformLocation(program, "x"); - assert_no_error(); - glUniform2fv(location, 64, data); - assert_error(GL_INVALID_OPERATION); -} - -static void test_uniform_query_matrix(void) -{ - GLuint program; - GLfloat data[18]; - GLint i, r, c; - GLint location; - - program = make_program("#version 110\nuniform mat3 m[2];\nvoid main() { gl_Position.xyz = m[1][2]; }\n", NULL); - location = glGetUniformLocation(program, "m"); - for (i = 0; i < 9; i++) - data[i] = i; - for (i = 9; i < 18; i++) - data[i] = 321.0; - glUniformMatrix3fv(location, 1, GL_TRUE, data); - - for (i = 0; i < 18; i++) - data[i] = 123.0; - glGetUniformfv(program, location, data); - for (c = 0; c < 3; c++) - for (r = 0; r < 3; r++) - assert(data[c * 3 + r] == r * 3 + c); - for (i = 9; i < 18; i++) - assert(data[i] == 123.0); -} - -static void test_uniform_neg_location(void) -{ - GLuint program; - GLfloat data[4]; - - program = make_program("#version 110\nvoid main() { gl_Position = vec4(1.0, 1.0, 1.0, 1.0); }\n", NULL); - assert_no_error(); - glUniform1i(-1, 1); - assert_no_error(); - glUniform1i(-200, 1); - assert_error(GL_INVALID_OPERATION); - glUniformMatrix2fv(-1, 1, GL_FALSE, data); - assert_no_error(); - glUniformMatrix2fv(-200, 1, GL_FALSE, data); - assert_error(GL_INVALID_OPERATION); -} - -static void test_uniform_bool_conversion(void) -{ - GLuint program; - GLint location; - GLint value[16]; /* in case glGetUniformiv goes nuts on the stack */ - - assert_no_error(); - program = make_program("uniform bool b;\nvoid main() { gl_Position.x = b ? 1.5 : 0.5; }\n", NULL); - location = glGetUniformLocation(program, "b"); - assert(location != -1); - assert_no_error(); - glUniform1i(location, 5); - assert_no_error(); - glGetUniformiv(program, location, &value[0]); - assert_no_error(); - assert(value[0] == 1); -} - -static void test_uniform_multiple_samplers(void) -{ - GLuint program; - GLint location; - GLint values[2] = {0, 1}; - - assert_no_error(); - program = make_program(NULL, "uniform sampler2D s[2];\nvoid main() { gl_FragColor = texture2D(s[1], vec2(0.0, 0.0)); }\n"); - location = glGetUniformLocation(program, "s[0]"); - if (location == -1) /* Mesa doesn't currently support indexing */ - location = glGetUniformLocation(program, "s"); - assert(location != -1); - assert_no_error(); - glUniform1iv(location, 2, values); - assert_no_error(); -} - -static void run_test(const char *name, void (*callback)(void)) -{ - printf("Running %s\n", name); - fflush(stdout); - callback(); -} - -#define RUN_TEST(name) run_test(#name, (name)) - -int main(int argc, char **argv) -{ - glutInit(&argc, argv); - glutCreateWindow("Mesa bug demo"); - - RUN_TEST(test_uniform_size_type); - RUN_TEST(test_attrib_size_type); - RUN_TEST(test_uniform_array_overflow); - RUN_TEST(test_uniform_scalar_count); - RUN_TEST(test_uniform_query_matrix); - RUN_TEST(test_uniform_neg_location); - RUN_TEST(test_uniform_bool_conversion); - /* Leave this one at the end, since it crashes Mesa's shader compiler */ - RUN_TEST(test_uniform_multiple_samplers); - return 0; -} diff --git a/progs/tests/sharedtex.c b/progs/tests/sharedtex.c deleted file mode 100644 index c07ebd719c..0000000000 --- a/progs/tests/sharedtex.c +++ /dev/null @@ -1,439 +0,0 @@ - -/* - * Test sharing of display lists and texture objects between GLX contests. - * Brian Paul - * Summer 2000 - * - * - * Copyright (C) 2000 Brian Paul All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - - -#include -#include -#include -#include -#include -#include - - -struct window { - char DisplayName[1000]; - Display *Dpy; - Window Win; - GLXContext Context; - float Angle; - int Id; -}; - - -#define MAX_WINDOWS 20 -static struct window Windows[MAX_WINDOWS]; -static int NumWindows = 0; - - -static GLuint Textures[3]; -static GLuint CubeList; - - - -static void -Error(const char *display, const char *msg) -{ - fprintf(stderr, "Error on display %s - %s\n", display, msg); - exit(1); -} - - -static struct window * -AddWindow(const char *displayName, int xpos, int ypos, - const struct window *shareWindow) -{ - Display *dpy; - Window win; - GLXContext ctx; - int attrib[] = { GLX_RGBA, - GLX_RED_SIZE, 1, - GLX_GREEN_SIZE, 1, - GLX_BLUE_SIZE, 1, - GLX_DOUBLEBUFFER, - GLX_DEPTH_SIZE, 1, - None }; - int scrnum; - XSetWindowAttributes attr; - unsigned long mask; - Window root; - XVisualInfo *visinfo; - int width = 300, height = 300; - - if (NumWindows >= MAX_WINDOWS) - return NULL; - - dpy = XOpenDisplay(displayName); - if (!dpy) { - Error(displayName, "Unable to open display"); - return NULL; - } - - scrnum = DefaultScreen(dpy); - root = RootWindow(dpy, scrnum); - - visinfo = glXChooseVisual(dpy, scrnum, attrib); - if (!visinfo) { - Error(displayName, "Unable to find RGB, double-buffered visual"); - return NULL; - } - - /* window attributes */ - attr.background_pixel = 0; - attr.border_pixel = 0; - attr.colormap = XCreateColormap(dpy, root, visinfo->visual, AllocNone); - attr.event_mask = StructureNotifyMask | ExposureMask | KeyPressMask; - mask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask; - - win = XCreateWindow(dpy, root, xpos, ypos, width, height, - 0, visinfo->depth, InputOutput, - visinfo->visual, mask, &attr); - if (!win) { - Error(displayName, "Couldn't create window"); - return NULL; - } - - { - XSizeHints sizehints; - sizehints.x = xpos; - sizehints.y = ypos; - sizehints.width = width; - sizehints.height = height; - sizehints.flags = USSize | USPosition; - XSetNormalHints(dpy, win, &sizehints); - XSetStandardProperties(dpy, win, displayName, displayName, - None, (char **)NULL, 0, &sizehints); - } - - - ctx = glXCreateContext(dpy, visinfo, - shareWindow ? shareWindow->Context : NULL, - True); - if (!ctx) { - Error(displayName, "Couldn't create GLX context"); - return NULL; - } - - XMapWindow(dpy, win); - - if (!glXMakeCurrent(dpy, win, ctx)) { - Error(displayName, "glXMakeCurrent failed"); - printf("glXMakeCurrent failed in Redraw()\n"); - return NULL; - } - - /* save the info for this window */ - { - static int id = 0; - struct window *h = &Windows[NumWindows]; - strcpy(h->DisplayName, displayName); - h->Dpy = dpy; - h->Win = win; - h->Context = ctx; - h->Angle = 0.0; - h->Id = id++; - NumWindows++; - return &Windows[NumWindows-1]; - } - -} - - -static void -InitGLstuff(struct window *h) -{ - if (!glXMakeCurrent(h->Dpy, h->Win, h->Context)) { - Error(h->DisplayName, "glXMakeCurrent failed in InitGLstuff"); - return; - } - - glGenTextures(3, Textures); - - /* setup first texture object */ - { - GLubyte image[16][16][4]; - GLint i, j; - glBindTexture(GL_TEXTURE_2D, Textures[0]); - - /* red/white checkerboard */ - for (i = 0; i < 16; i++) { - for (j = 0; j < 16; j++) { - if ((i ^ j) & 1) { - image[i][j][0] = 255; - image[i][j][1] = 255; - image[i][j][2] = 255; - image[i][j][3] = 255; - } - else { - image[i][j][0] = 255; - image[i][j][1] = 0; - image[i][j][2] = 0; - image[i][j][3] = 255; - } - } - } - - glPixelStorei(GL_UNPACK_ALIGNMENT, 1); - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 16, 16, 0, GL_RGBA, - GL_UNSIGNED_BYTE, image); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - } - - /* setup second texture object */ - { - GLubyte image[8][8][3]; - GLint i, j; - glBindTexture(GL_TEXTURE_2D, Textures[1]); - - /* green/yellow checkerboard */ - for (i = 0; i < 8; i++) { - for (j = 0; j < 8; j++) { - if ((i ^ j) & 1) { - image[i][j][0] = 0; - image[i][j][1] = 255; - image[i][j][2] = 0; - } - else { - image[i][j][0] = 255; - image[i][j][1] = 255; - image[i][j][2] = 0; - } - } - } - - glPixelStorei(GL_UNPACK_ALIGNMENT, 2); - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 8, 8, 0, GL_RGB, - GL_UNSIGNED_BYTE, image); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - } - - /* setup second texture object */ - { - GLubyte image[4][4][3]; - GLint i, j; - glBindTexture(GL_TEXTURE_2D, Textures[2]); - - /* blue/gray checkerboard */ - for (i = 0; i < 4; i++) { - for (j = 0; j < 4; j++) { - if ((i ^ j) & 1) { - image[i][j][0] = 0; - image[i][j][1] = 0; - image[i][j][2] = 255; - } - else { - image[i][j][0] = 200; - image[i][j][1] = 200; - image[i][j][2] = 200; - } - } - } - - glPixelStorei(GL_UNPACK_ALIGNMENT, 2); - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 4, 4, 0, GL_RGB, - GL_UNSIGNED_BYTE, image); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - } - - /* Now make the cube object display list */ - CubeList = glGenLists(1); - glNewList(CubeList, GL_COMPILE); - { - glBindTexture(GL_TEXTURE_2D, Textures[0]); - glBegin(GL_POLYGON); - glTexCoord2f(0, 0); glVertex3f(-1, -1, -1); - glTexCoord2f(1, 0); glVertex3f(-1, 1, -1); - glTexCoord2f(1, 1); glVertex3f(-1, 1, 1); - glTexCoord2f(0, 1); glVertex3f(-1, -1, 1); - glEnd(); - glBegin(GL_POLYGON); - glTexCoord2f(0, 0); glVertex3f(1, -1, -1); - glTexCoord2f(1, 0); glVertex3f(1, 1, -1); - glTexCoord2f(1, 1); glVertex3f(1, 1, 1); - glTexCoord2f(0, 1); glVertex3f(1, -1, 1); - glEnd(); - - glBindTexture(GL_TEXTURE_2D, Textures[1]); - glBegin(GL_POLYGON); - glTexCoord2f(0, 0); glVertex3f(-1, -1, -1); - glTexCoord2f(1, 0); glVertex3f( 1, -1, -1); - glTexCoord2f(1, 1); glVertex3f( 1, -1, 1); - glTexCoord2f(0, 1); glVertex3f(-1, -1, 1); - glEnd(); - glBegin(GL_POLYGON); - glTexCoord2f(0, 0); glVertex3f(-1, 1, -1); - glTexCoord2f(1, 0); glVertex3f( 1, 1, -1); - glTexCoord2f(1, 1); glVertex3f( 1, 1, 1); - glTexCoord2f(0, 1); glVertex3f(-1, 1, 1); - glEnd(); - - glBindTexture(GL_TEXTURE_2D, Textures[2]); - glBegin(GL_POLYGON); - glTexCoord2f(0, 0); glVertex3f(-1, -1, -1); - glTexCoord2f(1, 0); glVertex3f( 1, -1, -1); - glTexCoord2f(1, 1); glVertex3f( 1, 1, -1); - glTexCoord2f(0, 1); glVertex3f(-1, 1, -1); - glEnd(); - glBegin(GL_POLYGON); - glTexCoord2f(0, 0); glVertex3f(-1, -1, 1); - glTexCoord2f(1, 0); glVertex3f( 1, -1, 1); - glTexCoord2f(1, 1); glVertex3f( 1, 1, 1); - glTexCoord2f(0, 1); glVertex3f(-1, 1, 1); - glEnd(); - } - glEndList(); - - printf("GL_RENDERER: %s\n", (char *) glGetString(GL_RENDERER)); - printf("GL_VERSION: %s\n", (char *) glGetString(GL_VERSION)); - printf("GL_VENDOR: %s\n", (char *) glGetString(GL_VENDOR)); -} - - - -static void -Redraw(struct window *h) -{ - if (!glXMakeCurrent(h->Dpy, h->Win, h->Context)) { - Error(h->DisplayName, "glXMakeCurrent failed"); - printf("glXMakeCurrent failed in Redraw()\n"); - return; - } - - h->Angle += 1.0; - - glShadeModel(GL_FLAT); - glClearColor(0.25, 0.25, 0.25, 1.0); - glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); - - glEnable(GL_TEXTURE_2D); - glEnable(GL_DEPTH_TEST); - glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); - - glColor3f(1, 1, 1); - - glPushMatrix(); - if (h->Id == 0) - glRotatef(h->Angle, 0, 1, -1); - else if (h->Id == 1) - glRotatef(-(h->Angle), 0, 1, -1); - else if (h->Id == 2) - glRotatef(h->Angle, 0, 1, 1); - else if (h->Id == 3) - glRotatef(-(h->Angle), 0, 1, 1); - glCallList(CubeList); - glPopMatrix(); - - glXSwapBuffers(h->Dpy, h->Win); -} - - - -static void -Resize(const struct window *h, unsigned int width, unsigned int height) -{ - if (!glXMakeCurrent(h->Dpy, h->Win, h->Context)) { - Error(h->DisplayName, "glXMakeCurrent failed in Resize()"); - return; - } - glViewport(0, 0, width, height); - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glFrustum(-1, 1, -1, 1, 2, 10); - glMatrixMode(GL_MODELVIEW); - glLoadIdentity(); - glTranslatef(0, 0, -4.5); -} - - - -static void -EventLoop(void) -{ - while (1) { - int i; - for (i = 0; i < NumWindows; i++) { - struct window *h = &Windows[i]; - while (XPending(h->Dpy) > 0) { - XEvent event; - XNextEvent(h->Dpy, &event); - if (event.xany.window == h->Win) { - switch (event.type) { - case Expose: - Redraw(h); - break; - case ConfigureNotify: - Resize(h, event.xconfigure.width, event.xconfigure.height); - break; - case KeyPress: - return; - default: - /*no-op*/ ; - } - } - else { - printf("window mismatch\n"); - } - } - Redraw(h); - } - usleep(1); - } -} - - -#if 0 -static void -PrintInfo(const struct window *h) -{ - printf("Name: %s\n", h->DisplayName); - printf(" Display: %p\n", (void *) h->Dpy); - printf(" Window: 0x%x\n", (int) h->Win); - printf(" Context: 0x%x\n", (int) h->Context); -} -#endif - - -int -main(int argc, char *argv[]) -{ - const char *dpyName = XDisplayName(NULL); - - struct window *h0, *h1, *h2, *h3; - - /* four windows and contexts sharing display lists and texture objects */ - h0 = AddWindow(dpyName, 10, 10, NULL); - h1 = AddWindow(dpyName, 330, 10, h0); - h2 = AddWindow(dpyName, 10, 350, h0); - h3 = AddWindow(dpyName, 330, 350, h0); - - InitGLstuff(h0); - - EventLoop(); - return 0; -} diff --git a/progs/tests/stencil_twoside.c b/progs/tests/stencil_twoside.c deleted file mode 100644 index be9d9a776a..0000000000 --- a/progs/tests/stencil_twoside.c +++ /dev/null @@ -1,299 +0,0 @@ -/* - * (C) Copyright IBM Corporation 2004 - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * on the rights to use, copy, modify, merge, publish, distribute, sub - * license, and/or sell copies of the Software, and to permit persons to whom - * the Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL - * VA LINUX SYSTEM, IBM AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, - * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR - * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE - * USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -/** - * \file stencil_twoside.c - * - * Simple test of GL_ATI_separate_stencil (or the OGL 2.0 equivalent) functionality. - * Four squares are drawn - * with different stencil modes, but all should be rendered with the same - * final color. - */ - -#include -#include -#include - -static int use20syntax = 1; -static int Width = 550; -static int Height = 200; -static const GLfloat Near = 5.0, Far = 25.0; - - -static PFNGLSTENCILFUNCSEPARATEPROC stencil_func_separate = NULL; -static PFNGLSTENCILFUNCSEPARATEATIPROC stencil_func_separate_ati = NULL; -static PFNGLSTENCILOPSEPARATEPROC stencil_op_separate = NULL; - -static void Display( void ) -{ - GLint max_stencil; - GLint stencil_bits; - unsigned i; - - - glGetIntegerv( GL_STENCIL_BITS, & stencil_bits ); - max_stencil = (1U << stencil_bits) - 1; - printf( "Stencil bits = %u, maximum stencil value = 0x%08x\n", - stencil_bits, max_stencil ); - - glClearStencil( 1 ); - glClearColor( 0.2, 0.2, 0.8, 0 ); - glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT - | GL_STENCIL_BUFFER_BIT ); - - - glPushMatrix(); - - /* This is the "reference" square. - */ - - glDisable(GL_STENCIL_TEST); - glTranslatef(-6.0, 0, 0); - glBegin(GL_QUADS); - glColor3f( 0.5, 0.5, 0.5 ); - glVertex2f(-1, -1); - glVertex2f( 1, -1); - glVertex2f( 1, 1); - glVertex2f(-1, 1); - glEnd(); - - - glEnable(GL_STENCIL_TEST); - - /* Draw the first two squares using incr for the affected face - */ - - if (use20syntax) { - stencil_func_separate(GL_FRONT, GL_ALWAYS, 0, ~0); - stencil_func_separate(GL_BACK, GL_ALWAYS, 0, ~0); - } - else { - stencil_func_separate_ati(GL_ALWAYS, GL_ALWAYS, 0, ~0); - } - stencil_op_separate(GL_FRONT, GL_KEEP, GL_KEEP, GL_INCR); - stencil_op_separate(GL_BACK, GL_KEEP, GL_KEEP, GL_DECR); - - glTranslatef(3.0, 0, 0); - glBegin(GL_QUADS); - glColor3f( 0.9, 0.9, 0.9 ); - /* this should be front facing */ - for ( i = 0 ; i < (max_stencil + 5) ; i++ ) { - glVertex2f(-1, -1); - glVertex2f( 1, -1); - glVertex2f( 1, 1); - glVertex2f(-1, 1); - } - glEnd(); - - glStencilFunc(GL_EQUAL, max_stencil, ~0); - glBegin(GL_QUADS); - glColor3f( 0.5, 0.5, 0.5 ); - glVertex2f(-1, -1); - glVertex2f( 1, -1); - glVertex2f( 1, 1); - glVertex2f(-1, 1); - glEnd(); - - - if (use20syntax) { - stencil_func_separate(GL_FRONT, GL_ALWAYS, 0, ~0); - stencil_func_separate(GL_BACK, GL_ALWAYS, 0, ~0); - } - else { - stencil_func_separate_ati(GL_ALWAYS, GL_ALWAYS, 0, ~0); - } - stencil_op_separate(GL_FRONT, GL_KEEP, GL_KEEP, GL_DECR); - stencil_op_separate(GL_BACK, GL_KEEP, GL_KEEP, GL_INCR); - - glTranslatef(3.0, 0, 0); - glBegin(GL_QUADS); - glColor3f( 0.9, 0.9, 0.9 ); - - /* this should be back facing */ - for ( i = 0 ; i < (max_stencil + 5) ; i++ ) { - glVertex2f(-1, -1); - glVertex2f(-1, 1); - glVertex2f( 1, 1); - glVertex2f( 1, -1); - } - glEnd(); - - glStencilFunc(GL_EQUAL, max_stencil, ~0); - glBegin(GL_QUADS); - glColor3f( 0.5, 0.5, 0.5 ); - glVertex2f(-1, -1); - glVertex2f( 1, -1); - glVertex2f( 1, 1); - glVertex2f(-1, 1); - glEnd(); - - if (use20syntax) { - stencil_func_separate(GL_FRONT, GL_NEVER, 0, ~0); - stencil_func_separate(GL_BACK, GL_ALWAYS, 0, ~0); - } - else { - stencil_func_separate_ati(GL_NEVER, GL_ALWAYS, 0, ~0); - } - stencil_op_separate(GL_FRONT, GL_KEEP, GL_KEEP, GL_DECR); - stencil_op_separate(GL_BACK, GL_KEEP, GL_KEEP, GL_INCR); - - glTranslatef(3.0, 0, 0); - glBegin(GL_QUADS); - glColor3f( 0.9, 0.9, 0.9 ); - - /* this should be back facing */ - for ( i = 0 ; i < (max_stencil + 5) ; i++ ) { - /* this should be back facing */ - glVertex2f(-1, -1); - glVertex2f(-1, 1); - glVertex2f( 1, 1); - glVertex2f( 1, -1); - /* this should be front facing */ - glVertex2f(-1, -1); - glVertex2f( 1, -1); - glVertex2f( 1, 1); - glVertex2f(-1, 1); - } - glEnd(); - - glStencilFunc(GL_EQUAL, max_stencil, ~0); - glBegin(GL_QUADS); - glColor3f( 0.5, 0.5, 0.5 ); - glVertex2f(-1, -1); - glVertex2f( 1, -1); - glVertex2f( 1, 1); - glVertex2f(-1, 1); - glEnd(); - - if (use20syntax) { - stencil_func_separate(GL_FRONT, GL_ALWAYS, 0, ~0); - stencil_func_separate(GL_BACK, GL_ALWAYS, 0, ~0); - } - else { - stencil_func_separate_ati(GL_ALWAYS, GL_ALWAYS, 0, ~0); - } - stencil_op_separate(GL_FRONT, GL_KEEP, GL_KEEP, GL_DECR); - stencil_op_separate(GL_BACK, GL_KEEP, GL_KEEP, GL_INCR); - - glTranslatef(3.0, 0, 0); - glBegin(GL_QUADS); - glColor3f( 0.9, 0.9, 0.9 ); - - /* this should be back facing */ - for ( i = 0 ; i < (max_stencil + 5) ; i++ ) { - /* this should be back facing */ - glVertex2f(-1, -1); - glVertex2f(-1, 1); - glVertex2f( 1, 1); - glVertex2f( 1, -1); - /* this should be front facing */ - glVertex2f(-1, -1); - glVertex2f( 1, -1); - glVertex2f( 1, 1); - glVertex2f(-1, 1); - } - glEnd(); - - glStencilFunc(GL_EQUAL, 1, ~0); - glBegin(GL_QUADS); - glColor3f( 0.5, 0.5, 0.5 ); - glVertex2f(-1, -1); - glVertex2f( 1, -1); - glVertex2f( 1, 1); - glVertex2f(-1, 1); - glEnd(); - - glPopMatrix(); - - glutSwapBuffers(); -} - - -static void Reshape( int width, int height ) -{ - GLfloat ar = (float) width / (float) height; - Width = width; - Height = height; - glViewport( 0, 0, width, height ); - glMatrixMode( GL_PROJECTION ); - glLoadIdentity(); - glFrustum( -ar, ar, -1.0, 1.0, Near, Far ); - glMatrixMode( GL_MODELVIEW ); - glLoadIdentity(); - glTranslatef( 0.0, 0.0, -15.0 ); -} - - -static void Key( unsigned char key, int x, int y ) -{ - (void) x; - (void) y; - switch (key) { - case 27: - exit(0); - break; - } - glutPostRedisplay(); -} - - -static void Init( void ) -{ - const char * const ver_string = (const char * const) - glGetString( GL_VERSION ); - - printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - printf("GL_VERSION = %s\n", ver_string); - - if ( !glutExtensionSupported("GL_ATI_separate_stencil") - && (atof( ver_string ) < 2.0) ) { - printf("Sorry, this program requires either GL_ATI_separate_stencil or OpenGL 2.0.\n"); - exit(1); - } - if (atof( ver_string ) < 2.0) { - use20syntax = 0; - } - stencil_func_separate = glutGetProcAddress( "glStencilFuncSeparate" ); - stencil_func_separate_ati = glutGetProcAddress( "glStencilFuncSeparateATI" ); - stencil_op_separate = glutGetProcAddress( "glStencilOpSeparate" ); - - printf("\nAll 5 squares should be the same color.\n"); - glEnable( GL_BLEND ); -} - - -int main( int argc, char *argv[] ) -{ - glutInit( &argc, argv ); - glutInitWindowPosition( 0, 0 ); - glutInitWindowSize( Width, Height ); - glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH | GLUT_STENCIL ); - glutCreateWindow( "GL_ATI_separate_stencil test" ); - glutReshapeFunc( Reshape ); - glutKeyboardFunc( Key ); - glutDisplayFunc( Display ); - Init(); - glutMainLoop(); - return 0; -} diff --git a/progs/tests/stencil_wrap.c b/progs/tests/stencil_wrap.c deleted file mode 100644 index 88cf3809ca..0000000000 --- a/progs/tests/stencil_wrap.c +++ /dev/null @@ -1,257 +0,0 @@ -/* - * (C) Copyright IBM Corporation 2004 - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * on the rights to use, copy, modify, merge, publish, distribute, sub - * license, and/or sell copies of the Software, and to permit persons to whom - * the Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL - * VA LINUX SYSTEM, IBM AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, - * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR - * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE - * USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -/** - * \file stencil_wrap.c - * - * Simple test of GL_EXT_stencil_wrap functionality. Four squares are drawn - * with different stencil modes, but all should be rendered with the same - * final color. - * - * \author Ian Romanick - */ - -#include -#include -#include - -static int Width = 550; -static int Height = 200; -static const GLfloat Near = 5.0, Far = 25.0; - - -static void Display( void ) -{ - GLint max_stencil; - GLint stencil_bits; - unsigned i; - - - glGetIntegerv( GL_STENCIL_BITS, & stencil_bits ); - max_stencil = (1U << stencil_bits) - 1; - printf( "Stencil bits = %u, maximum stencil value = 0x%08x\n", - stencil_bits, max_stencil ); - - glClearStencil( 0 ); - glClearColor( 0.2, 0.2, 0.8, 0 ); - glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT - | GL_STENCIL_BUFFER_BIT ); - - - glPushMatrix(); - - /* This is the "reference" square. - */ - - glDisable(GL_STENCIL_TEST); - glTranslatef(-6.0, 0, 0); - glBegin(GL_QUADS); - glColor3f( 0.5, 0.5, 0.5 ); - glVertex2f(-1, -1); - glVertex2f( 1, -1); - glVertex2f( 1, 1); - glVertex2f(-1, 1); - glEnd(); - - - glEnable(GL_STENCIL_TEST); - - /* Draw the first two squares using the two non-wrap (i.e., saturate) - * modes. - */ - - glStencilFunc(GL_ALWAYS, 0, ~0); - glStencilOp(GL_KEEP, GL_KEEP, GL_INCR); - - glTranslatef(3.0, 0, 0); - glBegin(GL_QUADS); - glColor3f( 0.9, 0.9, 0.9 ); - - for ( i = 0 ; i < (max_stencil + 5) ; i++ ) { - glVertex2f(-1, -1); - glVertex2f( 1, -1); - glVertex2f( 1, 1); - glVertex2f(-1, 1); - } - glEnd(); - - glStencilFunc(GL_EQUAL, max_stencil, ~0); - glBegin(GL_QUADS); - glColor3f( 0.5, 0.5, 0.5 ); - glVertex2f(-1, -1); - glVertex2f( 1, -1); - glVertex2f( 1, 1); - glVertex2f(-1, 1); - glEnd(); - - - glStencilFunc(GL_ALWAYS, 0, ~0); - glStencilOp(GL_KEEP, GL_KEEP, GL_DECR); - - glTranslatef(3.0, 0, 0); - glBegin(GL_QUADS); - glColor3f( 0.9, 0.9, 0.9 ); - - for ( i = 0 ; i < (max_stencil + 5) ; i++ ) { - glVertex2f(-1, -1); - glVertex2f( 1, -1); - glVertex2f( 1, 1); - glVertex2f(-1, 1); - } - glEnd(); - - glStencilFunc(GL_EQUAL, 0, ~0); - glBegin(GL_QUADS); - glColor3f( 0.5, 0.5, 0.5 ); - glVertex2f(-1, -1); - glVertex2f( 1, -1); - glVertex2f( 1, 1); - glVertex2f(-1, 1); - glEnd(); - - - - - /* Draw the last two squares using the two wrap modes. - */ - - glStencilFunc(GL_ALWAYS, 0, ~0); - glStencilOp(GL_KEEP, GL_KEEP, GL_INCR_WRAP); - - glTranslatef(3.0, 0, 0); - glBegin(GL_QUADS); - glColor3f( 0.9, 0.9, 0.9 ); - - for ( i = 0 ; i < (max_stencil + 5) ; i++ ) { - glVertex2f(-1, -1); - glVertex2f( 1, -1); - glVertex2f( 1, 1); - glVertex2f(-1, 1); - } - glEnd(); - - glStencilFunc(GL_EQUAL, 4, ~0); - glBegin(GL_QUADS); - glColor3f( 0.5, 0.5, 0.5 ); - glVertex2f(-1, -1); - glVertex2f( 1, -1); - glVertex2f( 1, 1); - glVertex2f(-1, 1); - glEnd(); - - - - glStencilFunc(GL_ALWAYS, 0, ~0); - glStencilOp(GL_KEEP, GL_KEEP, GL_DECR_WRAP); - - glTranslatef(3.0, 0, 0); - glBegin(GL_QUADS); - glColor3f( 0.9, 0.9, 0.9 ); - - for ( i = 0 ; i < 5 ; i++ ) { - glVertex2f(-1, -1); - glVertex2f( 1, -1); - glVertex2f( 1, 1); - glVertex2f(-1, 1); - } - glEnd(); - - glStencilFunc(GL_EQUAL, (max_stencil - 4), ~0); - glBegin(GL_QUADS); - glColor3f( 0.5, 0.5, 0.5 ); - glVertex2f(-1, -1); - glVertex2f( 1, -1); - glVertex2f( 1, 1); - glVertex2f(-1, 1); - glEnd(); - - - - glPopMatrix(); - - glutSwapBuffers(); -} - - -static void Reshape( int width, int height ) -{ - GLfloat ar = (float) width / (float) height; - Width = width; - Height = height; - glViewport( 0, 0, width, height ); - glMatrixMode( GL_PROJECTION ); - glLoadIdentity(); - glFrustum( -ar, ar, -1.0, 1.0, Near, Far ); - glMatrixMode( GL_MODELVIEW ); - glLoadIdentity(); - glTranslatef( 0.0, 0.0, -15.0 ); -} - - -static void Key( unsigned char key, int x, int y ) -{ - (void) x; - (void) y; - switch (key) { - case 27: - exit(0); - break; - } - glutPostRedisplay(); -} - - -static void Init( void ) -{ - const char * const ver_string = (const char * const) - glGetString( GL_VERSION ); - - printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - printf("GL_VERSION = %s\n", ver_string); - - if ( !glutExtensionSupported("GL_EXT_stencil_wrap") - && (atof( ver_string ) < 1.4) ) { - printf("Sorry, this program requires either GL_EXT_stencil_wrap or OpenGL 1.4.\n"); - exit(1); - } - - printf("\nAll 5 squares should be the same color.\n"); - glEnable( GL_BLEND ); -} - - -int main( int argc, char *argv[] ) -{ - glutInit( &argc, argv ); - glutInitWindowPosition( 0, 0 ); - glutInitWindowSize( Width, Height ); - glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH | GLUT_STENCIL ); - glutCreateWindow( "GL_EXT_stencil_wrap test" ); - glutReshapeFunc( Reshape ); - glutKeyboardFunc( Key ); - glutDisplayFunc( Display ); - Init(); - glutMainLoop(); - return 0; -} diff --git a/progs/tests/stencilwrap.c b/progs/tests/stencilwrap.c deleted file mode 100644 index 753375d0f3..0000000000 --- a/progs/tests/stencilwrap.c +++ /dev/null @@ -1,281 +0,0 @@ -/* Test GL_EXT_stencil_wrap extension. - * This is by no means complete, just a quick check. - * - * Brian Paul 30 October 2002 - */ - -#include -#include -#include -#include -#include - -GLboolean wrapping; - -static void RunTest(void) -{ - const GLenum prim = GL_QUAD_STRIP; - GLubyte val; - int bits, max, i; - int expected; - GLboolean failed; - - glGetIntegerv(GL_STENCIL_BITS, &bits); - max = (1 << bits) - 1; - - - glEnable(GL_STENCIL_TEST); - glStencilFunc(GL_ALWAYS, 0, ~0); - - /* test GL_KEEP */ - glClearStencil(max); - glClear(GL_STENCIL_BUFFER_BIT); - glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP); - failed = GL_FALSE; - printf("Testing GL_KEEP...\n"); - expected = max; - glBegin(prim); - glVertex2f(0, 0); - glVertex2f(10, 0); - glVertex2f(0, 10); - glVertex2f(10, 10); - glEnd(); - glReadPixels(0, 0, 1, 1, GL_STENCIL_INDEX, GL_UNSIGNED_BYTE, &val); - if (val != expected) { - printf("Failed GL_KEEP test(got %u, expected %u)\n", val, expected); - failed = GL_TRUE; - } - else - printf("OK!\n"); - - /* test GL_ZERO */ - glClearStencil(max); - glClear(GL_STENCIL_BUFFER_BIT); - glStencilOp(GL_KEEP, GL_KEEP, GL_ZERO); - failed = GL_FALSE; - printf("Testing GL_ZERO...\n"); - expected = 0; - glBegin(prim); - glVertex2f(0, 0); - glVertex2f(10, 0); - glVertex2f(0, 10); - glVertex2f(10, 10); - glEnd(); - glReadPixels(0, 0, 1, 1, GL_STENCIL_INDEX, GL_UNSIGNED_BYTE, &val); - if (val != expected) { - printf("Failed GL_ZERO test(got %u, expected %u)\n", val, expected); - failed = GL_TRUE; - } - else - printf("OK!\n"); - - /* test GL_REPLACE */ - glClearStencil(max); - glClear(GL_STENCIL_BUFFER_BIT); - glStencilOp(GL_KEEP, GL_KEEP, GL_REPLACE); - failed = GL_FALSE; - printf("Testing GL_REPLACE...\n"); - expected = 0; - glBegin(prim); - glVertex2f(0, 0); - glVertex2f(10, 0); - glVertex2f(0, 10); - glVertex2f(10, 10); - glEnd(); - glReadPixels(0, 0, 1, 1, GL_STENCIL_INDEX, GL_UNSIGNED_BYTE, &val); - if (val != expected) { - printf("Failed GL_REPLACE test(got %u, expected %u)\n", val, expected); - failed = GL_TRUE; - } - else - printf("OK!\n"); - - /* test GL_INCR (saturation) */ - glClearStencil(0); - glClear(GL_STENCIL_BUFFER_BIT); - glStencilOp(GL_KEEP, GL_KEEP, GL_INCR); - failed = GL_FALSE; - printf("Testing GL_INCR...\n"); - for (i = 1; i < max+10; i++) { - expected = (i > max) ? max : i; - glBegin(prim); - glVertex2f(0, 0); glVertex2f(10, 0); - glVertex2f(0, 10); glVertex2f(10, 10); - glEnd(); - - glReadPixels(0, 0, 1, 1, GL_STENCIL_INDEX, GL_UNSIGNED_BYTE, &val); - if (val != expected) { - printf( "Failed GL_INCR test on iteration #%u " - "(got %u, expected %u)\n", i, val, expected ); - failed = GL_TRUE; - } - } - if ( !failed ) - printf("OK!\n"); - - /* test GL_DECR (saturation) */ - glClearStencil(max); - glClear(GL_STENCIL_BUFFER_BIT); - glStencilOp(GL_KEEP, GL_KEEP, GL_DECR); - failed = GL_FALSE; - printf("Testing GL_DECR...\n"); - for (i = max-1; i > -10; i--) { - expected = (i < 0) ? 0 : i; - glBegin(prim); - glVertex2f(0, 0); glVertex2f(10, 0); - glVertex2f(0, 10); glVertex2f(10, 10); - glEnd(); - glReadPixels(0, 0, 1, 1, GL_STENCIL_INDEX, GL_UNSIGNED_BYTE, &val); - if (val != expected) { - printf( "Failed GL_DECR test on iteration #%u " - "(got %u, expected %u)\n", max - i, val, expected ); - failed = GL_TRUE; - } - } - if ( !failed ) - printf("OK!\n"); - - /* test GL_INVERT */ - glClearStencil(0); - glClear(GL_STENCIL_BUFFER_BIT); - glStencilOp(GL_KEEP, GL_KEEP, GL_INVERT); - failed = GL_FALSE; - printf("Testing GL_INVERT...\n"); - expected = max; - glBegin(prim); - glVertex2f(0, 0); - glVertex2f(10, 0); - glVertex2f(0, 10); - glVertex2f(10, 10); - glEnd(); - glReadPixels(0, 0, 1, 1, GL_STENCIL_INDEX, GL_UNSIGNED_BYTE, &val); - if (val != expected) { - printf("Failed GL_INVERT test(got %u, expected %u)\n", val, expected); - failed = GL_TRUE; - } - else - printf("OK!\n"); - - if(wrapping) - { - /* test GL_INCR_WRAP_EXT (wrap around) */ - glClearStencil(0); - glClear(GL_STENCIL_BUFFER_BIT); - glStencilOp(GL_KEEP, GL_KEEP, GL_INCR_WRAP_EXT); - failed = GL_FALSE; - printf("Testing GL_INCR_WRAP_EXT...\n"); - for (i = 1; i < max+10; i++) { - expected = i % (max + 1); - glBegin(prim); - glVertex2f(0, 0); glVertex2f(10, 0); - glVertex2f(0, 10); glVertex2f(10, 10); - glEnd(); - glReadPixels(0, 0, 1, 1, GL_STENCIL_INDEX, GL_UNSIGNED_BYTE, &val); - if (val != expected) { - printf( "Failed GL_INCR_WRAP test on iteration #%u " - "(got %u, expected %u)\n", i, val, expected ); - failed = GL_TRUE; - } - } - if ( !failed ) - printf("OK!\n"); - - /* test GL_DECR_WRAP_EXT (wrap-around) */ - glClearStencil(max); - glClear(GL_STENCIL_BUFFER_BIT); - glStencilOp(GL_KEEP, GL_KEEP, GL_DECR_WRAP_EXT); - failed = GL_FALSE; - printf("Testing GL_DECR_WRAP_EXT...\n"); - for (i = max-1; i > -10; i--) { - expected = (i < 0) ? max + i + 1: i; - glBegin(prim); - glVertex2f(0, 0); glVertex2f(10, 0); - glVertex2f(0, 10); glVertex2f(10, 10); - glEnd(); - glReadPixels(0, 0, 1, 1, GL_STENCIL_INDEX, GL_UNSIGNED_BYTE, &val); - if (val != expected) { - printf( "Failed GL_DECR_WRAP test on iteration #%u " - "(got %u, expected %u)\n", max - i, val, expected ); - failed = GL_TRUE; - } - } - if ( !failed ) - printf("OK!\n"); - } - - glDisable(GL_STENCIL_TEST); -} - - -static void Display( void ) -{ - glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); - - RunTest(); - - glutSwapBuffers(); -} - - -static void Reshape( int width, int height ) -{ - glViewport( 0, 0, width, height ); - glMatrixMode( GL_PROJECTION ); - glLoadIdentity(); - glOrtho(0, width, 0, height, -1, 1); - glMatrixMode( GL_MODELVIEW ); - glLoadIdentity(); -} - - -static void Key( unsigned char key, int x, int y ) -{ - (void) x; - (void) y; - switch (key) { - case 27: - exit(0); - break; - } - glutPostRedisplay(); -} - - -static void Init( void ) -{ - const char * ver_str; - float version; - - printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - printf("GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - - - /* Check for both the extension string and GL version 1.4 on the - * outside chance that some vendor exports version 1.4 but doesn't - * export the extension string. The stencil-wrap modes are a required - * part of GL 1.4. - */ - - ver_str = glGetString( GL_VERSION ); - version = (ver_str == NULL) ? 1.0 : atof( ver_str ); - - wrapping = (glutExtensionSupported("GL_EXT_stencil_wrap") || (version >= 1.4)); - if (!wrapping) - printf("GL_EXT_stencil_wrap not supported. Only testing the rest.\n"); -} - - -int main( int argc, char *argv[] ) -{ - glutInit( &argc, argv ); - glutInitWindowPosition( 0, 0 ); - glutInitWindowSize( 400, 400 ); - glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE | GLUT_STENCIL ); - glutCreateWindow(argv[0]); - glutReshapeFunc( Reshape ); - glutKeyboardFunc( Key ); - glutDisplayFunc( Display ); - Init(); - glutMainLoop(); - return 0; -} diff --git a/progs/tests/subtexrate.c b/progs/tests/subtexrate.c deleted file mode 100644 index 568b68d552..0000000000 --- a/progs/tests/subtexrate.c +++ /dev/null @@ -1,350 +0,0 @@ -/* - * Measure glTexSubImage and glCopyTexSubImage speed - * - * Brian Paul - * 26 Jan 2006 - */ - -#define GL_GLEXT_PROTOTYPES -#include -#include -#include -#include -#include - -static GLint WinWidth = 1024, WinHeight = 512; -static GLint TexWidth = 512, TexHeight = 512; - -static GLuint TexObj = 1; - -static GLenum IntFormat = GL_RGBA8; -static GLenum ReadFormat = GL_RGBA; /* for glReadPixels */ - -static GLboolean DrawQuad = GL_TRUE; - - -/** - * draw teapot image, size TexWidth by TexHeight - */ -static void -DrawTestImage(void) -{ - GLfloat ar; - - glViewport(0, 0, TexWidth, TexHeight); - glScissor(0, 0, TexWidth, TexHeight); - glEnable(GL_SCISSOR_TEST); - - glClearColor(0.5, 0.5, 0.5, 0.0); - glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); - - ar = (float) TexWidth / TexHeight; - - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glFrustum(-ar, ar, -1.0, 1.0, 5.0, 25.0); - glMatrixMode(GL_MODELVIEW); - - glEnable(GL_LIGHTING); - glEnable(GL_LIGHT0); - glEnable(GL_DEPTH_TEST); - glFrontFace(GL_CW); - glPushMatrix(); - glRotatef(45, 1, 0, 0); - glRotatef(45, 0, 1, 0); - glutSolidTeapot(2.3); - glPopMatrix(); - glFrontFace(GL_CCW); - glDisable(GL_DEPTH_TEST); - glDisable(GL_LIGHTING); - - glDisable(GL_SCISSOR_TEST); - - glViewport(0, 0, WinWidth, WinHeight); - glFinish(); -} - - -/** - * Do glCopyTexSubImage2D call (update texture with framebuffer data) - * If doSubRect is true, do the copy in four pieces instead of all at once. - */ -static void -DoCopyTex(GLboolean doSubRect) -{ - if (doSubRect) { - /* copy in four parts */ - int w = TexWidth / 2, h = TexHeight / 2; - int x0 = 0, y0 = 0; - int x1 = w, y1 = h; -#if 1 - glCopyTexSubImage2D(GL_TEXTURE_2D, 0, x0, y0, x0, y0, w, h); - glCopyTexSubImage2D(GL_TEXTURE_2D, 0, x1, y0, x1, y0, w, h); - glCopyTexSubImage2D(GL_TEXTURE_2D, 0, x0, y1, x0, y1, w, h); - glCopyTexSubImage2D(GL_TEXTURE_2D, 0, x1, y1, x1, y1, w, h); -#else - /* scramble */ - glCopyTexSubImage2D(GL_TEXTURE_2D, 0, x0, y0, x1, y1, w, h); - glCopyTexSubImage2D(GL_TEXTURE_2D, 0, x1, y0, x0, y1, w, h); - glCopyTexSubImage2D(GL_TEXTURE_2D, 0, x0, y1, x1, y0, w, h); - glCopyTexSubImage2D(GL_TEXTURE_2D, 0, x1, y1, x0, y0, w, h); -#endif - } - else { - glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, TexWidth, TexHeight); - } -} - - -/** - * Do glTexSubImage2D (update texture w/ user data) - * If doSubRect, do update in four pieces, else all at once. - */ -static void -SubTex(GLboolean doSubRect, const GLubyte *image) -{ - if (doSubRect) { - /* four pieces */ - int w = TexWidth / 2, h = TexHeight / 2; - int x0 = 0, y0 = 0; - int x1 = w, y1 = h; - glPixelStorei(GL_UNPACK_ROW_LENGTH, TexWidth); - glPixelStorei(GL_UNPACK_ALIGNMENT, 1); - - glPixelStorei(GL_UNPACK_SKIP_ROWS, y0); - glPixelStorei(GL_UNPACK_SKIP_PIXELS, x0); - glTexSubImage2D(GL_TEXTURE_2D, 0, x0, y0, w, h, - ReadFormat, GL_UNSIGNED_BYTE, image); - - glPixelStorei(GL_UNPACK_SKIP_ROWS, y0); - glPixelStorei(GL_UNPACK_SKIP_PIXELS, x1); - glTexSubImage2D(GL_TEXTURE_2D, 0, x1, y0, w, h, - ReadFormat, GL_UNSIGNED_BYTE, image); - - glPixelStorei(GL_UNPACK_SKIP_ROWS, y1); - glPixelStorei(GL_UNPACK_SKIP_PIXELS, x0); - glTexSubImage2D(GL_TEXTURE_2D, 0, x0, y1, w, h, - ReadFormat, GL_UNSIGNED_BYTE, image); - - glPixelStorei(GL_UNPACK_SKIP_ROWS, y1); - glPixelStorei(GL_UNPACK_SKIP_PIXELS, x1); - glTexSubImage2D(GL_TEXTURE_2D, 0, x1, y1, w, h, - ReadFormat, GL_UNSIGNED_BYTE, image); - } - else { - /* all at once */ - glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, TexWidth, TexHeight, - ReadFormat, GL_UNSIGNED_BYTE, image); - } -} - - -/** - * Measure gl[Copy]TexSubImage rate. - * This actually also includes time to render a quad and SwapBuffers. - */ -static void -RunTest(GLboolean copyTex, GLboolean doSubRect) -{ - double t0, t1; - int iters = 0; - float copyRate, mbRate; - float rot = 0.0; - int bpp, r, g, b, a; - int w, h; - GLubyte *image = NULL; - - glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_RED_SIZE, &r); - glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_GREEN_SIZE, &g); - glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_BLUE_SIZE, &b); - glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_ALPHA_SIZE, &a); - bpp = (r + g + b + a) / 8; - - if (!copyTex) { - /* read image from frame buffer */ - image = (GLubyte *) malloc(TexWidth * TexHeight * bpp); - glPixelStorei(GL_PACK_ALIGNMENT, 1); - glReadPixels(0, 0, TexWidth, TexHeight, - ReadFormat, GL_UNSIGNED_BYTE, image); - } - - glEnable(GL_TEXTURE_2D); - glViewport(WinWidth / 2, 0, WinWidth / 2, WinHeight); - - t0 = glutGet(GLUT_ELAPSED_TIME) / 1000.0; - - do { - if (copyTex) - /* Framebuffer -> Texture */ - DoCopyTex(doSubRect); - else { - /* Main Mem -> Texture */ - SubTex(doSubRect, image); - } - - /* draw textured quad */ - if (DrawQuad) { - glPushMatrix(); - glRotatef(rot, 0, 0, 1); - glTranslatef(1, 0, 0); - glBegin(GL_POLYGON); - glTexCoord2f(0, 0); glVertex2f(-1, -1); - glTexCoord2f(1, 0); glVertex2f( 1, -1); - glTexCoord2f(1, 1); glVertex2f( 1, 1); - glTexCoord2f(0, 1); glVertex2f(-1, 1); - glEnd(); - glPopMatrix(); - } - - iters++; - rot += 2.0; - - t1 = glutGet(GLUT_ELAPSED_TIME) / 1000.0; - if (DrawQuad) { - glutSwapBuffers(); - } - } while (t1 - t0 < 5.0); - - glDisable(GL_TEXTURE_2D); - if (image) - free(image); - - if (doSubRect) { - w = TexWidth / 2; - h = TexHeight / 2; - iters *= 4; - } - else { - w = TexWidth; - h = TexHeight; - } - - copyRate = iters / (t1 - t0); - mbRate = w * h * bpp * copyRate / (1024 * 1024); - - if (copyTex) - printf("glCopyTexSubImage: %d x %d, %d Bpp:\n", w, h, bpp); - else - printf("glTexSubImage: %d x %d, %d Bpp:\n", w, h, bpp); - printf(" %d calls in %.2f = %.2f calls/sec, %.2f MB/s\n", - iters, t1-t0, copyRate, mbRate); -} - - -static void -Draw(void) -{ - glClearColor(0.2, 0.2, 0.8, 0); - glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); - - DrawTestImage(); - if (!DrawQuad) { - glutSwapBuffers(); - } - - RunTest(GL_FALSE, GL_FALSE); - RunTest(GL_FALSE, GL_TRUE); - RunTest(GL_TRUE, GL_FALSE); - RunTest(GL_TRUE, GL_TRUE); - - glutSwapBuffers(); - - printf("exiting\n"); - exit(0); -} - - -static void -Reshape(int width, int height) -{ - glViewport(0, 0, width, height); - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glFrustum(-1.0, 1.0, -1.0, 1.0, 5.0, 25.0); - glMatrixMode(GL_MODELVIEW); - glLoadIdentity(); - glTranslatef(0.0, 0.0, -15.0); -} - - -static void -Key(unsigned char key, int x, int y) -{ - (void) x; - (void) y; - switch (key) { - case 27: - exit(0); - break; - } - glutPostRedisplay(); -} - - -static void -SpecialKey(int key, int x, int y) -{ - (void) x; - (void) y; - switch (key) { - case GLUT_KEY_UP: - break; - case GLUT_KEY_DOWN: - break; - case GLUT_KEY_LEFT: - break; - case GLUT_KEY_RIGHT: - break; - } - glutPostRedisplay(); -} - - -static void -Init(void) -{ - /* create initial, empty teximage */ - glBindTexture(GL_TEXTURE_2D, TexObj); - glTexImage2D(GL_TEXTURE_2D, 0, IntFormat, TexWidth, TexHeight, 0, - GL_RGBA, GL_UNSIGNED_BYTE, NULL); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); -} - - - -static void -ParseArgs(int argc, char *argv[]) -{ - int i; - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-nodraw") == 0) - DrawQuad = GL_FALSE; - } -} - - -int -main(int argc, char *argv[]) -{ - GLint mode = GLUT_RGB | GLUT_ALPHA | GLUT_DOUBLE | GLUT_DEPTH; - glutInit(&argc, argv); - - ParseArgs(argc, argv); - - glutInitWindowPosition(0, 0); - glutInitWindowSize(WinWidth, WinHeight); - glutInitDisplayMode(mode); - glutCreateWindow(argv[0]); - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutSpecialFunc(SpecialKey); - glutDisplayFunc(Draw); - - printf("GL_RENDERER: %s\n", (char *) glGetString(GL_RENDERER)); - Init(); - - glutMainLoop(); - return 0; -} diff --git a/progs/tests/tex1d.c b/progs/tests/tex1d.c deleted file mode 100644 index 1fab849dd3..0000000000 --- a/progs/tests/tex1d.c +++ /dev/null @@ -1,139 +0,0 @@ - -/* Exercise 1D textures - */ - -#include -#include -#include -#include -#include -#include "GL/glut.h" - -static GLuint Window = 0; -static GLuint TexObj[2]; -static GLfloat Angle = 0.0f; - - -static void draw( void ) -{ - glClear( GL_COLOR_BUFFER_BIT ); - - glColor3f( 1.0, 1.0, 1.0 ); - - /* draw first polygon */ - glPushMatrix(); - glTranslatef( -1.0, 0.0, 0.0 ); - glRotatef( Angle, 0.0, 0.0, 1.0 ); - glBindTexture( GL_TEXTURE_1D, TexObj[0] ); - glBegin( GL_POLYGON ); - glTexCoord1f( 0.0 ); glVertex2f( -1.0, -1.0 ); - glTexCoord1f( 1.0 ); glVertex2f( 1.0, -1.0 ); - glTexCoord1f( 1.0 ); glVertex2f( 1.0, 1.0 ); - glTexCoord1f( 0.0 ); glVertex2f( -1.0, 1.0 ); - glEnd(); - glPopMatrix(); - - glutSwapBuffers(); -} - - - -static void idle( void ) -{ - Angle += 2.0; - glutPostRedisplay(); -} - - - -/* change view Angle, exit upon ESC */ -static void key(unsigned char k, int x, int y) -{ - (void) x; - (void) y; - switch (k) { - case 27: - exit(0); - } -} - - - -/* new window size or exposure */ -static void reshape( int width, int height ) -{ - glViewport(0, 0, (GLint)width, (GLint)height); - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - /* glOrtho( -3.0, 3.0, -3.0, 3.0, -10.0, 10.0 );*/ - glFrustum( -2.0, 2.0, -2.0, 2.0, 6.0, 20.0 ); - glMatrixMode(GL_MODELVIEW); - glLoadIdentity(); - glTranslatef( 0.0, 0.0, -8.0 ); -} - - -static void init( void ) -{ - GLubyte tex[256][3]; - GLint i; - - - glDisable( GL_DITHER ); - - /* Setup texturing */ - glEnable( GL_TEXTURE_1D ); - glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL ); - - - /* generate texture object IDs */ - glGenTextures( 2, TexObj ); - - /* setup first texture object */ - glBindTexture( GL_TEXTURE_1D, TexObj[0] ); - - - for (i = 0; i < 256; i++) { - GLfloat f; - - /* map 0..255 to -PI .. PI */ - f = ((i / 255.0) - .5) * (3.141592 * 2); - - f = sin(f); - - /* map -1..1 to 0..255 */ - tex[i][0] = (f+1.0)/2.0 * 255.0; - tex[i][1] = 0; - tex[i][2] = 0; - } - - glTexImage1D( GL_TEXTURE_1D, 0, 3, 256, 0, GL_RGB, GL_UNSIGNED_BYTE, tex ); - glTexParameteri( GL_TEXTURE_1D, GL_TEXTURE_MIN_FILTER, GL_NEAREST ); - glTexParameteri( GL_TEXTURE_1D, GL_TEXTURE_MAG_FILTER, GL_NEAREST ); - glTexParameteri( GL_TEXTURE_1D, GL_TEXTURE_WRAP_S, GL_REPEAT ); - glTexParameteri( GL_TEXTURE_1D, GL_TEXTURE_WRAP_T, GL_REPEAT ); -} - - - -int main( int argc, char *argv[] ) -{ - glutInit(&argc, argv); - glutInitWindowPosition(0, 0); - glutInitWindowSize(300, 300); - glutInitDisplayMode( GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE ); - - Window = glutCreateWindow("Texture Objects"); - if (!Window) { - exit(1); - } - - init(); - - glutReshapeFunc( reshape ); - glutKeyboardFunc( key ); -/* glutIdleFunc( idle ); */ - glutDisplayFunc( draw ); - glutMainLoop(); - return 0; -} diff --git a/progs/tests/texcmp.c b/progs/tests/texcmp.c deleted file mode 100644 index 6e822fb689..0000000000 --- a/progs/tests/texcmp.c +++ /dev/null @@ -1,414 +0,0 @@ -/* - * Compressed texture demo. Written by Daniel Borca. - * This program is in the public domain. - */ - -#include -#include -#include -#include -#define GL_GLEXT_PROTOTYPES 1 -#include - -#include "readtex.c" /* I know, this is a hack. */ -#define TEXTURE_FILE "../images/tree2.rgba" - - -static float Rot = 0.0; -static GLboolean Anim = 1; - -typedef struct { - GLubyte *data; - GLuint size; - GLenum format; - GLuint w, h; - - GLenum TC; - - GLubyte *cData; - GLuint cSize; - GLenum cFormat; -} TEXTURE; - -static TEXTURE *Tx, t1, t2, t3; -static GLboolean fxt1, dxtc, s3tc; - - -static const char *TextureName (GLenum TC) -{ - switch (TC) { - case GL_RGB: - return "RGB"; - case GL_RGBA: - return "RGBA"; - case GL_COMPRESSED_RGB: - return "COMPRESSED_RGB"; - case GL_COMPRESSED_RGBA: - return "COMPRESSED_RGBA"; - case GL_COMPRESSED_RGB_FXT1_3DFX: - return "GL_COMPRESSED_RGB_FXT1_3DFX"; - case GL_COMPRESSED_RGBA_FXT1_3DFX: - return "GL_COMPRESSED_RGBA_FXT1_3DFX"; - case GL_COMPRESSED_RGB_S3TC_DXT1_EXT: - return "GL_COMPRESSED_RGB_S3TC_DXT1_EXT"; - case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT: - return "GL_COMPRESSED_RGBA_S3TC_DXT1_EXT"; - case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT: - return "GL_COMPRESSED_RGBA_S3TC_DXT3_EXT"; - case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT: - return "GL_COMPRESSED_RGBA_S3TC_DXT5_EXT"; - case GL_RGB_S3TC: - return "GL_RGB_S3TC"; - case GL_RGB4_S3TC: - return "GL_RGB4_S3TC"; - case GL_RGBA_S3TC: - return "GL_RGBA_S3TC"; - case GL_RGBA4_S3TC: - return "GL_RGBA4_S3TC"; - case 0: - return "Invalid format"; - default: - return "Unknown format"; - } -} - - -static void -PrintString(const char *s) -{ - while (*s) { - glutBitmapCharacter(GLUT_BITMAP_8_BY_13, (int) *s); - s++; - } -} - - -static void Idle( void ) -{ - float t = glutGet(GLUT_ELAPSED_TIME) * 0.001; /* in seconds */ - Rot = t * 360 / 4; /* 1 rotation per 4 seconds */ - glutPostRedisplay(); -} - - -static void Display( void ) -{ - /* draw background gradient */ - glDisable(GL_TEXTURE_2D); - glBegin(GL_POLYGON); - glColor3f(1.0, 0.0, 0.2); glVertex2f(-1.5, -1.0); - glColor3f(1.0, 0.0, 0.2); glVertex2f( 1.5, -1.0); - glColor3f(0.0, 0.0, 1.0); glVertex2f( 1.5, 1.0); - glColor3f(0.0, 0.0, 1.0); glVertex2f(-1.5, 1.0); - glEnd(); - - glPushMatrix(); - glRotatef(Rot, 0, 0, 1); - - glEnable(GL_TEXTURE_2D); - glBegin(GL_POLYGON); - glTexCoord2f(0, 1); glVertex2f(-1, -0.5); - glTexCoord2f(1, 1); glVertex2f( 1, -0.5); - glTexCoord2f(1, 0); glVertex2f( 1, 0.5); - glTexCoord2f(0, 0); glVertex2f(-1, 0.5); - glEnd(); - - glPopMatrix(); - - /* info */ - glColor4f(1, 1, 1, 1); - - glRasterPos3f(-1.2, -0.7, 0); - PrintString("Selected: "); - PrintString(TextureName(Tx->TC)); - if (Tx->cData) { - char tmp[64]; - glRasterPos3f(-1.2, -0.8, 0); - PrintString("Internal: "); - PrintString(TextureName(Tx->cFormat)); - glRasterPos3f(-1.2, -0.9, 0); - PrintString("Size : "); - sprintf(tmp, "%d (%d%% of %d)", Tx->cSize, Tx->cSize * 100 / Tx->size, Tx->size); - PrintString(tmp); - } - - glutSwapBuffers(); -} - - -static void Reshape( int width, int height ) -{ - glViewport( 0, 0, width, height ); - glMatrixMode( GL_PROJECTION ); - glLoadIdentity(); - glOrtho( -1.5, 1.5, -1.0, 1.0, -1.0, 1.0 ); - glMatrixMode( GL_MODELVIEW ); - glLoadIdentity(); -} - - -static void ReInit( GLenum TC, TEXTURE *Tx ) -{ - GLint rv; - - if ((Tx->TC == TC) && (Tx->cData != NULL)) { - glCompressedTexImage2DARB(GL_TEXTURE_2D, /* target */ - 0, /* level */ - Tx->cFormat, /* real format */ - Tx->w, /* original width */ - Tx->h, /* original height */ - 0, /* border */ - Tx->cSize, /* compressed size*/ - Tx->cData); /* compressed data*/ - } else { - glTexImage2D(GL_TEXTURE_2D, /* target */ - 0, /* level */ - TC, /* internal format */ - Tx->w, Tx->h, /* width, height */ - 0, /* border */ - Tx->format, /* texture format */ - GL_UNSIGNED_BYTE, /* texture type */ - Tx->data); /* the texture */ - - /* okay, now cache the compressed texture */ - Tx->TC = TC; - if (Tx->cData != NULL) { - free(Tx->cData); - Tx->cData = NULL; - } - glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_COMPRESSED_ARB, &rv); - if (rv) { - glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_INTERNAL_FORMAT, (GLint *)&Tx->cFormat); - glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_COMPRESSED_IMAGE_SIZE_ARB, (GLint *)&Tx->cSize); - if ((Tx->cData = malloc(Tx->cSize)) != NULL) { - glGetCompressedTexImageARB(GL_TEXTURE_2D, 0, Tx->cData); - } - } - } -} - - -static void Init( void ) -{ - /* HEIGHT * WIDTH + 1 (for trailing '\0') */ - static char pattern[8 * 32 + 1] = {"\ - \ - MMM EEEE SSS AAA \ - M M M E S S A A \ - M M M EEEE SS A A \ - M M M E SS AAAAA \ - M M E S S A A \ - M M EEEE SSS A A \ - " - }; - - GLuint i, j; - - GLubyte (*texture1)[8 * 32][4]; - GLubyte (*texture2)[256][256][4]; - - t1.w = 32; - t1.h = 8; - t1.size = t1.w * t1.h * 4; - t1.data = malloc(t1.size); - t1.format = GL_RGBA; - t1.TC = GL_RGBA; - - texture1 = (GLubyte (*)[8 * 32][4])t1.data; - for (i = 0; i < sizeof(pattern) - 1; i++) { - switch (pattern[i]) { - default: - case ' ': - (*texture1)[i][0] = 255; - (*texture1)[i][1] = 255; - (*texture1)[i][2] = 255; - (*texture1)[i][3] = 64; - break; - case 'M': - (*texture1)[i][0] = 255; - (*texture1)[i][1] = 0; - (*texture1)[i][2] = 0; - (*texture1)[i][3] = 255; - break; - case 'E': - (*texture1)[i][0] = 0; - (*texture1)[i][1] = 255; - (*texture1)[i][2] = 0; - (*texture1)[i][3] = 255; - break; - case 'S': - (*texture1)[i][0] = 0; - (*texture1)[i][1] = 0; - (*texture1)[i][2] = 255; - (*texture1)[i][3] = 255; - break; - case 'A': - (*texture1)[i][0] = 255; - (*texture1)[i][1] = 255; - (*texture1)[i][2] = 0; - (*texture1)[i][3] = 255; - break; - } - } - - t2.w = 256; - t2.h = 256; - t2.size = t2.w * t2.h * 4; - t2.data = malloc(t2.size); - t2.format = GL_RGBA; - t2.TC = GL_RGBA; - - texture2 = (GLubyte (*)[256][256][4])t2.data; - for (j = 0; j < t2.h; j++) { - for (i = 0; i < t2.w; i++) { - (*texture2)[j][i][0] = sqrt(i * j * 255 * 255 / (t2.w * t2.h)); - (*texture2)[j][i][1] = 0; - (*texture2)[j][i][2] = 0; - (*texture2)[j][i][3] = 255; - } - } - - t3.data = LoadRGBImage(TEXTURE_FILE, (GLint *)&t3.w, (GLint *)&t3.h, &t3.format); - t3.size = t3.w * t3.h * ((t3.format == GL_RGB) ? 3 : 4); - t3.TC = GL_RGBA; - - ReInit(GL_RGBA, Tx = &t1); - - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); - glEnable(GL_TEXTURE_2D); - - glEnable(GL_BLEND); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); -} - - -static void Key( unsigned char key, int x, int y ) -{ - (void) x; - (void) y; - switch (key) { - case 27: - exit(0); - break; - case ' ': - Anim = !Anim; - if (Anim) - glutIdleFunc( Idle ); - else - glutIdleFunc( NULL ); - break; - case 't': - if (Tx == &t1) { - Tx = &t2; - } else if (Tx == &t2) { - Tx = &t3; - } else { - Tx = &t1; - } - ReInit(Tx->TC, Tx); - break; - case '9': - ReInit(GL_RGB, Tx); - break; - case '0': - ReInit(GL_RGBA, Tx); - break; - case '1': - ReInit(GL_COMPRESSED_RGB, Tx); - break; - case '2': - ReInit(GL_COMPRESSED_RGBA, Tx); - break; - case '3': - if (fxt1) ReInit(GL_COMPRESSED_RGB_FXT1_3DFX, Tx); - break; - case '4': - if (fxt1) ReInit(GL_COMPRESSED_RGBA_FXT1_3DFX, Tx); - break; - case '5': - if (dxtc) ReInit(GL_COMPRESSED_RGB_S3TC_DXT1_EXT, Tx); - break; - case '6': - if (dxtc) ReInit(GL_COMPRESSED_RGBA_S3TC_DXT1_EXT, Tx); - break; - case '7': - if (dxtc) ReInit(GL_COMPRESSED_RGBA_S3TC_DXT3_EXT, Tx); - break; - case '8': - if (dxtc) ReInit(GL_COMPRESSED_RGBA_S3TC_DXT5_EXT, Tx); - break; - case 'a': - if (s3tc) ReInit(GL_RGB_S3TC, Tx); - break; - case 's': - if (s3tc) ReInit(GL_RGB4_S3TC, Tx); - break; - case 'd': - if (s3tc) ReInit(GL_RGBA_S3TC, Tx); - break; - case 'f': - if (s3tc) ReInit(GL_RGBA4_S3TC, Tx); - break; - } - glutPostRedisplay(); -} - - -int main( int argc, char *argv[] ) -{ - float gl_version; - GLint num_formats; - GLint i; - GLint formats[64]; - - - glutInit( &argc, argv ); - glutInitWindowPosition( 0, 0 ); - glutInitWindowSize( 400, 300 ); - - glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE ); - - if (glutCreateWindow(argv[0]) <= 0) { - printf("Couldn't create window\n"); - exit(0); - } - - gl_version = atof( (const char *) glGetString( GL_VERSION ) ); - if ( (gl_version < 1.3) - && !glutExtensionSupported("GL_ARB_texture_compression") ) { - printf("Sorry, GL_ARB_texture_compression not supported\n"); - exit(0); - } - if (glutExtensionSupported("GL_3DFX_texture_compression_FXT1")) { - fxt1 = GL_TRUE; - } - if (glutExtensionSupported("GL_EXT_texture_compression_s3tc")) { - dxtc = GL_TRUE; - } - if (glutExtensionSupported("GL_S3_s3tc")) { - s3tc = GL_TRUE; - } - - glGetIntegerv( GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB, & num_formats ); - - (void) memset( formats, 0, sizeof( formats ) ); - glGetIntegerv( GL_COMPRESSED_TEXTURE_FORMATS_ARB, formats ); - - printf( "The following texture formats are supported:\n" ); - for ( i = 0 ; i < num_formats ; i++ ) { - printf( "\t%s\n", TextureName( formats[i] ) ); - } - - Init(); - - glutReshapeFunc( Reshape ); - glutKeyboardFunc( Key ); - glutDisplayFunc( Display ); - if (Anim) - glutIdleFunc( Idle ); - - glutMainLoop(); - return 0; -} diff --git a/progs/tests/texcompress2.c b/progs/tests/texcompress2.c deleted file mode 100644 index e2eed756b6..0000000000 --- a/progs/tests/texcompress2.c +++ /dev/null @@ -1,273 +0,0 @@ -/* - * Test texture compression. - */ - - -#define GL_GLEXT_PROTOTYPES -#include -#include -#include -#include -#include "readtex.c" - -#define IMAGE_FILE "../images/arch.rgb" - -static int ImgWidth, ImgHeight; -static GLenum ImgFormat; -static GLenum CompFormat; -static GLfloat EyeDist = 5.0; -static GLfloat Rot = 0.0; -const GLenum Target = GL_TEXTURE_2D; - - -static void -CheckError(int line) -{ - GLenum err = glGetError(); - if (err) { - printf("GL Error %d at line %d\n", (int) err, line); - } -} - - -static const char * -LookupFormat(GLenum format) -{ - switch (format) { - case GL_COMPRESSED_RGB_S3TC_DXT1_EXT: - return "GL_COMPRESSED_RGB_S3TC_DXT1_EXT"; - case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT: - return "GL_COMPRESSED_RGBA_S3TC_DXT1_EXT"; - case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT: - return "GL_COMPRESSED_RGBA_S3TC_DXT3_EXT"; - default: - return "other"; - } -} - - -static void -TestSubTex(void) -{ - GLboolean all = 0*GL_TRUE; - GLubyte *buffer; - GLint size, fmt; - int i; - - glGetTexLevelParameteriv(Target, 0, - GL_TEXTURE_COMPRESSED_IMAGE_SIZE_ARB, &size); - glGetTexLevelParameteriv(Target, 0, GL_TEXTURE_INTERNAL_FORMAT, &fmt); - - buffer = (GLubyte *) malloc(size); - glGetCompressedTexImageARB(Target, 0, buffer); - - printf("Testing sub-texture replacement\n"); - if (all) - glCompressedTexImage2DARB(Target, 0, - fmt, ImgWidth, ImgHeight, 0, - size, buffer); - else { - /* bottom half */ - glCompressedTexSubImage2DARB(Target, 0, - 0, 0, /* pos */ - ImgWidth, ImgHeight / 2, - fmt, size/2, buffer); - /* top half */ - glCompressedTexSubImage2DARB(Target, 0, - 0, ImgHeight / 2, /* pos */ - ImgWidth, ImgHeight / 2, - fmt, size/2, buffer + size / 2); - } - - free(buffer); -} - - -static void -LoadCompressedImage(const char *file) -{ - const GLenum filter = GL_LINEAR; - GLubyte *image; - GLint p; - - glPixelStorei(GL_UNPACK_ALIGNMENT, 1); - glPixelStorei(GL_PACK_ALIGNMENT, 1); - - /* - * Load image and scale if needed. - */ - image = LoadRGBImage( file, &ImgWidth, &ImgHeight, &ImgFormat ); - if (!image) { - printf("Couldn't read %s\n", IMAGE_FILE); - exit(0); - } - printf("Image is %d x %d\n", ImgWidth, ImgHeight); - - /* power of two */ - assert(ImgWidth == 128 || ImgWidth == 256 || ImgWidth == 512); - assert(ImgWidth == 128 || ImgHeight == 256 || ImgHeight == 512); - - if (ImgFormat == GL_RGB) - CompFormat = GL_COMPRESSED_RGB_S3TC_DXT1_EXT; - else - CompFormat = GL_COMPRESSED_RGBA_S3TC_DXT3_EXT; - - if (ImgFormat == GL_RGBA) { - int i, numAlpha = 0; - for (i = 0; i < ImgWidth * ImgHeight; i++) { - if (image[i*4+3] != 0 && image[i*4+3] != 0xff) { - numAlpha++; - } - if (image[i*4+3] == 0) - image[i*4+3] = 4 * i / ImgWidth; - } - printf("Num Alpha !=0,255: %d\n", numAlpha); - } - - CompFormat = GL_COMPRESSED_RGBA_S3TC_DXT5_EXT; - - - /* - * Give image to OpenGL and have it compress it. - */ - glTexImage2D(Target, 0, CompFormat, ImgWidth, ImgHeight, 0, - ImgFormat, GL_UNSIGNED_BYTE, image); - CheckError(__LINE__); - - free(image); - - glGetTexLevelParameteriv(Target, 0, GL_TEXTURE_INTERNAL_FORMAT, &p); - printf("Compressed Internal Format: %s (0x%x)\n", LookupFormat(p), p); - assert(p == CompFormat); - - printf("Original size: %d bytes\n", ImgWidth * ImgHeight * 3); - glGetTexLevelParameteriv(Target, 0, GL_TEXTURE_COMPRESSED_IMAGE_SIZE_ARB, &p); - printf("Compressed size: %d bytes\n", p); - - glTexParameteri(Target, GL_TEXTURE_MIN_FILTER, filter); - glTexParameteri(Target, GL_TEXTURE_MAG_FILTER, filter); - - TestSubTex(); - -} - - -static void -Init(const char *file) -{ - GLint numFormats, formats[100]; - GLint p; - - if (!glutExtensionSupported("GL_ARB_texture_compression")) { - printf("Sorry, GL_ARB_texture_compression is required.\n"); - exit(1); - } - if (!glutExtensionSupported("GL_EXT_texture_compression_s3tc")) { - printf("Sorry, GL_EXT_texture_compression_s3tc is required.\n"); - exit(1); - } - - printf("GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - - glGetIntegerv(GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB, &numFormats); - glGetIntegerv(GL_COMPRESSED_TEXTURE_FORMATS_ARB, formats); - printf("%d supported compression formats: ", numFormats); - for (p = 0; p < numFormats; p++) - printf("0x%x ", formats[p]); - printf("\n"); - - LoadCompressedImage(file); - - glEnable(GL_TEXTURE_2D); - - if (ImgFormat == GL_RGBA) { - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glEnable(GL_BLEND); - } -} - - -static void -Reshape( int width, int height ) -{ - glViewport( 0, 0, width, height ); - glMatrixMode( GL_PROJECTION ); - glLoadIdentity(); - glFrustum(-1, 1, -1, 1, 4, 100); - glMatrixMode( GL_MODELVIEW ); - glLoadIdentity(); -} - - -static void -Key( unsigned char key, int x, int y ) -{ - (void) x; - (void) y; - switch (key) { - case 'd': - EyeDist -= 1.0; - if (EyeDist < 4.0) - EyeDist = 4.0; - break; - case 'D': - EyeDist += 1.0; - break; - case 'z': - Rot += 5.0; - break; - case 'Z': - Rot -= 5.0; - break; - case 27: - exit(0); - break; - } - glutPostRedisplay(); -} - - -static void -Draw( void ) -{ - glClearColor(0.3, 0.3, .8, 0); - glClear(GL_COLOR_BUFFER_BIT); - - glPushMatrix(); - glTranslatef(0, 0, -(EyeDist+0.01)); - glRotatef(Rot, 0, 0, 1); - glBegin(GL_POLYGON); - glTexCoord2f(0, 0); glVertex2f(-1, -1); - glTexCoord2f(1, 0); glVertex2f( 1, -1); - glTexCoord2f(1, 1); glVertex2f( 1, 1); - glTexCoord2f(0, 1); glVertex2f(-1, 1); - glEnd(); - glPopMatrix(); - - glutSwapBuffers(); -} - - -int -main( int argc, char *argv[] ) -{ - glutInit( &argc, argv ); - glutInitWindowSize( 600, 600 ); - - glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE); - - glutCreateWindow(argv[0]); - - glutReshapeFunc( Reshape ); - glutKeyboardFunc( Key ); - glutDisplayFunc( Draw ); - - if (argc > 1) - Init(argv[1]); - else - Init(IMAGE_FILE); - - glutMainLoop(); - return 0; -} diff --git a/progs/tests/texfilt.c b/progs/tests/texfilt.c deleted file mode 100644 index 6ee4bc4eae..0000000000 --- a/progs/tests/texfilt.c +++ /dev/null @@ -1,398 +0,0 @@ -/* - * (C) Copyright IBM Corporation 2005 - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * on the rights to use, copy, modify, merge, publish, distribute, sub - * license, and/or sell copies of the Software, and to permit persons to whom - * the Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL - * IBM AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, - * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR - * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE - * USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - - -#include -#include -#include -#include -#include - -const GLenum filter_modes[] = { - GL_NEAREST, - GL_LINEAR, - GL_NEAREST_MIPMAP_NEAREST, - GL_NEAREST_MIPMAP_LINEAR, - GL_LINEAR_MIPMAP_NEAREST, - GL_LINEAR_MIPMAP_LINEAR, -}; - -static GLenum min_filter = GL_LINEAR_MIPMAP_LINEAR; -static GLenum mag_filter = GL_LINEAR; - -static unsigned segments = 64; -static GLfloat * position_data = NULL; -static GLfloat * texcoord_data = NULL; -static GLfloat max_anisotropy = 0.0; -static GLfloat anisotropy = 1.0; - -static void generate_tunnel( unsigned num_segs, GLfloat ** pos_data, - GLfloat ** tex_data ); -static void generate_textures( unsigned mode ); - -#define min(a,b) ( (a) < (b) ) ? (a) : (b) -#define max(a,b) ( (a) > (b) ) ? (a) : (b) - - -static void Display( void ) -{ - glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, min_filter ); - glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, mag_filter ); - - if ( max_anisotropy > 0.0 ) { - glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, - anisotropy ); - } - - glClear( GL_COLOR_BUFFER_BIT ); - glLoadIdentity(); - glTranslatef( 0.0f, 0.0f, -19.0f ); - - glVertexPointer( 4, GL_FLOAT, 0, position_data ); - glTexCoordPointer( 2, GL_FLOAT, 0, texcoord_data ); - glEnableClientState( GL_VERTEX_ARRAY ); - glEnableClientState( GL_TEXTURE_COORD_ARRAY ); - glDrawArrays( GL_QUADS, 0, 4 * segments ); - glutSwapBuffers(); -} - - -static void Reshape( int width, int height ) -{ - glViewport(0, 0, width, height); - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - gluPerspective(45.0f, (GLfloat)(width)/(GLfloat)(height), 0.1f, 100.0f); - glMatrixMode(GL_MODELVIEW); - glLoadIdentity(); -} - - -static void Key( unsigned char key, int x, int y ) -{ - GLfloat new_anisotropy = anisotropy; - - (void) x; - (void) y; - - - switch( key ) { - case 'a': { - new_anisotropy = anisotropy - 1.0; - break; - } - - case 'A': { - new_anisotropy = anisotropy + 1.0; - break; - } - - case 's': { - segments--; - if ( segments < 3 ) { - segments = 3; - } - generate_tunnel( segments, & position_data, & texcoord_data ); - break; - } - - case 'S': { - segments++; - if ( segments > 128 ) { - segments = 128; - } - generate_tunnel( segments, & position_data, & texcoord_data ); - break; - } - case 'q': - case 'Q': - case 27: - exit(0); - break; - } - - new_anisotropy = max( new_anisotropy, 1.0 ); - new_anisotropy = min( new_anisotropy, max_anisotropy ); - if ( new_anisotropy != anisotropy ) { - anisotropy = new_anisotropy; - printf( "Texture anisotropy: %f%s\n", anisotropy, - (anisotropy == 1.0) ? " (disabled)" : "" ); - } - - glutPostRedisplay(); -} - - -static void SpecialKey( int key, int x, int y ) -{ - (void) x; - (void) y; - (void) key; - glutPostRedisplay(); -} - - -static void menu_handler( int selection ) -{ - switch( selection >> 3 ) { - case 0: - glBindTexture( GL_TEXTURE_2D, selection ); - break; - - case 1: - min_filter = filter_modes[ selection & 7 ]; - break; - - case 2: - mag_filter = filter_modes[ selection & 7 ]; - break; - } - - glutPostRedisplay(); -} - - -static void Init( void ) -{ - glDisable(GL_CULL_FACE); - glEnable(GL_TEXTURE_2D); - glClearColor(0.0f, 0.0f, 0.4f, 0.0f); - glShadeModel(GL_SMOOTH); - glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST); - - generate_tunnel( segments, & position_data, & texcoord_data ); - - glBindTexture( GL_TEXTURE_2D, 1 ); - generate_textures(1); - - glBindTexture( GL_TEXTURE_2D, 2 ); - generate_textures(2); - - glBindTexture( GL_TEXTURE_2D, 3 ); - generate_textures(3); - - if ( glutExtensionSupported( "GL_EXT_texture_filter_anisotropic" ) ) { - glGetFloatv( GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, & max_anisotropy ); - } - - printf("Maximum texture anisotropy: %f\n", max_anisotropy ); - - /* Create the menus. */ - - glutCreateMenu( menu_handler ); - glutAddMenuEntry( "Min filter: GL_NEAREST", 8 + 0 ); - glutAddMenuEntry( "Min filter: GL_LINEAR", 8 + 1 ); - glutAddMenuEntry( "Min filter: GL_NEAREST_MIMMAP_NEAREST", 8 + 2 ); - glutAddMenuEntry( "Min filter: GL_NEAREST_MIMMAP_LINEAR", 8 + 3 ); - glutAddMenuEntry( "Min filter: GL_LINEAR_MIMMAP_NEAREST", 8 + 4 ); - glutAddMenuEntry( "Min filter: GL_LINEAR_MIMMAP_LINEAR", 8 + 5 ); - glutAddMenuEntry( "Mag filter: GL_NEAREST", 16 + 0 ); - glutAddMenuEntry( "Mag filter: GL_LINEAR", 16 + 1 ); - glutAddMenuEntry( "Texture: regular mipmaps", 1 ); - glutAddMenuEntry( "Texture: blended mipmaps", 2 ); - glutAddMenuEntry( "Texture: color mipmaps", 3 ); - glutAttachMenu( GLUT_RIGHT_BUTTON ); -} - - -static void generate_tunnel( unsigned num_segs, GLfloat ** pos_data, - GLfloat ** tex_data ) -{ - const GLfloat far = 20.0f; - const GLfloat near = -90.0f; - const GLfloat far_tex = 30.0f; - const GLfloat near_tex = 0.0f; - const GLfloat angle_step = (2 * M_PI) / num_segs; - const GLfloat tex_coord_step = 2.0 / num_segs; - GLfloat angle = 0.0f; - GLfloat tex_coord = 0.0f; - unsigned i; - GLfloat * position; - GLfloat * texture; - - - position = realloc( *pos_data, sizeof( GLfloat ) * num_segs * 4 * 4 ); - texture = realloc( *tex_data, sizeof( GLfloat ) * num_segs * 4 * 2 ); - - *pos_data = position; - *tex_data = texture; - - for ( i = 0 ; i < num_segs ; i++ ) { - position[0] = 2.5 * sinf( angle ); - position[1] = 2.5 * cosf( angle ); - position[2] = (i & 1) ? far : near; - position[3] = 1.0f; - - position[4] = position[0]; - position[5] = position[1]; - position[6] = (i & 1) ? near : far; - position[7] = 1.0f; - - position += 8; - - texture[0] = tex_coord; - texture[1] = (i & 1) ? far_tex : near_tex; - texture += 2; - - texture[0] = tex_coord; - texture[1] = (i & 1) ? near_tex : far_tex; - texture += 2; - - angle += angle_step; - tex_coord += tex_coord_step; - - position[0] = 2.5 * sinf( angle ); - position[1] = 2.5 * cosf( angle ); - position[2] = (i & 1) ? near : far; - position[3] = 1.0f; - - position[4] = position[0]; - position[5] = position[1]; - position[6] = (i & 1) ? far : near; - position[7] = 1.0f; - - position += 8; - - texture[0] = tex_coord; - texture[1] = (i & 1) ? near_tex : far_tex; - texture += 2; - - texture[0] = tex_coord; - texture[1] = (i & 1) ? far_tex : near_tex; - texture += 2; - } -} - - -static void generate_textures( unsigned mode ) -{ -#define LEVEL_COLORS 6 - const GLfloat colors[LEVEL_COLORS][3] = { - { 1.0, 0.0, 0.0 }, /* 32 x 32 */ - { 0.0, 1.0, 0.0 }, /* 16 x 16 */ - { 0.0, 0.0, 1.0 }, /* 8 x 8 */ - { 1.0, 0.0, 1.0 }, /* 4 x 4 */ - { 1.0, 1.0, 1.0 }, /* 2 x 2 */ - { 1.0, 1.0, 0.0 } /* 1 x 1 */ - }; - const unsigned checkers_per_level = 2; - GLfloat * tex; - unsigned level; - unsigned size; - GLint max_size; - - - glGetIntegerv( GL_MAX_TEXTURE_SIZE, & max_size ); - if ( max_size > 512 ) { - max_size = 512; - } - - tex = malloc( sizeof( GLfloat ) * 3 * max_size * max_size ); - - level = 0; - for ( size = max_size ; size > 0 ; size >>= 1 ) { - unsigned divisor = size / checkers_per_level; - unsigned i; - unsigned j; - GLfloat checkers[2][3]; - - - if ((level == 0) || (mode == 1)) { - checkers[0][0] = 1.0; - checkers[0][1] = 1.0; - checkers[0][2] = 1.0; - checkers[1][0] = 0.0; - checkers[1][1] = 0.0; - checkers[1][2] = 0.0; - } - else if (mode == 2) { - checkers[0][0] = colors[level % LEVEL_COLORS][0]; - checkers[0][1] = colors[level % LEVEL_COLORS][1]; - checkers[0][2] = colors[level % LEVEL_COLORS][2]; - checkers[1][0] = colors[level % LEVEL_COLORS][0] * 0.5; - checkers[1][1] = colors[level % LEVEL_COLORS][1] * 0.5; - checkers[1][2] = colors[level % LEVEL_COLORS][2] * 0.5; - } - else { - checkers[0][0] = colors[level % LEVEL_COLORS][0]; - checkers[0][1] = colors[level % LEVEL_COLORS][1]; - checkers[0][2] = colors[level % LEVEL_COLORS][2]; - checkers[1][0] = colors[level % LEVEL_COLORS][0]; - checkers[1][1] = colors[level % LEVEL_COLORS][1]; - checkers[1][2] = colors[level % LEVEL_COLORS][2]; - } - - if ( divisor == 0 ) { - divisor = 1; - - checkers[0][0] = (checkers[0][0] + checkers[1][0]) / 2; - checkers[0][1] = (checkers[0][0] + checkers[1][0]) / 2; - checkers[0][2] = (checkers[0][0] + checkers[1][0]) / 2; - checkers[1][0] = checkers[0][0]; - checkers[1][1] = checkers[0][1]; - checkers[1][2] = checkers[0][2]; - } - - - for ( i = 0 ; i < size ; i++ ) { - for ( j = 0 ; j < size ; j++ ) { - const unsigned idx = ((i ^ j) / divisor) & 1; - - tex[ ((i * size) + j) * 3 + 0] = checkers[ idx ][0]; - tex[ ((i * size) + j) * 3 + 1] = checkers[ idx ][1]; - tex[ ((i * size) + j) * 3 + 2] = checkers[ idx ][2]; - } - } - - glTexImage2D( GL_TEXTURE_2D, level, GL_RGB, size, size, 0, - GL_RGB, GL_FLOAT, tex ); - level++; - } - - free( tex ); -} - - -int main( int argc, char ** argv ) -{ - glutInit( &argc, argv ); - glutInitWindowPosition( 0, 0 ); - glutInitWindowSize( 800, 600 ); - glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE ); - glutCreateWindow( "Texture Filter Test" ); - glutReshapeFunc( Reshape ); - glutKeyboardFunc( Key ); - glutSpecialFunc( SpecialKey ); - glutDisplayFunc( Display ); - - Init(); - - printf("\nUse the right-button menu to select the texture and filter mode.\n"); - printf("Use 'A' and 'a' to increase and decrease the aniotropy.\n"); - printf("Use 'S' and 's' to increase and decrease the number of cylinder segments.\n"); - printf("Use 'q' to exit.\n\n"); - - glutMainLoop(); - return 0; -} diff --git a/progs/tests/texgenmix.c b/progs/tests/texgenmix.c deleted file mode 100644 index be8f6775c7..0000000000 --- a/progs/tests/texgenmix.c +++ /dev/null @@ -1,640 +0,0 @@ - -/* - * Demonstrates mixed texgen/non-texgen texture coordinates. - */ - -#include -#include -#include -#include - -#undef max -#undef min -#define max( a, b ) ((a) >= (b) ? (a) : (b)) -#define min( a, b ) ((a) <= (b) ? (a) : (b)) - -GLfloat labelColor0[4] = { 1.0, 1.0, 1.0, 1.0 }; -GLfloat labelColor1[4] = { 1.0, 1.0, 0.4, 1.0 }; -GLfloat *labelInfoColor = labelColor0; - -GLboolean doubleBuffered = GL_TRUE; -GLboolean drawTextured = GL_TRUE; - -int textureWidth = 64; -int textureHeight = 64; - -int winWidth = 580, winHeight = 720; - -const GLfloat texmat_swap_rq[16] = { 1.0, 0.0, 0.0, 0.0, - 0.0, 1.0, 0.0, 0.0, - 0.0, 0.0, 0.0, 1.0, - 0.0, 0.0, 1.0, 0.0}; - -const GLfloat nullPlane[4] = { 0.0, 0.0, 0.0, 0.0 }; -const GLfloat ObjPlaneS1[4] = { 1.0, 0.0, 1.0, 0.0 }; -const GLfloat ObjPlaneS2[4] = { 0.5, 0.0, 0.0, 0.0 }; -const GLfloat ObjPlaneS3[4] = { 1.0, 0.0, 0.0, 0.0 }; -const GLfloat ObjPlaneT[4] = { 0.0, 1.0, 0.0, 0.0 }; -const GLfloat ObjPlaneT2[4] = { 0.0, 0.5, 0.0, 0.0 }; -const GLfloat ObjPlaneT3[4] = { 0.0, 1.0, 0.0, 0.0 }; -const GLfloat ObjPlaneR[4] = { 0.0, 0.0, 1.0, 0.0 }; -const GLfloat ObjPlaneQ[4] = { 0.0, 0.0, 0.0, 0.5 }; - - -static void checkErrors( void ) -{ - GLenum error; - - while ( (error = glGetError()) != GL_NO_ERROR ) { - fprintf( stderr, "Error: %s\n", (char *) gluErrorString( error ) ); - } -} - -static void drawString( const char *string, GLfloat x, GLfloat y, - const GLfloat color[4] ) -{ - glColor4fv( color ); - glRasterPos2f( x, y ); - - while ( *string ) { - glutBitmapCharacter( GLUT_BITMAP_TIMES_ROMAN_10, *string ); - string++; - } -} - -static void begin2D( int width, int height ) -{ - glMatrixMode( GL_PROJECTION ); - - glPushMatrix(); - glLoadIdentity(); - - glOrtho( 0, width, 0, height, -1, 1 ); - glMatrixMode( GL_MODELVIEW ); - - glPushMatrix(); - glLoadIdentity(); -} - -static void end2D( void ) -{ - glMatrixMode( GL_PROJECTION ); - glPopMatrix(); - glMatrixMode( GL_MODELVIEW ); - glPopMatrix(); -} - -static void initialize( void ) -{ - glMatrixMode( GL_PROJECTION ); - glLoadIdentity(); - - glOrtho( -1.5, 1.5, -1.5, 1.5, -1.5, 1.5 ); - - glMatrixMode(GL_MODELVIEW); - glLoadIdentity(); - - glShadeModel( GL_FLAT ); -} - -/* ARGSUSED1 */ -static void keyboard( unsigned char c, int x, int y ) -{ - switch ( c ) { - case 't': - drawTextured = !drawTextured; - break; - case 27: /* Escape key should force exit. */ - exit(0); - break; - default: - break; - } - glutPostRedisplay(); -} - -/* ARGSUSED1 */ -static void special( int key, int x, int y ) -{ - switch ( key ) { - case GLUT_KEY_DOWN: - break; - case GLUT_KEY_UP: - break; - case GLUT_KEY_LEFT: - break; - case GLUT_KEY_RIGHT: - break; - default: - break; - } - glutPostRedisplay(); -} - -static void -reshape( int w, int h ) -{ - winWidth = w; - winHeight = h; - /* No need to call glViewPort here since "draw" calls it! */ -} - -static void loadTexture( int width, int height ) -{ - int alphaSize = 1; - int rgbSize = 3; - GLubyte *texImage, *p; - int elementsPerGroup, elementSize, groupSize, rowSize; - int i, j; - - - elementsPerGroup = alphaSize + rgbSize; - elementSize = sizeof(GLubyte); - groupSize = elementsPerGroup * elementSize; - rowSize = width * groupSize; - - if ( (texImage = (GLubyte *) malloc( height * rowSize ) ) == NULL ) { - fprintf( stderr, "texture malloc failed\n" ); - return; - } - - for ( i = 0 ; i < height ; i++ ) - { - p = texImage + i * rowSize; - - for ( j = 0 ; j < width ; j++ ) - { - if ( rgbSize > 0 ) - { - /** - ** +-----+-----+ - ** | | | - ** | R | G | - ** | | | - ** +-----+-----+ - ** | | | - ** | Y | B | - ** | | | - ** +-----+-----+ - **/ - if ( i > height / 2 ) { - if ( j < width / 2 ) { - p[0] = 0xff; - p[1] = 0x00; - p[2] = 0x00; - } else { - p[0] = 0x00; - p[1] = 0xff; - p[2] = 0x00; - } - } else { - if ( j < width / 2 ) { - p[0] = 0xff; - p[1] = 0xff; - p[2] = 0x00; - } else { - p[0] = 0x00; - p[1] = 0x00; - p[2] = 0xff; - } - } - p += 3 * elementSize; - } - - if ( alphaSize > 0 ) - { - /** - ** +-----------+ - ** | W | - ** | +-----+ | - ** | | | | - ** | | B | | - ** | | | | - ** | +-----+ | - ** | | - ** +-----------+ - **/ - int i2 = i - height / 2; - int j2 = j - width / 2; - int h8 = height / 8; - int w8 = width / 8; - if ( -h8 <= i2 && i2 <= h8 && -w8 <= j2 && j2 <= w8 ) { - p[0] = 0x00; - } else if ( -2 * h8 <= i2 && i2 <= 2 * h8 && -2 * w8 <= j2 && j2 <= 2 * w8 ) { - p[0] = 0x55; - } else if ( -3 * h8 <= i2 && i2 <= 3 * h8 && -3 * w8 <= j2 && j2 <= 3 * w8 ) { - p[0] = 0xaa; - } else { - p[0] = 0xff; - } - p += elementSize; - } - } - } - - glTexImage2D( GL_TEXTURE_2D, 0, - GL_RGBA, width, height, 0, - GL_RGBA, GL_UNSIGNED_BYTE, texImage ); - - free( texImage ); -} - - -static void drawSample( int x, int y, int w, int h, - int texgenenabled, int coordnr ) -{ - char buf[255]; - - glViewport( x, y, w, h ); - glScissor( x, y, w, h ); - - glClearColor( 0.1, 0.1, 0.1, 1.0 ); - glClear( GL_COLOR_BUFFER_BIT ); - - begin2D( w, h ); - if (texgenenabled == 2) { - sprintf( buf, "TexCoord%df", coordnr); - drawString( buf, 10, h - 15, labelInfoColor ); - sprintf( buf, "texgen enabled for %s coordinate(s)", coordnr == 2 ? "S" : "S/T"); - drawString( buf, 10, 5, labelInfoColor ); - } - else if (texgenenabled == 0) { - sprintf( buf, "TexCoord%df", coordnr); - drawString( buf, 10, h - 15, labelInfoColor ); - drawString( "no texgen", 10, 5, labelInfoColor ); - } - else if (texgenenabled == 1) { - drawString( "no TexCoord", 10, h - 15, labelInfoColor ); - sprintf( buf, "texgen enabled for %s coordinate(s)", - coordnr == 2 ? "S/T" : (coordnr == 3 ? "S/T/R" : "S/T/R/Q")); - drawString( buf, 10, 5, labelInfoColor ); - } - - end2D(); - - glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE ); - - glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST ); - glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST ); - - glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP ); - glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP ); - - loadTexture( textureWidth, textureHeight ); - - if ( drawTextured ) { - glEnable( GL_TEXTURE_2D ); - } - - glDisable( GL_TEXTURE_GEN_S ); - glDisable( GL_TEXTURE_GEN_T ); - glDisable( GL_TEXTURE_GEN_R ); - glDisable( GL_TEXTURE_GEN_Q ); - - glMatrixMode( GL_TEXTURE ); - glLoadIdentity(); - glMatrixMode( GL_MODELVIEW ); - glPushMatrix(); - - switch (coordnr) { - case 2: - switch (texgenenabled) { - case 0: - glBegin( GL_QUADS ); - glTexCoord2f( 0.0, 0.0 ); - glVertex2f( -0.8, -0.8 ); - - glTexCoord2f( 1.0, 0.0 ); - glVertex2f( 0.8, -0.8 ); - - glTexCoord2f( 1.0, 1.0 ); - glVertex2f( 0.8, 0.8 ); - - glTexCoord2f( 0.0, 1.0 ); - glVertex2f( -0.8, 0.8 ); - glEnd(); - break; - case 1: - glTranslatef( -0.8, -0.8, 0.0 ); - glScalef( 1.6, 1.6, 1.0 ); - glTexGeni( GL_S, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR ); - glTexGeni( GL_T, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR ); - glTexGeni( GL_R, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR ); - glTexGeni( GL_Q, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR ); - glTexGenfv(GL_S, GL_OBJECT_PLANE, ObjPlaneS3); - glTexGenfv(GL_T, GL_OBJECT_PLANE, ObjPlaneT3); - glTexGenfv(GL_R, GL_OBJECT_PLANE, nullPlane); - glTexGenfv(GL_Q, GL_OBJECT_PLANE, nullPlane); - - glEnable( GL_TEXTURE_GEN_S ); - glEnable( GL_TEXTURE_GEN_T ); - - /* Issue a texcoord here to be sure Q isn't left over from a - * previous sample. - */ - glTexCoord1f( 0.0 ); - glBegin( GL_QUADS ); - glVertex2f( 0.0, 0.0 ); - glVertex2f( 1.0, 0.0 ); - glVertex2f( 1.0, 1.0 ); - glVertex2f( 0.0, 1.0 ); - glEnd(); - break; - case 2: - /* make sure that texgen T and non-texgen S coordinate are wrong */ - glTexGeni( GL_S, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR ); - glTexGeni( GL_T, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR ); - glTexGeni( GL_R, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR ); - glTexGeni( GL_Q, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR ); - glTexGenfv(GL_S, GL_OBJECT_PLANE, ObjPlaneS1); - glTexGenfv(GL_T, GL_OBJECT_PLANE, nullPlane); - glTexGenfv(GL_R, GL_OBJECT_PLANE, nullPlane); - glTexGenfv(GL_Q, GL_OBJECT_PLANE, nullPlane); - - glEnable( GL_TEXTURE_GEN_S ); - - glBegin( GL_QUADS ); - /* use z coordinate to get correct texgen values... */ - glTexCoord2f( 0.0, 0.0 ); - glVertex3f( -0.8, -0.8, 0.8 ); - - glTexCoord2f( 0.0, 0.0 ); - glVertex3f( 0.8, -0.8, 0.2 ); - - glTexCoord2f( 0.0, 1.0 ); - glVertex3f( 0.8, 0.8, 0.2 ); - - glTexCoord2f( 0.0, 1.0 ); - glVertex3f( -0.8, 0.8, 0.8 ); - glEnd(); - break; - } - break; - case 3: - glMatrixMode( GL_TEXTURE ); - glLoadMatrixf( texmat_swap_rq ); - glMatrixMode( GL_MODELVIEW ); - glTranslatef( -0.8, -0.8, 0.0 ); - glScalef( 1.6, 1.6, 1.0 ); - switch (texgenenabled) { - case 0: - glBegin( GL_QUADS ); - glTexCoord3f( 0.0, 0.0, 0.5 ); - glVertex2f( 0.0, 0.0 ); - - glTexCoord3f( 0.5, 0.0, 0.5 ); - glVertex2f( 1.0, 0.0 ); - - glTexCoord3f( 0.5, 0.5, 0.5 ); - glVertex2f( 1.0, 1.0 ); - - glTexCoord3f( 0.0, 0.5, 0.5 ); - glVertex2f( 0.0, 1.0 ); - glEnd(); - break; - case 1: - glTexGeni( GL_S, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR ); - glTexGeni( GL_T, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR ); - glTexGeni( GL_R, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR ); - glTexGeni( GL_Q, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR ); - glTexGenfv(GL_S, GL_OBJECT_PLANE, ObjPlaneS2); - glTexGenfv(GL_T, GL_OBJECT_PLANE, ObjPlaneT2); - glTexGenfv(GL_R, GL_OBJECT_PLANE, ObjPlaneR); - glTexGenfv(GL_Q, GL_OBJECT_PLANE, nullPlane); - - glEnable( GL_TEXTURE_GEN_S ); - glEnable( GL_TEXTURE_GEN_T ); - glEnable( GL_TEXTURE_GEN_R ); - - glTexCoord1f( 0.0 ); /* to make sure Q is 1.0 */ - glBegin( GL_QUADS ); - glVertex3f( 0.0, 0.0, 0.5 ); - glVertex3f( 1.0, 0.0, 0.5 ); - glVertex3f( 1.0, 1.0, 0.5 ); - glVertex3f( 0.0, 1.0, 0.5 ); - glEnd(); - break; - case 2: - /* make sure that texgen R/Q and non-texgen S/T coordinates are wrong */ - glTexGeni( GL_S, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR ); - glTexGeni( GL_T, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR ); - glTexGeni( GL_R, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR ); - glTexGeni( GL_Q, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR ); - glTexGenfv(GL_S, GL_OBJECT_PLANE, ObjPlaneS2); - glTexGenfv(GL_T, GL_OBJECT_PLANE, ObjPlaneT2); - glTexGenfv(GL_R, GL_OBJECT_PLANE, nullPlane); - glTexGenfv(GL_Q, GL_OBJECT_PLANE, nullPlane); - - glEnable( GL_TEXTURE_GEN_S ); - glEnable( GL_TEXTURE_GEN_T ); - - glBegin( GL_QUADS ); - glTexCoord3f( 0.0, 0.0, 0.5 ); - glVertex2f( 0.0, 0.0); - - glTexCoord3f( 0.0, 0.0, 0.5 ); - glVertex2f( 1.0, 0.0); - - glTexCoord3f( 0.0, 0.0, 0.5 ); - glVertex2f( 1.0, 1.0); - - glTexCoord3f( 0.0, 0.0, 0.5 ); - glVertex2f( 0.0, 1.0); - glEnd(); - break; - } - break; - case 4: - switch (texgenenabled) { - case 0: - glBegin( GL_QUADS ); - /* don't need r coordinate but still setting it I'm mean */ - glTexCoord4f( 0.0, 0.0, 0.0, 0.5 ); - glVertex2f( -0.8, -0.8 ); - - glTexCoord4f( 0.5, 0.0, 0.2, 0.5 ); - glVertex2f( 0.8, -0.8 ); - - glTexCoord4f( 0.5, 0.5, 0.5, 0.5 ); - glVertex2f( 0.8, 0.8 ); - - glTexCoord4f( 0.0, 0.5, 0.5, 0.5 ); - glVertex2f( -0.8, 0.8 ); - glEnd(); - break; - case 1: - glTranslatef( -0.8, -0.8, 0.0 ); - glScalef( 1.6, 1.6, 1.0 ); - /* make sure that texgen R/Q and non-texgen S/T coordinates are wrong */ - glTexGeni( GL_S, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR ); - glTexGeni( GL_T, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR ); - glTexGeni( GL_R, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR ); - glTexGeni( GL_Q, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR ); - glTexGenfv(GL_S, GL_OBJECT_PLANE, ObjPlaneS2); - glTexGenfv(GL_T, GL_OBJECT_PLANE, ObjPlaneT2); - glTexGenfv(GL_R, GL_OBJECT_PLANE, ObjPlaneR); - glTexGenfv(GL_Q, GL_OBJECT_PLANE, ObjPlaneQ); - - glEnable( GL_TEXTURE_GEN_S ); - glEnable( GL_TEXTURE_GEN_T ); - glEnable( GL_TEXTURE_GEN_R ); - glEnable( GL_TEXTURE_GEN_Q ); - - glBegin( GL_QUADS ); - glVertex2f( 0.0, 0.0 ); - glVertex2f( 1.0, 0.0 ); - glVertex2f( 1.0, 1.0 ); - glVertex2f( 0.0, 1.0 ); - glEnd(); - break; - case 2: - glTranslatef( -0.8, -0.8, 0.0 ); - glScalef( 1.6, 1.6, 1.0 ); - /* make sure that texgen R/Q and non-texgen S/T coordinates are wrong */ - glTexGeni( GL_S, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR ); - glTexGeni( GL_T, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR ); - glTexGeni( GL_R, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR ); - glTexGeni( GL_Q, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR ); - glTexGenfv(GL_S, GL_OBJECT_PLANE, ObjPlaneS2); - glTexGenfv(GL_T, GL_OBJECT_PLANE, ObjPlaneT2); - glTexGenfv(GL_R, GL_OBJECT_PLANE, nullPlane); - glTexGenfv(GL_Q, GL_OBJECT_PLANE, nullPlane); - - glEnable( GL_TEXTURE_GEN_S ); - glEnable( GL_TEXTURE_GEN_T ); - - glBegin( GL_QUADS ); - glTexCoord4f( 0.0, 0.0, 0.0, 0.5 ); - glVertex2f( 0.0, 0.0 ); - - glTexCoord4f( 0.0, 0.0, 0.2, 0.5 ); - glVertex2f( 1.0, 0.0 ); - - glTexCoord4f( 0.0, 0.0, 0.5, 0.5 ); - glVertex2f( 1.0, 1.0 ); - - glTexCoord4f( 0.0, 0.0, 0.75, 0.5 ); - glVertex2f( 0.0, 1.0 ); - glEnd(); - break; - } - break; - } - - glPopMatrix(); - glDisable( GL_TEXTURE_2D ); - -} - -static void display( void ) -{ - int numX = 3, numY = 3; - float xBase = (float) winWidth * 0.01; - float xOffset = (winWidth - xBase) / numX; - float xSize = max( xOffset - xBase, 1 ); - float yBase = (float) winHeight * 0.01; - float yOffset = (winHeight - yBase) / numY; - float ySize = max( yOffset - yBase, 1 ); - float x, y; - int i, j; - - glViewport( 0, 0, winWidth, winHeight ); - glDisable( GL_SCISSOR_TEST ); - glClearColor( 0.0, 0.0, 0.0, 0.0 ); - glClear( GL_COLOR_BUFFER_BIT ); - glEnable( GL_SCISSOR_TEST ); - - x = xBase; - y = (winHeight - 1) - yOffset; - - for ( i = 0 ; i < numY ; i++ ) - { - - labelInfoColor = labelColor1; - - - for ( j = 0 ; j < numX ; j++ ) { - drawSample( x, y, xSize, ySize, i, j+2 ); - x += xOffset; - } - - x = xBase; - y -= yOffset; - } - - if ( doubleBuffered ) { - glutSwapBuffers(); - } else { - glFlush(); - } - - checkErrors(); -} - -static void usage( char *name ) -{ - fprintf( stderr, "usage: %s [ options ]\n", name ); - fprintf( stderr, "\n" ); - fprintf( stderr, "options:\n" ); - fprintf( stderr, " -sb single buffered\n" ); - fprintf( stderr, " -db double buffered\n" ); - fprintf( stderr, " -info print OpenGL driver info\n" ); -} - -static void instructions( void ) -{ - fprintf( stderr, "texgenmix - mixed texgen/non-texgen texture coordinate test\n" ); - fprintf( stderr, "all quads should look the same!\n" ); - fprintf( stderr, "\n" ); - fprintf( stderr, " [t] - toggle texturing\n" ); -} - -int main( int argc, char *argv[] ) -{ - GLboolean info = GL_FALSE; - int i; - - glutInit( &argc, argv ); - - for ( i = 1 ; i < argc ; i++ ) { - if ( !strcmp( "-sb", argv[i] ) ) { - doubleBuffered = GL_FALSE; - } else if ( !strcmp( "-db", argv[i] ) ) { - doubleBuffered = GL_TRUE; - } else if ( !strcmp( "-info", argv[i] ) ) { - info = GL_TRUE; - } else { - usage( argv[0] ); - exit( 1 ); - } - } - - if ( doubleBuffered ) { - glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE ); - } else { - glutInitDisplayMode( GLUT_RGB | GLUT_SINGLE ); - } - - glutInitWindowSize( winWidth, winHeight ); - glutInitWindowPosition( 0, 0 ); - glutCreateWindow( "Mixed texgen/non-texgen texture coordinate test" ); - - initialize(); - instructions(); - - if ( info ) { - printf( "\n" ); - printf( "GL_RENDERER = %s\n", (char *) glGetString( GL_RENDERER ) ); - printf( "GL_VERSION = %s\n", (char *) glGetString( GL_VERSION ) ); - printf( "GL_VENDOR = %s\n", (char *) glGetString( GL_VENDOR ) ) ; - printf( "GL_EXTENSIONS = %s\n", (char *) glGetString( GL_EXTENSIONS ) ); - } - - glutDisplayFunc( display ); - glutReshapeFunc( reshape ); - glutKeyboardFunc( keyboard ); - glutSpecialFunc( special ); - glutMainLoop(); - - return 0; -} diff --git a/progs/tests/texline.c b/progs/tests/texline.c deleted file mode 100644 index 76dfccd9b1..0000000000 --- a/progs/tests/texline.c +++ /dev/null @@ -1,278 +0,0 @@ - -/* - * Test textured lines. - * - * Brian Paul - * September 2000 - */ - -#include -#include -#include -#include -#include "../util/readtex.c" /* I know, this is a hack. */ - -#define TEXTURE_FILE "../images/girl.rgb" - -static GLboolean Antialias = GL_FALSE; -static GLboolean Animate = GL_FALSE; -static GLint Texture = 1; -static GLboolean Stipple = GL_FALSE; -static GLfloat LineWidth = 1.0; - -static GLfloat Xrot = -60.0, Yrot = 0.0, Zrot = 0.0; -static GLfloat DYrot = 1.0; -static GLboolean Points = GL_FALSE; -static GLfloat Scale = 1.0; - -static void Idle( void ) -{ - if (Animate) { - Zrot += DYrot; - glutPostRedisplay(); - } -} - - -static void Display( void ) -{ - GLfloat x, y, s, t; - - glClear( GL_COLOR_BUFFER_BIT ); - - glPushMatrix(); - glRotatef(Xrot, 1.0, 0.0, 0.0); - glRotatef(Yrot, 0.0, 1.0, 0.0); - glRotatef(Zrot, 0.0, 0.0, 1.0); - glScalef(Scale, Scale, Scale); - - if (Texture) - glColor3f(1, 1, 1); - - if (Points) { - glBegin(GL_POINTS); - for (t = 0.0; t <= 1.0; t += 0.025) { - for (s = 0.0; s <= 1.0; s += 0.025) { - x = s * 2.0 - 1.0; - y = t * 2.0 - 1.0; - if (!Texture) - glColor3f(1, 0, 1); - glMultiTexCoord2fARB(GL_TEXTURE1_ARB, t, s); - glTexCoord2f(s, t); - glVertex2f(x, y); - } - } - glEnd(); - } - else { - glBegin(GL_LINES); - for (t = 0.0; t <= 1.0; t += 0.025) { - x = t * 2.0 - 1.0; - if (!Texture) - glColor3f(1, 0, 1); - glTexCoord2f(t, 0.0); - glMultiTexCoord2fARB(GL_TEXTURE1_ARB, 0.0, t); - glVertex2f(x, -1.0); - if (!Texture) - glColor3f(0, 1, 0); - glTexCoord2f(t, 1.0); - glMultiTexCoord2fARB(GL_TEXTURE1_ARB, 1.0, t); - glVertex2f(x, 1.0); - } - glEnd(); - } - - glPopMatrix(); - - glutSwapBuffers(); -} - - -static void Reshape( int width, int height ) -{ - GLfloat ar = (float) width / height; - glViewport( 0, 0, width, height ); - glMatrixMode( GL_PROJECTION ); - glLoadIdentity(); - glFrustum( -ar, ar, -1.0, 1.0, 10.0, 100.0 ); - glMatrixMode( GL_MODELVIEW ); - glLoadIdentity(); - glTranslatef( 0.0, 0.0, -12.0 ); -} - - -static void Key( unsigned char key, int x, int y ) -{ - (void) x; - (void) y; - switch (key) { - case 'a': - Antialias = !Antialias; - if (Antialias) { - glEnable(GL_LINE_SMOOTH); - glEnable(GL_POINT_SMOOTH); - glEnable(GL_BLEND); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - } - else { - glDisable(GL_LINE_SMOOTH); - glDisable(GL_POINT_SMOOTH); - glDisable(GL_BLEND); - } - break; - case 't': - Texture++; - if (Texture > 2) - Texture = 0; - if (Texture == 0) { - glActiveTextureARB(GL_TEXTURE0_ARB); - glDisable(GL_TEXTURE_2D); - glActiveTextureARB(GL_TEXTURE1_ARB); - glDisable(GL_TEXTURE_2D); - } - else if (Texture == 1) { - glActiveTextureARB(GL_TEXTURE0_ARB); - glEnable(GL_TEXTURE_2D); - glActiveTextureARB(GL_TEXTURE1_ARB); - glDisable(GL_TEXTURE_2D); - } - else { - glActiveTextureARB(GL_TEXTURE0_ARB); - glEnable(GL_TEXTURE_2D); - glActiveTextureARB(GL_TEXTURE1_ARB); - glEnable(GL_TEXTURE_2D); - } - break; - case 'w': - LineWidth -= 0.25; - if (LineWidth < 0.25) - LineWidth = 0.25; - glLineWidth(LineWidth); - glPointSize(LineWidth); - break; - case 'W': - LineWidth += 0.25; - if (LineWidth > 8.0) - LineWidth = 8.0; - glLineWidth(LineWidth); - glPointSize(LineWidth); - break; - case 'p': - Points = !Points; - break; - case 's': - Stipple = !Stipple; - if (Stipple) - glEnable(GL_LINE_STIPPLE); - else - glDisable(GL_LINE_STIPPLE); - break; - case ' ': - Animate = !Animate; - if (Animate) - glutIdleFunc(Idle); - else - glutIdleFunc(NULL); - break; - case 27: - exit(0); - break; - } - printf("LineWidth, PointSize = %f\n", LineWidth); - glutPostRedisplay(); -} - - -static void SpecialKey( int key, int x, int y ) -{ - float step = 3.0; - (void) x; - (void) y; - - switch (key) { - case GLUT_KEY_UP: - Xrot += step; - break; - case GLUT_KEY_DOWN: - Xrot -= step; - break; - case GLUT_KEY_LEFT: - Yrot += step; - break; - case GLUT_KEY_RIGHT: - Yrot -= step; - break; - } - glutPostRedisplay(); -} - - -static void Init( int argc, char *argv[] ) -{ - GLfloat r[2]; - GLuint u; - - for (u = 0; u < 2; u++) { - glActiveTextureARB(GL_TEXTURE0_ARB + u); - glBindTexture(GL_TEXTURE_2D, 10+u); - if (u == 0) - glEnable(GL_TEXTURE_2D); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - - if (u == 0) - glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); - else - glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_ADD); - - glPixelStorei(GL_UNPACK_ALIGNMENT, 1); - if (!LoadRGBMipmaps(TEXTURE_FILE, GL_RGB)) { - printf("Error: couldn't load texture image\n"); - exit(1); - } - } - - glLineStipple(1, 0xff); - - if (argc > 1 && strcmp(argv[1], "-info")==0) { - printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - printf("GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - printf("GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - printf("GL_EXTENSIONS = %s\n", (char *) glGetString(GL_EXTENSIONS)); - } - - glGetFloatv(GL_ALIASED_POINT_SIZE_RANGE, r); - printf("Non-smooth point size range: %g .. %g\n", r[0], r[1]); - glGetFloatv(GL_POINT_SIZE_RANGE, r); - printf("Smoothed point size range: %g .. %g\n", r[0], r[1]); - glGetFloatv(GL_ALIASED_LINE_WIDTH_RANGE, r); - printf("Non-smooth line width range: %g .. %g\n", r[0], r[1]); - glGetFloatv(GL_LINE_WIDTH_RANGE, r); - printf("Smoothed line width range: %g .. %g\n", r[0], r[1]); -} - - -int main( int argc, char *argv[] ) -{ - glutInit( &argc, argv ); - glutInitWindowPosition(0, 0); - glutInitWindowSize( 400, 300 ); - - glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE ); - - glutCreateWindow(argv[0] ); - - Init(argc, argv); - - glutReshapeFunc( Reshape ); - glutKeyboardFunc( Key ); - glutSpecialFunc( SpecialKey ); - glutDisplayFunc( Display ); - if (Animate) - glutIdleFunc( Idle ); - - glutMainLoop(); - return 0; -} diff --git a/progs/tests/texobjshare.c b/progs/tests/texobjshare.c deleted file mode 100644 index 2b31cb6c4d..0000000000 --- a/progs/tests/texobjshare.c +++ /dev/null @@ -1,219 +0,0 @@ -/* - * Create several OpenGL rendering contexts, sharing textures, display - * lists, etc. Exercise binding, deleting, etc. - * - * Brian Paul - * 21 December 2004 - */ - - -#include -#include -#include -#include -#include -#include -#include -#include - - -/* - * Each display/window/context: - */ -struct context { - char DisplayName[1000]; - Display *Dpy; - Window Win; - GLXContext Context; -}; - - -#define MAX_CONTEXTS 200 -static struct context Contexts[MAX_CONTEXTS]; -static int NumContexts = 0; - - -static void -Error(const char *display, const char *msg) -{ - fprintf(stderr, "Error on display %s - %s\n", display, msg); - exit(1); -} - - -static struct context * -CreateContext(const char *displayName, const char *name) -{ - Display *dpy; - Window win; - GLXContext ctx; - int attrib[] = { GLX_RGBA, - GLX_RED_SIZE, 1, - GLX_GREEN_SIZE, 1, - GLX_BLUE_SIZE, 1, - GLX_DOUBLEBUFFER, - None }; - int scrnum; - XSetWindowAttributes attr; - unsigned long mask; - Window root; - XVisualInfo *visinfo; - int width = 90, height = 90; - int xpos = 0, ypos = 0; - - if (NumContexts >= MAX_CONTEXTS) - return NULL; - - dpy = XOpenDisplay(displayName); - if (!dpy) { - Error(displayName, "Unable to open display"); - return NULL; - } - - scrnum = DefaultScreen(dpy); - root = RootWindow(dpy, scrnum); - - visinfo = glXChooseVisual(dpy, scrnum, attrib); - if (!visinfo) { - Error(displayName, "Unable to find RGB, double-buffered visual"); - return NULL; - } - - /* window attributes */ - xpos = (NumContexts % 10) * 100; - ypos = (NumContexts / 10) * 100; - attr.background_pixel = 0; - attr.border_pixel = 0; - attr.colormap = XCreateColormap(dpy, root, visinfo->visual, AllocNone); - attr.event_mask = StructureNotifyMask | ExposureMask | KeyPressMask; - mask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask; - - win = XCreateWindow(dpy, root, xpos, ypos, width, height, - 0, visinfo->depth, InputOutput, - visinfo->visual, mask, &attr); - if (!win) { - Error(displayName, "Couldn't create window"); - return NULL; - } - - { - XSizeHints sizehints; - sizehints.x = xpos; - sizehints.y = ypos; - sizehints.width = width; - sizehints.height = height; - sizehints.flags = USSize | USPosition; - XSetNormalHints(dpy, win, &sizehints); - XSetStandardProperties(dpy, win, name, name, - None, (char **)NULL, 0, &sizehints); - } - - if (NumContexts == 0) { - ctx = glXCreateContext(dpy, visinfo, NULL, True); - } - else { - /* share textures & dlists with 0th context */ - ctx = glXCreateContext(dpy, visinfo, Contexts[0].Context, True); - } - if (!ctx) { - Error(displayName, "Couldn't create GLX context"); - return NULL; - } - - XMapWindow(dpy, win); - - if (!glXMakeCurrent(dpy, win, ctx)) { - Error(displayName, "glXMakeCurrent failed"); - return NULL; - } - - if (NumContexts == 0) { - printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - } - - /* save the info for this context */ - { - struct context *h = &Contexts[NumContexts]; - strcpy(h->DisplayName, name); - h->Dpy = dpy; - h->Win = win; - h->Context = ctx; - NumContexts++; - return &Contexts[NumContexts-1]; - } -} - - -static void -MakeCurrent(int i) -{ - if (!glXMakeCurrent(Contexts[i].Dpy, Contexts[i].Win, Contexts[i].Context)) { - fprintf(stderr, "glXMakeCurrent failed!\n"); - } -} - - - -static void -DestroyContext(int i) -{ - XDestroyWindow(Contexts[i].Dpy, Contexts[i].Win); - glXDestroyContext(Contexts[i].Dpy, Contexts[i].Context); - XCloseDisplay(Contexts[i].Dpy); -} - - -int -main(int argc, char *argv[]) -{ - char *dpyName = NULL; - int i; - GLuint t; - GLint tb; - - for (i = 0; i < 2; i++) { - CreateContext(dpyName, "context"); - } - - /* Create texture and bind it in context 0 */ - MakeCurrent(0); - glGenTextures(1, &t); - printf("Generated texture ID %u\n", t); - assert(!glIsTexture(t)); - glBindTexture(GL_TEXTURE_2D, t); - assert(glIsTexture(t)); - glGetIntegerv(GL_TEXTURE_BINDING_2D, &tb); - assert(tb == t); - - /* Bind texture in context 1 */ - MakeCurrent(1); - assert(glIsTexture(t)); - glBindTexture(GL_TEXTURE_2D, t); - glGetIntegerv(GL_TEXTURE_BINDING_2D, &tb); - assert(tb == t); - - /* Delete texture from context 0 */ - MakeCurrent(0); - glDeleteTextures(1, &t); - assert(!glIsTexture(t)); - glGetIntegerv(GL_TEXTURE_BINDING_2D, &tb); - printf("After delete, binding = %d\n", tb); - - /* Check texture state from context 1 */ - MakeCurrent(1); - assert(!glIsTexture(t)); - glGetIntegerv(GL_TEXTURE_BINDING_2D, &tb); - printf("In second context, binding = %d\n", tb); - glBindTexture(GL_TEXTURE_2D, 0); - glGetIntegerv(GL_TEXTURE_BINDING_2D, &tb); - assert(tb == 0); - - - for (i = 0; i < NumContexts; i++) { - DestroyContext(i); - } - - printf("Success!\n"); - - return 0; -} diff --git a/progs/tests/texrect.c b/progs/tests/texrect.c deleted file mode 100644 index 43edc49180..0000000000 --- a/progs/tests/texrect.c +++ /dev/null @@ -1,359 +0,0 @@ - -/* GL_NV_texture_rectangle test - * - * Brian Paul - * 14 June 2002 - */ - - -#define GL_GLEXT_PROTOTYPES -#include -#include -#include -#include -#include -#include "readtex.h" - -#define TEXTURE_0_FILE "../images/girl.rgb" -#define TEXTURE_1_FILE "../images/reflect.rgb" - -#define TEX0 1 -#define TEX7 8 -#define ANIMATE 10 -#define CLAMP 20 -#define CLAMP_TO_EDGE 21 -#define CLAMP_TO_BORDER 22 -#define LINEAR_FILTER 30 -#define NEAREST_FILTER 31 -#define QUIT 100 - -static GLboolean Animate = GL_FALSE; -static GLint NumUnits = 2; -static GLboolean TexEnabled[8]; -static GLint Width[8], Height[8]; /* image sizes */ -static GLenum Format[8]; - -static GLfloat Xrot = 00.0, Yrot = 00.0, Zrot = 0.0; - - -static void Idle( void ) -{ - Zrot = glutGet(GLUT_ELAPSED_TIME) * 0.01; - glutPostRedisplay(); -} - - -static void DrawObject(void) -{ - GLint i; - GLfloat d = 10; /* so we can see how borders are handled */ - - glColor3f(.1, .1, .1); /* modulate this */ - - glPushMatrix(); - - glRotatef(Zrot, 0, 0, 1); - - glBegin(GL_QUADS); - - for (i = 0; i < NumUnits; i++) - glMultiTexCoord2fARB(GL_TEXTURE0_ARB + i, -d, -d); - glVertex2f(-1.0, -1.0); - - for (i = 0; i < NumUnits; i++) - glMultiTexCoord2fARB(GL_TEXTURE0_ARB + i, Width[i]+d, -d); - glVertex2f(1.0, -1.0); - - for (i = 0; i < NumUnits; i++) - glMultiTexCoord2fARB(GL_TEXTURE0_ARB + i, Width[i]+d, Height[i]+d); - glVertex2f(1.0, 1.0); - - for (i = 0; i < NumUnits; i++) - glMultiTexCoord2fARB(GL_TEXTURE0_ARB + i, -d, Height[i]+d); - glVertex2f(-1.0, 1.0); - - glEnd(); - glPopMatrix(); -} - - -static void Display( void ) -{ - glClear( GL_COLOR_BUFFER_BIT ); - - glPushMatrix(); - glRotatef(Xrot, 1.0, 0.0, 0.0); - glRotatef(Yrot, 0.0, 1.0, 0.0); - glRotatef(Zrot, 0.0, 0.0, 1.0); - glScalef(5.0, 5.0, 5.0); - DrawObject(); - glPopMatrix(); - - glutSwapBuffers(); -} - - -static void Reshape( int width, int height ) -{ - glViewport( 0, 0, width, height ); - glMatrixMode( GL_PROJECTION ); - glLoadIdentity(); - glFrustum( -1.0, 1.0, -1.0, 1.0, 5.0, 100.0 ); - glMatrixMode( GL_MODELVIEW ); - glLoadIdentity(); - glTranslatef( 0.0, 0.0, -35.0 ); -} - - -static void ModeMenu(int entry) -{ - GLint i; - if (entry >= TEX0 && entry < TEX0 + NumUnits) { - /* toggle */ - i = entry - TEX0; - TexEnabled[i] = !TexEnabled[i]; - glActiveTextureARB(GL_TEXTURE0_ARB + i); - if (TexEnabled[i]) { - glEnable(GL_TEXTURE_RECTANGLE_NV); - } - else { - glDisable(GL_TEXTURE_RECTANGLE_NV); - } - printf("Enabled: "); - for (i = 0; i < NumUnits; i++) - printf("%d ", (int) TexEnabled[i]); - printf("\n"); - } - else if (entry==ANIMATE) { - Animate = !Animate; - if (Animate) - glutIdleFunc(Idle); - else - glutIdleFunc(NULL); - } - else if (entry==CLAMP) { - for (i = 0; i < NumUnits; i++) { - glActiveTextureARB(GL_TEXTURE0_ARB + i); - glTexParameteri(GL_TEXTURE_RECTANGLE_NV, GL_TEXTURE_WRAP_S, GL_CLAMP); - glTexParameteri(GL_TEXTURE_RECTANGLE_NV, GL_TEXTURE_WRAP_T, GL_CLAMP); - } - } - else if (entry==CLAMP_TO_EDGE) { - for (i = 0; i < NumUnits; i++) { - glActiveTextureARB(GL_TEXTURE0_ARB + i); - glTexParameteri(GL_TEXTURE_RECTANGLE_NV, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); - glTexParameteri(GL_TEXTURE_RECTANGLE_NV, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - } - } - else if (entry==CLAMP_TO_BORDER) { - for (i = 0; i < NumUnits; i++) { - glActiveTextureARB(GL_TEXTURE0_ARB + i); - glTexParameteri(GL_TEXTURE_RECTANGLE_NV, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_BORDER); - glTexParameteri(GL_TEXTURE_RECTANGLE_NV, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_BORDER); - } - } - else if (entry==NEAREST_FILTER) { - for (i = 0; i < NumUnits; i++) { - glActiveTextureARB(GL_TEXTURE0_ARB + i); - glTexParameteri(GL_TEXTURE_RECTANGLE_NV, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - glTexParameteri(GL_TEXTURE_RECTANGLE_NV, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - } - } - else if (entry==LINEAR_FILTER) { - for (i = 0; i < NumUnits; i++) { - glActiveTextureARB(GL_TEXTURE0_ARB + i); - glTexParameteri(GL_TEXTURE_RECTANGLE_NV, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_RECTANGLE_NV, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - } - } - - else if (entry==QUIT) { - exit(0); - } - - glutPostRedisplay(); -} - - -static void Key( unsigned char key, int x, int y ) -{ - (void) x; - (void) y; - switch (key) { - case 'z': - Zrot -= 1.0; - break; - case 'Z': - Zrot += 1.0; - break; - case 'a': - Animate = !Animate; - if (Animate) - glutIdleFunc(Idle); - else - glutIdleFunc(NULL); - break; - case 27: - exit(0); - break; - } - glutPostRedisplay(); -} - - -static void SpecialKey( int key, int x, int y ) -{ - float step = 3.0; - (void) x; - (void) y; - - switch (key) { - case GLUT_KEY_UP: - Xrot += step; - break; - case GLUT_KEY_DOWN: - Xrot -= step; - break; - case GLUT_KEY_LEFT: - Yrot += step; - break; - case GLUT_KEY_RIGHT: - Yrot -= step; - break; - } - glutPostRedisplay(); -} - - -static void Init( int argc, char *argv[] ) -{ - const GLenum wrap = GL_CLAMP; - GLuint texObj[8]; - GLint size, i; - - if (!glutExtensionSupported("GL_ARB_multitexture")) { - printf("Sorry, GL_ARB_multitexture needed by this program\n"); - exit(1); - } - - if (!glutExtensionSupported("GL_NV_texture_rectangle")) { - printf("Sorry, GL_NV_texture_rectangle needed by this program\n"); - exit(1); - } - - glGetIntegerv(GL_MAX_TEXTURE_UNITS_ARB, &NumUnits); - printf("%d texture units supported, using 2.\n", NumUnits); - if (NumUnits > 2) - NumUnits = 2; - - glGetIntegerv(GL_MAX_RECTANGLE_TEXTURE_SIZE_NV, &size); - printf("%d x %d max texture rectangle size\n", size, size); - - glPixelStorei(GL_UNPACK_ALIGNMENT, 1); - - for (i = 0; i < NumUnits; i++) { - TexEnabled[i] = GL_TRUE; - } - - /* allocate two texture objects */ - glGenTextures(NumUnits, texObj); - - /* setup the texture objects */ - for (i = 0; i < NumUnits; i++) { - - glActiveTextureARB(GL_TEXTURE0_ARB + i); - - glBindTexture(GL_TEXTURE_RECTANGLE_NV, texObj[i]); - glTexParameteri(GL_TEXTURE_RECTANGLE_NV, - GL_TEXTURE_MIN_FILTER, GL_NEAREST); - glTexParameteri(GL_TEXTURE_RECTANGLE_NV, - GL_TEXTURE_MAG_FILTER, GL_NEAREST); - glTexParameteri(GL_TEXTURE_RECTANGLE_NV, GL_TEXTURE_WRAP_S, wrap); - glTexParameteri(GL_TEXTURE_RECTANGLE_NV, GL_TEXTURE_WRAP_T, wrap); - - if (i == 0) { - GLubyte *img = LoadRGBImage(TEXTURE_0_FILE, &Width[0], &Height[0], - &Format[0]); - if (!img) { - printf("Error: couldn't load texture image\n"); - exit(1); - } - printf("Texture %d: %s (%d x %d)\n", i, - TEXTURE_0_FILE, Width[0], Height[0]); - glTexImage2D(GL_TEXTURE_RECTANGLE_NV, 0, GL_RGB, - Width[0], Height[0], 0, - Format[0], GL_UNSIGNED_BYTE, img); - } - else { - GLubyte *img = LoadRGBImage(TEXTURE_1_FILE, &Width[1], &Height[1], - &Format[1]); - if (!img) { - printf("Error: couldn't load texture image\n"); - exit(1); - } - printf("Texture %d: %s (%d x %d)\n", i, - TEXTURE_1_FILE, Width[1], Height[1]); - glTexImage2D(GL_TEXTURE_RECTANGLE_NV, 0, GL_RGB, - Width[1], Height[1], 0, - Format[1], GL_UNSIGNED_BYTE, img); - } - - if (i < 1) - glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_ADD); - else - glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_ADD); - - if (TexEnabled[i]) - glEnable(GL_TEXTURE_RECTANGLE_NV); - } - - glShadeModel(GL_FLAT); - glClearColor(0.3, 0.3, 0.4, 1.0); - - if (argc > 1 && strcmp(argv[1], "-info")==0) { - printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - printf("GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - printf("GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - printf("GL_EXTENSIONS = %s\n", (char *) glGetString(GL_EXTENSIONS)); - } -} - - -int main( int argc, char *argv[] ) -{ - GLint i; - - glutInit( &argc, argv ); - glutInitWindowSize( 300, 300 ); - glutInitWindowPosition( 0, 0 ); - glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE ); - glutCreateWindow(argv[0] ); - - Init( argc, argv ); - - glutReshapeFunc( Reshape ); - glutKeyboardFunc( Key ); - glutSpecialFunc( SpecialKey ); - glutDisplayFunc( Display ); - if (Animate) - glutIdleFunc( Idle ); - - glutCreateMenu(ModeMenu); - - for (i = 0; i < NumUnits; i++) { - char s[100]; - sprintf(s, "Toggle Texture %d", i); - glutAddMenuEntry(s, TEX0 + i); - } - glutAddMenuEntry("Toggle Animation", ANIMATE); - glutAddMenuEntry("GL_CLAMP", CLAMP); - glutAddMenuEntry("GL_CLAMP_TO_EDGE", CLAMP_TO_EDGE); - glutAddMenuEntry("GL_CLAMP_TO_BORDER", CLAMP_TO_BORDER); - glutAddMenuEntry("GL_NEAREST", NEAREST_FILTER); - glutAddMenuEntry("GL_LINEAR", LINEAR_FILTER); - glutAddMenuEntry("Quit", QUIT); - glutAttachMenu(GLUT_RIGHT_BUTTON); - - glutMainLoop(); - return 0; -} diff --git a/progs/tests/texwrap.c b/progs/tests/texwrap.c deleted file mode 100644 index 8143256f8a..0000000000 --- a/progs/tests/texwrap.c +++ /dev/null @@ -1,303 +0,0 @@ - -/* - * Test texture wrap modes. - * Press 'b' to toggle texture image borders. You should see the same - * rendering whether or not you're using borders. - * - * Brian Paul March 2001 - */ - - -#define GL_GLEXT_PROTOTYPES -#include -#include -#include -#include - - -#ifndef GL_CLAMP_TO_BORDER -#define GL_CLAMP_TO_BORDER 0x812D -#endif - -#ifndef GL_MIRRORED_REPEAT -#define GL_MIRRORED_REPEAT 0x8370 -#endif - -#ifndef GL_EXT_texture_mirror_clamp -#define GL_MIRROR_CLAMP_EXT 0x8742 -#define GL_MIRROR_CLAMP_TO_EDGE_EXT 0x8743 -#define GL_MIRROR_CLAMP_TO_BORDER_EXT 0x8912 -#endif - -#define BORDER_TEXTURE 1 -#define NO_BORDER_TEXTURE 2 - -#define SIZE 8 -static GLubyte BorderImage[SIZE+2][SIZE+2][4]; -static GLubyte NoBorderImage[SIZE][SIZE][4]; -static GLuint Border = 0; - -#define TILE_SIZE 110 - -#define WRAP_MODE(m) { m , # m, GL_TRUE, 1.0, { NULL, NULL } } -#define WRAP_EXT(m,e1,e2,v) { m , # m, GL_FALSE, v, { e1, e2 } } - -struct wrap_mode { - GLenum mode; - const char * name; - GLboolean supported; - GLfloat version; - const char * extension_names[2]; -}; - -static struct wrap_mode modes[] = { - WRAP_MODE( GL_REPEAT ), - WRAP_MODE( GL_CLAMP ), - WRAP_EXT ( GL_CLAMP_TO_EDGE, "GL_EXT_texture_edge_clamp", - "GL_SGIS_texture_edge_clamp", - 1.2 ), - WRAP_EXT ( GL_CLAMP_TO_BORDER, "GL_ARB_texture_border_clamp", - "GL_SGIS_texture_border_clamp", - 1.3 ), - WRAP_EXT ( GL_MIRRORED_REPEAT, "GL_ARB_texture_mirrored_repeat", - "GL_IBM_texture_mirrored_repeat", - 1.4 ), - WRAP_EXT ( GL_MIRROR_CLAMP_EXT, "GL_ATI_texture_mirror_once", - "GL_EXT_texture_mirror_clamp", - 999.0 ), - WRAP_EXT ( GL_MIRROR_CLAMP_TO_BORDER_EXT, "GL_EXT_texture_mirror_clamp", - NULL, - 999.0 ), - WRAP_EXT ( GL_MIRROR_CLAMP_TO_EDGE_EXT, "GL_ATI_texture_mirror_once", - "GL_EXT_texture_mirror_clamp", - 999.0 ), - { 0 } -}; - -static void -PrintString(const char *s) -{ - while (*s) { - glutBitmapCharacter(GLUT_BITMAP_8_BY_13, (int) *s); - s++; - } -} - - -static void Display( void ) -{ - GLenum i, j; - GLint offset; - GLfloat version; - - /* Fill in the extensions that are supported. - */ - - version = atof( (char *) glGetString( GL_VERSION ) ); - for ( i = 0 ; modes[i].mode != 0 ; i++ ) { - if ( ((modes[i].extension_names[0] != NULL) - && glutExtensionSupported(modes[i].extension_names[0])) - || ((modes[i].extension_names[1] != NULL) - && glutExtensionSupported(modes[i].extension_names[1])) ) { - modes[i].supported = GL_TRUE; - } - else if ( !modes[i].supported && (modes[i].version <= version) ) { - fprintf( stderr, "WARNING: OpenGL library meets minimum version\n" - " requirement for %s, but the\n" - " extension string is not advertised.\n" - " (%s%s%s)\n", - modes[i].name, - modes[i].extension_names[0], - (modes[i].extension_names[1] != NULL) - ? " or " : "", - (modes[i].extension_names[1] != NULL) - ? modes[i].extension_names[1] : "" ); - modes[i].supported = GL_TRUE; - } - } - - - glClearColor(0.5, 0.5, 0.5, 1.0); - glClear( GL_COLOR_BUFFER_BIT ); - -#if 0 - /* draw texture as image */ - glDisable(GL_TEXTURE_2D); - glWindowPos2iARB(1, 1); - glDrawPixels(6, 6, GL_RGBA, GL_UNSIGNED_BYTE, (void *) TexImage); -#endif - - glBindTexture(GL_TEXTURE_2D, Border ? BORDER_TEXTURE : NO_BORDER_TEXTURE); - - - /* loop over min/mag filters */ - for (i = 0; i < 2; i++) { - offset = 0; - - if (i) { - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - } - else { - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - } - - /* loop over border modes */ - for (j = 0; modes[j].mode != 0; j++) { - const GLfloat x0 = 0, y0 = 0, x1 = (TILE_SIZE - 10), y1 = (TILE_SIZE - 10); - const GLfloat b = 1.2; - const GLfloat s0 = -b, t0 = -b, s1 = 1.0+b, t1 = 1.0+b; - - if ( modes[j].supported != GL_TRUE ) - continue; - - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, modes[j].mode); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, modes[j].mode); - - glPushMatrix(); - glTranslatef(offset * TILE_SIZE + 10, i * TILE_SIZE + 40, 0); - offset++; - - glEnable(GL_TEXTURE_2D); - glColor3f(1, 1, 1); - glBegin(GL_POLYGON); - glTexCoord2f(s0, t0); glVertex2f(x0, y0); - glTexCoord2f(s1, t0); glVertex2f(x1, y0); - glTexCoord2f(s1, t1); glVertex2f(x1, y1); - glTexCoord2f(s0, t1); glVertex2f(x0, y1); - glEnd(); - - /* draw red outline showing bounds of texture at s=0,1 and t=0,1 */ - glDisable(GL_TEXTURE_2D); - glColor3f(1, 0, 0); - glBegin(GL_LINE_LOOP); - glVertex2f(x0 + b * (x1-x0) / (s1-s0), y0 + b * (y1-y0) / (t1-t0)); - glVertex2f(x1 - b * (x1-x0) / (s1-s0), y0 + b * (y1-y0) / (t1-t0)); - glVertex2f(x1 - b * (x1-x0) / (s1-s0), y1 - b * (y1-y0) / (t1-t0)); - glVertex2f(x0 + b * (x1-x0) / (s1-s0), y1 - b * (y1-y0) / (t1-t0)); - glEnd(); - - glPopMatrix(); - } - } - - glDisable(GL_TEXTURE_2D); - glColor3f(1, 1, 1); - offset = 0; - for (i = 0; modes[i].mode != 0; i++) { - if ( modes[i].supported ) { - glWindowPos2iARB( offset * TILE_SIZE + 10, 5 + ((offset & 1) * 15) ); - PrintString(modes[i].name); - offset++; - } - } - - glutSwapBuffers(); -} - - -static void Reshape( int width, int height ) -{ - glViewport( 0, 0, width, height ); - glMatrixMode( GL_PROJECTION ); - glLoadIdentity(); - glOrtho(0, width, 0, height, -1, 1); - glMatrixMode( GL_MODELVIEW ); - glLoadIdentity(); -} - - -static void Key( unsigned char key, int x, int y ) -{ - (void) x; - (void) y; - switch (key) { - case 'b': - Border = !Border; - printf("Texture Border Size = %d\n", Border); - break; - case 27: - exit(0); - break; - } - glutPostRedisplay(); -} - - -static void Init( void ) -{ - static const GLubyte border[4] = { 0, 255, 0, 255 }; - static const GLfloat borderf[4] = { 0, 1.0, 0, 1.0 }; - GLint i, j; - - for (i = 0; i < SIZE+2; i++) { - for (j = 0; j < SIZE+2; j++) { - if (i == 0 || j == 0 || i == SIZE+1 || j == SIZE+1) { - /* border color */ - BorderImage[i][j][0] = border[0]; - BorderImage[i][j][1] = border[1]; - BorderImage[i][j][2] = border[2]; - BorderImage[i][j][3] = border[3]; - } - else if ((i + j) & 1) { - /* white */ - BorderImage[i][j][0] = 255; - BorderImage[i][j][1] = 255; - BorderImage[i][j][2] = 255; - BorderImage[i][j][3] = 255; - } - else { - /* black */ - BorderImage[i][j][0] = 0; - BorderImage[i][j][1] = 0; - BorderImage[i][j][2] = 0; - BorderImage[i][j][3] = 0; - } - } - } - - glBindTexture(GL_TEXTURE_2D, BORDER_TEXTURE); - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, SIZE+2, SIZE+2, 1, - GL_RGBA, GL_UNSIGNED_BYTE, (void *) BorderImage); - - for (i = 0; i < SIZE; i++) { - for (j = 0; j < SIZE; j++) { - if ((i + j) & 1) { - /* white */ - NoBorderImage[i][j][0] = 255; - NoBorderImage[i][j][1] = 255; - NoBorderImage[i][j][2] = 255; - NoBorderImage[i][j][3] = 255; - } - else { - /* black */ - NoBorderImage[i][j][0] = 0; - NoBorderImage[i][j][1] = 0; - NoBorderImage[i][j][2] = 0; - NoBorderImage[i][j][3] = 0; - } - } - } - - glBindTexture(GL_TEXTURE_2D, NO_BORDER_TEXTURE); - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, SIZE, SIZE, 0, - GL_RGBA, GL_UNSIGNED_BYTE, (void *) NoBorderImage); - glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_BORDER_COLOR, borderf); -} - - -int main( int argc, char *argv[] ) -{ - glutInit( &argc, argv ); - glutInitWindowPosition( 0, 0 ); - glutInitWindowSize( 1000, 270 ); - glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE ); - glutCreateWindow(argv[0]); - glutReshapeFunc( Reshape ); - glutKeyboardFunc( Key ); - glutDisplayFunc( Display ); - Init(); - glutMainLoop(); - return 0; -} diff --git a/progs/tests/unfilledclip.c b/progs/tests/unfilledclip.c deleted file mode 100644 index f25e52616a..0000000000 --- a/progs/tests/unfilledclip.c +++ /dev/null @@ -1,205 +0,0 @@ -/* - * Copyright © 2008 Intel Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. - * - * Authors: - * Eric Anholt - * - */ - -#include -#include - -static int win_width, win_height; - -static void -line(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2) -{ - glBegin(GL_LINES); - glVertex2f(x1, y1); - glVertex2f(x2, y2); - glEnd(); -} - -static void -line3(GLfloat x1, GLfloat y1, GLfloat z1, GLfloat x2, GLfloat y2, GLfloat z2) -{ - glBegin(GL_LINES); - glVertex3f(x1, y1, z1); - glVertex3f(x2, y2, z2); - glEnd(); -} - -static void -display(void) -{ - glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); - - glClearColor(0.0, 0.0, 0.0, 0.0); - glClear(GL_COLOR_BUFFER_BIT); - - glColor3f(1.0, 0.0, 0.0); - /* clipped along xmin */ - glBegin(GL_TRIANGLES); - glVertex2f(-20, win_height / 2 - 20); - glVertex2f(20, win_height / 2); - glVertex2f(-20, win_height / 2 + 20); - glEnd(); - - glColor3f(0.0, 1.0, 0.0); - /* clipped along ymax */ - glBegin(GL_TRIANGLES); - glVertex2f(win_height / 2 - 20, win_height + 20); - glVertex2f(win_height / 2, win_height - 20); - glVertex2f(win_height / 2 + 20, win_height + 20); - glEnd(); - - glColor3f(0.0, 0.0, 1.0); - /* clipped along xmax */ - glBegin(GL_TRIANGLES); - glVertex2f(win_height + 20, win_height / 2 - 20); - glVertex2f(win_height - 20, win_height / 2); - glVertex2f(win_height + 20, win_height / 2 + 20); - glEnd(); - - glColor3f(1.0, 1.0, 1.0); - /* clipped along ymin */ - glBegin(GL_TRIANGLES); - glVertex2f(win_height / 2 - 20, -20); - glVertex2f(win_height / 2, 20); - glVertex2f(win_height / 2 + 20, -20); - glEnd(); - - /* clipped along near */ - glColor3f(1.0, 0.0, 1.0); - glBegin(GL_TRIANGLES); - glVertex3f(win_width / 2 - 20, win_height / 2 - 20, 0.5); - glVertex3f(win_width / 2 - 40, win_height / 2, -0.5); - glVertex3f(win_width / 2 - 20, win_height / 2 + 20, 0.5); - glEnd(); - - /* clipped along far */ - glColor3f(0.0, 1.0, 1.0); - glBegin(GL_TRIANGLES); - glVertex3f(win_width / 2 + 20, win_height / 2 - 20, 0.5); - glVertex3f(win_width / 2 + 40, win_height / 2, 1.5); - glVertex3f(win_width / 2 + 20, win_height / 2 + 20, 0.5); - glEnd(); - - /* entirely clipped along near/far */ - glColor3f(.5, .5, .5); - glBegin(GL_TRIANGLES); - glVertex3f(win_width / 2 - 20, win_height / 2 + 20, -0.5); - glVertex3f(win_width / 2, win_height / 2 + 40, -0.5); - glVertex3f(win_width / 2 + 20, win_height / 2 + 20, -0.5); - glEnd(); - - glBegin(GL_TRIANGLES); - glVertex3f(win_width / 2 - 20, win_height / 2 - 20, 1.5); - glVertex3f(win_width / 2, win_height / 2 - 40, 1.5); - glVertex3f(win_width / 2 + 20, win_height / 2 - 20, 1.5); - glEnd(); - - glColor3f(.5, .5, .5); - line3(win_width / 2, win_height / 2 - 20, 1.5, - win_width / 2, win_height / 2 + 20, 1.5); - - glColor3f(1.0, 1.0, 0.0); - /* clipped along both x and y limits */ - glBegin(GL_TRIANGLES); /* xmin, ymin */ - glVertex2f(-5, 20); - glVertex2f(20, 20); - glVertex2f(20, -5); - glEnd(); - glBegin(GL_TRIANGLES); /* xmin, ymax */ - glVertex2f(-5, win_height - 20); - glVertex2f(20, win_height - 20); - glVertex2f(20, win_height + 5); - glEnd(); - glBegin(GL_TRIANGLES); /* xmax, ymax */ - glVertex2f(win_width - 20, win_height + 5); - glVertex2f(win_width - 20, win_height - 20); - glVertex2f(win_width + 5, win_height - 20); - glEnd(); - glBegin(GL_TRIANGLES); /* xmax, ymin */ - glVertex2f(win_width + 5, 20); - glVertex2f(win_width - 20, 20); - glVertex2f(win_width - 20, -5); - glEnd(); - - glutSwapBuffers(); -} - -static void -reshape(int width, int height) -{ - win_width = width; - win_height = height; - glViewport(0, 0, width, height); - - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glOrtho(0, win_width, 0, win_height, 0.0, -1.0); - - glMatrixMode(GL_MODELVIEW); - glLoadIdentity(); - glTranslatef(.25, .25, 0); -} - -static void key( unsigned char key, int x, int y ) -{ - (void) x; - (void) y; - - switch (key) { - case 27: /* esc */ - exit(0); - break; - } - - glutPostRedisplay(); -} - -static void -init(void) -{ -} - -int -main(int argc, char *argv[]) -{ - win_width = 200; - win_height = 200; - - glutInit(&argc, argv); - glutInitWindowPosition(0, 0); - glutInitWindowSize(win_width, win_height); - glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH); - glutCreateWindow(argv[0]); - glutReshapeFunc(reshape); - glutKeyboardFunc(key); - glutDisplayFunc(display); - - init(); - - glutMainLoop(); - return 0; -} diff --git a/progs/tests/vao-01.c b/progs/tests/vao-01.c deleted file mode 100644 index c2d70885f0..0000000000 --- a/progs/tests/vao-01.c +++ /dev/null @@ -1,177 +0,0 @@ -/* - * (C) Copyright IBM Corporation 2006 - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * on the rights to use, copy, modify, merge, publish, distribute, sub - * license, and/or sell copies of the Software, and to permit persons to whom - * the Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL - * IBM AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - */ - -/** - * \file vao-01.c - * - * Simple test of APPLE_vertex_array_object functionality. This test creates - * a VAO, pushed it (via \c glPushClientAttrib), modifies the VAO, then pops - * it (via \c glPopClientAttrib). After popping, the state of the VAO is - * examined. - * - * According the the APPLE_vertex_array_object spec, the contents of the VAO - * should be restored to the values that they had when pushed. - * - * \author Ian Romanick - */ - -#include -#include -#include - -#ifdef __darwin__ -#include - -typedef void (* PFNGLBINDVERTEXARRAYAPPLEPROC) (GLuint array); -typedef void (* PFNGLDELETEVERTEXARRAYSAPPLEPROC) (GLsizei n, const GLuint *arrays); -typedef void (* PFNGLGENVERTEXARRAYSAPPLEPROC) (GLsizei n, GLuint *arrays); -typedef GLboolean (* PFNGLISVERTEXARRAYAPPLEPROC) (GLuint array); - -#else -#include -#endif - -static PFNGLBINDVERTEXARRAYAPPLEPROC bind_vertex_array = NULL; -static PFNGLGENVERTEXARRAYSAPPLEPROC gen_vertex_arrays = NULL; -static PFNGLDELETEVERTEXARRAYSAPPLEPROC delete_vertex_arrays = NULL; -static PFNGLISVERTEXARRAYAPPLEPROC is_vertex_array = NULL; - -static int Width = 400; -static int Height = 200; -static const GLfloat Near = 5.0, Far = 25.0; - - -static void Display( void ) -{ -} - - -static void Idle( void ) -{ -} - - -static void Visible( int vis ) -{ - if ( vis == GLUT_VISIBLE ) { - glutIdleFunc( Idle ); - } - else { - glutIdleFunc( NULL ); - } -} -static void Reshape( int width, int height ) -{ - GLfloat ar = (float) width / (float) height; - Width = width; - Height = height; - glViewport( 0, 0, width, height ); - glMatrixMode( GL_PROJECTION ); - glLoadIdentity(); - glFrustum( -ar, ar, -1.0, 1.0, Near, Far ); -} - - -static void Key( unsigned char key, int x, int y ) -{ - (void) x; - (void) y; - switch (key) { - case 27: - exit(0); - break; - } - glutPostRedisplay(); -} - - -static void Init( void ) -{ - const char * const ver_string = (const char * const) - glGetString( GL_VERSION ); - GLuint obj; - int pass = 1; - void * ptr; - - - printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - printf("GL_VERSION = %s\n\n", ver_string); - - if ( !glutExtensionSupported("GL_APPLE_vertex_array_object") ) { - printf("Sorry, this program requires GL_APPLE_vertex_array_object\n"); - exit(2); - } - - bind_vertex_array = glutGetProcAddress( "glBindVertexArrayAPPLE" ); - gen_vertex_arrays = glutGetProcAddress( "glGenVertexArraysAPPLE" ); - delete_vertex_arrays = glutGetProcAddress( "glDeleteVertexArraysAPPLE" ); - is_vertex_array = glutGetProcAddress( "glIsVertexArrayAPPLE" ); - - - (*gen_vertex_arrays)( 1, & obj ); - (*bind_vertex_array)( obj ); - glVertexPointer( 4, GL_FLOAT, sizeof(GLfloat) * 4, (void *) 0xDEADBEEF); - glEnableClientState( GL_VERTEX_ARRAY ); - - glPushClientAttrib( GL_CLIENT_VERTEX_ARRAY_BIT ); - - glVertexPointer( 4, GL_FLOAT, sizeof(GLfloat) * 4, (void *) 0xBADDC0DE); - glDisableClientState( GL_VERTEX_ARRAY ); - - glPopClientAttrib(); - - if ( ! glIsEnabled( GL_VERTEX_ARRAY ) ) { - printf( "Array state is incorrectly disabled.\n" ); - pass = 0; - } - - glGetPointerv( GL_VERTEX_ARRAY_POINTER, & ptr ); - if ( ptr != (void *) 0xDEADBEEF ) { - printf( "Array pointer is incorrectly set to 0x%p.\n", ptr ); - pass = 0; - } - - if ( ! pass ) { - printf( "FAIL!\n" ); - exit(1); - } -} - - -int main( int argc, char *argv[] ) -{ - glutInit( &argc, argv ); - glutInitWindowPosition( 0, 0 ); - glutInitWindowSize( Width, Height ); - glutInitDisplayMode( GLUT_RGB ); - glutCreateWindow( "GL_APPLE_vertex_array_object demo" ); - glutReshapeFunc( Reshape ); - glutKeyboardFunc( Key ); - glutDisplayFunc( Display ); - glutVisibilityFunc( Visible ); - - Init(); - - return 0; -} diff --git a/progs/tests/vao-02.c b/progs/tests/vao-02.c deleted file mode 100644 index 993bc368d4..0000000000 --- a/progs/tests/vao-02.c +++ /dev/null @@ -1,205 +0,0 @@ -/* - * (C) Copyright IBM Corporation 2006 - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * on the rights to use, copy, modify, merge, publish, distribute, sub - * license, and/or sell copies of the Software, and to permit persons to whom - * the Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL - * IBM AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - */ - -/** - * \file vao-02.c - * - * Simple test of APPLE_vertex_array_object functionality. This test creates - * a VAO, pushed it (via \c glPushClientAttrib), deletes the VAO, then pops - * it (via \c glPopClientAttrib). After popping, the state of the VAO is - * examined. - * - * According the the APPLE_vertex_array_object spec, the contents of the VAO - * should be restored to the values that they had when pushed. - * - * \author Ian Romanick - */ - -#include -#include -#include - -#ifdef __darwin__ -#include - -typedef void (* PFNGLBINDVERTEXARRAYAPPLEPROC) (GLuint array); -typedef void (* PFNGLDELETEVERTEXARRAYSAPPLEPROC) (GLsizei n, const GLuint *arrays); -typedef void (* PFNGLGENVERTEXARRAYSAPPLEPROC) (GLsizei n, GLuint *arrays); -typedef GLboolean (* PFNGLISVERTEXARRAYAPPLEPROC) (GLuint array); - -#else -#include -#endif - -static PFNGLBINDVERTEXARRAYAPPLEPROC bind_vertex_array = NULL; -static PFNGLGENVERTEXARRAYSAPPLEPROC gen_vertex_arrays = NULL; -static PFNGLDELETEVERTEXARRAYSAPPLEPROC delete_vertex_arrays = NULL; -static PFNGLISVERTEXARRAYAPPLEPROC is_vertex_array = NULL; - -static int Width = 400; -static int Height = 200; -static const GLfloat Near = 5.0, Far = 25.0; - - -static void Display( void ) -{ -} - - -static void Idle( void ) -{ -} - - -static void Visible( int vis ) -{ - if ( vis == GLUT_VISIBLE ) { - glutIdleFunc( Idle ); - } - else { - glutIdleFunc( NULL ); - } -} -static void Reshape( int width, int height ) -{ - GLfloat ar = (float) width / (float) height; - Width = width; - Height = height; - glViewport( 0, 0, width, height ); - glMatrixMode( GL_PROJECTION ); - glLoadIdentity(); - glFrustum( -ar, ar, -1.0, 1.0, Near, Far ); -} - - -static void Key( unsigned char key, int x, int y ) -{ - (void) x; - (void) y; - switch (key) { - case 27: - exit(0); - break; - } - glutPostRedisplay(); -} - - -static void Init( void ) -{ - const char * const ver_string = (const char * const) - glGetString( GL_VERSION ); - GLuint obj; - int pass = 1; - void * ptr; - GLenum err; - - - printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - printf("GL_VERSION = %s\n\n", ver_string); - - if ( !glutExtensionSupported("GL_APPLE_vertex_array_object") ) { - printf("Sorry, this program requires GL_APPLE_vertex_array_object\n"); - exit(2); - } - - bind_vertex_array = glutGetProcAddress( "glBindVertexArrayAPPLE" ); - gen_vertex_arrays = glutGetProcAddress( "glGenVertexArraysAPPLE" ); - delete_vertex_arrays = glutGetProcAddress( "glDeleteVertexArraysAPPLE" ); - is_vertex_array = glutGetProcAddress( "glIsVertexArrayAPPLE" ); - - - (*gen_vertex_arrays)( 1, & obj ); - (*bind_vertex_array)( obj ); - glVertexPointer( 4, GL_FLOAT, sizeof(GLfloat) * 4, (void *) 0xDEADBEEF); - glEnableClientState( GL_VERTEX_ARRAY ); - - glPushClientAttrib( GL_CLIENT_VERTEX_ARRAY_BIT ); - - (*delete_vertex_arrays)( 1, & obj ); - - err = glGetError(); - if (err) { - printf( "glGetError incorrectly returned 0x%04x.\n", err ); - pass = 0; - } - - if ( (*is_vertex_array)( obj ) ) { - printf( "Array object is incorrectly still valid.\n" ); - pass = 0; - } - - err = glGetError(); - if (err) { - printf( "glGetError incorrectly returned 0x%04x.\n", err ); - pass = 0; - } - - glPopClientAttrib(); - - err = glGetError(); - if (err) { - printf( "glGetError incorrectly returned 0x%04x.\n", err ); - pass = 0; - } - - if ( ! (*is_vertex_array)( obj ) ) { - printf( "Array object is incorrectly invalid.\n" ); - pass = 0; - } - - if ( ! glIsEnabled( GL_VERTEX_ARRAY ) ) { - printf( "Array state is incorrectly disabled.\n" ); - pass = 0; - } - - glGetPointerv( GL_VERTEX_ARRAY_POINTER, & ptr ); - if ( ptr != (void *) 0xDEADBEEF ) { - printf( "Array pointer is incorrectly set to 0x%p.\n", ptr ); - pass = 0; - } - - if ( ! pass ) { - printf( "FAIL!\n" ); - exit(1); - } -} - - -int main( int argc, char *argv[] ) -{ - glutInit( &argc, argv ); - glutInitWindowPosition( 0, 0 ); - glutInitWindowSize( Width, Height ); - glutInitDisplayMode( GLUT_RGB ); - glutCreateWindow( "GL_APPLE_vertex_array_object demo" ); - glutReshapeFunc( Reshape ); - glutKeyboardFunc( Key ); - glutDisplayFunc( Display ); - glutVisibilityFunc( Visible ); - - Init(); - - return 0; -} diff --git a/progs/tests/vparray.c b/progs/tests/vparray.c deleted file mode 100644 index 580a670f8e..0000000000 --- a/progs/tests/vparray.c +++ /dev/null @@ -1,294 +0,0 @@ -/* - * Test vertex arrays with GL_NV_vertex_program - * - * Based on a stripped-down version of the isosurf demo. - * The vertex program is trivial: compute the resulting - * RGB color as a linear function of vertex XYZ. - */ - -#include -#include -#include -#include -#include -#include -#define GL_GLEXT_PROTOTYPES -#include "GL/glut.h" - -#define MAXVERTS 10000 -static float data[MAXVERTS][6]; -static GLint numverts; - -static GLfloat xrot; -static GLfloat yrot; -static GLboolean useArrays = GL_TRUE; -static GLboolean useProgram = GL_TRUE; -static GLboolean useList = GL_FALSE; - - -static void read_surface( char *filename ) -{ - FILE *f; - - f = fopen(filename,"r"); - if (!f) { - printf("couldn't read %s\n", filename); - exit(1); - } - - numverts = 0; - while (!feof(f) && numverts < MAXVERTS) { - fscanf( f, "%f %f %f %f %f %f", - &data[numverts][0], &data[numverts][1], &data[numverts][2], - &data[numverts][3], &data[numverts][4], &data[numverts][5] ); - numverts++; - } - numverts--; - - printf("%d vertices, %d triangles\n", numverts, numverts-2); - printf("data = %p\n", (void *) data); - fclose(f); -} - - - - -static void Display(void) -{ - if (useProgram) - glEnable(GL_VERTEX_PROGRAM_NV); - else - glDisable(GL_VERTEX_PROGRAM_NV); - - glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); - - glPushMatrix(); - glRotatef(xrot, 1, 0, 0); - glRotatef(yrot, 0, 1, 0); - glScalef(2, 2, 2); - if (useArrays) { - if (useProgram) { - glVertexAttribPointerNV( 0, 3, GL_FLOAT, 6 * sizeof(GLfloat), data ); - glEnableClientState( GL_VERTEX_ATTRIB_ARRAY0_NV ); - glVertexAttribPointerNV( 2, 3, GL_FLOAT, 6 * sizeof(GLfloat), ((GLfloat *) data) + 3); - glEnableClientState( GL_VERTEX_ATTRIB_ARRAY2_NV); - } - else { - glVertexPointer( 3, GL_FLOAT, 6 * sizeof(GLfloat), data ); - glEnableClientState( GL_VERTEX_ARRAY ); - glNormalPointer( GL_FLOAT, 6 * sizeof(GLfloat), ((GLfloat *) data) + 3); - glEnableClientState( GL_NORMAL_ARRAY ); - } - - if (useList) { - /* dumb, but a good test */ - glNewList(1,GL_COMPILE); - glDrawArrays(GL_TRIANGLE_STRIP, 0, numverts); - glEndList(); - glCallList(1); - } - else { - glDrawArrays(GL_TRIANGLE_STRIP, 0, numverts); - } - - glDisableClientState( GL_VERTEX_ATTRIB_ARRAY0_NV ); - glDisableClientState( GL_VERTEX_ATTRIB_ARRAY2_NV); - glDisableClientState( GL_VERTEX_ARRAY ); - glDisableClientState( GL_NORMAL_ARRAY ); - } - else { - int i; - glBegin(GL_TRIANGLE_STRIP); - for (i = 0; i < numverts; i++) { - glNormal3fv( data[i] + 3 ); - glVertex3fv( data[i] + 0 ); - } - glEnd(); - } - glPopMatrix(); - - if (glGetError()) - printf("Error!\n"); - - glutSwapBuffers(); -} - - -static void InitMaterials(void) -{ - static float ambient[] = {0.1, 0.1, 0.1, 1.0}; - static float diffuse[] = {0.5, 1.0, 1.0, 1.0}; - static float position0[] = {0.0, 0.0, 20.0, 0.0}; - static float position1[] = {0.0, 0.0, -20.0, 0.0}; - static float front_mat_shininess[] = {60.0}; - static float front_mat_specular[] = {0.2, 0.2, 0.2, 1.0}; - static float front_mat_diffuse[] = {0.5, 0.28, 0.38, 1.0}; - /* - static float back_mat_shininess[] = {60.0}; - static float back_mat_specular[] = {0.5, 0.5, 0.2, 1.0}; - static float back_mat_diffuse[] = {1.0, 1.0, 0.2, 1.0}; - */ - static float lmodel_ambient[] = {1.0, 1.0, 1.0, 1.0}; - static float lmodel_twoside[] = {GL_FALSE}; - - glLightfv(GL_LIGHT0, GL_AMBIENT, ambient); - glLightfv(GL_LIGHT0, GL_DIFFUSE, diffuse); - glLightfv(GL_LIGHT0, GL_POSITION, position0); - glEnable(GL_LIGHT0); - - glLightfv(GL_LIGHT1, GL_AMBIENT, ambient); - glLightfv(GL_LIGHT1, GL_DIFFUSE, diffuse); - glLightfv(GL_LIGHT1, GL_POSITION, position1); - glEnable(GL_LIGHT1); - - glLightModelfv(GL_LIGHT_MODEL_AMBIENT, lmodel_ambient); - glLightModelfv(GL_LIGHT_MODEL_TWO_SIDE, lmodel_twoside); - - glMaterialfv(GL_FRONT_AND_BACK, GL_SHININESS, front_mat_shininess); - glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, front_mat_specular); - glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, front_mat_diffuse); - glEnable(GL_LIGHTING); -} - - -static void init_program(void) -{ - /* - * c[0..3] = modelview matrix - * c[4..7] = inverse modelview matrix - * c[30] = color scale - * c[31] = color bias - */ - static const char prog[] = - "!!VP1.0\n" - - "# RGB is proportional to XYZ \n" - - "MUL R0, v[OPOS], c[30]; \n" - "ADD o[COL0], R0, c[31]; \n" - - "# Continue with typical modelview/projection\n" - "MOV R3, v[OPOS]; \n" - "DP4 o[HPOS].x, c[0], R3 ; # object x MVP -> clip\n" - "DP4 o[HPOS].y, c[1], R3 ;\n" - "DP4 o[HPOS].z, c[2], R3 ;\n" - "DP4 o[HPOS].w, c[3], R3 ;\n" - - "END"; - - static const GLfloat scale[4] = {2.0, 2.0, 2.0, 0.0}; - static const GLfloat bias[4] = {1.0, 1.0, 1.0, 0.0}; - - if (!glutExtensionSupported("GL_NV_vertex_program")) { - printf("Sorry, this program requires GL_NV_vertex_program"); - exit(1); - } - - glLoadProgramNV(GL_VERTEX_PROGRAM_NV, 1, - strlen(prog), (const GLubyte *) prog); - assert(glIsProgramNV(1)); - glBindProgramNV(GL_VERTEX_PROGRAM_NV, 1); - - /* Load the program registers */ - glTrackMatrixNV(GL_VERTEX_PROGRAM_NV, 0, GL_MODELVIEW_PROJECTION_NV, GL_IDENTITY_NV); - glTrackMatrixNV(GL_VERTEX_PROGRAM_NV, 4, GL_MODELVIEW, GL_INVERSE_TRANSPOSE_NV); - - glProgramParameter4fvNV(GL_VERTEX_PROGRAM_NV, 30, scale); - glProgramParameter4fvNV(GL_VERTEX_PROGRAM_NV, 31, bias); -} - - -static void init(void) -{ - xrot = 0; - yrot = 0; - glClearColor(0.0, 0.0, 1.0, 0.0); - glEnable( GL_DEPTH_TEST ); - glEnable(GL_NORMALIZE); - InitMaterials(); - read_surface( "../demos/isosurf.dat" ); - init_program(); -} - - -static void Reshape(int width, int height) -{ - glViewport(0, 0, (GLint)width, (GLint)height); - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glFrustum( -1.0, 1.0, -1.0, 1.0, 5, 25 ); - glMatrixMode(GL_MODELVIEW); - glLoadIdentity(); - glTranslatef(0, 0, -15); -} - - - -static void Key( unsigned char key, int x, int y ) -{ - (void) x; - (void) y; - switch (key) { - case 27: - exit(0); - case 'a': - useArrays = !useArrays; - printf("use arrays: %s\n", useArrays ? "yes" : "no"); - break; - case 'l': - useList = !useList; - printf("use list: %s\n", useList ? "yes" : "no"); - break; - case 'p': - useProgram = !useProgram; - printf("use program: %s\n", useProgram ? "yes" : "no"); - break; - } - glutPostRedisplay(); -} - - -static void SpecialKey( int key, int x, int y ) -{ - (void) x; - (void) y; - switch (key) { - case GLUT_KEY_LEFT: - yrot -= 15.0; - break; - case GLUT_KEY_RIGHT: - yrot += 15.0; - break; - case GLUT_KEY_UP: - xrot += 15.0; - break; - case GLUT_KEY_DOWN: - xrot -= 15.0; - break; - default: - return; - } - glutPostRedisplay(); -} - - - -int main(int argc, char **argv) -{ - glutInit(&argc, argv); - glutInitDisplayMode( GLUT_DEPTH | GLUT_RGB | GLUT_DOUBLE ); - glutInitWindowPosition(0, 0); - glutInitWindowSize(400, 400); - if (glutCreateWindow("Isosurface") <= 0) { - exit(0); - } - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutSpecialFunc(SpecialKey); - glutDisplayFunc(Display); - - init(); - - glutMainLoop(); - return 0; -} diff --git a/progs/tests/vpeval.c b/progs/tests/vpeval.c deleted file mode 100644 index 8b6996d3b5..0000000000 --- a/progs/tests/vpeval.c +++ /dev/null @@ -1,231 +0,0 @@ -/* - * Vertex program evaluators test. - * Based on book/bezmesh.c - * - * Brian Paul - * 22 June 2002 - */ - -#include -#include -#include -#include -#define GL_GLEXT_PROTOTYPES -#include - - -/* - * Transform position by modelview/projection. - * Square incoming color. - */ -static const char prog[] = -"!!VP1.0\n" - -"# Typical modelview/projection\n" -"DP4 o[HPOS].x, c[0], v[OPOS] ; # object x MVP -> clip\n" -"DP4 o[HPOS].y, c[1], v[OPOS] ;\n" -"DP4 o[HPOS].z, c[2], v[OPOS] ;\n" -"DP4 o[HPOS].w, c[3], v[OPOS] ;\n" - -"MOV R0, v[COL0];\n # square the color\n" -"MUL R0, R0, R0;\n" -"MOV o[COL0], R0;\n # store output color\n" - -"END"; - - -static int program = 1; - - -GLfloat ctrlpoints[4][4][4] = -{ - { - {-1.5, -1.5, 4.0, 1.0}, - {-0.5, -1.5, 2.0, 1.0}, - {0.5, -1.5, -1.0, 1.0}, - {1.5, -1.5, 2.0, 1.0}}, - { - {-1.5, -0.5, 1.0, 1.0}, - {-0.5, -0.5, 3.0, 1.0}, - {0.5, -0.5, 0.0, 1.0}, - {1.5, -0.5, -1.0, 1.0}}, - { - {-1.5, 0.5, 4.0, 1.0}, - {-0.5, 0.5, 0.0, 1.0}, - {0.5, 0.5, 3.0, 1.0}, - {1.5, 0.5, 4.0, 1.0}}, - { - {-1.5, 1.5, -2.0, 1.0}, - {-0.5, 1.5, -2.0, 1.0}, - {0.5, 1.5, 0.0, 1.0}, - {1.5, 1.5, -1.0, 1.0}} -}; - -/* - * +-------------+ - * |green |yellow - * | | - * | | - * |black |red - * +-------------+ - */ -GLfloat colorPoints[4][4][4] = -{ - { - {0.0, 0.0, 0.0, 1.0}, - {0.3, 0.0, 0.0, 1.0}, - {0.6, 0.0, 0.0, 1.0}, - {1.0, 0.0, 0.0, 1.0}}, - { - {0.0, 0.3, 0.0, 1.0}, - {0.3, 0.3, 0.0, 1.0}, - {0.6, 0.3, 0.0, 1.0}, - {1.0, 0.3, 0.0, 1.0}}, - { - {0.0, 0.6, 0.0, 1.0}, - {0.3, 0.6, 0.0, 1.0}, - {0.6, 0.6, 0.0, 1.0}, - {1.0, 0.6, 0.0, 1.0}}, - { - {0.0, 1.0, 0.0, 1.0}, - {0.3, 1.0, 0.0, 1.0}, - {0.6, 1.0, 0.0, 1.0}, - {1.0, 1.0, 0.0, 1.0}} -}; - - -void -initlights(void) -{ - GLfloat ambient[] = {0.2, 0.2, 0.2, 1.0}; - GLfloat position[] = {0.0, 0.0, 2.0, 1.0}; - GLfloat mat_diffuse[] = {0.6, 0.6, 0.6, 1.0}; - GLfloat mat_specular[] = {1.0, 1.0, 1.0, 1.0}; - GLfloat mat_shininess[] = {50.0}; - -#if 0 /* no lighting for now */ - glEnable(GL_LIGHTING); - glEnable(GL_LIGHT0); - - glLightfv(GL_LIGHT0, GL_AMBIENT, ambient); - glLightfv(GL_LIGHT0, GL_POSITION, position); - - glMaterialfv(GL_FRONT, GL_DIFFUSE, mat_diffuse); - glMaterialfv(GL_FRONT, GL_SPECULAR, mat_specular); - glMaterialfv(GL_FRONT, GL_SHININESS, mat_shininess); -#endif -} - -void -display(void) -{ - glClearColor(.3, .3, .3, 0); - glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); - glPushMatrix(); -#if 1 - glRotatef(85.0, 1.0, 1.0, 1.0); -#endif - glEvalMesh2(GL_FILL, 0, 8, 0, 8); - glPopMatrix(); - glFlush(); -} - -void -myinit(int argc, char *argv[]) -{ - glClearColor(0.0, 0.0, 0.0, 1.0); - glEnable(GL_DEPTH_TEST); - - initlights(); /* for lighted version only */ - - glMapGrid2f(8, 0.0, 1.0, 8, 0.0, 1.0); - - if (argc > 1) - program = 0; - - printf("Using vertex program attribs? %s\n", program ? "yes" : "no"); - - if (!program) { - glMap2f(GL_MAP2_VERTEX_4, - 0.0, 1.0, 4, 4, - 0.0, 1.0, 16, 4, &ctrlpoints[0][0][0]); - glMap2f(GL_MAP2_COLOR_4, - 0.0, 1.0, 4, 4, - 0.0, 1.0, 16, 4, &colorPoints[0][0][0]); - glEnable(GL_MAP2_VERTEX_4); - glEnable(GL_MAP2_COLOR_4); - /* - glEnable(GL_AUTO_NORMAL); - glEnable(GL_NORMALIZE); - */ - } - else { - glMap2f(GL_MAP2_VERTEX_ATTRIB0_4_NV, - 0.0, 1.0, 4, 4, - 0.0, 1.0, 16, 4, &ctrlpoints[0][0][0]); - glMap2f(GL_MAP2_VERTEX_ATTRIB3_4_NV, - 0.0, 1.0, 4, 4, - 0.0, 1.0, 16, 4, &colorPoints[0][0][0]); - glEnable(GL_MAP2_VERTEX_ATTRIB0_4_NV); - glEnable(GL_MAP2_VERTEX_ATTRIB3_4_NV); - - /* - glEnable(GL_AUTO_NORMAL); - glEnable(GL_NORMALIZE); - */ - - /* vertex program init */ - glLoadProgramNV(GL_VERTEX_PROGRAM_NV, 1, - strlen(prog), (const GLubyte *) prog); - assert(glIsProgramNV(1)); - glBindProgramNV(GL_VERTEX_PROGRAM_NV, 1); - - /* track matrices */ - glTrackMatrixNV(GL_VERTEX_PROGRAM_NV, 0, GL_MODELVIEW_PROJECTION_NV, GL_IDENTITY_NV); - glEnable(GL_VERTEX_PROGRAM_NV); - } -} - -void -myReshape(int w, int h) -{ - glViewport(0, 0, w, h); - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - if (w <= h) - glOrtho(-4.0, 4.0, -4.0 * (GLfloat) h / (GLfloat) w, - 4.0 * (GLfloat) h / (GLfloat) w, -4.0, 4.0); - else - glOrtho(-4.0 * (GLfloat) w / (GLfloat) h, - 4.0 * (GLfloat) w / (GLfloat) h, -4.0, 4.0, -4.0, 4.0); - glMatrixMode(GL_MODELVIEW); - glLoadIdentity(); -} - -static void -key(unsigned char k, int x, int y) -{ - switch (k) { - case 27: /* Escape */ - exit(0); - break; - default: - return; - } - glutPostRedisplay(); -} - -int -main(int argc, char **argv) -{ - glutInit(&argc, argv); - glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB | GLUT_DEPTH); - glutInitWindowPosition(0, 0); - glutCreateWindow(argv[0]); - myinit(argc, argv); - glutReshapeFunc(myReshape); - glutDisplayFunc(display); - glutKeyboardFunc(key); - glutMainLoop(); - return 0; /* ANSI C requires main to return int. */ -} diff --git a/progs/tests/vptest1.c b/progs/tests/vptest1.c deleted file mode 100644 index 560df2c3fd..0000000000 --- a/progs/tests/vptest1.c +++ /dev/null @@ -1,170 +0,0 @@ -/* Test glGenProgramsNV(), glIsProgramNV(), glLoadProgramNV() */ - -#include -#include -#include -#include -#include -#define GL_GLEXT_PROTOTYPES -#include - - - -static void Display( void ) -{ - glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); - - glPushMatrix(); - - glBegin(GL_POLYGON); - glVertexAttrib2fNV(0, -1, -1); - glVertexAttrib2fNV(0, 1, -1); - glVertexAttrib2fNV(0, 0, 1); - glEnd(); - - glPopMatrix(); - - glutSwapBuffers(); -} - - -static void Reshape( int width, int height ) -{ - glViewport( 0, 0, width, height ); - glMatrixMode( GL_PROJECTION ); - glLoadIdentity(); - glFrustum( -1.0, 1.0, -1.0, 1.0, 5.0, 25.0 ); - glMatrixMode( GL_MODELVIEW ); - glLoadIdentity(); - glTranslatef( 0.0, 0.0, -15.0 ); -} - - -static void Key( unsigned char key, int x, int y ) -{ - (void) x; - (void) y; - switch (key) { - case 27: - exit(0); - break; - } - glutPostRedisplay(); -} - - -static void Init( void ) -{ - static const char *prog1 = - "!!VP1.0\n" - "MUL o[COL0].xyz, R0, c[35]; \n" - "END\n"; - static const char *prog2 = - "!!VP1.0\n" - "#\n" - "# c[0-3] = modelview projection (composite) matrix\n" - "# c[32] = normalized light direction in object-space\n" - "# c[35] = yellow diffuse material, (1.0, 1.0, 0.0, 1.0)\n" - "# c[64].x = 0.0\n" - "# c[64].z = 0.125, a scaling factor\n" - "#\n" - "# outputs diffuse illumination for color and perturbed position\n" - "#\n" - "DP3 R0, c[32], v[NRML]; # light direction DOT normal\n" - "MUL o[COL0].xyz, R0, c[35]; \n" - "MAX R0, c[64].x, R0; \n" - "MUL R0, R0, v[NRML]; \n" - "MUL R0, R0, c[64].z; \n" - "ADD R1, v[OPOS], -R0; # perturb object space position\n" - "DP4 o[HPOS].x, c[0], R1; \n" - "DP4 o[HPOS].y, c[1], R1; \n" - "DP4 o[HPOS].z, c[2], R1; \n" - "DP4 o[HPOS].w, c[3], R1; \n" - "END\n"; - static const char *prog3 = - "!!VP1.0\n" - "DP4 o[HPOS].x, c[0], v[OPOS];\n" - "DP4 o[HPOS].y, c[1], v[OPOS];\n" - "DP4 o[HPOS].z, c[2], v[OPOS];\n" - "DP4 o[HPOS].w, c[3], v[OPOS];\n" - "DP3 R0.x, c[4], v[NRML];\n" - "DP3 R0.y, c[5], v[NRML]; \n" - "DP3 R0.z, c[6], v[NRML]; # R0 = n' = transformed normal\n" - "DP3 R1.x, c[32], R0; # R1.x = Lpos DOT n'\n" - "DP3 R1.y, c[33], R0; # R1.y = hHat DOT n'\n" - "MOV R1.w, c[38].x; # R1.w = specular power\n" - "LIT R2, R1; # Compute lighting values\n" - "MAD R3, c[35].x, R2.y, c[35].y; # diffuse + emissive\n" - "MAD o[COL0].xyz, c[36], R2.z, R3; # + specular\n" - "END\n"; - static const char *prog4 = - "!!VP1.0\n" - "DP4 R2, R3, c[A0.x];\n" - "DP4 R2, R3, c[A0.x + 5];\n" - "DP4 o[HPOS], R3, c[A0.x - 4];\n" - "END\n"; - static const char *prog5 = - "!!VSP1.0\n" - "DP4 R2, R3, c[A0.x];\n" - "DP4 R2, R3, v[0];\n" - "DP4 c[3], R3, R2;\n" - "END\n"; - - - GLuint progs[5]; - - glGenProgramsNV(2, progs); - assert(progs[0]); - assert(progs[1]); - assert(progs[0] != progs[1]); - - glGenProgramsNV(3, progs + 2); - assert(progs[2]); - assert(progs[3]); - assert(progs[2] != progs[3]); - assert(progs[0] != progs[2]); - - - glLoadProgramNV(GL_VERTEX_PROGRAM_NV, 1, - strlen(prog1), - (const GLubyte *) prog1); - assert(!glIsProgramNV(1)); - - glLoadProgramNV(GL_VERTEX_PROGRAM_NV, 2, - strlen(prog2), - (const GLubyte *) prog2); - assert(glIsProgramNV(2)); - - glLoadProgramNV(GL_VERTEX_PROGRAM_NV, 3, - strlen(prog3), - (const GLubyte *) prog3); - assert(glIsProgramNV(3)); - - glLoadProgramNV(GL_VERTEX_PROGRAM_NV, 4, - strlen(prog4), - (const GLubyte *) prog4); - assert(glIsProgramNV(4)); - - glLoadProgramNV(GL_VERTEX_STATE_PROGRAM_NV, 5, - strlen(prog5), - (const GLubyte *) prog5); - assert(glIsProgramNV(5)); - - printf("glGetError = %d\n", (int) glGetError()); -} - - -int main( int argc, char *argv[] ) -{ - glutInit( &argc, argv ); - glutInitWindowPosition( 0, 0 ); - glutInitWindowSize( 250, 250 ); - glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH ); - glutCreateWindow(argv[0]); - glutReshapeFunc( Reshape ); - glutKeyboardFunc( Key ); - glutDisplayFunc( Display ); - Init(); - glutMainLoop(); - return 0; -} diff --git a/progs/tests/vptest2.c b/progs/tests/vptest2.c deleted file mode 100644 index 2158e07f04..0000000000 --- a/progs/tests/vptest2.c +++ /dev/null @@ -1,151 +0,0 @@ -/* Test vertex state program execution */ - -#include -#include -#include -#include -#include -#define GL_GLEXT_PROTOTYPES -#include - - - -static void Display( void ) -{ - glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); - glPushMatrix(); - glutSolidCube(2.0); - glPopMatrix(); - glutSwapBuffers(); -} - - -static void Reshape( int width, int height ) -{ - glViewport( 0, 0, width, height ); - glMatrixMode( GL_PROJECTION ); - glLoadIdentity(); - glFrustum( -1.0, 1.0, -1.0, 1.0, 5.0, 25.0 ); - glMatrixMode( GL_MODELVIEW ); - glLoadIdentity(); - glTranslatef( 0.0, 0.0, -15.0 ); -} - - -static void Key( unsigned char key, int x, int y ) -{ - (void) x; - (void) y; - switch (key) { - case 27: - exit(0); - break; - } - glutPostRedisplay(); -} - - -static void Test1( void ) -{ - static const GLfloat p[4] = {9, 8, 7, 6}; - GLfloat q[4]; - /* test addition */ - static const char *prog = - "!!VSP1.0\n" - "MOV R0, c[0];\n" - "MOV R1, c[1];\n" - "ADD c[2], R0, R1;\n" - "END\n"; - - glLoadProgramNV(GL_VERTEX_STATE_PROGRAM_NV, 1, - strlen(prog), - (const GLubyte *) prog); - assert(glIsProgramNV(1)); - - glProgramParameter4fNV(GL_VERTEX_PROGRAM_NV, 0, 1, 2, 3, 4); - glProgramParameter4fNV(GL_VERTEX_PROGRAM_NV, 1, 10, 20, 30, 40); - - glExecuteProgramNV(GL_VERTEX_STATE_PROGRAM_NV, 1, p); - - glGetProgramParameterfvNV(GL_VERTEX_PROGRAM_NV, 2, GL_PROGRAM_PARAMETER_NV, q); - printf("Result c[2] = %g %g %g %g (should be 11 22 33 44)\n", - q[0], q[1], q[2], q[3]); -} - - -static void Test2( void ) -{ - static const GLfloat p[4] = {9, 8, 7, 6}; - GLfloat q[4]; - /* test swizzling */ - static const char *prog = - "!!VSP1.0\n" - "MOV R0, c[0].wzyx;\n" - "MOV R1, c[1].wzyx;\n" - "ADD c[2], R0, R1;\n" - "END\n"; - - glLoadProgramNV(GL_VERTEX_STATE_PROGRAM_NV, 1, - strlen(prog), - (const GLubyte *) prog); - assert(glIsProgramNV(1)); - - glProgramParameter4fNV(GL_VERTEX_PROGRAM_NV, 0, 1, 2, 3, 4); - glProgramParameter4fNV(GL_VERTEX_PROGRAM_NV, 1, 10, 20, 30, 40); - - glExecuteProgramNV(GL_VERTEX_STATE_PROGRAM_NV, 1, p); - - glGetProgramParameterfvNV(GL_VERTEX_PROGRAM_NV, 2, GL_PROGRAM_PARAMETER_NV, q); - printf("Result c[2] = %g %g %g %g (should be 44 33 22 11)\n", - q[0], q[1], q[2], q[3]); -} - - -static void Test3( void ) -{ - static const GLfloat p[4] = {0, 0, 0, 0}; - GLfloat q[4]; - /* normalize vector */ - static const char *prog = - "!!VSP1.0\n" - "# c[0] = (nx,ny,nz)\n" - "# R0.xyz = normalize(R1)\n" - "# R0.w = 1/sqrt(nx*nx + ny*ny + nz*nz)\n" - "# c[2] = R0\n" - "DP3 R0.w, c[0], c[0];\n" - "RSQ R0.w, R0.w;\n" - "MUL R0.xyz, c[0], R0.w;\n" - "MOV c[2], R0;\n" - "END\n"; - - glLoadProgramNV(GL_VERTEX_STATE_PROGRAM_NV, 1, - strlen(prog), - (const GLubyte *) prog); - assert(glIsProgramNV(1)); - - glProgramParameter4fNV(GL_VERTEX_PROGRAM_NV, 0, 0, 10, 0, 0); - - glExecuteProgramNV(GL_VERTEX_STATE_PROGRAM_NV, 1, p); - - glGetProgramParameterfvNV(GL_VERTEX_PROGRAM_NV, 2, GL_PROGRAM_PARAMETER_NV, q); - printf("Result c[2] = %g %g %g %g (should be 0, 1, 0, 0.1)\n", - q[0], q[1], q[2], q[3]); -} - - -int main( int argc, char *argv[] ) -{ - glutInit( &argc, argv ); - glutInitWindowPosition( 0, 0 ); - glutInitWindowSize( 50, 50 ); - glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH ); - glutCreateWindow(argv[0]); - glutReshapeFunc( Reshape ); - glutKeyboardFunc( Key ); - glutDisplayFunc( Display ); - Test1(); - Test2(); - Test3(); - glutMainLoop(); - return 0; -} diff --git a/progs/tests/vptest3.c b/progs/tests/vptest3.c deleted file mode 100644 index 2c5c800040..0000000000 --- a/progs/tests/vptest3.c +++ /dev/null @@ -1,120 +0,0 @@ -/* Test glGenProgramsNV(), glIsProgramNV(), glLoadProgramNV() */ - -#include -#include -#include -#include -#include -#define GL_GLEXT_PROTOTYPES -#include - -static float Zrot = 0.0; - - -static void Display( void ) -{ - glClearColor(0.3, 0.3, 0.3, 1); - glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); - - glEnable(GL_VERTEX_PROGRAM_NV); - - glLoadIdentity(); - glRotatef(Zrot, 0, 0, 1); - - glTrackMatrixNV(GL_VERTEX_PROGRAM_NV, 0, GL_MODELVIEW, GL_IDENTITY_NV); - glPushMatrix(); - - glVertexAttrib3fNV(3, 1, 0.5, 0.25); - glBegin(GL_TRIANGLES); -#if 1 - glVertexAttrib3fNV(3, 1.0, 0.0, 0.0); - glVertexAttrib2fNV(0, -0.5, -0.5); - glVertexAttrib3fNV(3, 0.0, 1.0, 0.0); - glVertexAttrib2fNV(0, 0.5, -0.5); - glVertexAttrib3fNV(3, 0.0, 0.0, 1.0); - glVertexAttrib2fNV(0, 0, 0.5); -#else - glVertex2f( -1, -1); - glVertex2f( 1, -1); - glVertex2f( 0, 1); -#endif - glEnd(); - - glPopMatrix(); - - glutSwapBuffers(); -} - - -static void Reshape( int width, int height ) -{ - glViewport( 0, 0, width, height ); - glMatrixMode( GL_PROJECTION ); - glLoadIdentity(); - /* glFrustum( -2.0, 2.0, -2.0, 2.0, 5.0, 25.0 );*/ - glOrtho(-2.0, 2.0, -2.0, 2.0, -2.0, 2.0 ); - glMatrixMode( GL_MODELVIEW ); - glLoadIdentity(); - /*glTranslatef( 0.0, 0.0, -15.0 );*/ -} - - -static void Key( unsigned char key, int x, int y ) -{ - (void) x; - (void) y; - switch (key) { - case 'z': - Zrot -= 5.0; - break; - case 'Z': - Zrot += 5.0; - break; - case 27: - exit(0); - break; - } - glutPostRedisplay(); -} - - -static void Init( void ) -{ - static const char *prog1 = - "!!VP1.0\n" - "MOV o[COL0], v[COL0];\n" -#if 0 - "MOV o[HPOS], v[OPOS];\n" -#else - "DP4 o[HPOS].x, v[OPOS], c[0];\n" - "DP4 o[HPOS].y, v[OPOS], c[1];\n" - "DP4 o[HPOS].z, v[OPOS], c[2];\n" - "DP4 o[HPOS].w, v[OPOS], c[3];\n" -#endif - "END\n"; - - glLoadProgramNV(GL_VERTEX_PROGRAM_NV, 1, - strlen(prog1), - (const GLubyte *) prog1); - assert(glIsProgramNV(1)); - - glBindProgramNV(GL_VERTEX_PROGRAM_NV, 1); - - printf("glGetError = %d\n", (int) glGetError()); -} - - -int main( int argc, char *argv[] ) -{ - glutInit( &argc, argv ); - glutInitWindowPosition( 0, 0 ); - glutInitWindowSize( 250, 250 ); - glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH ); - glutCreateWindow(argv[0]); - glutReshapeFunc( Reshape ); - glutKeyboardFunc( Key ); - glutDisplayFunc( Display ); - Init(); - glutMainLoop(); - return 0; -} diff --git a/progs/tests/vptorus.c b/progs/tests/vptorus.c deleted file mode 100644 index 764dea4ec2..0000000000 --- a/progs/tests/vptorus.c +++ /dev/null @@ -1,174 +0,0 @@ -/* - * A lit, rotating torus via vertex program - */ - -#include -#include -#include -#include -#include -#define GL_GLEXT_PROTOTYPES -#include - -static float Xrot = 0.0, Yrot = 0.0, Zrot = 0.0; -static GLboolean Anim = GL_TRUE; - - -static void Idle( void ) -{ - Xrot += .3; - Yrot += .4; - Zrot += .2; - glutPostRedisplay(); -} - - -static void Display( void ) -{ - glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); - - glPushMatrix(); - glRotatef(Xrot, 1, 0, 0); - glRotatef(Yrot, 0, 1, 0); - glRotatef(Zrot, 0, 0, 1); - glutSolidTorus(0.75, 2.0, 10, 20); - glPopMatrix(); - - glutSwapBuffers(); -} - - -static void Reshape( int width, int height ) -{ - glViewport( 0, 0, width, height ); - glMatrixMode( GL_PROJECTION ); - glLoadIdentity(); - glFrustum( -2.0, 2.0, -2.0, 2.0, 5.0, 25.0 ); - glMatrixMode( GL_MODELVIEW ); - glLoadIdentity(); - glTranslatef( 0.0, 0.0, -12.0 ); -} - - -static void Key( unsigned char key, int x, int y ) -{ - (void) x; - (void) y; - switch (key) { - case ' ': - Xrot = Yrot = Zrot = 0; - break; - case 'a': - Anim = !Anim; - if (Anim) - glutIdleFunc(Idle); - else - glutIdleFunc(NULL); - break; - case 'z': - Zrot -= 5.0; - break; - case 'Z': - Zrot += 5.0; - break; - case 27: - exit(0); - break; - } - glutPostRedisplay(); -} - - -static void SpecialKey( int key, int x, int y ) -{ - const GLfloat step = 3.0; - (void) x; - (void) y; - switch (key) { - case GLUT_KEY_UP: - Xrot -= step; - break; - case GLUT_KEY_DOWN: - Xrot += step; - break; - case GLUT_KEY_LEFT: - Yrot -= step; - break; - case GLUT_KEY_RIGHT: - Yrot += step; - break; - } - glutPostRedisplay(); -} - - -static void Init( void ) -{ - /* borrowed from an nvidia demo: - * c[0..3] = modelview matrix - * c[4..7] = inverse modelview matrix - * c[32] = light pos - * c[35] = diffuse color - */ - static const char prog[] = - "!!VP1.0\n" - "#Simple transform and diffuse lighting\n" - "\n" - "DP4 o[HPOS].x, c[0], v[OPOS] ; # object x MVP -> clip\n" - "DP4 o[HPOS].y, c[1], v[OPOS] ;\n" - "DP4 o[HPOS].z, c[2], v[OPOS] ;\n" - "DP4 o[HPOS].w, c[3], v[OPOS] ;\n" - - "DP3 R1.x, c[4], v[NRML] ; # normal x MV-1T -> lighting normal\n" - "DP3 R1.y, c[5], v[NRML] ;\n" - "DP3 R1.z, c[6], v[NRML] ;\n" - - "DP3 R0, c[32], R1 ; # L.N\n" - "MUL o[COL0].xyz, R0, c[35] ; # col = L.N * diffuse\n" - "MOV o[TEX0], v[TEX0];\n" - "END"; - - if (!glutExtensionSupported("GL_NV_vertex_program")) { - printf("Sorry, this program requires GL_NV_vertex_program"); - exit(1); - } - - glLoadProgramNV(GL_VERTEX_PROGRAM_NV, 1, - strlen(prog), (const GLubyte *) prog); - assert(glIsProgramNV(1)); - glBindProgramNV(GL_VERTEX_PROGRAM_NV, 1); - - /* Load the program registers */ - glTrackMatrixNV(GL_VERTEX_PROGRAM_NV, 0, GL_MODELVIEW_PROJECTION_NV, GL_IDENTITY_NV); - glTrackMatrixNV(GL_VERTEX_PROGRAM_NV, 4, GL_MODELVIEW, GL_INVERSE_TRANSPOSE_NV); - - /* Light position */ - glProgramParameter4fNV(GL_VERTEX_PROGRAM_NV, 32, 2, 2, 4, 1); - /* Diffuse material color */ - glProgramParameter4fNV(GL_VERTEX_PROGRAM_NV, 35, 0.25, 0, 0.25, 1); - - glEnable(GL_VERTEX_PROGRAM_NV); - glEnable(GL_DEPTH_TEST); - glClearColor(0.3, 0.3, 0.3, 1); - - printf("glGetError = %d\n", (int) glGetError()); -} - - -int main( int argc, char *argv[] ) -{ - glutInit( &argc, argv ); - glutInitWindowPosition( 0, 0 ); - glutInitWindowSize( 250, 250 ); - glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH ); - glutCreateWindow(argv[0]); - glutReshapeFunc( Reshape ); - glutKeyboardFunc( Key ); - glutSpecialFunc( SpecialKey ); - glutDisplayFunc( Display ); - if (Anim) - glutIdleFunc(Idle); - Init(); - glutMainLoop(); - return 0; -} diff --git a/progs/tests/vpwarpmesh.c b/progs/tests/vpwarpmesh.c deleted file mode 100644 index 56aa8200ec..0000000000 --- a/progs/tests/vpwarpmesh.c +++ /dev/null @@ -1,236 +0,0 @@ -/* - * Warp a triangle mesh with a vertex program. - */ - -#include -#include -#include -#include -#include -#define GL_GLEXT_PROTOTYPES -#include - -static float Xrot = -60.0, Yrot = 0.0, Zrot = 0.0; -static GLboolean Anim = GL_TRUE; -static GLfloat Phi = 0.0; - - -static void Idle( void ) -{ - Phi += 0.01; - glutPostRedisplay(); -} - - -static void DrawMesh( int rows, int cols ) -{ - static const GLfloat colorA[3] = { 0, 1, 0 }; - static const GLfloat colorB[3] = { 0, 0, 1 }; - const float dx = 2.0 / (cols - 1); - const float dy = 2.0 / (rows - 1); - float x, y; - int i, j; - -#if 1 -#define COLOR3FV(c) glVertexAttrib3fvNV(3, c) -#define VERTEX2F(x, y) glVertexAttrib2fNV(0, x, y) -#else -#define COLOR3FV(c) glColor3fv(c) -#define VERTEX2F(x, y) glVertex2f(x, y) -#endif - - y = -1.0; - for (i = 0; i < rows - 1; i++) { - glBegin(GL_QUAD_STRIP); - x = -1.0; - for (j = 0; j < cols; j++) { - if ((i + j) & 1) - COLOR3FV(colorA); - else - COLOR3FV(colorB); - VERTEX2F(x, y); - VERTEX2F(x, y + dy); - x += dx; - } - glEnd(); - y += dy; - } -} - - -static void Display( void ) -{ - glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); - - glPushMatrix(); - glRotatef(Xrot, 1, 0, 0); - glRotatef(Yrot, 0, 1, 0); - glRotatef(Zrot, 0, 0, 1); - - /* Position the gravity source */ - { - GLfloat x, y, z, r = 0.5; - x = r * cos(Phi); - y = r * sin(Phi); - z = 1.0; - glProgramParameter4fNV(GL_VERTEX_PROGRAM_NV, 30, x, y, z, 1); - glDisable(GL_VERTEX_PROGRAM_NV); - glBegin(GL_POINTS); - glColor3f(1,1,1); - glVertex3f(x, y, z); - glEnd(); - } - - glEnable(GL_VERTEX_PROGRAM_NV); - DrawMesh(8, 8); - glPopMatrix(); - - glutSwapBuffers(); -} - - -static void Reshape( int width, int height ) -{ - float ar = (float) width / (float) height; - glViewport( 0, 0, width, height ); - glMatrixMode( GL_PROJECTION ); - glLoadIdentity(); - glFrustum( -1.0 * ar, 1.0 * ar, -1.0, 1.0, 5.0, 25.0 ); - glMatrixMode( GL_MODELVIEW ); - glLoadIdentity(); - glTranslatef( 0.0, 0.0, -12.0 ); - glScalef(2, 2, 2); -} - - -static void Key( unsigned char key, int x, int y ) -{ - (void) x; - (void) y; - switch (key) { - case 'a': - Anim = !Anim; - if (Anim) - glutIdleFunc(Idle); - else - glutIdleFunc(NULL); - break; - case 'p': - Phi += 0.2; - break; - case 'z': - Zrot -= 5.0; - break; - case 'Z': - Zrot += 5.0; - break; - case 27: - exit(0); - break; - } - glutPostRedisplay(); -} - - -static void SpecialKey( int key, int x, int y ) -{ - const GLfloat step = 3.0; - (void) x; - (void) y; - switch (key) { - case GLUT_KEY_UP: - Xrot -= step; - break; - case GLUT_KEY_DOWN: - Xrot += step; - break; - case GLUT_KEY_LEFT: - Yrot -= step; - break; - case GLUT_KEY_RIGHT: - Yrot += step; - break; - } - glutPostRedisplay(); -} - - -static void Init( void ) -{ - /* - * c[0..3] = modelview matrix - * c[4..7] = inverse modelview matrix - * c[30] = gravity source location - * c[31] = gravity source strength - * c[32] = light pos - * c[35] = diffuse color - */ - static const char prog[] = - "!!VP1.0\n" - - "# Compute distance from vertex to gravity source\n" - "ADD R1, c[30], -v[OPOS]; # vector from vertex to gravity\n" - "DP3 R2, R1, R1; # dot product\n" - "RSQ R2, R2.x; # square root = distance\n" - "MUL R2, R2, c[31].xxxx; # scale by the gravity factor\n" - - "# Displace vertex by gravity factor along R1 vector\n" - "MAD R3, R1, R2, v[OPOS];\n" - - "# Continue with typical modelview/projection\n" - "DP4 o[HPOS].x, c[0], R3 ; # object x MVP -> clip\n" - "DP4 o[HPOS].y, c[1], R3 ;\n" - "DP4 o[HPOS].z, c[2], R3 ;\n" - "DP4 o[HPOS].w, c[3], R3 ;\n" - - "MOV o[COL0], v[COL0];\n # copy input color to output color\n" - - "END"; - - if (!glutExtensionSupported("GL_NV_vertex_program")) { - printf("Sorry, this program requires GL_NV_vertex_program\n"); - exit(1); - } - - glLoadProgramNV(GL_VERTEX_PROGRAM_NV, 1, - strlen(prog), (const GLubyte *) prog); - assert(glIsProgramNV(1)); - glBindProgramNV(GL_VERTEX_PROGRAM_NV, 1); - - /* Load the program registers */ - glTrackMatrixNV(GL_VERTEX_PROGRAM_NV, 0, GL_MODELVIEW_PROJECTION_NV, GL_IDENTITY_NV); - glTrackMatrixNV(GL_VERTEX_PROGRAM_NV, 4, GL_MODELVIEW, GL_INVERSE_TRANSPOSE_NV); - - /* Light position */ - glProgramParameter4fNV(GL_VERTEX_PROGRAM_NV, 32, 2, 2, 4, 1); - /* Diffuse material color */ - glProgramParameter4fNV(GL_VERTEX_PROGRAM_NV, 35, 0.25, 0, 0.25, 1); - - /* Gravity strength */ - glProgramParameter4fNV(GL_VERTEX_PROGRAM_NV, 31, .5, 0, 0, 0); - - glEnable(GL_DEPTH_TEST); - glClearColor(0.3, 0.3, 0.3, 1); - glShadeModel(GL_FLAT); - glPointSize(3); - printf("glGetError = %d\n", (int) glGetError()); -} - - -int main( int argc, char *argv[] ) -{ - glutInit( &argc, argv ); - glutInitWindowPosition( 0, 0 ); - glutInitWindowSize( 250, 250 ); - glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH ); - glutCreateWindow(argv[0]); - glutReshapeFunc( Reshape ); - glutKeyboardFunc( Key ); - glutSpecialFunc( SpecialKey ); - glutDisplayFunc( Display ); - if (Anim) - glutIdleFunc(Idle); - Init(); - glutMainLoop(); - return 0; -} diff --git a/progs/tests/yuvrect.c b/progs/tests/yuvrect.c deleted file mode 100644 index acef406097..0000000000 --- a/progs/tests/yuvrect.c +++ /dev/null @@ -1,193 +0,0 @@ -/* - * Test the GL_NV_texture_rectangle and GL_MESA_ycrcb_texture extensions. - * - * Brian Paul 13 September 2002 - */ - -#include -#include -#include -#include -#include -#define GL_GLEXT_PROTOTYPES -#include - -#include "../util/readtex.c" /* I know, this is a hack. */ - -#define TEXTURE_FILE "../images/girl.rgb" - -static GLfloat Xrot = 0, Yrot = 0, Zrot = 0; -static GLint ImgWidth, ImgHeight; -static GLushort *ImageYUV = NULL; - - -static void DrawObject(void) -{ - glBegin(GL_QUADS); - - glTexCoord2f(0, 0); - glVertex2f(-1.0, -1.0); - - glTexCoord2f(ImgWidth, 0); - glVertex2f(1.0, -1.0); - - glTexCoord2f(ImgWidth, ImgHeight); - glVertex2f(1.0, 1.0); - - glTexCoord2f(0, ImgHeight); - glVertex2f(-1.0, 1.0); - - glEnd(); -} - - -static void Display( void ) -{ - glClear( GL_COLOR_BUFFER_BIT ); - - glPushMatrix(); - glRotatef(Xrot, 1.0, 0.0, 0.0); - glRotatef(Yrot, 0.0, 1.0, 0.0); - glRotatef(Zrot, 0.0, 0.0, 1.0); - DrawObject(); - glPopMatrix(); - - glutSwapBuffers(); -} - - -static void Reshape( int width, int height ) -{ - glViewport( 0, 0, width, height ); - glMatrixMode( GL_PROJECTION ); - glLoadIdentity(); - glFrustum( -1.0, 1.0, -1.0, 1.0, 10.0, 100.0 ); - glMatrixMode( GL_MODELVIEW ); - glLoadIdentity(); - glTranslatef( 0.0, 0.0, -15.0 ); -} - - -static void Key( unsigned char key, int x, int y ) -{ - (void) x; - (void) y; - switch (key) { - case 27: - exit(0); - break; - } - glutPostRedisplay(); -} - - -static void SpecialKey( int key, int x, int y ) -{ - float step = 3.0; - (void) x; - (void) y; - - switch (key) { - case GLUT_KEY_UP: - Xrot += step; - break; - case GLUT_KEY_DOWN: - Xrot -= step; - break; - case GLUT_KEY_LEFT: - Yrot += step; - break; - case GLUT_KEY_RIGHT: - Yrot -= step; - break; - } - glutPostRedisplay(); -} - - - -static void Init( int argc, char *argv[] ) -{ - GLuint texObj = 100; - const char *file; - - if (!glutExtensionSupported("GL_NV_texture_rectangle")) { - printf("Sorry, GL_NV_texture_rectangle is required\n"); - exit(0); - } - - if (!glutExtensionSupported("GL_MESA_ycbcr_texture")) { - printf("Sorry, GL_MESA_ycbcr_texture is required\n"); - exit(0); - } - - glPixelStorei(GL_UNPACK_ALIGNMENT, 1); - - glBindTexture(GL_TEXTURE_RECTANGLE_NV, texObj); -#ifdef LINEAR_FILTER - /* linear filtering looks much nicer but is much slower for Mesa */ - glTexParameteri(GL_TEXTURE_RECTANGLE_NV, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_RECTANGLE_NV, GL_TEXTURE_MAG_FILTER, GL_LINEAR); -#else - glTexParameteri(GL_TEXTURE_RECTANGLE_NV, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - glTexParameteri(GL_TEXTURE_RECTANGLE_NV, GL_TEXTURE_MAG_FILTER, GL_NEAREST); -#endif - - if (argc > 1) - file = argv[1]; - else - file = TEXTURE_FILE; - - ImageYUV = LoadYUVImage(file, &ImgWidth, &ImgHeight); - if (!ImageYUV) { - printf("Couldn't read %s\n", TEXTURE_FILE); - exit(0); - } - - printf("Image: %dx%d\n", ImgWidth, ImgHeight); - - glTexImage2D(GL_TEXTURE_RECTANGLE_NV, 0, - GL_YCBCR_MESA, ImgWidth, ImgHeight, 0, - GL_YCBCR_MESA, GL_UNSIGNED_SHORT_8_8_MESA, ImageYUV); - - assert(glGetError() == GL_NO_ERROR); - glTexSubImage2D(GL_TEXTURE_RECTANGLE_NV, 0, - 0, 0, ImgWidth, ImgHeight, - GL_YCBCR_MESA, GL_UNSIGNED_SHORT_8_8_MESA, ImageYUV); - - assert(glGetError() == GL_NO_ERROR); - - glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); - - glEnable(GL_TEXTURE_RECTANGLE_NV); - - glShadeModel(GL_FLAT); - glClearColor(0.3, 0.3, 0.4, 1.0); - - if (argc > 1 && strcmp(argv[1], "-info")==0) { - printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - printf("GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - printf("GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - printf("GL_EXTENSIONS = %s\n", (char *) glGetString(GL_EXTENSIONS)); - } -} - - -int main( int argc, char *argv[] ) -{ - glutInit( &argc, argv ); - glutInitWindowSize( 300, 300 ); - glutInitWindowPosition( 0, 0 ); - glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE ); - glutCreateWindow(argv[0] ); - - Init( argc, argv ); - - glutReshapeFunc( Reshape ); - glutKeyboardFunc( Key ); - glutSpecialFunc( SpecialKey ); - glutDisplayFunc( Display ); - - glutMainLoop(); - return 0; -} diff --git a/progs/tests/yuvsquare.c b/progs/tests/yuvsquare.c deleted file mode 100644 index 3601e7a31c..0000000000 --- a/progs/tests/yuvsquare.c +++ /dev/null @@ -1,232 +0,0 @@ -/* - * Test the GL_NV_texture_rectangle and GL_MESA_ycrcb_texture extensions. - * - * Brian Paul 13 September 2002 - */ - - -#include -#include -#include -#include -#define GL_GLEXT_PROTOTYPES -#include - -#include "../util/readtex.c" /* I know, this is a hack. */ - -#define TEXTURE_FILE "../images/tile.rgb" - -static GLfloat Xrot = 0, Yrot = 0, Zrot = 0; -static GLint ImgWidth, ImgHeight; -static GLushort *ImageYUV = NULL; -static GLubyte *ImageRGB = NULL; -static const GLuint yuvObj = 100; -static const GLuint rgbObj = 101; - - -static void DrawObject(void) -{ - glBegin(GL_QUADS); - - glTexCoord2f(0, 0); - glVertex2f(-1.0, -1.0); - - glTexCoord2f(1, 0); - glVertex2f(1.0, -1.0); - - glTexCoord2f(1, 1); - glVertex2f(1.0, 1.0); - - glTexCoord2f(0, 1); - glVertex2f(-1.0, 1.0); - - glEnd(); -} - - -static void Display( void ) -{ - glClear( GL_COLOR_BUFFER_BIT ); - - glPushMatrix(); - glTranslatef( -1.1, 0.0, -15.0 ); - glRotatef(Xrot, 1.0, 0.0, 0.0); - glRotatef(Yrot, 0.0, 1.0, 0.0); - glRotatef(Zrot, 0.0, 0.0, 1.0); - glBindTexture(GL_TEXTURE_2D, yuvObj); - DrawObject(); - glPopMatrix(); - - glPushMatrix(); - glTranslatef( 1.1, 0.0, -15.0 ); - glRotatef(Xrot, 1.0, 0.0, 0.0); - glRotatef(Yrot, 0.0, 1.0, 0.0); - glRotatef(Zrot, 0.0, 0.0, 1.0); - glBindTexture(GL_TEXTURE_2D, rgbObj); - DrawObject(); - glPopMatrix(); - - glutSwapBuffers(); -} - - -static void Reshape( int width, int height ) -{ - glViewport( 0, 0, width, height ); - glMatrixMode( GL_PROJECTION ); - glLoadIdentity(); - glFrustum( -1.1, 1.1, -1.1, 1.1, 10.0, 100.0 ); - glMatrixMode( GL_MODELVIEW ); - glLoadIdentity(); - glTranslatef( 0.0, 0.0, -15.0 ); -} - - -static void Key( unsigned char key, int x, int y ) -{ - (void) x; - (void) y; - switch (key) { - case 27: - exit(0); - break; - } - glutPostRedisplay(); -} - - -static void SpecialKey( int key, int x, int y ) -{ - float step = 3.0; - (void) x; - (void) y; - - switch (key) { - case GLUT_KEY_UP: - Xrot += step; - break; - case GLUT_KEY_DOWN: - Xrot -= step; - break; - case GLUT_KEY_LEFT: - Yrot += step; - break; - case GLUT_KEY_RIGHT: - Yrot -= step; - break; - } - glutPostRedisplay(); -} - - -#define CLAMP( X, MIN, MAX ) ( (X)<(MIN) ? (MIN) : ((X)>(MAX) ? (MAX) : (X)) ) - - - -/* #define LINEAR_FILTER */ - -static void Init( int argc, char *argv[] ) -{ - const char *file; - GLenum format; - - if (!glutExtensionSupported("GL_MESA_ycbcr_texture")) { - printf("Sorry, GL_MESA_ycbcr_texture is required\n"); - exit(0); - } - - glPixelStorei(GL_UNPACK_ALIGNMENT, 1); - - if (argc > 1) - file = argv[1]; - else - file = TEXTURE_FILE; - - /* First load the texture as YCbCr. - */ - - glBindTexture(GL_TEXTURE_2D, yuvObj); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - - ImageYUV = LoadYUVImage(file, &ImgWidth, &ImgHeight ); - if (!ImageYUV) { - printf("Couldn't read %s\n", TEXTURE_FILE); - exit(0); - } - - printf("Image: %dx%d\n", ImgWidth, ImgHeight); - - - glTexImage2D(GL_TEXTURE_2D, 0, - GL_YCBCR_MESA, - ImgWidth, ImgHeight, 0, - GL_YCBCR_MESA, - GL_UNSIGNED_SHORT_8_8_MESA, ImageYUV); - - glEnable(GL_TEXTURE_2D); - - glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); - - - - /* Now load the texture as RGB. - */ - - glBindTexture(GL_TEXTURE_2D, rgbObj); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - - ImageRGB = LoadRGBImage(file, &ImgWidth, &ImgHeight, &format ); - if (!ImageRGB) { - printf("Couldn't read %s\n", TEXTURE_FILE); - exit(0); - } - - printf("Image: %dx%d\n", ImgWidth, ImgHeight); - - - glTexImage2D(GL_TEXTURE_2D, 0, - format, - ImgWidth, ImgHeight, 0, - format, - GL_UNSIGNED_BYTE, ImageRGB); - - glEnable(GL_TEXTURE_2D); - - glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); - - - - glShadeModel(GL_FLAT); - glClearColor(0.3, 0.3, 0.4, 1.0); - - if (argc > 1 && strcmp(argv[1], "-info")==0) { - printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - printf("GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - printf("GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - printf("GL_EXTENSIONS = %s\n", (char *) glGetString(GL_EXTENSIONS)); - } - - printf( "Both images should appear the same.\n" ); -} - - -int main( int argc, char *argv[] ) -{ - glutInit( &argc, argv ); - glutInitWindowSize( 300, 300 ); - glutInitWindowPosition( 0, 0 ); - glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE ); - glutCreateWindow(argv[0] ); - - Init( argc, argv ); - - glutReshapeFunc( Reshape ); - glutKeyboardFunc( Key ); - glutSpecialFunc( SpecialKey ); - glutDisplayFunc( Display ); - - glutMainLoop(); - return 0; -} diff --git a/progs/tests/zreaddraw.c b/progs/tests/zreaddraw.c deleted file mode 100644 index e2dacbf7f2..0000000000 --- a/progs/tests/zreaddraw.c +++ /dev/null @@ -1,116 +0,0 @@ -/* - * Test glRead/DrawPixels for GL_DEPTH_COMPONENT, with pixelzoom. - * - * Brian Paul - * 23 August 2003 - */ - -#include -#include -#include -#define GL_GLEXT_PROTOTYPES -#include - -static GLint WinWidth = 500, WinHeight = 500; - - -static void Display(void) -{ - GLfloat depth[100 * 100]; - GLfloat depth2[400 * 400]; - GLfloat min, max; - int i; - - glClearColor(0.5, 0.5, 0.5, 0); - glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); - - /* draw a sphere */ - glViewport(0, 0, 100, 100); - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glOrtho(-1, 1, -1, 1, -1, 0); /* clip away back half of sphere */ - glMatrixMode(GL_MODELVIEW); - glLoadIdentity(); - glutSolidSphere(1.0, 20, 10); - - /* read the depth image */ - glReadPixels(0, 0, 100, 100, GL_DEPTH_COMPONENT, GL_FLOAT, depth); - min = max = depth[0]; - for (i = 1; i < 100 * 100; i++) { - if (depth[i] < min) - min = depth[i]; - if (depth[i] > max) - max = depth[i]; - } - printf("Depth value range: [%f, %f]\n", min, max); - - /* draw depth image with scaling (into z buffer) */ - glPixelZoom(4.0, 4.0); - glWindowPos2i(100, 0); - glDrawPixels(100, 100, GL_DEPTH_COMPONENT, GL_FLOAT, depth); - - /* read back scaled depth image */ - glReadPixels(100, 0, 400, 400, GL_DEPTH_COMPONENT, GL_FLOAT, depth2); - /* draw as luminance */ - glPixelZoom(1.0, 1.0); - glDrawPixels(400, 400, GL_LUMINANCE, GL_FLOAT, depth2); - - glutSwapBuffers(); -} - - -static void Reshape(int width, int height) -{ - WinWidth = width; - WinHeight = height; - glViewport(0, 0, width, height); -} - - -static void Key(unsigned char key, int x, int y) -{ - (void) x; - (void) y; - switch (key) { - case 27: - exit(0); - break; - } - glutPostRedisplay(); -} - - -static void Init(void) -{ - const GLfloat blue[4] = {.1, .1, 1.0, 0.0}; - const GLfloat gray[4] = {0.2, 0.2, 0.2, 1.0}; - const GLfloat white[4] = {1.0, 1.0, 1.0, 1.0}; - const GLfloat pos[4] = {0, 0, 10, 0}; - - printf("GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - - glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, blue); - glLightfv(GL_LIGHT0, GL_AMBIENT, gray); - glLightfv(GL_LIGHT0, GL_DIFFUSE, white); - glLightfv(GL_LIGHT0, GL_POSITION, pos); - glEnable(GL_LIGHTING); - glEnable(GL_LIGHT0); - glEnable(GL_DEPTH_TEST); -} - - -int main(int argc, char *argv[]) -{ - glutInit(&argc, argv); - glutInitWindowPosition(0, 0); - glutInitWindowSize(WinWidth, WinHeight); - glutInitDisplayMode(GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE); - glutCreateWindow(argv[0]); - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Display); - Init(); - glutMainLoop(); - return 0; -} diff --git a/progs/tools/trace/.gitignore b/progs/tools/trace/.gitignore deleted file mode 100644 index afe0c5829e..0000000000 --- a/progs/tools/trace/.gitignore +++ /dev/null @@ -1 +0,0 @@ -gltrace.cc diff --git a/progs/tools/trace/Makefile b/progs/tools/trace/Makefile deleted file mode 100644 index 822e466ad1..0000000000 --- a/progs/tools/trace/Makefile +++ /dev/null @@ -1,30 +0,0 @@ -# Makefile for Thomas Sondergaard's API tracer - -TOP = ../../.. - -include $(TOP)/configs/current - - -OBJECTS = gltrace.o gltrace_support.o - -TRACER = gltrace.so - -.cc.o: - $(CXX) -c $(INCDIRS) $(CXXFLAGS) $< -o $@ - - -default: $(TRACER) - -$(TRACER): $(OBJECTS) - $(MKLIB) -o $(TRACER) -noprefix -cplusplus -linker '$(CXX)' \ - -ldflags '$(LDFLAGS)' $(MKLIB_OPTIONS) $(OBJECTS) - -gltrace.cc: gltrace.py - PYTHONPATH=$(TOP)/src/mesa/glapi python gltrace.py -f $(TOP)/src/mesa/glapi/gl_API.xml > gltrace.cc - - -clean: - rm -f $(OBJECTS) - rm -f $(TRACER) - rm -f *~ - rm -f gltrace.cc diff --git a/progs/tools/trace/README b/progs/tools/trace/README deleted file mode 100644 index 7b3141dba7..0000000000 --- a/progs/tools/trace/README +++ /dev/null @@ -1,23 +0,0 @@ -NAME - gltrace - trace opengl calls - -SYNOPSIS - gltrace [OPTION] command [arg ...] - -DESCRIPTION - -h help (this text) - -c log gl calls - -t time stamp log entries - -e check for and log errors. errors occurring between - glBegin() and glEnd() are checked at glEnd() - -v verbose. Shows configuration settings passed to - gltrace.so - -l LOGFILE logfile. Default is stderr - -PROBLEMS - Not all OpenGL extensions are known and traced by gltrace. Extension - functions not initialized using glXGetProcAddress(ARB) will not be - traced. - -AUTHOR - Thomas Sondergaard (ts_news1 'at' sondergaard.cc) diff --git a/progs/tools/trace/gltrace b/progs/tools/trace/gltrace deleted file mode 100755 index d386912cf2..0000000000 --- a/progs/tools/trace/gltrace +++ /dev/null @@ -1,82 +0,0 @@ -#!/bin/bash - -# Copyright (C) 2006 Thomas Sondergaard -# All Rights Reserved. -# -# Permission is hereby granted, free of charge, to any person obtaining a -# copy of this software and associated documentation files (the "Software"), -# to deal in the Software without restriction, including without limitation -# on the rights to use, copy, modify, merge, publish, distribute, sub -# license, and/or sell copies of the Software, and to permit persons to whom -# the Software is furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice (including the next -# paragraph) shall be included in all copies or substantial portions of the -# Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL -# IBM AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -# IN THE SOFTWARE. -# -# Authors: -# Thomas Sondergaard - -usage="usage: $0 [ -hctev ] [-l LOGFILE] program [args...]\n\t-h\t\thelp (this text)\n\t-c\t\tlog gl calls\n\t-t\t\ttime stamp log entries\n\t-e\t\tcheck for and log errors. errors occurring between\n\t\t\tglBegin() and glEnd() are checked at glEnd()\n\t-v\t\tverbose. Shows configuration settings passed to\n\t\t\tgltrace.so\n\t-l LOGFILE\tlogfile. Default is stderr" - -# Path to gltrace.so - must not be relative -#GLTRACE_SO=/home/ts/Mesa_gltrace/src/mesa/glapi/gltrace.so -# This seems to work: -GLTRACE_SO=./gltrace.so - -# Set options from command line - -VERBOSE=0 -GLTRACE_LOG_CALLS=0 -GLTRACE_LOG_TIME=0 -GLTRACE_CHECK_ERRORS=0 -export GLTRACE_LOG_CALLS GLTRACE_LOG_TIME GLTRACE_CHECK_ERRORS - -if [ $# -eq 0 ]; then - echo -e $usage - exit -fi - -while getopts "hctevl:" options; do - case $options in - h) echo -e $usage - exit 1;; - c) GLTRACE_LOG_CALLS=1;; - t) GLTRACE_LOG_TIME=1;; - e) GLTRACE_CHECK_ERRORS=1;; - l) GLTRACE_LOGFILE=$OPTARG - export GLTRACE_LOGFILE;; - v) VERBOSE=1;; - *) echo -e $usage - exit 1;; - esac -done - -# Remove the parsed args -shift $(($OPTIND-1)) - -if [ ! -r $GLTRACE_SO ]; then - echo "Error: The gltrace.so file '$GLTRACE_SO' is missing!" - exit 1 -fi - -export LD_PRELOAD=$GLTRACE_SO - -if [ $VERBOSE -eq 1 ]; then - echo GLTRACE_LOG_CALLS=$GLTRACE_LOG_CALLS - echo GLTRACE_LOG_TIME=$GLTRACE_LOG_TIME - echo GLTRACE_CHECK_ERRORS=$GLTRACE_CHECK_ERRORS - echo GLTRACE_LOGFILE=$GLTRACE_LOGFILE - echo LD_PRELOAD=$LD_PRELOAD - echo command=$* -fi - -exec $* diff --git a/progs/tools/trace/gltrace.py b/progs/tools/trace/gltrace.py deleted file mode 100644 index 973881ac94..0000000000 --- a/progs/tools/trace/gltrace.py +++ /dev/null @@ -1,189 +0,0 @@ -#!/usr/bin/env python - -# Copyright (C) 2006 Thomas Sondergaard -# All Rights Reserved. -# -# Permission is hereby granted, free of charge, to any person obtaining a -# copy of this software and associated documentation files (the "Software"), -# to deal in the Software without restriction, including without limitation -# on the rights to use, copy, modify, merge, publish, distribute, sub -# license, and/or sell copies of the Software, and to permit persons to whom -# the Software is furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice (including the next -# paragraph) shall be included in all copies or substantial portions of the -# Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL -# IBM AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -# IN THE SOFTWARE. -# -# Authors: -# Thomas Sondergaard - -import gl_XML, glX_XML, glX_proto_common, license -import sys, getopt, copy, string - -def create_argument_string(parameters): - """Create a parameter string from a list of gl_parameters.""" - - list = [] - for p in parameters: - list.append( p.name ) - #if len(list) == 0: list = ["void"] - - return string.join(list, ", ") - -def create_logfunc_string(func, name): - """Create a parameter string from a list of gl_parameters.""" - - list = [] - list.append('"gl' + name + '("') - sep = None - for p in func.parameters: - if (sep): - list.append(sep) - list.append( p.name ) - sep = '", "' - list.append('");"') - #if len(list) == 0: list = ["void"] - - return "if (config.logCalls) GLTRACE_LOG(" + string.join(list, " << ")+");"; - -class PrintGltrace(glX_proto_common.glx_print_proto): #(gl_XML.gl_print_base): - def __init__(self): - gl_XML.gl_print_base.__init__(self) - - self.name = "gltrace.py" - self.license = license.bsd_license_template % ( \ -"""Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. -(C) Copyright IBM Corporation 2004""", "PRECISION INSIGHT, IBM") - #self.header_tag = "_INDIRECT_H_" - - self.last_category = "" - return - - - def printRealHeader(self): - print """/** - * \\file - * gl and glX wrappers for tracing - * - * \\author Thomas Sondergaard - */ -""" - #self.printVisibility( "HIDDEN", "hidden" ) - #self.printFastcall() - #self.printNoinline() - - print """ -#include -#include -#include -#include -#include "gltrace_support.h" - -using namespace gltrace; - -static GLenum real_glGetError() { - static GLenum (*real_func)(void) = 0; - if (!real_func) real_func = (GLenum (*)(void)) dlsym(RTLD_NEXT, "glGetError"); - return real_func(); -} - -bool betweenGLBeginEnd = false; - -extern "C" { - - -__GLXextFuncPtr real_glXGetProcAddressARB(const GLubyte *func_name) { - static __GLXextFuncPtr (*real_func)(const GLubyte *func_name) = 0; - if (!real_func) real_func = (__GLXextFuncPtr (*)(const GLubyte *func_name)) dlsym(RTLD_NEXT, "glXGetProcAddressARB"); - - return real_func(func_name); -} - -__GLXextFuncPtr glXGetProcAddressARB(const GLubyte *func_name_ubyte) { - std::string func_name = - std::string("gltrace_")+reinterpret_cast(func_name_ubyte); - - __GLXextFuncPtr f = (__GLXextFuncPtr) dlsym(RTLD_DEFAULT, func_name.c_str()); - if (!f) { - GLTRACE_LOG("warning: Could not resolve '" << func_name << "' - function will not be intercepted"); - return real_glXGetProcAddressARB(func_name_ubyte); - } - return f; -} - -""" - - def printRealFooter(self): - print "} // Extern \"C\"" - - def printBody(self, api): - for func in api.functionIterateGlx(): - for func_name in func.entry_points: - functionPrefix = "" - use_dlsym = True - if (api.get_category_for_name(func.name)[1] != None): - functionPrefix = "gltrace_" - use_dlsym = False - - print '%s %sgl%s(%s) {' % (func.return_type, functionPrefix, func_name, func.get_parameter_string()) - if (use_dlsym): - print ' static %s (*real_func)(%s) = 0;' % (func.return_type, func.get_parameter_string()) - print ' if (!real_func) real_func = (%s (*)(%s)) dlsym(RTLD_NEXT, "gl%s");' % (func.return_type, func.get_parameter_string(), func_name) - else: # use glXGetProcAddressArb - print ' static %s (*real_func)(%s) = 0;' % (func.return_type, func.get_parameter_string()) - print ' if (!real_func) real_func = (%s (*)(%s)) real_glXGetProcAddressARB((GLubyte *)"gl%s");' % (func.return_type, func.get_parameter_string(), func_name) - print ' ' + create_logfunc_string(func, func_name) - if (func.return_type == "void"): - print ' real_func(%s);' % (create_argument_string(func.parameters)) - else: - print ' %s retval = real_func(%s);' % (func.return_type, create_argument_string(func.parameters)) - if (func.name == "Begin"): - print ' betweenGLBeginEnd = true;' - elif (func.name == "End"): - print ' betweenGLBeginEnd = false;' - print ' if (!betweenGLBeginEnd && config.checkErrors) {' - print ' GLenum res;' - print ' while ((res = real_glGetError ()) != GL_NO_ERROR) ' - print ' GLTRACE_LOG("OpenGL Error (" << res << "): <" << gluErrorString(res) << "> at " << gltrace::getStackTrace());' - print ' }' - if (func.return_type != "void"): - print " return retval;" - print '}' - - -def show_usage(): - print "Usage: %s [-f input_file_name] [-m output_mode] [-d]" % sys.argv[0] - print " -m output_mode Output mode can be one of 'proto', 'init_c' or 'init_h'." - print " -d Enable extra debug information in the generated code." - sys.exit(1) - - -if __name__ == '__main__': - file_name = "gl_API.xml" - - try: - (args, trail) = getopt.getopt(sys.argv[1:], "f:d") - except Exception,e: - show_usage() - - debug = 0 - for (arg,val) in args: - if arg == "-f": - file_name = val - elif arg == "-d": - debug = 1 - - printer = PrintGltrace() - - printer.debug = debug - api = gl_XML.parse_GL_API( file_name, glX_XML.glx_item_factory() ) - - printer.Print( api ) diff --git a/progs/tools/trace/gltrace_support.cc b/progs/tools/trace/gltrace_support.cc deleted file mode 100644 index 0b76d3247d..0000000000 --- a/progs/tools/trace/gltrace_support.cc +++ /dev/null @@ -1,193 +0,0 @@ -/* - * Copyright (C) 2006 Thomas Sondergaard All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -#include "gltrace_support.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include - -namespace { - - const char * - demangle (const char * mangled) throw() - { - static char buf[4096]; - int status; - size_t length = sizeof(buf)-1; - - memset (buf, 0, sizeof(buf)); - - if (!mangled) - return 0; - - char * demangled = __cxxabiv1::__cxa_demangle(mangled, - buf, - &length, - &status); - if (demangled && !status) - return demangled; - else - return mangled; - } - - void - printStackTrace (void **stackframes, - int stackframe_size, - std::ostream & out ) - { - char **strings = 0; - std::stringstream ss; - - // this might actually fail if memory is tight or we are in a - // signal handler - strings = backtrace_symbols (stackframes, stackframe_size); - - ss << "Backtrace :"; - - if (stackframe_size == gltrace::MAX_STACKFRAMES) - ss << "(possibly incomplete maximal number of frames exceeded):" << std::endl; - else - ss << std::endl; - - out << ss.str(); - - // the first frame is the constructor of the exception - // the last frame always seem to be bogus? - for (int i = 0; strings && i < stackframe_size-1; ++i) { - char libname[257], funcname[2049]; - unsigned int address=0, funcoffset = 0x0; - - memset (libname,0,sizeof(libname)); - memset (funcname,0,sizeof(funcname)); - - strcpy (funcname,"??"); - strcpy (libname, "??"); - - int scanned = sscanf (strings[i], "%256[^(] ( %2048[^+] + %x ) [ %x ]", - libname, - funcname, - &funcoffset, - &address); - - /* ok, so no function was mentioned in the backtrace */ - if (scanned < 4) { - scanned = sscanf (strings[i], "%256[^([] [ %x ]", - libname, - &address); - } - - if (funcname[0] == '_') { - const char * demangled; - if ((demangled = demangle(funcname) ) != funcname) { - strncpy (funcname, demangled, sizeof(funcname)-1); - } - } - else - strcat (funcname," ()"); - - out << "\t#" << i << std::hex << " 0x" << address << " in " << funcname - << " at 0x" << funcoffset << " (from " << libname << ")" << std::endl; - } - - free (strings); - } - - -} // anon namespace - -namespace gltrace { - - std::string getStackTrace(int count, int first) { - ++first; - std::stringstream ss; - const int BA_MAX = 1000; - assert(count + first <= BA_MAX); - void *ba[BA_MAX]; - int n = backtrace(ba, count+first); - - printStackTrace( &ba[first], n-first, ss); - - return ss.str(); - } - - std::ostream &timeNow(std::ostream &os) { - - struct timeval now; - struct tm t; - static char const *months[12] = - { - "Jan", "Feb", "Mar", "Apr", "May", "Jun", - "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" - }; - - gettimeofday (&now, 0); - localtime_r ((time_t*) &now.tv_sec, &t); - - os - << months[t.tm_mon] << " " - << std::setw(2) << t.tm_mday << " " - << std::setw(2) << t.tm_hour << ":" - << std::setw(2) << t.tm_min << ":" - << std::setw(2) << t.tm_sec << "." - << std::setw(3) << now.tv_usec/1000; - return os; - } - - logstream::logstream(const char *filename) { - if (!filename) - init(std::cerr.rdbuf()); - else { - file_os.reset(new std::ofstream(filename)); - if (file_os->good()) - init(file_os->rdbuf()); - else { - std::cerr << "ERROR: gltrace: Failed to open '" << filename - << "' for writing. Falling back to stderr." << std::endl; - init(std::cerr.rdbuf()); - } - } - *this << std::setfill('0'); // setw used in timeNow - } - - - Config::Config() : - logCalls(true), - checkErrors(true), - logTime(true), - log(getenv("GLTRACE_LOGFILE")) { - if (const char *v = getenv("GLTRACE_LOG_CALLS")) - logCalls = strncmp("1", v, 1) == 0; - if (const char *v = getenv("GLTRACE_CHECK_ERRORS")) - checkErrors = strncmp("1", v, 1) == 0; - if (const char *v = getenv("GLTRACE_LOG_TIME")) - logTime = strncmp("1", v, 1) == 0; - } - - // *The* config - Config config; - -} // namespace gltrace diff --git a/progs/tools/trace/gltrace_support.h b/progs/tools/trace/gltrace_support.h deleted file mode 100644 index de28669a98..0000000000 --- a/progs/tools/trace/gltrace_support.h +++ /dev/null @@ -1,65 +0,0 @@ -// -*- c++ -*- (emacs c++ mode) -/* - * Copyright (C) 2006 Thomas Sondergaard All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ -#ifndef GLTRACE_SUPPORT_H -#define GLTRACE_SUPPORT_H - -#include -#include -#include - -namespace gltrace { - - const int MAX_STACKFRAMES = 100; - - /// Returns the stack trace of the current thread - std::string getStackTrace(int count = MAX_STACKFRAMES, int first = 0); - - std::ostream &timeNow(std::ostream &os); - - struct logstream : public std::ostream { - - /// Opens a logstream - if filename is null, stderr will be used - logstream(const char *filename = 0); - - private: - std::auto_ptr file_os; - }; - - struct Config { - bool logCalls; - bool checkErrors; - bool logTime; - logstream log; - - Config(); - }; - - extern Config config; - -} // namespace gltrace - -#define GLTRACE_LOG(x) \ - { if (config.logTime) config.log << timeNow << ": "; config.log << x << "\n"; } - -#endif // GLTRACE_SUPPORT_H - - diff --git a/progs/trivial/.gitignore b/progs/trivial/.gitignore deleted file mode 100644 index 1c49fdd55f..0000000000 --- a/progs/trivial/.gitignore +++ /dev/null @@ -1,65 +0,0 @@ -clear -dlist-dangling -dlist-edgeflag -dlist-edgeflag-dangling -drawarrays -drawelements -drawrange -line -line-clip -line-cull -line-userclip -line-userclip-clip -line-userclip-nop -line-userclip-nop-clip -lineloop -lineloop-clip -point -point-clip -point-param -point-wide -poly -poly-flat -poly-unfilled -quad -quad-clip -quad-clip-all-vertices -quad-clip-nearplane -quad-degenerate -quad-flat -quad-offset-factor -quad-offset-unfilled -quad-offset-units -quad-tex-2d -quad-tex-3d -quad-tex-pbo -quad-unfilled -quads -quadstrip -quadstrip-flat -readtex.c -readtex.h -tri -tri-blend -tri-clip -tri-cull -tri-dlist -tri-edgeflag -tri-flat -tri-flat-clip -tri-tex-3d -tri-unfilled -tri-unfilled-clip -tri-unfilled-smooth -tri-unfilled-userclip -tri-userclip -tristrip -tristrip-clip -vbo-drawarrays -vbo-drawelements -vbo-drawrange -vp-array -vp-clip -vp-line-clip -vp-tri -vp-unfilled diff --git a/progs/trivial/Makefile b/progs/trivial/Makefile deleted file mode 100644 index 36a5548488..0000000000 --- a/progs/trivial/Makefile +++ /dev/null @@ -1,145 +0,0 @@ -# progs/tests/Makefile - - -# These programs aren't intended to be included with the normal distro. -# They're not too interesting but they're good for testing. - -TOP = ../.. -include $(TOP)/configs/current - - -LIBS = -L$(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) $(APP_LIB_DEPS) - -SOURCES = \ - clear.c \ - line-clip.c \ - line-cull.c \ - line-userclip-clip.c \ - line-userclip-nop-clip.c \ - line-userclip-nop.c \ - line-userclip.c \ - line.c \ - lineloop-clip.c \ - lineloop.c \ - point.c \ - point-clip.c \ - point-param.c \ - point-wide.c \ - poly-flat.c \ - poly-unfilled.c \ - poly.c \ - quad-clip.c \ - quad-clip-all-vertices.c \ - quad-clip-nearplane.c \ - quad-degenerate.c \ - quad-flat.c \ - quad-offset-factor.c \ - quad-offset-units.c \ - quad-offset-unfilled.c \ - quad-unfilled.c \ - quad-tex-2d.c \ - quad-tex-pbo.c \ - quad-tex-3d.c \ - quad.c \ - quads.c \ - quadstrip.c \ - quadstrip-flat.c \ - dlist-edgeflag.c \ - dlist-dangling.c \ - dlist-edgeflag-dangling.c \ - dlist-degenerate.c \ - drawrange.c \ - drawelements.c \ - drawarrays.c \ - tri-blend.c \ - tri-tex-3d.c \ - tri-clip.c \ - tri-cull.c \ - tri-edgeflag.c \ - tri-flat-clip.c \ - tri-flat.c \ - tri-unfilled-clip.c \ - tri-unfilled-smooth.c \ - tri-unfilled-userclip.c \ - tri-unfilled.c \ - tri-userclip.c \ - tri-dlist.c \ - tri.c \ - tristrip-clip.c \ - tristrip.c \ - vbo-drawrange.c \ - vbo-drawelements.c \ - vbo-drawarrays.c \ - vp-clip.c \ - vp-tri.c \ - vp-line-clip.c \ - vp-unfilled.c \ - vp-array.c - -PROGS = $(SOURCES:%.c=%) - -INCLUDES = -I. -I$(TOP)/include -I../samples - -UTIL_FILES = readtex.h readtex.c - - -##### RULES ##### - -.SUFFIXES: -.SUFFIXES: .c - -.c: - $(CC) $(INCLUDES) $(CFLAGS) $(LDFLAGS) $< $(LIBS) -o $@ - -.c.o: - $(CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) $< -o $@ - -.S.o: - $(CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) $< -o $@ - - -##### TARGETS ##### - -default: $(UTIL_FILES) $(PROGS) - -clean: - -rm -f $(PROGS) - -rm -f *.o - -rm -f getproclist.h - - -# auto code generation -getprocaddress: getprocaddress.c getproclist.h - -getproclist.h: $(TOP)/src/mesa/glapi/gl_API.xml getprocaddress.c getprocaddress.py - python getprocaddress.py > getproclist.h - - -texrect: texrect.o readtex.o - $(CC) $(CFLAGS) $(LDFLAGS) texrect.o readtex.o $(LIBS) -o $@ - -texrect.o: texrect.c readtex.h - $(CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) $< -o $@ - -invert: invert.o readtex.o - $(CC) $(CFLAGS) $(LDFLAGS) invert.o readtex.o $(LIBS) -o $@ - -invert.o: invert.c readtex.h - $(CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) $< -o $@ - -readtex.o: readtex.c - $(CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) $< -o $@ - - -readtex.h: $(TOP)/progs/util/readtex.h - ln -s $(TOP)/progs/util/readtex.h . - -readtex.c: $(TOP)/progs/util/readtex.c - ln -s $(TOP)/progs/util/readtex.c . - - - - -# Emacs tags -tags: - etags `find . -name \*.[ch]` `find ../include` diff --git a/progs/trivial/clear.c b/progs/trivial/clear.c deleted file mode 100644 index 7e7ca588c3..0000000000 --- a/progs/trivial/clear.c +++ /dev/null @@ -1,126 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the name of - * Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF - * ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include -#include -#include -#include - - -#define CI_OFFSET_1 16 -#define CI_OFFSET_2 32 - - -GLenum doubleBuffer; - -static void Init(void) -{ - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - - glClearColor(0.0, 0.0, 1.0, 0.0); -} - -static void Reshape(int width, int height) -{ - - glViewport(0, 0, (GLint)width, (GLint)height); - - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0); - glMatrixMode(GL_MODELVIEW); -} - -static void Key(unsigned char key, int x, int y) -{ - - switch (key) { - case 27: - exit(1); - default: - return; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - glFlush(); - - if (doubleBuffer) { - glutSwapBuffers(); - } -} - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - doubleBuffer = GL_FALSE; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow("First Tri") == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/dlist-dangling.c b/progs/trivial/dlist-dangling.c deleted file mode 100644 index 97f878e96b..0000000000 --- a/progs/trivial/dlist-dangling.c +++ /dev/null @@ -1,149 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the name of - * Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF - * ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include -#include -#include -#include - - -#define CI_OFFSET_1 16 -#define CI_OFFSET_2 32 - - -GLenum doubleBuffer; -GLint list; - -static void Init(void) -{ - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - - glClearColor(0.0, 0.0, 1.0, 0.0); - - - list = glGenLists(1); - glNewList(list, GL_COMPILE); - glBegin(GL_TRIANGLES); - glVertex3f( 0.9, -0.9, -30.0); - glVertex3f( 0.9, 0.9, -30.0); - glColor3f(.8,0,0); - glVertex3f(-0.9, 0.0, -30.0); - glEnd(); - glEndList(); -} - -static void Reshape(int width, int height) -{ - - glViewport(0, 0, (GLint)width, (GLint)height); - - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0); - glMatrixMode(GL_MODELVIEW); -} - -static void Key(unsigned char key, int x, int y) -{ - - switch (key) { - case 27: - exit(1); - default: - return; - } - - glutPostRedisplay(); -} - - - - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - - glColor3f(0,.9,0); - glCallList(list); - - glRotatef(45,0,0,1); - glColor3f(1,0,1); - glCallList(list); - - glFlush(); - - if (doubleBuffer) { - glutSwapBuffers(); - } -} - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - doubleBuffer = GL_FALSE; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow("First Tri") == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/dlist-degenerate.c b/progs/trivial/dlist-degenerate.c deleted file mode 100644 index c7f2d2a6e9..0000000000 --- a/progs/trivial/dlist-degenerate.c +++ /dev/null @@ -1,153 +0,0 @@ -/** - * Test display list corner cases. - */ - - -#include -#include -#include -#include - - -static int Win; -static GLfloat Xrot = 0, Yrot = 0, Zrot = 0; -static GLboolean Anim = GL_FALSE; -static GLuint List1 = 0, List2 = 0; - - -static void -Idle(void) -{ - Xrot += 3.0; - Yrot += 4.0; - Zrot += 2.0; - glutPostRedisplay(); -} - - -static void -Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); - - glPushMatrix(); - glRotatef(Xrot, 1, 0, 0); - glRotatef(Yrot, 0, 1, 0); - glRotatef(Zrot, 0, 0, 1); - - glCallList(List1); - glCallList(List2); - - glPopMatrix(); - - glutSwapBuffers(); -} - - -static void -Reshape(int width, int height) -{ - glViewport(0, 0, width, height); - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glFrustum(-1.0, 1.0, -1.0, 1.0, 5.0, 25.0); - glMatrixMode(GL_MODELVIEW); - glLoadIdentity(); - glTranslatef(0.0, 0.0, -15.0); -} - - -static void -Key(unsigned char key, int x, int y) -{ - const GLfloat step = 3.0; - (void) x; - (void) y; - switch (key) { - case 'a': - Anim = !Anim; - if (Anim) - glutIdleFunc(Idle); - else - glutIdleFunc(NULL); - break; - case 'z': - Zrot -= step; - break; - case 'Z': - Zrot += step; - break; - case 27: - glutDestroyWindow(Win); - exit(0); - break; - } - glutPostRedisplay(); -} - - -static void -SpecialKey(int key, int x, int y) -{ - const GLfloat step = 3.0; - (void) x; - (void) y; - switch (key) { - case GLUT_KEY_UP: - Xrot -= step; - break; - case GLUT_KEY_DOWN: - Xrot += step; - break; - case GLUT_KEY_LEFT: - Yrot -= step; - break; - case GLUT_KEY_RIGHT: - Yrot += step; - break; - } - glutPostRedisplay(); -} - - -static void -Init(void) -{ - /* List1: start of primitive */ - List1 = glGenLists(1); - glNewList(List1, GL_COMPILE); - glBegin(GL_POLYGON); - glVertex2f(-1, -1); - glVertex2f( 1, -1); - glEndList(); - - /* List2: end of primitive */ - List2 = glGenLists(1); - glNewList(List2, GL_COMPILE); - glVertex2f( 1, 1); - glVertex2f(-1, 1); - glEnd(); - glEndList(); - - glEnable(GL_DEPTH_TEST); -} - - -int -main(int argc, char *argv[]) -{ - glutInit(&argc, argv); - glutInitWindowPosition(0, 0); - glutInitWindowSize(400, 400); - glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH); - Win = glutCreateWindow(argv[0]); - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutSpecialFunc(SpecialKey); - glutDisplayFunc(Draw); - if (Anim) - glutIdleFunc(Idle); - Init(); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/dlist-edgeflag-dangling.c b/progs/trivial/dlist-edgeflag-dangling.c deleted file mode 100644 index 47d29bdade..0000000000 --- a/progs/trivial/dlist-edgeflag-dangling.c +++ /dev/null @@ -1,154 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the name of - * Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF - * ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include -#include -#include -#include - - -#define CI_OFFSET_1 16 -#define CI_OFFSET_2 32 - - -GLenum doubleBuffer; -GLint list; - -static void Init(void) -{ - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - - glClearColor(0.0, 0.0, 1.0, 0.0); - - glPolygonMode(GL_FRONT, GL_LINE); - glPolygonMode(GL_BACK, GL_POINT); - - list = glGenLists(1); - glNewList(list, GL_COMPILE); - glBegin(GL_TRIANGLES); - glVertex3f( 0.9, -0.9, -30.0); - glEdgeFlag(1); - glVertex3f( 0.9, 0.9, -30.0); - glVertex3f(-0.9, 0.0, -30.0); - glEnd(); - glEndList(); -} - -static void Reshape(int width, int height) -{ - - glViewport(0, 0, (GLint)width, (GLint)height); - - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0); - glMatrixMode(GL_MODELVIEW); -} - -static void Key(unsigned char key, int x, int y) -{ - - switch (key) { - case 27: - exit(1); - default: - return; - } - - glutPostRedisplay(); -} - - - - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - - glPushMatrix(); - glColor3f(0,.9,0); - glEdgeFlag(0); - glCallList(list); - - glRotatef(45,0,0,1); - glColor3f(1,0,1); - glCallList(list); - glPopMatrix(); - - glFlush(); - - if (doubleBuffer) { - glutSwapBuffers(); - } -} - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - doubleBuffer = GL_FALSE; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow("First Tri") == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/dlist-edgeflag.c b/progs/trivial/dlist-edgeflag.c deleted file mode 100644 index b58e7eb435..0000000000 --- a/progs/trivial/dlist-edgeflag.c +++ /dev/null @@ -1,158 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the name of - * Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF - * ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include -#include -#include -#include - - -#define CI_OFFSET_1 16 -#define CI_OFFSET_2 32 - - -GLenum doubleBuffer; -GLint list; - -static void Init(void) -{ - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - - glClearColor(0.0, 0.0, 1.0, 0.0); - - glPolygonMode(GL_FRONT, GL_LINE); - glPolygonMode(GL_BACK, GL_POINT); - - list = glGenLists(1); - glNewList(list, GL_COMPILE); - glBegin(GL_TRIANGLES); - glEdgeFlag(1); -/* glColor3f(0,0,.7); */ - glVertex3f( 0.9, -0.9, -30.0); - glEdgeFlag(0); -/* glColor3f(.8,0,0); */ - glVertex3f( 0.9, 0.9, -30.0); - glEdgeFlag(1); -/* glColor3f(0,.9,0); */ - glVertex3f(-0.9, 0.0, -30.0); - glEnd(); - glEndList(); -} - -static void Reshape(int width, int height) -{ - - glViewport(0, 0, (GLint)width, (GLint)height); - - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0); - glMatrixMode(GL_MODELVIEW); -} - -static void Key(unsigned char key, int x, int y) -{ - - switch (key) { - case 27: - exit(1); - default: - return; - } - - glutPostRedisplay(); -} - - - - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - - glPushMatrix(); - glColor3f(0,.9,0); - glCallList(list); - - glRotatef(45,0,0,1); - glColor3f(1,0,1); - glCallList(list); - glPopMatrix(); - - glFlush(); - - if (doubleBuffer) { - glutSwapBuffers(); - } -} - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - doubleBuffer = GL_FALSE; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow("First Tri") == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/drawarrays.c b/progs/trivial/drawarrays.c deleted file mode 100644 index 596eee9eef..0000000000 --- a/progs/trivial/drawarrays.c +++ /dev/null @@ -1,127 +0,0 @@ -/* Basic VBO */ - -#include -#include -#include -#include -#include -#define GL_GLEXT_PROTOTYPES -#include - - -struct { - GLfloat pos[3]; - GLubyte color[4]; -} verts[] = -{ - { { 0.9, -0.9, 0.0 }, - { 0x00, 0x00, 0xff, 0x00 } - }, - - { { 0.9, 0.9, 0.0 }, - { 0x00, 0xff, 0x00, 0x00 } - }, - - { { -0.9, 0.9, 0.0 }, - { 0xff, 0x00, 0x00, 0x00 } - }, - - { { -0.9, -0.9, 0.0 }, - { 0xff, 0xff, 0xff, 0x00 } - }, -}; - -static void Init( void ) -{ - GLint errno; - GLuint prognum; - - static const char *prog1 = - "!!ARBvp1.0\n" - "MOV result.color, vertex.color;\n" - "MOV result.position, vertex.position;\n" - "END\n"; - - glGenProgramsARB(1, &prognum); - glBindProgramARB(GL_VERTEX_PROGRAM_ARB, prognum); - glProgramStringARB(GL_VERTEX_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, - strlen(prog1), (const GLubyte *) prog1); - - assert(glIsProgramARB(prognum)); - errno = glGetError(); - printf("glGetError = %d\n", errno); - if (errno != GL_NO_ERROR) - { - GLint errorpos; - - glGetIntegerv(GL_PROGRAM_ERROR_POSITION_ARB, &errorpos); - printf("errorpos: %d\n", errorpos); - printf("%s\n", (char *)glGetString(GL_PROGRAM_ERROR_STRING_ARB)); - } - - - glEnableClientState( GL_VERTEX_ARRAY ); - glEnableClientState( GL_COLOR_ARRAY ); - - glVertexPointer( 3, GL_FLOAT, sizeof(verts[0]), verts[0].pos ); - glColorPointer( 4, GL_UNSIGNED_BYTE, sizeof(verts[0]), verts[0].color ); - -} - - - -static void Display( void ) -{ - glClearColor(0.3, 0.3, 0.3, 1); - glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); - - glEnable(GL_VERTEX_PROGRAM_ARB); - -// glDrawArrays( GL_TRIANGLES, 0, 3 ); - glDrawArrays( GL_TRIANGLES, 1, 3 ); - - glFlush(); -} - - -static void Reshape( int width, int height ) -{ - glViewport( 0, 0, width, height ); - glMatrixMode( GL_PROJECTION ); - glLoadIdentity(); - glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0); - glMatrixMode( GL_MODELVIEW ); - glLoadIdentity(); - /*glTranslatef( 0.0, 0.0, -15.0 );*/ -} - - -static void Key( unsigned char key, int x, int y ) -{ - (void) x; - (void) y; - switch (key) { - case 27: - exit(0); - break; - } - glutPostRedisplay(); -} - - - - -int main( int argc, char *argv[] ) -{ - glutInit( &argc, argv ); - glutInitWindowPosition( 0, 0 ); - glutInitWindowSize( 250, 250 ); - glutInitDisplayMode( GLUT_RGB | GLUT_SINGLE | GLUT_DEPTH ); - glutCreateWindow(argv[0]); - glutReshapeFunc( Reshape ); - glutKeyboardFunc( Key ); - glutDisplayFunc( Display ); - Init(); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/drawelements.c b/progs/trivial/drawelements.c deleted file mode 100644 index e0c8e80b68..0000000000 --- a/progs/trivial/drawelements.c +++ /dev/null @@ -1,120 +0,0 @@ -/* Test rebasing */ - -#include -#include -#include -#include -#include -#define GL_GLEXT_PROTOTYPES -#include - -GLfloat verts[][4] = { - { 0.9, -0.9, 0.0, 1.0 }, - { 0.9, 0.9, 0.0, 1.0 }, - { -0.9, 0.9, 0.0, 1.0 }, - { -0.9, -0.9, 0.0, 1.0 }, -}; - -GLubyte color[][4] = { - { 0x00, 0x00, 0xff, 0x00 }, - { 0x00, 0xff, 0x00, 0x00 }, - { 0xff, 0x00, 0x00, 0x00 }, - { 0xff, 0xff, 0xff, 0x00 }, -}; - -GLuint indices[] = { 1, 2, 3 }; - -static void Init( void ) -{ - GLint errno; - GLuint prognum; - - static const char *prog1 = - "!!ARBvp1.0\n" - "MOV result.color, vertex.color;\n" - "MOV result.position, vertex.position;\n" - "END\n"; - - glGenProgramsARB(1, &prognum); - glBindProgramARB(GL_VERTEX_PROGRAM_ARB, prognum); - glProgramStringARB(GL_VERTEX_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, - strlen(prog1), (const GLubyte *) prog1); - - assert(glIsProgramARB(prognum)); - errno = glGetError(); - printf("glGetError = %d\n", errno); - if (errno != GL_NO_ERROR) - { - GLint errorpos; - - glGetIntegerv(GL_PROGRAM_ERROR_POSITION_ARB, &errorpos); - printf("errorpos: %d\n", errorpos); - printf("%s\n", (char *)glGetString(GL_PROGRAM_ERROR_STRING_ARB)); - } - - - glEnableClientState( GL_VERTEX_ARRAY ); - glEnableClientState( GL_COLOR_ARRAY ); - glVertexPointer( 3, GL_FLOAT, sizeof(verts[0]), verts ); - glColorPointer( 4, GL_UNSIGNED_BYTE, 0, color ); - -} - - - -static void Display( void ) -{ - glClearColor(0.3, 0.3, 0.3, 1); - glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); - - glEnable(GL_VERTEX_PROGRAM_NV); - - /* Should have min_index == 1, maybe force a rebase: - */ - glDrawElements( GL_TRIANGLES, 3, GL_UNSIGNED_INT, indices ); - - glFlush(); -} - - -static void Reshape( int width, int height ) -{ - glViewport( 0, 0, width, height ); - glMatrixMode( GL_PROJECTION ); - glLoadIdentity(); - glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0); - glMatrixMode( GL_MODELVIEW ); - glLoadIdentity(); - /*glTranslatef( 0.0, 0.0, -15.0 );*/ -} - - -static void Key( unsigned char key, int x, int y ) -{ - (void) x; - (void) y; - switch (key) { - case 27: - exit(0); - break; - } - glutPostRedisplay(); -} - - - - -int main( int argc, char *argv[] ) -{ - glutInit( &argc, argv ); - glutInitWindowPosition( 0, 0 ); - glutInitWindowSize( 250, 250 ); - glutInitDisplayMode( GLUT_RGB | GLUT_SINGLE | GLUT_DEPTH ); - glutCreateWindow(argv[0]); - glutReshapeFunc( Reshape ); - glutKeyboardFunc( Key ); - glutDisplayFunc( Display ); - Init(); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/drawrange.c b/progs/trivial/drawrange.c deleted file mode 100644 index 9c787cbfcd..0000000000 --- a/progs/trivial/drawrange.c +++ /dev/null @@ -1,118 +0,0 @@ -/* Test rebasing */ - -#include -#include -#include -#include -#include -#define GL_GLEXT_PROTOTYPES -#include - -GLfloat verts[][4] = { - { 0.9, -0.9, 0.0, 1.0 }, - { 0.9, 0.9, 0.0, 1.0 }, - { -0.9, 0.9, 0.0, 1.0 }, - { -0.9, -0.9, 0.0, 1.0 }, -}; - -GLubyte color[][4] = { - { 0x00, 0x00, 0xff, 0x00 }, - { 0x00, 0xff, 0x00, 0x00 }, - { 0xff, 0x00, 0x00, 0x00 }, - { 0xff, 0xff, 0xff, 0x00 }, -}; - -GLuint indices[] = { 1, 2, 3 }; - -static void Init( void ) -{ - GLint errno; - GLuint prognum; - - static const char *prog1 = - "!!ARBvp1.0\n" - "MOV result.color, vertex.color;\n" - "MOV result.position, vertex.position;\n" - "END\n"; - - glGenProgramsARB(1, &prognum); - glBindProgramARB(GL_VERTEX_PROGRAM_ARB, prognum); - glProgramStringARB(GL_VERTEX_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, - strlen(prog1), (const GLubyte *) prog1); - - assert(glIsProgramARB(prognum)); - errno = glGetError(); - printf("glGetError = %d\n", errno); - if (errno != GL_NO_ERROR) - { - GLint errorpos; - - glGetIntegerv(GL_PROGRAM_ERROR_POSITION_ARB, &errorpos); - printf("errorpos: %d\n", errorpos); - printf("%s\n", (char *)glGetString(GL_PROGRAM_ERROR_STRING_ARB)); - } - - - glEnableClientState( GL_VERTEX_ARRAY ); - glEnableClientState( GL_COLOR_ARRAY ); - glVertexPointer( 3, GL_FLOAT, sizeof(verts[0]), verts ); - glColorPointer( 4, GL_UNSIGNED_BYTE, 0, color ); - -} - - - -static void Display( void ) -{ - glClearColor(0.3, 0.3, 0.3, 1); - glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); - - glEnable(GL_VERTEX_PROGRAM_NV); - - glDrawRangeElements( GL_TRIANGLES, 1, 3, 3, GL_UNSIGNED_INT, indices ); - - glFlush(); -} - - -static void Reshape( int width, int height ) -{ - glViewport( 0, 0, width, height ); - glMatrixMode( GL_PROJECTION ); - glLoadIdentity(); - glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0); - glMatrixMode( GL_MODELVIEW ); - glLoadIdentity(); - /*glTranslatef( 0.0, 0.0, -15.0 );*/ -} - - -static void Key( unsigned char key, int x, int y ) -{ - (void) x; - (void) y; - switch (key) { - case 27: - exit(0); - break; - } - glutPostRedisplay(); -} - - - - -int main( int argc, char *argv[] ) -{ - glutInit( &argc, argv ); - glutInitWindowPosition( 0, 0 ); - glutInitWindowSize( 250, 250 ); - glutInitDisplayMode( GLUT_RGB | GLUT_SINGLE | GLUT_DEPTH ); - glutCreateWindow(argv[0]); - glutReshapeFunc( Reshape ); - glutKeyboardFunc( Key ); - glutDisplayFunc( Display ); - Init(); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/line-clip.c b/progs/trivial/line-clip.c deleted file mode 100644 index 9acd12acc7..0000000000 --- a/progs/trivial/line-clip.c +++ /dev/null @@ -1,140 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the name of - * Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF - * ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include -#include -#include -#include - - -#define CI_OFFSET_1 16 -#define CI_OFFSET_2 32 - - -GLenum doubleBuffer; - -static void Init(void) -{ - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - - glClearColor(0.0, 0.0, 1.0, 0.0); -} - -static void Reshape(int width, int height) -{ - - glViewport(0, 0, (GLint)width, (GLint)height); - - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0); - glMatrixMode(GL_MODELVIEW); -} - -static void Key(unsigned char key, int x, int y) -{ - - switch (key) { - case 27: - exit(1); - default: - return; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - - glBegin(GL_LINE_STRIP); - glColor3f(0,0,.7); - glVertex3f( 0.9, -0.9, -30.0); - glColor3f(.8,0,0); - glVertex3f( 0.9, 0.9, -30.0); - glColor3f(0,.9,0); - glVertex3f(-1.9, 0.0, -30.0); - /* Repeat - no loop support yet: - */ - glColor3f(0,0,.7); - glVertex3f( 0.9, -0.9, -30.0); - glEnd(); - - glFlush(); - - if (doubleBuffer) { - glutSwapBuffers(); - } -} - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - doubleBuffer = GL_FALSE; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow("First Tri") == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/line-cull.c b/progs/trivial/line-cull.c deleted file mode 100644 index 8999a8f0b1..0000000000 --- a/progs/trivial/line-cull.c +++ /dev/null @@ -1,136 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the name of - * Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF - * ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include -#include -#include -#include - - -#define CI_OFFSET_1 16 -#define CI_OFFSET_2 32 - - -GLenum doubleBuffer; - -static void Init(void) -{ - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - - glClearColor(0.0, 0.0, 1.0, 0.0); -} - -static void Reshape(int width, int height) -{ - - glViewport(0, 0, (GLint)width, (GLint)height); - - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0); - glMatrixMode(GL_MODELVIEW); -} - -static void Key(unsigned char key, int x, int y) -{ - - switch (key) { - case 27: - exit(1); - default: - return; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - - glBegin(GL_LINE_STRIP); - glColor3f(0,0,1); - glVertex3f( -1.5, 0.5, -30.0); - glColor3f(1,0,0); - glVertex3f( 0, 2.0, -30.0); - glColor3f(0,1,0); - glVertex3f(-1.5, 2.0, -30.0); - glEnd(); - - glFlush(); - - if (doubleBuffer) { - glutSwapBuffers(); - } -} - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - doubleBuffer = GL_FALSE; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow("First Tri") == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/line-userclip-clip.c b/progs/trivial/line-userclip-clip.c deleted file mode 100644 index b24d8452bc..0000000000 --- a/progs/trivial/line-userclip-clip.c +++ /dev/null @@ -1,142 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the name of - * Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF - * ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include -#include -#include -#include - - -#define CI_OFFSET_1 16 -#define CI_OFFSET_2 32 - - -GLenum doubleBuffer; - -static void Init(void) -{ - static GLdouble plane[4] = { -.5, 0, 1, 0 }; - - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - - glClearColor(0.0, 0.0, 1.0, 0.0); - glClipPlane(GL_CLIP_PLANE0, plane); - glEnable(GL_CLIP_PLANE0); -} - -static void Reshape(int width, int height) -{ - - glViewport(0, 0, (GLint)width, (GLint)height); - - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); -/* glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0); */ - glMatrixMode(GL_MODELVIEW); -} - -static void Key(unsigned char key, int x, int y) -{ - - switch (key) { - case 27: - exit(1); - default: - return; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - - glBegin(GL_LINE_STRIP); - glColor3f(0,0,.7); - glVertex3f( 0.9, -0.9, 0.0); - glColor3f(.8,0,0); - glVertex3f( 0.9, 0.9, 0.0); - glColor3f(0,.9,0); - glVertex3f(-1.9, 0.0, 0.0); - glColor3f(0,0,.7); - glVertex3f( 0.9, -0.9, 0.0); - glEnd(); - - glFlush(); - - if (doubleBuffer) { - glutSwapBuffers(); - } -} - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - doubleBuffer = GL_FALSE; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow("First Tri") == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/line-userclip-nop-clip.c b/progs/trivial/line-userclip-nop-clip.c deleted file mode 100644 index e2e0b85a52..0000000000 --- a/progs/trivial/line-userclip-nop-clip.c +++ /dev/null @@ -1,142 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the name of - * Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF - * ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include -#include -#include -#include - - -#define CI_OFFSET_1 16 -#define CI_OFFSET_2 32 - - -GLenum doubleBuffer; - -static void Init(void) -{ - static GLdouble plane[4] = { 0, 0, 1, 0 }; - - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - - glClearColor(0.0, 0.0, 1.0, 0.0); - glClipPlane(GL_CLIP_PLANE0, plane); - glEnable(GL_CLIP_PLANE0); -} - -static void Reshape(int width, int height) -{ - - glViewport(0, 0, (GLint)width, (GLint)height); - - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); -/* glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0); */ - glMatrixMode(GL_MODELVIEW); -} - -static void Key(unsigned char key, int x, int y) -{ - - switch (key) { - case 27: - exit(1); - default: - return; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - - glBegin(GL_LINE_STRIP); - glColor3f(0,0,.7); - glVertex3f( 0.9, -0.9, 0.0); - glColor3f(.8,0,0); - glVertex3f( 0.9, 0.9, 0.0); - glColor3f(0,.9,0); - glVertex3f(-1.9, 0.0, 0.0); - glColor3f(0,0,.7); - glVertex3f( 0.9, -0.9, 0.0); - glEnd(); - - glFlush(); - - if (doubleBuffer) { - glutSwapBuffers(); - } -} - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - doubleBuffer = GL_FALSE; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow("First Tri") == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/line-userclip-nop.c b/progs/trivial/line-userclip-nop.c deleted file mode 100644 index eacee06978..0000000000 --- a/progs/trivial/line-userclip-nop.c +++ /dev/null @@ -1,142 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the name of - * Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF - * ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include -#include -#include -#include - - -#define CI_OFFSET_1 16 -#define CI_OFFSET_2 32 - - -GLenum doubleBuffer; - -static void Init(void) -{ - static GLdouble plane[4] = { 0, 0, 1, 0 }; - - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - - glClearColor(0.0, 0.0, 1.0, 0.0); - glClipPlane(GL_CLIP_PLANE0, plane); - glEnable(GL_CLIP_PLANE0); -} - -static void Reshape(int width, int height) -{ - - glViewport(0, 0, (GLint)width, (GLint)height); - - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); -/* glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0); */ - glMatrixMode(GL_MODELVIEW); -} - -static void Key(unsigned char key, int x, int y) -{ - - switch (key) { - case 27: - exit(1); - default: - return; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - - glBegin(GL_LINE_STRIP); - glColor3f(0,0,.7); - glVertex3f( 0.9, -0.9, 0.0); - glColor3f(.8,0,0); - glVertex3f( 0.9, 0.9, 0.0); - glColor3f(0,.9,0); - glVertex3f(-0.9, 0.0, 0.0); - glColor3f(0,0,.7); - glVertex3f( 0.9, -0.9, 0.0); - glEnd(); - - glFlush(); - - if (doubleBuffer) { - glutSwapBuffers(); - } -} - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - doubleBuffer = GL_FALSE; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow("First Tri") == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/line-userclip.c b/progs/trivial/line-userclip.c deleted file mode 100644 index 6af91431d0..0000000000 --- a/progs/trivial/line-userclip.c +++ /dev/null @@ -1,142 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the name of - * Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF - * ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include -#include -#include -#include - - -#define CI_OFFSET_1 16 -#define CI_OFFSET_2 32 - - -GLenum doubleBuffer; - -static void Init(void) -{ - static GLdouble plane[4] = { -.5, 0, 1, 0 }; - - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - - glClearColor(0.0, 0.0, 1.0, 0.0); - glClipPlane(GL_CLIP_PLANE0, plane); - glEnable(GL_CLIP_PLANE0); -} - -static void Reshape(int width, int height) -{ - - glViewport(0, 0, (GLint)width, (GLint)height); - - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); -/* glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0); */ - glMatrixMode(GL_MODELVIEW); -} - -static void Key(unsigned char key, int x, int y) -{ - - switch (key) { - case 27: - exit(1); - default: - return; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - - glBegin(GL_LINE_STRIP); - glColor3f(0,0,.7); - glVertex3f( 0.9, -0.9, 0.0); - glColor3f(.8,0,0); - glVertex3f( 0.9, 0.9, 0.0); - glColor3f(0,.9,0); - glVertex3f(-0.9, 0.0, 0.0); - glColor3f(0,0,.7); - glVertex3f( 0.9, -0.9, 0.0); - glEnd(); - - glFlush(); - - if (doubleBuffer) { - glutSwapBuffers(); - } -} - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - doubleBuffer = GL_FALSE; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow("First Tri") == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/line.c b/progs/trivial/line.c deleted file mode 100644 index 58bad91b05..0000000000 --- a/progs/trivial/line.c +++ /dev/null @@ -1,140 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the name of - * Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF - * ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include -#include -#include -#include - - -#define CI_OFFSET_1 16 -#define CI_OFFSET_2 32 - - -GLenum doubleBuffer; - -static void Init(void) -{ - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - - glClearColor(0.0, 0.0, 1.0, 0.0); -} - -static void Reshape(int width, int height) -{ - - glViewport(0, 0, (GLint)width, (GLint)height); - - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0); - glMatrixMode(GL_MODELVIEW); -} - -static void Key(unsigned char key, int x, int y) -{ - - switch (key) { - case 27: - exit(1); - default: - return; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - - glBegin(GL_LINE_STRIP); - glColor3f(0,0,.7); - glVertex3f( 0.9, -0.9, -30.0); - glColor3f(.8,0,0); - glVertex3f( 0.9, 0.9, -30.0); - glColor3f(0,.9,0); - glVertex3f(-0.9, 0.0, -30.0); - /* Repeat the first vertex - don't have lineloop support in GS yet - */ - glColor3f(0,0,.7); - glVertex3f( 0.9, -0.9, -30.0); - glEnd(); - - glFlush(); - - if (doubleBuffer) { - glutSwapBuffers(); - } -} - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - doubleBuffer = GL_FALSE; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow("First Tri") == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/lineloop-clip.c b/progs/trivial/lineloop-clip.c deleted file mode 100644 index d8645ee347..0000000000 --- a/progs/trivial/lineloop-clip.c +++ /dev/null @@ -1,136 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the name of - * Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF - * ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include -#include -#include -#include - - -#define CI_OFFSET_1 16 -#define CI_OFFSET_2 32 - - -GLenum doubleBuffer; - -static void Init(void) -{ - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - - glClearColor(0.0, 0.0, 1.0, 0.0); -} - -static void Reshape(int width, int height) -{ - - glViewport(0, 0, (GLint)width, (GLint)height); - - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0); - glMatrixMode(GL_MODELVIEW); -} - -static void Key(unsigned char key, int x, int y) -{ - - switch (key) { - case 27: - exit(1); - default: - return; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - - glBegin(GL_LINE_LOOP); - glColor3f(0,0,.7); - glVertex3f( 0.9, -0.9, -30.0); - glColor3f(.8,0,0); - glVertex3f( 0.9, 0.9, -30.0); - glColor3f(0,.9,0); - glVertex3f(-1.9, 0.0, -30.0); - glEnd(); - - glFlush(); - - if (doubleBuffer) { - glutSwapBuffers(); - } -} - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - doubleBuffer = GL_FALSE; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow("First Tri") == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/lineloop.c b/progs/trivial/lineloop.c deleted file mode 100644 index 7500c54fc2..0000000000 --- a/progs/trivial/lineloop.c +++ /dev/null @@ -1,136 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the name of - * Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF - * ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include -#include -#include -#include - - -#define CI_OFFSET_1 16 -#define CI_OFFSET_2 32 - - -GLenum doubleBuffer; - -static void Init(void) -{ - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - - glClearColor(0.0, 0.0, 1.0, 0.0); -} - -static void Reshape(int width, int height) -{ - - glViewport(0, 0, (GLint)width, (GLint)height); - - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0); - glMatrixMode(GL_MODELVIEW); -} - -static void Key(unsigned char key, int x, int y) -{ - - switch (key) { - case 27: - exit(1); - default: - return; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - - glBegin(GL_LINE_LOOP); - glColor3f(0,0,.7); - glVertex3f( 0.9, -0.9, -30.0); - glColor3f(.8,0,0); - glVertex3f( 0.9, 0.9, -30.0); - glColor3f(0,.9,0); - glVertex3f(-0.9, 0.0, -30.0); - glEnd(); - - glFlush(); - - if (doubleBuffer) { - glutSwapBuffers(); - } -} - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - doubleBuffer = GL_FALSE; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow("First Tri") == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/point-clip.c b/progs/trivial/point-clip.c deleted file mode 100644 index 32792047c6..0000000000 --- a/progs/trivial/point-clip.c +++ /dev/null @@ -1,138 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the name of - * Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF - * ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include -#include -#include -#include - - -#define CI_OFFSET_1 16 -#define CI_OFFSET_2 32 - - -GLenum doubleBuffer; - -static void Init(void) -{ - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - - glClearColor(0.0, 0.0, 1.0, 0.0); -} - -static void Reshape(int width, int height) -{ - - glViewport(0, 0, (GLint)width, (GLint)height); - - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0); - glMatrixMode(GL_MODELVIEW); -} - -static void Key(unsigned char key, int x, int y) -{ - - switch (key) { - case 27: - exit(1); - default: - return; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - - glBegin(GL_POINTS); - glColor3f(1,0,0); - glVertex3f( 0.9, -0.9, -30.0); - glColor3f(1,1,0); - glVertex3f( 0.9, 0.9, -30.0); - glColor3f(1,0,1); - glVertex3f(-1.9, 0.9, -30.0); - glColor3f(0,1,1); - glVertex3f(-0.9, -0.9, -30.0); - glEnd(); - - glFlush(); - - if (doubleBuffer) { - glutSwapBuffers(); - } -} - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - doubleBuffer = GL_FALSE; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow("First Tri") == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/point-param.c b/progs/trivial/point-param.c deleted file mode 100644 index 02500cd34e..0000000000 --- a/progs/trivial/point-param.c +++ /dev/null @@ -1,156 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the name of - * Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF - * ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#define GL_GLEXT_PROTOTYPES -#include -#include -#include -#include -#include - - - -GLenum doubleBuffer; - -static void Init(void) -{ - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - - glClearColor(0.0, 0.0, 1.0, 0.0); -} - -static void Reshape(int width, int height) -{ - glViewport(0, 0, (GLint)width, (GLint)height); - - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glOrtho(-1.0, 1.0, -1.0, 1.0, 0, 100.0); - glMatrixMode(GL_MODELVIEW); -} - -static void Key(unsigned char key, int x, int y) -{ - switch (key) { - case 27: - exit(1); - default: - return; - } - glutPostRedisplay(); -} - - -static float -expected(float z, float size, const float atten[3]) -{ - float dist = fabs(z); - const GLfloat q = atten[0] + dist * (atten[1] + dist * atten[2]); - const GLfloat a = sqrt(1.0 / q); - return size * a; -} - - -static void Draw(void) -{ - static GLfloat atten[3] = { 0.0, 0.1, .01 }; - float size = 40.0; - int i; - - glClear(GL_COLOR_BUFFER_BIT); - - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glPointSize(size); - glPointParameterfvARB(GL_POINT_DISTANCE_ATTENUATION_ARB, atten); - - glColor3f(1,0,0); - - printf("Expected point sizes:\n"); - glBegin(GL_POINTS); - for (i = 0; i < 5; i++) { - float x = -0.8 + i * 0.4; - float z = -i * 20 - 10; - glVertex3f( x, 0.0, z); - printf(" %f\n", expected(z, size, atten)); - } - glEnd(); - - glFlush(); - - if (doubleBuffer) { - glutSwapBuffers(); - } -} - - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - doubleBuffer = GL_FALSE; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow(argv[0]) == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/point-wide.c b/progs/trivial/point-wide.c deleted file mode 100644 index 473ca043f1..0000000000 --- a/progs/trivial/point-wide.c +++ /dev/null @@ -1,140 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the name of - * Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF - * ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include -#include -#include -#include - - -#define CI_OFFSET_1 16 -#define CI_OFFSET_2 32 - - -GLenum doubleBuffer; - -static void Init(void) -{ - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - - glClearColor(0.0, 0.0, 1.0, 0.0); -} - -static void Reshape(int width, int height) -{ - - glViewport(0, 0, (GLint)width, (GLint)height); - - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0); - glMatrixMode(GL_MODELVIEW); -} - -static void Key(unsigned char key, int x, int y) -{ - - switch (key) { - case 27: - exit(1); - default: - return; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - - glPointSize(8.0); - - glBegin(GL_POINTS); - glColor3f(1,0,0); - glVertex3f( 0.9, -0.9, -30.0); - glColor3f(1,1,0); - glVertex3f( 0.9, 0.9, -30.0); - glColor3f(1,0,1); - glVertex3f(-0.9, 0.9, -30.0); - glColor3f(0,1,1); - glVertex3f(-0.9, -0.9, -30.0); - glEnd(); - - glFlush(); - - if (doubleBuffer) { - glutSwapBuffers(); - } -} - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - doubleBuffer = GL_FALSE; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow("First Tri") == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/point.c b/progs/trivial/point.c deleted file mode 100644 index 87465bfb2c..0000000000 --- a/progs/trivial/point.c +++ /dev/null @@ -1,138 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the name of - * Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF - * ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include -#include -#include -#include - - -#define CI_OFFSET_1 16 -#define CI_OFFSET_2 32 - - -GLenum doubleBuffer; - -static void Init(void) -{ - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - - glClearColor(0.0, 0.0, 1.0, 0.0); -} - -static void Reshape(int width, int height) -{ - - glViewport(0, 0, (GLint)width, (GLint)height); - - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0); - glMatrixMode(GL_MODELVIEW); -} - -static void Key(unsigned char key, int x, int y) -{ - - switch (key) { - case 27: - exit(1); - default: - return; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - - glBegin(GL_POINTS); - glColor3f(1,0,0); - glVertex3f( 0.9, -0.9, -30.0); - glColor3f(1,1,0); - glVertex3f( 0.9, 0.9, -30.0); - glColor3f(1,0,1); - glVertex3f(-0.9, 0.9, -30.0); - glColor3f(0,1,1); - glVertex3f(-0.9, -0.9, -30.0); - glEnd(); - - glFlush(); - - if (doubleBuffer) { - glutSwapBuffers(); - } -} - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - doubleBuffer = GL_FALSE; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow("First Tri") == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/poly-flat.c b/progs/trivial/poly-flat.c deleted file mode 100644 index 747b24dc0c..0000000000 --- a/progs/trivial/poly-flat.c +++ /dev/null @@ -1,140 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the name of - * Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF - * ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include -#include -#include -#include - - -#define CI_OFFSET_1 16 -#define CI_OFFSET_2 32 - - -GLenum doubleBuffer; - -static void Init(void) -{ - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - - glClearColor(0.0, 0.0, 1.0, 0.0); -} - -static void Reshape(int width, int height) -{ - - glViewport(0, 0, (GLint)width, (GLint)height); - - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0); - glMatrixMode(GL_MODELVIEW); -} - -static void Key(unsigned char key, int x, int y) -{ - - switch (key) { - case 27: - exit(1); - default: - return; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - glShadeModel(GL_FLAT); - - - glBegin(GL_POLYGON); - glColor3f(1,0,0); - glVertex3f( 0.9, -0.9, -30.0); - glColor3f(1,1,0); - glVertex3f( 0.9, 0.9, -30.0); - glColor3f(1,0,1); - glVertex3f(-0.9, 0.9, -30.0); - glColor3f(0,1,1); - glVertex3f(-0.9, -0.9, -30.0); - glEnd(); - - glFlush(); - - if (doubleBuffer) { - glutSwapBuffers(); - } -} - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - doubleBuffer = GL_FALSE; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow("First Tri") == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/poly-unfilled.c b/progs/trivial/poly-unfilled.c deleted file mode 100644 index e0ae463b08..0000000000 --- a/progs/trivial/poly-unfilled.c +++ /dev/null @@ -1,139 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the name of - * Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF - * ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include -#include -#include -#include - - -#define CI_OFFSET_1 16 -#define CI_OFFSET_2 32 - - -GLenum doubleBuffer; - -static void Init(void) -{ - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - - glClearColor(0.0, 0.0, 1.0, 0.0); -} - -static void Reshape(int width, int height) -{ - - glViewport(0, 0, (GLint)width, (GLint)height); - - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0); - glMatrixMode(GL_MODELVIEW); -} - -static void Key(unsigned char key, int x, int y) -{ - - switch (key) { - case 27: - exit(1); - default: - return; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); - - glBegin(GL_POLYGON); - glColor3f(1,0,0); - glVertex3f( 0.9, -0.9, -30.0); - glColor3f(1,1,0); - glVertex3f( 0.9, 0.9, -30.0); - glColor3f(1,0,1); - glVertex3f(-0.9, 0.9, -30.0); - glColor3f(0,1,1); - glVertex3f(-0.9, -0.9, -30.0); - glEnd(); - - glFlush(); - - if (doubleBuffer) { - glutSwapBuffers(); - } -} - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - doubleBuffer = GL_FALSE; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow("First Tri") == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/poly.c b/progs/trivial/poly.c deleted file mode 100644 index bdb9e27aa9..0000000000 --- a/progs/trivial/poly.c +++ /dev/null @@ -1,138 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the name of - * Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF - * ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include -#include -#include -#include - - -#define CI_OFFSET_1 16 -#define CI_OFFSET_2 32 - - -GLenum doubleBuffer; - -static void Init(void) -{ - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - - glClearColor(0.0, 0.0, 1.0, 0.0); -} - -static void Reshape(int width, int height) -{ - - glViewport(0, 0, (GLint)width, (GLint)height); - - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0); - glMatrixMode(GL_MODELVIEW); -} - -static void Key(unsigned char key, int x, int y) -{ - - switch (key) { - case 27: - exit(1); - default: - return; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - - glBegin(GL_POLYGON); - glColor3f(1,0,0); - glVertex3f( 0.9, -0.9, -30.0); - glColor3f(1,1,0); - glVertex3f( 0.9, 0.9, -30.0); - glColor3f(1,0,1); - glVertex3f(-0.9, 0.9, -30.0); - glColor3f(0,1,1); - glVertex3f(-0.9, -0.9, -30.0); - glEnd(); - - glFlush(); - - if (doubleBuffer) { - glutSwapBuffers(); - } -} - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - doubleBuffer = GL_FALSE; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow("First Tri") == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/quad-clip-all-vertices.c b/progs/trivial/quad-clip-all-vertices.c deleted file mode 100644 index 019ef0c479..0000000000 --- a/progs/trivial/quad-clip-all-vertices.c +++ /dev/null @@ -1,138 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the name of - * Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF - * ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include -#include -#include -#include - - -#define CI_OFFSET_1 16 -#define CI_OFFSET_2 32 - - -GLenum doubleBuffer; - -static void Init(void) -{ - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - - glClearColor(0.0, 0.0, 1.0, 0.0); -} - -static void Reshape(int width, int height) -{ - - glViewport(0, 0, (GLint)width, (GLint)height); - - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0); - glMatrixMode(GL_MODELVIEW); -} - -static void Key(unsigned char key, int x, int y) -{ - - switch (key) { - case 27: - exit(1); - default: - return; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - - glBegin(GL_QUADS); - glColor3f(1,0,0); - glVertex3f( 1.9, -1.9, -30.0); - glColor3f(1,1,0); - glVertex3f( 1.9, 1.9, -30.0); - glColor3f(1,0,1); - glVertex3f(-1.9, 1.9, -30.0); - glColor3f(0,1,1); - glVertex3f(-1.9, -1.9, -30.0); - glEnd(); - - glFlush(); - - if (doubleBuffer) { - glutSwapBuffers(); - } -} - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - doubleBuffer = GL_FALSE; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow("First Tri") == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/quad-clip-nearplane.c b/progs/trivial/quad-clip-nearplane.c deleted file mode 100644 index be9b9c619a..0000000000 --- a/progs/trivial/quad-clip-nearplane.c +++ /dev/null @@ -1,151 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the name of - * Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF - * ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include -#include -#include -#include - - -#define CI_OFFSET_1 16 -#define CI_OFFSET_2 32 - - -GLenum doubleBuffer; -float Z = -6; - -static void Init(void) -{ - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - - fprintf(stderr, "Press z/Z to translate quad\n"); - - glClearColor(0.0, 0.0, 1.0, 0.0); -} - -static void Reshape(int width, int height) -{ - glViewport(0, 0, (GLint)width, (GLint)height); - - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glFrustum(-1.0, 1.0, -1.0, 1.0, 5, 100.0); - glMatrixMode(GL_MODELVIEW); -} - -static void Key(unsigned char key, int x, int y) -{ - switch (key) { - case 'z': - Z += 0.5; - break; - case 'Z': - Z -= 0.5; - break; - case 27: - exit(1); - default: - return; - } - printf("Z = %f\n", Z); - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - - glPushMatrix(); - glTranslatef(0, -0.5, Z); - - glBegin(GL_QUADS); - glColor3f(1,0,0); - glVertex3f( -0.8, 0, -4.0); - glColor3f(1,1,0); - glVertex3f( 0.8, 0, -4.0); - glColor3f(1,0,1); - glVertex3f( 0.8, 0, 4.0); - glColor3f(0,1,1); - glVertex3f( -0.8, 0, 4.0); - glEnd(); - - glPopMatrix(); - - glFlush(); - - if (doubleBuffer) { - glutSwapBuffers(); - } -} - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - doubleBuffer = GL_FALSE; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(0, 0); - glutInitWindowSize( 250, 250); - - type = GLUT_RGB; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow("First Tri") == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/quad-clip.c b/progs/trivial/quad-clip.c deleted file mode 100644 index 9f3a45caec..0000000000 --- a/progs/trivial/quad-clip.c +++ /dev/null @@ -1,138 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the name of - * Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF - * ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include -#include -#include -#include - - -#define CI_OFFSET_1 16 -#define CI_OFFSET_2 32 - - -GLenum doubleBuffer; - -static void Init(void) -{ - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - - glClearColor(0.0, 0.0, 1.0, 0.0); -} - -static void Reshape(int width, int height) -{ - - glViewport(0, 0, (GLint)width, (GLint)height); - - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0); - glMatrixMode(GL_MODELVIEW); -} - -static void Key(unsigned char key, int x, int y) -{ - - switch (key) { - case 27: - exit(1); - default: - return; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - - glBegin(GL_QUADS); - glColor3f(1,0,0); - glVertex3f( 0.9, -0.9, -30.0); - glColor3f(1,1,0); - glVertex3f( 0.9, 0.9, -30.0); - glColor3f(1,0,1); - glVertex3f(-1.9, 0.9, -30.0); - glColor3f(0,1,1); - glVertex3f(-0.9, -0.9, -30.0); - glEnd(); - - glFlush(); - - if (doubleBuffer) { - glutSwapBuffers(); - } -} - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - doubleBuffer = GL_FALSE; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow("First Tri") == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/quad-degenerate.c b/progs/trivial/quad-degenerate.c deleted file mode 100644 index b14b0f1d87..0000000000 --- a/progs/trivial/quad-degenerate.c +++ /dev/null @@ -1,143 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the name of - * Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF - * ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include -#include -#include -#include - - -#define CI_OFFSET_1 16 -#define CI_OFFSET_2 32 - - -GLenum doubleBuffer; - -static void Init(void) -{ - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - - glClearColor(0.0, 0.0, 1.0, 0.0); -} - -static void Reshape(int width, int height) -{ - - glViewport(0, 0, (GLint)width, (GLint)height); - - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0); - glMatrixMode(GL_MODELVIEW); -} - -static void Key(unsigned char key, int x, int y) -{ - - switch (key) { - case 27: - exit(1); - default: - return; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - - glBegin(GL_QUADS); - glColor3f(1,0,0); - glVertex3f( 0.9, -0.9, -30.0); - glColor3f(1,1,0); - glVertex3f( 0.9, 0.9, -30.0); - glColor3f(1,0,1); - glVertex3f(-0.9, 0.9, -30.0); - glColor3f(0,1,1); - glVertex3f(-0.9, -0.9, -30.0); - glColor3f(1,0,0); - glVertex3f( 0.9, -0.9, -30.0); - glColor3f(1,1,0); - glVertex3f( 0.9, 0.9, -30.0); - glColor3f(1,0,1); - glEnd(); - - glFlush(); - - if (doubleBuffer) { - glutSwapBuffers(); - } -} - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - doubleBuffer = GL_FALSE; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow("First Tri") == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/quad-flat.c b/progs/trivial/quad-flat.c deleted file mode 100644 index d6e9f02120..0000000000 --- a/progs/trivial/quad-flat.c +++ /dev/null @@ -1,148 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the name of - * Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF - * ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include -#include -#include -#include - - -#define CI_OFFSET_1 16 -#define CI_OFFSET_2 32 - - -GLenum doubleBuffer; - -static void Init(void) -{ - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - - glClearColor(0.0, 0.0, 1.0, 0.0); -} - -static void Reshape(int width, int height) -{ - - glViewport(0, 0, (GLint)width, (GLint)height); - - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0); - glMatrixMode(GL_MODELVIEW); -} - -static void Key(unsigned char key, int x, int y) -{ - - switch (key) { - case 27: - exit(1); - default: - return; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - glShadeModel(GL_FLAT); - - if (1) { - glBegin(GL_LINES); - glColor3f(1,0,0); - glVertex3f( 0.95, -0.9, -30.0); - glColor3f(1,1,0); - glVertex3f( 0.95, 0.9, -30.0); - glEnd(); - } - - glBegin(GL_QUADS); - glColor3f(1,0,0); - glVertex3f( 0.9, -0.9, -30.0); - glColor3f(1,1,0); - glVertex3f( 0.9, 0.9, -30.0); - glColor3f(1,0,1); - glVertex3f(-0.9, 0.9, -30.0); - glColor3f(0,1,1); - glVertex3f(-0.9, -0.9, -30.0); - glEnd(); - - glFlush(); - - if (doubleBuffer) { - glutSwapBuffers(); - } -} - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - doubleBuffer = GL_FALSE; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow("First Tri") == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/quad-offset-factor.c b/progs/trivial/quad-offset-factor.c deleted file mode 100644 index 861d3461c0..0000000000 --- a/progs/trivial/quad-offset-factor.c +++ /dev/null @@ -1,167 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the name of - * Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF - * ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include -#include -#include -#include - - -#define CI_OFFSET_1 16 -#define CI_OFFSET_2 32 - - -GLenum doubleBuffer; - -static void Init(void) -{ - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - - glClearColor(1.0, 1.0, 1.0, 0.0); -} - -static void Reshape(int width, int height) -{ - - glViewport(0, 0, (GLint)width, (GLint)height); - - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0); - glMatrixMode(GL_MODELVIEW); -} - -static void Key(unsigned char key, int x, int y) -{ - - switch (key) { - case 27: - exit(1); - default: - return; - } - - glutPostRedisplay(); -} - -static void quad( float half ) -{ - glBegin(GL_QUADS); - glVertex3f( half/9.0, -half/9.0, -25.0 + half); - glVertex3f( half/9.0, half/9.0, -25.0 + half); - glVertex3f(-half/9.0, half/9.0, -25.0 - half); - glVertex3f(-half/9.0, -half/9.0, -25.0 - half); - glEnd(); - -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); - glEnable(GL_DEPTH_TEST); - - - - glEnable(GL_POLYGON_OFFSET_FILL); - glPolygonOffset(1, 0); - - glColor3f(1,0,0); - quad(9); - - glDisable(GL_POLYGON_OFFSET_FILL); - glColor3f(0,1,0); - quad(6); - - - glEnable(GL_POLYGON_OFFSET_FILL); - glPolygonOffset(0, 0); - - /* Black - should not be visible - */ - glColor3f(0,0,0); - quad(6); - - glEnable(GL_POLYGON_OFFSET_FILL); - glPolygonOffset(-1, 0); - glColor3f(0,0,1); - quad(3); - - glDisable(GL_POLYGON_OFFSET_FILL); - - glFlush(); - - if (doubleBuffer) { - glutSwapBuffers(); - } -} - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - doubleBuffer = GL_FALSE; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB | GLUT_DEPTH; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow("First Tri") == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/quad-offset-unfilled.c b/progs/trivial/quad-offset-unfilled.c deleted file mode 100644 index 1cecf3c1ce..0000000000 --- a/progs/trivial/quad-offset-unfilled.c +++ /dev/null @@ -1,167 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the name of - * Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF - * ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include -#include -#include -#include - - -#define CI_OFFSET_1 16 -#define CI_OFFSET_2 32 - - -GLenum doubleBuffer; - -static void Init(void) -{ - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - - glClearColor(1.0, 1.0, 1.0, 0.0); -} - -static void Reshape(int width, int height) -{ - - glViewport(0, 0, (GLint)width, (GLint)height); - - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0); - glMatrixMode(GL_MODELVIEW); -} - -static void Key(unsigned char key, int x, int y) -{ - - switch (key) { - case 27: - exit(1); - default: - return; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); - glEnable(GL_DEPTH_TEST); - - - - glEnable(GL_POLYGON_OFFSET_FILL); - glPolygonOffset(1, 0); - - glBegin(GL_QUADS); - glColor3f(1,0,0); - glVertex3f( 0.9, -0.9, -10.0); - glVertex3f( 0.9, 0.9, -10.0); - glVertex3f(-0.9, 0.9, -40.0); - glVertex3f(-0.9, -0.9, -40.0); - glEnd(); - - glDisable(GL_POLYGON_OFFSET_FILL); - - glBegin(GL_QUADS); - glColor3f(0,1,0); - glVertex3f( 0.6, -0.6, -15.0); - glVertex3f( 0.6, 0.6, -15.0); - glVertex3f(-0.6, 0.6, -35.0); - glVertex3f(-0.6, -0.6, -35.0); - glEnd(); - - glEnable(GL_POLYGON_OFFSET_FILL); - glPolygonOffset(-1, 0); - - glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); - - glBegin(GL_QUADS); - glColor3f(0,0,1); - glVertex3f( 0.3, -0.3, -20.0); - glVertex3f( 0.3, 0.3, -20.0); - glVertex3f(-0.3, 0.3, -30.0); - glVertex3f(-0.3, -0.3, -30.0); - glEnd(); - - - glDisable(GL_POLYGON_OFFSET_FILL); - - glFlush(); - - if (doubleBuffer) { - glutSwapBuffers(); - } -} - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - doubleBuffer = GL_FALSE; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB | GLUT_DEPTH; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow("First Tri") == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/quad-offset-units.c b/progs/trivial/quad-offset-units.c deleted file mode 100644 index 5c41be308e..0000000000 --- a/progs/trivial/quad-offset-units.c +++ /dev/null @@ -1,166 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the name of - * Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF - * ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include -#include -#include -#include - - -#define CI_OFFSET_1 16 -#define CI_OFFSET_2 32 - - -GLenum doubleBuffer; - -static void Init(void) -{ - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - - glClearColor(1.0, 1.0, 1.0, 0.0); -} - -static void Reshape(int width, int height) -{ - - glViewport(0, 0, (GLint)width, (GLint)height); - - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glOrtho(-1.2, 1.2, -1.2, 1.2, -0.5, 1000.0); - glMatrixMode(GL_MODELVIEW); -} - -static void Key(unsigned char key, int x, int y) -{ - - switch (key) { - case 27: - exit(1); - default: - return; - } - - glutPostRedisplay(); -} - -static void quad( float half ) -{ - glBegin(GL_QUADS); - glVertex3f( half/9.0, -half/9.0, -25.0 + half); - glVertex3f( half/9.0, half/9.0, -25.0 + half); - glVertex3f(-half/9.0, half/9.0, -25.0 - half); - glVertex3f(-half/9.0, -half/9.0, -25.0 - half); - glEnd(); - -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); - glEnable(GL_DEPTH_TEST); - - - - glEnable(GL_POLYGON_OFFSET_FILL); - glPolygonOffset(0, 4); - - glColor3f(1,0,0); - quad(9); - - glDisable(GL_POLYGON_OFFSET_FILL); - glColor3f(0,0,0); - quad(6); - - glEnable(GL_POLYGON_OFFSET_FILL); - glPolygonOffset(0, 0); - - glDepthFunc( GL_EQUAL ); - glColor3f(0,1,0); - quad(6); - glDepthFunc( GL_LESS ); - - - glPolygonOffset(0, -4); - glColor3f(0,0,1); - quad(3); - - glDisable(GL_POLYGON_OFFSET_FILL); - - glFlush(); - - if (doubleBuffer) { - glutSwapBuffers(); - } -} - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - doubleBuffer = GL_FALSE; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB | GLUT_DEPTH; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow("First Tri") == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/quad-tex-2d.c b/progs/trivial/quad-tex-2d.c deleted file mode 100644 index 70b9fbf8c6..0000000000 --- a/progs/trivial/quad-tex-2d.c +++ /dev/null @@ -1,169 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the name of - * Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF - * ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include -#include -#include -#include - - -#define CI_OFFSET_1 16 -#define CI_OFFSET_2 32 - -GLenum doubleBuffer; - -static void Init(void) -{ - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - - glClearColor(0.0, 0.0, 1.0, 0.0); - -#define SIZE 16 - { - GLubyte tex2d[SIZE][SIZE][3]; - GLint s, t; - - for (s = 0; s < SIZE; s++) { - for (t = 0; t < SIZE; t++) { -#if 0 - tex2d[t][s][0] = (s < SIZE/2) ? 0 : 255; - tex2d[t][s][1] = (t < SIZE/2) ? 0 : 255; - tex2d[t][s][2] = 0; -#else - tex2d[t][s][0] = s*255/(SIZE-1); - tex2d[t][s][1] = t*255/(SIZE-1); - tex2d[t][s][2] = 0; -#endif - } - } - - glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_R, GL_REPEAT); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - - glPixelStorei(GL_UNPACK_ALIGNMENT, 1); - glTexImage2D(GL_TEXTURE_2D, 0, 3, SIZE, SIZE, 0, - GL_RGB, GL_UNSIGNED_BYTE, tex2d); - glPixelStorei(GL_UNPACK_ALIGNMENT, 4); - glEnable(GL_TEXTURE_2D); - } - -} - -static void Reshape(int width, int height) -{ - - glViewport(0, 0, (GLint)width, (GLint)height); - - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0); - glMatrixMode(GL_MODELVIEW); -} - -static void Key(unsigned char key, int x, int y) -{ - - switch (key) { - case 27: - exit(1); - default: - return; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - - glBegin(GL_QUADS); - glTexCoord2f(1,0); - glVertex3f( 0.9, -0.9, -30.0); - glTexCoord2f(1,1); - glVertex3f( 0.9, 0.9, -30.0); - glTexCoord2f(0,1); - glVertex3f(-0.9, 0.9, -30.0); - glTexCoord2f(0,0); - glVertex3f(-0.9, -0.9, -30.0); - glEnd(); - - glFlush(); - - if (doubleBuffer) { - glutSwapBuffers(); - } -} - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - doubleBuffer = GL_FALSE; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow("First Tri") == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/quad-tex-3d.c b/progs/trivial/quad-tex-3d.c deleted file mode 100644 index 0b2dcc08a5..0000000000 --- a/progs/trivial/quad-tex-3d.c +++ /dev/null @@ -1,177 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the name of - * Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF - * ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include -#include -#include -#include - - -#define CI_OFFSET_1 16 -#define CI_OFFSET_2 32 - -GLfloat z= 0; -GLenum doubleBuffer; - -static void Init(void) -{ - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - - glClearColor(0.0, 0.0, 1.0, 0.0); - -#define SIZE 16 - { - GLubyte tex3d[SIZE][SIZE][SIZE][3]; - GLint r, s, t; - - for (s = 0; s < SIZE; s++) { - for (t = 0; t < SIZE; t++) { - for (r = 0; r < SIZE; r++) { -#if 0 - tex3d[r][t][s][0] = (s < SIZE/2) ? 0 : 255; - tex3d[r][t][s][1] = (t < SIZE/2) ? 0 : 255; - tex3d[r][t][s][2] = (r < SIZE/2) ? 0 : 255; -#else - tex3d[r][t][s][0] = s*255/(SIZE-1); - tex3d[r][t][s][1] = t*255/(SIZE-1); - tex3d[r][t][s][2] = r*255/(SIZE-1); -#endif - } - } - } - - glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); - glTexParameterf(GL_TEXTURE_3D, GL_TEXTURE_WRAP_R, GL_REPEAT); - glTexParameterf(GL_TEXTURE_3D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - glTexParameterf(GL_TEXTURE_3D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - - glPixelStorei(GL_UNPACK_ALIGNMENT, 1); - glTexImage3D(GL_TEXTURE_3D, 0, 3, SIZE, SIZE, SIZE, 0, - GL_RGB, GL_UNSIGNED_BYTE, tex3d); - glPixelStorei(GL_UNPACK_ALIGNMENT, 4); - glEnable(GL_TEXTURE_3D); - } - -} - -static void Reshape(int width, int height) -{ - - glViewport(0, 0, (GLint)width, (GLint)height); - - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0); - glMatrixMode(GL_MODELVIEW); -} - -static void Key(unsigned char key, int x, int y) -{ - - switch (key) { - case ' ': - z += 1.0/SIZE; - break; - case 27: - exit(1); - default: - return; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - - fprintf(stderr, "z: %f\n", z); - - glBegin(GL_QUADS); - glTexCoord3f(1,0,z); - glVertex3f( 0.9, -0.9, -30.0); - glTexCoord3f(1,1,z); - glVertex3f( 0.9, 0.9, -30.0); - glTexCoord3f(0,1,z); - glVertex3f(-0.9, 0.9, -30.0); - glTexCoord3f(0,0,z); - glVertex3f(-0.9, -0.9, -30.0); - glEnd(); - - glFlush(); - - if (doubleBuffer) { - glutSwapBuffers(); - } -} - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - doubleBuffer = GL_FALSE; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow("First Tri") == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/quad-tex-pbo.c b/progs/trivial/quad-tex-pbo.c deleted file mode 100644 index 5b63c698a7..0000000000 --- a/progs/trivial/quad-tex-pbo.c +++ /dev/null @@ -1,181 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the name of - * Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF - * ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#define GL_GLEXT_PROTOTYPES - -#include -#include -#include -#include - - -#define CI_OFFSET_1 16 -#define CI_OFFSET_2 32 - -GLenum doubleBuffer; - -static GLuint DrawPBO; - -static void Init(void) -{ - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - - glClearColor(0.0, 0.0, 1.0, 0.0); - -#define SIZE 16 - { - GLubyte tex2d[SIZE][SIZE][4]; - GLint s, t; - - for (s = 0; s < SIZE; s++) { - for (t = 0; t < SIZE; t++) { - /* bgra: - */ - tex2d[t][s][0] = 0x30; - tex2d[t][s][1] = t*255/(SIZE-1); - tex2d[t][s][2] = s*255/(SIZE-1); - tex2d[t][s][3] = 0xff; - } - } - - - /* put image into DrawPBO */ - glGenBuffersARB(1, &DrawPBO); - glBindBufferARB(GL_PIXEL_PACK_BUFFER_EXT, DrawPBO); - glBufferDataARB(GL_PIXEL_PACK_BUFFER_EXT, - SIZE * SIZE * 4, tex2d, GL_STATIC_DRAW); - glBindBufferARB(GL_PIXEL_PACK_BUFFER_EXT, 0); - - - glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_R, GL_REPEAT); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - - glPixelStorei(GL_UNPACK_ALIGNMENT, 1); - glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_EXT, DrawPBO); - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, SIZE, SIZE, 0, - GL_BGRA, GL_UNSIGNED_BYTE, NULL); - glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_EXT, 0); - glPixelStorei(GL_UNPACK_ALIGNMENT, 4); - glEnable(GL_TEXTURE_2D); - } - -} - -static void Reshape(int width, int height) -{ - - glViewport(0, 0, (GLint)width, (GLint)height); - - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0); - glMatrixMode(GL_MODELVIEW); -} - -static void Key(unsigned char key, int x, int y) -{ - - switch (key) { - case 27: - exit(1); - default: - return; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - - glBegin(GL_QUADS); - glTexCoord2f(1,0); - glVertex3f( 0.9, -0.9, -30.0); - glTexCoord2f(1,1); - glVertex3f( 0.9, 0.9, -30.0); - glTexCoord2f(0,1); - glVertex3f(-0.9, 0.9, -30.0); - glTexCoord2f(0,0); - glVertex3f(-0.9, -0.9, -30.0); - glEnd(); - - glFlush(); - - if (doubleBuffer) { - glutSwapBuffers(); - } -} - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - doubleBuffer = GL_FALSE; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow("First Tri") == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/quad-unfilled.c b/progs/trivial/quad-unfilled.c deleted file mode 100644 index 9d63d2dfb9..0000000000 --- a/progs/trivial/quad-unfilled.c +++ /dev/null @@ -1,139 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the name of - * Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF - * ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include -#include -#include -#include - - -#define CI_OFFSET_1 16 -#define CI_OFFSET_2 32 - - -GLenum doubleBuffer; - -static void Init(void) -{ - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - - glClearColor(0.0, 0.0, 1.0, 0.0); -} - -static void Reshape(int width, int height) -{ - - glViewport(0, 0, (GLint)width, (GLint)height); - - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0); - glMatrixMode(GL_MODELVIEW); -} - -static void Key(unsigned char key, int x, int y) -{ - - switch (key) { - case 27: - exit(1); - default: - return; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); - - glBegin(GL_QUADS); - glColor3f(1,0,0); - glVertex3f( 0.9, -0.9, -30.0); - glColor3f(1,1,0); - glVertex3f( 0.9, 0.9, -30.0); - glColor3f(1,0,1); - glVertex3f(-0.9, 0.9, -30.0); - glColor3f(0,1,1); - glVertex3f(-0.9, -0.9, -30.0); - glEnd(); - - glFlush(); - - if (doubleBuffer) { - glutSwapBuffers(); - } -} - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - doubleBuffer = GL_FALSE; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow("First Tri") == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/quad.c b/progs/trivial/quad.c deleted file mode 100644 index 85424b7b38..0000000000 --- a/progs/trivial/quad.c +++ /dev/null @@ -1,138 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the name of - * Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF - * ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include -#include -#include -#include - - -#define CI_OFFSET_1 16 -#define CI_OFFSET_2 32 - - -GLenum doubleBuffer; - -static void Init(void) -{ - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - - glClearColor(0.0, 0.0, 1.0, 0.0); -} - -static void Reshape(int width, int height) -{ - - glViewport(0, 0, (GLint)width, (GLint)height); - - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0); - glMatrixMode(GL_MODELVIEW); -} - -static void Key(unsigned char key, int x, int y) -{ - - switch (key) { - case 27: - exit(1); - default: - return; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - - glBegin(GL_QUADS); - glColor3f(1,0,0); - glVertex3f( 0.9, -0.9, -30.0); - glColor3f(1,1,0); - glVertex3f( 0.9, 0.9, -30.0); - glColor3f(1,0,1); - glVertex3f(-0.9, 0.9, -30.0); - glColor3f(0,1,1); - glVertex3f(-0.9, -0.9, -30.0); - glEnd(); - - glFlush(); - - if (doubleBuffer) { - glutSwapBuffers(); - } -} - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - doubleBuffer = GL_FALSE; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow("First Tri") == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/quads.c b/progs/trivial/quads.c deleted file mode 100644 index 1ca82cd9f8..0000000000 --- a/progs/trivial/quads.c +++ /dev/null @@ -1,156 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the name of - * Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF - * ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include -#include -#include -#include - - -#define CI_OFFSET_1 16 -#define CI_OFFSET_2 32 - - -GLenum doubleBuffer; - -static void Init(void) -{ - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - - glClearColor(0.0, 0.0, 1.0, 0.0); -} - -static void Reshape(int width, int height) -{ - - glViewport(0, 0, (GLint)width, (GLint)height); - - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0); - glMatrixMode(GL_MODELVIEW); -} - -static void Key(unsigned char key, int x, int y) -{ - - switch (key) { - case 27: - exit(1); - default: - return; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - - glBegin(GL_QUADS); - glColor3f(1,0,0); - glVertex3f( 0.9, -0.9, -30.0); - glColor3f(1,1,0); - glVertex3f( 0.9, 0.9, -30.0); - - glColor3f(1,1,1); - glVertex3f( 0.1, 0.9, -30.0); - glColor3f(1,0,1); - glVertex3f( 0.1, -0.9, -30.0); - - if (0) { - glEnd(); - glFlush(); - glBegin(GL_QUADS); - } - - glColor3f(0,1,0); - glVertex3f(-0.1, -0.9, -30.0); - glColor3f(1,0,0); - glVertex3f(-0.1, 0.9, -30.0); - - - glColor3f(1,0,1); - glVertex3f(-0.9, 0.9, -30.0); - glColor3f(0,1,1); - glVertex3f(-0.9, -0.9, -30.0); - glEnd(); - - glFlush(); - - if (doubleBuffer) { - glutSwapBuffers(); - } -} - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - doubleBuffer = GL_FALSE; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow("First Tri") == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/quadstrip-flat.c b/progs/trivial/quadstrip-flat.c deleted file mode 100644 index 061a0e409e..0000000000 --- a/progs/trivial/quadstrip-flat.c +++ /dev/null @@ -1,150 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the name of - * Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF - * ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include -#include -#include -#include - - -#define CI_OFFSET_1 16 -#define CI_OFFSET_2 32 - - -GLenum doubleBuffer; - -static void Init(void) -{ - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - - glClearColor(0.0, 0.0, 1.0, 0.0); -} - -static void Reshape(int width, int height) -{ - - glViewport(0, 0, (GLint)width, (GLint)height); - - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0); - glMatrixMode(GL_MODELVIEW); -} - -static void Key(unsigned char key, int x, int y) -{ - - switch (key) { - case 27: - exit(1); - default: - return; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - glShadeModel(GL_FLAT); - - glBegin(GL_QUAD_STRIP); - glColor3f(1,0,0); - glVertex3f( 0.9, -0.9, -30.0); - glColor3f(1,1,0); - glVertex3f( 0.9, 0.9, -30.0); - - glColor3f(1,0,0); - glVertex3f( 0.1, -0.8, -30.0); - glColor3f(1,1,0); - glVertex3f( 0.1, 0.8, -30.0); - - glColor3f(0,1,1); - glVertex3f(-0.1, -0.9, -30.0); - glColor3f(1,0,1); - glVertex3f(-0.1, 0.9, -30.0); - - glColor3f(0,1,1); - glVertex3f(-0.9, -0.8, -30.0); - glColor3f(1,0,1); - glVertex3f(-0.9, 0.8, -30.0); - glEnd(); - - glFlush(); - - if (doubleBuffer) { - glutSwapBuffers(); - } -} - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - doubleBuffer = GL_FALSE; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow("First Tri") == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/quadstrip.c b/progs/trivial/quadstrip.c deleted file mode 100644 index 342463f1a2..0000000000 --- a/progs/trivial/quadstrip.c +++ /dev/null @@ -1,144 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the name of - * Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF - * ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include -#include -#include -#include - -GLenum doubleBuffer; - -static void Init(void) -{ - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - - glClearColor(0.0, 0.0, 1.0, 0.0); -} - -static void Reshape(int width, int height) -{ - - glViewport(0, 0, (GLint)width, (GLint)height); - - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0); - glMatrixMode(GL_MODELVIEW); -} - -static void Key(unsigned char key, int x, int y) -{ - - switch (key) { - case 27: - exit(1); - default: - return; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - - glBegin(GL_QUAD_STRIP); - glColor3f(1,0,0); - glVertex3f( 0.9, -0.9, -30.0); - glColor3f(1,1,0); - glVertex3f( 0.9, 0.9, -30.0); - - glColor3f(1,0,0); - glVertex3f( 0.1, -0.8, -30.0); - glColor3f(1,1,0); - glVertex3f( 0.1, 0.8, -30.0); - - glColor3f(0,1,1); - glVertex3f(-0.1, -0.9, -30.0); - glColor3f(1,0,1); - glVertex3f(-0.1, 0.9, -30.0); - - glColor3f(0,1,1); - glVertex3f(-0.9, -0.8, -30.0); - glColor3f(1,0,1); - glVertex3f(-0.9, 0.8, -30.0); - glEnd(); - - glFlush(); - - if (doubleBuffer) { - glutSwapBuffers(); - } -} - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - doubleBuffer = GL_FALSE; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow("First Tri") == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/tri-blend.c b/progs/trivial/tri-blend.c deleted file mode 100644 index 284d15fd3c..0000000000 --- a/progs/trivial/tri-blend.c +++ /dev/null @@ -1,144 +0,0 @@ -/* - * Copyright (c) 1993-1997, Silicon Graphics, Inc. - * ALL RIGHTS RESERVED - * Permission to use, copy, modify, and distribute this software for - * any purpose and without fee is hereby granted, provided that the above - * copyright notice appear in all copies and that both the copyright notice - * and this permission notice appear in supporting documentation, and that - * the name of Silicon Graphics, Inc. not be used in advertising - * or publicity pertaining to distribution of the software without specific, - * written prior permission. - * - * THE MATERIAL EMBODIED ON THIS SOFTWARE IS PROVIDED TO YOU "AS-IS" - * AND WITHOUT WARRANTY OF ANY KIND, EXPRESS, IMPLIED OR OTHERWISE, - * INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY OR - * FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON - * GRAPHICS, INC. BE LIABLE TO YOU OR ANYONE ELSE FOR ANY DIRECT, - * SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY - * KIND, OR ANY DAMAGES WHATSOEVER, INCLUDING WITHOUT LIMITATION, - * LOSS OF PROFIT, LOSS OF USE, SAVINGS OR REVENUE, OR THE CLAIMS OF - * THIRD PARTIES, WHETHER OR NOT SILICON GRAPHICS, INC. HAS BEEN - * ADVISED OF THE POSSIBILITY OF SUCH LOSS, HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE - * POSSESSION, USE OR PERFORMANCE OF THIS SOFTWARE. - * - * US Government Users Restricted Rights - * Use, duplication, or disclosure by the Government is subject to - * restrictions set forth in FAR 52.227.19(c)(2) or subparagraph - * (c)(1)(ii) of the Rights in Technical Data and Computer Software - * clause at DFARS 252.227-7013 and/or in similar or successor - * clauses in the FAR or the DOD or NASA FAR Supplement. - * Unpublished-- rights reserved under the copyright laws of the - * United States. Contractor/manufacturer is Silicon Graphics, - * Inc., 2011 N. Shoreline Blvd., Mountain View, CA 94039-7311. - * - * OpenGL(R) is a registered trademark of Silicon Graphics, Inc. - */ - -/* - * alpha.c - * This program draws several overlapping filled polygons - * to demonstrate the effect order has on alpha blending results. - * Use the 't' key to toggle the order of drawing polygons. - */ -#include -#include - -static int leftFirst = GL_TRUE; - -/* Initialize alpha blending function. - */ -static void init(void) -{ - glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glShadeModel (GL_FLAT); - glClearColor (1.0, 0.0, 0.0, 0.0); -} - -static void drawLeftTriangle(void) -{ - /* draw yellow triangle on LHS of screen */ - - glBegin (GL_TRIANGLES); - glColor4f(1.0, 1.0, 0.0, 0.75); - glVertex3f(0.1, 0.9, 0.0); - glVertex3f(0.1, 0.1, 0.0); - glVertex3f(0.7, 0.5, 0.0); - glEnd(); -} - -static void drawRightTriangle(void) -{ - /* draw cyan triangle on RHS of screen */ - - glEnable (GL_BLEND); - glBegin (GL_TRIANGLES); - glColor4f(0.0, 1.0, 1.0, 0.75); - glVertex3f(0.9, 0.9, 0.0); - glVertex3f(0.3, 0.5, 0.0); - glVertex3f(0.9, 0.1, 0.0); - glEnd(); - glDisable (GL_BLEND); -} - -void display(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - - if (leftFirst) { - drawLeftTriangle(); - drawRightTriangle(); - } - else { - drawRightTriangle(); - drawLeftTriangle(); - } - - glFlush(); -} - -void reshape(int w, int h) -{ - glViewport(0, 0, (GLsizei) w, (GLsizei) h); - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - if (w <= h) - gluOrtho2D (0.0, 1.0, 0.0, 1.0*(GLfloat)h/(GLfloat)w); - else - gluOrtho2D (0.0, 1.0*(GLfloat)w/(GLfloat)h, 0.0, 1.0); -} - -/* ARGSUSED1 */ -void keyboard(unsigned char key, int x, int y) -{ - switch (key) { - case 't': - case 'T': - leftFirst = !leftFirst; - glutPostRedisplay(); - break; - case 27: /* Escape key */ - exit(0); - break; - default: - break; - } -} - -/* Main Loop - * Open window with initial window size, title bar, - * RGBA display mode, and handle input events. - */ -int main(int argc, char** argv) -{ - glutInit(&argc, argv); - glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB); - glutInitWindowSize (200, 200); - glutCreateWindow (argv[0]); - init(); - glutReshapeFunc (reshape); - glutKeyboardFunc (keyboard); - glutDisplayFunc (display); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/tri-clip.c b/progs/trivial/tri-clip.c deleted file mode 100644 index bf48533adc..0000000000 --- a/progs/trivial/tri-clip.c +++ /dev/null @@ -1,137 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the name of - * Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF - * ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include -#include -#include -#include - - -#define CI_OFFSET_1 16 -#define CI_OFFSET_2 32 - - -GLenum doubleBuffer; - -static void Init(void) -{ - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - - glClearColor(0.0, 0.0, 1.0, 0.0); -} - -static void Reshape(int width, int height) -{ - - glViewport(0, 0, (GLint)width, (GLint)height); - - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0); - glMatrixMode(GL_MODELVIEW); -} - -static void Key(unsigned char key, int x, int y) -{ - - switch (key) { - case 27: - exit(1); - default: - return; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - - glBegin(GL_TRIANGLES); - glColor3f(0,0,.7); - glVertex3f( 0.9, -0.9, -30.0); - glColor3f(.8,0,0); - glVertex3f( 0.9, 0.9, -30.0); - glColor3f(0,.9,0); - glVertex3f(-1.9, 0.0, -30.0); - glEnd(); - - glFlush(); - - if (doubleBuffer) { - glutSwapBuffers(); - } - -} - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - doubleBuffer = GL_FALSE; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow("First Tri") == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/tri-cull.c b/progs/trivial/tri-cull.c deleted file mode 100644 index 20aeaf1d7c..0000000000 --- a/progs/trivial/tri-cull.c +++ /dev/null @@ -1,136 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the name of - * Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF - * ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include -#include -#include -#include - - -#define CI_OFFSET_1 16 -#define CI_OFFSET_2 32 - - -GLenum doubleBuffer; - -static void Init(void) -{ - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - - glClearColor(0.0, 0.0, 1.0, 0.0); -} - -static void Reshape(int width, int height) -{ - - glViewport(0, 0, (GLint)width, (GLint)height); - - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0); - glMatrixMode(GL_MODELVIEW); -} - -static void Key(unsigned char key, int x, int y) -{ - - switch (key) { - case 27: - exit(1); - default: - return; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - - glBegin(GL_TRIANGLES); - glColor3f(0,0,1); - glVertex3f( -1.5, 0.5, -30.0); - glColor3f(1,0,0); - glVertex3f( 0, 2.0, -30.0); - glColor3f(0,1,0); - glVertex3f(-1.5, 2.0, -30.0); - glEnd(); - - glFlush(); - - if (doubleBuffer) { - glutSwapBuffers(); - } -} - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - doubleBuffer = GL_FALSE; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow("First Tri") == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/tri-dlist.c b/progs/trivial/tri-dlist.c deleted file mode 100644 index e0ab285eff..0000000000 --- a/progs/trivial/tri-dlist.c +++ /dev/null @@ -1,150 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the name of - * Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF - * ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include -#include -#include -#include - - -#define CI_OFFSET_1 16 -#define CI_OFFSET_2 32 - - -GLenum doubleBuffer; -GLint list; - -static void Init(void) -{ - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - - glClearColor(0.0, 0.0, 1.0, 0.0); - - list = glGenLists(1); - glNewList(list, GL_COMPILE); - glBegin(GL_TRIANGLES); -/* glColor3f(0,0,.7); */ - glVertex3f( 0.9, -0.9, -30.0); -/* glColor3f(.8,0,0); */ - glVertex3f( 0.9, 0.9, -30.0); -/* glColor3f(0,.9,0); */ - glVertex3f(-0.9, 0.0, -30.0); - glEnd(); - glEndList(); -} - -static void Reshape(int width, int height) -{ - - glViewport(0, 0, (GLint)width, (GLint)height); - - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0); - glMatrixMode(GL_MODELVIEW); -} - -static void Key(unsigned char key, int x, int y) -{ - - switch (key) { - case 27: - exit(1); - default: - return; - } - - glutPostRedisplay(); -} - - - - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - - glColor3f(0,.9,0); - glCallList(list); - - glRotatef(45,0,0,1); - glColor3f(1,0,1); - glCallList(list); - - glFlush(); - - if (doubleBuffer) { - glutSwapBuffers(); - } -} - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - doubleBuffer = GL_FALSE; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow("First Tri") == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/tri-edgeflag.c b/progs/trivial/tri-edgeflag.c deleted file mode 100644 index bdc0eaa253..0000000000 --- a/progs/trivial/tri-edgeflag.c +++ /dev/null @@ -1,141 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the name of - * Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF - * ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include -#include -#include -#include - - -#define CI_OFFSET_1 16 -#define CI_OFFSET_2 32 - - -GLenum doubleBuffer; - -static void Init(void) -{ - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - - glClearColor(0.0, 0.0, 1.0, 0.0); -} - -static void Reshape(int width, int height) -{ - - glViewport(0, 0, (GLint)width, (GLint)height); - - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); -/* glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0); */ - glMatrixMode(GL_MODELVIEW); -} - -static void Key(unsigned char key, int x, int y) -{ - - switch (key) { - case 27: - exit(1); - default: - return; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - glPolygonMode(GL_FRONT, GL_LINE); - glPolygonMode(GL_BACK, GL_POINT); - - glBegin(GL_TRIANGLES); - glEdgeFlag(1); - glColor3f(0,0,.7); - glVertex3f( 0.9, -0.9, -0.0); - glEdgeFlag(0); - glColor3f(.8,0,0); - glVertex3f( 0.9, 0.9, -0.0); - glEdgeFlag(1); - glColor3f(0,.9,0); - glVertex3f(-0.9, 0.0, -0.0); - glEnd(); - - glFlush(); - - if (doubleBuffer) { - glutSwapBuffers(); - } -} - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - doubleBuffer = GL_FALSE; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow("First Tri") == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/tri-flat-clip.c b/progs/trivial/tri-flat-clip.c deleted file mode 100644 index fafa64914d..0000000000 --- a/progs/trivial/tri-flat-clip.c +++ /dev/null @@ -1,137 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the name of - * Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF - * ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include -#include -#include -#include - - -#define CI_OFFSET_1 16 -#define CI_OFFSET_2 32 - - -GLenum doubleBuffer; - -static void Init(void) -{ - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - - glClearColor(0.5, 0.5, 0.5, 0.0); -} - -static void Reshape(int width, int height) -{ - - glViewport(0, 0, (GLint)width, (GLint)height); - - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0); - glMatrixMode(GL_MODELVIEW); -} - -static void Key(unsigned char key, int x, int y) -{ - - switch (key) { - case 27: - exit(1); - default: - return; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - glShadeModel(GL_FLAT); - - glBegin(GL_TRIANGLES); - glColor3f(0,0,1); - glVertex3f( 0.9, -0.9, -30.0); - glColor3f(1,0,0); - glVertex3f( 0.9, 0.9, -30.0); - glColor3f(0,1,0); - glVertex3f(-1.9, 0.0, -30.0); - glEnd(); - - glFlush(); - - if (doubleBuffer) { - glutSwapBuffers(); - } -} - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - doubleBuffer = GL_FALSE; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow("First Tri") == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/tri-flat.c b/progs/trivial/tri-flat.c deleted file mode 100644 index fb2cdbd7bb..0000000000 --- a/progs/trivial/tri-flat.c +++ /dev/null @@ -1,137 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the name of - * Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF - * ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include -#include -#include -#include - - -#define CI_OFFSET_1 16 -#define CI_OFFSET_2 32 - - -GLenum doubleBuffer; - -static void Init(void) -{ - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - - glClearColor(0.5, 0.5, 0.5, 0.0); -} - -static void Reshape(int width, int height) -{ - - glViewport(0, 0, (GLint)width, (GLint)height); - - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0); - glMatrixMode(GL_MODELVIEW); -} - -static void Key(unsigned char key, int x, int y) -{ - - switch (key) { - case 27: - exit(1); - default: - return; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - glShadeModel(GL_FLAT); - - glBegin(GL_TRIANGLES); - glColor3f(0,0,1); - glVertex3f( 0.9, -0.9, -30.0); - glColor3f(1,0,0); - glVertex3f( 0.9, 0.9, -30.0); - glColor3f(0,1,0); - glVertex3f(-0.9, 0.0, -30.0); - glEnd(); - - glFlush(); - - if (doubleBuffer) { - glutSwapBuffers(); - } -} - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - doubleBuffer = GL_FALSE; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow("First Tri") == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/tri-tex-3d.c b/progs/trivial/tri-tex-3d.c deleted file mode 100644 index 6a9d1d1bf6..0000000000 --- a/progs/trivial/tri-tex-3d.c +++ /dev/null @@ -1,170 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the name of - * Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF - * ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include -#include -#include -#include - - -#define CI_OFFSET_1 16 -#define CI_OFFSET_2 32 - - -GLenum doubleBuffer; - -static void Init(void) -{ - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - - glClearColor(0.0, 0.0, 1.0, 0.0); - -#define SIZE 16 - { - GLubyte tex3d[SIZE][SIZE][SIZE][3]; - GLint r, s, t; - - for (s = 0; s < SIZE; s++) { - for (t = 0; t < SIZE; t++) { - for (r = 0; r < SIZE; r++) { -#if 0 - tex3d[r][t][s][0] = (s < SIZE/2) ? 0 : 255; - tex3d[r][t][s][1] = (t < SIZE/2) ? 0 : 255; - tex3d[r][t][s][2] = (r < SIZE/2) ? 0 : 255; -#else - tex3d[r][t][s][0] = s*255/(SIZE-1); - tex3d[r][t][s][1] = t*255/(SIZE-1); - tex3d[r][t][s][2] = r*255/(SIZE-1); -#endif - } - } - } - - glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); - glTexParameterf(GL_TEXTURE_3D, GL_TEXTURE_WRAP_R, GL_REPEAT); - glTexParameterf(GL_TEXTURE_3D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - glTexParameterf(GL_TEXTURE_3D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - - glPixelStorei(GL_UNPACK_ALIGNMENT, 1); - glTexImage3D(GL_TEXTURE_3D, 0, 3, SIZE, SIZE, SIZE, 0, - GL_RGB, GL_UNSIGNED_BYTE, tex3d); - glPixelStorei(GL_UNPACK_ALIGNMENT, 4); - glEnable(GL_TEXTURE_3D); - } - -} - -static void Reshape(int width, int height) -{ - - glViewport(0, 0, (GLint)width, (GLint)height); - - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0); - glMatrixMode(GL_MODELVIEW); -} - -static void Key(unsigned char key, int x, int y) -{ - - switch (key) { - case 27: - exit(1); - default: - return; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - - glBegin(GL_TRIANGLES); - glTexCoord3f( 0,0,.9); - glVertex3f( 0.9, -0.9, -30.0); - glTexCoord3f(.9,0,0); - glVertex3f( 0.9, 0.9, -30.0); - glTexCoord3f(0,.9,0); - glVertex3f(-0.9, 0.0, -30.0); - glEnd(); - - glFlush(); - - if (doubleBuffer) { - glutSwapBuffers(); - } -} - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - doubleBuffer = GL_FALSE; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow("First Tri") == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/tri-unfilled-clip.c b/progs/trivial/tri-unfilled-clip.c deleted file mode 100644 index d486af2365..0000000000 --- a/progs/trivial/tri-unfilled-clip.c +++ /dev/null @@ -1,137 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the name of - * Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF - * ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include -#include -#include -#include - - -#define CI_OFFSET_1 16 -#define CI_OFFSET_2 32 - - -GLenum doubleBuffer; - -static void Init(void) -{ - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - - glClearColor(0.0, 0.0, 1.0, 0.0); -} - -static void Reshape(int width, int height) -{ - - glViewport(0, 0, (GLint)width, (GLint)height); - - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0); - glMatrixMode(GL_MODELVIEW); -} - -static void Key(unsigned char key, int x, int y) -{ - - switch (key) { - case 27: - exit(1); - default: - return; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); - - glBegin(GL_TRIANGLES); - glColor3f(0,0,.7); - glVertex3f( 0.9, -0.9, -30.0); - glColor3f(.8,0,0); - glVertex3f( 0.9, 0.9, -30.0); - glColor3f(0,.9,0); - glVertex3f(-1.9, 0.0, -30.0); - glEnd(); - - glFlush(); - - if (doubleBuffer) { - glutSwapBuffers(); - } -} - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - doubleBuffer = GL_FALSE; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow("First Tri") == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/tri-unfilled-smooth.c b/progs/trivial/tri-unfilled-smooth.c deleted file mode 100644 index e41903a3d5..0000000000 --- a/progs/trivial/tri-unfilled-smooth.c +++ /dev/null @@ -1,150 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the name of - * Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF - * ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include -#include -#include -#include - - -#define CI_OFFSET_1 16 -#define CI_OFFSET_2 32 - - -GLenum doubleBuffer; - -static void Init(void) -{ - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - - glClearColor(0.0, 0.0, 1.0, 0.0); -} - -static void Reshape(int width, int height) -{ - - glViewport(0, 0, (GLint)width, (GLint)height); - - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); -/* glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0); */ - glMatrixMode(GL_MODELVIEW); -} - -static void Key(unsigned char key, int x, int y) -{ - - switch (key) { - case 27: - exit(1); - default: - return; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - - glEnable(GL_LINE_SMOOTH); - - glBegin(GL_TRIANGLES); - glColor3f(0,0,.7); - glVertex3f( 0.6, -0.6, -0.0); - glColor3f(.8,0,0); - glVertex3f( 0.6, 0.6, -0.0); - glColor3f(0,.9,0); - glVertex3f(-0.6, 0.0, -0.0); - glEnd(); - - glPolygonMode(GL_FRONT, GL_LINE); -/* glPolygonMode(GL_BACK, GL_LINE); */ - - glBegin(GL_TRIANGLES); - glColor3f(0,0,.7); - glVertex3f( 0.9, -0.9, -0.0); - glColor3f(.8,0,0); - glVertex3f( 0.9, 0.9, -0.0); - glColor3f(0,.9,0); - glVertex3f(-0.9, 0.0, -0.0); - glEnd(); - - glFlush(); - - if (doubleBuffer) { - glutSwapBuffers(); - } -} - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - doubleBuffer = GL_FALSE; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow("First Tri") == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/tri-unfilled-userclip.c b/progs/trivial/tri-unfilled-userclip.c deleted file mode 100644 index dc93a8f1ab..0000000000 --- a/progs/trivial/tri-unfilled-userclip.c +++ /dev/null @@ -1,141 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the name of - * Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF - * ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include -#include -#include -#include - - -#define CI_OFFSET_1 16 -#define CI_OFFSET_2 32 - - -GLenum doubleBuffer; - -static void Init(void) -{ - static GLdouble plane[4] = { -.5, 0, 1, 0 }; - - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - - glClearColor(0.0, 0.0, 1.0, 0.0); - glClipPlane(GL_CLIP_PLANE0, plane); - glEnable(GL_CLIP_PLANE0); -} - -static void Reshape(int width, int height) -{ - - glViewport(0, 0, (GLint)width, (GLint)height); - - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); -/* glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0); */ - glMatrixMode(GL_MODELVIEW); -} - -static void Key(unsigned char key, int x, int y) -{ - - switch (key) { - case 27: - exit(1); - default: - return; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); - - glBegin(GL_TRIANGLES); - glColor3f(0,0,.7); - glVertex3f( 0.9, -0.9, 0.0); - glColor3f(.8,0,0); - glVertex3f( 0.9, 0.9, 0.0); - glColor3f(0,.9,0); - glVertex3f(-0.9, 0.0, 0.0); - glEnd(); - - glFlush(); - - if (doubleBuffer) { - glutSwapBuffers(); - } -} - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - doubleBuffer = GL_FALSE; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow("First Tri") == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/tri-unfilled.c b/progs/trivial/tri-unfilled.c deleted file mode 100644 index 73961bc93a..0000000000 --- a/progs/trivial/tri-unfilled.c +++ /dev/null @@ -1,138 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the name of - * Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF - * ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include -#include -#include -#include - - -#define CI_OFFSET_1 16 -#define CI_OFFSET_2 32 - - -GLenum doubleBuffer; - -static void Init(void) -{ - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - - glClearColor(0.0, 0.0, 1.0, 0.0); -} - -static void Reshape(int width, int height) -{ - - glViewport(0, 0, (GLint)width, (GLint)height); - - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); -/* glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0); */ - glMatrixMode(GL_MODELVIEW); -} - -static void Key(unsigned char key, int x, int y) -{ - - switch (key) { - case 27: - exit(1); - default: - return; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - glPolygonMode(GL_FRONT, GL_LINE); - glPolygonMode(GL_BACK, GL_LINE); - - glBegin(GL_TRIANGLES); - glColor3f(0,0,.7); - glVertex3f( 0.9, -0.9, -0.0); - glColor3f(.8,0,0); - glVertex3f( 0.9, 0.9, -0.0); - glColor3f(0,.9,0); - glVertex3f(-0.9, 0.0, -0.0); - glEnd(); - - glFlush(); - - if (doubleBuffer) { - glutSwapBuffers(); - } -} - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - doubleBuffer = GL_FALSE; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow("First Tri") == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/tri-userclip.c b/progs/trivial/tri-userclip.c deleted file mode 100644 index cde9662ace..0000000000 --- a/progs/trivial/tri-userclip.c +++ /dev/null @@ -1,140 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the name of - * Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF - * ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include -#include -#include -#include - - -#define CI_OFFSET_1 16 -#define CI_OFFSET_2 32 - - -GLenum doubleBuffer; - -static void Init(void) -{ - static GLdouble plane[4] = { -.5, 0, 1, 0 }; - - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - - glClearColor(0.0, 0.0, 1.0, 0.0); - glClipPlane(GL_CLIP_PLANE0, plane); - glEnable(GL_CLIP_PLANE0); -} - -static void Reshape(int width, int height) -{ - - glViewport(0, 0, (GLint)width, (GLint)height); - - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); -/* glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0); */ - glMatrixMode(GL_MODELVIEW); -} - -static void Key(unsigned char key, int x, int y) -{ - - switch (key) { - case 27: - exit(1); - default: - return; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - - glBegin(GL_TRIANGLES); - glColor3f(0,0,.7); - glVertex3f( 0.9, -0.9, 0.0); - glColor3f(.8,0,0); - glVertex3f( 0.9, 0.9, 0.0); - glColor3f(0,.9,0); - glVertex3f(-0.9, 0.0, 0.0); - glEnd(); - - glFlush(); - - if (doubleBuffer) { - glutSwapBuffers(); - } -} - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - doubleBuffer = GL_FALSE; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow("First Tri") == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/tri.c b/progs/trivial/tri.c deleted file mode 100644 index d4a7f08ae3..0000000000 --- a/progs/trivial/tri.c +++ /dev/null @@ -1,139 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the name of - * Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF - * ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include -#include -#include -#include - - -#define CI_OFFSET_1 16 -#define CI_OFFSET_2 32 - - -GLenum doubleBuffer; -int win; - -static void Init(void) -{ - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - - glClearColor(0.0, 0.0, 1.0, 0.0); -} - -static void Reshape(int width, int height) -{ - - glViewport(0, 0, (GLint)width, (GLint)height); - - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0); - glMatrixMode(GL_MODELVIEW); -} - -static void Key(unsigned char key, int x, int y) -{ - - switch (key) { - case 27: - glutDestroyWindow(win); - exit(0); - default: - return; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - - glBegin(GL_TRIANGLES); - glColor3f(0,0,.7); - glVertex3f( 0.9, -0.9, -30.0); - glColor3f(.8,0,0); - glVertex3f( 0.9, 0.9, -30.0); - glColor3f(0,.9,0); - glVertex3f(-0.9, 0.0, -30.0); - glEnd(); - - glFlush(); - - if (doubleBuffer) { - glutSwapBuffers(); - } -} - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - doubleBuffer = GL_FALSE; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - win = glutCreateWindow("First Tri"); - if (!win) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/tristrip-clip.c b/progs/trivial/tristrip-clip.c deleted file mode 100644 index f95c66a62a..0000000000 --- a/progs/trivial/tristrip-clip.c +++ /dev/null @@ -1,138 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the name of - * Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF - * ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include -#include -#include -#include - - -#define CI_OFFSET_1 16 -#define CI_OFFSET_2 32 - - -GLenum doubleBuffer; - -static void Init(void) -{ - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - - glClearColor(0.0, 0.0, 1.0, 0.0); -} - -static void Reshape(int width, int height) -{ - - glViewport(0, 0, (GLint)width, (GLint)height); - - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0); - glMatrixMode(GL_MODELVIEW); -} - -static void Key(unsigned char key, int x, int y) -{ - - switch (key) { - case 27: - exit(1); - default: - return; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - - glBegin(GL_TRIANGLE_STRIP); - glColor3f(1,0,0); - glVertex3f( 0.9, -0.9, -30.0); - glColor3f(1,1,0); - glVertex3f( 0.9, 0.9, -30.0); - glColor3f(0,1,1); - glVertex3f(-0.9, -0.9, -30.0); - glColor3f(1,0,1); - glVertex3f(-1.9, 0.9, -30.0); - glEnd(); - - glFlush(); - - if (doubleBuffer) { - glutSwapBuffers(); - } -} - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - doubleBuffer = GL_FALSE; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow("First Tri") == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/tristrip.c b/progs/trivial/tristrip.c deleted file mode 100644 index fa82a73711..0000000000 --- a/progs/trivial/tristrip.c +++ /dev/null @@ -1,138 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the name of - * Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF - * ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include -#include -#include -#include - - -#define CI_OFFSET_1 16 -#define CI_OFFSET_2 32 - - -GLenum doubleBuffer; - -static void Init(void) -{ - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - - glClearColor(0.0, 0.0, 1.0, 0.0); -} - -static void Reshape(int width, int height) -{ - - glViewport(0, 0, (GLint)width, (GLint)height); - - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0); - glMatrixMode(GL_MODELVIEW); -} - -static void Key(unsigned char key, int x, int y) -{ - - switch (key) { - case 27: - exit(1); - default: - return; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - - glBegin(GL_TRIANGLE_STRIP); - glColor3f(1,0,0); - glVertex3f( 0.9, -0.9, -30.0); - glColor3f(1,1,0); - glVertex3f( 0.9, 0.9, -30.0); - glColor3f(0,1,1); - glVertex3f(-0.9, -0.9, -30.0); - glColor3f(1,0,1); - glVertex3f(-0.9, 0.9, -30.0); - glEnd(); - - glFlush(); - - if (doubleBuffer) { - glutSwapBuffers(); - } -} - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - doubleBuffer = GL_FALSE; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow("First Tri") == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/vbo-drawarrays.c b/progs/trivial/vbo-drawarrays.c deleted file mode 100644 index fb590098a3..0000000000 --- a/progs/trivial/vbo-drawarrays.c +++ /dev/null @@ -1,133 +0,0 @@ -/* Basic VBO */ - -#include -#include -#include -#include -#include -#define GL_GLEXT_PROTOTYPES -#include - - -struct { - GLfloat pos[3]; - GLubyte color[4]; -} verts[] = -{ - { { 0.9, -0.9, 0.0 }, - { 0x00, 0x00, 0xff, 0x00 } - }, - - { { 0.9, 0.9, 0.0 }, - { 0x00, 0xff, 0x00, 0x00 } - }, - - { { -0.9, 0.9, 0.0 }, - { 0xff, 0x00, 0x00, 0x00 } - }, - - { { -0.9, -0.9, 0.0 }, - { 0xff, 0xff, 0xff, 0x00 } - }, -}; - -GLuint arrayObj, elementObj; - -static void Init( void ) -{ - GLint errno; - GLuint prognum; - - static const char *prog1 = - "!!ARBvp1.0\n" - "MOV result.color, vertex.color;\n" - "MOV result.position, vertex.position;\n" - "END\n"; - - glGenProgramsARB(1, &prognum); - glBindProgramARB(GL_VERTEX_PROGRAM_ARB, prognum); - glProgramStringARB(GL_VERTEX_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, - strlen(prog1), (const GLubyte *) prog1); - - assert(glIsProgramARB(prognum)); - errno = glGetError(); - printf("glGetError = %d\n", errno); - if (errno != GL_NO_ERROR) - { - GLint errorpos; - - glGetIntegerv(GL_PROGRAM_ERROR_POSITION_ARB, &errorpos); - printf("errorpos: %d\n", errorpos); - printf("%s\n", (char *)glGetString(GL_PROGRAM_ERROR_STRING_ARB)); - } - - - glEnableClientState( GL_VERTEX_ARRAY ); - glEnableClientState( GL_COLOR_ARRAY ); - - glGenBuffersARB(1, &arrayObj); - glBindBufferARB(GL_ARRAY_BUFFER_ARB, arrayObj); - glBufferDataARB(GL_ARRAY_BUFFER_ARB, sizeof(verts), verts, GL_STATIC_DRAW_ARB); - - glVertexPointer( 3, GL_FLOAT, sizeof(verts[0]), 0 ); - glColorPointer( 4, GL_UNSIGNED_BYTE, sizeof(verts[0]), (void *)(3*sizeof(float)) ); - -} - - - -static void Display( void ) -{ - glClearColor(0.3, 0.3, 0.3, 1); - glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); - - glEnable(GL_VERTEX_PROGRAM_ARB); - -// glDrawArrays( GL_TRIANGLES, 0, 3 ); - glDrawArrays( GL_TRIANGLES, 1, 3 ); - - glFlush(); -} - - -static void Reshape( int width, int height ) -{ - glViewport( 0, 0, width, height ); - glMatrixMode( GL_PROJECTION ); - glLoadIdentity(); - glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0); - glMatrixMode( GL_MODELVIEW ); - glLoadIdentity(); - /*glTranslatef( 0.0, 0.0, -15.0 );*/ -} - - -static void Key( unsigned char key, int x, int y ) -{ - (void) x; - (void) y; - switch (key) { - case 27: - exit(0); - break; - } - glutPostRedisplay(); -} - - - - -int main( int argc, char *argv[] ) -{ - glutInit( &argc, argv ); - glutInitWindowPosition( 0, 0 ); - glutInitWindowSize( 250, 250 ); - glutInitDisplayMode( GLUT_RGB | GLUT_SINGLE | GLUT_DEPTH ); - glutCreateWindow(argv[0]); - glutReshapeFunc( Reshape ); - glutKeyboardFunc( Key ); - glutDisplayFunc( Display ); - Init(); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/vbo-drawelements.c b/progs/trivial/vbo-drawelements.c deleted file mode 100644 index dddb45695c..0000000000 --- a/progs/trivial/vbo-drawelements.c +++ /dev/null @@ -1,137 +0,0 @@ -/* Basic VBO */ - -#include -#include -#include -#include -#include -#define GL_GLEXT_PROTOTYPES -#include - -struct { - GLfloat pos[3]; - GLubyte color[4]; -} verts[] = -{ - { { 0.9, -0.9, 0.0 }, - { 0x00, 0x00, 0xff, 0x00 } - }, - - { { 0.9, 0.9, 0.0 }, - { 0x00, 0xff, 0x00, 0x00 } - }, - - { { -0.9, 0.9, 0.0 }, - { 0xff, 0x00, 0x00, 0x00 } - }, - - { { -0.9, -0.9, 0.0 }, - { 0xff, 0xff, 0xff, 0x00 } - }, -}; - -GLuint indices[] = { 0, 1, 2, 3 }; - -GLuint arrayObj, elementObj; - -static void Init( void ) -{ - GLint errno; - GLuint prognum; - - static const char *prog1 = - "!!ARBvp1.0\n" - "MOV result.color, vertex.color;\n" - "MOV result.position, vertex.position;\n" - "END\n"; - - glGenProgramsARB(1, &prognum); - glBindProgramARB(GL_VERTEX_PROGRAM_ARB, prognum); - glProgramStringARB(GL_VERTEX_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, - strlen(prog1), (const GLubyte *) prog1); - - assert(glIsProgramARB(prognum)); - errno = glGetError(); - printf("glGetError = %d\n", errno); - if (errno != GL_NO_ERROR) - { - GLint errorpos; - - glGetIntegerv(GL_PROGRAM_ERROR_POSITION_ARB, &errorpos); - printf("errorpos: %d\n", errorpos); - printf("%s\n", (char *)glGetString(GL_PROGRAM_ERROR_STRING_ARB)); - } - - - glEnableClientState( GL_VERTEX_ARRAY ); - glEnableClientState( GL_COLOR_ARRAY ); - - glGenBuffersARB(1, &arrayObj); - glGenBuffersARB(1, &elementObj); - - glBindBufferARB(GL_ARRAY_BUFFER_ARB, arrayObj); - glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, elementObj); - - glBufferDataARB(GL_ARRAY_BUFFER_ARB, sizeof(verts), verts, GL_STATIC_DRAW_ARB); - glBufferDataARB(GL_ELEMENT_ARRAY_BUFFER_ARB, sizeof(indices), indices, GL_STATIC_DRAW_ARB); - - glVertexPointer( 3, GL_FLOAT, sizeof(verts[0]), 0 ); - glColorPointer( 4, GL_UNSIGNED_BYTE, sizeof(verts[0]), (void *)(3*sizeof(float)) ); - -} - - - -static void Display( void ) -{ - glClearColor(0.3, 0.3, 0.3, 1); - glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); - - glEnable(GL_VERTEX_PROGRAM_ARB); - glDrawElements( GL_TRIANGLES, 3, GL_UNSIGNED_INT, NULL ); - - glFlush(); -} - - -static void Reshape( int width, int height ) -{ - glViewport( 0, 0, width, height ); - glMatrixMode( GL_PROJECTION ); - glLoadIdentity(); - glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0); - glMatrixMode( GL_MODELVIEW ); - glLoadIdentity(); - /*glTranslatef( 0.0, 0.0, -15.0 );*/ -} - - -static void Key( unsigned char key, int x, int y ) -{ - (void) x; - (void) y; - switch (key) { - case 27: - exit(0); - break; - } - glutPostRedisplay(); -} - - - - -int main( int argc, char *argv[] ) -{ - glutInit( &argc, argv ); - glutInitWindowPosition( 0, 0 ); - glutInitWindowSize( 250, 250 ); - glutInitDisplayMode( GLUT_RGB | GLUT_SINGLE | GLUT_DEPTH ); - glutCreateWindow(argv[0]); - glutReshapeFunc( Reshape ); - glutKeyboardFunc( Key ); - glutDisplayFunc( Display ); - Init(); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/vbo-drawrange.c b/progs/trivial/vbo-drawrange.c deleted file mode 100644 index 407b7541f0..0000000000 --- a/progs/trivial/vbo-drawrange.c +++ /dev/null @@ -1,145 +0,0 @@ -/* Basic VBO */ - -#include -#include -#include -#include -#include -#define GL_GLEXT_PROTOTYPES -#include - -#define ELTOBJ 0 - -struct { - GLfloat pos[3]; - GLubyte color[4]; -} verts[] = -{ - { { 0.9, -0.9, 0.0 }, - { 0x00, 0x00, 0xff, 0x00 } - }, - - { { 0.9, 0.9, 0.0 }, - { 0x00, 0xff, 0x00, 0x00 } - }, - - { { -0.9, 0.9, 0.0 }, - { 0xff, 0x00, 0x00, 0x00 } - }, - - { { -0.9, -0.9, 0.0 }, - { 0xff, 0xff, 0xff, 0x00 } - }, -}; - -GLuint indices[] = { 1, 2, 3 }; - -GLuint arrayObj, elementObj; - -static void Init( void ) -{ - GLint errno; - GLuint prognum; - - static const char *prog1 = - "!!ARBvp1.0\n" - "MOV result.color, vertex.color;\n" - "MOV result.position, vertex.position;\n" - "END\n"; - - glGenProgramsARB(1, &prognum); - glBindProgramARB(GL_VERTEX_PROGRAM_ARB, prognum); - glProgramStringARB(GL_VERTEX_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, - strlen(prog1), (const GLubyte *) prog1); - - assert(glIsProgramARB(prognum)); - errno = glGetError(); - printf("glGetError = %d\n", errno); - if (errno != GL_NO_ERROR) - { - GLint errorpos; - - glGetIntegerv(GL_PROGRAM_ERROR_POSITION_ARB, &errorpos); - printf("errorpos: %d\n", errorpos); - printf("%s\n", (char *)glGetString(GL_PROGRAM_ERROR_STRING_ARB)); - } - - - glEnableClientState( GL_VERTEX_ARRAY ); - glEnableClientState( GL_COLOR_ARRAY ); - - glGenBuffersARB(1, &arrayObj); - glBindBufferARB(GL_ARRAY_BUFFER_ARB, arrayObj); - glBufferDataARB(GL_ARRAY_BUFFER_ARB, sizeof(verts), verts, GL_STATIC_DRAW_ARB); - -#if ELTOBJ - glGenBuffersARB(1, &elementObj); - glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, elementObj); - glBufferDataARB(GL_ELEMENT_ARRAY_BUFFER_ARB, sizeof(indices), indices, GL_STATIC_DRAW_ARB); -#endif - - glVertexPointer( 3, GL_FLOAT, sizeof(verts[0]), 0 ); - glColorPointer( 4, GL_UNSIGNED_BYTE, sizeof(verts[0]), (void *)(3*sizeof(float)) ); - -} - - - -static void Display( void ) -{ - glClearColor(0.3, 0.3, 0.3, 1); - glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); - - glEnable(GL_VERTEX_PROGRAM_ARB); - -#if ELTOBJ - glDrawRangeElements( GL_TRIANGLES, 1, 3, 3, GL_UNSIGNED_INT, NULL ); -#else - glDrawRangeElements( GL_TRIANGLES, 1, 3, 3, GL_UNSIGNED_INT, indices ); -#endif - - glFlush(); -} - - -static void Reshape( int width, int height ) -{ - glViewport( 0, 0, width, height ); - glMatrixMode( GL_PROJECTION ); - glLoadIdentity(); - glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0); - glMatrixMode( GL_MODELVIEW ); - glLoadIdentity(); - /*glTranslatef( 0.0, 0.0, -15.0 );*/ -} - - -static void Key( unsigned char key, int x, int y ) -{ - (void) x; - (void) y; - switch (key) { - case 27: - exit(0); - break; - } - glutPostRedisplay(); -} - - - - -int main( int argc, char *argv[] ) -{ - glutInit( &argc, argv ); - glutInitWindowPosition( 0, 0 ); - glutInitWindowSize( 250, 250 ); - glutInitDisplayMode( GLUT_RGB | GLUT_SINGLE | GLUT_DEPTH ); - glutCreateWindow(argv[0]); - glutReshapeFunc( Reshape ); - glutKeyboardFunc( Key ); - glutDisplayFunc( Display ); - Init(); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/vp-array.c b/progs/trivial/vp-array.c deleted file mode 100644 index abe8f62bec..0000000000 --- a/progs/trivial/vp-array.c +++ /dev/null @@ -1,117 +0,0 @@ -/* Test glGenProgramsNV(), glIsProgramNV(), glLoadProgramNV() */ - -#include -#include -#include -#include -#include -#define GL_GLEXT_PROTOTYPES -#include - -GLfloat verts[][4] = { - { 0.9, -0.9, 0.0, 1.0 }, - { 0.9, 0.9, 0.0, 1.0 }, - { -0.9, 0.9, 0.0, 1.0 }, - { -0.9, -0.9, 0.0, 1.0 }, -}; - -GLubyte color[][4] = { - { 0x00, 0x00, 0xff, 0x00 }, - { 0x00, 0xff, 0x00, 0x00 }, - { 0xff, 0x00, 0x00, 0x00 }, - { 0xff, 0xff, 0xff, 0x00 }, -}; - -GLuint indices[] = { 0, 1, 2, 3 }; - -static void Init( void ) -{ - GLint errno; - GLuint prognum; - - static const char *prog1 = - "!!ARBvp1.0\n" - "MOV result.color, vertex.color;\n" - "MOV result.position, vertex.position;\n" - "END\n"; - - glGenProgramsARB(1, &prognum); - glBindProgramARB(GL_VERTEX_PROGRAM_ARB, prognum); - glProgramStringARB(GL_VERTEX_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, - strlen(prog1), (const GLubyte *) prog1); - - assert(glIsProgramARB(prognum)); - errno = glGetError(); - printf("glGetError = %d\n", errno); - if (errno != GL_NO_ERROR) - { - GLint errorpos; - - glGetIntegerv(GL_PROGRAM_ERROR_POSITION_ARB, &errorpos); - printf("errorpos: %d\n", errorpos); - printf("%s\n", (char *)glGetString(GL_PROGRAM_ERROR_STRING_ARB)); - } - - - glEnableClientState( GL_VERTEX_ARRAY ); - glEnableClientState( GL_COLOR_ARRAY ); - glVertexPointer( 3, GL_FLOAT, sizeof(verts[0]), verts ); - glColorPointer( 4, GL_UNSIGNED_BYTE, 0, color ); - -} - - - -static void Display( void ) -{ - glClearColor(0.3, 0.3, 0.3, 1); - glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); - - glEnable(GL_VERTEX_PROGRAM_NV); - glDrawElements( GL_TRIANGLES, 3, GL_UNSIGNED_INT, indices ); - - glFlush(); -} - - -static void Reshape( int width, int height ) -{ - glViewport( 0, 0, width, height ); - glMatrixMode( GL_PROJECTION ); - glLoadIdentity(); - glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0); - glMatrixMode( GL_MODELVIEW ); - glLoadIdentity(); - /*glTranslatef( 0.0, 0.0, -15.0 );*/ -} - - -static void Key( unsigned char key, int x, int y ) -{ - (void) x; - (void) y; - switch (key) { - case 27: - exit(0); - break; - } - glutPostRedisplay(); -} - - - - -int main( int argc, char *argv[] ) -{ - glutInit( &argc, argv ); - glutInitWindowPosition( 0, 0 ); - glutInitWindowSize( 250, 250 ); - glutInitDisplayMode( GLUT_RGB | GLUT_SINGLE | GLUT_DEPTH ); - glutCreateWindow(argv[0]); - glutReshapeFunc( Reshape ); - glutKeyboardFunc( Key ); - glutDisplayFunc( Display ); - Init(); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/vp-clip.c b/progs/trivial/vp-clip.c deleted file mode 100644 index 206ba0b8cb..0000000000 --- a/progs/trivial/vp-clip.c +++ /dev/null @@ -1,102 +0,0 @@ -/* Test glGenProgramsNV(), glIsProgramNV(), glLoadProgramNV() */ - -#include -#include -#include -#include -#include -#define GL_GLEXT_PROTOTYPES -#include - -static void Init( void ) -{ - GLint errno; - GLuint prognum; - - static const char *prog1 = - "!!ARBvp1.0\n" - "MOV result.color, vertex.color;\n" - "MOV result.position, vertex.position;\n" - "END\n"; - - glGenProgramsARB(1, &prognum); - - glBindProgramARB(GL_VERTEX_PROGRAM_ARB, prognum); - glProgramStringARB(GL_VERTEX_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, - strlen(prog1), (const GLubyte *) prog1); - - assert(glIsProgramARB(prognum)); - errno = glGetError(); - printf("glGetError = %d\n", errno); - if (errno != GL_NO_ERROR) - { - GLint errorpos; - - glGetIntegerv(GL_PROGRAM_ERROR_POSITION_ARB, &errorpos); - printf("errorpos: %d\n", errorpos); - printf("%s\n", (char *)glGetString(GL_PROGRAM_ERROR_STRING_ARB)); - } -} - -static void Display( void ) -{ - glClearColor(0.3, 0.3, 0.3, 1); - glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); - - glEnable(GL_VERTEX_PROGRAM_NV); - - glBegin(GL_TRIANGLES); - glColor3f(0,0,1); - glVertex3f( 2.0, -2.0, 0.0); - glColor3f(0,1,0); - glVertex3f( 2.0, 2.0, 0.0); - glColor3f(1,0,0); - glVertex3f(-2.0, 0.0, 0.0); - glEnd(); - - - glFlush(); -} - - -static void Reshape( int width, int height ) -{ - glViewport( 0, 0, width, height ); - glMatrixMode( GL_PROJECTION ); - glLoadIdentity(); - glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0); - glMatrixMode( GL_MODELVIEW ); - glLoadIdentity(); - /*glTranslatef( 0.0, 0.0, -15.0 );*/ -} - - -static void Key( unsigned char key, int x, int y ) -{ - (void) x; - (void) y; - switch (key) { - case 27: - exit(0); - break; - } - glutPostRedisplay(); -} - - - - -int main( int argc, char *argv[] ) -{ - glutInit( &argc, argv ); - glutInitWindowPosition( 0, 0 ); - glutInitWindowSize( 250, 250 ); - glutInitDisplayMode( GLUT_RGB | GLUT_SINGLE | GLUT_DEPTH ); - glutCreateWindow(argv[0]); - glutReshapeFunc( Reshape ); - glutKeyboardFunc( Key ); - glutDisplayFunc( Display ); - Init(); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/vp-line-clip.c b/progs/trivial/vp-line-clip.c deleted file mode 100644 index b2aaf17ca4..0000000000 --- a/progs/trivial/vp-line-clip.c +++ /dev/null @@ -1,116 +0,0 @@ -/* Test glGenProgramsNV(), glIsProgramNV(), glLoadProgramNV() */ - -#include -#include -#include -#include -#include -#define GL_GLEXT_PROTOTYPES -#include - -static void Init( void ) -{ - GLint errno; - GLuint prognum; - - static const char *prog1 = - "!!ARBvp1.0\n" - "MOV result.color, vertex.color;\n" - "MOV result.position, vertex.position;\n" - "END\n"; - - glGenProgramsARB(1, &prognum); - - glBindProgramARB(GL_VERTEX_PROGRAM_ARB, prognum); - glProgramStringARB(GL_VERTEX_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, - strlen(prog1), (const GLubyte *) prog1); - - assert(glIsProgramARB(prognum)); - errno = glGetError(); - printf("glGetError = %d\n", errno); - if (errno != GL_NO_ERROR) - { - GLint errorpos; - - glGetIntegerv(GL_PROGRAM_ERROR_POSITION_ARB, &errorpos); - printf("errorpos: %d\n", errorpos); - printf("%s\n", (char *)glGetString(GL_PROGRAM_ERROR_STRING_ARB)); - } -} - -static void Display( void ) -{ - glClearColor(0.3, 0.3, 0.3, 1); - glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); - - glEnable(GL_VERTEX_PROGRAM_NV); - -#if 0 - glBegin(GL_LINES); - glColor3f(0,0,1); - glVertex3f( 0.75, -0.75, 0.0); - glColor3f(0,1,0); - glVertex3f( 0.75, 0.75, 0.0); - - glColor3f(0,1,0); - glVertex3f( 0.75, 0.75, 0.0); - glColor3f(1,0,0); - glVertex3f(-1.75, 0.0, 0.0); - glEnd(); -#else - glBegin(GL_LINE_STRIP); - glColor3f(0,0,1); - glVertex3f( 0.75, -0.75, 0.0); - glColor3f(0,1,0); - glVertex3f( 0.75, 0.75, 0.0); - glColor3f(1,0,0); - glVertex3f(-1.75, 0.0, 0.0); - glEnd(); -#endif - - - glFlush(); -} - - -static void Reshape( int width, int height ) -{ - glViewport( 0, 0, width, height ); - glMatrixMode( GL_PROJECTION ); - glLoadIdentity(); - glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0); - glMatrixMode( GL_MODELVIEW ); - glLoadIdentity(); - /*glTranslatef( 0.0, 0.0, -15.0 );*/ -} - - -static void Key( unsigned char key, int x, int y ) -{ - (void) x; - (void) y; - switch (key) { - case 27: - exit(0); - break; - } - glutPostRedisplay(); -} - - - - -int main( int argc, char *argv[] ) -{ - glutInit( &argc, argv ); - glutInitWindowPosition( 0, 0 ); - glutInitWindowSize( 250, 250 ); - glutInitDisplayMode( GLUT_RGB | GLUT_SINGLE | GLUT_DEPTH ); - glutCreateWindow(argv[0]); - glutReshapeFunc( Reshape ); - glutKeyboardFunc( Key ); - glutDisplayFunc( Display ); - Init(); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/vp-tri.c b/progs/trivial/vp-tri.c deleted file mode 100644 index f8e18654c6..0000000000 --- a/progs/trivial/vp-tri.c +++ /dev/null @@ -1,104 +0,0 @@ -/* Test glGenProgramsNV(), glIsProgramNV(), glLoadProgramNV() */ - -#include -#include -#include -#include -#include -#define GL_GLEXT_PROTOTYPES -#include - -static void Init( void ) -{ - GLint errno; - GLuint prognum; - - static const char *prog1 = - "!!ARBvp1.0\n" - "MOV result.color, vertex.color;\n" -/* "MOV result.color, {0,0,0,1};\n" */ - "MOV result.position, vertex.position;\n" - "END\n"; - - - glGenProgramsARB(1, &prognum); - - glBindProgramARB(GL_VERTEX_PROGRAM_ARB, prognum); - glProgramStringARB(GL_VERTEX_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, - strlen(prog1), (const GLubyte *) prog1); - - assert(glIsProgramARB(prognum)); - errno = glGetError(); - printf("glGetError = %d\n", errno); - if (errno != GL_NO_ERROR) - { - GLint errorpos; - - glGetIntegerv(GL_PROGRAM_ERROR_POSITION_ARB, &errorpos); - printf("errorpos: %d\n", errorpos); - printf("%s\n", (char *)glGetString(GL_PROGRAM_ERROR_STRING_ARB)); - } -} - -static void Display( void ) -{ - glClearColor(0.3, 0.3, 0.3, 1); - glClear( GL_COLOR_BUFFER_BIT ); - - glEnable(GL_VERTEX_PROGRAM_NV); - - glBegin(GL_TRIANGLES); - glColor3f(0,0,1); - glVertex3f( 0.9, -0.9, 0.0); - glColor3f(0,1,0); - glVertex3f( 0.9, 0.9, 0.0); - glColor3f(1,0,0); - glVertex3f(-0.9, 0.0, 0.0); - glEnd(); - - - glFlush(); -} - - -static void Reshape( int width, int height ) -{ - glViewport( 0, 0, width, height ); - glMatrixMode( GL_PROJECTION ); - glLoadIdentity(); - glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0); - glMatrixMode( GL_MODELVIEW ); - glLoadIdentity(); - /*glTranslatef( 0.0, 0.0, -15.0 );*/ -} - - -static void Key( unsigned char key, int x, int y ) -{ - (void) x; - (void) y; - switch (key) { - case 27: - exit(0); - break; - } - glutPostRedisplay(); -} - - - - -int main( int argc, char *argv[] ) -{ - glutInit( &argc, argv ); - glutInitWindowPosition( 0, 0 ); - glutInitWindowSize( 250, 250 ); - glutInitDisplayMode( GLUT_RGB | GLUT_SINGLE ); - glutCreateWindow(argv[0]); - glutReshapeFunc( Reshape ); - glutKeyboardFunc( Key ); - glutDisplayFunc( Display ); - Init(); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/vp-unfilled.c b/progs/trivial/vp-unfilled.c deleted file mode 100644 index ac23181fff..0000000000 --- a/progs/trivial/vp-unfilled.c +++ /dev/null @@ -1,104 +0,0 @@ -/* Test glGenProgramsNV(), glIsProgramNV(), glLoadProgramNV() */ - -#include -#include -#include -#include -#include -#define GL_GLEXT_PROTOTYPES -#include - -static void Init( void ) -{ - GLint errno; - GLuint prognum; - - static const char *prog1 = - "!!ARBvp1.0\n" - "MOV result.color, vertex.color;\n" - "MOV result.position, vertex.position;\n" - "END\n"; - - glGenProgramsARB(1, &prognum); - - glBindProgramARB(GL_VERTEX_PROGRAM_ARB, prognum); - glProgramStringARB(GL_VERTEX_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, - strlen(prog1), (const GLubyte *) prog1); - - assert(glIsProgramARB(prognum)); - errno = glGetError(); - printf("glGetError = %d\n", errno); - if (errno != GL_NO_ERROR) - { - GLint errorpos; - - glGetIntegerv(GL_PROGRAM_ERROR_POSITION_ARB, &errorpos); - printf("errorpos: %d\n", errorpos); - printf("%s\n", (char *)glGetString(GL_PROGRAM_ERROR_STRING_ARB)); - } -} - -static void Display( void ) -{ - glClearColor(0.3, 0.3, 0.3, 1); - glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); - glPolygonMode(GL_FRONT, GL_LINE); - glPolygonMode(GL_BACK, GL_POINT); - - glEnable(GL_VERTEX_PROGRAM_NV); - - glBegin(GL_TRIANGLES); - glColor3f(0,0,1); - glVertex3f( 0.9, -0.9, 0.0); - glColor3f(0,1,0); - glVertex3f( 0.9, 0.9, 0.0); - glColor3f(1,0,0); - glVertex3f(-0.9, 0.0, 0.0); - glEnd(); - - - glFlush(); -} - - -static void Reshape( int width, int height ) -{ - glViewport( 0, 0, width, height ); - glMatrixMode( GL_PROJECTION ); - glLoadIdentity(); - glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0); - glMatrixMode( GL_MODELVIEW ); - glLoadIdentity(); - /*glTranslatef( 0.0, 0.0, -15.0 );*/ -} - - -static void Key( unsigned char key, int x, int y ) -{ - (void) x; - (void) y; - switch (key) { - case 27: - exit(0); - break; - } - glutPostRedisplay(); -} - - - - -int main( int argc, char *argv[] ) -{ - glutInit( &argc, argv ); - glutInitWindowPosition( 0, 0 ); - glutInitWindowSize( 250, 250 ); - glutInitDisplayMode( GLUT_RGB | GLUT_SINGLE | GLUT_DEPTH ); - glutCreateWindow(argv[0]); - glutReshapeFunc( Reshape ); - glutKeyboardFunc( Key ); - glutDisplayFunc( Display ); - Init(); - glutMainLoop(); - return 0; -} diff --git a/progs/vp/.gitignore b/progs/vp/.gitignore deleted file mode 100644 index a5ff993525..0000000000 --- a/progs/vp/.gitignore +++ /dev/null @@ -1 +0,0 @@ -vp-tris diff --git a/progs/vp/Makefile b/progs/vp/Makefile deleted file mode 100644 index 28d63237a4..0000000000 --- a/progs/vp/Makefile +++ /dev/null @@ -1,53 +0,0 @@ -# progs/tests/Makefile - - -# These programs aren't intended to be included with the normal distro. -# They're not too interesting but they're good for testing. - -TOP = ../.. -include $(TOP)/configs/current - - -LIBS = -L$(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) $(APP_LIB_DEPS) - -SOURCES = \ - vp-tris.c - - - -PROGS = $(SOURCES:%.c=%) - -INCLUDES = -I. -I$(TOP)/include -I../samples - - -##### RULES ##### - -.SUFFIXES: -.SUFFIXES: .c - -.c: - $(CC) $(INCLUDES) $(CFLAGS) $(LDFLAGS) $< $(LIBS) -o $@ - -.c.o: - $(CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) $< -o $@ - -.S.o: - $(CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) $< -o $@ - - -##### TARGETS ##### - -default: $(PROGS) - -clean: - -rm -f $(PROGS) - -rm -f *.o - -rm -f getproclist.h - - - - - -# Emacs tags -tags: - etags `find . -name \*.[ch]` `find ../include` diff --git a/progs/vp/abs.txt b/progs/vp/abs.txt deleted file mode 100644 index cd00952e34..0000000000 --- a/progs/vp/abs.txt +++ /dev/null @@ -1,7 +0,0 @@ -!!ARBvp1.0 -TEMP R0; -SUB R0, {0.5}.x, vertex.color; -ABS result.color, R0; -MOV result.position, vertex.position; -END - diff --git a/progs/vp/add.txt b/progs/vp/add.txt deleted file mode 100644 index 4094cd448d..0000000000 --- a/progs/vp/add.txt +++ /dev/null @@ -1,6 +0,0 @@ -!!ARBvp1.0 -TEMP R0; -ADD R0, vertex.color, vertex.color; -ADD result.color, R0, R0; -MOV result.position, vertex.position; -END diff --git a/progs/vp/arl.txt b/progs/vp/arl.txt deleted file mode 100644 index a262b0149c..0000000000 --- a/progs/vp/arl.txt +++ /dev/null @@ -1,9 +0,0 @@ -!!ARBvp1.0 -PARAM arr[5] = { {0,1,2,3}, {4,5,6,7}, {8,9,10,11}, {12,13,14,14}, {16,17,18,19} }; -ADDRESS addr; -TEMP R0; -MAD R0, {5.0}.x, vertex.color, {2.0}.x; -ARL addr.x, R0.x; -MUL result.color, arr[addr.x-2], {.07}.x; -MOV result.position, vertex.position; -END diff --git a/progs/vp/dp3.txt b/progs/vp/dp3.txt deleted file mode 100644 index 8336bd3dd8..0000000000 --- a/progs/vp/dp3.txt +++ /dev/null @@ -1,5 +0,0 @@ -!!ARBvp1.0 -DP3 result.color, vertex.color, vertex.color; -MOV result.position, vertex.position; -END - diff --git a/progs/vp/dp4.txt b/progs/vp/dp4.txt deleted file mode 100644 index 70505a494c..0000000000 --- a/progs/vp/dp4.txt +++ /dev/null @@ -1,5 +0,0 @@ -!!ARBvp1.0 -DP4 result.color, vertex.color.xxxx, vertex.color; -MOV result.position, vertex.position; -END - diff --git a/progs/vp/dph.txt b/progs/vp/dph.txt deleted file mode 100644 index c7cab1384d..0000000000 --- a/progs/vp/dph.txt +++ /dev/null @@ -1,5 +0,0 @@ -!!ARBvp1.0 -DPH result.color, vertex.color, vertex.color; -MOV result.position, vertex.position; -END - diff --git a/progs/vp/dst.txt b/progs/vp/dst.txt deleted file mode 100644 index 03613c0eec..0000000000 --- a/progs/vp/dst.txt +++ /dev/null @@ -1,5 +0,0 @@ -!!ARBvp1.0 -DST result.color, vertex.color, vertex.color; -MOV result.position, vertex.position; -END - diff --git a/progs/vp/ex2.txt b/progs/vp/ex2.txt deleted file mode 100644 index bbef67bbb8..0000000000 --- a/progs/vp/ex2.txt +++ /dev/null @@ -1,6 +0,0 @@ -!!ARBvp1.0 -TEMP R0; -EX2 R0, vertex.color.x; -SUB result.color, R0, {1.0}.x; -MOV result.position, vertex.position; -END diff --git a/progs/vp/flr.txt b/progs/vp/flr.txt deleted file mode 100644 index c33280da97..0000000000 --- a/progs/vp/flr.txt +++ /dev/null @@ -1,6 +0,0 @@ -!!ARBvp1.0 -TEMP R0; -ADD R0, vertex.color, {0.5}.x; -FLR result.color, R0; -MOV result.position, vertex.position; -END diff --git a/progs/vp/frc.txt b/progs/vp/frc.txt deleted file mode 100644 index d8e72b60cc..0000000000 --- a/progs/vp/frc.txt +++ /dev/null @@ -1,6 +0,0 @@ -!!ARBvp1.0 -TEMP R0; -MUL R0, vertex.color, {3.0}.x; -FRC result.color, R0; -MOV result.position, vertex.position; -END diff --git a/progs/vp/lg2.txt b/progs/vp/lg2.txt deleted file mode 100644 index 2f59b993a4..0000000000 --- a/progs/vp/lg2.txt +++ /dev/null @@ -1,6 +0,0 @@ -!!ARBvp1.0 -TEMP R0; -MUL R0, vertex.color, {4.0}.x; -LG2 result.color, R0.x; -MOV result.position, vertex.position; -END diff --git a/progs/vp/lit.txt b/progs/vp/lit.txt deleted file mode 100644 index 65705b4170..0000000000 --- a/progs/vp/lit.txt +++ /dev/null @@ -1,6 +0,0 @@ -!!ARBvp1.0 -TEMP R0; -SUB R0, {0.5}.x, vertex.color; -LIT result.color, R0; -MOV result.position, vertex.position; -END diff --git a/progs/vp/mad.txt b/progs/vp/mad.txt deleted file mode 100644 index 0c9ed6c8b7..0000000000 --- a/progs/vp/mad.txt +++ /dev/null @@ -1,5 +0,0 @@ -!!ARBvp1.0 -MAD result.color, vertex.color.z, {1,0,0,1}, vertex.color; -MOV result.position, vertex.position; -END - diff --git a/progs/vp/max.txt b/progs/vp/max.txt deleted file mode 100644 index 6747ca5727..0000000000 --- a/progs/vp/max.txt +++ /dev/null @@ -1,5 +0,0 @@ -!!ARBvp1.0 -MAX result.color, {0.5}.x, vertex.color; -MOV result.position, vertex.position; -END - diff --git a/progs/vp/min.txt b/progs/vp/min.txt deleted file mode 100644 index 2adc872ed9..0000000000 --- a/progs/vp/min.txt +++ /dev/null @@ -1,5 +0,0 @@ -!!ARBvp1.0 -MIN result.color, {0.5}.x, vertex.color; -MOV result.position, vertex.position; -END - diff --git a/progs/vp/mov.txt b/progs/vp/mov.txt deleted file mode 100644 index 9ce1a45306..0000000000 --- a/progs/vp/mov.txt +++ /dev/null @@ -1,5 +0,0 @@ -!!ARBvp1.0 -MOV result.color, vertex.color; -MOV result.position, vertex.position; -END - diff --git a/progs/vp/mul.txt b/progs/vp/mul.txt deleted file mode 100644 index e479cdb854..0000000000 --- a/progs/vp/mul.txt +++ /dev/null @@ -1,5 +0,0 @@ -!!ARBvp1.0 -MUL result.color, vertex.color, vertex.color; -MOV result.position, vertex.position; -END - diff --git a/progs/vp/pow.txt b/progs/vp/pow.txt deleted file mode 100644 index 512412997d..0000000000 --- a/progs/vp/pow.txt +++ /dev/null @@ -1,5 +0,0 @@ -!!ARBvp1.0 -POW result.color, vertex.color.x, vertex.color.y; -MOV result.position, vertex.position; -END - diff --git a/progs/vp/rcp.txt b/progs/vp/rcp.txt deleted file mode 100644 index e16292bd00..0000000000 --- a/progs/vp/rcp.txt +++ /dev/null @@ -1,7 +0,0 @@ -!!ARBvp1.0 -TEMP R0; -ADD R0, vertex.color.x, vertex.color.x; -RCP result.color, R0.x; -MOV result.position, vertex.position; -END - diff --git a/progs/vp/rsq.txt b/progs/vp/rsq.txt deleted file mode 100644 index 3e3f3251ee..0000000000 --- a/progs/vp/rsq.txt +++ /dev/null @@ -1,7 +0,0 @@ -!!ARBvp1.0 -TEMP R0; -MUL R0, vertex.color, {3.0}.x; -RSQ result.color, R0.x; -MOV result.position, vertex.position; -END - diff --git a/progs/vp/sge.txt b/progs/vp/sge.txt deleted file mode 100644 index 3fa82e5d5e..0000000000 --- a/progs/vp/sge.txt +++ /dev/null @@ -1,5 +0,0 @@ -!!ARBvp1.0 -SGE result.color, {0.5}.x, vertex.color; -MOV result.position, vertex.position; -END - diff --git a/progs/vp/slt.txt b/progs/vp/slt.txt deleted file mode 100644 index 6bf8ffa775..0000000000 --- a/progs/vp/slt.txt +++ /dev/null @@ -1,5 +0,0 @@ -!!ARBvp1.0 -SLT result.color, {0.5}.x, vertex.color; -MOV result.position, vertex.position; -END - diff --git a/progs/vp/sub.txt b/progs/vp/sub.txt deleted file mode 100644 index a58ab101bc..0000000000 --- a/progs/vp/sub.txt +++ /dev/null @@ -1,5 +0,0 @@ -!!ARBvp1.0 -SUB result.color, vertex.color.yzxw, vertex.color; -MOV result.position, vertex.position; -END - diff --git a/progs/vp/swz.txt b/progs/vp/swz.txt deleted file mode 100644 index 92c58089b1..0000000000 --- a/progs/vp/swz.txt +++ /dev/null @@ -1,5 +0,0 @@ -!!ARBvp1.0 -MOV result.color, vertex.color.xxzx; -MOV result.position, vertex.position; -END - diff --git a/progs/vp/swz2.txt b/progs/vp/swz2.txt deleted file mode 100644 index 84c78db49f..0000000000 --- a/progs/vp/swz2.txt +++ /dev/null @@ -1,5 +0,0 @@ -!!ARBvp1.0 -SWZ result.color, vertex.color, 1,x,y,z; -MOV result.position, vertex.position; -END - diff --git a/progs/vp/vp-tris.c b/progs/vp/vp-tris.c deleted file mode 100644 index 5dbe5ac835..0000000000 --- a/progs/vp/vp-tris.c +++ /dev/null @@ -1,216 +0,0 @@ -/* Test glGenProgramsNV(), glIsProgramNV(), glLoadProgramNV() */ - -#include -#include -#include -#include -#include -#define GL_GLEXT_PROTOTYPES -#include - -static const char *filename = NULL; -static GLuint nr_steps = 4; - -static void usage( char *name ) -{ - fprintf( stderr, "usage: %s [ options ] shader_filename\n", name ); - fprintf( stderr, "\n" ); - fprintf( stderr, "options:\n" ); - fprintf( stderr, " -f flat shaded\n" ); - fprintf( stderr, " -nNr subdivision steps\n" ); -} - - -static void args(int argc, char *argv[]) -{ - GLint i; - - for (i = 1; i < argc; i++) { - if (strncmp(argv[i], "-n", 2) == 0) { - nr_steps = atoi((argv[i]) + 2); - } - else if (strcmp(argv[i], "-f") == 0) { - glShadeModel(GL_FLAT); - } - else if (i == argc - 1) { - filename = argv[i]; - } - else { - usage(argv[0]); - exit(1); - } - } - - if (!filename) { - usage(argv[0]); - exit(1); - } -} - - - -static void Init( void ) -{ - GLint errno; - GLuint prognum; - char buf[4096]; - GLuint sz; - FILE *f; - - if ((f = fopen(filename, "r")) == NULL) { - fprintf(stderr, "couldn't open %s\n", filename); - exit(1); - } - - sz = fread(buf, 1, sizeof(buf), f); - if (!feof(f)) { - fprintf(stderr, "file too long\n"); - exit(1); - } - - fprintf(stderr, "%.*s\n", sz, buf); - - glGenProgramsARB(1, &prognum); - - glBindProgramARB(GL_VERTEX_PROGRAM_ARB, prognum); - glProgramStringARB(GL_VERTEX_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, - sz, (const GLubyte *) buf); - - errno = glGetError(); - printf("glGetError = %d\n", errno); - if (errno != GL_NO_ERROR) - { - GLint errorpos; - - glGetIntegerv(GL_PROGRAM_ERROR_POSITION_ARB, &errorpos); - printf("errorpos: %d\n", errorpos); - printf("%s\n", (char *)glGetString(GL_PROGRAM_ERROR_STRING_ARB)); - } - assert(glIsProgramARB(prognum)); -} - - -union vert { - struct { - GLfloat color[3]; - GLfloat pos[3]; - } v; - GLfloat f[6]; -}; - -static void make_midpoint( union vert *out, - const union vert *v0, - const union vert *v1) -{ - int i; - for (i = 0; i < 6; i++) - out->f[i] = v0->f[i] + .5 * (v1->f[i] - v0->f[i]); -} - -static void subdiv( union vert *v0, - union vert *v1, - union vert *v2, - GLuint depth ) -{ - if (depth == 0) { - glColor3fv(v0->v.color); - glVertex3fv(v0->v.pos); - glColor3fv(v1->v.color); - glVertex3fv(v1->v.pos); - glColor3fv(v2->v.color); - glVertex3fv(v2->v.pos); - } - else { - union vert m[3]; - - make_midpoint(&m[0], v0, v1); - make_midpoint(&m[1], v1, v2); - make_midpoint(&m[2], v2, v0); - - subdiv(&m[0], &m[2], v0, depth-1); - subdiv(&m[1], &m[0], v1, depth-1); - subdiv(&m[2], &m[1], v2, depth-1); - subdiv(&m[0], &m[1], &m[2], depth-1); - } -} - -/** Assignment */ -#define ASSIGN_3V( V, V0, V1, V2 ) \ -do { \ - V[0] = V0; \ - V[1] = V1; \ - V[2] = V2; \ -} while(0) - -static void Display( void ) -{ - glClearColor(0.3, 0.3, 0.3, 1); - glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); - - glEnable(GL_VERTEX_PROGRAM_NV); - - glBegin(GL_TRIANGLES); - - - { - union vert v[3]; - - ASSIGN_3V(v[0].v.color, 0,0,1); - ASSIGN_3V(v[0].v.pos, 0.9, -0.9, 0.0); - ASSIGN_3V(v[1].v.color, 1,0,0); - ASSIGN_3V(v[1].v.pos, 0.9, 0.9, 0.0); - ASSIGN_3V(v[2].v.color, 0,1,0); - ASSIGN_3V(v[2].v.pos, -0.9, 0, 0.0); - - subdiv(&v[0], &v[1], &v[2], nr_steps); - } - - glEnd(); - - - glFlush(); -} - - -static void Reshape( int width, int height ) -{ - glViewport( 0, 0, width, height ); - glMatrixMode( GL_PROJECTION ); - glLoadIdentity(); - glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0); - glMatrixMode( GL_MODELVIEW ); - glLoadIdentity(); - /*glTranslatef( 0.0, 0.0, -15.0 );*/ -} - - -static void Key( unsigned char key, int x, int y ) -{ - (void) x; - (void) y; - switch (key) { - case 27: - exit(0); - break; - } - glutPostRedisplay(); -} - - - - -int main( int argc, char *argv[] ) -{ - glutInit( &argc, argv ); - glutInitWindowPosition( 0, 0 ); - glutInitWindowSize( 250, 250 ); - glutInitDisplayMode( GLUT_RGB | GLUT_SINGLE | GLUT_DEPTH ); - glutCreateWindow(argv[0]); - glutReshapeFunc( Reshape ); - glutKeyboardFunc( Key ); - glutDisplayFunc( Display ); - args( argc, argv ); - Init(); - glutMainLoop(); - return 0; -} diff --git a/progs/vp/xpd.txt b/progs/vp/xpd.txt deleted file mode 100644 index b8818ebc60..0000000000 --- a/progs/vp/xpd.txt +++ /dev/null @@ -1,5 +0,0 @@ -!!ARBvp1.0 -XPD result.color, vertex.color, {2,2,2,0}; -MOV result.position, vertex.position; -END - diff --git a/progs/xdemos/.gitignore b/progs/xdemos/.gitignore deleted file mode 100644 index 084dee5d84..0000000000 --- a/progs/xdemos/.gitignore +++ /dev/null @@ -1,26 +0,0 @@ -corender -glsync -glthreads -glxcontexts -glxdemo -glxgears -glxgears_fbconfig -glxgears_pixmap -glxheads -glxinfo -glxpbdemo -glxpixmap -glxsnoop -glxswapcontrol -manywin -offset -overlay -pbdemo -pbinfo -sharedtex -texture_from_pixmap -wincopy -xdemo -xfont -xrotfontdemo -yuvrect_client diff --git a/src/egl/Makefile b/src/egl/Makefile deleted file mode 100644 index fb4db8f9b9..0000000000 --- a/src/egl/Makefile +++ /dev/null @@ -1,24 +0,0 @@ -# src/egl/Makefile - -TOP = ../.. - -SUBDIRS = main drivers/demo drivers/dri - - -default: subdirs - - -subdirs: - @for dir in $(SUBDIRS) ; do \ - if [ -d $$dir ] ; then \ - (cd $$dir && $(MAKE)) || exit 1 ; \ - fi \ - done - - -clean: - -@for dir in $(SUBDIRS) ; do \ - if [ -d $$dir ] ; then \ - (cd $$dir && $(MAKE) clean) ; \ - fi \ - done diff --git a/src/egl/docs/EGL_MESA_screen_surface b/src/egl/docs/EGL_MESA_screen_surface deleted file mode 100644 index 6beb4ce88e..0000000000 --- a/src/egl/docs/EGL_MESA_screen_surface +++ /dev/null @@ -1,564 +0,0 @@ -Name - - MESA_screen_surface - -Name Strings - - EGL_MESA_screen_surface - -Contact - - Brian Paul - - To discuss, join the dri-egl@lists.freedesktop.org list. - -Status - - Preliminary - totally subject to change. - -Version - - 11 (27 January 2006) - -Number - - TBD - -Dependencies - - EGL 1.0 or later. - -Overview - - EGL 1.1 supports three types of drawing surfaces: - * Window surfaces - * Pixmap surfaces - * Pbuffer surfaces - This extension defines a fourth type of drawing surface: - * Screen surface - - A screen surface is a surface for which the (front) color buffer can - be directly displayed (i.e. scanned out) on a monitor (such as a flat - panel or CRT). In particular the color buffer memory will be allocated - at a location in VRAM (and in a suitable format) which can be displayed - by the graphics hardware. - - Note that the width and height of the screen surface need not exactly - match the monitor's current resolution. For example, while the monitor - may be configured to to show 1024x768 pixels, the associated screen - surface may be larger, such as 1200x1000. The "screen origin" attribute - will specify which region of the screen surface which is visible on the - monitor. The screen surface can be scrolled by changing this origin. - - This extension also defines functions for controlling the monitor's - display mode (width, height, refresh rate, etc), and specifing which - screen surface is to be displayed on a monitor. - - The new EGLModeMESA type and related functions are very similar to the - EGLConfig type and related functions. The user may get a list of - supported modes for a screen and specify the mode to be used when - displaying a screen surface. - - -Issues - - 1. Should EGL_INTERLACE be a supported mode attribute? - - Arguments against: - - No, this should be provided by another extension which would - also provide the mechanisms needed to play back interlaced video - material correctly on hardware that supports it. - This extension should prefer non-interlaced modes. [M. Danzer] - - Arguments for: - - An interlaced display can be of use without considering video - material. Being able to query whether a screen is operating in - interlaced mode can be used by applications to control their - drawing. For example: avoid drawing 1-pixel-wide horizontal lines - if screen is interlaced. [B. Paul] - - Resolution: Defer for future extension? - - - 2. Should EGL_REFRESH_RATE be a supported mode attribute? - - Arguments for: - - Yes, it's been shown that applications and/or users need to select - modes by this. [M. Danzer] - - Many examples have been given in which it's desirable to let the - user choose from a variety of refresh rates without having to - restart/reconfigure. [B. Paul] - - Arguments against: - - TBD. - - Resolution: Yes. - - - 3. Exactly how should the list of modes returned by eglChooseConfigMESA - be sorted? - - Current method is described in the text below. Subject to change. - - Alternately, leave the sorting order undefined so that each - implementation can return the modes in order of "most desirable" - to "least desirable" which may depend on the display technology - (CRT vs LCD, etc) or other factors. - - - 4. How should screen blanking be supported? Note that a screen can be - disabled or turned off by calling eglShowSurface(dpy, scrn, - EGL_NO_SURFACE, EGL_NO_MODE_MESA). But what about power-save mode? - - I would defer this to other extensions that depend on this one. - I can imagine people wanting different semantics not just in - relation to the power management API being exposed (DPMS or whatever) - but also relating to what events can trigger EGL_CONTEXT_LOST. Also - I'm not sure whether power management commands are properly operations - on the Display or on a screen surface. [A. Jackson] - - - 5. Should the EGL_PHYSICAL_SIZE_EGL query be kept? The size information - isn't always reliable (consider video projectors) but can still be - used to determine the pixel aspect ratio. - - Resolution: Omit. The EGL 1.2 specification includes queries for - the display resolution and pixel aspect ratio. - - - 6. Should detailed mode timing information be exposed by this API? - - Probably not. Instead, offer that information in a layered extension. - - - 7. How should the notion of a screen's "native" mode be expressed? - For example, LCD panels have a native resolution and refresh rate - that looks best but other sub-optimal resolutions may be supported. - - The mode attribute EGL_OPTIMAL_MESA will be set for modes which - best match the screen. [M. Danzer] - - - 8. Should eglQueryModeStringMESA() be included? This function returns - a human-readable string which corresponds to an EGLMode. - - Arguments for: - - A mode name such as "HDTV-720P" might mean more to users than - "1280x720@60Hz" if the later were generated via code. - - Arguments against: - - There's no standard syntax for the strings. May cause more - trouble than it's worth. - - Postpone for future extension. [A. Jackson] - - Latest discussion leaning toward omitting this function. - - - 9. Should we use "Get" or "Query" for functions which return state? - The EGL 1.x specification doesn't seem to be totally consistent - in this regard, but "Query" is used more often. - - Use "Get" for mode-related queries (as for EGLConfigs) but "Query" - for everything else. - - - 10. What should be the default size for screen surfaces? - - For Pbuffer surfaces the default width and height are zero. - We'll do the same for screen surfaces. Since there's no function - to resize surfaces it's useless to have a 0x0 screen, but this isn't - a situation that'll normally be encountered. - - - 11. Should there be a function for resizing a screen surface? - - Suppose one wants to change the screen's size in the EGL application. - Also suppose there's a hardware restriction such that only one screen - surface can exist at a time (either for lack of memory or because of - memory layout restrictions). - - The basic idea is that the currently displayed screen surface must - be deallocated before a new one can be created. Perhaps a resize - function would work better? - - - 12. How should sub-pixel LCD color information be made available? - What about the display's gamma value? - - Perhaps expose as additional read-only mode attributes. - - Perhaps postpone for a layered extension. - - - 13. What happens if the user attempts to delete a screen surface that - is currently being shown? - - Spec currently says that's illegal and that an error (TBD) will be - generated. - - - 14. What if the physical screen size can't be determined? Should - a query of EGL_PHYSICAL_SIZE_MESA return [0,0]? - - Obsolete: EGL_PHYSICAL_SIZE_MESA not used. - - - 15. Suppose the device's number of RAMDACs is different from the - number of output ports. For example, a graphics card with - two RAMDACs but three ports (VGA, DVI, TV). - - Address this in a follow-on extension. [Matthias Hopf] - - - 16. How should we deal with on-the-fly device changes? For example, - the monitor being unplugged and replaced by another with different - characteristics? - - A HAL event could be received via DBUS in the application [J. Smirl, - A. Jackson]. - - Should there be an EGL mechanism for detecting this? Maybe an - EGL_SCREEN_LOST error (similar to EGL_CONTEXT_LOST) can be recorded - when there's a screen change. At least then the application can - poll to detect this situation. - - Maybe leave that to a future extension. - - See also the EGL_SCREEN_COUNT_MESA query. - - - 17. What if pixel-accurate panning is not supported (see - eglScreenPositionMESA)? [M. Danzer] - - Is this a common problem? Can we ignore it for now? - - - 18. Should eglShowSurfaceMESA be renamed to eglShowScreenSurfaceMESA? - - Probably. - - - -New Procedures and Functions - - EGLBoolean eglChooseModeMESA(EGLDisplay dpy, EGLScreenMESA screen, - const EGLint *attrib_list, - EGLModeMESA *modes, EGLint modes_size, - EGLint *num_modes) - - EGLBoolean eglGetModesMESA(EGLDisplay dpy, EGLScreenMESA screen, - EGLModeMESA *modes, EGLint modes_size, - EGLint *num_modes) - - EGLBoolean eglGetModeAttribMESA(EGLDisplay dpy, EGLModeMESA mode, - EGLint attrib, EGLint *value) - - - EGLBoolean eglGetScreensMESA(EGLDisplay dpy, EGLScreenMESA *screens, - EGLint screens_size, EGLint *num_screens) - - EGLSurface eglCreateScreenSurfaceMESA(EGLDisplay dpy, EGLConfig config, - const EGLint *attrib_list) - - EGLBoolean eglShowSurfaceMESA(EGLDisplay dpy, EGLScreenMESA screen, - EGLSurface surface, EGLModeMESA mode) - - EGLBoolean eglScreenPositionMESA(EGLDisplay dpy, EGLScreenMESA screen, - EGLint x, EGLint y) - - - EGLBoolean eglQueryScreenMESA(EGLDisplay dpy, EGLScreenMESA screen, - EGLint attrib, EGLint *value); - - EGLBoolean eglQueryScreenSurfaceMESA(EGLDisplay dpy, EGLScreenMESA screen, - EGLSurface *surface) - - EGLBoolean eglQueryScreenModeMESA(EGLDisplay dpy, EGLScreenMESA screen, - EGLModeMESA *mode) - - const char *eglQueryModeStringMESA(EGLDisplay dpy, EGLMode mode); - - -New Types - - EGLModeMESA - EGLScreenMESA - -New Tokens - - New error codes: - - EGL_BAD_SCREEN_MESA - EGL_BAD_MODE_MESA - - Screen-related tokens: - - EGL_SCREEN_COUNT_MESA - EGL_SCREEN_POSITION_MESA - EGL_SCREEN_BIT_MESA - EGL_SCREEN_POSITION_GRANULARITY_MESA - - Mode-related tokens: - - EGL_MODE_ID_MESA - EGL_REFRESH_RATE_MESA - EGL_INTERLACED_MESA - EGL_OPTIMAL_MESA - EGL_NO_MODE_MESA - - -Additions to Chapter X of the EGL 1.1 Specification - - [XXX this all has to be rewritten to fit into the EGL specification - and match the conventions of an EGL extension. For now, just list - all the functions with brief descriptions.] - - - EGLBoolean eglChooseModeMESA(EGLDisplay dpy, const EGLScreenMESA screen, - EGLint *attrib_list, EGLModeMESA *modes, - EGLint modes_size, EGLint *num_modes) - - Like eglChooseConfig, returns a list of EGLModes which match the given - attribute list. This does not set the screen's current display mode. - The attribute list is a list of token/value pairs terminated with - EGL_NONE. Supported attributes include: - - Name Description - --------------------- --------------------------------------------- - EGL_WIDTH Mode width (resolution) - EGL_HEIGHT Mode height (resolution) - EGL_REFRESH_RATE_MESA The mode's refresh rate, multiplied by 1000 - EGL_INTERLACED_MESA 1 indicates an interlaced mode, 0 otherwise - EGL_OPTIMAL_MESA Set if the most is especially optimal for the - screen (ex. for particular LCD resolutions) - - Any other token will generate the error EGL_BAD_ATTRIBUTE. - - The list of modes returned by eglChooseModeMESA will be sorted - according to the following criteria. See the discussion of table 3.3 - in the EGL specification for more information. - - Selection Sort Sort - Attribute Default Criteria Order Priority - -------------------- -------------- ----------- ------ -------- - EGL_OPTIMAL_MESA EGL_DONT_CARE Exact 1,0 1 - EGL_INTERLACED_MESA EGL_DONT_CARE Exact 0,1 2 - EGL_REFRESH_RATE EGL_DONT_CARE AtLeast Larger 3 - EGL_WIDTH EGL_DONT_CARE AtLeast Larger 4 - EGL_HEIGHT EGL_DONT_CARE AtLeast Larger 5 - EGL_MODE_ID_MESA EGL_DONT_CARE Exact Smaller 6 - - - EGLBoolean eglGetModesMESA(EGLDisplay dpy, EGLScreenMESA screen, - EGLModeMESA *modes, EGLint modes_size, - EGLint *num_modes) - - Like eglGetConfigs, returns a list of all modes supported by the - given screen. The returned modes will be sorted in the same manner - as for eglChooseModeMESA(). - - - - EGLBoolean eglGetModeAttribMESA(EGLDisplay dpy, EGLModeMESA mode, - EGLint attrib, EGLint *value) - - Used to query mode attributes. The following attributes are supported: - - Name Return value description - --------------------- ---------------------------------------------- - EGL_OPTIMAL_MESA 1 indicates an optimal mode, 0 otherwise - EGL_INTERLACED_MESA 1 indicates an interlaced mode, 0 otherwise - EGL_REFRESH_RATE_MESA The mode's refresh rate, multiplied by 1000 - EGL_WIDTH Mode width (resolution) - EGL_HEIGHT Mode height (resolution) - EGL_MODE_ID_MESA A unique small integer identifier for the mode - - Any other token will generate the error EGL_BAD_ATTRIBUTE. - - - - EGLBoolean eglGetScreensMESA(EGLDisplay dpy, EGLScreenMESA *screens, - EGLint screens_size, EGLint *num_screens) - - This function returns an array of all available screen handles. - is the maximum number of screens to return in the - array. will return the number of screen handles - placed in the array, even if is NULL. - - The number of screens and the availability of each may change over - time (hot-plugging). Screen handles will not be reused. When a - screen handle becomes invalid, function calls which reference an - invalid handle will generate EGL_BAD_SCREEN_MESA. - - The first screen handle returned will be considered to be the primary - one. - - - - EGLSurface eglCreateScreenSurfaceMESA(EGLDisplay dpy, EGLConfig config, - const EGLint *attrib_list) - - Create a surface that can be displayed on a screen. is - an array of token/value pairs terminated with EGL_NONE. Valid tokens - include: - - Name Description - ---------------- -------------------------------- - EGL_WIDTH desired surface width in pixels - EGL_HEIGHT desired surface height in pixels - - Any other token will generate the error EGL_BAD_ATTRIBUTE. - The default width and height are zero. - - - - EGLBoolean eglShowSurfaceMESA(EGLDisplay dpy, EGLScreenMESA screen, - EGLSurface surface, EGLModeMESA mode) - - This function causes a screen to show the given surface (or more - precisely, the surface's front color buffer) with the given mode. - - If the surface is in any way incompatible with the mode, the error - EGL_BAD_MATCH will be generated, EGL_FALSE will be returned, and the - previous screen state will remain in effect. This might occur when - the bandwidth of the video-out subsystem is exceeded, or if the mode - specifies a width or height that's greater than the width or height - of the surface. - - To disable a screen, the values EGL_NO_SURFACE and EGL_NO_MODE_MESA - be passed as the and parameters. - - The values of EGL_SCREEN_POSITION_MESA are clamped to the new valid - range computed from the screen size and surface size. If the new - surface is EGL_NO_SURFACE, EGL_SCREEN_POSITION_MESA is set to [0, 0]. - - - Attempting to delete a screen surface which is currently being - displayed will result in the error EGL_BAD_ACCESS being generated. - - - - EGLBoolean eglScreenPositionMESA(EGLDisplay dpy, EGLScreenMESA screen, - EGLint x, EGLint y) - - Specifies the origin of the screen's view into the surface, if the - surface is larger than the screen. Valid values for x and y are - [0, surfaceWidth - screenWidth] and [0, surfaceHeight - screenHeight], - respectively. - - The x and y values are also constrained to be integer multiples of the - EGL_SCREEN_POSITION_GRANULARITY_MESA values. - - - - - EGLBoolean eglQueryScreenMESA(EGLDisplay dpy, EGLScreenMESA screen, - EGLint attrib, EGLint *value); - - Used to query screen attributes. may be one of the following: - - Name Return value description - ------------------------ --------------------------------------------- - EGL_SCREEN_POSITION_MESA x, y position of the screen's origin with - respect to the surface. If no surface is - attached to the screen, [0, 0] is returned. - EGL_SCREEN_POSITION_GRANULARITY_MESA - Returns the granularity, in pixels, for - which the screen position is constrained. - - Any other token will generate the error EGL_BAD_ATTRIBUTE. - - - - - EGLBoolean eglQueryScreenSurfaceMESA(EGLDisplay dpy, EGLScreenMESA screen, - EGLSurface *surface) - - Returns the surface currently displayed on the given screen. - may be EGL_NO_SURFACE if the screen isn't currently showing any surface. - - - - - EGLBoolean eglQueryScreenModeMESA(EGLDisplay dpy, EGLScreenMESA screen, - EGLModeMESA *mode) - - Returns the given screen's current display mode. The mode may be - EGL_NO_MODE_MESA if the screen is currently disabled. - - - - const char *eglQueryModeStringMESA(EGLDisplay dpy, EGLModeMESA mode); - - Returns a human-readable string for the given mode. The string is a - zero-terminated C string which the user should not attempt to free. - There is no standard syntax for mode strings. Applications should - not directly rely on mode strings. - - - -Version History - - 1. 15 March 2005 - BrianP - Initial version - - 2. 16 March 2005 - BrianP - Removed EGL_DEPTH_MESA - Added EGL_PHYSICAL_WIDTH_MESA, EGL_PHYSICAL_HEIGHT_MESA queries - Added EGL_OPTIMAL_MESA for width/height/refresh rate selection - Added possible eglQueryModeStringMESA() function - More details of the new functions explained. - - 3. 18 March 2005 - BrianP - Added screen_number to eglChooseModeMESA(). - Fix off by one mistake in value range for ORIGIN attributes - Added Issues section - - 4. 21 March 2005 - BrianP - Removed eglScreenAttribsMESA(). - Added eglScreenPositionMESA() to set screen origin. - Replaced EGL_SCREEN_X/Y_OFFSET_MESA with EGL_SCREEN_POSITION_MESA. - Replaced EGL_PHYSICAL_WIDTH/HEIGHT_MESA with EGL_PHYSICAL_SIZE_MESA. - Use EGL_OPTIMAL_MESA as a new mode attribute. (Michel Danzer) - Added a few more issues. - - 5. 6 April 2005 - BrianP - More language for eglGetModeStringMESA(). - Added issues 10, 11, 12, 13, 14. - Updated issue 3 discussion about mode sorting. - - 6. 22 April 2005 - BrianP - Fixed "LDC" typo. - Added issues 15, 16. - Changed dependency on EGL 1.1 to EGL 1.0 - s/EGL_NUM_SCREENS_MESA/EGL_SCREEN_COUNT_MESA/ - Added eglQueryDisplayMESA() to New Functions section. - Clarified language for the EGL_SCREEN_COUNT_MESA query. - - 7. 29 April 2005 - BrianP - Added EGLScreenMESA type and eglGetScreensMESA() function. [J. Smirl]. - Replaced EGLint screen_number parameters with EGLScreenMESA screen. - Added issue 17 (pixel-accurate panning) - - 8. 2 May 2005 - BrianP - Removed eglQueryDisplayMESA. - Fixed a few more EGLint -> EGLScreenMESA changes. - - 9. 20 May 2005 - BrianP - Fixed a few typos. - Updated some open issues text. - - 10. 10 August 2005 - BrianP - Added EGL_SCREEN_POSITION_GRANULARITY_MESA. - - 11. 27 January 2006 - BrianP - EGL_PHYSICAL_SIZE_MESA removed since EGL 1.2 has a similar feature. - diff --git a/src/egl/drivers/demo/Makefile b/src/egl/drivers/demo/Makefile deleted file mode 100644 index 6ca25aa5d6..0000000000 --- a/src/egl/drivers/demo/Makefile +++ /dev/null @@ -1,32 +0,0 @@ -# src/egl/drivers/demo/Makefile - -TOP = ../../../.. -include $(TOP)/configs/current - - -INCLUDE_DIRS = -I$(TOP)/include -I$(TOP)/src/egl/main - - -SOURCES = demo.c - -OBJECTS = $(SOURCES:.c=.o) - - -.c.o: - $(CC) -c $(INCLUDE_DIRS) $(CFLAGS) $< -o $@ - - - -default: $(TOP)/$(LIB_DIR)/demodriver.so - - -$(TOP)/$(LIB_DIR)/demodriver.so: $(OBJECTS) - $(MKLIB) -o demodriver.so -noprefix -linker '$(CC)' \ - -ldflags '$(LDFLAGS)' -install $(TOP)/$(LIB_DIR) \ - $(OBJECTS) - - - -clean: - -rm -f *.o - -rm -f *.so diff --git a/src/egl/drivers/demo/demo.c b/src/egl/drivers/demo/demo.c deleted file mode 100644 index 45545755c0..0000000000 --- a/src/egl/drivers/demo/demo.c +++ /dev/null @@ -1,316 +0,0 @@ -/* - * Sample driver: Demo - */ - -#include -#include -#include -#include "eglconfig.h" -#include "eglcontext.h" -#include "egldisplay.h" -#include "egldriver.h" -#include "eglglobals.h" -#include "eglmode.h" -#include "eglscreen.h" -#include "eglsurface.h" - - -/** - * Demo driver-specific driver class derived from _EGLDriver - */ -typedef struct demo_driver -{ - _EGLDriver Base; /* base class/object */ - GLuint DemoStuff; -} DemoDriver; - -#define DEMO_DRIVER(D) ((DemoDriver *) (D)) - - -/** - * Demo driver-specific surface class derived from _EGLSurface - */ -typedef struct demo_surface -{ - _EGLSurface Base; /* base class/object */ - GLuint DemoStuff; -} DemoSurface; - - -/** - * Demo driver-specific context class derived from _EGLContext - */ -typedef struct demo_context -{ - _EGLContext Base; /* base class/object */ - GLuint DemoStuff; -} DemoContext; - - - -static EGLBoolean -demoInitialize(_EGLDriver *drv, EGLDisplay dpy, EGLint *major, EGLint *minor) -{ - _EGLDisplay *disp = _eglLookupDisplay(dpy); - _EGLScreen *scrn; - EGLint i; - - /* Create a screen */ - scrn = calloc(1, sizeof(*scrn)); - _eglAddScreen(disp, scrn); - - /* Create the screen's modes - silly example */ - _eglAddNewMode(scrn, 1600, 1200, 72 * 1000, "1600x1200-72"); - _eglAddNewMode(scrn, 1280, 1024, 72 * 1000, "1280x1024-70"); - _eglAddNewMode(scrn, 1280, 1024, 70 * 1000, "1280x1024-70"); - _eglAddNewMode(scrn, 1024, 768, 72 * 1000, "1024x768-72"); - - /* Create the display's visual configs - silly example */ - for (i = 0; i < 4; i++) { - _EGLConfig config; - _eglInitConfig(&config, i + 1); - _eglSetConfigAttrib(&config, EGL_RED_SIZE, 8); - _eglSetConfigAttrib(&config, EGL_GREEN_SIZE, 8); - _eglSetConfigAttrib(&config, EGL_BLUE_SIZE, 8); - _eglSetConfigAttrib(&config, EGL_ALPHA_SIZE, 8); - _eglSetConfigAttrib(&config, EGL_BUFFER_SIZE, 32); - if (i & 1) { - _eglSetConfigAttrib(&config, EGL_DEPTH_SIZE, 32); - } - if (i & 2) { - _eglSetConfigAttrib(&config, EGL_STENCIL_SIZE, 8); - } - _eglSetConfigAttrib(&config, EGL_SURFACE_TYPE, - (EGL_WINDOW_BIT | EGL_PIXMAP_BIT | EGL_PBUFFER_BIT)); - _eglAddConfig(disp, &config); - } - - drv->Initialized = EGL_TRUE; - - *major = 1; - *minor = 0; - - return EGL_TRUE; -} - - -static EGLBoolean -demoTerminate(_EGLDriver *drv, EGLDisplay dpy) -{ - /*DemoDriver *demo = DEMO_DRIVER(dpy);*/ - free(drv); - return EGL_TRUE; -} - - -static DemoContext * -LookupDemoContext(EGLContext ctx) -{ - _EGLContext *c = _eglLookupContext(ctx); - return (DemoContext *) c; -} - - -static DemoSurface * -LookupDemoSurface(EGLSurface surf) -{ - _EGLSurface *s = _eglLookupSurface(surf); - return (DemoSurface *) s; -} - - - -static EGLContext -demoCreateContext(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config, EGLContext share_list, const EGLint *attrib_list) -{ - _EGLConfig *conf; - DemoContext *c; - int i; - - conf = _eglLookupConfig(drv, dpy, config); - if (!conf) { - _eglError(EGL_BAD_CONFIG, "eglCreateContext"); - return EGL_NO_CONTEXT; - } - - for (i = 0; attrib_list && attrib_list[i] != EGL_NONE; i++) { - switch (attrib_list[i]) { - /* no attribs defined for now */ - default: - _eglError(EGL_BAD_ATTRIBUTE, "eglCreateContext"); - return EGL_NO_CONTEXT; - } - } - - c = (DemoContext *) calloc(1, sizeof(DemoContext)); - if (!c) - return EGL_NO_CONTEXT; - - _eglInitContext(drv, dpy, &c->Base, config, attrib_list); - c->DemoStuff = 1; - printf("demoCreateContext\n"); - - /* generate handle and insert into hash table */ - _eglSaveContext(&c->Base); - assert(c->Base.Handle); - - return c->Base.Handle; -} - - -static EGLSurface -demoCreateWindowSurface(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config, NativeWindowType window, const EGLint *attrib_list) -{ - int i; - for (i = 0; attrib_list && attrib_list[i] != EGL_NONE; i++) { - switch (attrib_list[i]) { - /* no attribs at this time */ - default: - _eglError(EGL_BAD_ATTRIBUTE, "eglCreateWindowSurface"); - return EGL_NO_SURFACE; - } - } - printf("eglCreateWindowSurface()\n"); - /* XXX unfinished */ - - return EGL_NO_SURFACE; -} - - -static EGLSurface -demoCreatePixmapSurface(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config, NativePixmapType pixmap, const EGLint *attrib_list) -{ - _EGLConfig *conf; - EGLint i; - - conf = _eglLookupConfig(drv, dpy, config); - if (!conf) { - _eglError(EGL_BAD_CONFIG, "eglCreatePixmapSurface"); - return EGL_NO_SURFACE; - } - - for (i = 0; attrib_list && attrib_list[i] != EGL_NONE; i++) { - switch (attrib_list[i]) { - /* no attribs at this time */ - default: - _eglError(EGL_BAD_ATTRIBUTE, "eglCreatePixmapSurface"); - return EGL_NO_SURFACE; - } - } - - if (conf->Attrib[EGL_SURFACE_TYPE - FIRST_ATTRIB] == 0) { - _eglError(EGL_BAD_MATCH, "eglCreatePixmapSurface"); - return EGL_NO_SURFACE; - } - - printf("eglCreatePixmapSurface()\n"); - return EGL_NO_SURFACE; -} - - -static EGLSurface -demoCreatePbufferSurface(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config, - const EGLint *attrib_list) -{ - DemoSurface *surf = (DemoSurface *) calloc(1, sizeof(DemoSurface)); - if (!surf) - return EGL_NO_SURFACE; - - if (!_eglInitSurface(drv, dpy, &surf->Base, EGL_PBUFFER_BIT, - config, attrib_list)) { - free(surf); - return EGL_NO_SURFACE; - } - - /* a real driver would allocate the pbuffer memory here */ - - return surf->Base.Handle; -} - - -static EGLBoolean -demoDestroySurface(_EGLDriver *drv, EGLDisplay dpy, EGLSurface surface) -{ - DemoSurface *fs = LookupDemoSurface(surface); - _eglRemoveSurface(&fs->Base); - if (fs->Base.IsBound) { - fs->Base.DeletePending = EGL_TRUE; - } - else { - free(fs); - } - return EGL_TRUE; -} - - -static EGLBoolean -demoDestroyContext(_EGLDriver *drv, EGLDisplay dpy, EGLContext context) -{ - DemoContext *fc = LookupDemoContext(context); - _eglRemoveContext(&fc->Base); - if (fc->Base.IsBound) { - fc->Base.DeletePending = EGL_TRUE; - } - else { - free(fc); - } - return EGL_TRUE; -} - - -static EGLBoolean -demoMakeCurrent(_EGLDriver *drv, EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext context) -{ - /*DemoDriver *demo = DEMO_DRIVER(dpy);*/ - DemoSurface *readSurf = LookupDemoSurface(read); - DemoSurface *drawSurf = LookupDemoSurface(draw); - DemoContext *ctx = LookupDemoContext(context); - EGLBoolean b; - - b = _eglMakeCurrent(drv, dpy, draw, read, context); - if (!b) - return EGL_FALSE; - - /* XXX this is where we'd do the hardware context switch */ - (void) drawSurf; - (void) readSurf; - (void) ctx; - - printf("eglMakeCurrent()\n"); - return EGL_TRUE; -} - - -/** - * The bootstrap function. Return a new DemoDriver object and - * plug in API functions. - */ -_EGLDriver * -_eglMain(_EGLDisplay *dpy) -{ - DemoDriver *demo; - - demo = (DemoDriver *) calloc(1, sizeof(DemoDriver)); - if (!demo) { - return NULL; - } - - /* First fill in the dispatch table with defaults */ - _eglInitDriverFallbacks(&demo->Base); - /* then plug in our Demo-specific functions */ - demo->Base.API.Initialize = demoInitialize; - demo->Base.API.Terminate = demoTerminate; - demo->Base.API.CreateContext = demoCreateContext; - demo->Base.API.MakeCurrent = demoMakeCurrent; - demo->Base.API.CreateWindowSurface = demoCreateWindowSurface; - demo->Base.API.CreatePixmapSurface = demoCreatePixmapSurface; - demo->Base.API.CreatePbufferSurface = demoCreatePbufferSurface; - demo->Base.API.DestroySurface = demoDestroySurface; - demo->Base.API.DestroyContext = demoDestroyContext; - - /* enable supported extensions */ - demo->Base.Extensions.MESA_screen_surface = EGL_TRUE; - demo->Base.Extensions.MESA_copy_context = EGL_TRUE; - - return &demo->Base; -} diff --git a/src/egl/drivers/dri/Makefile b/src/egl/drivers/dri/Makefile deleted file mode 100644 index af0c40fe2b..0000000000 --- a/src/egl/drivers/dri/Makefile +++ /dev/null @@ -1,62 +0,0 @@ -# src/egl/drivers/dri/Makefile - -TOP = ../../../.. -include $(TOP)/configs/current - - -### Include directories -INCLUDE_DIRS = \ - -I. \ - -I/usr/include \ - -I/usr/include/drm \ - -I$(TOP)/include \ - -I$(TOP)/include/GL/internal \ - -I$(TOP)/src/mesa \ - -I$(TOP)/src/mesa/main \ - -I$(TOP)/src/mesa/glapi \ - -I$(TOP)/src/mesa/math \ - -I$(TOP)/src/mesa/transform \ - -I$(TOP)/src/mesa/shader \ - -I$(TOP)/src/mesa/swrast \ - -I$(TOP)/src/mesa/swrast_setup \ - -I$(TOP)/src/egl/main \ - -I$(TOP)/src/mesa/drivers/dri/common - - -HEADERS = egldri.h - -SOURCES = egldri.c - -OBJECTS = $(SOURCES:.c=.o) - - -.c.o: - $(CC) -c $(INCLUDE_DIRS) $(CFLAGS) $< -o $@ - - - -default: depend library Makefile - - -# EGLdri Library -library: $(TOP)/$(LIB_DIR)/libEGLdri.so - -$(TOP)/$(LIB_DIR)/libEGLdri.so: $(OBJECTS) - $(MKLIB) -o EGLdri -linker '$(CC)' -ldflags '$(LDFLAGS)' \ - -major 1 -minor 0 \ - -install $(TOP)/$(LIB_DIR) -ldl $(OBJECTS) - - -clean: - -rm -f *.o - -rm -f *.so - -depend: $(SOURCES) $(HEADERS) - @ echo "running $(MKDEP)" - @ touch depend - $(MKDEP) $(MKDEP_OPTIONS) $(DEFINES) $(INCLUDE_DIRS) \ - $(SOURCES) $(HEADERS) > /dev/null - -include depend -# DO NOT DELETE - diff --git a/src/egl/drivers/dri/egldri.c b/src/egl/drivers/dri/egldri.c deleted file mode 100644 index cab0be2bd1..0000000000 --- a/src/egl/drivers/dri/egldri.c +++ /dev/null @@ -1,1138 +0,0 @@ -/** - * Generic EGL driver for DRI. - * - * This file contains all the code needed to interface DRI-based drivers - * with libEGL. - * - * There's a lot of dependencies on fbdev and the /sys/ filesystem. - */ - - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "egldriver.h" -#include "egldisplay.h" -#include "eglcontext.h" -#include "eglconfig.h" -#include "eglsurface.h" -#include "eglscreen.h" -#include "eglglobals.h" -#include "egllog.h" -#include "eglmode.h" - -#include "egldri.h" - -const char *sysfs = "/sys/class"; -#define None 0 -static const int empty_attribute_list[1] = { None }; - - -/** - * The bootstrap function. - * Return a new driDriver object and plug in API functions. - * This function, in turn, loads a specific DRI driver (ex: r200_dri.so). - */ -_EGLDriver * -_eglMain(_EGLDisplay *dpy) -{ - int length; - char path[NAME_MAX]; - struct dirent *dirent; -#if 1 - FILE *file; -#endif - DIR *dir; - _EGLDriver *driver = NULL;; - - snprintf(path, sizeof(path), "%s/drm", sysfs); - if (!(dir = opendir(path))) { - _eglLog(_EGL_WARNING, "%s DRM devices not found.", path); - return EGL_FALSE; - } - while ((dirent = readdir(dir))) { - - if (strncmp(&dirent->d_name[0], "card", 4) != 0) - continue; - if (strcmp(&dirent->d_name[4], &dpy->Name[1]) != 0) - continue; - - snprintf(path, sizeof(path), "%s/drm/card%s/dri_library_name", sysfs, &dpy->Name[1]); - _eglLog(_EGL_INFO, "Opening %s", path); -#if 1 - file = fopen(path, "r"); - if (!file) { - _eglLog(_EGL_WARNING, "Failed to open %s", path); - return NULL; - } - fgets(path, sizeof(path), file); - fclose(file); -#else - strcpy(path, "r200\n"); -#endif - if ((length = strlen(path)) > 0) - path[length - 1] = '\0'; /* remove the trailing newline from sysfs */ - strncat(path, "_dri", sizeof(path)); - - driver = _eglOpenDriver(dpy, path); - - break; - } - closedir(dir); - - return driver; -} - - -/** - * Called by eglCreateContext via drv->API.CreateContext(). - */ -static EGLContext -_eglDRICreateContext(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config, - EGLContext share_list, const EGLint *attrib_list) -{ - driDisplay *disp = Lookup_driDisplay(dpy); - driContext *c, *share; - void *sharePriv; - _EGLConfig *conf; - __GLcontextModes visMode; - - c = (driContext *) calloc(1, sizeof(*c)); - if (!c) - return EGL_NO_CONTEXT; - - if (!_eglInitContext(drv, dpy, &c->Base, config, attrib_list)) { - free(c); - return EGL_NO_CONTEXT; - } - - if (share_list != EGL_NO_CONTEXT) { - _EGLContext *shareCtx = _eglLookupContext(share_list); - if (!shareCtx) { - _eglError(EGL_BAD_CONTEXT, "eglCreateContext(share_list)"); - return EGL_FALSE; - } - } - share = Lookup_driContext(share_list); - if (share) - sharePriv = share->driContext.private; - else - sharePriv = NULL; - - conf = _eglLookupConfig(drv, dpy, config); - assert(conf); - _eglConfigToContextModesRec(conf, &visMode); - - c->driContext.private = disp->driScreen.createNewContext(disp, &visMode, - GLX_WINDOW_BIT, sharePriv, &c->driContext); - if (!c->driContext.private) { - free(c); - return EGL_FALSE; - } - - /* generate handle and insert into hash table */ - _eglSaveContext(&c->Base); - - return c->Base.Handle; -} - - -static EGLBoolean -_eglDRIMakeCurrent(_EGLDriver *drv, EGLDisplay dpy, EGLSurface draw, - EGLSurface read, EGLContext context) -{ - driDisplay *disp = Lookup_driDisplay(dpy); - driContext *ctx = Lookup_driContext(context); - EGLBoolean b; - - b = _eglMakeCurrent(drv, dpy, draw, read, context); - if (!b) - return EGL_FALSE; - - if (ctx) { - ctx->driContext.bindContext(disp, 0, read, draw, &ctx->driContext); - } - else { - /* what's this??? */ - /* _mesa_make_current( NULL, NULL, NULL );*/ - } - return EGL_TRUE; -} - - -static EGLSurface -_eglDRICreatePbufferSurface(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config, - const EGLint *attrib_list) -{ - driSurface *surf; - - surf = (driSurface *) calloc(1, sizeof(*surf)); - if (!surf) { - return EGL_NO_SURFACE; - } - - if (!_eglInitSurface(drv, dpy, &surf->Base, EGL_PBUFFER_BIT, - config, attrib_list)) { - free(surf); - return EGL_NO_SURFACE; - } - - /* create software-based pbuffer */ - { -#if 0 - GLcontext *ctx = NULL; /* this _should_ be OK */ -#endif - GLvisual visMode; - _EGLConfig *conf = _eglLookupConfig(drv, dpy, config); - assert(conf); /* bad config should be caught earlier */ - _eglConfigToContextModesRec(conf, &visMode); - -#if 0 - surf->mesa_framebuffer = _mesa_create_framebuffer(&visMode); - _mesa_add_soft_renderbuffers(surf->mesa_framebuffer, - GL_TRUE, /* color bufs */ - visMode.haveDepthBuffer, - visMode.haveStencilBuffer, - visMode.haveAccumBuffer, - GL_FALSE, /* alpha */ - GL_FALSE /* aux */ ); - - /* set pbuffer/framebuffer size */ - _mesa_resize_framebuffer(ctx, surf->mesa_framebuffer, - surf->Base.Width, surf->Base.Height); -#endif - } - - _eglSaveSurface(&surf->Base); - - return surf->Base.Handle; -} - - -static EGLBoolean -_eglDRIDestroySurface(_EGLDriver *drv, EGLDisplay dpy, EGLSurface surface) -{ - driDisplay *disp = Lookup_driDisplay(dpy); - driSurface *fs = Lookup_driSurface(surface); - - _eglRemoveSurface(&fs->Base); - - fs->drawable.destroyDrawable(disp, fs->drawable.private); - - if (fs->Base.IsBound) { - fs->Base.DeletePending = EGL_TRUE; - } - else { - free(fs); - } - return EGL_TRUE; -} - - -static EGLBoolean -_eglDRIDestroyContext(_EGLDriver *drv, EGLDisplay dpy, EGLContext context) -{ - driDisplay *disp = Lookup_driDisplay(dpy); - driContext *fc = Lookup_driContext(context); - - _eglRemoveContext(&fc->Base); - - fc->driContext.destroyContext(disp, 0, fc->driContext.private); - - if (fc->Base.IsBound) { - fc->Base.DeletePending = EGL_TRUE; - } - else { - free(fc); - } - return EGL_TRUE; -} - - -/** - * Create a drawing surface which can be directly displayed on a screen. - */ -static EGLSurface -_eglDRICreateScreenSurfaceMESA(_EGLDriver *drv, EGLDisplay dpy, EGLConfig cfg, - const EGLint *attrib_list) -{ - _EGLConfig *config = _eglLookupConfig(drv, dpy, cfg); - driDisplay *disp = Lookup_driDisplay(dpy); - driSurface *surface; - GLvisual visMode; - - surface = (driSurface *) calloc(1, sizeof(*surface)); - if (!surface) { - return EGL_NO_SURFACE; - } - - /* init base class, do error checking, etc. */ - if (!_eglInitSurface(drv, dpy, &surface->Base, EGL_SCREEN_BIT_MESA, - cfg, attrib_list)) { - free(surface); - return EGL_NO_SURFACE; - } - - _eglSaveSurface(&surface->Base); - - - /* - * XXX this is where we should allocate video memory for the surface! - */ - - - /* convert EGLConfig to GLvisual */ - _eglConfigToContextModesRec(config, &visMode); - - /* Create a new DRI drawable */ - if (!disp->driScreen.createNewDrawable(disp, &visMode, surface->Base.Handle, - &surface->drawable, GLX_WINDOW_BIT, - empty_attribute_list)) { - _eglRemoveSurface(&surface->Base); - free(surface); - return EGL_NO_SURFACE; - } - - return surface->Base.Handle; -} - - -/** - * Set the fbdev colormap to a simple linear ramp. - */ -static void -_eglDRILoadColormap(driScreen *scrn) -{ - char path[ NAME_MAX ]; - char *buffer; - int i, fd; - - /* cmap attribute uses 256 lines of 16 bytes. - * Allocate one extra char for the \0 added by sprintf() - */ - if ( !( buffer = malloc( 256 * 16 + 1 ) ) ) { - _eglLog(_EGL_WARNING, "Out of memory in _eglDRILoadColormap"); - return; - } - - /* cmap attribute uses 256 lines of 16 bytes */ - for ( i = 0; i < 256; i++ ) { - int c = (i << 8) | i; /* expand to 16-bit value */ - sprintf(&buffer[i * 16], "%02x%c%04x%04x%04x\n", i, ' ', c, c, c); - } - - snprintf(path, sizeof(path), "%s/graphics/%s/color_map", sysfs, scrn->fb); - if ( !( fd = open( path, O_RDWR ) ) ) { - _eglLog(_EGL_WARNING, "Unable to open %s to set colormap", path); - return; - } - write( fd, buffer, 256 * 16 ); - close( fd ); - - free( buffer ); -} - - -/** - * Show the given surface on the named screen. - * If surface is EGL_NO_SURFACE, disable the screen's output. - * Called via eglShowSurfaceMESA(). - */ -EGLBoolean -_eglDRIShowScreenSurfaceMESA(_EGLDriver *drv, EGLDisplay dpy, - EGLScreenMESA screen, - EGLSurface surface, EGLModeMESA m) -{ - driDisplay *display = Lookup_driDisplay(dpy); - driScreen *scrn = Lookup_driScreen(dpy, screen); - driSurface *surf = Lookup_driSurface(surface); - _EGLMode *mode = _eglLookupMode(dpy, m); - FILE *file; - char fname[NAME_MAX], buffer[1000]; - int temp; - - _eglLog(_EGL_DEBUG, "Enter _eglDRIShowScreenSurface"); - - /* This will check that surface, screen, and mode are valid. - * Also, it checks that the surface is large enough for the mode, etc. - */ - if (!_eglShowScreenSurfaceMESA(drv, dpy, screen, surface, m)) - return EGL_FALSE; - - assert(surface == EGL_NO_SURFACE || surf); - assert(m == EGL_NO_MODE_MESA || mode); - assert(scrn); - - /* - * Blank/unblank screen depending on if m == EGL_NO_MODE_MESA - */ - snprintf(fname, sizeof(fname), "%s/graphics/%s/blank", sysfs, scrn->fb); - file = fopen(fname, "r+"); - if (!file) { - _eglLog(_EGL_WARNING, "kernel patch?? chown all fb sysfs attrib to allow" - " write - %s\n", fname); - return EGL_FALSE; - } - snprintf(buffer, sizeof(buffer), "%d", - (m == EGL_NO_MODE_MESA ? VESA_POWERDOWN : VESA_VSYNC_SUSPEND)); - fputs(buffer, file); - fclose(file); - - if (m == EGL_NO_MODE_MESA) { - /* all done! */ - return EGL_TRUE; - } - - _eglLog(_EGL_INFO, "Setting display mode to %d x %d, %d bpp", - mode->Width, mode->Height, display->bpp); - - /* - * Set the display mode - */ - snprintf(fname, sizeof(fname), "%s/graphics/%s/mode", sysfs, scrn->fb); - file = fopen(fname, "r+"); - if (!file) { - _eglLog(_EGL_WARNING, "Failed to open %s to set mode", fname); - return EGL_FALSE; - } - /* note: nothing happens without the \n! */ - snprintf(buffer, sizeof(buffer), "%s\n", mode->Name); - fputs(buffer, file); - fclose(file); - _eglLog(_EGL_INFO, "Set mode to %s in %s", mode->Name, fname); - - /* - * Set display bpp - */ - snprintf(fname, sizeof(fname), "%s/graphics/%s/bits_per_pixel", - sysfs, scrn->fb); - file = fopen(fname, "r+"); - if (!file) { - _eglLog(_EGL_WARNING, "Failed to open %s to set bpp", fname); - return EGL_FALSE; - } - display->bpp = GET_CONFIG_ATTRIB(surf->Base.Config, EGL_BUFFER_SIZE); - display->cpp = display->bpp / 8; - snprintf(buffer, sizeof(buffer), "%d", display->bpp); - fputs(buffer, file); - fclose(file); - - /* - * Unblank display - */ - snprintf(fname, sizeof(fname), "%s/graphics/%s/blank", sysfs, scrn->fb); - file = fopen(fname, "r+"); - if (!file) { - _eglLog(_EGL_WARNING, "Failed to open %s", fname); - return EGL_FALSE; - } - snprintf(buffer, sizeof(buffer), "%d", VESA_NO_BLANKING); - fputs(buffer, file); - fclose(file); - - /* - * Set fbdev buffer virtual size to surface's size. - */ - snprintf(fname, sizeof(fname), "%s/graphics/%s/virtual_size", sysfs, scrn->fb); - file = fopen(fname, "r+"); - snprintf(buffer, sizeof(buffer), "%d,%d", surf->Base.Width, surf->Base.Height); - fputs(buffer, file); - rewind(file); - fgets(buffer, sizeof(buffer), file); - sscanf(buffer, "%d,%d", &display->virtualWidth, &display->virtualHeight); - fclose(file); - - /* - * round up pitch as needed - */ - temp = display->virtualWidth; - switch (display->bpp / 8) { - case 1: temp = (display->virtualWidth + 127) & ~127; break; - case 2: temp = (display->virtualWidth + 31) & ~31; break; - case 3: - case 4: temp = (display->virtualWidth + 15) & ~15; break; - default: - _eglLog(_EGL_WARNING, "Bad display->bpp = %d in _eglDRIShowScreenSurface"); - } - display->virtualWidth = temp; - - /* - * sanity check - */ - if (surf->Base.Width < display->virtualWidth || - surf->Base.Height < display->virtualHeight) { - /* this case _should_ have been caught at the top of this function */ - _eglLog(_EGL_WARNING, "too small of surface in _eglDRIShowScreenSurfaceMESA " - "%d x %d < %d x %d", - surf->Base.Width, - surf->Base.Height, - display->virtualWidth, - display->virtualHeight); - /* - return EGL_FALSE; - */ - } - - /* This used to be done in the _eglDRICreateScreens routine. */ - _eglDRILoadColormap(scrn); - - return EGL_TRUE; -} - - -/** - * Called by eglSwapBuffers via the drv->API.SwapBuffers() pointer. - * - * If the backbuffer is on a videocard, this is extraordinarily slow! - */ -static EGLBoolean -_eglDRISwapBuffers(_EGLDriver *drv, EGLDisplay dpy, EGLSurface draw) -{ - driSurface *drawable = Lookup_driSurface(draw); - - /* this does error checking */ - if (!_eglSwapBuffers(drv, dpy, draw)) - return EGL_FALSE; - - drawable->drawable.swapBuffers(NULL, drawable->drawable.private); - - return EGL_TRUE; -} - - -EGLBoolean -_eglDRIGetDisplayInfo(driDisplay *dpy) -{ - char path[ NAME_MAX ]; - FILE *file; - int i, rc; - drmSetVersion sv; - drm_magic_t magic; - - snprintf( path, sizeof( path ), "%s/graphics/fb%d/device/device", sysfs, dpy->minor ); - file = fopen( path, "r" ); - if (!file) { - _eglLog(_EGL_WARNING, "Unable to open %s", path); - return EGL_FALSE; - } - fgets( path, sizeof( path ), file ); - sscanf( path, "%x", &dpy->chipset ); - fclose( file ); - - sprintf(path, DRM_DEV_NAME, DRM_DIR_NAME, dpy->minor); - if ( ( dpy->drmFD = open(path, O_RDWR, 0) ) < 0 ) { - _eglLog(_EGL_WARNING, "drmOpen failed."); - return EGL_FALSE; - } - - /* Set the interface version, asking for 1.2 */ - sv.drm_di_major = 1; - sv.drm_di_minor = 2; - sv.drm_dd_major = -1; - if ((rc = drmSetInterfaceVersion(dpy->drmFD, &sv))) - return EGL_FALSE; - - /* self authorize */ - if (drmGetMagic(dpy->drmFD, &magic)) - return EGL_FALSE; - if (drmAuthMagic(dpy->drmFD, magic)) - return EGL_FALSE; - - /* Map framebuffer and SAREA */ - for (i = 0; ; i++) { - drm_handle_t handle, offset; - drmSize size; - drmMapType type; - drmMapFlags flags; - int mtrr; - - if (drmGetMap(dpy->drmFD, i, &offset, &size, &type, &flags, - &handle, &mtrr)) - break; - - if (type == DRM_FRAME_BUFFER) { - rc = drmMap( dpy->drmFD, offset, size, (drmAddressPtr) &dpy->pFB); - if (rc < 0) { - _eglLog(_EGL_WARNING, "drmMap DRM_FAME_BUFFER failed"); - return EGL_FALSE; - } - dpy->fbSize = size; - _eglLog(_EGL_INFO, "Found framebuffer size: %d", dpy->fbSize); - } - else if (type == DRM_SHM) { - rc = drmMap(dpy->drmFD, offset, size, (drmAddressPtr) &dpy->pSAREA); - if (rc < 0 ) { - _eglLog(_EGL_WARNING, "drmMap DRM_SHM failed."); - return EGL_FALSE; - } - dpy->SAREASize = SAREA_MAX; - _eglLog(_EGL_DEBUG, "mapped SAREA 0x%08lx to %p, size %d", - (unsigned long) offset, dpy->pSAREA, dpy->SAREASize ); - } - } - - if (!dpy->pFB) { - _eglLog(_EGL_WARNING, "failed to map framebuffer"); - return EGL_FALSE; - } - - if (!dpy->pSAREA) { - /* if this happens, make sure you're using the most recent DRM modules */ - _eglLog(_EGL_WARNING, "failed to map SAREA"); - return EGL_FALSE; - } - - memset( dpy->pSAREA, 0, dpy->SAREASize ); - - return EGL_TRUE; -} - - - /* Return the DRI per screen structure */ -static __DRIscreen * -__eglFindDRIScreen(__DRInativeDisplay *ndpy, int scrn) -{ - driDisplay *disp = (driDisplay *)ndpy; - return &disp->driScreen; -} - - -static GLboolean -__eglCreateContextWithConfig(__DRInativeDisplay* ndpy, int screen, - int configID, void* context, - drm_context_t * hHWContext) -{ - __DRIscreen *pDRIScreen; - __DRIscreenPrivate *psp; - - pDRIScreen = __eglFindDRIScreen(ndpy, screen); - if ( (pDRIScreen == NULL) || (pDRIScreen->private == NULL) ) { - return GL_FALSE; - } - psp = (__DRIscreenPrivate *) pDRIScreen->private; - if (psp->fd) { - if (drmCreateContext(psp->fd, hHWContext)) { - _eglLog(_EGL_WARNING, "drmCreateContext failed."); - return GL_FALSE; - } - *(void**)context = (void*) *hHWContext; - } -#if 0 - __DRIscreen *pDRIScreen; - __DRIscreenPrivate *psp; - - pDRIScreen = __glXFindDRIScreen(dpy, screen); - if ( (pDRIScreen == NULL) || (pDRIScreen->private == NULL) ) { - return GL_FALSE; - } - - psp = (__DRIscreenPrivate *) pDRIScreen->private; - - if (psp->fd) { - if (drmCreateContext(psp->fd, hHWContext)) { - _eglLog(_EGL_WARNING, "drmCreateContext failed."); - return GL_FALSE; - } - *(void**)contextID = (void*) *hHWContext; - } -#endif - return GL_TRUE; -} - - -static GLboolean -__eglDestroyContext( __DRInativeDisplay * ndpy, int screen, __DRIid context ) -{ - __DRIscreen *pDRIScreen; - __DRIscreenPrivate *psp; - - pDRIScreen = __eglFindDRIScreen(ndpy, screen); - if ( (pDRIScreen == NULL) || (pDRIScreen->private == NULL) ) { - return GL_FALSE; - } - psp = (__DRIscreenPrivate *) pDRIScreen->private; - if (psp->fd) - drmDestroyContext(psp->fd, context); - - return GL_TRUE; -} - - -static GLboolean -__eglCreateDrawable(__DRInativeDisplay * ndpy, int screen, - __DRIid drawable, drm_drawable_t * hHWDrawable) -{ - __DRIscreen *pDRIScreen; - __DRIscreenPrivate *psp; - - pDRIScreen = __eglFindDRIScreen(ndpy, screen); - if ( (pDRIScreen == NULL) || (pDRIScreen->private == NULL) ) { - return GL_FALSE; - } - psp = (__DRIscreenPrivate *) pDRIScreen->private; - if (psp->fd) { - if (drmCreateDrawable(psp->fd, hHWDrawable)) { - _eglLog(_EGL_WARNING, "drmCreateDrawable failed."); - return GL_FALSE; - } - } - return GL_TRUE; -} - - -static GLboolean -__eglDestroyDrawable( __DRInativeDisplay * ndpy, int screen, __DRIid drawable ) -{ - __DRIscreen *pDRIScreen; - __DRIscreenPrivate *psp; - - pDRIScreen = __eglFindDRIScreen(ndpy, screen); - if ( (pDRIScreen == NULL) || (pDRIScreen->private == NULL) ) { - return GL_FALSE; - } - psp = (__DRIscreenPrivate *) pDRIScreen->private; - if (psp->fd) - drmDestroyDrawable(psp->fd, drawable); - - return GL_TRUE; -} - -static GLboolean -__eglGetDrawableInfo(__DRInativeDisplay * ndpy, int screen, __DRIid drawable, - unsigned int* index, unsigned int* stamp, - int* X, int* Y, int* W, int* H, - int* numClipRects, drm_clip_rect_t ** pClipRects, - int* backX, int* backY, - int* numBackClipRects, drm_clip_rect_t ** pBackClipRects ) -{ - __DRIscreen *pDRIScreen; - __DRIscreenPrivate *psp; - driSurface *surf = Lookup_driSurface(drawable); - - pDRIScreen = __eglFindDRIScreen(ndpy, screen); - - if ( (pDRIScreen == NULL) || (pDRIScreen->private == NULL) ) { - return GL_FALSE; - } - psp = (__DRIscreenPrivate *) pDRIScreen->private; - *X = 0; - *Y = 0; - *W = surf->Base.Width; - *H = surf->Base.Height; - - *backX = 0; - *backY = 0; - *numBackClipRects = 0; - *pBackClipRects = NULL; - - *numClipRects = 1; - *pClipRects = malloc(sizeof(**pClipRects)); - **pClipRects = (drm_clip_rect_t){0, 0, surf->Base.Width, surf->Base.Height}; - - psp->pSAREA->drawableTable[0].stamp = 1; - *stamp = 1; -#if 0 - GLXDrawable drawable = (GLXDrawable) draw; - drm_clip_rect_t * cliprect; - Display* display = (Display*)dpy; - __DRIcontextPrivate *pcp = (__DRIcontextPrivate *)CurrentContext->driContext.private; - if (drawable == 0) { - return GL_FALSE; - } - - cliprect = (drm_clip_rect_t*) _mesa_malloc(sizeof(drm_clip_rect_t)); - cliprect->x1 = drawable->x; - cliprect->y1 = drawable->y; - cliprect->x2 = drawable->x + drawable->w; - cliprect->y2 = drawable->y + drawable->h; - - /* the drawable index is by client id */ - *index = display->clientID; - - *stamp = pcp->driScreenPriv->pSAREA->drawableTable[display->clientID].stamp; - *x = drawable->x; - *y = drawable->y; - *width = drawable->w; - *height = drawable->h; - *numClipRects = 1; - *pClipRects = cliprect; - - *backX = drawable->x; - *backY = drawable->y; - *numBackClipRects = 0; - *pBackClipRects = 0; -#endif - return GL_TRUE; -} - - -/** - * Implement \c __DRIinterfaceMethods::getProcAddress. - */ -static __DRIfuncPtr -get_proc_address(const char * proc_name) -{ - return NULL; -} - - -/** - * Destroy a linked list of \c __GLcontextModes structures created by - * \c _gl_context_modes_create. - * - * \param modes Linked list of structures to be destroyed. All structres - * in the list will be freed. - */ -static void -__egl_context_modes_destroy(__GLcontextModes *modes) -{ - while ( modes != NULL ) { - __GLcontextModes * const next = modes->next; - - free( modes ); - modes = next; - } -} - - -/** - * Allocate a linked list of \c __GLcontextModes structures. The fields of - * each structure will be initialized to "reasonable" default values. In - * most cases this is the default value defined by table 3.4 of the GLX - * 1.3 specification. This means that most values are either initialized to - * zero or \c GLX_DONT_CARE (which is -1). As support for additional - * extensions is added, the new values will be initialized to appropriate - * values from the extension specification. - * - * \param count Number of structures to allocate. - * \param minimum_size Minimum size of a structure to allocate. This allows - * for differences in the version of the - * \c __GLcontextModes stucture used in libGL and in a - * DRI-based driver. - * \returns A pointer to the first element in a linked list of \c count - * stuctures on success, or \c NULL on failure. - * - * \warning Use of \c minimum_size does \b not guarantee binary compatibility. - * The fundamental assumption is that if the \c minimum_size - * specified by the driver and the size of the \c __GLcontextModes - * structure in libGL is the same, then the meaning of each byte in - * the structure is the same in both places. \b Be \b careful! - * Basically this means that fields have to be added in libGL and - * then propagated to drivers. Drivers should \b never arbitrarilly - * extend the \c __GLcontextModes data-structure. - */ -static __GLcontextModes * -__egl_context_modes_create(unsigned count, size_t minimum_size) -{ - const size_t size = (minimum_size > sizeof( __GLcontextModes )) - ? minimum_size : sizeof( __GLcontextModes ); - __GLcontextModes * base = NULL; - __GLcontextModes ** next; - unsigned i; - - next = & base; - for ( i = 0 ; i < count ; i++ ) { - *next = (__GLcontextModes *) malloc( size ); - if ( *next == NULL ) { - __egl_context_modes_destroy( base ); - base = NULL; - break; - } - - (void) memset( *next, 0, size ); - (*next)->visualID = GLX_DONT_CARE; - (*next)->visualType = GLX_DONT_CARE; - (*next)->visualRating = GLX_NONE; - (*next)->transparentPixel = GLX_NONE; - (*next)->transparentRed = GLX_DONT_CARE; - (*next)->transparentGreen = GLX_DONT_CARE; - (*next)->transparentBlue = GLX_DONT_CARE; - (*next)->transparentAlpha = GLX_DONT_CARE; - (*next)->transparentIndex = GLX_DONT_CARE; - (*next)->xRenderable = GLX_DONT_CARE; - (*next)->fbconfigID = GLX_DONT_CARE; - (*next)->swapMethod = GLX_SWAP_UNDEFINED_OML; - - next = & ((*next)->next); - } - - return base; -} - - -static GLboolean -__eglWindowExists(__DRInativeDisplay *dpy, __DRIid draw) -{ - return EGL_TRUE; -} - - -/** - * Get the unadjusted system time (UST). Currently, the UST is measured in - * microseconds since Epoc. The actual resolution of the UST may vary from - * system to system, and the units may vary from release to release. - * Drivers should not call this function directly. They should instead use - * \c glXGetProcAddress to obtain a pointer to the function. - * - * \param ust Location to store the 64-bit UST - * \returns Zero on success or a negative errno value on failure. - * - * \sa glXGetProcAddress, PFNGLXGETUSTPROC - * - * \since Internal API version 20030317. - */ -static int -__eglGetUST(int64_t *ust) -{ - struct timeval tv; - - if ( ust == NULL ) { - return -EFAULT; - } - - if ( gettimeofday( & tv, NULL ) == 0 ) { - ust[0] = (tv.tv_sec * 1000000) + tv.tv_usec; - return 0; - } - else { - return -errno; - } -} - -/** - * Determine the refresh rate of the specified drawable and display. - * - * \param dpy Display whose refresh rate is to be determined. - * \param drawable Drawable whose refresh rate is to be determined. - * \param numerator Numerator of the refresh rate. - * \param demoninator Denominator of the refresh rate. - * \return If the refresh rate for the specified display and drawable could - * be calculated, True is returned. Otherwise False is returned. - * - * \note This function is implemented entirely client-side. A lot of other - * functionality is required to export GLX_OML_sync_control, so on - * XFree86 this function can be called for direct-rendering contexts - * when GLX_OML_sync_control appears in the client extension string. - */ -static GLboolean -__eglGetMSCRate(__DRInativeDisplay * dpy, __DRIid drawable, - int32_t * numerator, int32_t * denominator) -{ - return EGL_TRUE; -} - - -/** - * Table of functions exported by the loader to the driver. - */ -static const __DRIinterfaceMethods interface_methods = { - get_proc_address, - - __egl_context_modes_create, - __egl_context_modes_destroy, - - __eglFindDRIScreen, - __eglWindowExists, - - __eglCreateContextWithConfig, - __eglDestroyContext, - - __eglCreateDrawable, - __eglDestroyDrawable, - __eglGetDrawableInfo, - - __eglGetUST, - __eglGetMSCRate, -}; - - -static int -__glXGetInternalVersion(void) -{ - return 20050725; -} - -static const char createNewScreenName[] = "__driCreateNewScreen_20050727"; - - -/** - * Do per-display initialization. - */ -EGLBoolean -_eglDRICreateDisplay(driDisplay *dpy, __DRIframebuffer *framebuffer) -{ - PFNCREATENEWSCREENFUNC createNewScreen; - int api_ver = __glXGetInternalVersion(); - __DRIversion ddx_version; - __DRIversion dri_version; - __DRIversion drm_version; - drmVersionPtr version; - - version = drmGetVersion( dpy->drmFD ); - if ( version ) { - drm_version.major = version->version_major; - drm_version.minor = version->version_minor; - drm_version.patch = version->version_patchlevel; - drmFreeVersion( version ); - } - else { - drm_version.major = -1; - drm_version.minor = -1; - drm_version.patch = -1; - } - - /* - * Get device name (like "tdfx") and the ddx version numbers. - * We'll check the version in each DRI driver's "createScreen" - * function. - */ - ddx_version.major = 4; - ddx_version.minor = 0; - ddx_version.patch = 0; - - /* - * Get the DRI X extension version. - */ - dri_version.major = 4; - dri_version.minor = 0; - dri_version.patch = 0; - - createNewScreen = ( PFNCREATENEWSCREENFUNC ) dlsym( dpy->Base.Driver->LibHandle, createNewScreenName ); - if ( !createNewScreen ) { - _eglLog(_EGL_WARNING, "Couldn't find %s function in the driver.", - createNewScreenName ); - return EGL_FALSE; - } - - dpy->driScreen.private = createNewScreen( dpy, 0, &dpy->driScreen, NULL, - &ddx_version, &dri_version, - &drm_version, framebuffer, - dpy->pSAREA, dpy->drmFD, - api_ver, - & interface_methods, - NULL); - if (!dpy->driScreen.private) - return EGL_FALSE; - - DRM_UNLOCK( dpy->drmFD, dpy->pSAREA, dpy->serverContext ); - - return EGL_TRUE; -} - - -/** - * Create all the EGL screens for the given display. - */ -EGLBoolean -_eglDRICreateScreens(driDisplay *dpy) -{ - const int numScreens = 1; /* XXX fix this someday */ - int i; - - for (i = 0; i < numScreens; i++) { - char path[ NAME_MAX ]; - FILE *file; - driScreen *s; - - /* Create a screen */ - if ( !( s = ( driScreen * ) calloc( 1, sizeof( *s ) ) ) ) - return EGL_FALSE; - - snprintf( s->fb, NAME_MAX, "fb%d", dpy->minor ); - _eglInitScreen( &s->Base ); - - _eglAddScreen( &dpy->Base, &s->Base ); - - /* Create the screen's mode list */ - snprintf( path, sizeof( path ), "%s/graphics/%s/modes", sysfs, s->fb ); - file = fopen( path, "r" ); - while ( fgets( path, sizeof( path ), file ) ) { - unsigned int x, y, r; - char c; - path[ strlen( path ) - 1 ] = '\0'; /* strip off \n from sysfs */ - sscanf( path, "%c:%ux%u-%u", &c, &x, &y, &r ); - _eglAddNewMode( &s->Base, x, y, r * 1000, path ); - } - fclose( file ); - - /* - * NOTE: we used to set the colormap here, but that didn't work reliably. - * Some entries near the start of the table would get corrupted by later - * mode changes. - */ - } - - return EGL_TRUE; -} - - -EGLBoolean -_eglDRIInitialize(_EGLDriver *drv, EGLDisplay dpy, - EGLint *major, EGLint *minor) -{ - _EGLDisplay *disp = _eglLookupDisplay(dpy); - driDisplay *display; - - assert(disp); - - /* Create new driDisplay object to replace the _EGLDisplay that was - * previously created. - */ - display = calloc(1, sizeof(*display)); - display->Base = *disp; - _eglHashInsert(_eglGlobal.Displays, disp->Handle, display); - free(disp); - - *major = 1; - *minor = 0; - - sscanf(&disp->Name[1], "%d", &display->minor); - - drv->Initialized = EGL_TRUE; - return EGL_TRUE; -} - - -static EGLBoolean -_eglDRITerminate(_EGLDriver *drv, EGLDisplay dpy) -{ - driDisplay *display = Lookup_driDisplay(dpy); - _eglCleanupDisplay(&display->Base);/*rename that function*/ - free(display); - free(drv); - return EGL_TRUE; -} - - -/** - * Plug in the DRI-specific functions into the driver's dispatch table. - * Also, enable some EGL extensions. - */ -void -_eglDRIInitDriverFallbacks(_EGLDriver *drv) -{ - _eglInitDriverFallbacks(drv); - - drv->API.Initialize = _eglDRIInitialize; - drv->API.Terminate = _eglDRITerminate; - drv->API.CreateContext = _eglDRICreateContext; - drv->API.MakeCurrent = _eglDRIMakeCurrent; - drv->API.CreatePbufferSurface = _eglDRICreatePbufferSurface; - drv->API.DestroySurface = _eglDRIDestroySurface; - drv->API.DestroyContext = _eglDRIDestroyContext; - drv->API.CreateScreenSurfaceMESA = _eglDRICreateScreenSurfaceMESA; - drv->API.ShowScreenSurfaceMESA = _eglDRIShowScreenSurfaceMESA; - drv->API.SwapBuffers = _eglDRISwapBuffers; - - /* enable supported extensions */ - drv->Extensions.MESA_screen_surface = EGL_TRUE; - drv->Extensions.MESA_copy_context = EGL_TRUE; -} diff --git a/src/egl/drivers/dri/egldri.h b/src/egl/drivers/dri/egldri.h deleted file mode 100644 index 34b12d64fc..0000000000 --- a/src/egl/drivers/dri/egldri.h +++ /dev/null @@ -1,113 +0,0 @@ -#ifndef EGLDRI_INCLUDED -#define EGLDRI_INCLUDED - -#include "egldisplay.h" -#include "eglscreen.h" -#include "eglsurface.h" -#include "eglcontext.h" -#include "mtypes.h" -#include "dri_util.h" -#include "drm_sarea.h" - -/** - * dri display-specific driver class derived from _EGLDisplay - */ -typedef struct dri_display -{ - _EGLDisplay Base; /* base class/object */ - void *pFB; - int drmFD; /**< \brief DRM device file descriptor */ - int minor; - unsigned long hFrameBuffer; - - int virtualWidth; - int virtualHeight; - int fbSize; - int bpp; - int cpp; - int card_type; - int SAREASize; - drm_sarea_t *pSAREA; - unsigned int serverContext; /**< \brief DRM context only active on server */ - unsigned long FBStart; /**< \brief physical address of the framebuffer */ - void *driverClientMsg; - int driverClientMsgSize; - int chipset; - void *driverPrivate; - drm_magic_t magic; - - __DRIscreen driScreen; - -} driDisplay; - - -/** - * dri driver-specific screen class derived from _EGLScreen - */ -typedef struct dri_screen -{ - _EGLScreen Base; - char fb[NAME_MAX]; /** the screen name, like "fb0" */ -} driScreen; - - -/** - * dri driver-specific surface class derived from _EGLSurface - */ -typedef struct dri_surface -{ - _EGLSurface Base; /* base class/object */ - __DRIdrawable drawable; -} driSurface; - - -/** - * dri driver-specific context class derived from _EGLContext - */ -typedef struct dri_context -{ - _EGLContext Base; /* base class/object */ - __DRIcontext driContext; /**< \brief context dependent methods */ -} driContext; - - - -static inline driDisplay * -Lookup_driDisplay(EGLDisplay dpy) -{ - _EGLDisplay *d = _eglLookupDisplay(dpy); - return (driDisplay *) d; -} - - -static inline driScreen * -Lookup_driScreen(EGLDisplay dpy, EGLScreenMESA screen) -{ - _EGLScreen *s = _eglLookupScreen(dpy, screen); - return (driScreen *) s; -} - - -static inline driContext * -Lookup_driContext(EGLContext ctx) -{ - _EGLContext *c = _eglLookupContext(ctx); - return (driContext *) c; -} - - -static inline driSurface * -Lookup_driSurface(EGLSurface surf) -{ - _EGLSurface *s = _eglLookupSurface(surf); - return (driSurface *) s; -} - -extern void _eglDRIInitDriverFallbacks(_EGLDriver *drv); -extern EGLBoolean _eglDRIShowScreenSurfaceMESA(_EGLDriver *drv, EGLDisplay dpy, EGLScreenMESA screen, EGLSurface surface, EGLModeMESA m); -extern EGLBoolean _eglDRIInitialize(_EGLDriver *drv, EGLDisplay dpy, EGLint *major, EGLint *minor); -extern EGLBoolean _eglDRIGetDisplayInfo(driDisplay *dpy); -extern EGLBoolean _eglDRICreateDisplay(driDisplay *dpy, __DRIframebuffer *framebuffer); -extern EGLBoolean _eglDRICreateScreens(driDisplay *dpy); - -#endif /* EGLDRI_INCLUDED */ diff --git a/src/egl/main/Makefile b/src/egl/main/Makefile deleted file mode 100644 index 7ab78197c7..0000000000 --- a/src/egl/main/Makefile +++ /dev/null @@ -1,67 +0,0 @@ -# src/egl/main/Makefile - -TOP = ../../.. -include $(TOP)/configs/current - - -INCLUDE_DIRS = -I$(TOP)/include -I$(TOP)/src/mesa/glapi - -HEADERS = \ - eglconfig.h \ - eglcontext.h \ - egldisplay.h \ - egldriver.h \ - eglglobals.h \ - egllog.h \ - eglhash.h \ - eglmode.h \ - eglscreen.h \ - eglsurface.h - -SOURCES = \ - eglapi.c \ - eglconfig.c \ - eglcontext.c \ - egldisplay.c \ - egldriver.c \ - eglglobals.c \ - egllog.c \ - eglhash.c \ - eglmode.c \ - eglscreen.c \ - eglsurface.c - -OBJECTS = $(SOURCES:.c=.o) - - -.c.o: - $(CC) -c $(INCLUDE_DIRS) $(CFLAGS) $< -o $@ - - - -default: depend library - - -# EGL Library -library: $(TOP)/$(LIB_DIR)/libEGL.so - -$(TOP)/$(LIB_DIR)/libEGL.so: $(OBJECTS) - $(MKLIB) -o EGL -linker '$(CC)' -ldflags '$(LDFLAGS)' \ - -major 1 -minor 0 \ - -install $(TOP)/$(LIB_DIR) -ldl $(OBJECTS) - - - -clean: - -rm -f *.o *.so* - -rm -f core.* - - -depend: $(SOURCES) $(HEADERS) - @ echo "running $(MKDEP)" - @ touch depend - $(MKDEP) $(MKDEP_OPTIONS) $(DEFINES) $(INCLUDE_DIRS) \ - $(SOURCES) $(HEADERS) > /dev/null - -include depend -# DO NOT DELETE diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c deleted file mode 100644 index bfa580e6c3..0000000000 --- a/src/egl/main/eglapi.c +++ /dev/null @@ -1,586 +0,0 @@ -/** - * Public EGL API entrypoints - * - * Generally, we use the EGLDisplay parameter as a key to lookup the - * appropriate device driver handle, then jump though the driver's - * dispatch table to handle the function. - * - * That allows us the option of supporting multiple, simultaneous, - * heterogeneous hardware devices in the future. - * - * The EGLDisplay, EGLConfig, EGLContext and EGLSurface types are - * opaque handles implemented with 32-bit unsigned integers. - * It's up to the driver function or fallback function to look up the - * handle and get an object. - * By using opaque handles, we leave open the possibility of having - * indirect rendering in the future, like GLX. - * - * - * Notes on naming conventions: - * - * eglFooBar - public EGL function - * EGL_FOO_BAR - public EGL token - * EGLDatatype - public EGL datatype - * - * _eglFooBar - private EGL function - * _EGLDatatype - private EGL datatype, typedef'd struct - * _egl_struct - private EGL struct, non-typedef'd - * - */ - - - -#include -#include -#include -#include "eglcontext.h" -#include "egldisplay.h" -#include "egltypedefs.h" -#include "eglglobals.h" -#include "egldriver.h" -#include "eglsurface.h" - - - -/** - * NOTE: displayName is treated as a string in _eglChooseDriver()!!! - * This will probably change! - * See _eglChooseDriver() for details! - */ -EGLDisplay APIENTRY -eglGetDisplay(NativeDisplayType displayName) -{ - _EGLDisplay *dpy; - _eglInitGlobals(); - dpy = _eglNewDisplay(displayName); - if (dpy) - return dpy->Handle; - else - return EGL_NO_DISPLAY; -} - - -EGLBoolean APIENTRY -eglInitialize(EGLDisplay dpy, EGLint *major, EGLint *minor) -{ - if (dpy) { - _EGLDriver *drv = _eglChooseDriver(dpy); - if (drv) - return drv->API.Initialize(drv, dpy, major, minor); - } - return EGL_FALSE; -} - - -EGLBoolean APIENTRY -eglTerminate(EGLDisplay dpy) -{ - _EGLDriver *drv = _eglLookupDriver(dpy); - if (drv) - return _eglCloseDriver(drv, dpy); - else - return EGL_FALSE; -} - - -const char * APIENTRY -eglQueryString(EGLDisplay dpy, EGLint name) -{ - _EGLDriver *drv = _eglLookupDriver(dpy); - if (drv) - return drv->API.QueryString(drv, dpy, name); - else - return NULL; -} - - -EGLBoolean APIENTRY -eglGetConfigs(EGLDisplay dpy, EGLConfig *configs, EGLint config_size, EGLint *num_config) -{ - _EGLDriver *drv = _eglLookupDriver(dpy); - /* XXX check drv for null in remaining functions */ - return drv->API.GetConfigs(drv, dpy, configs, config_size, num_config); -} - - -EGLBoolean APIENTRY -eglChooseConfig(EGLDisplay dpy, const EGLint *attrib_list, EGLConfig *configs, EGLint config_size, EGLint *num_config) -{ - _EGLDriver *drv = _eglLookupDriver(dpy); - return drv->API.ChooseConfig(drv, dpy, attrib_list, configs, config_size, num_config); -} - - -EGLBoolean APIENTRY -eglGetConfigAttrib(EGLDisplay dpy, EGLConfig config, EGLint attribute, EGLint *value) -{ - _EGLDriver *drv = _eglLookupDriver(dpy); - return drv->API.GetConfigAttrib(drv, dpy, config, attribute, value); -} - - -EGLContext APIENTRY -eglCreateContext(EGLDisplay dpy, EGLConfig config, EGLContext share_list, const EGLint *attrib_list) -{ - _EGLDriver *drv = _eglLookupDriver(dpy); - return drv->API.CreateContext(drv, dpy, config, share_list, attrib_list); -} - - -EGLBoolean APIENTRY -eglDestroyContext(EGLDisplay dpy, EGLContext ctx) -{ - _EGLDriver *drv = _eglLookupDriver(dpy); - return drv->API.DestroyContext(drv, dpy, ctx); -} - - -EGLBoolean APIENTRY -eglMakeCurrent(EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext ctx) -{ - _EGLDriver *drv = _eglLookupDriver(dpy); - return drv->API.MakeCurrent(drv, dpy, draw, read, ctx); -} - - -EGLBoolean APIENTRY -eglQueryContext(EGLDisplay dpy, EGLContext ctx, EGLint attribute, EGLint *value) -{ - _EGLDriver *drv = _eglLookupDriver(dpy); - return drv->API.QueryContext(drv, dpy, ctx, attribute, value); -} - - -EGLSurface APIENTRY -eglCreateWindowSurface(EGLDisplay dpy, EGLConfig config, NativeWindowType window, const EGLint *attrib_list) -{ - _EGLDriver *drv = _eglLookupDriver(dpy); - return drv->API.CreateWindowSurface(drv, dpy, config, window, attrib_list); -} - - -EGLSurface APIENTRY -eglCreatePixmapSurface(EGLDisplay dpy, EGLConfig config, NativePixmapType pixmap, const EGLint *attrib_list) -{ - _EGLDriver *drv = _eglLookupDriver(dpy); - return drv->API.CreatePixmapSurface(drv, dpy, config, pixmap, attrib_list); -} - - -EGLSurface APIENTRY -eglCreatePbufferSurface(EGLDisplay dpy, EGLConfig config, const EGLint *attrib_list) -{ - _EGLDriver *drv = _eglLookupDriver(dpy); - return drv->API.CreatePbufferSurface(drv, dpy, config, attrib_list); -} - - -EGLBoolean APIENTRY -eglDestroySurface(EGLDisplay dpy, EGLSurface surface) -{ - _EGLDriver *drv = _eglLookupDriver(dpy); - return drv->API.DestroySurface(drv, dpy, surface); -} - - -EGLBoolean APIENTRY -eglQuerySurface(EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint *value) -{ - _EGLDriver *drv = _eglLookupDriver(dpy); - return drv->API.QuerySurface(drv, dpy, surface, attribute, value); -} - - -EGLBoolean APIENTRY -eglSurfaceAttrib(EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint value) -{ - _EGLDriver *drv = _eglLookupDriver(dpy); - return drv->API.SurfaceAttrib(drv, dpy, surface, attribute, value); -} - - -EGLBoolean APIENTRY -eglBindTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer) -{ - _EGLDriver *drv = _eglLookupDriver(dpy); - return drv->API.BindTexImage(drv, dpy, surface, buffer); -} - - -EGLBoolean APIENTRY -eglReleaseTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer) -{ - _EGLDriver *drv = _eglLookupDriver(dpy); - return drv->API.ReleaseTexImage(drv, dpy, surface, buffer); -} - - -EGLBoolean APIENTRY -eglSwapInterval(EGLDisplay dpy, EGLint interval) -{ - _EGLDriver *drv = _eglLookupDriver(dpy); - return drv->API.SwapInterval(drv, dpy, interval); -} - - -EGLBoolean APIENTRY -eglSwapBuffers(EGLDisplay dpy, EGLSurface draw) -{ - _EGLDriver *drv = _eglLookupDriver(dpy); - return drv->API.SwapBuffers(drv, dpy, draw); -} - - -EGLBoolean APIENTRY -eglCopyBuffers(EGLDisplay dpy, EGLSurface surface, NativePixmapType target) -{ - _EGLDriver *drv = _eglLookupDriver(dpy); - return drv->API.CopyBuffers(drv, dpy, surface, target); -} - - -EGLBoolean APIENTRY -eglWaitGL(void) -{ - EGLDisplay dpy = eglGetCurrentDisplay(); - if (dpy != EGL_NO_DISPLAY) { - _EGLDriver *drv = _eglLookupDriver(dpy); - return drv->API.WaitGL(drv, dpy); - } - else - return EGL_FALSE; -} - - -EGLBoolean APIENTRY -eglWaitNative(EGLint engine) -{ - EGLDisplay dpy = eglGetCurrentDisplay(); - if (dpy != EGL_NO_DISPLAY) { - _EGLDriver *drv = _eglLookupDriver(dpy); - return drv->API.WaitNative(drv, dpy, engine); - } - else - return EGL_FALSE; -} - - -EGLDisplay APIENTRY -eglGetCurrentDisplay(void) -{ - _EGLDisplay *dpy = _eglGetCurrentDisplay(); - if (dpy) - return dpy->Handle; - else - return EGL_NO_DISPLAY; -} - - -EGLContext APIENTRY -eglGetCurrentContext(void) -{ - _EGLContext *ctx = _eglGetCurrentContext(); - if (ctx) - return ctx->Handle; - else - return EGL_NO_CONTEXT; -} - - -EGLSurface APIENTRY -eglGetCurrentSurface(EGLint readdraw) -{ - _EGLSurface *s = _eglGetCurrentSurface(readdraw); - if (s) - return s->Handle; - else - return EGL_NO_SURFACE; -} - - -EGLint APIENTRY -eglGetError(void) -{ - _EGLThreadInfo *t = _eglGetCurrentThread(); - EGLint e = t->LastError; - t->LastError = EGL_SUCCESS; - return e; -} - - -void (* APIENTRY eglGetProcAddress(const char *procname))() -{ - typedef void (*genericFunc)(); - struct name_function { - const char *name; - _EGLProc function; - }; - static struct name_function egl_functions[] = { - /* alphabetical order */ - { "eglBindTexImage", (_EGLProc) eglBindTexImage }, - { "eglChooseConfig", (_EGLProc) eglChooseConfig }, - { "eglCopyBuffers", (_EGLProc) eglCopyBuffers }, - { "eglCreateContext", (_EGLProc) eglCreateContext }, - { "eglCreatePbufferSurface", (_EGLProc) eglCreatePbufferSurface }, - { "eglCreatePixmapSurface", (_EGLProc) eglCreatePixmapSurface }, - { "eglCreateWindowSurface", (_EGLProc) eglCreateWindowSurface }, - { "eglDestroyContext", (_EGLProc) eglDestroyContext }, - { "eglDestroySurface", (_EGLProc) eglDestroySurface }, - { "eglGetConfigAttrib", (_EGLProc) eglGetConfigAttrib }, - { "eglGetConfigs", (_EGLProc) eglGetConfigs }, - { "eglGetCurrentContext", (_EGLProc) eglGetCurrentContext }, - { "eglGetCurrentDisplay", (_EGLProc) eglGetCurrentDisplay }, - { "eglGetCurrentSurface", (_EGLProc) eglGetCurrentSurface }, - { "eglGetDisplay", (_EGLProc) eglGetDisplay }, - { "eglGetError", (_EGLProc) eglGetError }, - { "eglGetProcAddress", (_EGLProc) eglGetProcAddress }, - { "eglInitialize", (_EGLProc) eglInitialize }, - { "eglMakeCurrent", (_EGLProc) eglMakeCurrent }, - { "eglQueryContext", (_EGLProc) eglQueryContext }, - { "eglQueryString", (_EGLProc) eglQueryString }, - { "eglQuerySurface", (_EGLProc) eglQuerySurface }, - { "eglReleaseTexImage", (_EGLProc) eglReleaseTexImage }, - { "eglSurfaceAttrib", (_EGLProc) eglSurfaceAttrib }, - { "eglSwapBuffers", (_EGLProc) eglSwapBuffers }, - { "eglSwapInterval", (_EGLProc) eglSwapInterval }, - { "eglTerminate", (_EGLProc) eglTerminate }, - { "eglWaitGL", (_EGLProc) eglWaitGL }, - { "eglWaitNative", (_EGLProc) eglWaitNative }, - /* Extensions */ -#ifdef EGL_MESA_screen_surface - { "eglChooseModeMESA", (_EGLProc) eglChooseModeMESA }, - { "eglGetModesMESA", (_EGLProc) eglGetModesMESA }, - { "eglGetModeAttribMESA", (_EGLProc) eglGetModeAttribMESA }, - { "eglCopyContextMESA", (_EGLProc) eglCopyContextMESA }, - { "eglGetScreensMESA", (_EGLProc) eglGetScreensMESA }, - { "eglCreateScreenSurfaceMESA", (_EGLProc) eglCreateScreenSurfaceMESA }, - { "eglShowScreenSurfaceMESA", (_EGLProc) eglShowScreenSurfaceMESA }, - { "eglScreenPositionMESA", (_EGLProc) eglScreenPositionMESA }, - { "eglQueryScreenMESA", (_EGLProc) eglQueryScreenMESA }, - { "eglQueryScreenSurfaceMESA", (_EGLProc) eglQueryScreenSurfaceMESA }, - { "eglQueryScreenModeMESA", (_EGLProc) eglQueryScreenModeMESA }, - { "eglQueryModeStringMESA", (_EGLProc) eglQueryModeStringMESA }, -#endif /* EGL_MESA_screen_surface */ -#ifdef EGL_VERSION_1_2 - { "eglBindAPI", (_EGLProc) eglBindAPI }, - { "eglCreatePbufferFromClientBuffer", (_EGLProc) eglCreatePbufferFromClientBuffer }, - { "eglQueryAPI", (_EGLProc) eglQueryAPI }, - { "eglReleaseThread", (_EGLProc) eglReleaseThread }, - { "eglWaitClient", (_EGLProc) eglWaitClient }, -#endif /* EGL_VERSION_1_2 */ - { NULL, NULL } - }; - EGLint i; - for (i = 0; egl_functions[i].name; i++) { - if (strcmp(egl_functions[i].name, procname) == 0) { - return (genericFunc) egl_functions[i].function; - } - } -#if 0 - /* XXX enable this code someday */ - return (genericFunc) _glapi_get_proc_address(procname); -#else - return NULL; -#endif -} - - -/* - * EGL_MESA_screen extension - */ - -EGLBoolean APIENTRY -eglChooseModeMESA(EGLDisplay dpy, EGLScreenMESA screen, - const EGLint *attrib_list, EGLModeMESA *modes, - EGLint modes_size, EGLint *num_modes) -{ - _EGLDriver *drv = _eglLookupDriver(dpy); - if (drv) - return drv->API.ChooseModeMESA(drv, dpy, screen, attrib_list, modes, modes_size, num_modes); - else - return EGL_FALSE; -} - - -EGLBoolean APIENTRY -eglGetModesMESA(EGLDisplay dpy, EGLScreenMESA screen, EGLModeMESA *modes, EGLint mode_size, EGLint *num_mode) -{ - _EGLDriver *drv = _eglLookupDriver(dpy); - if (drv) - return drv->API.GetModesMESA(drv, dpy, screen, modes, mode_size, num_mode); - else - return EGL_FALSE; -} - - -EGLBoolean APIENTRY -eglGetModeAttribMESA(EGLDisplay dpy, EGLModeMESA mode, EGLint attribute, EGLint *value) -{ - _EGLDriver *drv = _eglLookupDriver(dpy); - if (drv) - return drv->API.GetModeAttribMESA(drv, dpy, mode, attribute, value); - else - return EGL_FALSE; -} - - -EGLBoolean APIENTRY -eglCopyContextMESA(EGLDisplay dpy, EGLContext source, EGLContext dest, EGLint mask) -{ - _EGLDriver *drv = _eglLookupDriver(dpy); - if (drv) - return drv->API.CopyContextMESA(drv, dpy, source, dest, mask); - else - return EGL_FALSE; -} - - -EGLBoolean -eglGetScreensMESA(EGLDisplay dpy, EGLScreenMESA *screens, EGLint max_screens, EGLint *num_screens) -{ - _EGLDriver *drv = _eglLookupDriver(dpy); - if (drv) - return drv->API.GetScreensMESA(drv, dpy, screens, max_screens, num_screens); - else - return EGL_FALSE; -} - - -EGLSurface -eglCreateScreenSurfaceMESA(EGLDisplay dpy, EGLConfig config, const EGLint *attrib_list) -{ - _EGLDriver *drv = _eglLookupDriver(dpy); - return drv->API.CreateScreenSurfaceMESA(drv, dpy, config, attrib_list); -} - - -EGLBoolean -eglShowScreenSurfaceMESA(EGLDisplay dpy, EGLint screen, EGLSurface surface, EGLModeMESA mode) -{ - _EGLDriver *drv = _eglLookupDriver(dpy); - return drv->API.ShowScreenSurfaceMESA(drv, dpy, screen, surface, mode); -} - - -EGLBoolean -eglScreenPositionMESA(EGLDisplay dpy, EGLScreenMESA screen, EGLint x, EGLint y) -{ - _EGLDriver *drv = _eglLookupDriver(dpy); - return drv->API.ScreenPositionMESA(drv, dpy, screen, x, y); -} - - -EGLBoolean -eglQueryScreenMESA( EGLDisplay dpy, EGLScreenMESA screen, EGLint attribute, EGLint *value) -{ - _EGLDriver *drv = _eglLookupDriver(dpy); - return drv->API.QueryScreenMESA(drv, dpy, screen, attribute, value); -} - - -EGLBoolean -eglQueryScreenSurfaceMESA(EGLDisplay dpy, EGLScreenMESA screen, EGLSurface *surface) -{ - _EGLDriver *drv = _eglLookupDriver(dpy); - return drv->API.QueryScreenSurfaceMESA(drv, dpy, screen, surface); -} - - -EGLBoolean -eglQueryScreenModeMESA(EGLDisplay dpy, EGLScreenMESA screen, EGLModeMESA *mode) -{ - _EGLDriver *drv = _eglLookupDriver(dpy); - return drv->API.QueryScreenModeMESA(drv, dpy, screen, mode); -} - - -const char * -eglQueryModeStringMESA(EGLDisplay dpy, EGLModeMESA mode) -{ - _EGLDriver *drv = _eglLookupDriver(dpy); - return drv->API.QueryModeStringMESA(drv, dpy, mode); -} - - -/** - ** EGL 1.2 - **/ - -#ifdef EGL_VERSION_1_2 - -EGLBoolean -eglBindAPI(EGLenum api) -{ - _EGLThreadInfo *t = _eglGetCurrentThread(); - - switch (api) { - case EGL_OPENGL_ES_API: - if (_eglGlobal.OpenGLESAPISupported) { - t->CurrentAPI = api; - return EGL_TRUE; - } - _eglError(EGL_BAD_PARAMETER, "eglBindAPI"); - return EGL_FALSE; - case EGL_OPENVG_API: - if (_eglGlobal.OpenVGAPISupported) { - t->CurrentAPI = api; - return EGL_TRUE; - } - _eglError(EGL_BAD_PARAMETER, "eglBindAPI"); - return EGL_FALSE; - default: - return EGL_FALSE; - } - return EGL_TRUE; -} - - -EGLSurface -eglCreatePbufferFromClientBuffer(EGLDisplay dpy, EGLenum buftype, - EGLClientBuffer buffer, EGLConfig config, - const EGLint *attrib_list) -{ - _EGLDriver *drv = _eglLookupDriver(dpy); - return drv->API.CreatePbufferFromClientBuffer(drv, dpy, buftype, buffer, - config, attrib_list); -} - - -EGLenum -eglQueryAPI(void) -{ - /* returns one of EGL_OPENGL_ES_API or EGL_OPENVG_API */ - _EGLThreadInfo *t = _eglGetCurrentThread(); - return t->CurrentAPI; -} - - -EGLBoolean -eglReleaseThread(void) -{ - _EGLThreadInfo *t = _eglGetCurrentThread(); - EGLDisplay dpy = eglGetCurrentDisplay(); - if (dpy) { - _EGLDriver *drv = _eglLookupDriver(dpy); - /* unbind context */ - (void) drv->API.MakeCurrent(drv, dpy, EGL_NO_SURFACE, - EGL_NO_SURFACE, EGL_NO_CONTEXT); - } - _eglDeleteThreadData(t); - return EGL_TRUE; -} - - -EGLBoolean -eglWaitClient(void) -{ - EGLDisplay dpy = eglGetCurrentDisplay(); - if (dpy != EGL_NO_DISPLAY) { - _EGLDriver *drv = _eglLookupDriver(dpy); - return drv->API.WaitClient(drv, dpy); - } - else - return EGL_FALSE; -} - -#endif /* EGL_VERSION_1_2 */ diff --git a/src/egl/main/eglapi.h b/src/egl/main/eglapi.h deleted file mode 100644 index 555aa5dd9e..0000000000 --- a/src/egl/main/eglapi.h +++ /dev/null @@ -1,119 +0,0 @@ -#ifndef EGLAPI_INCLUDED -#define EGLAPI_INCLUDED - -/** - * Typedefs for all EGL API entrypoint functions. - */ - - -/* driver funcs */ -typedef EGLBoolean (*Initialize_t)(_EGLDriver *, EGLDisplay dpy, EGLint *major, EGLint *minor); -typedef EGLBoolean (*Terminate_t)(_EGLDriver *, EGLDisplay dpy); - -/* config funcs */ -typedef EGLBoolean (*GetConfigs_t)(_EGLDriver *drv, EGLDisplay dpy, EGLConfig *configs, EGLint config_size, EGLint *num_config); -typedef EGLBoolean (*ChooseConfig_t)(_EGLDriver *drv, EGLDisplay dpy, const EGLint *attrib_list, EGLConfig *configs, EGLint config_size, EGLint *num_config); -typedef EGLBoolean (*GetConfigAttrib_t)(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config, EGLint attribute, EGLint *value); - -/* context funcs */ -typedef EGLContext (*CreateContext_t)(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config, EGLContext share_list, const EGLint *attrib_list); -typedef EGLBoolean (*DestroyContext_t)(_EGLDriver *drv, EGLDisplay dpy, EGLContext ctx); -typedef EGLBoolean (*MakeCurrent_t)(_EGLDriver *drv, EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext ctx); -typedef EGLBoolean (*QueryContext_t)(_EGLDriver *drv, EGLDisplay dpy, EGLContext ctx, EGLint attribute, EGLint *value); - -/* surface funcs */ -typedef EGLSurface (*CreateWindowSurface_t)(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config, NativeWindowType window, const EGLint *attrib_list); -typedef EGLSurface (*CreatePixmapSurface_t)(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config, NativePixmapType pixmap, const EGLint *attrib_list); -typedef EGLSurface (*CreatePbufferSurface_t)(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config, const EGLint *attrib_list); -typedef EGLBoolean (*DestroySurface_t)(_EGLDriver *drv, EGLDisplay dpy, EGLSurface surface); -typedef EGLBoolean (*QuerySurface_t)(_EGLDriver *drv, EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint *value); -typedef EGLBoolean (*SurfaceAttrib_t)(_EGLDriver *drv, EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint value); -typedef EGLBoolean (*BindTexImage_t)(_EGLDriver *drv, EGLDisplay dpy, EGLSurface surface, EGLint buffer); -typedef EGLBoolean (*ReleaseTexImage_t)(_EGLDriver *drv, EGLDisplay dpy, EGLSurface surface, EGLint buffer); -typedef EGLBoolean (*SwapInterval_t)(_EGLDriver *drv, EGLDisplay dpy, EGLint interval); -typedef EGLBoolean (*SwapBuffers_t)(_EGLDriver *drv, EGLDisplay dpy, EGLSurface draw); -typedef EGLBoolean (*CopyBuffers_t)(_EGLDriver *drv, EGLDisplay dpy, EGLSurface surface, NativePixmapType target); - -/* misc funcs */ -typedef const char *(*QueryString_t)(_EGLDriver *drv, EGLDisplay dpy, EGLint name); -typedef EGLBoolean (*WaitGL_t)(_EGLDriver *drv, EGLDisplay dpy); -typedef EGLBoolean (*WaitNative_t)(_EGLDriver *drv, EGLDisplay dpy, EGLint engine); - - -#ifdef EGL_MESA_screen_surface -typedef EGLBoolean (*ChooseModeMESA_t)(_EGLDriver *drv, EGLDisplay dpy, EGLScreenMESA screen, const EGLint *attrib_list, EGLModeMESA *modes, EGLint modes_size, EGLint *num_modes); -typedef EGLBoolean (*GetModesMESA_t)(_EGLDriver *drv, EGLDisplay dpy, EGLScreenMESA screen, EGLModeMESA *modes, EGLint mode_size, EGLint *num_mode); -typedef EGLBoolean (*GetModeAttribMESA_t)(_EGLDriver *drv, EGLDisplay dpy, EGLModeMESA mode, EGLint attribute, EGLint *value); -typedef EGLBoolean (*CopyContextMESA_t)(_EGLDriver *drv, EGLDisplay dpy, EGLContext source, EGLContext dest, EGLint mask); -typedef EGLBoolean (*GetScreensMESA_t)(_EGLDriver *drv, EGLDisplay dpy, EGLScreenMESA *screens, EGLint max_screens, EGLint *num_screens); -typedef EGLSurface (*CreateScreenSurfaceMESA_t)(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config, const EGLint *attrib_list); -typedef EGLBoolean (*ShowScreenSurfaceMESA_t)(_EGLDriver *drv, EGLDisplay dpy, EGLScreenMESA screen, EGLSurface surface, EGLModeMESA mode); -typedef EGLBoolean (*ScreenPositionMESA_t)(_EGLDriver *drv, EGLDisplay dpy, EGLScreenMESA screen, EGLint x, EGLint y); -typedef EGLBoolean (*QueryScreenMESA_t)(_EGLDriver *drv, EGLDisplay dpy, EGLScreenMESA screen, EGLint attribute, EGLint *value); -typedef EGLBoolean (*QueryScreenSurfaceMESA_t)(_EGLDriver *drv, EGLDisplay dpy, EGLScreenMESA screen, EGLSurface *surface); -typedef EGLBoolean (*QueryScreenModeMESA_t)(_EGLDriver *drv, EGLDisplay dpy, EGLScreenMESA screen, EGLModeMESA *mode); -typedef const char * (*QueryModeStringMESA_t)(_EGLDriver *drv, EGLDisplay dpy, EGLModeMESA mode); -#endif /* EGL_MESA_screen_surface */ - - -#ifdef EGL_VERSION_1_2 -typedef EGLBoolean (*WaitClient_t)(_EGLDriver *drv, EGLDisplay dpy); -typedef EGLSurface (*CreatePbufferFromClientBuffer_t)(_EGLDriver *drv, EGLDisplay dpy, EGLenum buftype, EGLClientBuffer buffer, EGLConfig config, const EGLint *attrib_list); -#endif /* EGL_VERSION_1_2 */ - - - -/** - * The API dispatcher jumps through these functions - */ -struct _egl_api -{ - Initialize_t Initialize; - Terminate_t Terminate; - - GetConfigs_t GetConfigs; - ChooseConfig_t ChooseConfig; - GetConfigAttrib_t GetConfigAttrib; - - CreateContext_t CreateContext; - DestroyContext_t DestroyContext; - MakeCurrent_t MakeCurrent; - QueryContext_t QueryContext; - - CreateWindowSurface_t CreateWindowSurface; - CreatePixmapSurface_t CreatePixmapSurface; - CreatePbufferSurface_t CreatePbufferSurface; - DestroySurface_t DestroySurface; - QuerySurface_t QuerySurface; - SurfaceAttrib_t SurfaceAttrib; - BindTexImage_t BindTexImage; - ReleaseTexImage_t ReleaseTexImage; - SwapInterval_t SwapInterval; - SwapBuffers_t SwapBuffers; - CopyBuffers_t CopyBuffers; - - QueryString_t QueryString; - WaitGL_t WaitGL; - WaitNative_t WaitNative; - - /* EGL_MESA_screen extension */ - ChooseModeMESA_t ChooseModeMESA; - GetModesMESA_t GetModesMESA; - GetModeAttribMESA_t GetModeAttribMESA; - CopyContextMESA_t CopyContextMESA; - GetScreensMESA_t GetScreensMESA; - CreateScreenSurfaceMESA_t CreateScreenSurfaceMESA; - ShowScreenSurfaceMESA_t ShowScreenSurfaceMESA; - ScreenPositionMESA_t ScreenPositionMESA; - QueryScreenMESA_t QueryScreenMESA; - QueryScreenSurfaceMESA_t QueryScreenSurfaceMESA; - QueryScreenModeMESA_t QueryScreenModeMESA; - QueryModeStringMESA_t QueryModeStringMESA; - -#ifdef EGL_VERSION_1_2 - WaitClient_t WaitClient; - CreatePbufferFromClientBuffer_t CreatePbufferFromClientBuffer; -#endif -}; - -#endif /* EGLAPI_INCLUDED */ diff --git a/src/egl/main/eglconfig.c b/src/egl/main/eglconfig.c deleted file mode 100644 index 2a62f95b54..0000000000 --- a/src/egl/main/eglconfig.c +++ /dev/null @@ -1,638 +0,0 @@ -/** - * EGL Configuration (pixel format) functions. - */ - - -#include -#include -#include -#include -#include "eglconfig.h" -#include "egldisplay.h" -#include "egldriver.h" -#include "eglglobals.h" -#include "egllog.h" - - -#define MIN2(A, B) (((A) < (B)) ? (A) : (B)) - - -/** - * Convert an _EGLConfig to a __GLcontextModes object. - * NOTE: This routine may be incomplete - we're only making sure that - * the fields needed by Mesa (for _mesa_create_context/framebuffer) are - * set correctly. - */ -void -_eglConfigToContextModesRec(const _EGLConfig *config, __GLcontextModes *mode) -{ - memset(mode, 0, sizeof(*mode)); - - mode->rgbMode = GL_TRUE; /* no color index */ - mode->colorIndexMode = GL_FALSE; - mode->doubleBufferMode = GL_TRUE; /* always DB for now */ - mode->stereoMode = GL_FALSE; - - mode->redBits = GET_CONFIG_ATTRIB(config, EGL_RED_SIZE); - mode->greenBits = GET_CONFIG_ATTRIB(config, EGL_GREEN_SIZE); - mode->blueBits = GET_CONFIG_ATTRIB(config, EGL_BLUE_SIZE); - mode->alphaBits = GET_CONFIG_ATTRIB(config, EGL_ALPHA_SIZE); - mode->rgbBits = GET_CONFIG_ATTRIB(config, EGL_BUFFER_SIZE); - - /* no rgba masks - fix? */ - - mode->depthBits = GET_CONFIG_ATTRIB(config, EGL_DEPTH_SIZE); - mode->haveDepthBuffer = mode->depthBits > 0; - - mode->stencilBits = GET_CONFIG_ATTRIB(config, EGL_STENCIL_SIZE); - mode->haveStencilBuffer = mode->stencilBits > 0; - - /* no accum */ - - mode->level = GET_CONFIG_ATTRIB(config, EGL_LEVEL); - mode->samples = GET_CONFIG_ATTRIB(config, EGL_SAMPLES); - mode->sampleBuffers = GET_CONFIG_ATTRIB(config, EGL_SAMPLE_BUFFERS); - - /* surface type - not really needed */ - mode->visualType = GLX_TRUE_COLOR; - mode->renderType = GLX_RGBA_BIT; -} - - -void -_eglSetConfigAttrib(_EGLConfig *config, EGLint attr, EGLint val) -{ - assert(attr >= FIRST_ATTRIB); - assert(attr < FIRST_ATTRIB + MAX_ATTRIBS); - config->Attrib[attr - FIRST_ATTRIB] = val; -} - - -/** - * Init the given _EGLconfig to default values. - * \param id the configuration's ID. - */ -void -_eglInitConfig(_EGLConfig *config, EGLint id) -{ - memset(config, 0, sizeof(*config)); - config->Handle = id; - _eglSetConfigAttrib(config, EGL_CONFIG_ID, id); - _eglSetConfigAttrib(config, EGL_BIND_TO_TEXTURE_RGB, EGL_DONT_CARE); - _eglSetConfigAttrib(config, EGL_BIND_TO_TEXTURE_RGBA, EGL_DONT_CARE); - _eglSetConfigAttrib(config, EGL_CONFIG_CAVEAT, EGL_DONT_CARE); - _eglSetConfigAttrib(config, EGL_NATIVE_RENDERABLE, EGL_DONT_CARE); - _eglSetConfigAttrib(config, EGL_NATIVE_VISUAL_TYPE, EGL_DONT_CARE); - _eglSetConfigAttrib(config, EGL_MIN_SWAP_INTERVAL, EGL_DONT_CARE); - _eglSetConfigAttrib(config, EGL_MAX_SWAP_INTERVAL, EGL_DONT_CARE); - _eglSetConfigAttrib(config, EGL_SURFACE_TYPE, - EGL_SCREEN_BIT_MESA | EGL_PBUFFER_BIT | - EGL_PIXMAP_BIT | EGL_WINDOW_BIT); - _eglSetConfigAttrib(config, EGL_TRANSPARENT_TYPE, EGL_NONE); - _eglSetConfigAttrib(config, EGL_TRANSPARENT_RED_VALUE, EGL_DONT_CARE); - _eglSetConfigAttrib(config, EGL_TRANSPARENT_GREEN_VALUE, EGL_DONT_CARE); - _eglSetConfigAttrib(config, EGL_TRANSPARENT_BLUE_VALUE, EGL_DONT_CARE); -#ifdef EGL_VERSION_1_2 - _eglSetConfigAttrib(config, EGL_COLOR_BUFFER_TYPE, EGL_RGB_BUFFER); - _eglSetConfigAttrib(config, EGL_RENDERABLE_TYPE, EGL_OPENGL_ES_BIT); -#endif /* EGL_VERSION_1_2 */ -} - - -/** - * Given an EGLConfig handle, return the corresponding _EGLConfig object. - */ -_EGLConfig * -_eglLookupConfig(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config) -{ - EGLint i; - _EGLDisplay *disp = _eglLookupDisplay(dpy); - for (i = 0; i < disp->NumConfigs; i++) { - if (disp->Configs[i].Handle == config) { - return disp->Configs + i; - } - } - return NULL; -} - - -/** - * Add the given _EGLConfig to the given display. - */ -_EGLConfig * -_eglAddConfig(_EGLDisplay *display, const _EGLConfig *config) -{ - _EGLConfig *newConfigs; - EGLint n; - - n = display->NumConfigs; - - newConfigs = (_EGLConfig *) realloc(display->Configs, - (n + 1) * sizeof(_EGLConfig)); - if (newConfigs) { - display->Configs = newConfigs; - display->Configs[n] = *config; /* copy struct */ - display->Configs[n].Handle = n; - display->NumConfigs++; - return display->Configs + n; - } - else { - return NULL; - } -} - - -/** - * Parse the attrib_list to fill in the fields of the given _eglConfig - * Return EGL_FALSE if any errors, EGL_TRUE otherwise. - */ -EGLBoolean -_eglParseConfigAttribs(_EGLConfig *config, const EGLint *attrib_list) -{ - EGLint i; - - /* set all config attribs to EGL_DONT_CARE */ - for (i = 0; i < MAX_ATTRIBS; i++) { - config->Attrib[i] = EGL_DONT_CARE; - } - - for (i = 0; attrib_list && attrib_list[i] != EGL_NONE; i++) { - const EGLint attr = attrib_list[i]; - if (attr >= EGL_BUFFER_SIZE && - attr <= EGL_MAX_SWAP_INTERVAL) { - EGLint k = attr - FIRST_ATTRIB; - assert(k >= 0); - assert(k < MAX_ATTRIBS); - config->Attrib[k] = attrib_list[++i]; - } -#ifdef EGL_VERSION_1_2 - else if (attr == EGL_COLOR_BUFFER_TYPE) { - EGLint bufType = attrib_list[++i]; - if (bufType != EGL_RGB_BUFFER && bufType != EGL_LUMINANCE_BUFFER) { - _eglError(EGL_BAD_ATTRIBUTE, "eglChooseConfig"); - return EGL_FALSE; - } - _eglSetConfigAttrib(config, EGL_COLOR_BUFFER_TYPE, bufType); - } - else if (attr == EGL_RENDERABLE_TYPE) { - EGLint renType = attrib_list[++i]; - if (renType & ~(EGL_OPENGL_ES_BIT | EGL_OPENVG_BIT)) { - _eglError(EGL_BAD_ATTRIBUTE, "eglChooseConfig"); - return EGL_FALSE; - } - _eglSetConfigAttrib(config, EGL_RENDERABLE_TYPE, renType); - } - else if (attr == EGL_ALPHA_MASK_SIZE || - attr == EGL_LUMINANCE_SIZE) { - EGLint value = attrib_list[++i]; - _eglSetConfigAttrib(config, attr, value); - } -#endif /* EGL_VERSION_1_2 */ - else { - _eglError(EGL_BAD_ATTRIBUTE, "eglChooseConfig"); - return EGL_FALSE; - } - } - return EGL_TRUE; -} - - -#define EXACT 1 -#define ATLEAST 2 -#define MASK 3 -#define SMALLER 4 -#define SPECIAL 5 -#define NONE 6 - -struct sort_info { - EGLint Attribute; - EGLint MatchCriteria; - EGLint SortOrder; -}; - -/* This encodes the info from Table 3.5 of the EGL spec, ordered by - * Sort Priority. - * - * XXX To do: EGL 1.2 attribs - */ -static struct sort_info SortInfo[] = { - { EGL_CONFIG_CAVEAT, EXACT, SPECIAL }, - { EGL_RED_SIZE, ATLEAST, SPECIAL }, - { EGL_GREEN_SIZE, ATLEAST, SPECIAL }, - { EGL_BLUE_SIZE, ATLEAST, SPECIAL }, - { EGL_ALPHA_SIZE, ATLEAST, SPECIAL }, - { EGL_BUFFER_SIZE, ATLEAST, SMALLER }, - { EGL_SAMPLE_BUFFERS, ATLEAST, SMALLER }, - { EGL_SAMPLES, ATLEAST, SMALLER }, - { EGL_DEPTH_SIZE, ATLEAST, SMALLER }, - { EGL_STENCIL_SIZE, ATLEAST, SMALLER }, - { EGL_NATIVE_VISUAL_TYPE, EXACT, SPECIAL }, - { EGL_CONFIG_ID, EXACT, SMALLER }, - { EGL_BIND_TO_TEXTURE_RGB, EXACT, NONE }, - { EGL_BIND_TO_TEXTURE_RGBA, EXACT, NONE }, - { EGL_LEVEL, EXACT, NONE }, - { EGL_NATIVE_RENDERABLE, EXACT, NONE }, - { EGL_MAX_SWAP_INTERVAL, EXACT, NONE }, - { EGL_MIN_SWAP_INTERVAL, EXACT, NONE }, - { EGL_SURFACE_TYPE, MASK, NONE }, - { EGL_TRANSPARENT_TYPE, EXACT, NONE }, - { EGL_TRANSPARENT_RED_VALUE, EXACT, NONE }, - { EGL_TRANSPARENT_GREEN_VALUE, EXACT, NONE }, - { EGL_TRANSPARENT_BLUE_VALUE, EXACT, NONE }, - { 0, 0, 0 } -}; - - -/** - * Return EGL_TRUE if the attributes of c meet or exceed the minimums - * specified by min. - */ -static EGLBoolean -_eglConfigQualifies(const _EGLConfig *c, const _EGLConfig *min) -{ - EGLint i; - for (i = 0; SortInfo[i].Attribute != 0; i++) { - const EGLint mv = GET_CONFIG_ATTRIB(min, SortInfo[i].Attribute); - if (mv != EGL_DONT_CARE) { - const EGLint cv = GET_CONFIG_ATTRIB(c, SortInfo[i].Attribute); - if (SortInfo[i].MatchCriteria == EXACT) { - if (cv != mv) { - return EGL_FALSE; - } - } - else if (SortInfo[i].MatchCriteria == ATLEAST) { - if (cv < mv) { - return EGL_FALSE; - } - } - else { - assert(SortInfo[i].MatchCriteria == MASK); - if ((mv & cv) != mv) { - return EGL_FALSE; - } - } - } - } - return EGL_TRUE; -} - - -/** - * Compare configs 'a' and 'b' and return -1 if a belongs before b, - * 1 if a belongs after b, or 0 if they're equal. - * Used by qsort(). - */ -static int -_eglCompareConfigs(const void *a, const void *b) -{ - const _EGLConfig *aConfig = (const _EGLConfig *) a; - const _EGLConfig *bConfig = (const _EGLConfig *) b; - EGLint i; - - for (i = 0; SortInfo[i].Attribute != 0; i++) { - const EGLint aVal = GET_CONFIG_ATTRIB(aConfig, SortInfo[i].Attribute); - const EGLint bVal = GET_CONFIG_ATTRIB(bConfig, SortInfo[i].Attribute); - if (SortInfo[i].SortOrder == SMALLER) { - if (aVal < bVal) - return -1; - else if (aVal > bVal) - return 1; - /* else, continue examining attribute values */ - } - else if (SortInfo[i].SortOrder == SPECIAL) { - if (SortInfo[i].Attribute == EGL_CONFIG_CAVEAT) { - /* values are EGL_NONE, SLOW_CONFIG, or NON_CONFORMANT_CONFIG */ - if (aVal < bVal) - return -1; - else if (aVal > bVal) - return 1; - } - else if (SortInfo[i].Attribute == EGL_RED_SIZE || - SortInfo[i].Attribute == EGL_GREEN_SIZE || - SortInfo[i].Attribute == EGL_BLUE_SIZE || - SortInfo[i].Attribute == EGL_ALPHA_SIZE) { - if (aVal > bVal) - return -1; - else if (aVal < bVal) - return 1; - } - else { - assert(SortInfo[i].Attribute == EGL_NATIVE_VISUAL_TYPE); - if (aVal < bVal) - return -1; - else if (aVal > bVal) - return 1; - } - } - else { - assert(SortInfo[i].SortOrder == NONE); - /* continue examining attribute values */ - } - } - - /* all attributes identical */ - return 0; -} - - -/** - * Typical fallback routine for eglChooseConfig - */ -EGLBoolean -_eglChooseConfig(_EGLDriver *drv, EGLDisplay dpy, const EGLint *attrib_list, - EGLConfig *configs, EGLint config_size, EGLint *num_configs) -{ - _EGLDisplay *disp = _eglLookupDisplay(dpy); - _EGLConfig **configList, criteria; - EGLint i, count; - - /* parse the attrib_list to initialize criteria */ - if (!_eglParseConfigAttribs(&criteria, attrib_list)) { - return EGL_FALSE; - } - - /* allocate array of config pointers */ - configList = (_EGLConfig **) malloc(config_size * sizeof(_EGLConfig *)); - if (!configList) { - _eglError(EGL_BAD_CONFIG, "eglChooseConfig(out of memory)"); - return EGL_FALSE; - } - - /* make array of pointers to qualifying configs */ - for (i = count = 0; i < disp->NumConfigs && count < config_size; i++) { - if (_eglConfigQualifies(disp->Configs + i, &criteria)) { - configList[count++] = disp->Configs + i; - } - } - - /* sort array of pointers */ - qsort(configList, count, sizeof(_EGLConfig *), _eglCompareConfigs); - - /* copy config handles to output array */ - for (i = 0; i < count; i++) { - configs[i] = configList[i]->Handle; - } - - free(configList); - - *num_configs = count; - - return EGL_TRUE; -} - - -/** - * Fallback for eglGetConfigAttrib. - */ -EGLBoolean -_eglGetConfigAttrib(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config, - EGLint attribute, EGLint *value) -{ - const _EGLConfig *conf = _eglLookupConfig(drv, dpy, config); - const EGLint k = attribute - FIRST_ATTRIB; - if (k >= 0 && k < MAX_ATTRIBS) { - *value = conf->Attrib[k]; - return EGL_TRUE; - } - else { - _eglError(EGL_BAD_ATTRIBUTE, "eglGetConfigAttrib"); - return EGL_FALSE; - } -} - - -/** - * Fallback for eglGetConfigs. - */ -EGLBoolean -_eglGetConfigs(_EGLDriver *drv, EGLDisplay dpy, EGLConfig *configs, - EGLint config_size, EGLint *num_config) -{ - _EGLDisplay *disp = _eglLookupDisplay(dpy); - - if (!drv->Initialized) { - _eglError(EGL_NOT_INITIALIZED, "eglGetConfigs"); - return EGL_FALSE; - } - - if (configs) { - EGLint i; - *num_config = MIN2(disp->NumConfigs, config_size); - for (i = 0; i < *num_config; i++) { - configs[i] = disp->Configs[i].Handle; - } - } - else { - /* just return total number of supported configs */ - *num_config = disp->NumConfigs; - } - - return EGL_TRUE; -} - - -/** - * Creates a set of \c __GLcontextModes that a driver will expose. - * - * A set of \c __GLcontextModes will be created based on the supplied - * parameters. The number of modes processed will be 2 * - * \c num_depth_stencil_bits * \c num_db_modes. - * - * For the most part, data is just copied from \c depth_bits, \c stencil_bits, - * \c db_modes, and \c visType into each \c __GLcontextModes element. - * However, the meanings of \c fb_format and \c fb_type require further - * explanation. The \c fb_format specifies which color components are in - * each pixel and what the default order is. For example, \c GL_RGB specifies - * that red, green, blue are available and red is in the "most significant" - * position and blue is in the "least significant". The \c fb_type specifies - * the bit sizes of each component and the actual ordering. For example, if - * \c GL_UNSIGNED_SHORT_5_6_5_REV is specified with \c GL_RGB, bits [15:11] - * are the blue value, bits [10:5] are the green value, and bits [4:0] are - * the red value. - * - * One sublte issue is the combination of \c GL_RGB or \c GL_BGR and either - * of the \c GL_UNSIGNED_INT_8_8_8_8 modes. The resulting mask values in the - * \c __GLcontextModes structure is \b identical to the \c GL_RGBA or - * \c GL_BGRA case, except the \c alphaMask is zero. This means that, as - * far as this routine is concerned, \c GL_RGB with \c GL_UNSIGNED_INT_8_8_8_8 - * still uses 32-bits. - * - * If in doubt, look at the tables used in the function. - * - * \param ptr_to_modes Pointer to a pointer to a linked list of - * \c __GLcontextModes. Upon completion, a pointer to - * the next element to be process will be stored here. - * If the function fails and returns \c GL_FALSE, this - * value will be unmodified, but some elements in the - * linked list may be modified. - * \param fb_format Format of the framebuffer. Currently only \c GL_RGB, - * \c GL_RGBA, \c GL_BGR, and \c GL_BGRA are supported. - * \param fb_type Type of the pixels in the framebuffer. Currently only - * \c GL_UNSIGNED_SHORT_5_6_5, - * \c GL_UNSIGNED_SHORT_5_6_5_REV, - * \c GL_UNSIGNED_INT_8_8_8_8, and - * \c GL_UNSIGNED_INT_8_8_8_8_REV are supported. - * \param depth_bits Array of depth buffer sizes to be exposed. - * \param stencil_bits Array of stencil buffer sizes to be exposed. - * \param num_depth_stencil_bits Number of entries in both \c depth_bits and - * \c stencil_bits. - * \param db_modes Array of buffer swap modes. If an element has a - * value of \c GLX_NONE, then it represents a - * single-buffered mode. Other valid values are - * \c GLX_SWAP_EXCHANGE_OML, \c GLX_SWAP_COPY_OML, and - * \c GLX_SWAP_UNDEFINED_OML. See the - * GLX_OML_swap_method extension spec for more details. - * \param num_db_modes Number of entries in \c db_modes. - * \param visType GLX visual type. Usually either \c GLX_TRUE_COLOR or - * \c GLX_DIRECT_COLOR. - * - * \returns - * \c GL_TRUE on success or \c GL_FALSE on failure. Currently the only - * cause of failure is a bad parameter (i.e., unsupported \c fb_format or - * \c fb_type). - * - * \todo - * There is currently no way to support packed RGB modes (i.e., modes with - * exactly 3 bytes per pixel) or floating-point modes. This could probably - * be done by creating some new, private enums with clever names likes - * \c GL_UNSIGNED_3BYTE_8_8_8, \c GL_4FLOAT_32_32_32_32, - * \c GL_4HALF_16_16_16_16, etc. We can cross that bridge when we come to it. - */ -GLboolean -_eglFillInConfigs(_EGLConfig * configs, - GLenum fb_format, GLenum fb_type, - const uint8_t * depth_bits, const uint8_t * stencil_bits, - unsigned num_depth_stencil_bits, - const GLenum * db_modes, unsigned num_db_modes, - int visType) -{ - static const uint8_t bits_table[3][4] = { - /* R G B A */ - { 5, 6, 5, 0 }, /* Any GL_UNSIGNED_SHORT_5_6_5 */ - { 8, 8, 8, 0 }, /* Any RGB with any GL_UNSIGNED_INT_8_8_8_8 */ - { 8, 8, 8, 8 } /* Any RGBA with any GL_UNSIGNED_INT_8_8_8_8 */ - }; - - /* The following arrays are all indexed by the fb_type masked with 0x07. - * Given the four supported fb_type values, this results in valid array - * indices of 3, 4, 5, and 7. - */ - static const uint32_t masks_table_rgb[8][4] = { - {0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000F800, 0x000007E0, 0x0000001F, 0x00000000}, /* 5_6_5 */ - {0x0000001F, 0x000007E0, 0x0000F800, 0x00000000}, /* 5_6_5_REV */ - {0xFF000000, 0x00FF0000, 0x0000FF00, 0x00000000}, /* 8_8_8_8 */ - {0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x000000FF, 0x0000FF00, 0x00FF0000, 0x00000000} /* 8_8_8_8_REV */ - }; - - static const uint32_t masks_table_rgba[8][4] = { - {0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000F800, 0x000007E0, 0x0000001F, 0x00000000}, /* 5_6_5 */ - {0x0000001F, 0x000007E0, 0x0000F800, 0x00000000}, /* 5_6_5_REV */ - {0xFF000000, 0x00FF0000, 0x0000FF00, 0x000000FF}, /* 8_8_8_8 */ - {0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x000000FF, 0x0000FF00, 0x00FF0000, 0xFF000000}, /* 8_8_8_8_REV */ - }; - - static const uint32_t masks_table_bgr[8][4] = { - {0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000001F, 0x000007E0, 0x0000F800, 0x00000000}, /* 5_6_5 */ - {0x0000F800, 0x000007E0, 0x0000001F, 0x00000000}, /* 5_6_5_REV */ - {0x0000FF00, 0x00FF0000, 0xFF000000, 0x00000000}, /* 8_8_8_8 */ - {0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x00FF0000, 0x0000FF00, 0x000000FF, 0x00000000}, /* 8_8_8_8_REV */ - }; - - static const uint32_t masks_table_bgra[8][4] = { - {0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000001F, 0x000007E0, 0x0000F800, 0x00000000}, /* 5_6_5 */ - {0x0000F800, 0x000007E0, 0x0000001F, 0x00000000}, /* 5_6_5_REV */ - {0x0000FF00, 0x00FF0000, 0xFF000000, 0x000000FF}, /* 8_8_8_8 */ - {0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x00FF0000, 0x0000FF00, 0x000000FF, 0xFF000000}, /* 8_8_8_8_REV */ - }; - - static const uint8_t bytes_per_pixel[8] = { - 0, 0, 0, 2, 2, 4, 0, 4 - }; - - const uint8_t * bits; - const uint32_t * masks; - const int index = fb_type & 0x07; - _EGLConfig *config; - unsigned i; - unsigned j; - unsigned k; - - if ( bytes_per_pixel[index] == 0 ) { - _eglLog(_EGL_INFO, - "[%s:%u] Framebuffer type 0x%04x has 0 bytes per pixel.", - __FUNCTION__, __LINE__, fb_type); - return GL_FALSE; - } - - /* Valid types are GL_UNSIGNED_SHORT_5_6_5 and GL_UNSIGNED_INT_8_8_8_8 and - * the _REV versions. - * - * Valid formats are GL_RGBA, GL_RGB, and GL_BGRA. - */ - switch ( fb_format ) { - case GL_RGB: - bits = (bytes_per_pixel[index] == 2) ? bits_table[0] : bits_table[1]; - masks = masks_table_rgb[index]; - break; - - case GL_RGBA: - bits = (bytes_per_pixel[index] == 2) ? bits_table[0] : bits_table[2]; - masks = masks_table_rgba[index]; - break; - - case GL_BGR: - bits = (bytes_per_pixel[index] == 2) ? bits_table[0] : bits_table[1]; - masks = masks_table_bgr[index]; - break; - - case GL_BGRA: - bits = (bytes_per_pixel[index] == 2) ? bits_table[0] : bits_table[2]; - masks = masks_table_bgra[index]; - break; - - default: - _eglLog(_EGL_WARNING, - "[%s:%u] Framebuffer format 0x%04x is not GL_RGB, GL_RGBA, GL_BGR, or GL_BGRA.", - __FUNCTION__, __LINE__, fb_format); - return GL_FALSE; - } - - config = configs; - for (k = 0; k < num_depth_stencil_bits; k++) { - for (i = 0; i < num_db_modes; i++) { - for (j = 0; j < 2; j++) { - _eglSetConfigAttrib(config, EGL_RED_SIZE, bits[0]); - _eglSetConfigAttrib(config, EGL_GREEN_SIZE, bits[1]); - _eglSetConfigAttrib(config, EGL_BLUE_SIZE, bits[2]); - _eglSetConfigAttrib(config, EGL_ALPHA_SIZE, bits[3]); - _eglSetConfigAttrib(config, EGL_BUFFER_SIZE, - bits[0] + bits[1] + bits[2] + bits[3]); - - _eglSetConfigAttrib(config, EGL_STENCIL_SIZE, stencil_bits[k]); - _eglSetConfigAttrib(config, EGL_DEPTH_SIZE, depth_bits[i]); - - _eglSetConfigAttrib(config, EGL_SURFACE_TYPE, EGL_SCREEN_BIT_MESA | - EGL_PBUFFER_BIT | EGL_PIXMAP_BIT | EGL_WINDOW_BIT); - - config++; - } - } - } - return GL_TRUE; -} diff --git a/src/egl/main/eglconfig.h b/src/egl/main/eglconfig.h deleted file mode 100644 index 441b3f4d20..0000000000 --- a/src/egl/main/eglconfig.h +++ /dev/null @@ -1,67 +0,0 @@ -#ifndef EGLCONFIG_INCLUDED -#define EGLCONFIG_INCLUDED - - -#include "egltypedefs.h" -#include "GL/internal/glcore.h" - - -#define MAX_ATTRIBS 100 -#define FIRST_ATTRIB EGL_BUFFER_SIZE - - -struct _egl_config -{ - EGLConfig Handle; /* the public/opaque handle which names this config */ - EGLint Attrib[MAX_ATTRIBS]; -}; - - -#define SET_CONFIG_ATTRIB(CONF, ATTR, VAL) ((CONF)->Attrib[(ATTR) - FIRST_ATTRIB] = VAL) -#define GET_CONFIG_ATTRIB(CONF, ATTR) ((CONF)->Attrib[(ATTR) - FIRST_ATTRIB]) - - -extern void -_eglInitConfig(_EGLConfig *config, EGLint id); - - -extern _EGLConfig * -_eglLookupConfig(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config); - - -extern _EGLConfig * -_eglAddConfig(_EGLDisplay *display, const _EGLConfig *config); - - -extern EGLBoolean -_eglParseConfigAttribs(_EGLConfig *config, const EGLint *attrib_list); - - -extern EGLBoolean -_eglChooseConfig(_EGLDriver *drv, EGLDisplay dpy, const EGLint *attrib_list, EGLConfig *configs, EGLint config_size, EGLint *num_config); - - -extern EGLBoolean -_eglGetConfigAttrib(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config, EGLint attribute, EGLint *value); - - -extern EGLBoolean -_eglGetConfigs(_EGLDriver *drv, EGLDisplay dpy, EGLConfig *configs, EGLint config_size, EGLint *num_config); - - -extern void -_eglSetConfigAttrib(_EGLConfig *config, EGLint attr, EGLint val); - -extern GLboolean -_eglFillInConfigs( _EGLConfig *configs, - GLenum fb_format, GLenum fb_type, - const uint8_t * depth_bits, const uint8_t * stencil_bits, - unsigned num_depth_stencil_bits, - const GLenum * db_modes, unsigned num_db_modes, - int visType ); - -extern void -_eglConfigToContextModesRec(const _EGLConfig *config, __GLcontextModes *mode); - - -#endif /* EGLCONFIG_INCLUDED */ diff --git a/src/egl/main/eglcontext.c b/src/egl/main/eglcontext.c deleted file mode 100644 index 374c006dae..0000000000 --- a/src/egl/main/eglcontext.c +++ /dev/null @@ -1,276 +0,0 @@ -#include -#include -#include -#include "eglconfig.h" -#include "eglcontext.h" -#include "egldisplay.h" -#include "egldriver.h" -#include "eglglobals.h" -#include "eglhash.h" -#include "eglsurface.h" - - -/** - * Initialize the given _EGLContext object to defaults. - */ -EGLBoolean -_eglInitContext(_EGLDriver *drv, EGLDisplay dpy, _EGLContext *ctx, - EGLConfig config, const EGLint *attrib_list) -{ - _EGLConfig *conf; - _EGLDisplay *display = _eglLookupDisplay(dpy); - EGLint i; - - conf = _eglLookupConfig(drv, dpy, config); - if (!conf) { - _eglError(EGL_BAD_CONFIG, "eglCreateContext"); - return EGL_FALSE; - } - - for (i = 0; attrib_list && attrib_list[i] != EGL_NONE; i++) { - switch (attrib_list[i]) { - /* no attribs defined for now */ - default: - _eglError(EGL_BAD_ATTRIBUTE, "eglCreateContext"); - return EGL_NO_CONTEXT; - } - } - - memset(ctx, 0, sizeof(_EGLContext)); - ctx->Display = display; - ctx->Config = conf; - ctx->DrawSurface = EGL_NO_SURFACE; - ctx->ReadSurface = EGL_NO_SURFACE; - - return EGL_TRUE; -} - - -/* - * Assign an EGLContext handle to the _EGLContext object then put it into - * the hash table. - */ -void -_eglSaveContext(_EGLContext *ctx) -{ - assert(ctx); - ctx->Handle = _eglHashGenKey(_eglGlobal.Contexts); - _eglHashInsert(_eglGlobal.Contexts, ctx->Handle, ctx); -} - - -/** - * Remove the given _EGLContext object from the hash table. - */ -void -_eglRemoveContext(_EGLContext *ctx) -{ - _eglHashRemove(_eglGlobal.Contexts, ctx->Handle); -} - - -/** - * Return the _EGLContext object that corresponds to the given - * EGLContext handle. - */ -_EGLContext * -_eglLookupContext(EGLContext ctx) -{ - _EGLContext *c = (_EGLContext *) _eglHashLookup(_eglGlobal.Contexts, ctx); - return c; -} - - -/** - * Return the currently bound _EGLContext object, or NULL. - */ -_EGLContext * -_eglGetCurrentContext(void) -{ - _EGLThreadInfo *t = _eglGetCurrentThread(); - return t->CurrentContext; -} - - -/** - * Just a placeholder/demo function. Real driver will never use this! - */ -EGLContext -_eglCreateContext(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config, - EGLContext share_list, const EGLint *attrib_list) -{ -#if 0 /* example code */ - _EGLContext *context; - - context = (_EGLContext *) calloc(1, sizeof(_EGLContext)); - if (!context) - return EGL_NO_CONTEXT; - - if (!_eglInitContext(drv, dpy, context, config, attrib_list)) { - free(context); - return EGL_NO_CONTEXT; - } - - _eglSaveContext(context); - return context->Handle; -#endif - return EGL_NO_CONTEXT; -} - - -/** - * Default fallback routine - drivers should usually override this. - */ -EGLBoolean -_eglDestroyContext(_EGLDriver *drv, EGLDisplay dpy, EGLContext ctx) -{ - _EGLContext *context = _eglLookupContext(ctx); - if (context) { - _eglHashRemove(_eglGlobal.Contexts, ctx); - if (context->IsBound) { - context->DeletePending = EGL_TRUE; - } - else { - free(context); - } - return EGL_TRUE; - } - else { - _eglError(EGL_BAD_CONTEXT, "eglDestroyContext"); - return EGL_TRUE; - } -} - - -EGLBoolean -_eglQueryContext(_EGLDriver *drv, EGLDisplay dpy, EGLContext ctx, - EGLint attribute, EGLint *value) -{ - _EGLContext *c = _eglLookupContext(ctx); - - (void) drv; - (void) dpy; - - if (!c) { - _eglError(EGL_BAD_CONTEXT, "eglQueryContext"); - return EGL_FALSE; - } - - switch (attribute) { - case EGL_CONFIG_ID: - *value = GET_CONFIG_ATTRIB(c->Config, EGL_CONFIG_ID); - return EGL_TRUE; -#ifdef EGL_VERSION_1_2 - case EGL_CONTEXT_CLIENT_TYPE: - *value = c->ClientAPI; - return EGL_FALSE; -#endif /* EGL_VERSION_1_2 */ - default: - _eglError(EGL_BAD_ATTRIBUTE, "eglQueryContext"); - return EGL_FALSE; - } -} - - -/** - * Drivers will typically call this to do the error checking and - * update the various IsBound and DeletePending flags. - * Then, the driver will do its device-dependent Make-Current stuff. - */ -EGLBoolean -_eglMakeCurrent(_EGLDriver *drv, EGLDisplay dpy, EGLSurface d, - EGLSurface r, EGLContext context) -{ - _EGLThreadInfo *t = _eglGetCurrentThread(); - _EGLContext *ctx = _eglLookupContext(context); - _EGLSurface *draw = _eglLookupSurface(d); - _EGLSurface *read = _eglLookupSurface(r); - - _EGLContext *oldContext = _eglGetCurrentContext(); - _EGLSurface *oldDrawSurface = _eglGetCurrentSurface(EGL_DRAW); - _EGLSurface *oldReadSurface = _eglGetCurrentSurface(EGL_READ); - - /* error checking */ - if (ctx) { - if (draw == NULL || read == NULL) { - _eglError(EGL_BAD_MATCH, "eglMakeCurrent"); - return EGL_FALSE; - } - if (draw->Config != ctx->Config) { - _eglError(EGL_BAD_MATCH, "eglMakeCurrent"); - return EGL_FALSE; - } - if (read->Config != ctx->Config) { - _eglError(EGL_BAD_MATCH, "eglMakeCurrent"); - return EGL_FALSE; - } - } - - /* - * check if the old context or surfaces need to be deleted - */ - if (oldDrawSurface != NULL) { - oldDrawSurface->IsBound = EGL_FALSE; - if (oldDrawSurface->DeletePending) { - /* make sure we don't try to rebind a deleted surface */ - if (draw == oldDrawSurface || draw == oldReadSurface) { - draw = NULL; - } - /* really delete surface now */ - drv->API.DestroySurface(drv, dpy, oldDrawSurface->Handle); - } - } - if (oldReadSurface != NULL && oldReadSurface != oldDrawSurface) { - oldReadSurface->IsBound = EGL_FALSE; - if (oldReadSurface->DeletePending) { - /* make sure we don't try to rebind a deleted surface */ - if (read == oldDrawSurface || read == oldReadSurface) { - read = NULL; - } - /* really delete surface now */ - drv->API.DestroySurface(drv, dpy, oldReadSurface->Handle); - } - } - if (oldContext != NULL) { - oldContext->IsBound = EGL_FALSE; - if (oldContext->DeletePending) { - /* make sure we don't try to rebind a deleted context */ - if (ctx == oldContext) { - ctx = NULL; - } - /* really delete context now */ - drv->API.DestroyContext(drv, dpy, oldContext->Handle); - } - } - - if (ctx) { - /* check read/draw again, in case we deleted them above */ - if (draw == NULL || read == NULL) { - _eglError(EGL_BAD_MATCH, "eglMakeCurrent"); - return EGL_FALSE; - } - ctx->DrawSurface = draw; - ctx->ReadSurface = read; - ctx->IsBound = EGL_TRUE; - draw->IsBound = EGL_TRUE; - read->IsBound = EGL_TRUE; - } - - t->CurrentContext = ctx; - - return EGL_TRUE; -} - - -/** - * This is defined by the EGL_MESA_copy_context extension. - */ -EGLBoolean -_eglCopyContextMESA(_EGLDriver *drv, EGLDisplay dpy, EGLContext source, - EGLContext dest, EGLint mask) -{ - /* This function will always have to be overridden/implemented in the - * device driver. If the driver is based on Mesa, use _mesa_copy_context(). - */ - return EGL_FALSE; -} diff --git a/src/egl/main/eglcontext.h b/src/egl/main/eglcontext.h deleted file mode 100644 index 82bfde151f..0000000000 --- a/src/egl/main/eglcontext.h +++ /dev/null @@ -1,71 +0,0 @@ - -#ifndef EGLCONTEXT_INCLUDED -#define EGLCONTEXT_INCLUDED - - -#include "egltypedefs.h" - - -/** - * "Base" class for device driver contexts. - */ -struct _egl_context -{ - EGLContext Handle; /* The public/opaque handle which names this object */ - - _EGLDisplay *Display; /* who do I belong to? */ - - _EGLConfig *Config; - - _EGLSurface *DrawSurface; - _EGLSurface *ReadSurface; - - EGLBoolean IsBound; - EGLBoolean DeletePending; -#ifdef EGL_VERSION_1_2 - EGLint ClientAPI; /* Either EGL_OPENGL_ES_API or EGL_OPENVG_API */ -#endif /* EGL_VERSION_1_2 */ -}; - - -extern EGLBoolean -_eglInitContext(_EGLDriver *drv, EGLDisplay dpy, _EGLContext *ctx, - EGLConfig config, const EGLint *attrib_list); - - -extern void -_eglSaveContext(_EGLContext *ctx); - - -extern void -_eglRemoveContext(_EGLContext *ctx); - - -extern _EGLContext * -_eglLookupContext(EGLContext ctx); - - -extern _EGLContext * -_eglGetCurrentContext(void); - - -extern EGLContext -_eglCreateContext(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config, EGLContext share_list, const EGLint *attrib_list); - - -extern EGLBoolean -_eglDestroyContext(_EGLDriver *drv, EGLDisplay dpy, EGLContext ctx); - - -extern EGLBoolean -_eglQueryContext(_EGLDriver *drv, EGLDisplay dpy, EGLContext ctx, EGLint attribute, EGLint *value); - - -extern EGLBoolean -_eglMakeCurrent(_EGLDriver *drv, EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext ctx); - - -extern EGLBoolean -_eglCopyContextMESA(_EGLDriver *drv, EGLDisplay dpy, EGLContext source, EGLContext dest, EGLint mask); - -#endif /* EGLCONTEXT_INCLUDED */ diff --git a/src/egl/main/egldisplay.c b/src/egl/main/egldisplay.c deleted file mode 100644 index 074a85bf26..0000000000 --- a/src/egl/main/egldisplay.c +++ /dev/null @@ -1,71 +0,0 @@ -#include -#include -#include "eglcontext.h" -#include "egldisplay.h" -#include "eglglobals.h" -#include "eglhash.h" - - -static char * -my_strdup(const char *s) -{ - int l = strlen(s); - char *s2 = malloc(l + 1); - strcpy(s2, s); - return s2; -} - - -/** - * We're assuming that the NativeDisplayType parameter is actually - * a string. - * Return a new _EGLDisplay object for the given displayName - */ -_EGLDisplay * -_eglNewDisplay(NativeDisplayType displayName) -{ - _EGLDisplay *dpy = (_EGLDisplay *) calloc(1, sizeof(_EGLDisplay)); - if (dpy) { - dpy->Handle = _eglHashGenKey(_eglGlobal.Displays); - _eglHashInsert(_eglGlobal.Displays, dpy->Handle, dpy); - if (displayName) - dpy->Name = my_strdup(displayName); - else - dpy->Name = NULL; - dpy->Driver = NULL; /* this gets set later */ - } - return dpy; -} - - -/** - * Return the _EGLDisplay object that corresponds to the given public/ - * opaque display handle. - */ -_EGLDisplay * -_eglLookupDisplay(EGLDisplay dpy) -{ - _EGLDisplay *d = (_EGLDisplay *) _eglHashLookup(_eglGlobal.Displays, dpy); - return d; -} - - -_EGLDisplay * -_eglGetCurrentDisplay(void) -{ - _EGLContext *ctx = _eglGetCurrentContext(); - if (ctx) - return ctx->Display; - else - return NULL; -} - - -void -_eglCleanupDisplay(_EGLDisplay *disp) -{ - /* XXX incomplete */ - free(disp->Configs); - free(disp->Name); - /* driver deletes _EGLDisplay */ -} diff --git a/src/egl/main/egldisplay.h b/src/egl/main/egldisplay.h deleted file mode 100644 index 1a03fdd4ad..0000000000 --- a/src/egl/main/egldisplay.h +++ /dev/null @@ -1,44 +0,0 @@ -#ifndef EGLDISPLAY_INCLUDED -#define EGLDISPLAY_INCLUDED - - -#include "egltypedefs.h" - - -struct _egl_display -{ - EGLDisplay Handle; - - char *Name; - _EGLDriver *Driver; - - EGLint NumScreens; - _EGLScreen **Screens; /* array [NumScreens] */ - - EGLint NumConfigs; - _EGLConfig *Configs; /* array [NumConfigs] */ -}; - - -extern _EGLDisplay * -_eglNewDisplay(NativeDisplayType displayName); - - -extern _EGLDisplay * -_eglLookupDisplay(EGLDisplay dpy); - - -extern _EGLDisplay * -_eglGetCurrentDisplay(void); - - -extern void -_eglCleanupDisplay(_EGLDisplay *disp); - - -extern EGLBoolean -_eglQueryDisplayMESA(_EGLDriver *drv, EGLDisplay dpy, EGLint attrib, EGLint *value); - - - -#endif /* EGLDISPLAY_INCLUDED */ diff --git a/src/egl/main/egldriver.c b/src/egl/main/egldriver.c deleted file mode 100644 index bda06dd827..0000000000 --- a/src/egl/main/egldriver.c +++ /dev/null @@ -1,272 +0,0 @@ -#include -#include -#include -#include -#include "eglconfig.h" -#include "eglcontext.h" -#include "egldisplay.h" -#include "egldriver.h" -#include "eglglobals.h" -#include "egllog.h" -#include "eglmode.h" -#include "eglscreen.h" -#include "eglsurface.h" - - -const char *DefaultDriverName = "demodriver"; - - -/** - * Choose and open/init the hardware driver for the given EGLDisplay. - * Previously, the EGLDisplay was created with _eglNewDisplay() where - * we recorded the user's NativeDisplayType parameter. - * - * Now we'll use the NativeDisplayType value. - * - * Currently, the native display value is treated as a string. - * If the first character is ':' we interpret it as a screen or card index - * number (i.e. ":0" or ":1", etc) - * Else if the first character is '!' we interpret it as specific driver name - * (i.e. "!r200" or "!i830". - */ -_EGLDriver * -_eglChooseDriver(EGLDisplay display) -{ - _EGLDisplay *dpy = _eglLookupDisplay(display); - _EGLDriver *drv; - const char *driverName = DefaultDriverName; - const char *name; - - assert(dpy); - - name = dpy->Name; - if (!name) { - /* use default */ - } - else if (name[0] == ':' && (name[1] >= '0' && name[1] <= '9') && !name[2]) { - /* XXX probe hardware here to determine which driver to open */ - driverName = "libEGLdri"; - } - else if (name[0] == '!') { - /* use specified driver name */ - driverName = name + 1; - } - else { - /* Maybe display was returned by XOpenDisplay? */ - _eglLog(_EGL_FATAL, "eglChooseDriver() bad name"); - } - - _eglLog(_EGL_INFO, "eglChooseDriver() choosing %s", driverName); - - drv = _eglOpenDriver(dpy, driverName); - dpy->Driver = drv; - - return drv; -} - - -/** - * Open/load the named driver and call its bootstrap function: _eglMain(). - * \return new _EGLDriver object. - */ -_EGLDriver * -_eglOpenDriver(_EGLDisplay *dpy, const char *driverName) -{ - _EGLDriver *drv; - _EGLMain_t mainFunc; - void *lib; - char driverFilename[1000]; - - /* XXX also prepend a directory path??? */ - sprintf(driverFilename, "%s.so", driverName); - - _eglLog(_EGL_DEBUG, "dlopen(%s)", driverFilename); - lib = dlopen(driverFilename, RTLD_NOW); - if (!lib) { - _eglLog(_EGL_WARNING, "Could not open %s (%s)", - driverFilename, dlerror()); - return NULL; - } - - mainFunc = (_EGLMain_t) dlsym(lib, "_eglMain"); - if (!mainFunc) { - _eglLog(_EGL_WARNING, "_eglMain not found in %s", driverFilename); - dlclose(lib); - return NULL; - } - - drv = mainFunc(dpy); - if (!drv) { - dlclose(lib); - return NULL; - } - /* with a recurvise open you want the inner most handle */ - if (!drv->LibHandle) - drv->LibHandle = lib; - else - dlclose(lib); - - drv->Display = dpy; - return drv; -} - - -EGLBoolean -_eglCloseDriver(_EGLDriver *drv, EGLDisplay dpy) -{ - void *handle = drv->LibHandle; - EGLBoolean b; - - _eglLog(_EGL_INFO, "Closing driver"); - - /* - * XXX check for currently bound context/surfaces and delete them? - */ - - b = drv->API.Terminate(drv, dpy); - dlclose(handle); - return b; -} - - -/** - * Given a display handle, return the _EGLDriver for that display. - */ -_EGLDriver * -_eglLookupDriver(EGLDisplay dpy) -{ - _EGLDisplay *d = _eglLookupDisplay(dpy); - if (d) - return d->Driver; - else - return NULL; -} - - -/** - * Plug all the available fallback routines into the given driver's - * dispatch table. - */ -void -_eglInitDriverFallbacks(_EGLDriver *drv) -{ - /* If a pointer is set to NULL, then the device driver _really_ has - * to implement it. - */ - drv->API.Initialize = NULL; - drv->API.Terminate = NULL; - - drv->API.GetConfigs = _eglGetConfigs; - drv->API.ChooseConfig = _eglChooseConfig; - drv->API.GetConfigAttrib = _eglGetConfigAttrib; - - drv->API.CreateContext = _eglCreateContext; - drv->API.DestroyContext = _eglDestroyContext; - drv->API.MakeCurrent = _eglMakeCurrent; - drv->API.QueryContext = _eglQueryContext; - - drv->API.CreateWindowSurface = _eglCreateWindowSurface; - drv->API.CreatePixmapSurface = _eglCreatePixmapSurface; - drv->API.CreatePbufferSurface = _eglCreatePbufferSurface; - drv->API.DestroySurface = _eglDestroySurface; - drv->API.QuerySurface = _eglQuerySurface; - drv->API.SurfaceAttrib = _eglSurfaceAttrib; - drv->API.BindTexImage = _eglBindTexImage; - drv->API.ReleaseTexImage = _eglReleaseTexImage; - drv->API.SwapInterval = _eglSwapInterval; - drv->API.SwapBuffers = _eglSwapBuffers; - drv->API.CopyBuffers = _eglCopyBuffers; - - drv->API.QueryString = _eglQueryString; - drv->API.WaitGL = _eglWaitGL; - drv->API.WaitNative = _eglWaitNative; - -#ifdef EGL_MESA_screen_surface - drv->API.ChooseModeMESA = _eglChooseModeMESA; - drv->API.GetModesMESA = _eglGetModesMESA; - drv->API.GetModeAttribMESA = _eglGetModeAttribMESA; - drv->API.GetScreensMESA = _eglGetScreensMESA; - drv->API.CreateScreenSurfaceMESA = _eglCreateScreenSurfaceMESA; - drv->API.ShowScreenSurfaceMESA = _eglShowScreenSurfaceMESA; - drv->API.ScreenPositionMESA = _eglScreenPositionMESA; - drv->API.QueryScreenMESA = _eglQueryScreenMESA; - drv->API.QueryScreenSurfaceMESA = _eglQueryScreenSurfaceMESA; - drv->API.QueryScreenModeMESA = _eglQueryScreenModeMESA; - drv->API.QueryModeStringMESA = _eglQueryModeStringMESA; -#endif /* EGL_MESA_screen_surface */ - -#ifdef EGL_VERSION_1_2 - drv->API.CreatePbufferFromClientBuffer = _eglCreatePbufferFromClientBuffer; -#endif /* EGL_VERSION_1_2 */ -} - - -/** - * Examine the individual extension enable/disable flags and recompute - * the driver's Extensions string. - */ -static void -_eglUpdateExtensionsString(_EGLDriver *drv) -{ - drv->Extensions.String[0] = 0; - - if (drv->Extensions.MESA_screen_surface) - strcat(drv->Extensions.String, "EGL_MESA_screen_surface "); - if (drv->Extensions.MESA_copy_context) - strcat(drv->Extensions.String, "EGL_MESA_copy_context "); - assert(strlen(drv->Extensions.String) < MAX_EXTENSIONS_LEN); -} - - - -const char * -_eglQueryString(_EGLDriver *drv, EGLDisplay dpy, EGLint name) -{ - (void) drv; - (void) dpy; - switch (name) { - case EGL_VENDOR: - return "Mesa Project"; - case EGL_VERSION: - return "1.0"; - case EGL_EXTENSIONS: - _eglUpdateExtensionsString(drv); - return drv->Extensions.String; -#ifdef EGL_VERSION_1_2 - case EGL_CLIENT_APIS: - /* XXX need to initialize somewhere */ - return drv->ClientAPIs; -#endif - default: - _eglError(EGL_BAD_PARAMETER, "eglQueryString"); - return NULL; - } -} - - -EGLBoolean -_eglWaitGL(_EGLDriver *drv, EGLDisplay dpy) -{ - /* just a placeholder */ - (void) drv; - (void) dpy; - return EGL_TRUE; -} - - -EGLBoolean -_eglWaitNative(_EGLDriver *drv, EGLDisplay dpy, EGLint engine) -{ - /* just a placeholder */ - (void) drv; - (void) dpy; - switch (engine) { - case EGL_CORE_NATIVE_ENGINE: - break; - default: - _eglError(EGL_BAD_PARAMETER, "eglWaitNative(engine)"); - return EGL_FALSE; - } - - return EGL_TRUE; -} diff --git a/src/egl/main/egldriver.h b/src/egl/main/egldriver.h deleted file mode 100644 index 88526e973d..0000000000 --- a/src/egl/main/egldriver.h +++ /dev/null @@ -1,81 +0,0 @@ -#ifndef EGLDRIVER_INCLUDED -#define EGLDRIVER_INCLUDED - - -#include "egltypedefs.h" -#include "eglapi.h" - -/* should probably use a dynamic-length string, but this will do */ -#define MAX_EXTENSIONS_LEN 1000 - - -/** - * Optional EGL extensions info. - */ -struct _egl_extensions -{ - EGLBoolean MESA_screen_surface; - EGLBoolean MESA_copy_context; - - char String[MAX_EXTENSIONS_LEN]; -}; - - -/** - * Base class for device drivers. - */ -struct _egl_driver -{ - EGLBoolean Initialized; /* set by driver after initialized */ - - void *LibHandle; /* dlopen handle */ - - _EGLDisplay *Display; - - int ABIversion; - int APImajor, APIminor; /* returned through eglInitialize */ - const char *ClientAPIs; - - _EGLAPI API; - - _EGLExtensions Extensions; -}; - - -extern _EGLDriver *_eglMain(_EGLDisplay *dpy); - - -extern _EGLDriver * -_eglChooseDriver(EGLDisplay dpy); - - -extern _EGLDriver * -_eglOpenDriver(_EGLDisplay *dpy, const char *driverName); - - -extern EGLBoolean -_eglCloseDriver(_EGLDriver *drv, EGLDisplay dpy); - - -extern _EGLDriver * -_eglLookupDriver(EGLDisplay d); - - -extern void -_eglInitDriverFallbacks(_EGLDriver *drv); - - -extern const char * -_eglQueryString(_EGLDriver *drv, EGLDisplay dpy, EGLint name); - - -extern EGLBoolean -_eglWaitGL(_EGLDriver *drv, EGLDisplay dpy); - - -extern EGLBoolean -_eglWaitNative(_EGLDriver *drv, EGLDisplay dpy, EGLint engine); - - - -#endif /* EGLDRIVER_INCLUDED */ diff --git a/src/egl/main/eglglobals.c b/src/egl/main/eglglobals.c deleted file mode 100644 index 608311d749..0000000000 --- a/src/egl/main/eglglobals.c +++ /dev/null @@ -1,148 +0,0 @@ -#include -#include -#include "eglglobals.h" - - -struct _egl_global _eglGlobal = { .Initialized = EGL_FALSE }; - - -/** - * Init the fields in the _eglGlobal struct - * May be safely called more than once. - */ -void -_eglInitGlobals(void) -{ - if (!_eglGlobal.Initialized) { - _eglGlobal.Displays = _eglNewHashTable(); - _eglGlobal.Contexts = _eglNewHashTable(); - _eglGlobal.Surfaces = _eglNewHashTable(); - _eglGlobal.FreeScreenHandle = 1; - _eglGlobal.Initialized = EGL_TRUE; - - _eglGlobal.OpenGLESAPISupported = EGL_TRUE; - _eglGlobal.OpenVGAPISupported = EGL_FALSE; - - /* XXX temporary */ - _eglGlobal.ThreadInfo = _eglNewThreadInfo(); - } -} - - -/** - * Should call this via an atexit handler. - */ -void -_eglDestroyGlobals(void) -{ - /* XXX TODO walk over table entries, deleting each */ - _eglDeleteHashTable(_eglGlobal.Displays); - _eglDeleteHashTable(_eglGlobal.Contexts); - _eglDeleteHashTable(_eglGlobal.Surfaces); -} - - -/** - * Allocate and init a new _EGLThreadInfo object. - */ -_EGLThreadInfo * -_eglNewThreadInfo(void) -{ - _EGLThreadInfo *t = (_EGLThreadInfo *) calloc(1, sizeof(_EGLThreadInfo)); - if (t) { - t->CurrentContext = EGL_NO_CONTEXT; - t->LastError = EGL_SUCCESS; - t->CurrentAPI = EGL_NONE; - } - return t; -} - - -/** - * Delete/free a _EGLThreadInfo object. - */ -void -_eglDeleteThreadData(_EGLThreadInfo *t) -{ - free(t); -} - - - -/** - * Return pointer to calling thread's _EGLThreadInfo object. - * Create a new one if needed. - * Should never return NULL. - */ -_EGLThreadInfo * -_eglGetCurrentThread(void) -{ - _eglInitGlobals(); - - /* XXX temporary */ - return _eglGlobal.ThreadInfo; -} - - -/** - * Record EGL error code. - */ -void -_eglError(EGLint errCode, const char *msg) -{ - _EGLThreadInfo *t = _eglGetCurrentThread(); - const char *s; - - if (t->LastError == EGL_SUCCESS) { - t->LastError = errCode; - - switch (errCode) { - case EGL_BAD_ACCESS: - s = "EGL_BAD_ACCESS"; - break; - case EGL_BAD_ALLOC: - s = "EGL_BAD_ALLOC"; - break; - case EGL_BAD_ATTRIBUTE: - s = "EGL_BAD_ATTRIBUTE"; - break; - case EGL_BAD_CONFIG: - s = "EGL_BAD_CONFIG"; - break; - case EGL_BAD_CONTEXT: - s = "EGL_BAD_CONTEXT"; - break; - case EGL_BAD_CURRENT_SURFACE: - s = "EGL_BAD_CURRENT_SURFACE"; - break; - case EGL_BAD_DISPLAY: - s = "EGL_BAD_DISPLAY"; - break; - case EGL_BAD_MATCH: - s = "EGL_BAD_MATCH"; - break; - case EGL_BAD_NATIVE_PIXMAP: - s = "EGL_BAD_NATIVE_PIXMAP"; - break; - case EGL_BAD_NATIVE_WINDOW: - s = "EGL_BAD_NATIVE_WINDOW"; - break; - case EGL_BAD_PARAMETER: - s = "EGL_BAD_PARAMETER"; - break; - case EGL_BAD_SURFACE: - s = "EGL_BAD_SURFACE"; - break; - case EGL_BAD_SCREEN_MESA: - s = "EGL_BAD_SCREEN_MESA"; - break; - case EGL_BAD_MODE_MESA: - s = "EGL_BAD_MODE_MESA"; - break; - default: - s = "other"; - } - /* XXX temporary */ - fprintf(stderr, "EGL user error 0x%x (%s) in %s\n", errCode, s, msg); - } -} diff --git a/src/egl/main/eglglobals.h b/src/egl/main/eglglobals.h deleted file mode 100644 index c16baa2d6b..0000000000 --- a/src/egl/main/eglglobals.h +++ /dev/null @@ -1,68 +0,0 @@ -#ifndef EGLGLOBALS_INCLUDED -#define EGLGLOBALS_INCLUDED - -#include "egltypedefs.h" -#include "eglhash.h" - - -/** - * Per-thread info - */ -struct _egl_thread_info -{ - EGLint LastError; - _EGLContext *CurrentContext; - EGLenum CurrentAPI; -}; - - -/** - * Global library data - */ -struct _egl_global -{ - EGLBoolean Initialized; - - _EGLHashtable *Displays; - _EGLHashtable *Contexts; - _EGLHashtable *Surfaces; - - EGLScreenMESA FreeScreenHandle; - - /* XXX these may be temporary */ - EGLBoolean OpenGLESAPISupported; - EGLBoolean OpenVGAPISupported; - - /* XXX temporary - should be thread-specific data (TSD) */ - _EGLThreadInfo *ThreadInfo; -}; - - -extern struct _egl_global _eglGlobal; - - -extern void -_eglInitGlobals(void); - - -extern void -_eglDestroyGlobals(void); - - -extern _EGLThreadInfo * -_eglNewThreadInfo(void); - - -extern void -_eglDeleteThreadData(_EGLThreadInfo *t); - - -extern _EGLThreadInfo * -_eglGetCurrentThread(void); - - -extern void -_eglError(EGLint errCode, const char *msg); - - -#endif /* EGLGLOBALS_INCLUDED */ diff --git a/src/egl/main/eglhash.c b/src/egl/main/eglhash.c deleted file mode 100644 index 8e3da2e906..0000000000 --- a/src/egl/main/eglhash.c +++ /dev/null @@ -1,347 +0,0 @@ -/** - * \file hash.c - * Generic hash table. - * - * This code taken from Mesa and adapted. - */ - -#include -#include -#include -#include "eglhash.h" - - -#define TABLE_SIZE 1023 /**< Size of lookup table/array */ - -#define HASH_FUNC(K) ((K) % TABLE_SIZE) - - -/* - * Unfinished mutex stuff - */ - -typedef int _EGLMutex; - -static void -_eglInitMutex(_EGLMutex m) -{ -} - -static void -_eglDestroyMutex(_EGLMutex m) -{ -} - -static void -_eglLockMutex(_EGLMutex m) -{ -} - -static void -_eglUnlockMutex(_EGLMutex m) -{ -} - - - -typedef struct _egl_hashentry _EGLHashentry; - -struct _egl_hashentry -{ - EGLuint Key; /**< the entry's key */ - void *Data; /**< the entry's data */ - _EGLHashentry *Next; /**< pointer to next entry */ -}; - - -struct _egl_hashtable -{ - _EGLHashentry *Table[TABLE_SIZE]; /**< the lookup table */ - EGLuint MaxKey; /**< highest key inserted so far */ - _EGLMutex Mutex; /**< mutual exclusion lock */ -}; - - -/** - * Create a new hash table. - * - * \return pointer to a new, empty hash table. - */ -_EGLHashtable * -_eglNewHashTable(void) -{ - _EGLHashtable *table = (_EGLHashtable *) calloc(1, sizeof(_EGLHashtable)); - if (table) { - _eglInitMutex(table->Mutex); - table->MaxKey = 1; - } - return table; -} - - - -/** - * Delete a hash table. - * Frees each entry on the hash table and then the hash table structure itself. - * Note that the caller should have already traversed the table and deleted - * the objects in the table (i.e. We don't free the entries' data pointer). - * - * \param table the hash table to delete. - */ -void -_eglDeleteHashTable(_EGLHashtable *table) -{ - EGLuint i; - assert(table); - for (i = 0; i < TABLE_SIZE; i++) { - _EGLHashentry *entry = table->Table[i]; - while (entry) { - _EGLHashentry *next = entry->Next; - free(entry); - entry = next; - } - } - _eglDestroyMutex(table->Mutex); - free(table); -} - - - -/** - * Lookup an entry in the hash table. - * - * \param table the hash table. - * \param key the key. - * - * \return pointer to user's data or NULL if key not in table - */ -void * -_eglHashLookup(const _EGLHashtable *table, EGLuint key) -{ - EGLuint pos; - const _EGLHashentry *entry; - - assert(table); - - if (!key) - return NULL; - - pos = HASH_FUNC(key); - entry = table->Table[pos]; - while (entry) { - if (entry->Key == key) { - return entry->Data; - } - entry = entry->Next; - } - return NULL; -} - - - -/** - * Insert a key/pointer pair into the hash table. - * If an entry with this key already exists we'll replace the existing entry. - * - * \param table the hash table. - * \param key the key (not zero). - * \param data pointer to user data. - */ -void -_eglHashInsert(_EGLHashtable *table, EGLuint key, void *data) -{ - /* search for existing entry with this key */ - EGLuint pos; - _EGLHashentry *entry; - - assert(table); - assert(key); - - _eglLockMutex(table->Mutex); - - if (key > table->MaxKey) - table->MaxKey = key; - - pos = HASH_FUNC(key); - entry = table->Table[pos]; - while (entry) { - if (entry->Key == key) { - /* replace entry's data */ - entry->Data = data; - _eglUnlockMutex(table->Mutex); - return; - } - entry = entry->Next; - } - - /* alloc and insert new table entry */ - entry = (_EGLHashentry *) malloc(sizeof(_EGLHashentry)); - entry->Key = key; - entry->Data = data; - entry->Next = table->Table[pos]; - table->Table[pos] = entry; - - _eglUnlockMutex(table->Mutex); -} - - - -/** - * Remove an entry from the hash table. - * - * \param table the hash table. - * \param key key of entry to remove. - * - * While holding the hash table's lock, searches the entry with the matching - * key and unlinks it. - */ -void -_eglHashRemove(_EGLHashtable *table, EGLuint key) -{ - EGLuint pos; - _EGLHashentry *entry, *prev; - - assert(table); - assert(key); - - _eglLockMutex(table->Mutex); - - pos = HASH_FUNC(key); - prev = NULL; - entry = table->Table[pos]; - while (entry) { - if (entry->Key == key) { - /* found it! */ - if (prev) { - prev->Next = entry->Next; - } - else { - table->Table[pos] = entry->Next; - } - free(entry); - _eglUnlockMutex(table->Mutex); - return; - } - prev = entry; - entry = entry->Next; - } - - _eglUnlockMutex(table->Mutex); -} - - - -/** - * Get the key of the "first" entry in the hash table. - * - * This is used in the course of deleting all display lists when - * a context is destroyed. - * - * \param table the hash table - * - * \return key for the "first" entry in the hash table. - * - * While holding the lock, walks through all table positions until finding - * the first entry of the first non-empty one. - */ -EGLuint -_eglHashFirstEntry(_EGLHashtable *table) -{ - EGLuint pos; - assert(table); - _eglLockMutex(table->Mutex); - for (pos = 0; pos < TABLE_SIZE; pos++) { - if (table->Table[pos]) { - _eglUnlockMutex(table->Mutex); - return table->Table[pos]->Key; - } - } - _eglUnlockMutex(table->Mutex); - return 0; -} - - -/** - * Given a hash table key, return the next key. This is used to walk - * over all entries in the table. Note that the keys returned during - * walking won't be in any particular order. - * \return next hash key or 0 if end of table. - */ -EGLuint -_eglHashNextEntry(const _EGLHashtable *table, EGLuint key) -{ - const _EGLHashentry *entry; - EGLuint pos; - - assert(table); - assert(key); - - /* Find the entry with given key */ - pos = HASH_FUNC(key); - entry = table->Table[pos]; - while (entry) { - if (entry->Key == key) { - break; - } - entry = entry->Next; - } - - if (!entry) { - /* the key was not found, we can't find next entry */ - return 0; - } - - if (entry->Next) { - /* return next in linked list */ - return entry->Next->Key; - } - else { - /* look for next non-empty table slot */ - pos++; - while (pos < TABLE_SIZE) { - if (table->Table[pos]) { - return table->Table[pos]->Key; - } - pos++; - } - return 0; - } -} - - -/** - * Dump contents of hash table for debugging. - * - * \param table the hash table. - */ -void -_eglHashPrint(const _EGLHashtable *table) -{ - EGLuint i; - assert(table); - for (i = 0; i < TABLE_SIZE; i++) { - const _EGLHashentry *entry = table->Table[i]; - while (entry) { - printf("%u %p\n", entry->Key, entry->Data); - entry = entry->Next; - } - } -} - - - -/** - * Return a new, unused hash key. - */ -EGLuint -_eglHashGenKey(_EGLHashtable *table) -{ - EGLuint k; - - _eglLockMutex(table->Mutex); - k = table->MaxKey; - table->MaxKey++; - _eglUnlockMutex(table->Mutex); - return k; -} - diff --git a/src/egl/main/eglhash.h b/src/egl/main/eglhash.h deleted file mode 100644 index 1d6db9598c..0000000000 --- a/src/egl/main/eglhash.h +++ /dev/null @@ -1,39 +0,0 @@ -/** - * \file eglhash.h - * Generic hash table. - */ - - -#ifndef EGLHASH_INCLUDED -#define EGLHASH_INCLUDED - - -/* XXX move this? */ -typedef unsigned int EGLuint; - - -typedef struct _egl_hashtable _EGLHashtable; - - -extern _EGLHashtable *_eglNewHashTable(void); - -extern void _eglDeleteHashTable(_EGLHashtable *table); - -extern void *_eglHashLookup(const _EGLHashtable *table, EGLuint key); - -extern void _eglHashInsert(_EGLHashtable *table, EGLuint key, void *data); - -extern void _eglHashRemove(_EGLHashtable *table, EGLuint key); - -extern EGLuint _eglHashFirstEntry(_EGLHashtable *table); - -extern EGLuint _eglHashNextEntry(const _EGLHashtable *table, EGLuint key); - -extern void _eglHashPrint(const _EGLHashtable *table); - -extern EGLuint _eglHashGenKey(_EGLHashtable *table); - -extern void _egltest_hash_functions(void); - - -#endif /* EGLHASH_INCLUDED */ diff --git a/src/egl/main/egllog.c b/src/egl/main/egllog.c deleted file mode 100644 index dc1daaa996..0000000000 --- a/src/egl/main/egllog.c +++ /dev/null @@ -1,94 +0,0 @@ -/** - * Logging facility for debug/info messages. - */ - - -#include -#include -#include -#include -#include "egllog.h" - -#define MAXSTRING 1000 -#define FALLBACK_LOG_LEVEL _EGL_DEBUG -#define FALLBACK_LOG_LEVEL_STR "debug" - -static EGLint ReportingLevel = -1; - - -static void -log_level_initialize (void) -{ - char *log_env = getenv ("EGL_LOG_LEVEL"); - - if (log_env == NULL) { - ReportingLevel = FALLBACK_LOG_LEVEL; - } - else if (strcasecmp (log_env, "fatal") == 0) { - ReportingLevel = _EGL_FATAL; - } - else if (strcasecmp (log_env, "warning") == 0) { - ReportingLevel = _EGL_WARNING; - } - else if (strcasecmp (log_env, "info") == 0) { - ReportingLevel = _EGL_INFO; - } - else if (strcasecmp (log_env, "debug") == 0) { - ReportingLevel = _EGL_DEBUG; - } - else { - fprintf (stderr, "Unrecognized EGL_LOG_LEVEL environment variable value. " - "Expected one of \"fatal\", \"warning\", \"info\", \"debug\". " - "Got \"%s\". Falling back to \"%s\".\n", - log_env, FALLBACK_LOG_LEVEL_STR); - ReportingLevel = FALLBACK_LOG_LEVEL; - } -} - - -/** - * Log a message to stderr. - * \param level one of _EGL_FATAL, _EGL_WARNING, _EGL_INFO, _EGL_DEBUG. - */ -void -_eglLog(EGLint level, const char *fmtStr, ...) -{ - va_list args; - char msg[MAXSTRING]; - const char *levelStr; - static int log_level_initialized = 0; - - if (!log_level_initialized) { - log_level_initialize (); - log_level_initialized = 1; - } - - if (level <= ReportingLevel) { - switch (level) { - case _EGL_FATAL: - levelStr = "Fatal"; - break; - case _EGL_WARNING: - levelStr = "Warning"; - break; - case _EGL_INFO: - levelStr = "Info"; - break; - case _EGL_DEBUG: - levelStr = "Debug"; - break; - default: - levelStr = ""; - } - - va_start(args, fmtStr); - vsnprintf(msg, MAXSTRING, fmtStr, args); - va_end(args); - - fprintf(stderr, "EGL %s: %s\n", levelStr, msg); - - if (level == _EGL_FATAL) { - exit(1); /* or abort()? */ - } - } -} diff --git a/src/egl/main/egllog.h b/src/egl/main/egllog.h deleted file mode 100644 index 2fa352f155..0000000000 --- a/src/egl/main/egllog.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef EGLLOG_INCLUDED -#define EGLLOG_INCLUDED - -#include "egltypedefs.h" - -#define _EGL_FATAL 0 /* unrecoverable error */ -#define _EGL_WARNING 1 /* recoverable error/problem */ -#define _EGL_INFO 2 /* just useful info */ -#define _EGL_DEBUG 3 /* useful info for debugging */ - - -extern void -_eglLog(EGLint level, const char *fmtStr, ...); - - -#endif /* EGLLOG_INCLUDED */ diff --git a/src/egl/main/eglmode.c b/src/egl/main/eglmode.c deleted file mode 100644 index 786432234b..0000000000 --- a/src/egl/main/eglmode.c +++ /dev/null @@ -1,431 +0,0 @@ -#include -#include -#include -#include - -#include "egldisplay.h" -#include "egldriver.h" -#include "eglmode.h" -#include "eglglobals.h" -#include "eglscreen.h" - - -#define MIN2(A, B) (((A) < (B)) ? (A) : (B)) - - -static char * -my_strdup(const char *s) -{ - if (s) { - int l = strlen(s); - char *s2 = malloc(l + 1); - if (s2) - strcpy(s2, s); - return s2; - } - else { - return NULL; - } -} - - -/** - * Given an EGLModeMESA handle, return the corresponding _EGLMode object - * or null if non-existant. - */ -_EGLMode * -_eglLookupMode(EGLDisplay dpy, EGLModeMESA mode) -{ - const _EGLDisplay *disp = _eglLookupDisplay(dpy); - EGLint scrnum; - - /* loop over all screens on the display */ - for (scrnum = 0; scrnum < disp->NumScreens; scrnum++) { - const _EGLScreen *scrn = disp->Screens[scrnum]; - EGLint i; - /* search list of modes for handle */ - for (i = 0; i < scrn->NumModes; i++) { - if (scrn->Modes[i].Handle == mode) { - return scrn->Modes + i; - } - } - } - - return NULL; -} - - -/** - * Add a new mode with the given attributes (width, height, depth, refreshRate) - * to the given screen. - * Assign a new mode ID/handle to the mode as well. - * \return pointer to the new _EGLMode - */ -_EGLMode * -_eglAddNewMode(_EGLScreen *screen, EGLint width, EGLint height, - EGLint refreshRate, const char *name) -{ - EGLint n; - _EGLMode *newModes; - - assert(screen); - assert(width > 0); - assert(height > 0); - assert(refreshRate > 0); - - n = screen->NumModes; - newModes = (_EGLMode *) realloc(screen->Modes, (n+1) * sizeof(_EGLMode)); - if (newModes) { - screen->Modes = newModes; - screen->Modes[n].Handle = n + 1; - screen->Modes[n].Width = width; - screen->Modes[n].Height = height; - screen->Modes[n].RefreshRate = refreshRate; - screen->Modes[n].Optimal = EGL_FALSE; - screen->Modes[n].Interlaced = EGL_FALSE; - screen->Modes[n].Name = my_strdup(name); - screen->NumModes++; - return screen->Modes + n; - } - else { - return NULL; - } -} - - - -/** - * Parse the attrib_list to fill in the fields of the given _eglMode - * Return EGL_FALSE if any errors, EGL_TRUE otherwise. - */ -static EGLBoolean -_eglParseModeAttribs(_EGLMode *mode, const EGLint *attrib_list) -{ - EGLint i; - - /* init all attribs to EGL_DONT_CARE */ - mode->Handle = EGL_DONT_CARE; - mode->Width = EGL_DONT_CARE; - mode->Height = EGL_DONT_CARE; - mode->RefreshRate = EGL_DONT_CARE; - mode->Optimal = EGL_DONT_CARE; - mode->Interlaced = EGL_DONT_CARE; - mode->Name = NULL; - - for (i = 0; attrib_list && attrib_list[i] != EGL_NONE; i++) { - switch (attrib_list[i]) { - case EGL_MODE_ID_MESA: - mode->Handle = attrib_list[++i]; - if (mode->Handle <= 0) { - _eglError(EGL_BAD_PARAMETER, "eglChooseModeMESA(handle)"); - return EGL_FALSE; - } - break; - case EGL_WIDTH: - mode->Width = attrib_list[++i]; - if (mode->Width <= 0) { - _eglError(EGL_BAD_PARAMETER, "eglChooseModeMESA(width)"); - return EGL_FALSE; - } - break; - case EGL_HEIGHT: - mode->Height = attrib_list[++i]; - if (mode->Height <= 0) { - _eglError(EGL_BAD_PARAMETER, "eglChooseModeMESA(height)"); - return EGL_FALSE; - } - break; - case EGL_REFRESH_RATE_MESA: - mode->RefreshRate = attrib_list[++i]; - if (mode->RefreshRate <= 0) { - _eglError(EGL_BAD_PARAMETER, "eglChooseModeMESA(refresh rate)"); - return EGL_FALSE; - } - break; - case EGL_INTERLACED_MESA: - mode->Interlaced = attrib_list[++i]; - if (mode->Interlaced != EGL_TRUE && mode->Interlaced != EGL_FALSE) { - _eglError(EGL_BAD_PARAMETER, "eglChooseModeMESA(interlaced)"); - return EGL_FALSE; - } - break; - case EGL_OPTIMAL_MESA: - mode->Optimal = attrib_list[++i]; - if (mode->Optimal != EGL_TRUE && mode->Optimal != EGL_FALSE) { - _eglError(EGL_BAD_PARAMETER, "eglChooseModeMESA(optimal)"); - return EGL_FALSE; - } - break; - default: - _eglError(EGL_BAD_ATTRIBUTE, "eglChooseModeMESA"); - return EGL_FALSE; - } - } - return EGL_TRUE; -} - - -/** - * Determine if the candidate mode's attributes are at least as good - * as the minimal mode's. - * \return EGL_TRUE if qualifies, EGL_FALSE otherwise - */ -static EGLBoolean -_eglModeQualifies(const _EGLMode *c, const _EGLMode *min) -{ - if (min->Handle != EGL_DONT_CARE && c->Handle != min->Handle) - return EGL_FALSE; - if (min->Width != EGL_DONT_CARE && c->Width < min->Width) - return EGL_FALSE; - if (min->Height != EGL_DONT_CARE && c->Height < min->Height) - return EGL_FALSE; - if (min->RefreshRate != EGL_DONT_CARE && c->RefreshRate < min->RefreshRate) - return EGL_FALSE; - if (min->Optimal != EGL_DONT_CARE && c->Optimal != min->Optimal) - return EGL_FALSE; - if (min->Interlaced != EGL_DONT_CARE && c->Interlaced != min->Interlaced) - return EGL_FALSE; - - return EGL_TRUE; -} - - -/** - * Return value of given mode attribute, or -1 if bad attrib. - */ -static EGLint -getModeAttrib(const _EGLMode *m, EGLint attrib) -{ - switch (attrib) { - case EGL_MODE_ID_MESA: - return m->Handle; - case EGL_WIDTH: - return m->Width; - case EGL_HEIGHT: - return m->Height; - case EGL_REFRESH_RATE_MESA: - return m->RefreshRate; - case EGL_OPTIMAL_MESA: - return m->Optimal; - case EGL_INTERLACED_MESA: - return m->Interlaced; - default: - return -1; - } -} - - -#define SMALLER 1 -#define LARGER 2 - -struct sort_info { - EGLint Attrib; - EGLint Order; /* SMALLER or LARGER */ -}; - -/* the order of these entries is the priority */ -static struct sort_info SortInfo[] = { - { EGL_OPTIMAL_MESA, LARGER }, - { EGL_INTERLACED_MESA, SMALLER }, - { EGL_WIDTH, LARGER }, - { EGL_HEIGHT, LARGER }, - { EGL_REFRESH_RATE_MESA, LARGER }, - { EGL_MODE_ID_MESA, SMALLER }, - { 0, 0 } -}; - - -/** - * Compare modes 'a' and 'b' and return -1 if a belongs before b, or 1 if a - * belongs after b, or 0 if they're equal. - * Used by qsort(). - */ -static int -_eglCompareModes(const void *a, const void *b) -{ - const _EGLMode *aMode = *((const _EGLMode **) a); - const _EGLMode *bMode = *((const _EGLMode **) b); - EGLint i; - - for (i = 0; SortInfo[i].Attrib; i++) { - const EGLint aVal = getModeAttrib(aMode, SortInfo[i].Attrib); - const EGLint bVal = getModeAttrib(bMode, SortInfo[i].Attrib); - if (aVal == bVal) { - /* a tie */ - continue; - } - else if (SortInfo[i].Order == SMALLER) { - return (aVal < bVal) ? -1 : 1; - } - else if (SortInfo[i].Order == LARGER) { - return (aVal > bVal) ? -1 : 1; - } - } - - /* all attributes identical */ - return 0; -} - - -/** - * Search for EGLModes which match the given attribute list. - * Called via eglChooseModeMESA API function. - */ -EGLBoolean -_eglChooseModeMESA(_EGLDriver *drv, EGLDisplay dpy, EGLScreenMESA screen, - const EGLint *attrib_list, EGLModeMESA *modes, - EGLint modes_size, EGLint *num_modes) -{ - const _EGLScreen *scrn = _eglLookupScreen(dpy, screen); - _EGLMode **modeList, min; - EGLint i, count; - - if (!scrn) { - _eglError(EGL_BAD_SCREEN_MESA, "eglChooseModeMESA"); - return EGL_FALSE; - } - - if (!_eglParseModeAttribs(&min, attrib_list)) { - /* error code will have been recorded */ - return EGL_FALSE; - } - - /* allocate array of mode pointers */ - modeList = (_EGLMode **) malloc(modes_size * sizeof(_EGLMode *)); - if (!modeList) { - _eglError(EGL_BAD_MODE_MESA, "eglChooseModeMESA(out of memory)"); - return EGL_FALSE; - } - - /* make array of pointers to qualifying modes */ - for (i = count = 0; i < scrn->NumModes && count < modes_size; i++) { - if (_eglModeQualifies(scrn->Modes + i, &min)) { - modeList[count++] = scrn->Modes + i; - } - } - - /* sort array of pointers */ - qsort(modeList, count, sizeof(_EGLMode *), _eglCompareModes); - - /* copy mode handles to output array */ - for (i = 0; i < count; i++) { - modes[i] = modeList[i]->Handle; - } - - free(modeList); - - *num_modes = count; - - return EGL_TRUE; -} - - - -/** - * Return all possible modes for the given screen. No sorting of results. - * Called via eglGetModesMESA() API function. - */ -EGLBoolean -_eglGetModesMESA(_EGLDriver *drv, EGLDisplay dpy, EGLScreenMESA screen, - EGLModeMESA *modes, EGLint modes_size, EGLint *num_modes) -{ - _EGLScreen *scrn = _eglLookupScreen(dpy, screen); - - if (!scrn) { - _eglError(EGL_BAD_SCREEN_MESA, "eglGetModesMESA"); - return EGL_FALSE; - } - - if (modes) { - EGLint i; - *num_modes = MIN2(scrn->NumModes, modes_size); - for (i = 0; i < *num_modes; i++) { - modes[i] = scrn->Modes[i].Handle; - } - } - else { - /* just return total number of supported modes */ - *num_modes = scrn->NumModes; - } - - return EGL_TRUE; -} - - -/** - * Query an attribute of a mode. - */ -EGLBoolean -_eglGetModeAttribMESA(_EGLDriver *drv, EGLDisplay dpy, - EGLModeMESA mode, EGLint attribute, EGLint *value) -{ - _EGLMode *m = _eglLookupMode(dpy, mode); - EGLint v; - - if (!m) { - _eglError(EGL_BAD_MODE_MESA, "eglGetModeAttribMESA"); - return EGL_FALSE; - } - - v = getModeAttrib(m, attribute); - if (v < 0) { - _eglError(EGL_BAD_ATTRIBUTE, "eglGetModeAttribMESA"); - return EGL_FALSE; - } - *value = v; - return EGL_TRUE; -} - - -/** - * Return human-readable string for given mode. - * This is the default function called by eglQueryModeStringMESA(). - */ -const char * -_eglQueryModeStringMESA(_EGLDriver *drv, EGLDisplay dpy, EGLModeMESA mode) -{ - _EGLMode *m = _eglLookupMode(dpy, mode); - if (!m) { - _eglError(EGL_BAD_MODE_MESA, "eglQueryModeStringMESA"); - return NULL; - } - return m->Name; -} - - -#if 0 -static int -_eglRand(int max) -{ - return rand() % max; -} - -void -_eglTestModeModule(void) -{ - EGLint count = 30; - _EGLMode *modes = (_EGLMode *) malloc(count * sizeof(_EGLMode)); - _EGLMode **modeList = (_EGLMode **) malloc(count * sizeof(_EGLMode*)); - EGLint i; - - for (i = 0; i < count; i++) { - modes[i].Handle = _eglRand(20); - modes[i].Width = 512 + 256 * _eglRand(2); - modes[i].Height = 512 + 256 * _eglRand(2); - modes[i].RefreshRate = 50 + 5 * _eglRand(3); - modes[i].Interlaced = _eglRand(2); - modes[i].Optimal = _eglRand(4) == 0; - modeList[i] = modes + i; - } - - /* sort array of pointers */ - qsort(modeList, count, sizeof(_EGLMode *), compareModes); - - for (i = 0; i < count; i++) { - _EGLMode *m = modeList[i]; - printf("%2d: %3d %4d x %4d @ %3d opt %d int %d\n", i, - m->Handle, m->Width, m->Height, m->RefreshRate, - m->Optimal, m->Interlaced); - } -} -#endif diff --git a/src/egl/main/eglmode.h b/src/egl/main/eglmode.h deleted file mode 100644 index e70da85759..0000000000 --- a/src/egl/main/eglmode.h +++ /dev/null @@ -1,54 +0,0 @@ -#ifndef EGLMODE_INCLUDED -#define EGLMODE_INCLUDED - -#include "egltypedefs.h" - - -/** - * Data structure which corresponds to an EGLModeMESA. - */ -struct _egl_mode -{ - EGLModeMESA Handle; /* the public/opaque handle which names this mode */ - EGLint Width, Height; /* size in pixels */ - EGLint RefreshRate; /* rate * 1000.0 */ - EGLint Optimal; - EGLint Interlaced; - const char *Name; - - /* Other possible attributes */ - /* interlaced */ - /* external sync */ -}; - - -extern _EGLMode * -_eglLookupMode(EGLDisplay dpy, EGLModeMESA mode); - - -extern _EGLMode * -_eglAddNewMode(_EGLScreen *screen, EGLint width, EGLint height, - EGLint refreshRate, const char *name); - - -extern EGLBoolean -_eglChooseModeMESA(_EGLDriver *drv, EGLDisplay dpy, EGLScreenMESA screen, - const EGLint *attrib_list, EGLModeMESA *modes, - EGLint modes_size, EGLint *num_modes); - - -extern EGLBoolean -_eglGetModesMESA(_EGLDriver *drv, EGLDisplay dpy, EGLScreenMESA screen, - EGLModeMESA *modes, EGLint modes_size, EGLint *num_modes); - - -extern EGLBoolean -_eglGetModeAttribMESA(_EGLDriver *drv, EGLDisplay dpy, EGLModeMESA mode, - EGLint attribute, EGLint *value); - - -extern const char * -_eglQueryModeStringMESA(_EGLDriver *drv, EGLDisplay dpy, EGLModeMESA mode); - - -#endif /* EGLMODE_INCLUDED */ diff --git a/src/egl/main/eglscreen.c b/src/egl/main/eglscreen.c deleted file mode 100644 index 9c9a8377bf..0000000000 --- a/src/egl/main/eglscreen.c +++ /dev/null @@ -1,328 +0,0 @@ -/* - * Ideas for screen management extension to EGL. - * - * Each EGLDisplay has one or more screens (CRTs, Flat Panels, etc). - * The screens' handles can be obtained with eglGetScreensMESA(). - * - * A new kind of EGLSurface is possible- one which can be directly scanned - * out on a screen. Such a surface is created with eglCreateScreenSurface(). - * - * To actually display a screen surface on a screen, the eglShowSurface() - * function is called. - */ - -#include -#include -#include - -#include "egldisplay.h" -#include "eglglobals.h" -#include "eglmode.h" -#include "eglconfig.h" -#include "eglsurface.h" -#include "eglscreen.h" - - -/** - * Return a new screen handle/ID. - * NOTE: we never reuse these! - */ -EGLScreenMESA -_eglAllocScreenHandle(void) -{ - EGLScreenMESA s = _eglGlobal.FreeScreenHandle; - _eglGlobal.FreeScreenHandle++; - return s; -} - - -/** - * Initialize an _EGLScreen object to default values. - */ -void -_eglInitScreen(_EGLScreen *screen) -{ - memset(screen, 0, sizeof(_EGLScreen)); - screen->StepX = 1; - screen->StepY = 1; -} - - -/** - * Given a public screen handle, return the internal _EGLScreen object. - */ -_EGLScreen * -_eglLookupScreen(EGLDisplay dpy, EGLScreenMESA screen) -{ - EGLint i; - _EGLDisplay *display = _eglLookupDisplay(dpy); - - if (!display) - return NULL; - - for (i = 0; i < display->NumScreens; i++) { - if (display->Screens[i]->Handle == screen) - return display->Screens[i]; - } - return NULL; -} - - -/** - * Add the given _EGLScreen to the display's list of screens. - */ -void -_eglAddScreen(_EGLDisplay *display, _EGLScreen *screen) -{ - EGLint n; - - assert(display); - assert(screen); - - screen->Handle = _eglAllocScreenHandle(); - n = display->NumScreens; - display->Screens = realloc(display->Screens, (n+1) * sizeof(_EGLScreen *)); - display->Screens[n] = screen; - display->NumScreens++; -} - - - -EGLBoolean -_eglGetScreensMESA(_EGLDriver *drv, EGLDisplay dpy, EGLScreenMESA *screens, - EGLint max_screens, EGLint *num_screens) -{ - _EGLDisplay *display = _eglLookupDisplay(dpy); - EGLint n; - - if (!display) { - _eglError(EGL_BAD_DISPLAY, "eglGetScreensMESA"); - return EGL_FALSE; - } - - if (display->NumScreens > max_screens) { - n = max_screens; - } - else { - n = display->NumScreens; - } - - if (screens) { - EGLint i; - for (i = 0; i < n; i++) - screens[i] = display->Screens[i]->Handle; - } - if (num_screens) - *num_screens = n; - - return EGL_TRUE; -} - - -/** - * Example function - drivers should do a proper implementation. - */ -EGLSurface -_eglCreateScreenSurfaceMESA(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config, - const EGLint *attrib_list) -{ -#if 0 /* THIS IS JUST EXAMPLE CODE */ - _EGLSurface *surf; - - surf = (_EGLSurface *) calloc(1, sizeof(_EGLSurface)); - if (!surf) - return EGL_NO_SURFACE; - - if (!_eglInitSurface(drv, dpy, surf, EGL_SCREEN_BIT_MESA, - config, attrib_list)) { - free(surf); - return EGL_NO_SURFACE; - } - - _eglSaveSurface(surf); - - return surf->Handle; -#endif - return EGL_NO_SURFACE; -} - - -/** - * Show the given surface on the named screen. - * If surface is EGL_NO_SURFACE, disable the screen's output. - * - * This is just a placeholder function; drivers will always override - * this with code that _really_ shows the surface. - */ -EGLBoolean -_eglShowScreenSurfaceMESA(_EGLDriver *drv, EGLDisplay dpy, - EGLScreenMESA screen, EGLSurface surface, - EGLModeMESA m) -{ - _EGLScreen *scrn = _eglLookupScreen(dpy, screen); - _EGLMode *mode = _eglLookupMode(dpy, m); - - if (!scrn) { - _eglError(EGL_BAD_SCREEN_MESA, "eglShowSurfaceMESA"); - return EGL_FALSE; - } - if (!mode && (m != EGL_NO_MODE_MESA )) { - _eglError(EGL_BAD_MODE_MESA, "eglShowSurfaceMESA"); - return EGL_FALSE; - } - - if (surface == EGL_NO_SURFACE) { - scrn->CurrentSurface = NULL; - } - else { - _EGLSurface *surf = _eglLookupSurface(surface); - if (!surf || surf->Type != EGL_SCREEN_BIT_MESA) { - _eglError(EGL_BAD_SURFACE, "eglShowSurfaceMESA"); - return EGL_FALSE; - } - if (surf->Width < mode->Width || surf->Height < mode->Height) { - _eglError(EGL_BAD_SURFACE, - "eglShowSurfaceMESA(surface smaller than screen size)"); - return EGL_FALSE; - } - - scrn->CurrentSurface = surf; - scrn->CurrentMode = mode; - } - return EGL_TRUE; -} - - -/** - * Set a screen's current display mode. - * Note: mode = EGL_NO_MODE is valid (turns off the screen) - * - * This is just a placeholder function; drivers will always override - * this with code that _really_ sets the mode. - */ -EGLBoolean -_eglScreenModeMESA(_EGLDriver *drv, EGLDisplay dpy, EGLScreenMESA screen, - EGLModeMESA mode) -{ - _EGLScreen *scrn = _eglLookupScreen(dpy, screen); - - if (!scrn) { - _eglError(EGL_BAD_SCREEN_MESA, "eglScreenModeMESA"); - return EGL_FALSE; - } - - scrn->CurrentMode = _eglLookupMode(dpy, mode); - - return EGL_TRUE; -} - - -/** - * Set a screen's surface origin. - */ -EGLBoolean -_eglScreenPositionMESA(_EGLDriver *drv, EGLDisplay dpy, - EGLScreenMESA screen, EGLint x, EGLint y) -{ - _EGLScreen *scrn = _eglLookupScreen(dpy, screen); - if (!scrn) { - _eglError(EGL_BAD_SCREEN_MESA, "eglScreenPositionMESA"); - return EGL_FALSE; - } - - scrn->OriginX = x; - scrn->OriginY = y; - - return EGL_TRUE; -} - - -/** - * Query a screen's current surface. - */ -EGLBoolean -_eglQueryScreenSurfaceMESA(_EGLDriver *drv, EGLDisplay dpy, - EGLScreenMESA screen, EGLSurface *surface) -{ - const _EGLScreen *scrn = _eglLookupScreen(dpy, screen); - if (scrn->CurrentSurface) - *surface = scrn->CurrentSurface->Handle; - else - *surface = EGL_NO_SURFACE; - return EGL_TRUE; -} - - -/** - * Query a screen's current mode. - */ -EGLBoolean -_eglQueryScreenModeMESA(_EGLDriver *drv, EGLDisplay dpy, EGLScreenMESA screen, - EGLModeMESA *mode) -{ - const _EGLScreen *scrn = _eglLookupScreen(dpy, screen); - if (scrn->CurrentMode) - *mode = scrn->CurrentMode->Handle; - else - *mode = EGL_NO_MODE_MESA; - return EGL_TRUE; -} - - -EGLBoolean -_eglQueryScreenMESA(_EGLDriver *drv, EGLDisplay dpy, EGLScreenMESA screen, - EGLint attribute, EGLint *value) -{ - const _EGLScreen *scrn = _eglLookupScreen(dpy, screen); - - if (!scrn) { - _eglError(EGL_BAD_SCREEN_MESA, "eglQueryScreenMESA"); - return EGL_FALSE; - } - - switch (attribute) { - case EGL_SCREEN_POSITION_MESA: - value[0] = scrn->OriginX; - value[1] = scrn->OriginY; - break; - case EGL_SCREEN_POSITION_GRANULARITY_MESA: - value[0] = scrn->StepX; - value[1] = scrn->StepY; - break; - default: - _eglError(EGL_BAD_ATTRIBUTE, "eglQueryScreenMESA"); - return EGL_FALSE; - } - - return EGL_TRUE; -} - - -/** - * Delete the modes associated with given screen. - */ -void -_eglDestroyScreenModes(_EGLScreen *scrn) -{ - EGLint i; - for (i = 0; i < scrn->NumModes; i++) { - if (scrn->Modes[i].Name) - free((char *) scrn->Modes[i].Name); /* cast away const */ - } - if (scrn->Modes) - free(scrn->Modes); - scrn->Modes = NULL; - scrn->NumModes = 0; -} - - -/** - * Default fallback routine - drivers should usually override this. - */ -void -_eglDestroyScreen(_EGLScreen *scrn) -{ - _eglDestroyScreenModes(scrn); - free(scrn); -} - diff --git a/src/egl/main/eglscreen.h b/src/egl/main/eglscreen.h deleted file mode 100644 index 833439b410..0000000000 --- a/src/egl/main/eglscreen.h +++ /dev/null @@ -1,90 +0,0 @@ -#ifndef EGLSCREEN_INCLUDED -#define EGLSCREEN_INCLUDED - - -/** - * Per-screen information. - * Note that an EGL screen doesn't have a size. A screen may be set to - * one of several display modes (width/height/scanrate). The screen - * then displays a drawing surface. The drawing surface must be at least - * as large as the display mode's resolution. If it's larger, the - * OriginX and OriginY fields control what part of the surface is visible - * on the screen. - */ -struct _egl_screen -{ - EGLScreenMESA Handle; /* The public/opaque handle which names this object */ - - _EGLMode *CurrentMode; - _EGLSurface *CurrentSurface; - - EGLint OriginX, OriginY; /**< Origin of scan-out region w.r.t. surface */ - EGLint StepX, StepY; /**< Screen position/origin granularity */ - - EGLint NumModes; - _EGLMode *Modes; /**< array [NumModes] */ -}; - - -extern EGLScreenMESA -_eglAllocScreenHandle(void); - - -extern void -_eglInitScreen(_EGLScreen *screen); - - -extern _EGLScreen * -_eglLookupScreen(EGLDisplay dpy, EGLScreenMESA screen); - - -extern void -_eglAddScreen(_EGLDisplay *display, _EGLScreen *screen); - - -extern EGLBoolean -_eglGetScreensMESA(_EGLDriver *drv, EGLDisplay dpy, EGLScreenMESA *screens, EGLint max_screens, EGLint *num_screens); - - -extern EGLSurface -_eglCreateScreenSurfaceMESA(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config, const EGLint *attrib_list); - - -extern EGLBoolean -_eglShowScreenSurfaceMESA(_EGLDriver *drv, EGLDisplay dpy, EGLScreenMESA screen, EGLSurface surface, EGLModeMESA mode); - - -extern EGLBoolean -_eglScreenModeMESA(_EGLDriver *drv, EGLDisplay dpy, EGLScreenMESA screen, EGLModeMESA mode); - - -extern EGLBoolean -_eglScreenPositionMESA(_EGLDriver *drv, EGLDisplay dpy, EGLScreenMESA screen, EGLint x, EGLint y); - - -extern EGLBoolean -_eglQueryDisplayMESA(_EGLDriver *drv, EGLDisplay dpy, EGLint attribute, EGLint *value); - - -extern EGLBoolean -_eglQueryScreenSurfaceMESA(_EGLDriver *drv, EGLDisplay dpy, - EGLScreenMESA screen, EGLSurface *surface); - - -extern EGLBoolean -_eglQueryScreenModeMESA(_EGLDriver *drv, EGLDisplay dpy, EGLScreenMESA screen, EGLModeMESA *mode); - - -extern EGLBoolean -_eglQueryScreenMESA(_EGLDriver *drv, EGLDisplay dpy, EGLScreenMESA screen, EGLint attribute, EGLint *value); - - -extern void -_eglDestroyScreenModes(_EGLScreen *scrn); - - -extern void -_eglDestroyScreen(_EGLScreen *scrn); - - -#endif /* EGLSCREEN_INCLUDED */ diff --git a/src/egl/main/eglsurface.c b/src/egl/main/eglsurface.c deleted file mode 100644 index 874f318e96..0000000000 --- a/src/egl/main/eglsurface.c +++ /dev/null @@ -1,530 +0,0 @@ -/** - * Surface-related functions. - */ - - -#include -#include -#include -#include "eglcontext.h" -#include "eglconfig.h" -#include "eglglobals.h" -#include "eglhash.h" -#include "egllog.h" -#include "eglsurface.h" - - -/** - * Do error check on parameters and initialize the given _EGLSurface object. - * \return EGL_TRUE if no errors, EGL_FALSE otherwise. - */ -EGLBoolean -_eglInitSurface(_EGLDriver *drv, EGLDisplay dpy, - _EGLSurface *surf, EGLint type, EGLConfig config, - const EGLint *attrib_list) -{ - const char *func; - _EGLConfig *conf; - EGLint width = 0, height = 0, largest = 0; - EGLint texFormat = 0, texTarget = 0, mipmapTex = 0; - EGLint renderBuffer = EGL_BACK_BUFFER; -#ifdef EGL_VERSION_1_2 - EGLint colorspace = EGL_COLORSPACE_sRGB; - EGLint alphaFormat = EGL_ALPHA_FORMAT_NONPRE; -#endif - EGLint i; - - switch (type) { - case EGL_WINDOW_BIT: - func = "eglCreateWindowSurface"; - break; - case EGL_PIXMAP_BIT: - func = "eglCreatePixmapSurface"; - renderBuffer = EGL_SINGLE_BUFFER; - break; - case EGL_PBUFFER_BIT: - func = "eglCreatePBufferSurface"; - break; - case EGL_SCREEN_BIT_MESA: - func = "eglCreateScreenSurface"; - renderBuffer = EGL_SINGLE_BUFFER; /* XXX correct? */ - break; - default: - _eglLog(_EGL_WARNING, "Bad type in _eglInitSurface"); - return EGL_FALSE; - } - - conf = _eglLookupConfig(drv, dpy, config); - if (!conf) { - _eglError(EGL_BAD_CONFIG, func); - return EGL_FALSE; - } - - /* - * Parse attribute list. Different kinds of surfaces support different - * attributes. - */ - for (i = 0; attrib_list && attrib_list[i] != EGL_NONE; i++) { - switch (attrib_list[i]) { - case EGL_WIDTH: - if (type == EGL_PBUFFER_BIT || type == EGL_SCREEN_BIT_MESA) { - width = attrib_list[++i]; - } - else { - _eglError(EGL_BAD_ATTRIBUTE, func); - return EGL_FALSE; - } - break; - case EGL_HEIGHT: - if (type == EGL_PBUFFER_BIT || type == EGL_SCREEN_BIT_MESA) { - height = attrib_list[++i]; - } - else { - _eglError(EGL_BAD_ATTRIBUTE, func); - return EGL_FALSE; - } - break; - case EGL_LARGEST_PBUFFER: - if (type == EGL_PBUFFER_BIT) { - largest = attrib_list[++i]; - } - else { - _eglError(EGL_BAD_ATTRIBUTE, func); - return EGL_FALSE; - } - break; - case EGL_TEXTURE_FORMAT: - if (type == EGL_PBUFFER_BIT) { - texFormat = attrib_list[++i]; - } - else { - _eglError(EGL_BAD_ATTRIBUTE, func); - return EGL_FALSE; - } - break; - case EGL_TEXTURE_TARGET: - if (type == EGL_PBUFFER_BIT) { - texTarget = attrib_list[++i]; - } - else { - _eglError(EGL_BAD_ATTRIBUTE, func); - return EGL_FALSE; - } - break; - case EGL_MIPMAP_TEXTURE: - if (type == EGL_PBUFFER_BIT) { - mipmapTex = attrib_list[++i]; - } - else { - _eglError(EGL_BAD_ATTRIBUTE, func); - return EGL_FALSE; - } - break; -#ifdef EGL_VERSION_1_2 - case EGL_RENDER_BUFFER: - if (type == EGL_WINDOW_BIT) { - renderBuffer = attrib_list[++i]; - if (renderBuffer != EGL_BACK_BUFFER && - renderBuffer != EGL_SINGLE_BUFFER) { - _eglError(EGL_BAD_ATTRIBUTE, func); - return EGL_FALSE; - } - } - else { - _eglError(EGL_BAD_ATTRIBUTE, func); - return EGL_FALSE; - } - break; - case EGL_COLORSPACE: - if (type == EGL_WINDOW_BIT || - type == EGL_PBUFFER_BIT || - type == EGL_PIXMAP_BIT) { - colorspace = attrib_list[++i]; - if (colorspace != EGL_COLORSPACE_sRGB && - colorspace != EGL_COLORSPACE_LINEAR) { - _eglError(EGL_BAD_ATTRIBUTE, func); - return EGL_FALSE; - } - } - else { - _eglError(EGL_BAD_ATTRIBUTE, func); - return EGL_FALSE; - } - break; - case EGL_ALPHA_FORMAT: - if (type == EGL_WINDOW_BIT || - type == EGL_PBUFFER_BIT || - type == EGL_PIXMAP_BIT) { - alphaFormat = attrib_list[++i]; - if (alphaFormat != EGL_ALPHA_FORMAT_NONPRE && - alphaFormat != EGL_ALPHA_FORMAT_PRE) { - _eglError(EGL_BAD_ATTRIBUTE, func); - return EGL_FALSE; - } - } - else { - _eglError(EGL_BAD_ATTRIBUTE, func); - return EGL_FALSE; - } - break; - -#endif /* EGL_VERSION_1_2 */ - default: - _eglError(EGL_BAD_ATTRIBUTE, func); - return EGL_FALSE; - } - } - - if (width <= 0 || height <= 0) { - _eglError(EGL_BAD_ATTRIBUTE, func); - return EGL_FALSE; - } - - memset(surf, 0, sizeof(_EGLSurface)); - surf->Config = conf; - surf->Type = type; - surf->Width = width; - surf->Height = height; - surf->TextureFormat = texFormat; - surf->TextureTarget = texTarget; - surf->MipmapTexture = mipmapTex; - surf->MipmapLevel = 0; - surf->SwapInterval = 0; -#ifdef EGL_VERSION_1_2 - surf->SwapBehavior = EGL_BUFFER_DESTROYED; /* XXX ok? */ - surf->HorizontalResolution = EGL_UNKNOWN; /* set by caller */ - surf->VerticalResolution = EGL_UNKNOWN; /* set by caller */ - surf->AspectRatio = EGL_UNKNOWN; /* set by caller */ - surf->RenderBuffer = renderBuffer; - surf->AlphaFormat = alphaFormat; - surf->Colorspace = colorspace; -#endif - - return EGL_TRUE; -} - - -void -_eglSaveSurface(_EGLSurface *surf) -{ - assert(surf); - assert(!surf->Handle); - surf->Handle = _eglHashGenKey(_eglGlobal.Contexts); - assert(surf->Handle); - _eglHashInsert(_eglGlobal.Surfaces, surf->Handle, surf); -} - - -void -_eglRemoveSurface(_EGLSurface *surf) -{ - _eglHashRemove(_eglGlobal.Surfaces, surf->Handle); -} - - -_EGLSurface * -_eglLookupSurface(EGLSurface surf) -{ - _EGLSurface *c = (_EGLSurface *) _eglHashLookup(_eglGlobal.Surfaces, surf); - return c; -} - - -_EGLSurface * -_eglGetCurrentSurface(EGLint readdraw) -{ - _EGLContext *ctx = _eglGetCurrentContext(); - if (ctx) { - switch (readdraw) { - case EGL_DRAW: - return ctx->DrawSurface; - case EGL_READ: - return ctx->ReadSurface; - default: - return NULL; - } - } - return NULL; -} - - -EGLBoolean -_eglSwapBuffers(_EGLDriver *drv, EGLDisplay dpy, EGLSurface draw) -{ - /* Basically just do error checking here. Drivers have to do the - * actual buffer swap. - */ - _EGLContext *context = _eglGetCurrentContext(); - _EGLSurface *surface = _eglLookupSurface(draw); - if (context && context->DrawSurface != surface) { - _eglError(EGL_BAD_SURFACE, "eglSwapBuffers"); - return EGL_FALSE; - } - if (surface == NULL) { - _eglError(EGL_BAD_SURFACE, "eglSwapBuffers"); - return EGL_FALSE; - } - return EGL_TRUE; -} - - -EGLBoolean -_eglCopyBuffers(_EGLDriver *drv, EGLDisplay dpy, EGLSurface surface, - NativePixmapType target) -{ - /* copy surface to native pixmap */ - /* All implementation burdon for this is in the device driver */ - return EGL_FALSE; -} - - -EGLBoolean -_eglQuerySurface(_EGLDriver *drv, EGLDisplay dpy, EGLSurface surf, - EGLint attribute, EGLint *value) -{ - _EGLSurface *surface = _eglLookupSurface(surf); - if (surface == NULL) { - _eglError(EGL_BAD_SURFACE, "eglQuerySurface"); - return EGL_FALSE; - } - switch (attribute) { - case EGL_WIDTH: - *value = surface->Width; - return EGL_TRUE; - case EGL_HEIGHT: - *value = surface->Height; - return EGL_TRUE; - case EGL_CONFIG_ID: - *value = GET_CONFIG_ATTRIB(surface->Config, EGL_CONFIG_ID); - return EGL_TRUE; - /*XXX case EGL_LARGEST_PBUFFER:*/ - case EGL_SURFACE_TYPE: - *value = surface->Type; - return EGL_TRUE; -#ifdef EGL_VERSION_1_1 - case EGL_TEXTURE_FORMAT: - /* texture attributes: only for pbuffers, no error otherwise */ - if (surface->Type == EGL_PBUFFER_BIT) - *value = surface->TextureFormat; - return EGL_TRUE; - case EGL_TEXTURE_TARGET: - if (surface->Type == EGL_PBUFFER_BIT) - *value = surface->TextureTarget; - return EGL_TRUE; - case EGL_MIPMAP_TEXTURE: - if (surface->Type == EGL_PBUFFER_BIT) - *value = surface->MipmapTexture; - return EGL_TRUE; - case EGL_MIPMAP_LEVEL: - if (surface->Type == EGL_PBUFFER_BIT) - *value = surface->MipmapLevel; - return EGL_TRUE; -#endif /* EGL_VERSION_1_1 */ -#ifdef EGL_VERSION_1_2 - case EGL_SWAP_BEHAVIOR: - *value = surface->SwapBehavior; - return EGL_TRUE; - case EGL_RENDER_BUFFER: - *value = surface->RenderBuffer; - return EGL_TRUE; - case EGL_PIXEL_ASPECT_RATIO: - *value = surface->AspectRatio; - return EGL_TRUE; - case EGL_HORIZONTAL_RESOLUTION: - *value = surface->HorizontalResolution; - return EGL_TRUE; - case EGL_VERTICAL_RESOLUTION: - *value = surface->VerticalResolution; - return EGL_TRUE; - case EGL_ALPHA_FORMAT: - *value = surface->AlphaFormat; - return EGL_TRUE; - case EGL_COLORSPACE: - *value = surface->Colorspace; - return EGL_TRUE; -#endif /* EGL_VERSION_1_2 */ - default: - _eglError(EGL_BAD_ATTRIBUTE, "eglQuerySurface"); - return EGL_FALSE; - } -} - - -/** - * Example function - drivers should do a proper implementation. - */ -EGLSurface -_eglCreateWindowSurface(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config, - NativeWindowType window, const EGLint *attrib_list) -{ -#if 0 /* THIS IS JUST EXAMPLE CODE */ - _EGLSurface *surf; - - surf = (_EGLSurface *) calloc(1, sizeof(_EGLSurface)); - if (!surf) - return EGL_NO_SURFACE; - - if (!_eglInitSurface(drv, dpy, surf, EGL_WINDOW_BIT, config, attrib_list)) { - free(surf); - return EGL_NO_SURFACE; - } - - _eglSaveSurface(surf); - - return surf->Handle; -#endif - return EGL_NO_SURFACE; -} - - -/** - * Example function - drivers should do a proper implementation. - */ -EGLSurface -_eglCreatePixmapSurface(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config, - NativePixmapType pixmap, const EGLint *attrib_list) -{ -#if 0 /* THIS IS JUST EXAMPLE CODE */ - _EGLSurface *surf; - - surf = (_EGLSurface *) calloc(1, sizeof(_EGLSurface)); - if (!surf) - return EGL_NO_SURFACE; - - if (!_eglInitSurface(drv, dpy, surf, EGL_PIXMAP_BIT, config, attrib_list)) { - free(surf); - return EGL_NO_SURFACE; - } - - _eglSaveSurface(surf); - - return surf->Handle; -#endif - return EGL_NO_SURFACE; -} - - -/** - * Example function - drivers should do a proper implementation. - */ -EGLSurface -_eglCreatePbufferSurface(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config, - const EGLint *attrib_list) -{ -#if 0 /* THIS IS JUST EXAMPLE CODE */ - _EGLSurface *surf; - - surf = (_EGLSurface *) calloc(1, sizeof(_EGLSurface)); - if (!surf) - return EGL_NO_SURFACE; - - if (!_eglInitSurface(drv, dpy, surf, EGL_PBUFFER_BIT, config, attrib_list)) { - free(surf); - return EGL_NO_SURFACE; - } - - _eglSaveSurface(surf); - - return surf->Handle; -#endif - return EGL_NO_SURFACE; -} - - -/** - * Default fallback routine - drivers should usually override this. - */ -EGLBoolean -_eglDestroySurface(_EGLDriver *drv, EGLDisplay dpy, EGLSurface surface) -{ - _EGLSurface *surf = _eglLookupSurface(surface); - if (surf) { - _eglHashRemove(_eglGlobal.Surfaces, surface); - if (surf->IsBound) { - surf->DeletePending = EGL_TRUE; - } - else { - free(surf); - } - return EGL_TRUE; - } - else { - _eglError(EGL_BAD_SURFACE, "eglDestroySurface"); - return EGL_FALSE; - } -} - - -/** - * Default fallback routine - drivers might override this. - */ -EGLBoolean -_eglSurfaceAttrib(_EGLDriver *drv, EGLDisplay dpy, EGLSurface surf, EGLint attribute, EGLint value) -{ - _EGLSurface *surface = _eglLookupSurface(surf); - - if (surface == NULL) { - _eglError(EGL_BAD_SURFACE, "eglSurfaceAttrib"); - return EGL_FALSE; - } - - switch (attribute) { - case EGL_MIPMAP_LEVEL: - surface->MipmapLevel = value; - break; - default: - _eglError(EGL_BAD_ATTRIBUTE, "eglSurfaceAttrib"); - return EGL_FALSE; - } - return EGL_TRUE; -} - - -EGLBoolean -_eglBindTexImage(_EGLDriver *drv, EGLDisplay dpy, EGLSurface surface, EGLint buffer) -{ - /* XXX unfinished */ - return EGL_FALSE; -} - - -EGLBoolean -_eglReleaseTexImage(_EGLDriver *drv, EGLDisplay dpy, EGLSurface surface, EGLint buffer) -{ - /* XXX unfinished */ - return EGL_FALSE; -} - - -EGLBoolean -_eglSwapInterval(_EGLDriver *drv, EGLDisplay dpy, EGLint interval) -{ - _EGLSurface *surf = _eglGetCurrentSurface(EGL_DRAW); - if (surf == NULL) { - _eglError(EGL_BAD_SURFACE, "eglSwapInterval"); - return EGL_FALSE; - } - surf->SwapInterval = interval; - return EGL_TRUE; -} - - -#ifdef EGL_VERSION_1_2 - -/** - * Example function - drivers should do a proper implementation. - */ -EGLSurface -_eglCreatePbufferFromClientBuffer(_EGLDriver *drv, EGLDisplay dpy, - EGLenum buftype, EGLClientBuffer buffer, - EGLConfig config, const EGLint *attrib_list) -{ - if (buftype != EGL_OPENVG_IMAGE) { - _eglError(EGL_BAD_PARAMETER, "eglCreatePbufferFromClientBuffer"); - return EGL_NO_SURFACE; - } - - return EGL_NO_SURFACE; -} - -#endif /* EGL_VERSION_1_2 */ diff --git a/src/egl/main/eglsurface.h b/src/egl/main/eglsurface.h deleted file mode 100644 index 79abeca0b2..0000000000 --- a/src/egl/main/eglsurface.h +++ /dev/null @@ -1,117 +0,0 @@ -#ifndef EGLSURFACE_INCLUDED -#define EGLSURFACE_INCLUDED - - -#include "egltypedefs.h" - - -/** - * "Base" class for device driver surfaces. - */ -struct _egl_surface -{ - EGLSurface Handle; /* The public/opaque handle which names this object */ - _EGLConfig *Config; - - /* May need reference counting here */ - EGLBoolean IsBound; - EGLBoolean DeletePending; - - EGLint Type; /* one of EGL_WINDOW_BIT, EGL_PIXMAP_BIT or EGL_PBUFFER_BIT */ - EGLint Width, Height; - EGLint TextureFormat, TextureTarget; - EGLint MipmapTexture, MipmapLevel; - EGLint SwapInterval; - - /* If type == EGL_SCREEN_BIT: */ - EGLint VisibleRefCount; /* number of screens I'm displayed on */ - -#ifdef EGL_VERSION_1_2 - EGLint SwapBehavior; /* one of EGL_BUFFER_PRESERVED/DESTROYED */ - EGLint HorizontalResolution, VerticalResolution; - EGLint AspectRatio; - EGLint RenderBuffer; /* EGL_BACK_BUFFER or EGL_SINGLE_BUFFER */ - EGLint AlphaFormat; /* EGL_ALPHA_FORMAT_NONPRE or EGL_ALPHA_FORMAT_PRE */ - EGLint Colorspace; /* EGL_COLORSPACE_sRGB or EGL_COLORSPACE_LINEAR */ -#endif /* EGL_VERSION_1_2 */ -}; - - -extern EGLBoolean -_eglInitSurface(_EGLDriver *drv, EGLDisplay dpy, - _EGLSurface *surf, EGLint type, EGLConfig config, - const EGLint *attrib_list); - - -extern void -_eglSaveSurface(_EGLSurface *surf); - - -extern void -_eglRemoveSurface(_EGLSurface *surf); - - -extern _EGLSurface * -_eglLookupSurface(EGLSurface surf); - - -extern _EGLSurface * -_eglGetCurrentSurface(EGLint readdraw); - - -extern EGLBoolean -_eglSwapBuffers(_EGLDriver *drv, EGLDisplay dpy, EGLSurface draw); - - -extern EGLBoolean -_eglCopyBuffers(_EGLDriver *drv, EGLDisplay dpy, EGLSurface surface, NativePixmapType target); - - -extern EGLBoolean -_eglQuerySurface(_EGLDriver *drv, EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint *value); - - -extern EGLSurface -_eglCreateWindowSurface(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config, NativeWindowType window, const EGLint *attrib_list); - - -extern EGLSurface -_eglCreatePixmapSurface(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config, NativePixmapType pixmap, const EGLint *attrib_list); - - -extern EGLSurface -_eglCreatePbufferSurface(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config, const EGLint *attrib_list); - - -extern EGLBoolean -_eglDestroySurface(_EGLDriver *drv, EGLDisplay dpy, EGLSurface surface); - - -extern EGLBoolean -_eglSurfaceAttrib(_EGLDriver *drv, EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint value); - - -extern EGLBoolean -_eglBindTexImage(_EGLDriver *drv, EGLDisplay dpy, EGLSurface surface, EGLint buffer); - - -extern EGLBoolean -_eglReleaseTexImage(_EGLDriver *drv, EGLDisplay dpy, EGLSurface surface, EGLint buffer); - - -extern EGLBoolean -_eglSwapInterval(_EGLDriver *drv, EGLDisplay dpy, EGLint interval); - - -#ifdef EGL_VERSION_1_2 - -extern EGLSurface -_eglCreatePbufferFromClientBuffer(_EGLDriver *drv, EGLDisplay dpy, - EGLenum buftype, EGLClientBuffer buffer, - EGLConfig config, const EGLint *attrib_list); - -#endif /* EGL_VERSION_1_2 */ - - - -#endif /* EGLSURFACE_INCLUDED */ diff --git a/src/egl/main/egltypedefs.h b/src/egl/main/egltypedefs.h deleted file mode 100644 index fa8cb496f8..0000000000 --- a/src/egl/main/egltypedefs.h +++ /dev/null @@ -1,34 +0,0 @@ -#ifndef EGLTYPEDEFS_INCLUDED -#define EGLTYPEDEFS_INCLUDED - - -#include - - -typedef struct _egl_api _EGLAPI; - -typedef struct _egl_config _EGLConfig; - -typedef struct _egl_context _EGLContext; - -typedef struct _egl_display _EGLDisplay; - -typedef struct _egl_driver _EGLDriver; - -typedef struct _egl_extensions _EGLExtensions; - -typedef struct _egl_mode _EGLMode; - -typedef struct _egl_screen _EGLScreen; - -typedef struct _egl_surface _EGLSurface; - -typedef struct _egl_thread_info _EGLThreadInfo; - - -typedef void (*_EGLProc)(); - -typedef _EGLDriver *(*_EGLMain_t)(_EGLDisplay *dpy); - - -#endif /* EGLTYPEDEFS_INCLUDED */ diff --git a/src/glu/mesa/Makefile b/src/glu/mesa/Makefile deleted file mode 100644 index c468ce6210..0000000000 --- a/src/glu/mesa/Makefile +++ /dev/null @@ -1,56 +0,0 @@ -# src/glu/mesa/Makefile - -TOP = ../../.. - -include $(TOP)/configs/current - -GLU_MAJOR = 1 -GLU_MINOR = 1 -GLU_TINY = 0$(MESA_MAJOR)0$(MESA_MINOR)0$(MESA_TINY) - -C_SOURCES = \ - glu.c \ - mipmap.c \ - nurbs.c \ - nurbscrv.c \ - nurbssrf.c \ - nurbsutl.c \ - polytest.c \ - project.c \ - quadric.c \ - tess.c \ - tesselat.c - -OBJECTS = $(C_SOURCES:.c=.o) - -INCLUDES = -I. -I$(TOP)/include - -##### RULES ##### - -.c.o: - $(CC) -c $(INCLUDES) $(CFLAGS) $< -o $@ - -##### TARGETS ##### - -default: - @if [ "${CONFIG_NAME}" = "beos" ] ; then \ - echo "$(GLU_LIB_NAME) not build under BeOS, but integrated into ${GL_LIB_NAME}." ; \ - exit 0 ; \ - else \ - $(MAKE) $(TOP)/$(LIB_DIR)/$(GLU_LIB_NAME) || exit 1 ; \ - fi - -$(TOP)/$(LIB_DIR): - -mkdir $(TOP)/$(LIB_DIR) - -# Make the library: -$(TOP)/$(LIB_DIR)/$(GLU_LIB_NAME): $(OBJECTS) - @ $(MKLIB) -o $(GLU_LIB) -linker '$(CC)' -ldflags '$(LDFLAGS)' \ - -major $(GLU_MAJOR) -minor $(GLU_MINOR) -patch $(GLU_TINY) \ - $(MKLIB_OPTIONS) -install $(TOP)/$(LIB_DIR) \ - $(GLU_LIB_DEPS) $(OBJECTS) - -clean: - -rm -f *.o */*.o */*/*.o - -rm -f *.lo */*.lo */*/*.lo - -rm -f *.la */*.la */*/*.la diff --git a/src/glu/mesa/Makefile.DJ b/src/glu/mesa/Makefile.DJ deleted file mode 100644 index 92bcdaae94..0000000000 --- a/src/glu/mesa/Makefile.DJ +++ /dev/null @@ -1,100 +0,0 @@ -# Mesa 3-D graphics library -# Version: 4.0 -# -# Copyright (C) 1999 Brian Paul All Rights Reserved. -# -# Permission is hereby granted, free of charge, to any person obtaining a -# copy of this software and associated documentation files (the "Software"), -# to deal in the Software without restriction, including without limitation -# the rights to use, copy, modify, merge, publish, distribute, sublicense, -# and/or sell copies of the Software, and to permit persons to whom the -# Software is furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included -# in all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -# BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -# DOS/DJGPP glu makefile v1.5 for Mesa -# -# Copyright (C) 2002 - Daniel Borca -# Email : dborca@users.sourceforge.net -# Web : http://www.geocities.com/dborca - - -# -# Available options: -# -# Environment variables: -# CFLAGS -# -# Targets: -# all: build GLU -# clean: remove object files -# - - - -.PHONY: all clean - -TOP = ../../.. -LIBDIR = $(TOP)/lib -GLU_LIB = libglu.a -GLU_DXE = glu.dxe -GLU_IMP = libiglu.a - -export LD_LIBRARY_PATH := $(LD_LIBRARY_PATH);$(LIBDIR);$(GLIDE)/lib - -CC = gcc -CFLAGS += -I$(TOP)/include - -AR = ar -ARFLAGS = crus - -HAVEDXE3 = $(wildcard $(DJDIR)/bin/dxe3gen.exe) - -ifeq ($(wildcard $(addsuffix /rm.exe,$(subst ;, ,$(PATH)))),) -UNLINK = del $(subst /,\,$(1)) -else -UNLINK = $(RM) $(1) -endif - -CORE_SOURCES = \ - glu.c \ - mipmap.c \ - nurbs.c \ - nurbscrv.c \ - nurbssrf.c \ - nurbsutl.c \ - polytest.c \ - project.c \ - quadric.c \ - tess.c \ - tesselat.c - -SOURCES = $(CORE_SOURCES) - -OBJECTS = $(SOURCES:.c=.o) - -.c.o: - $(CC) -o $@ $(CFLAGS) -c $< - -all: $(LIBDIR)/$(GLU_LIB) $(LIBDIR)/$(GLU_DXE) $(LIBDIR)/$(GLU_IMP) - -$(LIBDIR)/$(GLU_LIB): $(OBJECTS) - $(AR) $(ARFLAGS) $@ $^ - -$(LIBDIR)/$(GLU_DXE) $(LIBDIR)/$(GLU_IMP): $(OBJECTS) -ifeq ($(HAVEDXE3),) - $(warning Missing DXE3 package... Skipping $(GLU_DXE)) -else - -dxe3gen -o $(LIBDIR)/$(GLU_DXE) -Y $(LIBDIR)/$(GLU_IMP) -D "MesaGLU DJGPP" -E _glu -P gl.dxe -U $^ -endif - -clean: - -$(call UNLINK,*.o) diff --git a/src/glu/mesa/Makefile.m32 b/src/glu/mesa/Makefile.m32 deleted file mode 100644 index e2cf9dd527..0000000000 --- a/src/glu/mesa/Makefile.m32 +++ /dev/null @@ -1,63 +0,0 @@ -# Makefile for GLU for GCC-2.95.2/Mingw32 contributed by -# Paul Garceau - -# Mesa 3-D graphics library -# Version: 3.3 -# Copyright (C) 1995-1999 Brian Paul -# -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Library General Public -# License as published by the Free Software Foundation; either -# version 2 of the License, or (at your option) any later version. -# -# This library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Library General Public License for more details. -# -# You should have received a copy of the GNU Library General Public -# License along with this library; if not, write to the Free -# Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - - -MESA_MAJOR=3 -MESA_MINOR=3 -MESA_TINY=0 -VERSION=$(MESA_MAJOR).$(MESA_MINOR) - -CFLAGS = -I. -DWIN32 -D__WIN32__ -D_WINDOWS \ - -O2 -funroll-loops \ - -fexpensive-optimizations -fomit-frame-pointer -ffast-math \ - -malign-loops=2 -malign-jumps=2 -malign-functions=2 \ - -mwindows -CC = gcc -MAKELIB = ar ru -GLU_LIB = libGLU.a - - -##### MACROS ##### - -VPATH = RCS - -INCDIR = ../include -LIBDIR = ../lib - -SOURCES = glu.c mipmap.c nurbs.c nurbscrv.c nurbssrf.c nurbsutl.c \ - polytest.c project.c quadric.c tess.c tesselat.c - -OBJECTS = $(SOURCES:.c=.o) - - - -##### RULES ##### - -.c.o: - $(CC) -c -I$(INCDIR) $(CFLAGS) $< - - - -##### TARGETS ##### - -# Make the library: -$(LIBDIR)/$(GLU_LIB): $(OBJECTS) - $(MAKELIB) $(GLU_LIB) $(MAJOR) $(MINOR) $(TINY) $(OBJECTS) \ No newline at end of file diff --git a/src/glu/mesa/Makefile.ugl b/src/glu/mesa/Makefile.ugl deleted file mode 100644 index fc189bd804..0000000000 --- a/src/glu/mesa/Makefile.ugl +++ /dev/null @@ -1,96 +0,0 @@ -# Mesa 3-D graphics library -# Version: 3.5 -# -# Copyright (C) 2001 Wind River Systems, Inc - -# The MIT License -# Permission is hereby granted, free of charge, to any person obtaining a -# copy of this software and associated documentation files (the "Software"), -# to deal in the Software without restriction, including without limitation -# the rights to use, copy, modify, merge, publish, distribute, sublicense, -# and/or sell copies of the Software, and to permit persons to whom the -# Software is furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included -# in all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -# DEALINGS IN THE SOFTWARE. - -# Makefile for GLU library - -##### MACROS ##### -GLU_MAJOR = 1 -GLU_MINOR = 3 -GLU_TINY = 0$(MESA_MAJOR)0$(MESA_MINOR)0$(MESA_TINY) - -##### RULES ##### - -include ../rules.windml - -GLU_SOURCES = \ - glu.c \ - mipmap.c \ - nurbs.c \ - nurbscrv.c \ - nurbssrf.c \ - nurbsutl.c \ - polytest.c \ - project.c \ - quadric.c \ - tess.c \ - tesselat.c \ - ../src/windml/tornado/torMesaGLUInit.c - -GLU_OBJECTS = $(GLU_SOURCES:.c=.o) -GLU_OBJNAME = $(MESA_LIBDIR)/objMesaGLU.o - -SOURCES = $(GLU_SOURCES) - -##### TARGETS ##### - -all: depend.$(CPU)$(TOOL) $(GLU_OBJNAME) - -# Make the GLU library -$(GLU_OBJNAME): $(GLU_OBJECTS) -# $(LD) -r $(GLU_OBJECTS) -o $(MESA_OBJNAME) - $(LD) -r $(GLU_OBJECTS) -o $(GLU_OBJNAME) -# $(AR) rus $(MESA_LIBNAME) $(GLU_OBJNAME) -# $(AR) rus $(VX_LIBNAME) $(GLU_OBJNAME) - -depend.$(CPU)$(TOOL): -ifeq ($(WIND_HOST_TYPE),x86-win32) - @ $(RM) $@ - @ $(ECHO) Creating depend.$(CPU)$(TOOL) -ifneq ($(SOURCES),) - @ for %f in ($(SOURCES)) do \ - $(CC) -MM $(CFLAGS) %f >>$@ -endif -else -Makefile - @ $(RM) $@ - @ $(ECHO) "Creating depend.$(CPU)$(TOOL)" -ifneq ($(SOURCES),) - @ for FILE in $(filter-out $(NODEPENDOBJS), $(SOURCES)); \ - do \ - $(CC) -MM $(CFLAGS) $$FILE \ - | $(TCL) $(BIN_DIR)/depend.tcl $(TGT_DIR) >>$@; \ - done -endif -endif - -.PHONY = clean - -clean: -# $(AR) d $(MESA_LIBNAME) $(GLU_OBJNAME) -# $(AR) d $(VX_LIBNAME) $(GLU_OBJNAME) - $(RM) $(GLU_OBJNAME) - $(RM) $(GLU_OBJECTS) - $(RM) depend.$(CPU)$(TOOL) - -include depend.$(CPU)$(TOOL) diff --git a/src/glu/mesa/MesaGLU.def b/src/glu/mesa/MesaGLU.def deleted file mode 100644 index 0cdd7bb787..0000000000 --- a/src/glu/mesa/MesaGLU.def +++ /dev/null @@ -1,62 +0,0 @@ -LIBRARY GLU32 -DESCRIPTION 'GLU for Windows Mesa' -EXETYPE WINDOWS -CODE MOVEABLE DISCARDABLE -DATA MOVEABLE SINGLE -HEAPSIZE 256000 - -STACKSIZE 4096 - -EXPORTS - gluLookAt - gluOrtho2D - gluPerspective - gluPickMatrix - gluProject - gluUnProject - gluErrorString - gluScaleImage - gluBuild1DMipmaps - gluBuild2DMipmaps - gluNewQuadric - gluDeleteQuadric - gluQuadricDrawStyle - gluQuadricOrientation - gluQuadricNormals - gluQuadricTexture - gluQuadricCallback - gluCylinder - gluSphere - gluDisk - gluPartialDisk - gluNewNurbsRenderer - gluDeleteNurbsRenderer - gluLoadSamplingMatrices - gluNurbsProperty - gluGetNurbsProperty - gluBeginCurve - gluEndCurve - gluNurbsCurve - gluBeginSurface - gluEndSurface - gluNurbsSurface - gluBeginTrim - gluEndTrim - gluPwlCurve - gluNurbsCallback - gluNewTess - gluDeleteTess -; gluTessBeginPolygon -; gluTessBeginContour - gluTessVertex -; gluTessEndContour -; gluTessEndPolygon -; gluTessProperty -; gluTessNormal - gluTessCallback -; gluGetTessProperty - gluBeginPolygon - gluNextContour - gluEndPolygon - gluGetString - diff --git a/src/glu/mesa/README1 b/src/glu/mesa/README1 deleted file mode 100644 index 75968572ff..0000000000 --- a/src/glu/mesa/README1 +++ /dev/null @@ -1,195 +0,0 @@ - -Notes on the GLU polygon tesselation facility implemented by Bogdan Sikorski... - - - -The tesselation module is provided under the same terms as the Mesa -package. - -This is the first release of polygon tesselation code for Mesa. -It was written during my very little free time, so lets name it: -"its not perfect". If someone hates pointers, don't look at the code. -I preffer dynamic allocation versus static. But _all_ ideas, suggestions, -bug reports and fixes are welcome (if You want, also flames). I am aware -that many things could have been written using better techniques, but time -that I could devote to this library was very limited. It is not well commented, -excuse me. Also I am thinking of continuing working on this code to improve, -fix and polish it. And make it as compliant as possible to the OpenGL, so -software ports from OpenGL to Mesa will work correctly. If You know of any -differences in behaviour, expected input/output between Mesa tesselation library -and OpenGL, please send me a note. I explain later on why I am not -confident with this code. - -I tried to be fully compliant with the OpenGL routines. By "tried" I mean that -up to my knowledge it behaves as OpenGL tesselation routines. Just recently -I began to experiment with OpenGL (actually only Mesa), and also have -no access to any machine providing official implementation of OpenGL, -nor access to books (particulary Addison-Wesley publications). Thus my -knowledge on how the original tesselation code works, what kind of data -it expects etc. is based _only_ on the publicly available documentation -provided by SGI. Namely: - -* "The OpenGL Graphics System Utility Library" by K.P.Smith - (Silicon Graphics, 1992) -* "The OpenGL Graphics Interface" by M.Segal and K.Akeley - (Silicon Graphics, 19??) -* "OpenGL and X, Part 1: Introduction" by M.J.Kilgard - (Silicon Graphics, 1994) -* "OpenGL and X, Part 2: Using OpenGL with Xlib" by M.J.Kilgard - (Silicon Graphics, 1994) -* "OpenGL Graphics with the X Window System" by P.Karlton - (Silicon Graphics, 1993) -* Online Docs - Appendix C of OpenGL Programming Guide, Polygon Tesselation - (partial text cut and sent by e-mail) - - -The tesselation routines use slightly different prototypes than the ones -specified in the mentioned above publications. The _only_ differences are -the enumeration types which are not GLenum, but are GLUenum. So the -implemented routines have following prototypes: - -GLUtringulatorObj *gluNewTess(void); - -void gluTessCallback(GLUtriangulatorObj *,GLUenum,void (*)()); - ^^^^^^^ -void gluBeginPolygon(GLUtriangulatorObj *); - -void gluTessVertex(GLUtriangulatorObj *,GLdouble [3],void *); - -void gluNextContour(GLUtriangulatorObj *,GLUenum); - ^^^^^^^ -void gluEndPolygon(GLUtriangulatorObj *); - -const GLubyte *gluErrorString(GLUenum); - ^^^^^^^ - prototypes for callback functions: - -void (GLUenum); - ^^^^^^^ -void (GLboolean); -void (void *); -void (void); -void (GLUenum); - ^^^^^^^ - -The begin callback will be called only with GLU_TRIANGLES. No support -for traingle fans or strips yet. - -In case of errors an internal error variable is set to the appropiate -error enum values (GLU_TESS_ERROR?). Initially it is set to GLU_NO_ERROR. -The OpenGL library provides 8 error conditions, the tesselation code -of Mesa provides 9. They are: - -GLU_TESS_ERROR1: missing gluEndPolygon /* same as OpenGL */ -GLU_TESS_ERROR2: missing gluBeginPolygon /* same as OpenGL */ -GLU_TESS_ERROR3: misoriented contour /* not used in Mesa - in OpenGL is bad orientation or intersecting edges */ -GLU_TESS_ERROR4: vertex/edge intersection /* same as OpenGL */ -GLU_TESS_ERROR5: misoriented or self-intersecting loops /* same as OpenGL */ -GLU_TESS_ERROR6: coincident vertices /* same as OpenGL */ -GLU_TESS_ERROR7: colinear vertices /* OpenGL's illegal data */ -GLU_TESS_ERROR8: intersecting edges /* same as OpenGL */ -GLU_TESS_ERROR9: not coplanar contours /* new for Mesa */ - -The Mesa tesselation code ignores all data and calls after detecting an error -codition. This means that a _new_ tesselation object must be used for further -triangulations. Maybe this is too restrictive, and will be lifted in -future versions. - -The tesselation code completely ignores the type parameter passed in -gluNextContour. It also doesn't check if the passed parameter is a legal -enum value - ignores silently (maybe at least this should be checked). -The reason I chose this behaviour is based on what I read in the -beforementioned documents. I cite: - -".... -void gluNextContour(GLUtriangulatorObj *tessobj, GLenum type); - -Marks the beginning of the next contour when multiple contours make up the -boundary of the polygon to be tessellated. type can be GLU_EXTERIOR, -GLU_INTERIOR, GLU_CCW, GLU_CW, or GLU_UNKNOWN. These serve only as -to the tessellation. If you get them right, the tessellation might -go faster. If you get them wrong, they're ignored, and the tesselation still -works. -....." - -I hope You agree with me that my decision was correct. Mesa tesselation -_always_ checks by itself the interrelations between contours. Just as if -all contours were specified with the type GLU_UNKNOWN. - -One of OpenGL's policy is not to check all error conditions - rely sometimes -that the user "got things right". This is justified, since exhausting -error checking is timeconsuming, and would significantly slow down -a correct application. The Mesa tesselation code assumes only _one_ condition -when triangulating - all vertices in a contour are planar. This is _not_ -checked for correctness. Trying to tesselate such objects will lead to -unpredictable output. - -And now we arrive to the moment where I would like to list the required -(but checked for) conditions for triangulation, as well as summarize the -library: - -* all contours in a single tesselation cycle _must_ be coplanar - if not - an error is raised (and if provided a call to the error callback - is made) -* the contours can be passed in _any_ order, exteriors and holes can be - intermixed within a tesselation cycle and the correct hierarchy - will be determined by the library; thus specifying first holes then - exteriors, then holes within holes form a valid input. -* a hole within a hole is consider to be a yet another exterior contour -* multiple exterior contours (polygons) can be tesselated in one cycle; - _but_ this significantly degrades performance since many tests will be - performed for every contour pair; if You want triangulation to be fast - tesselate a single polygon (with possible holes) one at a time. -* orientation of exterior contours is arbitray, but if it has holes, - all interior holes of this particular exterior contour _must_ have an - opposite orientation. -* the output triangles have the same orientation as the exterior contour - that forms them -* each triangle is "enclosed" within the begin and end callbacks; - this is not efficent, but was made on purpose; so if triangulation - results in 2 triangles the following callbacks will be made in such - order: - (GLU_TRAINGLES) - (...) /* 3 vertices of first triangle */ - (...) - (...) - () - (GLU_TRAINGLES) - (...) /* 3 vertices of second triangle */ - (...) - (...) - () - Of course only when begin, vertex, and end callback were provided, - otherwise no output is done (actually tesselation does not take place). -* You will notice that some output traingles are very "thin"; there - exist possible several ways to traingulate a polygon, but "smart" code - avoiding such cases would require time to write, and will impact on - execution speed. -* like OpenGL, no new vertices are introduced during triangulation -* if the edgeflag callback is provided it will be called whenever - the just-about-to be output vertex begins a different type of edge - than the previous vertices; always before the first output a call - is made with GL_TRUE, to allow synchronization. -* all intermediate computations are done using GLdouble type, and comparisons - are biased with a precision value (EPSILON defined in tess.h) -* the point_in_poly function is my adaptation of code from the - comp.graphics.alg newsgroup FAQ (originally written by Mr. Wm. Randolph - Franklin, modified by Scott Anguish). -* the edge_edge_intersect test is also an adopted code from comp.graphics.alg - newsgroup FAQ -* the general idea for traingulation used in this library is described in - the book "Computational Geometry in C" by Joseph O'Rourke. - - -Excuse my English, its not my mother tongue. I should be available for some -time uner the following e-mail address. But For how long I am not certain. -Once I am settled in my new place, I'll post on the Mesa mailing list -my new address. - -(PS: today is my last day of work here, I'm changing my job). - -Bogdan. ( bogdan@dia.unisa.it ) - -Apr 28, 1995. - diff --git a/src/glu/mesa/README2 b/src/glu/mesa/README2 deleted file mode 100644 index 3c9959179b..0000000000 --- a/src/glu/mesa/README2 +++ /dev/null @@ -1,43 +0,0 @@ -The current NURBS implementation has no trimming facilities yet. - -The code is not well commented. - -1) Normal calculus fails for special cases of NURBS (independent - of the NURBS modules) - Those cases arise when for u or v, some control points - for a fixed value of that parameter form the same point. - Imagine a Bezier patch degenerated into a "triangle". - - v ^ 0,1,2 order=3 - | * - | - | 3* 4* 5* - | - | 6* 7* 8* - | - | - +------------------------> u - - The calculus of du derivative at triple point (0,1 and 2) will fail. - As a result, the normal vector will be 0. - The eval2.c code has to be changed to handle the above situation. - -2) Adjacent NURBS surfaces ("sharing" the same control points along - the "joining" edge) will be sampled with the same factor. - This prevents the formation of "cracks". - When the control polygon of the "shared" edge is not the same, - cracks might appear. - -The sampling tolerance is sometimes not respected! -A NURBS object is broken into Bezier curves/surfaces. If one of such -Bezier objects has a local high curvature with other portions of it -relatively flat then the high curvature part will be sampled more dense that -its flatter regions. -The flat regions might be tesselated into quads having sides of length -greater than the current sampling tolernace setting. -I believe such behaviour is acceptable, though not along the concept of -sampling tolerance. - -February 20, 1996. - -Bogdan. diff --git a/src/glu/mesa/all.h b/src/glu/mesa/all.h deleted file mode 100644 index 874c935925..0000000000 --- a/src/glu/mesa/all.h +++ /dev/null @@ -1,54 +0,0 @@ - -/* - * Mesa 3-D graphics library - * Version: 3.3 - * Copyright (C) 1995-2000 Brian Paul - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the Free - * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - - -/* - * This file includes all .h files needed for the GLU source code for - * the purpose of precompiled headers. - * - * If the preprocessor symbol PCH is defined at compile time then each - * of the .c files will #include "all.h" only, instead of a bunch of - * individual .h files. - */ - - -#ifndef GLU_ALL_H -#define GLU_ALL_H - - -#ifndef PC_HEADER -This is an error. all.h should be included only if PCH is defined. -#endif - - -#include -#include -#include -#include -#include -#include "GL/gl.h" -#include "GL/glu.h" -#include "gluP.h" -#include "nurbs.h" -#include "tess.h" - - -#endif /*GLU_ALL_H */ diff --git a/src/glu/mesa/descrip.mms b/src/glu/mesa/descrip.mms deleted file mode 100644 index 2b3f64d8bc..0000000000 --- a/src/glu/mesa/descrip.mms +++ /dev/null @@ -1,61 +0,0 @@ -# Makefile for GLU for VMS -# contributed by Jouk Jansen joukj@hrem.stm.tudelft.nl - -.first - define gl [-.include.gl] - -.include [-]mms-config. - -##### MACROS ##### - -VPATH = RCS - -INCDIR = $disk2:[-.include] -LIBDIR = [-.lib] -CFLAGS = /include=$(INCDIR)/define=(FBIND=1)/name=(as_is,short)/float=ieee/ieee=denorm - -SOURCES = glu.c mipmap.c nurbs.c nurbscrv.c nurbssrf.c nurbsutl.c \ - polytest.c project.c quadric.c tess.c tesselat.c - -OBJECTS =glu.obj,mipmap.obj,nurbs.obj,nurbscrv.obj,nurbssrf.obj,nurbsutl.obj,\ - polytest.obj,project.obj,quadric.obj,tess.obj,tesselat.obj - - -##### RULES ##### - -VERSION=MesaGlu V3.2 - -##### TARGETS ##### - -# Make the library: -$(LIBDIR)$(GLU_LIB) : $(OBJECTS) -.ifdef SHARE - @ WRITE_ SYS$OUTPUT " generating mesagl1.opt" - @ OPEN_/WRITE FILE mesagl1.opt - @ WRITE_ FILE "!" - @ WRITE_ FILE "! mesagl1.opt generated by DESCRIP.$(MMS_EXT)" - @ WRITE_ FILE "!" - @ WRITE_ FILE "IDENTIFICATION=""$(VERSION)""" - @ WRITE_ FILE "GSMATCH=LEQUAL,3,2 - @ WRITE_ FILE "$(OBJECTS)" - @ WRITE_ FILE "[-.lib]libmesagl.exe/SHARE" - @ WRITE_ FILE "SYS$SHARE:DECW$XEXTLIBSHR/SHARE" - @ WRITE_ FILE "SYS$SHARE:DECW$XLIBSHR/SHARE" - @ CLOSE_ FILE - @ WRITE_ SYS$OUTPUT " generating mesagl.map ..." - @ LINK_/NODEB/NOSHARE/NOEXE/MAP=mesagl.map/FULL mesagl1.opt/OPT - @ WRITE_ SYS$OUTPUT " analyzing mesagl.map ..." - @ @[-.vms]ANALYZE_MAP.COM mesagl.map mesagl.opt - @ WRITE_ SYS$OUTPUT " linking $(GLU_LIB) ..." - @ LINK_/noinform/NODEB/SHARE=$(GLU_LIB)/MAP=mesagl.map/FULL mesagl1.opt/opt,mesagl.opt/opt -.else - @ $(MAKELIB) $(GLU_LIB) $(OBJECTS) -.endif - @ rename $(GLU_LIB)* $(LIBDIR) - -clean : - delete *.obj;* - purge - -include mms_depend. - diff --git a/src/glu/mesa/glu.c b/src/glu/mesa/glu.c deleted file mode 100644 index f9e33980a4..0000000000 --- a/src/glu/mesa/glu.c +++ /dev/null @@ -1,416 +0,0 @@ - -/* - * Mesa 3-D graphics library - * Version: 3.5 - * Copyright (C) 1995-2001 Brian Paul - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the Free - * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - - -#ifdef PC_HEADER -#include "all.h" -#else -#include -#include -#include -#include -#include -#include "gluP.h" -#endif - - -/* - * Miscellaneous utility functions - */ - - -#ifndef M_PI -#define M_PI 3.1415926536 -#endif -#define EPS 0.00001 - -#ifndef GLU_INCOMPATIBLE_GL_VERSION -#define GLU_INCOMPATIBLE_GL_VERSION 100903 -#endif - - -void GLAPIENTRY -gluLookAt(GLdouble eyex, GLdouble eyey, GLdouble eyez, - GLdouble centerx, GLdouble centery, GLdouble centerz, - GLdouble upx, GLdouble upy, GLdouble upz) -{ - GLdouble m[16]; - GLdouble x[3], y[3], z[3]; - GLdouble mag; - - /* Make rotation matrix */ - - /* Z vector */ - z[0] = eyex - centerx; - z[1] = eyey - centery; - z[2] = eyez - centerz; - mag = sqrt(z[0] * z[0] + z[1] * z[1] + z[2] * z[2]); - if (mag) { /* mpichler, 19950515 */ - z[0] /= mag; - z[1] /= mag; - z[2] /= mag; - } - - /* Y vector */ - y[0] = upx; - y[1] = upy; - y[2] = upz; - - /* X vector = Y cross Z */ - x[0] = y[1] * z[2] - y[2] * z[1]; - x[1] = -y[0] * z[2] + y[2] * z[0]; - x[2] = y[0] * z[1] - y[1] * z[0]; - - /* Recompute Y = Z cross X */ - y[0] = z[1] * x[2] - z[2] * x[1]; - y[1] = -z[0] * x[2] + z[2] * x[0]; - y[2] = z[0] * x[1] - z[1] * x[0]; - - /* mpichler, 19950515 */ - /* cross product gives area of parallelogram, which is < 1.0 for - * non-perpendicular unit-length vectors; so normalize x, y here - */ - - mag = sqrt(x[0] * x[0] + x[1] * x[1] + x[2] * x[2]); - if (mag) { - x[0] /= mag; - x[1] /= mag; - x[2] /= mag; - } - - mag = sqrt(y[0] * y[0] + y[1] * y[1] + y[2] * y[2]); - if (mag) { - y[0] /= mag; - y[1] /= mag; - y[2] /= mag; - } - -#define M(row,col) m[col*4+row] - M(0, 0) = x[0]; - M(0, 1) = x[1]; - M(0, 2) = x[2]; - M(0, 3) = 0.0; - M(1, 0) = y[0]; - M(1, 1) = y[1]; - M(1, 2) = y[2]; - M(1, 3) = 0.0; - M(2, 0) = z[0]; - M(2, 1) = z[1]; - M(2, 2) = z[2]; - M(2, 3) = 0.0; - M(3, 0) = 0.0; - M(3, 1) = 0.0; - M(3, 2) = 0.0; - M(3, 3) = 1.0; -#undef M - glMultMatrixd(m); - - /* Translate Eye to Origin */ - glTranslated(-eyex, -eyey, -eyez); - -} - - - -void GLAPIENTRY -gluOrtho2D(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top) -{ - glOrtho(left, right, bottom, top, -1.0, 1.0); -} - - - -static void -frustum(GLdouble left, GLdouble right, - GLdouble bottom, GLdouble top, - GLdouble nearval, GLdouble farval) -{ - GLdouble x, y, a, b, c, d; - GLdouble m[16]; - - x = (2.0 * nearval) / (right - left); - y = (2.0 * nearval) / (top - bottom); - a = (right + left) / (right - left); - b = (top + bottom) / (top - bottom); - c = -(farval + nearval) / ( farval - nearval); - d = -(2.0 * farval * nearval) / (farval - nearval); - -#define M(row,col) m[col*4+row] - M(0,0) = x; M(0,1) = 0.0F; M(0,2) = a; M(0,3) = 0.0F; - M(1,0) = 0.0F; M(1,1) = y; M(1,2) = b; M(1,3) = 0.0F; - M(2,0) = 0.0F; M(2,1) = 0.0F; M(2,2) = c; M(2,3) = d; - M(3,0) = 0.0F; M(3,1) = 0.0F; M(3,2) = -1.0F; M(3,3) = 0.0F; -#undef M - - glMultMatrixd(m); -} - - -void GLAPIENTRY -gluPerspective(GLdouble fovy, GLdouble aspect, GLdouble zNear, GLdouble zFar) -{ - GLdouble xmin, xmax, ymin, ymax; - - ymax = zNear * tan(fovy * M_PI / 360.0); - ymin = -ymax; - xmin = ymin * aspect; - xmax = ymax * aspect; - - /* don't call glFrustum() because of error semantics (covglu) */ - frustum(xmin, xmax, ymin, ymax, zNear, zFar); -} - - - -void GLAPIENTRY -gluPickMatrix(GLdouble x, GLdouble y, - GLdouble width, GLdouble height, GLint viewport[4]) -{ - GLfloat m[16]; - GLfloat sx, sy; - GLfloat tx, ty; - - sx = viewport[2] / width; - sy = viewport[3] / height; - tx = (viewport[2] + 2.0 * (viewport[0] - x)) / width; - ty = (viewport[3] + 2.0 * (viewport[1] - y)) / height; - -#define M(row,col) m[col*4+row] - M(0, 0) = sx; - M(0, 1) = 0.0; - M(0, 2) = 0.0; - M(0, 3) = tx; - M(1, 0) = 0.0; - M(1, 1) = sy; - M(1, 2) = 0.0; - M(1, 3) = ty; - M(2, 0) = 0.0; - M(2, 1) = 0.0; - M(2, 2) = 1.0; - M(2, 3) = 0.0; - M(3, 0) = 0.0; - M(3, 1) = 0.0; - M(3, 2) = 0.0; - M(3, 3) = 1.0; -#undef M - - glMultMatrixf(m); -} - - - -const GLubyte *GLAPIENTRY -gluErrorString(GLenum errorCode) -{ - static char *tess_error[] = { - "missing gluBeginPolygon", - "missing gluBeginContour", - "missing gluEndPolygon", - "missing gluEndContour", - "misoriented or self-intersecting loops", - "coincident vertices", - "colinear vertices", - "FIST recovery process fatal error" - }; - static char *nurbs_error[] = { - "spline order un-supported", - "too few knots", - "valid knot range is empty", - "decreasing knot sequence knot", - "knot multiplicity greater than order of spline", - "endcurve() must follow bgncurve()", - "bgncurve() must precede endcurve()", - "missing or extra geometric data", - "can't draw pwlcurves", - "missing bgncurve()", - "missing bgnsurface()", - "endtrim() must precede endsurface()", - "bgnsurface() must precede endsurface()", - "curve of improper type passed as trim curve", - "bgnsurface() must precede bgntrim()", - "endtrim() must follow bgntrim()", - "bgntrim() must precede endtrim()", - "invalid or missing trim curve", - "bgntrim() must precede pwlcurve()", - "pwlcurve referenced twice", - "pwlcurve and nurbscurve mixed", - "improper usage of trim data type", - "nurbscurve referenced twice", - "nurbscurve and pwlcurve mixed", - "nurbssurface referenced twice", - "invalid property", - "endsurface() must follow bgnsurface()", - "misoriented trim curves", - "intersecting trim curves", - "UNUSED", - "unconnected trim curves", - "unknown knot error", - "negative vertex count encountered", - "negative byte-stride encountered", - "unknown type descriptor", - "null control array or knot vector", - "duplicate point on pwlcurve" - }; - - /* GL Errors */ - if (errorCode == GL_NO_ERROR) { - return (GLubyte *) "no error"; - } - else if (errorCode == GL_INVALID_VALUE) { - return (GLubyte *) "invalid value"; - } - else if (errorCode == GL_INVALID_ENUM) { - return (GLubyte *) "invalid enum"; - } - else if (errorCode == GL_INVALID_OPERATION) { - return (GLubyte *) "invalid operation"; - } - else if (errorCode == GL_STACK_OVERFLOW) { - return (GLubyte *) "stack overflow"; - } - else if (errorCode == GL_STACK_UNDERFLOW) { - return (GLubyte *) "stack underflow"; - } - else if (errorCode == GL_OUT_OF_MEMORY) { - return (GLubyte *) "out of memory"; - } - /* GLU Errors */ - else if (errorCode == GLU_NO_ERROR) { - return (GLubyte *) "no error"; - } - else if (errorCode == GLU_INVALID_ENUM) { - return (GLubyte *) "invalid enum"; - } - else if (errorCode == GLU_INVALID_VALUE) { - return (GLubyte *) "invalid value"; - } - else if (errorCode == GLU_OUT_OF_MEMORY) { - return (GLubyte *) "out of memory"; - } - else if (errorCode == GLU_INCOMPATIBLE_GL_VERSION) { - return (GLubyte *) "incompatible GL version"; - } - else if (errorCode >= GLU_TESS_ERROR1 && errorCode <= GLU_TESS_ERROR8) { - return (GLubyte *) tess_error[errorCode - GLU_TESS_ERROR1]; - } - else if (errorCode >= GLU_NURBS_ERROR1 && errorCode <= GLU_NURBS_ERROR37) { - return (GLubyte *) nurbs_error[errorCode - GLU_NURBS_ERROR1]; - } - else { - return NULL; - } -} - - - -/* - * New in GLU 1.1 - */ - -const GLubyte *GLAPIENTRY -gluGetString(GLenum name) -{ - static char *extensions = "GL_EXT_abgr"; - static char *version = "1.1 Mesa 3.5"; - - switch (name) { - case GLU_EXTENSIONS: - return (GLubyte *) extensions; - case GLU_VERSION: - return (GLubyte *) version; - default: - return NULL; - } -} - - - -#if 0 /* gluGetProcAddressEXT not finalized yet! */ - -#ifdef __cplusplus - /* for BeOS R4.5 */ -void GLAPIENTRY(*gluGetProcAddressEXT(const GLubyte * procName)) (...) -#else -void (GLAPIENTRY * gluGetProcAddressEXT(const GLubyte * procName)) () -#endif -{ - struct proc - { - const char *name; - void *address; - }; - static struct proc procTable[] = { - {"gluGetProcAddressEXT", (void *) gluGetProcAddressEXT}, /* me! */ - - /* new 1.1 functions */ - {"gluGetString", (void *) gluGetString}, - - /* new 1.2 functions */ - {"gluTessBeginPolygon", (void *) gluTessBeginPolygon}, - {"gluTessBeginContour", (void *) gluTessBeginContour}, - {"gluTessEndContour", (void *) gluTessEndContour}, - {"gluTessEndPolygon", (void *) gluTessEndPolygon}, - {"gluGetTessProperty", (void *) gluGetTessProperty}, - - /* new 1.3 functions */ - - {NULL, NULL} - }; - GLuint i; - - for (i = 0; procTable[i].address; i++) { - if (strcmp((const char *) procName, procTable[i].name) == 0) - return (void (GLAPIENTRY *) ()) procTable[i].address; - } - - return NULL; -} - -#endif - - - -/* - * New in GLU 1.3 - */ -#ifdef GLU_VERSION_1_3 -GLboolean GLAPIENTRY -gluCheckExtension(const GLubyte *extName, const GLubyte * extString) -{ - assert(extName); - assert(extString); - { - const int len = strlen((const char *) extName); - const char *start = (const char *) extString; - - while (1) { - const char *c = strstr(start, (const char *) extName); - if (!c) - return GL_FALSE; - - if ((c == start || c[-1] == ' ') && (c[len] == ' ' || c[len] == 0)) - return GL_TRUE; - - start = c + len; - } - } -} -#endif diff --git a/src/glu/mesa/gluP.h b/src/glu/mesa/gluP.h deleted file mode 100644 index dc1b05b6a1..0000000000 --- a/src/glu/mesa/gluP.h +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Mesa 3-D graphics library - * Version: 6.3 - * Copyright (C) 1995-2004 Brian Paul - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the Free - * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - - -/* - * This file allows the GLU code to be compiled either with the Mesa - * headers or with the real OpenGL headers. - */ - - -#ifndef GLUP_H -#define GLUP_H - - -#include -#include -#include - - -#if defined(_WIN32) && !defined(__WIN32__) -# define __WIN32__ -#endif - -#if !defined(OPENSTEP) && (defined(__WIN32__) || defined(__CYGWIN__)) -# pragma warning( disable : 4068 ) /* unknown pragma */ -# pragma warning( disable : 4710 ) /* function 'foo' not inlined */ -# pragma warning( disable : 4711 ) /* function 'foo' selected for automatic inline expansion */ -# pragma warning( disable : 4127 ) /* conditional expression is constant */ -# if defined(MESA_MINWARN) -# pragma warning( disable : 4244 ) /* '=' : conversion from 'const double ' to 'float ', possible loss of data */ -# pragma warning( disable : 4018 ) /* '<' : signed/unsigned mismatch */ -# pragma warning( disable : 4305 ) /* '=' : truncation from 'const double ' to 'float ' */ -# pragma warning( disable : 4550 ) /* 'function' undefined; assuming extern returning int */ -# pragma warning( disable : 4761 ) /* integral size mismatch in argument; conversion supplied */ -# endif -# define GLCALLBACK __stdcall -# if defined(__CYGWIN__) -# define GLCALLBACKPCAST * -# else -# define GLCALLBACKPCAST __stdcall * -# endif -#else -/* non-Windows compilation */ -# define GLCALLBACK -# define GLCALLBACKPCAST * -#endif /* WIN32 / CYGWIN bracket */ - -/* compatability guard so we don't need to change client code */ - -#if defined(_WIN32) && !defined(_WINDEF_) && !defined(_GNU_H_WINDOWS32_BASE) && !defined(OPENSTEP) -# define CALLBACK GLCALLBACK -#endif - - - -#ifndef GLU_TESS_ERROR9 - /* If we're using the real OpenGL header files... */ -# define GLU_TESS_ERROR9 100159 -#endif - - -#define GLU_NO_ERROR GL_NO_ERROR - - -/* for Sun: */ -#ifdef SUNOS4 -#define MEMCPY( DST, SRC, BYTES) \ - memcpy( (char *) (DST), (char *) (SRC), (int) (BYTES) ) -#else -#define MEMCPY( DST, SRC, BYTES) \ - memcpy( (void *) (DST), (void *) (SRC), (size_t) (BYTES) ) -#endif - - -#ifndef NULL -# define NULL 0 -#endif - - -#endif diff --git a/src/glu/mesa/mipmap.c b/src/glu/mesa/mipmap.c deleted file mode 100644 index d85ce9b9b0..0000000000 --- a/src/glu/mesa/mipmap.c +++ /dev/null @@ -1,824 +0,0 @@ - -/* - * Mesa 3-D graphics library - * Version: 3.4 - * Copyright (C) 1995-2000 Brian Paul - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the Free - * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - - -#ifdef PC_HEADER -#include "all.h" -#else -#include -#include -#include -#include -#include "gluP.h" -#endif - - -/* - * Compute ceiling of integer quotient of A divided by B: - */ -#define CEILING( A, B ) ( (A) % (B) == 0 ? (A)/(B) : (A)/(B)+1 ) - - - -#ifdef EPSILON -#undef EPSILON -#endif -#define EPSILON 0.001 - - -/* To work around optimizer bug in MSVC4.1 */ -#if defined(__WIN32__) && !defined(OPENSTEP) -void -dummy(GLuint j, GLuint k) -{ -} -#else -#define dummy(J, K) -#endif - - -GLint GLAPIENTRY -gluScaleImage(GLenum format, - GLsizei widthin, GLsizei heightin, - GLenum typein, const void *datain, - GLsizei widthout, GLsizei heightout, - GLenum typeout, void *dataout) -{ - GLint components, i, j, k; - GLfloat *tempin, *tempout; - GLfloat sx, sy; - GLint unpackrowlength, unpackalignment, unpackskiprows, unpackskippixels; - GLint packrowlength, packalignment, packskiprows, packskippixels; - GLint sizein, sizeout; - GLint rowstride, rowlen; - - - /* Determine number of components per pixel */ - switch (format) { - case GL_COLOR_INDEX: - case GL_STENCIL_INDEX: - case GL_DEPTH_COMPONENT: - case GL_RED: - case GL_GREEN: - case GL_BLUE: - case GL_ALPHA: - case GL_LUMINANCE: - components = 1; - break; - case GL_LUMINANCE_ALPHA: - components = 2; - break; - case GL_RGB: - case GL_BGR: - components = 3; - break; - case GL_RGBA: - case GL_BGRA: -#ifdef GL_EXT_abgr - case GL_ABGR_EXT: -#endif - components = 4; - break; - default: - return GLU_INVALID_ENUM; - } - - /* Determine bytes per input datum */ - switch (typein) { - case GL_UNSIGNED_BYTE: - sizein = sizeof(GLubyte); - break; - case GL_BYTE: - sizein = sizeof(GLbyte); - break; - case GL_UNSIGNED_SHORT: - sizein = sizeof(GLushort); - break; - case GL_SHORT: - sizein = sizeof(GLshort); - break; - case GL_UNSIGNED_INT: - sizein = sizeof(GLuint); - break; - case GL_INT: - sizein = sizeof(GLint); - break; - case GL_FLOAT: - sizein = sizeof(GLfloat); - break; - case GL_BITMAP: - /* not implemented yet */ - default: - return GL_INVALID_ENUM; - } - - /* Determine bytes per output datum */ - switch (typeout) { - case GL_UNSIGNED_BYTE: - sizeout = sizeof(GLubyte); - break; - case GL_BYTE: - sizeout = sizeof(GLbyte); - break; - case GL_UNSIGNED_SHORT: - sizeout = sizeof(GLushort); - break; - case GL_SHORT: - sizeout = sizeof(GLshort); - break; - case GL_UNSIGNED_INT: - sizeout = sizeof(GLuint); - break; - case GL_INT: - sizeout = sizeof(GLint); - break; - case GL_FLOAT: - sizeout = sizeof(GLfloat); - break; - case GL_BITMAP: - /* not implemented yet */ - default: - return GL_INVALID_ENUM; - } - - /* Get glPixelStore state */ - glGetIntegerv(GL_UNPACK_ROW_LENGTH, &unpackrowlength); - glGetIntegerv(GL_UNPACK_ALIGNMENT, &unpackalignment); - glGetIntegerv(GL_UNPACK_SKIP_ROWS, &unpackskiprows); - glGetIntegerv(GL_UNPACK_SKIP_PIXELS, &unpackskippixels); - glGetIntegerv(GL_PACK_ROW_LENGTH, &packrowlength); - glGetIntegerv(GL_PACK_ALIGNMENT, &packalignment); - glGetIntegerv(GL_PACK_SKIP_ROWS, &packskiprows); - glGetIntegerv(GL_PACK_SKIP_PIXELS, &packskippixels); - - /* Allocate storage for intermediate images */ - tempin = (GLfloat *) malloc(widthin * heightin - * components * sizeof(GLfloat)); - if (!tempin) { - return GLU_OUT_OF_MEMORY; - } - tempout = (GLfloat *) malloc(widthout * heightout - * components * sizeof(GLfloat)); - if (!tempout) { - free(tempin); - return GLU_OUT_OF_MEMORY; - } - - - /* - * Unpack the pixel data and convert to floating point - */ - - if (unpackrowlength > 0) { - rowlen = unpackrowlength; - } - else { - rowlen = widthin; - } - if (sizein >= unpackalignment) { - rowstride = components * rowlen; - } - else { - rowstride = unpackalignment / sizein - * CEILING(components * rowlen * sizein, unpackalignment); - } - - switch (typein) { - case GL_UNSIGNED_BYTE: - k = 0; - for (i = 0; i < heightin; i++) { - GLubyte *ubptr = (GLubyte *) datain - + i * rowstride - + unpackskiprows * rowstride + unpackskippixels * components; - for (j = 0; j < widthin * components; j++) { - dummy(j, k); - tempin[k++] = (GLfloat) * ubptr++; - } - } - break; - case GL_BYTE: - k = 0; - for (i = 0; i < heightin; i++) { - GLbyte *bptr = (GLbyte *) datain - + i * rowstride - + unpackskiprows * rowstride + unpackskippixels * components; - for (j = 0; j < widthin * components; j++) { - dummy(j, k); - tempin[k++] = (GLfloat) * bptr++; - } - } - break; - case GL_UNSIGNED_SHORT: - k = 0; - for (i = 0; i < heightin; i++) { - GLushort *usptr = (GLushort *) datain - + i * rowstride - + unpackskiprows * rowstride + unpackskippixels * components; - for (j = 0; j < widthin * components; j++) { - dummy(j, k); - tempin[k++] = (GLfloat) * usptr++; - } - } - break; - case GL_SHORT: - k = 0; - for (i = 0; i < heightin; i++) { - GLshort *sptr = (GLshort *) datain - + i * rowstride - + unpackskiprows * rowstride + unpackskippixels * components; - for (j = 0; j < widthin * components; j++) { - dummy(j, k); - tempin[k++] = (GLfloat) * sptr++; - } - } - break; - case GL_UNSIGNED_INT: - k = 0; - for (i = 0; i < heightin; i++) { - GLuint *uiptr = (GLuint *) datain - + i * rowstride - + unpackskiprows * rowstride + unpackskippixels * components; - for (j = 0; j < widthin * components; j++) { - dummy(j, k); - tempin[k++] = (GLfloat) * uiptr++; - } - } - break; - case GL_INT: - k = 0; - for (i = 0; i < heightin; i++) { - GLint *iptr = (GLint *) datain - + i * rowstride - + unpackskiprows * rowstride + unpackskippixels * components; - for (j = 0; j < widthin * components; j++) { - dummy(j, k); - tempin[k++] = (GLfloat) * iptr++; - } - } - break; - case GL_FLOAT: - k = 0; - for (i = 0; i < heightin; i++) { - GLfloat *fptr = (GLfloat *) datain - + i * rowstride - + unpackskiprows * rowstride + unpackskippixels * components; - for (j = 0; j < widthin * components; j++) { - dummy(j, k); - tempin[k++] = *fptr++; - } - } - break; - default: - return GLU_INVALID_ENUM; - } - - - /* - * Scale the image! - */ - - if (widthout > 1) - sx = (GLfloat) (widthin - 1) / (GLfloat) (widthout - 1); - else - sx = (GLfloat) (widthin - 1); - if (heightout > 1) - sy = (GLfloat) (heightin - 1) / (GLfloat) (heightout - 1); - else - sy = (GLfloat) (heightin - 1); - -/*#define POINT_SAMPLE*/ -#ifdef POINT_SAMPLE - for (i = 0; i < heightout; i++) { - GLint ii = i * sy; - for (j = 0; j < widthout; j++) { - GLint jj = j * sx; - - GLfloat *src = tempin + (ii * widthin + jj) * components; - GLfloat *dst = tempout + (i * widthout + j) * components; - - for (k = 0; k < components; k++) { - *dst++ = *src++; - } - } - } -#else - if (sx < 1.0 && sy < 1.0) { - /* magnify both width and height: use weighted sample of 4 pixels */ - GLint i0, i1, j0, j1; - GLfloat alpha, beta; - GLfloat *src00, *src01, *src10, *src11; - GLfloat s1, s2; - GLfloat *dst; - - for (i = 0; i < heightout; i++) { - i0 = i * sy; - i1 = i0 + 1; - if (i1 >= heightin) - i1 = heightin - 1; -/* i1 = (i+1) * sy - EPSILON;*/ - alpha = i * sy - i0; - for (j = 0; j < widthout; j++) { - j0 = j * sx; - j1 = j0 + 1; - if (j1 >= widthin) - j1 = widthin - 1; -/* j1 = (j+1) * sx - EPSILON; */ - beta = j * sx - j0; - - /* compute weighted average of pixels in rect (i0,j0)-(i1,j1) */ - src00 = tempin + (i0 * widthin + j0) * components; - src01 = tempin + (i0 * widthin + j1) * components; - src10 = tempin + (i1 * widthin + j0) * components; - src11 = tempin + (i1 * widthin + j1) * components; - - dst = tempout + (i * widthout + j) * components; - - for (k = 0; k < components; k++) { - s1 = *src00++ * (1.0 - beta) + *src01++ * beta; - s2 = *src10++ * (1.0 - beta) + *src11++ * beta; - *dst++ = s1 * (1.0 - alpha) + s2 * alpha; - } - } - } - } - else { - /* shrink width and/or height: use an unweighted box filter */ - GLint i0, i1; - GLint j0, j1; - GLint ii, jj; - GLfloat sum, *dst; - - for (i = 0; i < heightout; i++) { - i0 = i * sy; - i1 = i0 + 1; - if (i1 >= heightin) - i1 = heightin - 1; -/* i1 = (i+1) * sy - EPSILON; */ - for (j = 0; j < widthout; j++) { - j0 = j * sx; - j1 = j0 + 1; - if (j1 >= widthin) - j1 = widthin - 1; -/* j1 = (j+1) * sx - EPSILON; */ - - dst = tempout + (i * widthout + j) * components; - - /* compute average of pixels in the rectangle (i0,j0)-(i1,j1) */ - for (k = 0; k < components; k++) { - sum = 0.0; - for (ii = i0; ii <= i1; ii++) { - for (jj = j0; jj <= j1; jj++) { - sum += *(tempin + (ii * widthin + jj) * components + k); - } - } - sum /= (j1 - j0 + 1) * (i1 - i0 + 1); - *dst++ = sum; - } - } - } - } -#endif - - - /* - * Return output image - */ - - if (packrowlength > 0) { - rowlen = packrowlength; - } - else { - rowlen = widthout; - } - if (sizeout >= packalignment) { - rowstride = components * rowlen; - } - else { - rowstride = packalignment / sizeout - * CEILING(components * rowlen * sizeout, packalignment); - } - - switch (typeout) { - case GL_UNSIGNED_BYTE: - k = 0; - for (i = 0; i < heightout; i++) { - GLubyte *ubptr = (GLubyte *) dataout - + i * rowstride - + packskiprows * rowstride + packskippixels * components; - for (j = 0; j < widthout * components; j++) { - dummy(j, k + i); - *ubptr++ = (GLubyte) tempout[k++]; - } - } - break; - case GL_BYTE: - k = 0; - for (i = 0; i < heightout; i++) { - GLbyte *bptr = (GLbyte *) dataout - + i * rowstride - + packskiprows * rowstride + packskippixels * components; - for (j = 0; j < widthout * components; j++) { - dummy(j, k + i); - *bptr++ = (GLbyte) tempout[k++]; - } - } - break; - case GL_UNSIGNED_SHORT: - k = 0; - for (i = 0; i < heightout; i++) { - GLushort *usptr = (GLushort *) dataout - + i * rowstride - + packskiprows * rowstride + packskippixels * components; - for (j = 0; j < widthout * components; j++) { - dummy(j, k + i); - *usptr++ = (GLushort) tempout[k++]; - } - } - break; - case GL_SHORT: - k = 0; - for (i = 0; i < heightout; i++) { - GLshort *sptr = (GLshort *) dataout - + i * rowstride - + packskiprows * rowstride + packskippixels * components; - for (j = 0; j < widthout * components; j++) { - dummy(j, k + i); - *sptr++ = (GLshort) tempout[k++]; - } - } - break; - case GL_UNSIGNED_INT: - k = 0; - for (i = 0; i < heightout; i++) { - GLuint *uiptr = (GLuint *) dataout - + i * rowstride - + packskiprows * rowstride + packskippixels * components; - for (j = 0; j < widthout * components; j++) { - dummy(j, k + i); - *uiptr++ = (GLuint) tempout[k++]; - } - } - break; - case GL_INT: - k = 0; - for (i = 0; i < heightout; i++) { - GLint *iptr = (GLint *) dataout - + i * rowstride - + packskiprows * rowstride + packskippixels * components; - for (j = 0; j < widthout * components; j++) { - dummy(j, k + i); - *iptr++ = (GLint) tempout[k++]; - } - } - break; - case GL_FLOAT: - k = 0; - for (i = 0; i < heightout; i++) { - GLfloat *fptr = (GLfloat *) dataout - + i * rowstride - + packskiprows * rowstride + packskippixels * components; - for (j = 0; j < widthout * components; j++) { - dummy(j, k + i); - *fptr++ = tempout[k++]; - } - } - break; - default: - return GLU_INVALID_ENUM; - } - - - /* free temporary image storage */ - free(tempin); - free(tempout); - - return 0; -} - - - -/* - * Return the largest k such that 2^k <= n. - */ -static GLint -ilog2(GLint n) -{ - GLint k; - - if (n <= 0) - return 0; - for (k = 0; n >>= 1; k++); - return k; -} - - - -/* - * Find the value nearest to n which is also a power of two. - */ -static GLint -round2(GLint n) -{ - GLint m; - - for (m = 1; m < n; m *= 2); - - /* m>=n */ - if (m - n <= n - m / 2) { - return m; - } - else { - return m / 2; - } -} - - -/* - * Given an pixel format and datatype, return the number of bytes to - * store one pixel. - */ -static GLint -bytes_per_pixel(GLenum format, GLenum type) -{ - GLint n, m; - - switch (format) { - case GL_COLOR_INDEX: - case GL_STENCIL_INDEX: - case GL_DEPTH_COMPONENT: - case GL_RED: - case GL_GREEN: - case GL_BLUE: - case GL_ALPHA: - case GL_LUMINANCE: - n = 1; - break; - case GL_LUMINANCE_ALPHA: - n = 2; - break; - case GL_RGB: - case GL_BGR: - n = 3; - break; - case GL_RGBA: - case GL_BGRA: -#ifdef GL_EXT_abgr - case GL_ABGR_EXT: -#endif - n = 4; - break; - default: - n = 0; - } - - switch (type) { - case GL_UNSIGNED_BYTE: - m = sizeof(GLubyte); - break; - case GL_BYTE: - m = sizeof(GLbyte); - break; - case GL_BITMAP: - m = 1; - break; - case GL_UNSIGNED_SHORT: - m = sizeof(GLushort); - break; - case GL_SHORT: - m = sizeof(GLshort); - break; - case GL_UNSIGNED_INT: - m = sizeof(GLuint); - break; - case GL_INT: - m = sizeof(GLint); - break; - case GL_FLOAT: - m = sizeof(GLfloat); - break; - default: - m = 0; - } - - return n * m; -} - - - -/* - * WARNING: This function isn't finished and has never been tested!!!! - */ -GLint GLAPIENTRY -gluBuild1DMipmaps(GLenum target, GLint components, - GLsizei width, GLenum format, GLenum type, const void *data) -{ - GLubyte *texture; - GLint levels, max_levels; - GLint new_width, max_width; - GLint i, j, k, l; - - if (width < 1) - return GLU_INVALID_VALUE; - - glGetIntegerv(GL_MAX_TEXTURE_SIZE, &max_width); - max_levels = ilog2(max_width) + 1; - - /* Compute how many mipmap images to make */ - levels = ilog2(width) + 1; - if (levels > max_levels) { - levels = max_levels; - } - - new_width = 1 << (levels - 1); - - texture = (GLubyte *) malloc(new_width * components); - if (!texture) { - return GLU_OUT_OF_MEMORY; - } - - if (width != new_width) { - /* initial rescaling */ - switch (type) { - case GL_UNSIGNED_BYTE: - { - GLubyte *ub_data = (GLubyte *) data; - for (i = 0; i < new_width; i++) { - j = i * width / new_width; - for (k = 0; k < components; k++) { - texture[i * components + k] = ub_data[j * components + k]; - } - } - } - break; - default: - /* Not implemented */ - return GLU_ERROR; - } - } - - /* generate and load mipmap images */ - for (l = 0; l < levels; l++) { - glTexImage1D(GL_TEXTURE_1D, l, components, new_width, 0, - format, GL_UNSIGNED_BYTE, texture); - - /* Scale image down to 1/2 size */ - new_width = new_width / 2; - for (i = 0; i < new_width; i++) { - for (k = 0; k < components; k++) { - GLint sample1, sample2; - sample1 = (GLint) texture[i * 2 * components + k]; - sample2 = (GLint) texture[(i * 2 + 1) * components + k]; - texture[i * components + k] = (GLubyte) ((sample1 + sample2) / 2); - } - } - } - - free(texture); - - return 0; -} - - - -GLint GLAPIENTRY -gluBuild2DMipmaps(GLenum target, GLint components, - GLsizei width, GLsizei height, GLenum format, - GLenum type, const void *data) -{ - GLint w, h, maxsize; - void *image, *newimage; - GLint neww, newh, level, bpp; - int error; - GLboolean done; - GLint retval = 0; - GLint unpackrowlength, unpackalignment, unpackskiprows, unpackskippixels; - GLint packrowlength, packalignment, packskiprows, packskippixels; - - if (width < 1 || height < 1) - return GLU_INVALID_VALUE; - - glGetIntegerv(GL_MAX_TEXTURE_SIZE, &maxsize); - - w = round2(width); - if (w > maxsize) { - w = maxsize; - } - h = round2(height); - if (h > maxsize) { - h = maxsize; - } - - bpp = bytes_per_pixel(format, type); - if (bpp == 0) { - /* probably a bad format or type enum */ - return GLU_INVALID_ENUM; - } - - /* Get current glPixelStore values */ - glGetIntegerv(GL_UNPACK_ROW_LENGTH, &unpackrowlength); - glGetIntegerv(GL_UNPACK_ALIGNMENT, &unpackalignment); - glGetIntegerv(GL_UNPACK_SKIP_ROWS, &unpackskiprows); - glGetIntegerv(GL_UNPACK_SKIP_PIXELS, &unpackskippixels); - glGetIntegerv(GL_PACK_ROW_LENGTH, &packrowlength); - glGetIntegerv(GL_PACK_ALIGNMENT, &packalignment); - glGetIntegerv(GL_PACK_SKIP_ROWS, &packskiprows); - glGetIntegerv(GL_PACK_SKIP_PIXELS, &packskippixels); - - /* set pixel packing */ - glPixelStorei(GL_PACK_ROW_LENGTH, 0); - glPixelStorei(GL_PACK_ALIGNMENT, 1); - glPixelStorei(GL_PACK_SKIP_ROWS, 0); - glPixelStorei(GL_PACK_SKIP_PIXELS, 0); - - done = GL_FALSE; - - if (w != width || h != height) { - /* must rescale image to get "top" mipmap texture image */ - image = malloc((w + 4) * h * bpp); - if (!image) { - return GLU_OUT_OF_MEMORY; - } - error = gluScaleImage(format, width, height, type, data, - w, h, type, image); - if (error) { - retval = error; - done = GL_TRUE; - } - } - else { - image = (void *) data; - } - - level = 0; - while (!done) { - if (image != data) { - /* set pixel unpacking */ - glPixelStorei(GL_UNPACK_ROW_LENGTH, 0); - glPixelStorei(GL_UNPACK_ALIGNMENT, 1); - glPixelStorei(GL_UNPACK_SKIP_ROWS, 0); - glPixelStorei(GL_UNPACK_SKIP_PIXELS, 0); - } - - glTexImage2D(target, level, components, w, h, 0, format, type, image); - - if (w == 1 && h == 1) - break; - - neww = (w < 2) ? 1 : w / 2; - newh = (h < 2) ? 1 : h / 2; - newimage = malloc((neww + 4) * newh * bpp); - if (!newimage) { - return GLU_OUT_OF_MEMORY; - } - - error = gluScaleImage(format, w, h, type, image, - neww, newh, type, newimage); - if (error) { - retval = error; - done = GL_TRUE; - } - - if (image != data) { - free(image); - } - image = newimage; - - w = neww; - h = newh; - level++; - } - - if (image != data) { - free(image); - } - - /* Restore original glPixelStore state */ - glPixelStorei(GL_UNPACK_ROW_LENGTH, unpackrowlength); - glPixelStorei(GL_UNPACK_ALIGNMENT, unpackalignment); - glPixelStorei(GL_UNPACK_SKIP_ROWS, unpackskiprows); - glPixelStorei(GL_UNPACK_SKIP_PIXELS, unpackskippixels); - glPixelStorei(GL_PACK_ROW_LENGTH, packrowlength); - glPixelStorei(GL_PACK_ALIGNMENT, packalignment); - glPixelStorei(GL_PACK_SKIP_ROWS, packskiprows); - glPixelStorei(GL_PACK_SKIP_PIXELS, packskippixels); - - return retval; -} diff --git a/src/glu/mesa/mms_depend b/src/glu/mesa/mms_depend deleted file mode 100644 index ed59ca9de8..0000000000 --- a/src/glu/mesa/mms_depend +++ /dev/null @@ -1,15 +0,0 @@ -# DO NOT DELETE THIS LINE -- make depend depends on it. - -glu.obj : gluP.h [-.include.gl]gl.h [-.include.gl]glu.h -mipmap.obj : gluP.h [-.include.gl]gl.h [-.include.gl]glu.h -nurbs.obj : gluP.h [-.include.gl]gl.h [-.include.gl]glu.h nurbs.h -nurbscrv.obj : nurbs.h gluP.h [-.include.gl]gl.h [-.include.gl]glu.h -nurbssrf.obj : gluP.h [-.include.gl]gl.h [-.include.gl]glu.h nurbs.h -nurbsutl.obj : gluP.h [-.include.gl]gl.h [-.include.gl]glu.h nurbs.h -project.obj : gluP.h [-.include.gl]gl.h [-.include.gl]glu.h -quadric.obj : gluP.h [-.include.gl]gl.h [-.include.gl]glu.h -tess.obj : gluP.h [-.include.gl]gl.h [-.include.gl]glu.h tess.h -tess_fist.obj : gluP.h [-.include.gl]gl.h [-.include.gl]glu.h tess.h -tess_hash.obj : gluP.h [-.include.gl]gl.h [-.include.gl]glu.h tess.h -tess_heap.obj : gluP.h [-.include.gl]gl.h [-.include.gl]glu.h tess.h -tess_clip.obj : gluP.h [-.include.gl]gl.h [-.include.gl]glu.h tess.h diff --git a/src/glu/mesa/nurbs.c b/src/glu/mesa/nurbs.c deleted file mode 100644 index 3f102b4e45..0000000000 --- a/src/glu/mesa/nurbs.c +++ /dev/null @@ -1,628 +0,0 @@ - -/* - * Mesa 3-D graphics library - * Version: 3.3 - * Copyright (C) 1995-2000 Brian Paul - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the Free - * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - - -/* - * NURBS implementation written by Bogdan Sikorski (bogdan@cira.it) - * See README2 for more info. - */ - - -#ifdef PC_HEADER -#include "all.h" -#else -#include -#include -#include "gluP.h" -#include "nurbs.h" -#endif - - -void -call_user_error(GLUnurbsObj * nobj, GLenum error) -{ - nobj->error = error; - if (nobj->error_callback != NULL) { - (*(nobj->error_callback)) (error); - } - else { - printf("NURBS error %d %s\n", error, (char *) gluErrorString(error)); - } -} - - - -GLUnurbsObj *GLAPIENTRY -gluNewNurbsRenderer(void) -{ - GLUnurbsObj *n; - GLfloat tmp_viewport[4]; - GLint i, j; - - n = (GLUnurbsObj *) malloc(sizeof(GLUnurbsObj)); - if (n) { - /* init */ - n->culling = GL_FALSE; - n->nurbs_type = GLU_NURBS_NONE; - n->error = GLU_NO_ERROR; - n->error_callback = NULL; - n->auto_load_matrix = GL_TRUE; - n->sampling_tolerance = 50.0; - n->parametric_tolerance = 0.5; - n->u_step = n->v_step = 100; - n->sampling_method = GLU_PATH_LENGTH; - n->display_mode = GLU_FILL; - /* in case the user doesn't supply the sampling matrices */ - /* set projection and modelview to identity */ - for (i = 0; i < 4; i++) - for (j = 0; j < 4; j++) - if (i == j) { - n->sampling_matrices.model[i * 4 + j] = 1.0; - n->sampling_matrices.proj[i * 4 + j] = 1.0; - } - else { - n->sampling_matrices.model[i * 4 + j] = 0.0; - n->sampling_matrices.proj[i * 4 + j] = 0.0; - } - /* and set the viewport sampling matrix to current ciewport */ - glGetFloatv(GL_VIEWPORT, tmp_viewport); - for (i = 0; i < 4; i++) - n->sampling_matrices.viewport[i] = tmp_viewport[i]; - n->trim = NULL; - } - return n; -} - - - -void GLAPIENTRY -gluDeleteNurbsRenderer(GLUnurbsObj * nobj) -{ - if (nobj) { - free(nobj); - } -} - - - -void GLAPIENTRY -gluLoadSamplingMatrices(GLUnurbsObj * nobj, - const GLfloat modelMatrix[16], - const GLfloat projMatrix[16], const GLint viewport[4]) -{ - GLint i; - - for (i = 0; i < 16; i++) { - nobj->sampling_matrices.model[i] = modelMatrix[i]; - nobj->sampling_matrices.proj[i] = projMatrix[i]; - } - for (i = 0; i < 4; i++) - nobj->sampling_matrices.viewport[i] = viewport[i]; -} - - -void GLAPIENTRY -gluNurbsProperty(GLUnurbsObj * nobj, GLenum property, GLfloat value) -{ - GLenum val; - - switch (property) { - case GLU_SAMPLING_TOLERANCE: - if (value <= 0.0) { - call_user_error(nobj, GLU_INVALID_VALUE); - return; - } - nobj->sampling_tolerance = value; - break; - case GLU_PARAMETRIC_TOLERANCE: - if (value <= 0.0) { - call_user_error(nobj, GLU_INVALID_VALUE); - return; - } - nobj->parametric_tolerance = value; - break; - case GLU_U_STEP: - if (value <= 0.0) { - call_user_error(nobj, GLU_INVALID_VALUE); - return; - } - nobj->u_step = (GLint) value; - break; - case GLU_V_STEP: - if (value <= 0.0) { - call_user_error(nobj, GLU_INVALID_VALUE); - return; - } - nobj->v_step = (GLint) value; - break; - case GLU_SAMPLING_METHOD: - val = (GLenum) value; - if (val != GLU_PATH_LENGTH && val != GLU_PARAMETRIC_ERROR - && val != GLU_DOMAIN_DISTANCE) { - call_user_error(nobj, GLU_INVALID_ENUM); - return; - } - nobj->sampling_method = val; - break; - case GLU_DISPLAY_MODE: - val = (GLenum) value; - if (val != GLU_FILL && val != GLU_OUTLINE_POLYGON - && val != GLU_OUTLINE_PATCH) { - call_user_error(nobj, GLU_INVALID_ENUM); - return; - } - if (nobj->nurbs_type == GLU_NURBS_CURVE) { - call_user_error(nobj, GLU_NURBS_ERROR26); - return; - } - nobj->display_mode = val; - if (val == GLU_OUTLINE_PATCH) - fprintf(stderr, - "NURBS, for the moment, can display only in POLYGON mode\n"); - break; - case GLU_CULLING: - val = (GLenum) value; - if (val != GL_TRUE && val != GL_FALSE) { - call_user_error(nobj, GLU_INVALID_ENUM); - return; - } - nobj->culling = (GLboolean) value; - break; - case GLU_AUTO_LOAD_MATRIX: - val = (GLenum) value; - if (val != GL_TRUE && val != GL_FALSE) { - call_user_error(nobj, GLU_INVALID_ENUM); - return; - } - nobj->auto_load_matrix = (GLboolean) value; - break; - default: - call_user_error(nobj, GLU_NURBS_ERROR26); - } -} - - -void GLAPIENTRY -gluGetNurbsProperty(GLUnurbsObj * nobj, GLenum property, GLfloat * value) -{ - switch (property) { - case GLU_SAMPLING_TOLERANCE: - *value = nobj->sampling_tolerance; - break; - case GLU_DISPLAY_MODE: - *value = (GLfloat) (GLint) nobj->display_mode; - break; - case GLU_CULLING: - *value = nobj->culling ? 1.0 : 0.0; - break; - case GLU_AUTO_LOAD_MATRIX: - *value = nobj->auto_load_matrix ? 1.0 : 0.0; - break; - default: - call_user_error(nobj, GLU_INVALID_ENUM); - } -} - - - -void GLAPIENTRY -gluBeginCurve(GLUnurbsObj * nobj) -{ - if (nobj->nurbs_type == GLU_NURBS_CURVE) { - call_user_error(nobj, GLU_NURBS_ERROR6); - return; - } - nobj->nurbs_type = GLU_NURBS_CURVE; - nobj->curve.geom.type = GLU_INVALID_ENUM; - nobj->curve.color.type = GLU_INVALID_ENUM; - nobj->curve.texture.type = GLU_INVALID_ENUM; - nobj->curve.normal.type = GLU_INVALID_ENUM; -} - - -void GLAPIENTRY -gluEndCurve(GLUnurbsObj * nobj) -{ - if (nobj->nurbs_type == GLU_NURBS_NONE) { - call_user_error(nobj, GLU_NURBS_ERROR7); - return; - } - if (nobj->curve.geom.type == GLU_INVALID_ENUM) { - call_user_error(nobj, GLU_NURBS_ERROR8); - nobj->nurbs_type = GLU_NURBS_NONE; - return; - } - glPushAttrib((GLbitfield) (GL_EVAL_BIT | GL_ENABLE_BIT)); - glDisable(GL_MAP1_VERTEX_3); - glDisable(GL_MAP1_VERTEX_4); - glDisable(GL_MAP1_INDEX); - glDisable(GL_MAP1_COLOR_4); - glDisable(GL_MAP1_NORMAL); - glDisable(GL_MAP1_TEXTURE_COORD_1); - glDisable(GL_MAP1_TEXTURE_COORD_2); - glDisable(GL_MAP1_TEXTURE_COORD_3); - glDisable(GL_MAP1_TEXTURE_COORD_4); - glDisable(GL_MAP2_VERTEX_3); - glDisable(GL_MAP2_VERTEX_4); - glDisable(GL_MAP2_INDEX); - glDisable(GL_MAP2_COLOR_4); - glDisable(GL_MAP2_NORMAL); - glDisable(GL_MAP2_TEXTURE_COORD_1); - glDisable(GL_MAP2_TEXTURE_COORD_2); - glDisable(GL_MAP2_TEXTURE_COORD_3); - glDisable(GL_MAP2_TEXTURE_COORD_4); - do_nurbs_curve(nobj); - glPopAttrib(); - nobj->nurbs_type = GLU_NURBS_NONE; -} - - -void GLAPIENTRY -gluNurbsCurve(GLUnurbsObj * nobj, GLint nknots, GLfloat * knot, - GLint stride, GLfloat * ctlarray, GLint order, GLenum type) -{ - if (nobj->nurbs_type == GLU_NURBS_TRIM) { -#if 0 -/* TODO: NOT IMPLEMENTED YET */ - nurbs_trim *ptr1; - trim_list *ptr2; - - if (type != GLU_MAP1_TRIM_2 && type != GLU_MAP1_TRIM_3) { - call_user_error(nobj, GLU_NURBS_ERROR14); - return; - } - for (ptr1 = nobj->trim; ptr1->next; ptr1 = ptr1->next); - if (ptr1->trim_loop) { - for (ptr2 = ptr1->trim_loop; ptr2->next; ptr2 = ptr2->next); - if ((ptr2->next = (trim_list *) malloc(sizeof(trim_list))) == NULL) { - call_user_error(nobj, GLU_OUT_OF_MEMORY); - return; - } - ptr2 = ptr2->next; - } - else { - if ((ptr2 = (trim_list *) malloc(sizeof(trim_list))) == NULL) { - call_user_error(nobj, GLU_OUT_OF_MEMORY); - return; - } - ptr1->trim_loop = ptr2; - } - ptr2->trim_type = GLU_TRIM_NURBS; - ptr2->curve.nurbs_curve.knot_count = nknots; - ptr2->curve.nurbs_curve.knot = knot; - ptr2->curve.nurbs_curve.stride = stride; - ptr2->curve.nurbs_curve.ctrlarray = ctlarray; - ptr2->curve.nurbs_curve.order = order; - ptr2->curve.nurbs_curve.dim = (type == GLU_MAP1_TRIM_2 ? 2 : 3); - ptr2->curve.nurbs_curve.type = type; - ptr2->next = NULL; -#endif - } - else { - if (type == GLU_MAP1_TRIM_2 || type == GLU_MAP1_TRIM_3) { - call_user_error(nobj, GLU_NURBS_ERROR22); - return; - } - if (nobj->nurbs_type != GLU_NURBS_CURVE) { - call_user_error(nobj, GLU_NURBS_ERROR10); - return; - } - switch (type) { - case GL_MAP1_VERTEX_3: - case GL_MAP1_VERTEX_4: - if (nobj->curve.geom.type != GLU_INVALID_ENUM) { - call_user_error(nobj, GLU_NURBS_ERROR8); - return; - } - nobj->curve.geom.type = type; - nobj->curve.geom.knot_count = nknots; - nobj->curve.geom.knot = knot; - nobj->curve.geom.stride = stride; - nobj->curve.geom.ctrlarray = ctlarray; - nobj->curve.geom.order = order; - break; - case GL_MAP1_INDEX: - case GL_MAP1_COLOR_4: - nobj->curve.color.type = type; - nobj->curve.color.knot_count = nknots; - nobj->curve.color.knot = knot; - nobj->curve.color.stride = stride; - nobj->curve.color.ctrlarray = ctlarray; - nobj->curve.color.order = order; - break; - case GL_MAP1_NORMAL: - nobj->curve.normal.type = type; - nobj->curve.normal.knot_count = nknots; - nobj->curve.normal.knot = knot; - nobj->curve.normal.stride = stride; - nobj->curve.normal.ctrlarray = ctlarray; - nobj->curve.normal.order = order; - break; - case GL_MAP1_TEXTURE_COORD_1: - case GL_MAP1_TEXTURE_COORD_2: - case GL_MAP1_TEXTURE_COORD_3: - case GL_MAP1_TEXTURE_COORD_4: - nobj->curve.texture.type = type; - nobj->curve.texture.knot_count = nknots; - nobj->curve.texture.knot = knot; - nobj->curve.texture.stride = stride; - nobj->curve.texture.ctrlarray = ctlarray; - nobj->curve.texture.order = order; - break; - default: - call_user_error(nobj, GLU_INVALID_ENUM); - } - } -} - - -void GLAPIENTRY -gluBeginSurface(GLUnurbsObj * nobj) -{ - switch (nobj->nurbs_type) { - case GLU_NURBS_NONE: - nobj->nurbs_type = GLU_NURBS_SURFACE; - nobj->surface.geom.type = GLU_INVALID_ENUM; - nobj->surface.color.type = GLU_INVALID_ENUM; - nobj->surface.texture.type = GLU_INVALID_ENUM; - nobj->surface.normal.type = GLU_INVALID_ENUM; - break; - case GLU_NURBS_TRIM: - call_user_error(nobj, GLU_NURBS_ERROR16); - break; - case GLU_NURBS_SURFACE: - case GLU_NURBS_NO_TRIM: - case GLU_NURBS_TRIM_DONE: - call_user_error(nobj, GLU_NURBS_ERROR27); - break; - case GLU_NURBS_CURVE: - call_user_error(nobj, GLU_NURBS_ERROR6); - break; - } -} - - -void GLAPIENTRY -gluEndSurface(GLUnurbsObj * nobj) -{ - switch (nobj->nurbs_type) { - case GLU_NURBS_NONE: - call_user_error(nobj, GLU_NURBS_ERROR13); - break; - case GLU_NURBS_TRIM: - call_user_error(nobj, GLU_NURBS_ERROR12); - break; - case GLU_NURBS_TRIM_DONE: -/* if(nobj->trim->trim_loop==NULL) - { - call_user_error(nobj,GLU_NURBS_ERROR18); - return; - }*/ - /* no break - fallthrough */ - case GLU_NURBS_NO_TRIM: - glPushAttrib((GLbitfield) - (GL_EVAL_BIT | GL_ENABLE_BIT | GL_POLYGON_BIT)); - glDisable(GL_MAP2_VERTEX_3); - glDisable(GL_MAP2_VERTEX_4); - glDisable(GL_MAP2_INDEX); - glDisable(GL_MAP2_COLOR_4); - glDisable(GL_MAP2_NORMAL); - glDisable(GL_MAP2_TEXTURE_COORD_1); - glDisable(GL_MAP2_TEXTURE_COORD_2); - glDisable(GL_MAP2_TEXTURE_COORD_3); - glDisable(GL_MAP2_TEXTURE_COORD_4); -/* glDisable(GL_MAP1_VERTEX_3); - glDisable(GL_MAP1_VERTEX_4); - glDisable(GL_MAP1_INDEX); - glDisable(GL_MAP1_COLOR_4); - glDisable(GL_MAP1_NORMAL); - glDisable(GL_MAP1_TEXTURE_COORD_1); - glDisable(GL_MAP1_TEXTURE_COORD_2); - glDisable(GL_MAP1_TEXTURE_COORD_3); - glDisable(GL_MAP1_TEXTURE_COORD_4);*/ - do_nurbs_surface(nobj); - glPopAttrib(); - break; - default: - call_user_error(nobj, GLU_NURBS_ERROR8); - } - nobj->nurbs_type = GLU_NURBS_NONE; -} - - -void GLAPIENTRY -gluNurbsSurface(GLUnurbsObj * nobj, - GLint sknot_count, GLfloat * sknot, - GLint tknot_count, GLfloat * tknot, - GLint s_stride, GLint t_stride, - GLfloat * ctrlarray, GLint sorder, GLint torder, GLenum type) -{ - if (nobj->nurbs_type == GLU_NURBS_NO_TRIM - || nobj->nurbs_type == GLU_NURBS_TRIM - || nobj->nurbs_type == GLU_NURBS_TRIM_DONE) { - if (type == GL_MAP2_VERTEX_3 || type == GL_MAP2_VERTEX_4) { - call_user_error(nobj, GLU_NURBS_ERROR8); - return; - } - } - else if (nobj->nurbs_type != GLU_NURBS_SURFACE) { - call_user_error(nobj, GLU_NURBS_ERROR11); - return; - } - switch (type) { - case GL_MAP2_VERTEX_3: - case GL_MAP2_VERTEX_4: - nobj->surface.geom.sknot_count = sknot_count; - nobj->surface.geom.sknot = sknot; - nobj->surface.geom.tknot_count = tknot_count; - nobj->surface.geom.tknot = tknot; - nobj->surface.geom.s_stride = s_stride; - nobj->surface.geom.t_stride = t_stride; - nobj->surface.geom.ctrlarray = ctrlarray; - nobj->surface.geom.sorder = sorder; - nobj->surface.geom.torder = torder; - nobj->surface.geom.type = type; - nobj->nurbs_type = GLU_NURBS_NO_TRIM; - break; - case GL_MAP2_INDEX: - case GL_MAP2_COLOR_4: - nobj->surface.color.sknot_count = sknot_count; - nobj->surface.color.sknot = sknot; - nobj->surface.color.tknot_count = tknot_count; - nobj->surface.color.tknot = tknot; - nobj->surface.color.s_stride = s_stride; - nobj->surface.color.t_stride = t_stride; - nobj->surface.color.ctrlarray = ctrlarray; - nobj->surface.color.sorder = sorder; - nobj->surface.color.torder = torder; - nobj->surface.color.type = type; - break; - case GL_MAP2_NORMAL: - nobj->surface.normal.sknot_count = sknot_count; - nobj->surface.normal.sknot = sknot; - nobj->surface.normal.tknot_count = tknot_count; - nobj->surface.normal.tknot = tknot; - nobj->surface.normal.s_stride = s_stride; - nobj->surface.normal.t_stride = t_stride; - nobj->surface.normal.ctrlarray = ctrlarray; - nobj->surface.normal.sorder = sorder; - nobj->surface.normal.torder = torder; - nobj->surface.normal.type = type; - break; - case GL_MAP2_TEXTURE_COORD_1: - case GL_MAP2_TEXTURE_COORD_2: - case GL_MAP2_TEXTURE_COORD_3: - case GL_MAP2_TEXTURE_COORD_4: - nobj->surface.texture.sknot_count = sknot_count; - nobj->surface.texture.sknot = sknot; - nobj->surface.texture.tknot_count = tknot_count; - nobj->surface.texture.tknot = tknot; - nobj->surface.texture.s_stride = s_stride; - nobj->surface.texture.t_stride = t_stride; - nobj->surface.texture.ctrlarray = ctrlarray; - nobj->surface.texture.sorder = sorder; - nobj->surface.texture.torder = torder; - nobj->surface.texture.type = type; - break; - default: - call_user_error(nobj, GLU_INVALID_ENUM); - } -} - - -void GLAPIENTRY -gluNurbsCallback(GLUnurbsObj * nobj, GLenum which, void (GLCALLBACK * fn) ()) -{ - nobj->error_callback = (void (GLCALLBACKPCAST) (GLenum)) fn; - - if (which != GLU_ERROR) - call_user_error(nobj, GLU_INVALID_ENUM); -} - -void GLAPIENTRY -gluBeginTrim(GLUnurbsObj * nobj) -{ -#if 0 - nurbs_trim *ptr; -#endif - - if (nobj->nurbs_type != GLU_NURBS_TRIM_DONE) - if (nobj->nurbs_type != GLU_NURBS_NO_TRIM) { - call_user_error(nobj, GLU_NURBS_ERROR15); - return; - } - nobj->nurbs_type = GLU_NURBS_TRIM; - fprintf(stderr, "NURBS - trimming not supported yet\n"); -#if 0 - if ((ptr = (nurbs_trim *) malloc(sizeof(nurbs_trim))) == NULL) { - call_user_error(nobj, GLU_OUT_OF_MEMORY); - return; - } - if (nobj->trim) { - nurbs_trim *tmp_ptr; - - for (tmp_ptr = nobj->trim; tmp_ptr->next; tmp_ptr = tmp_ptr->next); - tmp_ptr->next = ptr; - } - else - nobj->trim = ptr; - ptr->trim_loop = NULL; - ptr->segments = NULL; - ptr->next = NULL; -#endif -} - -void GLAPIENTRY -gluPwlCurve(GLUnurbsObj * nobj, GLint count, GLfloat * array, GLint stride, - GLenum type) -{ -#if 0 - nurbs_trim *ptr1; - trim_list *ptr2; -#endif - if (nobj->nurbs_type == GLU_NURBS_CURVE) { - call_user_error(nobj, GLU_NURBS_ERROR9); - return; - } - if (nobj->nurbs_type == GLU_NURBS_NONE) { - call_user_error(nobj, GLU_NURBS_ERROR19); - return; - } - if (type != GLU_MAP1_TRIM_2 && type != GLU_MAP1_TRIM_3) { - call_user_error(nobj, GLU_NURBS_ERROR14); - return; - } -#if 0 - for (ptr1 = nobj->trim; ptr1->next; ptr1 = ptr1->next); - if (ptr1->trim_loop) { - for (ptr2 = ptr1->trim_loop; ptr2->next; ptr2 = ptr2->next); - if ((ptr2->next = (trim_list *) malloc(sizeof(trim_list))) == NULL) { - call_user_error(nobj, GLU_OUT_OF_MEMORY); - return; - } - ptr2 = ptr2->next; - } - else { - if ((ptr2 = (trim_list *) malloc(sizeof(trim_list))) == NULL) { - call_user_error(nobj, GLU_OUT_OF_MEMORY); - return; - } - ptr1->trim_loop = ptr2; - } - ptr2->trim_type = GLU_TRIM_PWL; - ptr2->curve.pwl_curve.pt_count = count; - ptr2->curve.pwl_curve.ctrlarray = array; - ptr2->curve.pwl_curve.stride = stride; - ptr2->curve.pwl_curve.dim = (type == GLU_MAP1_TRIM_2 ? 2 : 3); - ptr2->curve.pwl_curve.type = type; - ptr2->next = NULL; -#endif -} - -void GLAPIENTRY -gluEndTrim(GLUnurbsObj * nobj) -{ - if (nobj->nurbs_type != GLU_NURBS_TRIM) { - call_user_error(nobj, GLU_NURBS_ERROR17); - return; - } - nobj->nurbs_type = GLU_NURBS_TRIM_DONE; -} diff --git a/src/glu/mesa/nurbs.h b/src/glu/mesa/nurbs.h deleted file mode 100644 index 3642e213a8..0000000000 --- a/src/glu/mesa/nurbs.h +++ /dev/null @@ -1,252 +0,0 @@ - -/* - * Mesa 3-D graphics library - * Version: 3.3 - * Copyright (C) 1995-2000 Brian Paul - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the Free - * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - - -/* - * NURBS implementation written by Bogdan Sikorski (bogdan@cira.it) - * See README2 for more info. - */ - - -#ifndef NURBS_H -#define NURBS_H - - -#define EPSILON 1e-06 /* epsilon for double precision compares */ - -typedef enum -{ - GLU_NURBS_CURVE, GLU_NURBS_SURFACE, GLU_NURBS_TRIM, GLU_NURBS_NO_TRIM, - GLU_NURBS_TRIM_DONE, GLU_NURBS_NONE -} -GLU_nurbs_enum; - -typedef enum -{ - GLU_TRIM_NURBS, GLU_TRIM_PWL -} -GLU_trim_enum; - -typedef struct -{ - GLint sknot_count; - GLfloat *sknot; - GLint tknot_count; - GLfloat *tknot; - GLint s_stride; - GLint t_stride; - GLfloat *ctrlarray; - GLint sorder; - GLint torder; - GLint dim; - GLenum type; -} -surface_attribs; - -typedef struct -{ - surface_attribs geom; - surface_attribs color; - surface_attribs texture; - surface_attribs normal; -} -nurbs_surface; - -typedef struct -{ - GLint knot_count; - GLfloat *knot; - GLint stride; - GLfloat *ctrlarray; - GLint order; - GLint dim; - GLenum type; -} -curve_attribs; - -typedef struct -{ - GLint pt_count; - GLfloat *ctrlarray; - GLint stride; - GLint dim; - GLenum type; -} -pwl_curve_attribs; - -typedef struct -{ - curve_attribs geom; - curve_attribs color; - curve_attribs texture; - curve_attribs normal; -} -nurbs_curve; - -typedef struct trim_list_str -{ - GLU_trim_enum trim_type; - union - { - pwl_curve_attribs pwl_curve; - curve_attribs nurbs_curve; - } - curve; - struct trim_list_str *next; -} -trim_list; - -typedef struct seg_trim_str -{ - GLfloat *points; - GLint pt_cnt, seg_array_len; - struct seg_trim_str *next; -} -trim_segments; - -typedef struct nurbs_trim_str -{ - trim_list *trim_loop; - trim_segments *segments; - struct nurbs_trim_str *next; -} -nurbs_trim; - -typedef struct -{ - GLfloat model[16], proj[16], viewport[4]; -} -culling_and_sampling_str; - -struct GLUnurbs -{ - GLboolean culling; - GLenum error; - void (GLCALLBACK * error_callback) (GLenum err); - GLenum display_mode; - GLU_nurbs_enum nurbs_type; - GLboolean auto_load_matrix; - culling_and_sampling_str sampling_matrices; - GLenum sampling_method; - GLfloat sampling_tolerance; - GLfloat parametric_tolerance; - GLint u_step, v_step; - nurbs_surface surface; - nurbs_curve curve; - nurbs_trim *trim; -}; - -typedef struct -{ - GLfloat *knot; - GLint nknots; - GLfloat *unified_knot; - GLint unified_nknots; - GLint order; - GLint t_min, t_max; - GLint delta_nknots; - GLboolean open_at_begin, open_at_end; - GLfloat *new_knot; - GLfloat *alpha; -} -knot_str_type; - -typedef struct -{ - GLfloat *geom_ctrl; - GLint geom_s_stride, geom_t_stride; - GLfloat **geom_offsets; - GLint geom_s_pt_cnt, geom_t_pt_cnt; - GLfloat *color_ctrl; - GLint color_s_stride, color_t_stride; - GLfloat **color_offsets; - GLint color_s_pt_cnt, color_t_pt_cnt; - GLfloat *normal_ctrl; - GLint normal_s_stride, normal_t_stride; - GLfloat **normal_offsets; - GLint normal_s_pt_cnt, normal_t_pt_cnt; - GLfloat *texture_ctrl; - GLint texture_s_stride, texture_t_stride; - GLfloat **texture_offsets; - GLint texture_s_pt_cnt, texture_t_pt_cnt; - GLint s_bezier_cnt, t_bezier_cnt; -} -new_ctrl_type; - -extern void call_user_error(GLUnurbsObj * nobj, GLenum error); - -extern GLenum test_knot(GLint nknots, GLfloat * knot, GLint order); - -extern GLenum explode_knot(knot_str_type * the_knot); - -extern GLenum calc_alphas(knot_str_type * the_knot); - -extern GLenum calc_new_ctrl_pts(GLfloat * ctrl, GLint stride, - knot_str_type * the_knot, GLint dim, - GLfloat ** new_ctrl, GLint * ncontrol); - -extern GLenum glu_do_sampling_crv(GLUnurbsObj * nobj, GLfloat * new_ctrl, - GLint n_ctrl, GLint order, GLint dim, - GLint ** factors); - -extern GLenum glu_do_sampling_3D(GLUnurbsObj * nobj, new_ctrl_type * new_ctrl, - int **sfactors, GLint ** tfactors); - -extern GLenum glu_do_sampling_uv(GLUnurbsObj * nobj, new_ctrl_type * new_ctrl, - int **sfactors, GLint ** tfactors); - -extern GLenum glu_do_sampling_param_3D(GLUnurbsObj * nobj, - new_ctrl_type * new_ctrl, - int **sfactors, GLint ** tfactors); - -extern GLboolean fine_culling_test_2D(GLUnurbsObj * nobj, GLfloat * ctrl, - GLint n_ctrl, GLint stride, GLint dim); - -extern GLboolean fine_culling_test_3D(GLUnurbsObj * nobj, GLfloat * ctrl, - GLint s_n_ctrl, GLint t_n_ctrl, - GLint s_stride, GLint t_stride, - GLint dim); - -extern void do_nurbs_curve(GLUnurbsObj * nobj); - -extern void do_nurbs_surface(GLUnurbsObj * nobj); - -extern GLenum patch_trimming(GLUnurbsObj * nobj, new_ctrl_type * new_ctrl, - GLint * sfactors, GLint * tfactors); - -extern void collect_unified_knot(knot_str_type * dest, knot_str_type * src, - GLfloat maximal_min_knot, - GLfloat minimal_max_knot); - -extern GLenum select_knot_working_range(GLUnurbsObj * nobj, - knot_str_type * geom_knot, - knot_str_type * color_knot, - knot_str_type * normal_knot, - knot_str_type * texture_knot); - -extern void free_unified_knots(knot_str_type * geom_knot, - knot_str_type * color_knot, - knot_str_type * normal_knot, - knot_str_type * texture_knot); - - - -#endif diff --git a/src/glu/mesa/nurbscrv.c b/src/glu/mesa/nurbscrv.c deleted file mode 100644 index 4483e1f776..0000000000 --- a/src/glu/mesa/nurbscrv.c +++ /dev/null @@ -1,444 +0,0 @@ - -/* - * Mesa 3-D graphics library - * Version: 3.3 - * Copyright (C) 1995-2000 Brian Paul - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the Free - * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - - -/* - * NURBS implementation written by Bogdan Sikorski (bogdan@cira.it) - * See README2 for more info. - */ - - -#ifdef PC_HEADER -#include "all.h" -#else -#include -#include -#include "gluP.h" -#include "nurbs.h" -#endif - - -static int -get_curve_dim(GLenum type) -{ - switch (type) { - case GL_MAP1_VERTEX_3: - return 3; - case GL_MAP1_VERTEX_4: - return 4; - case GL_MAP1_INDEX: - return 1; - case GL_MAP1_COLOR_4: - return 4; - case GL_MAP1_NORMAL: - return 3; - case GL_MAP1_TEXTURE_COORD_1: - return 1; - case GL_MAP1_TEXTURE_COORD_2: - return 2; - case GL_MAP1_TEXTURE_COORD_3: - return 3; - case GL_MAP1_TEXTURE_COORD_4: - return 4; - default: - abort(); /* TODO: is this OK? */ - } - return 0; /*never get here */ -} - -static GLenum -test_nurbs_curve(GLUnurbsObj * nobj, curve_attribs * attribs) -{ - GLenum err; - GLint tmp_int; - - if (attribs->order < 0) { - call_user_error(nobj, GLU_INVALID_VALUE); - return GLU_ERROR; - } - glGetIntegerv(GL_MAX_EVAL_ORDER, &tmp_int); - if (attribs->order > tmp_int || attribs->order < 2) { - call_user_error(nobj, GLU_NURBS_ERROR1); - return GLU_ERROR; - } - if (attribs->knot_count < attribs->order + 2) { - call_user_error(nobj, GLU_NURBS_ERROR2); - return GLU_ERROR; - } - if (attribs->stride < 0) { - call_user_error(nobj, GLU_NURBS_ERROR34); - return GLU_ERROR; - } - if (attribs->knot == NULL || attribs->ctrlarray == NULL) { - call_user_error(nobj, GLU_NURBS_ERROR36); - return GLU_ERROR; - } - if ((err = test_knot(attribs->knot_count, attribs->knot, attribs->order)) - != GLU_NO_ERROR) { - call_user_error(nobj, err); - return GLU_ERROR; - } - return GLU_NO_ERROR; -} - -static GLenum -test_nurbs_curves(GLUnurbsObj * nobj) -{ - /* test the geometric data */ - if (test_nurbs_curve(nobj, &(nobj->curve.geom)) != GLU_NO_ERROR) - return GLU_ERROR; - /* now test the attributive data */ - /* color */ - if (nobj->curve.color.type != GLU_INVALID_ENUM) - if (test_nurbs_curve(nobj, &(nobj->curve.color)) != GLU_NO_ERROR) - return GLU_ERROR; - /* normal */ - if (nobj->curve.normal.type != GLU_INVALID_ENUM) - if (test_nurbs_curve(nobj, &(nobj->curve.normal)) != GLU_NO_ERROR) - return GLU_ERROR; - /* texture */ - if (nobj->curve.texture.type != GLU_INVALID_ENUM) - if (test_nurbs_curve(nobj, &(nobj->curve.texture)) != GLU_NO_ERROR) - return GLU_ERROR; - return GLU_NO_ERROR; -} - -/* prepare the knot information structures */ -static GLenum -fill_knot_structures(GLUnurbsObj * nobj, knot_str_type * geom_knot, - knot_str_type * color_knot, knot_str_type * normal_knot, - knot_str_type * texture_knot) -{ - GLint order; - GLfloat *knot; - GLint nknots; - GLint t_min, t_max; - - geom_knot->unified_knot = NULL; - knot = geom_knot->knot = nobj->curve.geom.knot; - nknots = geom_knot->nknots = nobj->curve.geom.knot_count; - order = geom_knot->order = nobj->curve.geom.order; - geom_knot->delta_nknots = 0; - t_min = geom_knot->t_min = order - 1; - t_max = geom_knot->t_max = nknots - order; - if (fabs(knot[t_min] - knot[t_max]) < EPSILON) { - call_user_error(nobj, GLU_NURBS_ERROR3); - return GLU_ERROR; - } - if (fabs(knot[0] - knot[t_min]) < EPSILON) { - /* knot open at beggining */ - geom_knot->open_at_begin = GL_TRUE; - } - else - geom_knot->open_at_begin = GL_FALSE; - if (fabs(knot[t_max] - knot[nknots - 1]) < EPSILON) { - /* knot open at end */ - geom_knot->open_at_end = GL_TRUE; - } - else - geom_knot->open_at_end = GL_FALSE; - if (nobj->curve.color.type != GLU_INVALID_ENUM) { - color_knot->unified_knot = (GLfloat *) 1; - knot = color_knot->knot = nobj->curve.color.knot; - nknots = color_knot->nknots = nobj->curve.color.knot_count; - order = color_knot->order = nobj->curve.color.order; - color_knot->delta_nknots = 0; - t_min = color_knot->t_min = order - 1; - t_max = color_knot->t_max = nknots - order; - if (fabs(knot[t_min] - knot[t_max]) < EPSILON) { - call_user_error(nobj, GLU_NURBS_ERROR3); - return GLU_ERROR; - } - if (fabs(knot[0] - knot[t_min]) < EPSILON) { - /* knot open at beggining */ - color_knot->open_at_begin = GL_TRUE; - } - else - color_knot->open_at_begin = GL_FALSE; - if (fabs(knot[t_max] - knot[nknots - 1]) < EPSILON) { - /* knot open at end */ - color_knot->open_at_end = GL_TRUE; - } - else - color_knot->open_at_end = GL_FALSE; - } - else - color_knot->unified_knot = NULL; - if (nobj->curve.normal.type != GLU_INVALID_ENUM) { - normal_knot->unified_knot = (GLfloat *) 1; - knot = normal_knot->knot = nobj->curve.normal.knot; - nknots = normal_knot->nknots = nobj->curve.normal.knot_count; - order = normal_knot->order = nobj->curve.normal.order; - normal_knot->delta_nknots = 0; - t_min = normal_knot->t_min = order - 1; - t_max = normal_knot->t_max = nknots - order; - if (fabs(knot[t_min] - knot[t_max]) < EPSILON) { - call_user_error(nobj, GLU_NURBS_ERROR3); - return GLU_ERROR; - } - if (fabs(knot[0] - knot[t_min]) < EPSILON) { - /* knot open at beggining */ - normal_knot->open_at_begin = GL_TRUE; - } - else - normal_knot->open_at_begin = GL_FALSE; - if (fabs(knot[t_max] - knot[nknots - 1]) < EPSILON) { - /* knot open at end */ - normal_knot->open_at_end = GL_TRUE; - } - else - normal_knot->open_at_end = GL_FALSE; - } - else - normal_knot->unified_knot = NULL; - if (nobj->curve.texture.type != GLU_INVALID_ENUM) { - texture_knot->unified_knot = (GLfloat *) 1; - knot = texture_knot->knot = nobj->curve.texture.knot; - nknots = texture_knot->nknots = nobj->curve.texture.knot_count; - order = texture_knot->order = nobj->curve.texture.order; - texture_knot->delta_nknots = 0; - t_min = texture_knot->t_min = order - 1; - t_max = texture_knot->t_max = nknots - order; - if (fabs(knot[t_min] - knot[t_max]) < EPSILON) { - call_user_error(nobj, GLU_NURBS_ERROR3); - return GLU_ERROR; - } - if (fabs(knot[0] - knot[t_min]) < EPSILON) { - /* knot open at beggining */ - texture_knot->open_at_begin = GL_TRUE; - } - else - texture_knot->open_at_begin = GL_FALSE; - if (fabs(knot[t_max] - knot[nknots - 1]) < EPSILON) { - /* knot open at end */ - texture_knot->open_at_end = GL_TRUE; - } - else - texture_knot->open_at_end = GL_FALSE; - } - else - texture_knot->unified_knot = NULL; - return GLU_NO_ERROR; -} - -/* covert the NURBS curve into a series of adjacent Bezier curves */ -static GLenum -convert_curve(knot_str_type * the_knot, curve_attribs * attrib, - GLfloat ** new_ctrl, GLint * ncontrol) -{ - GLenum err; - - if ((err = explode_knot(the_knot)) != GLU_NO_ERROR) { - if (the_knot->unified_knot) { - free(the_knot->unified_knot); - the_knot->unified_knot = NULL; - } - return err; - } - if (the_knot->unified_knot) { - free(the_knot->unified_knot); - the_knot->unified_knot = NULL; - } - if ((err = calc_alphas(the_knot)) != GLU_NO_ERROR) { - free(the_knot->new_knot); - return err; - } - free(the_knot->new_knot); - if ((err = calc_new_ctrl_pts(attrib->ctrlarray, attrib->stride, the_knot, - attrib->dim, new_ctrl, ncontrol)) - != GLU_NO_ERROR) { - free(the_knot->alpha); - return err; - } - free(the_knot->alpha); - return GLU_NO_ERROR; -} - -/* covert curves - geometry and possible attribute ones into equivalent */ -/* sequence of adjacent Bezier curves */ -static GLenum -convert_curves(GLUnurbsObj * nobj, GLfloat ** new_geom_ctrl, - GLint * ncontrol, GLfloat ** new_color_ctrl, - GLfloat ** new_normal_ctrl, GLfloat ** new_texture_ctrl) -{ - knot_str_type geom_knot, color_knot, normal_knot, texture_knot; - GLint junk; - GLenum err; - - *new_color_ctrl = *new_normal_ctrl = *new_texture_ctrl = NULL; - - if (fill_knot_structures(nobj, &geom_knot, &color_knot, &normal_knot, - &texture_knot) != GLU_NO_ERROR) - return GLU_ERROR; - - /* unify knots - all knots should have the same number of working */ - /* ranges */ - if ( - (err = - select_knot_working_range(nobj, &geom_knot, &color_knot, &normal_knot, - &texture_knot)) != GLU_NO_ERROR) { - return err; - } - /* convert the geometry curve */ - nobj->curve.geom.dim = get_curve_dim(nobj->curve.geom.type); - if ((err = convert_curve(&geom_knot, &(nobj->curve.geom), new_geom_ctrl, - ncontrol)) != GLU_NO_ERROR) { - free_unified_knots(&geom_knot, &color_knot, &normal_knot, - &texture_knot); - call_user_error(nobj, err); - return err; - } - /* if additional attributive curves are given convert them as well */ - if (color_knot.unified_knot) { - nobj->curve.color.dim = get_curve_dim(nobj->curve.color.type); - if ((err = convert_curve(&color_knot, &(nobj->curve.color), - new_color_ctrl, &junk)) != GLU_NO_ERROR) { - free_unified_knots(&geom_knot, &color_knot, &normal_knot, - &texture_knot); - free(*new_geom_ctrl); - call_user_error(nobj, err); - return err; - } - } - if (normal_knot.unified_knot) { - nobj->curve.normal.dim = get_curve_dim(nobj->curve.normal.type); - if ((err = convert_curve(&normal_knot, &(nobj->curve.normal), - new_normal_ctrl, &junk)) != GLU_NO_ERROR) { - free_unified_knots(&geom_knot, &color_knot, &normal_knot, - &texture_knot); - free(*new_geom_ctrl); - if (*new_color_ctrl) - free(*new_color_ctrl); - call_user_error(nobj, err); - return err; - } - } - if (texture_knot.unified_knot) { - nobj->curve.texture.dim = get_curve_dim(nobj->curve.texture.type); - if ((err = convert_curve(&texture_knot, &(nobj->curve.texture), - new_texture_ctrl, &junk)) != GLU_NO_ERROR) { - free_unified_knots(&geom_knot, &color_knot, &normal_knot, - &texture_knot); - free(*new_geom_ctrl); - if (*new_color_ctrl) - free(*new_color_ctrl); - if (*new_normal_ctrl) - free(*new_normal_ctrl); - call_user_error(nobj, err); - return err; - } - } - return GLU_NO_ERROR; -} - -/* main NURBS curve procedure */ -void -do_nurbs_curve(GLUnurbsObj * nobj) -{ - GLint geom_order, color_order = 0, normal_order = 0, texture_order = 0; - GLenum geom_type; - GLint n_ctrl; - GLfloat *new_geom_ctrl, *new_color_ctrl, *new_normal_ctrl, - *new_texture_ctrl; - GLfloat *geom_ctrl = 0, *color_ctrl = 0, *normal_ctrl = 0, *texture_ctrl = 0; - GLint *factors; - GLint i, j; - GLint geom_dim, color_dim = 0, normal_dim = 0, texture_dim = 0; - - /* test the user supplied data */ - if (test_nurbs_curves(nobj) != GLU_NO_ERROR) - return; - - if (convert_curves(nobj, &new_geom_ctrl, &n_ctrl, &new_color_ctrl, - &new_normal_ctrl, &new_texture_ctrl) != GLU_NO_ERROR) - return; - - geom_order = nobj->curve.geom.order; - geom_type = nobj->curve.geom.type; - geom_dim = nobj->curve.geom.dim; - - if (glu_do_sampling_crv(nobj, new_geom_ctrl, n_ctrl, geom_order, geom_dim, - &factors) != GLU_NO_ERROR) { - free(new_geom_ctrl); - if (new_color_ctrl) - free(new_color_ctrl); - if (new_normal_ctrl) - free(new_normal_ctrl); - if (new_texture_ctrl) - free(new_texture_ctrl); - return; - } - glEnable(geom_type); - if (new_color_ctrl) { - glEnable(nobj->curve.color.type); - color_dim = nobj->curve.color.dim; - color_ctrl = new_color_ctrl; - color_order = nobj->curve.color.order; - } - if (new_normal_ctrl) { - glEnable(nobj->curve.normal.type); - normal_dim = nobj->curve.normal.dim; - normal_ctrl = new_normal_ctrl; - normal_order = nobj->curve.normal.order; - } - if (new_texture_ctrl) { - glEnable(nobj->curve.texture.type); - texture_dim = nobj->curve.texture.dim; - texture_ctrl = new_texture_ctrl; - texture_order = nobj->curve.texture.order; - } - for (i = 0, j = 0, geom_ctrl = new_geom_ctrl; - i < n_ctrl; i += geom_order, j++, geom_ctrl += geom_order * geom_dim) { - if (fine_culling_test_2D - (nobj, geom_ctrl, geom_order, geom_dim, geom_dim)) { - color_ctrl += color_order * color_dim; - normal_ctrl += normal_order * normal_dim; - texture_ctrl += texture_order * texture_dim; - continue; - } - glMap1f(geom_type, 0.0, 1.0, geom_dim, geom_order, geom_ctrl); - if (new_color_ctrl) { - glMap1f(nobj->curve.color.type, 0.0, 1.0, color_dim, - color_order, color_ctrl); - color_ctrl += color_order * color_dim; - } - if (new_normal_ctrl) { - glMap1f(nobj->curve.normal.type, 0.0, 1.0, normal_dim, - normal_order, normal_ctrl); - normal_ctrl += normal_order * normal_dim; - } - if (new_texture_ctrl) { - glMap1f(nobj->curve.texture.type, 0.0, 1.0, texture_dim, - texture_order, texture_ctrl); - texture_ctrl += texture_order * texture_dim; - } - glMapGrid1f(factors[j], 0.0, 1.0); - glEvalMesh1(GL_LINE, 0, factors[j]); - } - free(new_geom_ctrl); - free(factors); - if (new_color_ctrl) - free(new_color_ctrl); - if (new_normal_ctrl) - free(new_normal_ctrl); - if (new_texture_ctrl) - free(new_texture_ctrl); -} diff --git a/src/glu/mesa/nurbssrf.c b/src/glu/mesa/nurbssrf.c deleted file mode 100644 index d39fa47d18..0000000000 --- a/src/glu/mesa/nurbssrf.c +++ /dev/null @@ -1,1317 +0,0 @@ - -/* - * Mesa 3-D graphics library - * Version: 3.3 - * Copyright (C) 1995-2000 Brian Paul - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the Free - * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - - -/* - * NURBS implementation written by Bogdan Sikorski (bogdan@cira.it) - * See README2 for more info. - */ - - -#ifdef PC_HEADER -#include "all.h" -#else -#include -#include -#include -#include "gluP.h" -#include "nurbs.h" -#endif - - -static int -get_surface_dim(GLenum type) -{ - switch (type) { - case GL_MAP2_VERTEX_3: - return 3; - case GL_MAP2_VERTEX_4: - return 4; - case GL_MAP2_INDEX: - return 1; - case GL_MAP2_COLOR_4: - return 4; - case GL_MAP2_NORMAL: - return 3; - case GL_MAP2_TEXTURE_COORD_1: - return 1; - case GL_MAP2_TEXTURE_COORD_2: - return 2; - case GL_MAP2_TEXTURE_COORD_3: - return 3; - case GL_MAP2_TEXTURE_COORD_4: - return 4; - default: - abort(); /* TODO: is this OK? */ - } - return 0; /*never get here */ -} - -static GLenum -test_nurbs_surface(GLUnurbsObj * nobj, surface_attribs * attrib) -{ - GLenum err; - GLint tmp_int; - - if (attrib->sorder < 0 || attrib->torder < 0) { - call_user_error(nobj, GLU_INVALID_VALUE); - return GLU_ERROR; - } - glGetIntegerv(GL_MAX_EVAL_ORDER, &tmp_int); - if (attrib->sorder > tmp_int || attrib->sorder < 2) { - call_user_error(nobj, GLU_NURBS_ERROR1); - return GLU_ERROR; - } - if (attrib->torder > tmp_int || attrib->torder < 2) { - call_user_error(nobj, GLU_NURBS_ERROR1); - return GLU_ERROR; - } - if (attrib->sknot_count < attrib->sorder + 2) { - call_user_error(nobj, GLU_NURBS_ERROR2); - return GLU_ERROR; - } - if (attrib->tknot_count < attrib->torder + 2) { - call_user_error(nobj, GLU_NURBS_ERROR2); - return GLU_ERROR; - } - if (attrib->s_stride < 0 || attrib->t_stride < 0) { - call_user_error(nobj, GLU_NURBS_ERROR34); - return GLU_ERROR; - } - if (attrib->sknot == NULL || attrib->tknot == NULL - || attrib->ctrlarray == NULL) { - call_user_error(nobj, GLU_NURBS_ERROR36); - return GLU_ERROR; - } - if ((err = test_knot(attrib->tknot_count, attrib->tknot, attrib->torder)) - != GLU_NO_ERROR) { - call_user_error(nobj, err); - return GLU_ERROR; - } - if ((err = test_knot(attrib->sknot_count, attrib->sknot, attrib->sorder)) - != GLU_NO_ERROR) { - call_user_error(nobj, err); - return GLU_ERROR; - } - return GLU_NO_ERROR; -} - -static GLenum -test_nurbs_surfaces(GLUnurbsObj * nobj) -{ - /* test the geometric data */ - if (test_nurbs_surface(nobj, &(nobj->surface.geom)) != GLU_NO_ERROR) - return GLU_ERROR; - /* now test the attributive data */ - /* color */ - if (nobj->surface.color.type != GLU_INVALID_ENUM) - if (test_nurbs_surface(nobj, &(nobj->surface.color)) != GLU_NO_ERROR) - return GLU_ERROR; - /* normal */ - if (nobj->surface.normal.type != GLU_INVALID_ENUM) - if (test_nurbs_surface(nobj, &(nobj->surface.normal)) != GLU_NO_ERROR) - return GLU_ERROR; - /* texture */ - if (nobj->surface.texture.type != GLU_INVALID_ENUM) - if (test_nurbs_surface(nobj, &(nobj->surface.texture)) != GLU_NO_ERROR) - return GLU_ERROR; - return GLU_NO_ERROR; -} - -static GLenum -convert_surf(knot_str_type * s_knot, knot_str_type * t_knot, - surface_attribs * attrib, GLfloat ** new_ctrl, - GLint * s_n_ctrl, GLint * t_n_ctrl) -{ - GLfloat **tmp_ctrl; - GLfloat *ctrl_offset; - GLint tmp_n_control; - GLint i, j, t_cnt, s_cnt; - GLint tmp_stride; - GLint dim; - GLenum err; - - /* valid range is empty? */ - if ((s_knot->unified_knot != NULL && s_knot->unified_nknots == 0) || - (t_knot->unified_knot != NULL && t_knot->unified_nknots == 0)) { - if (s_knot->unified_knot) { - free(s_knot->unified_knot); - s_knot->unified_knot = NULL; - } - if (t_knot->unified_knot) { - free(t_knot->unified_knot); - t_knot->unified_knot = NULL; - } - *s_n_ctrl = 0; - *t_n_ctrl = 0; - return GLU_NO_ERROR; - } - t_cnt = attrib->tknot_count - attrib->torder; - s_cnt = attrib->sknot_count - attrib->sorder; - if ((tmp_ctrl = (GLfloat **) malloc(sizeof(GLfloat *) * t_cnt)) == NULL) - return GLU_OUT_OF_MEMORY; - if ((err = explode_knot(s_knot)) != GLU_NO_ERROR) { - free(tmp_ctrl); - if (s_knot->unified_knot) { - free(s_knot->unified_knot); - s_knot->unified_knot = NULL; - } - return err; - } - if (s_knot->unified_knot) { - free(s_knot->unified_knot); - s_knot->unified_knot = NULL; - } - if ((err = calc_alphas(s_knot)) != GLU_NO_ERROR) { - free(tmp_ctrl); - free(s_knot->new_knot); - return err; - } - free(s_knot->new_knot); - ctrl_offset = attrib->ctrlarray; - dim = attrib->dim; - for (i = 0; i < t_cnt; i++) { - if ((err = calc_new_ctrl_pts(ctrl_offset, attrib->s_stride, s_knot, - dim, &(tmp_ctrl[i]), - &tmp_n_control)) != GLU_NO_ERROR) { - for (--i; i <= 0; i--) - free(tmp_ctrl[i]); - free(tmp_ctrl); - free(s_knot->alpha); - return err; - } - ctrl_offset += attrib->t_stride; - } - free(s_knot->alpha); - tmp_stride = dim * tmp_n_control; - if ((*new_ctrl = (GLfloat *) malloc(sizeof(GLfloat) * tmp_stride * t_cnt)) - == NULL) { - for (i = 0; i < t_cnt; i++) - free(tmp_ctrl[i]); - free(tmp_ctrl); - return GLU_OUT_OF_MEMORY; - } - for (i = 0; i < tmp_n_control; i++) - for (j = 0; j < t_cnt; j++) - MEMCPY(*new_ctrl + j * dim + i * dim * t_cnt, tmp_ctrl[j] + dim * i, - sizeof(GLfloat) * dim); - for (i = 0; i < t_cnt; i++) - free(tmp_ctrl[i]); - free(tmp_ctrl); - *s_n_ctrl = tmp_n_control; - - if ((tmp_ctrl = (GLfloat **) malloc(sizeof(GLfloat *) * (*s_n_ctrl))) == - NULL) { - return GLU_OUT_OF_MEMORY; - } - if ((err = explode_knot(t_knot)) != GLU_NO_ERROR) { - free(tmp_ctrl); - if (t_knot->unified_knot) { - free(t_knot->unified_knot); - t_knot->unified_knot = NULL; - } - return err; - } - if (t_knot->unified_knot) { - free(t_knot->unified_knot); - t_knot->unified_knot = NULL; - } - if ((err = calc_alphas(t_knot)) != GLU_NO_ERROR) { - free(tmp_ctrl); - free(t_knot->new_knot); - return err; - } - free(t_knot->new_knot); - ctrl_offset = *new_ctrl; - for (i = 0; i < (*s_n_ctrl); i++) { - if ((err = calc_new_ctrl_pts(ctrl_offset, dim, t_knot, - dim, &(tmp_ctrl[i]), - &tmp_n_control)) != GLU_NO_ERROR) { - for (--i; i <= 0; i--) - free(tmp_ctrl[i]); - free(tmp_ctrl); - free(t_knot->alpha); - return err; - } - ctrl_offset += dim * t_cnt; - } - free(t_knot->alpha); - free(*new_ctrl); - tmp_stride = dim * tmp_n_control; - if ( - (*new_ctrl = - (GLfloat *) malloc(sizeof(GLfloat) * tmp_stride * (*s_n_ctrl))) == - NULL) { - for (i = 0; i < (*s_n_ctrl); i++) - free(tmp_ctrl[i]); - free(tmp_ctrl); - return GLU_OUT_OF_MEMORY; - } - for (i = 0; i < (*s_n_ctrl); i++) { - MEMCPY(*new_ctrl + i * tmp_stride, tmp_ctrl[i], - sizeof(GLfloat) * tmp_stride); - free(tmp_ctrl[i]); - } - free(tmp_ctrl); - *t_n_ctrl = tmp_n_control; - return GLU_NO_ERROR; -} - -/* prepare the knot information structures */ -static GLenum -fill_knot_structures(GLUnurbsObj * nobj, - knot_str_type * geom_s_knot, knot_str_type * geom_t_knot, - knot_str_type * color_s_knot, - knot_str_type * color_t_knot, - knot_str_type * normal_s_knot, - knot_str_type * normal_t_knot, - knot_str_type * texture_s_knot, - knot_str_type * texture_t_knot) -{ - GLint order; - GLfloat *knot; - GLint nknots; - GLint t_min, t_max; - - geom_s_knot->unified_knot = NULL; - knot = geom_s_knot->knot = nobj->surface.geom.sknot; - nknots = geom_s_knot->nknots = nobj->surface.geom.sknot_count; - order = geom_s_knot->order = nobj->surface.geom.sorder; - geom_s_knot->delta_nknots = 0; - t_min = geom_s_knot->t_min = order - 1; - t_max = geom_s_knot->t_max = nknots - order; - if (fabs(knot[t_min] - knot[t_max]) < EPSILON) { - call_user_error(nobj, GLU_NURBS_ERROR3); - return GLU_ERROR; - } - if (fabs(knot[0] - knot[t_min]) < EPSILON) { - /* knot open at beggining */ - geom_s_knot->open_at_begin = GL_TRUE; - } - else - geom_s_knot->open_at_begin = GL_FALSE; - if (fabs(knot[t_max] - knot[nknots - 1]) < EPSILON) { - /* knot open at end */ - geom_s_knot->open_at_end = GL_TRUE; - } - else - geom_s_knot->open_at_end = GL_FALSE; - geom_t_knot->unified_knot = NULL; - knot = geom_t_knot->knot = nobj->surface.geom.tknot; - nknots = geom_t_knot->nknots = nobj->surface.geom.tknot_count; - order = geom_t_knot->order = nobj->surface.geom.torder; - geom_t_knot->delta_nknots = 0; - t_min = geom_t_knot->t_min = order - 1; - t_max = geom_t_knot->t_max = nknots - order; - if (fabs(knot[t_min] - knot[t_max]) < EPSILON) { - call_user_error(nobj, GLU_NURBS_ERROR3); - return GLU_ERROR; - } - if (fabs(knot[0] - knot[t_min]) < EPSILON) { - /* knot open at beggining */ - geom_t_knot->open_at_begin = GL_TRUE; - } - else - geom_t_knot->open_at_begin = GL_FALSE; - if (fabs(knot[t_max] - knot[nknots - 1]) < EPSILON) { - /* knot open at end */ - geom_t_knot->open_at_end = GL_TRUE; - } - else - geom_t_knot->open_at_end = GL_FALSE; - - if (nobj->surface.color.type != GLU_INVALID_ENUM) { - color_s_knot->unified_knot = (GLfloat *) 1; - knot = color_s_knot->knot = nobj->surface.color.sknot; - nknots = color_s_knot->nknots = nobj->surface.color.sknot_count; - order = color_s_knot->order = nobj->surface.color.sorder; - color_s_knot->delta_nknots = 0; - t_min = color_s_knot->t_min = order - 1; - t_max = color_s_knot->t_max = nknots - order; - if (fabs(knot[t_min] - knot[t_max]) < EPSILON) { - call_user_error(nobj, GLU_NURBS_ERROR3); - return GLU_ERROR; - } - if (fabs(knot[0] - knot[t_min]) < EPSILON) { - /* knot open at beggining */ - color_s_knot->open_at_begin = GL_TRUE; - } - else - color_s_knot->open_at_begin = GL_FALSE; - if (fabs(knot[t_max] - knot[nknots - 1]) < EPSILON) { - /* knot open at end */ - color_s_knot->open_at_end = GL_TRUE; - } - else - color_s_knot->open_at_end = GL_FALSE; - color_t_knot->unified_knot = (GLfloat *) 1; - knot = color_t_knot->knot = nobj->surface.color.tknot; - nknots = color_t_knot->nknots = nobj->surface.color.tknot_count; - order = color_t_knot->order = nobj->surface.color.torder; - color_t_knot->delta_nknots = 0; - t_min = color_t_knot->t_min = order - 1; - t_max = color_t_knot->t_max = nknots - order; - if (fabs(knot[t_min] - knot[t_max]) < EPSILON) { - call_user_error(nobj, GLU_NURBS_ERROR3); - return GLU_ERROR; - } - if (fabs(knot[0] - knot[t_min]) < EPSILON) { - /* knot open at beggining */ - color_t_knot->open_at_begin = GL_TRUE; - } - else - color_t_knot->open_at_begin = GL_FALSE; - if (fabs(knot[t_max] - knot[nknots - 1]) < EPSILON) { - /* knot open at end */ - color_t_knot->open_at_end = GL_TRUE; - } - else - color_t_knot->open_at_end = GL_FALSE; - } - else { - color_s_knot->unified_knot = NULL; - color_t_knot->unified_knot = NULL; - } - - if (nobj->surface.normal.type != GLU_INVALID_ENUM) { - normal_s_knot->unified_knot = (GLfloat *) 1; - knot = normal_s_knot->knot = nobj->surface.normal.sknot; - nknots = normal_s_knot->nknots = nobj->surface.normal.sknot_count; - order = normal_s_knot->order = nobj->surface.normal.sorder; - normal_s_knot->delta_nknots = 0; - t_min = normal_s_knot->t_min = order - 1; - t_max = normal_s_knot->t_max = nknots - order; - if (fabs(knot[t_min] - knot[t_max]) < EPSILON) { - call_user_error(nobj, GLU_NURBS_ERROR3); - return GLU_ERROR; - } - if (fabs(knot[0] - knot[t_min]) < EPSILON) { - /* knot open at beggining */ - normal_s_knot->open_at_begin = GL_TRUE; - } - else - normal_s_knot->open_at_begin = GL_FALSE; - if (fabs(knot[t_max] - knot[nknots - 1]) < EPSILON) { - /* knot open at end */ - normal_s_knot->open_at_end = GL_TRUE; - } - else - normal_s_knot->open_at_end = GL_FALSE; - normal_t_knot->unified_knot = (GLfloat *) 1; - knot = normal_t_knot->knot = nobj->surface.normal.tknot; - nknots = normal_t_knot->nknots = nobj->surface.normal.tknot_count; - order = normal_t_knot->order = nobj->surface.normal.torder; - normal_t_knot->delta_nknots = 0; - t_min = normal_t_knot->t_min = order - 1; - t_max = normal_t_knot->t_max = nknots - order; - if (fabs(knot[t_min] - knot[t_max]) < EPSILON) { - call_user_error(nobj, GLU_NURBS_ERROR3); - return GLU_ERROR; - } - if (fabs(knot[0] - knot[t_min]) < EPSILON) { - /* knot open at beggining */ - normal_t_knot->open_at_begin = GL_TRUE; - } - else - normal_t_knot->open_at_begin = GL_FALSE; - if (fabs(knot[t_max] - knot[nknots - 1]) < EPSILON) { - /* knot open at end */ - normal_t_knot->open_at_end = GL_TRUE; - } - else - normal_t_knot->open_at_end = GL_FALSE; - } - else { - normal_s_knot->unified_knot = NULL; - normal_t_knot->unified_knot = NULL; - } - - if (nobj->surface.texture.type != GLU_INVALID_ENUM) { - texture_s_knot->unified_knot = (GLfloat *) 1; - knot = texture_s_knot->knot = nobj->surface.texture.sknot; - nknots = texture_s_knot->nknots = nobj->surface.texture.sknot_count; - order = texture_s_knot->order = nobj->surface.texture.sorder; - texture_s_knot->delta_nknots = 0; - t_min = texture_s_knot->t_min = order - 1; - t_max = texture_s_knot->t_max = nknots - order; - if (fabs(knot[t_min] - knot[t_max]) < EPSILON) { - call_user_error(nobj, GLU_NURBS_ERROR3); - return GLU_ERROR; - } - if (fabs(knot[0] - knot[t_min]) < EPSILON) { - /* knot open at beggining */ - texture_s_knot->open_at_begin = GL_TRUE; - } - else - texture_s_knot->open_at_begin = GL_FALSE; - if (fabs(knot[t_max] - knot[nknots - 1]) < EPSILON) { - /* knot open at end */ - texture_s_knot->open_at_end = GL_TRUE; - } - else - texture_s_knot->open_at_end = GL_FALSE; - texture_t_knot->unified_knot = (GLfloat *) 1; - knot = texture_t_knot->knot = nobj->surface.texture.tknot; - nknots = texture_t_knot->nknots = nobj->surface.texture.tknot_count; - order = texture_t_knot->order = nobj->surface.texture.torder; - texture_t_knot->delta_nknots = 0; - t_min = texture_t_knot->t_min = order - 1; - t_max = texture_t_knot->t_max = nknots - order; - if (fabs(knot[t_min] - knot[t_max]) < EPSILON) { - call_user_error(nobj, GLU_NURBS_ERROR3); - return GLU_ERROR; - } - if (fabs(knot[0] - knot[t_min]) < EPSILON) { - /* knot open at beggining */ - texture_t_knot->open_at_begin = GL_TRUE; - } - else - texture_t_knot->open_at_begin = GL_FALSE; - if (fabs(knot[t_max] - knot[nknots - 1]) < EPSILON) { - /* knot open at end */ - texture_t_knot->open_at_end = GL_TRUE; - } - else - texture_t_knot->open_at_end = GL_FALSE; - } - else { - texture_s_knot->unified_knot = NULL; - texture_t_knot->unified_knot = NULL; - } - return GLU_NO_ERROR; -} - - -static void -free_new_ctrl(new_ctrl_type * p) -{ - if (p->geom_ctrl) - free(p->geom_ctrl); - if (p->geom_offsets) - free(p->geom_offsets); - if (p->color_ctrl) { - free(p->color_ctrl); - if (p->color_offsets) - free(p->color_offsets); - } - if (p->normal_ctrl) { - free(p->normal_ctrl); - if (p->normal_offsets) - free(p->normal_offsets); - } - if (p->texture_ctrl) { - free(p->texture_ctrl); - if (p->texture_offsets) - free(p->texture_offsets); - } -} - -/* convert surfaces - geometry and possible attribute ones into equivalent */ -/* sequence of adjacent Bezier patches */ -static GLenum -convert_surfs(GLUnurbsObj * nobj, new_ctrl_type * new_ctrl) -{ - knot_str_type geom_s_knot, color_s_knot, normal_s_knot, texture_s_knot; - knot_str_type geom_t_knot, color_t_knot, normal_t_knot, texture_t_knot; - GLenum err; - - if ((err = fill_knot_structures(nobj, &geom_s_knot, &geom_t_knot, - &color_s_knot, &color_t_knot, - &normal_s_knot, &normal_t_knot, - &texture_s_knot, - &texture_t_knot)) != GLU_NO_ERROR) { - return err; - } - /* unify knots - all knots should have the same working range */ - if ((err = select_knot_working_range(nobj, &geom_s_knot, &color_s_knot, - &normal_s_knot, - &texture_s_knot)) != GLU_NO_ERROR) { - call_user_error(nobj, err); - return err; - } - if ((err = select_knot_working_range(nobj, &geom_t_knot, &color_t_knot, - &normal_t_knot, - &texture_t_knot)) != GLU_NO_ERROR) { - free_unified_knots(&geom_s_knot, &color_s_knot, &normal_s_knot, - &texture_s_knot); - call_user_error(nobj, err); - return err; - } - - /* convert the geometry surface */ - nobj->surface.geom.dim = get_surface_dim(nobj->surface.geom.type); - if ((err = convert_surf(&geom_s_knot, &geom_t_knot, &(nobj->surface.geom), - &(new_ctrl->geom_ctrl), &(new_ctrl->geom_s_pt_cnt), - &(new_ctrl->geom_t_pt_cnt))) != GLU_NO_ERROR) { - free_unified_knots(&geom_s_knot, &color_s_knot, &normal_s_knot, - &texture_s_knot); - free_unified_knots(&geom_t_knot, &color_t_knot, &normal_t_knot, - &texture_t_knot); - call_user_error(nobj, err); - return err; - } - /* if additional attributive surfaces are given convert them as well */ - if (color_s_knot.unified_knot) { - nobj->surface.color.dim = get_surface_dim(nobj->surface.color.type); - if ( - (err = - convert_surf(&color_s_knot, &color_t_knot, &(nobj->surface.color), - &(new_ctrl->color_ctrl), &(new_ctrl->color_s_pt_cnt), - &(new_ctrl->color_t_pt_cnt))) != GLU_NO_ERROR) { - free_unified_knots(&color_s_knot, &color_s_knot, &normal_s_knot, - &texture_s_knot); - free_unified_knots(&color_t_knot, &color_t_knot, &normal_t_knot, - &texture_t_knot); - free_new_ctrl(new_ctrl); - call_user_error(nobj, err); - return err; - } - } - if (normal_s_knot.unified_knot) { - nobj->surface.normal.dim = get_surface_dim(nobj->surface.normal.type); - if ((err = convert_surf(&normal_s_knot, &normal_t_knot, - &(nobj->surface.normal), - &(new_ctrl->normal_ctrl), - &(new_ctrl->normal_s_pt_cnt), - &(new_ctrl->normal_t_pt_cnt))) != - GLU_NO_ERROR) { - free_unified_knots(&normal_s_knot, &normal_s_knot, &normal_s_knot, - &texture_s_knot); - free_unified_knots(&normal_t_knot, &normal_t_knot, &normal_t_knot, - &texture_t_knot); - free_new_ctrl(new_ctrl); - call_user_error(nobj, err); - return err; - } - } - if (texture_s_knot.unified_knot) { - nobj->surface.texture.dim = get_surface_dim(nobj->surface.texture.type); - if ((err = convert_surf(&texture_s_knot, &texture_t_knot, - &(nobj->surface.texture), - &(new_ctrl->texture_ctrl), - &(new_ctrl->texture_s_pt_cnt), - &(new_ctrl->texture_t_pt_cnt))) != - GLU_NO_ERROR) { - free_unified_knots(&texture_s_knot, &texture_s_knot, &texture_s_knot, - &texture_s_knot); - free_unified_knots(&texture_t_knot, &texture_t_knot, &texture_t_knot, - &texture_t_knot); - free_new_ctrl(new_ctrl); - call_user_error(nobj, err); - return err; - } - } - return GLU_NO_ERROR; -} - -/* tesselate the "boundary" Bezier edge strips */ -static void -tesselate_strip_t_line(GLint top_start, GLint top_end, GLint top_z, - GLint bottom_start, GLint bottom_end, GLint bottom_z, - GLint bottom_domain) -{ - GLint top_cnt, bottom_cnt, tri_cnt, k; - GLint direction; - - top_cnt = top_end - top_start; - direction = (top_cnt >= 0 ? 1 : -1); - bottom_cnt = bottom_end - bottom_start; - glBegin(GL_LINES); - while (top_cnt) { - if (bottom_cnt) - tri_cnt = top_cnt / bottom_cnt; - else - tri_cnt = abs(top_cnt); - for (k = 0; k <= tri_cnt; k++, top_start += direction) { - glEvalCoord2f((GLfloat) bottom_z / bottom_domain, - (GLfloat) bottom_start / bottom_domain); - glEvalPoint2(top_z, top_start); - } - if (bottom_cnt) { - glEvalCoord2f((GLfloat) bottom_z / bottom_domain, - (GLfloat) bottom_start / bottom_domain); - bottom_start += direction; - top_start -= direction; - glEvalCoord2f((GLfloat) bottom_z / bottom_domain, - (GLfloat) bottom_start / bottom_domain); - glEvalCoord2f((GLfloat) bottom_z / bottom_domain, - (GLfloat) bottom_start / bottom_domain); - glEvalPoint2(top_z, top_start); - } - top_cnt -= direction * tri_cnt; - bottom_cnt -= direction; - } - glEnd(); -} - - -static void -tesselate_strip_t_fill(GLint top_start, GLint top_end, GLint top_z, - GLint bottom_start, GLint bottom_end, GLint bottom_z, - GLint bottom_domain) -{ - GLint top_cnt, bottom_cnt, tri_cnt, k; - GLint direction; - - top_cnt = top_end - top_start; - direction = (top_cnt >= 0 ? 1 : -1); - bottom_cnt = bottom_end - bottom_start; - while (top_cnt) { - if (bottom_cnt) - tri_cnt = top_cnt / bottom_cnt; - else - tri_cnt = abs(top_cnt); - glBegin(GL_TRIANGLE_FAN); - glEvalCoord2f((GLfloat) bottom_z / bottom_domain, - (GLfloat) bottom_start / bottom_domain); - for (k = 0; k <= tri_cnt; k++, top_start += direction) - glEvalPoint2(top_z, top_start); - if (bottom_cnt) { - bottom_start += direction; - top_start -= direction; - glEvalCoord2f((GLfloat) bottom_z / bottom_domain, - (GLfloat) bottom_start / bottom_domain); - } - glEnd(); - top_cnt -= direction * tri_cnt; - bottom_cnt -= direction; - } -} - - -static void -tesselate_strip_t(GLenum display_mode, GLint top_start, GLint top_end, - GLint top_z, GLint bottom_start, GLint bottom_end, - GLint bottom_z, GLint bottom_domain) -{ - if (display_mode == GL_FILL) - tesselate_strip_t_fill(top_start, top_end, top_z, bottom_start, - bottom_end, bottom_z, bottom_domain); - else - tesselate_strip_t_line(top_start, top_end, top_z, bottom_start, - bottom_end, bottom_z, bottom_domain); -} - - -static void -tesselate_strip_s_fill(GLint top_start, GLint top_end, GLint top_z, - GLint bottom_start, GLint bottom_end, GLint bottom_z, - GLfloat bottom_domain) -{ - GLint top_cnt, bottom_cnt, tri_cnt, k; - GLint direction; - - top_cnt = top_end - top_start; - direction = (top_cnt >= 0 ? 1 : -1); - bottom_cnt = bottom_end - bottom_start; - while (top_cnt) { - if (bottom_cnt) - tri_cnt = top_cnt / bottom_cnt; - else - tri_cnt = abs(top_cnt); - glBegin(GL_TRIANGLE_FAN); - glEvalCoord2f((GLfloat) bottom_start / bottom_domain, - (GLfloat) bottom_z / bottom_domain); - for (k = 0; k <= tri_cnt; k++, top_start += direction) - glEvalPoint2(top_start, top_z); - if (bottom_cnt) { - bottom_start += direction; - top_start -= direction; - glEvalCoord2f((GLfloat) bottom_start / bottom_domain, - (GLfloat) bottom_z / bottom_domain); - } - glEnd(); - top_cnt -= direction * tri_cnt; - bottom_cnt -= direction; - } -} - - -static void -tesselate_strip_s_line(GLint top_start, GLint top_end, GLint top_z, - GLint bottom_start, GLint bottom_end, GLint bottom_z, - GLfloat bottom_domain) -{ - GLint top_cnt, bottom_cnt, tri_cnt, k; - GLint direction; - - top_cnt = top_end - top_start; - direction = (top_cnt >= 0 ? 1 : -1); - bottom_cnt = bottom_end - bottom_start; - glBegin(GL_LINES); - while (top_cnt) { - if (bottom_cnt) - tri_cnt = top_cnt / bottom_cnt; - else - tri_cnt = abs(top_cnt); - for (k = 0; k <= tri_cnt; k++, top_start += direction) { - glEvalCoord2f((GLfloat) bottom_start / bottom_domain, - (GLfloat) bottom_z / bottom_domain); - glEvalPoint2(top_start, top_z); - } - if (bottom_cnt) { - glEvalCoord2f((GLfloat) bottom_start / bottom_domain, - (GLfloat) bottom_z / bottom_domain); - bottom_start += direction; - top_start -= direction; - glEvalCoord2f((GLfloat) bottom_start / bottom_domain, - (GLfloat) bottom_z / bottom_domain); - glEvalPoint2(top_start, top_z); - glEvalCoord2f((GLfloat) bottom_start / bottom_domain, - (GLfloat) bottom_z / bottom_domain); - } - top_cnt -= direction * tri_cnt; - bottom_cnt -= direction; - } - glEnd(); -} - - -static void -tesselate_strip_s(GLenum display_mode, GLint top_start, GLint top_end, - GLint top_z, GLint bottom_start, GLint bottom_end, - GLint bottom_z, GLfloat bottom_domain) -{ - if (display_mode == GL_FILL) - tesselate_strip_s_fill(top_start, top_end, top_z, bottom_start, - bottom_end, bottom_z, bottom_domain); - else - tesselate_strip_s_line(top_start, top_end, top_z, bottom_start, - bottom_end, bottom_z, bottom_domain); -} - -static void -tesselate_bottom_left_corner(GLenum display_mode, GLfloat s_1, GLfloat t_1) -{ - if (display_mode == GL_FILL) { - glBegin(GL_TRIANGLE_FAN); - glEvalPoint2(1, 1); - glEvalCoord2f(s_1, 0.0); - glEvalCoord2f(0.0, 0.0); - glEvalCoord2f(0.0, t_1); - } - else { - glBegin(GL_LINES); - glEvalCoord2f(0.0, 0.0); - glEvalCoord2f(0.0, t_1); - glEvalCoord2f(0.0, 0.0); - glEvalPoint2(1, 1); - glEvalCoord2f(0.0, 0.0); - glEvalCoord2f(s_1, 0.0); - } - glEnd(); -} - -static void -tesselate_bottom_right_corner(GLenum display_mode, GLint v_top, - GLint v_bottom, GLfloat s_1, GLfloat t_1) -{ - if (display_mode == GL_FILL) { - glBegin(GL_TRIANGLE_FAN); - glEvalPoint2(1, v_top); - glEvalCoord2f(0.0, v_bottom * t_1); - glEvalCoord2f(0.0, (v_bottom + 1) * t_1); - glEvalCoord2f(s_1, (v_bottom + 1) * t_1); - } - else { - glBegin(GL_LINES); - glEvalCoord2f(0.0, (v_bottom + 1) * t_1); - glEvalPoint2(1, v_top); - glEvalCoord2f(0.0, (v_bottom + 1) * t_1); - glEvalCoord2f(0.0, v_bottom * t_1); - glEvalCoord2f(0.0, (v_bottom + 1) * t_1); - glEvalCoord2f(s_1, (v_bottom + 1) * t_1); - } - glEnd(); -} - -static void -tesselate_top_left_corner(GLenum display_mode, GLint u_right, GLint u_left, - GLfloat s_1, GLfloat t_1) -{ - if (display_mode == GL_FILL) { - glBegin(GL_TRIANGLE_FAN); - glEvalPoint2(u_right, 1); - glEvalCoord2f((u_left + 1) * s_1, t_1); - glEvalCoord2f((u_left + 1) * s_1, 0.0); - glEvalCoord2f(u_left * s_1, 0.0); - } - else { - glBegin(GL_LINES); - glEvalCoord2f((u_left + 1) * s_1, 0.0); - glEvalPoint2(u_right, 1); - glEvalCoord2f((u_left + 1) * s_1, 0.0); - glEvalCoord2f(u_left * s_1, 0.0); - glEvalCoord2f((u_left + 1) * s_1, 0.0); - glEvalCoord2f((u_left + 1) * s_1, t_1); - } - glEnd(); -} - -static void -tesselate_top_right_corner(GLenum display_mode, GLint u_left, GLint v_bottom, - GLint u_right, GLint v_top, GLfloat s_1, - GLfloat t_1) -{ - if (display_mode == GL_FILL) { - glBegin(GL_TRIANGLE_FAN); - glEvalPoint2(u_left, v_bottom); - glEvalCoord2f((u_right - 1) * s_1, v_top * t_1); - glEvalCoord2f(u_right * s_1, v_top * t_1); - glEvalCoord2f(u_right * s_1, (v_top - 1) * t_1); - } - else { - glBegin(GL_LINES); - glEvalCoord2f(u_right * s_1, v_top * t_1); - glEvalPoint2(u_left, v_bottom); - glEvalCoord2f(u_right * s_1, v_top * t_1); - glEvalCoord2f(u_right * s_1, (v_top - 1) * t_1); - glEvalCoord2f(u_right * s_1, v_top * t_1); - glEvalCoord2f((u_right - 1) * s_1, v_top * t_1); - } - glEnd(); -} - -/* do mesh mapping of Bezier */ -static void -nurbs_map_bezier(GLenum display_mode, GLint * sfactors, GLint * tfactors, - GLint s_bezier_cnt, GLint t_bezier_cnt, GLint s, GLint t) -{ - GLint top, bottom, right, left; - - - if (s == 0) { - top = *(tfactors + t * 3); - bottom = *(tfactors + t * 3 + 1); - } - else if (s == s_bezier_cnt - 1) { - top = *(tfactors + t * 3 + 2); - bottom = *(tfactors + t * 3); - } - else { - top = bottom = *(tfactors + t * 3); - } - if (t == 0) { - left = *(sfactors + s * 3 + 1); - right = *(sfactors + s * 3); - } - else if (t == t_bezier_cnt - 1) { - left = *(sfactors + s * 3); - right = *(sfactors + s * 3 + 2); - } - else { - left = right = *(sfactors + s * 3); - } - - if (top > bottom) { - if (left < right) { - glMapGrid2f(right, 0.0, 1.0, top, 0.0, 1.0); - glEvalMesh2(display_mode, 1, right, 1, top); - tesselate_strip_s(display_mode, 1, right, 1, 1, left, 0, - (GLfloat) left); - tesselate_bottom_left_corner(display_mode, (GLfloat) (1.0 / left), - (GLfloat) (1.0 / bottom)); -/* tesselate_strip_t(display_mode,1,top,1,1,bottom,0,(GLfloat)bottom);*/ - tesselate_strip_t(display_mode, top, 1, 1, bottom, 1, 0, - (GLfloat) bottom); - } - else if (left == right) { - glMapGrid2f(right, 0.0, 1.0, top, 0.0, 1.0); - glEvalMesh2(display_mode, 1, right, 0, top); -/* tesselate_strip_t(display_mode,0,top,1,0,bottom,0,(GLfloat)bottom);*/ - tesselate_strip_t(display_mode, top, 0, 1, bottom, 0, 0, - (GLfloat) bottom); - } - else { - glMapGrid2f(left, 0.0, 1.0, top, 0.0, 1.0); - glEvalMesh2(display_mode, 1, left, 0, top - 1); -/* tesselate_strip_t(display_mode,0,top-1,1,0,bottom-1,0, - (GLfloat)bottom);*/ - tesselate_strip_t(display_mode, top - 1, 0, 1, bottom - 1, 0, 0, - (GLfloat) bottom); - tesselate_bottom_right_corner(display_mode, top - 1, bottom - 1, - (GLfloat) (1.0 / right), - (GLfloat) (1.0 / bottom)); -/* tesselate_strip_s(display_mode,1,left,top-1,1,right,right, - (GLfloat)right);*/ - tesselate_strip_s(display_mode, left, 1, top - 1, right, 1, right, - (GLfloat) right); - } - } - else if (top == bottom) { - if (left < right) { - glMapGrid2f(right, 0.0, 1.0, top, 0.0, 1.0); - glEvalMesh2(display_mode, 0, right, 1, top); - tesselate_strip_s(display_mode, 0, right, 1, 0, left, 0, - (GLfloat) left); - } - else if (left == right) { - glMapGrid2f(right, 0.0, 1.0, top, 0.0, 1.0); - glEvalMesh2(display_mode, 0, right, 0, top); - } - else { - glMapGrid2f(left, 0.0, 1.0, top, 0.0, 1.0); - glEvalMesh2(display_mode, 0, left, 0, top - 1); -/* tesselate_strip_s(display_mode,0,left,top-1,0,right,right, - (GLfloat)right);*/ - tesselate_strip_s(display_mode, left, 0, top - 1, right, 0, right, - (GLfloat) right); - } - } - else { - if (left < right) { - glMapGrid2f(right, 0.0, 1.0, bottom, 0.0, 1.0); - glEvalMesh2(display_mode, 0, right - 1, 1, bottom); - tesselate_strip_s(display_mode, 0, right - 1, 1, 0, left - 1, 0, - (GLfloat) left); - tesselate_top_left_corner(display_mode, right - 1, left - 1, - (GLfloat) (1.0 / left), - (GLfloat) (1.0 / top)); - tesselate_strip_t(display_mode, 1, bottom, right - 1, 1, top, top, - (GLfloat) top); - } - else if (left == right) { - glMapGrid2f(right, 0.0, 1.0, bottom, 0.0, 1.0); - glEvalMesh2(display_mode, 0, right - 1, 0, bottom); - tesselate_strip_t(display_mode, 0, bottom, right - 1, 0, top, top, - (GLfloat) top); - } - else { - glMapGrid2f(left, 0.0, 1.0, bottom, 0.0, 1.0); - glEvalMesh2(display_mode, 0, left - 1, 0, bottom - 1); - tesselate_strip_t(display_mode, 0, bottom - 1, left - 1, 0, top - 1, - top, (GLfloat) top); - tesselate_top_right_corner(display_mode, left - 1, bottom - 1, right, - top, (GLfloat) (1.0 / right), - (GLfloat) (1.0 / top)); -/* tesselate_strip_s(display_mode,0,left-1,bottom-1,0,right-1,right, - (GLfloat)right);*/ - tesselate_strip_s(display_mode, left - 1, 0, bottom - 1, right - 1, - 0, right, (GLfloat) right); - } - } -} - -/* draw NURBS surface in OUTLINE POLYGON mode */ -static void -draw_polygon_mode(GLenum display_mode, GLUnurbsObj * nobj, - new_ctrl_type * new_ctrl, GLint * sfactors, - GLint * tfactors) -{ - GLsizei offset; - GLint t_bezier_cnt, s_bezier_cnt; - GLboolean do_color, do_normal, do_texture; - GLint i, j; - - t_bezier_cnt = new_ctrl->t_bezier_cnt; - s_bezier_cnt = new_ctrl->s_bezier_cnt; - glEnable(nobj->surface.geom.type); - if (new_ctrl->color_ctrl) { - glEnable(nobj->surface.color.type); - do_color = GL_TRUE; - } - else - do_color = GL_FALSE; - if (new_ctrl->normal_ctrl) { - glEnable(nobj->surface.normal.type); - do_normal = GL_TRUE; - } - else - do_normal = GL_FALSE; - if (new_ctrl->texture_ctrl) { - glEnable(nobj->surface.texture.type); - do_texture = GL_TRUE; - } - else - do_texture = GL_FALSE; - for (j = 0; j < s_bezier_cnt; j++) { - for (i = 0; i < t_bezier_cnt; i++) { - offset = j * t_bezier_cnt + i; - if (fine_culling_test_3D(nobj, *(new_ctrl->geom_offsets + offset), - nobj->surface.geom.sorder, - nobj->surface.geom.torder, - new_ctrl->geom_s_stride, - new_ctrl->geom_t_stride, - nobj->surface.geom.dim)) continue; - glMap2f(nobj->surface.geom.type, 0.0, 1.0, new_ctrl->geom_s_stride, - nobj->surface.geom.sorder, 0.0, 1.0, new_ctrl->geom_t_stride, - nobj->surface.geom.torder, - *(new_ctrl->geom_offsets + offset)); - if (do_color) { - glMap2f(nobj->surface.color.type, 0.0, 1.0, - new_ctrl->color_s_stride, nobj->surface.color.sorder, - 0.0, 1.0, new_ctrl->color_t_stride, - nobj->surface.color.torder, - *(new_ctrl->color_offsets + offset)); - } - if (do_normal) { - glMap2f(nobj->surface.normal.type, 0.0, 1.0, - new_ctrl->normal_s_stride, nobj->surface.normal.sorder, - 0.0, 1.0, new_ctrl->normal_t_stride, - nobj->surface.normal.torder, - *(new_ctrl->normal_offsets + offset)); - } - if (do_texture) { - glMap2f(nobj->surface.texture.type, 0.0, 1.0, - new_ctrl->texture_s_stride, nobj->surface.texture.sorder, - 0.0, 1.0, new_ctrl->texture_t_stride, - nobj->surface.texture.torder, - *(new_ctrl->texture_offsets + offset)); - } -/* glMapGrid2f(sfactors[j*3+0],0.0,1.0,tfactors[i*3+0],0.0,1.0); - glEvalMesh2(display_mode,0,sfactors[j*3+0],0,tfactors[i*3+0]);*/ - nurbs_map_bezier(display_mode, sfactors, tfactors, s_bezier_cnt, - t_bezier_cnt, j, i); - } - } -} - - - -/* draw NURBS surface in OUTLINE POLYGON mode */ -#if 0 -static void -draw_patch_mode(GLenum display_mode, GLUnurbsObj * nobj, - new_ctrl_type * new_ctrl, GLint * sfactors, GLint * tfactors) -{ - GLsizei offset; - GLint t_bezier_cnt, s_bezier_cnt; - GLboolean do_color, do_normal, do_texture; - GLint i, j; - - t_bezier_cnt = new_ctrl->t_bezier_cnt; - s_bezier_cnt = new_ctrl->s_bezier_cnt; - glEnable(nobj->surface.geom.type); - if (new_ctrl->color_ctrl) { - glEnable(nobj->surface.color.type); - do_color = GL_TRUE; - } - else - do_color = GL_FALSE; - if (new_ctrl->normal_ctrl) { - glEnable(nobj->surface.normal.type); - do_normal = GL_TRUE; - } - else - do_normal = GL_FALSE; - if (new_ctrl->texture_ctrl) { - glEnable(nobj->surface.texture.type); - do_texture = GL_TRUE; - } - else - do_texture = GL_FALSE; - for (j = 0; j < s_bezier_cnt; j++) { - for (i = 0; i < t_bezier_cnt; i++) { - offset = j * t_bezier_cnt + i; - if (fine_culling_test_3D(nobj, *(new_ctrl->geom_offsets + offset), - nobj->surface.geom.sorder, - nobj->surface.geom.torder, - new_ctrl->geom_s_stride, - new_ctrl->geom_t_stride, - nobj->surface.geom.dim)) continue; - glMap2f(nobj->surface.geom.type, 0.0, 1.0, new_ctrl->geom_s_stride, - nobj->surface.geom.sorder, 0.0, 1.0, new_ctrl->geom_t_stride, - nobj->surface.geom.torder, - *(new_ctrl->geom_offsets + offset)); - if (do_color) { - glMap2f(nobj->surface.color.type, 0.0, 1.0, - new_ctrl->color_s_stride, nobj->surface.color.sorder, - 0.0, 1.0, new_ctrl->color_t_stride, - nobj->surface.color.torder, - *(new_ctrl->color_offsets + offset)); - } - if (do_normal) { - glMap2f(nobj->surface.normal.type, 0.0, 1.0, - new_ctrl->normal_s_stride, nobj->surface.normal.sorder, - 0.0, 1.0, new_ctrl->normal_t_stride, - nobj->surface.normal.torder, - *(new_ctrl->normal_offsets + offset)); - } - if (do_texture) { - glMap2f(nobj->surface.texture.type, 0.0, 1.0, - new_ctrl->texture_s_stride, nobj->surface.texture.sorder, - 0.0, 1.0, new_ctrl->texture_t_stride, - nobj->surface.texture.torder, - *(new_ctrl->texture_offsets + offset)); - } - nurbs_map_bezier(display_mode, sfactors, tfactors, s_bezier_cnt, - t_bezier_cnt, i, j); -/* glMapGrid2f(sfactors[j],0.0,1.0,tfactors[i],0.0,1.0); - glEvalMesh2(display_mode,0,sfactors[j],0,tfactors[i]);*/ - } - } -} -#endif - - - -static void -init_new_ctrl(new_ctrl_type * p) -{ - p->geom_ctrl = p->color_ctrl = p->normal_ctrl = p->texture_ctrl = NULL; - p->geom_offsets = p->color_offsets = p->normal_offsets = - p->texture_offsets = NULL; - p->s_bezier_cnt = p->t_bezier_cnt = 0; -} - - -static GLenum -augment_new_ctrl(GLUnurbsObj * nobj, new_ctrl_type * p) -{ - GLsizei offset_size; - GLint i, j; - - p->s_bezier_cnt = (p->geom_s_pt_cnt) / (nobj->surface.geom.sorder); - p->t_bezier_cnt = (p->geom_t_pt_cnt) / (nobj->surface.geom.torder); - offset_size = (p->s_bezier_cnt) * (p->t_bezier_cnt); - p->geom_t_stride = nobj->surface.geom.dim; - p->geom_s_stride = (p->geom_t_pt_cnt) * (nobj->surface.geom.dim); - p->color_t_stride = nobj->surface.color.dim; - p->color_s_stride = (p->color_t_pt_cnt) * (nobj->surface.color.dim); - p->normal_t_stride = nobj->surface.normal.dim; - p->normal_s_stride = (p->normal_t_pt_cnt) * (nobj->surface.normal.dim); - p->texture_t_stride = nobj->surface.texture.dim; - p->texture_s_stride = (p->texture_t_pt_cnt) * (nobj->surface.texture.dim); - if ( - (p->geom_offsets = - (GLfloat **) malloc(sizeof(GLfloat *) * offset_size)) == NULL) { - call_user_error(nobj, GLU_OUT_OF_MEMORY); - return GLU_ERROR; - } - if (p->color_ctrl) - if ( - (p->color_offsets = - (GLfloat **) malloc(sizeof(GLfloat *) * offset_size)) == NULL) { - free_new_ctrl(p); - call_user_error(nobj, GLU_OUT_OF_MEMORY); - return GLU_ERROR; - } - if (p->normal_ctrl) - if ( - (p->normal_offsets = - (GLfloat **) malloc(sizeof(GLfloat *) * offset_size)) == NULL) { - free_new_ctrl(p); - call_user_error(nobj, GLU_OUT_OF_MEMORY); - return GLU_ERROR; - } - if (p->texture_ctrl) - if ( - (p->texture_offsets = - (GLfloat **) malloc(sizeof(GLfloat *) * offset_size)) == NULL) { - free_new_ctrl(p); - call_user_error(nobj, GLU_OUT_OF_MEMORY); - return GLU_ERROR; - } - for (i = 0; i < p->s_bezier_cnt; i++) - for (j = 0; j < p->t_bezier_cnt; j++) - *(p->geom_offsets + i * (p->t_bezier_cnt) + j) = - p->geom_ctrl + i * (nobj->surface.geom.sorder) * - (nobj->surface.geom.dim) * (p->geom_t_pt_cnt) + - j * (nobj->surface.geom.dim) * (nobj->surface.geom.torder); - if (p->color_ctrl) - for (i = 0; i < p->s_bezier_cnt; i++) - for (j = 0; j < p->t_bezier_cnt; j++) - *(p->color_offsets + i * (p->t_bezier_cnt) + j) = - p->color_ctrl + i * (nobj->surface.color.sorder) * - (nobj->surface.color.dim) * (p->color_t_pt_cnt) + - j * (nobj->surface.color.dim) * (nobj->surface.color.torder); - if (p->normal_ctrl) - for (i = 0; i < p->s_bezier_cnt; i++) - for (j = 0; j < p->t_bezier_cnt; j++) - *(p->normal_offsets + i * (p->t_bezier_cnt) + j) = - p->normal_ctrl + i * (nobj->surface.normal.sorder) * - (nobj->surface.normal.dim) * (p->normal_t_pt_cnt) + - j * (nobj->surface.normal.dim) * (nobj->surface.normal.torder); - if (p->texture_ctrl) - for (i = 0; i < p->s_bezier_cnt; i++) - for (j = 0; j < p->t_bezier_cnt; j++) - *(p->texture_offsets + i * (p->t_bezier_cnt) + j) = - p->texture_ctrl + i * (nobj->surface.texture.sorder) * - (nobj->surface.texture.dim) * (p->texture_t_pt_cnt) + - j * (nobj->surface.texture.dim) * - (nobj->surface.texture.torder); - return GLU_NO_ERROR; -} - -/* main NURBS surface procedure */ -void -do_nurbs_surface(GLUnurbsObj * nobj) -{ - GLint *sfactors, *tfactors; - new_ctrl_type new_ctrl; - - /* test user supplied data */ - if (test_nurbs_surfaces(nobj) != GLU_NO_ERROR) - return; - - init_new_ctrl(&new_ctrl); - - if (convert_surfs(nobj, &new_ctrl) != GLU_NO_ERROR) - return; - if (augment_new_ctrl(nobj, &new_ctrl) != GLU_NO_ERROR) - return; - switch (nobj->sampling_method) { - case GLU_PATH_LENGTH: - if (glu_do_sampling_3D(nobj, &new_ctrl, &sfactors, &tfactors) != - GLU_NO_ERROR) { - free_new_ctrl(&new_ctrl); - return; - } - break; - case GLU_DOMAIN_DISTANCE: - if (glu_do_sampling_uv(nobj, &new_ctrl, &sfactors, &tfactors) != - GLU_NO_ERROR) { - free_new_ctrl(&new_ctrl); - return; - } - break; - case GLU_PARAMETRIC_ERROR: - if (glu_do_sampling_param_3D(nobj, &new_ctrl, &sfactors, &tfactors) != - GLU_NO_ERROR) { - free_new_ctrl(&new_ctrl); - return; - } - break; - default: - abort(); - } - glFrontFace(GL_CW); - switch (nobj->display_mode) { - case GLU_FILL: -/* if(polygon_trimming(nobj,&new_ctrl,sfactors,tfactors)==GLU_NO_ERROR)*/ - draw_polygon_mode(GL_FILL, nobj, &new_ctrl, sfactors, tfactors); - break; - case GLU_OUTLINE_POLYGON: - /* TODO - missing trimming handeling */ -/* just for now - no OUTLINE_PATCH mode - draw_patch_mode(GL_LINE,nobj,&new_ctrl,sfactors,tfactors); - break; */ - case GLU_OUTLINE_PATCH: -/* if(polygon_trimming(nobj,&new_ctrl,sfactors,tfactors)==GLU_NO_ERROR)*/ - draw_polygon_mode(GL_LINE, nobj, &new_ctrl, sfactors, tfactors); - break; - default: - abort(); /* TODO: is this OK? */ - } - free(sfactors); - free(tfactors); - free_new_ctrl(&new_ctrl); -} diff --git a/src/glu/mesa/nurbsutl.c b/src/glu/mesa/nurbsutl.c deleted file mode 100644 index b46348a50b..0000000000 --- a/src/glu/mesa/nurbsutl.c +++ /dev/null @@ -1,1309 +0,0 @@ - -/* - * Mesa 3-D graphics library - * Version: 3.3 - * Copyright (C) 1995-2000 Brian Paul - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the Free - * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - - -/* - * NURBS implementation written by Bogdan Sikorski (bogdan@cira.it) - * See README2 for more info. - */ - - -#ifdef PC_HEADER -#include "all.h" -#else -#include -#include -#include "gluP.h" -#include "nurbs.h" -#endif - - -GLenum test_knot(GLint nknots, GLfloat * knot, GLint order) -{ - GLsizei i; - GLint knot_mult; - GLfloat tmp_knot; - - tmp_knot = knot[0]; - knot_mult = 1; - for (i = 1; i < nknots; i++) { - if (knot[i] < tmp_knot) - return GLU_NURBS_ERROR4; - if (fabs(tmp_knot - knot[i]) > EPSILON) { - if (knot_mult > order) - return GLU_NURBS_ERROR5; - knot_mult = 1; - tmp_knot = knot[i]; - } - else - ++knot_mult; - } - return GLU_NO_ERROR; -} - -static int -/* qsort function */ -#if defined(WIN32) && !defined(OPENSTEP) - __cdecl -#endif -knot_sort(const void *a, const void *b) -{ - GLfloat x, y; - - x = *((GLfloat *) a); - y = *((GLfloat *) b); - if (fabs(x - y) < EPSILON) - return 0; - if (x > y) - return 1; - return -1; -} - -/* insert into dest knot all values within the valid range from src knot */ -/* that do not appear in dest */ -void -collect_unified_knot(knot_str_type * dest, knot_str_type * src, - GLfloat maximal_min_knot, GLfloat minimal_max_knot) -{ - GLfloat *src_knot, *dest_knot; - GLint src_t_min, src_t_max, dest_t_min, dest_t_max; - GLint src_nknots, dest_nknots; - GLint i, j, k, new_cnt; - GLboolean not_found_flag; - - src_knot = src->unified_knot; - dest_knot = dest->unified_knot; - src_t_min = src->t_min; - src_t_max = src->t_max; - dest_t_min = dest->t_min; - dest_t_max = dest->t_max; - src_nknots = src->unified_nknots; - dest_nknots = dest->unified_nknots; - - k = new_cnt = dest_nknots; - for (i = src_t_min; i <= src_t_max; i++) - if (src_knot[i] - maximal_min_knot > -EPSILON && - src_knot[i] - minimal_max_knot < EPSILON) { - not_found_flag = GL_TRUE; - for (j = dest_t_min; j <= dest_t_max; j++) - if (fabs(dest_knot[j] - src_knot[i]) < EPSILON) { - not_found_flag = GL_FALSE; - break; - } - if (not_found_flag) { - /* knot from src is not in dest - add this knot to dest */ - dest_knot[k++] = src_knot[i]; - ++new_cnt; - ++(dest->t_max); /* the valid range widens */ - ++(dest->delta_nknots); /* increment the extra knot value counter */ - } - } - dest->unified_nknots = new_cnt; - qsort((void *) dest_knot, (size_t) new_cnt, (size_t) sizeof(GLfloat), - &knot_sort); -} - -/* basing on the new common knot range for all attributes set */ -/* t_min and t_max values for each knot - they will be used later on */ -/* by explode_knot() and calc_new_ctrl_pts */ -static void -set_new_t_min_t_max(knot_str_type * geom_knot, knot_str_type * color_knot, - knot_str_type * normal_knot, knot_str_type * texture_knot, - GLfloat maximal_min_knot, GLfloat minimal_max_knot) -{ - GLuint t_min = 0, t_max = 0, cnt = 0; - - if (minimal_max_knot - maximal_min_knot < EPSILON) { - /* knot common range empty */ - geom_knot->t_min = geom_knot->t_max = 0; - color_knot->t_min = color_knot->t_max = 0; - normal_knot->t_min = normal_knot->t_max = 0; - texture_knot->t_min = texture_knot->t_max = 0; - } - else { - if (geom_knot->unified_knot != NULL) { - cnt = geom_knot->unified_nknots; - for (t_min = 0; t_min < cnt; t_min++) - if (fabs((geom_knot->unified_knot)[t_min] - maximal_min_knot) < - EPSILON) break; - for (t_max = cnt - 1; t_max; t_max--) - if (fabs((geom_knot->unified_knot)[t_max] - minimal_max_knot) < - EPSILON) break; - } - else if (geom_knot->nknots) { - cnt = geom_knot->nknots; - for (t_min = 0; t_min < cnt; t_min++) - if (fabs((geom_knot->knot)[t_min] - maximal_min_knot) < EPSILON) - break; - for (t_max = cnt - 1; t_max; t_max--) - if (fabs((geom_knot->knot)[t_max] - minimal_max_knot) < EPSILON) - break; - } - geom_knot->t_min = t_min; - geom_knot->t_max = t_max; - if (color_knot->unified_knot != NULL) { - cnt = color_knot->unified_nknots; - for (t_min = 0; t_min < cnt; t_min++) - if (fabs((color_knot->unified_knot)[t_min] - maximal_min_knot) < - EPSILON) break; - for (t_max = cnt - 1; t_max; t_max--) - if (fabs((color_knot->unified_knot)[t_max] - minimal_max_knot) < - EPSILON) break; - color_knot->t_min = t_min; - color_knot->t_max = t_max; - } - if (normal_knot->unified_knot != NULL) { - cnt = normal_knot->unified_nknots; - for (t_min = 0; t_min < cnt; t_min++) - if (fabs((normal_knot->unified_knot)[t_min] - maximal_min_knot) < - EPSILON) break; - for (t_max = cnt - 1; t_max; t_max--) - if (fabs((normal_knot->unified_knot)[t_max] - minimal_max_knot) < - EPSILON) break; - normal_knot->t_min = t_min; - normal_knot->t_max = t_max; - } - if (texture_knot->unified_knot != NULL) { - cnt = texture_knot->unified_nknots; - for (t_min = 0; t_min < cnt; t_min++) - if (fabs((texture_knot->unified_knot)[t_min] - maximal_min_knot) - < EPSILON) - break; - for (t_max = cnt - 1; t_max; t_max--) - if (fabs((texture_knot->unified_knot)[t_max] - minimal_max_knot) - < EPSILON) - break; - texture_knot->t_min = t_min; - texture_knot->t_max = t_max; - } - } -} - -/* modify all knot valid ranges in such a way that all have the same */ -/* range, common to all knots */ -/* do this by knot insertion */ -GLenum -select_knot_working_range(GLUnurbsObj * nobj, knot_str_type * geom_knot, - knot_str_type * color_knot, - knot_str_type * normal_knot, - knot_str_type * texture_knot) -{ - GLint max_nknots; - GLfloat maximal_min_knot, minimal_max_knot; - GLint i; - - /* find the maximum modified knot length */ - max_nknots = geom_knot->nknots; - if (color_knot->unified_knot) - max_nknots += color_knot->nknots; - if (normal_knot->unified_knot) - max_nknots += normal_knot->nknots; - if (texture_knot->unified_knot) - max_nknots += texture_knot->nknots; - maximal_min_knot = (geom_knot->knot)[geom_knot->t_min]; - minimal_max_knot = (geom_knot->knot)[geom_knot->t_max]; - /* any attirb data ? */ - if (max_nknots != geom_knot->nknots) { - /* allocate space for the unified knots */ - if ((geom_knot->unified_knot = - (GLfloat *) malloc(sizeof(GLfloat) * max_nknots)) == NULL) { - call_user_error(nobj, GLU_OUT_OF_MEMORY); - return GLU_ERROR; - } - /* copy the original knot to the unified one */ - geom_knot->unified_nknots = geom_knot->nknots; - for (i = 0; i < geom_knot->nknots; i++) - (geom_knot->unified_knot)[i] = (geom_knot->knot)[i]; - if (color_knot->unified_knot) { - if ((color_knot->knot)[color_knot->t_min] - maximal_min_knot > - EPSILON) - maximal_min_knot = (color_knot->knot)[color_knot->t_min]; - if (minimal_max_knot - (color_knot->knot)[color_knot->t_max] > - EPSILON) - minimal_max_knot = (color_knot->knot)[color_knot->t_max]; - if ((color_knot->unified_knot = - (GLfloat *) malloc(sizeof(GLfloat) * max_nknots)) == NULL) { - free(geom_knot->unified_knot); - call_user_error(nobj, GLU_OUT_OF_MEMORY); - return GLU_ERROR; - } - /* copy the original knot to the unified one */ - color_knot->unified_nknots = color_knot->nknots; - for (i = 0; i < color_knot->nknots; i++) - (color_knot->unified_knot)[i] = (color_knot->knot)[i]; - } - if (normal_knot->unified_knot) { - if ((normal_knot->knot)[normal_knot->t_min] - maximal_min_knot > - EPSILON) - maximal_min_knot = (normal_knot->knot)[normal_knot->t_min]; - if (minimal_max_knot - (normal_knot->knot)[normal_knot->t_max] > - EPSILON) - minimal_max_knot = (normal_knot->knot)[normal_knot->t_max]; - if ((normal_knot->unified_knot = - (GLfloat *) malloc(sizeof(GLfloat) * max_nknots)) == NULL) { - free(geom_knot->unified_knot); - free(color_knot->unified_knot); - call_user_error(nobj, GLU_OUT_OF_MEMORY); - return GLU_ERROR; - } - /* copy the original knot to the unified one */ - normal_knot->unified_nknots = normal_knot->nknots; - for (i = 0; i < normal_knot->nknots; i++) - (normal_knot->unified_knot)[i] = (normal_knot->knot)[i]; - } - if (texture_knot->unified_knot) { - if ((texture_knot->knot)[texture_knot->t_min] - maximal_min_knot > - EPSILON) - maximal_min_knot = (texture_knot->knot)[texture_knot->t_min]; - if (minimal_max_knot - (texture_knot->knot)[texture_knot->t_max] > - EPSILON) - minimal_max_knot = (texture_knot->knot)[texture_knot->t_max]; - if ((texture_knot->unified_knot = - (GLfloat *) malloc(sizeof(GLfloat) * max_nknots)) == NULL) { - free(geom_knot->unified_knot); - free(color_knot->unified_knot); - free(normal_knot->unified_knot); - call_user_error(nobj, GLU_OUT_OF_MEMORY); - return GLU_ERROR; - } - /* copy the original knot to the unified one */ - texture_knot->unified_nknots = texture_knot->nknots; - for (i = 0; i < texture_knot->nknots; i++) - (texture_knot->unified_knot)[i] = (texture_knot->knot)[i]; - } - /* work on the geometry knot with all additional knot values */ - /* appearing in attirbutive knots */ - if (minimal_max_knot - maximal_min_knot < EPSILON) { - /* empty working range */ - geom_knot->unified_nknots = 0; - color_knot->unified_nknots = 0; - normal_knot->unified_nknots = 0; - texture_knot->unified_nknots = 0; - } - else { - if (color_knot->unified_knot) - collect_unified_knot(geom_knot, color_knot, maximal_min_knot, - minimal_max_knot); - if (normal_knot->unified_knot) - collect_unified_knot(geom_knot, normal_knot, maximal_min_knot, - minimal_max_knot); - if (texture_knot->unified_knot) - collect_unified_knot(geom_knot, texture_knot, maximal_min_knot, - minimal_max_knot); - /* since we have now built the "unified" geometry knot */ - /* add same knot values to all attributive knots */ - if (color_knot->unified_knot) - collect_unified_knot(color_knot, geom_knot, maximal_min_knot, - minimal_max_knot); - if (normal_knot->unified_knot) - collect_unified_knot(normal_knot, geom_knot, maximal_min_knot, - minimal_max_knot); - if (texture_knot->unified_knot) - collect_unified_knot(texture_knot, geom_knot, maximal_min_knot, - minimal_max_knot); - } - } - set_new_t_min_t_max(geom_knot, color_knot, normal_knot, texture_knot, - maximal_min_knot, minimal_max_knot); - return GLU_NO_ERROR; -} - -void -free_unified_knots(knot_str_type * geom_knot, knot_str_type * color_knot, - knot_str_type * normal_knot, knot_str_type * texture_knot) -{ - if (geom_knot->unified_knot) - free(geom_knot->unified_knot); - if (color_knot->unified_knot) - free(color_knot->unified_knot); - if (normal_knot->unified_knot) - free(normal_knot->unified_knot); - if (texture_knot->unified_knot) - free(texture_knot->unified_knot); -} - -GLenum explode_knot(knot_str_type * the_knot) -{ - GLfloat *knot, *new_knot; - GLint nknots, n_new_knots = 0; - GLint t_min, t_max; - GLint ord; - GLsizei i, j, k; - GLfloat tmp_float; - - if (the_knot->unified_knot) { - knot = the_knot->unified_knot; - nknots = the_knot->unified_nknots; - } - else { - knot = the_knot->knot; - nknots = the_knot->nknots; - } - ord = the_knot->order; - t_min = the_knot->t_min; - t_max = the_knot->t_max; - - for (i = t_min; i <= t_max;) { - tmp_float = knot[i]; - for (j = 0; j < ord && (i + j) <= t_max; j++) - if (fabs(tmp_float - knot[i + j]) > EPSILON) - break; - n_new_knots += ord - j; - i += j; - } - /* alloc space for new_knot */ - if ( - (new_knot = - (GLfloat *) malloc(sizeof(GLfloat) * (nknots + n_new_knots + 1))) == NULL) { - return GLU_OUT_OF_MEMORY; - } - /* fill in new knot */ - for (j = 0; j < t_min; j++) - new_knot[j] = knot[j]; - for (i = j; i <= t_max; i++) { - tmp_float = knot[i]; - for (k = 0; k < ord; k++) { - new_knot[j++] = knot[i]; - if (tmp_float == knot[i + 1]) - i++; - } - } - for (i = t_max + 1; i < (int) nknots; i++) - new_knot[j++] = knot[i]; - /* fill in the knot structure */ - the_knot->new_knot = new_knot; - the_knot->delta_nknots += n_new_knots; - the_knot->t_max += n_new_knots; - return GLU_NO_ERROR; -} - -GLenum calc_alphas(knot_str_type * the_knot) -{ - GLfloat tmp_float; - int i, j, k, m, n; - int order; - GLfloat *alpha, *alpha_new, *tmp_alpha; - GLfloat denom; - GLfloat *knot, *new_knot; - - - knot = the_knot->knot; - order = the_knot->order; - new_knot = the_knot->new_knot; - n = the_knot->nknots - the_knot->order; - m = n + the_knot->delta_nknots; - if ((alpha = (GLfloat *) malloc(sizeof(GLfloat) * n * m)) == NULL) { - return GLU_OUT_OF_MEMORY; - } - if ((alpha_new = (GLfloat *) malloc(sizeof(GLfloat) * n * m)) == NULL) { - free(alpha); - return GLU_OUT_OF_MEMORY; - } - for (j = 0; j < m; j++) { - for (i = 0; i < n; i++) { - if ((knot[i] <= new_knot[j]) && (new_knot[j] < knot[i + 1])) - tmp_float = 1.0; - else - tmp_float = 0.0; - alpha[i + j * n] = tmp_float; - } - } - for (k = 1; k < order; k++) { - for (j = 0; j < m; j++) - for (i = 0; i < n; i++) { - denom = knot[i + k] - knot[i]; - if (fabs(denom) < EPSILON) - tmp_float = 0.0; - else - tmp_float = (new_knot[j + k] - knot[i]) / denom * - alpha[i + j * n]; - denom = knot[i + k + 1] - knot[i + 1]; - if (fabs(denom) > EPSILON) - tmp_float += (knot[i + k + 1] - new_knot[j + k]) / denom * - alpha[(i + 1) + j * n]; - alpha_new[i + j * n] = tmp_float; - } - tmp_alpha = alpha_new; - alpha_new = alpha; - alpha = tmp_alpha; - } - the_knot->alpha = alpha; - free(alpha_new); - return GLU_NO_ERROR; -} - -GLenum -calc_new_ctrl_pts(GLfloat * ctrl, GLint stride, knot_str_type * the_knot, - GLint dim, GLfloat ** new_ctrl, GLint * ncontrol) -{ - GLsizei i, j, k, l, m, n; - GLsizei index1, index2; - GLfloat *alpha; - GLfloat *new_knot; - - new_knot = the_knot->new_knot; - n = the_knot->nknots - the_knot->order; - alpha = the_knot->alpha; - - m = the_knot->t_max + 1 - the_knot->t_min - the_knot->order; - k = the_knot->t_min; - /* allocate space for new control points */ - if ((*new_ctrl = (GLfloat *) malloc(sizeof(GLfloat) * dim * m)) == NULL) { - return GLU_OUT_OF_MEMORY; - } - for (j = 0; j < m; j++) { - for (l = 0; l < dim; l++) - (*new_ctrl)[j * dim + l] = 0.0; - for (i = 0; i < n; i++) { - index1 = i + (j + k) * n; - index2 = i * stride; - for (l = 0; l < dim; l++) - (*new_ctrl)[j * dim + l] += alpha[index1] * ctrl[index2 + l]; - } - } - *ncontrol = (GLint) m; - return GLU_NO_ERROR; -} - -static GLint -calc_factor(GLfloat * pts, GLint order, GLint indx, GLint stride, - GLfloat tolerance, GLint dim) -{ - GLdouble model[16], proj[16]; - GLint viewport[4]; - GLdouble x, y, z, w, winx1, winy1, winz, winx2, winy2; - GLint i; - GLdouble len, dx, dy; - - glGetDoublev(GL_MODELVIEW_MATRIX, model); - glGetDoublev(GL_PROJECTION_MATRIX, proj); - glGetIntegerv(GL_VIEWPORT, viewport); - if (dim == 4) { - w = (GLdouble) pts[indx + 3]; - x = (GLdouble) pts[indx] / w; - y = (GLdouble) pts[indx + 1] / w; - z = (GLdouble) pts[indx + 2] / w; - gluProject(x, y, z, model, proj, viewport, &winx1, &winy1, &winz); - len = 0.0; - for (i = 1; i < order; i++) { - w = (GLdouble) pts[indx + i * stride + 3]; - x = (GLdouble) pts[indx + i * stride] / w; - y = (GLdouble) pts[indx + i * stride + 1] / w; - z = (GLdouble) pts[indx + i * stride + 2] / w; - if (gluProject - (x, y, z, model, proj, viewport, &winx2, &winy2, &winz)) { - dx = winx2 - winx1; - dy = winy2 - winy1; - len += sqrt(dx * dx + dy * dy); - } - winx1 = winx2; - winy1 = winy2; - } - } - else { - x = (GLdouble) pts[indx]; - y = (GLdouble) pts[indx + 1]; - if (dim == 2) - z = 0.0; - else - z = (GLdouble) pts[indx + 2]; - gluProject(x, y, z, model, proj, viewport, &winx1, &winy1, &winz); - len = 0.0; - for (i = 1; i < order; i++) { - x = (GLdouble) pts[indx + i * stride]; - y = (GLdouble) pts[indx + i * stride + 1]; - if (dim == 2) - z = 0.0; - else - z = (GLdouble) pts[indx + i * stride + 2]; - if (gluProject - (x, y, z, model, proj, viewport, &winx2, &winy2, &winz)) { - dx = winx2 - winx1; - dy = winy2 - winy1; - len += sqrt(dx * dx + dy * dy); - } - winx1 = winx2; - winy1 = winy2; - } - } - len /= tolerance; - return ((GLint) len + 1); -} - -/* we can't use the Mesa evaluators - no way to get the point coords */ -/* so we use our own Bezier point calculus routines */ -/* because I'm lazy, I reuse the ones from eval.c */ - -static void -bezier_curve(GLfloat * cp, GLfloat * out, GLfloat t, - GLuint dim, GLuint order, GLint offset) -{ - GLfloat s, powert; - GLuint i, k, bincoeff; - - if (order >= 2) { - bincoeff = order - 1; - s = 1.0 - t; - - for (k = 0; k < dim; k++) - out[k] = s * cp[k] + bincoeff * t * cp[offset + k]; - - for (i = 2, cp += 2 * offset, powert = t * t; i < order; - i++, powert *= t, cp += offset) { - bincoeff *= order - i; - bincoeff /= i; - - for (k = 0; k < dim; k++) - out[k] = s * out[k] + bincoeff * powert * cp[k]; - } - } - else { /* order=1 -> constant curve */ - - for (k = 0; k < dim; k++) - out[k] = cp[k]; - } -} - -static GLint -calc_parametric_factor(GLfloat * pts, GLint order, GLint indx, GLint stride, - GLfloat tolerance, GLint dim) -{ - GLdouble model[16], proj[16]; - GLint viewport[4]; - GLdouble x, y, z, w, x1, y1, z1, x2, y2, z2, x3, y3, z3; - GLint i; - GLint P; - GLfloat bez_pt[4]; - GLdouble len = 0.0, tmp, z_med; - - P = 2 * (order + 2); - glGetDoublev(GL_MODELVIEW_MATRIX, model); - glGetDoublev(GL_PROJECTION_MATRIX, proj); - glGetIntegerv(GL_VIEWPORT, viewport); - z_med = (viewport[2] + viewport[3]) * 0.5; - switch (dim) { - case 4: - for (i = 1; i < P; i++) { - bezier_curve(pts + indx, bez_pt, (GLfloat) i / (GLfloat) P, 4, - order, stride); - w = (GLdouble) bez_pt[3]; - x = (GLdouble) bez_pt[0] / w; - y = (GLdouble) bez_pt[1] / w; - z = (GLdouble) bez_pt[2] / w; - gluProject(x, y, z, model, proj, viewport, &x3, &y3, &z3); - z3 *= z_med; - bezier_curve(pts + indx, bez_pt, (GLfloat) (i - 1) / (GLfloat) P, 4, - order, stride); - w = (GLdouble) bez_pt[3]; - x = (GLdouble) bez_pt[0] / w; - y = (GLdouble) bez_pt[1] / w; - z = (GLdouble) bez_pt[2] / w; - gluProject(x, y, z, model, proj, viewport, &x1, &y1, &z1); - z1 *= z_med; - bezier_curve(pts + indx, bez_pt, (GLfloat) (i + 1) / (GLfloat) P, 4, - order, stride); - w = (GLdouble) bez_pt[3]; - x = (GLdouble) bez_pt[0] / w; - y = (GLdouble) bez_pt[1] / w; - z = (GLdouble) bez_pt[2] / w; - gluProject(x, y, z, model, proj, viewport, &x2, &y2, &z2); - z2 *= z_med; - /* calc distance between point (x3,y3,z3) and line segment */ - /* */ - x = x2 - x1; - y = y2 - y1; - z = z2 - z1; - tmp = sqrt(x * x + y * y + z * z); - x /= tmp; - y /= tmp; - z /= tmp; - tmp = x3 * x + y3 * y + z3 * z - x1 * x - y1 * y - z1 * z; - x = x1 + x * tmp - x3; - y = y1 + y * tmp - y3; - z = z1 + z * tmp - z3; - tmp = sqrt(x * x + y * y + z * z); - if (tmp > len) - len = tmp; - } - break; - case 3: - for (i = 1; i < P; i++) { - bezier_curve(pts + indx, bez_pt, (GLfloat) i / (GLfloat) P, 3, - order, stride); - x = (GLdouble) bez_pt[0]; - y = (GLdouble) bez_pt[1]; - z = (GLdouble) bez_pt[2]; - gluProject(x, y, z, model, proj, viewport, &x3, &y3, &z3); - z3 *= z_med; - bezier_curve(pts + indx, bez_pt, (GLfloat) (i - 1) / (GLfloat) P, 3, - order, stride); - x = (GLdouble) bez_pt[0]; - y = (GLdouble) bez_pt[1]; - z = (GLdouble) bez_pt[2]; - gluProject(x, y, z, model, proj, viewport, &x1, &y1, &z1); - z1 *= z_med; - bezier_curve(pts + indx, bez_pt, (GLfloat) (i + 1) / (GLfloat) P, 3, - order, stride); - x = (GLdouble) bez_pt[0]; - y = (GLdouble) bez_pt[1]; - z = (GLdouble) bez_pt[2]; - gluProject(x, y, z, model, proj, viewport, &x2, &y2, &z2); - z2 *= z_med; - /* calc distance between point (x3,y3,z3) and line segment */ - /* */ - x = x2 - x1; - y = y2 - y1; - z = z2 - z1; - tmp = sqrt(x * x + y * y + z * z); - x /= tmp; - y /= tmp; - z /= tmp; - tmp = x3 * x + y3 * y + z3 * z - x1 * x - y1 * y - z1 * z; - x = x1 + x * tmp - x3; - y = y1 + y * tmp - y3; - z = z1 + z * tmp - z3; - tmp = sqrt(x * x + y * y + z * z); - if (tmp > len) - len = tmp; - } - break; - case 2: - for (i = 1; i < P; i++) { - bezier_curve(pts + indx, bez_pt, (GLfloat) i / (GLfloat) P, 2, - order, stride); - x = (GLdouble) bez_pt[0]; - y = (GLdouble) bez_pt[1]; - z = 0.0; - gluProject(x, y, z, model, proj, viewport, &x3, &y3, &z3); - z3 *= z_med; - bezier_curve(pts + indx, bez_pt, (GLfloat) (i - 1) / (GLfloat) P, 2, - order, stride); - x = (GLdouble) bez_pt[0]; - y = (GLdouble) bez_pt[1]; - z = 0.0; - gluProject(x, y, z, model, proj, viewport, &x1, &y1, &z1); - z1 *= z_med; - bezier_curve(pts + indx, bez_pt, (GLfloat) (i + 1) / (GLfloat) P, 2, - order, stride); - x = (GLdouble) bez_pt[0]; - y = (GLdouble) bez_pt[1]; - z = 0.0; - gluProject(x, y, z, model, proj, viewport, &x2, &y2, &z2); - z2 *= z_med; - /* calc distance between point (x3,y3,z3) and line segment */ - /* */ - x = x2 - x1; - y = y2 - y1; - z = z2 - z1; - tmp = sqrt(x * x + y * y + z * z); - x /= tmp; - y /= tmp; - z /= tmp; - tmp = x3 * x + y3 * y + z3 * z - x1 * x - y1 * y - z1 * z; - x = x1 + x * tmp - x3; - y = y1 + y * tmp - y3; - z = z1 + z * tmp - z3; - tmp = sqrt(x * x + y * y + z * z); - if (tmp > len) - len = tmp; - } - break; - - } - if (len < tolerance) - return (order); - else - return (GLint) (sqrt(len / tolerance) * (order + 2) + 1); -} - -static GLenum -calc_sampling_3D(new_ctrl_type * new_ctrl, GLfloat tolerance, GLint dim, - GLint uorder, GLint vorder, GLint ** ufactors, - GLint ** vfactors) -{ - GLfloat *ctrl; - GLint tmp_factor1, tmp_factor2; - GLint ufactor_cnt, vfactor_cnt; - GLint offset1, offset2, offset3; - GLint i, j; - - ufactor_cnt = new_ctrl->s_bezier_cnt; - vfactor_cnt = new_ctrl->t_bezier_cnt; - if ((*ufactors = (GLint *) malloc(sizeof(GLint) * ufactor_cnt * 3)) - == NULL) { - return GLU_OUT_OF_MEMORY; - } - if ((*vfactors = (GLint *) malloc(sizeof(GLint) * vfactor_cnt * 3)) - == NULL) { - free(*ufactors); - return GLU_OUT_OF_MEMORY; - } - ctrl = new_ctrl->geom_ctrl; - offset1 = new_ctrl->geom_t_stride * vorder; - offset2 = new_ctrl->geom_s_stride * uorder; - for (j = 0; j < vfactor_cnt; j++) { - *(*vfactors + j * 3 + 1) = tmp_factor1 = calc_factor(ctrl, vorder, - j * offset1, dim, - tolerance, dim); - /* loop ufactor_cnt-1 times */ - for (i = 1; i < ufactor_cnt; i++) { - tmp_factor2 = calc_factor(ctrl, vorder, - j * offset1 + i * offset2, dim, tolerance, - dim); - if (tmp_factor2 > tmp_factor1) - tmp_factor1 = tmp_factor2; - } - /* last time for the opposite edge */ - *(*vfactors + j * 3 + 2) = tmp_factor2 = calc_factor(ctrl, vorder, - j * offset1 + - i * offset2 - - new_ctrl-> - geom_s_stride, dim, - tolerance, dim); - if (tmp_factor2 > tmp_factor1) - *(*vfactors + j * 3) = tmp_factor2; - else - *(*vfactors + j * 3) = tmp_factor1; - } - offset3 = new_ctrl->geom_s_stride; - offset2 = new_ctrl->geom_s_stride * uorder; - for (j = 0; j < ufactor_cnt; j++) { - *(*ufactors + j * 3 + 1) = tmp_factor1 = calc_factor(ctrl, uorder, - j * offset2, - offset3, tolerance, - dim); - /* loop vfactor_cnt-1 times */ - for (i = 1; i < vfactor_cnt; i++) { - tmp_factor2 = calc_factor(ctrl, uorder, - j * offset2 + i * offset1, offset3, - tolerance, dim); - if (tmp_factor2 > tmp_factor1) - tmp_factor1 = tmp_factor2; - } - /* last time for the opposite edge */ - *(*ufactors + j * 3 + 2) = tmp_factor2 = calc_factor(ctrl, uorder, - j * offset2 + - i * offset1 - - new_ctrl-> - geom_t_stride, - offset3, tolerance, - dim); - if (tmp_factor2 > tmp_factor1) - *(*ufactors + j * 3) = tmp_factor2; - else - *(*ufactors + j * 3) = tmp_factor1; - } - return GL_NO_ERROR; -} - -static GLenum -calc_sampling_param_3D(new_ctrl_type * new_ctrl, GLfloat tolerance, GLint dim, - GLint uorder, GLint vorder, GLint ** ufactors, - GLint ** vfactors) -{ - GLfloat *ctrl; - GLint tmp_factor1, tmp_factor2; - GLint ufactor_cnt, vfactor_cnt; - GLint offset1, offset2, offset3; - GLint i, j; - - ufactor_cnt = new_ctrl->s_bezier_cnt; - vfactor_cnt = new_ctrl->t_bezier_cnt; - if ((*ufactors = (GLint *) malloc(sizeof(GLint) * ufactor_cnt * 3)) - == NULL) { - return GLU_OUT_OF_MEMORY; - } - if ((*vfactors = (GLint *) malloc(sizeof(GLint) * vfactor_cnt * 3)) - == NULL) { - free(*ufactors); - return GLU_OUT_OF_MEMORY; - } - ctrl = new_ctrl->geom_ctrl; - offset1 = new_ctrl->geom_t_stride * vorder; - offset2 = new_ctrl->geom_s_stride * uorder; - for (j = 0; j < vfactor_cnt; j++) { - *(*vfactors + j * 3 + 1) = tmp_factor1 = - calc_parametric_factor(ctrl, vorder, j * offset1, dim, tolerance, - dim); - /* loop ufactor_cnt-1 times */ - for (i = 1; i < ufactor_cnt; i++) { - tmp_factor2 = calc_parametric_factor(ctrl, vorder, - j * offset1 + i * offset2, dim, - tolerance, dim); - if (tmp_factor2 > tmp_factor1) - tmp_factor1 = tmp_factor2; - } - /* last time for the opposite edge */ - *(*vfactors + j * 3 + 2) = tmp_factor2 = - calc_parametric_factor(ctrl, vorder, - j * offset1 + i * offset2 - - new_ctrl->geom_s_stride, dim, tolerance, dim); - if (tmp_factor2 > tmp_factor1) - *(*vfactors + j * 3) = tmp_factor2; - else - *(*vfactors + j * 3) = tmp_factor1; - } - offset3 = new_ctrl->geom_s_stride; - offset2 = new_ctrl->geom_s_stride * uorder; - for (j = 0; j < ufactor_cnt; j++) { - *(*ufactors + j * 3 + 1) = tmp_factor1 = - calc_parametric_factor(ctrl, uorder, j * offset2, offset3, tolerance, - dim); - /* loop vfactor_cnt-1 times */ - for (i = 1; i < vfactor_cnt; i++) { - tmp_factor2 = calc_parametric_factor(ctrl, uorder, - j * offset2 + i * offset1, - offset3, tolerance, dim); - if (tmp_factor2 > tmp_factor1) - tmp_factor1 = tmp_factor2; - } - /* last time for the opposite edge */ - *(*ufactors + j * 3 + 2) = tmp_factor2 = - calc_parametric_factor(ctrl, uorder, - j * offset2 + i * offset1 - - new_ctrl->geom_t_stride, offset3, tolerance, - dim); - if (tmp_factor2 > tmp_factor1) - *(*ufactors + j * 3) = tmp_factor2; - else - *(*ufactors + j * 3) = tmp_factor1; - } - return GL_NO_ERROR; -} - -static GLenum -calc_sampling_2D(GLfloat * ctrl, GLint cnt, GLint order, - GLfloat tolerance, GLint dim, GLint ** factors) -{ - GLint factor_cnt; - GLint tmp_factor; - GLint offset; - GLint i; - - factor_cnt = cnt / order; - if ((*factors = (GLint *) malloc(sizeof(GLint) * factor_cnt)) == NULL) { - return GLU_OUT_OF_MEMORY; - } - offset = order * dim; - for (i = 0; i < factor_cnt; i++) { - tmp_factor = calc_factor(ctrl, order, i * offset, dim, tolerance, dim); - if (tmp_factor == 0) - (*factors)[i] = 1; - else - (*factors)[i] = tmp_factor; - } - return GL_NO_ERROR; -} - -static void -set_sampling_and_culling(GLUnurbsObj * nobj) -{ - if (nobj->auto_load_matrix == GL_FALSE) { - GLint i; - GLfloat m[4]; - - glPushAttrib((GLbitfield) (GL_VIEWPORT_BIT | GL_TRANSFORM_BIT)); - for (i = 0; i < 4; i++) - m[i] = nobj->sampling_matrices.viewport[i]; - glViewport(m[0], m[1], m[2], m[3]); - glMatrixMode(GL_PROJECTION); - glPushMatrix(); - glLoadMatrixf(nobj->sampling_matrices.proj); - glMatrixMode(GL_MODELVIEW); - glPushMatrix(); - glLoadMatrixf(nobj->sampling_matrices.model); - } -} - -static void -revert_sampling_and_culling(GLUnurbsObj * nobj) -{ - if (nobj->auto_load_matrix == GL_FALSE) { - glMatrixMode(GL_MODELVIEW); - glPopMatrix(); - glMatrixMode(GL_PROJECTION); - glPopMatrix(); - glPopAttrib(); - } -} - -GLenum -glu_do_sampling_3D(GLUnurbsObj * nobj, new_ctrl_type * new_ctrl, - GLint ** sfactors, GLint ** tfactors) -{ - GLint dim; - GLenum err; - - *sfactors = NULL; - *tfactors = NULL; - dim = nobj->surface.geom.dim; - set_sampling_and_culling(nobj); - if ((err = calc_sampling_3D(new_ctrl, nobj->sampling_tolerance, dim, - nobj->surface.geom.sorder, - nobj->surface.geom.torder, sfactors, - tfactors)) == GLU_ERROR) { - revert_sampling_and_culling(nobj); - call_user_error(nobj, err); - return GLU_ERROR; - } - revert_sampling_and_culling(nobj); - return GLU_NO_ERROR; -} - -GLenum -glu_do_sampling_uv(GLUnurbsObj * nobj, new_ctrl_type * new_ctrl, - GLint ** sfactors, GLint ** tfactors) -{ - GLint s_cnt, t_cnt, i; - GLint u_steps, v_steps; - - s_cnt = new_ctrl->s_bezier_cnt; - t_cnt = new_ctrl->t_bezier_cnt; - *sfactors = NULL; - *tfactors = NULL; - if ((*sfactors = (GLint *) malloc(sizeof(GLint) * s_cnt * 3)) - == NULL) { - return GLU_OUT_OF_MEMORY; - } - if ((*tfactors = (GLint *) malloc(sizeof(GLint) * t_cnt * 3)) - == NULL) { - free(*sfactors); - return GLU_OUT_OF_MEMORY; - } - u_steps = nobj->u_step; - v_steps = nobj->v_step; - for (i = 0; i < s_cnt; i++) { - *(*sfactors + i * 3) = u_steps; - *(*sfactors + i * 3 + 1) = u_steps; - *(*sfactors + i * 3 + 2) = u_steps; - } - for (i = 0; i < t_cnt; i++) { - *(*tfactors + i * 3) = v_steps; - *(*tfactors + i * 3 + 1) = v_steps; - *(*tfactors + i * 3 + 2) = v_steps; - } - return GLU_NO_ERROR; -} - - -GLenum -glu_do_sampling_param_3D(GLUnurbsObj * nobj, new_ctrl_type * new_ctrl, - GLint ** sfactors, GLint ** tfactors) -{ - GLint dim; - GLenum err; - - *sfactors = NULL; - *tfactors = NULL; - dim = nobj->surface.geom.dim; - set_sampling_and_culling(nobj); - if ( - (err = - calc_sampling_param_3D(new_ctrl, nobj->parametric_tolerance, dim, - nobj->surface.geom.sorder, - nobj->surface.geom.torder, sfactors, - tfactors)) == GLU_ERROR) { - revert_sampling_and_culling(nobj); - call_user_error(nobj, err); - return GLU_ERROR; - } - revert_sampling_and_culling(nobj); - return GLU_NO_ERROR; -} - - -static GLenum -glu_do_sampling_2D(GLUnurbsObj * nobj, GLfloat * ctrl, GLint cnt, GLint order, - GLint dim, GLint ** factors) -{ - GLenum err; - - set_sampling_and_culling(nobj); - err = calc_sampling_2D(ctrl, cnt, order, nobj->sampling_tolerance, dim, - factors); - revert_sampling_and_culling(nobj); - return err; -} - - -static GLenum -glu_do_sampling_u(GLUnurbsObj * nobj, GLfloat * ctrl, GLint cnt, GLint order, - GLint dim, GLint ** factors) -{ - GLint i; - GLint u_steps; - - cnt /= order; - if ((*factors = (GLint *) malloc(sizeof(GLint) * cnt)) - == NULL) { - return GLU_OUT_OF_MEMORY; - } - u_steps = nobj->u_step; - for (i = 0; i < cnt; i++) - (*factors)[i] = u_steps; - return GLU_NO_ERROR; -} - - -static GLenum -glu_do_sampling_param_2D(GLUnurbsObj * nobj, GLfloat * ctrl, GLint cnt, - GLint order, GLint dim, GLint ** factors) -{ - GLint i; - GLint u_steps; - GLfloat tolerance; - - set_sampling_and_culling(nobj); - tolerance = nobj->parametric_tolerance; - cnt /= order; - if ((*factors = (GLint *) malloc(sizeof(GLint) * cnt)) - == NULL) { - revert_sampling_and_culling(nobj); - return GLU_OUT_OF_MEMORY; - } - u_steps = nobj->u_step; - for (i = 0; i < cnt; i++) { - (*factors)[i] = calc_parametric_factor(ctrl, order, 0, - dim, tolerance, dim); - - } - revert_sampling_and_culling(nobj); - return GLU_NO_ERROR; -} - -GLenum -glu_do_sampling_crv(GLUnurbsObj * nobj, GLfloat * ctrl, GLint cnt, - GLint order, GLint dim, GLint ** factors) -{ - GLenum err; - - *factors = NULL; - switch (nobj->sampling_method) { - case GLU_PATH_LENGTH: - if ((err = glu_do_sampling_2D(nobj, ctrl, cnt, order, dim, factors)) != - GLU_NO_ERROR) { - call_user_error(nobj, err); - return GLU_ERROR; - } - break; - case GLU_DOMAIN_DISTANCE: - if ((err = glu_do_sampling_u(nobj, ctrl, cnt, order, dim, factors)) != - GLU_NO_ERROR) { - call_user_error(nobj, err); - return GLU_ERROR; - } - break; - case GLU_PARAMETRIC_ERROR: - if ( - (err = - glu_do_sampling_param_2D(nobj, ctrl, cnt, order, dim, - factors)) != GLU_NO_ERROR) { - call_user_error(nobj, err); - return GLU_ERROR; - } - break; - default: - abort(); - } - - return GLU_NO_ERROR; -} - -/* TODO - i don't like this culling - this one just tests if at least one */ -/* ctrl point lies within the viewport . Also the point_in_viewport() */ -/* should be included in the fnctions for efficiency reasons */ - -static GLboolean -point_in_viewport(GLfloat * pt, GLint dim) -{ - GLdouble model[16], proj[16]; - GLint viewport[4]; - GLdouble x, y, z, w, winx, winy, winz; - - glGetDoublev(GL_MODELVIEW_MATRIX, model); - glGetDoublev(GL_PROJECTION_MATRIX, proj); - glGetIntegerv(GL_VIEWPORT, viewport); - if (dim == 3) { - x = (GLdouble) pt[0]; - y = (GLdouble) pt[1]; - z = (GLdouble) pt[2]; - gluProject(x, y, z, model, proj, viewport, &winx, &winy, &winz); - } - else { - w = (GLdouble) pt[3]; - x = (GLdouble) pt[0] / w; - y = (GLdouble) pt[1] / w; - z = (GLdouble) pt[2] / w; - gluProject(x, y, z, model, proj, viewport, &winx, &winy, &winz); - } - if ((GLint) winx >= viewport[0] && (GLint) winx < viewport[2] && - (GLint) winy >= viewport[1] && (GLint) winy < viewport[3]) - return GL_TRUE; - return GL_FALSE; -} - -GLboolean -fine_culling_test_3D(GLUnurbsObj * nobj, GLfloat * pts, GLint s_cnt, - GLint t_cnt, GLint s_stride, GLint t_stride, GLint dim) -{ - GLint i, j; - - if (nobj->culling == GL_FALSE) - return GL_FALSE; - set_sampling_and_culling(nobj); - - if (dim == 3) { - for (i = 0; i < s_cnt; i++) - for (j = 0; j < t_cnt; j++) - if (point_in_viewport(pts + i * s_stride + j * t_stride, dim)) { - revert_sampling_and_culling(nobj); - return GL_FALSE; - } - } - else { - for (i = 0; i < s_cnt; i++) - for (j = 0; j < t_cnt; j++) - if (point_in_viewport(pts + i * s_stride + j * t_stride, dim)) { - revert_sampling_and_culling(nobj); - return GL_FALSE; - } - } - revert_sampling_and_culling(nobj); - return GL_TRUE; -} - -/*GLboolean -fine_culling_test_3D(GLUnurbsObj *nobj,GLfloat *pts,GLint s_cnt,GLint t_cnt, - GLint s_stride,GLint t_stride, GLint dim) -{ - GLint visible_cnt; - GLfloat feedback_buffer[5]; - GLsizei buffer_size; - GLint i,j; - - if(nobj->culling==GL_FALSE) - return GL_FALSE; - buffer_size=5; - set_sampling_and_culling(nobj); - - glFeedbackBuffer(buffer_size,GL_2D,feedback_buffer); - glRenderMode(GL_FEEDBACK); - if(dim==3) - { - for(i=0;iculling == GL_FALSE) - return GL_FALSE; - set_sampling_and_culling(nobj); - - if (dim == 3) { - for (i = 0; i < cnt; i++) - if (point_in_viewport(pts + i * stride, dim)) { - revert_sampling_and_culling(nobj); - return GL_FALSE; - } - } - else { - for (i = 0; i < cnt; i++) - if (point_in_viewport(pts + i * stride, dim)) { - revert_sampling_and_culling(nobj); - return GL_FALSE; - } - } - revert_sampling_and_culling(nobj); - return GL_TRUE; -} - -/*GLboolean -fine_culling_test_2D(GLUnurbsObj *nobj,GLfloat *pts,GLint cnt, - GLint stride, GLint dim) -{ - GLint visible_cnt; - GLfloat feedback_buffer[5]; - GLsizei buffer_size; - GLint i; - - if(nobj->culling==GL_FALSE) - return GL_FALSE; - buffer_size=5; - set_sampling_and_culling(nobj); - - glFeedbackBuffer(buffer_size,GL_2D,feedback_buffer); - glRenderMode(GL_FEEDBACK); - glBegin(GL_LINE_LOOP); - if(dim==3) - { - for(i=0;i -#include -#include "gluP.h" -#include "tess.h" -#endif - - - -static GLenum store_polygon_as_contour(GLUtriangulatorObj *); -static void free_current_polygon(tess_polygon *); -static void prepare_projection_info(GLUtriangulatorObj *); -static GLdouble twice_the_polygon_area(tess_vertex *, tess_vertex *); -static GLenum verify_edge_vertex_intersections(GLUtriangulatorObj *); -void tess_find_contour_hierarchies(GLUtriangulatorObj *); -static GLenum test_for_overlapping_contours(GLUtriangulatorObj *); -static GLenum contours_overlap(tess_contour *, tess_polygon *); -static GLenum is_contour_contained_in(tess_contour *, tess_contour *); -static void add_new_exterior(GLUtriangulatorObj *, tess_contour *); -static void add_new_interior(GLUtriangulatorObj *, tess_contour *, - tess_contour *); -static void add_interior_with_hierarchy_check(GLUtriangulatorObj *, - tess_contour *, tess_contour *); -static void reverse_hierarchy_and_add_exterior(GLUtriangulatorObj *, - tess_contour *, - tess_contour *); -static GLboolean point_in_polygon(tess_contour *, GLdouble, GLdouble); -static void shift_interior_to_exterior(GLUtriangulatorObj *, tess_contour *); -static void add_exterior_with_check(GLUtriangulatorObj *, tess_contour *, - tess_contour *); -static GLenum cut_out_hole(GLUtriangulatorObj *, tess_contour *, - tess_contour *); -static GLenum merge_hole_with_contour(GLUtriangulatorObj *, - tess_contour *, tess_contour *, - tess_vertex *, tess_vertex *); - -static GLenum -find_normal(GLUtriangulatorObj * tobj) -{ - tess_polygon *polygon = tobj->current_polygon; - tess_vertex *va, *vb, *vc; - GLdouble A, B, C; - GLdouble A0, A1, A2, B0, B1, B2; - - va = polygon->vertices; - vb = va->next; - A0 = vb->location[0] - va->location[0]; - A1 = vb->location[1] - va->location[1]; - A2 = vb->location[2] - va->location[2]; - for (vc = vb->next; vc != va; vc = vc->next) { - B0 = vc->location[0] - va->location[0]; - B1 = vc->location[1] - va->location[1]; - B2 = vc->location[2] - va->location[2]; - A = A1 * B2 - A2 * B1; - B = A2 * B0 - A0 * B2; - C = A0 * B1 - A1 * B0; - if (fabs(A) > EPSILON || fabs(B) > EPSILON || fabs(C) > EPSILON) { - polygon->A = A; - polygon->B = B; - polygon->C = C; - polygon->D = - -A * va->location[0] - B * va->location[1] - C * va->location[2]; - return GLU_NO_ERROR; - } - } - tess_call_user_error(tobj, GLU_TESS_ERROR7); - return GLU_ERROR; -} - -void -tess_test_polygon(GLUtriangulatorObj * tobj) -{ - tess_polygon *polygon = tobj->current_polygon; - - /* any vertices defined? */ - if (polygon->vertex_cnt < 3) { - free_current_polygon(polygon); - return; - } - /* wrap pointers */ - polygon->last_vertex->next = polygon->vertices; - polygon->vertices->previous = polygon->last_vertex; - /* determine the normal */ - if (find_normal(tobj) == GLU_ERROR) - return; - /* compare the normals of previously defined contours and this one */ - /* first contour define ? */ - if (tobj->contours == NULL) { - tobj->A = polygon->A; - tobj->B = polygon->B; - tobj->C = polygon->C; - tobj->D = polygon->D; - /* determine the best projection to use */ - if (fabs(polygon->A) > fabs(polygon->B)) - if (fabs(polygon->A) > fabs(polygon->C)) - tobj->projection = OYZ; - else - tobj->projection = OXY; - else if (fabs(polygon->B) > fabs(polygon->C)) - tobj->projection = OXZ; - else - tobj->projection = OXY; - } - else { - GLdouble a[3], b[3]; - tess_vertex *vertex = polygon->vertices; - - a[0] = tobj->A; - a[1] = tobj->B; - a[2] = tobj->C; - b[0] = polygon->A; - b[1] = polygon->B; - b[2] = polygon->C; - - /* compare the normals */ - if (fabs(a[1] * b[2] - a[2] * b[1]) > EPSILON || - fabs(a[2] * b[0] - a[0] * b[2]) > EPSILON || - fabs(a[0] * b[1] - a[1] * b[0]) > EPSILON) { - /* not coplanar */ - tess_call_user_error(tobj, GLU_TESS_ERROR9); - return; - } - /* the normals are parallel - test for plane equation */ - if (fabs(a[0] * vertex->location[0] + a[1] * vertex->location[1] + - a[2] * vertex->location[2] + tobj->D) > EPSILON) { - /* not the same plane */ - tess_call_user_error(tobj, GLU_TESS_ERROR9); - return; - } - } - prepare_projection_info(tobj); - if (verify_edge_vertex_intersections(tobj) == GLU_ERROR) - return; - if (test_for_overlapping_contours(tobj) == GLU_ERROR) - return; - if (store_polygon_as_contour(tobj) == GLU_ERROR) - return; -} - -static GLenum -test_for_overlapping_contours(GLUtriangulatorObj * tobj) -{ - tess_contour *contour; - tess_polygon *polygon; - - polygon = tobj->current_polygon; - for (contour = tobj->contours; contour != NULL; contour = contour->next) - if (contours_overlap(contour, polygon) != GLU_NO_ERROR) { - tess_call_user_error(tobj, GLU_TESS_ERROR5); - return GLU_ERROR; - } - return GLU_NO_ERROR; -} - -static GLenum -store_polygon_as_contour(GLUtriangulatorObj * tobj) -{ - tess_polygon *polygon = tobj->current_polygon; - tess_contour *contour = tobj->contours; - - /* the first contour defined */ - if (contour == NULL) { - if ((contour = (tess_contour *) malloc(sizeof(tess_contour))) == NULL) { - tess_call_user_error(tobj, GLU_OUT_OF_MEMORY); - free_current_polygon(polygon); - return GLU_ERROR; - } - tobj->contours = tobj->last_contour = contour; - contour->next = contour->previous = NULL; - } - else { - if ((contour = (tess_contour *) malloc(sizeof(tess_contour))) == NULL) { - tess_call_user_error(tobj, GLU_OUT_OF_MEMORY); - free_current_polygon(polygon); - return GLU_ERROR; - } - contour->previous = tobj->last_contour; - tobj->last_contour->next = contour; - tobj->last_contour = contour; - contour->next = NULL; - } - /* mark all vertices in new contour as not special */ - /* and all are boundary edges */ - { - tess_vertex *vertex; - GLuint vertex_cnt, i; - - for (vertex = polygon->vertices, i = 0, vertex_cnt = - polygon->vertex_cnt; i < vertex_cnt; vertex = vertex->next, i++) { - vertex->shadow_vertex = NULL; - vertex->edge_flag = GL_TRUE; - } - } - contour->vertex_cnt = polygon->vertex_cnt; - contour->area = polygon->area; - contour->orientation = polygon->orientation; - contour->type = GLU_UNKNOWN; - contour->vertices = polygon->vertices; - contour->last_vertex = polygon->last_vertex; - polygon->vertices = polygon->last_vertex = NULL; - polygon->vertex_cnt = 0; - ++(tobj->contour_cnt); - return GLU_NO_ERROR; -} - -static void -free_current_polygon(tess_polygon * polygon) -{ - tess_vertex *vertex, *vertex_tmp; - GLuint i; - - /* free current_polygon structures */ - for (vertex = polygon->vertices, i = 0; i < polygon->vertex_cnt; i++) { - vertex_tmp = vertex->next; - free(vertex); - vertex = vertex_tmp; - } - polygon->vertices = polygon->last_vertex = NULL; - polygon->vertex_cnt = 0; -} - -static void -prepare_projection_info(GLUtriangulatorObj * tobj) -{ - tess_polygon *polygon = tobj->current_polygon; - tess_vertex *vertex, *last_vertex_ptr; - GLdouble area; - - last_vertex_ptr = polygon->last_vertex; - switch (tobj->projection) { - case OXY: - for (vertex = polygon->vertices; vertex != last_vertex_ptr; - vertex = vertex->next) { - vertex->x = vertex->location[0]; - vertex->y = vertex->location[1]; - } - last_vertex_ptr->x = last_vertex_ptr->location[0]; - last_vertex_ptr->y = last_vertex_ptr->location[1]; - break; - case OXZ: - for (vertex = polygon->vertices; vertex != last_vertex_ptr; - vertex = vertex->next) { - vertex->x = vertex->location[0]; - vertex->y = vertex->location[2]; - } - last_vertex_ptr->x = last_vertex_ptr->location[0]; - last_vertex_ptr->y = last_vertex_ptr->location[2]; - break; - case OYZ: - for (vertex = polygon->vertices; vertex != last_vertex_ptr; - vertex = vertex->next) { - vertex->x = vertex->location[1]; - vertex->y = vertex->location[2]; - } - last_vertex_ptr->x = last_vertex_ptr->location[1]; - last_vertex_ptr->y = last_vertex_ptr->location[2]; - break; - } - area = twice_the_polygon_area(polygon->vertices, polygon->last_vertex); - if (area >= 0.0) { - polygon->orientation = GLU_CCW; - polygon->area = area; - } - else { - polygon->orientation = GLU_CW; - polygon->area = -area; - } -} - -static GLdouble -twice_the_polygon_area(tess_vertex * vertex, tess_vertex * last_vertex) -{ - tess_vertex *next; - GLdouble area, x, y; - - area = 0.0; - x = vertex->x; - y = vertex->y; - vertex = vertex->next; - for (; vertex != last_vertex; vertex = vertex->next) { - next = vertex->next; - area += - (vertex->x - x) * (next->y - y) - (vertex->y - y) * (next->x - x); - } - return area; -} - -/* test if edges ab and cd intersect */ -/* if not return GLU_NO_ERROR, else if cross return GLU_TESS_ERROR8, */ -/* else if adjacent return GLU_TESS_ERROR4 */ -static GLenum -edge_edge_intersect(tess_vertex * a, - tess_vertex * b, tess_vertex * c, tess_vertex * d) -{ - GLdouble denom, r, s; - GLdouble xba, ydc, yba, xdc, yac, xac; - - xba = b->x - a->x; - yba = b->y - a->y; - xdc = d->x - c->x; - ydc = d->y - c->y; - xac = a->x - c->x; - yac = a->y - c->y; - denom = xba * ydc - yba * xdc; - r = yac * xdc - xac * ydc; - /* parallel? */ - if (fabs(denom) < EPSILON) { - if (fabs(r) < EPSILON) { - /* colinear */ - if (fabs(xba) < EPSILON) { - /* compare the Y coordinate */ - if (yba > 0.0) { - if ( - (fabs(a->y - c->y) < EPSILON - && fabs(c->y - b->y) < EPSILON) - || (fabs(a->y - d->y) < EPSILON - && fabs(d->y - b->y) < - EPSILON)) return GLU_TESS_ERROR4; - - } - else { - if ( - (fabs(b->y - c->y) < EPSILON - && fabs(c->y - a->y) < EPSILON) - || (fabs(b->y - d->y) < EPSILON - && fabs(d->y - a->y) < - EPSILON)) return GLU_TESS_ERROR4; - } - } - else { - /* compare the X coordinate */ - if (xba > 0.0) { - if ( - (fabs(a->x - c->x) < EPSILON - && fabs(c->x - b->x) < EPSILON) - || (fabs(a->x - d->x) < EPSILON - && fabs(d->x - b->x) < - EPSILON)) return GLU_TESS_ERROR4; - } - else { - if ( - (fabs(b->x - c->x) < EPSILON - && fabs(c->x - a->x) < EPSILON) - || (fabs(b->x - d->x) < EPSILON - && fabs(d->x - a->x) < - EPSILON)) return GLU_TESS_ERROR4; - } - } - } - return GLU_NO_ERROR; - } - r /= denom; - s = (yac * xba - xac * yba) / denom; - /* test if one vertex lies on other edge */ - if (((fabs(r) < EPSILON || (r < 1.0 + EPSILON && r > 1.0 - EPSILON)) && - s > -EPSILON && s < 1.0 + EPSILON) || - ((fabs(s) < EPSILON || (s < 1.0 + EPSILON && s > 1.0 - EPSILON)) && - r > -EPSILON && r < 1.0 + EPSILON)) { - return GLU_TESS_ERROR4; - } - /* test for crossing */ - if (r > -EPSILON && r < 1.0 + EPSILON && s > -EPSILON && s < 1.0 + EPSILON) { - return GLU_TESS_ERROR8; - } - return GLU_NO_ERROR; -} - -static GLenum -verify_edge_vertex_intersections(GLUtriangulatorObj * tobj) -{ - tess_polygon *polygon = tobj->current_polygon; - tess_vertex *vertex1, *last_vertex, *vertex2; - GLenum test; - - last_vertex = polygon->last_vertex; - vertex1 = last_vertex; - for (vertex2 = vertex1->next->next; - vertex2->next != last_vertex; vertex2 = vertex2->next) { - test = edge_edge_intersect(vertex1, vertex1->next, vertex2, - vertex2->next); - if (test != GLU_NO_ERROR) { - tess_call_user_error(tobj, test); - return GLU_ERROR; - } - } - for (vertex1 = polygon->vertices; - vertex1->next->next != last_vertex; vertex1 = vertex1->next) { - for (vertex2 = vertex1->next->next; - vertex2 != last_vertex; vertex2 = vertex2->next) { - test = edge_edge_intersect(vertex1, vertex1->next, vertex2, - vertex2->next); - if (test != GLU_NO_ERROR) { - tess_call_user_error(tobj, test); - return GLU_ERROR; - } - } - } - return GLU_NO_ERROR; -} - -static int -#ifdef WIN32 - __cdecl -#endif -area_compare(const void *a, const void *b) -{ - GLdouble area1, area2; - - area1 = (*((tess_contour **) a))->area; - area2 = (*((tess_contour **) b))->area; - if (area1 < area2) - return 1; - if (area1 > area2) - return -1; - return 0; -} - -void -tess_find_contour_hierarchies(GLUtriangulatorObj * tobj) -{ - tess_contour **contours; /* dinamic array of pointers */ - tess_contour *tmp_contour_ptr = tobj->contours; - GLuint cnt, i; - GLenum result; - GLboolean hierarchy_changed; - - /* any contours? */ - if (tobj->contour_cnt < 2) { - tobj->contours->type = GLU_EXTERIOR; - return; - } - if ((contours = (tess_contour **) - malloc(sizeof(tess_contour *) * (tobj->contour_cnt))) == NULL) { - tess_call_user_error(tobj, GLU_OUT_OF_MEMORY); - return; - } - for (tmp_contour_ptr = tobj->contours, cnt = 0; - tmp_contour_ptr != NULL; tmp_contour_ptr = tmp_contour_ptr->next) - contours[cnt++] = tmp_contour_ptr; - /* now sort the contours in decreasing area size order */ - qsort((void *) contours, (size_t) cnt, (size_t) sizeof(tess_contour *), - area_compare); - /* we leave just the first contour - remove others from list */ - tobj->contours = contours[0]; - tobj->contours->next = tobj->contours->previous = NULL; - tobj->last_contour = tobj->contours; - tobj->contour_cnt = 1; - /* first contour is the one with greatest area */ - /* must be EXTERIOR */ - tobj->contours->type = GLU_EXTERIOR; - tmp_contour_ptr = tobj->contours; - /* now we play! */ - for (i = 1; i < cnt; i++) { - hierarchy_changed = GL_FALSE; - for (tmp_contour_ptr = tobj->contours; - tmp_contour_ptr != NULL; tmp_contour_ptr = tmp_contour_ptr->next) { - if (tmp_contour_ptr->type == GLU_EXTERIOR) { - /* check if contour completely contained in EXTERIOR */ - result = is_contour_contained_in(tmp_contour_ptr, contours[i]); - switch (result) { - case GLU_INTERIOR: - /* now we have to check if contour is inside interiors */ - /* or not */ - /* any interiors? */ - if (tmp_contour_ptr->next != NULL && - tmp_contour_ptr->next->type == GLU_INTERIOR) { - /* for all interior, check if inside any of them */ - /* if not inside any of interiors, its another */ - /* interior */ - /* or it may contain some interiors, then change */ - /* the contained interiors to exterior ones */ - add_interior_with_hierarchy_check(tobj, - tmp_contour_ptr, - contours[i]); - } - else { - /* not in interior, add as new interior contour */ - add_new_interior(tobj, tmp_contour_ptr, contours[i]); - } - hierarchy_changed = GL_TRUE; - break; - case GLU_EXTERIOR: - /* ooops, the marked as EXTERIOR (contours[i]) is */ - /* actually an interior of tmp_contour_ptr */ - /* reverse the local hierarchy */ - reverse_hierarchy_and_add_exterior(tobj, tmp_contour_ptr, - contours[i]); - hierarchy_changed = GL_TRUE; - break; - case GLU_NO_ERROR: - break; - default: - abort(); - } - } - if (hierarchy_changed) - break; /* break from for loop */ - } - if (hierarchy_changed == GL_FALSE) { - /* disjoint with all contours, add to contour list */ - add_new_exterior(tobj, contours[i]); - } - } - free(contours); -} - -/* returns GLU_INTERIOR if inner is completey enclosed within outer */ -/* returns GLU_EXTERIOR if outer is completely enclosed within inner */ -/* returns GLU_NO_ERROR if contours are disjoint */ -static GLenum -is_contour_contained_in(tess_contour * outer, tess_contour * inner) -{ - GLenum relation_flag; - - /* set relation_flag to relation of containment of first inner vertex */ - /* regarding outer contour */ - if (point_in_polygon(outer, inner->vertices->x, inner->vertices->y)) - relation_flag = GLU_INTERIOR; - else - relation_flag = GLU_EXTERIOR; - if (relation_flag == GLU_INTERIOR) - return GLU_INTERIOR; - if (point_in_polygon(inner, outer->vertices->x, outer->vertices->y)) - return GLU_EXTERIOR; - return GLU_NO_ERROR; -} - -static GLboolean -point_in_polygon(tess_contour * contour, GLdouble x, GLdouble y) -{ - tess_vertex *v1, *v2; - GLuint i, vertex_cnt; - GLdouble xp1, yp1, xp2, yp2; - GLboolean tst; - - tst = GL_FALSE; - v1 = contour->vertices; - v2 = contour->vertices->previous; - for (i = 0, vertex_cnt = contour->vertex_cnt; i < vertex_cnt; i++) { - xp1 = v1->x; - yp1 = v1->y; - xp2 = v2->x; - yp2 = v2->y; - if ((((yp1 <= y) && (y < yp2)) || ((yp2 <= y) && (y < yp1))) && - (x < (xp2 - xp1) * (y - yp1) / (yp2 - yp1) + xp1)) - tst = (tst == GL_FALSE ? GL_TRUE : GL_FALSE); - v2 = v1; - v1 = v1->next; - } - return tst; -} - -static GLenum -contours_overlap(tess_contour * contour, tess_polygon * polygon) -{ - tess_vertex *vertex1, *vertex2; - GLuint vertex1_cnt, vertex2_cnt, i, j; - GLenum test; - - vertex1 = contour->vertices; - vertex2 = polygon->vertices; - vertex1_cnt = contour->vertex_cnt; - vertex2_cnt = polygon->vertex_cnt; - for (i = 0; i < vertex1_cnt; vertex1 = vertex1->next, i++) { - for (j = 0; j < vertex2_cnt; vertex2 = vertex2->next, j++) - if ((test = edge_edge_intersect(vertex1, vertex1->next, vertex2, - vertex2->next)) != GLU_NO_ERROR) - return test; - } - return GLU_NO_ERROR; -} - -static void -add_new_exterior(GLUtriangulatorObj * tobj, tess_contour * contour) -{ - contour->type = GLU_EXTERIOR; - contour->next = NULL; - contour->previous = tobj->last_contour; - tobj->last_contour->next = contour; - tobj->last_contour = contour; -} - -static void -add_new_interior(GLUtriangulatorObj * tobj, - tess_contour * outer, tess_contour * contour) -{ - contour->type = GLU_INTERIOR; - contour->next = outer->next; - contour->previous = outer; - if (outer->next != NULL) - outer->next->previous = contour; - outer->next = contour; - if (tobj->last_contour == outer) - tobj->last_contour = contour; -} - -static void -add_interior_with_hierarchy_check(GLUtriangulatorObj * tobj, - tess_contour * outer, - tess_contour * contour) -{ - tess_contour *ptr; - - /* for all interiors of outer check if they are interior of contour */ - /* if so, change that interior to exterior and move it of of the */ - /* interior sequence */ - if (outer->next != NULL && outer->next->type == GLU_INTERIOR) { - GLenum test; - - for (ptr = outer->next; ptr != NULL && ptr->type == GLU_INTERIOR; - ptr = ptr->next) { - test = is_contour_contained_in(ptr, contour); - switch (test) { - case GLU_INTERIOR: - /* contour is contained in one of the interiors */ - /* check if possibly contained in other exteriors */ - /* move ptr to first EXTERIOR */ - for (; ptr != NULL && ptr->type == GLU_INTERIOR; ptr = ptr->next); - if (ptr == NULL) - /* another exterior */ - add_new_exterior(tobj, contour); - else - add_exterior_with_check(tobj, ptr, contour); - return; - case GLU_EXTERIOR: - /* one of the interiors is contained in the contour */ - /* change it to EXTERIOR, and shift it away from the */ - /* interior sequence */ - shift_interior_to_exterior(tobj, ptr); - break; - case GLU_NO_ERROR: - /* disjoint */ - break; - default: - abort(); - } - } - } - /* add contour to the interior sequence */ - add_new_interior(tobj, outer, contour); -} - -static void -reverse_hierarchy_and_add_exterior(GLUtriangulatorObj * tobj, - tess_contour * outer, - tess_contour * contour) -{ - tess_contour *ptr; - - /* reverse INTERIORS to EXTERIORS */ - /* any INTERIORS? */ - if (outer->next != NULL && outer->next->type == GLU_INTERIOR) - for (ptr = outer->next; ptr != NULL && ptr->type == GLU_INTERIOR; - ptr = ptr->next) ptr->type = GLU_EXTERIOR; - /* the outer now becomes inner */ - outer->type = GLU_INTERIOR; - /* contour is the EXTERIOR */ - contour->next = outer; - if (tobj->contours == outer) { - /* first contour beeing reversed */ - contour->previous = NULL; - tobj->contours = contour; - } - else { - outer->previous->next = contour; - contour->previous = outer->previous; - } - outer->previous = contour; -} - -static void -shift_interior_to_exterior(GLUtriangulatorObj * tobj, tess_contour * contour) -{ - contour->previous->next = contour->next; - if (contour->next != NULL) - contour->next->previous = contour->previous; - else - tobj->last_contour = contour->previous; -} - -static void -add_exterior_with_check(GLUtriangulatorObj * tobj, - tess_contour * outer, tess_contour * contour) -{ - GLenum test; - - /* this contour might be interior to further exteriors - check */ - /* if not, just add as a new exterior */ - for (; outer != NULL && outer->type == GLU_EXTERIOR; outer = outer->next) { - test = is_contour_contained_in(outer, contour); - switch (test) { - case GLU_INTERIOR: - /* now we have to check if contour is inside interiors */ - /* or not */ - /* any interiors? */ - if (outer->next != NULL && outer->next->type == GLU_INTERIOR) { - /* for all interior, check if inside any of them */ - /* if not inside any of interiors, its another */ - /* interior */ - /* or it may contain some interiors, then change */ - /* the contained interiors to exterior ones */ - add_interior_with_hierarchy_check(tobj, outer, contour); - } - else { - /* not in interior, add as new interior contour */ - add_new_interior(tobj, outer, contour); - } - return; - case GLU_NO_ERROR: - /* disjoint */ - break; - default: - abort(); - } - } - /* add contour to the exterior sequence */ - add_new_exterior(tobj, contour); -} - -void -tess_handle_holes(GLUtriangulatorObj * tobj) -{ - tess_contour *contour, *hole; - GLenum exterior_orientation; - - /* verify hole orientation */ - for (contour = tobj->contours; contour != NULL;) { - exterior_orientation = contour->orientation; - for (contour = contour->next; - contour != NULL && contour->type == GLU_INTERIOR; - contour = contour->next) { - if (contour->orientation == exterior_orientation) { - tess_call_user_error(tobj, GLU_TESS_ERROR5); - return; - } - } - } - /* now cut-out holes */ - for (contour = tobj->contours; contour != NULL;) { - hole = contour->next; - while (hole != NULL && hole->type == GLU_INTERIOR) { - if (cut_out_hole(tobj, contour, hole) == GLU_ERROR) - return; - hole = contour->next; - } - contour = contour->next; - } -} - -static GLenum -cut_out_hole(GLUtriangulatorObj * tobj, - tess_contour * contour, tess_contour * hole) -{ - tess_contour *tmp_hole; - tess_vertex *v1, *v2, *tmp_vertex; - GLuint vertex1_cnt, vertex2_cnt, tmp_vertex_cnt; - GLuint i, j, k; - GLenum test = 0; - - /* find an edge connecting contour and hole not intersecting any other */ - /* edge belonging to either the contour or any of the other holes */ - for (v1 = contour->vertices, vertex1_cnt = contour->vertex_cnt, i = 0; - i < vertex1_cnt; i++, v1 = v1->next) { - for (v2 = hole->vertices, vertex2_cnt = hole->vertex_cnt, j = 0; - j < vertex2_cnt; j++, v2 = v2->next) { - /* does edge (v1,v2) intersect any edge of contour */ - for (tmp_vertex = contour->vertices, tmp_vertex_cnt = - contour->vertex_cnt, k = 0; k < tmp_vertex_cnt; - tmp_vertex = tmp_vertex->next, k++) { - /* skip edge tests for edges directly connected */ - if (v1 == tmp_vertex || v1 == tmp_vertex->next) - continue; - test = edge_edge_intersect(v1, v2, tmp_vertex, tmp_vertex->next); - if (test != GLU_NO_ERROR) - break; - } - if (test == GLU_NO_ERROR) { - /* does edge (v1,v2) intersect any edge of hole */ - for (tmp_vertex = hole->vertices, - tmp_vertex_cnt = hole->vertex_cnt, k = 0; - k < tmp_vertex_cnt; tmp_vertex = tmp_vertex->next, k++) { - /* skip edge tests for edges directly connected */ - if (v2 == tmp_vertex || v2 == tmp_vertex->next) - continue; - test = - edge_edge_intersect(v1, v2, tmp_vertex, tmp_vertex->next); - if (test != GLU_NO_ERROR) - break; - } - if (test == GLU_NO_ERROR) { - /* does edge (v1,v2) intersect any other hole? */ - for (tmp_hole = hole->next; - tmp_hole != NULL && tmp_hole->type == GLU_INTERIOR; - tmp_hole = tmp_hole->next) { - /* does edge (v1,v2) intersect any edge of hole */ - for (tmp_vertex = tmp_hole->vertices, - tmp_vertex_cnt = tmp_hole->vertex_cnt, k = 0; - k < tmp_vertex_cnt; tmp_vertex = tmp_vertex->next, k++) { - test = edge_edge_intersect(v1, v2, tmp_vertex, - tmp_vertex->next); - if (test != GLU_NO_ERROR) - break; - } - if (test != GLU_NO_ERROR) - break; - } - } - } - if (test == GLU_NO_ERROR) { - /* edge (v1,v2) is good for eliminating the hole */ - if (merge_hole_with_contour(tobj, contour, hole, v1, v2) - == GLU_NO_ERROR) - return GLU_NO_ERROR; - else - return GLU_ERROR; - } - } - } - /* other holes are blocking all possible connections of hole */ - /* with contour, we shift this hole as the last hole and retry */ - for (tmp_hole = hole; - tmp_hole != NULL && tmp_hole->type == GLU_INTERIOR; - tmp_hole = tmp_hole->next); - contour->next = hole->next; - hole->next->previous = contour; - if (tmp_hole == NULL) { - /* last EXTERIOR contour, shift hole as last contour */ - hole->next = NULL; - hole->previous = tobj->last_contour; - tobj->last_contour->next = hole; - tobj->last_contour = hole; - } - else { - tmp_hole->previous->next = hole; - hole->previous = tmp_hole->previous; - tmp_hole->previous = hole; - hole->next = tmp_hole; - } - hole = contour->next; - /* try once again - recurse */ - return cut_out_hole(tobj, contour, hole); -} - -static GLenum -merge_hole_with_contour(GLUtriangulatorObj * tobj, - tess_contour * contour, - tess_contour * hole, - tess_vertex * v1, tess_vertex * v2) -{ - tess_vertex *v1_new, *v2_new; - - /* make copies of v1 and v2, place them respectively after their originals */ - if ((v1_new = (tess_vertex *) malloc(sizeof(tess_vertex))) == NULL) { - tess_call_user_error(tobj, GLU_OUT_OF_MEMORY); - return GLU_ERROR; - } - if ((v2_new = (tess_vertex *) malloc(sizeof(tess_vertex))) == NULL) { - tess_call_user_error(tobj, GLU_OUT_OF_MEMORY); - return GLU_ERROR; - } - v1_new->edge_flag = GL_TRUE; - v1_new->data = v1->data; - v1_new->location[0] = v1->location[0]; - v1_new->location[1] = v1->location[1]; - v1_new->location[2] = v1->location[2]; - v1_new->x = v1->x; - v1_new->y = v1->y; - v1_new->shadow_vertex = v1; - v1->shadow_vertex = v1_new; - v1_new->next = v1->next; - v1_new->previous = v1; - v1->next->previous = v1_new; - v1->next = v1_new; - v2_new->edge_flag = GL_TRUE; - v2_new->data = v2->data; - v2_new->location[0] = v2->location[0]; - v2_new->location[1] = v2->location[1]; - v2_new->location[2] = v2->location[2]; - v2_new->x = v2->x; - v2_new->y = v2->y; - v2_new->shadow_vertex = v2; - v2->shadow_vertex = v2_new; - v2_new->next = v2->next; - v2_new->previous = v2; - v2->next->previous = v2_new; - v2->next = v2_new; - /* link together the two lists */ - v1->next = v2_new; - v2_new->previous = v1; - v2->next = v1_new; - v1_new->previous = v2; - /* update the vertex count of the contour */ - contour->vertex_cnt += hole->vertex_cnt + 2; - /* remove the INTERIOR contour */ - contour->next = hole->next; - if (hole->next != NULL) - hole->next->previous = contour; - free(hole); - /* update tobj structure */ - --(tobj->contour_cnt); - if (contour->last_vertex == v1) - contour->last_vertex = v1_new; - /* mark two vertices with edge_flag */ - v2->edge_flag = GL_FALSE; - v1->edge_flag = GL_FALSE; - return GLU_NO_ERROR; -} diff --git a/src/glu/mesa/project.c b/src/glu/mesa/project.c deleted file mode 100644 index 2e79cdf084..0000000000 --- a/src/glu/mesa/project.c +++ /dev/null @@ -1,403 +0,0 @@ - -/* - * Mesa 3-D graphics library - * Version: 3.3 - * Copyright (C) 1995-2000 Brian Paul - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the Free - * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - - -#ifdef PC_HEADER -#include "all.h" -#else -#include -#include -#include -#include "gluP.h" -#endif - - -/* - * This code was contributed by Marc Buffat (buffat@mecaflu.ec-lyon.fr). - * Thanks Marc!!! - */ - - - -/* implementation de gluProject et gluUnproject */ -/* M. Buffat 17/2/95 */ - - - -/* - * Transform a point (column vector) by a 4x4 matrix. I.e. out = m * in - * Input: m - the 4x4 matrix - * in - the 4x1 vector - * Output: out - the resulting 4x1 vector. - */ -static void -transform_point(GLdouble out[4], const GLdouble m[16], const GLdouble in[4]) -{ -#define M(row,col) m[col*4+row] - out[0] = - M(0, 0) * in[0] + M(0, 1) * in[1] + M(0, 2) * in[2] + M(0, 3) * in[3]; - out[1] = - M(1, 0) * in[0] + M(1, 1) * in[1] + M(1, 2) * in[2] + M(1, 3) * in[3]; - out[2] = - M(2, 0) * in[0] + M(2, 1) * in[1] + M(2, 2) * in[2] + M(2, 3) * in[3]; - out[3] = - M(3, 0) * in[0] + M(3, 1) * in[1] + M(3, 2) * in[2] + M(3, 3) * in[3]; -#undef M -} - - - - -/* - * Perform a 4x4 matrix multiplication (product = a x b). - * Input: a, b - matrices to multiply - * Output: product - product of a and b - */ -static void -matmul(GLdouble * product, const GLdouble * a, const GLdouble * b) -{ - /* This matmul was contributed by Thomas Malik */ - GLdouble temp[16]; - GLint i; - -#define A(row,col) a[(col<<2)+row] -#define B(row,col) b[(col<<2)+row] -#define T(row,col) temp[(col<<2)+row] - - /* i-te Zeile */ - for (i = 0; i < 4; i++) { - T(i, 0) = - A(i, 0) * B(0, 0) + A(i, 1) * B(1, 0) + A(i, 2) * B(2, 0) + A(i, - 3) * - B(3, 0); - T(i, 1) = - A(i, 0) * B(0, 1) + A(i, 1) * B(1, 1) + A(i, 2) * B(2, 1) + A(i, - 3) * - B(3, 1); - T(i, 2) = - A(i, 0) * B(0, 2) + A(i, 1) * B(1, 2) + A(i, 2) * B(2, 2) + A(i, - 3) * - B(3, 2); - T(i, 3) = - A(i, 0) * B(0, 3) + A(i, 1) * B(1, 3) + A(i, 2) * B(2, 3) + A(i, - 3) * - B(3, 3); - } - -#undef A -#undef B -#undef T - MEMCPY(product, temp, 16 * sizeof(GLdouble)); -} - - - -/* - * Compute inverse of 4x4 transformation matrix. - * Code contributed by Jacques Leroy jle@star.be - * Return GL_TRUE for success, GL_FALSE for failure (singular matrix) - */ -static GLboolean -invert_matrix(const GLdouble * m, GLdouble * out) -{ -/* NB. OpenGL Matrices are COLUMN major. */ -#define SWAP_ROWS(a, b) { GLdouble *_tmp = a; (a)=(b); (b)=_tmp; } -#define MAT(m,r,c) (m)[(c)*4+(r)] - - GLdouble wtmp[4][8]; - GLdouble m0, m1, m2, m3, s; - GLdouble *r0, *r1, *r2, *r3; - - r0 = wtmp[0], r1 = wtmp[1], r2 = wtmp[2], r3 = wtmp[3]; - - r0[0] = MAT(m, 0, 0), r0[1] = MAT(m, 0, 1), - r0[2] = MAT(m, 0, 2), r0[3] = MAT(m, 0, 3), - r0[4] = 1.0, r0[5] = r0[6] = r0[7] = 0.0, - r1[0] = MAT(m, 1, 0), r1[1] = MAT(m, 1, 1), - r1[2] = MAT(m, 1, 2), r1[3] = MAT(m, 1, 3), - r1[5] = 1.0, r1[4] = r1[6] = r1[7] = 0.0, - r2[0] = MAT(m, 2, 0), r2[1] = MAT(m, 2, 1), - r2[2] = MAT(m, 2, 2), r2[3] = MAT(m, 2, 3), - r2[6] = 1.0, r2[4] = r2[5] = r2[7] = 0.0, - r3[0] = MAT(m, 3, 0), r3[1] = MAT(m, 3, 1), - r3[2] = MAT(m, 3, 2), r3[3] = MAT(m, 3, 3), - r3[7] = 1.0, r3[4] = r3[5] = r3[6] = 0.0; - - /* choose pivot - or die */ - if (fabs(r3[0]) > fabs(r2[0])) - SWAP_ROWS(r3, r2); - if (fabs(r2[0]) > fabs(r1[0])) - SWAP_ROWS(r2, r1); - if (fabs(r1[0]) > fabs(r0[0])) - SWAP_ROWS(r1, r0); - if (0.0 == r0[0]) - return GL_FALSE; - - /* eliminate first variable */ - m1 = r1[0] / r0[0]; - m2 = r2[0] / r0[0]; - m3 = r3[0] / r0[0]; - s = r0[1]; - r1[1] -= m1 * s; - r2[1] -= m2 * s; - r3[1] -= m3 * s; - s = r0[2]; - r1[2] -= m1 * s; - r2[2] -= m2 * s; - r3[2] -= m3 * s; - s = r0[3]; - r1[3] -= m1 * s; - r2[3] -= m2 * s; - r3[3] -= m3 * s; - s = r0[4]; - if (s != 0.0) { - r1[4] -= m1 * s; - r2[4] -= m2 * s; - r3[4] -= m3 * s; - } - s = r0[5]; - if (s != 0.0) { - r1[5] -= m1 * s; - r2[5] -= m2 * s; - r3[5] -= m3 * s; - } - s = r0[6]; - if (s != 0.0) { - r1[6] -= m1 * s; - r2[6] -= m2 * s; - r3[6] -= m3 * s; - } - s = r0[7]; - if (s != 0.0) { - r1[7] -= m1 * s; - r2[7] -= m2 * s; - r3[7] -= m3 * s; - } - - /* choose pivot - or die */ - if (fabs(r3[1]) > fabs(r2[1])) - SWAP_ROWS(r3, r2); - if (fabs(r2[1]) > fabs(r1[1])) - SWAP_ROWS(r2, r1); - if (0.0 == r1[1]) - return GL_FALSE; - - /* eliminate second variable */ - m2 = r2[1] / r1[1]; - m3 = r3[1] / r1[1]; - r2[2] -= m2 * r1[2]; - r3[2] -= m3 * r1[2]; - r2[3] -= m2 * r1[3]; - r3[3] -= m3 * r1[3]; - s = r1[4]; - if (0.0 != s) { - r2[4] -= m2 * s; - r3[4] -= m3 * s; - } - s = r1[5]; - if (0.0 != s) { - r2[5] -= m2 * s; - r3[5] -= m3 * s; - } - s = r1[6]; - if (0.0 != s) { - r2[6] -= m2 * s; - r3[6] -= m3 * s; - } - s = r1[7]; - if (0.0 != s) { - r2[7] -= m2 * s; - r3[7] -= m3 * s; - } - - /* choose pivot - or die */ - if (fabs(r3[2]) > fabs(r2[2])) - SWAP_ROWS(r3, r2); - if (0.0 == r2[2]) - return GL_FALSE; - - /* eliminate third variable */ - m3 = r3[2] / r2[2]; - r3[3] -= m3 * r2[3], r3[4] -= m3 * r2[4], - r3[5] -= m3 * r2[5], r3[6] -= m3 * r2[6], r3[7] -= m3 * r2[7]; - - /* last check */ - if (0.0 == r3[3]) - return GL_FALSE; - - s = 1.0 / r3[3]; /* now back substitute row 3 */ - r3[4] *= s; - r3[5] *= s; - r3[6] *= s; - r3[7] *= s; - - m2 = r2[3]; /* now back substitute row 2 */ - s = 1.0 / r2[2]; - r2[4] = s * (r2[4] - r3[4] * m2), r2[5] = s * (r2[5] - r3[5] * m2), - r2[6] = s * (r2[6] - r3[6] * m2), r2[7] = s * (r2[7] - r3[7] * m2); - m1 = r1[3]; - r1[4] -= r3[4] * m1, r1[5] -= r3[5] * m1, - r1[6] -= r3[6] * m1, r1[7] -= r3[7] * m1; - m0 = r0[3]; - r0[4] -= r3[4] * m0, r0[5] -= r3[5] * m0, - r0[6] -= r3[6] * m0, r0[7] -= r3[7] * m0; - - m1 = r1[2]; /* now back substitute row 1 */ - s = 1.0 / r1[1]; - r1[4] = s * (r1[4] - r2[4] * m1), r1[5] = s * (r1[5] - r2[5] * m1), - r1[6] = s * (r1[6] - r2[6] * m1), r1[7] = s * (r1[7] - r2[7] * m1); - m0 = r0[2]; - r0[4] -= r2[4] * m0, r0[5] -= r2[5] * m0, - r0[6] -= r2[6] * m0, r0[7] -= r2[7] * m0; - - m0 = r0[1]; /* now back substitute row 0 */ - s = 1.0 / r0[0]; - r0[4] = s * (r0[4] - r1[4] * m0), r0[5] = s * (r0[5] - r1[5] * m0), - r0[6] = s * (r0[6] - r1[6] * m0), r0[7] = s * (r0[7] - r1[7] * m0); - - MAT(out, 0, 0) = r0[4]; - MAT(out, 0, 1) = r0[5], MAT(out, 0, 2) = r0[6]; - MAT(out, 0, 3) = r0[7], MAT(out, 1, 0) = r1[4]; - MAT(out, 1, 1) = r1[5], MAT(out, 1, 2) = r1[6]; - MAT(out, 1, 3) = r1[7], MAT(out, 2, 0) = r2[4]; - MAT(out, 2, 1) = r2[5], MAT(out, 2, 2) = r2[6]; - MAT(out, 2, 3) = r2[7], MAT(out, 3, 0) = r3[4]; - MAT(out, 3, 1) = r3[5], MAT(out, 3, 2) = r3[6]; - MAT(out, 3, 3) = r3[7]; - - return GL_TRUE; - -#undef MAT -#undef SWAP_ROWS -} - - - -/* projection du point (objx,objy,obz) sur l'ecran (winx,winy,winz) */ -GLint GLAPIENTRY -gluProject(GLdouble objx, GLdouble objy, GLdouble objz, - const GLdouble model[16], const GLdouble proj[16], - const GLint viewport[4], - GLdouble * winx, GLdouble * winy, GLdouble * winz) -{ - /* matrice de transformation */ - GLdouble in[4], out[4]; - - /* initilise la matrice et le vecteur a transformer */ - in[0] = objx; - in[1] = objy; - in[2] = objz; - in[3] = 1.0; - transform_point(out, model, in); - transform_point(in, proj, out); - - /* d'ou le resultat normalise entre -1 et 1 */ - if (in[3] == 0.0) - return GL_FALSE; - - in[0] /= in[3]; - in[1] /= in[3]; - in[2] /= in[3]; - - /* en coordonnees ecran */ - *winx = viewport[0] + (1 + in[0]) * viewport[2] / 2; - *winy = viewport[1] + (1 + in[1]) * viewport[3] / 2; - /* entre 0 et 1 suivant z */ - *winz = (1 + in[2]) / 2; - return GL_TRUE; -} - - - -/* transformation du point ecran (winx,winy,winz) en point objet */ -GLint GLAPIENTRY -gluUnProject(GLdouble winx, GLdouble winy, GLdouble winz, - const GLdouble model[16], const GLdouble proj[16], - const GLint viewport[4], - GLdouble * objx, GLdouble * objy, GLdouble * objz) -{ - /* matrice de transformation */ - GLdouble m[16], A[16]; - GLdouble in[4], out[4]; - - /* transformation coordonnees normalisees entre -1 et 1 */ - in[0] = (winx - viewport[0]) * 2 / viewport[2] - 1.0; - in[1] = (winy - viewport[1]) * 2 / viewport[3] - 1.0; - in[2] = 2 * winz - 1.0; - in[3] = 1.0; - - /* calcul transformation inverse */ - matmul(A, proj, model); - if (!invert_matrix(A, m)) - return GL_FALSE; - - /* d'ou les coordonnees objets */ - transform_point(out, m, in); - if (out[3] == 0.0) - return GL_FALSE; - *objx = out[0] / out[3]; - *objy = out[1] / out[3]; - *objz = out[2] / out[3]; - return GL_TRUE; -} - - -/* - * New in GLU 1.3 - * This is like gluUnProject but also takes near and far DepthRange values. - */ -#ifdef GLU_VERSION_1_3 -GLint GLAPIENTRY -gluUnProject4(GLdouble winx, GLdouble winy, GLdouble winz, GLdouble clipw, - const GLdouble modelMatrix[16], - const GLdouble projMatrix[16], - const GLint viewport[4], - GLclampd nearZ, GLclampd farZ, - GLdouble * objx, GLdouble * objy, GLdouble * objz, - GLdouble * objw) -{ - /* matrice de transformation */ - GLdouble m[16], A[16]; - GLdouble in[4], out[4]; - GLdouble z = nearZ + winz * (farZ - nearZ); - - /* transformation coordonnees normalisees entre -1 et 1 */ - in[0] = (winx - viewport[0]) * 2 / viewport[2] - 1.0; - in[1] = (winy - viewport[1]) * 2 / viewport[3] - 1.0; - in[2] = 2.0 * z - 1.0; - in[3] = clipw; - - /* calcul transformation inverse */ - matmul(A, projMatrix, modelMatrix); - if (!invert_matrix(A, m)) - return GL_FALSE; - - /* d'ou les coordonnees objets */ - transform_point(out, m, in); - if (out[3] == 0.0) - return GL_FALSE; - *objx = out[0] / out[3]; - *objy = out[1] / out[3]; - *objz = out[2] / out[3]; - *objw = out[3]; - return GL_TRUE; -} -#endif diff --git a/src/glu/mesa/quadric.c b/src/glu/mesa/quadric.c deleted file mode 100644 index 0f6889b284..0000000000 --- a/src/glu/mesa/quadric.c +++ /dev/null @@ -1,819 +0,0 @@ - -/* - * Mesa 3-D graphics library - * Version: 3.3 - * Copyright (C) 1999-2000 Brian Paul - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the Free - * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - - -/* TODO: - * texture coordinate support - * flip normals according to orientation - * there's still some inside/outside orientation bugs in possibly all - * but the sphere function - */ - - -#ifdef PC_HEADER -#include "all.h" -#else -#include -#include -#include -#include "gluP.h" -#endif - - - -#ifndef M_PI -# define M_PI (3.1415926) -#endif - - -/* - * Convert degrees to radians: - */ -#define DEG_TO_RAD(A) ((A)*(M_PI/180.0)) - - -/* - * Sin and Cos for degree angles: - */ -#define SIND( A ) sin( (A)*(M_PI/180.0) ) -#define COSD( A) cos( (A)*(M_PI/180.0) ) - - -/* - * Texture coordinates if texture flag is set - */ -#define TXTR_COORD(x,y) if (qobj->TextureFlag) glTexCoord2f(x,y); - - - -struct GLUquadric -{ - GLenum DrawStyle; /* GLU_FILL, LINE, SILHOUETTE, or POINT */ - GLenum Orientation; /* GLU_INSIDE or GLU_OUTSIDE */ - GLboolean TextureFlag; /* Generate texture coords? */ - GLenum Normals; /* GLU_NONE, GLU_FLAT, or GLU_SMOOTH */ - void (GLCALLBACK * ErrorFunc) (GLenum err); /* Error handler callback function */ -}; - - - -/* - * Process a GLU error. - */ -static void -quadric_error(GLUquadricObj * qobj, GLenum error, const char *msg) -{ - /* Call the error call back function if any */ - if (qobj->ErrorFunc) { - (*qobj->ErrorFunc) (error); - } - /* Print a message to stdout if MESA_DEBUG variable is defined */ - if (getenv("MESA_DEBUG")) { - fprintf(stderr, "GLUError: %s: %s\n", (char *) gluErrorString(error), - msg); - } -} - - - - -GLUquadricObj *GLAPIENTRY -gluNewQuadric(void) -{ - GLUquadricObj *q; - - q = (GLUquadricObj *) malloc(sizeof(struct GLUquadric)); - if (q) { - q->DrawStyle = GLU_FILL; - q->Orientation = GLU_OUTSIDE; - q->TextureFlag = GL_FALSE; - q->Normals = GLU_SMOOTH; - q->ErrorFunc = NULL; - } - return q; -} - - - -void GLAPIENTRY -gluDeleteQuadric(GLUquadricObj * state) -{ - if (state) { - free((void *) state); - } -} - - - -/* - * Set the drawing style to be GLU_FILL, GLU_LINE, GLU_SILHOUETTE, - * or GLU_POINT. - */ -void GLAPIENTRY -gluQuadricDrawStyle(GLUquadricObj * quadObject, GLenum drawStyle) -{ - if (quadObject && (drawStyle == GLU_FILL || drawStyle == GLU_LINE - || drawStyle == GLU_SILHOUETTE - || drawStyle == GLU_POINT)) { - quadObject->DrawStyle = drawStyle; - } - else { - quadric_error(quadObject, GLU_INVALID_ENUM, "qluQuadricDrawStyle"); - } -} - - - -/* - * Set the orientation to GLU_INSIDE or GLU_OUTSIDE. - */ -void GLAPIENTRY -gluQuadricOrientation(GLUquadricObj * quadObject, GLenum orientation) -{ - if (quadObject - && (orientation == GLU_INSIDE || orientation == GLU_OUTSIDE)) { - quadObject->Orientation = orientation; - } - else { - quadric_error(quadObject, GLU_INVALID_ENUM, "qluQuadricOrientation"); - } -} - - - -/* - * Set the error handler callback function. - */ -void GLAPIENTRY -gluQuadricCallback(GLUquadricObj * qobj, - GLenum which, void (GLCALLBACK * fn) ()) -{ - /* - * UGH, this is a mess! I thought ANSI was a standard. - */ - if (qobj && which == GLU_ERROR) { -#ifdef __CYGWIN32__ - qobj->ErrorFunc = (void (GLCALLBACKPCAST) (GLenum)) fn; -#elif defined(OPENSTEP) - qobj->ErrorFunc = (void (*)(GLenum)) fn; -#elif defined(_WIN32) - qobj->ErrorFunc = (void (GLCALLBACK *) (int)) fn; -#elif defined(__STORM__) - qobj->ErrorFunc = (void (GLCALLBACK *) (GLenum)) fn; -#elif defined(__BEOS__) - qobj->ErrorFunc = (void (*)(GLenum)) fn; -#else - qobj->ErrorFunc = (void (GLCALLBACK *) ()) fn; -#endif - } -} - - -void GLAPIENTRY -gluQuadricNormals(GLUquadricObj * quadObject, GLenum normals) -{ - if (quadObject - && (normals == GLU_NONE || normals == GLU_FLAT - || normals == GLU_SMOOTH)) { - quadObject->Normals = normals; - } -} - - -void GLAPIENTRY -gluQuadricTexture(GLUquadricObj * quadObject, GLboolean textureCoords) -{ - if (quadObject) { - quadObject->TextureFlag = textureCoords; - } -} - - - - -/* - * Call glNormal3f after scaling normal to unit length. - */ -static void -normal3f(GLfloat x, GLfloat y, GLfloat z) -{ - GLdouble mag; - - mag = sqrt(x * x + y * y + z * z); - if (mag > 0.00001F) { - x /= mag; - y /= mag; - z /= mag; - } - glNormal3f(x, y, z); -} - - - -void GLAPIENTRY -gluCylinder(GLUquadricObj * qobj, - GLdouble baseRadius, GLdouble topRadius, - GLdouble height, GLint slices, GLint stacks) -{ - GLdouble da, r, dr, dz; - GLfloat x, y, z, nz, nsign; - GLint i, j; - - if (qobj->Orientation == GLU_INSIDE) { - nsign = -1.0; - } - else { - nsign = 1.0; - } - - da = 2.0 * M_PI / slices; - dr = (topRadius - baseRadius) / stacks; - dz = height / stacks; - nz = (baseRadius - topRadius) / height; /* Z component of normal vectors */ - - if (qobj->DrawStyle == GLU_POINT) { - glBegin(GL_POINTS); - for (i = 0; i < slices; i++) { - x = cos(i * da); - y = sin(i * da); - normal3f(x * nsign, y * nsign, nz * nsign); - - z = 0.0; - r = baseRadius; - for (j = 0; j <= stacks; j++) { - glVertex3f(x * r, y * r, z); - z += dz; - r += dr; - } - } - glEnd(); - } - else if (qobj->DrawStyle == GLU_LINE || qobj->DrawStyle == GLU_SILHOUETTE) { - /* Draw rings */ - if (qobj->DrawStyle == GLU_LINE) { - z = 0.0; - r = baseRadius; - for (j = 0; j <= stacks; j++) { - glBegin(GL_LINE_LOOP); - for (i = 0; i < slices; i++) { - x = cos(i * da); - y = sin(i * da); - normal3f(x * nsign, y * nsign, nz * nsign); - glVertex3f(x * r, y * r, z); - } - glEnd(); - z += dz; - r += dr; - } - } - else { - /* draw one ring at each end */ - if (baseRadius != 0.0) { - glBegin(GL_LINE_LOOP); - for (i = 0; i < slices; i++) { - x = cos(i * da); - y = sin(i * da); - normal3f(x * nsign, y * nsign, nz * nsign); - glVertex3f(x * baseRadius, y * baseRadius, 0.0); - } - glEnd(); - glBegin(GL_LINE_LOOP); - for (i = 0; i < slices; i++) { - x = cos(i * da); - y = sin(i * da); - normal3f(x * nsign, y * nsign, nz * nsign); - glVertex3f(x * topRadius, y * topRadius, height); - } - glEnd(); - } - } - /* draw length lines */ - glBegin(GL_LINES); - for (i = 0; i < slices; i++) { - x = cos(i * da); - y = sin(i * da); - normal3f(x * nsign, y * nsign, nz * nsign); - glVertex3f(x * baseRadius, y * baseRadius, 0.0); - glVertex3f(x * topRadius, y * topRadius, height); - } - glEnd(); - } - else if (qobj->DrawStyle == GLU_FILL) { - GLfloat ds = 1.0 / slices; - GLfloat dt = 1.0 / stacks; - GLfloat t = 0.0; - z = 0.0; - r = baseRadius; - for (j = 0; j < stacks; j++) { - GLfloat s = 0.0; - glBegin(GL_QUAD_STRIP); - for (i = 0; i <= slices; i++) { - GLfloat x, y; - if (i == slices) { - x = sin(0.0); - y = cos(0.0); - } - else { - x = sin(i * da); - y = cos(i * da); - } - if (nsign == 1.0) { - normal3f(x * nsign, y * nsign, nz * nsign); - TXTR_COORD(s, t); - glVertex3f(x * r, y * r, z); - normal3f(x * nsign, y * nsign, nz * nsign); - TXTR_COORD(s, t + dt); - glVertex3f(x * (r + dr), y * (r + dr), z + dz); - } - else { - normal3f(x * nsign, y * nsign, nz * nsign); - TXTR_COORD(s, t); - glVertex3f(x * r, y * r, z); - normal3f(x * nsign, y * nsign, nz * nsign); - TXTR_COORD(s, t + dt); - glVertex3f(x * (r + dr), y * (r + dr), z + dz); - } - s += ds; - } /* for slices */ - glEnd(); - r += dr; - t += dt; - z += dz; - } /* for stacks */ - } -} - - - - - -void GLAPIENTRY -gluSphere(GLUquadricObj * qobj, GLdouble radius, GLint slices, GLint stacks) -{ - GLfloat rho, drho, theta, dtheta; - GLfloat x, y, z; - GLfloat s, t, ds, dt; - GLint i, j, imin, imax; - GLboolean normals; - GLfloat nsign; - - if (qobj->Normals == GLU_NONE) { - normals = GL_FALSE; - } - else { - normals = GL_TRUE; - } - if (qobj->Orientation == GLU_INSIDE) { - nsign = -1.0; - } - else { - nsign = 1.0; - } - - drho = M_PI / (GLfloat) stacks; - dtheta = 2.0 * M_PI / (GLfloat) slices; - - /* texturing: s goes from 0.0/0.25/0.5/0.75/1.0 at +y/+x/-y/-x/+y axis */ - /* t goes from -1.0/+1.0 at z = -radius/+radius (linear along longitudes) */ - /* cannot use triangle fan on texturing (s coord. at top/bottom tip varies) */ - - if (qobj->DrawStyle == GLU_FILL) { - if (!qobj->TextureFlag) { - /* draw +Z end as a triangle fan */ - glBegin(GL_TRIANGLE_FAN); - glNormal3f(0.0, 0.0, 1.0); - glVertex3f(0.0, 0.0, nsign * radius); - for (j = 0; j <= slices; j++) { - theta = (j == slices) ? 0.0 : j * dtheta; - x = -sin(theta) * sin(drho); - y = cos(theta) * sin(drho); - z = nsign * cos(drho); - if (normals) - glNormal3f(x * nsign, y * nsign, z * nsign); - glVertex3f(x * radius, y * radius, z * radius); - } - glEnd(); - } - - ds = 1.0 / slices; - dt = 1.0 / stacks; - t = 1.0; /* because loop now runs from 0 */ - if (qobj->TextureFlag) { - imin = 0; - imax = stacks; - } - else { - imin = 1; - imax = stacks - 1; - } - - /* draw intermediate stacks as quad strips */ - for (i = imin; i < imax; i++) { - rho = i * drho; - glBegin(GL_QUAD_STRIP); - s = 0.0; - for (j = 0; j <= slices; j++) { - theta = (j == slices) ? 0.0 : j * dtheta; - x = -sin(theta) * sin(rho); - y = cos(theta) * sin(rho); - z = nsign * cos(rho); - if (normals) - glNormal3f(x * nsign, y * nsign, z * nsign); - TXTR_COORD(s, t); - glVertex3f(x * radius, y * radius, z * radius); - x = -sin(theta) * sin(rho + drho); - y = cos(theta) * sin(rho + drho); - z = nsign * cos(rho + drho); - if (normals) - glNormal3f(x * nsign, y * nsign, z * nsign); - TXTR_COORD(s, t - dt); - s += ds; - glVertex3f(x * radius, y * radius, z * radius); - } - glEnd(); - t -= dt; - } - - if (!qobj->TextureFlag) { - /* draw -Z end as a triangle fan */ - glBegin(GL_TRIANGLE_FAN); - glNormal3f(0.0, 0.0, -1.0); - glVertex3f(0.0, 0.0, -radius * nsign); - rho = M_PI - drho; - s = 1.0; - t = dt; - for (j = slices; j >= 0; j--) { - theta = (j == slices) ? 0.0 : j * dtheta; - x = -sin(theta) * sin(rho); - y = cos(theta) * sin(rho); - z = nsign * cos(rho); - if (normals) - glNormal3f(x * nsign, y * nsign, z * nsign); - s -= ds; - glVertex3f(x * radius, y * radius, z * radius); - } - glEnd(); - } - } - else if (qobj->DrawStyle == GLU_LINE || qobj->DrawStyle == GLU_SILHOUETTE) { - /* draw stack lines */ - for (i = 1; i < stacks; i++) { /* stack line at i==stacks-1 was missing here */ - rho = i * drho; - glBegin(GL_LINE_LOOP); - for (j = 0; j < slices; j++) { - theta = j * dtheta; - x = cos(theta) * sin(rho); - y = sin(theta) * sin(rho); - z = cos(rho); - if (normals) - glNormal3f(x * nsign, y * nsign, z * nsign); - glVertex3f(x * radius, y * radius, z * radius); - } - glEnd(); - } - /* draw slice lines */ - for (j = 0; j < slices; j++) { - theta = j * dtheta; - glBegin(GL_LINE_STRIP); - for (i = 0; i <= stacks; i++) { - rho = i * drho; - x = cos(theta) * sin(rho); - y = sin(theta) * sin(rho); - z = cos(rho); - if (normals) - glNormal3f(x * nsign, y * nsign, z * nsign); - glVertex3f(x * radius, y * radius, z * radius); - } - glEnd(); - } - } - else if (qobj->DrawStyle == GLU_POINT) { - /* top and bottom-most points */ - glBegin(GL_POINTS); - if (normals) - glNormal3f(0.0, 0.0, nsign); - glVertex3d(0.0, 0.0, radius); - if (normals) - glNormal3f(0.0, 0.0, -nsign); - glVertex3d(0.0, 0.0, -radius); - - /* loop over stacks */ - for (i = 1; i < stacks - 1; i++) { - rho = i * drho; - for (j = 0; j < slices; j++) { - theta = j * dtheta; - x = cos(theta) * sin(rho); - y = sin(theta) * sin(rho); - z = cos(rho); - if (normals) - glNormal3f(x * nsign, y * nsign, z * nsign); - glVertex3f(x * radius, y * radius, z * radius); - } - } - glEnd(); - } - -} - - - -void GLAPIENTRY -gluDisk(GLUquadricObj * qobj, - GLdouble innerRadius, GLdouble outerRadius, GLint slices, GLint loops) -{ - GLfloat da, dr; -#if 0 - GLdouble a, da; - GLfloat r, dr; - GLfloat x, y; - GLfloat r1, r2, dtc; - GLint s, l; -#endif - - /* Normal vectors */ - if (qobj->Normals != GLU_NONE) { - if (qobj->Orientation == GLU_OUTSIDE) { - glNormal3f(0.0, 0.0, +1.0); - } - else { - glNormal3f(0.0, 0.0, -1.0); - } - } - - da = 2.0 * M_PI / slices; - dr = (outerRadius - innerRadius) / (GLfloat) loops; - - switch (qobj->DrawStyle) { - case GLU_FILL: - { - /* texture of a gluDisk is a cut out of the texture unit square - * x, y in [-outerRadius, +outerRadius]; s, t in [0, 1] - * (linear mapping) - */ - GLfloat dtc = 2.0f * outerRadius; - GLfloat sa, ca; - GLfloat r1 = innerRadius; - GLint l; - for (l = 0; l < loops; l++) { - GLfloat r2 = r1 + dr; - if (qobj->Orientation == GLU_OUTSIDE) { - GLint s; - glBegin(GL_QUAD_STRIP); - for (s = 0; s <= slices; s++) { - GLfloat a; - if (s == slices) - a = 0.0; - else - a = s * da; - sa = sin(a); - ca = cos(a); - TXTR_COORD(0.5 + sa * r2 / dtc, 0.5 + ca * r2 / dtc); - glVertex2f(r2 * sa, r2 * ca); - TXTR_COORD(0.5 + sa * r1 / dtc, 0.5 + ca * r1 / dtc); - glVertex2f(r1 * sa, r1 * ca); - } - glEnd(); - } - else { - GLint s; - glBegin(GL_QUAD_STRIP); - for (s = slices; s >= 0; s--) { - GLfloat a; - if (s == slices) - a = 0.0; - else - a = s * da; - sa = sin(a); - ca = cos(a); - TXTR_COORD(0.5 - sa * r2 / dtc, 0.5 + ca * r2 / dtc); - glVertex2f(r2 * sa, r2 * ca); - TXTR_COORD(0.5 - sa * r1 / dtc, 0.5 + ca * r1 / dtc); - glVertex2f(r1 * sa, r1 * ca); - } - glEnd(); - } - r1 = r2; - } - break; - } - case GLU_LINE: - { - GLint l, s; - /* draw loops */ - for (l = 0; l <= loops; l++) { - GLfloat r = innerRadius + l * dr; - glBegin(GL_LINE_LOOP); - for (s = 0; s < slices; s++) { - GLfloat a = s * da; - glVertex2f(r * sin(a), r * cos(a)); - } - glEnd(); - } - /* draw spokes */ - for (s = 0; s < slices; s++) { - GLfloat a = s * da; - GLfloat x = sin(a); - GLfloat y = cos(a); - glBegin(GL_LINE_STRIP); - for (l = 0; l <= loops; l++) { - GLfloat r = innerRadius + l * dr; - glVertex2f(r * x, r * y); - } - glEnd(); - } - break; - } - case GLU_POINT: - { - GLint s; - glBegin(GL_POINTS); - for (s = 0; s < slices; s++) { - GLfloat a = s * da; - GLfloat x = sin(a); - GLfloat y = cos(a); - GLint l; - for (l = 0; l <= loops; l++) { - GLfloat r = innerRadius * l * dr; - glVertex2f(r * x, r * y); - } - } - glEnd(); - break; - } - case GLU_SILHOUETTE: - { - if (innerRadius != 0.0) { - GLfloat a; - glBegin(GL_LINE_LOOP); - for (a = 0.0; a < 2.0 * M_PI; a += da) { - GLfloat x = innerRadius * sin(a); - GLfloat y = innerRadius * cos(a); - glVertex2f(x, y); - } - glEnd(); - } - { - GLfloat a; - glBegin(GL_LINE_LOOP); - for (a = 0; a < 2.0 * M_PI; a += da) { - GLfloat x = outerRadius * sin(a); - GLfloat y = outerRadius * cos(a); - glVertex2f(x, y); - } - glEnd(); - } - break; - } - default: - abort(); - } -} - - - -void GLAPIENTRY -gluPartialDisk(GLUquadricObj * qobj, GLdouble innerRadius, - GLdouble outerRadius, GLint slices, GLint loops, - GLdouble startAngle, GLdouble sweepAngle) -{ - if (qobj->Normals != GLU_NONE) { - if (qobj->Orientation == GLU_OUTSIDE) { - glNormal3f(0.0, 0.0, +1.0); - } - else { - glNormal3f(0.0, 0.0, -1.0); - } - } - - if (qobj->DrawStyle == GLU_POINT) { - GLint loop, slice; - GLdouble radius, delta_radius; - GLdouble angle, delta_angle; - delta_radius = (outerRadius - innerRadius) / (loops - 1); - delta_angle = DEG_TO_RAD((sweepAngle) / (slices - 1)); - glBegin(GL_POINTS); - radius = innerRadius; - for (loop = 0; loop < loops; loop++) { - angle = DEG_TO_RAD(startAngle); - for (slice = 0; slice < slices; slice++) { - glVertex2d(radius * sin(angle), radius * cos(angle)); - angle += delta_angle; - } - radius += delta_radius; - } - glEnd(); - } - else if (qobj->DrawStyle == GLU_LINE) { - GLint loop, slice; - GLdouble radius, delta_radius; - GLdouble angle, delta_angle; - delta_radius = (outerRadius - innerRadius) / loops; - delta_angle = DEG_TO_RAD(sweepAngle / slices); - /* draw rings */ - radius = innerRadius; - for (loop = 0; loop < loops; loop++) { - angle = DEG_TO_RAD(startAngle); - glBegin(GL_LINE_STRIP); - for (slice = 0; slice <= slices; slice++) { - glVertex2d(radius * sin(angle), radius * cos(angle)); - angle += delta_angle; - } - glEnd(); - radius += delta_radius; - } - /* draw spokes */ - angle = DEG_TO_RAD(startAngle); - for (slice = 0; slice <= slices; slice++) { - radius = innerRadius; - glBegin(GL_LINE_STRIP); - for (loop = 0; loop < loops; loop++) { - glVertex2d(radius * sin(angle), radius * cos(angle)); - radius += delta_radius; - } - glEnd(); - angle += delta_angle; - } - } - else if (qobj->DrawStyle == GLU_SILHOUETTE) { - GLint slice; - GLdouble angle, delta_angle; - delta_angle = DEG_TO_RAD(sweepAngle / slices); - /* draw outer ring */ - glBegin(GL_LINE_STRIP); - angle = DEG_TO_RAD(startAngle); - for (slice = 0; slice <= slices; slice++) { - glVertex2d(outerRadius * sin(angle), outerRadius * cos(angle)); - angle += delta_angle; - } - glEnd(); - /* draw inner ring */ - if (innerRadius > 0.0) { - glBegin(GL_LINE_STRIP); - angle = DEG_TO_RAD(startAngle); - for (slice = 0; slice < slices; slice++) { - glVertex2d(innerRadius * sin(angle), innerRadius * cos(angle)); - angle += delta_angle; - } - glEnd(); - } - /* draw spokes */ - if (sweepAngle < 360.0) { - GLdouble stopAngle = startAngle + sweepAngle; - glBegin(GL_LINES); - glVertex2d(innerRadius * SIND(startAngle), - innerRadius * COSD(startAngle)); - glVertex2d(outerRadius * SIND(startAngle), - outerRadius * COSD(startAngle)); - glVertex2d(innerRadius * SIND(stopAngle), - innerRadius * COSD(stopAngle)); - glVertex2d(outerRadius * SIND(stopAngle), - outerRadius * COSD(stopAngle)); - glEnd(); - } - } - else if (qobj->DrawStyle == GLU_FILL) { - GLint loop, slice; - GLdouble radius, delta_radius; - GLdouble angle, delta_angle; - delta_radius = (outerRadius - innerRadius) / loops; - delta_angle = DEG_TO_RAD(sweepAngle / slices); - radius = innerRadius; - for (loop = 0; loop < loops; loop++) { - glBegin(GL_QUAD_STRIP); - angle = DEG_TO_RAD(startAngle); - for (slice = 0; slice <= slices; slice++) { - if (qobj->Orientation == GLU_OUTSIDE) { - glVertex2d((radius + delta_radius) * sin(angle), - (radius + delta_radius) * cos(angle)); - glVertex2d(radius * sin(angle), radius * cos(angle)); - } - else { - glVertex2d(radius * sin(angle), radius * cos(angle)); - glVertex2d((radius + delta_radius) * sin(angle), - (radius + delta_radius) * cos(angle)); - } - angle += delta_angle; - } - glEnd(); - radius += delta_radius; - } - } -} diff --git a/src/glu/mesa/tess.c b/src/glu/mesa/tess.c deleted file mode 100644 index 341d29bae3..0000000000 --- a/src/glu/mesa/tess.c +++ /dev/null @@ -1,327 +0,0 @@ - -/* - * Mesa 3-D graphics library - * Version: 3.3 - * Copyright (C) 1995-2000 Brian Paul - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the Free - * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - - -/* - * This file is part of the polygon tesselation code contributed by - * Bogdan Sikorski - */ - - -#ifdef PC_HEADER -#include "all.h" -#else -#include -#include -#include "tess.h" -#endif - - -/* - * This is ugly, but seems the easiest way to do things to make the - * code work under YellowBox for Windows - */ -#if defined(OPENSTEP) && defined(CALLBACK) -#undef CALLBACK -#define CALLBACK -#endif - - -static void delete_contours(GLUtriangulatorObj *); - -#ifdef __CYGWIN32__ -#define _CALLBACK -#else -#define _CALLBACK GLCALLBACK -#endif - - -static void -init_callbacks(tess_callbacks * callbacks) -{ - callbacks->begin = (void (_CALLBACK *) (GLenum)) 0; - callbacks->edgeFlag = (void (_CALLBACK *) (GLboolean)) 0; - callbacks->vertex = (void (_CALLBACK *) (void *)) 0; - callbacks->end = (void (_CALLBACK *) (void)) 0; - callbacks->error = (void (_CALLBACK *) (GLenum)) 0; -} - -void -tess_call_user_error(GLUtriangulatorObj * tobj, GLenum gluerr) -{ - if (tobj->error == GLU_NO_ERROR) - tobj->error = gluerr; - if (tobj->callbacks.error != NULL) - (tobj->callbacks.error) (gluerr); -} - -GLUtriangulatorObj *GLAPIENTRY -gluNewTess(void) -{ - GLUtriangulatorObj *tobj; - - if ((tobj = (GLUtriangulatorObj *) - malloc(sizeof(struct GLUtesselator))) == NULL) - return NULL; - tobj->contours = tobj->last_contour = NULL; - init_callbacks(&tobj->callbacks); - tobj->error = GLU_NO_ERROR; - tobj->current_polygon = NULL; - tobj->contour_cnt = 0; - return tobj; -} - - -void GLAPIENTRY -gluTessCallback(GLUtriangulatorObj * tobj, GLenum which, - void (GLCALLBACK * fn) ()) -{ - switch (which) { - case GLU_BEGIN: - tobj->callbacks.begin = (void (_CALLBACK *) (GLenum)) fn; - break; - case GLU_EDGE_FLAG: - tobj->callbacks.edgeFlag = (void (_CALLBACK *) (GLboolean)) fn; - break; - case GLU_VERTEX: - tobj->callbacks.vertex = (void (_CALLBACK *) (void *)) fn; - break; - case GLU_END: - tobj->callbacks.end = (void (_CALLBACK *) (void)) fn; - break; - case GLU_ERROR: - tobj->callbacks.error = (void (_CALLBACK *) (GLenum)) fn; - break; - default: - tobj->error = GLU_INVALID_ENUM; - break; - } -} - - - -void GLAPIENTRY -gluDeleteTess(GLUtriangulatorObj * tobj) -{ - if (tobj->error == GLU_NO_ERROR && tobj->contour_cnt) - /* was gluEndPolygon called? */ - tess_call_user_error(tobj, GLU_TESS_ERROR1); - /* delete all internal structures */ - delete_contours(tobj); - free(tobj); -} - - -void GLAPIENTRY -gluBeginPolygon(GLUtriangulatorObj * tobj) -{ -/* - if(tobj->error!=GLU_NO_ERROR) - return; -*/ - tobj->error = GLU_NO_ERROR; - if (tobj->current_polygon != NULL) { - /* gluEndPolygon was not called */ - tess_call_user_error(tobj, GLU_TESS_ERROR1); - /* delete all internal structures */ - delete_contours(tobj); - } - else { - if ((tobj->current_polygon = - (tess_polygon *) malloc(sizeof(tess_polygon))) == NULL) { - tess_call_user_error(tobj, GLU_OUT_OF_MEMORY); - return; - } - tobj->current_polygon->vertex_cnt = 0; - tobj->current_polygon->vertices = - tobj->current_polygon->last_vertex = NULL; - } -} - - -void GLAPIENTRY -gluEndPolygon(GLUtriangulatorObj * tobj) -{ - /*tess_contour *contour_ptr; */ - - /* there was an error */ - if (tobj->error != GLU_NO_ERROR) - goto end; - - /* check if gluBeginPolygon was called */ - if (tobj->current_polygon == NULL) { - tess_call_user_error(tobj, GLU_TESS_ERROR2); - return; - } - tess_test_polygon(tobj); - /* there was an error */ - if (tobj->error != GLU_NO_ERROR) - goto end; - - /* any real contours? */ - if (tobj->contour_cnt == 0) { - /* delete all internal structures */ - delete_contours(tobj); - return; - } - tess_find_contour_hierarchies(tobj); - /* there was an error */ - if (tobj->error != GLU_NO_ERROR) - goto end; - - tess_handle_holes(tobj); - /* there was an error */ - if (tobj->error != GLU_NO_ERROR) - goto end; - - /* if no callbacks, nothing to do */ - if (tobj->callbacks.begin != NULL && tobj->callbacks.vertex != NULL && - tobj->callbacks.end != NULL) { - if (tobj->callbacks.edgeFlag == NULL) - tess_tesselate(tobj); - else - tess_tesselate_with_edge_flag(tobj); - } - - end: - /* delete all internal structures */ - delete_contours(tobj); -} - - -void GLAPIENTRY -gluNextContour(GLUtriangulatorObj * tobj, GLenum type) -{ - if (tobj->error != GLU_NO_ERROR) - return; - if (tobj->current_polygon == NULL) { - tess_call_user_error(tobj, GLU_TESS_ERROR2); - return; - } - /* first contour? */ - if (tobj->current_polygon->vertex_cnt) - tess_test_polygon(tobj); -} - - -void GLAPIENTRY -gluTessVertex(GLUtriangulatorObj * tobj, GLdouble v[3], void *data) -{ - tess_polygon *polygon = tobj->current_polygon; - tess_vertex *last_vertex_ptr; - - if (tobj->error != GLU_NO_ERROR) - return; - if (polygon == NULL) { - tess_call_user_error(tobj, GLU_TESS_ERROR2); - return; - } - last_vertex_ptr = polygon->last_vertex; - if (last_vertex_ptr == NULL) { - if ((last_vertex_ptr = (tess_vertex *) - malloc(sizeof(tess_vertex))) == NULL) { - tess_call_user_error(tobj, GLU_OUT_OF_MEMORY); - return; - } - polygon->vertices = last_vertex_ptr; - polygon->last_vertex = last_vertex_ptr; - last_vertex_ptr->data = data; - last_vertex_ptr->location[0] = v[0]; - last_vertex_ptr->location[1] = v[1]; - last_vertex_ptr->location[2] = v[2]; - last_vertex_ptr->next = NULL; - last_vertex_ptr->previous = NULL; - ++(polygon->vertex_cnt); - } - else { - tess_vertex *vertex_ptr; - - /* same point twice? */ - if (fabs(last_vertex_ptr->location[0] - v[0]) < EPSILON && - fabs(last_vertex_ptr->location[1] - v[1]) < EPSILON && - fabs(last_vertex_ptr->location[2] - v[2]) < EPSILON) { - tess_call_user_error(tobj, GLU_TESS_ERROR6); - return; - } - if ((vertex_ptr = (tess_vertex *) - malloc(sizeof(tess_vertex))) == NULL) { - tess_call_user_error(tobj, GLU_OUT_OF_MEMORY); - return; - } - vertex_ptr->data = data; - vertex_ptr->location[0] = v[0]; - vertex_ptr->location[1] = v[1]; - vertex_ptr->location[2] = v[2]; - vertex_ptr->next = NULL; - vertex_ptr->previous = last_vertex_ptr; - ++(polygon->vertex_cnt); - last_vertex_ptr->next = vertex_ptr; - polygon->last_vertex = vertex_ptr; - } -} - - -static void -delete_contours(GLUtriangulatorObj * tobj) -{ - tess_polygon *polygon = tobj->current_polygon; - tess_contour *contour, *contour_tmp; - tess_vertex *vertex, *vertex_tmp; - - /* remove current_polygon list - if exists due to detected error */ - if (polygon != NULL) { - if (polygon->vertices) { - for (vertex = polygon->vertices; vertex != polygon->last_vertex;) { - vertex_tmp = vertex->next; - free(vertex); - vertex = vertex_tmp; - } - free(vertex); - } - free(polygon); - tobj->current_polygon = NULL; - } - /* remove all contour data */ - for (contour = tobj->contours; contour != NULL;) { - for (vertex = contour->vertices; vertex != contour->last_vertex;) { - vertex_tmp = vertex->next; - free(vertex); - vertex = vertex_tmp; - } - free(vertex); - contour_tmp = contour->next; - free(contour); - contour = contour_tmp; - } - tobj->contours = tobj->last_contour = NULL; - tobj->contour_cnt = 0; -} - - -void GLAPIENTRY -gluTessNormal(GLUtesselator *tess, GLdouble valueX, GLdouble valueY, GLdouble valueZ) -{ - /* dummy function */ - (void) tess; - (void) valueX; - (void) valueY; - (void) valueZ; -} diff --git a/src/glu/mesa/tess.h b/src/glu/mesa/tess.h deleted file mode 100644 index 4e51dddd37..0000000000 --- a/src/glu/mesa/tess.h +++ /dev/null @@ -1,107 +0,0 @@ - -/* - * Mesa 3-D graphics library - * Version: 3.3 - * Copyright (C) 1995-2000 Brian Paul - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the Free - * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - - -/* - * This file is part of the polygon tesselation code contributed by - * Bogdan Sikorski - */ - - -#ifndef TESS_H -#define TESS_H - - -#include "gluP.h" - -#define EPSILON 1e-06 /* epsilon for double precision compares */ - -typedef enum -{ - OXY, - OYZ, - OXZ -} -projection_type; - -typedef struct callbacks_str -{ - void (GLCALLBACK * begin) (GLenum mode); - void (GLCALLBACK * edgeFlag) (GLboolean flag); - void (GLCALLBACK * vertex) (GLvoid * v); - void (GLCALLBACK * end) (void); - void (GLCALLBACK * error) (GLenum err); -} -tess_callbacks; - -typedef struct vertex_str -{ - void *data; - GLdouble location[3]; - GLdouble x, y; - GLboolean edge_flag; - struct vertex_str *shadow_vertex; - struct vertex_str *next, *previous; -} -tess_vertex; - -typedef struct contour_str -{ - GLenum type; - GLuint vertex_cnt; - GLdouble area; - GLenum orientation; - struct vertex_str *vertices, *last_vertex; - struct contour_str *next, *previous; -} -tess_contour; - -typedef struct polygon_str -{ - GLuint vertex_cnt; - GLdouble A, B, C, D; - GLdouble area; - GLenum orientation; - struct vertex_str *vertices, *last_vertex; -} -tess_polygon; - -struct GLUtesselator -{ - tess_contour *contours, *last_contour; - GLuint contour_cnt; - tess_callbacks callbacks; - tess_polygon *current_polygon; - GLenum error; - GLdouble A, B, C, D; - projection_type projection; -}; - - -extern void tess_call_user_error(GLUtriangulatorObj *, GLenum); -extern void tess_test_polygon(GLUtriangulatorObj *); -extern void tess_find_contour_hierarchies(GLUtriangulatorObj *); -extern void tess_handle_holes(GLUtriangulatorObj *); -extern void tess_tesselate(GLUtriangulatorObj *); -extern void tess_tesselate_with_edge_flag(GLUtriangulatorObj *); - - -#endif diff --git a/src/glu/mesa/tesselat.c b/src/glu/mesa/tesselat.c deleted file mode 100644 index 47d230073f..0000000000 --- a/src/glu/mesa/tesselat.c +++ /dev/null @@ -1,406 +0,0 @@ - -/* - * Mesa 3-D graphics library - * Version: 3.3 - * Copyright (C) 1995-2000 Brian Paul - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the Free - * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - - -/* - * This file is part of the polygon tesselation code contributed by - * Bogdan Sikorski - */ - - -#ifdef PC_HEADER -#include "all.h" -#else -#include -#include -#include "tess.h" -#endif - - - -static GLboolean edge_flag; - -static void emit_triangle(GLUtriangulatorObj *, tess_vertex *, - tess_vertex *, tess_vertex *); - -static void emit_triangle_with_edge_flag(GLUtriangulatorObj *, - tess_vertex *, GLboolean, - tess_vertex *, GLboolean, - tess_vertex *, GLboolean); - -static GLdouble -twice_the_triangle_area(tess_vertex * va, tess_vertex * vb, tess_vertex * vc) -{ - return (vb->x - va->x) * (vc->y - va->y) - (vb->y - va->y) * (vc->x - - va->x); -} - -static GLboolean -left(GLdouble A, GLdouble B, GLdouble C, GLdouble x, GLdouble y) -{ - if (A * x + B * y + C > -EPSILON) - return GL_TRUE; - else - return GL_FALSE; -} - -static GLboolean -right(GLdouble A, GLdouble B, GLdouble C, GLdouble x, GLdouble y) -{ - if (A * x + B * y + C < EPSILON) - return GL_TRUE; - else - return GL_FALSE; -} - -static GLint -convex_ccw(tess_vertex * va, - tess_vertex * vb, tess_vertex * vc, GLUtriangulatorObj * tobj) -{ - GLdouble d; - - d = twice_the_triangle_area(va, vb, vc); - - if (d > EPSILON) { - return 1; - } - else if (d < -EPSILON) { - return 0; - } - else { - return -1; - } -} - -static GLint -convex_cw(tess_vertex * va, - tess_vertex * vb, tess_vertex * vc, GLUtriangulatorObj * tobj) -{ - GLdouble d; - - d = twice_the_triangle_area(va, vb, vc); - - if (d < -EPSILON) { - return 1; - } - else if (d > EPSILON) { - return 0; - } - else { - return -1; - } -} - -static GLboolean -diagonal_ccw(tess_vertex * va, - tess_vertex * vb, - GLUtriangulatorObj * tobj, tess_contour * contour) -{ - tess_vertex *vc = va->next, *vertex, *shadow_vertex; - struct - { - GLdouble A, B, C; - } - ac, cb, ba; - GLdouble x, y; - - GLint res = convex_ccw(va, vc, vb, tobj); - if (res == 0) - return GL_FALSE; - if (res == -1) - return GL_TRUE; - - ba.A = vb->y - va->y; - ba.B = va->x - vb->x; - ba.C = -ba.A * va->x - ba.B * va->y; - ac.A = va->y - vc->y; - ac.B = vc->x - va->x; - ac.C = -ac.A * vc->x - ac.B * vc->y; - cb.A = vc->y - vb->y; - cb.B = vb->x - vc->x; - cb.C = -cb.A * vb->x - cb.B * vb->y; - for (vertex = vb->next; vertex != va; vertex = vertex->next) { - shadow_vertex = vertex->shadow_vertex; - if (shadow_vertex != NULL && - (shadow_vertex == va || shadow_vertex == vb || shadow_vertex == vc)) - continue; - x = vertex->x; - y = vertex->y; - if (left(ba.A, ba.B, ba.C, x, y) && - left(ac.A, ac.B, ac.C, x, y) && left(cb.A, cb.B, cb.C, x, y)) - return GL_FALSE; - } - return GL_TRUE; -} - -static GLboolean -diagonal_cw(tess_vertex * va, - tess_vertex * vb, - GLUtriangulatorObj * tobj, tess_contour * contour) -{ - tess_vertex *vc = va->next, *vertex, *shadow_vertex; - struct - { - GLdouble A, B, C; - } - ac, cb, ba; - GLdouble x, y; - - GLint res = convex_cw(va, vc, vb, tobj); - if (res == 0) - return GL_FALSE; - if (res == -1) - return GL_TRUE; - - ba.A = vb->y - va->y; - ba.B = va->x - vb->x; - ba.C = -ba.A * va->x - ba.B * va->y; - ac.A = va->y - vc->y; - ac.B = vc->x - va->x; - ac.C = -ac.A * vc->x - ac.B * vc->y; - cb.A = vc->y - vb->y; - cb.B = vb->x - vc->x; - cb.C = -cb.A * vb->x - cb.B * vb->y; - for (vertex = vb->next; vertex != va; vertex = vertex->next) { - shadow_vertex = vertex->shadow_vertex; - if (shadow_vertex != NULL && - (shadow_vertex == va || shadow_vertex == vb || shadow_vertex == vc)) - continue; - x = vertex->x; - y = vertex->y; - if (right(ba.A, ba.B, ba.C, x, y) && - right(ac.A, ac.B, ac.C, x, y) && right(cb.A, cb.B, cb.C, x, y)) - return GL_FALSE; - } - return GL_TRUE; -} - -static void -clip_ear(GLUtriangulatorObj * tobj, tess_vertex * v, tess_contour * contour) -{ - emit_triangle(tobj, v->previous, v, v->next); - /* the first in the list */ - if (contour->vertices == v) { - contour->vertices = v->next; - contour->last_vertex->next = v->next; - v->next->previous = contour->last_vertex; - } - else - /* the last ? */ - if (contour->last_vertex == v) { - contour->vertices->previous = v->previous; - v->previous->next = v->next; - contour->last_vertex = v->previous; - } - else { - v->next->previous = v->previous; - v->previous->next = v->next; - } - free(v); - --(contour->vertex_cnt); -} - -static void -clip_ear_with_edge_flag(GLUtriangulatorObj * tobj, - tess_vertex * v, tess_contour * contour) -{ - emit_triangle_with_edge_flag(tobj, v->previous, v->previous->edge_flag, - v, v->edge_flag, v->next, GL_FALSE); - v->previous->edge_flag = GL_FALSE; - /* the first in the list */ - if (contour->vertices == v) { - contour->vertices = v->next; - contour->last_vertex->next = v->next; - v->next->previous = contour->last_vertex; - } - else - /* the last ? */ - if (contour->last_vertex == v) { - contour->vertices->previous = v->previous; - v->previous->next = v->next; - contour->last_vertex = v->previous; - } - else { - v->next->previous = v->previous; - v->previous->next = v->next; - } - free(v); - --(contour->vertex_cnt); -} - -static void -triangulate_ccw(GLUtriangulatorObj * tobj, tess_contour * contour) -{ - tess_vertex *vertex; - GLuint vertex_cnt = contour->vertex_cnt; - - while (vertex_cnt > 3) { - vertex = contour->vertices; - while (diagonal_ccw(vertex, vertex->next->next, tobj, contour) == - GL_FALSE && tobj->error == GLU_NO_ERROR) - vertex = vertex->next; - if (tobj->error != GLU_NO_ERROR) - return; - clip_ear(tobj, vertex->next, contour); - --vertex_cnt; - } -} - -static void -triangulate_cw(GLUtriangulatorObj * tobj, tess_contour * contour) -{ - tess_vertex *vertex; - GLuint vertex_cnt = contour->vertex_cnt; - - while (vertex_cnt > 3) { - vertex = contour->vertices; - while (diagonal_cw(vertex, vertex->next->next, tobj, contour) == - GL_FALSE && tobj->error == GLU_NO_ERROR) - vertex = vertex->next; - if (tobj->error != GLU_NO_ERROR) - return; - clip_ear(tobj, vertex->next, contour); - --vertex_cnt; - } -} - -static void -triangulate_ccw_with_edge_flag(GLUtriangulatorObj * tobj, - tess_contour * contour) -{ - tess_vertex *vertex; - GLuint vertex_cnt = contour->vertex_cnt; - - while (vertex_cnt > 3) { - vertex = contour->vertices; - while (diagonal_ccw(vertex, vertex->next->next, tobj, contour) == - GL_FALSE && tobj->error == GLU_NO_ERROR) - vertex = vertex->next; - if (tobj->error != GLU_NO_ERROR) - return; - clip_ear_with_edge_flag(tobj, vertex->next, contour); - --vertex_cnt; - } -} - -static void -triangulate_cw_with_edge_flag(GLUtriangulatorObj * tobj, - tess_contour * contour) -{ - tess_vertex *vertex; - GLuint vertex_cnt = contour->vertex_cnt; - - while (vertex_cnt > 3) { - vertex = contour->vertices; - while (diagonal_cw(vertex, vertex->next->next, tobj, contour) == - GL_FALSE && tobj->error == GLU_NO_ERROR) - vertex = vertex->next; - if (tobj->error != GLU_NO_ERROR) - return; - clip_ear_with_edge_flag(tobj, vertex->next, contour); - --vertex_cnt; - } -} - -void -tess_tesselate(GLUtriangulatorObj * tobj) -{ - tess_contour *contour; - - for (contour = tobj->contours; contour != NULL; contour = contour->next) { - if (contour->orientation == GLU_CCW) { - triangulate_ccw(tobj, contour); - } - else { - triangulate_cw(tobj, contour); - } - if (tobj->error != GLU_NO_ERROR) - return; - - /* emit the last triangle */ - emit_triangle(tobj, contour->vertices, contour->vertices->next, - contour->vertices->next->next); - } -} - -void -tess_tesselate_with_edge_flag(GLUtriangulatorObj * tobj) -{ - tess_contour *contour; - - edge_flag = GL_TRUE; - /* first callback with edgeFlag set to GL_TRUE */ - (tobj->callbacks.edgeFlag) (GL_TRUE); - - for (contour = tobj->contours; contour != NULL; contour = contour->next) { - if (contour->orientation == GLU_CCW) - triangulate_ccw_with_edge_flag(tobj, contour); - else - triangulate_cw_with_edge_flag(tobj, contour); - if (tobj->error != GLU_NO_ERROR) - return; - /* emit the last triangle */ - emit_triangle_with_edge_flag(tobj, contour->vertices, - contour->vertices->edge_flag, - contour->vertices->next, - contour->vertices->next->edge_flag, - contour->vertices->next->next, - contour->vertices->next->next->edge_flag); - } -} - -static void -emit_triangle(GLUtriangulatorObj * tobj, - tess_vertex * v1, tess_vertex * v2, tess_vertex * v3) -{ - (tobj->callbacks.begin) (GL_TRIANGLES); - (tobj->callbacks.vertex) (v1->data); - (tobj->callbacks.vertex) (v2->data); - (tobj->callbacks.vertex) (v3->data); - (tobj->callbacks.end) (); -} - -static void -emit_triangle_with_edge_flag(GLUtriangulatorObj * tobj, - tess_vertex * v1, - GLboolean edge_flag1, - tess_vertex * v2, - GLboolean edge_flag2, - tess_vertex * v3, GLboolean edge_flag3) -{ - (tobj->callbacks.begin) (GL_TRIANGLES); - if (edge_flag1 != edge_flag) { - edge_flag = (edge_flag == GL_TRUE ? GL_FALSE : GL_TRUE); - (tobj->callbacks.edgeFlag) (edge_flag); - } - (tobj->callbacks.vertex) (v1->data); - if (edge_flag2 != edge_flag) { - edge_flag = (edge_flag == GL_TRUE ? GL_FALSE : GL_TRUE); - (tobj->callbacks.edgeFlag) (edge_flag); - } - (tobj->callbacks.vertex) (v2->data); - if (edge_flag3 != edge_flag) { - edge_flag = (edge_flag == GL_TRUE ? GL_FALSE : GL_TRUE); - (tobj->callbacks.edgeFlag) (edge_flag); - } - (tobj->callbacks.vertex) (v3->data); - (tobj->callbacks.end) (); -} diff --git a/src/glu/mini/all.h b/src/glu/mini/all.h deleted file mode 100644 index 874c935925..0000000000 --- a/src/glu/mini/all.h +++ /dev/null @@ -1,54 +0,0 @@ - -/* - * Mesa 3-D graphics library - * Version: 3.3 - * Copyright (C) 1995-2000 Brian Paul - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the Free - * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - - -/* - * This file includes all .h files needed for the GLU source code for - * the purpose of precompiled headers. - * - * If the preprocessor symbol PCH is defined at compile time then each - * of the .c files will #include "all.h" only, instead of a bunch of - * individual .h files. - */ - - -#ifndef GLU_ALL_H -#define GLU_ALL_H - - -#ifndef PC_HEADER -This is an error. all.h should be included only if PCH is defined. -#endif - - -#include -#include -#include -#include -#include -#include "GL/gl.h" -#include "GL/glu.h" -#include "gluP.h" -#include "nurbs.h" -#include "tess.h" - - -#endif /*GLU_ALL_H */ diff --git a/src/glu/mini/glu.c b/src/glu/mini/glu.c deleted file mode 100644 index 31429e3343..0000000000 --- a/src/glu/mini/glu.c +++ /dev/null @@ -1,416 +0,0 @@ - -/* - * Mesa 3-D graphics library - * Version: 3.5 - * Copyright (C) 1995-2001 Brian Paul - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the Free - * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - - -#ifdef PC_HEADER -#include "all.h" -#else -#include -#include -#include -#include -#include -#include "gluP.h" -#endif - - -/* - * Miscellaneous utility functions - */ - - -#ifndef M_PI -#define M_PI 3.1415926536 -#endif -#define EPS 0.00001 - -#ifndef GLU_INCOMPATIBLE_GL_VERSION -#define GLU_INCOMPATIBLE_GL_VERSION 100903 -#endif - - -void GLAPIENTRY -gluLookAt(GLdouble eyex, GLdouble eyey, GLdouble eyez, - GLdouble centerx, GLdouble centery, GLdouble centerz, - GLdouble upx, GLdouble upy, GLdouble upz) -{ - GLfloat m[16]; - GLfloat x[3], y[3], z[3]; - GLfloat mag; - - /* Make rotation matrix */ - - /* Z vector */ - z[0] = eyex - centerx; - z[1] = eyey - centery; - z[2] = eyez - centerz; - mag = sqrt(z[0] * z[0] + z[1] * z[1] + z[2] * z[2]); - if (mag) { /* mpichler, 19950515 */ - z[0] /= mag; - z[1] /= mag; - z[2] /= mag; - } - - /* Y vector */ - y[0] = upx; - y[1] = upy; - y[2] = upz; - - /* X vector = Y cross Z */ - x[0] = y[1] * z[2] - y[2] * z[1]; - x[1] = -y[0] * z[2] + y[2] * z[0]; - x[2] = y[0] * z[1] - y[1] * z[0]; - - /* Recompute Y = Z cross X */ - y[0] = z[1] * x[2] - z[2] * x[1]; - y[1] = -z[0] * x[2] + z[2] * x[0]; - y[2] = z[0] * x[1] - z[1] * x[0]; - - /* mpichler, 19950515 */ - /* cross product gives area of parallelogram, which is < 1.0 for - * non-perpendicular unit-length vectors; so normalize x, y here - */ - - mag = sqrt(x[0] * x[0] + x[1] * x[1] + x[2] * x[2]); - if (mag) { - x[0] /= mag; - x[1] /= mag; - x[2] /= mag; - } - - mag = sqrt(y[0] * y[0] + y[1] * y[1] + y[2] * y[2]); - if (mag) { - y[0] /= mag; - y[1] /= mag; - y[2] /= mag; - } - -#define M(row,col) m[col*4+row] - M(0, 0) = x[0]; - M(0, 1) = x[1]; - M(0, 2) = x[2]; - M(0, 3) = 0.0; - M(1, 0) = y[0]; - M(1, 1) = y[1]; - M(1, 2) = y[2]; - M(1, 3) = 0.0; - M(2, 0) = z[0]; - M(2, 1) = z[1]; - M(2, 2) = z[2]; - M(2, 3) = 0.0; - M(3, 0) = 0.0; - M(3, 1) = 0.0; - M(3, 2) = 0.0; - M(3, 3) = 1.0; -#undef M - glMultMatrixf(m); - - /* Translate Eye to Origin */ - glTranslatef(-eyex, -eyey, -eyez); - -} - - - -void GLAPIENTRY -gluOrtho2D(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top) -{ - glOrtho(left, right, bottom, top, -1.0, 1.0); -} - - - -static void -frustum(GLfloat left, GLfloat right, - GLfloat bottom, GLfloat top, - GLfloat nearval, GLfloat farval) -{ - GLfloat x, y, a, b, c, d; - GLfloat m[16]; - - x = (2.0 * nearval) / (right - left); - y = (2.0 * nearval) / (top - bottom); - a = (right + left) / (right - left); - b = (top + bottom) / (top - bottom); - c = -(farval + nearval) / ( farval - nearval); - d = -(2.0 * farval * nearval) / (farval - nearval); - -#define M(row,col) m[col*4+row] - M(0,0) = x; M(0,1) = 0.0F; M(0,2) = a; M(0,3) = 0.0F; - M(1,0) = 0.0F; M(1,1) = y; M(1,2) = b; M(1,3) = 0.0F; - M(2,0) = 0.0F; M(2,1) = 0.0F; M(2,2) = c; M(2,3) = d; - M(3,0) = 0.0F; M(3,1) = 0.0F; M(3,2) = -1.0F; M(3,3) = 0.0F; -#undef M - - glMultMatrixf(m); -} - - -void GLAPIENTRY -gluPerspective(GLdouble fovy, GLdouble aspect, GLdouble zNear, GLdouble zFar) -{ - GLfloat xmin, xmax, ymin, ymax; - - ymax = zNear * tan(fovy * M_PI / 360.0); - ymin = -ymax; - xmin = ymin * aspect; - xmax = ymax * aspect; - - /* don't call glFrustum() because of error semantics (covglu) */ - frustum(xmin, xmax, ymin, ymax, zNear, zFar); -} - - - -void GLAPIENTRY -gluPickMatrix(GLdouble x, GLdouble y, - GLdouble width, GLdouble height, GLint viewport[4]) -{ - GLfloat m[16]; - GLfloat sx, sy; - GLfloat tx, ty; - - sx = viewport[2] / width; - sy = viewport[3] / height; - tx = (viewport[2] + 2.0 * (viewport[0] - x)) / width; - ty = (viewport[3] + 2.0 * (viewport[1] - y)) / height; - -#define M(row,col) m[col*4+row] - M(0, 0) = sx; - M(0, 1) = 0.0; - M(0, 2) = 0.0; - M(0, 3) = tx; - M(1, 0) = 0.0; - M(1, 1) = sy; - M(1, 2) = 0.0; - M(1, 3) = ty; - M(2, 0) = 0.0; - M(2, 1) = 0.0; - M(2, 2) = 1.0; - M(2, 3) = 0.0; - M(3, 0) = 0.0; - M(3, 1) = 0.0; - M(3, 2) = 0.0; - M(3, 3) = 1.0; -#undef M - - glMultMatrixf(m); -} - - - -const GLubyte *GLAPIENTRY -gluErrorString(GLenum errorCode) -{ - static char *tess_error[] = { - "missing gluBeginPolygon", - "missing gluBeginContour", - "missing gluEndPolygon", - "missing gluEndContour", - "misoriented or self-intersecting loops", - "coincident vertices", - "colinear vertices", - "FIST recovery process fatal error" - }; - static char *nurbs_error[] = { - "spline order un-supported", - "too few knots", - "valid knot range is empty", - "decreasing knot sequence knot", - "knot multiplicity greater than order of spline", - "endcurve() must follow bgncurve()", - "bgncurve() must precede endcurve()", - "missing or extra geometric data", - "can't draw pwlcurves", - "missing bgncurve()", - "missing bgnsurface()", - "endtrim() must precede endsurface()", - "bgnsurface() must precede endsurface()", - "curve of improper type passed as trim curve", - "bgnsurface() must precede bgntrim()", - "endtrim() must follow bgntrim()", - "bgntrim() must precede endtrim()", - "invalid or missing trim curve", - "bgntrim() must precede pwlcurve()", - "pwlcurve referenced twice", - "pwlcurve and nurbscurve mixed", - "improper usage of trim data type", - "nurbscurve referenced twice", - "nurbscurve and pwlcurve mixed", - "nurbssurface referenced twice", - "invalid property", - "endsurface() must follow bgnsurface()", - "misoriented trim curves", - "intersecting trim curves", - "UNUSED", - "unconnected trim curves", - "unknown knot error", - "negative vertex count encountered", - "negative byte-stride encountered", - "unknown type descriptor", - "null control array or knot vector", - "duplicate point on pwlcurve" - }; - - /* GL Errors */ - if (errorCode == GL_NO_ERROR) { - return (GLubyte *) "no error"; - } - else if (errorCode == GL_INVALID_VALUE) { - return (GLubyte *) "invalid value"; - } - else if (errorCode == GL_INVALID_ENUM) { - return (GLubyte *) "invalid enum"; - } - else if (errorCode == GL_INVALID_OPERATION) { - return (GLubyte *) "invalid operation"; - } - else if (errorCode == GL_STACK_OVERFLOW) { - return (GLubyte *) "stack overflow"; - } - else if (errorCode == GL_STACK_UNDERFLOW) { - return (GLubyte *) "stack underflow"; - } - else if (errorCode == GL_OUT_OF_MEMORY) { - return (GLubyte *) "out of memory"; - } - /* GLU Errors */ - else if (errorCode == GLU_NO_ERROR) { - return (GLubyte *) "no error"; - } - else if (errorCode == GLU_INVALID_ENUM) { - return (GLubyte *) "invalid enum"; - } - else if (errorCode == GLU_INVALID_VALUE) { - return (GLubyte *) "invalid value"; - } - else if (errorCode == GLU_OUT_OF_MEMORY) { - return (GLubyte *) "out of memory"; - } - else if (errorCode == GLU_INCOMPATIBLE_GL_VERSION) { - return (GLubyte *) "incompatible GL version"; - } - else if (errorCode >= GLU_TESS_ERROR1 && errorCode <= GLU_TESS_ERROR8) { - return (GLubyte *) tess_error[errorCode - GLU_TESS_ERROR1]; - } - else if (errorCode >= GLU_NURBS_ERROR1 && errorCode <= GLU_NURBS_ERROR37) { - return (GLubyte *) nurbs_error[errorCode - GLU_NURBS_ERROR1]; - } - else { - return NULL; - } -} - - - -/* - * New in GLU 1.1 - */ - -const GLubyte *GLAPIENTRY -gluGetString(GLenum name) -{ - static char *extensions = "GL_EXT_abgr"; - static char *version = "1.1 Mesa 3.5"; - - switch (name) { - case GLU_EXTENSIONS: - return (GLubyte *) extensions; - case GLU_VERSION: - return (GLubyte *) version; - default: - return NULL; - } -} - - - -#if 0 /* gluGetProcAddressEXT not finalized yet! */ - -#ifdef __cplusplus - /* for BeOS R4.5 */ -void GLAPIENTRY(*gluGetProcAddressEXT(const GLubyte * procName)) (...) -#else -void (GLAPIENTRY * gluGetProcAddressEXT(const GLubyte * procName)) () -#endif -{ - struct proc - { - const char *name; - void *address; - }; - static struct proc procTable[] = { - {"gluGetProcAddressEXT", (void *) gluGetProcAddressEXT}, /* me! */ - - /* new 1.1 functions */ - {"gluGetString", (void *) gluGetString}, - - /* new 1.2 functions */ - {"gluTessBeginPolygon", (void *) gluTessBeginPolygon}, - {"gluTessBeginContour", (void *) gluTessBeginContour}, - {"gluTessEndContour", (void *) gluTessEndContour}, - {"gluTessEndPolygon", (void *) gluTessEndPolygon}, - {"gluGetTessProperty", (void *) gluGetTessProperty}, - - /* new 1.3 functions */ - - {NULL, NULL} - }; - GLuint i; - - for (i = 0; procTable[i].address; i++) { - if (strcmp((const char *) procName, procTable[i].name) == 0) - return (void (GLAPIENTRY *) ()) procTable[i].address; - } - - return NULL; -} - -#endif - - - -/* - * New in GLU 1.3 - */ -#ifdef GLU_VERSION_1_3 -GLboolean GLAPIENTRY -gluCheckExtension(const GLubyte *extName, const GLubyte * extString) -{ - assert(extName); - assert(extString); - { - const int len = strlen((const char *) extName); - const char *start = (const char *) extString; - - while (1) { - const char *c = strstr(start, (const char *) extName); - if (!c) - return GL_FALSE; - - if ((c == start || c[-1] == ' ') && (c[len] == ' ' || c[len] == 0)) - return GL_TRUE; - - start = c + len; - } - } -} -#endif diff --git a/src/glu/mini/gluP.h b/src/glu/mini/gluP.h deleted file mode 100644 index a39edce41f..0000000000 --- a/src/glu/mini/gluP.h +++ /dev/null @@ -1,141 +0,0 @@ - -/* - * Mesa 3-D graphics library - * Version: 3.3 - * Copyright (C) 1995-2000 Brian Paul - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the Free - * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - - -/* - * This file allows the GLU code to be compiled either with the Mesa - * headers or with the real OpenGL headers. - */ - - -#ifndef GLUP_H -#define GLUP_H - - -#include -#include -#include - - -#if defined(_WIN32) && !defined(__WIN32__) -# define __WIN32__ -#endif - -#if !defined(OPENSTEP) && (defined(__WIN32__) || defined(__CYGWIN__)) -# pragma warning( disable : 4068 ) /* unknown pragma */ -# pragma warning( disable : 4710 ) /* function 'foo' not inlined */ -# pragma warning( disable : 4711 ) /* function 'foo' selected for automatic inline expansion */ -# pragma warning( disable : 4127 ) /* conditional expression is constant */ -# if defined(MESA_MINWARN) -# pragma warning( disable : 4244 ) /* '=' : conversion from 'const double ' to 'float ', possible loss of data */ -# pragma warning( disable : 4018 ) /* '<' : signed/unsigned mismatch */ -# pragma warning( disable : 4305 ) /* '=' : truncation from 'const double ' to 'float ' */ -# pragma warning( disable : 4550 ) /* 'function' undefined; assuming extern returning int */ -# pragma warning( disable : 4761 ) /* integral size mismatch in argument; conversion supplied */ -# endif -# if defined(_MSC_VER) && defined(BUILD_GL32) /* tag specify we're building mesa as a DLL */ -# define GLAPI __declspec(dllexport) -# define WGLAPI __declspec(dllexport) -# elif defined(_MSC_VER) && defined(_DLL) /* tag specifying we're building for DLL runtime support */ -# define GLAPI __declspec(dllimport) -# define WGLAPI __declspec(dllimport) -# else /* for use with static link lib build of Win32 edition only */ -# define GLAPI extern -# define WGLAPI __declspec(dllimport) -# endif /* _STATIC_MESA support */ -# define GLAPIENTRY __stdcall -# define GLAPIENTRYP __stdcall * -# define GLCALLBACK __stdcall -# define GLCALLBACKP __stdcall * -# if defined(__CYGWIN__) -# define GLCALLBACKPCAST * -# else -# define GLCALLBACKPCAST __stdcall * -# endif -# define GLWINAPI __stdcall -# define GLWINAPIV __cdecl -#else -/* non-Windows compilation */ -# define GLAPI extern -# define GLAPIENTRY -# define GLAPIENTRYP * -# define GLCALLBACK -# define GLCALLBACKP * -# define GLCALLBACKPCAST * -# define GLWINAPI -# define GLWINAPIV -#endif /* WIN32 / CYGWIN bracket */ - -/* compatibility guard so we don't need to change client code */ - -#if defined(_WIN32) && !defined(_WINDEF_) && !defined(_GNU_H_WINDOWS32_BASE) && !defined(OPENSTEP) -# define CALLBACK GLCALLBACK -typedef int (GLAPIENTRY *PROC)(); -typedef void *HGLRC; -typedef void *HDC; -typedef unsigned long COLORREF; -#endif - -#if defined(_WIN32) && !defined(_WINGDI_) && !defined(_GNU_H_WINDOWS32_DEFINES) && !defined(OPENSTEP) -# define WGL_FONT_LINES 0 -# define WGL_FONT_POLYGONS 1 -#ifndef _GNU_H_WINDOWS32_FUNCTIONS -# ifdef UNICODE -# define wglUseFontBitmaps wglUseFontBitmapsW -# define wglUseFontOutlines wglUseFontOutlinesW -# else -# define wglUseFontBitmaps wglUseFontBitmapsA -# define wglUseFontOutlines wglUseFontOutlinesA -# endif /* !UNICODE */ -#endif /* _GNU_H_WINDOWS32_FUNCTIONS */ -typedef struct tagLAYERPLANEDESCRIPTOR LAYERPLANEDESCRIPTOR, *PLAYERPLANEDESCRIPTOR, *LPLAYERPLANEDESCRIPTOR; -typedef struct _GLYPHMETRICSFLOAT GLYPHMETRICSFLOAT, *PGLYPHMETRICSFLOAT, *LPGLYPHMETRICSFLOAT; -typedef struct tagPIXELFORMATDESCRIPTOR PIXELFORMATDESCRIPTOR, *PPIXELFORMATDESCRIPTOR, *LPPIXELFORMATDESCRIPTOR; -#include -#endif - - - -#ifndef GLU_TESS_ERROR9 - /* If we're using the real OpenGL header files... */ -# define GLU_TESS_ERROR9 100159 -#endif - - -#define GLU_NO_ERROR GL_NO_ERROR - - -/* for Sun: */ -#ifdef SUNOS4 -#define MEMCPY( DST, SRC, BYTES) \ - memcpy( (char *) (DST), (char *) (SRC), (int) (BYTES) ) -#else -#define MEMCPY( DST, SRC, BYTES) \ - memcpy( (void *) (DST), (void *) (SRC), (size_t) (BYTES) ) -#endif - - -#ifndef NULL -# define NULL 0 -#endif - - -#endif diff --git a/src/glu/mini/mipmap.c b/src/glu/mini/mipmap.c deleted file mode 100644 index a655d214e3..0000000000 --- a/src/glu/mini/mipmap.c +++ /dev/null @@ -1,763 +0,0 @@ - -/* - * Mesa 3-D graphics library - * Version: 3.4 - * Copyright (C) 1995-2000 Brian Paul - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the Free - * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - - -#ifdef PC_HEADER -#include "all.h" -#else -#include -#include -#include -#include -#include "gluP.h" -#endif - - -/* - * Compute ceiling of integer quotient of A divided by B: - */ -#define CEILING( A, B ) ( (A) % (B) == 0 ? (A)/(B) : (A)/(B)+1 ) - - - -#ifdef EPSILON -#undef EPSILON -#endif -#define EPSILON 0.001 - - -/* To work around optimizer bug in MSVC4.1 */ -#if defined(__WIN32__) && !defined(OPENSTEP) -void -dummy(GLuint j, GLuint k) -{ -} -#else -#define dummy(J, K) -#endif - - -GLint GLAPIENTRY -gluScaleImage(GLenum format, - GLsizei widthin, GLsizei heightin, - GLenum typein, const void *datain, - GLsizei widthout, GLsizei heightout, - GLenum typeout, void *dataout) -{ - GLint components, i, j, k; - GLfloat *tempin, *tempout, f; - GLfloat sx, sy; - GLint unpackrowlength, unpackalignment, unpackskiprows, unpackskippixels; - GLint packrowlength, packalignment, packskiprows, packskippixels; - GLint sizein, sizeout; - GLint rowstride, rowlen; - - - /* Determine number of components per pixel */ - switch (format) { - case GL_COLOR_INDEX: - case GL_STENCIL_INDEX: - case GL_DEPTH_COMPONENT: - case GL_RED: - case GL_GREEN: - case GL_BLUE: - case GL_ALPHA: - case GL_LUMINANCE: - components = 1; - break; - case GL_LUMINANCE_ALPHA: - components = 2; - break; - case GL_RGB: - case GL_BGR: - components = 3; - break; - case GL_RGBA: - case GL_BGRA: -#ifdef GL_EXT_abgr - case GL_ABGR_EXT: -#endif - components = 4; - break; - default: - return GLU_INVALID_ENUM; - } - - /* Determine bytes per input datum */ - switch (typein) { - case GL_UNSIGNED_BYTE: - sizein = sizeof(GLubyte); - break; - case GL_BYTE: - sizein = sizeof(GLbyte); - break; - case GL_UNSIGNED_SHORT: - sizein = sizeof(GLushort); - break; - case GL_SHORT: - sizein = sizeof(GLshort); - break; - case GL_UNSIGNED_INT: - sizein = sizeof(GLuint); - break; - case GL_INT: - sizein = sizeof(GLint); - break; - case GL_FLOAT: - sizein = sizeof(GLfloat); - break; - case GL_BITMAP: - /* not implemented yet */ - default: - return GL_INVALID_ENUM; - } - - /* Determine bytes per output datum */ - switch (typeout) { - case GL_UNSIGNED_BYTE: - sizeout = sizeof(GLubyte); - break; - case GL_BYTE: - sizeout = sizeof(GLbyte); - break; - case GL_UNSIGNED_SHORT: - sizeout = sizeof(GLushort); - break; - case GL_SHORT: - sizeout = sizeof(GLshort); - break; - case GL_UNSIGNED_INT: - sizeout = sizeof(GLuint); - break; - case GL_INT: - sizeout = sizeof(GLint); - break; - case GL_FLOAT: - sizeout = sizeof(GLfloat); - break; - case GL_BITMAP: - /* not implemented yet */ - default: - return GL_INVALID_ENUM; - } - - /* Get glPixelStore state */ - glGetFloatv(GL_UNPACK_ROW_LENGTH, &f); unpackrowlength = (int)f; - glGetFloatv(GL_UNPACK_ALIGNMENT, &f); unpackalignment = (int)f; - glGetFloatv(GL_UNPACK_SKIP_ROWS, &f); unpackskiprows = (int)f; - glGetFloatv(GL_UNPACK_SKIP_PIXELS, &f); unpackskippixels = (int)f; - glGetFloatv(GL_PACK_ROW_LENGTH, &f); packrowlength = (int)f; - glGetFloatv(GL_PACK_ALIGNMENT, &f); packalignment = (int)f; - glGetFloatv(GL_PACK_SKIP_ROWS, &f); packskiprows = (int)f; - glGetFloatv(GL_PACK_SKIP_PIXELS, &f); packskippixels = (int)f; - - /* Allocate storage for intermediate images */ - tempin = (GLfloat *) malloc(widthin * heightin - * components * sizeof(GLfloat)); - if (!tempin) { - return GLU_OUT_OF_MEMORY; - } - tempout = (GLfloat *) malloc(widthout * heightout - * components * sizeof(GLfloat)); - if (!tempout) { - free(tempin); - return GLU_OUT_OF_MEMORY; - } - - - /* - * Unpack the pixel data and convert to floating point - */ - - if (unpackrowlength > 0) { - rowlen = unpackrowlength; - } - else { - rowlen = widthin; - } - if (sizein >= unpackalignment) { - rowstride = components * rowlen; - } - else { - rowstride = unpackalignment / sizein - * CEILING(components * rowlen * sizein, unpackalignment); - } - - switch (typein) { - case GL_UNSIGNED_BYTE: - k = 0; - for (i = 0; i < heightin; i++) { - GLubyte *ubptr = (GLubyte *) datain - + i * rowstride - + unpackskiprows * rowstride + unpackskippixels * components; - for (j = 0; j < widthin * components; j++) { - dummy(j, k); - tempin[k++] = (GLfloat) * ubptr++; - } - } - break; - case GL_BYTE: - k = 0; - for (i = 0; i < heightin; i++) { - GLbyte *bptr = (GLbyte *) datain - + i * rowstride - + unpackskiprows * rowstride + unpackskippixels * components; - for (j = 0; j < widthin * components; j++) { - dummy(j, k); - tempin[k++] = (GLfloat) * bptr++; - } - } - break; - case GL_UNSIGNED_SHORT: - k = 0; - for (i = 0; i < heightin; i++) { - GLushort *usptr = (GLushort *) datain - + i * rowstride - + unpackskiprows * rowstride + unpackskippixels * components; - for (j = 0; j < widthin * components; j++) { - dummy(j, k); - tempin[k++] = (GLfloat) * usptr++; - } - } - break; - case GL_SHORT: - k = 0; - for (i = 0; i < heightin; i++) { - GLshort *sptr = (GLshort *) datain - + i * rowstride - + unpackskiprows * rowstride + unpackskippixels * components; - for (j = 0; j < widthin * components; j++) { - dummy(j, k); - tempin[k++] = (GLfloat) * sptr++; - } - } - break; - case GL_UNSIGNED_INT: - k = 0; - for (i = 0; i < heightin; i++) { - GLuint *uiptr = (GLuint *) datain - + i * rowstride - + unpackskiprows * rowstride + unpackskippixels * components; - for (j = 0; j < widthin * components; j++) { - dummy(j, k); - tempin[k++] = (GLfloat) * uiptr++; - } - } - break; - case GL_INT: - k = 0; - for (i = 0; i < heightin; i++) { - GLint *iptr = (GLint *) datain - + i * rowstride - + unpackskiprows * rowstride + unpackskippixels * components; - for (j = 0; j < widthin * components; j++) { - dummy(j, k); - tempin[k++] = (GLfloat) * iptr++; - } - } - break; - case GL_FLOAT: - k = 0; - for (i = 0; i < heightin; i++) { - GLfloat *fptr = (GLfloat *) datain - + i * rowstride - + unpackskiprows * rowstride + unpackskippixels * components; - for (j = 0; j < widthin * components; j++) { - dummy(j, k); - tempin[k++] = *fptr++; - } - } - break; - default: - return GLU_INVALID_ENUM; - } - - - /* - * Scale the image! - */ - - if (widthout > 1) - sx = (GLfloat) (widthin - 1) / (GLfloat) (widthout - 1); - else - sx = (GLfloat) (widthin - 1); - if (heightout > 1) - sy = (GLfloat) (heightin - 1) / (GLfloat) (heightout - 1); - else - sy = (GLfloat) (heightin - 1); - -/*#define POINT_SAMPLE*/ -#ifdef POINT_SAMPLE - for (i = 0; i < heightout; i++) { - GLint ii = i * sy; - for (j = 0; j < widthout; j++) { - GLint jj = j * sx; - - GLfloat *src = tempin + (ii * widthin + jj) * components; - GLfloat *dst = tempout + (i * widthout + j) * components; - - for (k = 0; k < components; k++) { - *dst++ = *src++; - } - } - } -#else - if (sx < 1.0 && sy < 1.0) { - /* magnify both width and height: use weighted sample of 4 pixels */ - GLint i0, i1, j0, j1; - GLfloat alpha, beta; - GLfloat *src00, *src01, *src10, *src11; - GLfloat s1, s2; - GLfloat *dst; - - for (i = 0; i < heightout; i++) { - i0 = i * sy; - i1 = i0 + 1; - if (i1 >= heightin) - i1 = heightin - 1; -/* i1 = (i+1) * sy - EPSILON;*/ - alpha = i * sy - i0; - for (j = 0; j < widthout; j++) { - j0 = j * sx; - j1 = j0 + 1; - if (j1 >= widthin) - j1 = widthin - 1; -/* j1 = (j+1) * sx - EPSILON; */ - beta = j * sx - j0; - - /* compute weighted average of pixels in rect (i0,j0)-(i1,j1) */ - src00 = tempin + (i0 * widthin + j0) * components; - src01 = tempin + (i0 * widthin + j1) * components; - src10 = tempin + (i1 * widthin + j0) * components; - src11 = tempin + (i1 * widthin + j1) * components; - - dst = tempout + (i * widthout + j) * components; - - for (k = 0; k < components; k++) { - s1 = *src00++ * (1.0 - beta) + *src01++ * beta; - s2 = *src10++ * (1.0 - beta) + *src11++ * beta; - *dst++ = s1 * (1.0 - alpha) + s2 * alpha; - } - } - } - } - else { - /* shrink width and/or height: use an unweighted box filter */ - GLint i0, i1; - GLint j0, j1; - GLint ii, jj; - GLfloat sum, *dst; - - for (i = 0; i < heightout; i++) { - i0 = i * sy; - i1 = i0 + 1; - if (i1 >= heightin) - i1 = heightin - 1; -/* i1 = (i+1) * sy - EPSILON; */ - for (j = 0; j < widthout; j++) { - j0 = j * sx; - j1 = j0 + 1; - if (j1 >= widthin) - j1 = widthin - 1; -/* j1 = (j+1) * sx - EPSILON; */ - - dst = tempout + (i * widthout + j) * components; - - /* compute average of pixels in the rectangle (i0,j0)-(i1,j1) */ - for (k = 0; k < components; k++) { - sum = 0.0; - for (ii = i0; ii <= i1; ii++) { - for (jj = j0; jj <= j1; jj++) { - sum += *(tempin + (ii * widthin + jj) * components + k); - } - } - sum /= (j1 - j0 + 1) * (i1 - i0 + 1); - *dst++ = sum; - } - } - } - } -#endif - - - /* - * Return output image - */ - - if (packrowlength > 0) { - rowlen = packrowlength; - } - else { - rowlen = widthout; - } - if (sizeout >= packalignment) { - rowstride = components * rowlen; - } - else { - rowstride = packalignment / sizeout - * CEILING(components * rowlen * sizeout, packalignment); - } - - switch (typeout) { - case GL_UNSIGNED_BYTE: - k = 0; - for (i = 0; i < heightout; i++) { - GLubyte *ubptr = (GLubyte *) dataout - + i * rowstride - + packskiprows * rowstride + packskippixels * components; - for (j = 0; j < widthout * components; j++) { - dummy(j, k + i); - *ubptr++ = (GLubyte) tempout[k++]; - } - } - break; - case GL_BYTE: - k = 0; - for (i = 0; i < heightout; i++) { - GLbyte *bptr = (GLbyte *) dataout - + i * rowstride - + packskiprows * rowstride + packskippixels * components; - for (j = 0; j < widthout * components; j++) { - dummy(j, k + i); - *bptr++ = (GLbyte) tempout[k++]; - } - } - break; - case GL_UNSIGNED_SHORT: - k = 0; - for (i = 0; i < heightout; i++) { - GLushort *usptr = (GLushort *) dataout - + i * rowstride - + packskiprows * rowstride + packskippixels * components; - for (j = 0; j < widthout * components; j++) { - dummy(j, k + i); - *usptr++ = (GLushort) tempout[k++]; - } - } - break; - case GL_SHORT: - k = 0; - for (i = 0; i < heightout; i++) { - GLshort *sptr = (GLshort *) dataout - + i * rowstride - + packskiprows * rowstride + packskippixels * components; - for (j = 0; j < widthout * components; j++) { - dummy(j, k + i); - *sptr++ = (GLshort) tempout[k++]; - } - } - break; - case GL_UNSIGNED_INT: - k = 0; - for (i = 0; i < heightout; i++) { - GLuint *uiptr = (GLuint *) dataout - + i * rowstride - + packskiprows * rowstride + packskippixels * components; - for (j = 0; j < widthout * components; j++) { - dummy(j, k + i); - *uiptr++ = (GLuint) tempout[k++]; - } - } - break; - case GL_INT: - k = 0; - for (i = 0; i < heightout; i++) { - GLint *iptr = (GLint *) dataout - + i * rowstride - + packskiprows * rowstride + packskippixels * components; - for (j = 0; j < widthout * components; j++) { - dummy(j, k + i); - *iptr++ = (GLint) tempout[k++]; - } - } - break; - case GL_FLOAT: - k = 0; - for (i = 0; i < heightout; i++) { - GLfloat *fptr = (GLfloat *) dataout - + i * rowstride - + packskiprows * rowstride + packskippixels * components; - for (j = 0; j < widthout * components; j++) { - dummy(j, k + i); - *fptr++ = tempout[k++]; - } - } - break; - default: - return GLU_INVALID_ENUM; - } - - - /* free temporary image storage */ - free(tempin); - free(tempout); - - return 0; -} - - - -/* - * Return the largest k such that 2^k <= n. - */ -static GLint -ilog2(GLint n) -{ - GLint k; - - if (n <= 0) - return 0; - for (k = 0; n >>= 1; k++); - return k; -} - - - -/* - * Find the value nearest to n which is also a power of two. - */ -static GLint -round2(GLint n) -{ - GLint m; - - for (m = 1; m < n; m *= 2); - - /* m>=n */ - if (m - n <= n - m / 2) { - return m; - } - else { - return m / 2; - } -} - - -/* - * Given an pixel format and data type, return the number of bytes to - * store one pixel. - */ -static GLint -bytes_per_pixel(GLenum format, GLenum type) -{ - GLint n, m; - - switch (format) { - case GL_COLOR_INDEX: - case GL_STENCIL_INDEX: - case GL_DEPTH_COMPONENT: - case GL_RED: - case GL_GREEN: - case GL_BLUE: - case GL_ALPHA: - case GL_LUMINANCE: - n = 1; - break; - case GL_LUMINANCE_ALPHA: - n = 2; - break; - case GL_RGB: - case GL_BGR: - n = 3; - break; - case GL_RGBA: - case GL_BGRA: -#ifdef GL_EXT_abgr - case GL_ABGR_EXT: -#endif - n = 4; - break; - default: - n = 0; - } - - switch (type) { - case GL_UNSIGNED_BYTE: - m = sizeof(GLubyte); - break; - case GL_BYTE: - m = sizeof(GLbyte); - break; - case GL_BITMAP: - m = 1; - break; - case GL_UNSIGNED_SHORT: - m = sizeof(GLushort); - break; - case GL_SHORT: - m = sizeof(GLshort); - break; - case GL_UNSIGNED_INT: - m = sizeof(GLuint); - break; - case GL_INT: - m = sizeof(GLint); - break; - case GL_FLOAT: - m = sizeof(GLfloat); - break; - default: - m = 0; - } - - return n * m; -} - - - -/* - * WARNING: This function isn't finished and has never been tested!!!! - */ -GLint GLAPIENTRY -gluBuild1DMipmaps(GLenum target, GLint components, - GLsizei width, GLenum format, GLenum type, const void *data) -{ - return 0; -} - - - -GLint GLAPIENTRY -gluBuild2DMipmaps(GLenum target, GLint components, - GLsizei width, GLsizei height, GLenum format, - GLenum type, const void *data) -{ - GLint w, h; - GLint maxsize; - void *image, *newimage; - GLint neww, newh, level, bpp; - int error; - GLboolean done; - GLint retval = 0; - GLint unpackrowlength, unpackalignment, unpackskiprows, unpackskippixels; - GLint packrowlength, packalignment, packskiprows, packskippixels; - GLfloat f; - - if (width < 1 || height < 1) - return GLU_INVALID_VALUE; - - glGetFloatv(GL_MAX_TEXTURE_SIZE, &f); maxsize = (int)f; - - w = round2(width); - if (w > maxsize) { - w = maxsize; - } - h = round2(height); - if (h > maxsize) { - h = maxsize; - } - - bpp = bytes_per_pixel(format, type); - if (bpp == 0) { - /* probably a bad format or type enum */ - return GLU_INVALID_ENUM; - } - - /* Get current glPixelStore values */ - glGetFloatv(GL_UNPACK_ROW_LENGTH, &f); unpackrowlength = (int)f; - glGetFloatv(GL_UNPACK_ALIGNMENT, &f); unpackalignment = (int)f; - glGetFloatv(GL_UNPACK_SKIP_ROWS, &f); unpackskiprows = (int)f; - glGetFloatv(GL_UNPACK_SKIP_PIXELS, &f); unpackskippixels = (int)f; - glGetFloatv(GL_PACK_ROW_LENGTH, &f); packrowlength = (int)f; - glGetFloatv(GL_PACK_ALIGNMENT, &f); packalignment = (int)f; - glGetFloatv(GL_PACK_SKIP_ROWS, &f); packskiprows = (int)f; - glGetFloatv(GL_PACK_SKIP_PIXELS, &f); packskippixels = (int)f; - - /* set pixel packing */ - glPixelStorei(GL_PACK_ROW_LENGTH, 0); - glPixelStorei(GL_PACK_ALIGNMENT, 1); - glPixelStorei(GL_PACK_SKIP_ROWS, 0); - glPixelStorei(GL_PACK_SKIP_PIXELS, 0); - - done = GL_FALSE; - - if (w != width || h != height) { - /* must rescale image to get "top" mipmap texture image */ - image = malloc((w + 4) * h * bpp); - if (!image) { - return GLU_OUT_OF_MEMORY; - } - error = gluScaleImage(format, width, height, type, data, - w, h, type, image); - if (error) { - retval = error; - done = GL_TRUE; - } - } - else { - image = (void *) data; - } - - level = 0; - while (!done) { - if (image != data) { - /* set pixel unpacking */ - glPixelStorei(GL_UNPACK_ROW_LENGTH, 0); - glPixelStorei(GL_UNPACK_ALIGNMENT, 1); - glPixelStorei(GL_UNPACK_SKIP_ROWS, 0); - glPixelStorei(GL_UNPACK_SKIP_PIXELS, 0); - } - - glTexImage2D(target, level, components, w, h, 0, format, type, image); - - if (w == 1 && h == 1) - break; - - neww = (w < 2) ? 1 : w / 2; - newh = (h < 2) ? 1 : h / 2; - newimage = malloc((neww + 4) * newh * bpp); - if (!newimage) { - return GLU_OUT_OF_MEMORY; - } - - error = gluScaleImage(format, w, h, type, image, - neww, newh, type, newimage); - if (error) { - retval = error; - done = GL_TRUE; - } - - if (image != data) { - free(image); - } - image = newimage; - - w = neww; - h = newh; - level++; - } - - if (image != data) { - free(image); - } - - /* Restore original glPixelStore state */ - glPixelStorei(GL_UNPACK_ROW_LENGTH, unpackrowlength); - glPixelStorei(GL_UNPACK_ALIGNMENT, unpackalignment); - glPixelStorei(GL_UNPACK_SKIP_ROWS, unpackskiprows); - glPixelStorei(GL_UNPACK_SKIP_PIXELS, unpackskippixels); - glPixelStorei(GL_PACK_ROW_LENGTH, packrowlength); - glPixelStorei(GL_PACK_ALIGNMENT, packalignment); - glPixelStorei(GL_PACK_SKIP_ROWS, packskiprows); - glPixelStorei(GL_PACK_SKIP_PIXELS, packskippixels); - - return retval; -} diff --git a/src/glu/mini/nurbs.c b/src/glu/mini/nurbs.c deleted file mode 100644 index 9f39cacb41..0000000000 --- a/src/glu/mini/nurbs.c +++ /dev/null @@ -1,157 +0,0 @@ - -/* - * Mesa 3-D graphics library - * Version: 3.3 - * Copyright (C) 1995-2000 Brian Paul - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the Free - * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - - -/* - * NURBS implementation written by Bogdan Sikorski (bogdan@cira.it) - * See README2 for more info. - */ - - -#ifdef PC_HEADER -#include "all.h" -#else -#include -#include -#include "gluP.h" -#include "nurbs.h" -#endif - - -void -call_user_error(GLUnurbsObj * nobj, GLenum error) -{ - nobj->error = error; - if (nobj->error_callback != NULL) { - (*(nobj->error_callback)) (error); - } - else { - printf("NURBS error %d %s\n", error, (char *) gluErrorString(error)); - } -} - - - -GLUnurbsObj *GLAPIENTRY -gluNewNurbsRenderer(void) -{ - GLUnurbsObj *n; - GLfloat tmp_viewport[4]; - GLint i, j; - - n = (GLUnurbsObj *) malloc(sizeof(GLUnurbsObj)); - return n; -} - - - -void GLAPIENTRY -gluDeleteNurbsRenderer(GLUnurbsObj * nobj) -{ - if (nobj) { - free(nobj); - } -} - - - -void GLAPIENTRY -gluLoadSamplingMatrices(GLUnurbsObj * nobj, - const GLfloat modelMatrix[16], - const GLfloat projMatrix[16], const GLint viewport[4]) -{ -} - - -void GLAPIENTRY -gluNurbsProperty(GLUnurbsObj * nobj, GLenum property, GLfloat value) -{ -} - - -void GLAPIENTRY -gluGetNurbsProperty(GLUnurbsObj * nobj, GLenum property, GLfloat * value) -{ -} - - - -void GLAPIENTRY -gluBeginCurve(GLUnurbsObj * nobj) -{ -} - - -void GLAPIENTRY -gluEndCurve(GLUnurbsObj * nobj) -{ -} - - -void GLAPIENTRY -gluNurbsCurve(GLUnurbsObj * nobj, GLint nknots, GLfloat * knot, - GLint stride, GLfloat * ctlarray, GLint order, GLenum type) -{ -} - - -void GLAPIENTRY -gluBeginSurface(GLUnurbsObj * nobj) -{ -} - - -void GLAPIENTRY -gluEndSurface(GLUnurbsObj * nobj) -{ -} - - -void GLAPIENTRY -gluNurbsSurface(GLUnurbsObj * nobj, - GLint sknot_count, GLfloat * sknot, - GLint tknot_count, GLfloat * tknot, - GLint s_stride, GLint t_stride, - GLfloat * ctrlarray, GLint sorder, GLint torder, GLenum type) -{ -} - - -void GLAPIENTRY -gluNurbsCallback(GLUnurbsObj * nobj, GLenum which, void (GLCALLBACK * fn) ()) -{ -} - -void GLAPIENTRY -gluBeginTrim(GLUnurbsObj * nobj) -{ -} - -void GLAPIENTRY -gluPwlCurve(GLUnurbsObj * nobj, GLint count, GLfloat * array, GLint stride, - GLenum type) -{ -} - -void GLAPIENTRY -gluEndTrim(GLUnurbsObj * nobj) -{ -} diff --git a/src/glu/mini/nurbs.h b/src/glu/mini/nurbs.h deleted file mode 100644 index 3642e213a8..0000000000 --- a/src/glu/mini/nurbs.h +++ /dev/null @@ -1,252 +0,0 @@ - -/* - * Mesa 3-D graphics library - * Version: 3.3 - * Copyright (C) 1995-2000 Brian Paul - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the Free - * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - - -/* - * NURBS implementation written by Bogdan Sikorski (bogdan@cira.it) - * See README2 for more info. - */ - - -#ifndef NURBS_H -#define NURBS_H - - -#define EPSILON 1e-06 /* epsilon for double precision compares */ - -typedef enum -{ - GLU_NURBS_CURVE, GLU_NURBS_SURFACE, GLU_NURBS_TRIM, GLU_NURBS_NO_TRIM, - GLU_NURBS_TRIM_DONE, GLU_NURBS_NONE -} -GLU_nurbs_enum; - -typedef enum -{ - GLU_TRIM_NURBS, GLU_TRIM_PWL -} -GLU_trim_enum; - -typedef struct -{ - GLint sknot_count; - GLfloat *sknot; - GLint tknot_count; - GLfloat *tknot; - GLint s_stride; - GLint t_stride; - GLfloat *ctrlarray; - GLint sorder; - GLint torder; - GLint dim; - GLenum type; -} -surface_attribs; - -typedef struct -{ - surface_attribs geom; - surface_attribs color; - surface_attribs texture; - surface_attribs normal; -} -nurbs_surface; - -typedef struct -{ - GLint knot_count; - GLfloat *knot; - GLint stride; - GLfloat *ctrlarray; - GLint order; - GLint dim; - GLenum type; -} -curve_attribs; - -typedef struct -{ - GLint pt_count; - GLfloat *ctrlarray; - GLint stride; - GLint dim; - GLenum type; -} -pwl_curve_attribs; - -typedef struct -{ - curve_attribs geom; - curve_attribs color; - curve_attribs texture; - curve_attribs normal; -} -nurbs_curve; - -typedef struct trim_list_str -{ - GLU_trim_enum trim_type; - union - { - pwl_curve_attribs pwl_curve; - curve_attribs nurbs_curve; - } - curve; - struct trim_list_str *next; -} -trim_list; - -typedef struct seg_trim_str -{ - GLfloat *points; - GLint pt_cnt, seg_array_len; - struct seg_trim_str *next; -} -trim_segments; - -typedef struct nurbs_trim_str -{ - trim_list *trim_loop; - trim_segments *segments; - struct nurbs_trim_str *next; -} -nurbs_trim; - -typedef struct -{ - GLfloat model[16], proj[16], viewport[4]; -} -culling_and_sampling_str; - -struct GLUnurbs -{ - GLboolean culling; - GLenum error; - void (GLCALLBACK * error_callback) (GLenum err); - GLenum display_mode; - GLU_nurbs_enum nurbs_type; - GLboolean auto_load_matrix; - culling_and_sampling_str sampling_matrices; - GLenum sampling_method; - GLfloat sampling_tolerance; - GLfloat parametric_tolerance; - GLint u_step, v_step; - nurbs_surface surface; - nurbs_curve curve; - nurbs_trim *trim; -}; - -typedef struct -{ - GLfloat *knot; - GLint nknots; - GLfloat *unified_knot; - GLint unified_nknots; - GLint order; - GLint t_min, t_max; - GLint delta_nknots; - GLboolean open_at_begin, open_at_end; - GLfloat *new_knot; - GLfloat *alpha; -} -knot_str_type; - -typedef struct -{ - GLfloat *geom_ctrl; - GLint geom_s_stride, geom_t_stride; - GLfloat **geom_offsets; - GLint geom_s_pt_cnt, geom_t_pt_cnt; - GLfloat *color_ctrl; - GLint color_s_stride, color_t_stride; - GLfloat **color_offsets; - GLint color_s_pt_cnt, color_t_pt_cnt; - GLfloat *normal_ctrl; - GLint normal_s_stride, normal_t_stride; - GLfloat **normal_offsets; - GLint normal_s_pt_cnt, normal_t_pt_cnt; - GLfloat *texture_ctrl; - GLint texture_s_stride, texture_t_stride; - GLfloat **texture_offsets; - GLint texture_s_pt_cnt, texture_t_pt_cnt; - GLint s_bezier_cnt, t_bezier_cnt; -} -new_ctrl_type; - -extern void call_user_error(GLUnurbsObj * nobj, GLenum error); - -extern GLenum test_knot(GLint nknots, GLfloat * knot, GLint order); - -extern GLenum explode_knot(knot_str_type * the_knot); - -extern GLenum calc_alphas(knot_str_type * the_knot); - -extern GLenum calc_new_ctrl_pts(GLfloat * ctrl, GLint stride, - knot_str_type * the_knot, GLint dim, - GLfloat ** new_ctrl, GLint * ncontrol); - -extern GLenum glu_do_sampling_crv(GLUnurbsObj * nobj, GLfloat * new_ctrl, - GLint n_ctrl, GLint order, GLint dim, - GLint ** factors); - -extern GLenum glu_do_sampling_3D(GLUnurbsObj * nobj, new_ctrl_type * new_ctrl, - int **sfactors, GLint ** tfactors); - -extern GLenum glu_do_sampling_uv(GLUnurbsObj * nobj, new_ctrl_type * new_ctrl, - int **sfactors, GLint ** tfactors); - -extern GLenum glu_do_sampling_param_3D(GLUnurbsObj * nobj, - new_ctrl_type * new_ctrl, - int **sfactors, GLint ** tfactors); - -extern GLboolean fine_culling_test_2D(GLUnurbsObj * nobj, GLfloat * ctrl, - GLint n_ctrl, GLint stride, GLint dim); - -extern GLboolean fine_culling_test_3D(GLUnurbsObj * nobj, GLfloat * ctrl, - GLint s_n_ctrl, GLint t_n_ctrl, - GLint s_stride, GLint t_stride, - GLint dim); - -extern void do_nurbs_curve(GLUnurbsObj * nobj); - -extern void do_nurbs_surface(GLUnurbsObj * nobj); - -extern GLenum patch_trimming(GLUnurbsObj * nobj, new_ctrl_type * new_ctrl, - GLint * sfactors, GLint * tfactors); - -extern void collect_unified_knot(knot_str_type * dest, knot_str_type * src, - GLfloat maximal_min_knot, - GLfloat minimal_max_knot); - -extern GLenum select_knot_working_range(GLUnurbsObj * nobj, - knot_str_type * geom_knot, - knot_str_type * color_knot, - knot_str_type * normal_knot, - knot_str_type * texture_knot); - -extern void free_unified_knots(knot_str_type * geom_knot, - knot_str_type * color_knot, - knot_str_type * normal_knot, - knot_str_type * texture_knot); - - - -#endif diff --git a/src/glu/mini/nurbscrv.c b/src/glu/mini/nurbscrv.c deleted file mode 100644 index e80468fdb0..0000000000 --- a/src/glu/mini/nurbscrv.c +++ /dev/null @@ -1,132 +0,0 @@ - -/* - * Mesa 3-D graphics library - * Version: 3.3 - * Copyright (C) 1995-2000 Brian Paul - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the Free - * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - - -/* - * NURBS implementation written by Bogdan Sikorski (bogdan@cira.it) - * See README2 for more info. - */ - - -#ifdef PC_HEADER -#include "all.h" -#else -#include -#include -#include "gluP.h" -#include "nurbs.h" -#endif - - - -/* main NURBS curve procedure */ -void -do_nurbs_curve(GLUnurbsObj * nobj) -{ - GLint geom_order, color_order = 0, normal_order = 0, texture_order = 0; - GLenum geom_type; - GLint n_ctrl; - GLfloat *new_geom_ctrl, *new_color_ctrl, *new_normal_ctrl, - *new_texture_ctrl; - GLfloat *geom_ctrl = 0, *color_ctrl = 0, *normal_ctrl = 0, *texture_ctrl = 0; - GLint *factors; - GLint i, j; - GLint geom_dim, color_dim = 0, normal_dim = 0, texture_dim = 0; - - /* test the user supplied data */ - if (test_nurbs_curves(nobj) != GLU_NO_ERROR) - return; - - if (convert_curves(nobj, &new_geom_ctrl, &n_ctrl, &new_color_ctrl, - &new_normal_ctrl, &new_texture_ctrl) != GLU_NO_ERROR) - return; - - geom_order = nobj->curve.geom.order; - geom_type = nobj->curve.geom.type; - geom_dim = nobj->curve.geom.dim; - - if (glu_do_sampling_crv(nobj, new_geom_ctrl, n_ctrl, geom_order, geom_dim, - &factors) != GLU_NO_ERROR) { - free(new_geom_ctrl); - if (new_color_ctrl) - free(new_color_ctrl); - if (new_normal_ctrl) - free(new_normal_ctrl); - if (new_texture_ctrl) - free(new_texture_ctrl); - return; - } - glEnable(geom_type); - if (new_color_ctrl) { - glEnable(nobj->curve.color.type); - color_dim = nobj->curve.color.dim; - color_ctrl = new_color_ctrl; - color_order = nobj->curve.color.order; - } - if (new_normal_ctrl) { - glEnable(nobj->curve.normal.type); - normal_dim = nobj->curve.normal.dim; - normal_ctrl = new_normal_ctrl; - normal_order = nobj->curve.normal.order; - } - if (new_texture_ctrl) { - glEnable(nobj->curve.texture.type); - texture_dim = nobj->curve.texture.dim; - texture_ctrl = new_texture_ctrl; - texture_order = nobj->curve.texture.order; - } - for (i = 0, j = 0, geom_ctrl = new_geom_ctrl; - i < n_ctrl; i += geom_order, j++, geom_ctrl += geom_order * geom_dim) { - if (fine_culling_test_2D - (nobj, geom_ctrl, geom_order, geom_dim, geom_dim)) { - color_ctrl += color_order * color_dim; - normal_ctrl += normal_order * normal_dim; - texture_ctrl += texture_order * texture_dim; - continue; - } - glMap1f(geom_type, 0.0, 1.0, geom_dim, geom_order, geom_ctrl); - if (new_color_ctrl) { - glMap1f(nobj->curve.color.type, 0.0, 1.0, color_dim, - color_order, color_ctrl); - color_ctrl += color_order * color_dim; - } - if (new_normal_ctrl) { - glMap1f(nobj->curve.normal.type, 0.0, 1.0, normal_dim, - normal_order, normal_ctrl); - normal_ctrl += normal_order * normal_dim; - } - if (new_texture_ctrl) { - glMap1f(nobj->curve.texture.type, 0.0, 1.0, texture_dim, - texture_order, texture_ctrl); - texture_ctrl += texture_order * texture_dim; - } - glMapGrid1f(factors[j], 0.0, 1.0); - glEvalMesh1(GL_LINE, 0, factors[j]); - } - free(new_geom_ctrl); - free(factors); - if (new_color_ctrl) - free(new_color_ctrl); - if (new_normal_ctrl) - free(new_normal_ctrl); - if (new_texture_ctrl) - free(new_texture_ctrl); -} diff --git a/src/glu/mini/polytest.c b/src/glu/mini/polytest.c deleted file mode 100644 index 1ff966f61c..0000000000 --- a/src/glu/mini/polytest.c +++ /dev/null @@ -1,937 +0,0 @@ - -/* - * Mesa 3-D graphics library - * Version: 3.3 - * Copyright (C) 1995-2000 Brian Paul - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the Free - * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - - -/* - * This file is part of the polygon tesselation code contributed by - * Bogdan Sikorski - */ - - -#ifdef PC_HEADER -#include "all.h" -#else -#include -#include -#include "gluP.h" -#include "tess.h" -#endif - - - -static GLenum store_polygon_as_contour(GLUtriangulatorObj *); -static void free_current_polygon(tess_polygon *); -static void prepare_projection_info(GLUtriangulatorObj *); -static GLdouble twice_the_polygon_area(tess_vertex *, tess_vertex *); -static GLenum verify_edge_vertex_intersections(GLUtriangulatorObj *); -void tess_find_contour_hierarchies(GLUtriangulatorObj *); -static GLenum test_for_overlapping_contours(GLUtriangulatorObj *); -static GLenum contours_overlap(tess_contour *, tess_polygon *); -static GLenum is_contour_contained_in(tess_contour *, tess_contour *); -static void add_new_exterior(GLUtriangulatorObj *, tess_contour *); -static void add_new_interior(GLUtriangulatorObj *, tess_contour *, - tess_contour *); -static void add_interior_with_hierarchy_check(GLUtriangulatorObj *, - tess_contour *, tess_contour *); -static void reverse_hierarchy_and_add_exterior(GLUtriangulatorObj *, - tess_contour *, - tess_contour *); -static GLboolean point_in_polygon(tess_contour *, GLdouble, GLdouble); -static void shift_interior_to_exterior(GLUtriangulatorObj *, tess_contour *); -static void add_exterior_with_check(GLUtriangulatorObj *, tess_contour *, - tess_contour *); -static GLenum cut_out_hole(GLUtriangulatorObj *, tess_contour *, - tess_contour *); -static GLenum merge_hole_with_contour(GLUtriangulatorObj *, - tess_contour *, tess_contour *, - tess_vertex *, tess_vertex *); - -static GLenum -find_normal(GLUtriangulatorObj * tobj) -{ - tess_polygon *polygon = tobj->current_polygon; - tess_vertex *va, *vb, *vc; - GLdouble A, B, C; - GLdouble A0, A1, A2, B0, B1, B2; - - va = polygon->vertices; - vb = va->next; - A0 = vb->location[0] - va->location[0]; - A1 = vb->location[1] - va->location[1]; - A2 = vb->location[2] - va->location[2]; - for (vc = vb->next; vc != va; vc = vc->next) { - B0 = vc->location[0] - va->location[0]; - B1 = vc->location[1] - va->location[1]; - B2 = vc->location[2] - va->location[2]; - A = A1 * B2 - A2 * B1; - B = A2 * B0 - A0 * B2; - C = A0 * B1 - A1 * B0; - if (fabs(A) > EPSILON || fabs(B) > EPSILON || fabs(C) > EPSILON) { - polygon->A = A; - polygon->B = B; - polygon->C = C; - polygon->D = - -A * va->location[0] - B * va->location[1] - C * va->location[2]; - return GLU_NO_ERROR; - } - } - tess_call_user_error(tobj, GLU_TESS_ERROR7); - return GLU_ERROR; -} - -void -tess_test_polygon(GLUtriangulatorObj * tobj) -{ - tess_polygon *polygon = tobj->current_polygon; - - /* any vertices defined? */ - if (polygon->vertex_cnt < 3) { - free_current_polygon(polygon); - return; - } - /* wrap pointers */ - polygon->last_vertex->next = polygon->vertices; - polygon->vertices->previous = polygon->last_vertex; - /* determine the normal */ - if (find_normal(tobj) == GLU_ERROR) - return; - /* compare the normals of previously defined contours and this one */ - /* first contour define ? */ - if (tobj->contours == NULL) { - tobj->A = polygon->A; - tobj->B = polygon->B; - tobj->C = polygon->C; - tobj->D = polygon->D; - /* determine the best projection to use */ - if (fabs(polygon->A) > fabs(polygon->B)) - if (fabs(polygon->A) > fabs(polygon->C)) - tobj->projection = OYZ; - else - tobj->projection = OXY; - else if (fabs(polygon->B) > fabs(polygon->C)) - tobj->projection = OXZ; - else - tobj->projection = OXY; - } - else { - GLdouble a[3], b[3]; - tess_vertex *vertex = polygon->vertices; - - a[0] = tobj->A; - a[1] = tobj->B; - a[2] = tobj->C; - b[0] = polygon->A; - b[1] = polygon->B; - b[2] = polygon->C; - - /* compare the normals */ - if (fabs(a[1] * b[2] - a[2] * b[1]) > EPSILON || - fabs(a[2] * b[0] - a[0] * b[2]) > EPSILON || - fabs(a[0] * b[1] - a[1] * b[0]) > EPSILON) { - /* not coplanar */ - tess_call_user_error(tobj, GLU_TESS_ERROR9); - return; - } - /* the normals are parallel - test for plane equation */ - if (fabs(a[0] * vertex->location[0] + a[1] * vertex->location[1] + - a[2] * vertex->location[2] + tobj->D) > EPSILON) { - /* not the same plane */ - tess_call_user_error(tobj, GLU_TESS_ERROR9); - return; - } - } - prepare_projection_info(tobj); - if (verify_edge_vertex_intersections(tobj) == GLU_ERROR) - return; - if (test_for_overlapping_contours(tobj) == GLU_ERROR) - return; - if (store_polygon_as_contour(tobj) == GLU_ERROR) - return; -} - -static GLenum -test_for_overlapping_contours(GLUtriangulatorObj * tobj) -{ - tess_contour *contour; - tess_polygon *polygon; - - polygon = tobj->current_polygon; - for (contour = tobj->contours; contour != NULL; contour = contour->next) - if (contours_overlap(contour, polygon) != GLU_NO_ERROR) { - tess_call_user_error(tobj, GLU_TESS_ERROR5); - return GLU_ERROR; - } - return GLU_NO_ERROR; -} - -static GLenum -store_polygon_as_contour(GLUtriangulatorObj * tobj) -{ - tess_polygon *polygon = tobj->current_polygon; - tess_contour *contour = tobj->contours; - - /* the first contour defined */ - if (contour == NULL) { - if ((contour = (tess_contour *) malloc(sizeof(tess_contour))) == NULL) { - tess_call_user_error(tobj, GLU_OUT_OF_MEMORY); - free_current_polygon(polygon); - return GLU_ERROR; - } - tobj->contours = tobj->last_contour = contour; - contour->next = contour->previous = NULL; - } - else { - if ((contour = (tess_contour *) malloc(sizeof(tess_contour))) == NULL) { - tess_call_user_error(tobj, GLU_OUT_OF_MEMORY); - free_current_polygon(polygon); - return GLU_ERROR; - } - contour->previous = tobj->last_contour; - tobj->last_contour->next = contour; - tobj->last_contour = contour; - contour->next = NULL; - } - /* mark all vertices in new contour as not special */ - /* and all are boundary edges */ - { - tess_vertex *vertex; - GLuint vertex_cnt, i; - - for (vertex = polygon->vertices, i = 0, vertex_cnt = - polygon->vertex_cnt; i < vertex_cnt; vertex = vertex->next, i++) { - vertex->shadow_vertex = NULL; - vertex->edge_flag = GL_TRUE; - } - } - contour->vertex_cnt = polygon->vertex_cnt; - contour->area = polygon->area; - contour->orientation = polygon->orientation; - contour->type = GLU_UNKNOWN; - contour->vertices = polygon->vertices; - contour->last_vertex = polygon->last_vertex; - polygon->vertices = polygon->last_vertex = NULL; - polygon->vertex_cnt = 0; - ++(tobj->contour_cnt); - return GLU_NO_ERROR; -} - -static void -free_current_polygon(tess_polygon * polygon) -{ - tess_vertex *vertex, *vertex_tmp; - GLuint i; - - /* free current_polygon structures */ - for (vertex = polygon->vertices, i = 0; i < polygon->vertex_cnt; i++) { - vertex_tmp = vertex->next; - free(vertex); - vertex = vertex_tmp; - } - polygon->vertices = polygon->last_vertex = NULL; - polygon->vertex_cnt = 0; -} - -static void -prepare_projection_info(GLUtriangulatorObj * tobj) -{ - tess_polygon *polygon = tobj->current_polygon; - tess_vertex *vertex, *last_vertex_ptr; - GLdouble area; - - last_vertex_ptr = polygon->last_vertex; - switch (tobj->projection) { - case OXY: - for (vertex = polygon->vertices; vertex != last_vertex_ptr; - vertex = vertex->next) { - vertex->x = vertex->location[0]; - vertex->y = vertex->location[1]; - } - last_vertex_ptr->x = last_vertex_ptr->location[0]; - last_vertex_ptr->y = last_vertex_ptr->location[1]; - break; - case OXZ: - for (vertex = polygon->vertices; vertex != last_vertex_ptr; - vertex = vertex->next) { - vertex->x = vertex->location[0]; - vertex->y = vertex->location[2]; - } - last_vertex_ptr->x = last_vertex_ptr->location[0]; - last_vertex_ptr->y = last_vertex_ptr->location[2]; - break; - case OYZ: - for (vertex = polygon->vertices; vertex != last_vertex_ptr; - vertex = vertex->next) { - vertex->x = vertex->location[1]; - vertex->y = vertex->location[2]; - } - last_vertex_ptr->x = last_vertex_ptr->location[1]; - last_vertex_ptr->y = last_vertex_ptr->location[2]; - break; - } - area = twice_the_polygon_area(polygon->vertices, polygon->last_vertex); - if (area >= 0.0) { - polygon->orientation = GLU_CCW; - polygon->area = area; - } - else { - polygon->orientation = GLU_CW; - polygon->area = -area; - } -} - -static GLdouble -twice_the_polygon_area(tess_vertex * vertex, tess_vertex * last_vertex) -{ - tess_vertex *next; - GLdouble area, x, y; - - area = 0.0; - x = vertex->x; - y = vertex->y; - vertex = vertex->next; - for (; vertex != last_vertex; vertex = vertex->next) { - next = vertex->next; - area += - (vertex->x - x) * (next->y - y) - (vertex->y - y) * (next->x - x); - } - return area; -} - -/* test if edges ab and cd intersect */ -/* if not return GLU_NO_ERROR, else if cross return GLU_TESS_ERROR8, */ -/* else if adjacent return GLU_TESS_ERROR4 */ -static GLenum -edge_edge_intersect(tess_vertex * a, - tess_vertex * b, tess_vertex * c, tess_vertex * d) -{ - GLdouble denom, r, s; - GLdouble xba, ydc, yba, xdc, yac, xac; - - xba = b->x - a->x; - yba = b->y - a->y; - xdc = d->x - c->x; - ydc = d->y - c->y; - xac = a->x - c->x; - yac = a->y - c->y; - denom = xba * ydc - yba * xdc; - r = yac * xdc - xac * ydc; - /* parallel? */ - if (fabs(denom) < EPSILON) { - if (fabs(r) < EPSILON) { - /* colinear */ - if (fabs(xba) < EPSILON) { - /* compare the Y coordinate */ - if (yba > 0.0) { - if ( - (fabs(a->y - c->y) < EPSILON - && fabs(c->y - b->y) < EPSILON) - || (fabs(a->y - d->y) < EPSILON - && fabs(d->y - b->y) < - EPSILON)) return GLU_TESS_ERROR4; - - } - else { - if ( - (fabs(b->y - c->y) < EPSILON - && fabs(c->y - a->y) < EPSILON) - || (fabs(b->y - d->y) < EPSILON - && fabs(d->y - a->y) < - EPSILON)) return GLU_TESS_ERROR4; - } - } - else { - /* compare the X coordinate */ - if (xba > 0.0) { - if ( - (fabs(a->x - c->x) < EPSILON - && fabs(c->x - b->x) < EPSILON) - || (fabs(a->x - d->x) < EPSILON - && fabs(d->x - b->x) < - EPSILON)) return GLU_TESS_ERROR4; - } - else { - if ( - (fabs(b->x - c->x) < EPSILON - && fabs(c->x - a->x) < EPSILON) - || (fabs(b->x - d->x) < EPSILON - && fabs(d->x - a->x) < - EPSILON)) return GLU_TESS_ERROR4; - } - } - } - return GLU_NO_ERROR; - } - r /= denom; - s = (yac * xba - xac * yba) / denom; - /* test if one vertex lies on other edge */ - if (((fabs(r) < EPSILON || (r < 1.0 + EPSILON && r > 1.0 - EPSILON)) && - s > -EPSILON && s < 1.0 + EPSILON) || - ((fabs(s) < EPSILON || (s < 1.0 + EPSILON && s > 1.0 - EPSILON)) && - r > -EPSILON && r < 1.0 + EPSILON)) { - return GLU_TESS_ERROR4; - } - /* test for crossing */ - if (r > -EPSILON && r < 1.0 + EPSILON && s > -EPSILON && s < 1.0 + EPSILON) { - return GLU_TESS_ERROR8; - } - return GLU_NO_ERROR; -} - -static GLenum -verify_edge_vertex_intersections(GLUtriangulatorObj * tobj) -{ - tess_polygon *polygon = tobj->current_polygon; - tess_vertex *vertex1, *last_vertex, *vertex2; - GLenum test; - - last_vertex = polygon->last_vertex; - vertex1 = last_vertex; - for (vertex2 = vertex1->next->next; - vertex2->next != last_vertex; vertex2 = vertex2->next) { - test = edge_edge_intersect(vertex1, vertex1->next, vertex2, - vertex2->next); - if (test != GLU_NO_ERROR) { - tess_call_user_error(tobj, test); - return GLU_ERROR; - } - } - for (vertex1 = polygon->vertices; - vertex1->next->next != last_vertex; vertex1 = vertex1->next) { - for (vertex2 = vertex1->next->next; - vertex2 != last_vertex; vertex2 = vertex2->next) { - test = edge_edge_intersect(vertex1, vertex1->next, vertex2, - vertex2->next); - if (test != GLU_NO_ERROR) { - tess_call_user_error(tobj, test); - return GLU_ERROR; - } - } - } - return GLU_NO_ERROR; -} - -static int -#ifdef WIN32 - __cdecl -#endif -area_compare(const void *a, const void *b) -{ - GLdouble area1, area2; - - area1 = (*((tess_contour **) a))->area; - area2 = (*((tess_contour **) b))->area; - if (area1 < area2) - return 1; - if (area1 > area2) - return -1; - return 0; -} - -void -tess_find_contour_hierarchies(GLUtriangulatorObj * tobj) -{ - tess_contour **contours; /* dinamic array of pointers */ - tess_contour *tmp_contour_ptr = tobj->contours; - GLuint cnt, i; - GLenum result; - GLboolean hierarchy_changed; - - /* any contours? */ - if (tobj->contour_cnt < 2) { - tobj->contours->type = GLU_EXTERIOR; - return; - } - if ((contours = (tess_contour **) - malloc(sizeof(tess_contour *) * (tobj->contour_cnt))) == NULL) { - tess_call_user_error(tobj, GLU_OUT_OF_MEMORY); - return; - } - for (tmp_contour_ptr = tobj->contours, cnt = 0; - tmp_contour_ptr != NULL; tmp_contour_ptr = tmp_contour_ptr->next) - contours[cnt++] = tmp_contour_ptr; - /* now sort the contours in decreasing area size order */ - qsort((void *) contours, (size_t) cnt, (size_t) sizeof(tess_contour *), - area_compare); - /* we leave just the first contour - remove others from list */ - tobj->contours = contours[0]; - tobj->contours->next = tobj->contours->previous = NULL; - tobj->last_contour = tobj->contours; - tobj->contour_cnt = 1; - /* first contour is the one with greatest area */ - /* must be EXTERIOR */ - tobj->contours->type = GLU_EXTERIOR; - tmp_contour_ptr = tobj->contours; - /* now we play! */ - for (i = 1; i < cnt; i++) { - hierarchy_changed = GL_FALSE; - for (tmp_contour_ptr = tobj->contours; - tmp_contour_ptr != NULL; tmp_contour_ptr = tmp_contour_ptr->next) { - if (tmp_contour_ptr->type == GLU_EXTERIOR) { - /* check if contour completely contained in EXTERIOR */ - result = is_contour_contained_in(tmp_contour_ptr, contours[i]); - switch (result) { - case GLU_INTERIOR: - /* now we have to check if contour is inside interiors */ - /* or not */ - /* any interiors? */ - if (tmp_contour_ptr->next != NULL && - tmp_contour_ptr->next->type == GLU_INTERIOR) { - /* for all interior, check if inside any of them */ - /* if not inside any of interiors, its another */ - /* interior */ - /* or it may contain some interiors, then change */ - /* the contained interiors to exterior ones */ - add_interior_with_hierarchy_check(tobj, - tmp_contour_ptr, - contours[i]); - } - else { - /* not in interior, add as new interior contour */ - add_new_interior(tobj, tmp_contour_ptr, contours[i]); - } - hierarchy_changed = GL_TRUE; - break; - case GLU_EXTERIOR: - /* ooops, the marked as EXTERIOR (contours[i]) is */ - /* actually an interior of tmp_contour_ptr */ - /* reverse the local hierarchy */ - reverse_hierarchy_and_add_exterior(tobj, tmp_contour_ptr, - contours[i]); - hierarchy_changed = GL_TRUE; - break; - case GLU_NO_ERROR: - break; - default: - abort(); - } - } - if (hierarchy_changed) - break; /* break from for loop */ - } - if (hierarchy_changed == GL_FALSE) { - /* disjoint with all contours, add to contour list */ - add_new_exterior(tobj, contours[i]); - } - } - free(contours); -} - -/* returns GLU_INTERIOR if inner is completey enclosed within outer */ -/* returns GLU_EXTERIOR if outer is completely enclosed within inner */ -/* returns GLU_NO_ERROR if contours are disjoint */ -static GLenum -is_contour_contained_in(tess_contour * outer, tess_contour * inner) -{ - GLenum relation_flag; - - /* set relation_flag to relation of containment of first inner vertex */ - /* regarding outer contour */ - if (point_in_polygon(outer, inner->vertices->x, inner->vertices->y)) - relation_flag = GLU_INTERIOR; - else - relation_flag = GLU_EXTERIOR; - if (relation_flag == GLU_INTERIOR) - return GLU_INTERIOR; - if (point_in_polygon(inner, outer->vertices->x, outer->vertices->y)) - return GLU_EXTERIOR; - return GLU_NO_ERROR; -} - -static GLboolean -point_in_polygon(tess_contour * contour, GLdouble x, GLdouble y) -{ - tess_vertex *v1, *v2; - GLuint i, vertex_cnt; - GLdouble xp1, yp1, xp2, yp2; - GLboolean tst; - - tst = GL_FALSE; - v1 = contour->vertices; - v2 = contour->vertices->previous; - for (i = 0, vertex_cnt = contour->vertex_cnt; i < vertex_cnt; i++) { - xp1 = v1->x; - yp1 = v1->y; - xp2 = v2->x; - yp2 = v2->y; - if ((((yp1 <= y) && (y < yp2)) || ((yp2 <= y) && (y < yp1))) && - (x < (xp2 - xp1) * (y - yp1) / (yp2 - yp1) + xp1)) - tst = (tst == GL_FALSE ? GL_TRUE : GL_FALSE); - v2 = v1; - v1 = v1->next; - } - return tst; -} - -static GLenum -contours_overlap(tess_contour * contour, tess_polygon * polygon) -{ - tess_vertex *vertex1, *vertex2; - GLuint vertex1_cnt, vertex2_cnt, i, j; - GLenum test; - - vertex1 = contour->vertices; - vertex2 = polygon->vertices; - vertex1_cnt = contour->vertex_cnt; - vertex2_cnt = polygon->vertex_cnt; - for (i = 0; i < vertex1_cnt; vertex1 = vertex1->next, i++) { - for (j = 0; j < vertex2_cnt; vertex2 = vertex2->next, j++) - if ((test = edge_edge_intersect(vertex1, vertex1->next, vertex2, - vertex2->next)) != GLU_NO_ERROR) - return test; - } - return GLU_NO_ERROR; -} - -static void -add_new_exterior(GLUtriangulatorObj * tobj, tess_contour * contour) -{ - contour->type = GLU_EXTERIOR; - contour->next = NULL; - contour->previous = tobj->last_contour; - tobj->last_contour->next = contour; - tobj->last_contour = contour; -} - -static void -add_new_interior(GLUtriangulatorObj * tobj, - tess_contour * outer, tess_contour * contour) -{ - contour->type = GLU_INTERIOR; - contour->next = outer->next; - contour->previous = outer; - if (outer->next != NULL) - outer->next->previous = contour; - outer->next = contour; - if (tobj->last_contour == outer) - tobj->last_contour = contour; -} - -static void -add_interior_with_hierarchy_check(GLUtriangulatorObj * tobj, - tess_contour * outer, - tess_contour * contour) -{ - tess_contour *ptr; - - /* for all interiors of outer check if they are interior of contour */ - /* if so, change that interior to exterior and move it of of the */ - /* interior sequence */ - if (outer->next != NULL && outer->next->type == GLU_INTERIOR) { - GLenum test; - - for (ptr = outer->next; ptr != NULL && ptr->type == GLU_INTERIOR; - ptr = ptr->next) { - test = is_contour_contained_in(ptr, contour); - switch (test) { - case GLU_INTERIOR: - /* contour is contained in one of the interiors */ - /* check if possibly contained in other exteriors */ - /* move ptr to first EXTERIOR */ - for (; ptr != NULL && ptr->type == GLU_INTERIOR; ptr = ptr->next); - if (ptr == NULL) - /* another exterior */ - add_new_exterior(tobj, contour); - else - add_exterior_with_check(tobj, ptr, contour); - return; - case GLU_EXTERIOR: - /* one of the interiors is contained in the contour */ - /* change it to EXTERIOR, and shift it away from the */ - /* interior sequence */ - shift_interior_to_exterior(tobj, ptr); - break; - case GLU_NO_ERROR: - /* disjoint */ - break; - default: - abort(); - } - } - } - /* add contour to the interior sequence */ - add_new_interior(tobj, outer, contour); -} - -static void -reverse_hierarchy_and_add_exterior(GLUtriangulatorObj * tobj, - tess_contour * outer, - tess_contour * contour) -{ - tess_contour *ptr; - - /* reverse INTERIORS to EXTERIORS */ - /* any INTERIORS? */ - if (outer->next != NULL && outer->next->type == GLU_INTERIOR) - for (ptr = outer->next; ptr != NULL && ptr->type == GLU_INTERIOR; - ptr = ptr->next) ptr->type = GLU_EXTERIOR; - /* the outer now becomes inner */ - outer->type = GLU_INTERIOR; - /* contour is the EXTERIOR */ - contour->next = outer; - if (tobj->contours == outer) { - /* first contour beeing reversed */ - contour->previous = NULL; - tobj->contours = contour; - } - else { - outer->previous->next = contour; - contour->previous = outer->previous; - } - outer->previous = contour; -} - -static void -shift_interior_to_exterior(GLUtriangulatorObj * tobj, tess_contour * contour) -{ - contour->previous->next = contour->next; - if (contour->next != NULL) - contour->next->previous = contour->previous; - else - tobj->last_contour = contour->previous; -} - -static void -add_exterior_with_check(GLUtriangulatorObj * tobj, - tess_contour * outer, tess_contour * contour) -{ - GLenum test; - - /* this contour might be interior to further exteriors - check */ - /* if not, just add as a new exterior */ - for (; outer != NULL && outer->type == GLU_EXTERIOR; outer = outer->next) { - test = is_contour_contained_in(outer, contour); - switch (test) { - case GLU_INTERIOR: - /* now we have to check if contour is inside interiors */ - /* or not */ - /* any interiors? */ - if (outer->next != NULL && outer->next->type == GLU_INTERIOR) { - /* for all interior, check if inside any of them */ - /* if not inside any of interiors, its another */ - /* interior */ - /* or it may contain some interiors, then change */ - /* the contained interiors to exterior ones */ - add_interior_with_hierarchy_check(tobj, outer, contour); - } - else { - /* not in interior, add as new interior contour */ - add_new_interior(tobj, outer, contour); - } - return; - case GLU_NO_ERROR: - /* disjoint */ - break; - default: - abort(); - } - } - /* add contour to the exterior sequence */ - add_new_exterior(tobj, contour); -} - -void -tess_handle_holes(GLUtriangulatorObj * tobj) -{ - tess_contour *contour, *hole; - GLenum exterior_orientation; - - /* verify hole orientation */ - for (contour = tobj->contours; contour != NULL;) { - exterior_orientation = contour->orientation; - for (contour = contour->next; - contour != NULL && contour->type == GLU_INTERIOR; - contour = contour->next) { - if (contour->orientation == exterior_orientation) { - tess_call_user_error(tobj, GLU_TESS_ERROR5); - return; - } - } - } - /* now cut-out holes */ - for (contour = tobj->contours; contour != NULL;) { - hole = contour->next; - while (hole != NULL && hole->type == GLU_INTERIOR) { - if (cut_out_hole(tobj, contour, hole) == GLU_ERROR) - return; - hole = contour->next; - } - contour = contour->next; - } -} - -static GLenum -cut_out_hole(GLUtriangulatorObj * tobj, - tess_contour * contour, tess_contour * hole) -{ - tess_contour *tmp_hole; - tess_vertex *v1, *v2, *tmp_vertex; - GLuint vertex1_cnt, vertex2_cnt, tmp_vertex_cnt; - GLuint i, j, k; - GLenum test = 0; - - /* find an edge connecting contour and hole not intersecting any other */ - /* edge belonging to either the contour or any of the other holes */ - for (v1 = contour->vertices, vertex1_cnt = contour->vertex_cnt, i = 0; - i < vertex1_cnt; i++, v1 = v1->next) { - for (v2 = hole->vertices, vertex2_cnt = hole->vertex_cnt, j = 0; - j < vertex2_cnt; j++, v2 = v2->next) { - /* does edge (v1,v2) intersect any edge of contour */ - for (tmp_vertex = contour->vertices, tmp_vertex_cnt = - contour->vertex_cnt, k = 0; k < tmp_vertex_cnt; - tmp_vertex = tmp_vertex->next, k++) { - /* skip edge tests for edges directly connected */ - if (v1 == tmp_vertex || v1 == tmp_vertex->next) - continue; - test = edge_edge_intersect(v1, v2, tmp_vertex, tmp_vertex->next); - if (test != GLU_NO_ERROR) - break; - } - if (test == GLU_NO_ERROR) { - /* does edge (v1,v2) intersect any edge of hole */ - for (tmp_vertex = hole->vertices, - tmp_vertex_cnt = hole->vertex_cnt, k = 0; - k < tmp_vertex_cnt; tmp_vertex = tmp_vertex->next, k++) { - /* skip edge tests for edges directly connected */ - if (v2 == tmp_vertex || v2 == tmp_vertex->next) - continue; - test = - edge_edge_intersect(v1, v2, tmp_vertex, tmp_vertex->next); - if (test != GLU_NO_ERROR) - break; - } - if (test == GLU_NO_ERROR) { - /* does edge (v1,v2) intersect any other hole? */ - for (tmp_hole = hole->next; - tmp_hole != NULL && tmp_hole->type == GLU_INTERIOR; - tmp_hole = tmp_hole->next) { - /* does edge (v1,v2) intersect any edge of hole */ - for (tmp_vertex = tmp_hole->vertices, - tmp_vertex_cnt = tmp_hole->vertex_cnt, k = 0; - k < tmp_vertex_cnt; tmp_vertex = tmp_vertex->next, k++) { - test = edge_edge_intersect(v1, v2, tmp_vertex, - tmp_vertex->next); - if (test != GLU_NO_ERROR) - break; - } - if (test != GLU_NO_ERROR) - break; - } - } - } - if (test == GLU_NO_ERROR) { - /* edge (v1,v2) is good for eliminating the hole */ - if (merge_hole_with_contour(tobj, contour, hole, v1, v2) - == GLU_NO_ERROR) - return GLU_NO_ERROR; - else - return GLU_ERROR; - } - } - } - /* other holes are blocking all possible connections of hole */ - /* with contour, we shift this hole as the last hole and retry */ - for (tmp_hole = hole; - tmp_hole != NULL && tmp_hole->type == GLU_INTERIOR; - tmp_hole = tmp_hole->next); - contour->next = hole->next; - hole->next->previous = contour; - if (tmp_hole == NULL) { - /* last EXTERIOR contour, shift hole as last contour */ - hole->next = NULL; - hole->previous = tobj->last_contour; - tobj->last_contour->next = hole; - tobj->last_contour = hole; - } - else { - tmp_hole->previous->next = hole; - hole->previous = tmp_hole->previous; - tmp_hole->previous = hole; - hole->next = tmp_hole; - } - hole = contour->next; - /* try once again - recurse */ - return cut_out_hole(tobj, contour, hole); -} - -static GLenum -merge_hole_with_contour(GLUtriangulatorObj * tobj, - tess_contour * contour, - tess_contour * hole, - tess_vertex * v1, tess_vertex * v2) -{ - tess_vertex *v1_new, *v2_new; - - /* make copies of v1 and v2, place them respectively after their originals */ - if ((v1_new = (tess_vertex *) malloc(sizeof(tess_vertex))) == NULL) { - tess_call_user_error(tobj, GLU_OUT_OF_MEMORY); - return GLU_ERROR; - } - if ((v2_new = (tess_vertex *) malloc(sizeof(tess_vertex))) == NULL) { - tess_call_user_error(tobj, GLU_OUT_OF_MEMORY); - return GLU_ERROR; - } - v1_new->edge_flag = GL_TRUE; - v1_new->data = v1->data; - v1_new->location[0] = v1->location[0]; - v1_new->location[1] = v1->location[1]; - v1_new->location[2] = v1->location[2]; - v1_new->x = v1->x; - v1_new->y = v1->y; - v1_new->shadow_vertex = v1; - v1->shadow_vertex = v1_new; - v1_new->next = v1->next; - v1_new->previous = v1; - v1->next->previous = v1_new; - v1->next = v1_new; - v2_new->edge_flag = GL_TRUE; - v2_new->data = v2->data; - v2_new->location[0] = v2->location[0]; - v2_new->location[1] = v2->location[1]; - v2_new->location[2] = v2->location[2]; - v2_new->x = v2->x; - v2_new->y = v2->y; - v2_new->shadow_vertex = v2; - v2->shadow_vertex = v2_new; - v2_new->next = v2->next; - v2_new->previous = v2; - v2->next->previous = v2_new; - v2->next = v2_new; - /* link together the two lists */ - v1->next = v2_new; - v2_new->previous = v1; - v2->next = v1_new; - v1_new->previous = v2; - /* update the vertex count of the contour */ - contour->vertex_cnt += hole->vertex_cnt + 2; - /* remove the INTERIOR contour */ - contour->next = hole->next; - if (hole->next != NULL) - hole->next->previous = contour; - free(hole); - /* update tobj structure */ - --(tobj->contour_cnt); - if (contour->last_vertex == v1) - contour->last_vertex = v1_new; - /* mark two vertices with edge_flag */ - v2->edge_flag = GL_FALSE; - v1->edge_flag = GL_FALSE; - return GLU_NO_ERROR; -} diff --git a/src/glu/mini/project.c b/src/glu/mini/project.c deleted file mode 100644 index 2e79cdf084..0000000000 --- a/src/glu/mini/project.c +++ /dev/null @@ -1,403 +0,0 @@ - -/* - * Mesa 3-D graphics library - * Version: 3.3 - * Copyright (C) 1995-2000 Brian Paul - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the Free - * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - - -#ifdef PC_HEADER -#include "all.h" -#else -#include -#include -#include -#include "gluP.h" -#endif - - -/* - * This code was contributed by Marc Buffat (buffat@mecaflu.ec-lyon.fr). - * Thanks Marc!!! - */ - - - -/* implementation de gluProject et gluUnproject */ -/* M. Buffat 17/2/95 */ - - - -/* - * Transform a point (column vector) by a 4x4 matrix. I.e. out = m * in - * Input: m - the 4x4 matrix - * in - the 4x1 vector - * Output: out - the resulting 4x1 vector. - */ -static void -transform_point(GLdouble out[4], const GLdouble m[16], const GLdouble in[4]) -{ -#define M(row,col) m[col*4+row] - out[0] = - M(0, 0) * in[0] + M(0, 1) * in[1] + M(0, 2) * in[2] + M(0, 3) * in[3]; - out[1] = - M(1, 0) * in[0] + M(1, 1) * in[1] + M(1, 2) * in[2] + M(1, 3) * in[3]; - out[2] = - M(2, 0) * in[0] + M(2, 1) * in[1] + M(2, 2) * in[2] + M(2, 3) * in[3]; - out[3] = - M(3, 0) * in[0] + M(3, 1) * in[1] + M(3, 2) * in[2] + M(3, 3) * in[3]; -#undef M -} - - - - -/* - * Perform a 4x4 matrix multiplication (product = a x b). - * Input: a, b - matrices to multiply - * Output: product - product of a and b - */ -static void -matmul(GLdouble * product, const GLdouble * a, const GLdouble * b) -{ - /* This matmul was contributed by Thomas Malik */ - GLdouble temp[16]; - GLint i; - -#define A(row,col) a[(col<<2)+row] -#define B(row,col) b[(col<<2)+row] -#define T(row,col) temp[(col<<2)+row] - - /* i-te Zeile */ - for (i = 0; i < 4; i++) { - T(i, 0) = - A(i, 0) * B(0, 0) + A(i, 1) * B(1, 0) + A(i, 2) * B(2, 0) + A(i, - 3) * - B(3, 0); - T(i, 1) = - A(i, 0) * B(0, 1) + A(i, 1) * B(1, 1) + A(i, 2) * B(2, 1) + A(i, - 3) * - B(3, 1); - T(i, 2) = - A(i, 0) * B(0, 2) + A(i, 1) * B(1, 2) + A(i, 2) * B(2, 2) + A(i, - 3) * - B(3, 2); - T(i, 3) = - A(i, 0) * B(0, 3) + A(i, 1) * B(1, 3) + A(i, 2) * B(2, 3) + A(i, - 3) * - B(3, 3); - } - -#undef A -#undef B -#undef T - MEMCPY(product, temp, 16 * sizeof(GLdouble)); -} - - - -/* - * Compute inverse of 4x4 transformation matrix. - * Code contributed by Jacques Leroy jle@star.be - * Return GL_TRUE for success, GL_FALSE for failure (singular matrix) - */ -static GLboolean -invert_matrix(const GLdouble * m, GLdouble * out) -{ -/* NB. OpenGL Matrices are COLUMN major. */ -#define SWAP_ROWS(a, b) { GLdouble *_tmp = a; (a)=(b); (b)=_tmp; } -#define MAT(m,r,c) (m)[(c)*4+(r)] - - GLdouble wtmp[4][8]; - GLdouble m0, m1, m2, m3, s; - GLdouble *r0, *r1, *r2, *r3; - - r0 = wtmp[0], r1 = wtmp[1], r2 = wtmp[2], r3 = wtmp[3]; - - r0[0] = MAT(m, 0, 0), r0[1] = MAT(m, 0, 1), - r0[2] = MAT(m, 0, 2), r0[3] = MAT(m, 0, 3), - r0[4] = 1.0, r0[5] = r0[6] = r0[7] = 0.0, - r1[0] = MAT(m, 1, 0), r1[1] = MAT(m, 1, 1), - r1[2] = MAT(m, 1, 2), r1[3] = MAT(m, 1, 3), - r1[5] = 1.0, r1[4] = r1[6] = r1[7] = 0.0, - r2[0] = MAT(m, 2, 0), r2[1] = MAT(m, 2, 1), - r2[2] = MAT(m, 2, 2), r2[3] = MAT(m, 2, 3), - r2[6] = 1.0, r2[4] = r2[5] = r2[7] = 0.0, - r3[0] = MAT(m, 3, 0), r3[1] = MAT(m, 3, 1), - r3[2] = MAT(m, 3, 2), r3[3] = MAT(m, 3, 3), - r3[7] = 1.0, r3[4] = r3[5] = r3[6] = 0.0; - - /* choose pivot - or die */ - if (fabs(r3[0]) > fabs(r2[0])) - SWAP_ROWS(r3, r2); - if (fabs(r2[0]) > fabs(r1[0])) - SWAP_ROWS(r2, r1); - if (fabs(r1[0]) > fabs(r0[0])) - SWAP_ROWS(r1, r0); - if (0.0 == r0[0]) - return GL_FALSE; - - /* eliminate first variable */ - m1 = r1[0] / r0[0]; - m2 = r2[0] / r0[0]; - m3 = r3[0] / r0[0]; - s = r0[1]; - r1[1] -= m1 * s; - r2[1] -= m2 * s; - r3[1] -= m3 * s; - s = r0[2]; - r1[2] -= m1 * s; - r2[2] -= m2 * s; - r3[2] -= m3 * s; - s = r0[3]; - r1[3] -= m1 * s; - r2[3] -= m2 * s; - r3[3] -= m3 * s; - s = r0[4]; - if (s != 0.0) { - r1[4] -= m1 * s; - r2[4] -= m2 * s; - r3[4] -= m3 * s; - } - s = r0[5]; - if (s != 0.0) { - r1[5] -= m1 * s; - r2[5] -= m2 * s; - r3[5] -= m3 * s; - } - s = r0[6]; - if (s != 0.0) { - r1[6] -= m1 * s; - r2[6] -= m2 * s; - r3[6] -= m3 * s; - } - s = r0[7]; - if (s != 0.0) { - r1[7] -= m1 * s; - r2[7] -= m2 * s; - r3[7] -= m3 * s; - } - - /* choose pivot - or die */ - if (fabs(r3[1]) > fabs(r2[1])) - SWAP_ROWS(r3, r2); - if (fabs(r2[1]) > fabs(r1[1])) - SWAP_ROWS(r2, r1); - if (0.0 == r1[1]) - return GL_FALSE; - - /* eliminate second variable */ - m2 = r2[1] / r1[1]; - m3 = r3[1] / r1[1]; - r2[2] -= m2 * r1[2]; - r3[2] -= m3 * r1[2]; - r2[3] -= m2 * r1[3]; - r3[3] -= m3 * r1[3]; - s = r1[4]; - if (0.0 != s) { - r2[4] -= m2 * s; - r3[4] -= m3 * s; - } - s = r1[5]; - if (0.0 != s) { - r2[5] -= m2 * s; - r3[5] -= m3 * s; - } - s = r1[6]; - if (0.0 != s) { - r2[6] -= m2 * s; - r3[6] -= m3 * s; - } - s = r1[7]; - if (0.0 != s) { - r2[7] -= m2 * s; - r3[7] -= m3 * s; - } - - /* choose pivot - or die */ - if (fabs(r3[2]) > fabs(r2[2])) - SWAP_ROWS(r3, r2); - if (0.0 == r2[2]) - return GL_FALSE; - - /* eliminate third variable */ - m3 = r3[2] / r2[2]; - r3[3] -= m3 * r2[3], r3[4] -= m3 * r2[4], - r3[5] -= m3 * r2[5], r3[6] -= m3 * r2[6], r3[7] -= m3 * r2[7]; - - /* last check */ - if (0.0 == r3[3]) - return GL_FALSE; - - s = 1.0 / r3[3]; /* now back substitute row 3 */ - r3[4] *= s; - r3[5] *= s; - r3[6] *= s; - r3[7] *= s; - - m2 = r2[3]; /* now back substitute row 2 */ - s = 1.0 / r2[2]; - r2[4] = s * (r2[4] - r3[4] * m2), r2[5] = s * (r2[5] - r3[5] * m2), - r2[6] = s * (r2[6] - r3[6] * m2), r2[7] = s * (r2[7] - r3[7] * m2); - m1 = r1[3]; - r1[4] -= r3[4] * m1, r1[5] -= r3[5] * m1, - r1[6] -= r3[6] * m1, r1[7] -= r3[7] * m1; - m0 = r0[3]; - r0[4] -= r3[4] * m0, r0[5] -= r3[5] * m0, - r0[6] -= r3[6] * m0, r0[7] -= r3[7] * m0; - - m1 = r1[2]; /* now back substitute row 1 */ - s = 1.0 / r1[1]; - r1[4] = s * (r1[4] - r2[4] * m1), r1[5] = s * (r1[5] - r2[5] * m1), - r1[6] = s * (r1[6] - r2[6] * m1), r1[7] = s * (r1[7] - r2[7] * m1); - m0 = r0[2]; - r0[4] -= r2[4] * m0, r0[5] -= r2[5] * m0, - r0[6] -= r2[6] * m0, r0[7] -= r2[7] * m0; - - m0 = r0[1]; /* now back substitute row 0 */ - s = 1.0 / r0[0]; - r0[4] = s * (r0[4] - r1[4] * m0), r0[5] = s * (r0[5] - r1[5] * m0), - r0[6] = s * (r0[6] - r1[6] * m0), r0[7] = s * (r0[7] - r1[7] * m0); - - MAT(out, 0, 0) = r0[4]; - MAT(out, 0, 1) = r0[5], MAT(out, 0, 2) = r0[6]; - MAT(out, 0, 3) = r0[7], MAT(out, 1, 0) = r1[4]; - MAT(out, 1, 1) = r1[5], MAT(out, 1, 2) = r1[6]; - MAT(out, 1, 3) = r1[7], MAT(out, 2, 0) = r2[4]; - MAT(out, 2, 1) = r2[5], MAT(out, 2, 2) = r2[6]; - MAT(out, 2, 3) = r2[7], MAT(out, 3, 0) = r3[4]; - MAT(out, 3, 1) = r3[5], MAT(out, 3, 2) = r3[6]; - MAT(out, 3, 3) = r3[7]; - - return GL_TRUE; - -#undef MAT -#undef SWAP_ROWS -} - - - -/* projection du point (objx,objy,obz) sur l'ecran (winx,winy,winz) */ -GLint GLAPIENTRY -gluProject(GLdouble objx, GLdouble objy, GLdouble objz, - const GLdouble model[16], const GLdouble proj[16], - const GLint viewport[4], - GLdouble * winx, GLdouble * winy, GLdouble * winz) -{ - /* matrice de transformation */ - GLdouble in[4], out[4]; - - /* initilise la matrice et le vecteur a transformer */ - in[0] = objx; - in[1] = objy; - in[2] = objz; - in[3] = 1.0; - transform_point(out, model, in); - transform_point(in, proj, out); - - /* d'ou le resultat normalise entre -1 et 1 */ - if (in[3] == 0.0) - return GL_FALSE; - - in[0] /= in[3]; - in[1] /= in[3]; - in[2] /= in[3]; - - /* en coordonnees ecran */ - *winx = viewport[0] + (1 + in[0]) * viewport[2] / 2; - *winy = viewport[1] + (1 + in[1]) * viewport[3] / 2; - /* entre 0 et 1 suivant z */ - *winz = (1 + in[2]) / 2; - return GL_TRUE; -} - - - -/* transformation du point ecran (winx,winy,winz) en point objet */ -GLint GLAPIENTRY -gluUnProject(GLdouble winx, GLdouble winy, GLdouble winz, - const GLdouble model[16], const GLdouble proj[16], - const GLint viewport[4], - GLdouble * objx, GLdouble * objy, GLdouble * objz) -{ - /* matrice de transformation */ - GLdouble m[16], A[16]; - GLdouble in[4], out[4]; - - /* transformation coordonnees normalisees entre -1 et 1 */ - in[0] = (winx - viewport[0]) * 2 / viewport[2] - 1.0; - in[1] = (winy - viewport[1]) * 2 / viewport[3] - 1.0; - in[2] = 2 * winz - 1.0; - in[3] = 1.0; - - /* calcul transformation inverse */ - matmul(A, proj, model); - if (!invert_matrix(A, m)) - return GL_FALSE; - - /* d'ou les coordonnees objets */ - transform_point(out, m, in); - if (out[3] == 0.0) - return GL_FALSE; - *objx = out[0] / out[3]; - *objy = out[1] / out[3]; - *objz = out[2] / out[3]; - return GL_TRUE; -} - - -/* - * New in GLU 1.3 - * This is like gluUnProject but also takes near and far DepthRange values. - */ -#ifdef GLU_VERSION_1_3 -GLint GLAPIENTRY -gluUnProject4(GLdouble winx, GLdouble winy, GLdouble winz, GLdouble clipw, - const GLdouble modelMatrix[16], - const GLdouble projMatrix[16], - const GLint viewport[4], - GLclampd nearZ, GLclampd farZ, - GLdouble * objx, GLdouble * objy, GLdouble * objz, - GLdouble * objw) -{ - /* matrice de transformation */ - GLdouble m[16], A[16]; - GLdouble in[4], out[4]; - GLdouble z = nearZ + winz * (farZ - nearZ); - - /* transformation coordonnees normalisees entre -1 et 1 */ - in[0] = (winx - viewport[0]) * 2 / viewport[2] - 1.0; - in[1] = (winy - viewport[1]) * 2 / viewport[3] - 1.0; - in[2] = 2.0 * z - 1.0; - in[3] = clipw; - - /* calcul transformation inverse */ - matmul(A, projMatrix, modelMatrix); - if (!invert_matrix(A, m)) - return GL_FALSE; - - /* d'ou les coordonnees objets */ - transform_point(out, m, in); - if (out[3] == 0.0) - return GL_FALSE; - *objx = out[0] / out[3]; - *objy = out[1] / out[3]; - *objz = out[2] / out[3]; - *objw = out[3]; - return GL_TRUE; -} -#endif diff --git a/src/glu/mini/quadric.c b/src/glu/mini/quadric.c deleted file mode 100644 index 0484890ef6..0000000000 --- a/src/glu/mini/quadric.c +++ /dev/null @@ -1,773 +0,0 @@ - -/* - * Mesa 3-D graphics library - * Version: 3.3 - * Copyright (C) 1999-2000 Brian Paul - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the Free - * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - - -/* TODO: - * texture coordinate support - * flip normals according to orientation - * there's still some inside/outside orientation bugs in possibly all - * but the sphere function - */ - - -#ifdef PC_HEADER -#include "all.h" -#else -#include -#include -#include -#include "gluP.h" -#endif - - - -#ifndef M_PI -# define M_PI (3.1415926) -#endif - - -/* - * Convert degrees to radians: - */ -#define DEG_TO_RAD(A) ((A)*(M_PI/180.0)) - - -/* - * Sin and Cos for degree angles: - */ -#define SIND( A ) sin( (A)*(M_PI/180.0) ) -#define COSD( A) cos( (A)*(M_PI/180.0) ) - - -/* - * Texture coordinates if texture flag is set - */ -#define TXTR_COORD(x,y) if (qobj->TextureFlag) glTexCoord2f(x,y); - - - -struct GLUquadric -{ - GLenum DrawStyle; /* GLU_FILL, LINE, SILHOUETTE, or POINT */ - GLenum Orientation; /* GLU_INSIDE or GLU_OUTSIDE */ - GLboolean TextureFlag; /* Generate texture coords? */ - GLenum Normals; /* GLU_NONE, GLU_FLAT, or GLU_SMOOTH */ - void (GLCALLBACK * ErrorFunc) (GLenum err); /* Error handler callback function */ -}; - - - -/* - * Process a GLU error. - */ -static void -quadric_error(GLUquadricObj * qobj, GLenum error, const char *msg) -{ - /* Call the error call back function if any */ - if (qobj->ErrorFunc) { - (*qobj->ErrorFunc) (error); - } - /* Print a message to stdout if MESA_DEBUG variable is defined */ - if (getenv("MESA_DEBUG")) { - fprintf(stderr, "GLUError: %s: %s\n", (char *) gluErrorString(error), - msg); - } -} - - - - -GLUquadricObj *GLAPIENTRY -gluNewQuadric(void) -{ - GLUquadricObj *q; - - q = (GLUquadricObj *) malloc(sizeof(struct GLUquadric)); - if (q) { - q->DrawStyle = GLU_FILL; - q->Orientation = GLU_OUTSIDE; - q->TextureFlag = GL_FALSE; - q->Normals = GLU_SMOOTH; - q->ErrorFunc = NULL; - } - return q; -} - - - -void GLAPIENTRY -gluDeleteQuadric(GLUquadricObj * state) -{ - if (state) { - free((void *) state); - } -} - - - -/* - * Set the drawing style to be GLU_FILL, GLU_LINE, GLU_SILHOUETTE, - * or GLU_POINT. - */ -void GLAPIENTRY -gluQuadricDrawStyle(GLUquadricObj * quadObject, GLenum drawStyle) -{ - if (quadObject && (drawStyle == GLU_FILL || drawStyle == GLU_LINE - || drawStyle == GLU_SILHOUETTE - || drawStyle == GLU_POINT)) { - quadObject->DrawStyle = drawStyle; - } - else { - quadric_error(quadObject, GLU_INVALID_ENUM, "qluQuadricDrawStyle"); - } -} - - - -/* - * Set the orientation to GLU_INSIDE or GLU_OUTSIDE. - */ -void GLAPIENTRY -gluQuadricOrientation(GLUquadricObj * quadObject, GLenum orientation) -{ - if (quadObject - && (orientation == GLU_INSIDE || orientation == GLU_OUTSIDE)) { - quadObject->Orientation = orientation; - } - else { - quadric_error(quadObject, GLU_INVALID_ENUM, "qluQuadricOrientation"); - } -} - - - -/* - * Set the error handler callback function. - */ -void GLAPIENTRY -gluQuadricCallback(GLUquadricObj * qobj, - GLenum which, void (GLCALLBACK * fn) ()) -{ - /* - * UGH, this is a mess! I thought ANSI was a standard. - */ - if (qobj && which == GLU_ERROR) { -#ifdef __CYGWIN32__ - qobj->ErrorFunc = (void (GLCALLBACKPCAST) (GLenum)) fn; -#elif defined(OPENSTEP) - qobj->ErrorFunc = (void (*)(GLenum)) fn; -#elif defined(_WIN32) - qobj->ErrorFunc = (void (GLCALLBACK *) (int)) fn; -#elif defined(__STORM__) - qobj->ErrorFunc = (void (GLCALLBACK *) (GLenum)) fn; -#elif defined(__BEOS__) - qobj->ErrorFunc = (void (*)(GLenum)) fn; -#else - qobj->ErrorFunc = (void (GLCALLBACK *) ()) fn; -#endif - } -} - - -void GLAPIENTRY -gluQuadricNormals(GLUquadricObj * quadObject, GLenum normals) -{ - if (quadObject - && (normals == GLU_NONE || normals == GLU_FLAT - || normals == GLU_SMOOTH)) { - quadObject->Normals = normals; - } -} - - -void GLAPIENTRY -gluQuadricTexture(GLUquadricObj * quadObject, GLboolean textureCoords) -{ - if (quadObject) { - quadObject->TextureFlag = textureCoords; - } -} - - - - -/* - * Call glNormal3f after scaling normal to unit length. - */ -static void -normal3f(GLfloat x, GLfloat y, GLfloat z) -{ -} - - - -void GLAPIENTRY -gluCylinder(GLUquadricObj * qobj, - GLdouble baseRadius, GLdouble topRadius, - GLdouble height, GLint slices, GLint stacks) -{ - GLdouble da, r, dr, dz; - GLfloat x, y, z, nz, nsign; - GLint i, j; - - if (qobj->Orientation == GLU_INSIDE) { - nsign = -1.0; - } - else { - nsign = 1.0; - } - - da = 2.0 * M_PI / slices; - dr = (topRadius - baseRadius) / stacks; - dz = height / stacks; - nz = (baseRadius - topRadius) / height; /* Z component of normal vectors */ - - if (qobj->DrawStyle == GLU_POINT) { - glBegin(GL_POINTS); - for (i = 0; i < slices; i++) { - x = cos(i * da); - y = sin(i * da); - normal3f(x * nsign, y * nsign, nz * nsign); - - z = 0.0; - r = baseRadius; - for (j = 0; j <= stacks; j++) { - glVertex3f(x * r, y * r, z); - z += dz; - r += dr; - } - } - glEnd(); - } - else if (qobj->DrawStyle == GLU_LINE || qobj->DrawStyle == GLU_SILHOUETTE) { - /* Draw rings */ - if (qobj->DrawStyle == GLU_LINE) { - z = 0.0; - r = baseRadius; - for (j = 0; j <= stacks; j++) { - glBegin(GL_LINE_LOOP); - for (i = 0; i < slices; i++) { - x = cos(i * da); - y = sin(i * da); - normal3f(x * nsign, y * nsign, nz * nsign); - glVertex3f(x * r, y * r, z); - } - glEnd(); - z += dz; - r += dr; - } - } - else { - /* draw one ring at each end */ - if (baseRadius != 0.0) { - glBegin(GL_LINE_LOOP); - for (i = 0; i < slices; i++) { - x = cos(i * da); - y = sin(i * da); - normal3f(x * nsign, y * nsign, nz * nsign); - glVertex3f(x * baseRadius, y * baseRadius, 0.0); - } - glEnd(); - glBegin(GL_LINE_LOOP); - for (i = 0; i < slices; i++) { - x = cos(i * da); - y = sin(i * da); - normal3f(x * nsign, y * nsign, nz * nsign); - glVertex3f(x * topRadius, y * topRadius, height); - } - glEnd(); - } - } - /* draw length lines */ - glBegin(GL_LINES); - for (i = 0; i < slices; i++) { - x = cos(i * da); - y = sin(i * da); - normal3f(x * nsign, y * nsign, nz * nsign); - glVertex3f(x * baseRadius, y * baseRadius, 0.0); - glVertex3f(x * topRadius, y * topRadius, height); - } - glEnd(); - } - else if (qobj->DrawStyle == GLU_FILL) { - GLfloat ds = 1.0 / slices; - GLfloat dt = 1.0 / stacks; - GLfloat t = 0.0; - z = 0.0; - r = baseRadius; - for (j = 0; j < stacks; j++) { - GLfloat s = 0.0; - glBegin(GL_QUAD_STRIP); - for (i = 0; i <= slices; i++) { - GLfloat x, y; - if (i == slices) { - x = sin(0.0); - y = cos(0.0); - } - else { - x = sin(i * da); - y = cos(i * da); - } - if (nsign == 1.0) { - normal3f(x * nsign, y * nsign, nz * nsign); - TXTR_COORD(s, t); - glVertex3f(x * r, y * r, z); - normal3f(x * nsign, y * nsign, nz * nsign); - TXTR_COORD(s, t + dt); - glVertex3f(x * (r + dr), y * (r + dr), z + dz); - } - else { - normal3f(x * nsign, y * nsign, nz * nsign); - TXTR_COORD(s, t); - glVertex3f(x * r, y * r, z); - normal3f(x * nsign, y * nsign, nz * nsign); - TXTR_COORD(s, t + dt); - glVertex3f(x * (r + dr), y * (r + dr), z + dz); - } - s += ds; - } /* for slices */ - glEnd(); - r += dr; - t += dt; - z += dz; - } /* for stacks */ - } -} - - - - - -void GLAPIENTRY -gluSphere(GLUquadricObj * qobj, GLdouble radius, GLint slices, GLint stacks) -{ - GLfloat rho, drho, theta, dtheta; - GLfloat x, y, z; - GLfloat s, t, ds, dt; - GLint i, j, imin, imax; - GLboolean normals; - GLfloat nsign; - - if (qobj->Normals == GLU_NONE) { - normals = GL_FALSE; - } - else { - normals = GL_TRUE; - } - if (qobj->Orientation == GLU_INSIDE) { - nsign = -1.0; - } - else { - nsign = 1.0; - } - - drho = M_PI / (GLfloat) stacks; - dtheta = 2.0 * M_PI / (GLfloat) slices; - - /* texturing: s goes from 0.0/0.25/0.5/0.75/1.0 at +y/+x/-y/-x/+y axis */ - /* t goes from -1.0/+1.0 at z = -radius/+radius (linear along longitudes) */ - /* cannot use triangle fan on texturing (s coord. at top/bottom tip varies) */ - - if (qobj->DrawStyle == GLU_FILL) { - if (!qobj->TextureFlag) { - /* draw +Z end as a triangle fan */ - glBegin(GL_TRIANGLE_FAN); -/* glNormal3f(0.0, 0.0, 1.0); */ - glVertex3f(0.0, 0.0, nsign * radius); - for (j = 0; j <= slices; j++) { - theta = (j == slices) ? 0.0 : j * dtheta; - x = -sin(theta) * sin(drho); - y = cos(theta) * sin(drho); - z = nsign * cos(drho); - glVertex3f(x * radius, y * radius, z * radius); - } - glEnd(); - } - - ds = 1.0 / slices; - dt = 1.0 / stacks; - t = 1.0; /* because loop now runs from 0 */ - if (qobj->TextureFlag) { - imin = 0; - imax = stacks; - } - else { - imin = 1; - imax = stacks - 1; - } - - /* draw intermediate stacks as quad strips */ - for (i = imin; i < imax; i++) { - rho = i * drho; - glBegin(GL_QUAD_STRIP); - s = 0.0; - for (j = 0; j <= slices; j++) { - theta = (j == slices) ? 0.0 : j * dtheta; - x = -sin(theta) * sin(rho); - y = cos(theta) * sin(rho); - z = nsign * cos(rho); - TXTR_COORD(s, t); - glVertex3f(x * radius, y * radius, z * radius); - x = -sin(theta) * sin(rho + drho); - y = cos(theta) * sin(rho + drho); - z = nsign * cos(rho + drho); - TXTR_COORD(s, t - dt); - s += ds; - glVertex3f(x * radius, y * radius, z * radius); - } - glEnd(); - t -= dt; - } - - if (!qobj->TextureFlag) { - /* draw -Z end as a triangle fan */ - glBegin(GL_TRIANGLE_FAN); - glVertex3f(0.0, 0.0, -radius * nsign); - rho = M_PI - drho; - s = 1.0; - t = dt; - for (j = slices; j >= 0; j--) { - theta = (j == slices) ? 0.0 : j * dtheta; - x = -sin(theta) * sin(rho); - y = cos(theta) * sin(rho); - z = nsign * cos(rho); - s -= ds; - glVertex3f(x * radius, y * radius, z * radius); - } - glEnd(); - } - } - else if (qobj->DrawStyle == GLU_LINE || qobj->DrawStyle == GLU_SILHOUETTE) { - /* draw stack lines */ - for (i = 1; i < stacks; i++) { /* stack line at i==stacks-1 was missing here */ - rho = i * drho; - glBegin(GL_LINE_LOOP); - for (j = 0; j < slices; j++) { - theta = j * dtheta; - x = cos(theta) * sin(rho); - y = sin(theta) * sin(rho); - z = cos(rho); - glVertex3f(x * radius, y * radius, z * radius); - } - glEnd(); - } - /* draw slice lines */ - for (j = 0; j < slices; j++) { - theta = j * dtheta; - glBegin(GL_LINE_STRIP); - for (i = 0; i <= stacks; i++) { - rho = i * drho; - x = cos(theta) * sin(rho); - y = sin(theta) * sin(rho); - z = cos(rho); - glVertex3f(x * radius, y * radius, z * radius); - } - glEnd(); - } - } - else if (qobj->DrawStyle == GLU_POINT) { - /* top and bottom-most points */ - glBegin(GL_POINTS); - glVertex3f(0.0, 0.0, radius); - glVertex3f(0.0, 0.0, -radius); - - /* loop over stacks */ - for (i = 1; i < stacks - 1; i++) { - rho = i * drho; - for (j = 0; j < slices; j++) { - theta = j * dtheta; - x = cos(theta) * sin(rho); - y = sin(theta) * sin(rho); - z = cos(rho); - glVertex3f(x * radius, y * radius, z * radius); - } - } - glEnd(); - } - -} - - - -void GLAPIENTRY -gluDisk(GLUquadricObj * qobj, - GLdouble innerRadius, GLdouble outerRadius, GLint slices, GLint loops) -{ - GLfloat da, dr; -#if 0 - GLdouble a, da; - GLfloat r, dr; - GLfloat x, y; - GLfloat r1, r2, dtc; - GLint s, l; -#endif - - - da = 2.0 * M_PI / slices; - dr = (outerRadius - innerRadius) / (GLfloat) loops; - - switch (qobj->DrawStyle) { - case GLU_FILL: - { - /* texture of a gluDisk is a cut out of the texture unit square - * x, y in [-outerRadius, +outerRadius]; s, t in [0, 1] - * (linear mapping) - */ - GLfloat dtc = 2.0f * outerRadius; - GLfloat sa, ca; - GLfloat r1 = innerRadius; - GLint l; - for (l = 0; l < loops; l++) { - GLfloat r2 = r1 + dr; - if (qobj->Orientation == GLU_OUTSIDE) { - GLint s; - glBegin(GL_QUAD_STRIP); - for (s = 0; s <= slices; s++) { - GLfloat a; - if (s == slices) - a = 0.0; - else - a = s * da; - sa = sin(a); - ca = cos(a); - TXTR_COORD(0.5 + sa * r2 / dtc, 0.5 + ca * r2 / dtc); - glVertex2f(r2 * sa, r2 * ca); - TXTR_COORD(0.5 + sa * r1 / dtc, 0.5 + ca * r1 / dtc); - glVertex2f(r1 * sa, r1 * ca); - } - glEnd(); - } - else { - GLint s; - glBegin(GL_QUAD_STRIP); - for (s = slices; s >= 0; s--) { - GLfloat a; - if (s == slices) - a = 0.0; - else - a = s * da; - sa = sin(a); - ca = cos(a); - TXTR_COORD(0.5 - sa * r2 / dtc, 0.5 + ca * r2 / dtc); - glVertex2f(r2 * sa, r2 * ca); - TXTR_COORD(0.5 - sa * r1 / dtc, 0.5 + ca * r1 / dtc); - glVertex2f(r1 * sa, r1 * ca); - } - glEnd(); - } - r1 = r2; - } - break; - } - case GLU_LINE: - { - GLint l, s; - /* draw loops */ - for (l = 0; l <= loops; l++) { - GLfloat r = innerRadius + l * dr; - glBegin(GL_LINE_LOOP); - for (s = 0; s < slices; s++) { - GLfloat a = s * da; - glVertex2f(r * sin(a), r * cos(a)); - } - glEnd(); - } - /* draw spokes */ - for (s = 0; s < slices; s++) { - GLfloat a = s * da; - GLfloat x = sin(a); - GLfloat y = cos(a); - glBegin(GL_LINE_STRIP); - for (l = 0; l <= loops; l++) { - GLfloat r = innerRadius + l * dr; - glVertex2f(r * x, r * y); - } - glEnd(); - } - break; - } - case GLU_POINT: - { - GLint s; - glBegin(GL_POINTS); - for (s = 0; s < slices; s++) { - GLfloat a = s * da; - GLfloat x = sin(a); - GLfloat y = cos(a); - GLint l; - for (l = 0; l <= loops; l++) { - GLfloat r = innerRadius * l * dr; - glVertex2f(r * x, r * y); - } - } - glEnd(); - break; - } - case GLU_SILHOUETTE: - { - if (innerRadius != 0.0) { - GLfloat a; - glBegin(GL_LINE_LOOP); - for (a = 0.0; a < 2.0 * M_PI; a += da) { - GLfloat x = innerRadius * sin(a); - GLfloat y = innerRadius * cos(a); - glVertex2f(x, y); - } - glEnd(); - } - { - GLfloat a; - glBegin(GL_LINE_LOOP); - for (a = 0; a < 2.0 * M_PI; a += da) { - GLfloat x = outerRadius * sin(a); - GLfloat y = outerRadius * cos(a); - glVertex2f(x, y); - } - glEnd(); - } - break; - } - default: - abort(); - } -} - - - -void GLAPIENTRY -gluPartialDisk(GLUquadricObj * qobj, GLdouble innerRadius, - GLdouble outerRadius, GLint slices, GLint loops, - GLdouble startAngle, GLdouble sweepAngle) -{ - if (qobj->DrawStyle == GLU_POINT) { - GLint loop, slice; - GLdouble radius, delta_radius; - GLdouble angle, delta_angle; - delta_radius = (outerRadius - innerRadius) / (loops - 1); - delta_angle = DEG_TO_RAD((sweepAngle) / (slices - 1)); - glBegin(GL_POINTS); - radius = innerRadius; - for (loop = 0; loop < loops; loop++) { - angle = DEG_TO_RAD(startAngle); - for (slice = 0; slice < slices; slice++) { - glVertex2f(radius * sin(angle), radius * cos(angle)); - angle += delta_angle; - } - radius += delta_radius; - } - glEnd(); - } - else if (qobj->DrawStyle == GLU_LINE) { - GLint loop, slice; - GLdouble radius, delta_radius; - GLdouble angle, delta_angle; - delta_radius = (outerRadius - innerRadius) / loops; - delta_angle = DEG_TO_RAD(sweepAngle / slices); - /* draw rings */ - radius = innerRadius; - for (loop = 0; loop < loops; loop++) { - angle = DEG_TO_RAD(startAngle); - glBegin(GL_LINE_STRIP); - for (slice = 0; slice <= slices; slice++) { - glVertex2f(radius * sin(angle), radius * cos(angle)); - angle += delta_angle; - } - glEnd(); - radius += delta_radius; - } - /* draw spokes */ - angle = DEG_TO_RAD(startAngle); - for (slice = 0; slice <= slices; slice++) { - radius = innerRadius; - glBegin(GL_LINE_STRIP); - for (loop = 0; loop < loops; loop++) { - glVertex2f(radius * sin(angle), radius * cos(angle)); - radius += delta_radius; - } - glEnd(); - angle += delta_angle; - } - } - else if (qobj->DrawStyle == GLU_SILHOUETTE) { - GLint slice; - GLdouble angle, delta_angle; - delta_angle = DEG_TO_RAD(sweepAngle / slices); - /* draw outer ring */ - glBegin(GL_LINE_STRIP); - angle = DEG_TO_RAD(startAngle); - for (slice = 0; slice <= slices; slice++) { - glVertex2f(outerRadius * sin(angle), outerRadius * cos(angle)); - angle += delta_angle; - } - glEnd(); - /* draw inner ring */ - if (innerRadius > 0.0) { - glBegin(GL_LINE_STRIP); - angle = DEG_TO_RAD(startAngle); - for (slice = 0; slice < slices; slice++) { - glVertex2f(innerRadius * sin(angle), innerRadius * cos(angle)); - angle += delta_angle; - } - glEnd(); - } - /* draw spokes */ - if (sweepAngle < 360.0) { - GLdouble stopAngle = startAngle + sweepAngle; - glBegin(GL_LINES); - glVertex2f(innerRadius * SIND(startAngle), - innerRadius * COSD(startAngle)); - glVertex2f(outerRadius * SIND(startAngle), - outerRadius * COSD(startAngle)); - glVertex2f(innerRadius * SIND(stopAngle), - innerRadius * COSD(stopAngle)); - glVertex2f(outerRadius * SIND(stopAngle), - outerRadius * COSD(stopAngle)); - glEnd(); - } - } - else if (qobj->DrawStyle == GLU_FILL) { - GLint loop, slice; - GLdouble radius, delta_radius; - GLdouble angle, delta_angle; - delta_radius = (outerRadius - innerRadius) / loops; - delta_angle = DEG_TO_RAD(sweepAngle / slices); - radius = innerRadius; - for (loop = 0; loop < loops; loop++) { - glBegin(GL_QUAD_STRIP); - angle = DEG_TO_RAD(startAngle); - for (slice = 0; slice <= slices; slice++) { - if (qobj->Orientation == GLU_OUTSIDE) { - glVertex2f((radius + delta_radius) * sin(angle), - (radius + delta_radius) * cos(angle)); - glVertex2f(radius * sin(angle), radius * cos(angle)); - } - else { - glVertex2f(radius * sin(angle), radius * cos(angle)); - glVertex2f((radius + delta_radius) * sin(angle), - (radius + delta_radius) * cos(angle)); - } - angle += delta_angle; - } - glEnd(); - radius += delta_radius; - } - } -} diff --git a/src/glu/mini/tess.c b/src/glu/mini/tess.c deleted file mode 100644 index 341d29bae3..0000000000 --- a/src/glu/mini/tess.c +++ /dev/null @@ -1,327 +0,0 @@ - -/* - * Mesa 3-D graphics library - * Version: 3.3 - * Copyright (C) 1995-2000 Brian Paul - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the Free - * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - - -/* - * This file is part of the polygon tesselation code contributed by - * Bogdan Sikorski - */ - - -#ifdef PC_HEADER -#include "all.h" -#else -#include -#include -#include "tess.h" -#endif - - -/* - * This is ugly, but seems the easiest way to do things to make the - * code work under YellowBox for Windows - */ -#if defined(OPENSTEP) && defined(CALLBACK) -#undef CALLBACK -#define CALLBACK -#endif - - -static void delete_contours(GLUtriangulatorObj *); - -#ifdef __CYGWIN32__ -#define _CALLBACK -#else -#define _CALLBACK GLCALLBACK -#endif - - -static void -init_callbacks(tess_callbacks * callbacks) -{ - callbacks->begin = (void (_CALLBACK *) (GLenum)) 0; - callbacks->edgeFlag = (void (_CALLBACK *) (GLboolean)) 0; - callbacks->vertex = (void (_CALLBACK *) (void *)) 0; - callbacks->end = (void (_CALLBACK *) (void)) 0; - callbacks->error = (void (_CALLBACK *) (GLenum)) 0; -} - -void -tess_call_user_error(GLUtriangulatorObj * tobj, GLenum gluerr) -{ - if (tobj->error == GLU_NO_ERROR) - tobj->error = gluerr; - if (tobj->callbacks.error != NULL) - (tobj->callbacks.error) (gluerr); -} - -GLUtriangulatorObj *GLAPIENTRY -gluNewTess(void) -{ - GLUtriangulatorObj *tobj; - - if ((tobj = (GLUtriangulatorObj *) - malloc(sizeof(struct GLUtesselator))) == NULL) - return NULL; - tobj->contours = tobj->last_contour = NULL; - init_callbacks(&tobj->callbacks); - tobj->error = GLU_NO_ERROR; - tobj->current_polygon = NULL; - tobj->contour_cnt = 0; - return tobj; -} - - -void GLAPIENTRY -gluTessCallback(GLUtriangulatorObj * tobj, GLenum which, - void (GLCALLBACK * fn) ()) -{ - switch (which) { - case GLU_BEGIN: - tobj->callbacks.begin = (void (_CALLBACK *) (GLenum)) fn; - break; - case GLU_EDGE_FLAG: - tobj->callbacks.edgeFlag = (void (_CALLBACK *) (GLboolean)) fn; - break; - case GLU_VERTEX: - tobj->callbacks.vertex = (void (_CALLBACK *) (void *)) fn; - break; - case GLU_END: - tobj->callbacks.end = (void (_CALLBACK *) (void)) fn; - break; - case GLU_ERROR: - tobj->callbacks.error = (void (_CALLBACK *) (GLenum)) fn; - break; - default: - tobj->error = GLU_INVALID_ENUM; - break; - } -} - - - -void GLAPIENTRY -gluDeleteTess(GLUtriangulatorObj * tobj) -{ - if (tobj->error == GLU_NO_ERROR && tobj->contour_cnt) - /* was gluEndPolygon called? */ - tess_call_user_error(tobj, GLU_TESS_ERROR1); - /* delete all internal structures */ - delete_contours(tobj); - free(tobj); -} - - -void GLAPIENTRY -gluBeginPolygon(GLUtriangulatorObj * tobj) -{ -/* - if(tobj->error!=GLU_NO_ERROR) - return; -*/ - tobj->error = GLU_NO_ERROR; - if (tobj->current_polygon != NULL) { - /* gluEndPolygon was not called */ - tess_call_user_error(tobj, GLU_TESS_ERROR1); - /* delete all internal structures */ - delete_contours(tobj); - } - else { - if ((tobj->current_polygon = - (tess_polygon *) malloc(sizeof(tess_polygon))) == NULL) { - tess_call_user_error(tobj, GLU_OUT_OF_MEMORY); - return; - } - tobj->current_polygon->vertex_cnt = 0; - tobj->current_polygon->vertices = - tobj->current_polygon->last_vertex = NULL; - } -} - - -void GLAPIENTRY -gluEndPolygon(GLUtriangulatorObj * tobj) -{ - /*tess_contour *contour_ptr; */ - - /* there was an error */ - if (tobj->error != GLU_NO_ERROR) - goto end; - - /* check if gluBeginPolygon was called */ - if (tobj->current_polygon == NULL) { - tess_call_user_error(tobj, GLU_TESS_ERROR2); - return; - } - tess_test_polygon(tobj); - /* there was an error */ - if (tobj->error != GLU_NO_ERROR) - goto end; - - /* any real contours? */ - if (tobj->contour_cnt == 0) { - /* delete all internal structures */ - delete_contours(tobj); - return; - } - tess_find_contour_hierarchies(tobj); - /* there was an error */ - if (tobj->error != GLU_NO_ERROR) - goto end; - - tess_handle_holes(tobj); - /* there was an error */ - if (tobj->error != GLU_NO_ERROR) - goto end; - - /* if no callbacks, nothing to do */ - if (tobj->callbacks.begin != NULL && tobj->callbacks.vertex != NULL && - tobj->callbacks.end != NULL) { - if (tobj->callbacks.edgeFlag == NULL) - tess_tesselate(tobj); - else - tess_tesselate_with_edge_flag(tobj); - } - - end: - /* delete all internal structures */ - delete_contours(tobj); -} - - -void GLAPIENTRY -gluNextContour(GLUtriangulatorObj * tobj, GLenum type) -{ - if (tobj->error != GLU_NO_ERROR) - return; - if (tobj->current_polygon == NULL) { - tess_call_user_error(tobj, GLU_TESS_ERROR2); - return; - } - /* first contour? */ - if (tobj->current_polygon->vertex_cnt) - tess_test_polygon(tobj); -} - - -void GLAPIENTRY -gluTessVertex(GLUtriangulatorObj * tobj, GLdouble v[3], void *data) -{ - tess_polygon *polygon = tobj->current_polygon; - tess_vertex *last_vertex_ptr; - - if (tobj->error != GLU_NO_ERROR) - return; - if (polygon == NULL) { - tess_call_user_error(tobj, GLU_TESS_ERROR2); - return; - } - last_vertex_ptr = polygon->last_vertex; - if (last_vertex_ptr == NULL) { - if ((last_vertex_ptr = (tess_vertex *) - malloc(sizeof(tess_vertex))) == NULL) { - tess_call_user_error(tobj, GLU_OUT_OF_MEMORY); - return; - } - polygon->vertices = last_vertex_ptr; - polygon->last_vertex = last_vertex_ptr; - last_vertex_ptr->data = data; - last_vertex_ptr->location[0] = v[0]; - last_vertex_ptr->location[1] = v[1]; - last_vertex_ptr->location[2] = v[2]; - last_vertex_ptr->next = NULL; - last_vertex_ptr->previous = NULL; - ++(polygon->vertex_cnt); - } - else { - tess_vertex *vertex_ptr; - - /* same point twice? */ - if (fabs(last_vertex_ptr->location[0] - v[0]) < EPSILON && - fabs(last_vertex_ptr->location[1] - v[1]) < EPSILON && - fabs(last_vertex_ptr->location[2] - v[2]) < EPSILON) { - tess_call_user_error(tobj, GLU_TESS_ERROR6); - return; - } - if ((vertex_ptr = (tess_vertex *) - malloc(sizeof(tess_vertex))) == NULL) { - tess_call_user_error(tobj, GLU_OUT_OF_MEMORY); - return; - } - vertex_ptr->data = data; - vertex_ptr->location[0] = v[0]; - vertex_ptr->location[1] = v[1]; - vertex_ptr->location[2] = v[2]; - vertex_ptr->next = NULL; - vertex_ptr->previous = last_vertex_ptr; - ++(polygon->vertex_cnt); - last_vertex_ptr->next = vertex_ptr; - polygon->last_vertex = vertex_ptr; - } -} - - -static void -delete_contours(GLUtriangulatorObj * tobj) -{ - tess_polygon *polygon = tobj->current_polygon; - tess_contour *contour, *contour_tmp; - tess_vertex *vertex, *vertex_tmp; - - /* remove current_polygon list - if exists due to detected error */ - if (polygon != NULL) { - if (polygon->vertices) { - for (vertex = polygon->vertices; vertex != polygon->last_vertex;) { - vertex_tmp = vertex->next; - free(vertex); - vertex = vertex_tmp; - } - free(vertex); - } - free(polygon); - tobj->current_polygon = NULL; - } - /* remove all contour data */ - for (contour = tobj->contours; contour != NULL;) { - for (vertex = contour->vertices; vertex != contour->last_vertex;) { - vertex_tmp = vertex->next; - free(vertex); - vertex = vertex_tmp; - } - free(vertex); - contour_tmp = contour->next; - free(contour); - contour = contour_tmp; - } - tobj->contours = tobj->last_contour = NULL; - tobj->contour_cnt = 0; -} - - -void GLAPIENTRY -gluTessNormal(GLUtesselator *tess, GLdouble valueX, GLdouble valueY, GLdouble valueZ) -{ - /* dummy function */ - (void) tess; - (void) valueX; - (void) valueY; - (void) valueZ; -} diff --git a/src/glu/mini/tess.h b/src/glu/mini/tess.h deleted file mode 100644 index 4e51dddd37..0000000000 --- a/src/glu/mini/tess.h +++ /dev/null @@ -1,107 +0,0 @@ - -/* - * Mesa 3-D graphics library - * Version: 3.3 - * Copyright (C) 1995-2000 Brian Paul - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the Free - * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - - -/* - * This file is part of the polygon tesselation code contributed by - * Bogdan Sikorski - */ - - -#ifndef TESS_H -#define TESS_H - - -#include "gluP.h" - -#define EPSILON 1e-06 /* epsilon for double precision compares */ - -typedef enum -{ - OXY, - OYZ, - OXZ -} -projection_type; - -typedef struct callbacks_str -{ - void (GLCALLBACK * begin) (GLenum mode); - void (GLCALLBACK * edgeFlag) (GLboolean flag); - void (GLCALLBACK * vertex) (GLvoid * v); - void (GLCALLBACK * end) (void); - void (GLCALLBACK * error) (GLenum err); -} -tess_callbacks; - -typedef struct vertex_str -{ - void *data; - GLdouble location[3]; - GLdouble x, y; - GLboolean edge_flag; - struct vertex_str *shadow_vertex; - struct vertex_str *next, *previous; -} -tess_vertex; - -typedef struct contour_str -{ - GLenum type; - GLuint vertex_cnt; - GLdouble area; - GLenum orientation; - struct vertex_str *vertices, *last_vertex; - struct contour_str *next, *previous; -} -tess_contour; - -typedef struct polygon_str -{ - GLuint vertex_cnt; - GLdouble A, B, C, D; - GLdouble area; - GLenum orientation; - struct vertex_str *vertices, *last_vertex; -} -tess_polygon; - -struct GLUtesselator -{ - tess_contour *contours, *last_contour; - GLuint contour_cnt; - tess_callbacks callbacks; - tess_polygon *current_polygon; - GLenum error; - GLdouble A, B, C, D; - projection_type projection; -}; - - -extern void tess_call_user_error(GLUtriangulatorObj *, GLenum); -extern void tess_test_polygon(GLUtriangulatorObj *); -extern void tess_find_contour_hierarchies(GLUtriangulatorObj *); -extern void tess_handle_holes(GLUtriangulatorObj *); -extern void tess_tesselate(GLUtriangulatorObj *); -extern void tess_tesselate_with_edge_flag(GLUtriangulatorObj *); - - -#endif diff --git a/src/glu/mini/tesselat.c b/src/glu/mini/tesselat.c deleted file mode 100644 index 47d230073f..0000000000 --- a/src/glu/mini/tesselat.c +++ /dev/null @@ -1,406 +0,0 @@ - -/* - * Mesa 3-D graphics library - * Version: 3.3 - * Copyright (C) 1995-2000 Brian Paul - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the Free - * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - - -/* - * This file is part of the polygon tesselation code contributed by - * Bogdan Sikorski - */ - - -#ifdef PC_HEADER -#include "all.h" -#else -#include -#include -#include "tess.h" -#endif - - - -static GLboolean edge_flag; - -static void emit_triangle(GLUtriangulatorObj *, tess_vertex *, - tess_vertex *, tess_vertex *); - -static void emit_triangle_with_edge_flag(GLUtriangulatorObj *, - tess_vertex *, GLboolean, - tess_vertex *, GLboolean, - tess_vertex *, GLboolean); - -static GLdouble -twice_the_triangle_area(tess_vertex * va, tess_vertex * vb, tess_vertex * vc) -{ - return (vb->x - va->x) * (vc->y - va->y) - (vb->y - va->y) * (vc->x - - va->x); -} - -static GLboolean -left(GLdouble A, GLdouble B, GLdouble C, GLdouble x, GLdouble y) -{ - if (A * x + B * y + C > -EPSILON) - return GL_TRUE; - else - return GL_FALSE; -} - -static GLboolean -right(GLdouble A, GLdouble B, GLdouble C, GLdouble x, GLdouble y) -{ - if (A * x + B * y + C < EPSILON) - return GL_TRUE; - else - return GL_FALSE; -} - -static GLint -convex_ccw(tess_vertex * va, - tess_vertex * vb, tess_vertex * vc, GLUtriangulatorObj * tobj) -{ - GLdouble d; - - d = twice_the_triangle_area(va, vb, vc); - - if (d > EPSILON) { - return 1; - } - else if (d < -EPSILON) { - return 0; - } - else { - return -1; - } -} - -static GLint -convex_cw(tess_vertex * va, - tess_vertex * vb, tess_vertex * vc, GLUtriangulatorObj * tobj) -{ - GLdouble d; - - d = twice_the_triangle_area(va, vb, vc); - - if (d < -EPSILON) { - return 1; - } - else if (d > EPSILON) { - return 0; - } - else { - return -1; - } -} - -static GLboolean -diagonal_ccw(tess_vertex * va, - tess_vertex * vb, - GLUtriangulatorObj * tobj, tess_contour * contour) -{ - tess_vertex *vc = va->next, *vertex, *shadow_vertex; - struct - { - GLdouble A, B, C; - } - ac, cb, ba; - GLdouble x, y; - - GLint res = convex_ccw(va, vc, vb, tobj); - if (res == 0) - return GL_FALSE; - if (res == -1) - return GL_TRUE; - - ba.A = vb->y - va->y; - ba.B = va->x - vb->x; - ba.C = -ba.A * va->x - ba.B * va->y; - ac.A = va->y - vc->y; - ac.B = vc->x - va->x; - ac.C = -ac.A * vc->x - ac.B * vc->y; - cb.A = vc->y - vb->y; - cb.B = vb->x - vc->x; - cb.C = -cb.A * vb->x - cb.B * vb->y; - for (vertex = vb->next; vertex != va; vertex = vertex->next) { - shadow_vertex = vertex->shadow_vertex; - if (shadow_vertex != NULL && - (shadow_vertex == va || shadow_vertex == vb || shadow_vertex == vc)) - continue; - x = vertex->x; - y = vertex->y; - if (left(ba.A, ba.B, ba.C, x, y) && - left(ac.A, ac.B, ac.C, x, y) && left(cb.A, cb.B, cb.C, x, y)) - return GL_FALSE; - } - return GL_TRUE; -} - -static GLboolean -diagonal_cw(tess_vertex * va, - tess_vertex * vb, - GLUtriangulatorObj * tobj, tess_contour * contour) -{ - tess_vertex *vc = va->next, *vertex, *shadow_vertex; - struct - { - GLdouble A, B, C; - } - ac, cb, ba; - GLdouble x, y; - - GLint res = convex_cw(va, vc, vb, tobj); - if (res == 0) - return GL_FALSE; - if (res == -1) - return GL_TRUE; - - ba.A = vb->y - va->y; - ba.B = va->x - vb->x; - ba.C = -ba.A * va->x - ba.B * va->y; - ac.A = va->y - vc->y; - ac.B = vc->x - va->x; - ac.C = -ac.A * vc->x - ac.B * vc->y; - cb.A = vc->y - vb->y; - cb.B = vb->x - vc->x; - cb.C = -cb.A * vb->x - cb.B * vb->y; - for (vertex = vb->next; vertex != va; vertex = vertex->next) { - shadow_vertex = vertex->shadow_vertex; - if (shadow_vertex != NULL && - (shadow_vertex == va || shadow_vertex == vb || shadow_vertex == vc)) - continue; - x = vertex->x; - y = vertex->y; - if (right(ba.A, ba.B, ba.C, x, y) && - right(ac.A, ac.B, ac.C, x, y) && right(cb.A, cb.B, cb.C, x, y)) - return GL_FALSE; - } - return GL_TRUE; -} - -static void -clip_ear(GLUtriangulatorObj * tobj, tess_vertex * v, tess_contour * contour) -{ - emit_triangle(tobj, v->previous, v, v->next); - /* the first in the list */ - if (contour->vertices == v) { - contour->vertices = v->next; - contour->last_vertex->next = v->next; - v->next->previous = contour->last_vertex; - } - else - /* the last ? */ - if (contour->last_vertex == v) { - contour->vertices->previous = v->previous; - v->previous->next = v->next; - contour->last_vertex = v->previous; - } - else { - v->next->previous = v->previous; - v->previous->next = v->next; - } - free(v); - --(contour->vertex_cnt); -} - -static void -clip_ear_with_edge_flag(GLUtriangulatorObj * tobj, - tess_vertex * v, tess_contour * contour) -{ - emit_triangle_with_edge_flag(tobj, v->previous, v->previous->edge_flag, - v, v->edge_flag, v->next, GL_FALSE); - v->previous->edge_flag = GL_FALSE; - /* the first in the list */ - if (contour->vertices == v) { - contour->vertices = v->next; - contour->last_vertex->next = v->next; - v->next->previous = contour->last_vertex; - } - else - /* the last ? */ - if (contour->last_vertex == v) { - contour->vertices->previous = v->previous; - v->previous->next = v->next; - contour->last_vertex = v->previous; - } - else { - v->next->previous = v->previous; - v->previous->next = v->next; - } - free(v); - --(contour->vertex_cnt); -} - -static void -triangulate_ccw(GLUtriangulatorObj * tobj, tess_contour * contour) -{ - tess_vertex *vertex; - GLuint vertex_cnt = contour->vertex_cnt; - - while (vertex_cnt > 3) { - vertex = contour->vertices; - while (diagonal_ccw(vertex, vertex->next->next, tobj, contour) == - GL_FALSE && tobj->error == GLU_NO_ERROR) - vertex = vertex->next; - if (tobj->error != GLU_NO_ERROR) - return; - clip_ear(tobj, vertex->next, contour); - --vertex_cnt; - } -} - -static void -triangulate_cw(GLUtriangulatorObj * tobj, tess_contour * contour) -{ - tess_vertex *vertex; - GLuint vertex_cnt = contour->vertex_cnt; - - while (vertex_cnt > 3) { - vertex = contour->vertices; - while (diagonal_cw(vertex, vertex->next->next, tobj, contour) == - GL_FALSE && tobj->error == GLU_NO_ERROR) - vertex = vertex->next; - if (tobj->error != GLU_NO_ERROR) - return; - clip_ear(tobj, vertex->next, contour); - --vertex_cnt; - } -} - -static void -triangulate_ccw_with_edge_flag(GLUtriangulatorObj * tobj, - tess_contour * contour) -{ - tess_vertex *vertex; - GLuint vertex_cnt = contour->vertex_cnt; - - while (vertex_cnt > 3) { - vertex = contour->vertices; - while (diagonal_ccw(vertex, vertex->next->next, tobj, contour) == - GL_FALSE && tobj->error == GLU_NO_ERROR) - vertex = vertex->next; - if (tobj->error != GLU_NO_ERROR) - return; - clip_ear_with_edge_flag(tobj, vertex->next, contour); - --vertex_cnt; - } -} - -static void -triangulate_cw_with_edge_flag(GLUtriangulatorObj * tobj, - tess_contour * contour) -{ - tess_vertex *vertex; - GLuint vertex_cnt = contour->vertex_cnt; - - while (vertex_cnt > 3) { - vertex = contour->vertices; - while (diagonal_cw(vertex, vertex->next->next, tobj, contour) == - GL_FALSE && tobj->error == GLU_NO_ERROR) - vertex = vertex->next; - if (tobj->error != GLU_NO_ERROR) - return; - clip_ear_with_edge_flag(tobj, vertex->next, contour); - --vertex_cnt; - } -} - -void -tess_tesselate(GLUtriangulatorObj * tobj) -{ - tess_contour *contour; - - for (contour = tobj->contours; contour != NULL; contour = contour->next) { - if (contour->orientation == GLU_CCW) { - triangulate_ccw(tobj, contour); - } - else { - triangulate_cw(tobj, contour); - } - if (tobj->error != GLU_NO_ERROR) - return; - - /* emit the last triangle */ - emit_triangle(tobj, contour->vertices, contour->vertices->next, - contour->vertices->next->next); - } -} - -void -tess_tesselate_with_edge_flag(GLUtriangulatorObj * tobj) -{ - tess_contour *contour; - - edge_flag = GL_TRUE; - /* first callback with edgeFlag set to GL_TRUE */ - (tobj->callbacks.edgeFlag) (GL_TRUE); - - for (contour = tobj->contours; contour != NULL; contour = contour->next) { - if (contour->orientation == GLU_CCW) - triangulate_ccw_with_edge_flag(tobj, contour); - else - triangulate_cw_with_edge_flag(tobj, contour); - if (tobj->error != GLU_NO_ERROR) - return; - /* emit the last triangle */ - emit_triangle_with_edge_flag(tobj, contour->vertices, - contour->vertices->edge_flag, - contour->vertices->next, - contour->vertices->next->edge_flag, - contour->vertices->next->next, - contour->vertices->next->next->edge_flag); - } -} - -static void -emit_triangle(GLUtriangulatorObj * tobj, - tess_vertex * v1, tess_vertex * v2, tess_vertex * v3) -{ - (tobj->callbacks.begin) (GL_TRIANGLES); - (tobj->callbacks.vertex) (v1->data); - (tobj->callbacks.vertex) (v2->data); - (tobj->callbacks.vertex) (v3->data); - (tobj->callbacks.end) (); -} - -static void -emit_triangle_with_edge_flag(GLUtriangulatorObj * tobj, - tess_vertex * v1, - GLboolean edge_flag1, - tess_vertex * v2, - GLboolean edge_flag2, - tess_vertex * v3, GLboolean edge_flag3) -{ - (tobj->callbacks.begin) (GL_TRIANGLES); - if (edge_flag1 != edge_flag) { - edge_flag = (edge_flag == GL_TRUE ? GL_FALSE : GL_TRUE); - (tobj->callbacks.edgeFlag) (edge_flag); - } - (tobj->callbacks.vertex) (v1->data); - if (edge_flag2 != edge_flag) { - edge_flag = (edge_flag == GL_TRUE ? GL_FALSE : GL_TRUE); - (tobj->callbacks.edgeFlag) (edge_flag); - } - (tobj->callbacks.vertex) (v2->data); - if (edge_flag3 != edge_flag) { - edge_flag = (edge_flag == GL_TRUE ? GL_FALSE : GL_TRUE); - (tobj->callbacks.edgeFlag) (edge_flag); - } - (tobj->callbacks.vertex) (v3->data); - (tobj->callbacks.end) (); -} diff --git a/src/glut/os2/Makefile b/src/glut/os2/Makefile deleted file mode 100644 index 102a8b688d..0000000000 --- a/src/glut/os2/Makefile +++ /dev/null @@ -1,420 +0,0 @@ -# Makefile -# Created by IBM WorkFrame/2 MakeMake at 12:46:25 on 3 June 2003 -# -# The actions included in this make file are: -# Compile::C++ Compiler -# Link::Linker -# Lib::Import Lib - -.SUFFIXES: - -.SUFFIXES: \ - .LIB .cpp .dll .obj - -.cpp.obj: - @echo " Compile::C++ Compiler " - icc.exe /I..\ /I..\X86 /I..\GL /I..\swrast /I..\swrast_setup /Ss /Wcmpcndcnscnvcpydclenuextgeninilanobsordparporppcprorearettrdtruund /Tx /O /Gm /Ge- /G5 /Gf /Gi /Oi /C %s - -{G:\EVGEN\MESA5\src-glut.os2pm}.cpp.obj: - @echo " Compile::C++ Compiler " - icc.exe /I..\ /I..\X86 /I..\GL /I..\swrast /I..\swrast_setup /Ss /Wcmpcndcnscnvcpydclenuextgeninilanobsordparporppcprorearettrdtruund /Tx /O /Gm /Ge- /G5 /Gf /Gi /Oi /C %s - -.dll.LIB: - @echo " Lib::Import Lib " - implib.exe %|dpfF.LIB %s - -{G:\EVGEN\MESA5\src-glut.os2pm}.dll.LIB: - @echo " Lib::Import Lib " - implib.exe %|dpfF.LIB %s - -all: \ - .\libGlut.LIB - -.\libGlut.dll: \ - .\os2_winproc.obj \ - .\WarpWin.obj \ - .\glutOverlay.obj \ - .\glut_8x13.obj \ - .\glut_9x15.obj \ - .\glut_bitmap.obj \ - .\glut_cindex.obj \ - .\glut_cmap.obj \ - .\glut_cursor.obj \ - .\glut_event.obj \ - .\glut_ext.obj \ - .\glut_fullscrn.obj \ - .\glut_gamemode.obj \ - .\glut_get.obj \ - .\glut_hel10.obj \ - .\glut_hel12.obj \ - .\glut_hel18.obj \ - .\glut_init.obj \ - .\glut_input.obj \ - .\glut_key.obj \ - .\glut_keyctrl.obj \ - .\glut_keyup.obj \ - .\glut_mesa.obj \ - .\glut_modifier.obj \ - .\glut_roman.obj \ - .\glut_shapes.obj \ - .\glut_stroke.obj \ - .\glut_swap.obj \ - .\glut_teapot.obj \ - .\glut_tr24.obj \ - .\glut_util.obj \ - .\glut_vidresize.obj \ - .\glut_warp.obj \ - .\glut_win.obj \ - .\glut_winmisc.obj \ - .\os2_glx.obj \ - .\os2_menu.obj \ - ..\si-glu\libGLU.lib \ - ..\MesaDll\MesaGL2.lib \ - ..\drv\DrvLoad\MesaDrvLoad.lib \ - {$(LIB)}libGlut.DEF - @echo " Link::Linker " - icc.exe @<< - /B" /dbgpack /exepack:2 /st:200000 /packd /optfunc" - /FelibGlut.dll - ..\si-glu\libGLU.lib - ..\MesaDll\MesaGL2.lib - ..\drv\DrvLoad\MesaDrvLoad.lib - libGlut.DEF - .\os2_winproc.obj - .\WarpWin.obj - .\glutOverlay.obj - .\glut_8x13.obj - .\glut_9x15.obj - .\glut_bitmap.obj - .\glut_cindex.obj - .\glut_cmap.obj - .\glut_cursor.obj - .\glut_event.obj - .\glut_ext.obj - .\glut_fullscrn.obj - .\glut_gamemode.obj - .\glut_get.obj - .\glut_hel10.obj - .\glut_hel12.obj - .\glut_hel18.obj - .\glut_init.obj - .\glut_input.obj - .\glut_key.obj - .\glut_keyctrl.obj - .\glut_keyup.obj - .\glut_mesa.obj - .\glut_modifier.obj - .\glut_roman.obj - .\glut_shapes.obj - .\glut_stroke.obj - .\glut_swap.obj - .\glut_teapot.obj - .\glut_tr24.obj - .\glut_util.obj - .\glut_vidresize.obj - .\glut_warp.obj - .\glut_win.obj - .\glut_winmisc.obj - .\os2_glx.obj - .\os2_menu.obj -<< - -.\os2_winproc.obj: \ - G:\EVGEN\MESA5\src-glut.os2pm\os2_winproc.cpp \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}WarpGL.h \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}glutint.h \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}glutwin32.h \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}win32_x11.h \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}win32_glx.h \ - gl\os2mesa.h \ - gl\gl.h \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}gl_mangle.h \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}GL/os2_x11.h \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}os2_config.h \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}os2mesadef.h \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}context.h \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}glapi.h \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}mtypes.h \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}glheader.h \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}config.h \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}glapitable.h \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}glthread.h \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}math/m_matrix.h \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}Trace/tr_context.h \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}dd.h \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}conf.h \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}GL/os2_config.h \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}GL/glext.h \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}Xthreads.h - -.\os2_menu.obj: \ - G:\EVGEN\MESA5\src-glut.os2pm\os2_menu.cpp \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}WarpGL.h \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}glutint.h \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}glutwin32.h \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}win32_x11.h \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}win32_glx.h - -.\os2_glx.obj: \ - G:\EVGEN\MESA5\src-glut.os2pm\os2_glx.cpp \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}WarpGL.h \ - gl\os2mesa.h \ - gl\gl.h \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}gl_mangle.h \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}GL/os2_x11.h \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}os2_config.h - -.\glut_winmisc.obj: \ - G:\EVGEN\MESA5\src-glut.os2pm\glut_winmisc.cpp \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}WarpGL.h \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}glutint.h \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}glutwin32.h \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}win32_x11.h \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}win32_glx.h - -.\glut_win.obj: \ - G:\EVGEN\MESA5\src-glut.os2pm\glut_win.cpp \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}WarpGL.h \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}glutint.h \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}glutwin32.h \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}win32_x11.h \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}win32_glx.h \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}glutos2.h \ - gl\os2mesa.h \ - gl\gl.h \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}gl_mangle.h \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}GL/os2_x11.h \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}os2_config.h - -.\glut_warp.obj: \ - G:\EVGEN\MESA5\src-glut.os2pm\glut_warp.cpp \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}WarpGL.h \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}glutint.h \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}glutwin32.h \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}win32_x11.h \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}win32_glx.h - -.\glut_vidresize.obj: \ - G:\EVGEN\MESA5\src-glut.os2pm\glut_vidresize.cpp \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}WarpGL.h \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}glutint.h \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}glutwin32.h \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}win32_x11.h \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}win32_glx.h - -.\glut_util.obj: \ - G:\EVGEN\MESA5\src-glut.os2pm\glut_util.cpp \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}WarpGL.h \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}glutint.h \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}glutwin32.h \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}win32_x11.h \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}win32_glx.h - -.\glut_tr24.obj: \ - G:\EVGEN\MESA5\src-glut.os2pm\glut_tr24.cpp \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}glutbitmap.h - -.\glut_teapot.obj: \ - G:\EVGEN\MESA5\src-glut.os2pm\glut_teapot.cpp \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}WarpGL.h \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}glutint.h \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}glutwin32.h \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}win32_x11.h \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}win32_glx.h - -.\glut_swap.obj: \ - G:\EVGEN\MESA5\src-glut.os2pm\glut_swap.cpp \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}WarpGL.h \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}glutint.h \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}glutwin32.h \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}win32_x11.h \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}win32_glx.h - -.\glut_stroke.obj: \ - G:\EVGEN\MESA5\src-glut.os2pm\glut_stroke.cpp \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}WarpGL.h \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}glutint.h \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}glutstroke.h \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}glutwin32.h \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}win32_x11.h \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}win32_glx.h - -.\glut_shapes.obj: \ - G:\EVGEN\MESA5\src-glut.os2pm\glut_shapes.cpp \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}WarpGL.h \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}glutint.h \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}glutwin32.h \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}win32_x11.h \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}win32_glx.h - -.\glut_roman.obj: \ - G:\EVGEN\MESA5\src-glut.os2pm\glut_roman.cpp \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}glutstroke.h - -.\glut_modifier.obj: \ - G:\EVGEN\MESA5\src-glut.os2pm\glut_modifier.cpp \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}WarpGL.h \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}glutint.h \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}glutwin32.h \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}win32_x11.h \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}win32_glx.h - -.\glut_mesa.obj: \ - G:\EVGEN\MESA5\src-glut.os2pm\glut_mesa.cpp \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}WarpGL.h \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}glutint.h \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}glutwin32.h \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}win32_x11.h \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}win32_glx.h - -.\glut_keyup.obj: \ - G:\EVGEN\MESA5\src-glut.os2pm\glut_keyup.cpp \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}WarpGL.h \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}glutint.h \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}glutwin32.h \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}win32_x11.h \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}win32_glx.h - -.\glut_keyctrl.obj: \ - G:\EVGEN\MESA5\src-glut.os2pm\glut_keyctrl.cpp \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}WarpGL.h \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}glutint.h \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}glutwin32.h \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}win32_x11.h \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}win32_glx.h - -.\glut_key.obj: \ - G:\EVGEN\MESA5\src-glut.os2pm\glut_key.cpp \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}WarpGL.h \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}glutint.h \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}glutwin32.h \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}win32_x11.h \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}win32_glx.h - -.\glut_input.obj: \ - G:\EVGEN\MESA5\src-glut.os2pm\glut_input.cpp \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}WarpGL.h \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}glutint.h \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}glutwin32.h \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}win32_x11.h \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}win32_glx.h - -.\glut_init.obj: \ - G:\EVGEN\MESA5\src-glut.os2pm\glut_init.cpp \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}WarpGL.h \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}glutint.h \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}glutwin32.h \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}win32_x11.h \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}win32_glx.h - -.\glut_hel18.obj: \ - G:\EVGEN\MESA5\src-glut.os2pm\glut_hel18.cpp \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}glutbitmap.h - -.\glut_hel12.obj: \ - G:\EVGEN\MESA5\src-glut.os2pm\glut_hel12.cpp \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}glutbitmap.h - -.\glut_hel10.obj: \ - G:\EVGEN\MESA5\src-glut.os2pm\glut_hel10.cpp \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}glutbitmap.h - -.\glut_get.obj: \ - G:\EVGEN\MESA5\src-glut.os2pm\glut_get.cpp \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}WarpGL.h \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}glutint.h \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}glutwin32.h \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}win32_x11.h \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}win32_glx.h - -.\glut_gamemode.obj: \ - G:\EVGEN\MESA5\src-glut.os2pm\glut_gamemode.cpp \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}WarpGL.h \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}glutint.h \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}glutwin32.h \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}win32_x11.h \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}win32_glx.h - -.\glut_fullscrn.obj: \ - G:\EVGEN\MESA5\src-glut.os2pm\glut_fullscrn.cpp \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}WarpGL.h \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}glutint.h \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}glutwin32.h \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}win32_x11.h \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}win32_glx.h - -.\glut_ext.obj: \ - G:\EVGEN\MESA5\src-glut.os2pm\glut_ext.cpp \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}WarpGL.h \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}glutint.h \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}glutwin32.h \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}win32_x11.h \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}win32_glx.h - -.\glut_event.obj: \ - G:\EVGEN\MESA5\src-glut.os2pm\glut_event.cpp \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}WarpGL.h \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}glutint.h \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}glutwin32.h \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}win32_x11.h \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}win32_glx.h - -.\glut_cursor.obj: \ - G:\EVGEN\MESA5\src-glut.os2pm\glut_cursor.cpp \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}WarpGL.h \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}glutint.h \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}glutwin32.h \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}win32_x11.h \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}win32_glx.h - -.\glut_cmap.obj: \ - G:\EVGEN\MESA5\src-glut.os2pm\glut_cmap.cpp \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}WarpGL.h \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}glutint.h \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}glutwin32.h \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}win32_x11.h \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}win32_glx.h \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}layerutil.h - -.\glut_cindex.obj: \ - G:\EVGEN\MESA5\src-glut.os2pm\glut_cindex.cpp \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}WarpGL.h \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}glutint.h \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}glutwin32.h \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}win32_x11.h \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}win32_glx.h - -.\glut_bitmap.obj: \ - G:\EVGEN\MESA5\src-glut.os2pm\glut_bitmap.cpp \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}WarpGL.h \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}glutint.h \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}glutbitmap.h \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}glutwin32.h \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}win32_x11.h \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}win32_glx.h - -.\glut_9x15.obj: \ - G:\EVGEN\MESA5\src-glut.os2pm\glut_9x15.cpp \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}glutbitmap.h - -.\glut_8x13.obj: \ - G:\EVGEN\MESA5\src-glut.os2pm\glut_8x13.cpp \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}glutbitmap.h - -.\glutOverlay.obj: \ - G:\EVGEN\MESA5\src-glut.os2pm\glutOverlay.cpp \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}WarpGL.h \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}glutint.h \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}glutbitmap.h \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}glutstroke.h \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}glutwin32.h \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}win32_x11.h \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}win32_glx.h - -.\WarpWin.obj: \ - G:\EVGEN\MESA5\src-glut.os2pm\WarpWin.cpp \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}WarpWin.h \ - {G:\EVGEN\MESA5\src-glut.os2pm;..\;..\X86;..\GL;..\swrast;..\swrast_setup;$(INCLUDE);}WarpGL.h - -.\libGlut.LIB: \ - .\libGlut.dll diff --git a/src/glut/os2/WarpWin.cpp b/src/glut/os2/WarpWin.cpp deleted file mode 100644 index 71cc8e1bc9..0000000000 --- a/src/glut/os2/WarpWin.cpp +++ /dev/null @@ -1,419 +0,0 @@ -/* WarpWin.c */ -/* glut for Warp */ -#include -#include - -#include "WarpWin.h" -#include "WarpGL.h" - -#define POKA 0 - -/* global variables that must be set for some functions to operate - correctly. */ -HDC XHDC; -HWND XHWND; - - -void -XStoreColor(Display* display, Colormap colormap, XColor* color) -{ - /* KLUDGE: set XHDC to 0 if the palette should NOT be realized after - setting the color. set XHDC to the correct HDC if it should. */ - - LONG pe; - ULONG cclr; - int r,g,b; - /* X11 stores color from 0-65535, Win32 expects them to be 0-256, so - twiddle the bits ( / 256). */ - r = color->red / 256; - g = color->green / 256; - b = color->blue / 256; - pe = LONGFromRGB(r,g,b); - /* make sure we use this flag, otherwise the colors might get mapped - to another place in the colormap, and when we glIndex() that - color, it may have moved (argh!!) */ - pe |= (PC_NOCOLLAPSE<<24); -/* This function changes the entries in a palette. */ -#if POKA -OS2: - rc = GpiSetPaletteEntries(colormap,LCOLF_CONSECRGB, color->pixel, 1, &pe); - GpiSelectPalette(hps,colormap); - WinRealizePalette(hwnd,hps,&cclr); -source Win: - if (XHDC) { - UnrealizeObject(colormap); - SelectPalette(XHDC, colormap, FALSE); - RealizePalette(XHDC); - - } -#endif -} - -void -XSetWindowColormap(Display* display, Window window, Colormap colormap) -{ -#if POKA - HDC hdc = GetDC(window); - - /* if the third parameter is FALSE, the logical colormap is copied - into the device palette when the application is in the - foreground, if it is TRUE, the colors are mapped into the current - palette in the best possible way. */ - SelectPalette(hdc, colormap, FALSE); - RealizePalette(hdc); - - /* note that we don't have to release the DC, since our window class - uses the WC_OWNDC flag! */ -#endif -} - - -/* display, root and visual - don't used at all */ -Colormap -XCreateColormap(Display* display, Window root, Visual* visual, int alloc) -{ - /* KLUDGE: this function needs XHDC to be set to the HDC currently - being operated on before it is invoked! */ - - HPAL palette; - int n; -#if POKA - PIXELFORMATDESCRIPTOR pfd; - LOGPALETTE *logical; - - /* grab the pixel format */ - memset(&pfd, 0, sizeof(PIXELFORMATDESCRIPTOR)); - DescribePixelFormat(XHDC, GetPixelFormat(XHDC), - sizeof(PIXELFORMATDESCRIPTOR), &pfd); - - if (!(pfd.dwFlags & PFD_NEED_PALETTE || - pfd.iPixelType == PFD_TYPE_COLORINDEX)) - { - return 0; - } - - n = 1 << pfd.cColorBits; - - /* allocate a bunch of memory for the logical palette (assume 256 - colors in a Win32 palette */ - logical = (LOGPALETTE*)malloc(sizeof(LOGPALETTE) + - sizeof(PALETTEENTRY) * n); - memset(logical, 0, sizeof(LOGPALETTE) + sizeof(PALETTEENTRY) * n); - - /* set the entries in the logical palette */ - logical->palVersion = 0x300; - logical->palNumEntries = n; - - /* start with a copy of the current system palette */ - GetSystemPaletteEntries(XHDC, 0, 256, &logical->palPalEntry[0]); - - if (pfd.iPixelType == PFD_TYPE_RGBA) { - int redMask = (1 << pfd.cRedBits) - 1; - int greenMask = (1 << pfd.cGreenBits) - 1; - int blueMask = (1 << pfd.cBlueBits) - 1; - int i; - - /* fill in an RGBA color palette */ - for (i = 0; i < n; ++i) { - logical->palPalEntry[i].peRed = - (((i >> pfd.cRedShift) & redMask) * 255) / redMask; - logical->palPalEntry[i].peGreen = - (((i >> pfd.cGreenShift) & greenMask) * 255) / greenMask; - logical->palPalEntry[i].peBlue = - (((i >> pfd.cBlueShift) & blueMask) * 255) / blueMask; - logical->palPalEntry[i].peFlags = 0; - } - } - - palette = CreatePalette(logical); - free(logical); - - SelectPalette(XHDC, palette, FALSE); - RealizePalette(XHDC); -#endif /* POKA */ - - return palette; -} - - - -int GetSystemMetrics( int mode) -{ RECTL rect; - - switch(mode) - { case SM_CXSCREEN: - WinQueryWindowRect(HWND_DESKTOP,&rect); - return (rect.xRight-rect.xLeft); - break; - case SM_CYSCREEN: - WinQueryWindowRect(HWND_DESKTOP,&rect); - return (rect.yTop-rect.yBottom); - break; - default: ; - } - return 0; -} -/* - * XParseGeometry parses strings of the form - * "=x{+-}{+-}", where - * width, height, xoffset, and yoffset are unsigned integers. - * Example: "=80x24+300-49" - * The equal sign is optional. - * It returns a bitmask that indicates which of the four values - * were actually found in the string. For each value found, - * the corresponding argument is updated; for each value - * not found, the corresponding argument is left unchanged. - */ - -static int -ReadInteger(char *string, char **NextString) -{ - register int Result = 0; - int Sign = 1; - - if (*string == '+') - string++; - else if (*string == '-') - { - string++; - Sign = -1; - } - for (; (*string >= '0') && (*string <= '9'); string++) - { - Result = (Result * 10) + (*string - '0'); - } - *NextString = string; - if (Sign >= 0) - return (Result); - else - return (-Result); -} - -int XParseGeometry(char *string, int *x, int *y, unsigned int *width, unsigned int *height) -{ - int mask = NoValue; - register char *strind; - unsigned int tempWidth, tempHeight; - int tempX, tempY; - char *nextCharacter; - - if ( (string == NULL) || (*string == '\0')) return(mask); - if (*string == '=') - string++; /* ignore possible '=' at beg of geometry spec */ - - strind = (char *)string; - if (*strind != '+' && *strind != '-' && *strind != 'x') { - tempWidth = ReadInteger(strind, &nextCharacter); - if (strind == nextCharacter) - return (0); - strind = nextCharacter; - mask |= WidthValue; - } - - if (*strind == 'x' || *strind == 'X') { - strind++; - tempHeight = ReadInteger(strind, &nextCharacter); - if (strind == nextCharacter) - return (0); - strind = nextCharacter; - mask |= HeightValue; - } - - if ((*strind == '+') || (*strind == '-')) { - if (*strind == '-') { - strind++; - tempX = -ReadInteger(strind, &nextCharacter); - if (strind == nextCharacter) - return (0); - strind = nextCharacter; - mask |= XNegative; - - } - else - { strind++; - tempX = ReadInteger(strind, &nextCharacter); - if (strind == nextCharacter) - return(0); - strind = nextCharacter; - } - mask |= XValue; - if ((*strind == '+') || (*strind == '-')) { - if (*strind == '-') { - strind++; - tempY = -ReadInteger(strind, &nextCharacter); - if (strind == nextCharacter) - return(0); - strind = nextCharacter; - mask |= YNegative; - - } - else - { - strind++; - tempY = ReadInteger(strind, &nextCharacter); - if (strind == nextCharacter) - return(0); - strind = nextCharacter; - } - mask |= YValue; - } - } - - /* If strind isn't at the end of the string the it's an invalid - geometry specification. */ - - if (*strind != '\0') return (0); - - if (mask & XValue) - *x = tempX; - if (mask & YValue) - *y = tempY; - if (mask & WidthValue) - *width = tempWidth; - if (mask & HeightValue) - *height = tempHeight; - return (mask); -} - -int gettimeofday(struct timeval* tp, void* tzp) -{ - DATETIME DateTime; - APIRET ulrc; /* Return Code. */ - - ulrc = DosGetDateTime(&DateTime); - tp->tv_sec = 60 * (60*DateTime.hours + DateTime.minutes) + DateTime.seconds; - tp->tv_usec = DateTime.hundredths * 10000; - return 0; -} - - -int -XPending(Display* display) -{ - /* similar functionality...I don't think that it is exact, but this - will have to do. */ - QMSG msg; - extern HAB hab; /* PM anchor block handle */ - -//?? WinPeekMsg(hab - return WinPeekMsg(hab, &msg, NULLHANDLE, 0, 0, PM_NOREMOVE); -} - -void -__glutAdjustCoords(Window parent, int* x, int* y, int* width, int* height) -{ - RECTL rect; - - /* adjust the window rectangle because Win32 thinks that the x, y, - width & height are the WHOLE window (including decorations), - whereas GLUT treats the x, y, width & height as only the CLIENT - area of the window. */ - rect.xLeft = *x; rect.yTop = *y; - rect.xRight = *x + *width; rect.yBottom = *y + *height; - - /* must adjust the coordinates according to the correct style - because depending on the style, there may or may not be - borders. */ -//?? AdjustWindowRect(&rect, WS_CLIPSIBLINGS | WS_CLIPCHILDREN | -//?? (parent ? WS_CHILD : WS_OVERLAPPEDWINDOW), -//?? FALSE); - /* FALSE in the third parameter = window has no menu bar */ - - /* readjust if the x and y are offscreen */ - if(rect.xLeft < 0) { - *x = 0; - } else { - *x = rect.xLeft; - } - - if(rect.yTop < 0) { - *y = 0; - } else { - *y = rect.yTop; - } - - *width = rect.xRight - rect.xLeft; /* adjusted width */ - *height = -(rect.yBottom - rect.yTop); /* adjusted height */ -} - - -int -__glutGetTransparentPixel(Display * dpy, XVisualInfo * vinfo) -{ - /* the transparent pixel on Win32 is always index number 0. So if - we put this routine in this file, we can avoid compiling the - whole of layerutil.c which is where this routine normally comes - from. */ - return 0; -} - -/* Translate point coordinates src_x and src_y from src to dst */ - -Bool -XTranslateCoordinates(Display *display, Window src, Window dst, - int src_x, int src_y, - int* dest_x_return, int* dest_y_return, - Window* child_return) -{ - SWP swp_src,swp_dst; - - WinQueryWindowPos(src,&swp_src); - WinQueryWindowPos(dst,&swp_dst); - - *dest_x_return = src_x + swp_src.x - swp_dst.x; - *dest_y_return = src_y + swp_src.y - swp_dst.y; - - /* just to make compilers happy...we don't use the return value. */ - return True; -} - -Status -XGetGeometry(Display* display, Window window, Window* root_return, - int* x_return, int* y_return, - unsigned int* width_return, unsigned int* height_return, - unsigned int *border_width_return, unsigned int* depth_return) -{ - /* KLUDGE: doesn't return the border_width or depth or root, x & y - are in screen coordinates. */ - SWP swp_src; - WinQueryWindowPos(window,&swp_src); - - *x_return = swp_src.x; - *y_return = swp_src.y; - *width_return = swp_src.cx; - *height_return = swp_src.cy; - - /* just to make compilers happy...we don't use the return value. */ - return 1; -} - -/* Get Display Width in millimeters */ -int -DisplayWidthMM(Display* display, int screen) -{ - int width; - LONG *pVC_Caps; - pVC_Caps = GetVideoConfig(NULLHANDLE); - width = (int)( 0.001 * pVC_Caps[CAPS_WIDTH] / pVC_Caps[CAPS_HORIZONTAL_RESOLUTION]);/* mm */ - return width; -} - -/* Get Display Height in millimeters */ -int -DisplayHeightMM(Display* display, int screen) -{ - int height; - LONG *pVC_Caps; - pVC_Caps = GetVideoConfig(NULLHANDLE); - height = (int)( 0.001 * pVC_Caps[CAPS_HEIGHT] / pVC_Caps[CAPS_VERTICAL_RESOLUTION]); /* mm */ - return height; -} - -void ScreenToClient( HWND hwnd, POINTL *point) -{ - SWP swp_src; - WinQueryWindowPos(hwnd,&swp_src); - point->x -= swp_src.x; - point->y -= swp_src.y; -} - diff --git a/src/glut/os2/glutOverlay.cpp b/src/glut/os2/glutOverlay.cpp deleted file mode 100644 index d57c4e7418..0000000000 --- a/src/glut/os2/glutOverlay.cpp +++ /dev/null @@ -1,133 +0,0 @@ -/*********************************************************** - * Copyright (C) 1997, Be Inc. All rights reserved. - * - * FILE: glutOverlay.cpp - * - * DESCRIPTION: we don't support overlays, so this code is - * really simple - ***********************************************************/ - -/*********************************************************** - * Headers - ***********************************************************/ -#include -#include "glutint.h" -#include "glutbitmap.h" -#include "glutstroke.h" - -GLUTAPI void GLUTAPIENTRY -glutEstablishOverlay(void) -{ - __glutFatalError("OS2PM lacks overlay support."); -} - -GLUTAPI void GLUTAPIENTRY -glutUseLayer(GLenum layer) { - // ignore -} - -GLUTAPI void GLUTAPIENTRY -glutRemoveOverlay(void) { - // ignore -} - -GLUTAPI void GLUTAPIENTRY -glutPostOverlayRedisplay(void) { - // ignore -} - -GLUTAPI void GLUTAPIENTRY -glutShowOverlay(void) { - // ignore -} - -GLUTAPI void GLUTAPIENTRY glutHideOverlay(void) -{ - // ignore -} - -int GLUTAPIENTRY -glutLayerGet(GLenum param) -{ - // ignore -} - -/*********************************************************** - * Unsupported callbacks - ***********************************************************/ -GLUTAPI void GLUTAPIENTRY -glutOverlayDisplayFunc(GLUTdisplayCB displayFunc) -{ -} - -GLUTAPI void GLUTAPIENTRY -glutSpaceballMotionFunc(GLUTspaceMotionCB spaceMotionFunc) -{ -} - -GLUTAPI void GLUTAPIENTRY -glutSpaceballRotateFunc(GLUTspaceRotateCB spaceRotateFunc) -{ -} - -GLUTAPI void GLUTAPIENTRY -glutSpaceballButtonFunc(GLUTspaceButtonCB spaceButtonFunc) -{ -} - -GLUTAPI void GLUTAPIENTRY -glutButtonBoxFunc(GLUTbuttonBoxCB buttonBoxFunc) -{ -} - -GLUTAPI void GLUTAPIENTRY -glutDialsFunc(GLUTdialsCB dialsFunc) -{ -} - -GLUTAPI void GLUTAPIENTRY -glutTabletMotionFunc(GLUTtabletMotionCB tabletMotionFunc) -{ -} - -GLUTAPI void GLUTAPIENTRY -glutTabletButtonFunc(GLUTtabletButtonCB tabletButtonFunc) -{ -} -GLUTAPI void GLUTAPIENTRY -glutPostWindowOverlayRedisplay(int win) -{ // -} - -void GLUTAPIENTRY -glutInitDisplayString(const char *string) -{ // -} -void GLUTAPIENTRY -glutJoystickFunc(GLUTjoystickCB joystickFunc, int pollInterval) -{ // -} - -void GLUTAPIENTRY -glutForceJoystickFunc(void) -{ // -} - - -int GLUTAPIENTRY -glutBitmapWidth(GLUTbitmapFont font, int c) -{ return 0; -} -int GLUTAPIENTRY -glutBitmapLength(GLUTbitmapFont font, const unsigned char *string) -{ // - return 0; -} -int GLUTAPIENTRY -glutStrokeWidth(GLUTstrokeFont font, int c) -{ return 0; -} -int GLUTAPIENTRY -glutStrokeLength(GLUTstrokeFont font, const unsigned char *string) -{ return 0; -} diff --git a/src/glut/os2/glut_8x13.cpp b/src/glut/os2/glut_8x13.cpp deleted file mode 100644 index 29ea6ea070..0000000000 --- a/src/glut/os2/glut_8x13.cpp +++ /dev/null @@ -1,2076 +0,0 @@ - -/* GENERATED FILE -- DO NOT MODIFY */ - -#define glutBitmap8By13 XXX -#include "glutbitmap.h" -#undef glutBitmap8By13 - -#ifdef _WIN32 -/* XXX Work around Microsoft OpenGL 1.1 bug where glBitmap with - a height or width of zero does not advance the raster position - as specified by OpenGL. (Cosmo OpenGL does not have this bug.) */ -static const GLubyte ch0data[] = { 0x0 }; -static const BitmapCharRec ch0 = {1,1,0,0,8,ch0data}; -#else -static const BitmapCharRec ch0 = {0,0,0,0,8,0}; -#endif - -#ifdef _WIN32 -/* XXX Work around Microsoft OpenGL 1.1 bug where glBitmap with - a height or width of zero does not advance the raster position - as specified by OpenGL. (Cosmo OpenGL does not have this bug.) */ -static const GLubyte ch32data[] = { 0x0 }; -static const BitmapCharRec ch32 = {1,1,0,0,8,ch32data}; -#else -static const BitmapCharRec ch32 = {0,0,0,0,8,0}; -#endif - -#ifdef _WIN32 -/* XXX Work around Microsoft OpenGL 1.1 bug where glBitmap with - a height or width of zero does not advance the raster position - as specified by OpenGL. (Cosmo OpenGL does not have this bug.) */ -static const GLubyte ch127data[] = { 0x0 }; -static const BitmapCharRec ch127 = {1,1,0,0,8,ch127data}; -#else -static const BitmapCharRec ch127 = {0,0,0,0,8,0}; -#endif - -#ifdef _WIN32 -/* XXX Work around Microsoft OpenGL 1.1 bug where glBitmap with - a height or width of zero does not advance the raster position - as specified by OpenGL. (Cosmo OpenGL does not have this bug.) */ -static const GLubyte ch160data[] = { 0x0 }; -static const BitmapCharRec ch160 = {1,1,0,0,8,ch160data}; -#else -static const BitmapCharRec ch160 = {0,0,0,0,8,0}; -#endif - -/* char: 0xff */ - -static const GLubyte ch255data[] = { -0x78,0x84,0x4,0x74,0x8c,0x84,0x84,0x84,0x0,0x0,0x48,0x48, -}; - -static const BitmapCharRec ch255 = {6,12,-1,2,8,ch255data}; - -/* char: 0xfe */ - -static const GLubyte ch254data[] = { -0x80,0x80,0xb8,0xc4,0x84,0x84,0xc4,0xb8,0x80,0x80, -}; - -static const BitmapCharRec ch254 = {6,10,-1,2,8,ch254data}; - -/* char: 0xfd */ - -static const GLubyte ch253data[] = { -0x78,0x84,0x4,0x74,0x8c,0x84,0x84,0x84,0x0,0x0,0x20,0x10, -}; - -static const BitmapCharRec ch253 = {6,12,-1,2,8,ch253data}; - -/* char: 0xfc */ - -static const GLubyte ch252data[] = { -0x74,0x88,0x88,0x88,0x88,0x88,0x0,0x0,0x48,0x48, -}; - -static const BitmapCharRec ch252 = {6,10,-1,0,8,ch252data}; - -/* char: 0xfb */ - -static const GLubyte ch251data[] = { -0x74,0x88,0x88,0x88,0x88,0x88,0x0,0x0,0x48,0x30, -}; - -static const BitmapCharRec ch251 = {6,10,-1,0,8,ch251data}; - -/* char: 0xfa */ - -static const GLubyte ch250data[] = { -0x74,0x88,0x88,0x88,0x88,0x88,0x0,0x0,0x20,0x10, -}; - -static const BitmapCharRec ch250 = {6,10,-1,0,8,ch250data}; - -/* char: 0xf9 */ - -static const GLubyte ch249data[] = { -0x74,0x88,0x88,0x88,0x88,0x88,0x0,0x0,0x10,0x20, -}; - -static const BitmapCharRec ch249 = {6,10,-1,0,8,ch249data}; - -/* char: 0xf8 */ - -static const GLubyte ch248data[] = { -0x80,0x78,0xc4,0xa4,0x94,0x8c,0x78,0x4, -}; - -static const BitmapCharRec ch248 = {6,8,-1,1,8,ch248data}; - -/* char: 0xf7 */ - -static const GLubyte ch247data[] = { -0x20,0x20,0x0,0xf8,0x0,0x20,0x20, -}; - -static const BitmapCharRec ch247 = {5,7,-1,-1,8,ch247data}; - -/* char: 0xf6 */ - -static const GLubyte ch246data[] = { -0x78,0x84,0x84,0x84,0x84,0x78,0x0,0x0,0x48,0x48, -}; - -static const BitmapCharRec ch246 = {6,10,-1,0,8,ch246data}; - -/* char: 0xf5 */ - -static const GLubyte ch245data[] = { -0x78,0x84,0x84,0x84,0x84,0x78,0x0,0x0,0x50,0x28, -}; - -static const BitmapCharRec ch245 = {6,10,-1,0,8,ch245data}; - -/* char: 0xf4 */ - -static const GLubyte ch244data[] = { -0x78,0x84,0x84,0x84,0x84,0x78,0x0,0x0,0x48,0x30, -}; - -static const BitmapCharRec ch244 = {6,10,-1,0,8,ch244data}; - -/* char: 0xf3 */ - -static const GLubyte ch243data[] = { -0x78,0x84,0x84,0x84,0x84,0x78,0x0,0x0,0x20,0x10, -}; - -static const BitmapCharRec ch243 = {6,10,-1,0,8,ch243data}; - -/* char: 0xf2 */ - -static const GLubyte ch242data[] = { -0x78,0x84,0x84,0x84,0x84,0x78,0x0,0x0,0x10,0x20, -}; - -static const BitmapCharRec ch242 = {6,10,-1,0,8,ch242data}; - -/* char: 0xf1 */ - -static const GLubyte ch241data[] = { -0x84,0x84,0x84,0x84,0xc4,0xb8,0x0,0x0,0x50,0x28, -}; - -static const BitmapCharRec ch241 = {6,10,-1,0,8,ch241data}; - -/* char: 0xf0 */ - -static const GLubyte ch240data[] = { -0x78,0x84,0x84,0x84,0x84,0x78,0x8,0x50,0x30,0x48, -}; - -static const BitmapCharRec ch240 = {6,10,-1,0,8,ch240data}; - -/* char: 0xef */ - -static const GLubyte ch239data[] = { -0xf8,0x20,0x20,0x20,0x20,0x60,0x0,0x0,0x50,0x50, -}; - -static const BitmapCharRec ch239 = {5,10,-1,0,8,ch239data}; - -/* char: 0xee */ - -static const GLubyte ch238data[] = { -0xf8,0x20,0x20,0x20,0x20,0x60,0x0,0x0,0x90,0x60, -}; - -static const BitmapCharRec ch238 = {5,10,-1,0,8,ch238data}; - -/* char: 0xed */ - -static const GLubyte ch237data[] = { -0xf8,0x20,0x20,0x20,0x20,0x60,0x0,0x0,0x40,0x20, -}; - -static const BitmapCharRec ch237 = {5,10,-1,0,8,ch237data}; - -/* char: 0xec */ - -static const GLubyte ch236data[] = { -0xf8,0x20,0x20,0x20,0x20,0x60,0x0,0x0,0x20,0x40, -}; - -static const BitmapCharRec ch236 = {5,10,-1,0,8,ch236data}; - -/* char: 0xeb */ - -static const GLubyte ch235data[] = { -0x78,0x84,0x80,0xfc,0x84,0x78,0x0,0x0,0x48,0x48, -}; - -static const BitmapCharRec ch235 = {6,10,-1,0,8,ch235data}; - -/* char: 0xea */ - -static const GLubyte ch234data[] = { -0x78,0x84,0x80,0xfc,0x84,0x78,0x0,0x0,0x48,0x30, -}; - -static const BitmapCharRec ch234 = {6,10,-1,0,8,ch234data}; - -/* char: 0xe9 */ - -static const GLubyte ch233data[] = { -0x78,0x84,0x80,0xfc,0x84,0x78,0x0,0x0,0x20,0x10, -}; - -static const BitmapCharRec ch233 = {6,10,-1,0,8,ch233data}; - -/* char: 0xe8 */ - -static const GLubyte ch232data[] = { -0x78,0x84,0x80,0xfc,0x84,0x78,0x0,0x0,0x10,0x20, -}; - -static const BitmapCharRec ch232 = {6,10,-1,0,8,ch232data}; - -/* char: 0xe7 */ - -static const GLubyte ch231data[] = { -0x20,0x10,0x78,0x84,0x80,0x80,0x84,0x78, -}; - -static const BitmapCharRec ch231 = {6,8,-1,2,8,ch231data}; - -/* char: 0xe6 */ - -static const GLubyte ch230data[] = { -0x6c,0x92,0x90,0x7c,0x12,0x6c, -}; - -static const BitmapCharRec ch230 = {7,6,0,0,8,ch230data}; - -/* char: 0xe5 */ - -static const GLubyte ch229data[] = { -0x74,0x8c,0x84,0x7c,0x4,0x78,0x0,0x30,0x48,0x30, -}; - -static const BitmapCharRec ch229 = {6,10,-1,0,8,ch229data}; - -/* char: 0xe4 */ - -static const GLubyte ch228data[] = { -0x74,0x8c,0x84,0x7c,0x4,0x78,0x0,0x0,0x48,0x48, -}; - -static const BitmapCharRec ch228 = {6,10,-1,0,8,ch228data}; - -/* char: 0xe3 */ - -static const GLubyte ch227data[] = { -0x74,0x8c,0x84,0x7c,0x4,0x78,0x0,0x0,0x50,0x28, -}; - -static const BitmapCharRec ch227 = {6,10,-1,0,8,ch227data}; - -/* char: 0xe2 */ - -static const GLubyte ch226data[] = { -0x74,0x8c,0x84,0x7c,0x4,0x78,0x0,0x0,0x48,0x30, -}; - -static const BitmapCharRec ch226 = {6,10,-1,0,8,ch226data}; - -/* char: 0xe1 */ - -static const GLubyte ch225data[] = { -0x74,0x8c,0x84,0x7c,0x4,0x78,0x0,0x0,0x20,0x10, -}; - -static const BitmapCharRec ch225 = {6,10,-1,0,8,ch225data}; - -/* char: 0xe0 */ - -static const GLubyte ch224data[] = { -0x74,0x8c,0x84,0x7c,0x4,0x78,0x0,0x0,0x10,0x20, -}; - -static const BitmapCharRec ch224 = {6,10,-1,0,8,ch224data}; - -/* char: 0xdf */ - -static const GLubyte ch223data[] = { -0x80,0xb8,0xc4,0x84,0x84,0xf8,0x84,0x84,0x78, -}; - -static const BitmapCharRec ch223 = {6,9,-1,1,8,ch223data}; - -/* char: 0xde */ - -static const GLubyte ch222data[] = { -0x80,0x80,0x80,0xf8,0x84,0x84,0x84,0xf8,0x80, -}; - -static const BitmapCharRec ch222 = {6,9,-1,0,8,ch222data}; - -/* char: 0xdd */ - -static const GLubyte ch221data[] = { -0x20,0x20,0x20,0x20,0x50,0x88,0x88,0x0,0x20,0x10, -}; - -static const BitmapCharRec ch221 = {5,10,-1,0,8,ch221data}; - -/* char: 0xdc */ - -static const GLubyte ch220data[] = { -0x78,0x84,0x84,0x84,0x84,0x84,0x84,0x0,0x48,0x48, -}; - -static const BitmapCharRec ch220 = {6,10,-1,0,8,ch220data}; - -/* char: 0xdb */ - -static const GLubyte ch219data[] = { -0x78,0x84,0x84,0x84,0x84,0x84,0x84,0x0,0x48,0x30, -}; - -static const BitmapCharRec ch219 = {6,10,-1,0,8,ch219data}; - -/* char: 0xda */ - -static const GLubyte ch218data[] = { -0x78,0x84,0x84,0x84,0x84,0x84,0x84,0x0,0x20,0x10, -}; - -static const BitmapCharRec ch218 = {6,10,-1,0,8,ch218data}; - -/* char: 0xd9 */ - -static const GLubyte ch217data[] = { -0x78,0x84,0x84,0x84,0x84,0x84,0x84,0x0,0x10,0x20, -}; - -static const BitmapCharRec ch217 = {6,10,-1,0,8,ch217data}; - -/* char: 0xd8 */ - -static const GLubyte ch216data[] = { -0x80,0x78,0xc4,0xa4,0xa4,0xa4,0x94,0x94,0x8c,0x78,0x4, -}; - -static const BitmapCharRec ch216 = {6,11,-1,1,8,ch216data}; - -/* char: 0xd7 */ - -static const GLubyte ch215data[] = { -0x84,0x48,0x30,0x30,0x48,0x84, -}; - -static const BitmapCharRec ch215 = {6,6,-1,-1,8,ch215data}; - -/* char: 0xd6 */ - -static const GLubyte ch214data[] = { -0x7c,0x82,0x82,0x82,0x82,0x82,0x7c,0x0,0x28,0x28, -}; - -static const BitmapCharRec ch214 = {7,10,0,0,8,ch214data}; - -/* char: 0xd5 */ - -static const GLubyte ch213data[] = { -0x7c,0x82,0x82,0x82,0x82,0x82,0x7c,0x0,0x28,0x14, -}; - -static const BitmapCharRec ch213 = {7,10,0,0,8,ch213data}; - -/* char: 0xd4 */ - -static const GLubyte ch212data[] = { -0x7c,0x82,0x82,0x82,0x82,0x82,0x7c,0x0,0x24,0x18, -}; - -static const BitmapCharRec ch212 = {7,10,0,0,8,ch212data}; - -/* char: 0xd3 */ - -static const GLubyte ch211data[] = { -0x7c,0x82,0x82,0x82,0x82,0x82,0x7c,0x0,0x10,0x8, -}; - -static const BitmapCharRec ch211 = {7,10,0,0,8,ch211data}; - -/* char: 0xd2 */ - -static const GLubyte ch210data[] = { -0x7c,0x82,0x82,0x82,0x82,0x82,0x7c,0x0,0x8,0x10, -}; - -static const BitmapCharRec ch210 = {7,10,0,0,8,ch210data}; - -/* char: 0xd1 */ - -static const GLubyte ch209data[] = { -0x82,0x86,0x8a,0x92,0xa2,0xc2,0x82,0x0,0x28,0x14, -}; - -static const BitmapCharRec ch209 = {7,10,0,0,8,ch209data}; - -/* char: 0xd0 */ - -static const GLubyte ch208data[] = { -0xfc,0x42,0x42,0x42,0xe2,0x42,0x42,0x42,0xfc, -}; - -static const BitmapCharRec ch208 = {7,9,0,0,8,ch208data}; - -/* char: 0xcf */ - -static const GLubyte ch207data[] = { -0xf8,0x20,0x20,0x20,0x20,0x20,0xf8,0x0,0x50,0x50, -}; - -static const BitmapCharRec ch207 = {5,10,-1,0,8,ch207data}; - -/* char: 0xce */ - -static const GLubyte ch206data[] = { -0xf8,0x20,0x20,0x20,0x20,0x20,0xf8,0x0,0x48,0x30, -}; - -static const BitmapCharRec ch206 = {5,10,-1,0,8,ch206data}; - -/* char: 0xcd */ - -static const GLubyte ch205data[] = { -0xf8,0x20,0x20,0x20,0x20,0x20,0xf8,0x0,0x20,0x10, -}; - -static const BitmapCharRec ch205 = {5,10,-1,0,8,ch205data}; - -/* char: 0xcc */ - -static const GLubyte ch204data[] = { -0xf8,0x20,0x20,0x20,0x20,0x20,0xf8,0x0,0x10,0x20, -}; - -static const BitmapCharRec ch204 = {5,10,-1,0,8,ch204data}; - -/* char: 0xcb */ - -static const GLubyte ch203data[] = { -0xfc,0x80,0x80,0xf0,0x80,0x80,0xfc,0x0,0x48,0x48, -}; - -static const BitmapCharRec ch203 = {6,10,-1,0,8,ch203data}; - -/* char: 0xca */ - -static const GLubyte ch202data[] = { -0xfc,0x80,0x80,0xf0,0x80,0x80,0xfc,0x0,0x48,0x30, -}; - -static const BitmapCharRec ch202 = {6,10,-1,0,8,ch202data}; - -/* char: 0xc9 */ - -static const GLubyte ch201data[] = { -0xfc,0x80,0x80,0xf0,0x80,0x80,0xfc,0x0,0x20,0x10, -}; - -static const BitmapCharRec ch201 = {6,10,-1,0,8,ch201data}; - -/* char: 0xc8 */ - -static const GLubyte ch200data[] = { -0xfc,0x80,0x80,0xf0,0x80,0x80,0xfc,0x0,0x10,0x20, -}; - -static const BitmapCharRec ch200 = {6,10,-1,0,8,ch200data}; - -/* char: 0xc7 */ - -static const GLubyte ch199data[] = { -0x20,0x10,0x78,0x84,0x80,0x80,0x80,0x80,0x80,0x84,0x78, -}; - -static const BitmapCharRec ch199 = {6,11,-1,2,8,ch199data}; - -/* char: 0xc6 */ - -static const GLubyte ch198data[] = { -0x9e,0x90,0x90,0xf0,0x9c,0x90,0x90,0x90,0x6e, -}; - -static const BitmapCharRec ch198 = {7,9,0,0,8,ch198data}; - -/* char: 0xc5 */ - -static const GLubyte ch197data[] = { -0x84,0x84,0xfc,0x84,0x84,0x48,0x30,0x30,0x48,0x30, -}; - -static const BitmapCharRec ch197 = {6,10,-1,0,8,ch197data}; - -/* char: 0xc4 */ - -static const GLubyte ch196data[] = { -0x84,0x84,0xfc,0x84,0x84,0x48,0x30,0x0,0x48,0x48, -}; - -static const BitmapCharRec ch196 = {6,10,-1,0,8,ch196data}; - -/* char: 0xc3 */ - -static const GLubyte ch195data[] = { -0x84,0x84,0xfc,0x84,0x84,0x48,0x30,0x0,0x50,0x28, -}; - -static const BitmapCharRec ch195 = {6,10,-1,0,8,ch195data}; - -/* char: 0xc2 */ - -static const GLubyte ch194data[] = { -0x84,0x84,0xfc,0x84,0x84,0x48,0x30,0x0,0x48,0x30, -}; - -static const BitmapCharRec ch194 = {6,10,-1,0,8,ch194data}; - -/* char: 0xc1 */ - -static const GLubyte ch193data[] = { -0x84,0x84,0xfc,0x84,0x84,0x48,0x30,0x0,0x20,0x10, -}; - -static const BitmapCharRec ch193 = {6,10,-1,0,8,ch193data}; - -/* char: 0xc0 */ - -static const GLubyte ch192data[] = { -0x84,0x84,0xfc,0x84,0x84,0x48,0x30,0x0,0x10,0x20, -}; - -static const BitmapCharRec ch192 = {6,10,-1,0,8,ch192data}; - -/* char: 0xbf */ - -static const GLubyte ch191data[] = { -0x78,0x84,0x84,0x80,0x40,0x20,0x20,0x0,0x20, -}; - -static const BitmapCharRec ch191 = {6,9,-1,0,8,ch191data}; - -/* char: 0xbe */ - -static const GLubyte ch190data[] = { -0x6,0x1a,0x12,0xa,0x66,0x92,0x10,0x20,0x90,0x60, -}; - -static const BitmapCharRec ch190 = {7,10,0,0,8,ch190data}; - -/* char: 0xbd */ - -static const GLubyte ch189data[] = { -0x1e,0x10,0xc,0x2,0xf2,0x4c,0x40,0x40,0xc0,0x40, -}; - -static const BitmapCharRec ch189 = {7,10,0,0,8,ch189data}; - -/* char: 0xbc */ - -static const GLubyte ch188data[] = { -0x6,0x1a,0x12,0xa,0xe6,0x42,0x40,0x40,0xc0,0x40, -}; - -static const BitmapCharRec ch188 = {7,10,0,0,8,ch188data}; - -/* char: 0xbb */ - -static const GLubyte ch187data[] = { -0x90,0x48,0x24,0x12,0x24,0x48,0x90, -}; - -static const BitmapCharRec ch187 = {7,7,0,-1,8,ch187data}; - -/* char: 0xba */ - -static const GLubyte ch186data[] = { -0xf0,0x0,0x60,0x90,0x90,0x60, -}; - -static const BitmapCharRec ch186 = {4,6,-1,-3,8,ch186data}; - -/* char: 0xb9 */ - -static const GLubyte ch185data[] = { -0xe0,0x40,0x40,0x40,0xc0,0x40, -}; - -static const BitmapCharRec ch185 = {3,6,-1,-4,8,ch185data}; - -/* char: 0xb8 */ - -static const GLubyte ch184data[] = { -0xc0,0x40, -}; - -static const BitmapCharRec ch184 = {2,2,-3,2,8,ch184data}; - -/* char: 0xb7 */ - -static const GLubyte ch183data[] = { -0xc0, -}; - -static const BitmapCharRec ch183 = {2,1,-3,-4,8,ch183data}; - -/* char: 0xb6 */ - -static const GLubyte ch182data[] = { -0x28,0x28,0x28,0x28,0x68,0xe8,0xe8,0xe8,0x7c, -}; - -static const BitmapCharRec ch182 = {6,9,-1,0,8,ch182data}; - -/* char: 0xb5 */ - -static const GLubyte ch181data[] = { -0x80,0xb4,0xcc,0x84,0x84,0x84,0x84, -}; - -static const BitmapCharRec ch181 = {6,7,-1,1,8,ch181data}; - -/* char: 0xb4 */ - -static const GLubyte ch180data[] = { -0x80,0x40, -}; - -static const BitmapCharRec ch180 = {2,2,-3,-8,8,ch180data}; - -/* char: 0xb3 */ - -static const GLubyte ch179data[] = { -0x60,0x90,0x10,0x20,0x90,0x60, -}; - -static const BitmapCharRec ch179 = {4,6,-1,-4,8,ch179data}; - -/* char: 0xb2 */ - -static const GLubyte ch178data[] = { -0xf0,0x80,0x60,0x10,0x90,0x60, -}; - -static const BitmapCharRec ch178 = {4,6,-1,-4,8,ch178data}; - -/* char: 0xb1 */ - -static const GLubyte ch177data[] = { -0xf8,0x0,0x20,0x20,0xf8,0x20,0x20, -}; - -static const BitmapCharRec ch177 = {5,7,-1,-1,8,ch177data}; - -/* char: 0xb0 */ - -static const GLubyte ch176data[] = { -0x60,0x90,0x90,0x60, -}; - -static const BitmapCharRec ch176 = {4,4,-2,-5,8,ch176data}; - -/* char: 0xaf */ - -static const GLubyte ch175data[] = { -0xfc, -}; - -static const BitmapCharRec ch175 = {6,1,-1,-8,8,ch175data}; - -/* char: 0xae */ - -static const GLubyte ch174data[] = { -0x38,0x44,0xaa,0xb2,0xaa,0xaa,0x92,0x44,0x38, -}; - -static const BitmapCharRec ch174 = {7,9,0,-1,8,ch174data}; - -/* char: 0xad */ - -static const GLubyte ch173data[] = { -0xfc, -}; - -static const BitmapCharRec ch173 = {6,1,-1,-4,8,ch173data}; - -/* char: 0xac */ - -static const GLubyte ch172data[] = { -0x4,0x4,0x4,0xfc, -}; - -static const BitmapCharRec ch172 = {6,4,-1,-1,8,ch172data}; - -/* char: 0xab */ - -static const GLubyte ch171data[] = { -0x12,0x24,0x48,0x90,0x48,0x24,0x12, -}; - -static const BitmapCharRec ch171 = {7,7,0,-1,8,ch171data}; - -/* char: 0xaa */ - -static const GLubyte ch170data[] = { -0xf8,0x0,0x78,0x88,0x78,0x8,0x70, -}; - -static const BitmapCharRec ch170 = {5,7,-1,-2,8,ch170data}; - -/* char: 0xa9 */ - -static const GLubyte ch169data[] = { -0x38,0x44,0x92,0xaa,0xa2,0xaa,0x92,0x44,0x38, -}; - -static const BitmapCharRec ch169 = {7,9,0,-1,8,ch169data}; - -/* char: 0xa8 */ - -static const GLubyte ch168data[] = { -0xd8, -}; - -static const BitmapCharRec ch168 = {5,1,-1,-8,8,ch168data}; - -/* char: 0xa7 */ - -static const GLubyte ch167data[] = { -0x60,0x90,0x10,0x60,0x90,0x90,0x60,0x80,0x90,0x60, -}; - -static const BitmapCharRec ch167 = {4,10,-2,0,8,ch167data}; - -/* char: 0xa6 */ - -static const GLubyte ch166data[] = { -0x80,0x80,0x80,0x80,0x0,0x80,0x80,0x80,0x80, -}; - -static const BitmapCharRec ch166 = {1,9,-3,0,8,ch166data}; - -/* char: 0xa5 */ - -static const GLubyte ch165data[] = { -0x10,0x10,0x7c,0x10,0x7c,0x28,0x44,0x82,0x82, -}; - -static const BitmapCharRec ch165 = {7,9,0,0,8,ch165data}; - -/* char: 0xa4 */ - -static const GLubyte ch164data[] = { -0x84,0x78,0x48,0x48,0x78,0x84, -}; - -static const BitmapCharRec ch164 = {6,6,-1,-1,8,ch164data}; - -/* char: 0xa3 */ - -static const GLubyte ch163data[] = { -0xdc,0x62,0x20,0x20,0x20,0x70,0x20,0x22,0x1c, -}; - -static const BitmapCharRec ch163 = {7,9,0,0,8,ch163data}; - -/* char: 0xa2 */ - -static const GLubyte ch162data[] = { -0x20,0x70,0xa8,0xa0,0xa0,0xa8,0x70,0x20, -}; - -static const BitmapCharRec ch162 = {5,8,-1,-1,8,ch162data}; - -/* char: 0xa1 */ - -static const GLubyte ch161data[] = { -0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x0,0x80, -}; - -static const BitmapCharRec ch161 = {1,9,-3,0,8,ch161data}; - -/* char: 0x7e '~' */ - -static const GLubyte ch126data[] = { -0x90,0xa8,0x48, -}; - -static const BitmapCharRec ch126 = {5,3,-1,-6,8,ch126data}; - -/* char: 0x7d '}' */ - -static const GLubyte ch125data[] = { -0xe0,0x10,0x10,0x20,0x18,0x20,0x10,0x10,0xe0, -}; - -static const BitmapCharRec ch125 = {5,9,-1,0,8,ch125data}; - -/* char: 0x7c '|' */ - -static const GLubyte ch124data[] = { -0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80, -}; - -static const BitmapCharRec ch124 = {1,9,-3,0,8,ch124data}; - -/* char: 0x7b '{' */ - -static const GLubyte ch123data[] = { -0x38,0x40,0x40,0x20,0xc0,0x20,0x40,0x40,0x38, -}; - -static const BitmapCharRec ch123 = {5,9,-2,0,8,ch123data}; - -/* char: 0x7a 'z' */ - -static const GLubyte ch122data[] = { -0xfc,0x40,0x20,0x10,0x8,0xfc, -}; - -static const BitmapCharRec ch122 = {6,6,-1,0,8,ch122data}; - -/* char: 0x79 'y' */ - -static const GLubyte ch121data[] = { -0x78,0x84,0x4,0x74,0x8c,0x84,0x84,0x84, -}; - -static const BitmapCharRec ch121 = {6,8,-1,2,8,ch121data}; - -/* char: 0x78 'x' */ - -static const GLubyte ch120data[] = { -0x84,0x48,0x30,0x30,0x48,0x84, -}; - -static const BitmapCharRec ch120 = {6,6,-1,0,8,ch120data}; - -/* char: 0x77 'w' */ - -static const GLubyte ch119data[] = { -0x44,0xaa,0x92,0x92,0x82,0x82, -}; - -static const BitmapCharRec ch119 = {7,6,0,0,8,ch119data}; - -/* char: 0x76 'v' */ - -static const GLubyte ch118data[] = { -0x20,0x50,0x50,0x88,0x88,0x88, -}; - -static const BitmapCharRec ch118 = {5,6,-1,0,8,ch118data}; - -/* char: 0x75 'u' */ - -static const GLubyte ch117data[] = { -0x74,0x88,0x88,0x88,0x88,0x88, -}; - -static const BitmapCharRec ch117 = {6,6,-1,0,8,ch117data}; - -/* char: 0x74 't' */ - -static const GLubyte ch116data[] = { -0x38,0x44,0x40,0x40,0x40,0xf8,0x40,0x40, -}; - -static const BitmapCharRec ch116 = {6,8,-1,0,8,ch116data}; - -/* char: 0x73 's' */ - -static const GLubyte ch115data[] = { -0x78,0x84,0x18,0x60,0x84,0x78, -}; - -static const BitmapCharRec ch115 = {6,6,-1,0,8,ch115data}; - -/* char: 0x72 'r' */ - -static const GLubyte ch114data[] = { -0x40,0x40,0x40,0x40,0x44,0xb8, -}; - -static const BitmapCharRec ch114 = {6,6,-1,0,8,ch114data}; - -/* char: 0x71 'q' */ - -static const GLubyte ch113data[] = { -0x4,0x4,0x4,0x74,0x8c,0x84,0x8c,0x74, -}; - -static const BitmapCharRec ch113 = {6,8,-1,2,8,ch113data}; - -/* char: 0x70 'p' */ - -static const GLubyte ch112data[] = { -0x80,0x80,0x80,0xb8,0xc4,0x84,0xc4,0xb8, -}; - -static const BitmapCharRec ch112 = {6,8,-1,2,8,ch112data}; - -/* char: 0x6f 'o' */ - -static const GLubyte ch111data[] = { -0x78,0x84,0x84,0x84,0x84,0x78, -}; - -static const BitmapCharRec ch111 = {6,6,-1,0,8,ch111data}; - -/* char: 0x6e 'n' */ - -static const GLubyte ch110data[] = { -0x84,0x84,0x84,0x84,0xc4,0xb8, -}; - -static const BitmapCharRec ch110 = {6,6,-1,0,8,ch110data}; - -/* char: 0x6d 'm' */ - -static const GLubyte ch109data[] = { -0x82,0x92,0x92,0x92,0x92,0xec, -}; - -static const BitmapCharRec ch109 = {7,6,0,0,8,ch109data}; - -/* char: 0x6c 'l' */ - -static const GLubyte ch108data[] = { -0xf8,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x60, -}; - -static const BitmapCharRec ch108 = {5,9,-1,0,8,ch108data}; - -/* char: 0x6b 'k' */ - -static const GLubyte ch107data[] = { -0x84,0x88,0x90,0xe0,0x90,0x88,0x80,0x80,0x80, -}; - -static const BitmapCharRec ch107 = {6,9,-1,0,8,ch107data}; - -/* char: 0x6a 'j' */ - -static const GLubyte ch106data[] = { -0x70,0x88,0x88,0x8,0x8,0x8,0x8,0x18,0x0,0x8, -}; - -static const BitmapCharRec ch106 = {5,10,-1,2,8,ch106data}; - -/* char: 0x69 'i' */ - -static const GLubyte ch105data[] = { -0xf8,0x20,0x20,0x20,0x20,0x60,0x0,0x20, -}; - -static const BitmapCharRec ch105 = {5,8,-1,0,8,ch105data}; - -/* char: 0x68 'h' */ - -static const GLubyte ch104data[] = { -0x84,0x84,0x84,0x84,0xc4,0xb8,0x80,0x80,0x80, -}; - -static const BitmapCharRec ch104 = {6,9,-1,0,8,ch104data}; - -/* char: 0x67 'g' */ - -static const GLubyte ch103data[] = { -0x78,0x84,0x78,0x80,0x70,0x88,0x88,0x74, -}; - -static const BitmapCharRec ch103 = {6,8,-1,2,8,ch103data}; - -/* char: 0x66 'f' */ - -static const GLubyte ch102data[] = { -0x40,0x40,0x40,0x40,0xf8,0x40,0x40,0x44,0x38, -}; - -static const BitmapCharRec ch102 = {6,9,-1,0,8,ch102data}; - -/* char: 0x65 'e' */ - -static const GLubyte ch101data[] = { -0x78,0x84,0x80,0xfc,0x84,0x78, -}; - -static const BitmapCharRec ch101 = {6,6,-1,0,8,ch101data}; - -/* char: 0x64 'd' */ - -static const GLubyte ch100data[] = { -0x74,0x8c,0x84,0x84,0x8c,0x74,0x4,0x4,0x4, -}; - -static const BitmapCharRec ch100 = {6,9,-1,0,8,ch100data}; - -/* char: 0x63 'c' */ - -static const GLubyte ch99data[] = { -0x78,0x84,0x80,0x80,0x84,0x78, -}; - -static const BitmapCharRec ch99 = {6,6,-1,0,8,ch99data}; - -/* char: 0x62 'b' */ - -static const GLubyte ch98data[] = { -0xb8,0xc4,0x84,0x84,0xc4,0xb8,0x80,0x80,0x80, -}; - -static const BitmapCharRec ch98 = {6,9,-1,0,8,ch98data}; - -/* char: 0x61 'a' */ - -static const GLubyte ch97data[] = { -0x74,0x8c,0x84,0x7c,0x4,0x78, -}; - -static const BitmapCharRec ch97 = {6,6,-1,0,8,ch97data}; - -/* char: 0x60 '`' */ - -static const GLubyte ch96data[] = { -0x10,0x60,0xe0, -}; - -static const BitmapCharRec ch96 = {4,3,-2,-6,8,ch96data}; - -/* char: 0x5f '_' */ - -static const GLubyte ch95data[] = { -0xfe, -}; - -static const BitmapCharRec ch95 = {7,1,0,1,8,ch95data}; - -/* char: 0x5e '^' */ - -static const GLubyte ch94data[] = { -0x88,0x50,0x20, -}; - -static const BitmapCharRec ch94 = {5,3,-1,-6,8,ch94data}; - -/* char: 0x5d ']' */ - -static const GLubyte ch93data[] = { -0xf0,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0xf0, -}; - -static const BitmapCharRec ch93 = {4,9,-1,0,8,ch93data}; - -/* char: 0x5c '\' */ - -static const GLubyte ch92data[] = { -0x2,0x2,0x4,0x8,0x10,0x20,0x40,0x80,0x80, -}; - -static const BitmapCharRec ch92 = {7,9,0,0,8,ch92data}; - -/* char: 0x5b '[' */ - -static const GLubyte ch91data[] = { -0xf0,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0xf0, -}; - -static const BitmapCharRec ch91 = {4,9,-2,0,8,ch91data}; - -/* char: 0x5a 'Z' */ - -static const GLubyte ch90data[] = { -0xfc,0x80,0x80,0x40,0x20,0x10,0x8,0x4,0xfc, -}; - -static const BitmapCharRec ch90 = {6,9,-1,0,8,ch90data}; - -/* char: 0x59 'Y' */ - -static const GLubyte ch89data[] = { -0x10,0x10,0x10,0x10,0x10,0x28,0x44,0x82,0x82, -}; - -static const BitmapCharRec ch89 = {7,9,0,0,8,ch89data}; - -/* char: 0x58 'X' */ - -static const GLubyte ch88data[] = { -0x82,0x82,0x44,0x28,0x10,0x28,0x44,0x82,0x82, -}; - -static const BitmapCharRec ch88 = {7,9,0,0,8,ch88data}; - -/* char: 0x57 'W' */ - -static const GLubyte ch87data[] = { -0x44,0xaa,0x92,0x92,0x92,0x82,0x82,0x82,0x82, -}; - -static const BitmapCharRec ch87 = {7,9,0,0,8,ch87data}; - -/* char: 0x56 'V' */ - -static const GLubyte ch86data[] = { -0x10,0x28,0x28,0x28,0x44,0x44,0x44,0x82,0x82, -}; - -static const BitmapCharRec ch86 = {7,9,0,0,8,ch86data}; - -/* char: 0x55 'U' */ - -static const GLubyte ch85data[] = { -0x78,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84, -}; - -static const BitmapCharRec ch85 = {6,9,-1,0,8,ch85data}; - -/* char: 0x54 'T' */ - -static const GLubyte ch84data[] = { -0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0xfe, -}; - -static const BitmapCharRec ch84 = {7,9,0,0,8,ch84data}; - -/* char: 0x53 'S' */ - -static const GLubyte ch83data[] = { -0x78,0x84,0x4,0x4,0x78,0x80,0x80,0x84,0x78, -}; - -static const BitmapCharRec ch83 = {6,9,-1,0,8,ch83data}; - -/* char: 0x52 'R' */ - -static const GLubyte ch82data[] = { -0x84,0x88,0x90,0xa0,0xf8,0x84,0x84,0x84,0xf8, -}; - -static const BitmapCharRec ch82 = {6,9,-1,0,8,ch82data}; - -/* char: 0x51 'Q' */ - -static const GLubyte ch81data[] = { -0x4,0x78,0x94,0xa4,0x84,0x84,0x84,0x84,0x84,0x78, -}; - -static const BitmapCharRec ch81 = {6,10,-1,1,8,ch81data}; - -/* char: 0x50 'P' */ - -static const GLubyte ch80data[] = { -0x80,0x80,0x80,0x80,0xf8,0x84,0x84,0x84,0xf8, -}; - -static const BitmapCharRec ch80 = {6,9,-1,0,8,ch80data}; - -/* char: 0x4f 'O' */ - -static const GLubyte ch79data[] = { -0x78,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x78, -}; - -static const BitmapCharRec ch79 = {6,9,-1,0,8,ch79data}; - -/* char: 0x4e 'N' */ - -static const GLubyte ch78data[] = { -0x84,0x84,0x84,0x8c,0x94,0xa4,0xc4,0x84,0x84, -}; - -static const BitmapCharRec ch78 = {6,9,-1,0,8,ch78data}; - -/* char: 0x4d 'M' */ - -static const GLubyte ch77data[] = { -0x82,0x82,0x82,0x92,0x92,0xaa,0xc6,0x82,0x82, -}; - -static const BitmapCharRec ch77 = {7,9,0,0,8,ch77data}; - -/* char: 0x4c 'L' */ - -static const GLubyte ch76data[] = { -0xfc,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80, -}; - -static const BitmapCharRec ch76 = {6,9,-1,0,8,ch76data}; - -/* char: 0x4b 'K' */ - -static const GLubyte ch75data[] = { -0x84,0x88,0x90,0xa0,0xc0,0xa0,0x90,0x88,0x84, -}; - -static const BitmapCharRec ch75 = {6,9,-1,0,8,ch75data}; - -/* char: 0x4a 'J' */ - -static const GLubyte ch74data[] = { -0x70,0x88,0x8,0x8,0x8,0x8,0x8,0x8,0x3c, -}; - -static const BitmapCharRec ch74 = {6,9,-1,0,8,ch74data}; - -/* char: 0x49 'I' */ - -static const GLubyte ch73data[] = { -0xf8,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0xf8, -}; - -static const BitmapCharRec ch73 = {5,9,-1,0,8,ch73data}; - -/* char: 0x48 'H' */ - -static const GLubyte ch72data[] = { -0x84,0x84,0x84,0x84,0xfc,0x84,0x84,0x84,0x84, -}; - -static const BitmapCharRec ch72 = {6,9,-1,0,8,ch72data}; - -/* char: 0x47 'G' */ - -static const GLubyte ch71data[] = { -0x74,0x8c,0x84,0x9c,0x80,0x80,0x80,0x84,0x78, -}; - -static const BitmapCharRec ch71 = {6,9,-1,0,8,ch71data}; - -/* char: 0x46 'F' */ - -static const GLubyte ch70data[] = { -0x80,0x80,0x80,0x80,0xf0,0x80,0x80,0x80,0xfc, -}; - -static const BitmapCharRec ch70 = {6,9,-1,0,8,ch70data}; - -/* char: 0x45 'E' */ - -static const GLubyte ch69data[] = { -0xfc,0x80,0x80,0x80,0xf0,0x80,0x80,0x80,0xfc, -}; - -static const BitmapCharRec ch69 = {6,9,-1,0,8,ch69data}; - -/* char: 0x44 'D' */ - -static const GLubyte ch68data[] = { -0xfc,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0xfc, -}; - -static const BitmapCharRec ch68 = {7,9,0,0,8,ch68data}; - -/* char: 0x43 'C' */ - -static const GLubyte ch67data[] = { -0x78,0x84,0x80,0x80,0x80,0x80,0x80,0x84,0x78, -}; - -static const BitmapCharRec ch67 = {6,9,-1,0,8,ch67data}; - -/* char: 0x42 'B' */ - -static const GLubyte ch66data[] = { -0xfc,0x42,0x42,0x42,0x7c,0x42,0x42,0x42,0xfc, -}; - -static const BitmapCharRec ch66 = {7,9,0,0,8,ch66data}; - -/* char: 0x41 'A' */ - -static const GLubyte ch65data[] = { -0x84,0x84,0x84,0xfc,0x84,0x84,0x84,0x48,0x30, -}; - -static const BitmapCharRec ch65 = {6,9,-1,0,8,ch65data}; - -/* char: 0x40 '@' */ - -static const GLubyte ch64data[] = { -0x78,0x80,0x94,0xac,0xa4,0x9c,0x84,0x84,0x78, -}; - -static const BitmapCharRec ch64 = {6,9,-1,0,8,ch64data}; - -/* char: 0x3f '?' */ - -static const GLubyte ch63data[] = { -0x10,0x0,0x10,0x10,0x8,0x4,0x84,0x84,0x78, -}; - -static const BitmapCharRec ch63 = {6,9,-1,0,8,ch63data}; - -/* char: 0x3e '>' */ - -static const GLubyte ch62data[] = { -0x80,0x40,0x20,0x10,0x8,0x10,0x20,0x40,0x80, -}; - -static const BitmapCharRec ch62 = {5,9,-1,0,8,ch62data}; - -/* char: 0x3d '=' */ - -static const GLubyte ch61data[] = { -0xfc,0x0,0x0,0xfc, -}; - -static const BitmapCharRec ch61 = {6,4,-1,-2,8,ch61data}; - -/* char: 0x3c '<' */ - -static const GLubyte ch60data[] = { -0x8,0x10,0x20,0x40,0x80,0x40,0x20,0x10,0x8, -}; - -static const BitmapCharRec ch60 = {5,9,-2,0,8,ch60data}; - -/* char: 0x3b ';' */ - -static const GLubyte ch59data[] = { -0x80,0x60,0x70,0x0,0x0,0x20,0x70,0x20, -}; - -static const BitmapCharRec ch59 = {4,8,-1,1,8,ch59data}; - -/* char: 0x3a ':' */ - -static const GLubyte ch58data[] = { -0x40,0xe0,0x40,0x0,0x0,0x40,0xe0,0x40, -}; - -static const BitmapCharRec ch58 = {3,8,-2,1,8,ch58data}; - -/* char: 0x39 '9' */ - -static const GLubyte ch57data[] = { -0x70,0x8,0x4,0x4,0x74,0x8c,0x84,0x84,0x78, -}; - -static const BitmapCharRec ch57 = {6,9,-1,0,8,ch57data}; - -/* char: 0x38 '8' */ - -static const GLubyte ch56data[] = { -0x78,0x84,0x84,0x84,0x78,0x84,0x84,0x84,0x78, -}; - -static const BitmapCharRec ch56 = {6,9,-1,0,8,ch56data}; - -/* char: 0x37 '7' */ - -static const GLubyte ch55data[] = { -0x40,0x40,0x20,0x20,0x10,0x10,0x8,0x4,0xfc, -}; - -static const BitmapCharRec ch55 = {6,9,-1,0,8,ch55data}; - -/* char: 0x36 '6' */ - -static const GLubyte ch54data[] = { -0x78,0x84,0x84,0xc4,0xb8,0x80,0x80,0x40,0x38, -}; - -static const BitmapCharRec ch54 = {6,9,-1,0,8,ch54data}; - -/* char: 0x35 '5' */ - -static const GLubyte ch53data[] = { -0x78,0x84,0x4,0x4,0xc4,0xb8,0x80,0x80,0xfc, -}; - -static const BitmapCharRec ch53 = {6,9,-1,0,8,ch53data}; - -/* char: 0x34 '4' */ - -static const GLubyte ch52data[] = { -0x8,0x8,0xfc,0x88,0x88,0x48,0x28,0x18,0x8, -}; - -static const BitmapCharRec ch52 = {6,9,-1,0,8,ch52data}; - -/* char: 0x33 '3' */ - -static const GLubyte ch51data[] = { -0x78,0x84,0x4,0x4,0x38,0x10,0x8,0x4,0xfc, -}; - -static const BitmapCharRec ch51 = {6,9,-1,0,8,ch51data}; - -/* char: 0x32 '2' */ - -static const GLubyte ch50data[] = { -0xfc,0x80,0x40,0x30,0x8,0x4,0x84,0x84,0x78, -}; - -static const BitmapCharRec ch50 = {6,9,-1,0,8,ch50data}; - -/* char: 0x31 '1' */ - -static const GLubyte ch49data[] = { -0xf8,0x20,0x20,0x20,0x20,0x20,0xa0,0x60,0x20, -}; - -static const BitmapCharRec ch49 = {5,9,-1,0,8,ch49data}; - -/* char: 0x30 '0' */ - -static const GLubyte ch48data[] = { -0x30,0x48,0x84,0x84,0x84,0x84,0x84,0x48,0x30, -}; - -static const BitmapCharRec ch48 = {6,9,-1,0,8,ch48data}; - -/* char: 0x2f '/' */ - -static const GLubyte ch47data[] = { -0x80,0x80,0x40,0x20,0x10,0x8,0x4,0x2,0x2, -}; - -static const BitmapCharRec ch47 = {7,9,0,0,8,ch47data}; - -/* char: 0x2e '.' */ - -static const GLubyte ch46data[] = { -0x40,0xe0,0x40, -}; - -static const BitmapCharRec ch46 = {3,3,-2,1,8,ch46data}; - -/* char: 0x2d '-' */ - -static const GLubyte ch45data[] = { -0xfc, -}; - -static const BitmapCharRec ch45 = {6,1,-1,-4,8,ch45data}; - -/* char: 0x2c ',' */ - -static const GLubyte ch44data[] = { -0x80,0x60,0x70, -}; - -static const BitmapCharRec ch44 = {4,3,-1,1,8,ch44data}; - -/* char: 0x2b '+' */ - -static const GLubyte ch43data[] = { -0x20,0x20,0xf8,0x20,0x20, -}; - -static const BitmapCharRec ch43 = {5,5,-1,-2,8,ch43data}; - -/* char: 0x2a '*' */ - -static const GLubyte ch42data[] = { -0x48,0x30,0xfc,0x30,0x48, -}; - -static const BitmapCharRec ch42 = {6,5,-1,-2,8,ch42data}; - -/* char: 0x29 ')' */ - -static const GLubyte ch41data[] = { -0x80,0x40,0x40,0x20,0x20,0x20,0x40,0x40,0x80, -}; - -static const BitmapCharRec ch41 = {3,9,-2,0,8,ch41data}; - -/* char: 0x28 '(' */ - -static const GLubyte ch40data[] = { -0x20,0x40,0x40,0x80,0x80,0x80,0x40,0x40,0x20, -}; - -static const BitmapCharRec ch40 = {3,9,-3,0,8,ch40data}; - -/* char: 0x27 ''' */ - -static const GLubyte ch39data[] = { -0x80,0x60,0x70, -}; - -static const BitmapCharRec ch39 = {4,3,-1,-6,8,ch39data}; - -/* char: 0x26 '&' */ - -static const GLubyte ch38data[] = { -0x74,0x88,0x94,0x60,0x90,0x90,0x60, -}; - -static const BitmapCharRec ch38 = {6,7,-1,0,8,ch38data}; - -/* char: 0x25 '%' */ - -static const GLubyte ch37data[] = { -0x88,0x54,0x48,0x20,0x10,0x10,0x48,0xa4,0x44, -}; - -static const BitmapCharRec ch37 = {6,9,-1,0,8,ch37data}; - -/* char: 0x24 '$' */ - -static const GLubyte ch36data[] = { -0x20,0xf0,0x28,0x70,0xa0,0x78,0x20, -}; - -static const BitmapCharRec ch36 = {5,7,-1,-1,8,ch36data}; - -/* char: 0x23 '#' */ - -static const GLubyte ch35data[] = { -0x48,0x48,0xfc,0x48,0xfc,0x48,0x48, -}; - -static const BitmapCharRec ch35 = {6,7,-1,-1,8,ch35data}; - -/* char: 0x22 '"' */ - -static const GLubyte ch34data[] = { -0x90,0x90,0x90, -}; - -static const BitmapCharRec ch34 = {4,3,-2,-6,8,ch34data}; - -/* char: 0x21 '!' */ - -static const GLubyte ch33data[] = { -0x80,0x0,0x80,0x80,0x80,0x80,0x80,0x80,0x80, -}; - -static const BitmapCharRec ch33 = {1,9,-3,0,8,ch33data}; - -/* char: 0x1f */ - -static const GLubyte ch31data[] = { -0x80, -}; - -static const BitmapCharRec ch31 = {1,1,-3,-3,8,ch31data}; - -/* char: 0x1e */ - -static const GLubyte ch30data[] = { -0xdc,0x62,0x20,0x20,0x20,0x70,0x20,0x22,0x1c, -}; - -static const BitmapCharRec ch30 = {7,9,0,0,8,ch30data}; - -/* char: 0x1d */ - -static const GLubyte ch29data[] = { -0x80,0x40,0xfe,0x10,0xfe,0x4,0x2, -}; - -static const BitmapCharRec ch29 = {7,7,0,0,8,ch29data}; - -/* char: 0x1c */ - -static const GLubyte ch28data[] = { -0x88,0x48,0x48,0x48,0x48,0xfc, -}; - -static const BitmapCharRec ch28 = {6,6,-1,0,8,ch28data}; - -/* char: 0x1b */ - -static const GLubyte ch27data[] = { -0xfe,0x80,0x20,0x8,0x2,0x8,0x20,0x80, -}; - -static const BitmapCharRec ch27 = {7,8,0,0,8,ch27data}; - -/* char: 0x1a */ - -static const GLubyte ch26data[] = { -0xfe,0x2,0x8,0x20,0x80,0x20,0x8,0x2, -}; - -static const BitmapCharRec ch26 = {7,8,0,0,8,ch26data}; - -/* char: 0x19 */ - -static const GLubyte ch25data[] = { -0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80, -}; - -static const BitmapCharRec ch25 = {1,13,-3,2,8,ch25data}; - -/* char: 0x18 */ - -static const GLubyte ch24data[] = { -0x10,0x10,0x10,0x10,0x10,0xff, -}; - -static const BitmapCharRec ch24 = {8,6,0,2,8,ch24data}; - -/* char: 0x17 */ - -static const GLubyte ch23data[] = { -0xff,0x10,0x10,0x10,0x10,0x10,0x10,0x10, -}; - -static const BitmapCharRec ch23 = {8,8,0,-3,8,ch23data}; - -/* char: 0x16 */ - -static const GLubyte ch22data[] = { -0x10,0x10,0x10,0x10,0x10,0xf0,0x10,0x10,0x10,0x10,0x10,0x10,0x10, -}; - -static const BitmapCharRec ch22 = {4,13,0,2,8,ch22data}; - -/* char: 0x15 */ - -static const GLubyte ch21data[] = { -0x80,0x80,0x80,0x80,0x80,0xf8,0x80,0x80,0x80,0x80,0x80,0x80,0x80, -}; - -static const BitmapCharRec ch21 = {5,13,-3,2,8,ch21data}; - -/* char: 0x14 */ - -static const GLubyte ch20data[] = { -0xff, -}; - -static const BitmapCharRec ch20 = {8,1,0,1,8,ch20data}; - -/* char: 0x13 */ - -static const GLubyte ch19data[] = { -0xff, -}; - -static const BitmapCharRec ch19 = {8,1,0,-1,8,ch19data}; - -/* char: 0x12 */ - -static const GLubyte ch18data[] = { -0xff, -}; - -static const BitmapCharRec ch18 = {8,1,0,-3,8,ch18data}; - -/* char: 0x11 */ - -static const GLubyte ch17data[] = { -0xff, -}; - -static const BitmapCharRec ch17 = {8,1,0,-5,8,ch17data}; - -/* char: 0x10 */ - -static const GLubyte ch16data[] = { -0xff, -}; - -static const BitmapCharRec ch16 = {8,1,0,-7,8,ch16data}; - -/* char: 0xf */ - -static const GLubyte ch15data[] = { -0x10,0x10,0x10,0x10,0x10,0xff,0x10,0x10,0x10,0x10,0x10,0x10,0x10, -}; - -static const BitmapCharRec ch15 = {8,13,0,2,8,ch15data}; - -/* char: 0xe */ - -static const GLubyte ch14data[] = { -0xf8,0x80,0x80,0x80,0x80,0x80,0x80,0x80, -}; - -static const BitmapCharRec ch14 = {5,8,-3,-3,8,ch14data}; - -/* char: 0xd */ - -static const GLubyte ch13data[] = { -0x80,0x80,0x80,0x80,0x80,0xf8, -}; - -static const BitmapCharRec ch13 = {5,6,-3,2,8,ch13data}; - -/* char: 0xc */ - -static const GLubyte ch12data[] = { -0x10,0x10,0x10,0x10,0x10,0xf0, -}; - -static const BitmapCharRec ch12 = {4,6,0,2,8,ch12data}; - -/* char: 0xb */ - -static const GLubyte ch11data[] = { -0xf0,0x10,0x10,0x10,0x10,0x10,0x10,0x10, -}; - -static const BitmapCharRec ch11 = {4,8,0,-3,8,ch11data}; - -/* char: 0xa */ - -static const GLubyte ch10data[] = { -0x8,0x8,0x8,0x8,0x3e,0x20,0x50,0x88,0x88, -}; - -static const BitmapCharRec ch10 = {7,9,0,2,8,ch10data}; - -/* char: 0x9 */ - -static const GLubyte ch9data[] = { -0x3e,0x20,0x20,0x20,0x88,0x98,0xa8,0xc8,0x88, -}; - -static const BitmapCharRec ch9 = {7,9,0,2,8,ch9data}; - -/* char: 0x8 */ - -static const GLubyte ch8data[] = { -0xfe,0x10,0x10,0xfe,0x10,0x10, -}; - -static const BitmapCharRec ch8 = {7,6,0,0,8,ch8data}; - -/* char: 0x7 */ - -static const GLubyte ch7data[] = { -0x70,0x88,0x88,0x70, -}; - -static const BitmapCharRec ch7 = {5,4,-1,-5,8,ch7data}; - -/* char: 0x6 */ - -static const GLubyte ch6data[] = { -0x20,0x20,0x3c,0x20,0x3e,0xf8,0x80,0x80,0x80, -}; - -static const BitmapCharRec ch6 = {7,9,0,2,8,ch6data}; - -/* char: 0x5 */ - -static const GLubyte ch5data[] = { -0x22,0x22,0x3c,0x22,0x3c,0x78,0x80,0x80,0x78, -}; - -static const BitmapCharRec ch5 = {7,9,0,2,8,ch5data}; - -/* char: 0x4 */ - -static const GLubyte ch4data[] = { -0x10,0x10,0x1c,0x10,0x9e,0x80,0xe0,0x80,0xf0, -}; - -static const BitmapCharRec ch4 = {7,9,0,2,8,ch4data}; - -/* char: 0x3 */ - -static const GLubyte ch3data[] = { -0x8,0x8,0x8,0x3e,0x88,0x88,0xf8,0x88,0x88, -}; - -static const BitmapCharRec ch3 = {7,9,0,2,8,ch3data}; - -/* char: 0x2 */ - -static const GLubyte ch2data[] = { -0x55,0xaa,0x55,0xaa,0x55,0xaa,0x55,0xaa,0x55,0xaa,0x55,0xaa, -}; - -static const BitmapCharRec ch2 = {8,12,0,2,8,ch2data}; - -/* char: 0x1 */ - -static const GLubyte ch1data[] = { -0x10,0x38,0x7c,0xfe,0x7c,0x38,0x10, -}; - -static const BitmapCharRec ch1 = {7,7,0,-1,8,ch1data}; - -static const BitmapCharRec * const chars[] = { -&ch0, -&ch1, -&ch2, -&ch3, -&ch4, -&ch5, -&ch6, -&ch7, -&ch8, -&ch9, -&ch10, -&ch11, -&ch12, -&ch13, -&ch14, -&ch15, -&ch16, -&ch17, -&ch18, -&ch19, -&ch20, -&ch21, -&ch22, -&ch23, -&ch24, -&ch25, -&ch26, -&ch27, -&ch28, -&ch29, -&ch30, -&ch31, -&ch32, -&ch33, -&ch34, -&ch35, -&ch36, -&ch37, -&ch38, -&ch39, -&ch40, -&ch41, -&ch42, -&ch43, -&ch44, -&ch45, -&ch46, -&ch47, -&ch48, -&ch49, -&ch50, -&ch51, -&ch52, -&ch53, -&ch54, -&ch55, -&ch56, -&ch57, -&ch58, -&ch59, -&ch60, -&ch61, -&ch62, -&ch63, -&ch64, -&ch65, -&ch66, -&ch67, -&ch68, -&ch69, -&ch70, -&ch71, -&ch72, -&ch73, -&ch74, -&ch75, -&ch76, -&ch77, -&ch78, -&ch79, -&ch80, -&ch81, -&ch82, -&ch83, -&ch84, -&ch85, -&ch86, -&ch87, -&ch88, -&ch89, -&ch90, -&ch91, -&ch92, -&ch93, -&ch94, -&ch95, -&ch96, -&ch97, -&ch98, -&ch99, -&ch100, -&ch101, -&ch102, -&ch103, -&ch104, -&ch105, -&ch106, -&ch107, -&ch108, -&ch109, -&ch110, -&ch111, -&ch112, -&ch113, -&ch114, -&ch115, -&ch116, -&ch117, -&ch118, -&ch119, -&ch120, -&ch121, -&ch122, -&ch123, -&ch124, -&ch125, -&ch126, -&ch127, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -&ch160, -&ch161, -&ch162, -&ch163, -&ch164, -&ch165, -&ch166, -&ch167, -&ch168, -&ch169, -&ch170, -&ch171, -&ch172, -&ch173, -&ch174, -&ch175, -&ch176, -&ch177, -&ch178, -&ch179, -&ch180, -&ch181, -&ch182, -&ch183, -&ch184, -&ch185, -&ch186, -&ch187, -&ch188, -&ch189, -&ch190, -&ch191, -&ch192, -&ch193, -&ch194, -&ch195, -&ch196, -&ch197, -&ch198, -&ch199, -&ch200, -&ch201, -&ch202, -&ch203, -&ch204, -&ch205, -&ch206, -&ch207, -&ch208, -&ch209, -&ch210, -&ch211, -&ch212, -&ch213, -&ch214, -&ch215, -&ch216, -&ch217, -&ch218, -&ch219, -&ch220, -&ch221, -&ch222, -&ch223, -&ch224, -&ch225, -&ch226, -&ch227, -&ch228, -&ch229, -&ch230, -&ch231, -&ch232, -&ch233, -&ch234, -&ch235, -&ch236, -&ch237, -&ch238, -&ch239, -&ch240, -&ch241, -&ch242, -&ch243, -&ch244, -&ch245, -&ch246, -&ch247, -&ch248, -&ch249, -&ch250, -&ch251, -&ch252, -&ch253, -&ch254, -&ch255, -}; - -#if !defined(__IBMCPP__) -const -#endif -BitmapFontRec glutBitmap8By13 = { -"-misc-fixed-medium-r-normal--13-120-75-75-C-80-iso8859-1", -256, -0, -chars -}; - diff --git a/src/glut/os2/glut_9x15.cpp b/src/glut/os2/glut_9x15.cpp deleted file mode 100644 index d228a2b150..0000000000 --- a/src/glut/os2/glut_9x15.cpp +++ /dev/null @@ -1,2077 +0,0 @@ - -/* GENERATED FILE -- DO NOT MODIFY */ - -#define glutBitmap9By15 XXX -#include "glutbitmap.h" -#undef glutBitmap9By15 - -#ifdef _WIN32 -/* XXX Work around Microsoft OpenGL 1.1 bug where glBitmap with - a height or width of zero does not advance the raster position - as specified by OpenGL. (Cosmo OpenGL does not have this bug.) */ -static const GLubyte ch0data[] = { 0x0 }; -static const BitmapCharRec ch0 = {1,1,0,0,9,ch0data}; -#else -static const BitmapCharRec ch0 = {0,0,0,0,9,0}; -#endif - -#ifdef _WIN32 -/* XXX Work around Microsoft OpenGL 1.1 bug where glBitmap with - a height or width of zero does not advance the raster position - as specified by OpenGL. (Cosmo OpenGL does not have this bug.) */ -static const GLubyte ch32data[] = { 0x0 }; -static const BitmapCharRec ch32 = {1,1,0,0,9,ch32data}; -#else -static const BitmapCharRec ch32 = {0,0,0,0,9,0}; -#endif - -#ifdef _WIN32 -/* XXX Work around Microsoft OpenGL 1.1 bug where glBitmap with - a height or width of zero does not advance the raster position - as specified by OpenGL. (Cosmo OpenGL does not have this bug.) */ -static const GLubyte ch127data[] = { 0x0 }; -static const BitmapCharRec ch127 = {1,1,0,0,9,ch127data}; -#else -static const BitmapCharRec ch127 = {0,0,0,0,9,0}; -#endif - -#ifdef _WIN32 -/* XXX Work around Microsoft OpenGL 1.1 bug where glBitmap with - a height or width of zero does not advance the raster position - as specified by OpenGL. (Cosmo OpenGL does not have this bug.) */ -static const GLubyte ch160data[] = { 0x0 }; -static const BitmapCharRec ch160 = {1,1,0,0,9,ch160data}; -#else -static const BitmapCharRec ch160 = {0,0,0,0,9,0}; -#endif - -/* char: 0xff */ - -static const GLubyte ch255data[] = { -0x78,0x84,0x4,0x74,0x8c,0x84,0x84,0x84,0x84,0x84,0x0,0x0,0x28,0x28, -}; - -static const BitmapCharRec ch255 = {6,14,-1,3,9,ch255data}; - -/* char: 0xfe */ - -static const GLubyte ch254data[] = { -0x80,0x80,0x80,0xbc,0xc2,0x82,0x82,0x82,0xc2,0xbc,0x80,0x80, -}; - -static const BitmapCharRec ch254 = {7,12,-1,3,9,ch254data}; - -/* char: 0xfd */ - -static const GLubyte ch253data[] = { -0x78,0x84,0x4,0x74,0x8c,0x84,0x84,0x84,0x84,0x84,0x0,0x0,0x30,0x8, -}; - -static const BitmapCharRec ch253 = {6,14,-1,3,9,ch253data}; - -/* char: 0xfc */ - -static const GLubyte ch252data[] = { -0x7a,0x84,0x84,0x84,0x84,0x84,0x84,0x0,0x0,0x28,0x28, -}; - -static const BitmapCharRec ch252 = {7,11,-1,0,9,ch252data}; - -/* char: 0xfb */ - -static const GLubyte ch251data[] = { -0x7a,0x84,0x84,0x84,0x84,0x84,0x84,0x0,0x0,0x44,0x38, -}; - -static const BitmapCharRec ch251 = {7,11,-1,0,9,ch251data}; - -/* char: 0xfa */ - -static const GLubyte ch250data[] = { -0x7a,0x84,0x84,0x84,0x84,0x84,0x84,0x0,0x0,0x30,0x8, -}; - -static const BitmapCharRec ch250 = {7,11,-1,0,9,ch250data}; - -/* char: 0xf9 */ - -static const GLubyte ch249data[] = { -0x7a,0x84,0x84,0x84,0x84,0x84,0x84,0x0,0x0,0x18,0x20, -}; - -static const BitmapCharRec ch249 = {7,11,-1,0,9,ch249data}; - -/* char: 0xf8 */ - -static const GLubyte ch248data[] = { -0x80,0x7c,0xa2,0xa2,0x92,0x8a,0x8a,0x7c,0x2, -}; - -static const BitmapCharRec ch248 = {7,9,-1,1,9,ch248data}; - -/* char: 0xf7 */ - -static const GLubyte ch247data[] = { -0x10,0x38,0x10,0x0,0xfe,0x0,0x10,0x38,0x10, -}; - -static const BitmapCharRec ch247 = {7,9,-1,0,9,ch247data}; - -/* char: 0xf6 */ - -static const GLubyte ch246data[] = { -0x7c,0x82,0x82,0x82,0x82,0x82,0x7c,0x0,0x0,0x28,0x28, -}; - -static const BitmapCharRec ch246 = {7,11,-1,0,9,ch246data}; - -/* char: 0xf5 */ - -static const GLubyte ch245data[] = { -0x7c,0x82,0x82,0x82,0x82,0x82,0x7c,0x0,0x0,0x50,0x28, -}; - -static const BitmapCharRec ch245 = {7,11,-1,0,9,ch245data}; - -/* char: 0xf4 */ - -static const GLubyte ch244data[] = { -0x7c,0x82,0x82,0x82,0x82,0x82,0x7c,0x0,0x0,0x44,0x38, -}; - -static const BitmapCharRec ch244 = {7,11,-1,0,9,ch244data}; - -/* char: 0xf3 */ - -static const GLubyte ch243data[] = { -0x7c,0x82,0x82,0x82,0x82,0x82,0x7c,0x0,0x0,0x30,0x8, -}; - -static const BitmapCharRec ch243 = {7,11,-1,0,9,ch243data}; - -/* char: 0xf2 */ - -static const GLubyte ch242data[] = { -0x7c,0x82,0x82,0x82,0x82,0x82,0x7c,0x0,0x0,0x18,0x20, -}; - -static const BitmapCharRec ch242 = {7,11,-1,0,9,ch242data}; - -/* char: 0xf1 */ - -static const GLubyte ch241data[] = { -0x82,0x82,0x82,0x82,0x82,0xc2,0xbc,0x0,0x0,0x50,0x28, -}; - -static const BitmapCharRec ch241 = {7,11,-1,0,9,ch241data}; - -/* char: 0xf0 */ - -static const GLubyte ch240data[] = { -0x7c,0x82,0x82,0x82,0x82,0x82,0x7c,0x8,0x50,0x30,0x48, -}; - -static const BitmapCharRec ch240 = {7,11,-1,0,9,ch240data}; - -/* char: 0xef */ - -static const GLubyte ch239data[] = { -0xf8,0x20,0x20,0x20,0x20,0x20,0xe0,0x0,0x0,0x50,0x50, -}; - -static const BitmapCharRec ch239 = {5,11,-2,0,9,ch239data}; - -/* char: 0xee */ - -static const GLubyte ch238data[] = { -0xf8,0x20,0x20,0x20,0x20,0x20,0xe0,0x0,0x0,0x90,0x60, -}; - -static const BitmapCharRec ch238 = {5,11,-2,0,9,ch238data}; - -/* char: 0xed */ - -static const GLubyte ch237data[] = { -0xf8,0x20,0x20,0x20,0x20,0x20,0xe0,0x0,0x0,0x60,0x10, -}; - -static const BitmapCharRec ch237 = {5,11,-2,0,9,ch237data}; - -/* char: 0xec */ - -static const GLubyte ch236data[] = { -0xf8,0x20,0x20,0x20,0x20,0x20,0xe0,0x0,0x0,0x30,0x40, -}; - -static const BitmapCharRec ch236 = {5,11,-2,0,9,ch236data}; - -/* char: 0xeb */ - -static const GLubyte ch235data[] = { -0x7c,0x80,0x80,0xfe,0x82,0x82,0x7c,0x0,0x0,0x28,0x28, -}; - -static const BitmapCharRec ch235 = {7,11,-1,0,9,ch235data}; - -/* char: 0xea */ - -static const GLubyte ch234data[] = { -0x7c,0x80,0x80,0xfe,0x82,0x82,0x7c,0x0,0x0,0x44,0x38, -}; - -static const BitmapCharRec ch234 = {7,11,-1,0,9,ch234data}; - -/* char: 0xe9 */ - -static const GLubyte ch233data[] = { -0x7c,0x80,0x80,0xfe,0x82,0x82,0x7c,0x0,0x0,0x30,0x8, -}; - -static const BitmapCharRec ch233 = {7,11,-1,0,9,ch233data}; - -/* char: 0xe8 */ - -static const GLubyte ch232data[] = { -0x7c,0x80,0x80,0xfe,0x82,0x82,0x7c,0x0,0x0,0x18,0x20, -}; - -static const BitmapCharRec ch232 = {7,11,-1,0,9,ch232data}; - -/* char: 0xe7 */ - -static const GLubyte ch231data[] = { -0x30,0x48,0x18,0x7c,0x82,0x80,0x80,0x80,0x82,0x7c, -}; - -static const BitmapCharRec ch231 = {7,10,-1,3,9,ch231data}; - -/* char: 0xe6 */ - -static const GLubyte ch230data[] = { -0x6e,0x92,0x90,0x7c,0x12,0x92,0x6c, -}; - -static const BitmapCharRec ch230 = {7,7,-1,0,9,ch230data}; - -/* char: 0xe5 */ - -static const GLubyte ch229data[] = { -0x7a,0x86,0x82,0x7e,0x2,0x2,0x7c,0x0,0x18,0x24,0x18, -}; - -static const BitmapCharRec ch229 = {7,11,-1,0,9,ch229data}; - -/* char: 0xe4 */ - -static const GLubyte ch228data[] = { -0x7a,0x86,0x82,0x7e,0x2,0x2,0x7c,0x0,0x0,0x28,0x28, -}; - -static const BitmapCharRec ch228 = {7,11,-1,0,9,ch228data}; - -/* char: 0xe3 */ - -static const GLubyte ch227data[] = { -0x7a,0x86,0x82,0x7e,0x2,0x2,0x7c,0x0,0x0,0x50,0x28, -}; - -static const BitmapCharRec ch227 = {7,11,-1,0,9,ch227data}; - -/* char: 0xe2 */ - -static const GLubyte ch226data[] = { -0x7a,0x86,0x82,0x7e,0x2,0x2,0x7c,0x0,0x0,0x44,0x38, -}; - -static const BitmapCharRec ch226 = {7,11,-1,0,9,ch226data}; - -/* char: 0xe1 */ - -static const GLubyte ch225data[] = { -0x7a,0x86,0x82,0x7e,0x2,0x2,0x7c,0x0,0x0,0x30,0x8, -}; - -static const BitmapCharRec ch225 = {7,11,-1,0,9,ch225data}; - -/* char: 0xe0 */ - -static const GLubyte ch224data[] = { -0x7a,0x86,0x82,0x7e,0x2,0x2,0x7c,0x0,0x0,0x18,0x20, -}; - -static const BitmapCharRec ch224 = {7,11,-1,0,9,ch224data}; - -/* char: 0xdf */ - -static const GLubyte ch223data[] = { -0x80,0xbc,0xc2,0x82,0x82,0xfc,0x82,0x82,0x7c, -}; - -static const BitmapCharRec ch223 = {7,9,-1,1,9,ch223data}; - -/* char: 0xde */ - -static const GLubyte ch222data[] = { -0x80,0x80,0x80,0xfc,0x82,0x82,0x82,0xfc,0x80,0x80, -}; - -static const BitmapCharRec ch222 = {7,10,-1,0,9,ch222data}; - -/* char: 0xdd */ - -static const GLubyte ch221data[] = { -0x10,0x10,0x10,0x10,0x28,0x44,0x82,0x82,0x0,0x30,0x8, -}; - -static const BitmapCharRec ch221 = {7,11,-1,0,9,ch221data}; - -/* char: 0xdc */ - -static const GLubyte ch220data[] = { -0x7c,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x0,0x28,0x28, -}; - -static const BitmapCharRec ch220 = {7,11,-1,0,9,ch220data}; - -/* char: 0xdb */ - -static const GLubyte ch219data[] = { -0x7c,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x0,0x44,0x38, -}; - -static const BitmapCharRec ch219 = {7,11,-1,0,9,ch219data}; - -/* char: 0xda */ - -static const GLubyte ch218data[] = { -0x7c,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x0,0x30,0x8, -}; - -static const BitmapCharRec ch218 = {7,11,-1,0,9,ch218data}; - -/* char: 0xd9 */ - -static const GLubyte ch217data[] = { -0x7c,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x0,0x18,0x20, -}; - -static const BitmapCharRec ch217 = {7,11,-1,0,9,ch217data}; - -/* char: 0xd8 */ - -static const GLubyte ch216data[] = { -0x80,0x7c,0xc2,0xa2,0xa2,0x92,0x92,0x8a,0x8a,0x86,0x7c,0x2, -}; - -static const BitmapCharRec ch216 = {7,12,-1,1,9,ch216data}; - -/* char: 0xd7 */ - -static const GLubyte ch215data[] = { -0x82,0x44,0x28,0x10,0x28,0x44,0x82, -}; - -static const BitmapCharRec ch215 = {7,7,-1,-1,9,ch215data}; - -/* char: 0xd6 */ - -static const GLubyte ch214data[] = { -0x7c,0x82,0x82,0x82,0x82,0x82,0x82,0x7c,0x0,0x28,0x28, -}; - -static const BitmapCharRec ch214 = {7,11,-1,0,9,ch214data}; - -/* char: 0xd5 */ - -static const GLubyte ch213data[] = { -0x7c,0x82,0x82,0x82,0x82,0x82,0x82,0x7c,0x0,0x50,0x28, -}; - -static const BitmapCharRec ch213 = {7,11,-1,0,9,ch213data}; - -/* char: 0xd4 */ - -static const GLubyte ch212data[] = { -0x7c,0x82,0x82,0x82,0x82,0x82,0x82,0x7c,0x0,0x44,0x38, -}; - -static const BitmapCharRec ch212 = {7,11,-1,0,9,ch212data}; - -/* char: 0xd3 */ - -static const GLubyte ch211data[] = { -0x7c,0x82,0x82,0x82,0x82,0x82,0x82,0x7c,0x0,0x30,0x8, -}; - -static const BitmapCharRec ch211 = {7,11,-1,0,9,ch211data}; - -/* char: 0xd2 */ - -static const GLubyte ch210data[] = { -0x7c,0x82,0x82,0x82,0x82,0x82,0x82,0x7c,0x0,0x18,0x20, -}; - -static const BitmapCharRec ch210 = {7,11,-1,0,9,ch210data}; - -/* char: 0xd1 */ - -static const GLubyte ch209data[] = { -0x82,0x86,0x8a,0x92,0x92,0xa2,0xc2,0x82,0x0,0x50,0x28, -}; - -static const BitmapCharRec ch209 = {7,11,-1,0,9,ch209data}; - -/* char: 0xd0 */ - -static const GLubyte ch208data[] = { -0xfc,0x42,0x42,0x42,0x42,0xf2,0x42,0x42,0x42,0xfc, -}; - -static const BitmapCharRec ch208 = {7,10,-1,0,9,ch208data}; - -/* char: 0xcf */ - -static const GLubyte ch207data[] = { -0xf8,0x20,0x20,0x20,0x20,0x20,0x20,0xf8,0x0,0x50,0x50, -}; - -static const BitmapCharRec ch207 = {5,11,-2,0,9,ch207data}; - -/* char: 0xce */ - -static const GLubyte ch206data[] = { -0xf8,0x20,0x20,0x20,0x20,0x20,0x20,0xf8,0x0,0x88,0x70, -}; - -static const BitmapCharRec ch206 = {5,11,-2,0,9,ch206data}; - -/* char: 0xcd */ - -static const GLubyte ch205data[] = { -0xf8,0x20,0x20,0x20,0x20,0x20,0x20,0xf8,0x0,0x60,0x10, -}; - -static const BitmapCharRec ch205 = {5,11,-2,0,9,ch205data}; - -/* char: 0xcc */ - -static const GLubyte ch204data[] = { -0xf8,0x20,0x20,0x20,0x20,0x20,0x20,0xf8,0x0,0x30,0x40, -}; - -static const BitmapCharRec ch204 = {5,11,-2,0,9,ch204data}; - -/* char: 0xcb */ - -static const GLubyte ch203data[] = { -0xfe,0x40,0x40,0x40,0x78,0x40,0x40,0xfe,0x0,0x28,0x28, -}; - -static const BitmapCharRec ch203 = {7,11,-1,0,9,ch203data}; - -/* char: 0xca */ - -static const GLubyte ch202data[] = { -0xfe,0x40,0x40,0x40,0x78,0x40,0x40,0xfe,0x0,0x44,0x38, -}; - -static const BitmapCharRec ch202 = {7,11,-1,0,9,ch202data}; - -/* char: 0xc9 */ - -static const GLubyte ch201data[] = { -0xfe,0x40,0x40,0x40,0x78,0x40,0x40,0xfe,0x0,0x30,0x8, -}; - -static const BitmapCharRec ch201 = {7,11,-1,0,9,ch201data}; - -/* char: 0xc8 */ - -static const GLubyte ch200data[] = { -0xfe,0x40,0x40,0x40,0x78,0x40,0x40,0xfe,0x0,0x18,0x20, -}; - -static const BitmapCharRec ch200 = {7,11,-1,0,9,ch200data}; - -/* char: 0xc7 */ - -static const GLubyte ch199data[] = { -0x30,0x48,0x18,0x7c,0x82,0x80,0x80,0x80,0x80,0x80,0x80,0x82,0x7c, -}; - -static const BitmapCharRec ch199 = {7,13,-1,3,9,ch199data}; - -/* char: 0xc6 */ - -static const GLubyte ch198data[] = { -0x9e,0x90,0x90,0x90,0xfc,0x90,0x90,0x90,0x90,0x6e, -}; - -static const BitmapCharRec ch198 = {7,10,-1,0,9,ch198data}; - -/* char: 0xc5 */ - -static const GLubyte ch197data[] = { -0x82,0x82,0x82,0xfe,0x82,0x82,0x44,0x38,0x10,0x28,0x10, -}; - -static const BitmapCharRec ch197 = {7,11,-1,0,9,ch197data}; - -/* char: 0xc4 */ - -static const GLubyte ch196data[] = { -0x82,0x82,0x82,0xfe,0x82,0x82,0x44,0x38,0x0,0x28,0x28, -}; - -static const BitmapCharRec ch196 = {7,11,-1,0,9,ch196data}; - -/* char: 0xc3 */ - -static const GLubyte ch195data[] = { -0x82,0x82,0x82,0xfe,0x82,0x82,0x44,0x38,0x0,0x50,0x28, -}; - -static const BitmapCharRec ch195 = {7,11,-1,0,9,ch195data}; - -/* char: 0xc2 */ - -static const GLubyte ch194data[] = { -0x82,0x82,0x82,0xfe,0x82,0x82,0x44,0x38,0x0,0x44,0x38, -}; - -static const BitmapCharRec ch194 = {7,11,-1,0,9,ch194data}; - -/* char: 0xc1 */ - -static const GLubyte ch193data[] = { -0x82,0x82,0x82,0xfe,0x82,0x82,0x44,0x38,0x0,0x30,0x8, -}; - -static const BitmapCharRec ch193 = {7,11,-1,0,9,ch193data}; - -/* char: 0xc0 */ - -static const GLubyte ch192data[] = { -0x82,0x82,0x82,0xfe,0x82,0x82,0x44,0x38,0x0,0x18,0x20, -}; - -static const BitmapCharRec ch192 = {7,11,-1,0,9,ch192data}; - -/* char: 0xbf */ - -static const GLubyte ch191data[] = { -0x7c,0x82,0x82,0x80,0x40,0x20,0x10,0x10,0x0,0x10, -}; - -static const BitmapCharRec ch191 = {7,10,-1,0,9,ch191data}; - -/* char: 0xbe */ - -static const GLubyte ch190data[] = { -0x6,0x1a,0x12,0xa,0x66,0x92,0x10,0x20,0x90,0x60, -}; - -static const BitmapCharRec ch190 = {7,10,-1,0,9,ch190data}; - -/* char: 0xbd */ - -static const GLubyte ch189data[] = { -0x1e,0x10,0xc,0x2,0xf2,0x4c,0x40,0x40,0xc0,0x40, -}; - -static const BitmapCharRec ch189 = {7,10,-1,0,9,ch189data}; - -/* char: 0xbc */ - -static const GLubyte ch188data[] = { -0x6,0x1a,0x12,0xa,0xe6,0x42,0x40,0x40,0xc0,0x40, -}; - -static const BitmapCharRec ch188 = {7,10,-1,0,9,ch188data}; - -/* char: 0xbb */ - -static const GLubyte ch187data[] = { -0x90,0x48,0x24,0x12,0x12,0x24,0x48,0x90, -}; - -static const BitmapCharRec ch187 = {7,8,-1,-1,9,ch187data}; - -/* char: 0xba */ - -static const GLubyte ch186data[] = { -0xf8,0x0,0x70,0x88,0x88,0x70, -}; - -static const BitmapCharRec ch186 = {5,6,-1,-5,9,ch186data}; - -/* char: 0xb9 */ - -static const GLubyte ch185data[] = { -0xe0,0x40,0x40,0x40,0xc0,0x40, -}; - -static const BitmapCharRec ch185 = {3,6,-1,-4,9,ch185data}; - -/* char: 0xb8 */ - -static const GLubyte ch184data[] = { -0x60,0x90,0x30, -}; - -static const BitmapCharRec ch184 = {4,3,-2,3,9,ch184data}; - -/* char: 0xb7 */ - -static const GLubyte ch183data[] = { -0xc0,0xc0, -}; - -static const BitmapCharRec ch183 = {2,2,-4,-4,9,ch183data}; - -/* char: 0xb6 */ - -static const GLubyte ch182data[] = { -0xa,0xa,0xa,0xa,0xa,0x7a,0x8a,0x8a,0x8a,0x7e, -}; - -static const BitmapCharRec ch182 = {7,10,-1,0,9,ch182data}; - -/* char: 0xb5 */ - -static const GLubyte ch181data[] = { -0x80,0x80,0xba,0xc6,0x82,0x82,0x82,0x82,0x82, -}; - -static const BitmapCharRec ch181 = {7,9,-1,2,9,ch181data}; - -/* char: 0xb4 */ - -static const GLubyte ch180data[] = { -0xc0,0x20, -}; - -static const BitmapCharRec ch180 = {3,2,-3,-9,9,ch180data}; - -/* char: 0xb3 */ - -static const GLubyte ch179data[] = { -0x60,0x90,0x10,0x20,0x90,0x60, -}; - -static const BitmapCharRec ch179 = {4,6,-1,-4,9,ch179data}; - -/* char: 0xb2 */ - -static const GLubyte ch178data[] = { -0xf0,0x80,0x60,0x10,0x90,0x60, -}; - -static const BitmapCharRec ch178 = {4,6,-1,-4,9,ch178data}; - -/* char: 0xb1 */ - -static const GLubyte ch177data[] = { -0xfe,0x0,0x10,0x10,0x10,0xfe,0x10,0x10,0x10, -}; - -static const BitmapCharRec ch177 = {7,9,-1,-1,9,ch177data}; - -/* char: 0xb0 */ - -static const GLubyte ch176data[] = { -0x60,0x90,0x90,0x60, -}; - -static const BitmapCharRec ch176 = {4,4,-3,-6,9,ch176data}; - -/* char: 0xaf */ - -static const GLubyte ch175data[] = { -0xfc, -}; - -static const BitmapCharRec ch175 = {6,1,-1,-9,9,ch175data}; - -/* char: 0xae */ - -static const GLubyte ch174data[] = { -0x3c,0x42,0xa5,0xa9,0xbd,0xa5,0xb9,0x42,0x3c, -}; - -static const BitmapCharRec ch174 = {8,9,0,-1,9,ch174data}; - -/* char: 0xad */ - -static const GLubyte ch173data[] = { -0xfc, -}; - -static const BitmapCharRec ch173 = {6,1,-1,-4,9,ch173data}; - -/* char: 0xac */ - -static const GLubyte ch172data[] = { -0x4,0x4,0x4,0xfc, -}; - -static const BitmapCharRec ch172 = {6,4,-1,-2,9,ch172data}; - -/* char: 0xab */ - -static const GLubyte ch171data[] = { -0x12,0x24,0x48,0x90,0x90,0x48,0x24,0x12, -}; - -static const BitmapCharRec ch171 = {7,8,-1,-1,9,ch171data}; - -/* char: 0xaa */ - -static const GLubyte ch170data[] = { -0xf8,0x0,0x78,0x90,0x70,0x90,0x60, -}; - -static const BitmapCharRec ch170 = {5,7,-3,-3,9,ch170data}; - -/* char: 0xa9 */ - -static const GLubyte ch169data[] = { -0x3c,0x42,0x99,0xa5,0xa1,0xa5,0x99,0x42,0x3c, -}; - -static const BitmapCharRec ch169 = {8,9,0,-1,9,ch169data}; - -/* char: 0xa8 */ - -static const GLubyte ch168data[] = { -0xa0,0xa0, -}; - -static const BitmapCharRec ch168 = {3,2,-3,-9,9,ch168data}; - -/* char: 0xa7 */ - -static const GLubyte ch167data[] = { -0x70,0x88,0x8,0x70,0x88,0x88,0x88,0x70,0x80,0x88,0x70, -}; - -static const BitmapCharRec ch167 = {5,11,-2,1,9,ch167data}; - -/* char: 0xa6 */ - -static const GLubyte ch166data[] = { -0x80,0x80,0x80,0x80,0x80,0x0,0x80,0x80,0x80,0x80,0x80, -}; - -static const BitmapCharRec ch166 = {1,11,-4,1,9,ch166data}; - -/* char: 0xa5 */ - -static const GLubyte ch165data[] = { -0x10,0x10,0x10,0x7c,0x10,0x7c,0x28,0x44,0x82,0x82, -}; - -static const BitmapCharRec ch165 = {7,10,-1,0,9,ch165data}; - -/* char: 0xa4 */ - -static const GLubyte ch164data[] = { -0x82,0x7c,0x44,0x44,0x7c,0x82, -}; - -static const BitmapCharRec ch164 = {7,6,-1,-3,9,ch164data}; - -/* char: 0xa3 */ - -static const GLubyte ch163data[] = { -0x5c,0xa2,0x60,0x20,0x20,0xf8,0x20,0x20,0x22,0x1c, -}; - -static const BitmapCharRec ch163 = {7,10,-1,0,9,ch163data}; - -/* char: 0xa2 */ - -static const GLubyte ch162data[] = { -0x40,0x78,0xa4,0xa0,0x90,0x94,0x78,0x8, -}; - -static const BitmapCharRec ch162 = {6,8,-1,0,9,ch162data}; - -/* char: 0xa1 */ - -static const GLubyte ch161data[] = { -0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x0,0x0,0x80,0x80, -}; - -static const BitmapCharRec ch161 = {1,11,-4,0,9,ch161data}; - -/* char: 0x7e '~' */ - -static const GLubyte ch126data[] = { -0x8c,0x92,0x62, -}; - -static const BitmapCharRec ch126 = {7,3,-1,-7,9,ch126data}; - -/* char: 0x7d '}' */ - -static const GLubyte ch125data[] = { -0xe0,0x10,0x10,0x10,0x20,0x18,0x18,0x20,0x10,0x10,0x10,0xe0, -}; - -static const BitmapCharRec ch125 = {5,12,-1,1,9,ch125data}; - -/* char: 0x7c '|' */ - -static const GLubyte ch124data[] = { -0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80, -}; - -static const BitmapCharRec ch124 = {1,12,-4,1,9,ch124data}; - -/* char: 0x7b '{' */ - -static const GLubyte ch123data[] = { -0x38,0x40,0x40,0x40,0x20,0xc0,0xc0,0x20,0x40,0x40,0x40,0x38, -}; - -static const BitmapCharRec ch123 = {5,12,-3,1,9,ch123data}; - -/* char: 0x7a 'z' */ - -static const GLubyte ch122data[] = { -0xfe,0x40,0x20,0x10,0x8,0x4,0xfe, -}; - -static const BitmapCharRec ch122 = {7,7,-1,0,9,ch122data}; - -/* char: 0x79 'y' */ - -static const GLubyte ch121data[] = { -0x78,0x84,0x4,0x74,0x8c,0x84,0x84,0x84,0x84,0x84, -}; - -static const BitmapCharRec ch121 = {6,10,-1,3,9,ch121data}; - -/* char: 0x78 'x' */ - -static const GLubyte ch120data[] = { -0x82,0x44,0x28,0x10,0x28,0x44,0x82, -}; - -static const BitmapCharRec ch120 = {7,7,-1,0,9,ch120data}; - -/* char: 0x77 'w' */ - -static const GLubyte ch119data[] = { -0x44,0xaa,0x92,0x92,0x92,0x82,0x82, -}; - -static const BitmapCharRec ch119 = {7,7,-1,0,9,ch119data}; - -/* char: 0x76 'v' */ - -static const GLubyte ch118data[] = { -0x10,0x28,0x28,0x44,0x44,0x82,0x82, -}; - -static const BitmapCharRec ch118 = {7,7,-1,0,9,ch118data}; - -/* char: 0x75 'u' */ - -static const GLubyte ch117data[] = { -0x7a,0x84,0x84,0x84,0x84,0x84,0x84, -}; - -static const BitmapCharRec ch117 = {7,7,-1,0,9,ch117data}; - -/* char: 0x74 't' */ - -static const GLubyte ch116data[] = { -0x1c,0x22,0x20,0x20,0x20,0x20,0xfc,0x20,0x20, -}; - -static const BitmapCharRec ch116 = {7,9,-1,0,9,ch116data}; - -/* char: 0x73 's' */ - -static const GLubyte ch115data[] = { -0x7c,0x82,0x2,0x7c,0x80,0x82,0x7c, -}; - -static const BitmapCharRec ch115 = {7,7,-1,0,9,ch115data}; - -/* char: 0x72 'r' */ - -static const GLubyte ch114data[] = { -0x40,0x40,0x40,0x40,0x42,0x62,0x9c, -}; - -static const BitmapCharRec ch114 = {7,7,-1,0,9,ch114data}; - -/* char: 0x71 'q' */ - -static const GLubyte ch113data[] = { -0x2,0x2,0x2,0x7a,0x86,0x82,0x82,0x82,0x86,0x7a, -}; - -static const BitmapCharRec ch113 = {7,10,-1,3,9,ch113data}; - -/* char: 0x70 'p' */ - -static const GLubyte ch112data[] = { -0x80,0x80,0x80,0xbc,0xc2,0x82,0x82,0x82,0xc2,0xbc, -}; - -static const BitmapCharRec ch112 = {7,10,-1,3,9,ch112data}; - -/* char: 0x6f 'o' */ - -static const GLubyte ch111data[] = { -0x7c,0x82,0x82,0x82,0x82,0x82,0x7c, -}; - -static const BitmapCharRec ch111 = {7,7,-1,0,9,ch111data}; - -/* char: 0x6e 'n' */ - -static const GLubyte ch110data[] = { -0x82,0x82,0x82,0x82,0x82,0xc2,0xbc, -}; - -static const BitmapCharRec ch110 = {7,7,-1,0,9,ch110data}; - -/* char: 0x6d 'm' */ - -static const GLubyte ch109data[] = { -0x82,0x92,0x92,0x92,0x92,0x92,0xec, -}; - -static const BitmapCharRec ch109 = {7,7,-1,0,9,ch109data}; - -/* char: 0x6c 'l' */ - -static const GLubyte ch108data[] = { -0xf8,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0xe0, -}; - -static const BitmapCharRec ch108 = {5,10,-2,0,9,ch108data}; - -/* char: 0x6b 'k' */ - -static const GLubyte ch107data[] = { -0x82,0x8c,0xb0,0xc0,0xb0,0x8c,0x82,0x80,0x80,0x80, -}; - -static const BitmapCharRec ch107 = {7,10,-1,0,9,ch107data}; - -/* char: 0x6a 'j' */ - -static const GLubyte ch106data[] = { -0x78,0x84,0x84,0x84,0x4,0x4,0x4,0x4,0x4,0x1c,0x0,0x0,0xc, -}; - -static const BitmapCharRec ch106 = {6,13,-1,3,9,ch106data}; - -/* char: 0x69 'i' */ - -static const GLubyte ch105data[] = { -0xf8,0x20,0x20,0x20,0x20,0x20,0xe0,0x0,0x0,0x60, -}; - -static const BitmapCharRec ch105 = {5,10,-2,0,9,ch105data}; - -/* char: 0x68 'h' */ - -static const GLubyte ch104data[] = { -0x82,0x82,0x82,0x82,0x82,0xc2,0xbc,0x80,0x80,0x80, -}; - -static const BitmapCharRec ch104 = {7,10,-1,0,9,ch104data}; - -/* char: 0x67 'g' */ - -static const GLubyte ch103data[] = { -0x7c,0x82,0x82,0x7c,0x80,0x78,0x84,0x84,0x84,0x7a, -}; - -static const BitmapCharRec ch103 = {7,10,-1,3,9,ch103data}; - -/* char: 0x66 'f' */ - -static const GLubyte ch102data[] = { -0x20,0x20,0x20,0x20,0xf8,0x20,0x20,0x22,0x22,0x1c, -}; - -static const BitmapCharRec ch102 = {7,10,-1,0,9,ch102data}; - -/* char: 0x65 'e' */ - -static const GLubyte ch101data[] = { -0x7c,0x80,0x80,0xfe,0x82,0x82,0x7c, -}; - -static const BitmapCharRec ch101 = {7,7,-1,0,9,ch101data}; - -/* char: 0x64 'd' */ - -static const GLubyte ch100data[] = { -0x7a,0x86,0x82,0x82,0x82,0x86,0x7a,0x2,0x2,0x2, -}; - -static const BitmapCharRec ch100 = {7,10,-1,0,9,ch100data}; - -/* char: 0x63 'c' */ - -static const GLubyte ch99data[] = { -0x7c,0x82,0x80,0x80,0x80,0x82,0x7c, -}; - -static const BitmapCharRec ch99 = {7,7,-1,0,9,ch99data}; - -/* char: 0x62 'b' */ - -static const GLubyte ch98data[] = { -0xbc,0xc2,0x82,0x82,0x82,0xc2,0xbc,0x80,0x80,0x80, -}; - -static const BitmapCharRec ch98 = {7,10,-1,0,9,ch98data}; - -/* char: 0x61 'a' */ - -static const GLubyte ch97data[] = { -0x7a,0x86,0x82,0x7e,0x2,0x2,0x7c, -}; - -static const BitmapCharRec ch97 = {7,7,-1,0,9,ch97data}; - -/* char: 0x60 '`' */ - -static const GLubyte ch96data[] = { -0x10,0x20,0x40,0xc0, -}; - -static const BitmapCharRec ch96 = {4,4,-3,-6,9,ch96data}; - -/* char: 0x5f '_' */ - -static const GLubyte ch95data[] = { -0xff, -}; - -static const BitmapCharRec ch95 = {8,1,0,1,9,ch95data}; - -/* char: 0x5e '^' */ - -static const GLubyte ch94data[] = { -0x82,0x44,0x28,0x10, -}; - -static const BitmapCharRec ch94 = {7,4,-1,-6,9,ch94data}; - -/* char: 0x5d ']' */ - -static const GLubyte ch93data[] = { -0xf0,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0xf0, -}; - -static const BitmapCharRec ch93 = {4,12,-2,1,9,ch93data}; - -/* char: 0x5c '\' */ - -static const GLubyte ch92data[] = { -0x2,0x4,0x4,0x8,0x10,0x10,0x20,0x40,0x40,0x80, -}; - -static const BitmapCharRec ch92 = {7,10,-1,0,9,ch92data}; - -/* char: 0x5b '[' */ - -static const GLubyte ch91data[] = { -0xf0,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0xf0, -}; - -static const BitmapCharRec ch91 = {4,12,-3,1,9,ch91data}; - -/* char: 0x5a 'Z' */ - -static const GLubyte ch90data[] = { -0xfe,0x80,0x80,0x40,0x20,0x10,0x8,0x4,0x2,0xfe, -}; - -static const BitmapCharRec ch90 = {7,10,-1,0,9,ch90data}; - -/* char: 0x59 'Y' */ - -static const GLubyte ch89data[] = { -0x10,0x10,0x10,0x10,0x10,0x10,0x28,0x44,0x82,0x82, -}; - -static const BitmapCharRec ch89 = {7,10,-1,0,9,ch89data}; - -/* char: 0x58 'X' */ - -static const GLubyte ch88data[] = { -0x82,0x82,0x44,0x28,0x10,0x10,0x28,0x44,0x82,0x82, -}; - -static const BitmapCharRec ch88 = {7,10,-1,0,9,ch88data}; - -/* char: 0x57 'W' */ - -static const GLubyte ch87data[] = { -0x44,0xaa,0x92,0x92,0x92,0x92,0x82,0x82,0x82,0x82, -}; - -static const BitmapCharRec ch87 = {7,10,-1,0,9,ch87data}; - -/* char: 0x56 'V' */ - -static const GLubyte ch86data[] = { -0x10,0x28,0x28,0x28,0x44,0x44,0x44,0x82,0x82,0x82, -}; - -static const BitmapCharRec ch86 = {7,10,-1,0,9,ch86data}; - -/* char: 0x55 'U' */ - -static const GLubyte ch85data[] = { -0x7c,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82, -}; - -static const BitmapCharRec ch85 = {7,10,-1,0,9,ch85data}; - -/* char: 0x54 'T' */ - -static const GLubyte ch84data[] = { -0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0xfe, -}; - -static const BitmapCharRec ch84 = {7,10,-1,0,9,ch84data}; - -/* char: 0x53 'S' */ - -static const GLubyte ch83data[] = { -0x7c,0x82,0x82,0x2,0xc,0x70,0x80,0x82,0x82,0x7c, -}; - -static const BitmapCharRec ch83 = {7,10,-1,0,9,ch83data}; - -/* char: 0x52 'R' */ - -static const GLubyte ch82data[] = { -0x82,0x82,0x84,0x88,0x90,0xfc,0x82,0x82,0x82,0xfc, -}; - -static const BitmapCharRec ch82 = {7,10,-1,0,9,ch82data}; - -/* char: 0x51 'Q' */ - -static const GLubyte ch81data[] = { -0x6,0x8,0x7c,0x92,0xa2,0x82,0x82,0x82,0x82,0x82,0x82,0x7c, -}; - -static const BitmapCharRec ch81 = {7,12,-1,2,9,ch81data}; - -/* char: 0x50 'P' */ - -static const GLubyte ch80data[] = { -0x80,0x80,0x80,0x80,0x80,0xfc,0x82,0x82,0x82,0xfc, -}; - -static const BitmapCharRec ch80 = {7,10,-1,0,9,ch80data}; - -/* char: 0x4f 'O' */ - -static const GLubyte ch79data[] = { -0x7c,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x7c, -}; - -static const BitmapCharRec ch79 = {7,10,-1,0,9,ch79data}; - -/* char: 0x4e 'N' */ - -static const GLubyte ch78data[] = { -0x82,0x82,0x82,0x86,0x8a,0x92,0xa2,0xc2,0x82,0x82, -}; - -static const BitmapCharRec ch78 = {7,10,-1,0,9,ch78data}; - -/* char: 0x4d 'M' */ - -static const GLubyte ch77data[] = { -0x82,0x82,0x82,0x92,0x92,0xaa,0xaa,0xc6,0x82,0x82, -}; - -static const BitmapCharRec ch77 = {7,10,-1,0,9,ch77data}; - -/* char: 0x4c 'L' */ - -static const GLubyte ch76data[] = { -0xfe,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80, -}; - -static const BitmapCharRec ch76 = {7,10,-1,0,9,ch76data}; - -/* char: 0x4b 'K' */ - -static const GLubyte ch75data[] = { -0x82,0x84,0x88,0x90,0xa0,0xe0,0x90,0x88,0x84,0x82, -}; - -static const BitmapCharRec ch75 = {7,10,-1,0,9,ch75data}; - -/* char: 0x4a 'J' */ - -static const GLubyte ch74data[] = { -0x78,0x84,0x4,0x4,0x4,0x4,0x4,0x4,0x4,0x1e, -}; - -static const BitmapCharRec ch74 = {7,10,-1,0,9,ch74data}; - -/* char: 0x49 'I' */ - -static const GLubyte ch73data[] = { -0xf8,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0xf8, -}; - -static const BitmapCharRec ch73 = {5,10,-2,0,9,ch73data}; - -/* char: 0x48 'H' */ - -static const GLubyte ch72data[] = { -0x82,0x82,0x82,0x82,0x82,0xfe,0x82,0x82,0x82,0x82, -}; - -static const BitmapCharRec ch72 = {7,10,-1,0,9,ch72data}; - -/* char: 0x47 'G' */ - -static const GLubyte ch71data[] = { -0x7c,0x82,0x82,0x82,0x8e,0x80,0x80,0x80,0x82,0x7c, -}; - -static const BitmapCharRec ch71 = {7,10,-1,0,9,ch71data}; - -/* char: 0x46 'F' */ - -static const GLubyte ch70data[] = { -0x40,0x40,0x40,0x40,0x40,0x78,0x40,0x40,0x40,0xfe, -}; - -static const BitmapCharRec ch70 = {7,10,-1,0,9,ch70data}; - -/* char: 0x45 'E' */ - -static const GLubyte ch69data[] = { -0xfe,0x40,0x40,0x40,0x40,0x78,0x40,0x40,0x40,0xfe, -}; - -static const BitmapCharRec ch69 = {7,10,-1,0,9,ch69data}; - -/* char: 0x44 'D' */ - -static const GLubyte ch68data[] = { -0xfc,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0xfc, -}; - -static const BitmapCharRec ch68 = {7,10,-1,0,9,ch68data}; - -/* char: 0x43 'C' */ - -static const GLubyte ch67data[] = { -0x7c,0x82,0x80,0x80,0x80,0x80,0x80,0x80,0x82,0x7c, -}; - -static const BitmapCharRec ch67 = {7,10,-1,0,9,ch67data}; - -/* char: 0x42 'B' */ - -static const GLubyte ch66data[] = { -0xfc,0x42,0x42,0x42,0x42,0x7c,0x42,0x42,0x42,0xfc, -}; - -static const BitmapCharRec ch66 = {7,10,-1,0,9,ch66data}; - -/* char: 0x41 'A' */ - -static const GLubyte ch65data[] = { -0x82,0x82,0x82,0xfe,0x82,0x82,0x82,0x44,0x28,0x10, -}; - -static const BitmapCharRec ch65 = {7,10,-1,0,9,ch65data}; - -/* char: 0x40 '@' */ - -static const GLubyte ch64data[] = { -0x7c,0x80,0x80,0x9a,0xa6,0xa2,0x9e,0x82,0x82,0x7c, -}; - -static const BitmapCharRec ch64 = {7,10,-1,0,9,ch64data}; - -/* char: 0x3f '?' */ - -static const GLubyte ch63data[] = { -0x10,0x0,0x10,0x10,0x8,0x4,0x2,0x82,0x82,0x7c, -}; - -static const BitmapCharRec ch63 = {7,10,-1,0,9,ch63data}; - -/* char: 0x3e '>' */ - -static const GLubyte ch62data[] = { -0x80,0x40,0x20,0x10,0x8,0x8,0x10,0x20,0x40,0x80, -}; - -static const BitmapCharRec ch62 = {5,10,-2,0,9,ch62data}; - -/* char: 0x3d '=' */ - -static const GLubyte ch61data[] = { -0xfe,0x0,0x0,0xfe, -}; - -static const BitmapCharRec ch61 = {7,4,-1,-2,9,ch61data}; - -/* char: 0x3c '<' */ - -static const GLubyte ch60data[] = { -0x8,0x10,0x20,0x40,0x80,0x80,0x40,0x20,0x10,0x8, -}; - -static const BitmapCharRec ch60 = {5,10,-2,0,9,ch60data}; - -/* char: 0x3b ';' */ - -static const GLubyte ch59data[] = { -0x80,0x40,0x40,0xc0,0xc0,0x0,0x0,0x0,0xc0,0xc0, -}; - -static const BitmapCharRec ch59 = {2,10,-4,3,9,ch59data}; - -/* char: 0x3a ':' */ - -static const GLubyte ch58data[] = { -0xc0,0xc0,0x0,0x0,0x0,0xc0,0xc0, -}; - -static const BitmapCharRec ch58 = {2,7,-4,0,9,ch58data}; - -/* char: 0x39 '9' */ - -static const GLubyte ch57data[] = { -0x78,0x4,0x2,0x2,0x7a,0x86,0x82,0x82,0x82,0x7c, -}; - -static const BitmapCharRec ch57 = {7,10,-1,0,9,ch57data}; - -/* char: 0x38 '8' */ - -static const GLubyte ch56data[] = { -0x38,0x44,0x82,0x82,0x44,0x38,0x44,0x82,0x44,0x38, -}; - -static const BitmapCharRec ch56 = {7,10,-1,0,9,ch56data}; - -/* char: 0x37 '7' */ - -static const GLubyte ch55data[] = { -0x40,0x40,0x20,0x20,0x10,0x8,0x4,0x2,0x2,0xfe, -}; - -static const BitmapCharRec ch55 = {7,10,-1,0,9,ch55data}; - -/* char: 0x36 '6' */ - -static const GLubyte ch54data[] = { -0x7c,0x82,0x82,0x82,0xc2,0xbc,0x80,0x80,0x40,0x3c, -}; - -static const BitmapCharRec ch54 = {7,10,-1,0,9,ch54data}; - -/* char: 0x35 '5' */ - -static const GLubyte ch53data[] = { -0x7c,0x82,0x2,0x2,0x2,0xc2,0xbc,0x80,0x80,0xfe, -}; - -static const BitmapCharRec ch53 = {7,10,-1,0,9,ch53data}; - -/* char: 0x34 '4' */ - -static const GLubyte ch52data[] = { -0x4,0x4,0x4,0xfe,0x84,0x44,0x24,0x14,0xc,0x4, -}; - -static const BitmapCharRec ch52 = {7,10,-1,0,9,ch52data}; - -/* char: 0x33 '3' */ - -static const GLubyte ch51data[] = { -0x7c,0x82,0x2,0x2,0x2,0x1c,0x8,0x4,0x2,0xfe, -}; - -static const BitmapCharRec ch51 = {7,10,-1,0,9,ch51data}; - -/* char: 0x32 '2' */ - -static const GLubyte ch50data[] = { -0xfe,0x80,0x40,0x30,0x8,0x4,0x2,0x82,0x82,0x7c, -}; - -static const BitmapCharRec ch50 = {7,10,-1,0,9,ch50data}; - -/* char: 0x31 '1' */ - -static const GLubyte ch49data[] = { -0xfe,0x10,0x10,0x10,0x10,0x10,0x90,0x50,0x30,0x10, -}; - -static const BitmapCharRec ch49 = {7,10,-1,0,9,ch49data}; - -/* char: 0x30 '0' */ - -static const GLubyte ch48data[] = { -0x38,0x44,0x82,0x82,0x82,0x82,0x82,0x82,0x44,0x38, -}; - -static const BitmapCharRec ch48 = {7,10,-1,0,9,ch48data}; - -/* char: 0x2f '/' */ - -static const GLubyte ch47data[] = { -0x80,0x40,0x40,0x20,0x10,0x10,0x8,0x4,0x4,0x2, -}; - -static const BitmapCharRec ch47 = {7,10,-1,0,9,ch47data}; - -/* char: 0x2e '.' */ - -static const GLubyte ch46data[] = { -0xc0,0xc0, -}; - -static const BitmapCharRec ch46 = {2,2,-4,0,9,ch46data}; - -/* char: 0x2d '-' */ - -static const GLubyte ch45data[] = { -0xfe, -}; - -static const BitmapCharRec ch45 = {7,1,-1,-4,9,ch45data}; - -/* char: 0x2c ',' */ - -static const GLubyte ch44data[] = { -0x80,0x40,0x40,0xc0,0xc0, -}; - -static const BitmapCharRec ch44 = {2,5,-4,3,9,ch44data}; - -/* char: 0x2b '+' */ - -static const GLubyte ch43data[] = { -0x10,0x10,0x10,0xfe,0x10,0x10,0x10, -}; - -static const BitmapCharRec ch43 = {7,7,-1,-1,9,ch43data}; - -/* char: 0x2a '*' */ - -static const GLubyte ch42data[] = { -0x10,0x92,0x54,0x38,0x54,0x92,0x10, -}; - -static const BitmapCharRec ch42 = {7,7,-1,-1,9,ch42data}; - -/* char: 0x29 ')' */ - -static const GLubyte ch41data[] = { -0x80,0x40,0x40,0x20,0x20,0x20,0x20,0x20,0x20,0x40,0x40,0x80, -}; - -static const BitmapCharRec ch41 = {3,12,-3,1,9,ch41data}; - -/* char: 0x28 '(' */ - -static const GLubyte ch40data[] = { -0x20,0x40,0x40,0x80,0x80,0x80,0x80,0x80,0x80,0x40,0x40,0x20, -}; - -static const BitmapCharRec ch40 = {3,12,-3,1,9,ch40data}; - -/* char: 0x27 ''' */ - -static const GLubyte ch39data[] = { -0x80,0x40,0x20,0x30, -}; - -static const BitmapCharRec ch39 = {4,4,-3,-6,9,ch39data}; - -/* char: 0x26 '&' */ - -static const GLubyte ch38data[] = { -0x62,0x94,0x88,0x94,0x62,0x60,0x90,0x90,0x90,0x60, -}; - -static const BitmapCharRec ch38 = {7,10,-1,0,9,ch38data}; - -/* char: 0x25 '%' */ - -static const GLubyte ch37data[] = { -0x84,0x4a,0x4a,0x24,0x10,0x10,0x48,0xa4,0xa4,0x42, -}; - -static const BitmapCharRec ch37 = {7,10,-1,0,9,ch37data}; - -/* char: 0x24 '$' */ - -static const GLubyte ch36data[] = { -0x10,0x7c,0x92,0x12,0x12,0x14,0x38,0x50,0x90,0x92,0x7c,0x10, -}; - -static const BitmapCharRec ch36 = {7,12,-1,1,9,ch36data}; - -/* char: 0x23 '#' */ - -static const GLubyte ch35data[] = { -0x48,0x48,0xfc,0x48,0x48,0xfc,0x48,0x48, -}; - -static const BitmapCharRec ch35 = {6,8,-1,-1,9,ch35data}; - -/* char: 0x22 '"' */ - -static const GLubyte ch34data[] = { -0x90,0x90,0x90, -}; - -static const BitmapCharRec ch34 = {4,3,-3,-7,9,ch34data}; - -/* char: 0x21 '!' */ - -static const GLubyte ch33data[] = { -0x80,0x80,0x0,0x0,0x80,0x80,0x80,0x80,0x80,0x80,0x80, -}; - -static const BitmapCharRec ch33 = {1,11,-4,0,9,ch33data}; - -/* char: 0x1f */ - -static const GLubyte ch31data[] = { -0xc0,0xc0, -}; - -static const BitmapCharRec ch31 = {2,2,-4,-2,9,ch31data}; - -/* char: 0x1e */ - -static const GLubyte ch30data[] = { -0x5c,0xa2,0x60,0x20,0x20,0xf8,0x20,0x20,0x22,0x1c, -}; - -static const BitmapCharRec ch30 = {7,10,-1,0,9,ch30data}; - -/* char: 0x1d */ - -static const GLubyte ch29data[] = { -0x80,0x40,0xfe,0x10,0xfe,0x4,0x2, -}; - -static const BitmapCharRec ch29 = {7,7,-1,0,9,ch29data}; - -/* char: 0x1c */ - -static const GLubyte ch28data[] = { -0x44,0x24,0x24,0x24,0x24,0x24,0xfe, -}; - -static const BitmapCharRec ch28 = {7,7,-1,0,9,ch28data}; - -/* char: 0x1b */ - -static const GLubyte ch27data[] = { -0xfe,0x0,0x80,0x40,0x20,0x10,0x8,0x8,0x10,0x20,0x40,0x80, -}; - -static const BitmapCharRec ch27 = {7,12,-1,2,9,ch27data}; - -/* char: 0x1a */ - -static const GLubyte ch26data[] = { -0xfc,0x0,0x4,0x8,0x10,0x20,0x40,0x40,0x20,0x10,0x8,0x4, -}; - -static const BitmapCharRec ch26 = {6,12,-2,2,9,ch26data}; - -/* char: 0x19 */ - -static const GLubyte ch25data[] = { -0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80, -}; - -static const BitmapCharRec ch25 = {1,15,-4,3,9,ch25data}; - -/* char: 0x18 */ - -static const GLubyte ch24data[] = { -0x8,0x0,0x8,0x0,0x8,0x0,0x8,0x0,0x8,0x0,0x8,0x0,0xff,0x80, -}; - -static const BitmapCharRec ch24 = {9,7,0,3,9,ch24data}; - -/* char: 0x17 */ - -static const GLubyte ch23data[] = { -0xff,0x80,0x8,0x0,0x8,0x0,0x8,0x0,0x8,0x0,0x8,0x0,0x8,0x0,0x8,0x0, -0x8,0x0, -}; - -static const BitmapCharRec ch23 = {9,9,0,-3,9,ch23data}; - -/* char: 0x16 */ - -static const GLubyte ch22data[] = { -0x8,0x8,0x8,0x8,0x8,0x8,0xf8,0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8, -}; - -static const BitmapCharRec ch22 = {5,15,0,3,9,ch22data}; - -/* char: 0x15 */ - -static const GLubyte ch21data[] = { -0x80,0x80,0x80,0x80,0x80,0x80,0xf8,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80, -}; - -static const BitmapCharRec ch21 = {5,15,-4,3,9,ch21data}; - -/* char: 0x14 */ - -static const GLubyte ch20data[] = { -0xff,0x80, -}; - -static const BitmapCharRec ch20 = {9,1,0,1,9,ch20data}; - -/* char: 0x13 */ - -static const GLubyte ch19data[] = { -0xff,0x80, -}; - -static const BitmapCharRec ch19 = {9,1,0,-1,9,ch19data}; - -/* char: 0x12 */ - -static const GLubyte ch18data[] = { -0xff,0x80, -}; - -static const BitmapCharRec ch18 = {9,1,0,-3,9,ch18data}; - -/* char: 0x11 */ - -static const GLubyte ch17data[] = { -0xff,0x80, -}; - -static const BitmapCharRec ch17 = {9,1,0,-5,9,ch17data}; - -/* char: 0x10 */ - -static const GLubyte ch16data[] = { -0xff,0x80, -}; - -static const BitmapCharRec ch16 = {9,1,0,-7,9,ch16data}; - -/* char: 0xf */ - -static const GLubyte ch15data[] = { -0x8,0x0,0x8,0x0,0x8,0x0,0x8,0x0,0x8,0x0,0x8,0x0,0xff,0x80,0x8,0x0, -0x8,0x0,0x8,0x0,0x8,0x0,0x8,0x0,0x8,0x0,0x8,0x0,0x8,0x0, -}; - -static const BitmapCharRec ch15 = {9,15,0,3,9,ch15data}; - -/* char: 0xe */ - -static const GLubyte ch14data[] = { -0xf8,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80, -}; - -static const BitmapCharRec ch14 = {5,9,-4,-3,9,ch14data}; - -/* char: 0xd */ - -static const GLubyte ch13data[] = { -0x80,0x80,0x80,0x80,0x80,0x80,0xf8, -}; - -static const BitmapCharRec ch13 = {5,7,-4,3,9,ch13data}; - -/* char: 0xc */ - -static const GLubyte ch12data[] = { -0x8,0x8,0x8,0x8,0x8,0x8,0xf8, -}; - -static const BitmapCharRec ch12 = {5,7,0,3,9,ch12data}; - -/* char: 0xb */ - -static const GLubyte ch11data[] = { -0xf8,0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8, -}; - -static const BitmapCharRec ch11 = {5,9,0,-3,9,ch11data}; - -/* char: 0xa */ - -static const GLubyte ch10data[] = { -0x8,0x8,0x8,0x8,0x3e,0x0,0x20,0x50,0x88,0x88, -}; - -static const BitmapCharRec ch10 = {7,10,-1,2,9,ch10data}; - -/* char: 0x9 */ - -static const GLubyte ch9data[] = { -0x3e,0x20,0x20,0x20,0x20,0x88,0x98,0xa8,0xc8,0x88, -}; - -static const BitmapCharRec ch9 = {7,10,-1,2,9,ch9data}; - -/* char: 0x8 */ - -static const GLubyte ch8data[] = { -0xfe,0x10,0x10,0xfe,0x10,0x10, -}; - -static const BitmapCharRec ch8 = {7,6,-1,0,9,ch8data}; - -/* char: 0x7 */ - -static const GLubyte ch7data[] = { -0x70,0x88,0x88,0x70, -}; - -static const BitmapCharRec ch7 = {5,4,-2,-6,9,ch7data}; - -/* char: 0x6 */ - -static const GLubyte ch6data[] = { -0x20,0x20,0x3c,0x20,0x3e,0x0,0xf8,0x80,0x80,0x80, -}; - -static const BitmapCharRec ch6 = {7,10,-1,2,9,ch6data}; - -/* char: 0x5 */ - -static const GLubyte ch5data[] = { -0x22,0x22,0x3c,0x22,0x3c,0x0,0x78,0x80,0x80,0x78, -}; - -static const BitmapCharRec ch5 = {7,10,-1,2,9,ch5data}; - -/* char: 0x4 */ - -static const GLubyte ch4data[] = { -0x10,0x10,0x1c,0x10,0x1e,0x80,0x80,0xe0,0x80,0xf0, -}; - -static const BitmapCharRec ch4 = {7,10,-1,2,9,ch4data}; - -/* char: 0x3 */ - -static const GLubyte ch3data[] = { -0x8,0x8,0x8,0x3e,0x0,0x88,0x88,0xf8,0x88,0x88, -}; - -static const BitmapCharRec ch3 = {7,10,-1,2,9,ch3data}; - -/* char: 0x2 */ - -static const GLubyte ch2data[] = { -0x55,0xaa,0x55,0xaa,0x55,0xaa,0x55,0xaa,0x55,0xaa,0x55,0xaa,0x55,0xaa, -}; - -static const BitmapCharRec ch2 = {8,14,0,3,9,ch2data}; - -/* char: 0x1 */ - -static const GLubyte ch1data[] = { -0x10,0x38,0x7c,0xfe,0x7c,0x38,0x10, -}; - -static const BitmapCharRec ch1 = {7,7,-1,0,9,ch1data}; - -static const BitmapCharRec * const chars[] = { -&ch0, -&ch1, -&ch2, -&ch3, -&ch4, -&ch5, -&ch6, -&ch7, -&ch8, -&ch9, -&ch10, -&ch11, -&ch12, -&ch13, -&ch14, -&ch15, -&ch16, -&ch17, -&ch18, -&ch19, -&ch20, -&ch21, -&ch22, -&ch23, -&ch24, -&ch25, -&ch26, -&ch27, -&ch28, -&ch29, -&ch30, -&ch31, -&ch32, -&ch33, -&ch34, -&ch35, -&ch36, -&ch37, -&ch38, -&ch39, -&ch40, -&ch41, -&ch42, -&ch43, -&ch44, -&ch45, -&ch46, -&ch47, -&ch48, -&ch49, -&ch50, -&ch51, -&ch52, -&ch53, -&ch54, -&ch55, -&ch56, -&ch57, -&ch58, -&ch59, -&ch60, -&ch61, -&ch62, -&ch63, -&ch64, -&ch65, -&ch66, -&ch67, -&ch68, -&ch69, -&ch70, -&ch71, -&ch72, -&ch73, -&ch74, -&ch75, -&ch76, -&ch77, -&ch78, -&ch79, -&ch80, -&ch81, -&ch82, -&ch83, -&ch84, -&ch85, -&ch86, -&ch87, -&ch88, -&ch89, -&ch90, -&ch91, -&ch92, -&ch93, -&ch94, -&ch95, -&ch96, -&ch97, -&ch98, -&ch99, -&ch100, -&ch101, -&ch102, -&ch103, -&ch104, -&ch105, -&ch106, -&ch107, -&ch108, -&ch109, -&ch110, -&ch111, -&ch112, -&ch113, -&ch114, -&ch115, -&ch116, -&ch117, -&ch118, -&ch119, -&ch120, -&ch121, -&ch122, -&ch123, -&ch124, -&ch125, -&ch126, -&ch127, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -&ch160, -&ch161, -&ch162, -&ch163, -&ch164, -&ch165, -&ch166, -&ch167, -&ch168, -&ch169, -&ch170, -&ch171, -&ch172, -&ch173, -&ch174, -&ch175, -&ch176, -&ch177, -&ch178, -&ch179, -&ch180, -&ch181, -&ch182, -&ch183, -&ch184, -&ch185, -&ch186, -&ch187, -&ch188, -&ch189, -&ch190, -&ch191, -&ch192, -&ch193, -&ch194, -&ch195, -&ch196, -&ch197, -&ch198, -&ch199, -&ch200, -&ch201, -&ch202, -&ch203, -&ch204, -&ch205, -&ch206, -&ch207, -&ch208, -&ch209, -&ch210, -&ch211, -&ch212, -&ch213, -&ch214, -&ch215, -&ch216, -&ch217, -&ch218, -&ch219, -&ch220, -&ch221, -&ch222, -&ch223, -&ch224, -&ch225, -&ch226, -&ch227, -&ch228, -&ch229, -&ch230, -&ch231, -&ch232, -&ch233, -&ch234, -&ch235, -&ch236, -&ch237, -&ch238, -&ch239, -&ch240, -&ch241, -&ch242, -&ch243, -&ch244, -&ch245, -&ch246, -&ch247, -&ch248, -&ch249, -&ch250, -&ch251, -&ch252, -&ch253, -&ch254, -&ch255, -}; -#if !defined(__IBMCPP__) -const -#endif - BitmapFontRec glutBitmap9By15 = { -"-misc-fixed-medium-r-normal--15-140-75-75-C-90-iso8859-1", -256, -0, -chars -}; - diff --git a/src/glut/os2/glut_bitmap.cpp b/src/glut/os2/glut_bitmap.cpp deleted file mode 100644 index 40530b69c1..0000000000 --- a/src/glut/os2/glut_bitmap.cpp +++ /dev/null @@ -1,57 +0,0 @@ - -/* Copyright (c) Mark J. Kilgard, 1994. */ - -/* This program is freely distributable without licensing fees - and is provided without guarantee or warrantee expressed or - implied. This program is -not- in the public domain. */ - -#include "glutint.h" -#include "glutbitmap.h" - -void GLUTAPIENTRY -glutBitmapCharacter(GLUTbitmapFont font, int c) -{ - const BitmapCharRec *ch; - BitmapFontPtr fontinfo; - GLint swapbytes, lsbfirst, rowlength; - GLint skiprows, skippixels, alignment; - -#if defined(_WIN32) - fontinfo = (BitmapFontPtr) __glutFont(font); -#else - fontinfo = (BitmapFontPtr) font; -#endif - - if (c < fontinfo->first || - c >= fontinfo->first + fontinfo->num_chars) - return; - ch = fontinfo->ch[c - fontinfo->first]; - if (ch) { - /* Save current modes. */ - glGetIntegerv(GL_UNPACK_SWAP_BYTES, &swapbytes); - glGetIntegerv(GL_UNPACK_LSB_FIRST, &lsbfirst); - glGetIntegerv(GL_UNPACK_ROW_LENGTH, &rowlength); - glGetIntegerv(GL_UNPACK_SKIP_ROWS, &skiprows); - glGetIntegerv(GL_UNPACK_SKIP_PIXELS, &skippixels); - glGetIntegerv(GL_UNPACK_ALIGNMENT, &alignment); - /* Little endian machines (DEC Alpha for example) could - benefit from setting GL_UNPACK_LSB_FIRST to GL_TRUE - instead of GL_FALSE, but this would require changing the - generated bitmaps too. */ - glPixelStorei(GL_UNPACK_SWAP_BYTES, GL_FALSE); - glPixelStorei(GL_UNPACK_LSB_FIRST, GL_FALSE); - glPixelStorei(GL_UNPACK_ROW_LENGTH, 0); - glPixelStorei(GL_UNPACK_SKIP_ROWS, 0); - glPixelStorei(GL_UNPACK_SKIP_PIXELS, 0); - glPixelStorei(GL_UNPACK_ALIGNMENT, 1); - glBitmap(ch->width, ch->height, ch->xorig, ch->yorig, - ch->advance, 0, ch->bitmap); - /* Restore saved modes. */ - glPixelStorei(GL_UNPACK_SWAP_BYTES, swapbytes); - glPixelStorei(GL_UNPACK_LSB_FIRST, lsbfirst); - glPixelStorei(GL_UNPACK_ROW_LENGTH, rowlength); - glPixelStorei(GL_UNPACK_SKIP_ROWS, skiprows); - glPixelStorei(GL_UNPACK_SKIP_PIXELS, skippixels); - glPixelStorei(GL_UNPACK_ALIGNMENT, alignment); - } -} diff --git a/src/glut/os2/glut_cindex.cpp b/src/glut/os2/glut_cindex.cpp deleted file mode 100644 index fa6d2f12d6..0000000000 --- a/src/glut/os2/glut_cindex.cpp +++ /dev/null @@ -1,258 +0,0 @@ - -/* Copyright (c) Mark J. Kilgard, 1994, 1996, 1997. */ - -/* This program is freely distributable without licensing fees - and is provided without guarantee or warrantee expressed or - implied. This program is -not- in the public domain. */ - -#include -#include "glutint.h" - -#if defined(__OS2PM__) - #define IsWindowVisible WinIsWindowVisible -#endif - -#define CLAMP(i) ((i) > 1.0 ? 1.0 : ((i) < 0.0 ? 0.0 : (i))) - -/* CENTRY */ -void GLUTAPIENTRY -glutSetColor(int ndx, GLfloat red, GLfloat green, GLfloat blue) -{ - GLUTcolormap *cmap, *newcmap; - XVisualInfo *vis; - XColor color; - int i; - - if (__glutCurrentWindow->renderWin == __glutCurrentWindow->win) { - cmap = __glutCurrentWindow->colormap; - vis = __glutCurrentWindow->vis; - } else { - cmap = __glutCurrentWindow->overlay->colormap; - vis = __glutCurrentWindow->overlay->vis; - if (ndx == __glutCurrentWindow->overlay->transparentPixel) { - __glutWarning( - "glutSetColor: cannot set color of overlay transparent index %d\n", - ndx); - return; - } - } - - if (!cmap) { - __glutWarning("glutSetColor: current window is RGBA"); - return; - } -#if defined(_WIN32) || defined(__OS2PM__) - if (ndx >= 256 || /* always assume 256 colors on Win32 */ -#else - if (ndx >= vis->visual->map_entries || -#endif - ndx < 0) { - __glutWarning("glutSetColor: index %d out of range", ndx); - return; - } - if (cmap->refcnt > 1) { - newcmap = __glutAssociateNewColormap(vis); - cmap->refcnt--; - /* Wouldn't it be nice if XCopyColormapAndFree could be - told not to free the old colormap's entries! */ - for (i = cmap->size - 1; i >= 0; i--) { - if (i == ndx) { - /* We are going to set this cell shortly! */ - continue; - } - if (cmap->cells[i].component[GLUT_RED] >= 0.0) { - color.pixel = i; - newcmap->cells[i].component[GLUT_RED] = - cmap->cells[i].component[GLUT_RED]; - color.red = (GLfloat) 0xffff * - cmap->cells[i].component[GLUT_RED]; - newcmap->cells[i].component[GLUT_GREEN] = - cmap->cells[i].component[GLUT_GREEN]; - color.green = (GLfloat) 0xffff * - cmap->cells[i].component[GLUT_GREEN]; - newcmap->cells[i].component[GLUT_BLUE] = - cmap->cells[i].component[GLUT_BLUE]; - color.blue = (GLfloat) 0xffff * - cmap->cells[i].component[GLUT_BLUE]; - color.flags = DoRed | DoGreen | DoBlue; -#if defined(_WIN32) || defined(__OS2PM__) - if (IsWindowVisible(__glutCurrentWindow->win)) { - XHDC = __glutCurrentWindow->hdc; - } else { - XHDC = 0; - } -#endif - XStoreColor(__glutDisplay, newcmap->cmap, &color); - } else { - /* Leave unallocated entries unallocated. */ - } - } - cmap = newcmap; - if (__glutCurrentWindow->renderWin == __glutCurrentWindow->win) { - __glutCurrentWindow->colormap = cmap; - __glutCurrentWindow->cmap = cmap->cmap; - } else { - __glutCurrentWindow->overlay->colormap = cmap; - __glutCurrentWindow->overlay->cmap = cmap->cmap; - } - XSetWindowColormap(__glutDisplay, - __glutCurrentWindow->renderWin, cmap->cmap); - -#if !defined(_WIN32) && !defined(__OS2PM__) - { - GLUTwindow *toplevel; - - toplevel = __glutToplevelOf(__glutCurrentWindow); - if (toplevel->cmap != cmap->cmap) { - __glutPutOnWorkList(toplevel, GLUT_COLORMAP_WORK); - } - } -#endif - } - color.pixel = ndx; - red = CLAMP(red); - cmap->cells[ndx].component[GLUT_RED] = red; - color.red = (GLfloat) 0xffff *red; - green = CLAMP(green); - cmap->cells[ndx].component[GLUT_GREEN] = green; - color.green = (GLfloat) 0xffff *green; - blue = CLAMP(blue); - cmap->cells[ndx].component[GLUT_BLUE] = blue; - color.blue = (GLfloat) 0xffff *blue; - color.flags = DoRed | DoGreen | DoBlue; -#if defined(_WIN32) || defined(__OS2PM__) - if (IsWindowVisible(__glutCurrentWindow->win)) { - XHDC = __glutCurrentWindow->hdc; - } else { - XHDC = 0; - } -#endif - XStoreColor(__glutDisplay, cmap->cmap, &color); -} - -GLfloat GLUTAPIENTRY -glutGetColor(int ndx, int comp) -{ - GLUTcolormap *colormap; - XVisualInfo *vis; - - if (__glutCurrentWindow->renderWin == __glutCurrentWindow->win) { - colormap = __glutCurrentWindow->colormap; - vis = __glutCurrentWindow->vis; - } else { - colormap = __glutCurrentWindow->overlay->colormap; - vis = __glutCurrentWindow->overlay->vis; - if (ndx == __glutCurrentWindow->overlay->transparentPixel) { - __glutWarning("glutGetColor: requesting overlay transparent index %d\n", - ndx); - return -1.0; - } - } - - if (!colormap) { - __glutWarning("glutGetColor: current window is RGBA"); - return -1.0; - } -#if defined(_WIN32) || defined(__OS2PM__) -#define OUT_OF_RANGE_NDX(ndx) (ndx >= 256 || ndx < 0) -#else -#define OUT_OF_RANGE_NDX(ndx) (ndx >= vis->visual->map_entries || ndx < 0) -#endif - if (OUT_OF_RANGE_NDX(ndx)) { - __glutWarning("glutGetColor: index %d out of range", ndx); - return -1.0; - } - return colormap->cells[ndx].component[comp]; -} - -void GLUTAPIENTRY -glutCopyColormap(int winnum) -{ - GLUTwindow *window = __glutWindowList[winnum - 1]; - GLUTcolormap *oldcmap, *newcmap; - XVisualInfo *dstvis; - - if (__glutCurrentWindow->renderWin == __glutCurrentWindow->win) { - oldcmap = __glutCurrentWindow->colormap; - dstvis = __glutCurrentWindow->vis; - newcmap = window->colormap; - } else { - oldcmap = __glutCurrentWindow->overlay->colormap; - dstvis = __glutCurrentWindow->overlay->vis; - if (!window->overlay) { - __glutWarning("glutCopyColormap: window %d has no overlay", winnum); - return; - } - newcmap = window->overlay->colormap; - } - - if (!oldcmap) { - __glutWarning("glutCopyColormap: destination colormap must be color index"); - return; - } - if (!newcmap) { - __glutWarning( - "glutCopyColormap: source colormap of window %d must be color index", - winnum); - return; - } - if (newcmap == oldcmap) { - /* Source and destination are the same; now copy needed. */ - return; - } -#if !defined(_WIN32) && !defined(__OS2PM__) - /* Play safe: compare visual IDs, not Visual*'s. */ - if (newcmap->visual->visualid == oldcmap->visual->visualid) { -#endif - /* Visuals match! "Copy" by reference... */ - __glutFreeColormap(oldcmap); - newcmap->refcnt++; - if (__glutCurrentWindow->renderWin == __glutCurrentWindow->win) { - __glutCurrentWindow->colormap = newcmap; - __glutCurrentWindow->cmap = newcmap->cmap; - } else { - __glutCurrentWindow->overlay->colormap = newcmap; - __glutCurrentWindow->overlay->cmap = newcmap->cmap; - } - XSetWindowColormap(__glutDisplay, __glutCurrentWindow->renderWin, - newcmap->cmap); -#if !defined(_WIN32) && !defined(__OS2PM__) - __glutPutOnWorkList(__glutToplevelOf(window), GLUT_COLORMAP_WORK); -bla bla bla - - } else { - GLUTcolormap *copycmap; - XColor color; - int i, last; - - /* Visuals different - need a distinct X colormap! */ - copycmap = __glutAssociateNewColormap(dstvis); - /* Wouldn't it be nice if XCopyColormapAndFree could be - told not to free the old colormap's entries! */ - last = newcmap->size; - if (last > copycmap->size) { - last = copycmap->size; - } - for (i = last - 1; i >= 0; i--) { - if (newcmap->cells[i].component[GLUT_RED] >= 0.0) { - color.pixel = i; - copycmap->cells[i].component[GLUT_RED] = - newcmap->cells[i].component[GLUT_RED]; - color.red = (GLfloat) 0xffff * - newcmap->cells[i].component[GLUT_RED]; - copycmap->cells[i].component[GLUT_GREEN] = - newcmap->cells[i].component[GLUT_GREEN]; - color.green = (GLfloat) 0xffff * - newcmap->cells[i].component[GLUT_GREEN]; - copycmap->cells[i].component[GLUT_BLUE] = - newcmap->cells[i].component[GLUT_BLUE]; - color.blue = (GLfloat) 0xffff * - newcmap->cells[i].component[GLUT_BLUE]; - color.flags = DoRed | DoGreen | DoBlue; - XStoreColor(__glutDisplay, copycmap->cmap, &color); - } - } - } -#endif -} -/* ENDCENTRY */ diff --git a/src/glut/os2/glut_cmap.cpp b/src/glut/os2/glut_cmap.cpp deleted file mode 100644 index afe44f0aca..0000000000 --- a/src/glut/os2/glut_cmap.cpp +++ /dev/null @@ -1,399 +0,0 @@ - -/* Copyright (c) Mark J. Kilgard, 1994, 1996, 1997. */ - -/* This program is freely distributable without licensing fees - and is provided without guarantee or warrantee expressed or - implied. This program is -not- in the public domain. */ - -#ifdef __VMS -//EK#include -#endif - -#include -#include -#include /* SunOS multithreaded assert() needs . Lame. */ -#include -#if !defined(_WIN32) && !defined(__OS2__) - #include - #include - #include /* for XA_RGB_DEFAULT_MAP atom */ - #if defined(__vms) - #include /* for XmuLookupStandardColormap */ - #else - #include /* for XmuLookupStandardColormap */ - #endif -#endif - -/* SGI optimization introduced in IRIX 6.3 to avoid X server - round trips for interning common X atoms. */ -#if defined(_SGI_EXTRA_PREDEFINES) && !defined(NO_FAST_ATOMS) -#include -#else -#define XSGIFastInternAtom(dpy,string,fast_name,how) XInternAtom(dpy,string,how) -#endif - -#include "glutint.h" -#include "layerutil.h" - -GLUTcolormap *__glutColormapList = NULL; - -GLUTcolormap * -__glutAssociateNewColormap(XVisualInfo * vis) -{ - GLUTcolormap *cmap; - int transparentPixel, i; - unsigned long pixels[255]; - - cmap = (GLUTcolormap *) malloc(sizeof(GLUTcolormap)); - if (!cmap) - __glutFatalError("out of memory."); -#if defined(_WIN32) || defined(__OS2__) - pixels[0] = 0; /* avoid compilation warnings on win32 */ - cmap->visual = 0; - cmap->size = 256; /* always assume 256 on Win32 */ -#else - cmap->visual = vis->visual; - cmap->size = vis->visual->map_entries; -#endif - cmap->refcnt = 1; - cmap->cells = (GLUTcolorcell *) - malloc(sizeof(GLUTcolorcell) * cmap->size); - if (!cmap->cells) - __glutFatalError("out of memory."); - /* make all color cell entries be invalid */ - for (i = cmap->size - 1; i >= 0; i--) { - cmap->cells[i].component[GLUT_RED] = -1.0; - cmap->cells[i].component[GLUT_GREEN] = -1.0; - cmap->cells[i].component[GLUT_BLUE] = -1.0; - } - transparentPixel = __glutGetTransparentPixel(__glutDisplay, vis); - if (transparentPixel == -1 || transparentPixel >= cmap->size) { - - /* If there is no transparent pixel or if the transparent - pixel is outside the range of valid colormap cells (HP - can implement their overlays this smart way since their - transparent pixel is 255), we can AllocAll the colormap. - See note below. */ - - cmap->cmap = XCreateColormap(__glutDisplay, - __glutRoot, cmap->visual, AllocAll); - } else { - - /* On machines where zero (or some other value in the range - of 0 through map_entries-1), BadAlloc may be generated - when an AllocAll overlay colormap is allocated since the - transparent pixel precludes all the cells in the colormap - being allocated (the transparent pixel is pre-allocated). - So in this case, use XAllocColorCells to allocate - map_entries-1 pixels (that is, all but the transparent - pixel. */ - -#if defined(_WIN32) || defined(__OS2__) - cmap->cmap = XCreateColormap(__glutDisplay, - __glutRoot, 0, AllocNone); -#else - cmap->cmap = XCreateColormap(__glutDisplay, - __glutRoot, vis->visual, AllocNone); - XAllocColorCells(__glutDisplay, cmap->cmap, False, 0, 0, - pixels, cmap->size - 1); -#endif - } - cmap->next = __glutColormapList; - __glutColormapList = cmap; - return cmap; -} - -static GLUTcolormap * -associateColormap(XVisualInfo * vis) -{ -#if !defined(_WIN32) && !defined(__OS2__) - GLUTcolormap *cmap = __glutColormapList; - - while (cmap != NULL) { - /* Play safe: compare visual IDs, not Visual*'s. */ - if (cmap->visual->visualid == vis->visual->visualid) { - /* Already have created colormap for the visual. */ - cmap->refcnt++; - return cmap; - } - cmap = cmap->next; - } -#endif - return __glutAssociateNewColormap(vis); -} - -void -__glutSetupColormap(XVisualInfo * vi, GLUTcolormap ** colormap, Colormap * cmap) -{ -#if defined(_WIN32) || defined(__OS2__) - if (vi->dwFlags & PFD_NEED_PALETTE || vi->iPixelType == PFD_TYPE_COLORINDEX) { - *colormap = associateColormap(vi); - *cmap = (*colormap)->cmap; - } else { - *colormap = NULL; - *cmap = 0; - } -#else - Status status; - XStandardColormap *standardCmaps; - int i, numCmaps; - static Atom hpColorRecoveryAtom = -1; - int isRGB, visualClass, rc; - -#if defined(__cplusplus) || defined(c_plusplus) - visualClass = vi->c_class; -#else - visualClass = vi->class; -#endif - switch (visualClass) { - case PseudoColor: - /* Mesa might return a PseudoColor visual for RGB mode. */ - rc = glXGetConfig(__glutDisplay, vi, GLX_RGBA, &isRGB); - if (rc == 0 && isRGB) { - /* Must be Mesa. */ - *colormap = NULL; - if (MaxCmapsOfScreen(DefaultScreenOfDisplay(__glutDisplay)) == 1 - && vi->visual == DefaultVisual(__glutDisplay, __glutScreen)) { - char *privateCmap = getenv("MESA_PRIVATE_CMAP"); - - if (privateCmap) { - /* User doesn't want to share colormaps. */ - *cmap = XCreateColormap(__glutDisplay, __glutRoot, - vi->visual, AllocNone); - } else { - /* Share the root colormap. */ - *cmap = DefaultColormap(__glutDisplay, __glutScreen); - } - } else { - /* Get our own PseudoColor colormap. */ - *cmap = XCreateColormap(__glutDisplay, __glutRoot, - vi->visual, AllocNone); - } - } else { - /* CI mode, real GLX never returns a PseudoColor visual - for RGB mode. */ - *colormap = associateColormap(vi); - *cmap = (*colormap)->cmap; - } - break; - case TrueColor: - case DirectColor: - *colormap = NULL; /* NULL if RGBA */ - - /* Hewlett-Packard supports a feature called "HP Color - Recovery". Mesa has code to use HP Color Recovery. For - Mesa to use this feature, the atom - _HP_RGB_SMOOTH_MAP_LIST must be defined on the root - window AND the colormap obtainable by XGetRGBColormaps - for that atom must be set on the window. If that - colormap is not set, the output will look stripy. */ - - if (hpColorRecoveryAtom == -1) { - char *xvendor; - -#define VENDOR_HP "Hewlett-Packard" - - /* Only makes sense to make XInternAtom round-trip if we - know that we are connected to an HP X server. */ - xvendor = ServerVendor(__glutDisplay); - if (!strncmp(xvendor, VENDOR_HP, sizeof(VENDOR_HP) - 1)) { - hpColorRecoveryAtom = XInternAtom(__glutDisplay, "_HP_RGB_SMOOTH_MAP_LIST", True); - } else { - hpColorRecoveryAtom = None; - } - } - if (hpColorRecoveryAtom != None) { - status = XGetRGBColormaps(__glutDisplay, __glutRoot, - &standardCmaps, &numCmaps, hpColorRecoveryAtom); - if (status == 1) { - for (i = 0; i < numCmaps; i++) { - if (standardCmaps[i].visualid == vi->visualid) { - *cmap = standardCmaps[i].colormap; - XFree(standardCmaps); - return; - } - } - XFree(standardCmaps); - } - } -#ifndef SOLARIS_2_4_BUG - /* Solaris 2.4 and 2.5 have a bug in their - XmuLookupStandardColormap implementations. Please - compile your Solaris 2.4 or 2.5 version of GLUT with - -DSOLARIS_2_4_BUG to work around this bug. The symptom - of the bug is that programs will get a BadMatch error - from X_CreateWindow when creating a GLUT window because - Solaris 2.4 and 2.5 create a corrupted RGB_DEFAULT_MAP - property. Note that this workaround prevents Colormap - sharing between applications, perhaps leading - unnecessary colormap installations or colormap flashing. - Sun fixed this bug in Solaris 2.6. */ - status = XmuLookupStandardColormap(__glutDisplay, - vi->screen, vi->visualid, vi->depth, XA_RGB_DEFAULT_MAP, - /* replace */ False, /* retain */ True); - if (status == 1) { - status = XGetRGBColormaps(__glutDisplay, __glutRoot, - &standardCmaps, &numCmaps, XA_RGB_DEFAULT_MAP); - if (status == 1) { - for (i = 0; i < numCmaps; i++) { - if (standardCmaps[i].visualid == vi->visualid) { - *cmap = standardCmaps[i].colormap; - XFree(standardCmaps); - return; - } - } - XFree(standardCmaps); - } - } -#endif - /* If no standard colormap but TrueColor, just make a - private one. */ - /* XXX Should do a better job of internal sharing for - privately allocated TrueColor colormaps. */ - /* XXX DirectColor probably needs ramps hand initialized! */ - *cmap = XCreateColormap(__glutDisplay, __glutRoot, - vi->visual, AllocNone); - break; - case StaticColor: - case StaticGray: - case GrayScale: - /* Mesa supports these visuals */ - *colormap = NULL; - *cmap = XCreateColormap(__glutDisplay, __glutRoot, - vi->visual, AllocNone); - break; - default: - __glutFatalError( - "could not allocate colormap for visual type: %d.", - visualClass); - } - return; -#endif -} - -#if !defined(_WIN32) && !defined(__OS2__) -static int -findColormaps(GLUTwindow * window, - Window * winlist, Colormap * cmaplist, int num, int max) -{ - GLUTwindow *child; - int i; - - /* Do not allow more entries that maximum number of - colormaps! */ - if (num >= max) - return num; - /* Is cmap for this window already on the list? */ - for (i = 0; i < num; i++) { - if (cmaplist[i] == window->cmap) - goto normalColormapAlreadyListed; - } - /* Not found on the list; add colormap and window. */ - winlist[num] = window->win; - cmaplist[num] = window->cmap; - num++; - -normalColormapAlreadyListed: - - /* Repeat above but for the overlay colormap if there one. */ - if (window->overlay) { - if (num >= max) - return num; - for (i = 0; i < num; i++) { - if (cmaplist[i] == window->overlay->cmap) - goto overlayColormapAlreadyListed; - } - winlist[num] = window->overlay->win; - cmaplist[num] = window->overlay->cmap; - num++; - } -overlayColormapAlreadyListed: - - /* Recursively search children. */ - child = window->children; - while (child) { - num = findColormaps(child, winlist, cmaplist, num, max); - child = child->siblings; - } - return num; -} - -void -__glutEstablishColormapsProperty(GLUTwindow * window) -{ - /* this routine is strictly X. Win32 doesn't need to do - anything of this sort (but has to do other wacky stuff - later). */ - static Atom wmColormapWindows = None; - Window *winlist; - Colormap *cmaplist; - Status status; - int maxcmaps, num; - - assert(!window->parent); - maxcmaps = MaxCmapsOfScreen(ScreenOfDisplay(__glutDisplay, - __glutScreen)); - /* For portability reasons we don't use alloca for winlist - and cmaplist, but we could. */ - winlist = (Window *) malloc(maxcmaps * sizeof(Window)); - cmaplist = (Colormap *) malloc(maxcmaps * sizeof(Colormap)); - num = findColormaps(window, winlist, cmaplist, 0, maxcmaps); - if (num < 2) { - /* Property no longer needed; remove it. */ - wmColormapWindows = XSGIFastInternAtom(__glutDisplay, - "WM_COLORMAP_WINDOWS", SGI_XA_WM_COLORMAP_WINDOWS, False); - if (wmColormapWindows == None) { - __glutWarning("Could not intern X atom for WM_COLORMAP_WINDOWS."); - return; - } - XDeleteProperty(__glutDisplay, window->win, wmColormapWindows); - } else { - status = XSetWMColormapWindows(__glutDisplay, window->win, - winlist, num); - /* XSetWMColormapWindows should always work unless the - WM_COLORMAP_WINDOWS property cannot be intern'ed. We - check to be safe. */ - if (status == False) - __glutFatalError("XSetWMColormapWindows returned False."); - } - /* For portability reasons we don't use alloca for winlist - and cmaplist, but we could. */ - free(winlist); - free(cmaplist); -} - -GLUTwindow * -__glutToplevelOf(GLUTwindow * window) -{ - while (window->parent) { - window = window->parent; - } - return window; -} -#endif - -void -__glutFreeColormap(GLUTcolormap * cmap) -{ - GLUTcolormap *cur, **prev; - - cmap->refcnt--; - if (cmap->refcnt == 0) { - /* remove from colormap list */ - cur = __glutColormapList; - prev = &__glutColormapList; - while (cur) { - if (cur == cmap) { - *prev = cmap->next; - break; - } - prev = &(cur->next); - cur = cur->next; - } - /* actually free colormap */ - XFreeColormap(__glutDisplay, cmap->cmap); - free(cmap->cells); - free(cmap); - } -} - diff --git a/src/glut/os2/glut_cursor.cpp b/src/glut/os2/glut_cursor.cpp deleted file mode 100644 index 0db0aa64a4..0000000000 --- a/src/glut/os2/glut_cursor.cpp +++ /dev/null @@ -1,210 +0,0 @@ - -/* Copyright (c) Mark J. Kilgard, 1995, 1998. */ - -/* This program is freely distributable without licensing fees - and is provided without guarantee or warrantee expressed or - implied. This program is -not- in the public domain. */ - -#include "glutint.h" - -#if !defined(_WIN32) && !defined(__OS2PM__) -#include /* For XA_CURSOR */ -#include -#endif - -typedef struct _CursorTable { -#if defined(_WIN32) - char* glyph; -#else - int glyph; -#endif - Cursor cursor; -} CursorTable; -/* *INDENT-OFF* */ - -static CursorTable cursorTable[] = { - {XC_arrow, None}, /* GLUT_CURSOR_RIGHT_ARROW */ - {XC_top_left_arrow, None}, /* GLUT_CURSOR_LEFT_ARROW */ - {XC_hand1, None}, /* GLUT_CURSOR_INFO */ - {XC_pirate, None}, /* GLUT_CURSOR_DESTROY */ - {XC_question_arrow, None}, /* GLUT_CURSOR_HELP */ - {XC_exchange, None}, /* GLUT_CURSOR_CYCLE */ - {XC_spraycan, None}, /* GLUT_CURSOR_SPRAY */ - {XC_watch, None}, /* GLUT_CURSOR_WAIT */ - {XC_xterm, None}, /* GLUT_CURSOR_TEXT */ - {XC_crosshair, None}, /* GLUT_CURSOR_CROSSHAIR */ - {XC_sb_v_double_arrow, None}, /* GLUT_CURSOR_UP_DOWN */ - {XC_sb_h_double_arrow, None}, /* GLUT_CURSOR_LEFT_RIGHT */ - {XC_top_side, None}, /* GLUT_CURSOR_TOP_SIDE */ - {XC_bottom_side, None}, /* GLUT_CURSOR_BOTTOM_SIDE */ - {XC_left_side, None}, /* GLUT_CURSOR_LEFT_SIDE */ - {XC_right_side, None}, /* GLUT_CURSOR_RIGHT_SIDE */ - {XC_top_left_corner, None}, /* GLUT_CURSOR_TOP_LEFT_CORNER */ - {XC_top_right_corner, None}, /* GLUT_CURSOR_TOP_RIGHT_CORNER */ - {XC_bottom_right_corner, None}, /* GLUT_CURSOR_BOTTOM_RIGHT_CORNER */ - {XC_bottom_left_corner, None}, /* GLUT_CURSOR_BOTTOM_LEFT_CORNER */ -}; -/* *INDENT-ON* */ - -#if !defined(_WIN32) && !defined(__OS2PM__) -static Cursor blankCursor = None; -static Cursor fullCrosshairCusor = None; - -/* SGI X server's support a special property called the - _SGI_CROSSHAIR_CURSOR that when installed as a window's - cursor, becomes a full screen crosshair cursor. SGI - has special cursor generation hardware for this case. */ -static Cursor -getFullCrosshairCursor(void) -{ - Cursor cursor; - Atom crosshairAtom, actualType; - int rc, actualFormat; - unsigned long n, left; - unsigned long *value; - - if (fullCrosshairCusor == None) { - crosshairAtom = XInternAtom(__glutDisplay, - "_SGI_CROSSHAIR_CURSOR", True); - if (crosshairAtom != None) { - value = 0; /* Make compiler happy. */ - rc = XGetWindowProperty(__glutDisplay, __glutRoot, - crosshairAtom, 0, 1, False, XA_CURSOR, &actualType, - &actualFormat, &n, &left, (unsigned char **) &value); - if (rc == Success && actualFormat == 32 && n >= 1) { - cursor = value[0]; - XFree(value); - return cursor; - } - } - } - return XCreateFontCursor(__glutDisplay, XC_crosshair); -} - -/* X11 forces you to create a blank cursor if you want - to disable the cursor. */ -static Cursor -makeBlankCursor(void) -{ - static char data[1] = - {0}; - Cursor cursor; - Pixmap blank; - XColor dummy; - - blank = XCreateBitmapFromData(__glutDisplay, __glutRoot, - data, 1, 1); - if (blank == None) - __glutFatalError("out of memory."); - cursor = XCreatePixmapCursor(__glutDisplay, blank, blank, - &dummy, &dummy, 0, 0); - XFreePixmap(__glutDisplay, blank); - - return cursor; -} -#endif /* !_WIN32 && !__OS2PM__*/ - -/* Win32 and X11 use this same function to accomplish - fairly different tasks. X11 lets you just define the - cursor for a window and the window system takes care - of making sure that the window's cursor is installed - when the mouse is in the window. Win32 requires the - application to handle a WM_SETCURSOR message to install - the right cursor when windows are entered. Think of - the Win32 __glutSetCursor (called from __glutWindowProc) - as "install cursor". Think of the X11 __glutSetCursor - (called from glutSetCursor) as "define cursor". */ -void -__glutSetCursor(GLUTwindow *window) -{ - int cursor = window->cursor; - Cursor xcursor = 0; - - if (cursor >= 0 && - cursor < sizeof(cursorTable) / sizeof(cursorTable[0])) { - if (cursorTable[cursor].cursor == None) { - cursorTable[cursor].cursor = XCreateFontCursor(__glutDisplay, - cursorTable[cursor].glyph); - } - xcursor = cursorTable[cursor].cursor; - } else { - /* Special cases. */ - switch (cursor) { - case GLUT_CURSOR_INHERIT: -#if defined(_WIN32) - while (window->parent) { - window = window->parent; - if (window->cursor != GLUT_CURSOR_INHERIT) { - __glutSetCursor(window); - return; - } - } - /* XXX Default to an arrow cursor. Is this - right or should we be letting the default - window proc be installing some system cursor? */ - xcursor = cursorTable[0].cursor; - if (xcursor == NULL) { - xcursor = - cursorTable[0].cursor = - LoadCursor(NULL, cursorTable[0].glyph); - } - -#elif defined(__OS2PM__) -//todo - xcursor = None; - -#else - xcursor = None; -#endif - break; - case GLUT_CURSOR_NONE: -#if defined(_WIN32) || defined(__OS2PM__) - xcursor = NULL; -#else - if (blankCursor == None) { - blankCursor = makeBlankCursor(); - } - xcursor = blankCursor; -#endif - break; - case GLUT_CURSOR_FULL_CROSSHAIR: -#if defined(_WIN32) - xcursor = (HICON) IDC_CROSS; -#elif defined(__OS2PM__) -//todo -#else - if (fullCrosshairCusor == None) { - fullCrosshairCusor = getFullCrosshairCursor(); - } - xcursor = fullCrosshairCusor; -#endif - break; - } - } - XDefineCursor(__glutDisplay, - window->win, xcursor); - XFlush(__glutDisplay); -} - -/* CENTRY */ -void GLUTAPIENTRY -glutSetCursor(int cursor) -{ -#ifdef _WIN32 - POINT point; - - __glutCurrentWindow->cursor = cursor; - /* Are we in the window right now? If so, - install the cursor. */ - GetCursorPos(&point); - if (__glutCurrentWindow->win == WindowFromPoint(point)) { - __glutSetCursor(__glutCurrentWindow); - } -#elif defined(__OS2PM__) -//todo -#else - __glutCurrentWindow->cursor = cursor; - __glutSetCursor(__glutCurrentWindow); -#endif -} -/* ENDCENTRY */ diff --git a/src/glut/os2/glut_event.cpp b/src/glut/os2/glut_event.cpp deleted file mode 100644 index 4ece82e52b..0000000000 --- a/src/glut/os2/glut_event.cpp +++ /dev/null @@ -1,1399 +0,0 @@ -/* glut_event.c */ -/* Copyright (c) Mark J. Kilgard, 1994, 1995, 1996, 1997, 1998. */ - -/* This program is freely distributable without licensing fees - and is provided without guarantee or warrantee expressed or - implied. This program is -not- in the public domain. */ - -#ifdef __VMS -#include -#endif - -#include -#include -#include -#include -#include /* Some FD_ZERO macros use memset without - prototyping memset. */ - -/* Much of the following #ifdef logic to include the proper - prototypes for the select system call is based on logic - from the X11R6.3 version of . */ - -#if !defined(_WIN32) -# ifdef __sgi -# include /* prototype for bzero used by FD_ZERO */ -# endif -# if (defined(SVR4) || defined(CRAY) || defined(AIXV3)) && !defined(FD_SETSIZE) -# include /* select system call interface */ -# ifdef luna -# include -# endif -# endif - /* AIX 4.2 fubar-ed , so go to heroic measures to get it */ -# if defined(AIXV4) && !defined(NFDBITS) -# include -# endif -#endif /* !_WIN32 */ - -#include - -#if defined(__OS2__) -//??? ­ ä¨£  ?? # include -#elif !defined(_WIN32) -# if defined(__vms) && ( __VMS_VER < 70000000 ) -# include -# else -# ifndef __vms -# include -# endif -# endif -# include -# include -# include -#else -# ifdef __CYGWIN32__ -# include -# else -# include -# endif -# ifdef __hpux - /* XXX Bert Gijsbers reports that HP-UX - needs different keysyms for the End, Insert, and Delete keys - to work on an HP 715. It would be better if HP generated - standard keysyms for standard keys. */ -# include -# endif -#endif /* !_WIN32 */ - -#include "glutint.h" - -#if defined(__vms) && ( __VMS_VER < 70000000 ) -#include -#include -extern int SYS$CLREF(int efn); -extern int SYS$SETIMR(unsigned int efn, struct timeval6 *timeout, void *ast, - unsigned int request_id, unsigned int flags); -extern int SYS$WFLOR(unsigned int efn, unsigned int mask); -extern int SYS$CANTIM(unsigned int request_id, unsigned int mode); -#endif /* __vms, VMs 6.2 or earlier */ - -static GLUTtimer *freeTimerList = NULL; - -GLUTidleCB __glutIdleFunc = NULL; -GLUTtimer *__glutTimerList = NULL; -#ifdef SUPPORT_FORTRAN -GLUTtimer *__glutNewTimer; -#endif -GLUTwindow *__glutWindowWorkList = NULL; -GLUTmenu *__glutMappedMenu; -GLUTmenu *__glutCurrentMenu = NULL; - -void (*__glutUpdateInputDeviceMaskFunc) (GLUTwindow *); -#if !defined(_WIN32) && !defined(__OS2__) -void (*__glutMenuItemEnterOrLeave)(GLUTmenuItem * item, int num, int type) = NULL; -void (*__glutFinishMenu)(Window win, int x, int y); -void (*__glutPaintMenu)(GLUTmenu * menu); -void (*__glutStartMenu)(GLUTmenu * menu, GLUTwindow * window, int x, int y, int x_win, int y_win); -GLUTmenu * (*__glutGetMenuByNum)(int menunum); -GLUTmenuItem * (*__glutGetMenuItem)(GLUTmenu * menu, Window win, int *which); -GLUTmenu * (*__glutGetMenu)(Window win); -#endif - -Atom __glutMotifHints = None; -/* Modifier mask of ~0 implies not in core input callback. */ -unsigned int __glutModifierMask = (unsigned int) ~0; -int __glutWindowDamaged = 0; - -void GLUTAPIENTRY -glutIdleFunc(GLUTidleCB idleFunc) -{ - __glutIdleFunc = idleFunc; -} - -void GLUTAPIENTRY -glutTimerFunc(unsigned int interval, GLUTtimerCB timerFunc, int value) -{ - GLUTtimer *timer, *other; - GLUTtimer **prevptr; -#ifdef OLD_VMS - struct timeval6 now; -#else - struct timeval now; -#endif - - if (!timerFunc) - return; - - if (freeTimerList) { - timer = freeTimerList; - freeTimerList = timer->next; - } else { - timer = (GLUTtimer *) malloc(sizeof(GLUTtimer)); - if (!timer) - __glutFatalError("out of memory."); - } - - timer->func = timerFunc; -#if defined(__vms) && ( __VMS_VER < 70000000 ) - /* VMS time is expressed in units of 100 ns */ - timer->timeout.val = interval * TICKS_PER_MILLISECOND; -#else - timer->timeout.tv_sec = (int) interval / 1000; - timer->timeout.tv_usec = (int) (interval % 1000) * 1000; -#endif - timer->value = value; - timer->next = NULL; - GETTIMEOFDAY(&now); - ADD_TIME(timer->timeout, timer->timeout, now); - prevptr = &__glutTimerList; - other = *prevptr; - while (other && IS_AFTER(other->timeout, timer->timeout)) { - prevptr = &other->next; - other = *prevptr; - } - timer->next = other; -#ifdef SUPPORT_FORTRAN - __glutNewTimer = timer; /* for Fortran binding! */ -#endif - *prevptr = timer; -} - -void -handleTimeouts(void) -{ -#ifdef OLD_VMS - struct timeval6 now; -#else - struct timeval now; -#endif - GLUTtimer *timer; - - /* Assumption is that __glutTimerList is already determined - to be non-NULL. */ - GETTIMEOFDAY(&now); - while (IS_AT_OR_AFTER(__glutTimerList->timeout, now)) { - timer = __glutTimerList; - timer->func(timer->value); - __glutTimerList = timer->next; - timer->next = freeTimerList; - freeTimerList = timer; - if (!__glutTimerList) - break; - } -} - -void -__glutPutOnWorkList(GLUTwindow * window, int workMask) -{ - if (window->workMask) { - /* Already on list; just OR in new workMask. */ - window->workMask |= workMask; - } else { - /* Update work mask and add to window work list. */ - window->workMask = workMask; - /* Assert that if the window does not have a - workMask already, the window should definitely - not be the head of the work list. */ - assert(window != __glutWindowWorkList); - window->prevWorkWin = __glutWindowWorkList; - __glutWindowWorkList = window; - } -} - -void -__glutPostRedisplay(GLUTwindow * window, int layerMask) -{ - int shown = (layerMask & (GLUT_REDISPLAY_WORK | GLUT_REPAIR_WORK)) ? - window->shownState : window->overlay->shownState; - - /* Post a redisplay if the window is visible (or the - visibility of the window is unknown, ie. window->visState - == -1) _and_ the layer is known to be shown. */ - if (window->visState != GLUT_HIDDEN - && window->visState != GLUT_FULLY_COVERED && shown) { - __glutPutOnWorkList(window, layerMask); - } -} - -/* CENTRY */ -void GLUTAPIENTRY -glutPostRedisplay(void) -{ - __glutPostRedisplay(__glutCurrentWindow, GLUT_REDISPLAY_WORK); -} - -/* The advantage of this routine is that it saves the cost of a - glutSetWindow call (entailing an expensive OpenGL context switch), - particularly useful when multiple windows need redisplays posted at - the same times. See also glutPostWindowOverlayRedisplay. */ -void GLUTAPIENTRY -glutPostWindowRedisplay(int win) -{ - __glutPostRedisplay(__glutWindowList[win - 1], GLUT_REDISPLAY_WORK); -} - -/* ENDCENTRY */ -static GLUTeventParser *eventParserList = NULL; - -/* __glutRegisterEventParser allows another module to register - to intercept X events types not otherwise acted on by the - GLUT processEventsAndTimeouts routine. The X Input - extension support code uses an event parser for handling X - Input extension events. */ - -void -__glutRegisterEventParser(GLUTeventParser * parser) -{ - parser->next = eventParserList; - eventParserList = parser; -} - -static void -markWindowHidden(GLUTwindow * window) -{ - if (GLUT_HIDDEN != window->visState) { - GLUTwindow *child; - - if (window->windowStatus) { - window->visState = GLUT_HIDDEN; - __glutSetWindow(window); - window->windowStatus(GLUT_HIDDEN); - } - /* An unmap is only reported on a single window; its - descendents need to know they are no longer visible. */ - child = window->children; - while (child) { - markWindowHidden(child); - child = child->siblings; - } - } -} - -#if !defined(_WIN32) && !defined(__OS2__) - -static void -purgeStaleWindow(Window win) -{ - GLUTstale **pEntry = &__glutStaleWindowList; - GLUTstale *entry = __glutStaleWindowList; - - /* Tranverse singly-linked stale window list look for the - window ID. */ - while (entry) { - if (entry->win == win) { - /* Found it; delete it. */ - *pEntry = entry->next; - free(entry); - return; - } else { - pEntry = &entry->next; - entry = *pEntry; - } - } -} - -/* Unlike XNextEvent, if a signal arrives, - interruptibleXNextEvent will return (with a zero return - value). This helps GLUT drop out of XNextEvent if a signal - is delivered. The intent is so that a GLUT program can call - glutIdleFunc in a signal handler to register an idle func - and then immediately get dropped into the idle func (after - returning from the signal handler). The idea is to make - GLUT's main loop reliably interruptible by signals. */ -static int -interruptibleXNextEvent(Display * dpy, XEvent * event) -{ - fd_set fds; - int rc; - - /* Flush X protocol since XPending does not do this - implicitly. */ - XFlush(__glutDisplay); - for (;;) { - if (XPending(__glutDisplay)) { - XNextEvent(dpy, event); - return 1; - } -#ifndef VMS - /* the combination ConectionNumber-select is buggy on VMS. Sometimes it - * fails. This part of the code hangs the program on VMS7.2. But even - * without it the program seems to run correctly. - * Note that this is a bug in the VMS/DECWindows run-time-libraries. - * Compaq engeneering does not want or is not able to make a fix. - * (last sentence is a quotation from Compaq when I reported the - * problem January 2000) */ - FD_ZERO(&fds); - FD_SET(__glutConnectionFD, &fds); - rc = select(__glutConnectionFD + 1, &fds, NULL, NULL, NULL); - if (rc < 0) { - if (errno == EINTR) { - return 0; - } else { - __glutFatalError("select error."); - } - } -#endif - } -} - -#endif - -static void -processEventsAndTimeouts(void) -{ - do { -#if defined(__OS2__) - QMSG qmsg; /* message from message queue */ - extern HAB hab; /* PM anchor block handle */ - - if(! WinGetMsg( hab, &qmsg, 0UL, 0UL, 0UL ) ) - exit(0); - WinDispatchMsg( hab, /* PM anchor block handle */ - &qmsg ); /* pointer to message */ - -#elif defined(_WIN32) - MSG event; - - if(!GetMessage(&event, NULL, 0, 0)) /* bail if no more messages */ - exit(0); - TranslateMessage(&event); /* translate virtual-key messages */ - DispatchMessage(&event); /* call the window proc */ - /* see win32_event.c for event (message) processing procedures */ -#else - static int mappedMenuButton; - GLUTeventParser *parser; - XEvent event, ahead; - GLUTwindow *window; - GLUTkeyboardCB keyboard; - GLUTspecialCB special; - int gotEvent, width, height; - - gotEvent = interruptibleXNextEvent(__glutDisplay, &event); - if (gotEvent) { - switch (event.type) { - case MappingNotify: - XRefreshKeyboardMapping((XMappingEvent *) & event); - break; - case ConfigureNotify: - window = __glutGetWindow(event.xconfigure.window); - if (window) { - if (window->win != event.xconfigure.window) { - /* Ignore ConfigureNotify sent to the overlay - planes. GLUT could get here because overlays - select for StructureNotify events to receive - DestroyNotify. */ - break; - } - width = event.xconfigure.width; - height = event.xconfigure.height; - if (width != window->width || height != window->height) { - if (window->overlay) { - XResizeWindow(__glutDisplay, window->overlay->win, width, height); - } - window->width = width; - window->height = height; - __glutSetWindow(window); - /* Do not execute OpenGL out of sequence with - respect to the XResizeWindow request! */ - glXWaitX(); - window->reshape(width, height); - window->forceReshape = False; - /* A reshape should be considered like posting a - repair; this is necessary for the "Mesa - glXSwapBuffers to repair damage" hack to operate - correctly. Without it, there's not an initial - back buffer render from which to blit from when - damage happens to the window. */ - __glutPostRedisplay(window, GLUT_REPAIR_WORK); - } - } - break; - case Expose: - /* compress expose events */ - while (XEventsQueued(__glutDisplay, QueuedAfterReading) - > 0) { - XPeekEvent(__glutDisplay, &ahead); - if (ahead.type != Expose || - ahead.xexpose.window != event.xexpose.window) { - break; - } - XNextEvent(__glutDisplay, &event); - } - if (event.xexpose.count == 0) { - GLUTmenu *menu; - - if (__glutMappedMenu && - (menu = __glutGetMenu(event.xexpose.window))) { - __glutPaintMenu(menu); - } else { - window = __glutGetWindow(event.xexpose.window); - if (window) { - if (window->win == event.xexpose.window) { - __glutPostRedisplay(window, GLUT_REPAIR_WORK); - } else if (window->overlay && window->overlay->win == event.xexpose.window) { - __glutPostRedisplay(window, GLUT_OVERLAY_REPAIR_WORK); - } - } - } - } else { - /* there are more exposes to read; wait to redisplay */ - } - break; - case ButtonPress: - case ButtonRelease: - if (__glutMappedMenu && event.type == ButtonRelease - && mappedMenuButton == event.xbutton.button) { - /* Menu is currently popped up and its button is - released. */ - __glutFinishMenu(event.xbutton.window, event.xbutton.x, event.xbutton.y); - } else { - window = __glutGetWindow(event.xbutton.window); - if (window) { - GLUTmenu *menu; - int menuNum; - - menuNum = window->menu[event.xbutton.button - 1]; - /* Make sure that __glutGetMenuByNum is only called if there - really is a menu present. */ - if ((menuNum > 0) && (menu = __glutGetMenuByNum(menuNum))) { - if (event.type == ButtonPress && !__glutMappedMenu) { - __glutStartMenu(menu, window, - event.xbutton.x_root, event.xbutton.y_root, - event.xbutton.x, event.xbutton.y); - mappedMenuButton = event.xbutton.button; - } else { - /* Ignore a release of a button with a menu - attatched to it when no menu is popped up, - or ignore a press when another menu is - already popped up. */ - } - } else if (window->mouse) { - __glutSetWindow(window); - __glutModifierMask = event.xbutton.state; - window->mouse(event.xbutton.button - 1, - event.type == ButtonRelease ? - GLUT_UP : GLUT_DOWN, - event.xbutton.x, event.xbutton.y); - __glutModifierMask = ~0; - } else { - /* Stray mouse events. Ignore. */ - } - } else { - /* Window might have been destroyed and all the - events for the window may not yet be received. */ - } - } - break; - case MotionNotify: - if (!__glutMappedMenu) { - window = __glutGetWindow(event.xmotion.window); - if (window) { - /* If motion function registered _and_ buttons held - * down, call motion function... */ - if (window->motion && event.xmotion.state & - (Button1Mask | Button2Mask | Button3Mask)) { - __glutSetWindow(window); - window->motion(event.xmotion.x, event.xmotion.y); - } - /* If passive motion function registered _and_ - buttons not held down, call passive motion - function... */ - else if (window->passive && - ((event.xmotion.state & - (Button1Mask | Button2Mask | Button3Mask)) == - 0)) { - __glutSetWindow(window); - window->passive(event.xmotion.x, - event.xmotion.y); - } - } - } else { - /* Motion events are thrown away when a pop up menu - is active. */ - } - break; - case KeyPress: - case KeyRelease: - window = __glutGetWindow(event.xkey.window); - if (!window) { - break; - } - if (event.type == KeyPress) { - keyboard = window->keyboard; - } else { - - /* If we are ignoring auto repeated keys for this window, - check if the next event in the X event queue is a KeyPress - for the exact same key (and at the exact same time) as the - key being released. The X11 protocol will send auto - repeated keys as such KeyRelease/KeyPress pairs. */ - - if (window->ignoreKeyRepeat) { - if (XEventsQueued(__glutDisplay, QueuedAfterReading)) { - XPeekEvent(__glutDisplay, &ahead); - if (ahead.type == KeyPress - && ahead.xkey.window == event.xkey.window - && ahead.xkey.keycode == event.xkey.keycode - && ahead.xkey.time == event.xkey.time) { - /* Pop off the repeated KeyPress and ignore - the auto repeated KeyRelease/KeyPress pair. */ - XNextEvent(__glutDisplay, &event); - break; - } - } - } - keyboard = window->keyboardUp; - } - if (keyboard) { - char tmp[1]; - int rc; - - rc = XLookupString(&event.xkey, tmp, sizeof(tmp), - NULL, NULL); - if (rc) { - __glutSetWindow(window); - __glutModifierMask = event.xkey.state; - keyboard(tmp[0], - event.xkey.x, event.xkey.y); - __glutModifierMask = ~0; - break; - } - } - if (event.type == KeyPress) { - special = window->special; - } else { - special = window->specialUp; - } - if (special) { - KeySym ks; - int key; - -/* Introduced in X11R6: (Partial list of) Keypad Functions. Define - in place in case compiling against an older pre-X11R6 - X11/keysymdef.h file. */ -#ifndef XK_KP_Home -#define XK_KP_Home 0xFF95 -#endif -#ifndef XK_KP_Left -#define XK_KP_Left 0xFF96 -#endif -#ifndef XK_KP_Up -#define XK_KP_Up 0xFF97 -#endif -#ifndef XK_KP_Right -#define XK_KP_Right 0xFF98 -#endif -#ifndef XK_KP_Down -#define XK_KP_Down 0xFF99 -#endif -#ifndef XK_KP_Prior -#define XK_KP_Prior 0xFF9A -#endif -#ifndef XK_KP_Next -#define XK_KP_Next 0xFF9B -#endif -#ifndef XK_KP_End -#define XK_KP_End 0xFF9C -#endif -#ifndef XK_KP_Insert -#define XK_KP_Insert 0xFF9E -#endif -#ifndef XK_KP_Delete -#define XK_KP_Delete 0xFF9F -#endif - - ks = XLookupKeysym((XKeyEvent *) & event, 0); - /* XXX Verbose, but makes no assumptions about keysym - layout. */ - switch (ks) { -/* *INDENT-OFF* */ - /* function keys */ - case XK_F1: key = GLUT_KEY_F1; break; - case XK_F2: key = GLUT_KEY_F2; break; - case XK_F3: key = GLUT_KEY_F3; break; - case XK_F4: key = GLUT_KEY_F4; break; - case XK_F5: key = GLUT_KEY_F5; break; - case XK_F6: key = GLUT_KEY_F6; break; - case XK_F7: key = GLUT_KEY_F7; break; - case XK_F8: key = GLUT_KEY_F8; break; - case XK_F9: key = GLUT_KEY_F9; break; - case XK_F10: key = GLUT_KEY_F10; break; - case XK_F11: key = GLUT_KEY_F11; break; - case XK_F12: key = GLUT_KEY_F12; break; - /* directional keys */ - case XK_KP_Left: - case XK_Left: key = GLUT_KEY_LEFT; break; - case XK_KP_Up: /* Introduced in X11R6. */ - case XK_Up: key = GLUT_KEY_UP; break; - case XK_KP_Right: /* Introduced in X11R6. */ - case XK_Right: key = GLUT_KEY_RIGHT; break; - case XK_KP_Down: /* Introduced in X11R6. */ - case XK_Down: key = GLUT_KEY_DOWN; break; -/* *INDENT-ON* */ - - case XK_KP_Prior: /* Introduced in X11R6. */ - case XK_Prior: - /* XK_Prior same as X11R6's XK_Page_Up */ - key = GLUT_KEY_PAGE_UP; - break; - case XK_KP_Next: /* Introduced in X11R6. */ - case XK_Next: - /* XK_Next same as X11R6's XK_Page_Down */ - key = GLUT_KEY_PAGE_DOWN; - break; - case XK_KP_Home: /* Introduced in X11R6. */ - case XK_Home: - key = GLUT_KEY_HOME; - break; -#ifdef __hpux - case XK_Select: -#endif - case XK_KP_End: /* Introduced in X11R6. */ - case XK_End: - key = GLUT_KEY_END; - break; -#ifdef __hpux - case XK_InsertChar: -#endif - case XK_KP_Insert: /* Introduced in X11R6. */ - case XK_Insert: - key = GLUT_KEY_INSERT; - break; -#ifdef __hpux - case XK_DeleteChar: -#endif - case XK_KP_Delete: /* Introduced in X11R6. */ - /* The Delete character is really an ASCII key. */ - __glutSetWindow(window); - keyboard(127, /* ASCII Delete character. */ - event.xkey.x, event.xkey.y); - goto skip; - default: - goto skip; - } - __glutSetWindow(window); - __glutModifierMask = event.xkey.state; - special(key, event.xkey.x, event.xkey.y); - __glutModifierMask = ~0; - skip:; - } - break; - case EnterNotify: - case LeaveNotify: - if (event.xcrossing.mode != NotifyNormal || - event.xcrossing.detail == NotifyNonlinearVirtual || - event.xcrossing.detail == NotifyVirtual) { - - /* Careful to ignore Enter/LeaveNotify events that - come from the pop-up menu pointer grab and ungrab. - Also, ignore "virtual" Enter/LeaveNotify events - since they represent the pointer passing through - the window hierarchy without actually entering or - leaving the actual real estate of a window. */ - - break; - } - if (__glutMappedMenu) { - GLUTmenuItem *item; - int num; - - item = __glutGetMenuItem(__glutMappedMenu, - event.xcrossing.window, &num); - if (item) { - __glutMenuItemEnterOrLeave(item, num, event.type); - break; - } - } - window = __glutGetWindow(event.xcrossing.window); - if (window) { - if (window->entry) { - if (event.type == EnterNotify) { - - /* With overlays established, X can report two - enter events for both the overlay and normal - plane window. Do not generate a second enter - callback if we reported one without an - intervening leave. */ - - if (window->entryState != EnterNotify) { - int num = window->num; - Window xid = window->win; - - window->entryState = EnterNotify; - __glutSetWindow(window); - window->entry(GLUT_ENTERED); - - if (__glutMappedMenu) { - - /* Do not generate any passive motion events - when menus are in use. */ - - } else { - - /* An EnterNotify event can result in a - "compound" callback if a passive motion - callback is also registered. In this case, - be a little paranoid about the possibility - the window could have been destroyed in the - entry callback. */ - - window = __glutWindowList[num]; - if (window && window->passive && window->win == xid) { - __glutSetWindow(window); - window->passive(event.xcrossing.x, event.xcrossing.y); - } - } - } - } else { - if (window->entryState != LeaveNotify) { - - /* When an overlay is established for a window - already mapped and with the pointer in it, - the X server will generate a leave/enter - event pair as the pointer leaves (without - moving) from the normal plane X window to - the newly mapped overlay X window (or vice - versa). This enter/leave pair should not be - reported to the GLUT program since the pair - is a consequence of creating (or destroying) - the overlay, not an actual leave from the - GLUT window. */ - - if (XEventsQueued(__glutDisplay, QueuedAfterReading)) { - XPeekEvent(__glutDisplay, &ahead); - if (ahead.type == EnterNotify && - __glutGetWindow(ahead.xcrossing.window) == window) { - XNextEvent(__glutDisplay, &event); - break; - } - } - window->entryState = LeaveNotify; - __glutSetWindow(window); - window->entry(GLUT_LEFT); - } - } - } else if (window->passive) { - __glutSetWindow(window); - window->passive(event.xcrossing.x, event.xcrossing.y); - } - } - break; - case UnmapNotify: - /* MapNotify events are not needed to maintain - visibility state since VisibilityNotify events will - be delivered when a window becomes visible from - mapping. However, VisibilityNotify events are not - delivered when a window is unmapped (for the window - or its children). */ - window = __glutGetWindow(event.xunmap.window); - if (window) { - if (window->win != event.xconfigure.window) { - /* Ignore UnmapNotify sent to the overlay planes. - GLUT could get here because overlays select for - StructureNotify events to receive DestroyNotify. - */ - break; - } - markWindowHidden(window); - } - break; - case VisibilityNotify: - window = __glutGetWindow(event.xvisibility.window); - if (window) { - /* VisibilityUnobscured+1 = GLUT_FULLY_RETAINED, - VisibilityPartiallyObscured+1 = - GLUT_PARTIALLY_RETAINED, VisibilityFullyObscured+1 - = GLUT_FULLY_COVERED. */ - int visState = event.xvisibility.state + 1; - - if (visState != window->visState) { - if (window->windowStatus) { - window->visState = visState; - __glutSetWindow(window); - window->windowStatus(visState); - } - } - } - break; - case ClientMessage: - if (event.xclient.data.l[0] == __glutWMDeleteWindow) - exit(0); - break; - case DestroyNotify: - purgeStaleWindow(event.xdestroywindow.window); - break; - case CirculateNotify: - case CreateNotify: - case GravityNotify: - case ReparentNotify: - /* Uninteresting to GLUT (but possible for GLUT to - receive). */ - break; - default: - /* Pass events not directly handled by the GLUT main - event loop to any event parsers that have been - registered. In this way, X Input extension events - are passed to the correct handler without forcing - all GLUT programs to support X Input event handling. - */ - parser = eventParserList; - while (parser) { - if (parser->func(&event)) - break; - parser = parser->next; - } - break; - } - } -#endif /* _WIN32 */ - if (__glutTimerList) { - handleTimeouts(); - } - } - while (XPending(__glutDisplay)); -} - -static void -waitForSomething(void) -{ -#if defined(__vms) && ( __VMS_VER < 70000000 ) - static struct timeval6 zerotime = - {0}; - unsigned int timer_efn; -#define timer_id 'glut' /* random :-) number */ - unsigned int wait_mask; -#else - static struct timeval zerotime = - {0, 0}; -#if defined(__OS2__) - -#elif !defined(_WIN32) - fd_set fds; -#endif -#endif -#ifdef OLD_VMS - struct timeval6 now, timeout, waittime; -#else - struct timeval now, timeout, waittime; -#endif -#if !defined(_WIN32) - int rc; -#endif - - /* Flush X protocol since XPending does not do this - implicitly. */ - XFlush(__glutDisplay); - if (XPending(__glutDisplay)) { - /* It is possible (but quite rare) that XFlush may have - needed to wait for a writable X connection file - descriptor, and in the process, may have had to read off - X protocol from the file descriptor. If XPending is true, - this case occured and we should avoid waiting in select - since X protocol buffered within Xlib is due to be - processed and potentially no more X protocol is on the - file descriptor, so we would risk waiting improperly in - select. */ - goto immediatelyHandleXinput; - } -#if defined(__vms) && ( __VMS_VER < 70000000 ) - timeout = __glutTimerList->timeout; - GETTIMEOFDAY(&now); - wait_mask = 1 << (__glutConnectionFD & 31); - if (IS_AFTER(now, timeout)) { - /* We need an event flag for the timer. */ - /* XXX The `right' way to do this is to use LIB$GET_EF, but - since it needs to be in the same cluster as the EFN for - the display, we will have hack it. */ - timer_efn = __glutConnectionFD - 1; - if ((timer_efn / 32) != (__glutConnectionFD / 32)) { - timer_efn = __glutConnectionFD + 1; - } - rc = SYS$CLREF(timer_efn); - rc = SYS$SETIMR(timer_efn, &timeout, NULL, timer_id, 0); - wait_mask |= 1 << (timer_efn & 31); - } else { - timer_efn = 0; - } - rc = SYS$WFLOR(__glutConnectionFD, wait_mask); - if (timer_efn != 0 && SYS$CLREF(timer_efn) == SS$_WASCLR) { - rc = SYS$CANTIM(timer_id, PSL$C_USER); - } - /* XXX There does not seem to be checking of "rc" in the code - above. Can any of the SYS$ routines above fail? */ -#else /* not vms6.2 or lower */ -#if defined(__OS2__) - -#elif !defined(_WIN32) - FD_ZERO(&fds); - FD_SET(__glutConnectionFD, &fds); -#endif - timeout = __glutTimerList->timeout; - GETTIMEOFDAY(&now); - if (IS_AFTER(now, timeout)) { - TIMEDELTA(waittime, timeout, now); - } else { - waittime = zerotime; - } - -#if defined(__OS2__) - DosSleep(0); -#elif !defined(_WIN32) - rc = select(__glutConnectionFD + 1, &fds, - NULL, NULL, &waittime); - if (rc < 0 && errno != EINTR) - __glutFatalError("select error."); -#else - - MsgWaitForMultipleObjects(0, NULL, FALSE, - waittime.tv_sec*1000 + waittime.tv_usec/1000, QS_ALLINPUT); - -#endif -#endif /* not vms6.2 or lower */ - /* Without considering the cause of select unblocking, check - for pending X events and handle any timeouts (by calling - processEventsAndTimeouts). We always look for X events - even if select returned with 0 (indicating a timeout); - otherwise we risk starving X event processing by continous - timeouts. */ - if (XPending(__glutDisplay)) { - immediatelyHandleXinput: - processEventsAndTimeouts(); - } else { - if (__glutTimerList) - handleTimeouts(); - } -} - -static void -idleWait(void) -{ - if (XPending(__glutDisplay)) { - processEventsAndTimeouts(); - } else { - if (__glutTimerList) { - handleTimeouts(); - } - } - /* Make sure idle func still exists! */ - if (__glutIdleFunc) { - __glutIdleFunc(); - } -} - -static GLUTwindow **beforeEnd; - -static GLUTwindow * -processWindowWorkList(GLUTwindow * window) -{ - int workMask; - - if (window->prevWorkWin) { - window->prevWorkWin = processWindowWorkList(window->prevWorkWin); - } else { - beforeEnd = &window->prevWorkWin; - } - - /* Capture work mask for work that needs to be done to this - window, then clear the window's work mask (excepting the - dummy work bit, see below). Then, process the captured - work mask. This allows callbacks in the processing the - captured work mask to set the window's work mask for - subsequent processing. */ - - workMask = window->workMask; - assert((workMask & GLUT_DUMMY_WORK) == 0); - - /* Set the dummy work bit, clearing all other bits, to - indicate that the window is currently on the window work - list _and_ that the window's work mask is currently being - processed. This convinces __glutPutOnWorkList that this - window is on the work list still. */ - window->workMask = GLUT_DUMMY_WORK; - - /* Optimization: most of the time, the work to do is a - redisplay and not these other types of work. Check for - the following cases as a group to before checking each one - individually one by one. This saves about 25 MIPS - instructions in the common redisplay only case. */ - if (workMask & (GLUT_EVENT_MASK_WORK | GLUT_DEVICE_MASK_WORK | - GLUT_CONFIGURE_WORK | GLUT_COLORMAP_WORK | GLUT_MAP_WORK)) { - -#if !defined(_WIN32) && !defined(__OS2__) - /* Be sure to set event mask BEFORE map window is done. */ - if (workMask & GLUT_EVENT_MASK_WORK) { - long eventMask; - - /* Make sure children are not propogating events this - window is selecting for. Be sure to do this before - enabling events on the children's parent. */ - if (window->children) { - GLUTwindow *child = window->children; - unsigned long attribMask = CWDontPropagate; - XSetWindowAttributes wa; - - wa.do_not_propagate_mask = window->eventMask & GLUT_DONT_PROPAGATE_FILTER_MASK; - if (window->eventMask & GLUT_HACK_STOP_PROPAGATE_MASK) { - wa.event_mask = child->eventMask | (window->eventMask & GLUT_HACK_STOP_PROPAGATE_MASK); - attribMask |= CWEventMask; - } - do { - XChangeWindowAttributes(__glutDisplay, child->win, - attribMask, &wa); - child = child->siblings; - } while (child); - } - eventMask = window->eventMask; - if (window->parent && window->parent->eventMask & GLUT_HACK_STOP_PROPAGATE_MASK) - eventMask |= (window->parent->eventMask & GLUT_HACK_STOP_PROPAGATE_MASK); - XSelectInput(__glutDisplay, window->win, eventMask); - if (window->overlay) - XSelectInput(__glutDisplay, window->overlay->win, - window->eventMask & GLUT_OVERLAY_EVENT_FILTER_MASK); - } -#endif /* !_WIN32 */ - /* Be sure to set device mask BEFORE map window is done. */ - if (workMask & GLUT_DEVICE_MASK_WORK) { - __glutUpdateInputDeviceMaskFunc(window); - } - /* Be sure to configure window BEFORE map window is done. */ - if (workMask & GLUT_CONFIGURE_WORK) { -#if defined(__OS2__) - RECTL changes; - -#elif defined(_WIN32) - RECT changes; - POINT point; - UINT flags = SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOOWNERZORDER - | SWP_NOSENDCHANGING | SWP_NOSIZE | SWP_NOZORDER; - - GetClientRect(window->win, &changes); - - /* If this window is a toplevel window, translate the 0,0 client - coordinate into a screen coordinate for proper placement. */ - if (!window->parent) { - point.x = 0; - point.y = 0; - ClientToScreen(window->win, &point); - changes.left = point.x; - changes.top = point.y; - } - if (window->desiredConfMask & (CWX | CWY)) { - changes.left = window->desiredX; - changes.top = window->desiredY; - flags &= ~SWP_NOMOVE; - } - if (window->desiredConfMask & (CWWidth | CWHeight)) { - changes.right = changes.left + window->desiredWidth; - changes.bottom = changes.top + window->desiredHeight; - flags &= ~SWP_NOSIZE; - /* XXX If overlay exists, resize the overlay here, ie. - if (window->overlay) ... */ - } - if (window->desiredConfMask & CWStackMode) { - flags &= ~SWP_NOZORDER; - /* XXX Overlay support might require something special here. */ - } - - /* Adjust the window rectangle because Win32 thinks that the x, y, - width & height are the WHOLE window (including decorations), - whereas GLUT treats the x, y, width & height as only the CLIENT - area of the window. Only do this to top level windows - that are not in game mode (since game mode windows do - not have any decorations). */ - if (!window->parent && window != __glutGameModeWindow) { - AdjustWindowRect(&changes, - WS_OVERLAPPEDWINDOW | WS_CLIPSIBLINGS | WS_CLIPCHILDREN, - FALSE); - } - - /* Do the repositioning, moving, and push/pop. */ - SetWindowPos(window->win, - window->desiredStack == Above ? HWND_TOP : HWND_NOTOPMOST, - changes.left, changes.top, - changes.right - changes.left, changes.bottom - changes.top, - flags); - - /* Zero out the mask. */ - window->desiredConfMask = 0; - - /* This hack causes the window to go back to the right position - when it is taken out of fullscreen mode. */ - if (workMask & GLUT_FULL_SCREEN_WORK) { - window->desiredConfMask |= CWX | CWY; - window->desiredX = point.x; - window->desiredY = point.y; - } -#else /* !_WIN32 */ - XWindowChanges changes; - - changes.x = window->desiredX; - changes.y = window->desiredY; - if (window->desiredConfMask & (CWWidth | CWHeight)) { - changes.width = window->desiredWidth; - changes.height = window->desiredHeight; - if (window->overlay) - XResizeWindow(__glutDisplay, window->overlay->win, - window->desiredWidth, window->desiredHeight); - if (__glutMotifHints != None) { - if (workMask & GLUT_FULL_SCREEN_WORK) { - MotifWmHints hints; - - hints.flags = MWM_HINTS_DECORATIONS; - hints.decorations = 0; /* Absolutely no - decorations. */ - XChangeProperty(__glutDisplay, window->win, - __glutMotifHints, __glutMotifHints, 32, - PropModeReplace, (unsigned char *) &hints, 4); - if (workMask & GLUT_MAP_WORK) { - /* Handle case where glutFullScreen is called - before the first time that the window is - mapped. Some window managers will randomly or - interactively position the window the first - time it is mapped if the window's - WM_NORMAL_HINTS property does not request an - explicit position. We don't want any such - window manager interaction when going - fullscreen. Overwrite the WM_NORMAL_HINTS - property installed by glutCreateWindow's - XSetWMProperties property with one explicitly - requesting a fullscreen window. */ - XSizeHints hints; - - hints.flags = USPosition | USSize; - hints.x = 0; - hints.y = 0; - hints.width = window->desiredWidth; - hints.height = window->desiredHeight; - XSetWMNormalHints(__glutDisplay, window->win, &hints); - } - } else { - XDeleteProperty(__glutDisplay, window->win, __glutMotifHints); - } - } - } - if (window->desiredConfMask & CWStackMode) { - changes.stack_mode = window->desiredStack; - /* Do not let glutPushWindow push window beneath the - underlay. */ - if (window->parent && window->parent->overlay - && window->desiredStack == Below) { - changes.stack_mode = Above; - changes.sibling = window->parent->overlay->win; - window->desiredConfMask |= CWSibling; - } - } - XConfigureWindow(__glutDisplay, window->win, - window->desiredConfMask, &changes); - window->desiredConfMask = 0; -#endif - } -#if !defined(_WIN32) && !defined(__OS2__) - /* Be sure to establish the colormaps BEFORE map window is - done. */ - if (workMask & GLUT_COLORMAP_WORK) { - __glutEstablishColormapsProperty(window); - } -#endif - if (workMask & GLUT_MAP_WORK) { - switch (window->desiredMapState) { - case WithdrawnState: - if (window->parent) { - XUnmapWindow(__glutDisplay, window->win); - } else { - XWithdrawWindow(__glutDisplay, window->win, - __glutScreen); - } - window->shownState = 0; - break; - case NormalState: - XMapWindow(__glutDisplay, window->win); - window->shownState = 1; - break; -#ifdef _WIN32 - case GameModeState: /* Not an Xlib value. */ - ShowWindow(window->win, SW_SHOW); - window->shownState = 1; - break; -#endif - case IconicState: - XIconifyWindow(__glutDisplay, window->win, __glutScreen); - window->shownState = 0; - break; - } - } - } - if (workMask & (GLUT_REDISPLAY_WORK | GLUT_OVERLAY_REDISPLAY_WORK | GLUT_REPAIR_WORK | GLUT_OVERLAY_REPAIR_WORK)) { - if (window->forceReshape) { - /* Guarantee that before a display callback is generated - for a window, a reshape callback must be generated. */ - __glutSetWindow(window); - window->reshape(window->width, window->height); - window->forceReshape = False; - - /* Setting the redisplay bit on the first reshape is - necessary to make the "Mesa glXSwapBuffers to repair - damage" hack operate correctly. Without indicating a - redisplay is necessary, there's not an initial back - buffer render from which to blit from when damage - happens to the window. */ - workMask |= GLUT_REDISPLAY_WORK; - } - /* The code below is more involved than otherwise necessary - because it is paranoid about the overlay or entire window - being removed or destroyed in the course of the callbacks. - Notice how the global __glutWindowDamaged is used to record - the layers' damage status. See the code in glutLayerGet for - how __glutWindowDamaged is used. The point is to not have to - update the "damaged" field after the callback since the - window (or overlay) may be destroyed (or removed) when the - callback returns. */ - - if (window->overlay && window->overlay->display) { - int num = window->num; - Window xid = window->overlay ? window->overlay->win : None; - - /* If an overlay display callback is registered, we - differentiate between a redisplay needed for the - overlay and/or normal plane. If there is no overlay - display callback registered, we simply use the - standard display callback. */ - - if (workMask & (GLUT_REDISPLAY_WORK | GLUT_REPAIR_WORK)) { - if (__glutMesaSwapHackSupport) { - if (window->usedSwapBuffers) { - if ((workMask & (GLUT_REPAIR_WORK | GLUT_REDISPLAY_WORK)) == GLUT_REPAIR_WORK) { - SWAP_BUFFERS_WINDOW(window); - goto skippedDisplayCallback1; - } - } - } - /* Render to normal plane. */ -#ifdef _WIN32 - window->renderDc = window->hdc; -#endif - window->renderWin = window->win; - window->renderCtx = window->ctx; - __glutWindowDamaged = (workMask & GLUT_REPAIR_WORK); - __glutSetWindow(window); - window->usedSwapBuffers = 0; - window->display(); - __glutWindowDamaged = 0; - - skippedDisplayCallback1:; - } - if (workMask & (GLUT_OVERLAY_REDISPLAY_WORK | GLUT_OVERLAY_REPAIR_WORK)) { - window = __glutWindowList[num]; - if (window && window->overlay && - window->overlay->win == xid && window->overlay->display) { - - /* Render to overlay. */ -#ifdef _WIN32 - window->renderDc = window->overlay->hdc; -#endif - window->renderWin = window->overlay->win; - window->renderCtx = window->overlay->ctx; - __glutWindowDamaged = (workMask & GLUT_OVERLAY_REPAIR_WORK); - __glutSetWindow(window); - window->overlay->display(); - __glutWindowDamaged = 0; - } else { - /* Overlay may have since been destroyed or the - overlay callback may have been disabled during - normal display callback. */ - } - } - } else { - if (__glutMesaSwapHackSupport) { - if (!window->overlay && window->usedSwapBuffers) { - if ((workMask & (GLUT_REPAIR_WORK | GLUT_REDISPLAY_WORK)) == GLUT_REPAIR_WORK) { - SWAP_BUFFERS_WINDOW(window); - goto skippedDisplayCallback2; - } - } - } - /* Render to normal plane (and possibly overlay). */ - __glutWindowDamaged = (workMask & (GLUT_OVERLAY_REPAIR_WORK | GLUT_REPAIR_WORK)); - __glutSetWindow(window); - window->usedSwapBuffers = 0; - window->display(); - __glutWindowDamaged = 0; - - skippedDisplayCallback2:; - } - } - /* Combine workMask with window->workMask to determine what - finish and debug work there is. */ - workMask |= window->workMask; - - if (workMask & GLUT_FINISH_WORK) { - /* Finish work makes sure a glFinish gets done to indirect - rendering contexts. Indirect contexts tend to have much - longer latency because lots of OpenGL extension requests - can queue up in the X protocol stream. __glutSetWindow - is where the finish works gets queued for indirect - contexts. */ - __glutSetWindow(window); - glFinish(); - } - if (workMask & GLUT_DEBUG_WORK) { - __glutSetWindow(window); - glutReportErrors(); - } - /* Strip out dummy, finish, and debug work bits. */ - window->workMask &= ~(GLUT_DUMMY_WORK | GLUT_FINISH_WORK | GLUT_DEBUG_WORK); - if (window->workMask) { - /* Leave on work list. */ - return window; - } else { - /* Remove current window from work list. */ - return window->prevWorkWin; - } -} - -#ifndef _WIN32 -static /* X11 implementations do not need this global. */ -#endif -void -__glutProcessWindowWorkLists(void) -{ - if (__glutWindowWorkList) { - GLUTwindow *remainder, *work; - - work = __glutWindowWorkList; - __glutWindowWorkList = NULL; - if (work) { - remainder = processWindowWorkList(work); - if (remainder) { - *beforeEnd = __glutWindowWorkList; - __glutWindowWorkList = remainder; - } - } - } -} - -/* CENTRY */ -void GLUTAPIENTRY -glutMainLoop(void) -{ -#if !defined(_WIN32) - if (!__glutDisplay) - __glutFatalUsage("main loop entered with out proper initialization."); -#endif - if (!__glutWindowListSize) - __glutFatalUsage( - "main loop entered with no windows created."); - for (;;) { - __glutProcessWindowWorkLists(); - if (__glutIdleFunc || __glutWindowWorkList) { - idleWait(); - } else { - if (__glutTimerList) { - waitForSomething(); - } else { - processEventsAndTimeouts(); - } - } - } -} -/* ENDCENTRY */ diff --git a/src/glut/os2/glut_ext.cpp b/src/glut/os2/glut_ext.cpp deleted file mode 100644 index 6617fd6edb..0000000000 --- a/src/glut/os2/glut_ext.cpp +++ /dev/null @@ -1,204 +0,0 @@ - -/* Copyright (c) Mark J. Kilgard, 1994, 1997. */ - -/* This program is freely distributable without licensing fees - and is provided without guarantee or warrantee expressed or - implied. This program is -not- in the public domain. */ - -#include -#include - -#include "glutint.h" - -/* CENTRY */ -int GLUTAPIENTRY -glutExtensionSupported(const char *extension) -{ - static const GLubyte *extensions = NULL; - const GLubyte *start; - GLubyte *where, *terminator; - - /* Extension names should not have spaces. */ - where = (GLubyte *) strchr(extension, ' '); - if (where || *extension == '\0') - return 0; - - if (!extensions) { - extensions = glGetString(GL_EXTENSIONS); - } - /* It takes a bit of care to be fool-proof about parsing the - OpenGL extensions string. Don't be fooled by sub-strings, - etc. */ - start = extensions; - for (;;) { - /* If your application crashes in the strstr routine below, - you are probably calling glutExtensionSupported without - having a current window. Calling glGetString without - a current OpenGL context has unpredictable results. - Please fix your program. */ - where = (GLubyte *) strstr((const char *) start, extension); - if (!where) - break; - terminator = where + strlen(extension); - if (where == start || *(where - 1) == ' ') { - if (*terminator == ' ' || *terminator == '\0') { - return 1; - } - } - start = terminator; - } - return 0; -} - - -struct name_address_pair { - const char *name; - const void *address; -}; - -static struct name_address_pair glut_functions[] = { - { "glutInit", (const void *) glutInit }, - { "glutInitDisplayMode", (const void *) glutInitDisplayMode }, - { "glutInitDisplayString", (const void *) glutInitDisplayString }, - { "glutInitWindowPosition", (const void *) glutInitWindowPosition }, - { "glutInitWindowSize", (const void *) glutInitWindowSize }, - { "glutMainLoop", (const void *) glutMainLoop }, - { "glutCreateWindow", (const void *) glutCreateWindow }, - { "glutCreateSubWindow", (const void *) glutCreateSubWindow }, - { "glutDestroyWindow", (const void *) glutDestroyWindow }, - { "glutPostRedisplay", (const void *) glutPostRedisplay }, - { "glutPostWindowRedisplay", (const void *) glutPostWindowRedisplay }, - { "glutSwapBuffers", (const void *) glutSwapBuffers }, - { "glutGetWindow", (const void *) glutGetWindow }, - { "glutSetWindow", (const void *) glutSetWindow }, - { "glutSetWindowTitle", (const void *) glutSetWindowTitle }, - { "glutSetIconTitle", (const void *) glutSetIconTitle }, - { "glutPositionWindow", (const void *) glutPositionWindow }, - { "glutReshapeWindow", (const void *) glutReshapeWindow }, - { "glutPopWindow", (const void *) glutPopWindow }, - { "glutPushWindow", (const void *) glutPushWindow }, - { "glutIconifyWindow", (const void *) glutIconifyWindow }, - { "glutShowWindow", (const void *) glutShowWindow }, - { "glutHideWindow", (const void *) glutHideWindow }, - { "glutFullScreen", (const void *) glutFullScreen }, - { "glutSetCursor", (const void *) glutSetCursor }, - { "glutWarpPointer", (const void *) glutWarpPointer }, - { "glutEstablishOverlay", (const void *) glutEstablishOverlay }, - { "glutRemoveOverlay", (const void *) glutRemoveOverlay }, - { "glutUseLayer", (const void *) glutUseLayer }, - { "glutPostOverlayRedisplay", (const void *) glutPostOverlayRedisplay }, - { "glutPostWindowOverlayRedisplay", (const void *) glutPostWindowOverlayRedisplay }, - { "glutShowOverlay", (const void *) glutShowOverlay }, - { "glutHideOverlay", (const void *) glutHideOverlay }, - { "glutCreateMenu", (const void *) glutCreateMenu }, - { "glutDestroyMenu", (const void *) glutDestroyMenu }, - { "glutGetMenu", (const void *) glutGetMenu }, - { "glutSetMenu", (const void *) glutSetMenu }, - { "glutAddMenuEntry", (const void *) glutAddMenuEntry }, - { "glutAddSubMenu", (const void *) glutAddSubMenu }, - { "glutChangeToMenuEntry", (const void *) glutChangeToMenuEntry }, - { "glutChangeToSubMenu", (const void *) glutChangeToSubMenu }, - { "glutRemoveMenuItem", (const void *) glutRemoveMenuItem }, - { "glutAttachMenu", (const void *) glutAttachMenu }, - { "glutDetachMenu", (const void *) glutDetachMenu }, - { "glutDisplayFunc", (const void *) glutDisplayFunc }, - { "glutReshapeFunc", (const void *) glutReshapeFunc }, - { "glutKeyboardFunc", (const void *) glutKeyboardFunc }, - { "glutMouseFunc", (const void *) glutMouseFunc }, - { "glutMotionFunc", (const void *) glutMotionFunc }, - { "glutPassiveMotionFunc", (const void *) glutPassiveMotionFunc }, - { "glutEntryFunc", (const void *) glutEntryFunc }, - { "glutVisibilityFunc", (const void *) glutVisibilityFunc }, - { "glutIdleFunc", (const void *) glutIdleFunc }, - { "glutTimerFunc", (const void *) glutTimerFunc }, - { "glutMenuStateFunc", (const void *) glutMenuStateFunc }, - { "glutSpecialFunc", (const void *) glutSpecialFunc }, - { "glutSpaceballMotionFunc", (const void *) glutSpaceballMotionFunc }, - { "glutSpaceballRotateFunc", (const void *) glutSpaceballRotateFunc }, - { "glutSpaceballButtonFunc", (const void *) glutSpaceballButtonFunc }, - { "glutButtonBoxFunc", (const void *) glutButtonBoxFunc }, - { "glutDialsFunc", (const void *) glutDialsFunc }, - { "glutTabletMotionFunc", (const void *) glutTabletMotionFunc }, - { "glutTabletButtonFunc", (const void *) glutTabletButtonFunc }, - { "glutMenuStatusFunc", (const void *) glutMenuStatusFunc }, - { "glutOverlayDisplayFunc", (const void *) glutOverlayDisplayFunc }, - { "glutWindowStatusFunc", (const void *) glutWindowStatusFunc }, - { "glutKeyboardUpFunc", (const void *) glutKeyboardUpFunc }, - { "glutSpecialUpFunc", (const void *) glutSpecialUpFunc }, - { "glutJoystickFunc", (const void *) glutJoystickFunc }, - { "glutSetColor", (const void *) glutSetColor }, - { "glutGetColor", (const void *) glutGetColor }, - { "glutCopyColormap", (const void *) glutCopyColormap }, - { "glutGet", (const void *) glutGet }, - { "glutDeviceGet", (const void *) glutDeviceGet }, - { "glutExtensionSupported", (const void *) glutExtensionSupported }, - { "glutGetModifiers", (const void *) glutGetModifiers }, - { "glutLayerGet", (const void *) glutLayerGet }, - { "glutGetProcAddress", (const void *) glutGetProcAddress }, - { "glutBitmapCharacter", (const void *) glutBitmapCharacter }, - { "glutBitmapWidth", (const void *) glutBitmapWidth }, - { "glutStrokeCharacter", (const void *) glutStrokeCharacter }, - { "glutStrokeWidth", (const void *) glutStrokeWidth }, - { "glutBitmapLength", (const void *) glutBitmapLength }, - { "glutStrokeLength", (const void *) glutStrokeLength }, - { "glutWireSphere", (const void *) glutWireSphere }, - { "glutSolidSphere", (const void *) glutSolidSphere }, - { "glutWireCone", (const void *) glutWireCone }, - { "glutSolidCone", (const void *) glutSolidCone }, - { "glutWireCube", (const void *) glutWireCube }, - { "glutSolidCube", (const void *) glutSolidCube }, - { "glutWireTorus", (const void *) glutWireTorus }, - { "glutSolidTorus", (const void *) glutSolidTorus }, - { "glutWireDodecahedron", (const void *) glutWireDodecahedron }, - { "glutSolidDodecahedron", (const void *) glutSolidDodecahedron }, - { "glutWireTeapot", (const void *) glutWireTeapot }, - { "glutSolidTeapot", (const void *) glutSolidTeapot }, - { "glutWireOctahedron", (const void *) glutWireOctahedron }, - { "glutSolidOctahedron", (const void *) glutSolidOctahedron }, - { "glutWireTetrahedron", (const void *) glutWireTetrahedron }, - { "glutSolidTetrahedron", (const void *) glutSolidTetrahedron }, - { "glutWireIcosahedron", (const void *) glutWireIcosahedron }, - { "glutSolidIcosahedron", (const void *) glutSolidIcosahedron }, - { "glutVideoResizeGet", (const void *) glutVideoResizeGet }, - { "glutSetupVideoResizing", (const void *) glutSetupVideoResizing }, - { "glutStopVideoResizing", (const void *) glutStopVideoResizing }, - { "glutVideoResize", (const void *) glutVideoResize }, - { "glutVideoPan", (const void *) glutVideoPan }, - { "glutReportErrors", (const void *) glutReportErrors }, - { "glutIgnoreKeyRepeat", (const void *) glutIgnoreKeyRepeat }, - { "glutSetKeyRepeat", (const void *) glutSetKeyRepeat }, - { "glutForceJoystickFunc", (const void *) glutForceJoystickFunc }, - { "glutGameModeString", (const void *) glutGameModeString }, - { "glutEnterGameMode", (const void *) glutEnterGameMode }, - { "glutLeaveGameMode", (const void *) glutLeaveGameMode }, - { "glutGameModeGet", (const void *) glutGameModeGet }, - { NULL, NULL } -}; - - -/* XXX This isn't an official GLUT function, yet */ -void * GLUTAPIENTRY -glutGetProcAddress(const char *procName) -{ - /* Try GLUT functions first */ - int i; - for (i = 0; glut_functions[i].name; i++) { - if (strcmp(glut_functions[i].name, procName) == 0) - return (void *) glut_functions[i].address; - } - - /* Try core GL functions */ -#if defined(_WIN32) - return (void *) wglGetProcAddress((LPCSTR) procName); - -#elif defined(__OS2PM__) - return (void *) wglGetProcAddress((char *) procName); -#elif defined(GLX_ARB_get_proc_address) - return (void *) glXGetProcAddressARB((const GLubyte *) procName); -#else - return NULL; -#endif -} - - -/* ENDCENTRY */ diff --git a/src/glut/os2/glut_fullscrn.cpp b/src/glut/os2/glut_fullscrn.cpp deleted file mode 100644 index 584aba4fd8..0000000000 --- a/src/glut/os2/glut_fullscrn.cpp +++ /dev/null @@ -1,38 +0,0 @@ - -/* Copyright (c) Mark J. Kilgard, 1995, 1998. */ - -/* This program is freely distributable without licensing fees - and is provided without guarantee or warrantee expressed or - implied. This program is -not- in the public domain. */ - -#include - -#include "glutint.h" - -/* CENTRY */ -void GLUTAPIENTRY -glutFullScreen(void) -{ - assert(!__glutCurrentWindow->parent); - IGNORE_IN_GAME_MODE(); -#if !defined(_WIN32) && !defined(__OS2PM__) - if (__glutMotifHints == None) { - __glutMotifHints = XSGIFastInternAtom(__glutDisplay, "_MOTIF_WM_HINTS", - SGI_XA__MOTIF_WM_HINTS, 0); - if (__glutMotifHints == None) { - __glutWarning("Could not intern X atom for _MOTIF_WM_HINTS."); - } - } -#endif - - __glutCurrentWindow->desiredX = 0; - __glutCurrentWindow->desiredY = 0; - __glutCurrentWindow->desiredWidth = __glutScreenWidth; - __glutCurrentWindow->desiredHeight = __glutScreenHeight; - __glutCurrentWindow->desiredConfMask |= CWX | CWY | CWWidth | CWHeight; - - __glutPutOnWorkList(__glutCurrentWindow, - GLUT_CONFIGURE_WORK | GLUT_FULL_SCREEN_WORK); -} - -/* ENDCENTRY */ diff --git a/src/glut/os2/glut_gamemode.cpp b/src/glut/os2/glut_gamemode.cpp deleted file mode 100644 index 1756e8a4b5..0000000000 --- a/src/glut/os2/glut_gamemode.cpp +++ /dev/null @@ -1,679 +0,0 @@ - -/* Copyright (c) Mark J. Kilgard, 1998. */ - -/* This program is freely distributable without licensing fees - and is provided without guarantee or warrantee expressed or - implied. This program is -not- in the public domain. */ - - -#include -#include -#include -#include - -#include "glutint.h" - -#if !defined(_WIN32) && !defined(__OS2__) -#include -#include - -/* SGI optimization introduced in IRIX 6.3 to avoid X server - round trips for interning common X atoms. */ -#if defined(_SGI_EXTRA_PREDEFINES) && !defined(NO_FAST_ATOMS) -#include -#else -#define XSGIFastInternAtom(dpy,string,fast_name,how) XInternAtom(dpy,string,how) -#endif -#endif /* not _WIN32 */ - -int __glutDisplaySettingsChanged = 0; -static DisplayMode *dmodes, *currentDm = NULL; -static int ndmodes = -1; -GLUTwindow *__glutGameModeWindow = NULL; - -#ifdef TEST -static char *compstr[] = -{ - "none", "=", "!=", "<=", ">=", ">", "<", "~" -}; -static char *capstr[] = -{ - "width", "height", "bpp", "hertz", "num" -}; -#endif - -#if defined(__OS2__) -void -#else -void __cdecl -#endif -__glutCloseDownGameMode(void) -{ - if (__glutDisplaySettingsChanged) { -#ifdef _WIN32 - /* Assumes that display settings have been changed, that - is __glutDisplaySettingsChanged is true. */ - ChangeDisplaySettings(NULL, 0); -#endif - __glutDisplaySettingsChanged = 0; - } - __glutGameModeWindow = NULL; -} - -void GLUTAPIENTRY -glutLeaveGameMode(void) -{ - if (__glutGameModeWindow == NULL) { - __glutWarning("not in game mode so cannot leave game mode"); - return; - } - __glutDestroyWindow(__glutGameModeWindow, - __glutGameModeWindow); - XFlush(__glutDisplay); - __glutGameModeWindow = NULL; -} - -#ifdef _WIN32 - -/* Same values as from MSDN's SetDisp.c example. */ -#define MIN_WIDTH 400 -#define MIN_FREQUENCY 60 - -static void -initGameModeSupport(void) -{ - DEVMODE dm; - DWORD mode; - int i; - - if (ndmodes >= 0) { - /* ndmodes is initially -1 to indicate no - dmodes allocated yet. */ - return; - } - - /* Determine how many display modes there are. */ - ndmodes = 0; - mode = 0; - while (EnumDisplaySettings(NULL, mode, &dm)) { - if (dm.dmPelsWidth >= MIN_WIDTH && - (dm.dmDisplayFrequency == 0 || - dm.dmDisplayFrequency >= MIN_FREQUENCY)) { - ndmodes++; - } - mode++; - } - - /* Allocate memory for a list of all the display modes. */ - dmodes = (DisplayMode*) - malloc(ndmodes * sizeof(DisplayMode)); - - /* Now that we know how many display modes to expect, - enumerate them again and save the information in - the list we allocated above. */ - i = 0; - mode = 0; - while (EnumDisplaySettings(NULL, mode, &dm)) { - /* Try to reject any display settings that seem unplausible. */ - if (dm.dmPelsWidth >= MIN_WIDTH && - (dm.dmDisplayFrequency == 0 || - dm.dmDisplayFrequency >= MIN_FREQUENCY)) { - dmodes[i].devmode = dm; - dmodes[i].valid = 1; /* XXX Not used for now. */ - dmodes[i].cap[DM_WIDTH] = dm.dmPelsWidth; - dmodes[i].cap[DM_HEIGHT] = dm.dmPelsHeight; - dmodes[i].cap[DM_PIXEL_DEPTH] = dm.dmBitsPerPel; - if (dm.dmDisplayFrequency == 0) { - /* Guess a reasonable guess. */ - /* Lame Windows 95 version of EnumDisplaySettings. */ - dmodes[i].cap[DM_HERTZ] = 60; - } else { - dmodes[i].cap[DM_HERTZ] = dm.dmDisplayFrequency; - } - i++; - } - mode++; - } - - assert(i == ndmodes); -} - -#else - -/* X Windows version of initGameModeSupport. */ -static void -initGameModeSupport(void) -{ - if (ndmodes >= 0) { - /* ndmodes is initially -1 to indicate no - dmodes allocated yet. */ - return; - } - - /* Determine how many display modes there are. */ - ndmodes = 0; -} - -#endif - -/* This routine is based on similiar code in glut_dstr.c */ -static DisplayMode * -findMatch(DisplayMode * dmodes, int ndmodes, - Criterion * criteria, int ncriteria) -{ - DisplayMode *found; - int *bestScore, *thisScore; - int i, j, numok, result = 0, worse, better; - - found = NULL; - numok = 1; /* "num" capability is indexed from 1, - not 0. */ - - /* XXX alloca canidate. */ - bestScore = (int *) malloc(ncriteria * sizeof(int)); - if (!bestScore) { - __glutFatalError("out of memory."); - } - for (j = 0; j < ncriteria; j++) { - /* Very negative number. */ - bestScore[j] = -32768; - } - - /* XXX alloca canidate. */ - thisScore = (int *) malloc(ncriteria * sizeof(int)); - if (!thisScore) { - __glutFatalError("out of memory."); - } - - for (i = 0; i < ndmodes; i++) { - if (dmodes[i].valid) { - worse = 0; - better = 0; - - for (j = 0; j < ncriteria; j++) { - int cap, cvalue, dvalue; - - cap = criteria[j].capability; - cvalue = criteria[j].value; - if (cap == NUM) { - dvalue = numok; - } else { - dvalue = dmodes[i].cap[cap]; - } -#ifdef TEST - if (verbose) - printf(" %s %s %d to %d\n", - capstr[cap], compstr[criteria[j].comparison], cvalue, dvalue); -#endif - switch (criteria[j].comparison) { - case EQ: - result = cvalue == dvalue; - thisScore[j] = 1; - break; - case NEQ: - result = cvalue != dvalue; - thisScore[j] = 1; - break; - case LT: - result = dvalue < cvalue; - thisScore[j] = dvalue - cvalue; - break; - case GT: - result = dvalue > cvalue; - thisScore[j] = dvalue - cvalue; - break; - case LTE: - result = dvalue <= cvalue; - thisScore[j] = dvalue - cvalue; - break; - case GTE: - result = (dvalue >= cvalue); - thisScore[j] = dvalue - cvalue; - break; - case MIN: - result = dvalue >= cvalue; - thisScore[j] = cvalue - dvalue; - break; - } - -#ifdef TEST - if (verbose) - printf(" result=%d score=%d bestScore=%d\n", result, thisScore[j], bestScore[j]); -#endif - - if (result) { - if (better || thisScore[j] > bestScore[j]) { - better = 1; - } else if (thisScore[j] == bestScore[j]) { - /* Keep looking. */ - } else { - goto nextDM; - } - } else { - if (cap == NUM) { - worse = 1; - } else { - goto nextDM; - } - } - - } - - if (better && !worse) { - found = &dmodes[i]; - for (j = 0; j < ncriteria; j++) { - bestScore[j] = thisScore[j]; - } - } - numok++; - - nextDM:; - - } - } - free(bestScore); - free(thisScore); - return found; -} - -/** - * Parses strings in the form of: - * 800x600 - * 800x600:16 - * 800x600@60 - * 800x600:16@60 - * @60 - * :16 - * :16@60 - * NOTE that @ before : is not parsed. - */ -static int -specialCaseParse(char *word, Criterion * criterion, int mask) -{ - char *xstr, *response; - int got; - int width, height, bpp, hertz; - - switch(word[0]) { - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - /* The WWWxHHH case. */ - if (mask & (1 << DM_WIDTH)) { - return -1; - } - xstr = strpbrk(&word[1], "x"); - if (xstr) { - width = (int) strtol(word, &response, 0); - if (response == word || response[0] != 'x') { - /* Not a valid number OR needs to be followed by 'x'. */ - return -1; - } - height = (int) strtol(&xstr[1], &response, 0); - if (response == &xstr[1]) { - /* Not a valid number. */ - return -1; - } - criterion[0].capability = DM_WIDTH; - criterion[0].comparison = EQ; - criterion[0].value = width; - criterion[1].capability = DM_HEIGHT; - criterion[1].comparison = EQ; - criterion[1].value = height; - got = specialCaseParse(response, - &criterion[2], 1 << DM_WIDTH); - if (got >= 0) { - return got + 2; - } else { - return -1; - } - } - return -1; - case ':': - /* The :BPP case. */ - if (mask & (1 << DM_PIXEL_DEPTH)) { - return -1; - } - bpp = (int) strtol(&word[1], &response, 0); - if (response == &word[1]) { - /* Not a valid number. */ - return -1; - } - criterion[0].capability = DM_PIXEL_DEPTH; - criterion[0].comparison = EQ; - criterion[0].value = bpp; - got = specialCaseParse(response, - &criterion[1], (1 << DM_WIDTH) | (1 << DM_PIXEL_DEPTH)); - if (got >= 0) { - return got + 1; - } else { - return -1; - } - case '@': - /* The @HZ case. */ - if (mask & (1 << DM_HERTZ)) { - return -1; - } - hertz = (int) strtol(&word[1], &response, 0); - if (response == &word[1]) { - /* Not a valid number. */ - return -1; - } - criterion[0].capability = DM_HERTZ; - criterion[0].comparison = EQ; - criterion[0].value = hertz; - got = specialCaseParse(response, - &criterion[1], ~DM_HERTZ); - if (got >= 0) { - return got + 1; - } else { - return -1; - } - case '\0': - return 0; - } - return -1; -} - -/* This routine is based on similiar code in glut_dstr.c */ -static int -parseCriteria(char *word, Criterion * criterion) -{ - char *cstr, *vstr, *response; - int comparator, value = 0; - - cstr = strpbrk(word, "=>': - if (cstr[1] == '=') { - comparator = GTE; - vstr = &cstr[2]; - } else { - comparator = GT; - vstr = &cstr[1]; - } - break; - case '<': - if (cstr[1] == '=') { - comparator = LTE; - vstr = &cstr[2]; - } else { - comparator = LT; - vstr = &cstr[1]; - } - break; - case '!': - if (cstr[1] == '=') { - comparator = NEQ; - vstr = &cstr[2]; - } else { - return -1; - } - break; - default: - return -1; - } - value = (int) strtol(vstr, &response, 0); - if (response == vstr) { - /* Not a valid number. */ - return -1; - } - *cstr = '\0'; - } else { - comparator = NONE; - } - switch (word[0]) { - case 'b': - if (!strcmp(word, "bpp")) { - criterion[0].capability = DM_PIXEL_DEPTH; - if (comparator == NONE) { - return -1; - } else { - criterion[0].comparison = comparator; - criterion[0].value = value; - return 1; - } - } - return -1; - case 'h': - if (!strcmp(word, "height")) { - criterion[0].capability = DM_HEIGHT; - if (comparator == NONE) { - return -1; - } else { - criterion[0].comparison = comparator; - criterion[0].value = value; - return 1; - } - } - if (!strcmp(word, "hertz")) { - criterion[0].capability = DM_HERTZ; - if (comparator == NONE) { - return -1; - } else { - criterion[0].comparison = comparator; - criterion[0].value = value; - return 1; - } - } - return -1; - case 'n': - if (!strcmp(word, "num")) { - criterion[0].capability = DM_NUM; - if (comparator == NONE) { - return -1; - } else { - criterion[0].comparison = comparator; - criterion[0].value = value; - return 1; - } - } - return -1; - case 'w': - if (!strcmp(word, "width")) { - criterion[0].capability = DM_WIDTH; - if (comparator == NONE) { - return -1; - } else { - criterion[0].comparison = comparator; - criterion[0].value = value; - return 1; - } - } - return -1; - } - if (comparator == NONE) { - return specialCaseParse(word, criterion, 0); - } - return -1; -} - -/* This routine is based on similiar code in glut_dstr.c */ -static Criterion * -parseDisplayString(const char *display, int *ncriteria) -{ - Criterion *criteria = NULL; - int n, parsed; - char *copy, *word; - - copy = __glutStrdup(display); - /* Attempt to estimate how many criteria entries should be - needed. */ - n = 0; - word = strtok(copy, " \t"); - while (word) { - n++; - word = strtok(NULL, " \t"); - } - /* Allocate number of words of criteria. A word - could contain as many as four criteria in the - worst case. Example: 800x600:16@60 */ - criteria = (Criterion *) malloc(4 * n * sizeof(Criterion)); - if (!criteria) { - __glutFatalError("out of memory."); - } - - /* Re-copy the copy of the display string. */ - strcpy(copy, display); - - n = 0; - word = strtok(copy, " \t"); - while (word) { - parsed = parseCriteria(word, &criteria[n]); - if (parsed >= 0) { - n += parsed; - } else { - __glutWarning("Unrecognized game mode string word: %s (ignoring)\n", word); - } - word = strtok(NULL, " \t"); - } - - free(copy); - *ncriteria = n; - return criteria; -} - -void GLUTAPIENTRY -glutGameModeString(const char *string) -{ - Criterion *criteria; - int ncriteria; - - initGameModeSupport(); - criteria = parseDisplayString(string, &ncriteria); - currentDm = findMatch(dmodes, ndmodes, criteria, ncriteria); - free(criteria); -} - -int GLUTAPIENTRY -glutEnterGameMode(void) -{ - GLUTwindow *window; - int width, height; - Window win; - - if (__glutMappedMenu) { - __glutFatalUsage("entering game mode not allowed while menus in use"); - } - if (__glutGameModeWindow) { - /* Already in game mode, so blow away game mode - window so apps can change resolutions. */ - window = __glutGameModeWindow; - /* Setting the game mode window to NULL tricks - the window destroy code into not undoing the - screen display change since we plan on immediately - doing another mode change. */ - __glutGameModeWindow = NULL; - __glutDestroyWindow(window, window); - } - - /* Assume default screen size until we find out if we - can actually change the display settings. */ - width = __glutScreenWidth; - height = __glutScreenHeight; - - if (currentDm) { -#ifdef _WIN32 - LONG status; - static int registered = 0; - - status = ChangeDisplaySettings(¤tDm->devmode, - CDS_FULLSCREEN); - if (status == DISP_CHANGE_SUCCESSFUL) { - __glutDisplaySettingsChanged = 1; - width = currentDm->cap[DM_WIDTH]; - height = currentDm->cap[DM_HEIGHT]; - if (!registered) { - atexit(__glutCloseDownGameMode); - registered = 1; - } - } else { - /* Switch back to default resolution. */ - ChangeDisplaySettings(NULL, 0); - } -#endif - } - - window = __glutCreateWindow(NULL, 0, 0, - width, height, /* game mode */ 1); - win = window->win; - -#if !defined(_WIN32) && !defined(__OS2__) - if (__glutMotifHints == None) { - __glutMotifHints = XSGIFastInternAtom(__glutDisplay, "_MOTIF_WM_HINTS", - SGI_XA__MOTIF_WM_HINTS, 0); - if (__glutMotifHints == None) { - __glutWarning("Could not intern X atom for _MOTIF_WM_HINTS."); - } - } - - /* Game mode window is a toplevel window. */ - XSetWMProtocols(__glutDisplay, win, &__glutWMDeleteWindow, 1); -#endif - - /* Schedule the fullscreen property to be added and to - make sure the window is configured right. Win32 - doesn't need this. */ - window->desiredX = 0; - window->desiredY = 0; - window->desiredWidth = width; - window->desiredHeight = height; - window->desiredConfMask |= CWX | CWY | CWWidth | CWHeight; -#ifdef _WIN32 - /* Win32 does not want to use GLUT_FULL_SCREEN_WORK - for game mode because we need to be maximizing - the window in game mode, not just sizing it to - take up the full screen. The Win32-ness of game - mode happens when you pass 1 in the gameMode parameter - to __glutCreateWindow above. A gameMode of creates - a WS_POPUP window, not a standard WS_OVERLAPPEDWINDOW - window. WS_POPUP ensures the taskbar is hidden. */ - __glutPutOnWorkList(window, - GLUT_CONFIGURE_WORK); -#else - __glutPutOnWorkList(window, - GLUT_CONFIGURE_WORK | GLUT_FULL_SCREEN_WORK); -#endif - - __glutGameModeWindow = window; - return window->num + 1; -} - -int GLUTAPIENTRY -glutGameModeGet(GLenum mode) -{ - switch (mode) { - case GLUT_GAME_MODE_ACTIVE: - return __glutGameModeWindow != NULL; - case GLUT_GAME_MODE_POSSIBLE: - return currentDm != NULL; - case GLUT_GAME_MODE_WIDTH: - return currentDm ? currentDm->cap[DM_WIDTH] : -1; - case GLUT_GAME_MODE_HEIGHT: - return currentDm ? currentDm->cap[DM_HEIGHT] : -1; - case GLUT_GAME_MODE_PIXEL_DEPTH: - return currentDm ? currentDm->cap[DM_PIXEL_DEPTH] : -1; - case GLUT_GAME_MODE_REFRESH_RATE: - return currentDm ? currentDm->cap[DM_HERTZ] : -1; - case GLUT_GAME_MODE_DISPLAY_CHANGED: - return __glutDisplaySettingsChanged; - default: - return -1; - } -} diff --git a/src/glut/os2/glut_get.cpp b/src/glut/os2/glut_get.cpp deleted file mode 100644 index 8921e9ab03..0000000000 --- a/src/glut/os2/glut_get.cpp +++ /dev/null @@ -1,232 +0,0 @@ - -/* Copyright (c) Mark J. Kilgard, 1994, 1997, 1998. */ - -/* This program is freely distributable without licensing fees - and is provided without guarantee or warrantee expressed or - implied. This program is -not- in the public domain. */ - -#include -#include /* SunOS 4 needs NULL defined for GETTIMEOFDAY macro. */ -#include "glutint.h" - -/* CENTRY */ -int GLUTAPIENTRY -glutGet(GLenum param) -{ - Window win, root; - int x, y, value; - unsigned int width, height, border, depth; - - switch (param) { - case GLUT_INIT_WINDOW_X: - return __glutInitX; - case GLUT_INIT_WINDOW_Y: - return __glutInitY; - case GLUT_INIT_WINDOW_WIDTH: - return __glutInitWidth; - case GLUT_INIT_WINDOW_HEIGHT: - return __glutInitHeight; - case GLUT_INIT_DISPLAY_MODE: - return __glutDisplayMode; - case GLUT_WINDOW_X: - XTranslateCoordinates(__glutDisplay, __glutCurrentWindow->win, - __glutRoot, 0, 0, &x, &y, &win); - return x; - case GLUT_WINDOW_Y: - XTranslateCoordinates(__glutDisplay, __glutCurrentWindow->win, - __glutRoot, 0, 0, &x, &y, &win); - return y; - case GLUT_WINDOW_WIDTH: - if (!__glutCurrentWindow->reshape) { - XGetGeometry(__glutDisplay, __glutCurrentWindow->win, - &root, &x, &y, - &width, &height, &border, &depth); - return width; - } - return __glutCurrentWindow->width; - case GLUT_WINDOW_HEIGHT: - if (!__glutCurrentWindow->reshape) { - XGetGeometry(__glutDisplay, __glutCurrentWindow->win, - &root, &x, &y, - &width, &height, &border, &depth); - return height; - } - return __glutCurrentWindow->height; -#ifdef __OS2__ - #define GET_CONFIG(attrib) \ - { if (__glutCurrentWindow->renderWin == __glutCurrentWindow->win) \ - glXGetConfig( __glutCurrentWindow->vis, attrib, &value); \ - else \ - glXGetConfig(__glutCurrentWindow->overlay->vis, attrib, &value); \ - } \ - -#else - -#define GET_CONFIG(attrib) { \ - if (__glutCurrentWindow->renderWin == __glutCurrentWindow->win) { \ - glXGetConfig(__glutDisplay, __glutCurrentWindow->vis, \ - attrib, &value); \ - } else { \ - glXGetConfig(__glutDisplay, __glutCurrentWindow->overlay->vis, \ - attrib, &value); \ - } \ -} -#endif - - case GLUT_WINDOW_BUFFER_SIZE: - GET_CONFIG(GLX_BUFFER_SIZE); - return value; - case GLUT_WINDOW_STENCIL_SIZE: - GET_CONFIG(GLX_STENCIL_SIZE); - return value; - case GLUT_WINDOW_DEPTH_SIZE: - GET_CONFIG(GLX_DEPTH_SIZE); - return value; - case GLUT_WINDOW_RED_SIZE: - GET_CONFIG(GLX_RED_SIZE); - return value; - case GLUT_WINDOW_GREEN_SIZE: - GET_CONFIG(GLX_GREEN_SIZE); - return value; - case GLUT_WINDOW_BLUE_SIZE: - GET_CONFIG(GLX_BLUE_SIZE); - return value; - case GLUT_WINDOW_ALPHA_SIZE: - GET_CONFIG(GLX_ALPHA_SIZE); - return value; - case GLUT_WINDOW_ACCUM_RED_SIZE: - GET_CONFIG(GLX_ACCUM_RED_SIZE); - return value; - case GLUT_WINDOW_ACCUM_GREEN_SIZE: - GET_CONFIG(GLX_ACCUM_GREEN_SIZE); - return value; - case GLUT_WINDOW_ACCUM_BLUE_SIZE: - GET_CONFIG(GLX_ACCUM_BLUE_SIZE); - return value; - case GLUT_WINDOW_ACCUM_ALPHA_SIZE: - GET_CONFIG(GLX_ACCUM_ALPHA_SIZE); - return value; - case GLUT_WINDOW_DOUBLEBUFFER: - GET_CONFIG(GLX_DOUBLEBUFFER); - return value; - case GLUT_WINDOW_RGBA: - GET_CONFIG(GLX_RGBA); - return value; - case GLUT_WINDOW_COLORMAP_SIZE: - GET_CONFIG(GLX_RGBA); - if (value) { - return 0; - } else { -#if defined(_WIN32) || defined(__OS2__) - /* KLUDGE: we always assume 256 colors in CI mode on - Win32 */ - return 256; -#else - if (__glutCurrentWindow->renderWin == __glutCurrentWindow->win) { - return __glutCurrentWindow->vis->visual->map_entries; - } else { - return __glutCurrentWindow->overlay->vis->visual->map_entries; - } -#endif /* _WIN32 */ - } - case GLUT_WINDOW_PARENT: - return __glutCurrentWindow->parent ? - __glutCurrentWindow->parent->num + 1 : 0; - case GLUT_WINDOW_NUM_CHILDREN: - { - int num = 0; - GLUTwindow *children = __glutCurrentWindow->children; - - while (children) { - num++; - children = children->siblings; - } - return num; - } - case GLUT_WINDOW_NUM_SAMPLES: -#if defined(GLX_VERSION_1_1) && defined(GLX_SGIS_multisample) - if (__glutIsSupportedByGLX("GLX_SGIS_multisample")) { - GET_CONFIG(GLX_SAMPLES_SGIS); - return value; - } else { - return 0; - } -#else - /* Independent of GLX server support, multisampling not - supported by GLX client-side. */ - return 0; -#endif - case GLUT_WINDOW_STEREO: - GET_CONFIG(GLX_STEREO); - return value; - case GLUT_WINDOW_CURSOR: - return __glutCurrentWindow->cursor; - case GLUT_SCREEN_WIDTH: - return DisplayWidth(__glutDisplay, __glutScreen); - case GLUT_SCREEN_HEIGHT: - return DisplayHeight(__glutDisplay, __glutScreen); - case GLUT_SCREEN_WIDTH_MM: - return DisplayWidthMM(__glutDisplay, __glutScreen); - case GLUT_SCREEN_HEIGHT_MM: - return DisplayHeightMM(__glutDisplay, __glutScreen); - case GLUT_MENU_NUM_ITEMS: - return __glutCurrentMenu->num; - case GLUT_DISPLAY_MODE_POSSIBLE: - { - XVisualInfo *vi; - Bool dummy, visAlloced; - void *fbc; - -#if defined(_WIN32) - /* Our fake glXChooseVisual (which is called by - __glutDetermineVisual) needs an HDC to work with, so grab one - from the "root" window. */ - XHDC = GetDC(GetDesktopWindow()); -#endif - vi = __glutDetermineWindowVisual(&dummy, &visAlloced, &fbc); -#if defined(_WIN32) - ReleaseDC(GetDesktopWindow(), XHDC); -#endif - if (vi) { - if (visAlloced) - XFree(vi); - return 1; - } - return 0; - } - case GLUT_ELAPSED_TIME: - { -#ifdef OLD_VMS - struct timeval6 elapsed, beginning, now; -#else - struct timeval elapsed, beginning, now; -#endif - - __glutInitTime(&beginning); - GETTIMEOFDAY(&now); - TIMEDELTA(elapsed, now, beginning); - /* Return elapsed milliseconds. */ -#if defined(__vms) && ( __VMS_VER < 70000000 ) - return (int) (elapsed.val / TICKS_PER_MILLISECOND); -#else - return (int) ((elapsed.tv_sec * 1000) + (elapsed.tv_usec / 1000)); -#endif - } - case GLUT_WINDOW_FORMAT_ID: -#if defined(__OS2__) - return wglGetPixelFormat(__glutCurrentWindow->hdc); -#elif defined(_WIN32) - return GetPixelFormat(__glutCurrentWindow->hdc); -#else - if (__glutCurrentWindow->renderWin == __glutCurrentWindow->win) { - return (int) __glutCurrentWindow->vis->visualid; - } else { - return (int) __glutCurrentWindow->overlay->vis->visualid; - } -#endif - default: - __glutWarning("invalid glutGet parameter: %d", param); - return -1; - } -} -/* ENDCENTRY */ diff --git a/src/glut/os2/glut_hel10.cpp b/src/glut/os2/glut_hel10.cpp deleted file mode 100644 index a9f08ff133..0000000000 --- a/src/glut/os2/glut_hel10.cpp +++ /dev/null @@ -1,1781 +0,0 @@ - -/* GENERATED FILE -- DO NOT MODIFY */ - -#define glutBitmapHelvetica10 XXX -#include "glutbitmap.h" -#undef glutBitmapHelvetica10 - -/* char: 0xff */ - -static const GLubyte ch255data[] = { -0x80,0x40,0x40,0x60,0xa0,0xa0,0x90,0x90,0x0,0x50, -}; - -static const BitmapCharRec ch255 = {4,10,0,2,5,ch255data}; - -/* char: 0xfe */ - -static const GLubyte ch254data[] = { -0x80,0x80,0xb0,0xc8,0x88,0x88,0xc8,0xb0,0x80,0x80, -}; - -static const BitmapCharRec ch254 = {5,10,0,2,6,ch254data}; - -/* char: 0xfd */ - -static const GLubyte ch253data[] = { -0x80,0x40,0x40,0x60,0xa0,0xa0,0x90,0x90,0x0,0x20,0x10, -}; - -static const BitmapCharRec ch253 = {4,11,0,2,5,ch253data}; - -/* char: 0xfc */ - -static const GLubyte ch252data[] = { -0x70,0x90,0x90,0x90,0x90,0x90,0x0,0x50, -}; - -static const BitmapCharRec ch252 = {4,8,0,0,5,ch252data}; - -/* char: 0xfb */ - -static const GLubyte ch251data[] = { -0x70,0x90,0x90,0x90,0x90,0x90,0x0,0x50,0x20, -}; - -static const BitmapCharRec ch251 = {4,9,0,0,5,ch251data}; - -/* char: 0xfa */ - -static const GLubyte ch250data[] = { -0x70,0x90,0x90,0x90,0x90,0x90,0x0,0x40,0x20, -}; - -static const BitmapCharRec ch250 = {4,9,0,0,5,ch250data}; - -/* char: 0xf9 */ - -static const GLubyte ch249data[] = { -0x70,0x90,0x90,0x90,0x90,0x90,0x0,0x20,0x40, -}; - -static const BitmapCharRec ch249 = {4,9,0,0,5,ch249data}; - -/* char: 0xf8 */ - -static const GLubyte ch248data[] = { -0x70,0x88,0xc8,0xa8,0x98,0x74, -}; - -static const BitmapCharRec ch248 = {6,6,0,0,6,ch248data}; - -/* char: 0xf7 */ - -static const GLubyte ch247data[] = { -0x20,0x0,0xf8,0x0,0x20, -}; - -static const BitmapCharRec ch247 = {5,5,0,-1,6,ch247data}; - -/* char: 0xf6 */ - -static const GLubyte ch246data[] = { -0x70,0x88,0x88,0x88,0x88,0x70,0x0,0x50, -}; - -static const BitmapCharRec ch246 = {5,8,0,0,6,ch246data}; - -/* char: 0xf5 */ - -static const GLubyte ch245data[] = { -0x70,0x88,0x88,0x88,0x88,0x70,0x0,0x50,0x28, -}; - -static const BitmapCharRec ch245 = {5,9,0,0,6,ch245data}; - -/* char: 0xf4 */ - -static const GLubyte ch244data[] = { -0x70,0x88,0x88,0x88,0x88,0x70,0x0,0x50,0x20, -}; - -static const BitmapCharRec ch244 = {5,9,0,0,6,ch244data}; - -/* char: 0xf3 */ - -static const GLubyte ch243data[] = { -0x70,0x88,0x88,0x88,0x88,0x70,0x0,0x20,0x10, -}; - -static const BitmapCharRec ch243 = {5,9,0,0,6,ch243data}; - -/* char: 0xf2 */ - -static const GLubyte ch242data[] = { -0x70,0x88,0x88,0x88,0x88,0x70,0x0,0x20,0x40, -}; - -static const BitmapCharRec ch242 = {5,9,0,0,6,ch242data}; - -/* char: 0xf1 */ - -static const GLubyte ch241data[] = { -0x90,0x90,0x90,0x90,0x90,0xe0,0x0,0xa0,0x50, -}; - -static const BitmapCharRec ch241 = {4,9,0,0,5,ch241data}; - -/* char: 0xf0 */ - -static const GLubyte ch240data[] = { -0x70,0x88,0x88,0x88,0x88,0x78,0x90,0x60,0x50, -}; - -static const BitmapCharRec ch240 = {5,9,0,0,6,ch240data}; - -/* char: 0xef */ - -static const GLubyte ch239data[] = { -0x40,0x40,0x40,0x40,0x40,0x40,0x0,0xa0, -}; - -static const BitmapCharRec ch239 = {3,8,0,0,2,ch239data}; - -/* char: 0xee */ - -static const GLubyte ch238data[] = { -0x40,0x40,0x40,0x40,0x40,0x40,0x0,0xa0,0x40, -}; - -static const BitmapCharRec ch238 = {3,9,1,0,2,ch238data}; - -/* char: 0xed */ - -static const GLubyte ch237data[] = { -0x80,0x80,0x80,0x80,0x80,0x80,0x0,0x80,0x40, -}; - -static const BitmapCharRec ch237 = {2,9,0,0,2,ch237data}; - -/* char: 0xec */ - -static const GLubyte ch236data[] = { -0x40,0x40,0x40,0x40,0x40,0x40,0x0,0x40,0x80, -}; - -static const BitmapCharRec ch236 = {2,9,1,0,2,ch236data}; - -/* char: 0xeb */ - -static const GLubyte ch235data[] = { -0x60,0x90,0x80,0xf0,0x90,0x60,0x0,0x50, -}; - -static const BitmapCharRec ch235 = {4,8,0,0,5,ch235data}; - -/* char: 0xea */ - -static const GLubyte ch234data[] = { -0x60,0x90,0x80,0xf0,0x90,0x60,0x0,0x50,0x20, -}; - -static const BitmapCharRec ch234 = {4,9,0,0,5,ch234data}; - -/* char: 0xe9 */ - -static const GLubyte ch233data[] = { -0x60,0x90,0x80,0xf0,0x90,0x60,0x0,0x40,0x20, -}; - -static const BitmapCharRec ch233 = {4,9,0,0,5,ch233data}; - -/* char: 0xe8 */ - -static const GLubyte ch232data[] = { -0x60,0x90,0x80,0xf0,0x90,0x60,0x0,0x20,0x40, -}; - -static const BitmapCharRec ch232 = {4,9,0,0,5,ch232data}; - -/* char: 0xe7 */ - -static const GLubyte ch231data[] = { -0x60,0x20,0x60,0x90,0x80,0x80,0x90,0x60, -}; - -static const BitmapCharRec ch231 = {4,8,0,2,5,ch231data}; - -/* char: 0xe6 */ - -static const GLubyte ch230data[] = { -0x6c,0x92,0x90,0x7e,0x12,0xec, -}; - -static const BitmapCharRec ch230 = {7,6,0,0,8,ch230data}; - -/* char: 0xe5 */ - -static const GLubyte ch229data[] = { -0x68,0x90,0x90,0x70,0x10,0xe0,0x20,0x50,0x20, -}; - -static const BitmapCharRec ch229 = {5,9,0,0,5,ch229data}; - -/* char: 0xe4 */ - -static const GLubyte ch228data[] = { -0x68,0x90,0x90,0x70,0x10,0xe0,0x0,0x50, -}; - -static const BitmapCharRec ch228 = {5,8,0,0,5,ch228data}; - -/* char: 0xe3 */ - -static const GLubyte ch227data[] = { -0x68,0x90,0x90,0x70,0x10,0xe0,0x0,0xa0,0x50, -}; - -static const BitmapCharRec ch227 = {5,9,0,0,5,ch227data}; - -/* char: 0xe2 */ - -static const GLubyte ch226data[] = { -0x68,0x90,0x90,0x70,0x10,0xe0,0x0,0x50,0x20, -}; - -static const BitmapCharRec ch226 = {5,9,0,0,5,ch226data}; - -/* char: 0xe1 */ - -static const GLubyte ch225data[] = { -0x68,0x90,0x90,0x70,0x10,0xe0,0x0,0x20,0x10, -}; - -static const BitmapCharRec ch225 = {5,9,0,0,5,ch225data}; - -/* char: 0xe0 */ - -static const GLubyte ch224data[] = { -0x68,0x90,0x90,0x70,0x10,0xe0,0x0,0x20,0x40, -}; - -static const BitmapCharRec ch224 = {5,9,0,0,5,ch224data}; - -/* char: 0xdf */ - -static const GLubyte ch223data[] = { -0xa0,0x90,0x90,0x90,0xa0,0x90,0x90,0x60, -}; - -static const BitmapCharRec ch223 = {4,8,0,0,5,ch223data}; - -/* char: 0xde */ - -static const GLubyte ch222data[] = { -0x80,0x80,0xf0,0x88,0x88,0xf0,0x80,0x80, -}; - -static const BitmapCharRec ch222 = {5,8,-1,0,7,ch222data}; - -/* char: 0xdd */ - -static const GLubyte ch221data[] = { -0x10,0x10,0x10,0x28,0x28,0x44,0x44,0x82,0x0,0x10,0x8, -}; - -static const BitmapCharRec ch221 = {7,11,0,0,7,ch221data}; - -/* char: 0xdc */ - -static const GLubyte ch220data[] = { -0x78,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x0,0x48, -}; - -static const BitmapCharRec ch220 = {6,10,-1,0,8,ch220data}; - -/* char: 0xdb */ - -static const GLubyte ch219data[] = { -0x78,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x0,0x28,0x10, -}; - -static const BitmapCharRec ch219 = {6,11,-1,0,8,ch219data}; - -/* char: 0xda */ - -static const GLubyte ch218data[] = { -0x78,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x0,0x20,0x10, -}; - -static const BitmapCharRec ch218 = {6,11,-1,0,8,ch218data}; - -/* char: 0xd9 */ - -static const GLubyte ch217data[] = { -0x78,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x0,0x10,0x20, -}; - -static const BitmapCharRec ch217 = {6,11,-1,0,8,ch217data}; - -/* char: 0xd8 */ - -static const GLubyte ch216data[] = { -0x80,0x78,0xc4,0xa4,0xa4,0x94,0x94,0x8c,0x78,0x4, -}; - -static const BitmapCharRec ch216 = {6,10,-1,1,8,ch216data}; - -/* char: 0xd7 */ - -static const GLubyte ch215data[] = { -0x88,0x50,0x20,0x50,0x88, -}; - -static const BitmapCharRec ch215 = {5,5,0,-1,6,ch215data}; - -/* char: 0xd6 */ - -static const GLubyte ch214data[] = { -0x78,0x84,0x84,0x84,0x84,0x84,0x84,0x78,0x0,0x48, -}; - -static const BitmapCharRec ch214 = {6,10,-1,0,8,ch214data}; - -/* char: 0xd5 */ - -static const GLubyte ch213data[] = { -0x78,0x84,0x84,0x84,0x84,0x84,0x84,0x78,0x0,0x50,0x28, -}; - -static const BitmapCharRec ch213 = {6,11,-1,0,8,ch213data}; - -/* char: 0xd4 */ - -static const GLubyte ch212data[] = { -0x78,0x84,0x84,0x84,0x84,0x84,0x84,0x78,0x0,0x28,0x10, -}; - -static const BitmapCharRec ch212 = {6,11,-1,0,8,ch212data}; - -/* char: 0xd3 */ - -static const GLubyte ch211data[] = { -0x78,0x84,0x84,0x84,0x84,0x84,0x84,0x78,0x0,0x10,0x8, -}; - -static const BitmapCharRec ch211 = {6,11,-1,0,8,ch211data}; - -/* char: 0xd2 */ - -static const GLubyte ch210data[] = { -0x78,0x84,0x84,0x84,0x84,0x84,0x84,0x78,0x0,0x10,0x20, -}; - -static const BitmapCharRec ch210 = {6,11,-1,0,8,ch210data}; - -/* char: 0xd1 */ - -static const GLubyte ch209data[] = { -0x8c,0x8c,0x94,0x94,0xa4,0xa4,0xc4,0xc4,0x0,0x50,0x28, -}; - -static const BitmapCharRec ch209 = {6,11,-1,0,8,ch209data}; - -/* char: 0xd0 */ - -static const GLubyte ch208data[] = { -0x78,0x44,0x42,0x42,0xf2,0x42,0x44,0x78, -}; - -static const BitmapCharRec ch208 = {7,8,0,0,8,ch208data}; - -/* char: 0xcf */ - -static const GLubyte ch207data[] = { -0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x0,0xa0, -}; - -static const BitmapCharRec ch207 = {3,10,0,0,3,ch207data}; - -/* char: 0xce */ - -static const GLubyte ch206data[] = { -0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x0,0xa0,0x40, -}; - -static const BitmapCharRec ch206 = {3,11,0,0,3,ch206data}; - -/* char: 0xcd */ - -static const GLubyte ch205data[] = { -0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x0,0x80,0x40, -}; - -static const BitmapCharRec ch205 = {2,11,-1,0,3,ch205data}; - -/* char: 0xcc */ - -static const GLubyte ch204data[] = { -0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x0,0x40,0x80, -}; - -static const BitmapCharRec ch204 = {2,11,0,0,3,ch204data}; - -/* char: 0xcb */ - -static const GLubyte ch203data[] = { -0xf8,0x80,0x80,0x80,0xf8,0x80,0x80,0xf8,0x0,0x50, -}; - -static const BitmapCharRec ch203 = {5,10,-1,0,7,ch203data}; - -/* char: 0xca */ - -static const GLubyte ch202data[] = { -0xf8,0x80,0x80,0xf8,0x80,0x80,0x80,0xf8,0x0,0x50,0x20, -}; - -static const BitmapCharRec ch202 = {5,11,-1,0,7,ch202data}; - -/* char: 0xc9 */ - -static const GLubyte ch201data[] = { -0xf8,0x80,0x80,0x80,0xf8,0x80,0x80,0xf8,0x0,0x20,0x10, -}; - -static const BitmapCharRec ch201 = {5,11,-1,0,7,ch201data}; - -/* char: 0xc8 */ - -static const GLubyte ch200data[] = { -0xf8,0x80,0x80,0x80,0xf8,0x80,0x80,0xf8,0x0,0x20,0x40, -}; - -static const BitmapCharRec ch200 = {5,11,-1,0,7,ch200data}; - -/* char: 0xc7 */ - -static const GLubyte ch199data[] = { -0x30,0x10,0x78,0x84,0x80,0x80,0x80,0x80,0x84,0x78, -}; - -static const BitmapCharRec ch199 = {6,10,-1,2,8,ch199data}; - -/* char: 0xc6 */ - -static const GLubyte ch198data[] = { -0x8f,0x80,0x88,0x0,0x78,0x0,0x48,0x0,0x2f,0x80,0x28,0x0,0x18,0x0,0x1f,0x80, -}; - -static const BitmapCharRec ch198 = {9,8,0,0,10,ch198data}; - -/* char: 0xc5 */ - -static const GLubyte ch197data[] = { -0x82,0x82,0x7c,0x44,0x28,0x28,0x10,0x10,0x10,0x28,0x10, -}; - -static const BitmapCharRec ch197 = {7,11,0,0,7,ch197data}; - -/* char: 0xc4 */ - -static const GLubyte ch196data[] = { -0x82,0x82,0x7c,0x44,0x28,0x28,0x10,0x10,0x0,0x28, -}; - -static const BitmapCharRec ch196 = {7,10,0,0,7,ch196data}; - -/* char: 0xc3 */ - -static const GLubyte ch195data[] = { -0x82,0x82,0x7c,0x44,0x28,0x28,0x10,0x10,0x0,0x28,0x14, -}; - -static const BitmapCharRec ch195 = {7,11,0,0,7,ch195data}; - -/* char: 0xc2 */ - -static const GLubyte ch194data[] = { -0x82,0x82,0x7c,0x44,0x28,0x28,0x10,0x10,0x0,0x28,0x10, -}; - -static const BitmapCharRec ch194 = {7,11,0,0,7,ch194data}; - -/* char: 0xc1 */ - -static const GLubyte ch193data[] = { -0x82,0x82,0x7c,0x44,0x28,0x28,0x10,0x10,0x0,0x10,0x8, -}; - -static const BitmapCharRec ch193 = {7,11,0,0,7,ch193data}; - -/* char: 0xc0 */ - -static const GLubyte ch192data[] = { -0x82,0x82,0x7c,0x44,0x28,0x28,0x10,0x10,0x0,0x10,0x20, -}; - -static const BitmapCharRec ch192 = {7,11,0,0,7,ch192data}; - -/* char: 0xbf */ - -static const GLubyte ch191data[] = { -0x60,0x90,0x80,0x40,0x20,0x20,0x0,0x20, -}; - -static const BitmapCharRec ch191 = {4,8,-1,2,6,ch191data}; - -/* char: 0xbe */ - -static const GLubyte ch190data[] = { -0x21,0x0,0x17,0x80,0x13,0x0,0x9,0x0,0xc8,0x0,0x24,0x0,0x44,0x0,0xe2,0x0, -}; - -static const BitmapCharRec ch190 = {9,8,0,0,9,ch190data}; - -/* char: 0xbd */ - -static const GLubyte ch189data[] = { -0x27,0x12,0x15,0xb,0x48,0x44,0xc4,0x42, -}; - -static const BitmapCharRec ch189 = {8,8,0,0,9,ch189data}; - -/* char: 0xbc */ - -static const GLubyte ch188data[] = { -0x21,0x0,0x17,0x80,0x13,0x0,0x9,0x0,0x48,0x0,0x44,0x0,0xc4,0x0,0x42,0x0, -}; - -static const BitmapCharRec ch188 = {9,8,0,0,9,ch188data}; - -/* char: 0xbb */ - -static const GLubyte ch187data[] = { -0xa0,0x50,0x28,0x50,0xa0, -}; - -static const BitmapCharRec ch187 = {5,5,0,0,6,ch187data}; - -/* char: 0xba */ - -static const GLubyte ch186data[] = { -0xe0,0x0,0xe0,0xa0,0xe0, -}; - -static const BitmapCharRec ch186 = {3,5,0,-3,4,ch186data}; - -/* char: 0xb9 */ - -static const GLubyte ch185data[] = { -0x40,0x40,0xc0,0x40, -}; - -static const BitmapCharRec ch185 = {2,4,0,-3,3,ch185data}; - -/* char: 0xb8 */ - -static const GLubyte ch184data[] = { -0xc0,0x40, -}; - -static const BitmapCharRec ch184 = {2,2,0,2,3,ch184data}; - -/* char: 0xb7 */ - -static const GLubyte ch183data[] = { -0xc0, -}; - -static const BitmapCharRec ch183 = {2,1,0,-3,3,ch183data}; - -/* char: 0xb6 */ - -static const GLubyte ch182data[] = { -0x28,0x28,0x28,0x28,0x28,0x68,0xe8,0xe8,0xe8,0x7c, -}; - -static const BitmapCharRec ch182 = {6,10,0,2,6,ch182data}; - -/* char: 0xb5 */ - -static const GLubyte ch181data[] = { -0x80,0x80,0xf0,0x90,0x90,0x90,0x90,0x90, -}; - -static const BitmapCharRec ch181 = {4,8,0,2,5,ch181data}; - -/* char: 0xb4 */ - -static const GLubyte ch180data[] = { -0x80,0x40, -}; - -static const BitmapCharRec ch180 = {2,2,0,-6,3,ch180data}; - -/* char: 0xb3 */ - -static const GLubyte ch179data[] = { -0xc0,0x20,0x40,0xe0, -}; - -static const BitmapCharRec ch179 = {3,4,0,-3,3,ch179data}; - -/* char: 0xb2 */ - -static const GLubyte ch178data[] = { -0xe0,0x40,0xa0,0x60, -}; - -static const BitmapCharRec ch178 = {3,4,0,-3,3,ch178data}; - -/* char: 0xb1 */ - -static const GLubyte ch177data[] = { -0xf8,0x0,0x20,0x20,0xf8,0x20,0x20, -}; - -static const BitmapCharRec ch177 = {5,7,0,0,6,ch177data}; - -/* char: 0xb0 */ - -static const GLubyte ch176data[] = { -0x60,0x90,0x90,0x60, -}; - -static const BitmapCharRec ch176 = {4,4,0,-3,4,ch176data}; - -/* char: 0xaf */ - -static const GLubyte ch175data[] = { -0xe0, -}; - -static const BitmapCharRec ch175 = {3,1,0,-7,3,ch175data}; - -/* char: 0xae */ - -static const GLubyte ch174data[] = { -0x38,0x44,0xaa,0xb2,0xba,0x44,0x38, -}; - -static const BitmapCharRec ch174 = {7,7,-1,0,9,ch174data}; - -/* char: 0xad */ - -static const GLubyte ch173data[] = { -0xe0, -}; - -static const BitmapCharRec ch173 = {3,1,0,-3,4,ch173data}; - -/* char: 0xac */ - -static const GLubyte ch172data[] = { -0x8,0x8,0xf8, -}; - -static const BitmapCharRec ch172 = {5,3,-1,-2,7,ch172data}; - -/* char: 0xab */ - -static const GLubyte ch171data[] = { -0x28,0x50,0xa0,0x50,0x28, -}; - -static const BitmapCharRec ch171 = {5,5,0,0,6,ch171data}; - -/* char: 0xaa */ - -static const GLubyte ch170data[] = { -0xe0,0x0,0xa0,0x20,0xe0, -}; - -static const BitmapCharRec ch170 = {3,5,0,-3,4,ch170data}; - -/* char: 0xa9 */ - -static const GLubyte ch169data[] = { -0x38,0x44,0x9a,0xa2,0x9a,0x44,0x38, -}; - -static const BitmapCharRec ch169 = {7,7,-1,0,9,ch169data}; - -/* char: 0xa8 */ - -static const GLubyte ch168data[] = { -0xa0, -}; - -static const BitmapCharRec ch168 = {3,1,0,-7,3,ch168data}; - -/* char: 0xa7 */ - -static const GLubyte ch167data[] = { -0x70,0x88,0x18,0x70,0xc8,0x98,0x70,0xc0,0x88,0x70, -}; - -static const BitmapCharRec ch167 = {5,10,0,2,6,ch167data}; - -/* char: 0xa6 */ - -static const GLubyte ch166data[] = { -0x80,0x80,0x80,0x80,0x0,0x0,0x80,0x80,0x80,0x80, -}; - -static const BitmapCharRec ch166 = {1,10,-1,2,3,ch166data}; - -/* char: 0xa5 */ - -static const GLubyte ch165data[] = { -0x20,0xf8,0x20,0xf8,0x50,0x50,0x88,0x88, -}; - -static const BitmapCharRec ch165 = {5,8,0,0,6,ch165data}; - -/* char: 0xa4 */ - -static const GLubyte ch164data[] = { -0x90,0x60,0x90,0x90,0x60,0x90, -}; - -static const BitmapCharRec ch164 = {4,6,0,-1,5,ch164data}; - -/* char: 0xa3 */ - -static const GLubyte ch163data[] = { -0xb0,0x48,0x40,0x40,0xe0,0x40,0x48,0x30, -}; - -static const BitmapCharRec ch163 = {5,8,0,0,6,ch163data}; - -/* char: 0xa2 */ - -static const GLubyte ch162data[] = { -0x40,0x70,0xa8,0xa0,0xa0,0xa8,0x70,0x10, -}; - -static const BitmapCharRec ch162 = {5,8,0,1,6,ch162data}; - -/* char: 0xa1 */ - -static const GLubyte ch161data[] = { -0x80,0x80,0x80,0x80,0x80,0x80,0x0,0x80, -}; - -static const BitmapCharRec ch161 = {1,8,-1,2,3,ch161data}; - -/* char: 0xa0 */ - -#ifdef _WIN32 -/* XXX Work around Microsoft OpenGL 1.1 bug where glBitmap with - a height or width of zero does not advance the raster position - as specified by OpenGL. (Cosmo OpenGL does not have this bug.) */ -static const GLubyte ch160data[] = { 0x0 }; -static const BitmapCharRec ch160 = {1,1,0,0,3,ch160data}; -#else -static const BitmapCharRec ch160 = {0,0,0,0,3,0}; -#endif - -/* char: 0x7e '~' */ - -static const GLubyte ch126data[] = { -0x98,0x64, -}; - -static const BitmapCharRec ch126 = {6,2,0,-3,7,ch126data}; - -/* char: 0x7d '}' */ - -static const GLubyte ch125data[] = { -0x80,0x40,0x40,0x40,0x40,0x20,0x40,0x40,0x40,0x80, -}; - -static const BitmapCharRec ch125 = {3,10,0,2,3,ch125data}; - -/* char: 0x7c '|' */ - -static const GLubyte ch124data[] = { -0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80, -}; - -static const BitmapCharRec ch124 = {1,10,-1,2,3,ch124data}; - -/* char: 0x7b '{' */ - -static const GLubyte ch123data[] = { -0x20,0x40,0x40,0x40,0x40,0x80,0x40,0x40,0x40,0x20, -}; - -static const BitmapCharRec ch123 = {3,10,0,2,3,ch123data}; - -/* char: 0x7a 'z' */ - -static const GLubyte ch122data[] = { -0xf0,0x80,0x40,0x20,0x10,0xf0, -}; - -static const BitmapCharRec ch122 = {4,6,0,0,5,ch122data}; - -/* char: 0x79 'y' */ - -static const GLubyte ch121data[] = { -0x80,0x40,0x40,0x60,0xa0,0xa0,0x90,0x90, -}; - -static const BitmapCharRec ch121 = {4,8,0,2,5,ch121data}; - -/* char: 0x78 'x' */ - -static const GLubyte ch120data[] = { -0x88,0x88,0x50,0x20,0x50,0x88, -}; - -static const BitmapCharRec ch120 = {5,6,0,0,6,ch120data}; - -/* char: 0x77 'w' */ - -static const GLubyte ch119data[] = { -0x28,0x28,0x54,0x54,0x92,0x92, -}; - -static const BitmapCharRec ch119 = {7,6,0,0,8,ch119data}; - -/* char: 0x76 'v' */ - -static const GLubyte ch118data[] = { -0x20,0x20,0x50,0x50,0x88,0x88, -}; - -static const BitmapCharRec ch118 = {5,6,0,0,6,ch118data}; - -/* char: 0x75 'u' */ - -static const GLubyte ch117data[] = { -0x70,0x90,0x90,0x90,0x90,0x90, -}; - -static const BitmapCharRec ch117 = {4,6,0,0,5,ch117data}; - -/* char: 0x74 't' */ - -static const GLubyte ch116data[] = { -0x60,0x40,0x40,0x40,0x40,0xe0,0x40,0x40, -}; - -static const BitmapCharRec ch116 = {3,8,0,0,4,ch116data}; - -/* char: 0x73 's' */ - -static const GLubyte ch115data[] = { -0x60,0x90,0x10,0x60,0x90,0x60, -}; - -static const BitmapCharRec ch115 = {4,6,0,0,5,ch115data}; - -/* char: 0x72 'r' */ - -static const GLubyte ch114data[] = { -0x80,0x80,0x80,0x80,0xc0,0xa0, -}; - -static const BitmapCharRec ch114 = {3,6,0,0,4,ch114data}; - -/* char: 0x71 'q' */ - -static const GLubyte ch113data[] = { -0x8,0x8,0x68,0x98,0x88,0x88,0x98,0x68, -}; - -static const BitmapCharRec ch113 = {5,8,0,2,6,ch113data}; - -/* char: 0x70 'p' */ - -static const GLubyte ch112data[] = { -0x80,0x80,0xb0,0xc8,0x88,0x88,0xc8,0xb0, -}; - -static const BitmapCharRec ch112 = {5,8,0,2,6,ch112data}; - -/* char: 0x6f 'o' */ - -static const GLubyte ch111data[] = { -0x70,0x88,0x88,0x88,0x88,0x70, -}; - -static const BitmapCharRec ch111 = {5,6,0,0,6,ch111data}; - -/* char: 0x6e 'n' */ - -static const GLubyte ch110data[] = { -0x88,0x88,0x88,0x88,0xc8,0xb0, -}; - -static const BitmapCharRec ch110 = {5,6,0,0,6,ch110data}; - -/* char: 0x6d 'm' */ - -static const GLubyte ch109data[] = { -0x92,0x92,0x92,0x92,0x92,0xec, -}; - -static const BitmapCharRec ch109 = {7,6,0,0,8,ch109data}; - -/* char: 0x6c 'l' */ - -static const GLubyte ch108data[] = { -0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80, -}; - -static const BitmapCharRec ch108 = {1,8,0,0,2,ch108data}; - -/* char: 0x6b 'k' */ - -static const GLubyte ch107data[] = { -0x90,0x90,0xa0,0xc0,0xa0,0x90,0x80,0x80, -}; - -static const BitmapCharRec ch107 = {4,8,0,0,5,ch107data}; - -/* char: 0x6a 'j' */ - -static const GLubyte ch106data[] = { -0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x0,0x80, -}; - -static const BitmapCharRec ch106 = {1,9,0,1,2,ch106data}; - -/* char: 0x69 'i' */ - -static const GLubyte ch105data[] = { -0x80,0x80,0x80,0x80,0x80,0x80,0x0,0x80, -}; - -static const BitmapCharRec ch105 = {1,8,0,0,2,ch105data}; - -/* char: 0x68 'h' */ - -static const GLubyte ch104data[] = { -0x88,0x88,0x88,0x88,0xc8,0xb0,0x80,0x80, -}; - -static const BitmapCharRec ch104 = {5,8,0,0,6,ch104data}; - -/* char: 0x67 'g' */ - -static const GLubyte ch103data[] = { -0x70,0x8,0x68,0x98,0x88,0x88,0x98,0x68, -}; - -static const BitmapCharRec ch103 = {5,8,0,2,6,ch103data}; - -/* char: 0x66 'f' */ - -static const GLubyte ch102data[] = { -0x40,0x40,0x40,0x40,0x40,0xe0,0x40,0x30, -}; - -static const BitmapCharRec ch102 = {4,8,0,0,4,ch102data}; - -/* char: 0x65 'e' */ - -static const GLubyte ch101data[] = { -0x60,0x90,0x80,0xf0,0x90,0x60, -}; - -static const BitmapCharRec ch101 = {4,6,0,0,5,ch101data}; - -/* char: 0x64 'd' */ - -static const GLubyte ch100data[] = { -0x68,0x98,0x88,0x88,0x98,0x68,0x8,0x8, -}; - -static const BitmapCharRec ch100 = {5,8,0,0,6,ch100data}; - -/* char: 0x63 'c' */ - -static const GLubyte ch99data[] = { -0x60,0x90,0x80,0x80,0x90,0x60, -}; - -static const BitmapCharRec ch99 = {4,6,0,0,5,ch99data}; - -/* char: 0x62 'b' */ - -static const GLubyte ch98data[] = { -0xb0,0xc8,0x88,0x88,0xc8,0xb0,0x80,0x80, -}; - -static const BitmapCharRec ch98 = {5,8,0,0,6,ch98data}; - -/* char: 0x61 'a' */ - -static const GLubyte ch97data[] = { -0x68,0x90,0x90,0x70,0x10,0xe0, -}; - -static const BitmapCharRec ch97 = {5,6,0,0,5,ch97data}; - -/* char: 0x60 '`' */ - -static const GLubyte ch96data[] = { -0x80,0x80,0x40, -}; - -static const BitmapCharRec ch96 = {2,3,0,-5,3,ch96data}; - -/* char: 0x5f '_' */ - -static const GLubyte ch95data[] = { -0xfc, -}; - -static const BitmapCharRec ch95 = {6,1,0,2,6,ch95data}; - -/* char: 0x5e '^' */ - -static const GLubyte ch94data[] = { -0x88,0x50,0x50,0x20,0x20, -}; - -static const BitmapCharRec ch94 = {5,5,0,-3,6,ch94data}; - -/* char: 0x5d ']' */ - -static const GLubyte ch93data[] = { -0xc0,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0xc0, -}; - -static const BitmapCharRec ch93 = {2,10,0,2,3,ch93data}; - -/* char: 0x5c '\' */ - -static const GLubyte ch92data[] = { -0x20,0x20,0x40,0x40,0x40,0x40,0x80,0x80, -}; - -static const BitmapCharRec ch92 = {3,8,0,0,3,ch92data}; - -/* char: 0x5b '[' */ - -static const GLubyte ch91data[] = { -0xc0,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0xc0, -}; - -static const BitmapCharRec ch91 = {2,10,-1,2,3,ch91data}; - -/* char: 0x5a 'Z' */ - -static const GLubyte ch90data[] = { -0xf8,0x80,0x40,0x20,0x20,0x10,0x8,0xf8, -}; - -static const BitmapCharRec ch90 = {5,8,-1,0,7,ch90data}; - -/* char: 0x59 'Y' */ - -static const GLubyte ch89data[] = { -0x10,0x10,0x10,0x28,0x28,0x44,0x44,0x82, -}; - -static const BitmapCharRec ch89 = {7,8,0,0,7,ch89data}; - -/* char: 0x58 'X' */ - -static const GLubyte ch88data[] = { -0x88,0x88,0x50,0x50,0x20,0x50,0x88,0x88, -}; - -static const BitmapCharRec ch88 = {5,8,-1,0,7,ch88data}; - -/* char: 0x57 'W' */ - -static const GLubyte ch87data[] = { -0x22,0x0,0x22,0x0,0x22,0x0,0x55,0x0,0x49,0x0,0x49,0x0,0x88,0x80,0x88,0x80, -}; - -static const BitmapCharRec ch87 = {9,8,0,0,9,ch87data}; - -/* char: 0x56 'V' */ - -static const GLubyte ch86data[] = { -0x10,0x28,0x28,0x44,0x44,0x44,0x82,0x82, -}; - -static const BitmapCharRec ch86 = {7,8,0,0,7,ch86data}; - -/* char: 0x55 'U' */ - -static const GLubyte ch85data[] = { -0x78,0x84,0x84,0x84,0x84,0x84,0x84,0x84, -}; - -static const BitmapCharRec ch85 = {6,8,-1,0,8,ch85data}; - -/* char: 0x54 'T' */ - -static const GLubyte ch84data[] = { -0x20,0x20,0x20,0x20,0x20,0x20,0x20,0xf8, -}; - -static const BitmapCharRec ch84 = {5,8,0,0,5,ch84data}; - -/* char: 0x53 'S' */ - -static const GLubyte ch83data[] = { -0x70,0x88,0x88,0x8,0x70,0x80,0x88,0x70, -}; - -static const BitmapCharRec ch83 = {5,8,-1,0,7,ch83data}; - -/* char: 0x52 'R' */ - -static const GLubyte ch82data[] = { -0x88,0x88,0x88,0x88,0xf0,0x88,0x88,0xf0, -}; - -static const BitmapCharRec ch82 = {5,8,-1,0,7,ch82data}; - -/* char: 0x51 'Q' */ - -static const GLubyte ch81data[] = { -0x2,0x7c,0x8c,0x94,0x84,0x84,0x84,0x84,0x78, -}; - -static const BitmapCharRec ch81 = {7,9,-1,1,8,ch81data}; - -/* char: 0x50 'P' */ - -static const GLubyte ch80data[] = { -0x80,0x80,0x80,0x80,0xf0,0x88,0x88,0xf0, -}; - -static const BitmapCharRec ch80 = {5,8,-1,0,7,ch80data}; - -/* char: 0x4f 'O' */ - -static const GLubyte ch79data[] = { -0x78,0x84,0x84,0x84,0x84,0x84,0x84,0x78, -}; - -static const BitmapCharRec ch79 = {6,8,-1,0,8,ch79data}; - -/* char: 0x4e 'N' */ - -static const GLubyte ch78data[] = { -0x8c,0x8c,0x94,0x94,0xa4,0xa4,0xc4,0xc4, -}; - -static const BitmapCharRec ch78 = {6,8,-1,0,8,ch78data}; - -/* char: 0x4d 'M' */ - -static const GLubyte ch77data[] = { -0x92,0x92,0x92,0xaa,0xaa,0xc6,0xc6,0x82, -}; - -static const BitmapCharRec ch77 = {7,8,-1,0,9,ch77data}; - -/* char: 0x4c 'L' */ - -static const GLubyte ch76data[] = { -0xf0,0x80,0x80,0x80,0x80,0x80,0x80,0x80, -}; - -static const BitmapCharRec ch76 = {4,8,-1,0,6,ch76data}; - -/* char: 0x4b 'K' */ - -static const GLubyte ch75data[] = { -0x88,0x88,0x90,0x90,0xe0,0xa0,0x90,0x88, -}; - -static const BitmapCharRec ch75 = {5,8,-1,0,7,ch75data}; - -/* char: 0x4a 'J' */ - -static const GLubyte ch74data[] = { -0x60,0x90,0x10,0x10,0x10,0x10,0x10,0x10, -}; - -static const BitmapCharRec ch74 = {4,8,0,0,5,ch74data}; - -/* char: 0x49 'I' */ - -static const GLubyte ch73data[] = { -0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80, -}; - -static const BitmapCharRec ch73 = {1,8,-1,0,3,ch73data}; - -/* char: 0x48 'H' */ - -static const GLubyte ch72data[] = { -0x84,0x84,0x84,0x84,0xfc,0x84,0x84,0x84, -}; - -static const BitmapCharRec ch72 = {6,8,-1,0,8,ch72data}; - -/* char: 0x47 'G' */ - -static const GLubyte ch71data[] = { -0x74,0x8c,0x84,0x8c,0x80,0x80,0x84,0x78, -}; - -static const BitmapCharRec ch71 = {6,8,-1,0,8,ch71data}; - -/* char: 0x46 'F' */ - -static const GLubyte ch70data[] = { -0x80,0x80,0x80,0x80,0xf0,0x80,0x80,0xf8, -}; - -static const BitmapCharRec ch70 = {5,8,-1,0,6,ch70data}; - -/* char: 0x45 'E' */ - -static const GLubyte ch69data[] = { -0xf8,0x80,0x80,0x80,0xf8,0x80,0x80,0xf8, -}; - -static const BitmapCharRec ch69 = {5,8,-1,0,7,ch69data}; - -/* char: 0x44 'D' */ - -static const GLubyte ch68data[] = { -0xf0,0x88,0x84,0x84,0x84,0x84,0x88,0xf0, -}; - -static const BitmapCharRec ch68 = {6,8,-1,0,8,ch68data}; - -/* char: 0x43 'C' */ - -static const GLubyte ch67data[] = { -0x78,0x84,0x80,0x80,0x80,0x80,0x84,0x78, -}; - -static const BitmapCharRec ch67 = {6,8,-1,0,8,ch67data}; - -/* char: 0x42 'B' */ - -static const GLubyte ch66data[] = { -0xf0,0x88,0x88,0x88,0xf0,0x88,0x88,0xf0, -}; - -static const BitmapCharRec ch66 = {5,8,-1,0,7,ch66data}; - -/* char: 0x41 'A' */ - -static const GLubyte ch65data[] = { -0x82,0x82,0x7c,0x44,0x28,0x28,0x10,0x10, -}; - -static const BitmapCharRec ch65 = {7,8,0,0,7,ch65data}; - -/* char: 0x40 '@' */ - -static const GLubyte ch64data[] = { -0x3e,0x0,0x40,0x0,0x9b,0x0,0xa4,0x80,0xa4,0x80,0xa2,0x40,0x92,0x40,0x4d,0x40, -0x20,0x80,0x1f,0x0, -}; - -static const BitmapCharRec ch64 = {10,10,0,2,11,ch64data}; - -/* char: 0x3f '?' */ - -static const GLubyte ch63data[] = { -0x40,0x0,0x40,0x40,0x20,0x10,0x90,0x60, -}; - -static const BitmapCharRec ch63 = {4,8,-1,0,6,ch63data}; - -/* char: 0x3e '>' */ - -static const GLubyte ch62data[] = { -0x80,0x40,0x20,0x40,0x80, -}; - -static const BitmapCharRec ch62 = {3,5,-1,-1,6,ch62data}; - -/* char: 0x3d '=' */ - -static const GLubyte ch61data[] = { -0xf0,0x0,0xf0, -}; - -static const BitmapCharRec ch61 = {4,3,0,-2,5,ch61data}; - -/* char: 0x3c '<' */ - -static const GLubyte ch60data[] = { -0x20,0x40,0x80,0x40,0x20, -}; - -static const BitmapCharRec ch60 = {3,5,-1,-1,6,ch60data}; - -/* char: 0x3b ';' */ - -static const GLubyte ch59data[] = { -0x80,0x40,0x40,0x0,0x0,0x0,0x0,0x40, -}; - -static const BitmapCharRec ch59 = {2,8,0,2,3,ch59data}; - -/* char: 0x3a ':' */ - -static const GLubyte ch58data[] = { -0x80,0x0,0x0,0x0,0x0,0x80, -}; - -static const BitmapCharRec ch58 = {1,6,-1,0,3,ch58data}; - -/* char: 0x39 '9' */ - -static const GLubyte ch57data[] = { -0x70,0x88,0x8,0x68,0x98,0x88,0x88,0x70, -}; - -static const BitmapCharRec ch57 = {5,8,0,0,6,ch57data}; - -/* char: 0x38 '8' */ - -static const GLubyte ch56data[] = { -0x70,0x88,0x88,0x88,0x70,0x88,0x88,0x70, -}; - -static const BitmapCharRec ch56 = {5,8,0,0,6,ch56data}; - -/* char: 0x37 '7' */ - -static const GLubyte ch55data[] = { -0x40,0x40,0x20,0x20,0x10,0x10,0x8,0xf8, -}; - -static const BitmapCharRec ch55 = {5,8,0,0,6,ch55data}; - -/* char: 0x36 '6' */ - -static const GLubyte ch54data[] = { -0x70,0x88,0x88,0xc8,0xb0,0x80,0x88,0x70, -}; - -static const BitmapCharRec ch54 = {5,8,0,0,6,ch54data}; - -/* char: 0x35 '5' */ - -static const GLubyte ch53data[] = { -0x70,0x88,0x8,0x8,0xf0,0x80,0x80,0xf8, -}; - -static const BitmapCharRec ch53 = {5,8,0,0,6,ch53data}; - -/* char: 0x34 '4' */ - -static const GLubyte ch52data[] = { -0x10,0x10,0xf8,0x90,0x50,0x50,0x30,0x10, -}; - -static const BitmapCharRec ch52 = {5,8,0,0,6,ch52data}; - -/* char: 0x33 '3' */ - -static const GLubyte ch51data[] = { -0x70,0x88,0x8,0x8,0x30,0x8,0x88,0x70, -}; - -static const BitmapCharRec ch51 = {5,8,0,0,6,ch51data}; - -/* char: 0x32 '2' */ - -static const GLubyte ch50data[] = { -0xf8,0x80,0x40,0x30,0x8,0x8,0x88,0x70, -}; - -static const BitmapCharRec ch50 = {5,8,0,0,6,ch50data}; - -/* char: 0x31 '1' */ - -static const GLubyte ch49data[] = { -0x40,0x40,0x40,0x40,0x40,0x40,0xc0,0x40, -}; - -static const BitmapCharRec ch49 = {2,8,-1,0,6,ch49data}; - -/* char: 0x30 '0' */ - -static const GLubyte ch48data[] = { -0x70,0x88,0x88,0x88,0x88,0x88,0x88,0x70, -}; - -static const BitmapCharRec ch48 = {5,8,0,0,6,ch48data}; - -/* char: 0x2f '/' */ - -static const GLubyte ch47data[] = { -0x80,0x80,0x40,0x40,0x40,0x40,0x20,0x20, -}; - -static const BitmapCharRec ch47 = {3,8,0,0,3,ch47data}; - -/* char: 0x2e '.' */ - -static const GLubyte ch46data[] = { -0x80, -}; - -static const BitmapCharRec ch46 = {1,1,-1,0,3,ch46data}; - -/* char: 0x2d '-' */ - -static const GLubyte ch45data[] = { -0xf8, -}; - -static const BitmapCharRec ch45 = {5,1,-1,-3,7,ch45data}; - -/* char: 0x2c ',' */ - -static const GLubyte ch44data[] = { -0x80,0x40,0x40, -}; - -static const BitmapCharRec ch44 = {2,3,0,2,3,ch44data}; - -/* char: 0x2b '+' */ - -static const GLubyte ch43data[] = { -0x20,0x20,0xf8,0x20,0x20, -}; - -static const BitmapCharRec ch43 = {5,5,0,-1,6,ch43data}; - -/* char: 0x2a '*' */ - -static const GLubyte ch42data[] = { -0xa0,0x40,0xa0, -}; - -static const BitmapCharRec ch42 = {3,3,0,-5,4,ch42data}; - -/* char: 0x29 ')' */ - -static const GLubyte ch41data[] = { -0x80,0x40,0x40,0x20,0x20,0x20,0x20,0x40,0x40,0x80, -}; - -static const BitmapCharRec ch41 = {3,10,-1,2,4,ch41data}; - -/* char: 0x28 '(' */ - -static const GLubyte ch40data[] = { -0x20,0x40,0x40,0x80,0x80,0x80,0x80,0x40,0x40,0x20, -}; - -static const BitmapCharRec ch40 = {3,10,0,2,4,ch40data}; - -/* char: 0x27 ''' */ - -static const GLubyte ch39data[] = { -0x80,0x40,0x40, -}; - -static const BitmapCharRec ch39 = {2,3,-1,-5,3,ch39data}; - -/* char: 0x26 '&' */ - -static const GLubyte ch38data[] = { -0x64,0x98,0x98,0xa4,0x60,0x50,0x50,0x20, -}; - -static const BitmapCharRec ch38 = {6,8,-1,0,8,ch38data}; - -/* char: 0x25 '%' */ - -static const GLubyte ch37data[] = { -0x26,0x29,0x16,0x10,0x8,0x68,0x94,0x64, -}; - -static const BitmapCharRec ch37 = {8,8,0,0,9,ch37data}; - -/* char: 0x24 '$' */ - -static const GLubyte ch36data[] = { -0x20,0x70,0xa8,0x28,0x70,0xa0,0xa8,0x70,0x20, -}; - -static const BitmapCharRec ch36 = {5,9,0,1,6,ch36data}; - -/* char: 0x23 '#' */ - -static const GLubyte ch35data[] = { -0x50,0x50,0xf8,0x28,0x7c,0x28,0x28, -}; - -static const BitmapCharRec ch35 = {6,7,0,0,6,ch35data}; - -/* char: 0x22 '"' */ - -static const GLubyte ch34data[] = { -0xa0,0xa0, -}; - -static const BitmapCharRec ch34 = {3,2,-1,-6,4,ch34data}; - -/* char: 0x21 '!' */ - -static const GLubyte ch33data[] = { -0x80,0x0,0x80,0x80,0x80,0x80,0x80,0x80, -}; - -static const BitmapCharRec ch33 = {1,8,-1,0,3,ch33data}; - -/* char: 0x20 ' ' */ - -#ifdef _WIN32 -/* XXX Work around Microsoft OpenGL 1.1 bug where glBitmap with - a height or width of zero does not advance the raster position - as specified by OpenGL. (Cosmo OpenGL does not have this bug.) */ -static const GLubyte ch32data[] = { 0x0 }; -static const BitmapCharRec ch32 = {0,0,0,0,3,ch32data}; -#else -static const BitmapCharRec ch32 = {0,0,0,0,3,0}; -#endif - -static const BitmapCharRec * const chars[] = { -&ch32, -&ch33, -&ch34, -&ch35, -&ch36, -&ch37, -&ch38, -&ch39, -&ch40, -&ch41, -&ch42, -&ch43, -&ch44, -&ch45, -&ch46, -&ch47, -&ch48, -&ch49, -&ch50, -&ch51, -&ch52, -&ch53, -&ch54, -&ch55, -&ch56, -&ch57, -&ch58, -&ch59, -&ch60, -&ch61, -&ch62, -&ch63, -&ch64, -&ch65, -&ch66, -&ch67, -&ch68, -&ch69, -&ch70, -&ch71, -&ch72, -&ch73, -&ch74, -&ch75, -&ch76, -&ch77, -&ch78, -&ch79, -&ch80, -&ch81, -&ch82, -&ch83, -&ch84, -&ch85, -&ch86, -&ch87, -&ch88, -&ch89, -&ch90, -&ch91, -&ch92, -&ch93, -&ch94, -&ch95, -&ch96, -&ch97, -&ch98, -&ch99, -&ch100, -&ch101, -&ch102, -&ch103, -&ch104, -&ch105, -&ch106, -&ch107, -&ch108, -&ch109, -&ch110, -&ch111, -&ch112, -&ch113, -&ch114, -&ch115, -&ch116, -&ch117, -&ch118, -&ch119, -&ch120, -&ch121, -&ch122, -&ch123, -&ch124, -&ch125, -&ch126, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -&ch160, -&ch161, -&ch162, -&ch163, -&ch164, -&ch165, -&ch166, -&ch167, -&ch168, -&ch169, -&ch170, -&ch171, -&ch172, -&ch173, -&ch174, -&ch175, -&ch176, -&ch177, -&ch178, -&ch179, -&ch180, -&ch181, -&ch182, -&ch183, -&ch184, -&ch185, -&ch186, -&ch187, -&ch188, -&ch189, -&ch190, -&ch191, -&ch192, -&ch193, -&ch194, -&ch195, -&ch196, -&ch197, -&ch198, -&ch199, -&ch200, -&ch201, -&ch202, -&ch203, -&ch204, -&ch205, -&ch206, -&ch207, -&ch208, -&ch209, -&ch210, -&ch211, -&ch212, -&ch213, -&ch214, -&ch215, -&ch216, -&ch217, -&ch218, -&ch219, -&ch220, -&ch221, -&ch222, -&ch223, -&ch224, -&ch225, -&ch226, -&ch227, -&ch228, -&ch229, -&ch230, -&ch231, -&ch232, -&ch233, -&ch234, -&ch235, -&ch236, -&ch237, -&ch238, -&ch239, -&ch240, -&ch241, -&ch242, -&ch243, -&ch244, -&ch245, -&ch246, -&ch247, -&ch248, -&ch249, -&ch250, -&ch251, -&ch252, -&ch253, -&ch254, -&ch255, -}; - -#if !defined(__IBMCPP__) -const -#endif -BitmapFontRec glutBitmapHelvetica10 = { -"-adobe-helvetica-medium-r-normal--10-100-75-75-p-56-iso8859-1", -224, -32, -chars -}; - diff --git a/src/glut/os2/glut_hel12.cpp b/src/glut/os2/glut_hel12.cpp deleted file mode 100644 index f615fbb2f8..0000000000 --- a/src/glut/os2/glut_hel12.cpp +++ /dev/null @@ -1,1791 +0,0 @@ - -/* GENERATED FILE -- DO NOT MODIFY */ - -#define glutBitmapHelvetica12 XXX -#include "glutbitmap.h" -#undef glutBitmapHelvetica12 - -/* char: 0xff */ - -static const GLubyte ch255data[] = { -0xc0,0x20,0x20,0x20,0x30,0x50,0x50,0x48,0x88,0x88,0x0,0x50, -}; - -static const BitmapCharRec ch255 = {5,12,-1,3,7,ch255data}; - -/* char: 0xfe */ - -static const GLubyte ch254data[] = { -0x80,0x80,0x80,0xb0,0xc8,0x88,0x88,0x88,0xc8,0xb0,0x80,0x80, -}; - -static const BitmapCharRec ch254 = {5,12,-1,3,7,ch254data}; - -/* char: 0xfd */ - -static const GLubyte ch253data[] = { -0x80,0x40,0x20,0x20,0x50,0x50,0x90,0x88,0x88,0x88,0x0,0x20,0x10, -}; - -static const BitmapCharRec ch253 = {5,13,-1,3,7,ch253data}; - -/* char: 0xfc */ - -static const GLubyte ch252data[] = { -0x68,0x98,0x88,0x88,0x88,0x88,0x88,0x0,0x50, -}; - -static const BitmapCharRec ch252 = {5,9,-1,0,7,ch252data}; - -/* char: 0xfb */ - -static const GLubyte ch251data[] = { -0x68,0x98,0x88,0x88,0x88,0x88,0x88,0x0,0x50,0x20, -}; - -static const BitmapCharRec ch251 = {5,10,-1,0,7,ch251data}; - -/* char: 0xfa */ - -static const GLubyte ch250data[] = { -0x68,0x98,0x88,0x88,0x88,0x88,0x88,0x0,0x20,0x10, -}; - -static const BitmapCharRec ch250 = {5,10,-1,0,7,ch250data}; - -/* char: 0xf9 */ - -static const GLubyte ch249data[] = { -0x68,0x98,0x88,0x88,0x88,0x88,0x88,0x0,0x20,0x40, -}; - -static const BitmapCharRec ch249 = {5,10,-1,0,7,ch249data}; - -/* char: 0xf8 */ - -static const GLubyte ch248data[] = { -0xb8,0x44,0x64,0x54,0x4c,0x44,0x3a, -}; - -static const BitmapCharRec ch248 = {7,7,0,0,7,ch248data}; - -/* char: 0xf7 */ - -static const GLubyte ch247data[] = { -0x20,0x0,0xf8,0x0,0x20, -}; - -static const BitmapCharRec ch247 = {5,5,-1,-1,7,ch247data}; - -/* char: 0xf6 */ - -static const GLubyte ch246data[] = { -0x70,0x88,0x88,0x88,0x88,0x88,0x70,0x0,0x50, -}; - -static const BitmapCharRec ch246 = {5,9,-1,0,7,ch246data}; - -/* char: 0xf5 */ - -static const GLubyte ch245data[] = { -0x70,0x88,0x88,0x88,0x88,0x88,0x70,0x0,0x50,0x28, -}; - -static const BitmapCharRec ch245 = {5,10,-1,0,7,ch245data}; - -/* char: 0xf4 */ - -static const GLubyte ch244data[] = { -0x70,0x88,0x88,0x88,0x88,0x88,0x70,0x0,0x50,0x20, -}; - -static const BitmapCharRec ch244 = {5,10,-1,0,7,ch244data}; - -/* char: 0xf3 */ - -static const GLubyte ch243data[] = { -0x70,0x88,0x88,0x88,0x88,0x88,0x70,0x0,0x20,0x10, -}; - -static const BitmapCharRec ch243 = {5,10,-1,0,7,ch243data}; - -/* char: 0xf2 */ - -static const GLubyte ch242data[] = { -0x70,0x88,0x88,0x88,0x88,0x88,0x70,0x0,0x20,0x40, -}; - -static const BitmapCharRec ch242 = {5,10,-1,0,7,ch242data}; - -/* char: 0xf1 */ - -static const GLubyte ch241data[] = { -0x88,0x88,0x88,0x88,0x88,0xc8,0xb0,0x0,0x50,0x28, -}; - -static const BitmapCharRec ch241 = {5,10,-1,0,7,ch241data}; - -/* char: 0xf0 */ - -static const GLubyte ch240data[] = { -0x70,0x88,0x88,0x88,0x88,0x78,0x8,0x50,0x30,0x68, -}; - -static const BitmapCharRec ch240 = {5,10,-1,0,7,ch240data}; - -/* char: 0xef */ - -static const GLubyte ch239data[] = { -0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x0,0xa0, -}; - -static const BitmapCharRec ch239 = {3,9,0,0,3,ch239data}; - -/* char: 0xee */ - -static const GLubyte ch238data[] = { -0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x0,0xa0,0x40, -}; - -static const BitmapCharRec ch238 = {3,10,0,0,3,ch238data}; - -/* char: 0xed */ - -static const GLubyte ch237data[] = { -0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x0,0x80,0x40, -}; - -static const BitmapCharRec ch237 = {2,10,-1,0,3,ch237data}; - -/* char: 0xec */ - -static const GLubyte ch236data[] = { -0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x0,0x40,0x80, -}; - -static const BitmapCharRec ch236 = {2,10,0,0,3,ch236data}; - -/* char: 0xeb */ - -static const GLubyte ch235data[] = { -0x70,0x88,0x80,0xf8,0x88,0x88,0x70,0x0,0x50, -}; - -static const BitmapCharRec ch235 = {5,9,-1,0,7,ch235data}; - -/* char: 0xea */ - -static const GLubyte ch234data[] = { -0x70,0x88,0x80,0xf8,0x88,0x88,0x70,0x0,0x50,0x20, -}; - -static const BitmapCharRec ch234 = {5,10,-1,0,7,ch234data}; - -/* char: 0xe9 */ - -static const GLubyte ch233data[] = { -0x70,0x88,0x80,0xf8,0x88,0x88,0x70,0x0,0x20,0x10, -}; - -static const BitmapCharRec ch233 = {5,10,-1,0,7,ch233data}; - -/* char: 0xe8 */ - -static const GLubyte ch232data[] = { -0x70,0x88,0x80,0xf8,0x88,0x88,0x70,0x0,0x20,0x40, -}; - -static const BitmapCharRec ch232 = {5,10,-1,0,7,ch232data}; - -/* char: 0xe7 */ - -static const GLubyte ch231data[] = { -0x60,0x10,0x20,0x70,0x88,0x80,0x80,0x80,0x88,0x70, -}; - -static const BitmapCharRec ch231 = {5,10,-1,3,7,ch231data}; - -/* char: 0xe6 */ - -static const GLubyte ch230data[] = { -0x77,0x0,0x88,0x80,0x88,0x0,0x7f,0x80,0x8,0x80,0x88,0x80,0x77,0x0, -}; - -static const BitmapCharRec ch230 = {9,7,-1,0,11,ch230data}; - -/* char: 0xe5 */ - -static const GLubyte ch229data[] = { -0x74,0x88,0x88,0x78,0x8,0x88,0x70,0x30,0x48,0x30, -}; - -static const BitmapCharRec ch229 = {6,10,-1,0,7,ch229data}; - -/* char: 0xe4 */ - -static const GLubyte ch228data[] = { -0x74,0x88,0x88,0x78,0x8,0x88,0x70,0x0,0x50, -}; - -static const BitmapCharRec ch228 = {6,9,-1,0,7,ch228data}; - -/* char: 0xe3 */ - -static const GLubyte ch227data[] = { -0x74,0x88,0x88,0x78,0x8,0x88,0x70,0x0,0x50,0x28, -}; - -static const BitmapCharRec ch227 = {6,10,-1,0,7,ch227data}; - -/* char: 0xe2 */ - -static const GLubyte ch226data[] = { -0x74,0x88,0x88,0x78,0x8,0x88,0x70,0x0,0x50,0x20, -}; - -static const BitmapCharRec ch226 = {6,10,-1,0,7,ch226data}; - -/* char: 0xe1 */ - -static const GLubyte ch225data[] = { -0x74,0x88,0x88,0x78,0x8,0x88,0x70,0x0,0x20,0x10, -}; - -static const BitmapCharRec ch225 = {6,10,-1,0,7,ch225data}; - -/* char: 0xe0 */ - -static const GLubyte ch224data[] = { -0x74,0x88,0x88,0x78,0x8,0x88,0x70,0x0,0x10,0x20, -}; - -static const BitmapCharRec ch224 = {6,10,-1,0,7,ch224data}; - -/* char: 0xdf */ - -static const GLubyte ch223data[] = { -0xb0,0x88,0x88,0x88,0xb0,0x88,0x88,0x88,0x70, -}; - -static const BitmapCharRec ch223 = {5,9,-1,0,7,ch223data}; - -/* char: 0xde */ - -static const GLubyte ch222data[] = { -0x80,0x80,0xf8,0x84,0x84,0x84,0xf8,0x80,0x80, -}; - -static const BitmapCharRec ch222 = {6,9,-1,0,8,ch222data}; - -/* char: 0xdd */ - -static const GLubyte ch221data[] = { -0x10,0x10,0x10,0x10,0x28,0x44,0x44,0x82,0x82,0x0,0x10,0x8, -}; - -static const BitmapCharRec ch221 = {7,12,-1,0,9,ch221data}; - -/* char: 0xdc */ - -static const GLubyte ch220data[] = { -0x78,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x0,0x48, -}; - -static const BitmapCharRec ch220 = {6,11,-1,0,8,ch220data}; - -/* char: 0xdb */ - -static const GLubyte ch219data[] = { -0x78,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x0,0x28,0x10, -}; - -static const BitmapCharRec ch219 = {6,12,-1,0,8,ch219data}; - -/* char: 0xda */ - -static const GLubyte ch218data[] = { -0x78,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x0,0x10,0x8, -}; - -static const BitmapCharRec ch218 = {6,12,-1,0,8,ch218data}; - -/* char: 0xd9 */ - -static const GLubyte ch217data[] = { -0x78,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x0,0x10,0x20, -}; - -static const BitmapCharRec ch217 = {6,12,-1,0,8,ch217data}; - -/* char: 0xd8 */ - -static const GLubyte ch216data[] = { -0x80,0x0,0x5e,0x0,0x21,0x0,0x50,0x80,0x48,0x80,0x44,0x80,0x44,0x80,0x42,0x80, -0x21,0x0,0x1e,0x80,0x0,0x40, -}; - -static const BitmapCharRec ch216 = {10,11,0,1,10,ch216data}; - -/* char: 0xd7 */ - -static const GLubyte ch215data[] = { -0x88,0x50,0x20,0x50,0x88, -}; - -static const BitmapCharRec ch215 = {5,5,-1,-1,7,ch215data}; - -/* char: 0xd6 */ - -static const GLubyte ch214data[] = { -0x3c,0x42,0x81,0x81,0x81,0x81,0x81,0x42,0x3c,0x0,0x24, -}; - -static const BitmapCharRec ch214 = {8,11,-1,0,10,ch214data}; - -/* char: 0xd5 */ - -static const GLubyte ch213data[] = { -0x3c,0x42,0x81,0x81,0x81,0x81,0x81,0x42,0x3c,0x0,0x28,0x14, -}; - -static const BitmapCharRec ch213 = {8,12,-1,0,10,ch213data}; - -/* char: 0xd4 */ - -static const GLubyte ch212data[] = { -0x3c,0x42,0x81,0x81,0x81,0x81,0x81,0x42,0x3c,0x0,0x14,0x8, -}; - -static const BitmapCharRec ch212 = {8,12,-1,0,10,ch212data}; - -/* char: 0xd3 */ - -static const GLubyte ch211data[] = { -0x3c,0x42,0x81,0x81,0x81,0x81,0x81,0x42,0x3c,0x0,0x8,0x4, -}; - -static const BitmapCharRec ch211 = {8,12,-1,0,10,ch211data}; - -/* char: 0xd2 */ - -static const GLubyte ch210data[] = { -0x3c,0x42,0x81,0x81,0x81,0x81,0x81,0x42,0x3c,0x0,0x8,0x10, -}; - -static const BitmapCharRec ch210 = {8,12,-1,0,10,ch210data}; - -/* char: 0xd1 */ - -static const GLubyte ch209data[] = { -0x82,0x86,0x8a,0x8a,0x92,0xa2,0xa2,0xc2,0x82,0x0,0x28,0x14, -}; - -static const BitmapCharRec ch209 = {7,12,-1,0,9,ch209data}; - -/* char: 0xd0 */ - -static const GLubyte ch208data[] = { -0x7c,0x42,0x41,0x41,0xf1,0x41,0x41,0x42,0x7c, -}; - -static const BitmapCharRec ch208 = {8,9,0,0,9,ch208data}; - -/* char: 0xcf */ - -static const GLubyte ch207data[] = { -0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x0,0xa0, -}; - -static const BitmapCharRec ch207 = {3,11,0,0,3,ch207data}; - -/* char: 0xce */ - -static const GLubyte ch206data[] = { -0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x0,0xa0,0x40, -}; - -static const BitmapCharRec ch206 = {3,12,0,0,3,ch206data}; - -/* char: 0xcd */ - -static const GLubyte ch205data[] = { -0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x0,0x80,0x40, -}; - -static const BitmapCharRec ch205 = {2,12,-1,0,3,ch205data}; - -/* char: 0xcc */ - -static const GLubyte ch204data[] = { -0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x0,0x40,0x80, -}; - -static const BitmapCharRec ch204 = {2,12,0,0,3,ch204data}; - -/* char: 0xcb */ - -static const GLubyte ch203data[] = { -0xfc,0x80,0x80,0x80,0xfc,0x80,0x80,0x80,0xfc,0x0,0x28, -}; - -static const BitmapCharRec ch203 = {6,11,-1,0,8,ch203data}; - -/* char: 0xca */ - -static const GLubyte ch202data[] = { -0xfc,0x80,0x80,0x80,0xfc,0x80,0x80,0x80,0xfc,0x0,0x28,0x10, -}; - -static const BitmapCharRec ch202 = {6,12,-1,0,8,ch202data}; - -/* char: 0xc9 */ - -static const GLubyte ch201data[] = { -0xfc,0x80,0x80,0x80,0xfc,0x80,0x80,0x80,0xfc,0x0,0x10,0x8, -}; - -static const BitmapCharRec ch201 = {6,12,-1,0,8,ch201data}; - -/* char: 0xc8 */ - -static const GLubyte ch200data[] = { -0xfc,0x80,0x80,0x80,0xfc,0x80,0x80,0x80,0xfc,0x0,0x10,0x20, -}; - -static const BitmapCharRec ch200 = {6,12,-1,0,8,ch200data}; - -/* char: 0xc7 */ - -static const GLubyte ch199data[] = { -0x30,0x8,0x8,0x3c,0x42,0x80,0x80,0x80,0x80,0x80,0x42,0x3c, -}; - -static const BitmapCharRec ch199 = {7,12,-1,3,9,ch199data}; - -/* char: 0xc6 */ - -static const GLubyte ch198data[] = { -0x8f,0x80,0x88,0x0,0x88,0x0,0x78,0x0,0x4f,0x80,0x48,0x0,0x28,0x0,0x28,0x0, -0x1f,0x80, -}; - -static const BitmapCharRec ch198 = {9,9,-1,0,11,ch198data}; - -/* char: 0xc5 */ - -static const GLubyte ch197data[] = { -0x82,0x82,0x82,0x7c,0x44,0x44,0x28,0x10,0x10,0x10,0x28,0x10, -}; - -static const BitmapCharRec ch197 = {7,12,-1,0,9,ch197data}; - -/* char: 0xc4 */ - -static const GLubyte ch196data[] = { -0x82,0x82,0x82,0x7c,0x44,0x44,0x28,0x10,0x10,0x0,0x28, -}; - -static const BitmapCharRec ch196 = {7,11,-1,0,9,ch196data}; - -/* char: 0xc3 */ - -static const GLubyte ch195data[] = { -0x82,0x82,0x82,0x7c,0x44,0x44,0x28,0x10,0x10,0x0,0x28,0x14, -}; - -static const BitmapCharRec ch195 = {7,12,-1,0,9,ch195data}; - -/* char: 0xc2 */ - -static const GLubyte ch194data[] = { -0x82,0x82,0x82,0x7c,0x44,0x44,0x28,0x10,0x10,0x0,0x28,0x10, -}; - -static const BitmapCharRec ch194 = {7,12,-1,0,9,ch194data}; - -/* char: 0xc1 */ - -static const GLubyte ch193data[] = { -0x82,0x82,0x82,0x7c,0x44,0x44,0x28,0x10,0x10,0x0,0x10,0x8, -}; - -static const BitmapCharRec ch193 = {7,12,-1,0,9,ch193data}; - -/* char: 0xc0 */ - -static const GLubyte ch192data[] = { -0x82,0x82,0x82,0x7c,0x44,0x44,0x28,0x10,0x10,0x0,0x10,0x20, -}; - -static const BitmapCharRec ch192 = {7,12,-1,0,9,ch192data}; - -/* char: 0xbf */ - -static const GLubyte ch191data[] = { -0x70,0x88,0x88,0x40,0x40,0x20,0x20,0x0,0x20, -}; - -static const BitmapCharRec ch191 = {5,9,-1,3,7,ch191data}; - -/* char: 0xbe */ - -static const GLubyte ch190data[] = { -0x21,0x0,0x17,0x80,0x15,0x0,0xb,0x0,0xc9,0x0,0x24,0x0,0x44,0x0,0x22,0x0, -0xe1,0x0, -}; - -static const BitmapCharRec ch190 = {9,9,0,0,10,ch190data}; - -/* char: 0xbd */ - -static const GLubyte ch189data[] = { -0x47,0x80,0x22,0x0,0x11,0x0,0x14,0x80,0x4b,0x0,0x48,0x0,0x44,0x0,0xc2,0x0, -0x41,0x0, -}; - -static const BitmapCharRec ch189 = {9,9,0,0,10,ch189data}; - -/* char: 0xbc */ - -static const GLubyte ch188data[] = { -0x41,0x0,0x27,0x80,0x15,0x0,0x13,0x0,0x49,0x0,0x44,0x0,0x44,0x0,0xc2,0x0, -0x41,0x0, -}; - -static const BitmapCharRec ch188 = {9,9,0,0,10,ch188data}; - -/* char: 0xbb */ - -static const GLubyte ch187data[] = { -0xa0,0x50,0x28,0x50,0xa0, -}; - -static const BitmapCharRec ch187 = {5,5,-1,-1,7,ch187data}; - -/* char: 0xba */ - -static const GLubyte ch186data[] = { -0xe0,0x0,0xe0,0xa0,0xe0, -}; - -static const BitmapCharRec ch186 = {3,5,-1,-4,5,ch186data}; - -/* char: 0xb9 */ - -static const GLubyte ch185data[] = { -0x40,0x40,0x40,0xc0,0x40, -}; - -static const BitmapCharRec ch185 = {2,5,-1,-3,4,ch185data}; - -/* char: 0xb8 */ - -static const GLubyte ch184data[] = { -0xc0,0x20,0x20,0x40, -}; - -static const BitmapCharRec ch184 = {3,4,0,3,3,ch184data}; - -/* char: 0xb7 */ - -static const GLubyte ch183data[] = { -0x80, -}; - -static const BitmapCharRec ch183 = {1,1,-1,-3,3,ch183data}; - -/* char: 0xb6 */ - -static const GLubyte ch182data[] = { -0x28,0x28,0x28,0x28,0x28,0x28,0x68,0xe8,0xe8,0xe8,0x68,0x3c, -}; - -static const BitmapCharRec ch182 = {6,12,0,3,7,ch182data}; - -/* char: 0xb5 */ - -static const GLubyte ch181data[] = { -0x80,0x80,0x80,0xe8,0x98,0x88,0x88,0x88,0x88,0x88, -}; - -static const BitmapCharRec ch181 = {5,10,-1,3,7,ch181data}; - -/* char: 0xb4 */ - -static const GLubyte ch180data[] = { -0x80,0x40, -}; - -static const BitmapCharRec ch180 = {2,2,0,-8,2,ch180data}; - -/* char: 0xb3 */ - -static const GLubyte ch179data[] = { -0xc0,0x20,0x40,0x20,0xe0, -}; - -static const BitmapCharRec ch179 = {3,5,0,-3,4,ch179data}; - -/* char: 0xb2 */ - -static const GLubyte ch178data[] = { -0xf0,0x40,0x20,0x90,0x60, -}; - -static const BitmapCharRec ch178 = {4,5,0,-3,4,ch178data}; - -/* char: 0xb1 */ - -static const GLubyte ch177data[] = { -0xf8,0x0,0x20,0x20,0xf8,0x20,0x20, -}; - -static const BitmapCharRec ch177 = {5,7,-1,0,7,ch177data}; - -/* char: 0xb0 */ - -static const GLubyte ch176data[] = { -0x60,0x90,0x90,0x60, -}; - -static const BitmapCharRec ch176 = {4,4,0,-4,5,ch176data}; - -/* char: 0xaf */ - -static const GLubyte ch175data[] = { -0xf0, -}; - -static const BitmapCharRec ch175 = {4,1,0,-8,4,ch175data}; - -/* char: 0xae */ - -static const GLubyte ch174data[] = { -0x3e,0x0,0x41,0x0,0x94,0x80,0x94,0x80,0x98,0x80,0x94,0x80,0x9c,0x80,0x41,0x0, -0x3e,0x0, -}; - -static const BitmapCharRec ch174 = {9,9,-1,0,11,ch174data}; - -/* char: 0xad */ - -static const GLubyte ch173data[] = { -0xf0, -}; - -static const BitmapCharRec ch173 = {4,1,0,-3,5,ch173data}; - -/* char: 0xac */ - -static const GLubyte ch172data[] = { -0x4,0x4,0x4,0xfc, -}; - -static const BitmapCharRec ch172 = {6,4,-1,-2,8,ch172data}; - -/* char: 0xab */ - -static const GLubyte ch171data[] = { -0x28,0x50,0xa0,0x50,0x28, -}; - -static const BitmapCharRec ch171 = {5,5,-1,-1,7,ch171data}; - -/* char: 0xaa */ - -static const GLubyte ch170data[] = { -0xe0,0x0,0xa0,0x20,0xe0, -}; - -static const BitmapCharRec ch170 = {3,5,-1,-4,5,ch170data}; - -/* char: 0xa9 */ - -static const GLubyte ch169data[] = { -0x3e,0x0,0x41,0x0,0x9c,0x80,0xa2,0x80,0xa0,0x80,0xa2,0x80,0x9c,0x80,0x41,0x0, -0x3e,0x0, -}; - -static const BitmapCharRec ch169 = {9,9,-1,0,11,ch169data}; - -/* char: 0xa8 */ - -static const GLubyte ch168data[] = { -0xa0, -}; - -static const BitmapCharRec ch168 = {3,1,0,-8,3,ch168data}; - -/* char: 0xa7 */ - -static const GLubyte ch167data[] = { -0x70,0x88,0x8,0x30,0x48,0x88,0x88,0x90,0x60,0x80,0x88,0x70, -}; - -static const BitmapCharRec ch167 = {5,12,0,3,6,ch167data}; - -/* char: 0xa6 */ - -static const GLubyte ch166data[] = { -0x80,0x80,0x80,0x80,0x0,0x0,0x0,0x80,0x80,0x80,0x80, -}; - -static const BitmapCharRec ch166 = {1,11,-1,2,3,ch166data}; - -/* char: 0xa5 */ - -static const GLubyte ch165data[] = { -0x20,0x20,0xf8,0x20,0xf8,0x20,0x50,0x88,0x88, -}; - -static const BitmapCharRec ch165 = {5,9,-1,0,7,ch165data}; - -/* char: 0xa4 */ - -static const GLubyte ch164data[] = { -0x84,0x78,0x48,0x48,0x78,0x84, -}; - -static const BitmapCharRec ch164 = {6,6,0,-1,7,ch164data}; - -/* char: 0xa3 */ - -static const GLubyte ch163data[] = { -0xb0,0x48,0x20,0x20,0xf0,0x40,0x40,0x48,0x30, -}; - -static const BitmapCharRec ch163 = {5,9,-1,0,7,ch163data}; - -/* char: 0xa2 */ - -static const GLubyte ch162data[] = { -0x40,0x70,0xc8,0xa0,0xa0,0xa0,0xa8,0x70,0x10, -}; - -static const BitmapCharRec ch162 = {5,9,-1,1,7,ch162data}; - -/* char: 0xa1 */ - -static const GLubyte ch161data[] = { -0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x0,0x80, -}; - -static const BitmapCharRec ch161 = {1,10,-1,3,3,ch161data}; - -/* char: 0xa0 */ - -#ifdef _WIN32 -/* XXX Work around Microsoft OpenGL 1.1 bug where glBitmap with - a height or width of zero does not advance the raster position - as specified by OpenGL. (Cosmo OpenGL does not have this bug.) */ -static const GLubyte ch160data[] = { 0x0 }; -static const BitmapCharRec ch160 = {1,1,0,0,4,ch160data}; -#else -static const BitmapCharRec ch160 = {0,0,0,0,4,0}; -#endif - -/* char: 0x7e '~' */ - -static const GLubyte ch126data[] = { -0x98,0x64, -}; - -static const BitmapCharRec ch126 = {6,2,0,-3,7,ch126data}; - -/* char: 0x7d '}' */ - -static const GLubyte ch125data[] = { -0xc0,0x20,0x20,0x20,0x20,0x20,0x10,0x20,0x20,0x20,0x20,0xc0, -}; - -static const BitmapCharRec ch125 = {4,12,0,3,4,ch125data}; - -/* char: 0x7c '|' */ - -static const GLubyte ch124data[] = { -0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80, -}; - -static const BitmapCharRec ch124 = {1,12,-1,3,3,ch124data}; - -/* char: 0x7b '{' */ - -static const GLubyte ch123data[] = { -0x30,0x40,0x40,0x40,0x40,0x40,0x80,0x40,0x40,0x40,0x40,0x30, -}; - -static const BitmapCharRec ch123 = {4,12,0,3,4,ch123data}; - -/* char: 0x7a 'z' */ - -static const GLubyte ch122data[] = { -0xf0,0x80,0x40,0x40,0x20,0x10,0xf0, -}; - -static const BitmapCharRec ch122 = {4,7,-1,0,6,ch122data}; - -/* char: 0x79 'y' */ - -static const GLubyte ch121data[] = { -0x80,0x40,0x20,0x20,0x50,0x50,0x90,0x88,0x88,0x88, -}; - -static const BitmapCharRec ch121 = {5,10,-1,3,7,ch121data}; - -/* char: 0x78 'x' */ - -static const GLubyte ch120data[] = { -0x84,0x84,0x48,0x30,0x30,0x48,0x84, -}; - -static const BitmapCharRec ch120 = {6,7,0,0,6,ch120data}; - -/* char: 0x77 'w' */ - -static const GLubyte ch119data[] = { -0x22,0x0,0x22,0x0,0x55,0x0,0x49,0x0,0x49,0x0,0x88,0x80,0x88,0x80, -}; - -static const BitmapCharRec ch119 = {9,7,0,0,9,ch119data}; - -/* char: 0x76 'v' */ - -static const GLubyte ch118data[] = { -0x20,0x20,0x50,0x50,0x88,0x88,0x88, -}; - -static const BitmapCharRec ch118 = {5,7,-1,0,7,ch118data}; - -/* char: 0x75 'u' */ - -static const GLubyte ch117data[] = { -0x68,0x98,0x88,0x88,0x88,0x88,0x88, -}; - -static const BitmapCharRec ch117 = {5,7,-1,0,7,ch117data}; - -/* char: 0x74 't' */ - -static const GLubyte ch116data[] = { -0x60,0x40,0x40,0x40,0x40,0x40,0xe0,0x40,0x40, -}; - -static const BitmapCharRec ch116 = {3,9,0,0,3,ch116data}; - -/* char: 0x73 's' */ - -static const GLubyte ch115data[] = { -0x60,0x90,0x10,0x60,0x80,0x90,0x60, -}; - -static const BitmapCharRec ch115 = {4,7,-1,0,6,ch115data}; - -/* char: 0x72 'r' */ - -static const GLubyte ch114data[] = { -0x80,0x80,0x80,0x80,0x80,0xc0,0xa0, -}; - -static const BitmapCharRec ch114 = {3,7,-1,0,4,ch114data}; - -/* char: 0x71 'q' */ - -static const GLubyte ch113data[] = { -0x8,0x8,0x8,0x68,0x98,0x88,0x88,0x88,0x98,0x68, -}; - -static const BitmapCharRec ch113 = {5,10,-1,3,7,ch113data}; - -/* char: 0x70 'p' */ - -static const GLubyte ch112data[] = { -0x80,0x80,0x80,0xb0,0xc8,0x88,0x88,0x88,0xc8,0xb0, -}; - -static const BitmapCharRec ch112 = {5,10,-1,3,7,ch112data}; - -/* char: 0x6f 'o' */ - -static const GLubyte ch111data[] = { -0x70,0x88,0x88,0x88,0x88,0x88,0x70, -}; - -static const BitmapCharRec ch111 = {5,7,-1,0,7,ch111data}; - -/* char: 0x6e 'n' */ - -static const GLubyte ch110data[] = { -0x88,0x88,0x88,0x88,0x88,0xc8,0xb0, -}; - -static const BitmapCharRec ch110 = {5,7,-1,0,7,ch110data}; - -/* char: 0x6d 'm' */ - -static const GLubyte ch109data[] = { -0x92,0x92,0x92,0x92,0x92,0xda,0xa4, -}; - -static const BitmapCharRec ch109 = {7,7,-1,0,9,ch109data}; - -/* char: 0x6c 'l' */ - -static const GLubyte ch108data[] = { -0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80, -}; - -static const BitmapCharRec ch108 = {1,9,-1,0,3,ch108data}; - -/* char: 0x6b 'k' */ - -static const GLubyte ch107data[] = { -0x88,0x90,0xa0,0xc0,0xc0,0xa0,0x90,0x80,0x80, -}; - -static const BitmapCharRec ch107 = {5,9,-1,0,6,ch107data}; - -/* char: 0x6a 'j' */ - -static const GLubyte ch106data[] = { -0x80,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x0,0x40, -}; - -static const BitmapCharRec ch106 = {2,12,0,3,3,ch106data}; - -/* char: 0x69 'i' */ - -static const GLubyte ch105data[] = { -0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x0,0x80, -}; - -static const BitmapCharRec ch105 = {1,9,-1,0,3,ch105data}; - -/* char: 0x68 'h' */ - -static const GLubyte ch104data[] = { -0x88,0x88,0x88,0x88,0x88,0xc8,0xb0,0x80,0x80, -}; - -static const BitmapCharRec ch104 = {5,9,-1,0,7,ch104data}; - -/* char: 0x67 'g' */ - -static const GLubyte ch103data[] = { -0x70,0x88,0x8,0x68,0x98,0x88,0x88,0x88,0x98,0x68, -}; - -static const BitmapCharRec ch103 = {5,10,-1,3,7,ch103data}; - -/* char: 0x66 'f' */ - -static const GLubyte ch102data[] = { -0x40,0x40,0x40,0x40,0x40,0x40,0xe0,0x40,0x30, -}; - -static const BitmapCharRec ch102 = {4,9,0,0,3,ch102data}; - -/* char: 0x65 'e' */ - -static const GLubyte ch101data[] = { -0x70,0x88,0x80,0xf8,0x88,0x88,0x70, -}; - -static const BitmapCharRec ch101 = {5,7,-1,0,7,ch101data}; - -/* char: 0x64 'd' */ - -static const GLubyte ch100data[] = { -0x68,0x98,0x88,0x88,0x88,0x98,0x68,0x8,0x8, -}; - -static const BitmapCharRec ch100 = {5,9,-1,0,7,ch100data}; - -/* char: 0x63 'c' */ - -static const GLubyte ch99data[] = { -0x70,0x88,0x80,0x80,0x80,0x88,0x70, -}; - -static const BitmapCharRec ch99 = {5,7,-1,0,7,ch99data}; - -/* char: 0x62 'b' */ - -static const GLubyte ch98data[] = { -0xb0,0xc8,0x88,0x88,0x88,0xc8,0xb0,0x80,0x80, -}; - -static const BitmapCharRec ch98 = {5,9,-1,0,7,ch98data}; - -/* char: 0x61 'a' */ - -static const GLubyte ch97data[] = { -0x74,0x88,0x88,0x78,0x8,0x88,0x70, -}; - -static const BitmapCharRec ch97 = {6,7,-1,0,7,ch97data}; - -/* char: 0x60 '`' */ - -static const GLubyte ch96data[] = { -0xc0,0x80,0x40, -}; - -static const BitmapCharRec ch96 = {2,3,0,-6,3,ch96data}; - -/* char: 0x5f '_' */ - -static const GLubyte ch95data[] = { -0xfe, -}; - -static const BitmapCharRec ch95 = {7,1,0,2,7,ch95data}; - -/* char: 0x5e '^' */ - -static const GLubyte ch94data[] = { -0x88,0x50,0x20, -}; - -static const BitmapCharRec ch94 = {5,3,0,-5,6,ch94data}; - -/* char: 0x5d ']' */ - -static const GLubyte ch93data[] = { -0xc0,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0xc0, -}; - -static const BitmapCharRec ch93 = {2,12,0,3,3,ch93data}; - -/* char: 0x5c '\' */ - -static const GLubyte ch92data[] = { -0x10,0x10,0x20,0x20,0x20,0x40,0x40,0x80,0x80, -}; - -static const BitmapCharRec ch92 = {4,9,0,0,4,ch92data}; - -/* char: 0x5b '[' */ - -static const GLubyte ch91data[] = { -0xc0,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0xc0, -}; - -static const BitmapCharRec ch91 = {2,12,-1,3,3,ch91data}; - -/* char: 0x5a 'Z' */ - -static const GLubyte ch90data[] = { -0xfe,0x80,0x40,0x20,0x10,0x8,0x4,0x2,0xfe, -}; - -static const BitmapCharRec ch90 = {7,9,-1,0,9,ch90data}; - -/* char: 0x59 'Y' */ - -static const GLubyte ch89data[] = { -0x10,0x10,0x10,0x10,0x28,0x44,0x44,0x82,0x82, -}; - -static const BitmapCharRec ch89 = {7,9,-1,0,9,ch89data}; - -/* char: 0x58 'X' */ - -static const GLubyte ch88data[] = { -0x82,0x44,0x44,0x28,0x10,0x28,0x44,0x44,0x82, -}; - -static const BitmapCharRec ch88 = {7,9,-1,0,9,ch88data}; - -/* char: 0x57 'W' */ - -static const GLubyte ch87data[] = { -0x22,0x0,0x22,0x0,0x22,0x0,0x55,0x0,0x55,0x0,0x49,0x0,0x88,0x80,0x88,0x80, -0x88,0x80, -}; - -static const BitmapCharRec ch87 = {9,9,-1,0,11,ch87data}; - -/* char: 0x56 'V' */ - -static const GLubyte ch86data[] = { -0x10,0x10,0x28,0x28,0x44,0x44,0x44,0x82,0x82, -}; - -static const BitmapCharRec ch86 = {7,9,-1,0,9,ch86data}; - -/* char: 0x55 'U' */ - -static const GLubyte ch85data[] = { -0x78,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84, -}; - -static const BitmapCharRec ch85 = {6,9,-1,0,8,ch85data}; - -/* char: 0x54 'T' */ - -static const GLubyte ch84data[] = { -0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0xfe, -}; - -static const BitmapCharRec ch84 = {7,9,0,0,7,ch84data}; - -/* char: 0x53 'S' */ - -static const GLubyte ch83data[] = { -0x78,0x84,0x84,0x4,0x18,0x60,0x80,0x84,0x78, -}; - -static const BitmapCharRec ch83 = {6,9,-1,0,8,ch83data}; - -/* char: 0x52 'R' */ - -static const GLubyte ch82data[] = { -0x84,0x84,0x84,0x88,0xf8,0x84,0x84,0x84,0xf8, -}; - -static const BitmapCharRec ch82 = {6,9,-1,0,8,ch82data}; - -/* char: 0x51 'Q' */ - -static const GLubyte ch81data[] = { -0x3d,0x42,0x85,0x89,0x81,0x81,0x81,0x42,0x3c, -}; - -static const BitmapCharRec ch81 = {8,9,-1,0,10,ch81data}; - -/* char: 0x50 'P' */ - -static const GLubyte ch80data[] = { -0x80,0x80,0x80,0x80,0xf8,0x84,0x84,0x84,0xf8, -}; - -static const BitmapCharRec ch80 = {6,9,-1,0,8,ch80data}; - -/* char: 0x4f 'O' */ - -static const GLubyte ch79data[] = { -0x3c,0x42,0x81,0x81,0x81,0x81,0x81,0x42,0x3c, -}; - -static const BitmapCharRec ch79 = {8,9,-1,0,10,ch79data}; - -/* char: 0x4e 'N' */ - -static const GLubyte ch78data[] = { -0x82,0x86,0x8a,0x8a,0x92,0xa2,0xa2,0xc2,0x82, -}; - -static const BitmapCharRec ch78 = {7,9,-1,0,9,ch78data}; - -/* char: 0x4d 'M' */ - -static const GLubyte ch77data[] = { -0x88,0x80,0x88,0x80,0x94,0x80,0x94,0x80,0xa2,0x80,0xa2,0x80,0xc1,0x80,0xc1,0x80, -0x80,0x80, -}; - -static const BitmapCharRec ch77 = {9,9,-1,0,11,ch77data}; - -/* char: 0x4c 'L' */ - -static const GLubyte ch76data[] = { -0xf8,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80, -}; - -static const BitmapCharRec ch76 = {5,9,-1,0,7,ch76data}; - -/* char: 0x4b 'K' */ - -static const GLubyte ch75data[] = { -0x82,0x84,0x88,0x90,0xe0,0xa0,0x90,0x88,0x84, -}; - -static const BitmapCharRec ch75 = {7,9,-1,0,8,ch75data}; - -/* char: 0x4a 'J' */ - -static const GLubyte ch74data[] = { -0x70,0x88,0x88,0x8,0x8,0x8,0x8,0x8,0x8, -}; - -static const BitmapCharRec ch74 = {5,9,-1,0,7,ch74data}; - -/* char: 0x49 'I' */ - -static const GLubyte ch73data[] = { -0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80, -}; - -static const BitmapCharRec ch73 = {1,9,-1,0,3,ch73data}; - -/* char: 0x48 'H' */ - -static const GLubyte ch72data[] = { -0x82,0x82,0x82,0x82,0xfe,0x82,0x82,0x82,0x82, -}; - -static const BitmapCharRec ch72 = {7,9,-1,0,9,ch72data}; - -/* char: 0x47 'G' */ - -static const GLubyte ch71data[] = { -0x3a,0x46,0x82,0x82,0x8e,0x80,0x80,0x42,0x3c, -}; - -static const BitmapCharRec ch71 = {7,9,-1,0,9,ch71data}; - -/* char: 0x46 'F' */ - -static const GLubyte ch70data[] = { -0x80,0x80,0x80,0x80,0xf8,0x80,0x80,0x80,0xfc, -}; - -static const BitmapCharRec ch70 = {6,9,-1,0,8,ch70data}; - -/* char: 0x45 'E' */ - -static const GLubyte ch69data[] = { -0xfc,0x80,0x80,0x80,0xfc,0x80,0x80,0x80,0xfc, -}; - -static const BitmapCharRec ch69 = {6,9,-1,0,8,ch69data}; - -/* char: 0x44 'D' */ - -static const GLubyte ch68data[] = { -0xf8,0x84,0x82,0x82,0x82,0x82,0x82,0x84,0xf8, -}; - -static const BitmapCharRec ch68 = {7,9,-1,0,9,ch68data}; - -/* char: 0x43 'C' */ - -static const GLubyte ch67data[] = { -0x3c,0x42,0x80,0x80,0x80,0x80,0x80,0x42,0x3c, -}; - -static const BitmapCharRec ch67 = {7,9,-1,0,9,ch67data}; - -/* char: 0x42 'B' */ - -static const GLubyte ch66data[] = { -0xf8,0x84,0x84,0x84,0xf8,0x84,0x84,0x84,0xf8, -}; - -static const BitmapCharRec ch66 = {6,9,-1,0,8,ch66data}; - -/* char: 0x41 'A' */ - -static const GLubyte ch65data[] = { -0x82,0x82,0x82,0x7c,0x44,0x44,0x28,0x28,0x10, -}; - -static const BitmapCharRec ch65 = {7,9,-1,0,9,ch65data}; - -/* char: 0x40 '@' */ - -static const GLubyte ch64data[] = { -0x3e,0x0,0x40,0x0,0x9b,0x0,0xa6,0x80,0xa2,0x40,0xa2,0x40,0x92,0x40,0x4d,0x40, -0x60,0x80,0x1f,0x0, -}; - -static const BitmapCharRec ch64 = {10,10,-1,1,12,ch64data}; - -/* char: 0x3f '?' */ - -static const GLubyte ch63data[] = { -0x20,0x0,0x20,0x20,0x10,0x10,0x88,0x88,0x70, -}; - -static const BitmapCharRec ch63 = {5,9,-1,0,7,ch63data}; - -/* char: 0x3e '>' */ - -static const GLubyte ch62data[] = { -0xc0,0x30,0xc,0x30,0xc0, -}; - -static const BitmapCharRec ch62 = {6,5,-1,-1,7,ch62data}; - -/* char: 0x3d '=' */ - -static const GLubyte ch61data[] = { -0xf8,0x0,0xf8, -}; - -static const BitmapCharRec ch61 = {5,3,-1,-2,7,ch61data}; - -/* char: 0x3c '<' */ - -static const GLubyte ch60data[] = { -0xc,0x30,0xc0,0x30,0xc, -}; - -static const BitmapCharRec ch60 = {6,5,0,-1,7,ch60data}; - -/* char: 0x3b ';' */ - -static const GLubyte ch59data[] = { -0x80,0x40,0x40,0x0,0x0,0x0,0x0,0x40, -}; - -static const BitmapCharRec ch59 = {2,8,0,2,3,ch59data}; - -/* char: 0x3a ':' */ - -static const GLubyte ch58data[] = { -0x80,0x0,0x0,0x0,0x0,0x80, -}; - -static const BitmapCharRec ch58 = {1,6,-1,0,3,ch58data}; - -/* char: 0x39 '9' */ - -static const GLubyte ch57data[] = { -0x70,0x88,0x8,0x8,0x78,0x88,0x88,0x88,0x70, -}; - -static const BitmapCharRec ch57 = {5,9,-1,0,7,ch57data}; - -/* char: 0x38 '8' */ - -static const GLubyte ch56data[] = { -0x70,0x88,0x88,0x88,0x88,0x70,0x88,0x88,0x70, -}; - -static const BitmapCharRec ch56 = {5,9,-1,0,7,ch56data}; - -/* char: 0x37 '7' */ - -static const GLubyte ch55data[] = { -0x40,0x40,0x20,0x20,0x20,0x10,0x10,0x8,0xf8, -}; - -static const BitmapCharRec ch55 = {5,9,-1,0,7,ch55data}; - -/* char: 0x36 '6' */ - -static const GLubyte ch54data[] = { -0x70,0x88,0x88,0x88,0xc8,0xb0,0x80,0x88,0x70, -}; - -static const BitmapCharRec ch54 = {5,9,-1,0,7,ch54data}; - -/* char: 0x35 '5' */ - -static const GLubyte ch53data[] = { -0x70,0x88,0x88,0x8,0x8,0xf0,0x80,0x80,0xf8, -}; - -static const BitmapCharRec ch53 = {5,9,-1,0,7,ch53data}; - -/* char: 0x34 '4' */ - -static const GLubyte ch52data[] = { -0x8,0x8,0xfc,0x88,0x48,0x28,0x28,0x18,0x8, -}; - -static const BitmapCharRec ch52 = {6,9,0,0,7,ch52data}; - -/* char: 0x33 '3' */ - -static const GLubyte ch51data[] = { -0x70,0x88,0x88,0x8,0x8,0x30,0x8,0x88,0x70, -}; - -static const BitmapCharRec ch51 = {5,9,-1,0,7,ch51data}; - -/* char: 0x32 '2' */ - -static const GLubyte ch50data[] = { -0xf8,0x80,0x80,0x40,0x20,0x10,0x8,0x88,0x70, -}; - -static const BitmapCharRec ch50 = {5,9,-1,0,7,ch50data}; - -/* char: 0x31 '1' */ - -static const GLubyte ch49data[] = { -0x20,0x20,0x20,0x20,0x20,0x20,0x20,0xe0,0x20, -}; - -static const BitmapCharRec ch49 = {3,9,-1,0,7,ch49data}; - -/* char: 0x30 '0' */ - -static const GLubyte ch48data[] = { -0x70,0x88,0x88,0x88,0x88,0x88,0x88,0x88,0x70, -}; - -static const BitmapCharRec ch48 = {5,9,-1,0,7,ch48data}; - -/* char: 0x2f '/' */ - -static const GLubyte ch47data[] = { -0x80,0x80,0x40,0x40,0x40,0x20,0x20,0x10,0x10, -}; - -static const BitmapCharRec ch47 = {4,9,0,0,4,ch47data}; - -/* char: 0x2e '.' */ - -static const GLubyte ch46data[] = { -0x80, -}; - -static const BitmapCharRec ch46 = {1,1,-1,0,3,ch46data}; - -/* char: 0x2d '-' */ - -static const GLubyte ch45data[] = { -0xf8, -}; - -static const BitmapCharRec ch45 = {5,1,-1,-3,8,ch45data}; - -/* char: 0x2c ',' */ - -static const GLubyte ch44data[] = { -0x80,0x40,0x40, -}; - -static const BitmapCharRec ch44 = {2,3,-1,2,4,ch44data}; - -/* char: 0x2b '+' */ - -static const GLubyte ch43data[] = { -0x20,0x20,0xf8,0x20,0x20, -}; - -static const BitmapCharRec ch43 = {5,5,-1,-1,7,ch43data}; - -/* char: 0x2a '*' */ - -static const GLubyte ch42data[] = { -0xa0,0x40,0xa0, -}; - -static const BitmapCharRec ch42 = {3,3,-1,-6,5,ch42data}; - -/* char: 0x29 ')' */ - -static const GLubyte ch41data[] = { -0x80,0x40,0x40,0x20,0x20,0x20,0x20,0x20,0x20,0x40,0x40,0x80, -}; - -static const BitmapCharRec ch41 = {3,12,0,3,4,ch41data}; - -/* char: 0x28 '(' */ - -static const GLubyte ch40data[] = { -0x20,0x40,0x40,0x80,0x80,0x80,0x80,0x80,0x80,0x40,0x40,0x20, -}; - -static const BitmapCharRec ch40 = {3,12,-1,3,4,ch40data}; - -/* char: 0x27 ''' */ - -static const GLubyte ch39data[] = { -0x80,0x40,0xc0, -}; - -static const BitmapCharRec ch39 = {2,3,-1,-6,3,ch39data}; - -/* char: 0x26 '&' */ - -static const GLubyte ch38data[] = { -0x72,0x8c,0x84,0x8a,0x50,0x30,0x48,0x48,0x30, -}; - -static const BitmapCharRec ch38 = {7,9,-1,0,9,ch38data}; - -/* char: 0x25 '%' */ - -static const GLubyte ch37data[] = { -0x23,0x0,0x14,0x80,0x14,0x80,0x13,0x0,0x8,0x0,0x68,0x0,0x94,0x0,0x94,0x0, -0x62,0x0, -}; - -static const BitmapCharRec ch37 = {9,9,-1,0,11,ch37data}; - -/* char: 0x24 '$' */ - -static const GLubyte ch36data[] = { -0x20,0x70,0xa8,0xa8,0x28,0x70,0xa0,0xa8,0x70,0x20, -}; - -static const BitmapCharRec ch36 = {5,10,-1,1,7,ch36data}; - -/* char: 0x23 '#' */ - -static const GLubyte ch35data[] = { -0x50,0x50,0x50,0xfc,0x28,0xfc,0x28,0x28, -}; - -static const BitmapCharRec ch35 = {6,8,0,0,7,ch35data}; - -/* char: 0x22 '"' */ - -static const GLubyte ch34data[] = { -0xa0,0xa0,0xa0, -}; - -static const BitmapCharRec ch34 = {3,3,-1,-6,5,ch34data}; - -/* char: 0x21 '!' */ - -static const GLubyte ch33data[] = { -0x80,0x0,0x80,0x80,0x80,0x80,0x80,0x80,0x80, -}; - -static const BitmapCharRec ch33 = {1,9,-1,0,3,ch33data}; - -/* char: 0x20 ' ' */ - -#ifdef _WIN32 -/* XXX Work around Microsoft OpenGL 1.1 bug where glBitmap with - a height or width of zero does not advance the raster position - as specified by OpenGL. (Cosmo OpenGL does not have this bug.) */ -static const GLubyte ch32data[] = { 0x0 }; -static const BitmapCharRec ch32 = {1,1,0,0,4,ch32data}; -#else -static const BitmapCharRec ch32 = {0,0,0,0,4,0}; -#endif - -static const BitmapCharRec * const chars[] = { -&ch32, -&ch33, -&ch34, -&ch35, -&ch36, -&ch37, -&ch38, -&ch39, -&ch40, -&ch41, -&ch42, -&ch43, -&ch44, -&ch45, -&ch46, -&ch47, -&ch48, -&ch49, -&ch50, -&ch51, -&ch52, -&ch53, -&ch54, -&ch55, -&ch56, -&ch57, -&ch58, -&ch59, -&ch60, -&ch61, -&ch62, -&ch63, -&ch64, -&ch65, -&ch66, -&ch67, -&ch68, -&ch69, -&ch70, -&ch71, -&ch72, -&ch73, -&ch74, -&ch75, -&ch76, -&ch77, -&ch78, -&ch79, -&ch80, -&ch81, -&ch82, -&ch83, -&ch84, -&ch85, -&ch86, -&ch87, -&ch88, -&ch89, -&ch90, -&ch91, -&ch92, -&ch93, -&ch94, -&ch95, -&ch96, -&ch97, -&ch98, -&ch99, -&ch100, -&ch101, -&ch102, -&ch103, -&ch104, -&ch105, -&ch106, -&ch107, -&ch108, -&ch109, -&ch110, -&ch111, -&ch112, -&ch113, -&ch114, -&ch115, -&ch116, -&ch117, -&ch118, -&ch119, -&ch120, -&ch121, -&ch122, -&ch123, -&ch124, -&ch125, -&ch126, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -&ch160, -&ch161, -&ch162, -&ch163, -&ch164, -&ch165, -&ch166, -&ch167, -&ch168, -&ch169, -&ch170, -&ch171, -&ch172, -&ch173, -&ch174, -&ch175, -&ch176, -&ch177, -&ch178, -&ch179, -&ch180, -&ch181, -&ch182, -&ch183, -&ch184, -&ch185, -&ch186, -&ch187, -&ch188, -&ch189, -&ch190, -&ch191, -&ch192, -&ch193, -&ch194, -&ch195, -&ch196, -&ch197, -&ch198, -&ch199, -&ch200, -&ch201, -&ch202, -&ch203, -&ch204, -&ch205, -&ch206, -&ch207, -&ch208, -&ch209, -&ch210, -&ch211, -&ch212, -&ch213, -&ch214, -&ch215, -&ch216, -&ch217, -&ch218, -&ch219, -&ch220, -&ch221, -&ch222, -&ch223, -&ch224, -&ch225, -&ch226, -&ch227, -&ch228, -&ch229, -&ch230, -&ch231, -&ch232, -&ch233, -&ch234, -&ch235, -&ch236, -&ch237, -&ch238, -&ch239, -&ch240, -&ch241, -&ch242, -&ch243, -&ch244, -&ch245, -&ch246, -&ch247, -&ch248, -&ch249, -&ch250, -&ch251, -&ch252, -&ch253, -&ch254, -&ch255, -}; - -#if !defined(__IBMCPP__) -const -#endif -BitmapFontRec glutBitmapHelvetica12 = { -"-adobe-helvetica-medium-r-normal--12-120-75-75-p-67-iso8859-1", -224, -32, -chars -}; - diff --git a/src/glut/os2/glut_hel18.cpp b/src/glut/os2/glut_hel18.cpp deleted file mode 100644 index 8fe76332b2..0000000000 --- a/src/glut/os2/glut_hel18.cpp +++ /dev/null @@ -1,1900 +0,0 @@ - -/* GENERATED FILE -- DO NOT MODIFY */ - -#define glutBitmapHelvetica18 XXX -#include "glutbitmap.h" -#undef glutBitmapHelvetica18 - -/* char: 0xff */ - -static const GLubyte ch255data[] = { -0x70,0x70,0x18,0x18,0x18,0x18,0x3c,0x24,0x66,0x66,0x66,0xc3,0xc3,0xc3,0x0,0x66, -0x66, -}; - -static const BitmapCharRec ch255 = {8,17,-1,4,10,ch255data}; - -/* char: 0xfe */ - -static const GLubyte ch254data[] = { -0xc0,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x0,0xde,0x0,0xff,0x0,0xe3,0x0,0xc1,0x80, -0xc1,0x80,0xc1,0x80,0xc1,0x80,0xe3,0x0,0xff,0x0,0xde,0x0,0xc0,0x0,0xc0,0x0, -0xc0,0x0,0xc0,0x0, -}; - -static const BitmapCharRec ch254 = {9,18,-1,4,11,ch254data}; - -/* char: 0xfd */ - -static const GLubyte ch253data[] = { -0x70,0x70,0x18,0x18,0x18,0x18,0x3c,0x24,0x66,0x66,0x66,0xc3,0xc3,0xc3,0x0,0x18, -0xc,0x6, -}; - -static const BitmapCharRec ch253 = {8,18,-1,4,10,ch253data}; - -/* char: 0xfc */ - -static const GLubyte ch252data[] = { -0x73,0xfb,0xc7,0xc3,0xc3,0xc3,0xc3,0xc3,0xc3,0xc3,0x0,0x66,0x66, -}; - -static const BitmapCharRec ch252 = {8,13,-1,0,10,ch252data}; - -/* char: 0xfb */ - -static const GLubyte ch251data[] = { -0x73,0xfb,0xc7,0xc3,0xc3,0xc3,0xc3,0xc3,0xc3,0xc3,0x0,0x66,0x3c,0x18, -}; - -static const BitmapCharRec ch251 = {8,14,-1,0,10,ch251data}; - -/* char: 0xfa */ - -static const GLubyte ch250data[] = { -0x73,0xfb,0xc7,0xc3,0xc3,0xc3,0xc3,0xc3,0xc3,0xc3,0x0,0x18,0xc,0x6, -}; - -static const BitmapCharRec ch250 = {8,14,-1,0,10,ch250data}; - -/* char: 0xf9 */ - -static const GLubyte ch249data[] = { -0x73,0xfb,0xc7,0xc3,0xc3,0xc3,0xc3,0xc3,0xc3,0xc3,0x0,0xc,0x18,0x30, -}; - -static const BitmapCharRec ch249 = {8,14,-1,0,10,ch249data}; - -/* char: 0xf8 */ - -static const GLubyte ch248data[] = { -0xce,0x0,0x7f,0x80,0x31,0x80,0x78,0xc0,0x6c,0xc0,0x66,0xc0,0x63,0xc0,0x31,0x80, -0x3f,0xc0,0xe,0x60, -}; - -static const BitmapCharRec ch248 = {11,10,0,0,11,ch248data}; - -/* char: 0xf7 */ - -static const GLubyte ch247data[] = { -0x18,0x18,0x0,0xff,0xff,0x0,0x18,0x18, -}; - -static const BitmapCharRec ch247 = {8,8,-1,-1,10,ch247data}; - -/* char: 0xf6 */ - -static const GLubyte ch246data[] = { -0x3e,0x0,0x7f,0x0,0x63,0x0,0xc1,0x80,0xc1,0x80,0xc1,0x80,0xc1,0x80,0x63,0x0, -0x7f,0x0,0x3e,0x0,0x0,0x0,0x36,0x0,0x36,0x0, -}; - -static const BitmapCharRec ch246 = {9,13,-1,0,11,ch246data}; - -/* char: 0xf5 */ - -static const GLubyte ch245data[] = { -0x3e,0x0,0x7f,0x0,0x63,0x0,0xc1,0x80,0xc1,0x80,0xc1,0x80,0xc1,0x80,0x63,0x0, -0x7f,0x0,0x3e,0x0,0x0,0x0,0x26,0x0,0x2d,0x0,0x19,0x0, -}; - -static const BitmapCharRec ch245 = {9,14,-1,0,11,ch245data}; - -/* char: 0xf4 */ - -static const GLubyte ch244data[] = { -0x3e,0x0,0x7f,0x0,0x63,0x0,0xc1,0x80,0xc1,0x80,0xc1,0x80,0xc1,0x80,0x63,0x0, -0x7f,0x0,0x3e,0x0,0x0,0x0,0x33,0x0,0x1e,0x0,0xc,0x0, -}; - -static const BitmapCharRec ch244 = {9,14,-1,0,11,ch244data}; - -/* char: 0xf3 */ - -static const GLubyte ch243data[] = { -0x3e,0x0,0x7f,0x0,0x63,0x0,0xc1,0x80,0xc1,0x80,0xc1,0x80,0xc1,0x80,0x63,0x0, -0x7f,0x0,0x3e,0x0,0x0,0x0,0x18,0x0,0xc,0x0,0x6,0x0, -}; - -static const BitmapCharRec ch243 = {9,14,-1,0,11,ch243data}; - -/* char: 0xf2 */ - -static const GLubyte ch242data[] = { -0x3e,0x0,0x7f,0x0,0x63,0x0,0xc1,0x80,0xc1,0x80,0xc1,0x80,0xc1,0x80,0x63,0x0, -0x7f,0x0,0x3e,0x0,0x0,0x0,0xc,0x0,0x18,0x0,0x30,0x0, -}; - -static const BitmapCharRec ch242 = {9,14,-1,0,11,ch242data}; - -/* char: 0xf1 */ - -static const GLubyte ch241data[] = { -0xc3,0xc3,0xc3,0xc3,0xc3,0xc3,0xc3,0xe3,0xdf,0xce,0x0,0x4c,0x5a,0x32, -}; - -static const BitmapCharRec ch241 = {8,14,-1,0,10,ch241data}; - -/* char: 0xf0 */ - -static const GLubyte ch240data[] = { -0x3e,0x0,0x7f,0x0,0x63,0x0,0xc1,0x80,0xc1,0x80,0xc1,0x80,0xc1,0x80,0x63,0x0, -0x7f,0x0,0x3e,0x0,0x4c,0x0,0x38,0x0,0x36,0x0,0x60,0x0, -}; - -static const BitmapCharRec ch240 = {9,14,-1,0,11,ch240data}; - -/* char: 0xef */ - -static const GLubyte ch239data[] = { -0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x0,0xd8,0xd8, -}; - -static const BitmapCharRec ch239 = {5,13,0,0,4,ch239data}; - -/* char: 0xee */ - -static const GLubyte ch238data[] = { -0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x0,0xcc,0x78,0x30, -}; - -static const BitmapCharRec ch238 = {6,14,1,0,4,ch238data}; - -/* char: 0xed */ - -static const GLubyte ch237data[] = { -0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x0,0xc0,0x60,0x30, -}; - -static const BitmapCharRec ch237 = {4,14,0,0,4,ch237data}; - -/* char: 0xec */ - -static const GLubyte ch236data[] = { -0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x0,0x30,0x60,0xc0, -}; - -static const BitmapCharRec ch236 = {4,14,0,0,4,ch236data}; - -/* char: 0xeb */ - -static const GLubyte ch235data[] = { -0x3c,0x7f,0xe3,0xc0,0xc0,0xff,0xc3,0xc3,0x7e,0x3c,0x0,0x36,0x36, -}; - -static const BitmapCharRec ch235 = {8,13,-1,0,10,ch235data}; - -/* char: 0xea */ - -static const GLubyte ch234data[] = { -0x3c,0x7f,0xe3,0xc0,0xc0,0xff,0xc3,0xc3,0x7e,0x3c,0x0,0x66,0x3c,0x18, -}; - -static const BitmapCharRec ch234 = {8,14,-1,0,10,ch234data}; - -/* char: 0xe9 */ - -static const GLubyte ch233data[] = { -0x3c,0x7f,0xe3,0xc0,0xc0,0xff,0xc3,0xc3,0x7e,0x3c,0x0,0x18,0xc,0x6, -}; - -static const BitmapCharRec ch233 = {8,14,-1,0,10,ch233data}; - -/* char: 0xe8 */ - -static const GLubyte ch232data[] = { -0x3c,0x7f,0xe3,0xc0,0xc0,0xff,0xc3,0xc3,0x7e,0x3c,0x0,0x18,0x30,0x60, -}; - -static const BitmapCharRec ch232 = {8,14,-1,0,10,ch232data}; - -/* char: 0xe7 */ - -static const GLubyte ch231data[] = { -0x78,0x6c,0xc,0x38,0x3e,0x7f,0x63,0xc0,0xc0,0xc0,0xc0,0x63,0x7f,0x3e, -}; - -static const BitmapCharRec ch231 = {8,14,-1,4,10,ch231data}; - -/* char: 0xe6 */ - -static const GLubyte ch230data[] = { -0x75,0xe0,0xef,0xf8,0xc7,0x18,0xc6,0x0,0xe6,0x0,0x7f,0xf8,0xe,0x18,0xc6,0x18, -0xef,0xf0,0x7d,0xe0, -}; - -static const BitmapCharRec ch230 = {13,10,-1,0,15,ch230data}; - -/* char: 0xe5 */ - -static const GLubyte ch229data[] = { -0x76,0xee,0xc6,0xc6,0xe6,0x7e,0xe,0xc6,0xee,0x7c,0x38,0x6c,0x6c,0x38, -}; - -static const BitmapCharRec ch229 = {7,14,-1,0,9,ch229data}; - -/* char: 0xe4 */ - -static const GLubyte ch228data[] = { -0x76,0xee,0xc6,0xc6,0xe6,0x7e,0xe,0xc6,0xee,0x7c,0x0,0x6c,0x6c, -}; - -static const BitmapCharRec ch228 = {7,13,-1,0,9,ch228data}; - -/* char: 0xe3 */ - -static const GLubyte ch227data[] = { -0x76,0xee,0xc6,0xc6,0xe6,0x7e,0xe,0xc6,0xee,0x7c,0x0,0x4c,0x5a,0x32, -}; - -static const BitmapCharRec ch227 = {7,14,-1,0,9,ch227data}; - -/* char: 0xe2 */ - -static const GLubyte ch226data[] = { -0x76,0xee,0xc6,0xc6,0xe6,0x7e,0xe,0xc6,0xee,0x7c,0x0,0x66,0x3c,0x18, -}; - -static const BitmapCharRec ch226 = {7,14,-1,0,9,ch226data}; - -/* char: 0xe1 */ - -static const GLubyte ch225data[] = { -0x76,0xee,0xc6,0xc6,0xe6,0x7e,0xe,0xc6,0xee,0x7c,0x0,0x30,0x18,0xc, -}; - -static const BitmapCharRec ch225 = {7,14,-1,0,9,ch225data}; - -/* char: 0xe0 */ - -static const GLubyte ch224data[] = { -0x76,0xee,0xc6,0xc6,0xe6,0x7e,0xe,0xc6,0xee,0x7c,0x0,0x18,0x30,0x60, -}; - -static const BitmapCharRec ch224 = {7,14,-1,0,9,ch224data}; - -/* char: 0xdf */ - -static const GLubyte ch223data[] = { -0xdc,0xde,0xc6,0xc6,0xc6,0xc6,0xdc,0xdc,0xc6,0xc6,0xc6,0xc6,0x7c,0x38, -}; - -static const BitmapCharRec ch223 = {7,14,-1,0,9,ch223data}; - -/* char: 0xde */ - -static const GLubyte ch222data[] = { -0xc0,0x0,0xc0,0x0,0xc0,0x0,0xff,0x0,0xff,0x80,0xc1,0xc0,0xc0,0xc0,0xc0,0xc0, -0xc1,0xc0,0xff,0x80,0xff,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x0, -}; - -static const BitmapCharRec ch222 = {10,14,-1,0,12,ch222data}; - -/* char: 0xdd */ - -static const GLubyte ch221data[] = { -0x6,0x0,0x6,0x0,0x6,0x0,0x6,0x0,0x6,0x0,0x6,0x0,0xf,0x0,0x19,0x80, -0x30,0xc0,0x30,0xc0,0x60,0x60,0x60,0x60,0xc0,0x30,0xc0,0x30,0x0,0x0,0x6,0x0, -0x3,0x0,0x1,0x80, -}; - -static const BitmapCharRec ch221 = {12,18,-1,0,14,ch221data}; - -/* char: 0xdc */ - -static const GLubyte ch220data[] = { -0x1f,0x0,0x7f,0xc0,0x60,0xc0,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60, -0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0x0,0x0,0x19,0x80, -0x19,0x80, -}; - -static const BitmapCharRec ch220 = {11,17,-1,0,13,ch220data}; - -/* char: 0xdb */ - -static const GLubyte ch219data[] = { -0x1f,0x0,0x7f,0xc0,0x60,0xc0,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60, -0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0x0,0x0,0x19,0x80, -0xf,0x0,0x6,0x0, -}; - -static const BitmapCharRec ch219 = {11,18,-1,0,13,ch219data}; - -/* char: 0xda */ - -static const GLubyte ch218data[] = { -0x1f,0x0,0x7f,0xc0,0x60,0xc0,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60, -0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0x0,0x0,0xc,0x0, -0x6,0x0,0x3,0x0, -}; - -static const BitmapCharRec ch218 = {11,18,-1,0,13,ch218data}; - -/* char: 0xd9 */ - -static const GLubyte ch217data[] = { -0x1f,0x0,0x7f,0xc0,0x60,0xc0,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60, -0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0x0,0x0,0x6,0x0, -0xc,0x0,0x18,0x0, -}; - -static const BitmapCharRec ch217 = {11,18,-1,0,13,ch217data}; - -/* char: 0xd8 */ - -static const GLubyte ch216data[] = { -0xc7,0xc0,0xff,0xf0,0x78,0x38,0x38,0x18,0x6c,0x1c,0x6e,0xc,0x67,0xc,0x63,0x8c, -0x61,0xcc,0x70,0xdc,0x30,0x78,0x38,0x38,0x1f,0xfc,0x7,0xcc, -}; - -static const BitmapCharRec ch216 = {14,14,0,0,15,ch216data}; - -/* char: 0xd7 */ - -static const GLubyte ch215data[] = { -0xc0,0xc0,0x61,0x80,0x33,0x0,0x1e,0x0,0xc,0x0,0x1e,0x0,0x33,0x0,0x61,0x80, -0xc0,0xc0, -}; - -static const BitmapCharRec ch215 = {10,9,0,0,10,ch215data}; - -/* char: 0xd6 */ - -static const GLubyte ch214data[] = { -0xf,0x80,0x3f,0xe0,0x70,0x70,0x60,0x30,0xe0,0x38,0xc0,0x18,0xc0,0x18,0xc0,0x18, -0xc0,0x18,0xe0,0x38,0x60,0x30,0x70,0x70,0x3f,0xe0,0xf,0x80,0x0,0x0,0xd,0x80, -0xd,0x80, -}; - -static const BitmapCharRec ch214 = {13,17,-1,0,15,ch214data}; - -/* char: 0xd5 */ - -static const GLubyte ch213data[] = { -0xf,0x80,0x3f,0xe0,0x70,0x70,0x60,0x30,0xe0,0x38,0xc0,0x18,0xc0,0x18,0xc0,0x18, -0xc0,0x18,0xe0,0x38,0x60,0x30,0x70,0x70,0x3f,0xe0,0xf,0x80,0x0,0x0,0x9,0x80, -0xb,0x40,0x6,0x40, -}; - -static const BitmapCharRec ch213 = {13,18,-1,0,15,ch213data}; - -/* char: 0xd4 */ - -static const GLubyte ch212data[] = { -0xf,0x80,0x3f,0xe0,0x70,0x70,0x60,0x30,0xe0,0x38,0xc0,0x18,0xc0,0x18,0xc0,0x18, -0xc0,0x18,0xe0,0x38,0x60,0x30,0x70,0x70,0x3f,0xe0,0xf,0x80,0x0,0x0,0xc,0xc0, -0x7,0x80,0x3,0x0, -}; - -static const BitmapCharRec ch212 = {13,18,-1,0,15,ch212data}; - -/* char: 0xd3 */ - -static const GLubyte ch211data[] = { -0xf,0x80,0x3f,0xe0,0x70,0x70,0x60,0x30,0xe0,0x38,0xc0,0x18,0xc0,0x18,0xc0,0x18, -0xc0,0x18,0xe0,0x38,0x60,0x30,0x70,0x70,0x3f,0xe0,0xf,0x80,0x0,0x0,0x3,0x0, -0x1,0x80,0x0,0xc0, -}; - -static const BitmapCharRec ch211 = {13,18,-1,0,15,ch211data}; - -/* char: 0xd2 */ - -static const GLubyte ch210data[] = { -0xf,0x80,0x3f,0xe0,0x70,0x70,0x60,0x30,0xe0,0x38,0xc0,0x18,0xc0,0x18,0xc0,0x18, -0xc0,0x18,0xe0,0x38,0x60,0x30,0x70,0x70,0x3f,0xe0,0xf,0x80,0x0,0x0,0x3,0x0, -0x6,0x0,0xc,0x0, -}; - -static const BitmapCharRec ch210 = {13,18,-1,0,15,ch210data}; - -/* char: 0xd1 */ - -static const GLubyte ch209data[] = { -0xc0,0x60,0xc0,0xe0,0xc1,0xe0,0xc1,0xe0,0xc3,0x60,0xc6,0x60,0xc6,0x60,0xcc,0x60, -0xcc,0x60,0xd8,0x60,0xd8,0x60,0xf0,0x60,0xe0,0x60,0xe0,0x60,0x0,0x0,0x13,0x0, -0x16,0x80,0xc,0x80, -}; - -static const BitmapCharRec ch209 = {11,18,-1,0,13,ch209data}; - -/* char: 0xd0 */ - -static const GLubyte ch208data[] = { -0x7f,0x80,0x7f,0xc0,0x60,0xe0,0x60,0x60,0x60,0x30,0x60,0x30,0xfc,0x30,0xfc,0x30, -0x60,0x30,0x60,0x30,0x60,0x60,0x60,0xe0,0x7f,0xc0,0x7f,0x80, -}; - -static const BitmapCharRec ch208 = {12,14,0,0,13,ch208data}; - -/* char: 0xcf */ - -static const GLubyte ch207data[] = { -0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x0,0xcc, -0xcc, -}; - -static const BitmapCharRec ch207 = {6,17,0,0,6,ch207data}; - -/* char: 0xce */ - -static const GLubyte ch206data[] = { -0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x0,0xcc, -0x78,0x30, -}; - -static const BitmapCharRec ch206 = {6,18,0,0,6,ch206data}; - -/* char: 0xcd */ - -static const GLubyte ch205data[] = { -0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0x0,0xc0, -0x60,0x30, -}; - -static const BitmapCharRec ch205 = {4,18,-2,0,6,ch205data}; - -/* char: 0xcc */ - -static const GLubyte ch204data[] = { -0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x0,0x30, -0x60,0xc0, -}; - -static const BitmapCharRec ch204 = {4,18,0,0,6,ch204data}; - -/* char: 0xcb */ - -static const GLubyte ch203data[] = { -0xff,0x80,0xff,0x80,0xc0,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x0,0xff,0x0,0xff,0x0, -0xc0,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x0,0xff,0x80,0xff,0x80,0x0,0x0,0x33,0x0, -0x33,0x0, -}; - -static const BitmapCharRec ch203 = {9,17,-1,0,11,ch203data}; - -/* char: 0xca */ - -static const GLubyte ch202data[] = { -0xff,0x80,0xff,0x80,0xc0,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x0,0xff,0x0,0xff,0x0, -0xc0,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x0,0xff,0x80,0xff,0x80,0x0,0x0,0x33,0x0, -0x1e,0x0,0xc,0x0, -}; - -static const BitmapCharRec ch202 = {9,18,-1,0,11,ch202data}; - -/* char: 0xc9 */ - -static const GLubyte ch201data[] = { -0xff,0x80,0xff,0x80,0xc0,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x0,0xff,0x0,0xff,0x0, -0xc0,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x0,0xff,0x80,0xff,0x80,0x0,0x0,0xc,0x0, -0x6,0x0,0x3,0x0, -}; - -static const BitmapCharRec ch201 = {9,18,-1,0,11,ch201data}; - -/* char: 0xc8 */ - -static const GLubyte ch200data[] = { -0xff,0x80,0xff,0x80,0xc0,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x0,0xff,0x0,0xff,0x0, -0xc0,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x0,0xff,0x80,0xff,0x80,0x0,0x0,0xc,0x0, -0x18,0x0,0x30,0x0, -}; - -static const BitmapCharRec ch200 = {9,18,-1,0,11,ch200data}; - -/* char: 0xc7 */ - -static const GLubyte ch199data[] = { -0x1e,0x0,0x1b,0x0,0x3,0x0,0xe,0x0,0xf,0x80,0x3f,0xe0,0x70,0x70,0x60,0x30, -0xe0,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x0,0xe0,0x0,0x60,0x30,0x70,0x70, -0x3f,0xe0,0xf,0x80, -}; - -static const BitmapCharRec ch199 = {12,18,-1,4,14,ch199data}; - -/* char: 0xc6 */ - -static const GLubyte ch198data[] = { -0xc1,0xff,0xc1,0xff,0x61,0x80,0x61,0x80,0x7f,0x80,0x3f,0x80,0x31,0xfe,0x31,0xfe, -0x19,0x80,0x19,0x80,0xd,0x80,0xd,0x80,0x7,0xff,0x7,0xff, -}; - -static const BitmapCharRec ch198 = {16,14,-1,0,18,ch198data}; - -/* char: 0xc5 */ - -static const GLubyte ch197data[] = { -0xc0,0x30,0xc0,0x30,0x60,0x60,0x60,0x60,0x7f,0xe0,0x3f,0xc0,0x30,0xc0,0x30,0xc0, -0x19,0x80,0x19,0x80,0xf,0x0,0xf,0x0,0x6,0x0,0x6,0x0,0xf,0x0,0x19,0x80, -0x19,0x80,0xf,0x0, -}; - -static const BitmapCharRec ch197 = {12,18,0,0,12,ch197data}; - -/* char: 0xc4 */ - -static const GLubyte ch196data[] = { -0xc0,0x30,0xc0,0x30,0x60,0x60,0x60,0x60,0x7f,0xe0,0x3f,0xc0,0x30,0xc0,0x30,0xc0, -0x19,0x80,0x19,0x80,0xf,0x0,0xf,0x0,0x6,0x0,0x6,0x0,0x0,0x0,0x19,0x80, -0x19,0x80, -}; - -static const BitmapCharRec ch196 = {12,17,0,0,12,ch196data}; - -/* char: 0xc3 */ - -static const GLubyte ch195data[] = { -0xc0,0x30,0xc0,0x30,0x60,0x60,0x60,0x60,0x7f,0xe0,0x3f,0xc0,0x30,0xc0,0x30,0xc0, -0x19,0x80,0x19,0x80,0xf,0x0,0xf,0x0,0x6,0x0,0x6,0x0,0x0,0x0,0x13,0x0, -0x16,0x80,0xc,0x80, -}; - -static const BitmapCharRec ch195 = {12,18,0,0,12,ch195data}; - -/* char: 0xc2 */ - -static const GLubyte ch194data[] = { -0xc0,0x30,0xc0,0x30,0x60,0x60,0x60,0x60,0x7f,0xe0,0x3f,0xc0,0x30,0xc0,0x30,0xc0, -0x19,0x80,0x19,0x80,0xf,0x0,0xf,0x0,0x6,0x0,0x6,0x0,0x0,0x0,0x19,0x80, -0xf,0x0,0x6,0x0, -}; - -static const BitmapCharRec ch194 = {12,18,0,0,12,ch194data}; - -/* char: 0xc1 */ - -static const GLubyte ch193data[] = { -0xc0,0x30,0xc0,0x30,0x60,0x60,0x60,0x60,0x7f,0xe0,0x3f,0xc0,0x30,0xc0,0x30,0xc0, -0x19,0x80,0x19,0x80,0xf,0x0,0xf,0x0,0x6,0x0,0x6,0x0,0x0,0x0,0x6,0x0, -0x3,0x0,0x1,0x80, -}; - -static const BitmapCharRec ch193 = {12,18,0,0,12,ch193data}; - -/* char: 0xc0 */ - -static const GLubyte ch192data[] = { -0xc0,0x30,0xc0,0x30,0x60,0x60,0x60,0x60,0x7f,0xe0,0x3f,0xc0,0x30,0xc0,0x30,0xc0, -0x19,0x80,0x19,0x80,0xf,0x0,0xf,0x0,0x6,0x0,0x6,0x0,0x0,0x0,0x6,0x0, -0xc,0x0,0x18,0x0, -}; - -static const BitmapCharRec ch192 = {12,18,0,0,12,ch192data}; - -/* char: 0xbf */ - -static const GLubyte ch191data[] = { -0x7c,0xfe,0xc6,0xc6,0xe0,0x70,0x38,0x18,0x18,0x18,0x0,0x0,0x18,0x18, -}; - -static const BitmapCharRec ch191 = {7,14,-1,4,10,ch191data}; - -/* char: 0xbe */ - -static const GLubyte ch190data[] = { -0x18,0x18,0x18,0x18,0xc,0xfc,0x6,0xd8,0x6,0x78,0x73,0x38,0xf9,0x18,0x99,0x88, -0x30,0xc0,0x30,0xc0,0x98,0x60,0xf8,0x30,0x70,0x30, -}; - -static const BitmapCharRec ch190 = {14,13,0,0,15,ch190data}; - -/* char: 0xbd */ - -static const GLubyte ch189data[] = { -0x30,0xf8,0x30,0xf8,0x18,0x60,0xc,0x30,0xc,0x18,0x66,0x98,0x62,0xf8,0x63,0x70, -0x61,0x80,0x61,0x80,0xe0,0xc0,0xe0,0x60,0x60,0x60, -}; - -static const BitmapCharRec ch189 = {13,13,-1,0,15,ch189data}; - -/* char: 0xbc */ - -static const GLubyte ch188data[] = { -0x30,0x30,0x30,0x30,0x19,0xf8,0xd,0xb0,0xc,0xf0,0x66,0x70,0x62,0x30,0x63,0x10, -0x61,0x80,0x61,0x80,0xe0,0xc0,0xe0,0x60,0x60,0x60, -}; - -static const BitmapCharRec ch188 = {13,13,-1,0,15,ch188data}; - -/* char: 0xbb */ - -static const GLubyte ch187data[] = { -0x90,0xd8,0x6c,0x36,0x36,0x6c,0xd8,0x90, -}; - -static const BitmapCharRec ch187 = {7,8,-1,-1,9,ch187data}; - -/* char: 0xba */ - -static const GLubyte ch186data[] = { -0xf8,0x0,0x70,0xd8,0x88,0x88,0xd8,0x70, -}; - -static const BitmapCharRec ch186 = {5,8,-1,-6,7,ch186data}; - -/* char: 0xb9 */ - -static const GLubyte ch185data[] = { -0x60,0x60,0x60,0x60,0x60,0xe0,0xe0,0x60, -}; - -static const BitmapCharRec ch185 = {3,8,-1,-5,6,ch185data}; - -/* char: 0xb8 */ - -static const GLubyte ch184data[] = { -0xf0,0xd8,0x18,0x70,0x60, -}; - -static const BitmapCharRec ch184 = {5,5,0,4,5,ch184data}; - -/* char: 0xb7 */ - -static const GLubyte ch183data[] = { -0xc0,0xc0, -}; - -static const BitmapCharRec ch183 = {2,2,-1,-4,4,ch183data}; - -/* char: 0xb6 */ - -static const GLubyte ch182data[] = { -0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x32,0x72,0xf2,0xf2,0xf2,0xf2, -0x72,0x3f, -}; - -static const BitmapCharRec ch182 = {8,18,-1,4,10,ch182data}; - -/* char: 0xb5 */ - -static const GLubyte ch181data[] = { -0xc0,0xc0,0xc0,0xc0,0xdb,0xff,0xe7,0xc3,0xc3,0xc3,0xc3,0xc3,0xc3,0xc3, -}; - -static const BitmapCharRec ch181 = {8,14,-1,4,10,ch181data}; - -/* char: 0xb4 */ - -static const GLubyte ch180data[] = { -0xc0,0x60,0x30, -}; - -static const BitmapCharRec ch180 = {4,3,0,-11,4,ch180data}; - -/* char: 0xb3 */ - -static const GLubyte ch179data[] = { -0x70,0xf8,0x98,0x30,0x30,0x98,0xf8,0x70, -}; - -static const BitmapCharRec ch179 = {5,8,0,-5,6,ch179data}; - -/* char: 0xb2 */ - -static const GLubyte ch178data[] = { -0xf8,0xf8,0x60,0x30,0x18,0x98,0xf8,0x70, -}; - -static const BitmapCharRec ch178 = {5,8,0,-5,6,ch178data}; - -/* char: 0xb1 */ - -static const GLubyte ch177data[] = { -0xff,0xff,0x0,0x18,0x18,0x18,0xff,0xff,0x18,0x18,0x18, -}; - -static const BitmapCharRec ch177 = {8,11,-1,0,10,ch177data}; - -/* char: 0xb0 */ - -static const GLubyte ch176data[] = { -0x70,0xd8,0x88,0xd8,0x70, -}; - -static const BitmapCharRec ch176 = {5,5,-1,-8,7,ch176data}; - -/* char: 0xaf */ - -static const GLubyte ch175data[] = { -0xf8, -}; - -static const BitmapCharRec ch175 = {5,1,0,-12,5,ch175data}; - -/* char: 0xae */ - -static const GLubyte ch174data[] = { -0xf,0x80,0x30,0x60,0x40,0x10,0x48,0x50,0x88,0x88,0x89,0x8,0x8f,0x88,0x88,0x48, -0x88,0x48,0x4f,0x90,0x40,0x10,0x30,0x60,0xf,0x80, -}; - -static const BitmapCharRec ch174 = {13,13,-1,0,14,ch174data}; - -/* char: 0xad */ - -static const GLubyte ch173data[] = { -0xf8,0xf8, -}; - -static const BitmapCharRec ch173 = {5,2,-1,-4,7,ch173data}; - -/* char: 0xac */ - -static const GLubyte ch172data[] = { -0x1,0x80,0x1,0x80,0x1,0x80,0xff,0x80,0xff,0x80, -}; - -static const BitmapCharRec ch172 = {9,5,-1,-3,11,ch172data}; - -/* char: 0xab */ - -static const GLubyte ch171data[] = { -0x12,0x36,0x6c,0xd8,0xd8,0x6c,0x36,0x12, -}; - -static const BitmapCharRec ch171 = {7,8,-1,-1,9,ch171data}; - -/* char: 0xaa */ - -static const GLubyte ch170data[] = { -0xf8,0x0,0x68,0xd8,0x48,0x38,0xc8,0x70, -}; - -static const BitmapCharRec ch170 = {5,8,-1,-6,7,ch170data}; - -/* char: 0xa9 */ - -static const GLubyte ch169data[] = { -0xf,0x80,0x30,0x60,0x40,0x10,0x47,0x10,0x88,0x88,0x90,0x8,0x90,0x8,0x90,0x8, -0x88,0x88,0x47,0x10,0x40,0x10,0x30,0x60,0xf,0x80, -}; - -static const BitmapCharRec ch169 = {13,13,-1,0,15,ch169data}; - -/* char: 0xa8 */ - -static const GLubyte ch168data[] = { -0xd8,0xd8, -}; - -static const BitmapCharRec ch168 = {5,2,0,-11,6,ch168data}; - -/* char: 0xa7 */ - -static const GLubyte ch167data[] = { -0x3c,0x7e,0xc3,0xc3,0x7,0xe,0x3e,0x73,0xe3,0xc3,0xc7,0x6e,0x7c,0xf0,0xc3,0xc3, -0x7e,0x3c, -}; - -static const BitmapCharRec ch167 = {8,18,-1,4,10,ch167data}; - -/* char: 0xa6 */ - -static const GLubyte ch166data[] = { -0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0x0,0x0,0x0,0x0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0, -0xc0, -}; - -static const BitmapCharRec ch166 = {2,17,-1,3,4,ch166data}; - -/* char: 0xa5 */ - -static const GLubyte ch165data[] = { -0x18,0x18,0x18,0x18,0xff,0x18,0xff,0x3c,0x66,0x66,0x66,0xc3,0xc3, -}; - -static const BitmapCharRec ch165 = {8,13,-1,0,10,ch165data}; - -/* char: 0xa4 */ - -static const GLubyte ch164data[] = { -0xc3,0xff,0x66,0x66,0x66,0xff,0xc3, -}; - -static const BitmapCharRec ch164 = {8,7,-1,-3,10,ch164data}; - -/* char: 0xa3 */ - -static const GLubyte ch163data[] = { -0xdf,0x0,0xff,0x80,0x60,0x80,0x30,0x0,0x18,0x0,0x18,0x0,0x7e,0x0,0x30,0x0, -0x60,0x0,0x61,0x80,0x61,0x80,0x3f,0x0,0x1e,0x0, -}; - -static const BitmapCharRec ch163 = {9,13,0,0,10,ch163data}; - -/* char: 0xa2 */ - -static const GLubyte ch162data[] = { -0x10,0x10,0x3e,0x7f,0x6b,0xc8,0xc8,0xc8,0xc8,0x6b,0x7f,0x3e,0x4,0x4, -}; - -static const BitmapCharRec ch162 = {8,14,-1,2,10,ch162data}; - -/* char: 0xa1 */ - -static const GLubyte ch161data[] = { -0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0x40,0x40,0x0,0x0,0xc0,0xc0, -}; - -static const BitmapCharRec ch161 = {2,14,-2,4,6,ch161data}; - -/* char: 0xa0 */ - -#ifdef _WIN32 -/* XXX Work around Microsoft OpenGL 1.1 bug where glBitmap with - a height or width of zero does not advance the raster position - as specified by OpenGL. (Cosmo OpenGL does not have this bug.) */ -static const GLubyte ch160data[] = { 0x0 }; -static const BitmapCharRec ch160 = {1,1,0,0,5,ch160data}; -#else -static const BitmapCharRec ch160 = {0,0,0,0,5,0}; -#endif - -/* char: 0x7e '~' */ - -static const GLubyte ch126data[] = { -0xcc,0x7e,0x33, -}; - -static const BitmapCharRec ch126 = {8,3,-1,-4,10,ch126data}; - -/* char: 0x7d '}' */ - -static const GLubyte ch125data[] = { -0xc0,0x60,0x30,0x30,0x30,0x30,0x30,0x30,0x18,0xc,0x18,0x30,0x30,0x30,0x30,0x30, -0x60,0xc0, -}; - -static const BitmapCharRec ch125 = {6,18,0,4,6,ch125data}; - -/* char: 0x7c '|' */ - -static const GLubyte ch124data[] = { -0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0, -0xc0,0xc0, -}; - -static const BitmapCharRec ch124 = {2,18,-1,4,4,ch124data}; - -/* char: 0x7b '{' */ - -static const GLubyte ch123data[] = { -0xc,0x18,0x30,0x30,0x30,0x30,0x30,0x30,0x60,0xc0,0x60,0x30,0x30,0x30,0x30,0x30, -0x18,0xc, -}; - -static const BitmapCharRec ch123 = {6,18,0,4,6,ch123data}; - -/* char: 0x7a 'z' */ - -static const GLubyte ch122data[] = { -0xfe,0xfe,0xc0,0x60,0x30,0x18,0xc,0x6,0xfe,0xfe, -}; - -static const BitmapCharRec ch122 = {7,10,-1,0,9,ch122data}; - -/* char: 0x79 'y' */ - -static const GLubyte ch121data[] = { -0x70,0x70,0x18,0x18,0x18,0x18,0x3c,0x24,0x66,0x66,0x66,0xc3,0xc3,0xc3, -}; - -static const BitmapCharRec ch121 = {8,14,-1,4,10,ch121data}; - -/* char: 0x78 'x' */ - -static const GLubyte ch120data[] = { -0xc3,0xe7,0x66,0x3c,0x18,0x18,0x3c,0x66,0xe7,0xc3, -}; - -static const BitmapCharRec ch120 = {8,10,-1,0,10,ch120data}; - -/* char: 0x77 'w' */ - -static const GLubyte ch119data[] = { -0x19,0x80,0x19,0x80,0x39,0xc0,0x29,0x40,0x69,0x60,0x66,0x60,0x66,0x60,0xc6,0x30, -0xc6,0x30,0xc6,0x30, -}; - -static const BitmapCharRec ch119 = {12,10,-1,0,14,ch119data}; - -/* char: 0x76 'v' */ - -static const GLubyte ch118data[] = { -0x18,0x18,0x3c,0x24,0x66,0x66,0x66,0xc3,0xc3,0xc3, -}; - -static const BitmapCharRec ch118 = {8,10,-1,0,10,ch118data}; - -/* char: 0x75 'u' */ - -static const GLubyte ch117data[] = { -0x73,0xfb,0xc7,0xc3,0xc3,0xc3,0xc3,0xc3,0xc3,0xc3, -}; - -static const BitmapCharRec ch117 = {8,10,-1,0,10,ch117data}; - -/* char: 0x74 't' */ - -static const GLubyte ch116data[] = { -0x18,0x38,0x30,0x30,0x30,0x30,0x30,0x30,0xfc,0xfc,0x30,0x30,0x30, -}; - -static const BitmapCharRec ch116 = {6,13,0,0,6,ch116data}; - -/* char: 0x73 's' */ - -static const GLubyte ch115data[] = { -0x78,0xfc,0xc6,0x6,0x3e,0xfc,0xc0,0xc6,0x7e,0x3c, -}; - -static const BitmapCharRec ch115 = {7,10,-1,0,9,ch115data}; - -/* char: 0x72 'r' */ - -static const GLubyte ch114data[] = { -0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xe0,0xd8,0xd8, -}; - -static const BitmapCharRec ch114 = {5,10,-1,0,6,ch114data}; - -/* char: 0x71 'q' */ - -static const GLubyte ch113data[] = { -0x1,0x80,0x1,0x80,0x1,0x80,0x1,0x80,0x3d,0x80,0x7f,0x80,0x63,0x80,0xc1,0x80, -0xc1,0x80,0xc1,0x80,0xc1,0x80,0x63,0x80,0x7f,0x80,0x3d,0x80, -}; - -static const BitmapCharRec ch113 = {9,14,-1,4,11,ch113data}; - -/* char: 0x70 'p' */ - -static const GLubyte ch112data[] = { -0xc0,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x0,0xde,0x0,0xff,0x0,0xe3,0x0,0xc1,0x80, -0xc1,0x80,0xc1,0x80,0xc1,0x80,0xe3,0x0,0xff,0x0,0xde,0x0, -}; - -static const BitmapCharRec ch112 = {9,14,-1,4,11,ch112data}; - -/* char: 0x6f 'o' */ - -static const GLubyte ch111data[] = { -0x3e,0x0,0x7f,0x0,0x63,0x0,0xc1,0x80,0xc1,0x80,0xc1,0x80,0xc1,0x80,0x63,0x0, -0x7f,0x0,0x3e,0x0, -}; - -static const BitmapCharRec ch111 = {9,10,-1,0,11,ch111data}; - -/* char: 0x6e 'n' */ - -static const GLubyte ch110data[] = { -0xc3,0xc3,0xc3,0xc3,0xc3,0xc3,0xc3,0xe3,0xdf,0xce, -}; - -static const BitmapCharRec ch110 = {8,10,-1,0,10,ch110data}; - -/* char: 0x6d 'm' */ - -static const GLubyte ch109data[] = { -0xc6,0x30,0xc6,0x30,0xc6,0x30,0xc6,0x30,0xc6,0x30,0xc6,0x30,0xc6,0x30,0xe7,0x30, -0xde,0xf0,0xcc,0x60, -}; - -static const BitmapCharRec ch109 = {12,10,-1,0,14,ch109data}; - -/* char: 0x6c 'l' */ - -static const GLubyte ch108data[] = { -0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0, -}; - -static const BitmapCharRec ch108 = {2,14,-1,0,4,ch108data}; - -/* char: 0x6b 'k' */ - -static const GLubyte ch107data[] = { -0xc7,0xc6,0xce,0xcc,0xd8,0xf8,0xf0,0xd8,0xcc,0xc6,0xc0,0xc0,0xc0,0xc0, -}; - -static const BitmapCharRec ch107 = {8,14,-1,0,9,ch107data}; - -/* char: 0x6a 'j' */ - -static const GLubyte ch106data[] = { -0xe0,0xf0,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x0,0x0, -0x30,0x30, -}; - -static const BitmapCharRec ch106 = {4,18,1,4,4,ch106data}; - -/* char: 0x69 'i' */ - -static const GLubyte ch105data[] = { -0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0x0,0x0,0xc0,0xc0, -}; - -static const BitmapCharRec ch105 = {2,14,-1,0,4,ch105data}; - -/* char: 0x68 'h' */ - -static const GLubyte ch104data[] = { -0xc3,0xc3,0xc3,0xc3,0xc3,0xc3,0xc3,0xe3,0xdf,0xce,0xc0,0xc0,0xc0,0xc0, -}; - -static const BitmapCharRec ch104 = {8,14,-1,0,10,ch104data}; - -/* char: 0x67 'g' */ - -static const GLubyte ch103data[] = { -0x1c,0x0,0x7f,0x0,0x63,0x0,0x1,0x80,0x3d,0x80,0x7f,0x80,0x63,0x80,0xc1,0x80, -0xc1,0x80,0xc1,0x80,0xc1,0x80,0x61,0x80,0x7f,0x80,0x3d,0x80, -}; - -static const BitmapCharRec ch103 = {9,14,-1,4,11,ch103data}; - -/* char: 0x66 'f' */ - -static const GLubyte ch102data[] = { -0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0xfc,0xfc,0x30,0x30,0x3c,0x1c, -}; - -static const BitmapCharRec ch102 = {6,14,0,0,6,ch102data}; - -/* char: 0x65 'e' */ - -static const GLubyte ch101data[] = { -0x3c,0x7f,0xe3,0xc0,0xc0,0xff,0xc3,0xc3,0x7e,0x3c, -}; - -static const BitmapCharRec ch101 = {8,10,-1,0,10,ch101data}; - -/* char: 0x64 'd' */ - -static const GLubyte ch100data[] = { -0x3d,0x80,0x7f,0x80,0x63,0x80,0xc1,0x80,0xc1,0x80,0xc1,0x80,0xc1,0x80,0x63,0x80, -0x7f,0x80,0x3d,0x80,0x1,0x80,0x1,0x80,0x1,0x80,0x1,0x80, -}; - -static const BitmapCharRec ch100 = {9,14,-1,0,11,ch100data}; - -/* char: 0x63 'c' */ - -static const GLubyte ch99data[] = { -0x3e,0x7f,0x63,0xc0,0xc0,0xc0,0xc0,0x63,0x7f,0x3e, -}; - -static const BitmapCharRec ch99 = {8,10,-1,0,10,ch99data}; - -/* char: 0x62 'b' */ - -static const GLubyte ch98data[] = { -0xde,0x0,0xff,0x0,0xe3,0x0,0xc1,0x80,0xc1,0x80,0xc1,0x80,0xc1,0x80,0xe3,0x0, -0xff,0x0,0xde,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x0, -}; - -static const BitmapCharRec ch98 = {9,14,-1,0,11,ch98data}; - -/* char: 0x61 'a' */ - -static const GLubyte ch97data[] = { -0x76,0xee,0xc6,0xc6,0xe6,0x7e,0xe,0xc6,0xee,0x7c, -}; - -static const BitmapCharRec ch97 = {7,10,-1,0,9,ch97data}; - -/* char: 0x60 '`' */ - -static const GLubyte ch96data[] = { -0xc0,0xc0,0x80,0x80,0x40, -}; - -static const BitmapCharRec ch96 = {2,5,-1,-9,4,ch96data}; - -/* char: 0x5f '_' */ - -static const GLubyte ch95data[] = { -0xff,0xc0,0xff,0xc0, -}; - -static const BitmapCharRec ch95 = {10,2,0,4,10,ch95data}; - -/* char: 0x5e '^' */ - -static const GLubyte ch94data[] = { -0x82,0xc6,0x6c,0x38,0x10, -}; - -static const BitmapCharRec ch94 = {7,5,-1,-8,9,ch94data}; - -/* char: 0x5d ']' */ - -static const GLubyte ch93data[] = { -0xf0,0xf0,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30, -0xf0,0xf0, -}; - -static const BitmapCharRec ch93 = {4,18,0,4,5,ch93data}; - -/* char: 0x5c '\' */ - -static const GLubyte ch92data[] = { -0x18,0x18,0x10,0x10,0x30,0x30,0x20,0x20,0x60,0x60,0x40,0x40,0xc0,0xc0, -}; - -static const BitmapCharRec ch92 = {5,14,0,0,5,ch92data}; - -/* char: 0x5b '[' */ - -static const GLubyte ch91data[] = { -0xf0,0xf0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0, -0xf0,0xf0, -}; - -static const BitmapCharRec ch91 = {4,18,-1,4,5,ch91data}; - -/* char: 0x5a 'Z' */ - -static const GLubyte ch90data[] = { -0xff,0xc0,0xff,0xc0,0xc0,0x0,0x60,0x0,0x30,0x0,0x18,0x0,0x1c,0x0,0xc,0x0, -0x6,0x0,0x3,0x0,0x1,0x80,0x0,0xc0,0xff,0xc0,0xff,0xc0, -}; - -static const BitmapCharRec ch90 = {10,14,-1,0,12,ch90data}; - -/* char: 0x59 'Y' */ - -static const GLubyte ch89data[] = { -0x6,0x0,0x6,0x0,0x6,0x0,0x6,0x0,0x6,0x0,0x6,0x0,0xf,0x0,0x19,0x80, -0x30,0xc0,0x30,0xc0,0x60,0x60,0x60,0x60,0xc0,0x30,0xc0,0x30, -}; - -static const BitmapCharRec ch89 = {12,14,-1,0,14,ch89data}; - -/* char: 0x58 'X' */ - -static const GLubyte ch88data[] = { -0xc0,0x60,0xe0,0xe0,0x60,0xc0,0x71,0xc0,0x31,0x80,0x1b,0x0,0xe,0x0,0xe,0x0, -0x1b,0x0,0x31,0x80,0x71,0xc0,0x60,0xc0,0xe0,0xe0,0xc0,0x60, -}; - -static const BitmapCharRec ch88 = {11,14,-1,0,13,ch88data}; - -/* char: 0x57 'W' */ - -static const GLubyte ch87data[] = { -0x18,0x18,0x18,0x18,0x1c,0x38,0x34,0x2c,0x36,0x6c,0x36,0x6c,0x66,0x66,0x66,0x66, -0x62,0x46,0x63,0xc6,0xc3,0xc3,0xc1,0x83,0xc1,0x83,0xc1,0x83, -}; - -static const BitmapCharRec ch87 = {16,14,-1,0,18,ch87data}; - -/* char: 0x56 'V' */ - -static const GLubyte ch86data[] = { -0x6,0x0,0xf,0x0,0xf,0x0,0x19,0x80,0x19,0x80,0x19,0x80,0x30,0xc0,0x30,0xc0, -0x30,0xc0,0x60,0x60,0x60,0x60,0x60,0x60,0xc0,0x30,0xc0,0x30, -}; - -static const BitmapCharRec ch86 = {12,14,-1,0,14,ch86data}; - -/* char: 0x55 'U' */ - -static const GLubyte ch85data[] = { -0x1f,0x0,0x7f,0xc0,0x60,0xc0,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60, -0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60, -}; - -static const BitmapCharRec ch85 = {11,14,-1,0,13,ch85data}; - -/* char: 0x54 'T' */ - -static const GLubyte ch84data[] = { -0xc,0x0,0xc,0x0,0xc,0x0,0xc,0x0,0xc,0x0,0xc,0x0,0xc,0x0,0xc,0x0, -0xc,0x0,0xc,0x0,0xc,0x0,0xc,0x0,0xff,0xc0,0xff,0xc0, -}; - -static const BitmapCharRec ch84 = {10,14,-1,0,12,ch84data}; - -/* char: 0x53 'S' */ - -static const GLubyte ch83data[] = { -0x3f,0x0,0x7f,0xc0,0xe0,0xe0,0xc0,0x60,0x0,0x60,0x0,0xe0,0x3,0xc0,0x1f,0x0, -0x7c,0x0,0xe0,0x0,0xc0,0x60,0xe0,0xe0,0x7f,0xc0,0x1f,0x0, -}; - -static const BitmapCharRec ch83 = {11,14,-1,0,13,ch83data}; - -/* char: 0x52 'R' */ - -static const GLubyte ch82data[] = { -0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc1,0x80,0xc1,0x80,0xff,0x0,0xff,0x80, -0xc1,0xc0,0xc0,0xc0,0xc0,0xc0,0xc1,0xc0,0xff,0x80,0xff,0x0, -}; - -static const BitmapCharRec ch82 = {10,14,-1,0,12,ch82data}; - -/* char: 0x51 'Q' */ - -static const GLubyte ch81data[] = { -0x0,0x30,0xf,0xb0,0x3f,0xe0,0x70,0xf0,0x61,0xb0,0xe1,0xb8,0xc0,0x18,0xc0,0x18, -0xc0,0x18,0xc0,0x18,0xe0,0x38,0x60,0x30,0x70,0x70,0x3f,0xe0,0xf,0x80, -}; - -static const BitmapCharRec ch81 = {13,15,-1,1,15,ch81data}; - -/* char: 0x50 'P' */ - -static const GLubyte ch80data[] = { -0xc0,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x0,0xff,0x0,0xff,0x80, -0xc1,0xc0,0xc0,0xc0,0xc0,0xc0,0xc1,0xc0,0xff,0x80,0xff,0x0, -}; - -static const BitmapCharRec ch80 = {10,14,-1,0,12,ch80data}; - -/* char: 0x4f 'O' */ - -static const GLubyte ch79data[] = { -0xf,0x80,0x3f,0xe0,0x70,0x70,0x60,0x30,0xe0,0x38,0xc0,0x18,0xc0,0x18,0xc0,0x18, -0xc0,0x18,0xe0,0x38,0x60,0x30,0x70,0x70,0x3f,0xe0,0xf,0x80, -}; - -static const BitmapCharRec ch79 = {13,14,-1,0,15,ch79data}; - -/* char: 0x4e 'N' */ - -static const GLubyte ch78data[] = { -0xc0,0x60,0xc0,0xe0,0xc1,0xe0,0xc1,0xe0,0xc3,0x60,0xc6,0x60,0xc6,0x60,0xcc,0x60, -0xcc,0x60,0xd8,0x60,0xf0,0x60,0xf0,0x60,0xe0,0x60,0xc0,0x60, -}; - -static const BitmapCharRec ch78 = {11,14,-1,0,13,ch78data}; - -/* char: 0x4d 'M' */ - -static const GLubyte ch77data[] = { -0xc3,0xc,0xc3,0xc,0xc7,0x8c,0xc4,0x8c,0xcc,0xcc,0xcc,0xcc,0xd8,0x6c,0xd8,0x6c, -0xf0,0x3c,0xf0,0x3c,0xe0,0x1c,0xe0,0x1c,0xc0,0xc,0xc0,0xc, -}; - -static const BitmapCharRec ch77 = {14,14,-1,0,16,ch77data}; - -/* char: 0x4c 'L' */ - -static const GLubyte ch76data[] = { -0xff,0xff,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0, -}; - -static const BitmapCharRec ch76 = {8,14,-1,0,10,ch76data}; - -/* char: 0x4b 'K' */ - -static const GLubyte ch75data[] = { -0xc0,0x70,0xc0,0xe0,0xc1,0xc0,0xc3,0x80,0xc7,0x0,0xce,0x0,0xfc,0x0,0xf8,0x0, -0xdc,0x0,0xce,0x0,0xc7,0x0,0xc3,0x80,0xc1,0xc0,0xc0,0xe0, -}; - -static const BitmapCharRec ch75 = {12,14,-1,0,13,ch75data}; - -/* char: 0x4a 'J' */ - -static const GLubyte ch74data[] = { -0x3c,0x7e,0xe7,0xc3,0xc3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3, -}; - -static const BitmapCharRec ch74 = {8,14,-1,0,10,ch74data}; - -/* char: 0x49 'I' */ - -static const GLubyte ch73data[] = { -0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0, -}; - -static const BitmapCharRec ch73 = {2,14,-2,0,6,ch73data}; - -/* char: 0x48 'H' */ - -static const GLubyte ch72data[] = { -0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xff,0xe0,0xff,0xe0, -0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60, -}; - -static const BitmapCharRec ch72 = {11,14,-1,0,13,ch72data}; - -/* char: 0x47 'G' */ - -static const GLubyte ch71data[] = { -0xf,0xb0,0x3f,0xf0,0x70,0x70,0x60,0x30,0xe0,0x30,0xc1,0xf0,0xc1,0xf0,0xc0,0x0, -0xc0,0x0,0xe0,0x30,0x60,0x30,0x70,0x70,0x3f,0xe0,0xf,0x80, -}; - -static const BitmapCharRec ch71 = {12,14,-1,0,14,ch71data}; - -/* char: 0x46 'F' */ - -static const GLubyte ch70data[] = { -0xc0,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x0,0xff,0x0,0xff,0x0, -0xc0,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x0,0xff,0x80,0xff,0x80, -}; - -static const BitmapCharRec ch70 = {9,14,-1,0,11,ch70data}; - -/* char: 0x45 'E' */ - -static const GLubyte ch69data[] = { -0xff,0x80,0xff,0x80,0xc0,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x0,0xff,0x0,0xff,0x0, -0xc0,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x0,0xff,0x80,0xff,0x80, -}; - -static const BitmapCharRec ch69 = {9,14,-1,0,11,ch69data}; - -/* char: 0x44 'D' */ - -static const GLubyte ch68data[] = { -0xff,0x0,0xff,0x80,0xc1,0xc0,0xc0,0xc0,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60, -0xc0,0x60,0xc0,0x60,0xc0,0xc0,0xc1,0xc0,0xff,0x80,0xff,0x0, -}; - -static const BitmapCharRec ch68 = {11,14,-1,0,13,ch68data}; - -/* char: 0x43 'C' */ - -static const GLubyte ch67data[] = { -0xf,0x80,0x3f,0xe0,0x70,0x70,0x60,0x30,0xe0,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x0, -0xc0,0x0,0xe0,0x0,0x60,0x30,0x70,0x70,0x3f,0xe0,0xf,0x80, -}; - -static const BitmapCharRec ch67 = {12,14,-1,0,14,ch67data}; - -/* char: 0x42 'B' */ - -static const GLubyte ch66data[] = { -0xff,0x80,0xff,0xc0,0xc0,0xe0,0xc0,0x60,0xc0,0x60,0xc0,0xe0,0xff,0xc0,0xff,0x80, -0xc1,0x80,0xc0,0xc0,0xc0,0xc0,0xc1,0xc0,0xff,0x80,0xff,0x0, -}; - -static const BitmapCharRec ch66 = {11,14,-1,0,13,ch66data}; - -/* char: 0x41 'A' */ - -static const GLubyte ch65data[] = { -0xc0,0x30,0xc0,0x30,0x60,0x60,0x60,0x60,0x7f,0xe0,0x3f,0xc0,0x30,0xc0,0x30,0xc0, -0x19,0x80,0x19,0x80,0xf,0x0,0xf,0x0,0x6,0x0,0x6,0x0, -}; - -static const BitmapCharRec ch65 = {12,14,0,0,12,ch65data}; - -/* char: 0x40 '@' */ - -static const GLubyte ch64data[] = { -0x7,0xe0,0x1f,0xf0,0x38,0x0,0x70,0x0,0x67,0x70,0xcf,0xf8,0xcc,0xcc,0xcc,0x66, -0xcc,0x66,0xcc,0x63,0xc6,0x33,0x67,0x73,0x63,0xb3,0x30,0x6,0x1c,0xe,0xf,0xfc, -0x3,0xf0, -}; - -static const BitmapCharRec ch64 = {16,17,-1,3,18,ch64data}; - -/* char: 0x3f '?' */ - -static const GLubyte ch63data[] = { -0x30,0x30,0x0,0x0,0x30,0x30,0x30,0x38,0x1c,0xe,0xc6,0xc6,0xfe,0x7c, -}; - -static const BitmapCharRec ch63 = {7,14,-1,0,10,ch63data}; - -/* char: 0x3e '>' */ - -static const GLubyte ch62data[] = { -0xc0,0xf0,0x3c,0xe,0x3,0xe,0x3c,0xf0,0xc0, -}; - -static const BitmapCharRec ch62 = {8,9,-1,0,10,ch62data}; - -/* char: 0x3d '=' */ - -static const GLubyte ch61data[] = { -0xfe,0xfe,0x0,0x0,0xfe,0xfe, -}; - -static const BitmapCharRec ch61 = {7,6,-2,-2,11,ch61data}; - -/* char: 0x3c '<' */ - -static const GLubyte ch60data[] = { -0x3,0xf,0x3c,0x70,0xc0,0x70,0x3c,0xf,0x3, -}; - -static const BitmapCharRec ch60 = {8,9,-1,0,10,ch60data}; - -/* char: 0x3b ';' */ - -static const GLubyte ch59data[] = { -0x80,0x40,0x40,0xc0,0xc0,0x0,0x0,0x0,0x0,0x0,0x0,0xc0,0xc0, -}; - -static const BitmapCharRec ch59 = {2,13,-1,3,5,ch59data}; - -/* char: 0x3a ':' */ - -static const GLubyte ch58data[] = { -0xc0,0xc0,0x0,0x0,0x0,0x0,0x0,0x0,0xc0,0xc0, -}; - -static const BitmapCharRec ch58 = {2,10,-1,0,5,ch58data}; - -/* char: 0x39 '9' */ - -static const GLubyte ch57data[] = { -0x7c,0xfe,0xc6,0x3,0x3,0x3b,0x7f,0xc3,0xc3,0xc3,0xc7,0x7e,0x3c, -}; - -static const BitmapCharRec ch57 = {8,13,-1,0,10,ch57data}; - -/* char: 0x38 '8' */ - -static const GLubyte ch56data[] = { -0x3c,0x7e,0xe7,0xc3,0xc3,0x66,0x7e,0x66,0xc3,0xc3,0xe7,0x7e,0x3c, -}; - -static const BitmapCharRec ch56 = {8,13,-1,0,10,ch56data}; - -/* char: 0x37 '7' */ - -static const GLubyte ch55data[] = { -0x60,0x60,0x30,0x30,0x30,0x18,0x18,0xc,0xc,0x6,0x3,0xff,0xff, -}; - -static const BitmapCharRec ch55 = {8,13,-1,0,10,ch55data}; - -/* char: 0x36 '6' */ - -static const GLubyte ch54data[] = { -0x3c,0x7e,0xe3,0xc3,0xc3,0xc3,0xfe,0xdc,0xc0,0xc0,0x63,0x7f,0x3c, -}; - -static const BitmapCharRec ch54 = {8,13,-1,0,10,ch54data}; - -/* char: 0x35 '5' */ - -static const GLubyte ch53data[] = { -0x7c,0xfe,0xc7,0xc3,0x3,0x3,0xc7,0xfe,0xfc,0xc0,0xc0,0xfe,0xfe, -}; - -static const BitmapCharRec ch53 = {8,13,-1,0,10,ch53data}; - -/* char: 0x34 '4' */ - -static const GLubyte ch52data[] = { -0x3,0x0,0x3,0x0,0x3,0x0,0xff,0x80,0xff,0x80,0xc3,0x0,0x63,0x0,0x33,0x0, -0x33,0x0,0x1b,0x0,0xf,0x0,0x7,0x0,0x3,0x0, -}; - -static const BitmapCharRec ch52 = {9,13,-1,0,10,ch52data}; - -/* char: 0x33 '3' */ - -static const GLubyte ch51data[] = { -0x3c,0x7e,0xc7,0xc3,0x3,0x7,0x1e,0x1c,0x6,0xc3,0xc3,0x7e,0x3c, -}; - -static const BitmapCharRec ch51 = {8,13,-1,0,10,ch51data}; - -/* char: 0x32 '2' */ - -static const GLubyte ch50data[] = { -0xff,0xff,0xc0,0xe0,0x70,0x38,0x1c,0xe,0x7,0x3,0xc3,0xfe,0x3c, -}; - -static const BitmapCharRec ch50 = {8,13,-1,0,10,ch50data}; - -/* char: 0x31 '1' */ - -static const GLubyte ch49data[] = { -0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0xf8,0xf8,0x18, -}; - -static const BitmapCharRec ch49 = {5,13,-2,0,10,ch49data}; - -/* char: 0x30 '0' */ - -static const GLubyte ch48data[] = { -0x3c,0x7e,0x66,0xc3,0xc3,0xc3,0xc3,0xc3,0xc3,0xc3,0x66,0x7e,0x3c, -}; - -static const BitmapCharRec ch48 = {8,13,-1,0,10,ch48data}; - -/* char: 0x2f '/' */ - -static const GLubyte ch47data[] = { -0xc0,0xc0,0x40,0x40,0x60,0x60,0x20,0x20,0x30,0x30,0x10,0x10,0x18,0x18, -}; - -static const BitmapCharRec ch47 = {5,14,0,0,5,ch47data}; - -/* char: 0x2e '.' */ - -static const GLubyte ch46data[] = { -0xc0,0xc0, -}; - -static const BitmapCharRec ch46 = {2,2,-1,0,5,ch46data}; - -/* char: 0x2d '-' */ - -static const GLubyte ch45data[] = { -0xff,0xff, -}; - -static const BitmapCharRec ch45 = {8,2,-1,-4,11,ch45data}; - -/* char: 0x2c ',' */ - -static const GLubyte ch44data[] = { -0x80,0x40,0x40,0xc0,0xc0, -}; - -static const BitmapCharRec ch44 = {2,5,-1,3,5,ch44data}; - -/* char: 0x2b '+' */ - -static const GLubyte ch43data[] = { -0x18,0x18,0x18,0x18,0xff,0xff,0x18,0x18,0x18,0x18, -}; - -static const BitmapCharRec ch43 = {8,10,-1,0,10,ch43data}; - -/* char: 0x2a '*' */ - -static const GLubyte ch42data[] = { -0x88,0x70,0x70,0xf8,0x20,0x20, -}; - -static const BitmapCharRec ch42 = {5,6,-1,-8,7,ch42data}; - -/* char: 0x29 ')' */ - -static const GLubyte ch41data[] = { -0x80,0xc0,0x60,0x60,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x60,0x60, -0xc0,0x80, -}; - -static const BitmapCharRec ch41 = {4,18,-1,4,6,ch41data}; - -/* char: 0x28 '(' */ - -static const GLubyte ch40data[] = { -0x10,0x30,0x60,0x60,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0x60,0x60, -0x30,0x10, -}; - -static const BitmapCharRec ch40 = {4,18,-1,4,6,ch40data}; - -/* char: 0x27 ''' */ - -static const GLubyte ch39data[] = { -0x80,0x40,0x40,0xc0,0xc0, -}; - -static const BitmapCharRec ch39 = {2,5,-1,-9,4,ch39data}; - -/* char: 0x26 '&' */ - -static const GLubyte ch38data[] = { -0x3c,0x70,0x7e,0xe0,0xe7,0xc0,0xc3,0x80,0xc3,0xc0,0xc6,0xc0,0xee,0xc0,0x7c,0x0, -0x3c,0x0,0x66,0x0,0x66,0x0,0x7e,0x0,0x3c,0x0, -}; - -static const BitmapCharRec ch38 = {12,13,-1,0,13,ch38data}; - -/* char: 0x25 '%' */ - -static const GLubyte ch37data[] = { -0x18,0x78,0x18,0xfc,0xc,0xcc,0xc,0xcc,0x6,0xfc,0x6,0x78,0x3,0x0,0x7b,0x0, -0xfd,0x80,0xcd,0x80,0xcc,0xc0,0xfc,0xc0,0x78,0x60, -}; - -static const BitmapCharRec ch37 = {14,13,-1,0,16,ch37data}; - -/* char: 0x24 '$' */ - -static const GLubyte ch36data[] = { -0x8,0x0,0x8,0x0,0x3e,0x0,0x7f,0x0,0xeb,0x80,0xc9,0x80,0x9,0x80,0xf,0x0, -0x3e,0x0,0x78,0x0,0xe8,0x0,0xc8,0x0,0xcb,0x0,0x7f,0x0,0x3e,0x0,0x8,0x0, -}; - -static const BitmapCharRec ch36 = {9,16,-1,2,10,ch36data}; - -/* char: 0x23 '#' */ - -static const GLubyte ch35data[] = { -0x24,0x0,0x24,0x0,0x24,0x0,0xff,0x80,0xff,0x80,0x12,0x0,0x12,0x0,0x12,0x0, -0x7f,0xc0,0x7f,0xc0,0x9,0x0,0x9,0x0,0x9,0x0, -}; - -static const BitmapCharRec ch35 = {10,13,0,0,10,ch35data}; - -/* char: 0x22 '"' */ - -static const GLubyte ch34data[] = { -0x90,0x90,0xd8,0xd8,0xd8, -}; - -static const BitmapCharRec ch34 = {5,5,0,-9,5,ch34data}; - -/* char: 0x21 '!' */ - -static const GLubyte ch33data[] = { -0xc0,0xc0,0x0,0x0,0x80,0x80,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0, -}; - -static const BitmapCharRec ch33 = {2,14,-2,0,6,ch33data}; - -/* char: 0x20 ' ' */ - -#ifdef _WIN32 -/* XXX Work around Microsoft OpenGL 1.1 bug where glBitmap with - a height or width of zero does not advance the raster position - as specified by OpenGL. (Cosmo OpenGL does not have this bug.) */ -static const GLubyte ch32data[] = { 0x0 }; -static const BitmapCharRec ch32 = {1,1,0,0,5,ch32data}; -#else -static const BitmapCharRec ch32 = {0,0,0,0,5,0}; -#endif - -static const BitmapCharRec * const chars[] = { -&ch32, -&ch33, -&ch34, -&ch35, -&ch36, -&ch37, -&ch38, -&ch39, -&ch40, -&ch41, -&ch42, -&ch43, -&ch44, -&ch45, -&ch46, -&ch47, -&ch48, -&ch49, -&ch50, -&ch51, -&ch52, -&ch53, -&ch54, -&ch55, -&ch56, -&ch57, -&ch58, -&ch59, -&ch60, -&ch61, -&ch62, -&ch63, -&ch64, -&ch65, -&ch66, -&ch67, -&ch68, -&ch69, -&ch70, -&ch71, -&ch72, -&ch73, -&ch74, -&ch75, -&ch76, -&ch77, -&ch78, -&ch79, -&ch80, -&ch81, -&ch82, -&ch83, -&ch84, -&ch85, -&ch86, -&ch87, -&ch88, -&ch89, -&ch90, -&ch91, -&ch92, -&ch93, -&ch94, -&ch95, -&ch96, -&ch97, -&ch98, -&ch99, -&ch100, -&ch101, -&ch102, -&ch103, -&ch104, -&ch105, -&ch106, -&ch107, -&ch108, -&ch109, -&ch110, -&ch111, -&ch112, -&ch113, -&ch114, -&ch115, -&ch116, -&ch117, -&ch118, -&ch119, -&ch120, -&ch121, -&ch122, -&ch123, -&ch124, -&ch125, -&ch126, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -&ch160, -&ch161, -&ch162, -&ch163, -&ch164, -&ch165, -&ch166, -&ch167, -&ch168, -&ch169, -&ch170, -&ch171, -&ch172, -&ch173, -&ch174, -&ch175, -&ch176, -&ch177, -&ch178, -&ch179, -&ch180, -&ch181, -&ch182, -&ch183, -&ch184, -&ch185, -&ch186, -&ch187, -&ch188, -&ch189, -&ch190, -&ch191, -&ch192, -&ch193, -&ch194, -&ch195, -&ch196, -&ch197, -&ch198, -&ch199, -&ch200, -&ch201, -&ch202, -&ch203, -&ch204, -&ch205, -&ch206, -&ch207, -&ch208, -&ch209, -&ch210, -&ch211, -&ch212, -&ch213, -&ch214, -&ch215, -&ch216, -&ch217, -&ch218, -&ch219, -&ch220, -&ch221, -&ch222, -&ch223, -&ch224, -&ch225, -&ch226, -&ch227, -&ch228, -&ch229, -&ch230, -&ch231, -&ch232, -&ch233, -&ch234, -&ch235, -&ch236, -&ch237, -&ch238, -&ch239, -&ch240, -&ch241, -&ch242, -&ch243, -&ch244, -&ch245, -&ch246, -&ch247, -&ch248, -&ch249, -&ch250, -&ch251, -&ch252, -&ch253, -&ch254, -&ch255, -}; - -#if !defined(__IBMCPP__) -const -#endif -BitmapFontRec glutBitmapHelvetica18 = { -"-adobe-helvetica-medium-r-normal--18-180-75-75-p-98-iso8859-1", -224, -32, -chars -}; - diff --git a/src/glut/os2/glut_init.cpp b/src/glut/os2/glut_init.cpp deleted file mode 100644 index 9e9f2e366e..0000000000 --- a/src/glut/os2/glut_init.cpp +++ /dev/null @@ -1,451 +0,0 @@ - -/* Copyright (c) Mark J. Kilgard, 1994, 1997. */ - -/* This program is freely distributable without licensing fees - and is provided without guarantee or warrantee expressed or - implied. This program is -not- in the public domain. */ - -#ifdef __VMS -#include -#endif - -#include -#include -#include - -#if !defined(_WIN32) && !defined(__OS2__) - #include - #include -#endif - -/* SGI optimization introduced in IRIX 6.3 to avoid X server - round trips for interning common X atoms. */ -#if defined(_SGI_EXTRA_PREDEFINES) && !defined(NO_FAST_ATOMS) -#include -#else -#define XSGIFastInternAtom(dpy,string,fast_name,how) XInternAtom(dpy,string,how) -#endif - -#include "glutint.h" - -/* GLUT inter-file variables */ -/* *INDENT-OFF* */ -char *__glutProgramName = NULL; -int __glutArgc = 0; -char **__glutArgv = NULL; -char *__glutGeometry = NULL; -Display *__glutDisplay = NULL; -int __glutScreen; -Window __glutRoot; -int __glutScreenHeight; -int __glutScreenWidth; -GLboolean __glutIconic = GL_FALSE; -GLboolean __glutDebug = GL_FALSE; -unsigned int __glutDisplayMode = - GLUT_RGB | GLUT_SINGLE | GLUT_DEPTH; -char *__glutDisplayString = NULL; -int __glutConnectionFD; -XSizeHints __glutSizeHints = {0}; -int __glutInitWidth = 300, __glutInitHeight = 300; -int __glutInitX = -1, __glutInitY = -1; -GLboolean __glutForceDirect = GL_FALSE, - __glutTryDirect = GL_TRUE; -Atom __glutWMDeleteWindow; -/* *INDENT-ON* */ - -#ifdef _WIN32 -void (__cdecl *__glutExitFunc)(int retval) = NULL; -#endif - -static Bool synchronize = False; - -#if defined(__OS2__) - -MRESULT EXPENTRY GlutWindowProc( HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2 ); -MRESULT EXPENTRY GlutWindowChildProc( HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2 ); - - -void __glutOpenOS2Connection(char* display) -{ - static char *classname=NULL; -extern HAB hab; /* PM anchor block handle */ -ERRORID erridErrorCode;/* last error id code */ -int ii; - - /* Make sure we register the window only once. */ - if(classname) - return; - - classname = "GLUT"; - - if ( !WinRegisterClass( hab, /* PM anchor block handle */ - classname,/* window class name */ - GlutWindowProc,/* address of window procedure*/ - CS_SIZEREDRAW, /* |CS_SYNCPAINT size changes cause redrawing */ - 0UL ) ) /* window data */ - { erridErrorCode = WinGetLastError(hab); - ii = erridErrorCode; - return; - } - - classname = "GLUTCHILD"; - - if ( !WinRegisterClass( hab, /* PM anchor block handle */ - classname,/* window class name */ - GlutWindowChildProc,/* address of window procedure*/ - CS_SIZEREDRAW, /* size changes cause redrawing */ - 0UL ) ) /* window data */ - { erridErrorCode = WinGetLastError(hab); - ii = erridErrorCode; - return; - } - - __glutScreenWidth = GetSystemMetrics(SM_CXSCREEN); - __glutScreenHeight = GetSystemMetrics(SM_CYSCREEN); - - /* Set the root window to NULL because windows creates a top-level - window when the parent is NULL. X creates a top-level window - when the parent is the root window. */ - __glutRoot = NULLHANDLE; - - /* Set the display to 1 -- we shouldn't be using this anywhere - (except as an argument to X calls). */ - __glutDisplay = (Display*)1; - - /* There isn't any concept of multiple screens in Win32, therefore, - we don't need to keep track of the screen we're on... it's always - the same one. */ - __glutScreen = 0; -} - -#elif defined(_WIN32) - -#ifdef __BORLANDC__ -#include /* For masking floating point exceptions. */ -#endif - -void -__glutOpenWin32Connection(char* display) -{ - static char *classname; - WNDCLASS wc; - HINSTANCE hInstance = GetModuleHandle(NULL); - - /* Make sure we register the window only once. */ - if(classname) - return; - -#ifdef __BORLANDC__ - /* Under certain conditions (e.g. while rendering solid surfaces with - lighting enabled) Microsoft OpenGL libraries cause some illegal - operations like floating point overflow or division by zero. The - default behaviour of Microsoft compilers is to mask (ignore) - floating point exceptions, while Borland compilers do not. The - following function of Borland RTL allows to mask exceptions. - Advice from Pier Giorgio Esposito (mc2172@mclink.it). */ - _control87(MCW_EM,MCW_EM); -#endif - - classname = "GLUT"; - - /* Clear (important!) and then fill in the window class structure. */ - memset(&wc, 0, sizeof(WNDCLASS)); - wc.style = CS_OWNDC; - wc.lpfnWndProc = (WNDPROC)__glutWindowProc; - wc.hInstance = hInstance; - wc.hIcon = LoadIcon(hInstance, "GLUT_ICON"); - wc.hCursor = LoadCursor(hInstance, IDC_ARROW); - wc.hbrBackground = NULL; - wc.lpszMenuName = NULL; - wc.lpszClassName = classname; - - /* Fill in a default icon if one isn't specified as a resource. */ - if(!wc.hIcon) - wc.hIcon = LoadIcon(NULL, IDI_WINLOGO); - - if(!RegisterClass(&wc)) { - __glutFatalError("RegisterClass() failed:" - "Cannot register GLUT window class."); - } - - __glutScreenWidth = GetSystemMetrics(SM_CXSCREEN); - __glutScreenHeight = GetSystemMetrics(SM_CYSCREEN); - - /* Set the root window to NULL because windows creates a top-level - window when the parent is NULL. X creates a top-level window - when the parent is the root window. */ - __glutRoot = NULL; - - /* Set the display to 1 -- we shouldn't be using this anywhere - (except as an argument to X calls). */ - __glutDisplay = (Display*)1; - - /* There isn't any concept of multiple screens in Win32, therefore, - we don't need to keep track of the screen we're on... it's always - the same one. */ - __glutScreen = 0; -} -#else /* !_WIN32 */ -void -__glutOpenXConnection(char *display) -{ - int errorBase, eventBase; - - __glutDisplay = XOpenDisplay(display); - if (!__glutDisplay) - __glutFatalError("could not open display: %s", - XDisplayName(display)); - if (synchronize) - XSynchronize(__glutDisplay, True); - if (!glXQueryExtension(__glutDisplay, &errorBase, &eventBase)) - __glutFatalError( - "OpenGL GLX extension not supported by display: %s", - XDisplayName(display)); - __glutScreen = DefaultScreen(__glutDisplay); - __glutRoot = RootWindow(__glutDisplay, __glutScreen); - __glutScreenWidth = DisplayWidth(__glutDisplay, __glutScreen); - __glutScreenHeight = DisplayHeight(__glutDisplay, - __glutScreen); - __glutConnectionFD = ConnectionNumber(__glutDisplay); - __glutWMDeleteWindow = XSGIFastInternAtom(__glutDisplay, - "WM_DELETE_WINDOW", SGI_XA_WM_DELETE_WINDOW, False); -} -#endif /* _WIN32 */ - -void -#ifdef OLD_VMS - __glutInitTime(struct timeval6 *beginning) -#else - __glutInitTime(struct timeval *beginning) -#endif -{ - static int beenhere = 0; -#ifdef OLD_VMS - static struct timeval6 genesis; -#else - static struct timeval genesis; -#endif - - if (!beenhere) { - GETTIMEOFDAY(&genesis); - beenhere = 1; - } - *beginning = genesis; -} - -static void -removeArgs(int *argcp, char **argv, int numToRemove) -{ - int i, j; - - for (i = 0, j = numToRemove; argv[j]; i++, j++) { - argv[i] = argv[j]; - } - argv[i] = NULL; - *argcp -= numToRemove; -} - -void GLUTAPIENTRY -glutInit(int *argcp, char **argv) -{ - char *display = NULL; - char *str, *geometry = NULL; -#ifdef OLD_VMS - struct timeval6 unused; -#else - struct timeval unused; -#endif - int i; - - if (__glutDisplay) { - __glutWarning("glutInit being called a second time."); - return; - } - /* Determine temporary program name. */ - str = strrchr(argv[0], '/'); - if (str == NULL) { - __glutProgramName = argv[0]; - } else { - __glutProgramName = str + 1; - } - - /* Make private copy of command line arguments. */ - __glutArgc = *argcp; - __glutArgv = (char **) malloc(__glutArgc * sizeof(char *)); - if (!__glutArgv) - __glutFatalError("out of memory."); - for (i = 0; i < __glutArgc; i++) { - __glutArgv[i] = __glutStrdup(argv[i]); - if (!__glutArgv[i]) - __glutFatalError("out of memory."); - } - - /* determine permanent program name */ - str = strrchr(__glutArgv[0], '/'); - if (str == NULL) { - __glutProgramName = __glutArgv[0]; - } else { - __glutProgramName = str + 1; - } - - /* parse arguments for standard options */ - for (i = 1; i < __glutArgc; i++) { - if (!strcmp(__glutArgv[i], "-display")) { -#if defined(_WIN32) - __glutWarning("-display option not supported by Win32 GLUT."); -#endif - if (++i >= __glutArgc) { - __glutFatalError( - "follow -display option with X display name."); - } - display = __glutArgv[i]; - removeArgs(argcp, &argv[1], 2); - } else if (!strcmp(__glutArgv[i], "-geometry")) { - if (++i >= __glutArgc) { - __glutFatalError( - "follow -geometry option with geometry parameter."); - } - geometry = __glutArgv[i]; - removeArgs(argcp, &argv[1], 2); - } else if (!strcmp(__glutArgv[i], "-direct")) { -#if defined(_WIN32) - __glutWarning("-direct option not supported by Win32 GLUT."); -#endif - if (!__glutTryDirect) - __glutFatalError( - "cannot force both direct and indirect rendering."); - __glutForceDirect = GL_TRUE; - removeArgs(argcp, &argv[1], 1); - } else if (!strcmp(__glutArgv[i], "-indirect")) { -#if defined(_WIN32) - __glutWarning("-indirect option not supported by Win32 GLUT."); -#endif - if (__glutForceDirect) - __glutFatalError( - "cannot force both direct and indirect rendering."); - __glutTryDirect = GL_FALSE; - removeArgs(argcp, &argv[1], 1); - } else if (!strcmp(__glutArgv[i], "-iconic")) { - __glutIconic = GL_TRUE; - removeArgs(argcp, &argv[1], 1); - } else if (!strcmp(__glutArgv[i], "-gldebug")) { - __glutDebug = GL_TRUE; - removeArgs(argcp, &argv[1], 1); - } else if (!strcmp(__glutArgv[i], "-sync")) { -#if defined(_WIN32) - __glutWarning("-sync option not supported by Win32 GLUT."); -#endif - synchronize = GL_TRUE; - removeArgs(argcp, &argv[1], 1); - } else { - /* Once unknown option encountered, stop command line - processing. */ - break; - } - } -#if defined(__OS2__) - __glutOpenOS2Connection(display); -#elif defined(_WIN32) - __glutOpenWin32Connection(display); -#else - __glutOpenXConnection(display); -#endif - if (geometry) { - int flags, x, y, width, height; - - /* Fix bogus "{width|height} may be used before set" - warning */ - width = 0; - height = 0; - - flags = XParseGeometry(geometry, &x, &y, - (unsigned int *) &width, (unsigned int *) &height); - if (WidthValue & flags) { - /* Careful because X does not allow zero or negative - width windows */ - if (width > 0) - __glutInitWidth = width; - } - if (HeightValue & flags) { - /* Careful because X does not allow zero or negative - height windows */ - if (height > 0) - __glutInitHeight = height; - } - glutInitWindowSize(__glutInitWidth, __glutInitHeight); - if (XValue & flags) { - if (XNegative & flags) - x = DisplayWidth(__glutDisplay, __glutScreen) + - x - __glutSizeHints.width; - /* Play safe: reject negative X locations */ - if (x >= 0) - __glutInitX = x; - } - if (YValue & flags) { - if (YNegative & flags) - y = DisplayHeight(__glutDisplay, __glutScreen) + - y - __glutSizeHints.height; - /* Play safe: reject negative Y locations */ - if (y >= 0) - __glutInitY = y; - } - glutInitWindowPosition(__glutInitX, __glutInitY); - } - __glutInitTime(&unused); - - /* check if GLUT_FPS env var is set */ - { - const char *fps = getenv("GLUT_FPS"); - if (fps) { - sscanf(fps, "%d", &__glutFPS); - if (__glutFPS <= 0) - __glutFPS = 5000; /* 5000 milliseconds */ - } - } -} - -#ifdef _WIN32 -void APIENTRY -__glutInitWithExit(int *argcp, char **argv, void (__cdecl *exitfunc)(int)) -{ - __glutExitFunc = exitfunc; - glutInit(argcp, argv); -} -#endif - -/* CENTRY */ -void GLUTAPIENTRY -glutInitWindowPosition(int x, int y) -{ - __glutInitX = x; - __glutInitY = y; - if (x >= 0 && y >= 0) { - __glutSizeHints.x = x; - __glutSizeHints.y = y; - __glutSizeHints.flags |= USPosition; - } else { - __glutSizeHints.flags &= ~USPosition; - } -} - -void GLUTAPIENTRY -glutInitWindowSize(int width, int height) -{ - __glutInitWidth = width; - __glutInitHeight = height; - if (width > 0 && height > 0) { - __glutSizeHints.width = width; - __glutSizeHints.height = height; - __glutSizeHints.flags |= USSize; - } else { - __glutSizeHints.flags &= ~USSize; - } -} - -void GLUTAPIENTRY -glutInitDisplayMode(unsigned int mask) -{ - __glutDisplayMode = mask; -} - -/* ENDCENTRY */ diff --git a/src/glut/os2/glut_input.cpp b/src/glut/os2/glut_input.cpp deleted file mode 100644 index e65b691cb1..0000000000 --- a/src/glut/os2/glut_input.cpp +++ /dev/null @@ -1,628 +0,0 @@ - -/* Copyright (c) Mark J. Kilgard, 1994, 1997, 1998. */ - -/* This program is freely distributable without licensing fees - and is provided without guarantee or warrantee expressed or - implied. This program is -not- in the public domain. */ - -#include -#include -#include -#include - -#include "glutint.h" -#define POFIG 0 -#if POFIG - -int __glutNumDials = 0; -int __glutNumSpaceballButtons = 0; -int __glutNumButtonBoxButtons = 0; -int __glutNumTabletButtons = 0; -int __glutNumMouseButtons = 3; /* Good guess. */ -XDevice *__glutTablet = NULL; -XDevice *__glutDials = NULL; -XDevice *__glutSpaceball = NULL; - -int __glutHasJoystick = 0; -int __glutNumJoystickButtons = 0; -int __glutNumJoystickAxes = 0; - -#if !defined(_WIN32) -typedef struct _Range { - int min; - int range; -} Range; - -#define NUM_SPACEBALL_AXIS 6 -#define NUM_TABLET_AXIS 2 -#define NUM_DIALS_AXIS 8 - -Range __glutSpaceballRange[NUM_SPACEBALL_AXIS]; -Range __glutTabletRange[NUM_TABLET_AXIS]; -int *__glutDialsResolution; - -/* Safely assumes 0 is an illegal event type for X Input - extension events. */ -int __glutDeviceMotionNotify = 0; -int __glutDeviceButtonPress = 0; -int __glutDeviceButtonPressGrab = 0; -int __glutDeviceButtonRelease = 0; -int __glutDeviceStateNotify = 0; - -static int -normalizeTabletPos(int axis, int rawValue) -{ - assert(rawValue >= __glutTabletRange[axis].min); - assert(rawValue <= __glutTabletRange[axis].min - + __glutTabletRange[axis].range); - /* Normalize rawValue to between 0 and 4000. */ - return ((rawValue - __glutTabletRange[axis].min) * 4000) / - __glutTabletRange[axis].range; -} - -static int -normalizeDialAngle(int axis, int rawValue) -{ - /* XXX Assumption made that the resolution of the device is - number of clicks for one complete dial revolution. This - is true for SGI's dial & button box. */ - return (rawValue * 360.0) / __glutDialsResolution[axis]; -} - -static int -normalizeSpaceballAngle(int axis, int rawValue) -{ - assert(rawValue >= __glutSpaceballRange[axis].min); - assert(rawValue <= __glutSpaceballRange[axis].min + - __glutSpaceballRange[axis].range); - /* Normalize rawValue to between -1800 and 1800. */ - return ((rawValue - __glutSpaceballRange[axis].min) * 3600) / - __glutSpaceballRange[axis].range - 1800; -} - -static int -normalizeSpaceballDelta(int axis, int rawValue) -{ - assert(rawValue >= __glutSpaceballRange[axis].min); - assert(rawValue <= __glutSpaceballRange[axis].min + - __glutSpaceballRange[axis].range); - /* Normalize rawValue to between -1000 and 1000. */ - return ((rawValue - __glutSpaceballRange[axis].min) * 2000) / - __glutSpaceballRange[axis].range - 1000; -} - -static void -queryTabletPos(GLUTwindow * window) -{ - XDeviceState *state; - XInputClass *any; - XValuatorState *v; - int i; - - state = XQueryDeviceState(__glutDisplay, __glutTablet); - any = state->data; - for (i = 0; i < state->num_classes; i++) { -#if defined(__cplusplus) || defined(c_plusplus) - switch (any->c_class) { -#else - switch (any->class) { -#endif - case ValuatorClass: - v = (XValuatorState *) any; - if (v->num_valuators < 2) - goto end; - if (window->tabletPos[0] == -1) - window->tabletPos[0] = normalizeTabletPos(0, v->valuators[0]); - if (window->tabletPos[1] == -1) - window->tabletPos[1] = normalizeTabletPos(1, v->valuators[1]); - } - any = (XInputClass *) ((char *) any + any->length); - } -end: - XFreeDeviceState(state); -} - -static void -tabletPosChange(GLUTwindow * window, int first, int count, int *data) -{ - int i, value, genEvent = 0; - - for (i = first; i < first + count; i++) { - switch (i) { - case 0: /* X axis */ - case 1: /* Y axis */ - value = normalizeTabletPos(i, data[i - first]); - if (value != window->tabletPos[i]) { - window->tabletPos[i] = value; - genEvent = 1; - } - break; - } - } - if (window->tabletPos[0] == -1 || window->tabletPos[1] == -1) - queryTabletPos(window); - if (genEvent) - window->tabletMotion(window->tabletPos[0], window->tabletPos[1]); -} -#endif /* !_WIN32 */ - -static int -__glutProcessDeviceEvents(XEvent * event) -{ -#if !defined(_WIN32) - GLUTwindow *window; - - /* XXX Ugly code fan out. */ - - /* Can't use switch/case since X Input event types are - dynamic. */ - - if (__glutDeviceMotionNotify && event->type == __glutDeviceMotionNotify) { - XDeviceMotionEvent *devmot = (XDeviceMotionEvent *) event; - - window = __glutGetWindow(devmot->window); - if (window) { - if (__glutTablet - && devmot->deviceid == __glutTablet->device_id - && window->tabletMotion) { - tabletPosChange(window, devmot->first_axis, devmot->axes_count, - devmot->axis_data); - } else if (__glutDials - && devmot->deviceid == __glutDials->device_id - && window->dials) { - int i, first = devmot->first_axis, count = devmot->axes_count; - - for (i = first; i < first + count; i++) - window->dials(i + 1, - normalizeDialAngle(i, devmot->axis_data[i - first])); - } else if (__glutSpaceball - && devmot->deviceid == __glutSpaceball->device_id) { - /* XXX Assume that space ball motion events come in as - all the first 6 axes. Assume first 3 axes are XYZ - translations; second 3 axes are XYZ rotations. */ - if (devmot->first_axis == 0 && devmot->axes_count == 6) { - if (window->spaceMotion) - window->spaceMotion( - normalizeSpaceballDelta(0, devmot->axis_data[0]), - normalizeSpaceballDelta(1, devmot->axis_data[1]), - normalizeSpaceballDelta(2, devmot->axis_data[2])); - if (window->spaceRotate) - window->spaceRotate( - normalizeSpaceballAngle(3, devmot->axis_data[3]), - normalizeSpaceballAngle(4, devmot->axis_data[4]), - normalizeSpaceballAngle(5, devmot->axis_data[5])); - } - } - return 1; - } - } else if (__glutDeviceButtonPress - && event->type == __glutDeviceButtonPress) { - XDeviceButtonEvent *devbtn = (XDeviceButtonEvent *) event; - - window = __glutGetWindow(devbtn->window); - if (window) { - if (__glutTablet - && devbtn->deviceid == __glutTablet->device_id - && window->tabletButton - && devbtn->first_axis == 0 - && devbtn->axes_count == 2) { - tabletPosChange(window, devbtn->first_axis, devbtn->axes_count, - devbtn->axis_data); - window->tabletButton(devbtn->button, GLUT_DOWN, - window->tabletPos[0], window->tabletPos[1]); - } else if (__glutDials - && devbtn->deviceid == __glutDials->device_id - && window->buttonBox) { - window->buttonBox(devbtn->button, GLUT_DOWN); - } else if (__glutSpaceball - && devbtn->deviceid == __glutSpaceball->device_id - && window->spaceButton) { - window->spaceButton(devbtn->button, GLUT_DOWN); - } - return 1; - } - } else if (__glutDeviceButtonRelease - && event->type == __glutDeviceButtonRelease) { - XDeviceButtonEvent *devbtn = (XDeviceButtonEvent *) event; - - window = __glutGetWindow(devbtn->window); - if (window) { - if (__glutTablet - && devbtn->deviceid == __glutTablet->device_id - && window->tabletButton - && devbtn->first_axis == 0 - && devbtn->axes_count == 2) { - tabletPosChange(window, devbtn->first_axis, devbtn->axes_count, - devbtn->axis_data); - window->tabletButton(devbtn->button, GLUT_UP, - window->tabletPos[0], window->tabletPos[1]); - } else if (__glutDials - && devbtn->deviceid == __glutDials->device_id - && window->buttonBox) { - window->buttonBox(devbtn->button, GLUT_UP); - } else if (__glutSpaceball - && devbtn->deviceid == __glutSpaceball->device_id - && window->spaceButton) { - window->spaceButton(devbtn->button, GLUT_UP); - } - return 1; - } - } -#else - { - JOYINFOEX info; - JOYCAPS joyCaps; - - memset(&info, 0, sizeof(JOYINFOEX)); - info.dwSize = sizeof(JOYINFOEX); - info.dwFlags = JOY_RETURNALL; - - if (joyGetPosEx(JOYSTICKID1,&info) != JOYERR_NOERROR) { - __glutHasJoystick = 1; - joyGetDevCaps(JOYSTICKID1, &joyCaps, sizeof(joyCaps)); - __glutNumJoystickButtons = joyCaps.wNumButtons; - __glutNumJoystickAxes = joyCaps.wNumAxes; - } else { - __glutHasJoystick = 0; - __glutNumJoystickButtons = 0; - __glutNumJoystickAxes = 0; - } - } -#endif /* !_WIN32 */ - return 0; -} - -static GLUTeventParser eventParser = -{__glutProcessDeviceEvents, NULL}; - -static void -addDeviceEventParser(void) -{ - static Bool been_here = False; - - if (been_here) - return; - been_here = True; - __glutRegisterEventParser(&eventParser); -} - -static int -probeDevices(void) -{ - static Bool been_here = False; - static int support; -#if !defined(_WIN32) - XExtensionVersion *version; - XDeviceInfoPtr device_info, device; - XAnyClassPtr any; - XButtonInfoPtr b; - XValuatorInfoPtr v; - XAxisInfoPtr a; - int num_dev = 0, btns = 0, dials = 0; - int i, j, k; -#endif /* !_WIN32 */ - - if (been_here) { - return support; - } - been_here = True; - -#if !defined(_WIN32) - version = XGetExtensionVersion(__glutDisplay, "XInputExtension"); - /* Ugh. XInput extension API forces annoying cast of a pointer - to a long so it can be compared with the NoSuchExtension - value (#defined to 1). */ - if (version == NULL || ((long) version) == NoSuchExtension) { - support = 0; - return support; - } - XFree(version); - device_info = XListInputDevices(__glutDisplay, &num_dev); - if (device_info) { - for (i = 0; i < num_dev; i++) { - /* XXX These are SGI names for these devices; - unfortunately, no good standard exists for standard - types of X input extension devices. */ - - device = &device_info[i]; - any = (XAnyClassPtr) device->inputclassinfo; - - if (!__glutSpaceball && !strcmp(device->name, "spaceball")) { - v = NULL; - b = NULL; - for (j = 0; j < device->num_classes; j++) { -#if defined(__cplusplus) || defined(c_plusplus) - switch (any->c_class) { -#else - switch (any->class) { -#endif - case ButtonClass: - b = (XButtonInfoPtr) any; - btns = b->num_buttons; - break; - case ValuatorClass: - v = (XValuatorInfoPtr) any; - /* Sanity check: at least 6 valuators? */ - if (v->num_axes < NUM_SPACEBALL_AXIS) - goto skip_device; - a = (XAxisInfoPtr) ((char *) v + sizeof(XValuatorInfo)); - for (k = 0; k < NUM_SPACEBALL_AXIS; k++, a++) { - __glutSpaceballRange[k].min = a->min_value; - __glutSpaceballRange[k].range = a->max_value - a->min_value; - } - break; - } - any = (XAnyClassPtr) ((char *) any + any->length); - } - if (v) { - __glutSpaceball = XOpenDevice(__glutDisplay, device->id); - if (__glutSpaceball) { - __glutNumSpaceballButtons = btns; - addDeviceEventParser(); - } - } - } else if (!__glutDials && !strcmp(device->name, "dial+buttons")) { - v = NULL; - b = NULL; - for (j = 0; j < device->num_classes; j++) { -#if defined(__cplusplus) || defined(c_plusplus) - switch (any->c_class) { -#else - switch (any->class) { -#endif - case ButtonClass: - b = (XButtonInfoPtr) any; - btns = b->num_buttons; - break; - case ValuatorClass: - v = (XValuatorInfoPtr) any; - /* Sanity check: at least 8 valuators? */ - if (v->num_axes < NUM_DIALS_AXIS) - goto skip_device; - dials = v->num_axes; - __glutDialsResolution = (int *) malloc(sizeof(int) * dials); - a = (XAxisInfoPtr) ((char *) v + sizeof(XValuatorInfo)); - for (k = 0; k < dials; k++, a++) { - __glutDialsResolution[k] = a->resolution; - } - break; - } - any = (XAnyClassPtr) ((char *) any + any->length); - } - if (v) { - __glutDials = XOpenDevice(__glutDisplay, device->id); - if (__glutDials) { - __glutNumButtonBoxButtons = btns; - __glutNumDials = dials; - addDeviceEventParser(); - } - } - } else if (!__glutTablet && !strcmp(device->name, "tablet")) { - v = NULL; - b = NULL; - for (j = 0; j < device->num_classes; j++) { -#if defined(__cplusplus) || defined(c_plusplus) - switch (any->c_class) { -#else - switch (any->class) { -#endif - case ButtonClass: - b = (XButtonInfoPtr) any; - btns = b->num_buttons; - break; - case ValuatorClass: - v = (XValuatorInfoPtr) any; - /* Sanity check: exactly 2 valuators? */ - if (v->num_axes != NUM_TABLET_AXIS) - goto skip_device; - a = (XAxisInfoPtr) ((char *) v + sizeof(XValuatorInfo)); - for (k = 0; k < NUM_TABLET_AXIS; k++, a++) { - __glutTabletRange[k].min = a->min_value; - __glutTabletRange[k].range = a->max_value - a->min_value; - } - break; - } - any = (XAnyClassPtr) ((char *) any + any->length); - } - if (v) { - __glutTablet = XOpenDevice(__glutDisplay, device->id); - if (__glutTablet) { - __glutNumTabletButtons = btns; - addDeviceEventParser(); - } - } - } else if (!strcmp(device->name, "mouse")) { - for (j = 0; j < device->num_classes; j++) { -#if defined(__cplusplus) || defined(c_plusplus) - if (any->c_class == ButtonClass) { -#else - if (any->class == ButtonClass) { -#endif - b = (XButtonInfoPtr) any; - __glutNumMouseButtons = b->num_buttons; - } - any = (XAnyClassPtr) ((char *) any + any->length); - } - } - skip_device:; - } - XFreeDeviceList(device_info); - } -#else /* _WIN32 */ - __glutNumMouseButtons = GetSystemMetrics(SM_CMOUSEBUTTONS); -#endif /* !_WIN32 */ - /* X Input extension might be supported, but only if there is - a tablet, dials, or spaceball do we claim devices are - supported. */ - support = __glutTablet || __glutDials || __glutSpaceball; - return support; -} - -void -__glutUpdateInputDeviceMask(GLUTwindow * window) -{ -#if !defined(_WIN32) - /* 5 (dial and buttons) + 5 (tablet locator and buttons) + 5 - (Spaceball buttons and axis) = 15 */ - XEventClass eventList[15]; - int rc, numEvents; - - rc = probeDevices(); - if (rc) { - numEvents = 0; - if (__glutTablet) { - if (window->tabletMotion) { - DeviceMotionNotify(__glutTablet, __glutDeviceMotionNotify, - eventList[numEvents]); - numEvents++; - } - if (window->tabletButton) { - DeviceButtonPress(__glutTablet, __glutDeviceButtonPress, - eventList[numEvents]); - numEvents++; - DeviceButtonPressGrab(__glutTablet, __glutDeviceButtonPressGrab, - eventList[numEvents]); - numEvents++; - DeviceButtonRelease(__glutTablet, __glutDeviceButtonRelease, - eventList[numEvents]); - numEvents++; - } - if (window->tabletMotion || window->tabletButton) { - DeviceStateNotify(__glutTablet, __glutDeviceStateNotify, - eventList[numEvents]); - numEvents++; - } - } - if (__glutDials) { - if (window->dials) { - DeviceMotionNotify(__glutDials, __glutDeviceMotionNotify, - eventList[numEvents]); - numEvents++; - } - if (window->buttonBox) { - DeviceButtonPress(__glutDials, __glutDeviceButtonPress, - eventList[numEvents]); - numEvents++; - DeviceButtonPressGrab(__glutDials, __glutDeviceButtonPressGrab, - eventList[numEvents]); - numEvents++; - DeviceButtonRelease(__glutDials, __glutDeviceButtonRelease, - eventList[numEvents]); - numEvents++; - } - if (window->dials || window->buttonBox) { - DeviceStateNotify(__glutDials, __glutDeviceStateNotify, - eventList[numEvents]); - numEvents++; - } - } - if (__glutSpaceball) { - if (window->spaceMotion || window->spaceRotate) { - DeviceMotionNotify(__glutSpaceball, __glutDeviceMotionNotify, - eventList[numEvents]); - numEvents++; - } - if (window->spaceButton) { - DeviceButtonPress(__glutSpaceball, __glutDeviceButtonPress, - eventList[numEvents]); - numEvents++; - DeviceButtonPressGrab(__glutSpaceball, __glutDeviceButtonPressGrab, - eventList[numEvents]); - numEvents++; - DeviceButtonRelease(__glutSpaceball, __glutDeviceButtonRelease, - eventList[numEvents]); - numEvents++; - } - if (window->spaceMotion || window->spaceRotate || window->spaceButton) { - DeviceStateNotify(__glutSpaceball, __glutDeviceStateNotify, - eventList[numEvents]); - numEvents++; - } - } -#if 0 - if (window->children) { - GLUTwindow *child = window->children; - - do { - XChangeDeviceDontPropagateList(__glutDisplay, child->win, - numEvents, eventList, AddToList); - child = child->siblings; - } while (child); - } -#endif - XSelectExtensionEvent(__glutDisplay, window->win, - eventList, numEvents); - if (window->overlay) { - XSelectExtensionEvent(__glutDisplay, window->overlay->win, - eventList, numEvents); - } - } else { - /* X Input extension not supported; no chance for exotic - input devices. */ - } -#endif /* !_WIN32 */ -} - -#endif //POFIG - -/* CENTRY */ -int GLUTAPIENTRY -glutDeviceGet(GLenum param) -{ -#if POFIG - probeDevices(); -#endif - switch (param) { - case GLUT_HAS_KEYBOARD: - case GLUT_HAS_MOUSE: - /* Assume window system always has mouse and keyboard. */ - return 1; -#if POFIG - case GLUT_HAS_SPACEBALL: - return __glutSpaceball != NULL; - case GLUT_HAS_DIAL_AND_BUTTON_BOX: - return __glutDials != NULL; - case GLUT_HAS_TABLET: - return __glutTablet != NULL; - case GLUT_NUM_MOUSE_BUTTONS: - return __glutNumMouseButtons; - case GLUT_NUM_SPACEBALL_BUTTONS: - return __glutNumSpaceballButtons; - case GLUT_NUM_BUTTON_BOX_BUTTONS: - return __glutNumButtonBoxButtons; - case GLUT_NUM_DIALS: - return __glutNumDials; - case GLUT_NUM_TABLET_BUTTONS: - return __glutNumTabletButtons; - case GLUT_DEVICE_IGNORE_KEY_REPEAT: - return __glutCurrentWindow->ignoreKeyRepeat; -#ifndef _WIN32 - case GLUT_DEVICE_KEY_REPEAT: - { - XKeyboardState state; - - XGetKeyboardControl(__glutDisplay, &state); - return state.global_auto_repeat; - } - case GLUT_JOYSTICK_POLL_RATE: - return 0; -#else - case GLUT_DEVICE_KEY_REPEAT: - /* Win32 cannot globally disable key repeat. */ - return GLUT_KEY_REPEAT_ON; - case GLUT_JOYSTICK_POLL_RATE: - return __glutCurrentWindow->joyPollInterval; -#endif - case GLUT_HAS_JOYSTICK: - return __glutHasJoystick; - case GLUT_JOYSTICK_BUTTONS: - return __glutNumJoystickButtons; - case GLUT_JOYSTICK_AXES: - return __glutNumJoystickAxes; -#endif //POFIG - default: - __glutWarning("invalid glutDeviceGet parameter: %d", param); - return -1; - } -} -/* ENDCENTRY */ diff --git a/src/glut/os2/glut_key.cpp b/src/glut/os2/glut_key.cpp deleted file mode 100644 index 3e1f7e52c1..0000000000 --- a/src/glut/os2/glut_key.cpp +++ /dev/null @@ -1,29 +0,0 @@ - -/* Copyright (c) Mark J. Kilgard, 1997. */ - -/* This program is freely distributable without licensing fees - and is provided without guarantee or warrantee expressed or - implied. This program is -not- in the public domain. */ - -#include - -#include "glutint.h" - -/* CENTRY */ -void GLUTAPIENTRY -glutKeyboardFunc(GLUTkeyboardCB keyboardFunc) -{ - __glutChangeWindowEventMask(KeyPressMask, - keyboardFunc != NULL || __glutCurrentWindow->special != NULL); - __glutCurrentWindow->keyboard = keyboardFunc; -} - -void GLUTAPIENTRY -glutSpecialFunc(GLUTspecialCB specialFunc) -{ - __glutChangeWindowEventMask(KeyPressMask, - specialFunc != NULL || __glutCurrentWindow->keyboard != NULL); - __glutCurrentWindow->special = specialFunc; -} - -/* ENDCENTRY */ diff --git a/src/glut/os2/glut_keyctrl.cpp b/src/glut/os2/glut_keyctrl.cpp deleted file mode 100644 index ddac630509..0000000000 --- a/src/glut/os2/glut_keyctrl.cpp +++ /dev/null @@ -1,29 +0,0 @@ - -/* Copyright (c) Mark J. Kilgard, 1996, 1997. */ - -/* This program is freely distributable without licensing fees - and is provided without guarantee or warrantee expressed or - implied. This program is -not- in the public domain. */ - -#include "glutint.h" - -/* CENTRY */ -void GLUTAPIENTRY -glutIgnoreKeyRepeat(int ignore) -{ - __glutCurrentWindow->ignoreKeyRepeat = ignore; -} - -void GLUTAPIENTRY -glutSetKeyRepeat(int repeatMode) -{ -#if !defined(_WIN32) && !defined(__OS2PM__) - XKeyboardControl values; - - /* GLUT's repeatMode #define's match the Xlib API values. */ - values.auto_repeat_mode = repeatMode; - XChangeKeyboardControl(__glutDisplay, KBAutoRepeatMode, &values); -#endif -} - -/* ENDCENTRY */ diff --git a/src/glut/os2/glut_keyup.cpp b/src/glut/os2/glut_keyup.cpp deleted file mode 100644 index c33770f1be..0000000000 --- a/src/glut/os2/glut_keyup.cpp +++ /dev/null @@ -1,29 +0,0 @@ - -/* Copyright (c) Mark J. Kilgard, 1997. */ - -/* This program is freely distributable without licensing fees - and is provided without guarantee or warrantee expressed or - implied. This program is -not- in the public domain. */ - -#include - -#include "glutint.h" - -/* CENTRY */ -void GLUTAPIENTRY -glutKeyboardUpFunc(GLUTkeyboardCB keyboardUpFunc) -{ - __glutChangeWindowEventMask(KeyReleaseMask, - keyboardUpFunc != NULL || __glutCurrentWindow->specialUp != NULL); - __glutCurrentWindow->keyboardUp = keyboardUpFunc; -} - -void GLUTAPIENTRY -glutSpecialUpFunc(GLUTspecialCB specialUpFunc) -{ - __glutChangeWindowEventMask(KeyReleaseMask, - specialUpFunc != NULL || __glutCurrentWindow->keyboardUp != NULL); - __glutCurrentWindow->specialUp = specialUpFunc; -} - -/* ENDCENTRY */ diff --git a/src/glut/os2/glut_mesa.cpp b/src/glut/os2/glut_mesa.cpp deleted file mode 100644 index 7e202fa078..0000000000 --- a/src/glut/os2/glut_mesa.cpp +++ /dev/null @@ -1,57 +0,0 @@ - -/* Copyright (c) Mark J. Kilgard, 1996. */ - -/* This program is freely distributable without licensing fees - and is provided without guarantee or warrantee expressed or - implied. This program is -not- in the public domain. */ - -#include -#include -#include "glutint.h" - -int __glutMesaSwapHackSupport = 0; /* Not supported until - proven otherwise. */ - -/* Use the "Mesa swap hack" if reasonable if and only if - MESA_SWAP_HACK is set to something whose first character is - not "N" or "n" AND "Brian Paul" is the vendor string AND - "Mesa X11"* (or "Mesa" for backward compatibility) is the - renderer string. - - Anyone who modifies Mesa so that glXSwapBuffers does not - simply blit the previously rendered back buffer should - change either their vendor or renderer string to avoid - confusing GLUT. */ - -void -__glutDetermineMesaSwapHackSupport(void) -{ - static int doneAlready = 0; - char *env, *vendor, *renderer; - - if (doneAlready) - return; - env = getenv("MESA_SWAP_HACK"); - if (env) { - if ((env[0] != 'n') && (env[0] != 'N')) { - vendor = (char *) glGetString(GL_VENDOR); - renderer = (char *) glGetString(GL_RENDERER); - - /* Old versions of X11 Mesa uses the renderer string - "Mesa"; Brian plans to start using "Mesa X11" to - distinguish the X version of Mesa from other flavor - such as Windows or 3Dfx. */ - -#define MESA_X11 "Mesa X11" - - /* XXX At some point in the future, eliminate the - backward compatibility for the old "Mesa" renderer - string. */ - - if (!strcmp(vendor, "Brian Paul") && (!strcmp(renderer, "Mesa") || - !strncmp(renderer, MESA_X11, sizeof(MESA_X11) - 1))) - __glutMesaSwapHackSupport = 1; - } - } - doneAlready = 1; -} diff --git a/src/glut/os2/glut_modifier.cpp b/src/glut/os2/glut_modifier.cpp deleted file mode 100644 index 7e0e67a21f..0000000000 --- a/src/glut/os2/glut_modifier.cpp +++ /dev/null @@ -1,31 +0,0 @@ - -/* Copyright (c) Mark J. Kilgard, 1994. */ - -/* This program is freely distributable without licensing fees - and is provided without guarantee or warrantee expressed or - implied. This program is -not- in the public domain. */ - -#include "glutint.h" - -/* CENTRY */ -int GLUTAPIENTRY -glutGetModifiers(void) -{ - int modifiers; - - if(__glutModifierMask == (unsigned int) ~0) { - __glutWarning( - "glutCurrentModifiers: do not call outside core input callback."); - return 0; - } - modifiers = 0; - if(__glutModifierMask & (ShiftMask|LockMask)) - modifiers |= GLUT_ACTIVE_SHIFT; - if(__glutModifierMask & ControlMask) - modifiers |= GLUT_ACTIVE_CTRL; - if(__glutModifierMask & Mod1Mask) - modifiers |= GLUT_ACTIVE_ALT; - return modifiers; -} - -/* ENDCENTRY */ diff --git a/src/glut/os2/glut_roman.cpp b/src/glut/os2/glut_roman.cpp deleted file mode 100644 index af2b4ec956..0000000000 --- a/src/glut/os2/glut_roman.cpp +++ /dev/null @@ -1,2451 +0,0 @@ - -/* GENERATED FILE -- DO NOT MODIFY */ - -#include "glutstroke.h" - -/* char: 33 '!' */ - -static const CoordRec char33_stroke0[] = { - { 13.3819, 100 }, - { 13.3819, 33.3333 }, -}; - -static const CoordRec char33_stroke1[] = { - { 13.3819, 9.5238 }, - { 8.62, 4.7619 }, - { 13.3819, 0 }, - { 18.1438, 4.7619 }, - { 13.3819, 9.5238 }, -}; - -static const StrokeRec char33[] = { - { 2, char33_stroke0 }, - { 5, char33_stroke1 }, -}; - -/* char: 34 '"' */ - -static const CoordRec char34_stroke0[] = { - { 4.02, 100 }, - { 4.02, 66.6667 }, -}; - -static const CoordRec char34_stroke1[] = { - { 42.1152, 100 }, - { 42.1152, 66.6667 }, -}; - -static const StrokeRec char34[] = { - { 2, char34_stroke0 }, - { 2, char34_stroke1 }, -}; - -/* char: 35 '#' */ - -static const CoordRec char35_stroke0[] = { - { 41.2952, 119.048 }, - { 7.9619, -33.3333 }, -}; - -static const CoordRec char35_stroke1[] = { - { 69.8667, 119.048 }, - { 36.5333, -33.3333 }, -}; - -static const CoordRec char35_stroke2[] = { - { 7.9619, 57.1429 }, - { 74.6286, 57.1429 }, -}; - -static const CoordRec char35_stroke3[] = { - { 3.2, 28.5714 }, - { 69.8667, 28.5714 }, -}; - -static const StrokeRec char35[] = { - { 2, char35_stroke0 }, - { 2, char35_stroke1 }, - { 2, char35_stroke2 }, - { 2, char35_stroke3 }, -}; - -/* char: 36 '$' */ - -static const CoordRec char36_stroke0[] = { - { 28.6295, 119.048 }, - { 28.6295, -19.0476 }, -}; - -static const CoordRec char36_stroke1[] = { - { 47.6771, 119.048 }, - { 47.6771, -19.0476 }, -}; - -static const CoordRec char36_stroke2[] = { - { 71.4867, 85.7143 }, - { 61.9629, 95.2381 }, - { 47.6771, 100 }, - { 28.6295, 100 }, - { 14.3438, 95.2381 }, - { 4.82, 85.7143 }, - { 4.82, 76.1905 }, - { 9.5819, 66.6667 }, - { 14.3438, 61.9048 }, - { 23.8676, 57.1429 }, - { 52.439, 47.619 }, - { 61.9629, 42.8571 }, - { 66.7248, 38.0952 }, - { 71.4867, 28.5714 }, - { 71.4867, 14.2857 }, - { 61.9629, 4.7619 }, - { 47.6771, 0 }, - { 28.6295, 0 }, - { 14.3438, 4.7619 }, - { 4.82, 14.2857 }, -}; - -static const StrokeRec char36[] = { - { 2, char36_stroke0 }, - { 2, char36_stroke1 }, - { 20, char36_stroke2 }, -}; - -/* char: 37 '%' */ - -static const CoordRec char37_stroke0[] = { - { 92.0743, 100 }, - { 6.36, 0 }, -}; - -static const CoordRec char37_stroke1[] = { - { 30.1695, 100 }, - { 39.6933, 90.4762 }, - { 39.6933, 80.9524 }, - { 34.9314, 71.4286 }, - { 25.4076, 66.6667 }, - { 15.8838, 66.6667 }, - { 6.36, 76.1905 }, - { 6.36, 85.7143 }, - { 11.1219, 95.2381 }, - { 20.6457, 100 }, - { 30.1695, 100 }, - { 39.6933, 95.2381 }, - { 53.979, 90.4762 }, - { 68.2648, 90.4762 }, - { 82.5505, 95.2381 }, - { 92.0743, 100 }, -}; - -static const CoordRec char37_stroke2[] = { - { 73.0267, 33.3333 }, - { 63.5029, 28.5714 }, - { 58.741, 19.0476 }, - { 58.741, 9.5238 }, - { 68.2648, 0 }, - { 77.7886, 0 }, - { 87.3124, 4.7619 }, - { 92.0743, 14.2857 }, - { 92.0743, 23.8095 }, - { 82.5505, 33.3333 }, - { 73.0267, 33.3333 }, -}; - -static const StrokeRec char37[] = { - { 2, char37_stroke0 }, - { 16, char37_stroke1 }, - { 11, char37_stroke2 }, -}; - -/* char: 38 '&' */ - -static const CoordRec char38_stroke0[] = { - { 101.218, 57.1429 }, - { 101.218, 61.9048 }, - { 96.4562, 66.6667 }, - { 91.6943, 66.6667 }, - { 86.9324, 61.9048 }, - { 82.1705, 52.381 }, - { 72.6467, 28.5714 }, - { 63.1229, 14.2857 }, - { 53.599, 4.7619 }, - { 44.0752, 0 }, - { 25.0276, 0 }, - { 15.5038, 4.7619 }, - { 10.7419, 9.5238 }, - { 5.98, 19.0476 }, - { 5.98, 28.5714 }, - { 10.7419, 38.0952 }, - { 15.5038, 42.8571 }, - { 48.8371, 61.9048 }, - { 53.599, 66.6667 }, - { 58.361, 76.1905 }, - { 58.361, 85.7143 }, - { 53.599, 95.2381 }, - { 44.0752, 100 }, - { 34.5514, 95.2381 }, - { 29.7895, 85.7143 }, - { 29.7895, 76.1905 }, - { 34.5514, 61.9048 }, - { 44.0752, 47.619 }, - { 67.8848, 14.2857 }, - { 77.4086, 4.7619 }, - { 86.9324, 0 }, - { 96.4562, 0 }, - { 101.218, 4.7619 }, - { 101.218, 9.5238 }, -}; - -static const StrokeRec char38[] = { - { 34, char38_stroke0 }, -}; - -/* char: 39 ''' */ - -static const CoordRec char39_stroke0[] = { - { 4.44, 100 }, - { 4.44, 66.6667 }, -}; - -static const StrokeRec char39[] = { - { 2, char39_stroke0 }, -}; - -/* char: 40 '(' */ - -static const CoordRec char40_stroke0[] = { - { 40.9133, 119.048 }, - { 31.3895, 109.524 }, - { 21.8657, 95.2381 }, - { 12.3419, 76.1905 }, - { 7.58, 52.381 }, - { 7.58, 33.3333 }, - { 12.3419, 9.5238 }, - { 21.8657, -9.5238 }, - { 31.3895, -23.8095 }, - { 40.9133, -33.3333 }, -}; - -static const StrokeRec char40[] = { - { 10, char40_stroke0 }, -}; - -/* char: 41 ')' */ - -static const CoordRec char41_stroke0[] = { - { 5.28, 119.048 }, - { 14.8038, 109.524 }, - { 24.3276, 95.2381 }, - { 33.8514, 76.1905 }, - { 38.6133, 52.381 }, - { 38.6133, 33.3333 }, - { 33.8514, 9.5238 }, - { 24.3276, -9.5238 }, - { 14.8038, -23.8095 }, - { 5.28, -33.3333 }, -}; - -static const StrokeRec char41[] = { - { 10, char41_stroke0 }, -}; - -/* char: 42 '*' */ - -static const CoordRec char42_stroke0[] = { - { 30.7695, 71.4286 }, - { 30.7695, 14.2857 }, -}; - -static const CoordRec char42_stroke1[] = { - { 6.96, 57.1429 }, - { 54.579, 28.5714 }, -}; - -static const CoordRec char42_stroke2[] = { - { 54.579, 57.1429 }, - { 6.96, 28.5714 }, -}; - -static const StrokeRec char42[] = { - { 2, char42_stroke0 }, - { 2, char42_stroke1 }, - { 2, char42_stroke2 }, -}; - -/* char: 43 '+' */ - -static const CoordRec char43_stroke0[] = { - { 48.8371, 85.7143 }, - { 48.8371, 0 }, -}; - -static const CoordRec char43_stroke1[] = { - { 5.98, 42.8571 }, - { 91.6943, 42.8571 }, -}; - -static const StrokeRec char43[] = { - { 2, char43_stroke0 }, - { 2, char43_stroke1 }, -}; - -/* char: 44 ',' */ - -static const CoordRec char44_stroke0[] = { - { 18.2838, 4.7619 }, - { 13.5219, 0 }, - { 8.76, 4.7619 }, - { 13.5219, 9.5238 }, - { 18.2838, 4.7619 }, - { 18.2838, -4.7619 }, - { 13.5219, -14.2857 }, - { 8.76, -19.0476 }, -}; - -static const StrokeRec char44[] = { - { 8, char44_stroke0 }, -}; - -/* char: 45 '-' */ - -static const CoordRec char45_stroke0[] = { - { 7.38, 42.8571 }, - { 93.0943, 42.8571 }, -}; - -static const StrokeRec char45[] = { - { 2, char45_stroke0 }, -}; - -/* char: 46 '.' */ - -static const CoordRec char46_stroke0[] = { - { 13.1019, 9.5238 }, - { 8.34, 4.7619 }, - { 13.1019, 0 }, - { 17.8638, 4.7619 }, - { 13.1019, 9.5238 }, -}; - -static const StrokeRec char46[] = { - { 5, char46_stroke0 }, -}; - -/* char: 47 '/' */ - -static const CoordRec char47_stroke0[] = { - { 7.24, -14.2857 }, - { 73.9067, 100 }, -}; - -static const StrokeRec char47[] = { - { 2, char47_stroke0 }, -}; - -/* char: 48 '0' */ - -static const CoordRec char48_stroke0[] = { - { 33.5514, 100 }, - { 19.2657, 95.2381 }, - { 9.7419, 80.9524 }, - { 4.98, 57.1429 }, - { 4.98, 42.8571 }, - { 9.7419, 19.0476 }, - { 19.2657, 4.7619 }, - { 33.5514, 0 }, - { 43.0752, 0 }, - { 57.361, 4.7619 }, - { 66.8848, 19.0476 }, - { 71.6467, 42.8571 }, - { 71.6467, 57.1429 }, - { 66.8848, 80.9524 }, - { 57.361, 95.2381 }, - { 43.0752, 100 }, - { 33.5514, 100 }, -}; - -static const StrokeRec char48[] = { - { 17, char48_stroke0 }, -}; - -/* char: 49 '1' */ - -static const CoordRec char49_stroke0[] = { - { 11.82, 80.9524 }, - { 21.3438, 85.7143 }, - { 35.6295, 100 }, - { 35.6295, 0 }, -}; - -static const StrokeRec char49[] = { - { 4, char49_stroke0 }, -}; - -/* char: 50 '2' */ - -static const CoordRec char50_stroke0[] = { - { 10.1819, 76.1905 }, - { 10.1819, 80.9524 }, - { 14.9438, 90.4762 }, - { 19.7057, 95.2381 }, - { 29.2295, 100 }, - { 48.2771, 100 }, - { 57.801, 95.2381 }, - { 62.5629, 90.4762 }, - { 67.3248, 80.9524 }, - { 67.3248, 71.4286 }, - { 62.5629, 61.9048 }, - { 53.039, 47.619 }, - { 5.42, 0 }, - { 72.0867, 0 }, -}; - -static const StrokeRec char50[] = { - { 14, char50_stroke0 }, -}; - -/* char: 51 '3' */ - -static const CoordRec char51_stroke0[] = { - { 14.5238, 100 }, - { 66.9048, 100 }, - { 38.3333, 61.9048 }, - { 52.619, 61.9048 }, - { 62.1429, 57.1429 }, - { 66.9048, 52.381 }, - { 71.6667, 38.0952 }, - { 71.6667, 28.5714 }, - { 66.9048, 14.2857 }, - { 57.381, 4.7619 }, - { 43.0952, 0 }, - { 28.8095, 0 }, - { 14.5238, 4.7619 }, - { 9.7619, 9.5238 }, - { 5, 19.0476 }, -}; - -static const StrokeRec char51[] = { - { 15, char51_stroke0 }, -}; - -/* char: 52 '4' */ - -static const CoordRec char52_stroke0[] = { - { 51.499, 100 }, - { 3.88, 33.3333 }, - { 75.3086, 33.3333 }, -}; - -static const CoordRec char52_stroke1[] = { - { 51.499, 100 }, - { 51.499, 0 }, -}; - -static const StrokeRec char52[] = { - { 3, char52_stroke0 }, - { 2, char52_stroke1 }, -}; - -/* char: 53 '5' */ - -static const CoordRec char53_stroke0[] = { - { 62.0029, 100 }, - { 14.3838, 100 }, - { 9.6219, 57.1429 }, - { 14.3838, 61.9048 }, - { 28.6695, 66.6667 }, - { 42.9552, 66.6667 }, - { 57.241, 61.9048 }, - { 66.7648, 52.381 }, - { 71.5267, 38.0952 }, - { 71.5267, 28.5714 }, - { 66.7648, 14.2857 }, - { 57.241, 4.7619 }, - { 42.9552, 0 }, - { 28.6695, 0 }, - { 14.3838, 4.7619 }, - { 9.6219, 9.5238 }, - { 4.86, 19.0476 }, -}; - -static const StrokeRec char53[] = { - { 17, char53_stroke0 }, -}; - -/* char: 54 '6' */ - -static const CoordRec char54_stroke0[] = { - { 62.7229, 85.7143 }, - { 57.961, 95.2381 }, - { 43.6752, 100 }, - { 34.1514, 100 }, - { 19.8657, 95.2381 }, - { 10.3419, 80.9524 }, - { 5.58, 57.1429 }, - { 5.58, 33.3333 }, - { 10.3419, 14.2857 }, - { 19.8657, 4.7619 }, - { 34.1514, 0 }, - { 38.9133, 0 }, - { 53.199, 4.7619 }, - { 62.7229, 14.2857 }, - { 67.4848, 28.5714 }, - { 67.4848, 33.3333 }, - { 62.7229, 47.619 }, - { 53.199, 57.1429 }, - { 38.9133, 61.9048 }, - { 34.1514, 61.9048 }, - { 19.8657, 57.1429 }, - { 10.3419, 47.619 }, - { 5.58, 33.3333 }, -}; - -static const StrokeRec char54[] = { - { 23, char54_stroke0 }, -}; - -/* char: 55 '7' */ - -static const CoordRec char55_stroke0[] = { - { 72.2267, 100 }, - { 24.6076, 0 }, -}; - -static const CoordRec char55_stroke1[] = { - { 5.56, 100 }, - { 72.2267, 100 }, -}; - -static const StrokeRec char55[] = { - { 2, char55_stroke0 }, - { 2, char55_stroke1 }, -}; - -/* char: 56 '8' */ - -static const CoordRec char56_stroke0[] = { - { 29.4095, 100 }, - { 15.1238, 95.2381 }, - { 10.3619, 85.7143 }, - { 10.3619, 76.1905 }, - { 15.1238, 66.6667 }, - { 24.6476, 61.9048 }, - { 43.6952, 57.1429 }, - { 57.981, 52.381 }, - { 67.5048, 42.8571 }, - { 72.2667, 33.3333 }, - { 72.2667, 19.0476 }, - { 67.5048, 9.5238 }, - { 62.7429, 4.7619 }, - { 48.4571, 0 }, - { 29.4095, 0 }, - { 15.1238, 4.7619 }, - { 10.3619, 9.5238 }, - { 5.6, 19.0476 }, - { 5.6, 33.3333 }, - { 10.3619, 42.8571 }, - { 19.8857, 52.381 }, - { 34.1714, 57.1429 }, - { 53.219, 61.9048 }, - { 62.7429, 66.6667 }, - { 67.5048, 76.1905 }, - { 67.5048, 85.7143 }, - { 62.7429, 95.2381 }, - { 48.4571, 100 }, - { 29.4095, 100 }, -}; - -static const StrokeRec char56[] = { - { 29, char56_stroke0 }, -}; - -/* char: 57 '9' */ - -static const CoordRec char57_stroke0[] = { - { 68.5048, 66.6667 }, - { 63.7429, 52.381 }, - { 54.219, 42.8571 }, - { 39.9333, 38.0952 }, - { 35.1714, 38.0952 }, - { 20.8857, 42.8571 }, - { 11.3619, 52.381 }, - { 6.6, 66.6667 }, - { 6.6, 71.4286 }, - { 11.3619, 85.7143 }, - { 20.8857, 95.2381 }, - { 35.1714, 100 }, - { 39.9333, 100 }, - { 54.219, 95.2381 }, - { 63.7429, 85.7143 }, - { 68.5048, 66.6667 }, - { 68.5048, 42.8571 }, - { 63.7429, 19.0476 }, - { 54.219, 4.7619 }, - { 39.9333, 0 }, - { 30.4095, 0 }, - { 16.1238, 4.7619 }, - { 11.3619, 14.2857 }, -}; - -static const StrokeRec char57[] = { - { 23, char57_stroke0 }, -}; - -/* char: 58 ':' */ - -static const CoordRec char58_stroke0[] = { - { 14.0819, 66.6667 }, - { 9.32, 61.9048 }, - { 14.0819, 57.1429 }, - { 18.8438, 61.9048 }, - { 14.0819, 66.6667 }, -}; - -static const CoordRec char58_stroke1[] = { - { 14.0819, 9.5238 }, - { 9.32, 4.7619 }, - { 14.0819, 0 }, - { 18.8438, 4.7619 }, - { 14.0819, 9.5238 }, -}; - -static const StrokeRec char58[] = { - { 5, char58_stroke0 }, - { 5, char58_stroke1 }, -}; - -/* char: 59 ';' */ - -static const CoordRec char59_stroke0[] = { - { 12.9619, 66.6667 }, - { 8.2, 61.9048 }, - { 12.9619, 57.1429 }, - { 17.7238, 61.9048 }, - { 12.9619, 66.6667 }, -}; - -static const CoordRec char59_stroke1[] = { - { 17.7238, 4.7619 }, - { 12.9619, 0 }, - { 8.2, 4.7619 }, - { 12.9619, 9.5238 }, - { 17.7238, 4.7619 }, - { 17.7238, -4.7619 }, - { 12.9619, -14.2857 }, - { 8.2, -19.0476 }, -}; - -static const StrokeRec char59[] = { - { 5, char59_stroke0 }, - { 8, char59_stroke1 }, -}; - -/* char: 60 '<' */ - -static const CoordRec char60_stroke0[] = { - { 79.2505, 85.7143 }, - { 3.06, 42.8571 }, - { 79.2505, 0 }, -}; - -static const StrokeRec char60[] = { - { 3, char60_stroke0 }, -}; - -/* char: 61 '=' */ - -static const CoordRec char61_stroke0[] = { - { 5.7, 57.1429 }, - { 91.4143, 57.1429 }, -}; - -static const CoordRec char61_stroke1[] = { - { 5.7, 28.5714 }, - { 91.4143, 28.5714 }, -}; - -static const StrokeRec char61[] = { - { 2, char61_stroke0 }, - { 2, char61_stroke1 }, -}; - -/* char: 62 '>' */ - -static const CoordRec char62_stroke0[] = { - { 2.78, 85.7143 }, - { 78.9705, 42.8571 }, - { 2.78, 0 }, -}; - -static const StrokeRec char62[] = { - { 3, char62_stroke0 }, -}; - -/* char: 63 '?' */ - -static const CoordRec char63_stroke0[] = { - { 8.42, 76.1905 }, - { 8.42, 80.9524 }, - { 13.1819, 90.4762 }, - { 17.9438, 95.2381 }, - { 27.4676, 100 }, - { 46.5152, 100 }, - { 56.039, 95.2381 }, - { 60.801, 90.4762 }, - { 65.5629, 80.9524 }, - { 65.5629, 71.4286 }, - { 60.801, 61.9048 }, - { 56.039, 57.1429 }, - { 36.9914, 47.619 }, - { 36.9914, 33.3333 }, -}; - -static const CoordRec char63_stroke1[] = { - { 36.9914, 9.5238 }, - { 32.2295, 4.7619 }, - { 36.9914, 0 }, - { 41.7533, 4.7619 }, - { 36.9914, 9.5238 }, -}; - -static const StrokeRec char63[] = { - { 14, char63_stroke0 }, - { 5, char63_stroke1 }, -}; - -/* char: 64 '@' */ - -static const CoordRec char64_stroke0[] = { - { 49.2171, 52.381 }, - { 39.6933, 57.1429 }, - { 30.1695, 57.1429 }, - { 25.4076, 47.619 }, - { 25.4076, 42.8571 }, - { 30.1695, 33.3333 }, - { 39.6933, 33.3333 }, - { 49.2171, 38.0952 }, -}; - -static const CoordRec char64_stroke1[] = { - { 49.2171, 57.1429 }, - { 49.2171, 38.0952 }, - { 53.979, 33.3333 }, - { 63.5029, 33.3333 }, - { 68.2648, 42.8571 }, - { 68.2648, 47.619 }, - { 63.5029, 61.9048 }, - { 53.979, 71.4286 }, - { 39.6933, 76.1905 }, - { 34.9314, 76.1905 }, - { 20.6457, 71.4286 }, - { 11.1219, 61.9048 }, - { 6.36, 47.619 }, - { 6.36, 42.8571 }, - { 11.1219, 28.5714 }, - { 20.6457, 19.0476 }, - { 34.9314, 14.2857 }, - { 39.6933, 14.2857 }, - { 53.979, 19.0476 }, -}; - -static const StrokeRec char64[] = { - { 8, char64_stroke0 }, - { 19, char64_stroke1 }, -}; - -/* char: 65 'A' */ - -static const CoordRec char65_stroke0[] = { - { 40.5952, 100 }, - { 2.5, 0 }, -}; - -static const CoordRec char65_stroke1[] = { - { 40.5952, 100 }, - { 78.6905, 0 }, -}; - -static const CoordRec char65_stroke2[] = { - { 16.7857, 33.3333 }, - { 64.4048, 33.3333 }, -}; - -static const StrokeRec char65[] = { - { 2, char65_stroke0 }, - { 2, char65_stroke1 }, - { 2, char65_stroke2 }, -}; - -/* char: 66 'B' */ - -static const CoordRec char66_stroke0[] = { - { 11.42, 100 }, - { 11.42, 0 }, -}; - -static const CoordRec char66_stroke1[] = { - { 11.42, 100 }, - { 54.2771, 100 }, - { 68.5629, 95.2381 }, - { 73.3248, 90.4762 }, - { 78.0867, 80.9524 }, - { 78.0867, 71.4286 }, - { 73.3248, 61.9048 }, - { 68.5629, 57.1429 }, - { 54.2771, 52.381 }, -}; - -static const CoordRec char66_stroke2[] = { - { 11.42, 52.381 }, - { 54.2771, 52.381 }, - { 68.5629, 47.619 }, - { 73.3248, 42.8571 }, - { 78.0867, 33.3333 }, - { 78.0867, 19.0476 }, - { 73.3248, 9.5238 }, - { 68.5629, 4.7619 }, - { 54.2771, 0 }, - { 11.42, 0 }, -}; - -static const StrokeRec char66[] = { - { 2, char66_stroke0 }, - { 9, char66_stroke1 }, - { 10, char66_stroke2 }, -}; - -/* char: 67 'C' */ - -static const CoordRec char67_stroke0[] = { - { 78.0886, 76.1905 }, - { 73.3267, 85.7143 }, - { 63.8029, 95.2381 }, - { 54.279, 100 }, - { 35.2314, 100 }, - { 25.7076, 95.2381 }, - { 16.1838, 85.7143 }, - { 11.4219, 76.1905 }, - { 6.66, 61.9048 }, - { 6.66, 38.0952 }, - { 11.4219, 23.8095 }, - { 16.1838, 14.2857 }, - { 25.7076, 4.7619 }, - { 35.2314, 0 }, - { 54.279, 0 }, - { 63.8029, 4.7619 }, - { 73.3267, 14.2857 }, - { 78.0886, 23.8095 }, -}; - -static const StrokeRec char67[] = { - { 18, char67_stroke0 }, -}; - -/* char: 68 'D' */ - -static const CoordRec char68_stroke0[] = { - { 11.96, 100 }, - { 11.96, 0 }, -}; - -static const CoordRec char68_stroke1[] = { - { 11.96, 100 }, - { 45.2933, 100 }, - { 59.579, 95.2381 }, - { 69.1029, 85.7143 }, - { 73.8648, 76.1905 }, - { 78.6267, 61.9048 }, - { 78.6267, 38.0952 }, - { 73.8648, 23.8095 }, - { 69.1029, 14.2857 }, - { 59.579, 4.7619 }, - { 45.2933, 0 }, - { 11.96, 0 }, -}; - -static const StrokeRec char68[] = { - { 2, char68_stroke0 }, - { 12, char68_stroke1 }, -}; - -/* char: 69 'E' */ - -static const CoordRec char69_stroke0[] = { - { 11.42, 100 }, - { 11.42, 0 }, -}; - -static const CoordRec char69_stroke1[] = { - { 11.42, 100 }, - { 73.3248, 100 }, -}; - -static const CoordRec char69_stroke2[] = { - { 11.42, 52.381 }, - { 49.5152, 52.381 }, -}; - -static const CoordRec char69_stroke3[] = { - { 11.42, 0 }, - { 73.3248, 0 }, -}; - -static const StrokeRec char69[] = { - { 2, char69_stroke0 }, - { 2, char69_stroke1 }, - { 2, char69_stroke2 }, - { 2, char69_stroke3 }, -}; - -/* char: 70 'F' */ - -static const CoordRec char70_stroke0[] = { - { 11.42, 100 }, - { 11.42, 0 }, -}; - -static const CoordRec char70_stroke1[] = { - { 11.42, 100 }, - { 73.3248, 100 }, -}; - -static const CoordRec char70_stroke2[] = { - { 11.42, 52.381 }, - { 49.5152, 52.381 }, -}; - -static const StrokeRec char70[] = { - { 2, char70_stroke0 }, - { 2, char70_stroke1 }, - { 2, char70_stroke2 }, -}; - -/* char: 71 'G' */ - -static const CoordRec char71_stroke0[] = { - { 78.4886, 76.1905 }, - { 73.7267, 85.7143 }, - { 64.2029, 95.2381 }, - { 54.679, 100 }, - { 35.6314, 100 }, - { 26.1076, 95.2381 }, - { 16.5838, 85.7143 }, - { 11.8219, 76.1905 }, - { 7.06, 61.9048 }, - { 7.06, 38.0952 }, - { 11.8219, 23.8095 }, - { 16.5838, 14.2857 }, - { 26.1076, 4.7619 }, - { 35.6314, 0 }, - { 54.679, 0 }, - { 64.2029, 4.7619 }, - { 73.7267, 14.2857 }, - { 78.4886, 23.8095 }, - { 78.4886, 38.0952 }, -}; - -static const CoordRec char71_stroke1[] = { - { 54.679, 38.0952 }, - { 78.4886, 38.0952 }, -}; - -static const StrokeRec char71[] = { - { 19, char71_stroke0 }, - { 2, char71_stroke1 }, -}; - -/* char: 72 'H' */ - -static const CoordRec char72_stroke0[] = { - { 11.42, 100 }, - { 11.42, 0 }, -}; - -static const CoordRec char72_stroke1[] = { - { 78.0867, 100 }, - { 78.0867, 0 }, -}; - -static const CoordRec char72_stroke2[] = { - { 11.42, 52.381 }, - { 78.0867, 52.381 }, -}; - -static const StrokeRec char72[] = { - { 2, char72_stroke0 }, - { 2, char72_stroke1 }, - { 2, char72_stroke2 }, -}; - -/* char: 73 'I' */ - -static const CoordRec char73_stroke0[] = { - { 10.86, 100 }, - { 10.86, 0 }, -}; - -static const StrokeRec char73[] = { - { 2, char73_stroke0 }, -}; - -/* char: 74 'J' */ - -static const CoordRec char74_stroke0[] = { - { 50.119, 100 }, - { 50.119, 23.8095 }, - { 45.3571, 9.5238 }, - { 40.5952, 4.7619 }, - { 31.0714, 0 }, - { 21.5476, 0 }, - { 12.0238, 4.7619 }, - { 7.2619, 9.5238 }, - { 2.5, 23.8095 }, - { 2.5, 33.3333 }, -}; - -static const StrokeRec char74[] = { - { 10, char74_stroke0 }, -}; - -/* char: 75 'K' */ - -static const CoordRec char75_stroke0[] = { - { 11.28, 100 }, - { 11.28, 0 }, -}; - -static const CoordRec char75_stroke1[] = { - { 77.9467, 100 }, - { 11.28, 33.3333 }, -}; - -static const CoordRec char75_stroke2[] = { - { 35.0895, 57.1429 }, - { 77.9467, 0 }, -}; - -static const StrokeRec char75[] = { - { 2, char75_stroke0 }, - { 2, char75_stroke1 }, - { 2, char75_stroke2 }, -}; - -/* char: 76 'L' */ - -static const CoordRec char76_stroke0[] = { - { 11.68, 100 }, - { 11.68, 0 }, -}; - -static const CoordRec char76_stroke1[] = { - { 11.68, 0 }, - { 68.8229, 0 }, -}; - -static const StrokeRec char76[] = { - { 2, char76_stroke0 }, - { 2, char76_stroke1 }, -}; - -/* char: 77 'M' */ - -static const CoordRec char77_stroke0[] = { - { 10.86, 100 }, - { 10.86, 0 }, -}; - -static const CoordRec char77_stroke1[] = { - { 10.86, 100 }, - { 48.9552, 0 }, -}; - -static const CoordRec char77_stroke2[] = { - { 87.0505, 100 }, - { 48.9552, 0 }, -}; - -static const CoordRec char77_stroke3[] = { - { 87.0505, 100 }, - { 87.0505, 0 }, -}; - -static const StrokeRec char77[] = { - { 2, char77_stroke0 }, - { 2, char77_stroke1 }, - { 2, char77_stroke2 }, - { 2, char77_stroke3 }, -}; - -/* char: 78 'N' */ - -static const CoordRec char78_stroke0[] = { - { 11.14, 100 }, - { 11.14, 0 }, -}; - -static const CoordRec char78_stroke1[] = { - { 11.14, 100 }, - { 77.8067, 0 }, -}; - -static const CoordRec char78_stroke2[] = { - { 77.8067, 100 }, - { 77.8067, 0 }, -}; - -static const StrokeRec char78[] = { - { 2, char78_stroke0 }, - { 2, char78_stroke1 }, - { 2, char78_stroke2 }, -}; - -/* char: 79 'O' */ - -static const CoordRec char79_stroke0[] = { - { 34.8114, 100 }, - { 25.2876, 95.2381 }, - { 15.7638, 85.7143 }, - { 11.0019, 76.1905 }, - { 6.24, 61.9048 }, - { 6.24, 38.0952 }, - { 11.0019, 23.8095 }, - { 15.7638, 14.2857 }, - { 25.2876, 4.7619 }, - { 34.8114, 0 }, - { 53.859, 0 }, - { 63.3829, 4.7619 }, - { 72.9067, 14.2857 }, - { 77.6686, 23.8095 }, - { 82.4305, 38.0952 }, - { 82.4305, 61.9048 }, - { 77.6686, 76.1905 }, - { 72.9067, 85.7143 }, - { 63.3829, 95.2381 }, - { 53.859, 100 }, - { 34.8114, 100 }, -}; - -static const StrokeRec char79[] = { - { 21, char79_stroke0 }, -}; - -/* char: 80 'P' */ - -static const CoordRec char80_stroke0[] = { - { 12.1, 100 }, - { 12.1, 0 }, -}; - -static const CoordRec char80_stroke1[] = { - { 12.1, 100 }, - { 54.9571, 100 }, - { 69.2429, 95.2381 }, - { 74.0048, 90.4762 }, - { 78.7667, 80.9524 }, - { 78.7667, 66.6667 }, - { 74.0048, 57.1429 }, - { 69.2429, 52.381 }, - { 54.9571, 47.619 }, - { 12.1, 47.619 }, -}; - -static const StrokeRec char80[] = { - { 2, char80_stroke0 }, - { 10, char80_stroke1 }, -}; - -/* char: 81 'Q' */ - -static const CoordRec char81_stroke0[] = { - { 33.8714, 100 }, - { 24.3476, 95.2381 }, - { 14.8238, 85.7143 }, - { 10.0619, 76.1905 }, - { 5.3, 61.9048 }, - { 5.3, 38.0952 }, - { 10.0619, 23.8095 }, - { 14.8238, 14.2857 }, - { 24.3476, 4.7619 }, - { 33.8714, 0 }, - { 52.919, 0 }, - { 62.4429, 4.7619 }, - { 71.9667, 14.2857 }, - { 76.7286, 23.8095 }, - { 81.4905, 38.0952 }, - { 81.4905, 61.9048 }, - { 76.7286, 76.1905 }, - { 71.9667, 85.7143 }, - { 62.4429, 95.2381 }, - { 52.919, 100 }, - { 33.8714, 100 }, -}; - -static const CoordRec char81_stroke1[] = { - { 48.1571, 19.0476 }, - { 76.7286, -9.5238 }, -}; - -static const StrokeRec char81[] = { - { 21, char81_stroke0 }, - { 2, char81_stroke1 }, -}; - -/* char: 82 'R' */ - -static const CoordRec char82_stroke0[] = { - { 11.68, 100 }, - { 11.68, 0 }, -}; - -static const CoordRec char82_stroke1[] = { - { 11.68, 100 }, - { 54.5371, 100 }, - { 68.8229, 95.2381 }, - { 73.5848, 90.4762 }, - { 78.3467, 80.9524 }, - { 78.3467, 71.4286 }, - { 73.5848, 61.9048 }, - { 68.8229, 57.1429 }, - { 54.5371, 52.381 }, - { 11.68, 52.381 }, -}; - -static const CoordRec char82_stroke2[] = { - { 45.0133, 52.381 }, - { 78.3467, 0 }, -}; - -static const StrokeRec char82[] = { - { 2, char82_stroke0 }, - { 10, char82_stroke1 }, - { 2, char82_stroke2 }, -}; - -/* char: 83 'S' */ - -static const CoordRec char83_stroke0[] = { - { 74.6667, 85.7143 }, - { 65.1429, 95.2381 }, - { 50.8571, 100 }, - { 31.8095, 100 }, - { 17.5238, 95.2381 }, - { 8, 85.7143 }, - { 8, 76.1905 }, - { 12.7619, 66.6667 }, - { 17.5238, 61.9048 }, - { 27.0476, 57.1429 }, - { 55.619, 47.619 }, - { 65.1429, 42.8571 }, - { 69.9048, 38.0952 }, - { 74.6667, 28.5714 }, - { 74.6667, 14.2857 }, - { 65.1429, 4.7619 }, - { 50.8571, 0 }, - { 31.8095, 0 }, - { 17.5238, 4.7619 }, - { 8, 14.2857 }, -}; - -static const StrokeRec char83[] = { - { 20, char83_stroke0 }, -}; - -/* char: 84 'T' */ - -static const CoordRec char84_stroke0[] = { - { 35.6933, 100 }, - { 35.6933, 0 }, -}; - -static const CoordRec char84_stroke1[] = { - { 2.36, 100 }, - { 69.0267, 100 }, -}; - -static const StrokeRec char84[] = { - { 2, char84_stroke0 }, - { 2, char84_stroke1 }, -}; - -/* char: 85 'U' */ - -static const CoordRec char85_stroke0[] = { - { 11.54, 100 }, - { 11.54, 28.5714 }, - { 16.3019, 14.2857 }, - { 25.8257, 4.7619 }, - { 40.1114, 0 }, - { 49.6352, 0 }, - { 63.921, 4.7619 }, - { 73.4448, 14.2857 }, - { 78.2067, 28.5714 }, - { 78.2067, 100 }, -}; - -static const StrokeRec char85[] = { - { 10, char85_stroke0 }, -}; - -/* char: 86 'V' */ - -static const CoordRec char86_stroke0[] = { - { 2.36, 100 }, - { 40.4552, 0 }, -}; - -static const CoordRec char86_stroke1[] = { - { 78.5505, 100 }, - { 40.4552, 0 }, -}; - -static const StrokeRec char86[] = { - { 2, char86_stroke0 }, - { 2, char86_stroke1 }, -}; - -/* char: 87 'W' */ - -static const CoordRec char87_stroke0[] = { - { 2.22, 100 }, - { 26.0295, 0 }, -}; - -static const CoordRec char87_stroke1[] = { - { 49.839, 100 }, - { 26.0295, 0 }, -}; - -static const CoordRec char87_stroke2[] = { - { 49.839, 100 }, - { 73.6486, 0 }, -}; - -static const CoordRec char87_stroke3[] = { - { 97.4581, 100 }, - { 73.6486, 0 }, -}; - -static const StrokeRec char87[] = { - { 2, char87_stroke0 }, - { 2, char87_stroke1 }, - { 2, char87_stroke2 }, - { 2, char87_stroke3 }, -}; - -/* char: 88 'X' */ - -static const CoordRec char88_stroke0[] = { - { 2.5, 100 }, - { 69.1667, 0 }, -}; - -static const CoordRec char88_stroke1[] = { - { 69.1667, 100 }, - { 2.5, 0 }, -}; - -static const StrokeRec char88[] = { - { 2, char88_stroke0 }, - { 2, char88_stroke1 }, -}; - -/* char: 89 'Y' */ - -static const CoordRec char89_stroke0[] = { - { 1.52, 100 }, - { 39.6152, 52.381 }, - { 39.6152, 0 }, -}; - -static const CoordRec char89_stroke1[] = { - { 77.7105, 100 }, - { 39.6152, 52.381 }, -}; - -static const StrokeRec char89[] = { - { 3, char89_stroke0 }, - { 2, char89_stroke1 }, -}; - -/* char: 90 'Z' */ - -static const CoordRec char90_stroke0[] = { - { 69.1667, 100 }, - { 2.5, 0 }, -}; - -static const CoordRec char90_stroke1[] = { - { 2.5, 100 }, - { 69.1667, 100 }, -}; - -static const CoordRec char90_stroke2[] = { - { 2.5, 0 }, - { 69.1667, 0 }, -}; - -static const StrokeRec char90[] = { - { 2, char90_stroke0 }, - { 2, char90_stroke1 }, - { 2, char90_stroke2 }, -}; - -/* char: 91 '[' */ - -static const CoordRec char91_stroke0[] = { - { 7.78, 119.048 }, - { 7.78, -33.3333 }, -}; - -static const CoordRec char91_stroke1[] = { - { 12.5419, 119.048 }, - { 12.5419, -33.3333 }, -}; - -static const CoordRec char91_stroke2[] = { - { 7.78, 119.048 }, - { 41.1133, 119.048 }, -}; - -static const CoordRec char91_stroke3[] = { - { 7.78, -33.3333 }, - { 41.1133, -33.3333 }, -}; - -static const StrokeRec char91[] = { - { 2, char91_stroke0 }, - { 2, char91_stroke1 }, - { 2, char91_stroke2 }, - { 2, char91_stroke3 }, -}; - -/* char: 92 '\' */ - -static const CoordRec char92_stroke0[] = { - { 5.84, 100 }, - { 72.5067, -14.2857 }, -}; - -static const StrokeRec char92[] = { - { 2, char92_stroke0 }, -}; - -/* char: 93 ']' */ - -static const CoordRec char93_stroke0[] = { - { 33.0114, 119.048 }, - { 33.0114, -33.3333 }, -}; - -static const CoordRec char93_stroke1[] = { - { 37.7733, 119.048 }, - { 37.7733, -33.3333 }, -}; - -static const CoordRec char93_stroke2[] = { - { 4.44, 119.048 }, - { 37.7733, 119.048 }, -}; - -static const CoordRec char93_stroke3[] = { - { 4.44, -33.3333 }, - { 37.7733, -33.3333 }, -}; - -static const StrokeRec char93[] = { - { 2, char93_stroke0 }, - { 2, char93_stroke1 }, - { 2, char93_stroke2 }, - { 2, char93_stroke3 }, -}; - -/* char: 94 '^' */ - -static const CoordRec char94_stroke0[] = { - { 44.0752, 109.524 }, - { 5.98, 42.8571 }, -}; - -static const CoordRec char94_stroke1[] = { - { 44.0752, 109.524 }, - { 82.1705, 42.8571 }, -}; - -static const StrokeRec char94[] = { - { 2, char94_stroke0 }, - { 2, char94_stroke1 }, -}; - -/* char: 95 '_' */ - -static const CoordRec char95_stroke0[] = { - { -1.1, -33.3333 }, - { 103.662, -33.3333 }, - { 103.662, -28.5714 }, - { -1.1, -28.5714 }, - { -1.1, -33.3333 }, -}; - -static const StrokeRec char95[] = { - { 5, char95_stroke0 }, -}; - -/* char: 96 '`' */ - -static const CoordRec char96_stroke0[] = { - { 33.0219, 100 }, - { 56.8314, 71.4286 }, -}; - -static const CoordRec char96_stroke1[] = { - { 33.0219, 100 }, - { 28.26, 95.2381 }, - { 56.8314, 71.4286 }, -}; - -static const StrokeRec char96[] = { - { 2, char96_stroke0 }, - { 3, char96_stroke1 }, -}; - -/* char: 97 'a' */ - -static const CoordRec char97_stroke0[] = { - { 63.8229, 66.6667 }, - { 63.8229, 0 }, -}; - -static const CoordRec char97_stroke1[] = { - { 63.8229, 52.381 }, - { 54.299, 61.9048 }, - { 44.7752, 66.6667 }, - { 30.4895, 66.6667 }, - { 20.9657, 61.9048 }, - { 11.4419, 52.381 }, - { 6.68, 38.0952 }, - { 6.68, 28.5714 }, - { 11.4419, 14.2857 }, - { 20.9657, 4.7619 }, - { 30.4895, 0 }, - { 44.7752, 0 }, - { 54.299, 4.7619 }, - { 63.8229, 14.2857 }, -}; - -static const StrokeRec char97[] = { - { 2, char97_stroke0 }, - { 14, char97_stroke1 }, -}; - -/* char: 98 'b' */ - -static const CoordRec char98_stroke0[] = { - { 8.76, 100 }, - { 8.76, 0 }, -}; - -static const CoordRec char98_stroke1[] = { - { 8.76, 52.381 }, - { 18.2838, 61.9048 }, - { 27.8076, 66.6667 }, - { 42.0933, 66.6667 }, - { 51.6171, 61.9048 }, - { 61.141, 52.381 }, - { 65.9029, 38.0952 }, - { 65.9029, 28.5714 }, - { 61.141, 14.2857 }, - { 51.6171, 4.7619 }, - { 42.0933, 0 }, - { 27.8076, 0 }, - { 18.2838, 4.7619 }, - { 8.76, 14.2857 }, -}; - -static const StrokeRec char98[] = { - { 2, char98_stroke0 }, - { 14, char98_stroke1 }, -}; - -/* char: 99 'c' */ - -static const CoordRec char99_stroke0[] = { - { 62.6629, 52.381 }, - { 53.139, 61.9048 }, - { 43.6152, 66.6667 }, - { 29.3295, 66.6667 }, - { 19.8057, 61.9048 }, - { 10.2819, 52.381 }, - { 5.52, 38.0952 }, - { 5.52, 28.5714 }, - { 10.2819, 14.2857 }, - { 19.8057, 4.7619 }, - { 29.3295, 0 }, - { 43.6152, 0 }, - { 53.139, 4.7619 }, - { 62.6629, 14.2857 }, -}; - -static const StrokeRec char99[] = { - { 14, char99_stroke0 }, -}; - -/* char: 100 'd' */ - -static const CoordRec char100_stroke0[] = { - { 61.7829, 100 }, - { 61.7829, 0 }, -}; - -static const CoordRec char100_stroke1[] = { - { 61.7829, 52.381 }, - { 52.259, 61.9048 }, - { 42.7352, 66.6667 }, - { 28.4495, 66.6667 }, - { 18.9257, 61.9048 }, - { 9.4019, 52.381 }, - { 4.64, 38.0952 }, - { 4.64, 28.5714 }, - { 9.4019, 14.2857 }, - { 18.9257, 4.7619 }, - { 28.4495, 0 }, - { 42.7352, 0 }, - { 52.259, 4.7619 }, - { 61.7829, 14.2857 }, -}; - -static const StrokeRec char100[] = { - { 2, char100_stroke0 }, - { 14, char100_stroke1 }, -}; - -/* char: 101 'e' */ - -static const CoordRec char101_stroke0[] = { - { 5.72, 38.0952 }, - { 62.8629, 38.0952 }, - { 62.8629, 47.619 }, - { 58.101, 57.1429 }, - { 53.339, 61.9048 }, - { 43.8152, 66.6667 }, - { 29.5295, 66.6667 }, - { 20.0057, 61.9048 }, - { 10.4819, 52.381 }, - { 5.72, 38.0952 }, - { 5.72, 28.5714 }, - { 10.4819, 14.2857 }, - { 20.0057, 4.7619 }, - { 29.5295, 0 }, - { 43.8152, 0 }, - { 53.339, 4.7619 }, - { 62.8629, 14.2857 }, -}; - -static const StrokeRec char101[] = { - { 17, char101_stroke0 }, -}; - -/* char: 102 'f' */ - -static const CoordRec char102_stroke0[] = { - { 38.7752, 100 }, - { 29.2514, 100 }, - { 19.7276, 95.2381 }, - { 14.9657, 80.9524 }, - { 14.9657, 0 }, -}; - -static const CoordRec char102_stroke1[] = { - { 0.68, 66.6667 }, - { 34.0133, 66.6667 }, -}; - -static const StrokeRec char102[] = { - { 5, char102_stroke0 }, - { 2, char102_stroke1 }, -}; - -/* char: 103 'g' */ - -static const CoordRec char103_stroke0[] = { - { 62.5029, 66.6667 }, - { 62.5029, -9.5238 }, - { 57.741, -23.8095 }, - { 52.979, -28.5714 }, - { 43.4552, -33.3333 }, - { 29.1695, -33.3333 }, - { 19.6457, -28.5714 }, -}; - -static const CoordRec char103_stroke1[] = { - { 62.5029, 52.381 }, - { 52.979, 61.9048 }, - { 43.4552, 66.6667 }, - { 29.1695, 66.6667 }, - { 19.6457, 61.9048 }, - { 10.1219, 52.381 }, - { 5.36, 38.0952 }, - { 5.36, 28.5714 }, - { 10.1219, 14.2857 }, - { 19.6457, 4.7619 }, - { 29.1695, 0 }, - { 43.4552, 0 }, - { 52.979, 4.7619 }, - { 62.5029, 14.2857 }, -}; - -static const StrokeRec char103[] = { - { 7, char103_stroke0 }, - { 14, char103_stroke1 }, -}; - -/* char: 104 'h' */ - -static const CoordRec char104_stroke0[] = { - { 9.6, 100 }, - { 9.6, 0 }, -}; - -static const CoordRec char104_stroke1[] = { - { 9.6, 47.619 }, - { 23.8857, 61.9048 }, - { 33.4095, 66.6667 }, - { 47.6952, 66.6667 }, - { 57.219, 61.9048 }, - { 61.981, 47.619 }, - { 61.981, 0 }, -}; - -static const StrokeRec char104[] = { - { 2, char104_stroke0 }, - { 7, char104_stroke1 }, -}; - -/* char: 105 'i' */ - -static const CoordRec char105_stroke0[] = { - { 10.02, 100 }, - { 14.7819, 95.2381 }, - { 19.5438, 100 }, - { 14.7819, 104.762 }, - { 10.02, 100 }, -}; - -static const CoordRec char105_stroke1[] = { - { 14.7819, 66.6667 }, - { 14.7819, 0 }, -}; - -static const StrokeRec char105[] = { - { 5, char105_stroke0 }, - { 2, char105_stroke1 }, -}; - -/* char: 106 'j' */ - -static const CoordRec char106_stroke0[] = { - { 17.3876, 100 }, - { 22.1495, 95.2381 }, - { 26.9114, 100 }, - { 22.1495, 104.762 }, - { 17.3876, 100 }, -}; - -static const CoordRec char106_stroke1[] = { - { 22.1495, 66.6667 }, - { 22.1495, -14.2857 }, - { 17.3876, -28.5714 }, - { 7.8638, -33.3333 }, - { -1.66, -33.3333 }, -}; - -static const StrokeRec char106[] = { - { 5, char106_stroke0 }, - { 5, char106_stroke1 }, -}; - -/* char: 107 'k' */ - -static const CoordRec char107_stroke0[] = { - { 9.6, 100 }, - { 9.6, 0 }, -}; - -static const CoordRec char107_stroke1[] = { - { 57.219, 66.6667 }, - { 9.6, 19.0476 }, -}; - -static const CoordRec char107_stroke2[] = { - { 28.6476, 38.0952 }, - { 61.981, 0 }, -}; - -static const StrokeRec char107[] = { - { 2, char107_stroke0 }, - { 2, char107_stroke1 }, - { 2, char107_stroke2 }, -}; - -/* char: 108 'l' */ - -static const CoordRec char108_stroke0[] = { - { 10.02, 100 }, - { 10.02, 0 }, -}; - -static const StrokeRec char108[] = { - { 2, char108_stroke0 }, -}; - -/* char: 109 'm' */ - -static const CoordRec char109_stroke0[] = { - { 9.6, 66.6667 }, - { 9.6, 0 }, -}; - -static const CoordRec char109_stroke1[] = { - { 9.6, 47.619 }, - { 23.8857, 61.9048 }, - { 33.4095, 66.6667 }, - { 47.6952, 66.6667 }, - { 57.219, 61.9048 }, - { 61.981, 47.619 }, - { 61.981, 0 }, -}; - -static const CoordRec char109_stroke2[] = { - { 61.981, 47.619 }, - { 76.2667, 61.9048 }, - { 85.7905, 66.6667 }, - { 100.076, 66.6667 }, - { 109.6, 61.9048 }, - { 114.362, 47.619 }, - { 114.362, 0 }, -}; - -static const StrokeRec char109[] = { - { 2, char109_stroke0 }, - { 7, char109_stroke1 }, - { 7, char109_stroke2 }, -}; - -/* char: 110 'n' */ - -static const CoordRec char110_stroke0[] = { - { 9.18, 66.6667 }, - { 9.18, 0 }, -}; - -static const CoordRec char110_stroke1[] = { - { 9.18, 47.619 }, - { 23.4657, 61.9048 }, - { 32.9895, 66.6667 }, - { 47.2752, 66.6667 }, - { 56.799, 61.9048 }, - { 61.561, 47.619 }, - { 61.561, 0 }, -}; - -static const StrokeRec char110[] = { - { 2, char110_stroke0 }, - { 7, char110_stroke1 }, -}; - -/* char: 111 'o' */ - -static const CoordRec char111_stroke0[] = { - { 28.7895, 66.6667 }, - { 19.2657, 61.9048 }, - { 9.7419, 52.381 }, - { 4.98, 38.0952 }, - { 4.98, 28.5714 }, - { 9.7419, 14.2857 }, - { 19.2657, 4.7619 }, - { 28.7895, 0 }, - { 43.0752, 0 }, - { 52.599, 4.7619 }, - { 62.1229, 14.2857 }, - { 66.8848, 28.5714 }, - { 66.8848, 38.0952 }, - { 62.1229, 52.381 }, - { 52.599, 61.9048 }, - { 43.0752, 66.6667 }, - { 28.7895, 66.6667 }, -}; - -static const StrokeRec char111[] = { - { 17, char111_stroke0 }, -}; - -/* char: 112 'p' */ - -static const CoordRec char112_stroke0[] = { - { 9.46, 66.6667 }, - { 9.46, -33.3333 }, -}; - -static const CoordRec char112_stroke1[] = { - { 9.46, 52.381 }, - { 18.9838, 61.9048 }, - { 28.5076, 66.6667 }, - { 42.7933, 66.6667 }, - { 52.3171, 61.9048 }, - { 61.841, 52.381 }, - { 66.6029, 38.0952 }, - { 66.6029, 28.5714 }, - { 61.841, 14.2857 }, - { 52.3171, 4.7619 }, - { 42.7933, 0 }, - { 28.5076, 0 }, - { 18.9838, 4.7619 }, - { 9.46, 14.2857 }, -}; - -static const StrokeRec char112[] = { - { 2, char112_stroke0 }, - { 14, char112_stroke1 }, -}; - -/* char: 113 'q' */ - -static const CoordRec char113_stroke0[] = { - { 61.9829, 66.6667 }, - { 61.9829, -33.3333 }, -}; - -static const CoordRec char113_stroke1[] = { - { 61.9829, 52.381 }, - { 52.459, 61.9048 }, - { 42.9352, 66.6667 }, - { 28.6495, 66.6667 }, - { 19.1257, 61.9048 }, - { 9.6019, 52.381 }, - { 4.84, 38.0952 }, - { 4.84, 28.5714 }, - { 9.6019, 14.2857 }, - { 19.1257, 4.7619 }, - { 28.6495, 0 }, - { 42.9352, 0 }, - { 52.459, 4.7619 }, - { 61.9829, 14.2857 }, -}; - -static const StrokeRec char113[] = { - { 2, char113_stroke0 }, - { 14, char113_stroke1 }, -}; - -/* char: 114 'r' */ - -static const CoordRec char114_stroke0[] = { - { 9.46, 66.6667 }, - { 9.46, 0 }, -}; - -static const CoordRec char114_stroke1[] = { - { 9.46, 38.0952 }, - { 14.2219, 52.381 }, - { 23.7457, 61.9048 }, - { 33.2695, 66.6667 }, - { 47.5552, 66.6667 }, -}; - -static const StrokeRec char114[] = { - { 2, char114_stroke0 }, - { 5, char114_stroke1 }, -}; - -/* char: 115 's' */ - -static const CoordRec char115_stroke0[] = { - { 57.081, 52.381 }, - { 52.319, 61.9048 }, - { 38.0333, 66.6667 }, - { 23.7476, 66.6667 }, - { 9.4619, 61.9048 }, - { 4.7, 52.381 }, - { 9.4619, 42.8571 }, - { 18.9857, 38.0952 }, - { 42.7952, 33.3333 }, - { 52.319, 28.5714 }, - { 57.081, 19.0476 }, - { 57.081, 14.2857 }, - { 52.319, 4.7619 }, - { 38.0333, 0 }, - { 23.7476, 0 }, - { 9.4619, 4.7619 }, - { 4.7, 14.2857 }, -}; - -static const StrokeRec char115[] = { - { 17, char115_stroke0 }, -}; - -/* char: 116 't' */ - -static const CoordRec char116_stroke0[] = { - { 14.8257, 100 }, - { 14.8257, 19.0476 }, - { 19.5876, 4.7619 }, - { 29.1114, 0 }, - { 38.6352, 0 }, -}; - -static const CoordRec char116_stroke1[] = { - { 0.54, 66.6667 }, - { 33.8733, 66.6667 }, -}; - -static const StrokeRec char116[] = { - { 5, char116_stroke0 }, - { 2, char116_stroke1 }, -}; - -/* char: 117 'u' */ - -static const CoordRec char117_stroke0[] = { - { 9.46, 66.6667 }, - { 9.46, 19.0476 }, - { 14.2219, 4.7619 }, - { 23.7457, 0 }, - { 38.0314, 0 }, - { 47.5552, 4.7619 }, - { 61.841, 19.0476 }, -}; - -static const CoordRec char117_stroke1[] = { - { 61.841, 66.6667 }, - { 61.841, 0 }, -}; - -static const StrokeRec char117[] = { - { 7, char117_stroke0 }, - { 2, char117_stroke1 }, -}; - -/* char: 118 'v' */ - -static const CoordRec char118_stroke0[] = { - { 1.8, 66.6667 }, - { 30.3714, 0 }, -}; - -static const CoordRec char118_stroke1[] = { - { 58.9429, 66.6667 }, - { 30.3714, 0 }, -}; - -static const StrokeRec char118[] = { - { 2, char118_stroke0 }, - { 2, char118_stroke1 }, -}; - -/* char: 119 'w' */ - -static const CoordRec char119_stroke0[] = { - { 2.5, 66.6667 }, - { 21.5476, 0 }, -}; - -static const CoordRec char119_stroke1[] = { - { 40.5952, 66.6667 }, - { 21.5476, 0 }, -}; - -static const CoordRec char119_stroke2[] = { - { 40.5952, 66.6667 }, - { 59.6429, 0 }, -}; - -static const CoordRec char119_stroke3[] = { - { 78.6905, 66.6667 }, - { 59.6429, 0 }, -}; - -static const StrokeRec char119[] = { - { 2, char119_stroke0 }, - { 2, char119_stroke1 }, - { 2, char119_stroke2 }, - { 2, char119_stroke3 }, -}; - -/* char: 120 'x' */ - -static const CoordRec char120_stroke0[] = { - { 1.66, 66.6667 }, - { 54.041, 0 }, -}; - -static const CoordRec char120_stroke1[] = { - { 54.041, 66.6667 }, - { 1.66, 0 }, -}; - -static const StrokeRec char120[] = { - { 2, char120_stroke0 }, - { 2, char120_stroke1 }, -}; - -/* char: 121 'y' */ - -static const CoordRec char121_stroke0[] = { - { 6.5619, 66.6667 }, - { 35.1333, 0 }, -}; - -static const CoordRec char121_stroke1[] = { - { 63.7048, 66.6667 }, - { 35.1333, 0 }, - { 25.6095, -19.0476 }, - { 16.0857, -28.5714 }, - { 6.5619, -33.3333 }, - { 1.8, -33.3333 }, -}; - -static const StrokeRec char121[] = { - { 2, char121_stroke0 }, - { 6, char121_stroke1 }, -}; - -/* char: 122 'z' */ - -static const CoordRec char122_stroke0[] = { - { 56.821, 66.6667 }, - { 4.44, 0 }, -}; - -static const CoordRec char122_stroke1[] = { - { 4.44, 66.6667 }, - { 56.821, 66.6667 }, -}; - -static const CoordRec char122_stroke2[] = { - { 4.44, 0 }, - { 56.821, 0 }, -}; - -static const StrokeRec char122[] = { - { 2, char122_stroke0 }, - { 2, char122_stroke1 }, - { 2, char122_stroke2 }, -}; - -/* char: 123 '{' */ - -static const CoordRec char123_stroke0[] = { - { 31.1895, 119.048 }, - { 21.6657, 114.286 }, - { 16.9038, 109.524 }, - { 12.1419, 100 }, - { 12.1419, 90.4762 }, - { 16.9038, 80.9524 }, - { 21.6657, 76.1905 }, - { 26.4276, 66.6667 }, - { 26.4276, 57.1429 }, - { 16.9038, 47.619 }, -}; - -static const CoordRec char123_stroke1[] = { - { 21.6657, 114.286 }, - { 16.9038, 104.762 }, - { 16.9038, 95.2381 }, - { 21.6657, 85.7143 }, - { 26.4276, 80.9524 }, - { 31.1895, 71.4286 }, - { 31.1895, 61.9048 }, - { 26.4276, 52.381 }, - { 7.38, 42.8571 }, - { 26.4276, 33.3333 }, - { 31.1895, 23.8095 }, - { 31.1895, 14.2857 }, - { 26.4276, 4.7619 }, - { 21.6657, 0 }, - { 16.9038, -9.5238 }, - { 16.9038, -19.0476 }, - { 21.6657, -28.5714 }, -}; - -static const CoordRec char123_stroke2[] = { - { 16.9038, 38.0952 }, - { 26.4276, 28.5714 }, - { 26.4276, 19.0476 }, - { 21.6657, 9.5238 }, - { 16.9038, 4.7619 }, - { 12.1419, -4.7619 }, - { 12.1419, -14.2857 }, - { 16.9038, -23.8095 }, - { 21.6657, -28.5714 }, - { 31.1895, -33.3333 }, -}; - -static const StrokeRec char123[] = { - { 10, char123_stroke0 }, - { 17, char123_stroke1 }, - { 10, char123_stroke2 }, -}; - -/* char: 124 '|' */ - -static const CoordRec char124_stroke0[] = { - { 11.54, 119.048 }, - { 11.54, -33.3333 }, -}; - -static const StrokeRec char124[] = { - { 2, char124_stroke0 }, -}; - -/* char: 125 '}' */ - -static const CoordRec char125_stroke0[] = { - { 9.18, 119.048 }, - { 18.7038, 114.286 }, - { 23.4657, 109.524 }, - { 28.2276, 100 }, - { 28.2276, 90.4762 }, - { 23.4657, 80.9524 }, - { 18.7038, 76.1905 }, - { 13.9419, 66.6667 }, - { 13.9419, 57.1429 }, - { 23.4657, 47.619 }, -}; - -static const CoordRec char125_stroke1[] = { - { 18.7038, 114.286 }, - { 23.4657, 104.762 }, - { 23.4657, 95.2381 }, - { 18.7038, 85.7143 }, - { 13.9419, 80.9524 }, - { 9.18, 71.4286 }, - { 9.18, 61.9048 }, - { 13.9419, 52.381 }, - { 32.9895, 42.8571 }, - { 13.9419, 33.3333 }, - { 9.18, 23.8095 }, - { 9.18, 14.2857 }, - { 13.9419, 4.7619 }, - { 18.7038, 0 }, - { 23.4657, -9.5238 }, - { 23.4657, -19.0476 }, - { 18.7038, -28.5714 }, -}; - -static const CoordRec char125_stroke2[] = { - { 23.4657, 38.0952 }, - { 13.9419, 28.5714 }, - { 13.9419, 19.0476 }, - { 18.7038, 9.5238 }, - { 23.4657, 4.7619 }, - { 28.2276, -4.7619 }, - { 28.2276, -14.2857 }, - { 23.4657, -23.8095 }, - { 18.7038, -28.5714 }, - { 9.18, -33.3333 }, -}; - -static const StrokeRec char125[] = { - { 10, char125_stroke0 }, - { 17, char125_stroke1 }, - { 10, char125_stroke2 }, -}; - -/* char: 126 '~' */ - -static const CoordRec char126_stroke0[] = { - { 2.92, 28.5714 }, - { 2.92, 38.0952 }, - { 7.6819, 52.381 }, - { 17.2057, 57.1429 }, - { 26.7295, 57.1429 }, - { 36.2533, 52.381 }, - { 55.301, 38.0952 }, - { 64.8248, 33.3333 }, - { 74.3486, 33.3333 }, - { 83.8724, 38.0952 }, - { 88.6343, 47.619 }, -}; - -static const CoordRec char126_stroke1[] = { - { 2.92, 38.0952 }, - { 7.6819, 47.619 }, - { 17.2057, 52.381 }, - { 26.7295, 52.381 }, - { 36.2533, 47.619 }, - { 55.301, 33.3333 }, - { 64.8248, 28.5714 }, - { 74.3486, 28.5714 }, - { 83.8724, 33.3333 }, - { 88.6343, 47.619 }, - { 88.6343, 57.1429 }, -}; - -static const StrokeRec char126[] = { - { 11, char126_stroke0 }, - { 11, char126_stroke1 }, -}; - -/* char: 127 */ - -static const CoordRec char127_stroke0[] = { - { 52.381, 100 }, - { 14.2857, -33.3333 }, -}; - -static const CoordRec char127_stroke1[] = { - { 28.5714, 66.6667 }, - { 14.2857, 61.9048 }, - { 4.7619, 52.381 }, - { 0, 38.0952 }, - { 0, 23.8095 }, - { 4.7619, 14.2857 }, - { 14.2857, 4.7619 }, - { 28.5714, 0 }, - { 38.0952, 0 }, - { 52.381, 4.7619 }, - { 61.9048, 14.2857 }, - { 66.6667, 28.5714 }, - { 66.6667, 42.8571 }, - { 61.9048, 52.381 }, - { 52.381, 61.9048 }, - { 38.0952, 66.6667 }, - { 28.5714, 66.6667 }, -}; - -static const StrokeRec char127[] = { - { 2, char127_stroke0 }, - { 17, char127_stroke1 }, -}; - -static const StrokeCharRec chars[] = { - { 0, /* char0 */ 0, 0, 0 }, - { 0, /* char1 */ 0, 0, 0 }, - { 0, /* char2 */ 0, 0, 0 }, - { 0, /* char3 */ 0, 0, 0 }, - { 0, /* char4 */ 0, 0, 0 }, - { 0, /* char5 */ 0, 0, 0 }, - { 0, /* char6 */ 0, 0, 0 }, - { 0, /* char7 */ 0, 0, 0 }, - { 0, /* char8 */ 0, 0, 0 }, - { 0, /* char9 */ 0, 0, 0 }, - { 0, /* char10 */ 0, 0, 0 }, - { 0, /* char11 */ 0, 0, 0 }, - { 0, /* char12 */ 0, 0, 0 }, - { 0, /* char13 */ 0, 0, 0 }, - { 0, /* char14 */ 0, 0, 0 }, - { 0, /* char15 */ 0, 0, 0 }, - { 0, /* char16 */ 0, 0, 0 }, - { 0, /* char17 */ 0, 0, 0 }, - { 0, /* char18 */ 0, 0, 0 }, - { 0, /* char19 */ 0, 0, 0 }, - { 0, /* char20 */ 0, 0, 0 }, - { 0, /* char21 */ 0, 0, 0 }, - { 0, /* char22 */ 0, 0, 0 }, - { 0, /* char23 */ 0, 0, 0 }, - { 0, /* char24 */ 0, 0, 0 }, - { 0, /* char25 */ 0, 0, 0 }, - { 0, /* char26 */ 0, 0, 0 }, - { 0, /* char27 */ 0, 0, 0 }, - { 0, /* char28 */ 0, 0, 0 }, - { 0, /* char29 */ 0, 0, 0 }, - { 0, /* char30 */ 0, 0, 0 }, - { 0, /* char31 */ 0, 0, 0 }, - { 0, /* char32 */ 0, 52.381, 104.762 }, - { 2, char33, 13.3819, 26.6238 }, - { 2, char34, 23.0676, 51.4352 }, - { 4, char35, 36.5333, 79.4886 }, - { 3, char36, 38.1533, 76.2067 }, - { 3, char37, 49.2171, 96.5743 }, - { 1, char38, 53.599, 101.758 }, - { 1, char39, 4.44, 13.62 }, - { 1, char40, 21.8657, 47.1733 }, - { 1, char41, 24.3276, 47.5333 }, - { 3, char42, 30.7695, 59.439 }, - { 2, char43, 48.8371, 97.2543 }, - { 1, char44, 13.5219, 26.0638 }, - { 1, char45, 50.2371, 100.754 }, - { 1, char46, 13.1019, 26.4838 }, - { 1, char47, 40.5733, 82.1067 }, - { 1, char48, 38.3133, 77.0667 }, - { 1, char49, 30.8676, 66.5295 }, - { 1, char50, 38.7533, 77.6467 }, - { 1, char51, 38.3333, 77.0467 }, - { 2, char52, 37.2133, 80.1686 }, - { 1, char53, 38.1933, 77.6867 }, - { 1, char54, 34.1514, 73.8048 }, - { 2, char55, 38.8933, 77.2267 }, - { 1, char56, 38.9333, 77.6667 }, - { 1, char57, 39.9333, 74.0648 }, - { 2, char58, 14.0819, 26.2238 }, - { 2, char59, 12.9619, 26.3038 }, - { 1, char60, 41.1552, 81.6105 }, - { 2, char61, 48.5571, 97.2543 }, - { 1, char62, 40.8752, 81.6105 }, - { 2, char63, 36.9914, 73.9029 }, - { 2, char64, 34.9314, 74.3648 }, - { 3, char65, 40.5952, 80.4905 }, - { 3, char66, 44.7533, 83.6267 }, - { 1, char67, 39.9933, 84.4886 }, - { 2, char68, 45.2933, 85.2867 }, - { 4, char69, 39.9914, 78.1848 }, - { 3, char70, 39.9914, 78.7448 }, - { 2, char71, 40.3933, 89.7686 }, - { 3, char72, 44.7533, 89.0867 }, - { 1, char73, 10.86, 21.3 }, - { 1, char74, 31.0714, 59.999 }, - { 3, char75, 44.6133, 79.3267 }, - { 2, char76, 40.2514, 71.3229 }, - { 4, char77, 48.9552, 97.2105 }, - { 3, char78, 44.4733, 88.8067 }, - { 1, char79, 44.3352, 88.8305 }, - { 2, char80, 45.4333, 85.6667 }, - { 2, char81, 43.3952, 88.0905 }, - { 3, char82, 45.0133, 82.3667 }, - { 1, char83, 41.3333, 80.8267 }, - { 2, char84, 35.6933, 71.9467 }, - { 1, char85, 44.8733, 89.4867 }, - { 2, char86, 40.4552, 81.6105 }, - { 4, char87, 49.839, 100.518 }, - { 2, char88, 35.8333, 72.3667 }, - { 2, char89, 39.6152, 79.6505 }, - { 3, char90, 35.8333, 73.7467 }, - { 4, char91, 22.0657, 46.1133 }, - { 1, char92, 39.1733, 78.2067 }, - { 4, char93, 23.4876, 46.3933 }, - { 2, char94, 44.0752, 90.2305 }, - { 1, char95, 51.281, 104.062 }, - { 2, char96, 42.5457, 83.5714 }, - { 2, char97, 35.2514, 66.6029 }, - { 2, char98, 37.3314, 70.4629 }, - { 1, char99, 34.0914, 68.9229 }, - { 2, char100, 33.2114, 70.2629 }, - { 1, char101, 34.2914, 68.5229 }, - { 2, char102, 14.9657, 38.6552 }, - { 2, char103, 33.9314, 70.9829 }, - { 2, char104, 33.4095, 71.021 }, - { 2, char105, 14.7819, 28.8638 }, - { 2, char106, 17.3876, 36.2314 }, - { 3, char107, 33.4095, 62.521 }, - { 1, char108, 10.02, 19.34 }, - { 3, char109, 61.981, 123.962 }, - { 2, char110, 32.9895, 70.881 }, - { 1, char111, 33.5514, 71.7448 }, - { 2, char112, 38.0314, 70.8029 }, - { 2, char113, 33.4114, 70.7429 }, - { 2, char114, 23.7457, 49.4952 }, - { 1, char115, 28.5095, 62.321 }, - { 2, char116, 14.8257, 39.3152 }, - { 2, char117, 33.2695, 71.161 }, - { 2, char118, 30.3714, 60.6029 }, - { 4, char119, 40.5952, 80.4905 }, - { 2, char120, 25.4695, 56.401 }, - { 2, char121, 35.1333, 66.0648 }, - { 3, char122, 28.2495, 61.821 }, - { 3, char123, 21.6657, 41.6295 }, - { 1, char124, 11.54, 23.78 }, - { 3, char125, 18.7038, 41.4695 }, - { 2, char126, 45.7771, 91.2743 }, - { 2, char127, 33.3333, 66.6667 }, -}; - -StrokeFontRec glutStrokeRoman = { "Roman", 128, chars, 119.048, -33.3333 }; - diff --git a/src/glut/os2/glut_shapes.cpp b/src/glut/os2/glut_shapes.cpp deleted file mode 100644 index 111e2d48e9..0000000000 --- a/src/glut/os2/glut_shapes.cpp +++ /dev/null @@ -1,595 +0,0 @@ - -/* Copyright (c) Mark J. Kilgard, 1994, 1997. */ - -/** -(c) Copyright 1993, Silicon Graphics, Inc. - -ALL RIGHTS RESERVED - -Permission to use, copy, modify, and distribute this software -for any purpose and without fee is hereby granted, provided -that the above copyright notice appear in all copies and that -both the copyright notice and this permission notice appear in -supporting documentation, and that the name of Silicon -Graphics, Inc. not be used in advertising or publicity -pertaining to distribution of the software without specific, -written prior permission. - -THE MATERIAL EMBODIED ON THIS SOFTWARE IS PROVIDED TO YOU -"AS-IS" AND WITHOUT WARRANTY OF ANY KIND, EXPRESS, IMPLIED OR -OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF -MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. IN NO -EVENT SHALL SILICON GRAPHICS, INC. BE LIABLE TO YOU OR ANYONE -ELSE FOR ANY DIRECT, SPECIAL, INCIDENTAL, INDIRECT OR -CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER, -INCLUDING WITHOUT LIMITATION, LOSS OF PROFIT, LOSS OF USE, -SAVINGS OR REVENUE, OR THE CLAIMS OF THIRD PARTIES, WHETHER OR -NOT SILICON GRAPHICS, INC. HAS BEEN ADVISED OF THE POSSIBILITY -OF SUCH LOSS, HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -ARISING OUT OF OR IN CONNECTION WITH THE POSSESSION, USE OR -PERFORMANCE OF THIS SOFTWARE. - -US Government Users Restricted Rights - -Use, duplication, or disclosure by the Government is subject to -restrictions set forth in FAR 52.227.19(c)(2) or subparagraph -(c)(1)(ii) of the Rights in Technical Data and Computer -Software clause at DFARS 252.227-7013 and/or in similar or -successor clauses in the FAR or the DOD or NASA FAR -Supplement. Unpublished-- rights reserved under the copyright -laws of the United States. Contractor/manufacturer is Silicon -Graphics, Inc., 2011 N. Shoreline Blvd., Mountain View, CA -94039-7311. - -OpenGL(TM) is a trademark of Silicon Graphics, Inc. -*/ - -#include -#include "glutint.h" - -/* Some files do not define M_PI... */ -#ifndef M_PI -#define M_PI 3.14159265358979323846 -#endif - -static GLUquadricObj *quadObj; - -#define QUAD_OBJ_INIT() { if(!quadObj) initQuadObj(); } - -static void -initQuadObj(void) -{ - quadObj = gluNewQuadric(); - if (!quadObj) - __glutFatalError("out of memory."); -} - -/* CENTRY */ -void GLUTAPIENTRY -glutWireSphere(GLdouble radius, GLint slices, GLint stacks) -{ - QUAD_OBJ_INIT(); - gluQuadricDrawStyle(quadObj, GLU_LINE); - gluQuadricNormals(quadObj, GLU_SMOOTH); - /* If we ever changed/used the texture or orientation state - of quadObj, we'd need to change it to the defaults here - with gluQuadricTexture and/or gluQuadricOrientation. */ - gluSphere(quadObj, radius, slices, stacks); -} - -void GLUTAPIENTRY -glutSolidSphere(GLdouble radius, GLint slices, GLint stacks) -{ - QUAD_OBJ_INIT(); - gluQuadricDrawStyle(quadObj, GLU_FILL); - gluQuadricNormals(quadObj, GLU_SMOOTH); - /* If we ever changed/used the texture or orientation state - of quadObj, we'd need to change it to the defaults here - with gluQuadricTexture and/or gluQuadricOrientation. */ - gluSphere(quadObj, radius, slices, stacks); -} - -void GLUTAPIENTRY -glutWireCone(GLdouble base, GLdouble height, - GLint slices, GLint stacks) -{ - QUAD_OBJ_INIT(); - gluQuadricDrawStyle(quadObj, GLU_LINE); - gluQuadricNormals(quadObj, GLU_SMOOTH); - /* If we ever changed/used the texture or orientation state - of quadObj, we'd need to change it to the defaults here - with gluQuadricTexture and/or gluQuadricOrientation. */ - gluCylinder(quadObj, base, 0.0, height, slices, stacks); -} - -void GLUTAPIENTRY -glutSolidCone(GLdouble base, GLdouble height, - GLint slices, GLint stacks) -{ - QUAD_OBJ_INIT(); - gluQuadricDrawStyle(quadObj, GLU_FILL); - gluQuadricNormals(quadObj, GLU_SMOOTH); - /* If we ever changed/used the texture or orientation state - of quadObj, we'd need to change it to the defaults here - with gluQuadricTexture and/or gluQuadricOrientation. */ - gluCylinder(quadObj, base, 0.0, height, slices, stacks); -} - -/* ENDCENTRY */ - -static void -drawBox(GLfloat size, GLenum type) -{ - static GLfloat n[6][3] = - { - {-1.0, 0.0, 0.0}, - {0.0, 1.0, 0.0}, - {1.0, 0.0, 0.0}, - {0.0, -1.0, 0.0}, - {0.0, 0.0, 1.0}, - {0.0, 0.0, -1.0} - }; - static GLint faces[6][4] = - { - {0, 1, 2, 3}, - {3, 2, 6, 7}, - {7, 6, 5, 4}, - {4, 5, 1, 0}, - {5, 6, 2, 1}, - {7, 4, 0, 3} - }; - GLfloat v[8][3]; - GLint i; - - v[0][0] = v[1][0] = v[2][0] = v[3][0] = -size / 2; - v[4][0] = v[5][0] = v[6][0] = v[7][0] = size / 2; - v[0][1] = v[1][1] = v[4][1] = v[5][1] = -size / 2; - v[2][1] = v[3][1] = v[6][1] = v[7][1] = size / 2; - v[0][2] = v[3][2] = v[4][2] = v[7][2] = -size / 2; - v[1][2] = v[2][2] = v[5][2] = v[6][2] = size / 2; - - for (i = 5; i >= 0; i--) { - glBegin(type); - glNormal3fv(&n[i][0]); - glVertex3fv(&v[faces[i][0]][0]); - glVertex3fv(&v[faces[i][1]][0]); - glVertex3fv(&v[faces[i][2]][0]); - glVertex3fv(&v[faces[i][3]][0]); - glEnd(); - } -} - -/* CENTRY */ -void GLUTAPIENTRY -glutWireCube(GLdouble size) -{ - drawBox(size, GL_LINE_LOOP); -} - -void GLUTAPIENTRY -glutSolidCube(GLdouble size) -{ - drawBox(size, GL_QUADS); -} - -/* ENDCENTRY */ - -static void -doughnut(GLfloat r, GLfloat R, GLint nsides, GLint rings) -{ - int i, j; - GLfloat theta, phi, theta1; - GLfloat cosTheta, sinTheta; - GLfloat cosTheta1, sinTheta1; - GLfloat ringDelta, sideDelta; - - ringDelta = 2.0 * M_PI / rings; - sideDelta = 2.0 * M_PI / nsides; - - theta = 0.0; - cosTheta = 1.0; - sinTheta = 0.0; - for (i = rings - 1; i >= 0; i--) { - theta1 = theta + ringDelta; - cosTheta1 = cos(theta1); - sinTheta1 = sin(theta1); - glBegin(GL_QUAD_STRIP); - phi = 0.0; - for (j = nsides; j >= 0; j--) { - GLfloat cosPhi, sinPhi, dist; - - phi += sideDelta; - cosPhi = cos(phi); - sinPhi = sin(phi); - dist = R + r * cosPhi; - - glNormal3f(cosTheta1 * cosPhi, -sinTheta1 * cosPhi, sinPhi); - glVertex3f(cosTheta1 * dist, -sinTheta1 * dist, r * sinPhi); - glNormal3f(cosTheta * cosPhi, -sinTheta * cosPhi, sinPhi); - glVertex3f(cosTheta * dist, -sinTheta * dist, r * sinPhi); - } - glEnd(); - theta = theta1; - cosTheta = cosTheta1; - sinTheta = sinTheta1; - } -} - -/* CENTRY */ -void GLUTAPIENTRY -glutWireTorus(GLdouble innerRadius, GLdouble outerRadius, - GLint nsides, GLint rings) -{ - glPushAttrib(GL_POLYGON_BIT); - glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); - doughnut(innerRadius, outerRadius, nsides, rings); - glPopAttrib(); -} - -void GLUTAPIENTRY -glutSolidTorus(GLdouble innerRadius, GLdouble outerRadius, - GLint nsides, GLint rings) -{ - doughnut(innerRadius, outerRadius, nsides, rings); -} - -/* ENDCENTRY */ - -static GLfloat dodec[20][3]; - -static void -initDodecahedron(void) -{ - GLfloat alpha, beta; - - alpha = sqrt(2.0 / (3.0 + sqrt(5.0))); - beta = 1.0 + sqrt(6.0 / (3.0 + sqrt(5.0)) - - 2.0 + 2.0 * sqrt(2.0 / (3.0 + sqrt(5.0)))); - /* *INDENT-OFF* */ - dodec[0][0] = -alpha; dodec[0][1] = 0; dodec[0][2] = beta; - dodec[1][0] = alpha; dodec[1][1] = 0; dodec[1][2] = beta; - dodec[2][0] = -1; dodec[2][1] = -1; dodec[2][2] = -1; - dodec[3][0] = -1; dodec[3][1] = -1; dodec[3][2] = 1; - dodec[4][0] = -1; dodec[4][1] = 1; dodec[4][2] = -1; - dodec[5][0] = -1; dodec[5][1] = 1; dodec[5][2] = 1; - dodec[6][0] = 1; dodec[6][1] = -1; dodec[6][2] = -1; - dodec[7][0] = 1; dodec[7][1] = -1; dodec[7][2] = 1; - dodec[8][0] = 1; dodec[8][1] = 1; dodec[8][2] = -1; - dodec[9][0] = 1; dodec[9][1] = 1; dodec[9][2] = 1; - dodec[10][0] = beta; dodec[10][1] = alpha; dodec[10][2] = 0; - dodec[11][0] = beta; dodec[11][1] = -alpha; dodec[11][2] = 0; - dodec[12][0] = -beta; dodec[12][1] = alpha; dodec[12][2] = 0; - dodec[13][0] = -beta; dodec[13][1] = -alpha; dodec[13][2] = 0; - dodec[14][0] = -alpha; dodec[14][1] = 0; dodec[14][2] = -beta; - dodec[15][0] = alpha; dodec[15][1] = 0; dodec[15][2] = -beta; - dodec[16][0] = 0; dodec[16][1] = beta; dodec[16][2] = alpha; - dodec[17][0] = 0; dodec[17][1] = beta; dodec[17][2] = -alpha; - dodec[18][0] = 0; dodec[18][1] = -beta; dodec[18][2] = alpha; - dodec[19][0] = 0; dodec[19][1] = -beta; dodec[19][2] = -alpha; - /* *INDENT-ON* */ - -} - -#define DIFF3(_a,_b,_c) { \ - (_c)[0] = (_a)[0] - (_b)[0]; \ - (_c)[1] = (_a)[1] - (_b)[1]; \ - (_c)[2] = (_a)[2] - (_b)[2]; \ -} - -static void -crossprod(GLfloat v1[3], GLfloat v2[3], GLfloat prod[3]) -{ - GLfloat p[3]; /* in case prod == v1 or v2 */ - - p[0] = v1[1] * v2[2] - v2[1] * v1[2]; - p[1] = v1[2] * v2[0] - v2[2] * v1[0]; - p[2] = v1[0] * v2[1] - v2[0] * v1[1]; - prod[0] = p[0]; - prod[1] = p[1]; - prod[2] = p[2]; -} - -static void -normalize(GLfloat v[3]) -{ - GLfloat d; - - d = sqrt(v[0] * v[0] + v[1] * v[1] + v[2] * v[2]); - if (d == 0.0) { - __glutWarning("normalize: zero length vector"); - v[0] = d = 1.0; - } - d = 1 / d; - v[0] *= d; - v[1] *= d; - v[2] *= d; -} - -static void -pentagon(int a, int b, int c, int d, int e, GLenum shadeType) -{ - GLfloat n0[3], d1[3], d2[3]; - - DIFF3(dodec[a], dodec[b], d1); - DIFF3(dodec[b], dodec[c], d2); - crossprod(d1, d2, n0); - normalize(n0); - - glBegin(shadeType); - glNormal3fv(n0); - glVertex3fv(&dodec[a][0]); - glVertex3fv(&dodec[b][0]); - glVertex3fv(&dodec[c][0]); - glVertex3fv(&dodec[d][0]); - glVertex3fv(&dodec[e][0]); - glEnd(); -} - -static void -dodecahedron(GLenum type) -{ - static int inited = 0; - - if (inited == 0) { - inited = 1; - initDodecahedron(); - } - pentagon(0, 1, 9, 16, 5, type); - pentagon(1, 0, 3, 18, 7, type); - pentagon(1, 7, 11, 10, 9, type); - pentagon(11, 7, 18, 19, 6, type); - pentagon(8, 17, 16, 9, 10, type); - pentagon(2, 14, 15, 6, 19, type); - pentagon(2, 13, 12, 4, 14, type); - pentagon(2, 19, 18, 3, 13, type); - pentagon(3, 0, 5, 12, 13, type); - pentagon(6, 15, 8, 10, 11, type); - pentagon(4, 17, 8, 15, 14, type); - pentagon(4, 12, 5, 16, 17, type); -} - -/* CENTRY */ -void GLUTAPIENTRY glutWireDodecahedron(void) -{ - dodecahedron(GL_LINE_LOOP); -} - -void GLUTAPIENTRY -glutSolidDodecahedron(void) -{ - dodecahedron(GL_TRIANGLE_FAN); -} - -/* ENDCENTRY */ - -static void -recorditem(GLfloat * n1, GLfloat * n2, GLfloat * n3, - GLenum shadeType) -{ - GLfloat q0[3], q1[3]; - - DIFF3(n1, n2, q0); - DIFF3(n2, n3, q1); - crossprod(q0, q1, q1); - normalize(q1); - - glBegin(shadeType); - glNormal3fv(q1); - glVertex3fv(n1); - glVertex3fv(n2); - glVertex3fv(n3); - glEnd(); -} - -static void -subdivide(GLfloat * v0, GLfloat * v1, GLfloat * v2, - GLenum shadeType) -{ - int depth; - GLfloat w0[3], w1[3], w2[3]; - GLfloat l; - int i, j, k, n; - - depth = 1; - for (i = 0; i < depth; i++) { - for (j = 0; i + j < depth; j++) { - k = depth - i - j; - for (n = 0; n < 3; n++) { - w0[n] = (i * v0[n] + j * v1[n] + k * v2[n]) / depth; - w1[n] = ((i + 1) * v0[n] + j * v1[n] + (k - 1) * v2[n]) - / depth; - w2[n] = (i * v0[n] + (j + 1) * v1[n] + (k - 1) * v2[n]) - / depth; - } - l = sqrt(w0[0] * w0[0] + w0[1] * w0[1] + w0[2] * w0[2]); - w0[0] /= l; - w0[1] /= l; - w0[2] /= l; - l = sqrt(w1[0] * w1[0] + w1[1] * w1[1] + w1[2] * w1[2]); - w1[0] /= l; - w1[1] /= l; - w1[2] /= l; - l = sqrt(w2[0] * w2[0] + w2[1] * w2[1] + w2[2] * w2[2]); - w2[0] /= l; - w2[1] /= l; - w2[2] /= l; - recorditem(w1, w0, w2, shadeType); - } - } -} - -static void -drawtriangle(int i, GLfloat data[][3], int ndx[][3], - GLenum shadeType) -{ - GLfloat *x0, *x1, *x2; - - x0 = data[ndx[i][0]]; - x1 = data[ndx[i][1]]; - x2 = data[ndx[i][2]]; - subdivide(x0, x1, x2, shadeType); -} - -/* octahedron data: The octahedron produced is centered at the - origin and has radius 1.0 */ -static GLfloat odata[6][3] = -{ - {1.0, 0.0, 0.0}, - {-1.0, 0.0, 0.0}, - {0.0, 1.0, 0.0}, - {0.0, -1.0, 0.0}, - {0.0, 0.0, 1.0}, - {0.0, 0.0, -1.0} -}; - -static int ondex[8][3] = -{ - {0, 4, 2}, - {1, 2, 4}, - {0, 3, 4}, - {1, 4, 3}, - {0, 2, 5}, - {1, 5, 2}, - {0, 5, 3}, - {1, 3, 5} -}; - -static void -octahedron(GLenum shadeType) -{ - int i; - - for (i = 7; i >= 0; i--) { - drawtriangle(i, odata, ondex, shadeType); - } -} - -/* CENTRY */ -void GLUTAPIENTRY -glutWireOctahedron(void) -{ - octahedron(GL_LINE_LOOP); -} - -void GLUTAPIENTRY -glutSolidOctahedron(void) -{ - octahedron(GL_TRIANGLES); -} - -/* ENDCENTRY */ - -/* icosahedron data: These numbers are rigged to make an - icosahedron of radius 1.0 */ - -#define X .525731112119133606 -#define Z .850650808352039932 - -static GLfloat idata[12][3] = -{ - {-X, 0, Z}, - {X, 0, Z}, - {-X, 0, -Z}, - {X, 0, -Z}, - {0, Z, X}, - {0, Z, -X}, - {0, -Z, X}, - {0, -Z, -X}, - {Z, X, 0}, - {-Z, X, 0}, - {Z, -X, 0}, - {-Z, -X, 0} -}; - -static int index[20][3] = -{ - {0, 4, 1}, - {0, 9, 4}, - {9, 5, 4}, - {4, 5, 8}, - {4, 8, 1}, - {8, 10, 1}, - {8, 3, 10}, - {5, 3, 8}, - {5, 2, 3}, - {2, 7, 3}, - {7, 10, 3}, - {7, 6, 10}, - {7, 11, 6}, - {11, 0, 6}, - {0, 1, 6}, - {6, 1, 10}, - {9, 0, 11}, - {9, 11, 2}, - {9, 2, 5}, - {7, 2, 11}, -}; - -static void -icosahedron(GLenum shadeType) -{ - int i; - - for (i = 19; i >= 0; i--) { - drawtriangle(i, idata, index, shadeType); - } -} - -/* CENTRY */ -void GLUTAPIENTRY -glutWireIcosahedron(void) -{ - icosahedron(GL_LINE_LOOP); -} - -void GLUTAPIENTRY -glutSolidIcosahedron(void) -{ - icosahedron(GL_TRIANGLES); -} - -/* ENDCENTRY */ - -/* tetrahedron data: */ - -#define T 1.73205080756887729 - -static GLfloat tdata[4][3] = -{ - {T, T, T}, - {T, -T, -T}, - {-T, T, -T}, - {-T, -T, T} -}; - -static int tndex[4][3] = -{ - {0, 1, 3}, - {2, 1, 0}, - {3, 2, 0}, - {1, 2, 3} -}; - -static void -tetrahedron(GLenum shadeType) -{ - int i; - - for (i = 3; i >= 0; i--) - drawtriangle(i, tdata, tndex, shadeType); -} - -/* CENTRY */ -void GLUTAPIENTRY -glutWireTetrahedron(void) -{ - tetrahedron(GL_LINE_LOOP); -} - -void GLUTAPIENTRY -glutSolidTetrahedron(void) -{ - tetrahedron(GL_TRIANGLES); -} - -/* ENDCENTRY */ diff --git a/src/glut/os2/glut_stroke.cpp b/src/glut/os2/glut_stroke.cpp deleted file mode 100644 index ac231e4973..0000000000 --- a/src/glut/os2/glut_stroke.cpp +++ /dev/null @@ -1,42 +0,0 @@ - -/* Copyright (c) Mark J. Kilgard, 1994. */ - -/* This program is freely distributable without licensing fees - and is provided without guarantee or warrantee expressed or - implied. This program is -not- in the public domain. */ - -#include "glutint.h" -#include "glutstroke.h" - -void GLUTAPIENTRY -glutStrokeCharacter(GLUTstrokeFont font, int c) -{ - const StrokeCharRec *ch; - const StrokeRec *stroke; - const CoordRec *coord; - StrokeFontPtr fontinfo; - int i, j; - - -#if defined(_WIN32) - fontinfo = (StrokeFontPtr) __glutFont(font); -#else - fontinfo = (StrokeFontPtr) font; -#endif - - if (c < 0 || c >= fontinfo->num_chars) - return; - ch = &(fontinfo->ch[c]); - if (ch) { - for (i = ch->num_strokes, stroke = ch->stroke; - i > 0; i--, stroke++) { - glBegin(GL_LINE_STRIP); - for (j = stroke->num_coords, coord = stroke->coord; - j > 0; j--, coord++) { - glVertex2f(coord->x, coord->y); - } - glEnd(); - } - glTranslatef(ch->right, 0.0, 0.0); - } -} diff --git a/src/glut/os2/glut_swap.cpp b/src/glut/os2/glut_swap.cpp deleted file mode 100644 index 4831b8eb35..0000000000 --- a/src/glut/os2/glut_swap.cpp +++ /dev/null @@ -1,67 +0,0 @@ - -/* Copyright (c) Mark J. Kilgard, 1994, 1997. */ - -/* This program is freely distributable without licensing fees - and is provided without guarantee or warrantee expressed or - implied. This program is -not- in the public domain. */ - -#include -#include "glutint.h" - -GLint __glutFPS = 0; -GLint __glutSwapCount = 0; -GLint __glutSwapTime = 0; - -/* CENTRY */ -void GLUTAPIENTRY -glutSwapBuffers(void) -{ - GLUTwindow *window = __glutCurrentWindow; - - if (window->renderWin == window->win) { - if (__glutCurrentWindow->treatAsSingle) { - /* Pretend the double buffered window is single buffered, - so treat glutSwapBuffers as a no-op. */ - return; - } - } else { - if (__glutCurrentWindow->overlay->treatAsSingle) { - /* Pretend the double buffered overlay is single - buffered, so treat glutSwapBuffers as a no-op. */ - return; - } - } - - /* For the MESA_SWAP_HACK. */ - window->usedSwapBuffers = 1; - - SWAP_BUFFERS_LAYER(__glutCurrentWindow); - - /* I considered putting the window being swapped on the - GLUT_FINISH_WORK work list because you could call - glutSwapBuffers from an idle callback which doesn't call - __glutSetWindow which normally adds indirect rendering - windows to the GLUT_FINISH_WORK work list. Not being put - on the list could lead to the buffering up of multiple - redisplays and buffer swaps and hamper interactivity. I - consider this an application bug due to not using - glutPostRedisplay to trigger redraws. If - glutPostRedisplay were used, __glutSetWindow would be - called and a glFinish to throttle buffering would occur. */ - - if (__glutFPS) { - GLint t = glutGet(GLUT_ELAPSED_TIME); - __glutSwapCount++; - if (__glutSwapTime == 0) - __glutSwapTime = t; - else if (t - __glutSwapTime > __glutFPS) { - float time = 0.001 * (t - __glutSwapTime); - float fps = (float) __glutSwapCount / time; - fprintf(stderr, "GLUT: %d frames in %.2f seconds = %.2f FPS\n", - __glutSwapCount, time, fps); - __glutSwapTime = t; - __glutSwapCount = 0; - } - } -} -/* ENDCENTRY */ diff --git a/src/glut/os2/glut_teapot.cpp b/src/glut/os2/glut_teapot.cpp deleted file mode 100644 index 31bbbbd6df..0000000000 --- a/src/glut/os2/glut_teapot.cpp +++ /dev/null @@ -1,210 +0,0 @@ - -/* Copyright (c) Mark J. Kilgard, 1994. */ - -/** -(c) Copyright 1993, Silicon Graphics, Inc. - -ALL RIGHTS RESERVED - -Permission to use, copy, modify, and distribute this software -for any purpose and without fee is hereby granted, provided -that the above copyright notice appear in all copies and that -both the copyright notice and this permission notice appear in -supporting documentation, and that the name of Silicon -Graphics, Inc. not be used in advertising or publicity -pertaining to distribution of the software without specific, -written prior permission. - -THE MATERIAL EMBODIED ON THIS SOFTWARE IS PROVIDED TO YOU -"AS-IS" AND WITHOUT WARRANTY OF ANY KIND, EXPRESS, IMPLIED OR -OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF -MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. IN NO -EVENT SHALL SILICON GRAPHICS, INC. BE LIABLE TO YOU OR ANYONE -ELSE FOR ANY DIRECT, SPECIAL, INCIDENTAL, INDIRECT OR -CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER, -INCLUDING WITHOUT LIMITATION, LOSS OF PROFIT, LOSS OF USE, -SAVINGS OR REVENUE, OR THE CLAIMS OF THIRD PARTIES, WHETHER OR -NOT SILICON GRAPHICS, INC. HAS BEEN ADVISED OF THE POSSIBILITY -OF SUCH LOSS, HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -ARISING OUT OF OR IN CONNECTION WITH THE POSSESSION, USE OR -PERFORMANCE OF THIS SOFTWARE. - -US Government Users Restricted Rights - -Use, duplication, or disclosure by the Government is subject to -restrictions set forth in FAR 52.227.19(c)(2) or subparagraph -(c)(1)(ii) of the Rights in Technical Data and Computer -Software clause at DFARS 252.227-7013 and/or in similar or -successor clauses in the FAR or the DOD or NASA FAR -Supplement. Unpublished-- rights reserved under the copyright -laws of the United States. Contractor/manufacturer is Silicon -Graphics, Inc., 2011 N. Shoreline Blvd., Mountain View, CA -94039-7311. - -OpenGL(TM) is a trademark of Silicon Graphics, Inc. -*/ - -#include "glutint.h" - -/* Rim, body, lid, and bottom data must be reflected in x and - y; handle and spout data across the y axis only. */ - -static int patchdata[][16] = -{ - /* rim */ - {102, 103, 104, 105, 4, 5, 6, 7, 8, 9, 10, 11, - 12, 13, 14, 15}, - /* body */ - {12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, - 24, 25, 26, 27}, - {24, 25, 26, 27, 29, 30, 31, 32, 33, 34, 35, 36, - 37, 38, 39, 40}, - /* lid */ - {96, 96, 96, 96, 97, 98, 99, 100, 101, 101, 101, - 101, 0, 1, 2, 3,}, - {0, 1, 2, 3, 106, 107, 108, 109, 110, 111, 112, - 113, 114, 115, 116, 117}, - /* bottom */ - {118, 118, 118, 118, 124, 122, 119, 121, 123, 126, - 125, 120, 40, 39, 38, 37}, - /* handle */ - {41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, - 53, 54, 55, 56}, - {53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, - 28, 65, 66, 67}, - /* spout */ - {68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, - 80, 81, 82, 83}, - {80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, - 92, 93, 94, 95} -}; -/* *INDENT-OFF* */ - -static float cpdata[][3] = -{ - {0.2, 0, 2.7}, {0.2, -0.112, 2.7}, {0.112, -0.2, 2.7}, {0, - -0.2, 2.7}, {1.3375, 0, 2.53125}, {1.3375, -0.749, 2.53125}, - {0.749, -1.3375, 2.53125}, {0, -1.3375, 2.53125}, {1.4375, - 0, 2.53125}, {1.4375, -0.805, 2.53125}, {0.805, -1.4375, - 2.53125}, {0, -1.4375, 2.53125}, {1.5, 0, 2.4}, {1.5, -0.84, - 2.4}, {0.84, -1.5, 2.4}, {0, -1.5, 2.4}, {1.75, 0, 1.875}, - {1.75, -0.98, 1.875}, {0.98, -1.75, 1.875}, {0, -1.75, - 1.875}, {2, 0, 1.35}, {2, -1.12, 1.35}, {1.12, -2, 1.35}, - {0, -2, 1.35}, {2, 0, 0.9}, {2, -1.12, 0.9}, {1.12, -2, - 0.9}, {0, -2, 0.9}, {-2, 0, 0.9}, {2, 0, 0.45}, {2, -1.12, - 0.45}, {1.12, -2, 0.45}, {0, -2, 0.45}, {1.5, 0, 0.225}, - {1.5, -0.84, 0.225}, {0.84, -1.5, 0.225}, {0, -1.5, 0.225}, - {1.5, 0, 0.15}, {1.5, -0.84, 0.15}, {0.84, -1.5, 0.15}, {0, - -1.5, 0.15}, {-1.6, 0, 2.025}, {-1.6, -0.3, 2.025}, {-1.5, - -0.3, 2.25}, {-1.5, 0, 2.25}, {-2.3, 0, 2.025}, {-2.3, -0.3, - 2.025}, {-2.5, -0.3, 2.25}, {-2.5, 0, 2.25}, {-2.7, 0, - 2.025}, {-2.7, -0.3, 2.025}, {-3, -0.3, 2.25}, {-3, 0, - 2.25}, {-2.7, 0, 1.8}, {-2.7, -0.3, 1.8}, {-3, -0.3, 1.8}, - {-3, 0, 1.8}, {-2.7, 0, 1.575}, {-2.7, -0.3, 1.575}, {-3, - -0.3, 1.35}, {-3, 0, 1.35}, {-2.5, 0, 1.125}, {-2.5, -0.3, - 1.125}, {-2.65, -0.3, 0.9375}, {-2.65, 0, 0.9375}, {-2, - -0.3, 0.9}, {-1.9, -0.3, 0.6}, {-1.9, 0, 0.6}, {1.7, 0, - 1.425}, {1.7, -0.66, 1.425}, {1.7, -0.66, 0.6}, {1.7, 0, - 0.6}, {2.6, 0, 1.425}, {2.6, -0.66, 1.425}, {3.1, -0.66, - 0.825}, {3.1, 0, 0.825}, {2.3, 0, 2.1}, {2.3, -0.25, 2.1}, - {2.4, -0.25, 2.025}, {2.4, 0, 2.025}, {2.7, 0, 2.4}, {2.7, - -0.25, 2.4}, {3.3, -0.25, 2.4}, {3.3, 0, 2.4}, {2.8, 0, - 2.475}, {2.8, -0.25, 2.475}, {3.525, -0.25, 2.49375}, - {3.525, 0, 2.49375}, {2.9, 0, 2.475}, {2.9, -0.15, 2.475}, - {3.45, -0.15, 2.5125}, {3.45, 0, 2.5125}, {2.8, 0, 2.4}, - {2.8, -0.15, 2.4}, {3.2, -0.15, 2.4}, {3.2, 0, 2.4}, {0, 0, - 3.15}, {0.8, 0, 3.15}, {0.8, -0.45, 3.15}, {0.45, -0.8, - 3.15}, {0, -0.8, 3.15}, {0, 0, 2.85}, {1.4, 0, 2.4}, {1.4, - -0.784, 2.4}, {0.784, -1.4, 2.4}, {0, -1.4, 2.4}, {0.4, 0, - 2.55}, {0.4, -0.224, 2.55}, {0.224, -0.4, 2.55}, {0, -0.4, - 2.55}, {1.3, 0, 2.55}, {1.3, -0.728, 2.55}, {0.728, -1.3, - 2.55}, {0, -1.3, 2.55}, {1.3, 0, 2.4}, {1.3, -0.728, 2.4}, - {0.728, -1.3, 2.4}, {0, -1.3, 2.4}, {0, 0, 0}, {1.425, - -0.798, 0}, {1.5, 0, 0.075}, {1.425, 0, 0}, {0.798, -1.425, - 0}, {0, -1.5, 0.075}, {0, -1.425, 0}, {1.5, -0.84, 0.075}, - {0.84, -1.5, 0.075} -}; - -static float tex[2][2][2] = -{ - { {0, 0}, - {1, 0}}, - { {0, 1}, - {1, 1}} -}; - -/* *INDENT-ON* */ - -static void -teapot(GLint grid, GLdouble scale, GLenum type) -{ - float p[4][4][3], q[4][4][3], r[4][4][3], s[4][4][3]; - long i, j, k, l; - - glPushAttrib(GL_ENABLE_BIT | GL_EVAL_BIT); - glEnable(GL_AUTO_NORMAL); - glEnable(GL_NORMALIZE); - glEnable(GL_MAP2_VERTEX_3); - glEnable(GL_MAP2_TEXTURE_COORD_2); - glPushMatrix(); - glRotatef(270.0, 1.0, 0.0, 0.0); - glScalef(0.5 * scale, 0.5 * scale, 0.5 * scale); - glTranslatef(0.0, 0.0, -1.5); - for (i = 0; i < 10; i++) { - for (j = 0; j < 4; j++) { - for (k = 0; k < 4; k++) { - for (l = 0; l < 3; l++) { - p[j][k][l] = cpdata[patchdata[i][j * 4 + k]][l]; - q[j][k][l] = cpdata[patchdata[i][j * 4 + (3 - k)]][l]; - if (l == 1) - q[j][k][l] *= -1.0; - if (i < 6) { - r[j][k][l] = - cpdata[patchdata[i][j * 4 + (3 - k)]][l]; - if (l == 0) - r[j][k][l] *= -1.0; - s[j][k][l] = cpdata[patchdata[i][j * 4 + k]][l]; - if (l == 0) - s[j][k][l] *= -1.0; - if (l == 1) - s[j][k][l] *= -1.0; - } - } - } - } - glMap2f(GL_MAP2_TEXTURE_COORD_2, 0, 1, 2, 2, 0, 1, 4, 2, - &tex[0][0][0]); - glMap2f(GL_MAP2_VERTEX_3, 0, 1, 3, 4, 0, 1, 12, 4, - &p[0][0][0]); - glMapGrid2f(grid, 0.0, 1.0, grid, 0.0, 1.0); - glEvalMesh2(type, 0, grid, 0, grid); - glMap2f(GL_MAP2_VERTEX_3, 0, 1, 3, 4, 0, 1, 12, 4, - &q[0][0][0]); - glEvalMesh2(type, 0, grid, 0, grid); - if (i < 6) { - glMap2f(GL_MAP2_VERTEX_3, 0, 1, 3, 4, 0, 1, 12, 4, - &r[0][0][0]); - glEvalMesh2(type, 0, grid, 0, grid); - glMap2f(GL_MAP2_VERTEX_3, 0, 1, 3, 4, 0, 1, 12, 4, - &s[0][0][0]); - glEvalMesh2(type, 0, grid, 0, grid); - } - } - glPopMatrix(); - glPopAttrib(); -} - -/* CENTRY */ -void GLUTAPIENTRY -glutSolidTeapot(GLdouble scale) -{ - teapot(7, scale, GL_FILL); -} - -void GLUTAPIENTRY -glutWireTeapot(GLdouble scale) -{ - teapot(10, scale, GL_LINE); -} - -/* ENDCENTRY */ diff --git a/src/glut/os2/glut_tr24.cpp b/src/glut/os2/glut_tr24.cpp deleted file mode 100644 index a3cbf4b62b..0000000000 --- a/src/glut/os2/glut_tr24.cpp +++ /dev/null @@ -1,2063 +0,0 @@ - -/* GENERATED FILE -- DO NOT MODIFY */ - -#define glutBitmapTimesRoman24 XXX -#include "glutbitmap.h" -#undef glutBitmapTimesRoman24 - -/* char: 0xff */ - -static const GLubyte ch255data[] = { -0xe0,0x0,0xf0,0x0,0x18,0x0,0x8,0x0,0xc,0x0,0x4,0x0,0xe,0x0,0xe,0x0, -0x1a,0x0,0x19,0x0,0x19,0x0,0x31,0x0,0x30,0x80,0x30,0x80,0x60,0x80,0x60,0xc0, -0xf1,0xe0,0x0,0x0,0x0,0x0,0x33,0x0,0x33,0x0, -}; - -static const BitmapCharRec ch255 = {11,21,0,5,11,ch255data}; - -/* char: 0xfe */ - -static const GLubyte ch254data[] = { -0xf0,0x0,0x60,0x0,0x60,0x0,0x60,0x0,0x60,0x0,0x6e,0x0,0x73,0x80,0x61,0x80, -0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x61,0x80,0x73,0x80, -0x6e,0x0,0x60,0x0,0x60,0x0,0x60,0x0,0x60,0x0,0xe0,0x0, -}; - -static const BitmapCharRec ch254 = {10,22,-1,5,12,ch254data}; - -/* char: 0xfd */ - -static const GLubyte ch253data[] = { -0xe0,0x0,0xf0,0x0,0x18,0x0,0x8,0x0,0xc,0x0,0x4,0x0,0xe,0x0,0xe,0x0, -0x1a,0x0,0x19,0x0,0x19,0x0,0x31,0x0,0x30,0x80,0x30,0x80,0x60,0x80,0x60,0xc0, -0xf1,0xe0,0x0,0x0,0x8,0x0,0x6,0x0,0x3,0x80,0x1,0x80, -}; - -static const BitmapCharRec ch253 = {11,22,0,5,11,ch253data}; - -/* char: 0xfc */ - -static const GLubyte ch252data[] = { -0x1c,0xe0,0x3e,0xc0,0x71,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0, -0x60,0xc0,0x60,0xc0,0x60,0xc0,0xe1,0xc0,0x0,0x0,0x0,0x0,0x33,0x0,0x33,0x0, -}; - -static const BitmapCharRec ch252 = {11,16,-1,0,13,ch252data}; - -/* char: 0xfb */ - -static const GLubyte ch251data[] = { -0x1c,0xe0,0x3e,0xc0,0x71,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0, -0x60,0xc0,0x60,0xc0,0x60,0xc0,0xe1,0xc0,0x0,0x0,0x21,0x0,0x12,0x0,0x1e,0x0, -0xc,0x0, -}; - -static const BitmapCharRec ch251 = {11,17,-1,0,13,ch251data}; - -/* char: 0xfa */ - -static const GLubyte ch250data[] = { -0x1c,0xe0,0x3e,0xc0,0x71,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0, -0x60,0xc0,0x60,0xc0,0x60,0xc0,0xe1,0xc0,0x0,0x0,0x8,0x0,0x6,0x0,0x3,0x80, -0x1,0x80, -}; - -static const BitmapCharRec ch250 = {11,17,-1,0,13,ch250data}; - -/* char: 0xf9 */ - -static const GLubyte ch249data[] = { -0x1c,0xe0,0x3e,0xc0,0x71,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0, -0x60,0xc0,0x60,0xc0,0x60,0xc0,0xe1,0xc0,0x0,0x0,0x2,0x0,0xc,0x0,0x38,0x0, -0x30,0x0, -}; - -static const BitmapCharRec ch249 = {11,17,-1,0,13,ch249data}; - -/* char: 0xf8 */ - -static const GLubyte ch248data[] = { -0xc0,0x0,0xde,0x0,0x73,0x80,0x71,0x80,0xd0,0xc0,0xd8,0xc0,0xc8,0xc0,0xcc,0xc0, -0xc4,0xc0,0xc6,0xc0,0x63,0x80,0x73,0x80,0x1e,0xc0,0x0,0xc0, -}; - -static const BitmapCharRec ch248 = {10,14,-1,1,12,ch248data}; - -/* char: 0xf7 */ - -static const GLubyte ch247data[] = { -0x6,0x0,0x6,0x0,0x0,0x0,0x0,0x0,0xff,0xf0,0xff,0xf0,0x0,0x0,0x0,0x0, -0x6,0x0,0x6,0x0, -}; - -static const BitmapCharRec ch247 = {12,10,-1,-2,14,ch247data}; - -/* char: 0xf6 */ - -static const GLubyte ch246data[] = { -0x1e,0x0,0x73,0x80,0x61,0x80,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0, -0xc0,0xc0,0x61,0x80,0x73,0x80,0x1e,0x0,0x0,0x0,0x0,0x0,0x33,0x0,0x33,0x0, -}; - -static const BitmapCharRec ch246 = {10,16,-1,0,12,ch246data}; - -/* char: 0xf5 */ - -static const GLubyte ch245data[] = { -0x1e,0x0,0x73,0x80,0x61,0x80,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0, -0xc0,0xc0,0x61,0x80,0x73,0x80,0x1e,0x0,0x0,0x0,0x0,0x0,0x27,0x0,0x1c,0x80, -}; - -static const BitmapCharRec ch245 = {10,16,-1,0,12,ch245data}; - -/* char: 0xf4 */ - -static const GLubyte ch244data[] = { -0x1e,0x0,0x73,0x80,0x61,0x80,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0, -0xc0,0xc0,0x61,0x80,0x73,0x80,0x1e,0x0,0x0,0x0,0x21,0x0,0x12,0x0,0x1e,0x0, -0xc,0x0, -}; - -static const BitmapCharRec ch244 = {10,17,-1,0,12,ch244data}; - -/* char: 0xf3 */ - -static const GLubyte ch243data[] = { -0x1e,0x0,0x73,0x80,0x61,0x80,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0, -0xc0,0xc0,0x61,0x80,0x73,0x80,0x1e,0x0,0x0,0x0,0x8,0x0,0x6,0x0,0x3,0x80, -0x1,0x80, -}; - -static const BitmapCharRec ch243 = {10,17,-1,0,12,ch243data}; - -/* char: 0xf2 */ - -static const GLubyte ch242data[] = { -0x1e,0x0,0x73,0x80,0x61,0x80,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0, -0xc0,0xc0,0x61,0x80,0x73,0x80,0x1e,0x0,0x0,0x0,0x2,0x0,0xc,0x0,0x38,0x0, -0x30,0x0, -}; - -static const BitmapCharRec ch242 = {10,17,-1,0,12,ch242data}; - -/* char: 0xf1 */ - -static const GLubyte ch241data[] = { -0xf1,0xe0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0, -0x60,0xc0,0x71,0xc0,0x6f,0x80,0xe7,0x0,0x0,0x0,0x0,0x0,0x27,0x0,0x1c,0x80, -}; - -static const BitmapCharRec ch241 = {11,16,-1,0,13,ch241data}; - -/* char: 0xf0 */ - -static const GLubyte ch240data[] = { -0x1e,0x0,0x73,0x80,0x61,0x80,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0, -0xc0,0xc0,0x61,0x80,0x73,0x80,0x1f,0x0,0xc6,0x0,0x3c,0x0,0x1e,0x0,0x71,0x80, -0xc0,0x0, -}; - -static const BitmapCharRec ch240 = {10,17,-1,0,12,ch240data}; - -/* char: 0xef */ - -static const GLubyte ch239data[] = { -0x78,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x70,0x0,0x0,0xcc,0xcc, -}; - -static const BitmapCharRec ch239 = {6,16,0,0,6,ch239data}; - -/* char: 0xee */ - -static const GLubyte ch238data[] = { -0x78,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x70,0x0,0x84,0x48,0x78, -0x30, -}; - -static const BitmapCharRec ch238 = {6,17,0,0,6,ch238data}; - -/* char: 0xed */ - -static const GLubyte ch237data[] = { -0xf0,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0xe0,0x0,0x80,0x60,0x38, -0x18, -}; - -static const BitmapCharRec ch237 = {5,17,-1,0,6,ch237data}; - -/* char: 0xec */ - -static const GLubyte ch236data[] = { -0x78,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x70,0x0,0x8,0x30,0xe0, -0xc0, -}; - -static const BitmapCharRec ch236 = {5,17,0,0,6,ch236data}; - -/* char: 0xeb */ - -static const GLubyte ch235data[] = { -0x1e,0x0,0x7f,0x0,0x70,0x80,0xe0,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x0,0xff,0x80, -0xc1,0x80,0x41,0x80,0x63,0x0,0x1e,0x0,0x0,0x0,0x0,0x0,0x33,0x0,0x33,0x0, -}; - -static const BitmapCharRec ch235 = {9,16,-1,0,11,ch235data}; - -/* char: 0xea */ - -static const GLubyte ch234data[] = { -0x1e,0x0,0x7f,0x0,0x70,0x80,0xe0,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x0,0xff,0x80, -0xc1,0x80,0x41,0x80,0x63,0x0,0x1e,0x0,0x0,0x0,0x21,0x0,0x12,0x0,0x1e,0x0, -0xc,0x0, -}; - -static const BitmapCharRec ch234 = {9,17,-1,0,11,ch234data}; - -/* char: 0xe9 */ - -static const GLubyte ch233data[] = { -0x1e,0x0,0x7f,0x0,0x70,0x80,0xe0,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x0,0xff,0x80, -0xc1,0x80,0x41,0x80,0x63,0x0,0x1e,0x0,0x0,0x0,0x10,0x0,0xc,0x0,0x7,0x0, -0x3,0x0, -}; - -static const BitmapCharRec ch233 = {9,17,-1,0,11,ch233data}; - -/* char: 0xe8 */ - -static const GLubyte ch232data[] = { -0x1e,0x0,0x7f,0x0,0x70,0x80,0xe0,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x0,0xff,0x80, -0xc1,0x80,0x41,0x80,0x63,0x0,0x1e,0x0,0x0,0x0,0x4,0x0,0x18,0x0,0x70,0x0, -0x60,0x0, -}; - -static const BitmapCharRec ch232 = {9,17,-1,0,11,ch232data}; - -/* char: 0xe7 */ - -static const GLubyte ch231data[] = { -0x3c,0x0,0x66,0x0,0x6,0x0,0x1e,0x0,0x18,0x0,0x8,0x0,0x1e,0x0,0x7f,0x0, -0x70,0x80,0xe0,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x0,0x41,0x80, -0x63,0x80,0x1f,0x0, -}; - -static const BitmapCharRec ch231 = {9,18,-1,6,11,ch231data}; - -/* char: 0xe6 */ - -static const GLubyte ch230data[] = { -0x70,0xf0,0xfb,0xf8,0xc7,0x84,0xc3,0x0,0xc3,0x0,0x63,0x0,0x3b,0x0,0xf,0xfc, -0x3,0xc,0x63,0xc,0x67,0x98,0x3c,0xf0, -}; - -static const BitmapCharRec ch230 = {14,12,-1,0,16,ch230data}; - -/* char: 0xe5 */ - -static const GLubyte ch229data[] = { -0x71,0x80,0xfb,0x0,0xc7,0x0,0xc3,0x0,0xc3,0x0,0x63,0x0,0x3b,0x0,0xf,0x0, -0x3,0x0,0x63,0x0,0x67,0x0,0x3e,0x0,0x0,0x0,0x1c,0x0,0x22,0x0,0x22,0x0, -0x1c,0x0, -}; - -static const BitmapCharRec ch229 = {9,17,-1,0,11,ch229data}; - -/* char: 0xe4 */ - -static const GLubyte ch228data[] = { -0x71,0x80,0xfb,0x0,0xc7,0x0,0xc3,0x0,0xc3,0x0,0x63,0x0,0x3b,0x0,0xf,0x0, -0x3,0x0,0x63,0x0,0x67,0x0,0x3e,0x0,0x0,0x0,0x0,0x0,0x66,0x0,0x66,0x0, -}; - -static const BitmapCharRec ch228 = {9,16,-1,0,11,ch228data}; - -/* char: 0xe3 */ - -static const GLubyte ch227data[] = { -0x71,0x80,0xfb,0x0,0xc7,0x0,0xc3,0x0,0xc3,0x0,0x63,0x0,0x3b,0x0,0xf,0x0, -0x3,0x0,0x63,0x0,0x67,0x0,0x3e,0x0,0x0,0x0,0x0,0x0,0x5c,0x0,0x3a,0x0, -}; - -static const BitmapCharRec ch227 = {9,16,-1,0,11,ch227data}; - -/* char: 0xe2 */ - -static const GLubyte ch226data[] = { -0x71,0x80,0xfb,0x0,0xc7,0x0,0xc3,0x0,0xc3,0x0,0x63,0x0,0x3b,0x0,0xf,0x0, -0x3,0x0,0x63,0x0,0x67,0x0,0x3e,0x0,0x0,0x0,0x42,0x0,0x24,0x0,0x3c,0x0, -0x18,0x0, -}; - -static const BitmapCharRec ch226 = {9,17,-1,0,11,ch226data}; - -/* char: 0xe1 */ - -static const GLubyte ch225data[] = { -0x71,0x80,0xfb,0x0,0xc7,0x0,0xc3,0x0,0xc3,0x0,0x63,0x0,0x3b,0x0,0xf,0x0, -0x3,0x0,0x63,0x0,0x67,0x0,0x3e,0x0,0x0,0x0,0x10,0x0,0xc,0x0,0x7,0x0, -0x3,0x0, -}; - -static const BitmapCharRec ch225 = {9,17,-1,0,11,ch225data}; - -/* char: 0xe0 */ - -static const GLubyte ch224data[] = { -0x71,0x80,0xfb,0x0,0xc7,0x0,0xc3,0x0,0xc3,0x0,0x63,0x0,0x3b,0x0,0xf,0x0, -0x3,0x0,0x63,0x0,0x67,0x0,0x3e,0x0,0x0,0x0,0x4,0x0,0x18,0x0,0x70,0x0, -0x60,0x0, -}; - -static const BitmapCharRec ch224 = {9,17,-1,0,11,ch224data}; - -/* char: 0xdf */ - -static const GLubyte ch223data[] = { -0xe7,0x0,0x6c,0x80,0x6c,0xc0,0x60,0xc0,0x60,0xc0,0x61,0xc0,0x61,0x80,0x63,0x80, -0x67,0x0,0x6c,0x0,0x63,0x0,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x33,0x0, -0x1e,0x0, -}; - -static const BitmapCharRec ch223 = {10,17,-1,0,12,ch223data}; - -/* char: 0xde */ - -static const GLubyte ch222data[] = { -0xfc,0x0,0x30,0x0,0x30,0x0,0x30,0x0,0x3f,0xc0,0x30,0x70,0x30,0x30,0x30,0x18, -0x30,0x18,0x30,0x18,0x30,0x30,0x30,0x70,0x3f,0xc0,0x30,0x0,0x30,0x0,0x30,0x0, -0xfc,0x0, -}; - -static const BitmapCharRec ch222 = {13,17,-1,0,15,ch222data}; - -/* char: 0xdd */ - -static const GLubyte ch221data[] = { -0x7,0xe0,0x1,0x80,0x1,0x80,0x1,0x80,0x1,0x80,0x1,0x80,0x1,0x80,0x3,0xc0, -0x3,0x40,0x6,0x60,0x6,0x20,0xc,0x30,0x1c,0x10,0x18,0x18,0x38,0x8,0x30,0xc, -0xfc,0x3f,0x0,0x0,0x1,0x0,0x0,0xc0,0x0,0x70,0x0,0x30, -}; - -static const BitmapCharRec ch221 = {16,22,0,0,16,ch221data}; - -/* char: 0xdc */ - -static const GLubyte ch220data[] = { -0x7,0xe0,0x1c,0x30,0x18,0x8,0x30,0x8,0x30,0x4,0x30,0x4,0x30,0x4,0x30,0x4, -0x30,0x4,0x30,0x4,0x30,0x4,0x30,0x4,0x30,0x4,0x30,0x4,0x30,0x4,0x30,0x4, -0xfc,0x1f,0x0,0x0,0x0,0x0,0x6,0x30,0x6,0x30, -}; - -static const BitmapCharRec ch220 = {16,21,-1,0,18,ch220data}; - -/* char: 0xdb */ - -static const GLubyte ch219data[] = { -0x7,0xe0,0x1c,0x30,0x18,0x8,0x30,0x8,0x30,0x4,0x30,0x4,0x30,0x4,0x30,0x4, -0x30,0x4,0x30,0x4,0x30,0x4,0x30,0x4,0x30,0x4,0x30,0x4,0x30,0x4,0x30,0x4, -0xfc,0x1f,0x0,0x0,0x8,0x10,0x6,0x60,0x3,0xc0,0x1,0x80, -}; - -static const BitmapCharRec ch219 = {16,22,-1,0,18,ch219data}; - -/* char: 0xda */ - -static const GLubyte ch218data[] = { -0x7,0xe0,0x1c,0x30,0x18,0x8,0x30,0x8,0x30,0x4,0x30,0x4,0x30,0x4,0x30,0x4, -0x30,0x4,0x30,0x4,0x30,0x4,0x30,0x4,0x30,0x4,0x30,0x4,0x30,0x4,0x30,0x4, -0xfc,0x1f,0x0,0x0,0x1,0x0,0x0,0xc0,0x0,0x70,0x0,0x30, -}; - -static const BitmapCharRec ch218 = {16,22,-1,0,18,ch218data}; - -/* char: 0xd9 */ - -static const GLubyte ch217data[] = { -0x7,0xe0,0x1c,0x30,0x18,0x8,0x30,0x8,0x30,0x4,0x30,0x4,0x30,0x4,0x30,0x4, -0x30,0x4,0x30,0x4,0x30,0x4,0x30,0x4,0x30,0x4,0x30,0x4,0x30,0x4,0x30,0x4, -0xfc,0x1f,0x0,0x0,0x0,0x40,0x1,0x80,0x7,0x0,0x6,0x0, -}; - -static const BitmapCharRec ch217 = {16,22,-1,0,18,ch217data}; - -/* char: 0xd8 */ - -static const GLubyte ch216data[] = { -0x20,0x0,0x27,0xe0,0x1c,0x38,0x38,0x1c,0x68,0x6,0x64,0x6,0xc2,0x3,0xc2,0x3, -0xc1,0x3,0xc1,0x3,0xc0,0x83,0xc0,0x83,0xc0,0x43,0x60,0x46,0x60,0x26,0x38,0x1c, -0x1c,0x38,0x7,0xe4,0x0,0x4, -}; - -static const BitmapCharRec ch216 = {16,19,-1,1,18,ch216data}; - -/* char: 0xd7 */ - -static const GLubyte ch215data[] = { -0x80,0x40,0xc0,0xc0,0x61,0x80,0x33,0x0,0x1e,0x0,0xc,0x0,0x1e,0x0,0x33,0x0, -0x61,0x80,0xc0,0xc0,0x80,0x40, -}; - -static const BitmapCharRec ch215 = {10,11,-2,-1,14,ch215data}; - -/* char: 0xd6 */ - -static const GLubyte ch214data[] = { -0x7,0xe0,0x1c,0x38,0x38,0x1c,0x60,0x6,0x60,0x6,0xc0,0x3,0xc0,0x3,0xc0,0x3, -0xc0,0x3,0xc0,0x3,0xc0,0x3,0xc0,0x3,0x60,0x6,0x60,0x6,0x38,0x1c,0x1c,0x38, -0x7,0xe0,0x0,0x0,0x0,0x0,0x6,0x60,0x6,0x60, -}; - -static const BitmapCharRec ch214 = {16,21,-1,0,18,ch214data}; - -/* char: 0xd5 */ - -static const GLubyte ch213data[] = { -0x7,0xe0,0x1c,0x38,0x38,0x1c,0x60,0x6,0x60,0x6,0xc0,0x3,0xc0,0x3,0xc0,0x3, -0xc0,0x3,0xc0,0x3,0xc0,0x3,0xc0,0x3,0x60,0x6,0x60,0x6,0x38,0x1c,0x1c,0x38, -0x7,0xe0,0x0,0x0,0x0,0x0,0x4,0xe0,0x3,0x90, -}; - -static const BitmapCharRec ch213 = {16,21,-1,0,18,ch213data}; - -/* char: 0xd4 */ - -static const GLubyte ch212data[] = { -0x7,0xe0,0x1c,0x38,0x38,0x1c,0x60,0x6,0x60,0x6,0xc0,0x3,0xc0,0x3,0xc0,0x3, -0xc0,0x3,0xc0,0x3,0xc0,0x3,0xc0,0x3,0x60,0x6,0x60,0x6,0x38,0x1c,0x1c,0x38, -0x7,0xe0,0x0,0x0,0x8,0x10,0x6,0x60,0x3,0xc0,0x1,0x80, -}; - -static const BitmapCharRec ch212 = {16,22,-1,0,18,ch212data}; - -/* char: 0xd3 */ - -static const GLubyte ch211data[] = { -0x7,0xe0,0x1c,0x38,0x38,0x1c,0x60,0x6,0x60,0x6,0xc0,0x3,0xc0,0x3,0xc0,0x3, -0xc0,0x3,0xc0,0x3,0xc0,0x3,0xc0,0x3,0x60,0x6,0x60,0x6,0x38,0x1c,0x1c,0x38, -0x7,0xe0,0x0,0x0,0x1,0x0,0x0,0xc0,0x0,0x70,0x0,0x30, -}; - -static const BitmapCharRec ch211 = {16,22,-1,0,18,ch211data}; - -/* char: 0xd2 */ - -static const GLubyte ch210data[] = { -0x7,0xe0,0x1c,0x38,0x38,0x1c,0x60,0x6,0x60,0x6,0xc0,0x3,0xc0,0x3,0xc0,0x3, -0xc0,0x3,0xc0,0x3,0xc0,0x3,0xc0,0x3,0x60,0x6,0x60,0x6,0x38,0x1c,0x1c,0x38, -0x7,0xe0,0x0,0x0,0x0,0x40,0x1,0x80,0x7,0x0,0x6,0x0, -}; - -static const BitmapCharRec ch210 = {16,22,-1,0,18,ch210data}; - -/* char: 0xd1 */ - -static const GLubyte ch209data[] = { -0xf8,0xc,0x20,0x1c,0x20,0x1c,0x20,0x34,0x20,0x64,0x20,0x64,0x20,0xc4,0x21,0x84, -0x21,0x84,0x23,0x4,0x26,0x4,0x26,0x4,0x2c,0x4,0x38,0x4,0x38,0x4,0x30,0x4, -0xf0,0x1f,0x0,0x0,0x0,0x0,0x4,0xe0,0x3,0x90, -}; - -static const BitmapCharRec ch209 = {16,21,-1,0,18,ch209data}; - -/* char: 0xd0 */ - -static const GLubyte ch208data[] = { -0x7f,0xe0,0x18,0x38,0x18,0x1c,0x18,0x6,0x18,0x6,0x18,0x3,0x18,0x3,0x18,0x3, -0xff,0x3,0x18,0x3,0x18,0x3,0x18,0x3,0x18,0x6,0x18,0x6,0x18,0x1c,0x18,0x38, -0x7f,0xe0, -}; - -static const BitmapCharRec ch208 = {16,17,0,0,17,ch208data}; - -/* char: 0xcf */ - -static const GLubyte ch207data[] = { -0xfc,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30, -0xfc,0x0,0x0,0xcc,0xcc, -}; - -static const BitmapCharRec ch207 = {6,21,-1,0,8,ch207data}; - -/* char: 0xce */ - -static const GLubyte ch206data[] = { -0x7e,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, -0x7e,0x0,0x81,0x66,0x3c,0x18, -}; - -static const BitmapCharRec ch206 = {8,22,-1,0,8,ch206data}; - -/* char: 0xcd */ - -static const GLubyte ch205data[] = { -0xfc,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30, -0xfc,0x0,0x40,0x30,0x1c,0xc, -}; - -static const BitmapCharRec ch205 = {6,22,-1,0,8,ch205data}; - -/* char: 0xcc */ - -static const GLubyte ch204data[] = { -0xfc,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30, -0xfc,0x0,0x8,0x30,0xe0,0xc0, -}; - -static const BitmapCharRec ch204 = {6,22,-1,0,8,ch204data}; - -/* char: 0xcb */ - -static const GLubyte ch203data[] = { -0xff,0xf8,0x30,0x18,0x30,0x8,0x30,0x8,0x30,0x0,0x30,0x0,0x30,0x40,0x30,0x40, -0x3f,0xc0,0x30,0x40,0x30,0x40,0x30,0x0,0x30,0x0,0x30,0x10,0x30,0x10,0x30,0x30, -0xff,0xf0,0x0,0x0,0x0,0x0,0x19,0x80,0x19,0x80, -}; - -static const BitmapCharRec ch203 = {13,21,-1,0,15,ch203data}; - -/* char: 0xca */ - -static const GLubyte ch202data[] = { -0xff,0xf8,0x30,0x18,0x30,0x8,0x30,0x8,0x30,0x0,0x30,0x0,0x30,0x40,0x30,0x40, -0x3f,0xc0,0x30,0x40,0x30,0x40,0x30,0x0,0x30,0x0,0x30,0x10,0x30,0x10,0x30,0x30, -0xff,0xf0,0x0,0x0,0x10,0x20,0xc,0xc0,0x7,0x80,0x3,0x0, -}; - -static const BitmapCharRec ch202 = {13,22,-1,0,15,ch202data}; - -/* char: 0xc9 */ - -static const GLubyte ch201data[] = { -0xff,0xf8,0x30,0x18,0x30,0x8,0x30,0x8,0x30,0x0,0x30,0x0,0x30,0x40,0x30,0x40, -0x3f,0xc0,0x30,0x40,0x30,0x40,0x30,0x0,0x30,0x0,0x30,0x10,0x30,0x10,0x30,0x30, -0xff,0xf0,0x0,0x0,0x4,0x0,0x3,0x0,0x1,0xc0,0x0,0xc0, -}; - -static const BitmapCharRec ch201 = {13,22,-1,0,15,ch201data}; - -/* char: 0xc8 */ - -static const GLubyte ch200data[] = { -0xff,0xf8,0x30,0x18,0x30,0x8,0x30,0x8,0x30,0x0,0x30,0x0,0x30,0x40,0x30,0x40, -0x3f,0xc0,0x30,0x40,0x30,0x40,0x30,0x0,0x30,0x0,0x30,0x10,0x30,0x10,0x30,0x30, -0xff,0xf0,0x0,0x0,0x1,0x0,0x6,0x0,0x1c,0x0,0x18,0x0, -}; - -static const BitmapCharRec ch200 = {13,22,-1,0,15,ch200data}; - -/* char: 0xc7 */ - -static const GLubyte ch199data[] = { -0x7,0x80,0xc,0xc0,0x0,0xc0,0x3,0xc0,0x3,0x0,0x1,0x0,0x7,0xe0,0x1e,0x38, -0x38,0x8,0x60,0x4,0x60,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x0, -0xc0,0x0,0xc0,0x0,0x60,0x4,0x60,0x4,0x38,0xc,0x1c,0x3c,0x7,0xe4, -}; - -static const BitmapCharRec ch199 = {14,23,-1,6,16,ch199data}; - -/* char: 0xc6 */ - -static const GLubyte ch198data[] = { -0xf9,0xff,0xf0,0x30,0x60,0x30,0x10,0x60,0x10,0x10,0x60,0x10,0x18,0x60,0x0,0x8, -0x60,0x0,0xf,0xe0,0x80,0xc,0x60,0x80,0x4,0x7f,0x80,0x4,0x60,0x80,0x6,0x60, -0x80,0x2,0x60,0x0,0x2,0x60,0x0,0x1,0x60,0x20,0x1,0x60,0x20,0x1,0xe0,0x60, -0x3,0xff,0xe0, -}; - -static const BitmapCharRec ch198 = {20,17,0,0,21,ch198data}; - -/* char: 0xc5 */ - -static const GLubyte ch197data[] = { -0xfc,0x1f,0x80,0x30,0x6,0x0,0x10,0x6,0x0,0x10,0xc,0x0,0x18,0xc,0x0,0x8, -0xc,0x0,0xf,0xf8,0x0,0xc,0x18,0x0,0x4,0x18,0x0,0x4,0x30,0x0,0x6,0x30, -0x0,0x2,0x30,0x0,0x2,0x60,0x0,0x1,0x60,0x0,0x1,0xc0,0x0,0x1,0xc0,0x0, -0x0,0x80,0x0,0x1,0xc0,0x0,0x2,0x20,0x0,0x2,0x20,0x0,0x1,0xc0,0x0, -}; - -static const BitmapCharRec ch197 = {17,21,0,0,17,ch197data}; - -/* char: 0xc4 */ - -static const GLubyte ch196data[] = { -0xfc,0x1f,0x80,0x30,0x6,0x0,0x10,0x6,0x0,0x10,0xc,0x0,0x18,0xc,0x0,0x8, -0xc,0x0,0xf,0xf8,0x0,0xc,0x18,0x0,0x4,0x18,0x0,0x4,0x30,0x0,0x6,0x30, -0x0,0x2,0x30,0x0,0x2,0x60,0x0,0x1,0x60,0x0,0x1,0xc0,0x0,0x1,0xc0,0x0, -0x0,0x80,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x6,0x30,0x0,0x6,0x30,0x0, -}; - -static const BitmapCharRec ch196 = {17,21,0,0,17,ch196data}; - -/* char: 0xc3 */ - -static const GLubyte ch195data[] = { -0xfc,0x1f,0x80,0x30,0x7,0x0,0x10,0x6,0x0,0x10,0xc,0x0,0x18,0xc,0x0,0x8, -0xc,0x0,0xf,0xf8,0x0,0xc,0x18,0x0,0x4,0x18,0x0,0x4,0x30,0x0,0x6,0x30, -0x0,0x2,0x30,0x0,0x2,0x60,0x0,0x1,0x60,0x0,0x1,0xc0,0x0,0x1,0xc0,0x0, -0x0,0x80,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x4,0xe0,0x0,0x3,0x90,0x0, -}; - -static const BitmapCharRec ch195 = {17,21,0,0,17,ch195data}; - -/* char: 0xc2 */ - -static const GLubyte ch194data[] = { -0xfc,0x1f,0x80,0x30,0x6,0x0,0x10,0x6,0x0,0x10,0xc,0x0,0x18,0xc,0x0,0x8, -0xc,0x0,0xf,0xf8,0x0,0xc,0x18,0x0,0x4,0x18,0x0,0x4,0x30,0x0,0x6,0x30, -0x0,0x2,0x30,0x0,0x2,0x60,0x0,0x1,0x60,0x0,0x1,0xc0,0x0,0x1,0xc0,0x0, -0x0,0x80,0x0,0x0,0x0,0x0,0x8,0x10,0x0,0x6,0x60,0x0,0x3,0xc0,0x0,0x1, -0x80,0x0, -}; - -static const BitmapCharRec ch194 = {17,22,0,0,17,ch194data}; - -/* char: 0xc1 */ - -static const GLubyte ch193data[] = { -0xfc,0x1f,0x80,0x30,0x6,0x0,0x10,0x6,0x0,0x10,0xc,0x0,0x18,0xc,0x0,0x8, -0xc,0x0,0xf,0xf8,0x0,0xc,0x18,0x0,0x4,0x18,0x0,0x4,0x30,0x0,0x6,0x30, -0x0,0x2,0x30,0x0,0x2,0x60,0x0,0x1,0x60,0x0,0x1,0xc0,0x0,0x1,0xc0,0x0, -0x0,0x80,0x0,0x0,0x0,0x0,0x1,0x0,0x0,0x0,0xc0,0x0,0x0,0x70,0x0,0x0, -0x30,0x0, -}; - -static const BitmapCharRec ch193 = {17,22,0,0,17,ch193data}; - -/* char: 0xc0 */ - -static const GLubyte ch192data[] = { -0xfc,0x1f,0x80,0x30,0x6,0x0,0x10,0x6,0x0,0x10,0xc,0x0,0x18,0xc,0x0,0x8, -0xc,0x0,0xf,0xf8,0x0,0xc,0x18,0x0,0x4,0x18,0x0,0x4,0x30,0x0,0x6,0x30, -0x0,0x2,0x30,0x0,0x2,0x60,0x0,0x1,0x60,0x0,0x1,0xc0,0x0,0x1,0xc0,0x0, -0x0,0x80,0x0,0x0,0x0,0x0,0x0,0x20,0x0,0x0,0xc0,0x0,0x3,0x80,0x0,0x3, -0x0,0x0, -}; - -static const BitmapCharRec ch192 = {17,22,0,0,17,ch192data}; - -/* char: 0xbf */ - -static const GLubyte ch191data[] = { -0x3e,0x63,0xc1,0xc3,0xc3,0xe0,0x70,0x30,0x38,0x18,0x18,0x8,0x8,0x0,0x0,0xc, -0xc, -}; - -static const BitmapCharRec ch191 = {8,17,-1,5,11,ch191data}; - -/* char: 0xbe */ - -static const GLubyte ch190data[] = { -0x18,0x2,0x0,0x8,0x2,0x0,0xc,0x7f,0x80,0x4,0x22,0x0,0x6,0x32,0x0,0x3, -0x12,0x0,0x1,0xa,0x0,0x71,0x8e,0x0,0x88,0x86,0x0,0x8c,0xc2,0x0,0xc,0x60, -0x0,0x8,0x20,0x0,0x30,0x30,0x0,0x8,0x10,0x0,0x8c,0x18,0x0,0x4c,0xc,0x0, -0x38,0x4,0x0, -}; - -static const BitmapCharRec ch190 = {17,17,0,0,18,ch190data}; - -/* char: 0xbd */ - -static const GLubyte ch189data[] = { -0x30,0x7e,0x10,0x22,0x18,0x10,0x8,0x18,0xc,0x8,0x6,0x4,0x2,0x6,0xfb,0x46, -0x21,0x26,0x21,0x9c,0x20,0xc0,0x20,0x40,0x20,0x60,0x20,0x20,0xa0,0x30,0x60,0x18, -0x20,0x8, -}; - -static const BitmapCharRec ch189 = {15,17,-1,0,18,ch189data}; - -/* char: 0xbc */ - -static const GLubyte ch188data[] = { -0x30,0x4,0x10,0x4,0x18,0xff,0x8,0x44,0xc,0x64,0x6,0x24,0x2,0x14,0xfb,0x1c, -0x21,0xc,0x21,0x84,0x20,0xc0,0x20,0x40,0x20,0x60,0x20,0x20,0xa0,0x30,0x60,0x18, -0x20,0x8, -}; - -static const BitmapCharRec ch188 = {16,17,-1,0,18,ch188data}; - -/* char: 0xbb */ - -static const GLubyte ch187data[] = { -0x88,0x0,0xcc,0x0,0x66,0x0,0x33,0x0,0x19,0x80,0x19,0x80,0x33,0x0,0x66,0x0, -0xcc,0x0,0x88,0x0, -}; - -static const BitmapCharRec ch187 = {9,10,-2,-1,12,ch187data}; - -/* char: 0xba */ - -static const GLubyte ch186data[] = { -0xfc,0x0,0x78,0xcc,0xcc,0xcc,0xcc,0xcc,0x78, -}; - -static const BitmapCharRec ch186 = {6,9,-1,-8,8,ch186data}; - -/* char: 0xb9 */ - -static const GLubyte ch185data[] = { -0xf8,0x20,0x20,0x20,0x20,0x20,0x20,0xa0,0x60,0x20, -}; - -static const BitmapCharRec ch185 = {5,10,-1,-7,7,ch185data}; - -/* char: 0xb8 */ - -static const GLubyte ch184data[] = { -0x78,0xcc,0xc,0x3c,0x30,0x10, -}; - -static const BitmapCharRec ch184 = {6,6,-1,6,8,ch184data}; - -/* char: 0xb7 */ - -static const GLubyte ch183data[] = { -0xc0,0xc0, -}; - -static const BitmapCharRec ch183 = {2,2,-2,-6,6,ch183data}; - -/* char: 0xb6 */ - -static const GLubyte ch182data[] = { -0x9,0x0,0x9,0x0,0x9,0x0,0x9,0x0,0x9,0x0,0x9,0x0,0x9,0x0,0x9,0x0, -0x9,0x0,0x9,0x0,0x9,0x0,0x19,0x0,0x39,0x0,0x79,0x0,0x79,0x0,0xf9,0x0, -0xf9,0x0,0xf9,0x0,0x79,0x0,0x79,0x0,0x39,0x0,0x1f,0x80, -}; - -static const BitmapCharRec ch182 = {9,22,-1,5,11,ch182data}; - -/* char: 0xb5 */ - -static const GLubyte ch181data[] = { -0x40,0x0,0xe0,0x0,0xc0,0x0,0x40,0x0,0x40,0x0,0x5c,0xe0,0x7e,0xc0,0x71,0xc0, -0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0, -0xe1,0xc0, -}; - -static const BitmapCharRec ch181 = {11,17,-1,5,13,ch181data}; - -/* char: 0xb4 */ - -static const GLubyte ch180data[] = { -0x80,0x60,0x38,0x18, -}; - -static const BitmapCharRec ch180 = {5,4,-2,-13,8,ch180data}; - -/* char: 0xb3 */ - -static const GLubyte ch179data[] = { -0x70,0x88,0x8c,0xc,0x8,0x30,0x8,0x8c,0x4c,0x38, -}; - -static const BitmapCharRec ch179 = {6,10,0,-7,7,ch179data}; - -/* char: 0xb2 */ - -static const GLubyte ch178data[] = { -0xfc,0x44,0x20,0x30,0x10,0x8,0xc,0x8c,0x4c,0x38, -}; - -static const BitmapCharRec ch178 = {6,10,0,-7,7,ch178data}; - -/* char: 0xb1 */ - -static const GLubyte ch177data[] = { -0xff,0xf0,0xff,0xf0,0x0,0x0,0x6,0x0,0x6,0x0,0x6,0x0,0x6,0x0,0x6,0x0, -0xff,0xf0,0xff,0xf0,0x6,0x0,0x6,0x0,0x6,0x0,0x6,0x0,0x6,0x0, -}; - -static const BitmapCharRec ch177 = {12,15,-1,0,14,ch177data}; - -/* char: 0xb0 */ - -static const GLubyte ch176data[] = { -0x38,0x44,0x82,0x82,0x82,0x44,0x38, -}; - -static const BitmapCharRec ch176 = {7,7,-1,-10,9,ch176data}; - -/* char: 0xaf */ - -static const GLubyte ch175data[] = { -0xfc,0xfc, -}; - -static const BitmapCharRec ch175 = {6,2,-1,-14,8,ch175data}; - -/* char: 0xae */ - -static const GLubyte ch174data[] = { -0x7,0xf0,0x0,0x1c,0x1c,0x0,0x30,0x6,0x0,0x60,0x3,0x0,0x47,0x19,0x0,0xc2, -0x31,0x80,0x82,0x20,0x80,0x82,0x40,0x80,0x83,0xe0,0x80,0x82,0x30,0x80,0x82,0x10, -0x80,0xc2,0x11,0x80,0x42,0x31,0x0,0x67,0xe3,0x0,0x30,0x6,0x0,0x1c,0x1c,0x0, -0x7,0xf0,0x0, -}; - -static const BitmapCharRec ch174 = {17,17,-1,0,19,ch174data}; - -/* char: 0xad */ - -static const GLubyte ch173data[] = { -0xfe,0xfe, -}; - -static const BitmapCharRec ch173 = {7,2,-1,-5,9,ch173data}; - -/* char: 0xac */ - -static const GLubyte ch172data[] = { -0x0,0x30,0x0,0x30,0x0,0x30,0x0,0x30,0x0,0x30,0xff,0xf0,0xff,0xf0, -}; - -static const BitmapCharRec ch172 = {12,7,-1,-3,14,ch172data}; - -/* char: 0xab */ - -static const GLubyte ch171data[] = { -0x8,0x80,0x19,0x80,0x33,0x0,0x66,0x0,0xcc,0x0,0xcc,0x0,0x66,0x0,0x33,0x0, -0x19,0x80,0x8,0x80, -}; - -static const BitmapCharRec ch171 = {9,10,-2,-1,13,ch171data}; - -/* char: 0xaa */ - -static const GLubyte ch170data[] = { -0x7e,0x0,0x76,0xcc,0xcc,0x7c,0xc,0xcc,0x78, -}; - -static const BitmapCharRec ch170 = {7,9,0,-8,8,ch170data}; - -/* char: 0xa9 */ - -static const GLubyte ch169data[] = { -0x7,0xf0,0x0,0x1c,0x1c,0x0,0x30,0x6,0x0,0x61,0xc3,0x0,0x47,0x71,0x0,0xc4, -0x19,0x80,0x8c,0x0,0x80,0x88,0x0,0x80,0x88,0x0,0x80,0x88,0x0,0x80,0x8c,0x0, -0x80,0xc4,0x19,0x80,0x47,0x31,0x0,0x61,0xe3,0x0,0x30,0x6,0x0,0x1c,0x1c,0x0, -0x7,0xf0,0x0, -}; - -static const BitmapCharRec ch169 = {17,17,-1,0,19,ch169data}; - -/* char: 0xa8 */ - -static const GLubyte ch168data[] = { -0xcc,0xcc, -}; - -static const BitmapCharRec ch168 = {6,2,-1,-14,8,ch168data}; - -/* char: 0xa7 */ - -static const GLubyte ch167data[] = { -0x38,0x64,0x62,0x6,0xe,0x1c,0x38,0x74,0xe2,0xc3,0x83,0x87,0x4e,0x3c,0x38,0x70, -0x60,0x46,0x26,0x1c, -}; - -static const BitmapCharRec ch167 = {8,20,-2,2,12,ch167data}; - -/* char: 0xa6 */ - -static const GLubyte ch166data[] = { -0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0x0,0x0,0x0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0, -0xc0, -}; - -static const BitmapCharRec ch166 = {2,17,-2,0,6,ch166data}; - -/* char: 0xa5 */ - -static const GLubyte ch165data[] = { -0xf,0xc0,0x3,0x0,0x3,0x0,0x3,0x0,0x3,0x0,0x1f,0xe0,0x3,0x0,0x1f,0xe0, -0x3,0x0,0x7,0x80,0xc,0x80,0xc,0xc0,0x18,0x40,0x18,0x60,0x30,0x20,0x70,0x30, -0xf8,0x7c, -}; - -static const BitmapCharRec ch165 = {14,17,0,0,14,ch165data}; - -/* char: 0xa4 */ - -static const GLubyte ch164data[] = { -0xc0,0x60,0xee,0xe0,0x7f,0xc0,0x31,0x80,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0, -0x31,0x80,0x7f,0xc0,0xee,0xe0,0xc0,0x60, -}; - -static const BitmapCharRec ch164 = {11,12,-1,-3,13,ch164data}; - -/* char: 0xa3 */ - -static const GLubyte ch163data[] = { -0xe7,0x80,0xbe,0xc0,0x78,0x40,0x30,0x0,0x30,0x0,0x30,0x0,0x30,0x0,0x30,0x0, -0x30,0x0,0xfc,0x0,0x30,0x0,0x30,0x0,0x30,0x0,0x30,0x0,0x31,0x80,0x19,0x80, -0xf,0x0, -}; - -static const BitmapCharRec ch163 = {10,17,-1,0,12,ch163data}; - -/* char: 0xa2 */ - -static const GLubyte ch162data[] = { -0x40,0x0,0x40,0x0,0x3e,0x0,0x7f,0x0,0x70,0x80,0xd0,0x0,0xc8,0x0,0xc8,0x0, -0xc8,0x0,0xc4,0x0,0xc4,0x0,0x43,0x80,0x63,0x80,0x1f,0x0,0x1,0x0,0x1,0x0, -}; - -static const BitmapCharRec ch162 = {9,16,-1,2,12,ch162data}; - -/* char: 0xa1 */ - -static const GLubyte ch161data[] = { -0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0x0,0x0,0x0,0xc0, -0xc0, -}; - -static const BitmapCharRec ch161 = {2,17,-4,5,8,ch161data}; - -/* char: 0xa0 */ - -#ifdef _WIN32 -/* XXX Work around Microsoft OpenGL 1.1 bug where glBitmap with - a height or width of zero does not advance the raster position - as specified by OpenGL. (Cosmo OpenGL does not have this bug.) */ -static const GLubyte ch160data[] = { 0x0 }; -static const BitmapCharRec ch160 = {1,1,0,0,6,ch160data}; -#else -static const BitmapCharRec ch160 = {0,0,0,0,6,0}; -#endif - -/* char: 0x7e '~' */ - -static const GLubyte ch126data[] = { -0x83,0x80,0xc7,0xc0,0x7c,0x60,0x38,0x20, -}; - -static const BitmapCharRec ch126 = {11,4,-1,-5,13,ch126data}; - -/* char: 0x7d '}' */ - -static const GLubyte ch125data[] = { -0xe0,0x30,0x18,0x18,0x18,0x18,0x18,0x18,0x8,0xc,0x4,0x3,0x4,0xc,0x8,0x18, -0x18,0x18,0x18,0x18,0x30,0xe0, -}; - -static const BitmapCharRec ch125 = {8,22,-1,5,10,ch125data}; - -/* char: 0x7c '|' */ - -static const GLubyte ch124data[] = { -0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0, -0xc0, -}; - -static const BitmapCharRec ch124 = {2,17,-2,0,6,ch124data}; - -/* char: 0x7b '{' */ - -static const GLubyte ch123data[] = { -0x7,0xc,0x18,0x18,0x18,0x18,0x18,0x18,0x10,0x30,0x20,0xc0,0x20,0x30,0x10,0x18, -0x18,0x18,0x18,0x18,0xc,0x7, -}; - -static const BitmapCharRec ch123 = {8,22,-1,5,10,ch123data}; - -/* char: 0x7a 'z' */ - -static const GLubyte ch122data[] = { -0xff,0xc3,0x61,0x70,0x30,0x38,0x18,0x1c,0xe,0x86,0xc3,0xff, -}; - -static const BitmapCharRec ch122 = {8,12,-1,0,10,ch122data}; - -/* char: 0x79 'y' */ - -static const GLubyte ch121data[] = { -0xe0,0x0,0xf0,0x0,0x18,0x0,0x8,0x0,0xc,0x0,0x4,0x0,0xe,0x0,0xe,0x0, -0x1a,0x0,0x19,0x0,0x19,0x0,0x31,0x0,0x30,0x80,0x30,0x80,0x60,0x80,0x60,0xc0, -0xf1,0xe0, -}; - -static const BitmapCharRec ch121 = {11,17,0,5,11,ch121data}; - -/* char: 0x78 'x' */ - -static const GLubyte ch120data[] = { -0xf1,0xe0,0x60,0xc0,0x21,0x80,0x33,0x80,0x1b,0x0,0xe,0x0,0xc,0x0,0x1a,0x0, -0x39,0x0,0x31,0x80,0x60,0xc0,0xf1,0xe0, -}; - -static const BitmapCharRec ch120 = {11,12,-1,0,13,ch120data}; - -/* char: 0x77 'w' */ - -static const GLubyte ch119data[] = { -0x4,0x10,0x0,0xe,0x38,0x0,0xe,0x38,0x0,0x1a,0x28,0x0,0x1a,0x64,0x0,0x19, -0x64,0x0,0x31,0x64,0x0,0x30,0xc2,0x0,0x30,0xc2,0x0,0x60,0xc2,0x0,0x60,0xc3, -0x0,0xf1,0xe7,0x80, -}; - -static const BitmapCharRec ch119 = {17,12,0,0,17,ch119data}; - -/* char: 0x76 'v' */ - -static const GLubyte ch118data[] = { -0x4,0x0,0xe,0x0,0xe,0x0,0x1a,0x0,0x19,0x0,0x19,0x0,0x31,0x0,0x30,0x80, -0x30,0x80,0x60,0x80,0x60,0xc0,0xf1,0xe0, -}; - -static const BitmapCharRec ch118 = {11,12,0,0,11,ch118data}; - -/* char: 0x75 'u' */ - -static const GLubyte ch117data[] = { -0x1c,0xe0,0x3e,0xc0,0x71,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0, -0x60,0xc0,0x60,0xc0,0x60,0xc0,0xe1,0xc0, -}; - -static const BitmapCharRec ch117 = {11,12,-1,0,13,ch117data}; - -/* char: 0x74 't' */ - -static const GLubyte ch116data[] = { -0x1c,0x32,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0xfe,0x70,0x30,0x10, -}; - -static const BitmapCharRec ch116 = {7,15,0,0,7,ch116data}; - -/* char: 0x73 's' */ - -static const GLubyte ch115data[] = { -0xf8,0xc6,0x83,0x3,0x7,0x1e,0x7c,0x70,0xe0,0xc2,0x66,0x3e, -}; - -static const BitmapCharRec ch115 = {8,12,-1,0,10,ch115data}; - -/* char: 0x72 'r' */ - -static const GLubyte ch114data[] = { -0xf0,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x76,0x6e,0xe6, -}; - -static const BitmapCharRec ch114 = {7,12,-1,0,8,ch114data}; - -/* char: 0x71 'q' */ - -static const GLubyte ch113data[] = { -0x3,0xc0,0x1,0x80,0x1,0x80,0x1,0x80,0x1,0x80,0x1d,0x80,0x73,0x80,0x61,0x80, -0xc1,0x80,0xc1,0x80,0xc1,0x80,0xc1,0x80,0xc1,0x80,0xc1,0x80,0x61,0x80,0x73,0x80, -0x1d,0x80, -}; - -static const BitmapCharRec ch113 = {10,17,-1,5,12,ch113data}; - -/* char: 0x70 'p' */ - -static const GLubyte ch112data[] = { -0xf0,0x0,0x60,0x0,0x60,0x0,0x60,0x0,0x60,0x0,0x6e,0x0,0x73,0x80,0x61,0x80, -0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x61,0x80,0x73,0x80, -0xee,0x0, -}; - -static const BitmapCharRec ch112 = {10,17,-1,5,12,ch112data}; - -/* char: 0x6f 'o' */ - -static const GLubyte ch111data[] = { -0x1e,0x0,0x73,0x80,0x61,0x80,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0, -0xc0,0xc0,0x61,0x80,0x73,0x80,0x1e,0x0, -}; - -static const BitmapCharRec ch111 = {10,12,-1,0,12,ch111data}; - -/* char: 0x6e 'n' */ - -static const GLubyte ch110data[] = { -0xf1,0xe0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0, -0x60,0xc0,0x71,0xc0,0x6f,0x80,0xe7,0x0, -}; - -static const BitmapCharRec ch110 = {11,12,-1,0,13,ch110data}; - -/* char: 0x6d 'm' */ - -static const GLubyte ch109data[] = { -0xf1,0xe3,0xc0,0x60,0xc1,0x80,0x60,0xc1,0x80,0x60,0xc1,0x80,0x60,0xc1,0x80,0x60, -0xc1,0x80,0x60,0xc1,0x80,0x60,0xc1,0x80,0x60,0xc1,0x80,0x71,0xe3,0x80,0x6f,0x9f, -0x0,0xe7,0xe,0x0, -}; - -static const BitmapCharRec ch109 = {18,12,-1,0,20,ch109data}; - -/* char: 0x6c 'l' */ - -static const GLubyte ch108data[] = { -0xf0,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60, -0xe0, -}; - -static const BitmapCharRec ch108 = {4,17,-1,0,6,ch108data}; - -/* char: 0x6b 'k' */ - -static const GLubyte ch107data[] = { -0xf3,0xe0,0x61,0xc0,0x63,0x80,0x67,0x0,0x6e,0x0,0x6c,0x0,0x78,0x0,0x68,0x0, -0x64,0x0,0x66,0x0,0x63,0x0,0x67,0xc0,0x60,0x0,0x60,0x0,0x60,0x0,0x60,0x0, -0xe0,0x0, -}; - -static const BitmapCharRec ch107 = {11,17,-1,0,12,ch107data}; - -/* char: 0x6a 'j' */ - -static const GLubyte ch106data[] = { -0xc0,0xe0,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30, -0x70,0x0,0x0,0x0,0x30,0x30, -}; - -static const BitmapCharRec ch106 = {4,22,0,5,6,ch106data}; - -/* char: 0x69 'i' */ - -static const GLubyte ch105data[] = { -0xf0,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0xe0,0x0,0x0,0x0,0x60, -0x60, -}; - -static const BitmapCharRec ch105 = {4,17,-1,0,6,ch105data}; - -/* char: 0x68 'h' */ - -static const GLubyte ch104data[] = { -0xf1,0xe0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0, -0x60,0xc0,0x71,0xc0,0x6f,0x80,0x67,0x0,0x60,0x0,0x60,0x0,0x60,0x0,0x60,0x0, -0xe0,0x0, -}; - -static const BitmapCharRec ch104 = {11,17,-1,0,13,ch104data}; - -/* char: 0x67 'g' */ - -static const GLubyte ch103data[] = { -0x3f,0x0,0xf1,0xc0,0xc0,0x60,0xc0,0x20,0x60,0x60,0x3f,0xc0,0x7f,0x0,0x60,0x0, -0x30,0x0,0x3e,0x0,0x33,0x0,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x33,0x0, -0x1f,0xc0, -}; - -static const BitmapCharRec ch103 = {11,17,-1,5,12,ch103data}; - -/* char: 0x66 'f' */ - -static const GLubyte ch102data[] = { -0x78,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0xfe,0x30,0x30,0x30,0x16, -0xe, -}; - -static const BitmapCharRec ch102 = {7,17,0,0,7,ch102data}; - -/* char: 0x65 'e' */ - -static const GLubyte ch101data[] = { -0x1e,0x0,0x7f,0x0,0x70,0x80,0xe0,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x0,0xff,0x80, -0xc1,0x80,0x41,0x80,0x63,0x0,0x1e,0x0, -}; - -static const BitmapCharRec ch101 = {9,12,-1,0,11,ch101data}; - -/* char: 0x64 'd' */ - -static const GLubyte ch100data[] = { -0x1e,0xc0,0x73,0x80,0x61,0x80,0xc1,0x80,0xc1,0x80,0xc1,0x80,0xc1,0x80,0xc1,0x80, -0xc1,0x80,0x61,0x80,0x73,0x80,0x1d,0x80,0x1,0x80,0x1,0x80,0x1,0x80,0x1,0x80, -0x3,0x80, -}; - -static const BitmapCharRec ch100 = {10,17,-1,0,12,ch100data}; - -/* char: 0x63 'c' */ - -static const GLubyte ch99data[] = { -0x1e,0x0,0x7f,0x0,0x70,0x80,0xe0,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x0, -0xc0,0x0,0x41,0x80,0x63,0x80,0x1f,0x0, -}; - -static const BitmapCharRec ch99 = {9,12,-1,0,11,ch99data}; - -/* char: 0x62 'b' */ - -static const GLubyte ch98data[] = { -0x5e,0x0,0x73,0x80,0x61,0x80,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0,0x60,0xc0, -0x60,0xc0,0x61,0x80,0x73,0x80,0x6e,0x0,0x60,0x0,0x60,0x0,0x60,0x0,0x60,0x0, -0xe0,0x0, -}; - -static const BitmapCharRec ch98 = {10,17,-1,0,12,ch98data}; - -/* char: 0x61 'a' */ - -static const GLubyte ch97data[] = { -0x71,0x80,0xfb,0x0,0xc7,0x0,0xc3,0x0,0xc3,0x0,0x63,0x0,0x3b,0x0,0xf,0x0, -0x3,0x0,0x63,0x0,0x67,0x0,0x3e,0x0, -}; - -static const BitmapCharRec ch97 = {9,12,-1,0,11,ch97data}; - -/* char: 0x60 '`' */ - -static const GLubyte ch96data[] = { -0x60,0xe0,0x80,0xc0,0x60, -}; - -static const BitmapCharRec ch96 = {3,5,-2,-12,7,ch96data}; - -/* char: 0x5f '_' */ - -static const GLubyte ch95data[] = { -0xff,0xf8,0xff,0xf8, -}; - -static const BitmapCharRec ch95 = {13,2,0,5,13,ch95data}; - -/* char: 0x5e '^' */ - -static const GLubyte ch94data[] = { -0x80,0x80,0xc1,0x80,0x41,0x0,0x63,0x0,0x22,0x0,0x36,0x0,0x14,0x0,0x1c,0x0, -0x8,0x0, -}; - -static const BitmapCharRec ch94 = {9,9,-1,-8,11,ch94data}; - -/* char: 0x5d ']' */ - -static const GLubyte ch93data[] = { -0xf8,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, -0x18,0x18,0x18,0x18,0xf8, -}; - -static const BitmapCharRec ch93 = {5,21,-1,4,8,ch93data}; - -/* char: 0x5c '\' */ - -static const GLubyte ch92data[] = { -0x6,0x6,0x4,0xc,0xc,0x8,0x18,0x18,0x10,0x30,0x30,0x20,0x60,0x60,0x40,0xc0, -0xc0, -}; - -static const BitmapCharRec ch92 = {7,17,0,0,7,ch92data}; - -/* char: 0x5b '[' */ - -static const GLubyte ch91data[] = { -0xf8,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0, -0xc0,0xc0,0xc0,0xc0,0xf8, -}; - -static const BitmapCharRec ch91 = {5,21,-2,4,8,ch91data}; - -/* char: 0x5a 'Z' */ - -static const GLubyte ch90data[] = { -0xff,0xf8,0xe0,0x18,0x70,0x8,0x30,0x8,0x38,0x0,0x18,0x0,0x1c,0x0,0xe,0x0, -0x6,0x0,0x7,0x0,0x3,0x0,0x3,0x80,0x1,0xc0,0x80,0xc0,0x80,0xe0,0xc0,0x70, -0xff,0xf0, -}; - -static const BitmapCharRec ch90 = {13,17,-1,0,15,ch90data}; - -/* char: 0x59 'Y' */ - -static const GLubyte ch89data[] = { -0x7,0xe0,0x1,0x80,0x1,0x80,0x1,0x80,0x1,0x80,0x1,0x80,0x1,0x80,0x3,0xc0, -0x3,0x40,0x6,0x60,0x6,0x20,0xc,0x30,0x1c,0x10,0x18,0x18,0x38,0x8,0x30,0xc, -0xfc,0x3f, -}; - -static const BitmapCharRec ch89 = {16,17,0,0,16,ch89data}; - -/* char: 0x58 'X' */ - -static const GLubyte ch88data[] = { -0xfc,0xf,0xc0,0x30,0x3,0x80,0x18,0x7,0x0,0x8,0xe,0x0,0x4,0xc,0x0,0x6, -0x18,0x0,0x2,0x38,0x0,0x1,0x70,0x0,0x0,0xe0,0x0,0x0,0xc0,0x0,0x1,0xc0, -0x0,0x3,0xa0,0x0,0x3,0x10,0x0,0x6,0x8,0x0,0xe,0xc,0x0,0x1c,0x6,0x0, -0x7e,0xf,0x80, -}; - -static const BitmapCharRec ch88 = {18,17,0,0,18,ch88data}; - -/* char: 0x57 'W' */ - -static const GLubyte ch87data[] = { -0x1,0x83,0x0,0x1,0x83,0x0,0x1,0x83,0x80,0x3,0x87,0x80,0x3,0x46,0x80,0x3, -0x46,0xc0,0x6,0x46,0x40,0x6,0x4c,0x40,0x6,0x4c,0x60,0xc,0x2c,0x60,0xc,0x2c, -0x20,0x18,0x2c,0x20,0x18,0x18,0x30,0x18,0x18,0x10,0x30,0x18,0x10,0x30,0x18,0x18, -0xfc,0x7e,0x7e, -}; - -static const BitmapCharRec ch87 = {23,17,0,0,23,ch87data}; - -/* char: 0x56 'V' */ - -static const GLubyte ch86data[] = { -0x1,0x80,0x0,0x1,0x80,0x0,0x1,0x80,0x0,0x3,0xc0,0x0,0x3,0x40,0x0,0x3, -0x60,0x0,0x6,0x20,0x0,0x6,0x20,0x0,0x6,0x30,0x0,0xc,0x10,0x0,0xc,0x18, -0x0,0x18,0x8,0x0,0x18,0x8,0x0,0x18,0xc,0x0,0x30,0x4,0x0,0x30,0x6,0x0, -0xfc,0x1f,0x80, -}; - -static const BitmapCharRec ch86 = {17,17,0,0,17,ch86data}; - -/* char: 0x55 'U' */ - -static const GLubyte ch85data[] = { -0x7,0xe0,0x1c,0x30,0x18,0x8,0x30,0x8,0x30,0x4,0x30,0x4,0x30,0x4,0x30,0x4, -0x30,0x4,0x30,0x4,0x30,0x4,0x30,0x4,0x30,0x4,0x30,0x4,0x30,0x4,0x30,0x4, -0xfc,0x1f, -}; - -static const BitmapCharRec ch85 = {16,17,-1,0,18,ch85data}; - -/* char: 0x54 'T' */ - -static const GLubyte ch84data[] = { -0xf,0xc0,0x3,0x0,0x3,0x0,0x3,0x0,0x3,0x0,0x3,0x0,0x3,0x0,0x3,0x0, -0x3,0x0,0x3,0x0,0x3,0x0,0x3,0x0,0x3,0x0,0x83,0x4,0x83,0x4,0xc3,0xc, -0xff,0xfc, -}; - -static const BitmapCharRec ch84 = {14,17,-1,0,16,ch84data}; - -/* char: 0x53 'S' */ - -static const GLubyte ch83data[] = { -0x9e,0x0,0xf1,0x80,0xc0,0xc0,0x80,0x60,0x80,0x60,0x0,0x60,0x0,0xe0,0x3,0xc0, -0xf,0x80,0x1e,0x0,0x78,0x0,0xe0,0x0,0xc0,0x40,0xc0,0x40,0xc0,0xc0,0x63,0xc0, -0x1e,0x40, -}; - -static const BitmapCharRec ch83 = {11,17,-1,0,13,ch83data}; - -/* char: 0x52 'R' */ - -static const GLubyte ch82data[] = { -0xfc,0x1e,0x30,0x1c,0x30,0x38,0x30,0x70,0x30,0x60,0x30,0xc0,0x31,0xc0,0x33,0x80, -0x3f,0xc0,0x30,0x70,0x30,0x30,0x30,0x38,0x30,0x18,0x30,0x38,0x30,0x30,0x30,0x70, -0xff,0xc0, -}; - -static const BitmapCharRec ch82 = {15,17,-1,0,16,ch82data}; - -/* char: 0x51 'Q' */ - -static const GLubyte ch81data[] = { -0x0,0xf,0x0,0x38,0x0,0x70,0x0,0xe0,0x1,0xc0,0x7,0xe0,0x1c,0x38,0x38,0x1c, -0x60,0x6,0x60,0x6,0xc0,0x3,0xc0,0x3,0xc0,0x3,0xc0,0x3,0xc0,0x3,0xc0,0x3, -0xc0,0x3,0x60,0x6,0x60,0x6,0x38,0x1c,0x1c,0x38,0x7,0xe0, -}; - -static const BitmapCharRec ch81 = {16,22,-1,5,18,ch81data}; - -/* char: 0x50 'P' */ - -static const GLubyte ch80data[] = { -0xfc,0x0,0x30,0x0,0x30,0x0,0x30,0x0,0x30,0x0,0x30,0x0,0x30,0x0,0x30,0x0, -0x3f,0xc0,0x30,0x70,0x30,0x30,0x30,0x18,0x30,0x18,0x30,0x18,0x30,0x30,0x30,0x70, -0xff,0xc0, -}; - -static const BitmapCharRec ch80 = {13,17,-1,0,15,ch80data}; - -/* char: 0x4f 'O' */ - -static const GLubyte ch79data[] = { -0x7,0xe0,0x1c,0x38,0x38,0x1c,0x60,0x6,0x60,0x6,0xc0,0x3,0xc0,0x3,0xc0,0x3, -0xc0,0x3,0xc0,0x3,0xc0,0x3,0xc0,0x3,0x60,0x6,0x60,0x6,0x38,0x1c,0x1c,0x38, -0x7,0xe0, -}; - -static const BitmapCharRec ch79 = {16,17,-1,0,18,ch79data}; - -/* char: 0x4e 'N' */ - -static const GLubyte ch78data[] = { -0xf8,0xc,0x20,0x1c,0x20,0x1c,0x20,0x34,0x20,0x64,0x20,0x64,0x20,0xc4,0x21,0x84, -0x21,0x84,0x23,0x4,0x26,0x4,0x26,0x4,0x2c,0x4,0x38,0x4,0x38,0x4,0x30,0x4, -0xf0,0x1f, -}; - -static const BitmapCharRec ch78 = {16,17,-1,0,18,ch78data}; - -/* char: 0x4d 'M' */ - -static const GLubyte ch77data[] = { -0xf8,0x21,0xf8,0x20,0x60,0x60,0x20,0x60,0x60,0x20,0xd0,0x60,0x20,0xd0,0x60,0x21, -0x88,0x60,0x21,0x88,0x60,0x23,0x8,0x60,0x23,0x4,0x60,0x26,0x4,0x60,0x26,0x2, -0x60,0x2c,0x2,0x60,0x2c,0x2,0x60,0x38,0x1,0x60,0x38,0x1,0x60,0x30,0x0,0xe0, -0xf0,0x0,0xf8, -}; - -static const BitmapCharRec ch77 = {21,17,-1,0,22,ch77data}; - -/* char: 0x4c 'L' */ - -static const GLubyte ch76data[] = { -0xff,0xf8,0x30,0x18,0x30,0x8,0x30,0x8,0x30,0x0,0x30,0x0,0x30,0x0,0x30,0x0, -0x30,0x0,0x30,0x0,0x30,0x0,0x30,0x0,0x30,0x0,0x30,0x0,0x30,0x0,0x30,0x0, -0xfc,0x0, -}; - -static const BitmapCharRec ch76 = {13,17,-1,0,14,ch76data}; - -/* char: 0x4b 'K' */ - -static const GLubyte ch75data[] = { -0xfc,0x1f,0x30,0xe,0x30,0x1c,0x30,0x38,0x30,0x70,0x30,0xe0,0x31,0xc0,0x33,0x80, -0x3f,0x0,0x3e,0x0,0x33,0x0,0x31,0x80,0x30,0xc0,0x30,0x60,0x30,0x30,0x30,0x18, -0xfc,0x7e, -}; - -static const BitmapCharRec ch75 = {16,17,-1,0,17,ch75data}; - -/* char: 0x4a 'J' */ - -static const GLubyte ch74data[] = { -0x78,0x0,0xcc,0x0,0xc6,0x0,0x6,0x0,0x6,0x0,0x6,0x0,0x6,0x0,0x6,0x0, -0x6,0x0,0x6,0x0,0x6,0x0,0x6,0x0,0x6,0x0,0x6,0x0,0x6,0x0,0x6,0x0, -0x1f,0x80, -}; - -static const BitmapCharRec ch74 = {9,17,-1,0,11,ch74data}; - -/* char: 0x49 'I' */ - -static const GLubyte ch73data[] = { -0xfc,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30, -0xfc, -}; - -static const BitmapCharRec ch73 = {6,17,-1,0,8,ch73data}; - -/* char: 0x48 'H' */ - -static const GLubyte ch72data[] = { -0xfc,0x1f,0x80,0x30,0x6,0x0,0x30,0x6,0x0,0x30,0x6,0x0,0x30,0x6,0x0,0x30, -0x6,0x0,0x30,0x6,0x0,0x30,0x6,0x0,0x3f,0xfe,0x0,0x30,0x6,0x0,0x30,0x6, -0x0,0x30,0x6,0x0,0x30,0x6,0x0,0x30,0x6,0x0,0x30,0x6,0x0,0x30,0x6,0x0, -0xfc,0x1f,0x80, -}; - -static const BitmapCharRec ch72 = {17,17,-1,0,19,ch72data}; - -/* char: 0x47 'G' */ - -static const GLubyte ch71data[] = { -0x7,0xe0,0x1e,0x38,0x38,0x1c,0x60,0xc,0x60,0xc,0xc0,0xc,0xc0,0xc,0xc0,0x3f, -0xc0,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x0,0x60,0x4,0x60,0x4,0x38,0xc,0x1c,0x3c, -0x7,0xe4, -}; - -static const BitmapCharRec ch71 = {16,17,-1,0,18,ch71data}; - -/* char: 0x46 'F' */ - -static const GLubyte ch70data[] = { -0xfc,0x0,0x30,0x0,0x30,0x0,0x30,0x0,0x30,0x0,0x30,0x0,0x30,0x20,0x30,0x20, -0x3f,0xe0,0x30,0x20,0x30,0x20,0x30,0x0,0x30,0x0,0x30,0x10,0x30,0x10,0x30,0x30, -0xff,0xf0, -}; - -static const BitmapCharRec ch70 = {12,17,-1,0,14,ch70data}; - -/* char: 0x45 'E' */ - -static const GLubyte ch69data[] = { -0xff,0xf8,0x30,0x18,0x30,0x8,0x30,0x8,0x30,0x0,0x30,0x0,0x30,0x40,0x30,0x40, -0x3f,0xc0,0x30,0x40,0x30,0x40,0x30,0x0,0x30,0x0,0x30,0x10,0x30,0x10,0x30,0x30, -0xff,0xf0, -}; - -static const BitmapCharRec ch69 = {13,17,-1,0,15,ch69data}; - -/* char: 0x44 'D' */ - -static const GLubyte ch68data[] = { -0xff,0xc0,0x30,0x70,0x30,0x38,0x30,0xc,0x30,0xc,0x30,0x6,0x30,0x6,0x30,0x6, -0x30,0x6,0x30,0x6,0x30,0x6,0x30,0x6,0x30,0xc,0x30,0xc,0x30,0x38,0x30,0x70, -0xff,0xc0, -}; - -static const BitmapCharRec ch68 = {15,17,-1,0,17,ch68data}; - -/* char: 0x43 'C' */ - -static const GLubyte ch67data[] = { -0x7,0xe0,0x1e,0x38,0x38,0x8,0x60,0x4,0x60,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x0, -0xc0,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x0,0x60,0x4,0x60,0x4,0x38,0xc,0x1c,0x3c, -0x7,0xe4, -}; - -static const BitmapCharRec ch67 = {14,17,-1,0,16,ch67data}; - -/* char: 0x42 'B' */ - -static const GLubyte ch66data[] = { -0xff,0xe0,0x30,0x78,0x30,0x18,0x30,0xc,0x30,0xc,0x30,0xc,0x30,0x18,0x30,0x38, -0x3f,0xe0,0x30,0x40,0x30,0x30,0x30,0x18,0x30,0x18,0x30,0x18,0x30,0x30,0x30,0x70, -0xff,0xc0, -}; - -static const BitmapCharRec ch66 = {14,17,-1,0,16,ch66data}; - -/* char: 0x41 'A' */ - -static const GLubyte ch65data[] = { -0xfc,0x1f,0x80,0x30,0x6,0x0,0x10,0x6,0x0,0x10,0xc,0x0,0x18,0xc,0x0,0x8, -0xc,0x0,0xf,0xf8,0x0,0xc,0x18,0x0,0x4,0x18,0x0,0x4,0x30,0x0,0x6,0x30, -0x0,0x2,0x30,0x0,0x2,0x60,0x0,0x1,0x60,0x0,0x1,0xc0,0x0,0x1,0xc0,0x0, -0x0,0x80,0x0, -}; - -static const BitmapCharRec ch65 = {17,17,0,0,17,ch65data}; - -/* char: 0x40 '@' */ - -static const GLubyte ch64data[] = { -0x3,0xf0,0x0,0xe,0xc,0x0,0x18,0x0,0x0,0x30,0x0,0x0,0x61,0xde,0x0,0x63, -0x7b,0x0,0xc6,0x39,0x80,0xc6,0x18,0x80,0xc6,0x18,0xc0,0xc6,0x18,0x40,0xc6,0xc, -0x40,0xc3,0xc,0x40,0xc3,0x8c,0x40,0xe1,0xfc,0x40,0x60,0xec,0xc0,0x70,0x0,0x80, -0x38,0x1,0x80,0x1c,0x3,0x0,0xf,0xe,0x0,0x3,0xf8,0x0, -}; - -static const BitmapCharRec ch64 = {18,20,-2,3,22,ch64data}; - -/* char: 0x3f '?' */ - -static const GLubyte ch63data[] = { -0x30,0x30,0x0,0x0,0x10,0x10,0x10,0x18,0x18,0xc,0xe,0x7,0xc3,0xc3,0x83,0xc6, -0x7c, -}; - -static const BitmapCharRec ch63 = {8,17,-2,0,11,ch63data}; - -/* char: 0x3e '>' */ - -static const GLubyte ch62data[] = { -0xc0,0x0,0x70,0x0,0x1c,0x0,0x7,0x0,0x1,0xc0,0x0,0x60,0x1,0xc0,0x7,0x0, -0x1c,0x0,0x70,0x0,0xc0,0x0, -}; - -static const BitmapCharRec ch62 = {11,11,-1,-1,13,ch62data}; - -/* char: 0x3d '=' */ - -static const GLubyte ch61data[] = { -0xff,0xf0,0xff,0xf0,0x0,0x0,0x0,0x0,0xff,0xf0,0xff,0xf0, -}; - -static const BitmapCharRec ch61 = {12,6,-1,-4,14,ch61data}; - -/* char: 0x3c '<' */ - -static const GLubyte ch60data[] = { -0x0,0x60,0x1,0xc0,0x7,0x0,0x1c,0x0,0x70,0x0,0xc0,0x0,0x70,0x0,0x1c,0x0, -0x7,0x0,0x1,0xc0,0x0,0x60, -}; - -static const BitmapCharRec ch60 = {11,11,-1,-1,13,ch60data}; - -/* char: 0x3b ';' */ - -static const GLubyte ch59data[] = { -0xc0,0x60,0x20,0xe0,0xc0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xc0,0xc0, -}; - -static const BitmapCharRec ch59 = {3,14,-2,3,7,ch59data}; - -/* char: 0x3a ':' */ - -static const GLubyte ch58data[] = { -0xc0,0xc0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xc0,0xc0, -}; - -static const BitmapCharRec ch58 = {2,11,-2,0,6,ch58data}; - -/* char: 0x39 '9' */ - -static const GLubyte ch57data[] = { -0xf0,0x0,0x1c,0x0,0x6,0x0,0x3,0x0,0x3,0x80,0x1,0x80,0x1d,0x80,0x73,0xc0, -0x61,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc1,0xc0,0x61,0x80,0x77,0x80, -0x1e,0x0, -}; - -static const BitmapCharRec ch57 = {10,17,-1,0,12,ch57data}; - -/* char: 0x38 '8' */ - -static const GLubyte ch56data[] = { -0x1e,0x0,0x73,0x80,0xe1,0x80,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0x41,0xc0,0x61,0x80, -0x37,0x0,0x1e,0x0,0x1e,0x0,0x33,0x0,0x61,0x80,0x61,0x80,0x61,0x80,0x33,0x0, -0x1e,0x0, -}; - -static const BitmapCharRec ch56 = {10,17,-1,0,12,ch56data}; - -/* char: 0x37 '7' */ - -static const GLubyte ch55data[] = { -0x18,0x0,0x18,0x0,0xc,0x0,0xc,0x0,0xc,0x0,0x4,0x0,0x6,0x0,0x6,0x0, -0x2,0x0,0x3,0x0,0x3,0x0,0x1,0x0,0x1,0x80,0x81,0x80,0xc0,0xc0,0xff,0xc0, -0x7f,0xc0, -}; - -static const BitmapCharRec ch55 = {10,17,-1,0,12,ch55data}; - -/* char: 0x36 '6' */ - -static const GLubyte ch54data[] = { -0x1e,0x0,0x7b,0x80,0x61,0x80,0xe0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0, -0xc1,0x80,0xf3,0x80,0xee,0x0,0x60,0x0,0x70,0x0,0x30,0x0,0x18,0x0,0xe,0x0, -0x3,0xc0, -}; - -static const BitmapCharRec ch54 = {10,17,-1,0,12,ch54data}; - -/* char: 0x35 '5' */ - -static const GLubyte ch53data[] = { -0x7e,0x0,0xe3,0x80,0xc1,0x80,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x0,0xc0,0x1,0xc0, -0x3,0x80,0xf,0x80,0x7e,0x0,0x78,0x0,0x60,0x0,0x20,0x0,0x20,0x0,0x1f,0x80, -0x1f,0xc0, -}; - -static const BitmapCharRec ch53 = {10,17,-1,0,12,ch53data}; - -/* char: 0x34 '4' */ - -static const GLubyte ch52data[] = { -0x3,0x0,0x3,0x0,0x3,0x0,0x3,0x0,0xff,0xc0,0xff,0xc0,0xc3,0x0,0x43,0x0, -0x63,0x0,0x23,0x0,0x33,0x0,0x13,0x0,0x1b,0x0,0xb,0x0,0x7,0x0,0x7,0x0, -0x3,0x0, -}; - -static const BitmapCharRec ch52 = {10,17,-1,0,12,ch52data}; - -/* char: 0x33 '3' */ - -static const GLubyte ch51data[] = { -0x78,0x0,0xe6,0x0,0xc3,0x0,0x1,0x0,0x1,0x80,0x1,0x80,0x1,0x80,0x3,0x80, -0x7,0x0,0x1e,0x0,0xc,0x0,0x6,0x0,0x83,0x0,0x83,0x0,0x47,0x0,0x7e,0x0, -0x1c,0x0, -}; - -static const BitmapCharRec ch51 = {9,17,-1,0,12,ch51data}; - -/* char: 0x32 '2' */ - -static const GLubyte ch50data[] = { -0xff,0x80,0xff,0xc0,0x60,0x40,0x30,0x0,0x18,0x0,0xc,0x0,0x4,0x0,0x6,0x0, -0x3,0x0,0x3,0x0,0x1,0x80,0x1,0x80,0x81,0x80,0x81,0x80,0x43,0x80,0x7f,0x0, -0x1c,0x0, -}; - -static const BitmapCharRec ch50 = {10,17,-1,0,12,ch50data}; - -/* char: 0x31 '1' */ - -static const GLubyte ch49data[] = { -0xff,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x78,0x18, -0x8, -}; - -static const BitmapCharRec ch49 = {8,17,-2,0,12,ch49data}; - -/* char: 0x30 '0' */ - -static const GLubyte ch48data[] = { -0x1e,0x0,0x33,0x0,0x61,0x80,0x61,0x80,0xe1,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0, -0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0x61,0x80,0x61,0x80,0x33,0x0, -0x1e,0x0, -}; - -static const BitmapCharRec ch48 = {10,17,-1,0,12,ch48data}; - -/* char: 0x2f '/' */ - -static const GLubyte ch47data[] = { -0xc0,0xc0,0xc0,0x60,0x60,0x20,0x30,0x30,0x10,0x18,0x18,0x8,0xc,0xc,0x4,0x6, -0x6,0x3,0x3,0x3, -}; - -static const BitmapCharRec ch47 = {8,20,1,3,7,ch47data}; - -/* char: 0x2e '.' */ - -static const GLubyte ch46data[] = { -0xc0,0xc0, -}; - -static const BitmapCharRec ch46 = {2,2,-2,0,6,ch46data}; - -/* char: 0x2d '-' */ - -static const GLubyte ch45data[] = { -0xff,0xf0,0xff,0xf0, -}; - -static const BitmapCharRec ch45 = {12,2,-1,-6,14,ch45data}; - -/* char: 0x2c ',' */ - -static const GLubyte ch44data[] = { -0xc0,0x60,0x20,0xe0,0xc0, -}; - -static const BitmapCharRec ch44 = {3,5,-2,3,7,ch44data}; - -/* char: 0x2b '+' */ - -static const GLubyte ch43data[] = { -0x6,0x0,0x6,0x0,0x6,0x0,0x6,0x0,0x6,0x0,0xff,0xf0,0xff,0xf0,0x6,0x0, -0x6,0x0,0x6,0x0,0x6,0x0,0x6,0x0, -}; - -static const BitmapCharRec ch43 = {12,12,-1,-1,14,ch43data}; - -/* char: 0x2a '*' */ - -static const GLubyte ch42data[] = { -0x8,0x0,0x1c,0x0,0xc9,0x80,0xeb,0x80,0x1c,0x0,0xeb,0x80,0xc9,0x80,0x1c,0x0, -0x8,0x0, -}; - -static const BitmapCharRec ch42 = {9,9,-2,-8,12,ch42data}; - -/* char: 0x29 ')' */ - -static const GLubyte ch41data[] = { -0x80,0x40,0x20,0x30,0x10,0x18,0x18,0xc,0xc,0xc,0xc,0xc,0xc,0xc,0xc,0x18, -0x18,0x10,0x30,0x20,0x40,0x80, -}; - -static const BitmapCharRec ch41 = {6,22,-1,5,8,ch41data}; - -/* char: 0x28 '(' */ - -static const GLubyte ch40data[] = { -0x4,0x8,0x10,0x30,0x20,0x60,0x60,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0x60, -0x60,0x20,0x30,0x10,0x8,0x4, -}; - -static const BitmapCharRec ch40 = {6,22,-1,5,8,ch40data}; - -/* char: 0x27 ''' */ - -static const GLubyte ch39data[] = { -0xc0,0x60,0x20,0xe0,0xc0, -}; - -static const BitmapCharRec ch39 = {3,5,-3,-12,8,ch39data}; - -/* char: 0x26 '&' */ - -static const GLubyte ch38data[] = { -0x3c,0x3c,0x7f,0x7e,0xe1,0xe1,0xc0,0xc0,0xc1,0xc0,0xc1,0xa0,0x63,0x20,0x37,0x10, -0x1e,0x18,0xe,0x3e,0xf,0x0,0x1d,0x80,0x18,0xc0,0x18,0x40,0x18,0x40,0xc,0xc0, -0x7,0x80, -}; - -static const BitmapCharRec ch38 = {16,17,-1,0,18,ch38data}; - -/* char: 0x25 '%' */ - -static const GLubyte ch37data[] = { -0x30,0x3c,0x0,0x18,0x72,0x0,0xc,0x61,0x0,0x4,0x60,0x80,0x6,0x60,0x80,0x3, -0x30,0x80,0x1,0x19,0x80,0x1,0x8f,0x0,0x78,0xc0,0x0,0xe4,0x40,0x0,0xc2,0x60, -0x0,0xc1,0x30,0x0,0xc1,0x10,0x0,0x61,0x18,0x0,0x33,0xfc,0x0,0x1e,0xc,0x0, -}; - -static const BitmapCharRec ch37 = {17,16,-1,0,19,ch37data}; - -/* char: 0x24 '$' */ - -static const GLubyte ch36data[] = { -0x4,0x0,0x4,0x0,0x3f,0x0,0xe5,0xc0,0xc4,0xc0,0x84,0x60,0x84,0x60,0x4,0x60, -0x4,0xe0,0x7,0xc0,0x7,0x80,0x1e,0x0,0x3c,0x0,0x74,0x0,0x64,0x0,0x64,0x20, -0x64,0x60,0x34,0xe0,0x1f,0x80,0x4,0x0,0x4,0x0, -}; - -static const BitmapCharRec ch36 = {11,21,0,2,12,ch36data}; - -/* char: 0x23 '#' */ - -static const GLubyte ch35data[] = { -0x22,0x0,0x22,0x0,0x22,0x0,0x22,0x0,0x22,0x0,0xff,0xc0,0xff,0xc0,0x11,0x0, -0x11,0x0,0x11,0x0,0x7f,0xe0,0x7f,0xe0,0x8,0x80,0x8,0x80,0x8,0x80,0x8,0x80, -0x8,0x80, -}; - -static const BitmapCharRec ch35 = {11,17,-1,0,13,ch35data}; - -/* char: 0x22 '"' */ - -static const GLubyte ch34data[] = { -0x88,0xcc,0xcc,0xcc,0xcc, -}; - -static const BitmapCharRec ch34 = {6,5,-1,-12,10,ch34data}; - -/* char: 0x21 '!' */ - -static const GLubyte ch33data[] = { -0xc0,0xc0,0x0,0x0,0x0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0, -0xc0, -}; - -static const BitmapCharRec ch33 = {2,17,-3,0,8,ch33data}; - -/* char: 0x20 ' ' */ - -#ifdef _WIN32 -/* XXX Work around Microsoft OpenGL 1.1 bug where glBitmap with - a height or width of zero does not advance the raster position - as specified by OpenGL. (Cosmo OpenGL does not have this bug.) */ -static const GLubyte ch32data[] = { 0x0 }; -static const BitmapCharRec ch32 = {1,1,0,0,6,ch32data}; -#else -static const BitmapCharRec ch32 = {0,0,0,0,6,0}; -#endif - -static const BitmapCharRec * const chars[] = { -&ch32, -&ch33, -&ch34, -&ch35, -&ch36, -&ch37, -&ch38, -&ch39, -&ch40, -&ch41, -&ch42, -&ch43, -&ch44, -&ch45, -&ch46, -&ch47, -&ch48, -&ch49, -&ch50, -&ch51, -&ch52, -&ch53, -&ch54, -&ch55, -&ch56, -&ch57, -&ch58, -&ch59, -&ch60, -&ch61, -&ch62, -&ch63, -&ch64, -&ch65, -&ch66, -&ch67, -&ch68, -&ch69, -&ch70, -&ch71, -&ch72, -&ch73, -&ch74, -&ch75, -&ch76, -&ch77, -&ch78, -&ch79, -&ch80, -&ch81, -&ch82, -&ch83, -&ch84, -&ch85, -&ch86, -&ch87, -&ch88, -&ch89, -&ch90, -&ch91, -&ch92, -&ch93, -&ch94, -&ch95, -&ch96, -&ch97, -&ch98, -&ch99, -&ch100, -&ch101, -&ch102, -&ch103, -&ch104, -&ch105, -&ch106, -&ch107, -&ch108, -&ch109, -&ch110, -&ch111, -&ch112, -&ch113, -&ch114, -&ch115, -&ch116, -&ch117, -&ch118, -&ch119, -&ch120, -&ch121, -&ch122, -&ch123, -&ch124, -&ch125, -&ch126, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -&ch160, -&ch161, -&ch162, -&ch163, -&ch164, -&ch165, -&ch166, -&ch167, -&ch168, -&ch169, -&ch170, -&ch171, -&ch172, -&ch173, -&ch174, -&ch175, -&ch176, -&ch177, -&ch178, -&ch179, -&ch180, -&ch181, -&ch182, -&ch183, -&ch184, -&ch185, -&ch186, -&ch187, -&ch188, -&ch189, -&ch190, -&ch191, -&ch192, -&ch193, -&ch194, -&ch195, -&ch196, -&ch197, -&ch198, -&ch199, -&ch200, -&ch201, -&ch202, -&ch203, -&ch204, -&ch205, -&ch206, -&ch207, -&ch208, -&ch209, -&ch210, -&ch211, -&ch212, -&ch213, -&ch214, -&ch215, -&ch216, -&ch217, -&ch218, -&ch219, -&ch220, -&ch221, -&ch222, -&ch223, -&ch224, -&ch225, -&ch226, -&ch227, -&ch228, -&ch229, -&ch230, -&ch231, -&ch232, -&ch233, -&ch234, -&ch235, -&ch236, -&ch237, -&ch238, -&ch239, -&ch240, -&ch241, -&ch242, -&ch243, -&ch244, -&ch245, -&ch246, -&ch247, -&ch248, -&ch249, -&ch250, -&ch251, -&ch252, -&ch253, -&ch254, -&ch255, -}; - -#if !defined(__IBMCPP__) -const -#endif -BitmapFontRec glutBitmapTimesRoman24 = { -"-adobe-times-medium-r-normal--24-240-75-75-p-124-iso8859-1", -224, -32, -chars -}; - diff --git a/src/glut/os2/glut_util.cpp b/src/glut/os2/glut_util.cpp deleted file mode 100644 index 2a50a7400e..0000000000 --- a/src/glut/os2/glut_util.cpp +++ /dev/null @@ -1,90 +0,0 @@ - -/* Copyright (c) Mark J. Kilgard, 1994. */ - -/* This program is freely distributable without licensing fees - and is provided without guarantee or warrantee expressed or - implied. This program is -not- in the public domain. */ - -#include -#include -#include -#include - -#include "glutint.h" - -#if !defined(__OS2__) - -/* strdup is actually not a standard ANSI C or POSIX routine - so implement a private one for GLUT. OpenVMS does not have a - strdup; Linux's standard libc doesn't declare strdup by default - (unless BSD or SVID interfaces are requested). */ -char * -__glutStrdup(const char *string) -{ - char *copy; - - copy = (char*) malloc(strlen(string) + 1); - if (copy == NULL) - return NULL; - strcpy(copy, string); - return copy; -} -#endif - -void -__glutWarning(char *format,...) -{ - va_list args; - - va_start(args, format); - fprintf(stderr, "GLUT: Warning in %s: ", - __glutProgramName ? __glutProgramName : "(unamed)"); - vfprintf(stderr, format, args); - va_end(args); - putc('\n', stderr); -} - -/* CENTRY */ -void GLUTAPIENTRY -glutReportErrors(void) -{ - GLenum error; - - while ((error = glGetError()) != GL_NO_ERROR) - __glutWarning("GL error: %s", gluErrorString(error)); -} -/* ENDCENTRY */ - -void -__glutFatalError(char *format,...) -{ - va_list args; - - va_start(args, format); - fprintf(stderr, "GLUT: Fatal Error in %s: ", - __glutProgramName ? __glutProgramName : "(unamed)"); - vfprintf(stderr, format, args); - va_end(args); - putc('\n', stderr); -/* || defined(__OS2__) */ -#if defined(_WIN32) - if (__glutExitFunc) { - __glutExitFunc(1); - } -#endif - exit(1); -} - -void -__glutFatalUsage(char *format,...) -{ - va_list args; - - va_start(args, format); - fprintf(stderr, "GLUT: Fatal API Usage in %s: ", - __glutProgramName ? __glutProgramName : "(unamed)"); - vfprintf(stderr, format, args); - va_end(args); - putc('\n', stderr); - abort(); -} diff --git a/src/glut/os2/glut_vidresize.cpp b/src/glut/os2/glut_vidresize.cpp deleted file mode 100644 index 9f9b6eef58..0000000000 --- a/src/glut/os2/glut_vidresize.cpp +++ /dev/null @@ -1,232 +0,0 @@ - -/* Copyright (c) Mark J. Kilgard, 1996. */ - -/* This program is freely distributable without licensing fees - and is provided without guarantee or warrantee expressed or - implied. This program is -not- in the public domain. */ - -#include - -#ifdef __sgi -#include -#endif - -#include "glutint.h" - -/* Grumble. The IRIX 6.3 and early IRIX 6.4 OpenGL headers - support the video resize extension, but failed to define - GLX_SGIX_video_resize. */ -#if 0 -#ifdef GLX_SYNC_FRAME_SGIX -#define GLX_SGIX_video_resize 1 -#endif -#endif - -#if defined(GLX_VERSION_1_1) && defined(GLX_SGIX_video_resize) -static int canVideoResize = -1; -static int videoResizeChannel; -#else -static int canVideoResize = 0; -#endif -static int videoResizeInUse = 0; -static int dx = -1, dy = -1, dw = -1, dh = -1; - -/* XXX Note that IRIX 6.2, 6.3, and some 6.4 versions have a - bug where programs seg-fault when they attempt video - resizing from an indirect OpenGL context (either local or - over a network). */ - -#if defined(GLX_VERSION_1_1) && defined(GLX_SGIX_video_resize) - -static volatile int errorCaught; - -/* ARGSUSED */ -static int -catchXSGIvcErrors(Display * dpy, XErrorEvent * event) -{ - errorCaught = 1; - return 0; -} -#endif - -/* CENTRY */ - -int GLUTAPIENTRY -glutVideoResizeGet(GLenum param) -{ -#if defined(GLX_VERSION_1_1) && defined(GLX_SGIX_video_resize) - if (canVideoResize < 0) { - canVideoResize = __glutIsSupportedByGLX("GLX_SGIX_video_resize"); - if (canVideoResize) { -#if defined(__sgi) && __sgi - /* This is a hack because IRIX 6.2, 6.3, and some 6.4 - versions were released with GLX_SGIX_video_resize - being advertised by the X server though the video - resize extension is not actually supported. We try to - determine if the libGL.so we are using actually has a - video resize entrypoint before we try to use the - feature. */ - void (*func) (void); - void *glxDso = dlopen("libGL.so", RTLD_LAZY); - - func = (void (*)(void)) dlsym(glxDso, "glXQueryChannelDeltasSGIX"); - if (!func) { - canVideoResize = 0; - } else -#endif - { - char *channelString; - int (*handler) (Display *, XErrorEvent *); - - channelString = getenv("GLUT_VIDEO_RESIZE_CHANNEL"); - videoResizeChannel = channelString ? atoi(channelString) : 0; - - /* Work around another annoying problem with SGI's - GLX_SGIX_video_resize implementation. Early IRIX - 6.4 OpenGL's advertise the extension and have the - video resize API, but an XSGIvc X protocol errors - result trying to use the API. Set up an error - handler to intercept what would otherwise be a fatal - error. If an error was recieved, do not report that - video resize is possible. */ - handler = XSetErrorHandler(catchXSGIvcErrors); - - errorCaught = 0; - -#if defined(GLX_GLXEXT_PROTOTYPES) -#endif - - __glut_glXQueryChannelDeltasSGIX(__glutDisplay, __glutScreen, - videoResizeChannel, &dx, &dy, &dw, &dh); - - /* glXQueryChannelDeltasSGIX is an inherent X server - round-trip so we know we will have gotten either the - correct reply or and error by this time. */ - XSetErrorHandler(handler); - - /* Still yet another work around. In IRIX 6.4 betas, - glXQueryChannelDeltasSGIX will return as if it - succeeded, but the values are filled with junk. - Watch to make sure the delta variables really make - sense. */ - if (errorCaught || - dx < 0 || dy < 0 || dw < 0 || dh < 0 || - dx > 2048 || dy > 2048 || dw > 2048 || dh > 2048) { - canVideoResize = 0; - } - } - } - } -#endif /* GLX_SGIX_video_resize */ - - switch (param) { - case GLUT_VIDEO_RESIZE_POSSIBLE: - return canVideoResize; - case GLUT_VIDEO_RESIZE_IN_USE: - return videoResizeInUse; - case GLUT_VIDEO_RESIZE_X_DELTA: - return dx; - case GLUT_VIDEO_RESIZE_Y_DELTA: - return dy; - case GLUT_VIDEO_RESIZE_WIDTH_DELTA: - return dw; - case GLUT_VIDEO_RESIZE_HEIGHT_DELTA: - return dh; - case GLUT_VIDEO_RESIZE_X: - case GLUT_VIDEO_RESIZE_Y: - case GLUT_VIDEO_RESIZE_WIDTH: - case GLUT_VIDEO_RESIZE_HEIGHT: -#if defined(GLX_VERSION_1_1) && defined(GLX_SGIX_video_resize) - if (videoResizeInUse) { - int x, y, width, height; - - __glut_glXQueryChannelRectSGIX(__glutDisplay, __glutScreen, - videoResizeChannel, &x, &y, &width, &height); - switch (param) { - case GLUT_VIDEO_RESIZE_X: - return x; - case GLUT_VIDEO_RESIZE_Y: - return y; - case GLUT_VIDEO_RESIZE_WIDTH: - return width; - case GLUT_VIDEO_RESIZE_HEIGHT: - return height; - } - } -#endif - return -1; - default: - __glutWarning("invalid glutVideoResizeGet parameter: %d", param); - return -1; - } -} - -void GLUTAPIENTRY -glutSetupVideoResizing(void) -{ -#if defined(GLX_VERSION_1_1) && defined(GLX_SGIX_video_resize) - if (glutVideoResizeGet(GLUT_VIDEO_RESIZE_POSSIBLE)) { - __glut_glXBindChannelToWindowSGIX(__glutDisplay, __glutScreen, - videoResizeChannel, __glutCurrentWindow->win); - videoResizeInUse = 1; - } else -#endif - __glutFatalError("glutEstablishVideoResizing: video resizing not possible.\n"); -} - -void GLUTAPIENTRY -glutStopVideoResizing(void) -{ -#if defined(GLX_VERSION_1_1) && defined(GLX_SGIX_video_resize) - if (glutVideoResizeGet(GLUT_VIDEO_RESIZE_POSSIBLE)) { - if (videoResizeInUse) { - __glut_glXBindChannelToWindowSGIX(__glutDisplay, __glutScreen, - videoResizeChannel, None); - videoResizeInUse = 0; - } - } -#endif -} - -/* ARGSUSED */ -void GLUTAPIENTRY -glutVideoResize(int x, int y, int width, int height) -{ -#if defined(GLX_VERSION_1_1) && defined(GLX_SGIX_video_resize) - if (videoResizeInUse) { -#ifdef GLX_SYNC_SWAP_SGIX - /* glXChannelRectSyncSGIX introduced in a patch to IRIX - 6.2; the original unpatched IRIX 6.2 behavior is always - GLX_SYNC_SWAP_SGIX. */ - __glut_glXChannelRectSyncSGIX(__glutDisplay, __glutScreen, - videoResizeChannel, GLX_SYNC_SWAP_SGIX); -#endif - __glut_glXChannelRectSGIX(__glutDisplay, __glutScreen, - videoResizeChannel, x, y, width, height); - } -#endif -} - -/* ARGSUSED */ -void GLUTAPIENTRY -glutVideoPan(int x, int y, int width, int height) -{ -#if defined(GLX_VERSION_1_1) && defined(GLX_SGIX_video_resize) - if (videoResizeInUse) { -#ifdef GLX_SYNC_FRAME_SGIX - /* glXChannelRectSyncSGIX introduced in a patch to IRIX - 6.2; the original unpatched IRIX 6.2 behavior is always - GLX_SYNC_SWAP_SGIX. We just ignore that we cannot - accomplish GLX_SYNC_FRAME_SGIX on IRIX unpatched 6.2; - this means you'd need a glutSwapBuffers to actually - realize the video resize. */ - __glut_glXChannelRectSyncSGIX(__glutDisplay, __glutScreen, - videoResizeChannel, GLX_SYNC_FRAME_SGIX); -#endif - __glut_glXChannelRectSGIX(__glutDisplay, __glutScreen, - videoResizeChannel, x, y, width, height); - } -#endif -} - -/* ENDCENTRY */ diff --git a/src/glut/os2/glut_warp.cpp b/src/glut/os2/glut_warp.cpp deleted file mode 100644 index 4ef6f7bf39..0000000000 --- a/src/glut/os2/glut_warp.cpp +++ /dev/null @@ -1,29 +0,0 @@ - -/* Copyright (c) Mark J. Kilgard, 1996, 1997. */ - -/* This program is freely distributable without licensing fees - and is provided without guarantee or warrantee expressed or - implied. This program is -not- in the public domain. */ - -#include -#include -#include - -#include "glutint.h" - -/* CENTRY */ -void GLUTAPIENTRY -glutWarpPointer(int x, int y) -{ -// XWarpPointer(__glutDisplay, None, __glutCurrentWindow->win, -// 0, 0, 0, 0, x, y); - POINTL point; - point.x = x; - point.y = y; - WinMapWindowPoints(__glutCurrentWindow->win,HWND_DESKTOP,&point,1); - WinSetPointerPos(HWND_DESKTOP, point.x, point.y); - - XFlush(__glutDisplay); -} - -/* ENDCENTRY */ diff --git a/src/glut/os2/glut_win.cpp b/src/glut/os2/glut_win.cpp deleted file mode 100644 index 63757d7152..0000000000 --- a/src/glut/os2/glut_win.cpp +++ /dev/null @@ -1,1220 +0,0 @@ - -/* Copyright (c) Mark J. Kilgard, 1994, 1997. */ - -/* This program is freely distributable without licensing fees - and is provided without guarantee or warrantee expressed or - implied. This program is -not- in the public domain. */ - -#ifdef __VMS -#include -#endif - -#include -#include -#include -#include -#if defined(__OS2__) -#define POKA 0 - #include "WarpGL.h" - #include "glutos2.h" - #include "glutint.h" - - #include "gl\os2mesa.h" - -// -//define for resource id for main GLUT window, in samples it is defined in GL_TEST.h - #define ID_WINDOW 256 - - int evglSetPixelFormat(int iPixelFormat); - HPS hpsCurrent; - -#elif !defined(_WIN32) - -#include -#include -#endif - -#include "glutint.h" - -GLUTwindow *__glutCurrentWindow = NULL; -GLUTwindow **__glutWindowList = NULL; -int __glutWindowListSize = 0; -#if !defined(_WIN32) && !defined(__OS2__) -GLUTstale *__glutStaleWindowList = NULL; -#endif -GLUTwindow *__glutMenuWindow = NULL; - -void (*__glutFreeOverlayFunc) (GLUToverlay *); -XVisualInfo *(*__glutDetermineVisualFromString) (char *string, Bool * treatAsSingle, - Criterion * requiredCriteria, int nRequired, int requiredMask, void** fbc) = NULL; - -static Criterion requiredWindowCriteria[] = -{ - {LEVEL, EQ, 0}, - {TRANSPARENT, EQ, 0} -}; -static int numRequiredWindowCriteria = sizeof(requiredWindowCriteria) / sizeof(Criterion); -static int requiredWindowCriteriaMask = (1 << LEVEL) | (1 << TRANSPARENT); - -static void -cleanWindowWorkList(GLUTwindow * window) -{ - GLUTwindow **pEntry = &__glutWindowWorkList; - GLUTwindow *entry = __glutWindowWorkList; - - /* Tranverse singly-linked window work list look for the - window. */ - while (entry) { - if (entry == window) { - /* Found it; delete it. */ - *pEntry = entry->prevWorkWin; - return; - } else { - pEntry = &entry->prevWorkWin; - entry = *pEntry; - } - } -} - -#if !defined(_WIN32) && !defined(__OS2PM__) - -static void -cleanStaleWindowList(GLUTwindow * window) -{ - GLUTstale **pEntry = &__glutStaleWindowList; - GLUTstale *entry = __glutStaleWindowList; - - /* Tranverse singly-linked stale window list look for the - window ID. */ - while (entry) { - if (entry->window == window) { - /* Found it; delete it. */ - *pEntry = entry->next; - free(entry); - return; - } else { - pEntry = &entry->next; - entry = *pEntry; - } - } -} - -#endif - -static GLUTwindow *__glutWindowCache = NULL; - -GLUTwindow * -__glutGetWindow(Window win) -{ - int i; - - /* Does win belong to the last window ID looked up? */ - if (__glutWindowCache && (win == __glutWindowCache->win || - (__glutWindowCache->overlay && win == - __glutWindowCache->overlay->win))) { - return - __glutWindowCache; - } - /* Otherwise scan the window list looking for the window ID. */ - for (i = 0; i < __glutWindowListSize; i++) { - if (__glutWindowList[i]) { - if (win == __glutWindowList[i]->win) { - __glutWindowCache = __glutWindowList[i]; - return __glutWindowCache; - } - if (__glutWindowList[i]->overlay) { - if (win == __glutWindowList[i]->overlay->win) { - __glutWindowCache = __glutWindowList[i]; - return __glutWindowCache; - } - } - } - } -#if !defined(_WIN32) && !defined(__OS2PM__) - { - GLUTstale *entry; - - /* Scan through destroyed overlay window IDs for which no - DestroyNotify has yet been received. */ - for (entry = __glutStaleWindowList; entry; entry = entry->next) { - if (entry->win == win) - return entry->window; - } - } -#endif - return NULL; -} - -/* CENTRY */ -int GLUTAPIENTRY -glutGetWindow(void) -{ - if (__glutCurrentWindow) { - return __glutCurrentWindow->num + 1; - } else { - return 0; - } -} -/* ENDCENTRY */ - -void -__glutSetWindow(GLUTwindow * window) -{ - /* It is tempting to try to short-circuit the call to - glXMakeCurrent if we "know" we are going to make current - to a window we are already current to. In fact, this - assumption breaks when GLUT is expected to integrated with - other OpenGL windowing APIs that also make current to - OpenGL contexts. Since glXMakeCurrent short-circuits the - "already bound" case, GLUT avoids the temptation to do so - too. */ - __glutCurrentWindow = window; - - MAKE_CURRENT_LAYER(__glutCurrentWindow); - -#if !defined(_WIN32) && !defined(__OS2__) - /* We should be careful to force a finish between each - iteration through the GLUT main loop if indirect OpenGL - contexts are in use; indirect contexts tend to have much - longer latency because lots of OpenGL extension requests - can queue up in the X protocol stream. We accomplish this - by posting GLUT_FINISH_WORK to be done. */ - if (!__glutCurrentWindow->isDirect) - __glutPutOnWorkList(__glutCurrentWindow, GLUT_FINISH_WORK); -#endif - - /* If debugging is enabled, we'll want to check this window - for any OpenGL errors every iteration through the GLUT - main loop. To accomplish this, we post the - GLUT_DEBUG_WORK to be done on this window. */ - if (__glutDebug) { - __glutPutOnWorkList(__glutCurrentWindow, GLUT_DEBUG_WORK); - } -} - -/* CENTRY */ -void GLUTAPIENTRY -glutSetWindow(int win) -{ - GLUTwindow *window; - - if (win < 1 || win > __glutWindowListSize) { - __glutWarning("glutSetWindow attempted on bogus window."); - return; - } - window = __glutWindowList[win - 1]; - if (!window) { - __glutWarning("glutSetWindow attempted on bogus window."); - return; - } - __glutSetWindow(window); -} -/* ENDCENTRY */ - -static int -getUnusedWindowSlot(void) -{ - int i; - - /* Look for allocated, unused slot. */ - for (i = 0; i < __glutWindowListSize; i++) { - if (!__glutWindowList[i]) { - return i; - } - } - /* Allocate a new slot. */ - __glutWindowListSize++; - if (__glutWindowList) { - __glutWindowList = (GLUTwindow **) - realloc(__glutWindowList, - __glutWindowListSize * sizeof(GLUTwindow *)); - } else { - /* XXX Some realloc's do not correctly perform a malloc - when asked to perform a realloc on a NULL pointer, - though the ANSI C library spec requires this. */ - __glutWindowList = (GLUTwindow **) - malloc(sizeof(GLUTwindow *)); - } - if (!__glutWindowList) - __glutFatalError("out of memory."); - __glutWindowList[__glutWindowListSize - 1] = NULL; - return __glutWindowListSize - 1; -} - -static XVisualInfo * -getVisualInfoCI(unsigned int mode) -{ -#if POKA - static int bufSizeList[] = - {16, 12, 8, 4, 2, 1, 0}; - XVisualInfo *vi; - int list[32]; - int i, n = 0; - - /* Should not be looking at display mode mask if - __glutDisplayString is non-NULL. */ - assert(!__glutDisplayString); - - list[n++] = GLX_BUFFER_SIZE; - list[n++] = 1; - if (GLUT_WIND_IS_DOUBLE(mode)) { - list[n++] = GLX_DOUBLEBUFFER; - } - if (GLUT_WIND_IS_STEREO(mode)) { - list[n++] = GLX_STEREO; - } - if (GLUT_WIND_HAS_DEPTH(mode)) { - list[n++] = GLX_DEPTH_SIZE; - list[n++] = 1; - } - if (GLUT_WIND_HAS_STENCIL(mode)) { - list[n++] = GLX_STENCIL_SIZE; - list[n++] = 1; - } - list[n] = (int) None; /* terminate list */ - - /* glXChooseVisual specify GLX_BUFFER_SIZE prefers the - "smallest index buffer of at least the specified size". - This would be reasonable if GLUT allowed the user to - specify the required buffe size, but GLUT's display mode - is too simplistic (easy to use?). GLUT should try to find - the "largest". So start with a large buffer size and - shrink until we find a matching one that exists. */ - - for (i = 0; bufSizeList[i]; i++) { - /* XXX Assumes list[1] is where GLX_BUFFER_SIZE parameter - is. */ - list[1] = bufSizeList[i]; - vi = glXChooseVisual(__glutDisplay, - __glutScreen, list); - if (vi) - return vi; - } - return NULL; -#else - return - glXChooseVisual(mode); - -#endif -} - -static XVisualInfo * -getVisualInfoRGB(unsigned int mode) -{ -#if POKA - int list[32]; - int n = 0; - - /* Should not be looking at display mode mask if - __glutDisplayString is non-NULL. */ - assert(!__glutDisplayString); - - /* XXX Would a caching mechanism to minize the calls to - glXChooseVisual? You'd have to reference count - XVisualInfo* pointers. Would also have to properly - interact with glutInitDisplayString. */ - - list[n++] = GLX_RGBA; - list[n++] = GLX_RED_SIZE; - list[n++] = 1; - list[n++] = GLX_GREEN_SIZE; - list[n++] = 1; - list[n++] = GLX_BLUE_SIZE; - list[n++] = 1; - if (GLUT_WIND_HAS_ALPHA(mode)) { - list[n++] = GLX_ALPHA_SIZE; - list[n++] = 1; - } - if (GLUT_WIND_IS_DOUBLE(mode)) { - list[n++] = GLX_DOUBLEBUFFER; - } - if (GLUT_WIND_IS_STEREO(mode)) { - list[n++] = GLX_STEREO; - } - if (GLUT_WIND_HAS_DEPTH(mode)) { - list[n++] = GLX_DEPTH_SIZE; - list[n++] = 1; - } - if (GLUT_WIND_HAS_STENCIL(mode)) { - list[n++] = GLX_STENCIL_SIZE; - list[n++] = 1; - } - if (GLUT_WIND_HAS_ACCUM(mode)) { - list[n++] = GLX_ACCUM_RED_SIZE; - list[n++] = 1; - list[n++] = GLX_ACCUM_GREEN_SIZE; - list[n++] = 1; - list[n++] = GLX_ACCUM_BLUE_SIZE; - list[n++] = 1; - if (GLUT_WIND_HAS_ALPHA(mode)) { - list[n++] = GLX_ACCUM_ALPHA_SIZE; - list[n++] = 1; - } - } -#if defined(GLX_VERSION_1_1) && (defined(GLX_SGIS_multisample) || defined(GLX_ARB_multisample)) - if (GLUT_WIND_IS_MULTISAMPLE(mode)) { - if (!__glutIsSupportedByGLX("GLX_SGIS_multisample") && - !__glutIsSupportedByGLX("GLX_ARB_multisample")) - return NULL; -#if defined(GLX_ARB_multisample) - list[n++] = GLX_SAMPLES_ARB; -#elif defined(GLX_SGIS_multisample) - list[n++] = GLX_SAMPLES_SGIS; -#endif - /* XXX Is 4 a reasonable minimum acceptable number of - samples? */ - list[n++] = 4; - } -#endif - list[n] = (int) None; /* terminate list */ - - return glXChooseVisual(__glutDisplay, - __glutScreen, list); -#else /* POKA */ - - return - glXChooseVisual(mode); - -#endif -} - -XVisualInfo * -__glutGetVisualInfo(unsigned int mode) -{ - /* XXX GLUT_LUMINANCE not implemented for GLUT 3.0. */ - if (GLUT_WIND_IS_LUMINANCE(mode)) - return NULL; - - if (GLUT_WIND_IS_RGB(mode)) - return getVisualInfoRGB(mode); - else - return getVisualInfoCI(mode); -} - -XVisualInfo * -__glutDetermineVisual( - unsigned int displayMode, - Bool * treatAsSingle, - XVisualInfo * (getVisualInfo) (unsigned int)) -{ - XVisualInfo *vis; - - /* Should not be looking at display mode mask if - __glutDisplayString is non-NULL. */ - assert(!__glutDisplayString); - - *treatAsSingle = GLUT_WIND_IS_SINGLE(displayMode); - vis = getVisualInfo(displayMode); - if (!vis) { - /* Fallback cases when can't get exactly what was asked - for... */ - if (GLUT_WIND_IS_SINGLE(displayMode)) { - /* If we can't find a single buffered visual, try looking - for a double buffered visual. We can treat a double - buffered visual as a single buffer visual by changing - the draw buffer to GL_FRONT and treating any swap - buffers as no-ops. */ - displayMode |= GLUT_DOUBLE; - vis = getVisualInfo(displayMode); - *treatAsSingle = True; - } - if (!vis && GLUT_WIND_IS_MULTISAMPLE(displayMode)) { - /* If we can't seem to get multisampling (ie, not Reality - Engine class graphics!), go without multisampling. It - is up to the application to query how many multisamples - were allocated (0 equals no multisampling) if the - application is going to use multisampling for more than - just antialiasing. */ - displayMode &= ~GLUT_MULTISAMPLE; - vis = getVisualInfo(displayMode); - } - } - return vis; -} - -static void GLUTCALLBACK -__glutDefaultDisplay(void) -{ - /* XXX Remove the warning after GLUT 3.0. */ - __glutWarning("The following is a new check for GLUT 3.0; update your code."); - __glutFatalError( - "redisplay needed for window %d, but no display callback.", - __glutCurrentWindow->num + 1); -} - -void GLUTCALLBACK -__glutDefaultReshape(int width, int height) -{ - GLUToverlay *overlay; - - /* Adjust the viewport of the window (and overlay if one - exists). */ - MAKE_CURRENT_WINDOW(__glutCurrentWindow); - glViewport(0, 0, (GLsizei) width, (GLsizei) height); - overlay = __glutCurrentWindow->overlay; - if (overlay) { - MAKE_CURRENT_OVERLAY(overlay); - glViewport(0, 0, (GLsizei) width, (GLsizei) height); - } - /* Make sure we are current to the current layer (application - should be able to count on the current layer not changing - unless the application explicitly calls glutUseLayer). */ - MAKE_CURRENT_LAYER(__glutCurrentWindow); -} - -XVisualInfo * -__glutDetermineWindowVisual(Bool * treatAsSingle, Bool * visAlloced, void **fbc) -{ - if (__glutDisplayString) { - - /* __glutDisplayString should be NULL except if - glutInitDisplayString has been called to register a - different display string. Calling glutInitDisplayString - means using a string instead of an integer mask determine - the visual to use. Using the function pointer variable - __glutDetermineVisualFromString below avoids linking in - the code for implementing glutInitDisplayString (ie, - glut_dstr.o) unless glutInitDisplayString gets called by - the application. */ - - assert(__glutDetermineVisualFromString); - *visAlloced = False; - *fbc = NULL; - return __glutDetermineVisualFromString(__glutDisplayString, treatAsSingle, - requiredWindowCriteria, numRequiredWindowCriteria, requiredWindowCriteriaMask, fbc); - } else { - *visAlloced = True; - *fbc = NULL; - return __glutDetermineVisual(__glutDisplayMode, - treatAsSingle, __glutGetVisualInfo); - } -} - -/* ARGSUSED5 */ /* Only Win32 uses gameMode parameter. */ -GLUTwindow * -__glutCreateWindow(GLUTwindow * parent, - int x, int y, int width, int height, int gameMode) -{ - GLUTwindow *window; - XSetWindowAttributes wa; - unsigned long attribMask; - int winnum; - int i; -#if defined(GLX_VERSION_1_1) && defined(GLX_SGIX_fbconfig) - GLXFBConfigSGIX fbc; -#else - void *fbc; -#endif - -#if defined(__OS2PM__) - { - extern HAB hab; /* PM anchor block handle */ - CLASSINFO classinfo; - - if(!WinQueryClassInfo(hab,"GLUT", &classinfo) ) - __glutOpenOS2Connection(NULL); - } -#elif defined(_WIN32) - WNDCLASS wc; - int style; - - if (!GetClassInfo(GetModuleHandle(NULL), "GLUT", &wc)) { - __glutOpenWin32Connection(NULL); - } -#else - if (!__glutDisplay) { - __glutOpenXConnection(NULL); - } -#endif - -#ifndef __OS2PM__ - if (__glutGameModeWindow) { - __glutFatalError("cannot create windows in game mode."); - } -#endif - - winnum = getUnusedWindowSlot(); - window = (GLUTwindow *) malloc(sizeof(GLUTwindow)); - if (!window) { - __glutFatalError("out of memory."); - } - window->num = winnum; - -#if defined(__OS2PM__) - /* Add this new window to the window list. */ - __glutWindowList[winnum] = window; - window->shownState = -1; -#endif - -#if !defined(_WIN32) && !defined(__OS2PM__) - window->vis = __glutDetermineWindowVisual(&window->treatAsSingle, - &window->visAlloced, (void**) &fbc); - if (!window->vis) { - __glutFatalError( - "visual with necessary capabilities not found."); - } - __glutSetupColormap(window->vis, &window->colormap, &window->cmap); -#endif - window->eventMask = StructureNotifyMask | ExposureMask; - - attribMask = CWBackPixmap | CWBorderPixel | CWColormap | CWEventMask; - wa.background_pixmap = None; - wa.border_pixel = 0; - wa.colormap = window->cmap; - wa.event_mask = window->eventMask; - if (parent) { - if (parent->eventMask & GLUT_HACK_STOP_PROPAGATE_MASK) - wa.event_mask |= GLUT_HACK_STOP_PROPAGATE_MASK; - attribMask |= CWDontPropagate; - wa.do_not_propagate_mask = parent->eventMask & GLUT_DONT_PROPAGATE_FILTER_MASK; - } else { - wa.do_not_propagate_mask = 0; - } - - /* Stash width and height before Win32's __glutAdjustCoords - possibly overwrites the values. */ - window->width = width; - window->height = height; - window->forceReshape = True; - window->ignoreKeyRepeat = False; - -#if defined(__OS2PM__) - - { ULONG flStyle=0; - int ii; - ERRORID erridErrorCode;/* last error id code */ - extern HAB hab; /* PM anchor block handle */ - - if (parent) { - flStyle = WS_CLIPCHILDREN|WS_VISIBLE; - } else { - if (gameMode) { - /* Game mode window should be a WS_POPUP window to - ensure that the taskbar is hidden by it. A standard - WS_OVERLAPPEDWINDOW does not hide the task bar. */ - flStyle = FCF_STANDARD | WS_MAXIMIZED; - } else { - /* A standard toplevel window with borders and such. */ - flStyle = FCF_STANDARD | WS_CLIPCHILDREN; -// flStyle = WS_OVERLAPPEDWINDOW; - } - } -{ - HWND hwnd; /* Window */ - ULONG ListBoxId; /* Window id */ - /* (supplied by application) */ - - - HWND hwndClient; /* handle to the client */ - HWND hwndFrame; /* handle to the frame */ - PFNWP GenericWndProc; - FRAMECDATA fcd; - RECTL rect; /* Boundary rectangle */ - - - -/************************************************/ -// flCreate = (FCF_STANDARD) & ~FCF_TASKLIST; -/**********************************/ - if (parent) - { window->frame = NULL; - - hwnd = WinCreateWindow(parent->win, /* Parent window */ - "GLUTCHILD", /* Class name */ - "", /* Window text */ - flStyle, /* Window style */ - x, y, /* Position (x,y) */ - width, height, /* Size (width,height) */ - parent->win, /* Owner window */ - HWND_TOP, /* Sibling window */ - 0, /* Window id */ - NULL, /* Control data */ - NULL); /* Pres parameters */ - - erridErrorCode = WinGetLastError(hab); - window->win = hwnd; - - window->hdc = WinOpenWindowDC(window->win); - window->hpsBuffer = hpsCurrent; - - - rect.xLeft = x; - rect.xRight = x+width; - rect.yBottom = y; - rect.yTop = y + height; - -/***** else parent *****************************/ - } else { - hwnd = WinCreateStdWindow(HWND_DESKTOP, - 0, /* WS_VISIBLE frame-window style */ - &flStyle, /* window style */ - "GLUT", /* class name */ - "GLUT",/* window title */ - 0L, /* default client style */ - NULLHANDLE, /* resource in executable file */ - ID_WINDOW, /* resource id */ - &hwndClient); /* receives client window handle */ - - erridErrorCode = WinGetLastError(hab); - window->win = hwndClient; - window->frame = hwnd; - window->hdc = WinOpenWindowDC(window->win); - - window->hpsBuffer = hpsCurrent; - - -/* converts a client window's boundaries into an equivalent frame rectangle */ - rect.xLeft = x; - rect.xRight = x+width; - rect.yBottom = y; - rect.yTop = y + height; - - /* calculate equivalent frame boundary from boundary data */ - WinCalcFrameRect(window->frame, &rect, FALSE); - } -/***** endof if(parent) *****************************/ - - /* Must set the XHDC for fake glXChooseVisual & fake - glXCreateContext & fake XAllocColorCells. */ - XHDC = window->hdc; - XHWND = window->win; - window->vis = __glutDetermineWindowVisual(&window->treatAsSingle, - &window->visAlloced, &fbc); - if (!window->vis) - { __glutFatalError( - "pixel format with necessary capabilities not found."); - } - { int rc; - rc = wglChoosePixelFormat(window->hdc, window->vis), - -// evglSetPixelFormat(2); /* int iPixelFormat 1 - doublebuffer/2 - single buffer ??*/ - wglSetPixelFormat(window->hdc,rc,window->vis); - } - __glutSetupColormap(window->vis, &window->colormap, &window->cmap); - - window->ctx = glXCreateContext(window->hpsBuffer, window->vis, - None, __glutTryDirect); - - WinSetWindowPos(hwnd, - HWND_TOP,rect.xLeft,rect.yBottom, - rect.xRight-rect.xLeft, rect.yTop-rect.yBottom, - SWP_ACTIVATE | SWP_MOVE | SWP_SIZE | SWP_SHOW|SWP_ZORDER); /* flags*/ - - /* Make sure subwindows get a windowStatus callback. */ - if (parent) - WinPostMsg(parent->win, WM_ACTIVATE, 0, 0); - - } -} - -#elif defined(_WIN32) - - __glutAdjustCoords(parent ? parent->win : NULL, - &x, &y, &width, &height); - if (parent) { - style = WS_CHILD; - } else { - if (gameMode) { - /* Game mode window should be a WS_POPUP window to - ensure that the taskbar is hidden by it. A standard - WS_OVERLAPPEDWINDOW does not hide the task bar. */ - style = WS_POPUP | WS_MAXIMIZE; - } else { - /* A standard toplevel window with borders and such. */ - style = WS_OVERLAPPEDWINDOW; - } - } - window->win = CreateWindow("GLUT", "GLUT", - WS_CLIPSIBLINGS | WS_CLIPCHILDREN | style, - x, y, width, height, parent ? parent->win : __glutRoot, - NULL, GetModuleHandle(NULL), 0); - window->hdc = GetDC(window->win); - /* Must set the XHDC for fake glXChooseVisual & fake - glXCreateContext & fake XAllocColorCells. */ - XHDC = window->hdc; - window->vis = __glutDetermineWindowVisual(&window->treatAsSingle, - &window->visAlloced, &fbc); - if (!window->vis) { - __glutFatalError( - "pixel format with necessary capabilities not found."); - } - if (!SetPixelFormat(window->hdc, - ChoosePixelFormat(window->hdc, window->vis), - window->vis)) { - __glutFatalError("SetPixelFormat failed during window create."); - } - __glutSetupColormap(window->vis, &window->colormap, &window->cmap); - /* Make sure subwindows get a windowStatus callback. */ - if (parent) { - PostMessage(parent->win, WM_ACTIVATE, 0, 0); - } - window->renderDc = window->hdc; -#else - window->win = XCreateWindow(__glutDisplay, - parent == NULL ? __glutRoot : parent->win, - x, y, width, height, 0, - window->vis->depth, InputOutput, window->vis->visual, - attribMask, &wa); -#endif - window->renderWin = window->win; -#if defined(GLX_VERSION_1_1) && defined(GLX_SGIX_fbconfig) - if (fbc) { - window->ctx = __glut_glXCreateContextWithConfigSGIX(__glutDisplay, fbc, - GLX_RGBA_TYPE_SGIX, None, __glutTryDirect); - } else -#endif -#if defined(__OS2PM__) -// window->ctx = glXCreateContext(window->hpsBuffer, window->vis, -// None, __glutTryDirect); -#else - window->ctx = glXCreateContext(__glutDisplay, window->vis, - None, __glutTryDirect); -#endif - if (!window->ctx) { - __glutFatalError( - "failed to create OpenGL rendering context."); - } - window->renderCtx = window->ctx; -#if !defined(_WIN32) && !defined(__OS2PM__) - window->isDirect = glXIsDirect(__glutDisplay, window->ctx); - if (__glutForceDirect) { - if (!window->isDirect) - __glutFatalError("direct rendering not possible."); - } -#endif - - window->parent = parent; - if (parent) { - window->siblings = parent->children; - parent->children = window; - } else { - window->siblings = NULL; - } - window->overlay = NULL; - window->children = NULL; - window->display = __glutDefaultDisplay; - window->reshape = __glutDefaultReshape; - window->mouse = NULL; - window->motion = NULL; - window->passive = NULL; - window->entry = NULL; - window->keyboard = NULL; - window->keyboardUp = NULL; - window->windowStatus = NULL; - window->visibility = NULL; - window->special = NULL; - window->specialUp = NULL; - window->buttonBox = NULL; - window->dials = NULL; - window->spaceMotion = NULL; - window->spaceRotate = NULL; - window->spaceButton = NULL; - window->tabletMotion = NULL; - window->tabletButton = NULL; -#ifdef _WIN32 - window->joystick = NULL; - window->joyPollInterval = 0; -#endif - -#if defined(__OS2PM__) - window->wm_command = NULL; -#endif - - window->tabletPos[0] = -1; - window->tabletPos[1] = -1; -#if defined(__OS2PM__) - if(window->shownState == -1) - window->shownState = 0; - window->visState = window->shownState; -#else - window->shownState = 0; - window->visState = -1; /* not VisibilityUnobscured, - VisibilityPartiallyObscured, or - VisibilityFullyObscured */ -#endif - window->entryState = -1; /* not EnterNotify or LeaveNotify */ - - window->desiredConfMask = 0; - window->buttonUses = 0; - window->cursor = GLUT_CURSOR_INHERIT; - - /* Setup window to be mapped when glutMainLoop starts. */ - window->workMask = GLUT_MAP_WORK; -#ifdef _WIN32 - if (gameMode) { - /* When mapping a game mode window, just show - the window. We have already created the game - mode window with a maximize flag at creation - time. Doing a ShowWindow(window->win, SW_SHOWNORMAL) - would be wrong for a game mode window since it - would unmaximize the window. */ - window->desiredMapState = GameModeState; - } else { - window->desiredMapState = NormalState; - } -#else - window->desiredMapState = NormalState; -#endif - window->prevWorkWin = __glutWindowWorkList; - __glutWindowWorkList = window; - - /* Initially, no menus attached. */ - for (i = 0; i < GLUT_MAX_MENUS; i++) { - window->menu[i] = 0; - } - - /* Add this new window to the window list. */ - __glutWindowList[winnum] = window; - - /* Make the new window the current window. */ - __glutSetWindow(window); - - __glutDetermineMesaSwapHackSupport(); - - if (window->treatAsSingle) { - /* We do this because either the window really is single - buffered (in which case this is redundant, but harmless, - because this is the initial single-buffered context - state); or we are treating a double buffered window as a - single-buffered window because the system does not appear - to export any suitable single- buffered visuals (in which - the following are necessary). */ - glDrawBuffer(GL_FRONT); - glReadBuffer(GL_FRONT); - } - return window; -} - -/* CENTRY */ -int GLUTAPIENTRY -glutCreateWindow(const char *title) -{ - static int firstWindow = 1; - GLUTwindow *window; -#if !defined(_WIN32) && !defined(__OS2__) - XWMHints *wmHints; -#endif - Window win; - XTextProperty textprop; - - if (__glutGameModeWindow) { - __glutFatalError("cannot create windows in game mode."); - } - window = __glutCreateWindow(NULL, - __glutSizeHints.x, __glutSizeHints.y, - __glutInitWidth, __glutInitHeight, - /* not game mode */ 0); - win = window->win; - /* Setup ICCCM properties. */ - textprop.value = (unsigned char *) title; - textprop.encoding = XA_STRING; - textprop.format = 8; - textprop.nitems = strlen(title); -#if defined(__OS2__) - WinSetWindowText(window->frame, (PCSZ)title); - if (__glutIconic) { - window->desiredMapState = IconicState; - } -#elif defined(_WIN32) - SetWindowText(win, title); - if (__glutIconic) { - window->desiredMapState = IconicState; - } -#else - wmHints = XAllocWMHints(); - wmHints->initial_state = - __glutIconic ? IconicState : NormalState; - wmHints->flags = StateHint; - XSetWMProperties(__glutDisplay, win, &textprop, &textprop, - /* Only put WM_COMMAND property on first window. */ - firstWindow ? __glutArgv : NULL, - firstWindow ? __glutArgc : 0, - &__glutSizeHints, wmHints, NULL); - XFree(wmHints); - XSetWMProtocols(__glutDisplay, win, &__glutWMDeleteWindow, 1); -#endif - firstWindow = 0; - return window->num + 1; -} - -#ifdef _WIN32 -int GLUTAPIENTRY -__glutCreateWindowWithExit(const char *title, void (__cdecl *exitfunc)(int)) -{ - __glutExitFunc = exitfunc; - return glutCreateWindow(title); -} -#endif - -int GLUTAPIENTRY -glutCreateSubWindow(int win, int x, int y, int width, int height) -{ - GLUTwindow *window; - - window = __glutCreateWindow(__glutWindowList[win - 1], - x, y, width, height, /* not game mode */ 0); -#if !defined(_WIN32) && !defined(__OS2__) - { - GLUTwindow *toplevel; - - toplevel = __glutToplevelOf(window); - if (toplevel->cmap != window->cmap) { - __glutPutOnWorkList(toplevel, GLUT_COLORMAP_WORK); - } - } -#endif - return window->num + 1; -} -/* ENDCENTRY */ - -void -__glutDestroyWindow(GLUTwindow * window, - GLUTwindow * initialWindow) -{ - GLUTwindow **prev, *cur, *parent, *siblings; - - /* Recursively destroy any children. */ - cur = window->children; - while (cur) { - siblings = cur->siblings; - __glutDestroyWindow(cur, initialWindow); - cur = siblings; - } - /* Remove from parent's children list (only necessary for - non-initial windows and subwindows!). */ - parent = window->parent; - if (parent && parent == initialWindow->parent) { - prev = &parent->children; - cur = parent->children; - while (cur) { - if (cur == window) { - *prev = cur->siblings; - break; - } - prev = &(cur->siblings); - cur = cur->siblings; - } - } - /* Unbind if bound to this window. */ - if (window == __glutCurrentWindow) { - UNMAKE_CURRENT(); - __glutCurrentWindow = NULL; - } - /* Begin tearing down window itself. */ - if (window->overlay) { - __glutFreeOverlayFunc(window->overlay); - } - XDestroyWindow(__glutDisplay, window->win); - glXDestroyContext(__glutDisplay, window->ctx); - if (window->colormap) { - /* Only color index windows have colormap data structure. */ - __glutFreeColormap(window->colormap); - } - /* NULLing the __glutWindowList helps detect is a window - instance has been destroyed, given a window number. */ - __glutWindowList[window->num] = NULL; - - /* Cleanup data structures that might contain window. */ - cleanWindowWorkList(window); -#if !defined(_WIN32) && !defined(__OS2__) - cleanStaleWindowList(window); -#endif - /* Remove window from the "get window cache" if it is there. */ - if (__glutWindowCache == window) - __glutWindowCache = NULL; - - if (window->visAlloced) { - /* Only free XVisualInfo* gotten from glXChooseVisual. */ - XFree(window->vis); - } - - if (window == __glutGameModeWindow) { - /* Destroying the game mode window should implicitly - have GLUT leave game mode. */ - __glutCloseDownGameMode(); - } - - free(window); -} - -/* CENTRY */ -void GLUTAPIENTRY -glutDestroyWindow(int win) -{ - GLUTwindow *window = __glutWindowList[win - 1]; - - if (__glutMappedMenu && __glutMenuWindow == window) { - __glutFatalUsage("destroying menu window not allowed while menus in use"); - } -#if !defined(_WIN32) && !defined(__OS2__) - /* If not a toplevel window... */ - if (window->parent) { - /* Destroying subwindows may change colormap requirements; - recalculate toplevel window's WM_COLORMAP_WINDOWS - property. */ - __glutPutOnWorkList(__glutToplevelOf(window->parent), - GLUT_COLORMAP_WORK); - } -#endif - __glutDestroyWindow(window, window); - XFlush(__glutDisplay); -} -/* ENDCENTRY */ - -void -__glutChangeWindowEventMask(long eventMask, Bool add) -{ - if (add) { - /* Add eventMask to window's event mask. */ - if ((__glutCurrentWindow->eventMask & eventMask) != - eventMask) { - __glutCurrentWindow->eventMask |= eventMask; - __glutPutOnWorkList(__glutCurrentWindow, - GLUT_EVENT_MASK_WORK); - } - } else { - /* Remove eventMask from window's event mask. */ - if (__glutCurrentWindow->eventMask & eventMask) { - __glutCurrentWindow->eventMask &= ~eventMask; - __glutPutOnWorkList(__glutCurrentWindow, - GLUT_EVENT_MASK_WORK); - } - } -} - -void GLUTAPIENTRY -glutDisplayFunc(GLUTdisplayCB displayFunc) -{ - /* XXX Remove the warning after GLUT 3.0. */ - if (!displayFunc) - __glutFatalError("NULL display callback not allowed in GLUT 3.0; update your code."); - __glutCurrentWindow->display = displayFunc; -} - -void GLUTAPIENTRY -glutMouseFunc(GLUTmouseCB mouseFunc) -{ - if (__glutCurrentWindow->mouse) { - if (!mouseFunc) { - /* Previous mouseFunc being disabled. */ - __glutCurrentWindow->buttonUses--; - __glutChangeWindowEventMask( - ButtonPressMask | ButtonReleaseMask, - __glutCurrentWindow->buttonUses > 0); - } - } else { - if (mouseFunc) { - /* Previously no mouseFunc, new one being installed. */ - __glutCurrentWindow->buttonUses++; - __glutChangeWindowEventMask( - ButtonPressMask | ButtonReleaseMask, True); - } - } - __glutCurrentWindow->mouse = mouseFunc; -} - -void GLUTAPIENTRY -glutMotionFunc(GLUTmotionCB motionFunc) -{ - /* Hack. Some window managers (4Dwm by default) will mask - motion events if the client is not selecting for button - press and release events. So we select for press and - release events too (being careful to use reference - counting). */ - if (__glutCurrentWindow->motion) { - if (!motionFunc) { - /* previous mouseFunc being disabled */ - __glutCurrentWindow->buttonUses--; - __glutChangeWindowEventMask( - ButtonPressMask | ButtonReleaseMask, - __glutCurrentWindow->buttonUses > 0); - } - } else { - if (motionFunc) { - /* Previously no mouseFunc, new one being installed. */ - __glutCurrentWindow->buttonUses++; - __glutChangeWindowEventMask( - ButtonPressMask | ButtonReleaseMask, True); - } - } - /* Real work of selecting for passive mouse motion. */ - __glutChangeWindowEventMask( - Button1MotionMask | Button2MotionMask | Button3MotionMask, - motionFunc != NULL); - __glutCurrentWindow->motion = motionFunc; -} - -void GLUTAPIENTRY -glutPassiveMotionFunc(GLUTpassiveCB passiveMotionFunc) -{ - __glutChangeWindowEventMask(PointerMotionMask, - passiveMotionFunc != NULL); - - /* Passive motion also requires watching enters and leaves so - that a fake passive motion event can be generated on an - enter. */ - __glutChangeWindowEventMask(EnterWindowMask | LeaveWindowMask, - __glutCurrentWindow->entry != NULL || passiveMotionFunc != NULL); - - __glutCurrentWindow->passive = passiveMotionFunc; -} - -void GLUTAPIENTRY -glutEntryFunc(GLUTentryCB entryFunc) -{ - __glutChangeWindowEventMask(EnterWindowMask | LeaveWindowMask, - entryFunc != NULL || __glutCurrentWindow->passive); - __glutCurrentWindow->entry = entryFunc; - if (!entryFunc) { - __glutCurrentWindow->entryState = -1; - } -} - -void GLUTAPIENTRY -glutWindowStatusFunc(GLUTwindowStatusCB windowStatusFunc) -{ - __glutChangeWindowEventMask(VisibilityChangeMask, - windowStatusFunc != NULL); - __glutCurrentWindow->windowStatus = windowStatusFunc; - if (!windowStatusFunc) { - /* Make state invalid. */ - __glutCurrentWindow->visState = -1; - } -} - -static void GLUTCALLBACK -visibilityHelper(int status) -{ - if (status == GLUT_HIDDEN || status == GLUT_FULLY_COVERED) - __glutCurrentWindow->visibility(GLUT_NOT_VISIBLE); - else - __glutCurrentWindow->visibility(GLUT_VISIBLE); -} - - -void GLUTAPIENTRY -glutVisibilityFunc(GLUTvisibilityCB visibilityFunc) -{ - __glutCurrentWindow->visibility = visibilityFunc; - - if (visibilityFunc) - { glutWindowStatusFunc(visibilityHelper); -#if defined(__OS2PM__) - if(__glutCurrentWindow->shownState >= 0) - { visibilityHelper(__glutCurrentWindow->shownState); - } -#endif - } - else - glutWindowStatusFunc(NULL); -} - -void GLUTAPIENTRY -glutReshapeFunc(GLUTreshapeCB reshapeFunc) -{ - if (reshapeFunc) { - __glutCurrentWindow->reshape = reshapeFunc; - } else { - __glutCurrentWindow->reshape = __glutDefaultReshape; - } -} diff --git a/src/glut/os2/glut_winmisc.cpp b/src/glut/os2/glut_winmisc.cpp deleted file mode 100644 index 7cd6699924..0000000000 --- a/src/glut/os2/glut_winmisc.cpp +++ /dev/null @@ -1,126 +0,0 @@ - -/* Copyright (c) Mark J. Kilgard, 1994. */ - -/* This program is freely distributable without licensing fees - and is provided without guarantee or warrantee expressed or - implied. This program is -not- in the public domain. */ - - -#include -#include -#include -#include - - -#include "glutint.h" - -/* CENTRY */ -void GLUTAPIENTRY -glutSetWindowTitle(const char *title) -{ -#if defined(__OS2PM__) - __glutSetWindowText(__glutCurrentWindow->win, (char *)title); - -#else - XTextProperty textprop; - - assert(!__glutCurrentWindow->parent); - IGNORE_IN_GAME_MODE(); - textprop.value = (unsigned char *) title; - textprop.encoding = XA_STRING; - textprop.format = 8; - textprop.nitems = strlen(title); - XSetWMName(__glutDisplay, - __glutCurrentWindow->win, &textprop); - XFlush(__glutDisplay); -#endif -} - -void GLUTAPIENTRY -glutSetIconTitle(const char *title) -{ -#if defined(__OS2PM__) -//todo ? -#else - - XTextProperty textprop; - - assert(!__glutCurrentWindow->parent); - IGNORE_IN_GAME_MODE(); - textprop.value = (unsigned char *) title; - textprop.encoding = XA_STRING; - textprop.format = 8; - textprop.nitems = strlen(title); - XSetWMIconName(__glutDisplay, - __glutCurrentWindow->win, &textprop); - XFlush(__glutDisplay); -#endif -} - -void GLUTAPIENTRY -glutPositionWindow(int x, int y) -{ - IGNORE_IN_GAME_MODE(); - __glutCurrentWindow->desiredX = x; - __glutCurrentWindow->desiredY = y; - __glutCurrentWindow->desiredConfMask |= CWX | CWY; - __glutPutOnWorkList(__glutCurrentWindow, GLUT_CONFIGURE_WORK); -} - -void GLUTAPIENTRY -glutReshapeWindow(int w, int h) -{ - IGNORE_IN_GAME_MODE(); - if (w <= 0 || h <= 0) - __glutWarning("glutReshapeWindow: non-positive width or height not allowed"); - - __glutCurrentWindow->desiredWidth = w; - __glutCurrentWindow->desiredHeight = h; - __glutCurrentWindow->desiredConfMask |= CWWidth | CWHeight; - __glutPutOnWorkList(__glutCurrentWindow, GLUT_CONFIGURE_WORK); -} - -void GLUTAPIENTRY -glutPopWindow(void) -{ - IGNORE_IN_GAME_MODE(); - __glutCurrentWindow->desiredStack = Above; - __glutCurrentWindow->desiredConfMask |= CWStackMode; - __glutPutOnWorkList(__glutCurrentWindow, GLUT_CONFIGURE_WORK); -} - -void GLUTAPIENTRY -glutPushWindow(void) -{ - IGNORE_IN_GAME_MODE(); - __glutCurrentWindow->desiredStack = Below; - __glutCurrentWindow->desiredConfMask |= CWStackMode; - __glutPutOnWorkList(__glutCurrentWindow, GLUT_CONFIGURE_WORK); -} - -void GLUTAPIENTRY -glutIconifyWindow(void) -{ - IGNORE_IN_GAME_MODE(); - assert(!__glutCurrentWindow->parent); - __glutCurrentWindow->desiredMapState = IconicState; - __glutPutOnWorkList(__glutCurrentWindow, GLUT_MAP_WORK); -} - -void GLUTAPIENTRY -glutShowWindow(void) -{ - IGNORE_IN_GAME_MODE(); - __glutCurrentWindow->desiredMapState = NormalState; - __glutPutOnWorkList(__glutCurrentWindow, GLUT_MAP_WORK); -} - -void GLUTAPIENTRY -glutHideWindow(void) -{ - IGNORE_IN_GAME_MODE(); - __glutCurrentWindow->desiredMapState = WithdrawnState; - __glutPutOnWorkList(__glutCurrentWindow, GLUT_MAP_WORK); -} - -/* ENDCENTRY */ diff --git a/src/glut/os2/glutbitmap.h b/src/glut/os2/glutbitmap.h deleted file mode 100644 index 9584bb129d..0000000000 --- a/src/glut/os2/glutbitmap.h +++ /dev/null @@ -1,32 +0,0 @@ -#ifndef __glutbitmap_h__ -#define __glutbitmap_h__ - -/* Copyright (c) Mark J. Kilgard, 1994, 1998. */ - -/* This program is freely distributable without licensing fees - and is provided without guarantee or warrantee expressed or - implied. This program is -not- in the public domain. */ - -#define GLUT_NO_LIB_PRAGMA /* Avoid auto library linking when building - the GLUT library itself. */ -#include - -typedef struct { - const GLsizei width; - const GLsizei height; - const GLfloat xorig; - const GLfloat yorig; - const GLfloat advance; - const GLubyte *bitmap; -} BitmapCharRec, *BitmapCharPtr; - -typedef struct { - const char *name; - const int num_chars; - const int first; - const BitmapCharRec * const *ch; -} BitmapFontRec, *BitmapFontPtr; - -typedef void *GLUTbitmapFont; - -#endif /* __glutbitmap_h__ */ diff --git a/src/glut/os2/glutos2.h b/src/glut/os2/glutos2.h deleted file mode 100644 index 533a78011e..0000000000 --- a/src/glut/os2/glutos2.h +++ /dev/null @@ -1,36 +0,0 @@ -#ifndef __glutos2_h__ -#define __glutos2_h__ - - -/* Win32 "equivalent" cursors - eventually, the X glyphs should be - converted to Win32 cursors -- then they will look the same */ -#define XC_arrow IDC_ARROW -#define XC_top_left_arrow IDC_ARROW -#define XC_hand1 IDC_SIZEALL -#define XC_pirate IDC_NO -#define XC_question_arrow IDC_HELP -#define XC_exchange IDC_NO -#define XC_spraycan IDC_SIZEALL -#define XC_watch IDC_WAIT -#define XC_xterm IDC_IBEAM -#define XC_crosshair IDC_CROSS -#define XC_sb_v_double_arrow IDC_SIZENS -#define XC_sb_h_double_arrow IDC_SIZEWE -#define XC_top_side IDC_UPARROW -#define XC_bottom_side IDC_SIZENS -#define XC_left_side IDC_SIZEWE -#define XC_right_side IDC_SIZEWE -#define XC_top_left_corner IDC_SIZENWSE -#define XC_top_right_corner IDC_SIZENESW -#define XC_bottom_right_corner IDC_SIZENWSE -#define XC_bottom_left_corner IDC_SIZENESW - -#define XA_STRING 0 - -/* Private routines from win32_util.c */ -extern int gettimeofday(struct timeval* tp, void* tzp); -//extern void *__glutFont(void *font); -extern int __glutGetTransparentPixel(Display *dpy, XVisualInfo *vinfo); -extern void __glutAdjustCoords(Window parent, int *x, int *y, int *width, int *height); - -#endif /* __glutos2_h__ */ diff --git a/src/glut/os2/glutstroke.h b/src/glut/os2/glutstroke.h deleted file mode 100644 index cbc9e156fe..0000000000 --- a/src/glut/os2/glutstroke.h +++ /dev/null @@ -1,42 +0,0 @@ -#ifndef __glutstroke_h__ -#define __glutstroke_h__ - -/* Copyright (c) Mark J. Kilgard, 1994. */ - -/* This program is freely distributable without licensing fees - and is provided without guarantee or warrantee expressed or - implied. This program is -not- in the public domain. */ - -#if defined(_WIN32) -#pragma warning (disable:4244) /* disable bogus conversion warnings */ -#pragma warning (disable:4305) /* VC++ 5.0 version of above warning. */ -#endif - -typedef struct { - float x; - float y; -} CoordRec, *CoordPtr; - -typedef struct { - int num_coords; - const CoordRec *coord; -} StrokeRec, *StrokePtr; - -typedef struct { - int num_strokes; - const StrokeRec *stroke; - float center; - float right; -} StrokeCharRec, *StrokeCharPtr; - -typedef struct { - const char *name; - int num_chars; - const StrokeCharRec *ch; - float top; - float bottom; -} StrokeFontRec, *StrokeFontPtr; - -typedef void *GLUTstrokeFont; - -#endif /* __glutstroke_h__ */ diff --git a/src/glut/os2/layerutil.h b/src/glut/os2/layerutil.h deleted file mode 100644 index 3f62031939..0000000000 --- a/src/glut/os2/layerutil.h +++ /dev/null @@ -1,59 +0,0 @@ -#ifndef __layerutil_h__ -#define __layerutil_h__ - -/* Copyright (c) Mark J. Kilgard, 1993, 1994. */ - -/* This program is freely distributable without licensing fees - and is provided without guarantee or warrantee expressed or - implied. This program is -not- in the public domain. */ - -/* Based on XLayerUtil.h: Revision: 1.3 */ - -#ifdef __VMS -#include -#endif - -#if !defined(_WIN32) && !defined(__OS2__) -#include -#include -#include -#endif /* !_WIN32 */ - -/* Transparent type values */ -/* None 0 */ -#define TransparentPixel 1 -#define TransparentMask 2 - -/* layered visual info template flags */ -#define VisualLayerMask 0x200 -#define VisualTransparentType 0x400 -#define VisualTransparentValue 0x800 -#define VisualAllLayerMask 0xFFF - -/* layered visual info structure */ -typedef struct _XLayerVisualInfo { - XVisualInfo vinfo; - long layer; - long type; - unsigned long value; -} XLayerVisualInfo; - -/* SERVER_OVERLAY_VISUALS property element */ -typedef struct _OverlayInfo { - /* Avoid 64-bit portability problems by being careful to use - longs due to the way XGetWindowProperty is specified. Note - that these parameters are passed as CARD32s over X - protocol. */ - long overlay_visual; - long transparent_type; - long value; - long layer; -} OverlayInfo; - -extern int __glutGetTransparentPixel(Display *, XVisualInfo *); -extern XLayerVisualInfo *__glutXGetLayerVisualInfo(Display *, - long, XLayerVisualInfo *, int *); -extern Status __glutXMatchLayerVisualInfo(Display *, - int, int, int, int, XLayerVisualInfo *); - -#endif /* __layerutil_h__ */ diff --git a/src/glut/os2/libGlut.DEF b/src/glut/os2/libGlut.DEF deleted file mode 100644 index a0e184eef0..0000000000 --- a/src/glut/os2/libGlut.DEF +++ /dev/null @@ -1,94 +0,0 @@ - -;----------------------------------------------------- -; def Module definition file for the DLL -;----------------------------------------------------- - -LIBRARY libGlut INITINSTANCE TERMINSTANCE -PROTMODE -DATA MULTIPLE NONSHARED READWRITE LOADONCALL -CODE LOADONCALL -EXPORTS ; Names of exported functions and data - -;********************************* -;MesaGLUT - glutCommandFunc @3001 - glutCreateWindow @3002 - glutCreateSubWindow @3003 - glutDestroyWindow @3004 - glutDisplayFunc @3005 - glutEntryFunc @3006 - glutExtensionSupported @3007 - glutIdleFunc @3008 - glutInit @3009 - glutInitDisplayMode @3010 - glutInitWindowPosition @3011 - glutInitWindowSize @3012 - glutMainLoop @3013 - glutGet @3014 - glutGetColor @3015 - glutGetWindow @3016 - glutKeyboardFunc @3017 - glutMouseFunc @3018 - glutSpecialFunc @3019 - glutStrokeCharacter @3020 - glutSetColor @3021 - glutSetIconTitle @3022 - glutSetWindow @3023 - glutSetWindowTitle @3024 - - glutReshapeFunc @3025 - glutReshapeWindow @3026 - - - glutSwapBuffers @3027 - glutPostRedisplay @3028 - glutPositionWindow @3029 - glutVisibilityFunc @3030 - glutTimerFunc @3031 - glutMotionFunc @3032 - - glutCreateMenu @3033 - glutAttachMenu @3034 - glutDestroyMenu @3035 - glutAddMenuEntry @3036 - glutPassiveMotionFunc @3037 - - glutSolidCone @3038 - glutSolidCube @3039 - glutSolidDodecahedron @3040 - glutSolidOctahedron @3041 - glutSolidIcosahedron @3042 - glutSolidSphere @3043 - glutSolidTeapot @3044 - glutSolidTetrahedron @3045 - glutSolidTorus @3046 - - glutWireCone @3047 - glutWireCube @3048 - glutWireDodecahedron @3049 - glutWireIcosahedron @3050 - glutWireOctahedron @3051 - glutWireSphere @3052 - glutWireTetrahedron @3053 - glutWireTorus @3054 - glutWireTeapot @3055 - -;GL_GLEXT_PROTOTYPES - glutBitmapCharacter @3101 - glutBitmap9By15 @3102 - glutBitmapHelvetica10 @3103 - glutBitmapHelvetica12 @3104 - glutBitmapHelvetica18 @3105 - glutBitmapTimesRoman24 @3106 - glutStrokeRoman @3107 - glutBitmap8By13 @3108 - -;Global constants -; hab @12001 -; /* PM anchor block handle */ -; hpsCurrent @12002 - XHDC @12004 - XHWND @12005 - - - diff --git a/src/glut/os2/os2_glx.cpp b/src/glut/os2/os2_glx.cpp deleted file mode 100644 index bf116e49c9..0000000000 --- a/src/glut/os2/os2_glx.cpp +++ /dev/null @@ -1,145 +0,0 @@ -/* os2_glx.c */ - -#include -#include -#include -#include "gl/gl.h" -#include "WarpGL.h" -#include "GL/os2mesa.h" - -#define POKA 0 -/* global current HDC */ - -XVisualInfo *wglDescribePixelFormat(int iPixelFormat); - -extern HDC XHDC; -extern HWND XHWND; -//extern HPS hpsCurrent; -extern HAB hab; /* PM anchor block handle */ - -GLXContext -glXCreateContext(HPS hps, XVisualInfo * visinfo, - GLXContext share, Bool direct) -{ - /* KLUDGE: GLX really expects a display pointer to be passed - in as the first parameter, but Win32 needs an HDC instead, - so BE SURE that the global XHDC is set before calling this - routine. */ - HGLRC context; - - context = wglCreateContext(XHDC,hps,hab); - - - /* Since direct rendering is implicit, the direct flag is - ignored. */ - - return context; -} - - -int -glXGetConfig(XVisualInfo * visual, int attrib, int *value) -{ - if (!visual) - return GLX_BAD_VISUAL; - - switch (attrib) { - case GLX_USE_GL: - if (visual->dwFlags & (PFD_SUPPORT_OPENGL | PFD_DRAW_TO_WINDOW)) { - /* XXX Brad's Matrix Millenium II has problems creating - color index windows in 24-bit mode (lead to GDI crash) - and 32-bit mode (lead to black window). The cColorBits - filed of the PIXELFORMATDESCRIPTOR returned claims to - have 24 and 32 bits respectively of color indices. 2^24 - and 2^32 are ridiculously huge writable colormaps. - Assume that if we get back a color index - PIXELFORMATDESCRIPTOR with 24 or more bits, the - PIXELFORMATDESCRIPTOR doesn't really work and skip it. - -mjk */ - if (visual->iPixelType == PFD_TYPE_COLORINDEX - && visual->cColorBits >= 24) { - *value = 0; - } else { - *value = 1; - } - } else { - *value = 0; - } - break; - case GLX_BUFFER_SIZE: - /* KLUDGE: if we're RGBA, return the number of bits/pixel, - otherwise, return 8 (we guessed at 256 colors in CI - mode). */ - if (visual->iPixelType == PFD_TYPE_RGBA) - *value = visual->cColorBits; - else - *value = 8; - break; - case GLX_LEVEL: - /* The bReserved flag of the pfd contains the - overlay/underlay info. */ - *value = visual->bReserved; - break; - case GLX_RGBA: - *value = visual->iPixelType == PFD_TYPE_RGBA; - break; - case GLX_DOUBLEBUFFER: - *value = visual->dwFlags & PFD_DOUBLEBUFFER; - break; - case GLX_STEREO: - *value = visual->dwFlags & PFD_STEREO; - break; - case GLX_AUX_BUFFERS: - *value = visual->cAuxBuffers; - break; - case GLX_RED_SIZE: - *value = visual->cRedBits; - break; - case GLX_GREEN_SIZE: - *value = visual->cGreenBits; - break; - case GLX_BLUE_SIZE: - *value = visual->cBlueBits; - break; - case GLX_ALPHA_SIZE: - *value = visual->cAlphaBits; - break; - case GLX_DEPTH_SIZE: - *value = visual->cDepthBits; - break; - case GLX_STENCIL_SIZE: - *value = visual->cStencilBits; - break; - case GLX_ACCUM_RED_SIZE: - *value = visual->cAccumRedBits; - break; - case GLX_ACCUM_GREEN_SIZE: - *value = visual->cAccumGreenBits; - break; - case GLX_ACCUM_BLUE_SIZE: - *value = visual->cAccumBlueBits; - break; - case GLX_ACCUM_ALPHA_SIZE: - *value = visual->cAccumAlphaBits; - break; -#if POKA == 100 -#endif /* POKA == 100 */ - default: - return GLX_BAD_ATTRIB; - } - return 0; -} - - -XVisualInfo * glXChooseVisual(int mode) -{ int imode = 2; - if(mode & GLUT_DOUBLE) - imode = 1; - return - wglDescribePixelFormat(imode); -} - - -#if POKA -#endif /* POKA */ - diff --git a/src/glut/os2/os2_menu.cpp b/src/glut/os2/os2_menu.cpp deleted file mode 100644 index f140e9c79b..0000000000 --- a/src/glut/os2/os2_menu.cpp +++ /dev/null @@ -1,532 +0,0 @@ - -/* Copyright (c) Mark J. Kilgard, 1994, 1997, 1998. */ -/* Copyright (c) Nate Robins, 1997. */ - -/* This program is freely distributable without licensing fees - and is provided without guarantee or warrantee expressed or - implied. This program is -not- in the public domain. */ - -/* This file completely re-implements glut_menu.c and glut_menu2.c - for Win32. Note that neither glut_menu.c nor glut_menu2.c are - compiled into Win32 GLUT. */ - -#include -#include -#include -#include -#include - -#include "glutint.h" - -void (GLUTCALLBACK *__glutMenuStatusFunc) (int, int, int); -//GLUTmenu *__glutMappedMenu; -//GLUTwindow *__glutMenuWindow; -GLUTmenuItem *__glutItemSelected; -unsigned __glutMenuButton; - -static GLUTmenu **menuList = NULL; -static int menuListSize = 0; -static UINT uniqueMenuHandler = 1; - -/* DEPRICATED, use glutMenuStatusFunc instead. */ -void GLUTAPIENTRY -glutMenuStateFunc(GLUTmenuStateCB menuStateFunc) -{ - __glutMenuStatusFunc = (GLUTmenuStatusCB) menuStateFunc; -} - -void GLUTAPIENTRY -glutMenuStatusFunc(GLUTmenuStatusCB menuStatusFunc) -{ - __glutMenuStatusFunc = menuStatusFunc; -} - -void -__glutSetMenu(GLUTmenu * menu) -{ - __glutCurrentMenu = menu; -} - -static void -unmapMenu(GLUTmenu * menu) -{ - if (menu->cascade) { - unmapMenu(menu->cascade); - menu->cascade = NULL; - } - menu->anchor = NULL; - menu->highlighted = NULL; -} - -void -__glutFinishMenu(Window win, int x, int y) -{ - - unmapMenu(__glutMappedMenu); - - /* XXX Put in a GdiFlush just in case. Probably unnecessary. -mjk */ -// GdiFlush(); - - if (__glutMenuStatusFunc) { - __glutSetWindow(__glutMenuWindow); - __glutSetMenu(__glutMappedMenu); - - /* Setting __glutMappedMenu to NULL permits operations that - change menus or destroy the menu window again. */ - __glutMappedMenu = NULL; - - __glutMenuStatusFunc(GLUT_MENU_NOT_IN_USE, x, y); - } - /* Setting __glutMappedMenu to NULL permits operations that - change menus or destroy the menu window again. */ - __glutMappedMenu = NULL; - - /* If an item is selected and it is not a submenu trigger, - generate menu callback. */ - if (__glutItemSelected && !__glutItemSelected->isTrigger) { - __glutSetWindow(__glutMenuWindow); - /* When menu callback is triggered, current menu should be - set to the callback menu. */ - __glutSetMenu(__glutItemSelected->menu); - __glutItemSelected->menu->select(__glutItemSelected->value); - } - __glutMenuWindow = NULL; -} - -static void -mapMenu(GLUTmenu * menu, int x, int y) -{ -//todo -// TrackPopupMenu((HMENU) menu->win, TPM_LEFTALIGN | -// (__glutMenuButton == TPM_RIGHTBUTTON) ? TPM_RIGHTBUTTON : TPM_LEFTBUTTON, -// x, y, 0, __glutCurrentWindow->win, NULL); -} - -void -__glutStartMenu(GLUTmenu * menu, GLUTwindow * window, - int x, int y, int x_win, int y_win) -{ - assert(__glutMappedMenu == NULL); - __glutMappedMenu = menu; - __glutMenuWindow = window; - __glutItemSelected = NULL; - if (__glutMenuStatusFunc) { - __glutSetMenu(menu); - __glutSetWindow(window); - __glutMenuStatusFunc(GLUT_MENU_IN_USE, x_win, y_win); - } - mapMenu(menu, x, y); -} - -GLUTmenuItem * -__glutGetUniqueMenuItem(GLUTmenu * menu, UINT unique) -{ - GLUTmenuItem *item; - int i; - - i = menu->num; - item = menu->list; - while (item) { - if (item->unique == unique) { - return item; - } - if (item->isTrigger) { - GLUTmenuItem *subitem; - subitem = __glutGetUniqueMenuItem(menuList[item->value], unique); - if (subitem) { - return subitem; - } - } - i--; - item = item->next; - } - return NULL; -} - -GLUTmenuItem * -__glutGetMenuItem(GLUTmenu * menu, Window win, int *which) -{ - GLUTmenuItem *item; - int i; - - i = menu->num; - item = menu->list; - while (item) { - if (item->win == win) { - *which = i; - return item; - } - if (item->isTrigger) { - GLUTmenuItem *subitem; - - subitem = __glutGetMenuItem(menuList[item->value], - win, which); - if (subitem) { - return subitem; - } - } - i--; - item = item->next; - } - return NULL; -} - -GLUTmenu * -__glutGetMenu(Window win) -{ - GLUTmenu *menu; - - menu = __glutMappedMenu; - while (menu) { - if (win == menu->win) { - return menu; - } - menu = menu->cascade; - } - return NULL; -} - -GLUTmenu * -__glutGetMenuByNum(int menunum) -{ - if (menunum < 1 || menunum > menuListSize) { - return NULL; - } - return menuList[menunum - 1]; -} - -static int -getUnusedMenuSlot(void) -{ - int i; - - /* Look for allocated, unused slot. */ - for (i = 0; i < menuListSize; i++) { - if (!menuList[i]) { - return i; - } - } - /* Allocate a new slot. */ - menuListSize++; - if (menuList) { - menuList = (GLUTmenu **) - realloc(menuList, menuListSize * sizeof(GLUTmenu *)); - } else { - /* XXX Some realloc's do not correctly perform a malloc - when asked to perform a realloc on a NULL pointer, - though the ANSI C library spec requires this. */ - menuList = (GLUTmenu **) malloc(sizeof(GLUTmenu *)); - } - if (!menuList) { - __glutFatalError("out of memory."); - } - menuList[menuListSize - 1] = NULL; - return menuListSize - 1; -} - -static void -menuModificationError(void) -{ - /* XXX Remove the warning after GLUT 3.0. */ - __glutWarning("The following is a new check for GLUT 3.0; update your code."); - __glutFatalError("menu manipulation not allowed while menus in use."); -} - -int GLUTAPIENTRY -glutCreateMenu(GLUTselectCB selectFunc) -{ - GLUTmenu *menu; - int menuid; - - if (__glutMappedMenu) { - menuModificationError(); - } - menuid = getUnusedMenuSlot(); - menu = (GLUTmenu *) malloc(sizeof(GLUTmenu)); - if (!menu) { - __glutFatalError("out of memory."); - } - menu->id = menuid; - menu->num = 0; - menu->submenus = 0; - menu->select = selectFunc; - menu->list = NULL; - menu->cascade = NULL; - menu->highlighted = NULL; - menu->anchor = NULL; -//todo -// menu->win = (HWND) CreatePopupMenu(); - menuList[menuid] = menu; - __glutSetMenu(menu); - return menuid + 1; -} - - -void GLUTAPIENTRY -glutDestroyMenu(int menunum) -{ - GLUTmenu *menu = __glutGetMenuByNum(menunum); - GLUTmenuItem *item, *next; - - if (__glutMappedMenu) { - menuModificationError(); - } - assert(menu->id == menunum - 1); -//todo DestroyMenu( (HMENU) menu->win); - menuList[menunum - 1] = NULL; - /* free all menu entries */ - item = menu->list; - while (item) { - assert(item->menu == menu); - next = item->next; - free(item->label); - free(item); - item = next; - } - if (__glutCurrentMenu == menu) { - __glutCurrentMenu = NULL; - } - free(menu); -} - -int GLUTAPIENTRY -glutGetMenu(void) -{ - if (__glutCurrentMenu) { - return __glutCurrentMenu->id + 1; - } else { - return 0; - } -} - -void GLUTAPIENTRY -glutSetMenu(int menuid) -{ - GLUTmenu *menu; - - if (menuid < 1 || menuid > menuListSize) { - __glutWarning("glutSetMenu attempted on bogus menu."); - return; - } - menu = menuList[menuid - 1]; - if (!menu) { - __glutWarning("glutSetMenu attempted on bogus menu."); - return; - } - __glutSetMenu(menu); -} - -static void -setMenuItem(GLUTmenuItem * item, const char *label, - int value, Bool isTrigger) -{ - GLUTmenu *menu; - - menu = item->menu; - item->label = __glutStrdup(label); - if (!item->label) { - __glutFatalError("out of memory."); - } - item->isTrigger = isTrigger; - item->len = (int) strlen(label); - item->value = value; - item->unique = uniqueMenuHandler++; -//todo -// if (isTrigger) { -// AppendMenu((HMENU) menu->win, MF_POPUP, (UINT)item->win, label); -// } else { -// AppendMenu((HMENU) menu->win, MF_STRING, item->unique, label); -// } -} - -void GLUTAPIENTRY -glutAddMenuEntry(const char *label, int value) -{ - GLUTmenuItem *entry; - - if (__glutMappedMenu) { - menuModificationError(); - } - entry = (GLUTmenuItem *) malloc(sizeof(GLUTmenuItem)); - if (!entry) { - __glutFatalError("out of memory."); - } - entry->menu = __glutCurrentMenu; - setMenuItem(entry, label, value, FALSE); - __glutCurrentMenu->num++; - entry->next = __glutCurrentMenu->list; - __glutCurrentMenu->list = entry; -} - -void GLUTAPIENTRY -glutAddSubMenu(const char *label, int menu) -{ - GLUTmenuItem *submenu; - GLUTmenu *popupmenu; - - if (__glutMappedMenu) { - menuModificationError(); - } - submenu = (GLUTmenuItem *) malloc(sizeof(GLUTmenuItem)); - if (!submenu) { - __glutFatalError("out of memory."); - } - __glutCurrentMenu->submenus++; - submenu->menu = __glutCurrentMenu; - popupmenu = __glutGetMenuByNum(menu); - if (popupmenu) { - submenu->win = popupmenu->win; - } - setMenuItem(submenu, label, /* base 0 */ menu - 1, TRUE); - __glutCurrentMenu->num++; - submenu->next = __glutCurrentMenu->list; - __glutCurrentMenu->list = submenu; -} - -void GLUTAPIENTRY -glutChangeToMenuEntry(int num, const char *label, int value) -{ - GLUTmenuItem *item; - int i; - - if (__glutMappedMenu) { - menuModificationError(); - } - i = __glutCurrentMenu->num; - item = __glutCurrentMenu->list; - while (item) { - if (i == num) { - if (item->isTrigger) { - /* If changing a submenu trigger to a menu entry, we - need to account for submenus. */ - item->menu->submenus--; - /* Nuke the Win32 menu. */ -//todo -// DestroyMenu((HMENU) item->win); - } - free(item->label); - - item->label = strdup(label); - if (!item->label) - __glutFatalError("out of memory"); - item->isTrigger = FALSE; - item->len = (int) strlen(label); - item->value = value; - item->unique = uniqueMenuHandler++; -//todo -// ModifyMenu((HMENU) __glutCurrentMenu->win, (UINT) i - 1, -// MF_BYPOSITION | MFT_STRING, item->unique, label); - - return; - } - i--; - item = item->next; - } - __glutWarning("Current menu has no %d item.", num); -} - -void GLUTAPIENTRY -glutChangeToSubMenu(int num, const char *label, int menu) -{ - GLUTmenu *popupmenu; - GLUTmenuItem *item; - int i; - - if (__glutMappedMenu) { - menuModificationError(); - } - i = __glutCurrentMenu->num; - item = __glutCurrentMenu->list; - while (item) { - if (i == num) { - if (!item->isTrigger) { - /* If changing a menu entry to as submenu trigger, we - need to account for submenus. */ - item->menu->submenus++; -//todo -// item->win = (HWND) CreatePopupMenu(); - } - free(item->label); - - item->label = strdup(label); - if (!item->label) - __glutFatalError("out of memory"); - item->isTrigger = TRUE; - item->len = (int) strlen(label); - item->value = menu - 1; - item->unique = uniqueMenuHandler++; - popupmenu = __glutGetMenuByNum(menu); - if (popupmenu) - item->win = popupmenu->win; -//todo -// ModifyMenu((HMENU) __glutCurrentMenu->win, (UINT) i - 1, -// MF_BYPOSITION | MF_POPUP, (UINT) item->win, label); - return; - } - i--; - item = item->next; - } - __glutWarning("Current menu has no %d item.", num); -} - -void GLUTAPIENTRY -glutRemoveMenuItem(int num) -{ - GLUTmenuItem *item, **prev; - int i; - - if (__glutMappedMenu) { - menuModificationError(); - } - i = __glutCurrentMenu->num; - prev = &__glutCurrentMenu->list; - item = __glutCurrentMenu->list; - while (item) { - if (i == num) { - /* Found the menu item in list to remove. */ - __glutCurrentMenu->num--; - - /* Patch up menu's item list. */ - *prev = item->next; -//todo -// RemoveMenu((HMENU) __glutCurrentMenu->win, (UINT) i - 1, MF_BYPOSITION); - - free(item->label); - free(item); - return; - } - i--; - prev = &item->next; - item = item->next; - } - __glutWarning("Current menu has no %d item.", num); -} - -void GLUTAPIENTRY -glutAttachMenu(int button) -{ - if (__glutCurrentWindow == __glutGameModeWindow) { - __glutWarning("cannot attach menus in game mode."); - return; - } - if (__glutMappedMenu) { - menuModificationError(); - } - if (__glutCurrentWindow->menu[button] < 1) { - __glutCurrentWindow->buttonUses++; - } - __glutCurrentWindow->menu[button] = __glutCurrentMenu->id + 1; -} - -void GLUTAPIENTRY -glutDetachMenu(int button) -{ - if (__glutMappedMenu) { - menuModificationError(); - } - if (__glutCurrentWindow->menu[button] > 0) { - __glutCurrentWindow->buttonUses--; - __glutCurrentWindow->menu[button] = 0; - } -} - diff --git a/src/glut/os2/os2_winproc.cpp b/src/glut/os2/os2_winproc.cpp deleted file mode 100644 index 9cbdec1cd2..0000000000 --- a/src/glut/os2/os2_winproc.cpp +++ /dev/null @@ -1,1296 +0,0 @@ -/* os2_winproc.c */ - - -#define INCL_DEV -#include "WarpGL.h" -#include "GL/os2mesa.h" - - -#define _MEERROR_H_ -#include /* It is from MMPM toolkit */ -#include -#include - - -#include "os2mesadef.h" -#include "glutint.h" - - -#define POKA 0 - -#if POKA - -extern unsigned __glutMenuButton; -extern GLUTidleCB __glutIdleFunc; -extern GLUTtimer *__glutTimerList; -extern void handleTimeouts(void); -extern GLUTmenuItem *__glutGetUniqueMenuItem(GLUTmenu * menu, int unique); -static HMENU __glutHMenu; - -#endif - -extern void _mesa_ResizeBuffersMESA( void ); - - -MRESULT EXPENTRY GlutWindowProc( HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2 ); -MRESULT EXPENTRY GlutWindowChildProc( HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2 ); -void updateWindowState(GLUTwindow *window, int visState); - -volatile extern HAB hab; /* PM anchor block handle */ -volatile extern HPS hpsCurrent; - -RECTL rCtls[52]; -ULONG ulNumRcls; - -MRESULT EXPENTRY GlutWindowChildProc( HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2 ) -{ MRESULT rc; - rc = GlutWindowProc(hwnd, msg, mp1, mp2 ); - return rc; -} - -MRESULT EXPENTRY GlutWindowProc( HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2 ) -{ - HPS hps = NULLHANDLE; /* presentation space handle */ - GLUTwindow* window; /* GLUT window associated with message. */ - GLUTmenu* menu; /* GLUT menu associated with message. */ - RECTL rclClient; - POINTL point; - int button = -1,rc,key; - - -/* Process the message. */ - - switch( msg ) - { - case WM_CREATE: - { - SIZEL sizl = { 0L, 0L }; - LONG *alCaps; - HDC hdc; - - /*+-----------------------------------------------------------------+*/ - /*| The client window is being created. Create the semaphore to |*/ - /*| control access to the presentation space. Then create the |*/ - /*| thread that will draw the lines. |*/ - /*+-----------------------------------------------------------------+*/ - // DosCreateMutexSem( (PSZ)NULL, &hmtxPS, 0UL, FALSE ); - - hdc = WinOpenWindowDC(hwnd); - - /*+-----------------------------------------------------------------+*/ - /*| Create a non-cached presentation space. We will not release |*/ - /*| this PS, as we will be Selecting a Palette to this PS and then |*/ - /*| animating the palette. Upon releasing a PS the palette is no |*/ - /*| longer selected for obvious reasons. |*/ - /*+-----------------------------------------------------------------+*/ - hpsCurrent = GpiCreatePS( hab, - hdc, - &sizl, - PU_PELS | GPIF_DEFAULT | - GPIT_MICRO | GPIA_ASSOC ); -// DevQueryCaps( hdc, lStart, lCount, alCaps ); -// fPaletteCaps = alCaps[CAPS_ADDITIONAL_GRAPHICS] & CAPS_PALETTE_MANAGER; -// PaletteInit(3); - /* ¯¥p¥¢®¤ hpsBuffer ¢ p¥¦¨¬ RGB color table */ - - GpiCreateLogColorTable(hpsCurrent,0 ,LCOLF_RGB,0,0,NULL); - GpiSetPattern(hpsCurrent,PATSYM_SOLID); - GpiSetPatternSet(hpsCurrent,LCID_DEFAULT); - - } - break; - - return 0; - case WM_CLOSE: - WinPostMsg( hwnd, WM_QUIT, NULL, NULL ); - - return 0; - - case WM_PAINT: - window = __glutGetWindow(hwnd); - if (window) - { - PWMC ctx; -// hps = WinBeginPaint(hwnd,NULLHANDLE,&rclClient); - hps = WinBeginPaint(hwnd,NULLHANDLE,&rclClient); - // blit Dive buffer to screen. - - { - SWP swp; // Window position - POINTL pointl; // Point to offset from Desktop - - // Convert the point to offset from desktop lower left. - pointl.x = 0; - pointl.y = 0; - WinMapWindowPoints ( hwnd, HWND_DESKTOP, &pointl, 1 ); - - -// ctx = window->ctx; -// ctx->xDiveScr = pointl.x; -// ctx->yDiveScr = pointl.y; - } -// rc = DiveBlitImage (ctx->hDive, -// ctx->ulDiveBufferNumber, -// DIVE_BUFFER_SCREEN ); -// - - if (window->win == hwnd) { - __glutPostRedisplay(window, GLUT_REPAIR_WORK); - } else if (window->overlay && window->overlay->win == hwnd) { - __glutPostRedisplay(window, GLUT_OVERLAY_REPAIR_WORK); - } - WinEndPaint(hps); - } else { - - hps = WinBeginPaint(hwnd,NULLHANDLE,&rclClient); - WinFillRect(hps, &rclClient, CLR_WHITE); - WinEndPaint(hps); - } - break; - - case WM_VRNDISABLED: - -// pwinData->fDataInProcess = TRUE; -// DiveSetupBlitter ( pwinData->hDive, 0 ); -// pwinData->fVrnDisabled = TRUE; - break; - - case WM_VRNENABLED: - { HRGN hrgn; /* Region handle */ - RGNRECT rgnCtl; /* Processing control structure */ -// RECTL rCtls[52]; -// ULONG ulNumRcls; - -// pwinData->fDataInProcess = TRUE; - hps = WinGetPS ( hwnd ); - if ( !hps ) - break; - hrgn = GpiCreateRegion ( hps, 0L, NULL ); - if ( hrgn ) - { /* NOTE: If mp1 is zero, then this was just a move message. - ** Illustrate the visible region on a WM_VRNENABLE. - */ - WinQueryVisibleRegion ( hwnd, hrgn ); - rgnCtl.ircStart = 0; - rgnCtl.crc = 50; - rgnCtl.ulDirection = 1; - - /* Get the all ORed rectangles */ - if ( GpiQueryRegionRects ( hps, hrgn, NULL, - &rgnCtl, rCtls) ) - { - ulNumRcls = rgnCtl.crcReturned; - - /* Now find the window position and size, relative to parent. - */ -// WinQueryWindowPos ( pwinData->hwndClient, &pwinData->swp ); - -// rcl.xLeft = 0; -// rcl.yBottom = 0; - - /* Convert the point to offset from desktop lower left. - */ -// pointl.x = pwinData->swp.x; -// pointl.y = pwinData->swp.y; - -// WinMapWindowPoints ( pwinData->hwndFrame, -// HWND_DESKTOP, &pointl, 1 ); - -// pwinData->cxWindowPos = pointl.x; -// pwinData->cyWindowPos = pointl.y; - - } - GpiDestroyRegion( hps, hrgn ); - } - WinReleasePS( hps ); - - } - break; - - case WM_SIZE: - window = __glutGetWindow(hwnd); - if (window) - { int width,height; - width = SHORT1FROMMP(mp2); - height = SHORT2FROMMP(mp2); - if (width != window->width || height != window->height) { -#if 0 /* Win32 GLUT does not support overlays for now. */ - if (window->overlay) { - XResizeWindow(__glutDisplay, window->overlay->win, width, height); - } -#endif - window->width = width; - window->height = height; - __glutSetWindow(window); - if(width <= 0 || height <= 0) - break; - _mesa_ResizeBuffersMESA(); - - /* Do not execute OpenGL out of sequence with respect - to the SetWindowPos request! */ - window->reshape(width, height); - window->forceReshape = FALSE; - /* A reshape should be considered like posting a - repair request. */ - __glutPostRedisplay(window, GLUT_REPAIR_WORK); - } - } - return 0; - case WM_SHOW: - window = __glutGetWindow(hwnd); - if (window) { - int visState; - visState = SHORT1FROMMP( mp1 ); - updateWindowState(window, visState); - } - return 0; - - case WM_ACTIVATE: - window = __glutGetWindow(hwnd); -// /* Make sure we re-select the correct palette if needed. */ -// if (LOWORD(wParam)) { -// PostMessage(hwnd, WM_PALETTECHANGED, 0, 0); -// } - if (window) { - int visState; - visState = SHORT1FROMMP( mp1 ); - updateWindowState(window, visState); - } - return 0; - - case WM_CHAR: - { USHORT fsflags; - window = __glutGetWindow(hwnd); - if (!window) { - break; - } - fsflags = SHORT1FROMMP(mp1); -/* ?? */ - if((fsflags & KC_KEYUP) ) /* ¨£­®p¨p㥬 ®â¦ â¨¥ ª­®¯ª¨, p¥ £¨p㥬 ⮫쪮 ­  ­ ¦ â¨¥ */ - break; -/////////////////////////////////////////////////// - if(!(fsflags & KC_CHAR) ) - { - if (!(fsflags & KC_VIRTUALKEY)) - break; - key = 0; - /* Get the virtual key from mp2. */ - switch (SHORT2FROMMP(mp2)) - { -/* directional keys */ - case VK_LEFT: key = GLUT_KEY_LEFT; break; - case VK_UP: key = GLUT_KEY_UP; break; - case VK_RIGHT: key = GLUT_KEY_RIGHT; break; - case VK_DOWN: key = GLUT_KEY_DOWN; break; - - case VK_PAGEUP: key = GLUT_KEY_PAGE_UP; break; - case VK_PAGEDOWN:key = GLUT_KEY_PAGE_DOWN; break; - case VK_HOME: key = GLUT_KEY_HOME;break; - case VK_END: key = GLUT_KEY_END; break; - case VK_INSERT: key = GLUT_KEY_INSERT; break; - -/* function keys */ - case VK_F1 : key = GLUT_KEY_F1; break; - case VK_F2 : key = GLUT_KEY_F2; break; - case VK_F3 : key = GLUT_KEY_F3; break; - case VK_F4 : key = GLUT_KEY_F4; break; - case VK_F5 : key = GLUT_KEY_F5; break; - case VK_F6 : key = GLUT_KEY_F6; break; - case VK_F7 : key = GLUT_KEY_F7; break; - case VK_F8 : key = GLUT_KEY_F8; break; - case VK_F9 : key = GLUT_KEY_F9; break; - case VK_F10: key = GLUT_KEY_F10;break; - case VK_F11: key = GLUT_KEY_F11; break; - case VK_F12: key = GLUT_KEY_F12; break; - case VK_ESC: key = -1; break; /* Character codes */ - case VK_SPACE: key = -1; break; - case VK_TAB: key = -1; break; - } - if(!key) - { break; /* Key Not implemented */ - } - if(key > 0) - { if (!window->special) /* ­¥ ãáâ ­®¢«¥­® ®¡à ¡®â稪  */ - break; - - WinQueryPointerPos(HWND_DESKTOP,&point); - ScreenToClient(window->win, &point); - __glutSetWindow(window); - __glutModifierMask = 0; - if(WinGetKeyState(HWND_DESKTOP,VK_SHIFT) & 0x8000) /* high order bit is on */ - __glutModifierMask |= ShiftMask; - if(WinGetKeyState(HWND_DESKTOP,VK_CTRL) & 0x8000) - __glutModifierMask |= ControlMask; - if(WinGetKeyState(HWND_DESKTOP,VK_MENU) & 0x8000) - __glutModifierMask |= Mod1Mask; - window->special(key, point.x, point.y); - __glutModifierMask = (unsigned int) ~0; - return 0; - } - - } -///////////////////////////////////////////////////// - /* If we are ignoring auto repeated key strokes for the window, bail. */ - if (window->ignoreKeyRepeat && (CHAR3FROMMP(mp1)) ) - break; - if(!((unsigned char)SHORT1FROMMP(mp2)) ) /* ¨£­®p¨p㥬 ­¥á¨¬¢®«ì­ë¥ ª®¤ë */ - break; - if (window->keyboard) { - WinQueryPointerPos(HWND_DESKTOP,&point); - - ScreenToClient(window->win, &point); - __glutSetWindow(window); - __glutModifierMask = 0; - if(WinGetKeyState(HWND_DESKTOP,VK_SHIFT) & 0x8000) /* high order bit is on */ - __glutModifierMask |= ShiftMask; - if(WinGetKeyState(HWND_DESKTOP,VK_CTRL) & 0x8000) - __glutModifierMask |= ControlMask; - if(WinGetKeyState(HWND_DESKTOP,VK_MENU) & 0x8000) - __glutModifierMask |= Mod1Mask; - window->keyboard((unsigned char)SHORT1FROMMP(mp2), point.x, point.y); - __glutModifierMask = (unsigned int) ~0; - } - return 0; - } /* endof case WM_CHAR: */ -//////////////////////////////////////////////// - case WM_BUTTON1DOWN: - button = GLUT_LEFT_BUTTON; - case WM_BUTTON3DOWN: - if (button < 0) - button = GLUT_MIDDLE_BUTTON; - case WM_BUTTON2DOWN: - if (button < 0) - button = GLUT_RIGHT_BUTTON; - { POINTS psh; - psh = *((POINTS *)&mp1); - point.x = psh.x; - point.y = psh.y; - } - /* finish the menu if we get a button down message (user must have - cancelled the menu). */ - if (__glutMappedMenu) { - /* TODO: take this out once the menu on middle mouse stuff works - properly. */ - if (button == GLUT_MIDDLE_BUTTON) - return 0; - /* get current mouse pointer position */ -// WinQueryPointerPos(HWND_DESKTOP,&point); - /* map from desktop to client window */ -// WinMapWindowPoints(HWND_DESKTOP, hwnd, &point, 1); - __glutItemSelected = NULL; - __glutFinishMenu(hwnd, point.x, point.y); - return 0; - } - window = __glutGetWindow(hwnd); - if (window) { - window->buttonDownState = button+1; - menu = __glutGetMenuByNum(window->menu[button]); - if (menu) { -//todo -// __glutMenuButton = button == GLUT_RIGHT_BUTTON ? TPM_RIGHTBUTTON : -// button == GLUT_LEFT_BUTTON ? TPM_LEFTBUTTON : -// 0x0001; -// __glutStartMenu(menu, window, point.x, point.y, x, y); - } else if (window->mouse) { - - __glutSetWindow(window); - __glutModifierMask = 0; - if (WinGetKeyState(HWND_DESKTOP,VK_SHIFT) & 0x8000) /* < 0 = high order bit is on. */ - __glutModifierMask |= ShiftMask; - if (WinGetKeyState(HWND_DESKTOP,VK_CTRL) & 0x8000) - __glutModifierMask |= ControlMask; - if (WinGetKeyState(HWND_DESKTOP,VK_MENU) & 0x8000) - __glutModifierMask |= Mod1Mask; - window->mouse(button, GLUT_DOWN, point.x, point.y); - __glutModifierMask = (unsigned int)~0; - } else { - /* Stray mouse events. Ignore. */ - } - } - return 0; - - break; -/********************************************/ - case WM_BUTTON1UP: - button = GLUT_LEFT_BUTTON; - case WM_BUTTON3UP: - if (button < 0) - button = GLUT_MIDDLE_BUTTON; - case WM_BUTTON2UP: - if (button < 0) - button = GLUT_RIGHT_BUTTON; - { POINTS psh; - psh = *((POINTS *)&mp1); - point.x = psh.x; - point.y = psh.y; - } - /* Bail out if we're processing a menu. */ - /* Bail out = ¢ë¡à®á¨âìáï á ¯ à èã⮬ */ - if (__glutMappedMenu) { - WinQueryPointerPos(HWND_DESKTOP,&point); - WinMapWindowPoints(HWND_DESKTOP, hwnd, &point, 1); - /* if we're getting the middle button up signal, then something - on the menu was selected. */ - if (button == GLUT_MIDDLE_BUTTON) { - return 0; - /* For some reason, the code below always returns -1 even - though the point IS IN THE ITEM! Therefore, just bail out if - we get a middle mouse up. The user must select using the - left mouse button. Stupid Win32. */ -#if 0 - int item = MenuItemFromPoint(hwnd, __glutHMenu, point); - if (item != -1) - __glutItemSelected = (GLUTmenuItem*)GetMenuItemID(__glutHMenu, item); - else - __glutItemSelected = NULL; - __glutFinishMenu(hwnd, point.x, point.y); -#endif - } else { - __glutItemSelected = NULL; - __glutFinishMenu(hwnd, point.x, point.y); - } - return 0; - } - - window = __glutGetWindow(hwnd); - if(window) - window->buttonDownState = 0; - - if (window && window->mouse) { - __glutSetWindow(window); - __glutModifierMask = 0; - if (WinGetKeyState(HWND_DESKTOP,VK_SHIFT) & 0x8000) /* < 0 = high order bit is on */ - __glutModifierMask |= ShiftMask; - if (WinGetKeyState(HWND_DESKTOP,VK_CTRL) & 0x8000) - __glutModifierMask |= ControlMask; - if (WinGetKeyState(HWND_DESKTOP,VK_MENU) & 0x8000) - __glutModifierMask |= Mod1Mask; - window->mouse(button, GLUT_UP, point.x, point.y); - - __glutModifierMask = (unsigned int)~0; - } else { - /* Window might have been destroyed and all the - events for the window may not yet be received. */ - } - return 0; - - - break; -////////////////////////////////////////////////// - case WM_COMMAND: - window = __glutGetWindow(hwnd); - if (window) - { if (window->wm_command) - window->wm_command(hwnd,mp1,mp2); - } - break; - - case WM_MOUSEMOVE: - if (!__glutMappedMenu) { - window = __glutGetWindow(hwnd); - if (window) { - /* If motion function registered _and_ buttons held * - down, call motion function... */ - { POINTS psh; - psh = *((POINTS *)&mp1); - point.x = psh.x; - point.y = psh.y; - } - - if (window->motion && window->buttonDownState) { - __glutSetWindow(window); - window->motion(point.x, point.y); - } - /* If passive motion function registered _and_ - buttons not held down, call passive motion - function... */ - else if (window->passive && !window->buttonDownState) { - __glutSetWindow(window); - window->passive(point.x, point.y); - } - } - } else { - /* Motion events are thrown away when a pop up menu is - active. */ - } - return 0; - - - default: - /* For all other messages, let the default window procedure process them. */ - return ( WinDefWindowProc( hwnd, msg, mp1, mp2 ) ); - - } //endof switch( msg ) - return ( WinDefWindowProc( hwnd, msg, mp1, mp2 ) ); -// return NULL; -} - -void APIENTRY glutCommandFunc(GLUTcommandCB Func) -{ -extern GLUTwindow *__glutCurrentWindow; - __glutCurrentWindow->wm_command = Func; -} - - - - -void -updateWindowState(GLUTwindow *window, int visState) -{ - GLUTwindow* child; - - /* XXX shownState and visState are the same in Win32. */ - window->shownState = visState; - if (visState != window->visState) { - if (window->windowStatus) { - window->visState = visState; - __glutSetWindow(window); - window->windowStatus(visState); - } - } - /* Since Win32 only sends an activate for the toplevel window, - update the visibility for all the child windows. */ - child = window->children; - while (child) { - updateWindowState(child, visState); - child = child->siblings; - } -} - -#if POKA - -LONG WINAPI -__glutWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) -{ - POINT point; /* Point structure. */ - PAINTSTRUCT ps; /* Paint structure. */ - LPMINMAXINFO minmax; /* Minimum/maximum info structure. */ - GLUTwindow* window; /* GLUT window associated with message. */ - GLUTmenu* menu; /* GLUT menu associated with message. */ - int x, y, width, height, key; - int button = -1; - - switch(msg) { - case WM_CREATE: - return 0; - case WM_CLOSE: - PostQuitMessage(0); - return 0; -#if 0 - case WM_DESTROY: - /* XXX NVidia's NT OpenGL can have problems closing down - its OpenGL internal data structures if we just allow - the process to terminate without unbinding and deleting - the windows context. Apparently, DirectDraw unloads - before OPENGL32.DLL in the close down sequence, but - NVidia's NT OpenGL needs DirectDraw to close down its - data structures. */ - window = __glutGetWindow(hwnd); - if (window) { - if (window->ctx) { - wglMakeCurrent(NULL, NULL); - wglDeleteContext(window->ctx); - } - } - return 0; -#endif - - case WM_SYSKEYUP: - case WM_KEYUP: - window = __glutGetWindow(hwnd); - if (!window) { - break; - } - /* Win32 is dumb and sends these messages only to the parent - window. Therefore, find out if we're in a child window and - call the child windows keyboard callback if we are. */ - if (window->parent) { - GetCursorPos(&point); - ScreenToClient(hwnd, &point); - hwnd = ChildWindowFromPoint(hwnd, point); - window = __glutGetWindow(hwnd); - } - if (window->specialUp || window->keyboardUp) { - GetCursorPos(&point); - ScreenToClient(window->win, &point); - __glutSetWindow(window); - __glutModifierMask = 0; - if (GetKeyState(VK_SHIFT) < 0) /* < 0 = high order bit is on */ - __glutModifierMask |= ShiftMask; - if (GetKeyState(VK_SHIFT) < 0) /* < 0 = high order bit is on */ - __glutModifierMask |= ControlMask; - if (GetKeyState(VK_MENU) < 0) - __glutModifierMask |= Mod1Mask; - switch (wParam) { - /* *INDENT-OFF* */ - case VK_F1: key = GLUT_KEY_F1; break; - case VK_F2: key = GLUT_KEY_F2; break; - case VK_F3: key = GLUT_KEY_F3; break; - case VK_F4: key = GLUT_KEY_F4; break; - case VK_F5: key = GLUT_KEY_F5; break; - case VK_F6: key = GLUT_KEY_F6; break; - case VK_F7: key = GLUT_KEY_F7; break; - case VK_F8: key = GLUT_KEY_F8; break; - case VK_F9: key = GLUT_KEY_F9; break; - case VK_F10: key = GLUT_KEY_F10; break; - case VK_F11: key = GLUT_KEY_F11; break; - case VK_F12: key = GLUT_KEY_F12; break; - case VK_LEFT: key = GLUT_KEY_LEFT; break; - case VK_UP: key = GLUT_KEY_UP; break; - case VK_RIGHT: key = GLUT_KEY_RIGHT; break; - case VK_DOWN: key = GLUT_KEY_DOWN; break; - case VK_PRIOR: key = GLUT_KEY_PAGE_UP; break; - case VK_NEXT: key = GLUT_KEY_PAGE_DOWN; break; - case VK_HOME: key = GLUT_KEY_HOME; break; - case VK_END: key = GLUT_KEY_END; break; - case VK_INSERT: key = GLUT_KEY_INSERT; break; - case VK_DELETE: - /* Delete is an ASCII character. */ - if (window->keyboardUp) { - window->keyboardUp((unsigned char) 127, point.x, point.y); - } - return 0; - /* *INDENT-ON* */ - default: - if (window->keyboardUp) { - key = MapVirtualKey(wParam, 2); /* Map to ASCII. */ - if (isascii(key) && (key != 0)) { - - /* XXX Attempt to determine modified ASCII character - is quite incomplete. Digits, symbols, CapsLock, - Ctrl, and numeric keypad are all ignored. Fix this. */ - - if (!(__glutModifierMask & ShiftMask)) - key = tolower(key); - window->keyboardUp((unsigned char) key, point.x, point.y); - } - } - __glutModifierMask = (unsigned int) ~0; - return 0; - } - if (window->specialUp) { - window->specialUp(key, point.x, point.y); - } - __glutModifierMask = (unsigned int) ~0; - } - return 0; - - case WM_SYSCHAR: - case WM_CHAR: - window = __glutGetWindow(hwnd); - if (!window) { - break; - } - - /* Bit 30 of lParam is set if key already held down. If - we are ignoring auto repeated key strokes for the window, bail. */ - if (window->ignoreKeyRepeat && (lParam & (1 << 30)) ) { - break; - } - - /* Win32 is dumb and sends these messages only to the parent - window. Therefore, find out if we're in a child window and - call the child windows keyboard callback if we are. */ - if (window->parent) { - GetCursorPos(&point); - ScreenToClient(hwnd, &point); - hwnd = ChildWindowFromPoint(hwnd, point); - window = __glutGetWindow(hwnd); - } - if (window->keyboard) { - GetCursorPos(&point); - ScreenToClient(window->win, &point); - __glutSetWindow(window); - __glutModifierMask = 0; - if (GetKeyState(VK_SHIFT) < 0) /* < 0 = high order bit is on */ - __glutModifierMask |= ShiftMask; - if (GetKeyState(VK_CONTROL) < 0) - __glutModifierMask |= ControlMask; - if (GetKeyState(VK_MENU) < 0) - __glutModifierMask |= Mod1Mask; - window->keyboard((unsigned char)wParam, point.x, point.y); - __glutModifierMask = (unsigned int) ~0; - } - return 0; - - case WM_SYSKEYDOWN: - case WM_KEYDOWN: - window = __glutGetWindow(hwnd); - if (!window) { - break; - } - - /* Bit 30 of lParam is set if key already held down. If - we are ignoring auto repeated key strokes for the window, bail. */ - if (window->ignoreKeyRepeat && (lParam & (1 << 30)) ) { - break; - } - - /* Win32 is dumb and sends these messages only to the parent - window. Therefore, find out if we're in a child window and - call the child windows keyboard callback if we are. */ - if (window->parent) { - GetCursorPos(&point); - ScreenToClient(hwnd, &point); - hwnd = ChildWindowFromPoint(hwnd, point); - window = __glutGetWindow(hwnd); - } - if (window->special) { - switch (wParam) { - /* *INDENT-OFF* */ - /* function keys */ - case VK_F1: key = GLUT_KEY_F1; break; - case VK_F2: key = GLUT_KEY_F2; break; - case VK_F3: key = GLUT_KEY_F3; break; - case VK_F4: key = GLUT_KEY_F4; break; - case VK_F5: key = GLUT_KEY_F5; break; - case VK_F6: key = GLUT_KEY_F6; break; - case VK_F7: key = GLUT_KEY_F7; break; - case VK_F8: key = GLUT_KEY_F8; break; - case VK_F9: key = GLUT_KEY_F9; break; - case VK_F10: key = GLUT_KEY_F10; break; - case VK_F11: key = GLUT_KEY_F11; break; - case VK_F12: key = GLUT_KEY_F12; break; - /* directional keys */ - case VK_LEFT: key = GLUT_KEY_LEFT; break; - case VK_UP: key = GLUT_KEY_UP; break; - case VK_RIGHT: key = GLUT_KEY_RIGHT; break; - case VK_DOWN: key = GLUT_KEY_DOWN; break; - /* *INDENT-ON* */ - - case VK_PRIOR: - /* VK_PRIOR is Win32's Page Up */ - key = GLUT_KEY_PAGE_UP; - break; - case VK_NEXT: - /* VK_NEXT is Win32's Page Down */ - key = GLUT_KEY_PAGE_DOWN; - break; - case VK_HOME: - key = GLUT_KEY_HOME; - break; - case VK_END: - key = GLUT_KEY_END; - break; - case VK_INSERT: - key = GLUT_KEY_INSERT; - break; - case VK_DELETE: - goto handleDelete; - default: - goto defproc; - } - GetCursorPos(&point); - ScreenToClient(window->win, &point); - __glutSetWindow(window); - __glutModifierMask = 0; - if (GetKeyState(VK_SHIFT) < 0) /* < 0 = high order bit is on */ - __glutModifierMask |= ShiftMask; - if (GetKeyState(VK_CONTROL) < 0) - __glutModifierMask |= ControlMask; - if (GetKeyState(VK_MENU) < 0) - __glutModifierMask |= Mod1Mask; - window->special(key, point.x, point.y); - __glutModifierMask = (unsigned int) ~0; - } else if (window->keyboard) { - /* Specially handle any keys that match ASCII values but - do not generate Windows WM_SYSCHAR or WM_CHAR messages. */ - switch (wParam) { - case VK_DELETE: - handleDelete: - /* Delete is an ASCII character. */ - GetCursorPos(&point); - ScreenToClient(window->win, &point); - __glutSetWindow(window); - __glutModifierMask = 0; - if (GetKeyState(VK_SHIFT) < 0) /* < 0 = high order bit is on */ - __glutModifierMask |= ShiftMask; - if (GetKeyState(VK_CONTROL) < 0) - __glutModifierMask |= ControlMask; - if (GetKeyState(VK_MENU) < 0) - __glutModifierMask |= Mod1Mask; - window->keyboard((unsigned char) 127, point.x, point.y); - __glutModifierMask = (unsigned int) ~0; - return 0; - default: - /* Let the following WM_SYSCHAR or WM_CHAR message generate - the keyboard callback. */ - break; - } - } - return 0; - - case WM_LBUTTONDOWN: - button = GLUT_LEFT_BUTTON; - case WM_MBUTTONDOWN: - if (button < 0) - button = GLUT_MIDDLE_BUTTON; - case WM_RBUTTONDOWN: - if (button < 0) - button = GLUT_RIGHT_BUTTON; - - /* finish the menu if we get a button down message (user must have - cancelled the menu). */ - if (__glutMappedMenu) { - /* TODO: take this out once the menu on middle mouse stuff works - properly. */ - if (button == GLUT_MIDDLE_BUTTON) - return 0; - GetCursorPos(&point); - ScreenToClient(hwnd, &point); - __glutItemSelected = NULL; - __glutFinishMenu(hwnd, point.x, point.y); - return 0; - } - - /* set the capture so we can get mouse events outside the window */ - SetCapture(hwnd); - - /* Win32 doesn't return the same numbers as X does when the mouse - goes beyond the upper or left side of the window. roll the - Win32's 0..2^16 pointer co-ord range to 0 +/- 2^15. */ - x = LOWORD(lParam); - y = HIWORD(lParam); - if(x & 1 << 15) x -= (1 << 16); - if(y & 1 << 15) y -= (1 << 16); - - window = __glutGetWindow(hwnd); - if (window) { - menu = __glutGetMenuByNum(window->menu[button]); - if (menu) { - point.x = LOWORD(lParam); point.y = HIWORD(lParam); - ClientToScreen(window->win, &point); - __glutMenuButton = button == GLUT_RIGHT_BUTTON ? TPM_RIGHTBUTTON : - button == GLUT_LEFT_BUTTON ? TPM_LEFTBUTTON : - 0x0001; - __glutStartMenu(menu, window, point.x, point.y, x, y); - } else if (window->mouse) { - - __glutSetWindow(window); - __glutModifierMask = 0; - if (GetKeyState(VK_SHIFT) < 0) /* < 0 = high order bit is on. */ - __glutModifierMask |= ShiftMask; - if (GetKeyState(VK_CONTROL) < 0) - __glutModifierMask |= ControlMask; - if (GetKeyState(VK_MENU) < 0) - __glutModifierMask |= Mod1Mask; - window->mouse(button, GLUT_DOWN, x, y); - __glutModifierMask = (unsigned int)~0; - } else { - /* Stray mouse events. Ignore. */ - } - } - return 0; - - case WM_LBUTTONUP: - button = GLUT_LEFT_BUTTON; - case WM_MBUTTONUP: - if (button < 0) - button = GLUT_MIDDLE_BUTTON; - case WM_RBUTTONUP: - if (button < 0) - button = GLUT_RIGHT_BUTTON; - - /* Bail out if we're processing a menu. */ - if (__glutMappedMenu) { - GetCursorPos(&point); - ScreenToClient(hwnd, &point); - /* if we're getting the middle button up signal, then something - on the menu was selected. */ - if (button == GLUT_MIDDLE_BUTTON) { - return 0; - /* For some reason, the code below always returns -1 even - though the point IS IN THE ITEM! Therefore, just bail out if - we get a middle mouse up. The user must select using the - left mouse button. Stupid Win32. */ -#if 0 - int item = MenuItemFromPoint(hwnd, __glutHMenu, point); - if (item != -1) - __glutItemSelected = (GLUTmenuItem*)GetMenuItemID(__glutHMenu, item); - else - __glutItemSelected = NULL; - __glutFinishMenu(hwnd, point.x, point.y); -#endif - } else { - __glutItemSelected = NULL; - __glutFinishMenu(hwnd, point.x, point.y); - } - return 0; - } - - /* Release the mouse capture. */ - ReleaseCapture(); - - window = __glutGetWindow(hwnd); - if (window && window->mouse) { - /* Win32 doesn't return the same numbers as X does when the - mouse goes beyond the upper or left side of the window. roll - the Win32's 0..2^16 pointer co-ord range to 0 +/- 2^15. */ - x = LOWORD(lParam); - y = HIWORD(lParam); - if(x & 1 << 15) x -= (1 << 16); - if(y & 1 << 15) y -= (1 << 16); - - __glutSetWindow(window); - __glutModifierMask = 0; - if (GetKeyState(VK_SHIFT) < 0) /* < 0 = high order bit is on */ - __glutModifierMask |= ShiftMask; - if (GetKeyState(VK_CONTROL) < 0) - __glutModifierMask |= ControlMask; - if (GetKeyState(VK_MENU) < 0) - __glutModifierMask |= Mod1Mask; - window->mouse(button, GLUT_UP, x, y); - __glutModifierMask = (unsigned int)~0; - } else { - /* Window might have been destroyed and all the - events for the window may not yet be received. */ - } - return 0; - - case WM_ENTERMENULOOP: - /* KLUDGE: create a timer that fires every 100 ms when we start a - menu so that we can still process the idle & timer events (that - way, the timers will fire during a menu pick and so will the - idle func. */ - SetTimer(hwnd, 1, 1, NULL); - return 0; - - case WM_TIMER: -#if 0 - /* If the timer id is 2, then this is the timer that is set up in - the main glut message processing loop, and we don't want to do - anything but acknowledge that we got it. It is used to prevent - CPU spiking when an idle function is installed. */ - if (wParam == 2) - return 0; -#endif - - /* only worry about the idle function and the timeouts, since - these are the only events we expect to process during - processing of a menu. */ - /* we no longer process the idle functions (as outlined in the - README), since drawing can't be done until the menu has - finished...it's pretty lame when the animation goes on, but - doesn't update, so you get this weird jerkiness. */ -#if 0 - if (__glutIdleFunc) - __glutIdleFunc(); -#endif - if (__glutTimerList) - handleTimeouts(); - return 0; - - case WM_EXITMENULOOP: - /* nuke the above created timer...we don't need it anymore, since - the menu is gone now. */ - KillTimer(hwnd, 1); - return 0; - - case WM_MENUSELECT: - if (lParam != 0) - __glutHMenu = (HMENU)lParam; - return 0; - - case WM_COMMAND: - if (__glutMappedMenu) { - if (GetSubMenu(__glutHMenu, LOWORD(wParam))) - __glutItemSelected = NULL; - else - __glutItemSelected = - __glutGetUniqueMenuItem(__glutMappedMenu, LOWORD(wParam)); - GetCursorPos(&point); - ScreenToClient(hwnd, &point); - __glutFinishMenu(hwnd, point.x, point.y); - } - return 0; - - case WM_MOUSEMOVE: - if (!__glutMappedMenu) { - window = __glutGetWindow(hwnd); - if (window) { - /* If motion function registered _and_ buttons held * - down, call motion function... */ - x = LOWORD(lParam); - y = HIWORD(lParam); - - /* Win32 doesn't return the same numbers as X does when the - mouse goes beyond the upper or left side of the window. - roll the Win32's 0..2^16 pointer co-ord range to 0..+/-2^15. */ - if(x & 1 << 15) x -= (1 << 16); - if(y & 1 << 15) y -= (1 << 16); - - if (window->motion && wParam & - (MK_LBUTTON | MK_MBUTTON | MK_RBUTTON)) { - __glutSetWindow(window); - window->motion(x, y); - } - /* If passive motion function registered _and_ - buttons not held down, call passive motion - function... */ - else if (window->passive && - ((wParam & - (MK_LBUTTON | MK_MBUTTON | MK_RBUTTON)) == - 0)) { - __glutSetWindow(window); - window->passive(x, y); - } - } - } else { - /* Motion events are thrown away when a pop up menu is - active. */ - } - return 0; - - case WM_GETMINMAXINFO: - /* this voodoo is brought to you by Win32 (again). It allows the - window to be bigger than the screen, and smaller than 100x100 - (although it doesn't seem to help the y minimum). */ - minmax = (LPMINMAXINFO)lParam; - minmax->ptMaxSize.x = __glutScreenWidth; - minmax->ptMaxSize.y = __glutScreenHeight; - minmax->ptMinTrackSize.x = 0; - minmax->ptMinTrackSize.y = 0; - minmax->ptMaxTrackSize.x = __glutScreenWidth + - GetSystemMetrics(SM_CXSIZE) * 2; - minmax->ptMaxTrackSize.y = __glutScreenHeight + - GetSystemMetrics(SM_CXSIZE) * 2 + GetSystemMetrics(SM_CYCAPTION); - return 0; - - case WM_SIZE: - window = __glutGetWindow(hwnd); - if (window) { - width = LOWORD(lParam); - height = HIWORD(lParam); - if (width != window->width || height != window->height) { -#if 0 /* Win32 GLUT does not support overlays for now. */ - if (window->overlay) { - XResizeWindow(__glutDisplay, window->overlay->win, width, height); - } -#endif - window->width = width; - window->height = height; - __glutSetWindow(window); - /* Do not execute OpenGL out of sequence with respect - to the SetWindowPos request! */ - GdiFlush(); - window->reshape(width, height); - window->forceReshape = FALSE; - /* A reshape should be considered like posting a - repair request. */ - __glutPostRedisplay(window, GLUT_REPAIR_WORK); - } - } - return 0; - - case WM_SETCURSOR: - /* If the cursor is not in the client area, then we want to send - this message to the default window procedure ('cause its - probably in the border or title, and we don't handle that - cursor. otherwise, set our cursor. Win32 makes us set the - cursor every time the mouse moves (DUMB!). */ - if(LOWORD(lParam) != HTCLIENT) { - goto defproc; - } - window = __glutGetWindow(hwnd); - if (window) { - __glutSetCursor(window); - } - /* TODO: check out the info in DevStudio on WM_SETCURSOR in the - DefaultAction section. */ - return 1; - - case WM_SETFOCUS: - window = __glutGetWindow(hwnd); - if (window) { - window->entryState = WM_SETFOCUS; - if (window->entry) { - __glutSetWindow(window); - window->entry(GLUT_ENTERED); - /* XXX Generation of fake passive notify? See how much - work the X11 code does to support fake passive notify - callbacks. */ - } - if (window->joystick && __glutCurrentWindow) { - if (__glutCurrentWindow->joyPollInterval > 0) { - MMRESULT result; - - /* Because Win32 will only let one window capture the - joystick at a time, we must capture it when we get the - focus and release it when we lose the focus. */ - result = joySetCapture(__glutCurrentWindow->win, - JOYSTICKID1, 0, TRUE); - if (result != JOYERR_NOERROR) { - return 0; - } - (void) joySetThreshold(JOYSTICKID1, - __glutCurrentWindow->joyPollInterval); - } - } - } - return 0; - - case WM_KILLFOCUS: - window = __glutGetWindow(hwnd); - if (window) { - window->entryState = WM_KILLFOCUS; - if (window->entry) { - __glutSetWindow(window); - window->entry(GLUT_LEFT); - } - if (window->joystick && __glutCurrentWindow) { - if (__glutCurrentWindow->joyPollInterval > 0) { - /* Because Win32 will only let one window capture the - joystick at a time, we must capture it when we get the - focus and release it when we lose the focus. */ - (void) joyReleaseCapture(JOYSTICKID1); - } - } - } - return 0; - case WM_ACTIVATE: - window = __glutGetWindow(hwnd); - /* Make sure we re-select the correct palette if needed. */ - if (LOWORD(wParam)) { - PostMessage(hwnd, WM_PALETTECHANGED, 0, 0); - } - if (window) { - int visState; - - /* HIWORD(wParam) is the minimized flag. */ - visState = !HIWORD(wParam); - updateWindowState(window, visState); - } - return 0; - - /* Colour Palette Management */ - case WM_PALETTECHANGED: - if (hwnd == (HWND)wParam) { - /* Don't respond to the message that we sent! */ - break; - } - /* fall through to WM_QUERYNEWPALETTE */ - - case WM_QUERYNEWPALETTE: - window = __glutGetWindow(hwnd); - if (window && window->colormap) { - UnrealizeObject(window->colormap->cmap); - SelectPalette(window->hdc, window->colormap->cmap, FALSE); - RealizePalette(window->hdc); - return TRUE; - } - return FALSE; - - case MM_JOY1MOVE: - case MM_JOY1ZMOVE: - window = __glutGetWindow(hwnd); - if (window->joystick) { - JOYINFOEX jix; - int x, y, z; - - /* Because WIN32 only supports messages for X, Y, and Z - translations, we must poll for the rest */ - jix.dwSize = sizeof(jix); - jix.dwFlags = JOY_RETURNALL; - joyGetPosEx(JOYSTICKID1,&jix); - -#define SCALE(v) ((int) ((v - 32767)/32.768)) - - /* Convert to integer for scaling. */ - x = jix.dwXpos; - y = jix.dwYpos; - z = jix.dwZpos; - window->joystick(jix.dwButtons, SCALE(x), SCALE(y), SCALE(z)); - - return TRUE; - } - return FALSE; - case MM_JOY1BUTTONDOWN: - case MM_JOY1BUTTONUP: - window = __glutGetWindow(hwnd); - if (window->joystick) { - JOYINFOEX jix; - - /* Because WIN32 only supports messages for X, Y, and Z - translations, we must poll for the rest */ - jix.dwSize = sizeof(jix); - jix.dwFlags = JOY_RETURNALL; - joyGetPosEx(JOYSTICKID1,&jix); - - return TRUE; - } - return FALSE; - -#if 0 - /* Miscellaneous messages (don't really need to enumerate them, - but it's good to know what you're not getting sometimes). */ - case WM_DISPLAYCHANGE: - break; - case WM_NCHITTEST: - /* This event is generated by every mouse move event. */ - goto defproc; - case WM_NCMOUSEMOVE: - goto defproc; - case WM_NCACTIVATE: - goto defproc; - case WM_NCPAINT: - goto defproc; - case WM_NCCALCSIZE: - goto defproc; - case WM_NCCREATE: - goto defproc; - case WM_NCDESTROY: - goto defproc; - case WM_NCLBUTTONDOWN: - goto defproc; - case WM_SETTEXT: - goto defproc; - case WM_GETTEXT: - goto defproc; - case WM_ACTIVATEAPP: - goto defproc; - case WM_GETICON: - goto defproc; - case WM_ERASEBKGND: - goto defproc; - case WM_WINDOWPOSCHANGING: - goto defproc; - case WM_WINDOWPOSCHANGED: - goto defproc; - case WM_MOUSEACTIVATE: - goto defproc; - case WM_SHOWWINDOW: - goto defproc; - case WM_MOVING: - goto defproc; - case WM_MOVE: - goto defproc; - case WM_KEYUP: - goto defproc; - case WM_CAPTURECHANGED: - goto defproc; - case WM_SYSCOMMAND: - goto defproc; - case WM_ENTERSIZEMOVE: - goto defproc; - case WM_ENTERIDLE: - goto defproc; -#endif - - default: - goto defproc; - } - -defproc: - return DefWindowProc(hwnd, msg, wParam, lParam); -} - -#endif - -#if defined(__OS2PM__) -Bool __glutSetWindowText(Window window, char *text) -{ - return WinSetWindowText(window, (PCSZ)text); - -} - -#endif diff --git a/src/glut/os2/src-glut_os2pm.zip b/src/glut/os2/src-glut_os2pm.zip deleted file mode 100644 index 8c8a8c7ac4..0000000000 Binary files a/src/glut/os2/src-glut_os2pm.zip and /dev/null differ diff --git a/src/glx/mini/Makefile b/src/glx/mini/Makefile deleted file mode 100644 index aabc1d2be3..0000000000 --- a/src/glx/mini/Makefile +++ /dev/null @@ -1,88 +0,0 @@ -# Build the MiniGLX libGL.so library. - -TOP = ../../.. -include $(TOP)/configs/current - - -DEFINES += -DGLX_DIRECT_RENDERING -DIN_MINI_GLX -UIN_DRI_DRIVER - -C_SOURCES = \ - $(TOP)/src/mesa/main/dispatch.c \ - $(TOP)/src/mesa/glapi/glapi.c \ - $(TOP)/src/mesa/glapi/glthread.c \ - $(TOP)/src/glx/x11/glcontextmodes.c \ - miniglx.c \ - miniglx_events.c - -X86_SOURCES = $(TOP)/src/mesa/x86/glapi_x86.S - -OBJECTS = $(C_SOURCES:.c=.o) \ - $(ASM_SOURCES:.S=.o) - -INCLUDES = -I. $(INCLUDE_DIRS) - -INCLUDE_DIRS = \ - -I$(TOP)/include \ - -I$(TOP)/src/mesa \ - -I$(TOP)/src/mesa/main \ - -I$(TOP)/src/mesa/glapi \ - -I$(TOP)/src/glx/x11 \ - -I$(TOP)/src/mesa/drivers/dri/common \ - $(LIBDRM_CFLAGS) \ - $(PCIACCESS_CFLAGS) - - - -##### RULES ##### - -.c.o: - $(CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) $< -o $@ - -.S.o: - $(CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) $< -o $@ - - -##### TARGETS ##### - -default: depend $(TOP)/$(LIB_DIR)/$(GL_LIB_NAME) $(TOP)/$(LIB_DIR)/miniglx.conf - - -# Make libGL -$(TOP)/$(LIB_DIR)/$(GL_LIB_NAME): $(OBJECTS) Makefile - @ $(MKLIB) -o $(GL_LIB) -linker '$(CC)' -ldflags '$(LDFLAGS)' \ - -major 1 -minor 2 $(MKLIB_OPTIONS) \ - -install $(TOP)/$(LIB_DIR) $(GL_LIB_DEPS) $(OBJECTS) \ - $(LIBDRM_LIB) $(PCIACCESS_LIB) - - -# install sample miniglx.conf -$(TOP)/$(LIB_DIR)/miniglx.conf: - $(INSTALL) example.miniglx.conf $(TOP)/$(LIB_DIR)/miniglx.conf - - -drmtest: xf86drm.o drmtest.o - rm -f drmtest && $(CC) -o drmtest xf86drm.o drmtest.o - - -depend: $(C_SOURCES) $(ASM_SOURCES) - touch depend - $(MKDEP) $(MKDEP_OPTIONS) $(INCLUDES) $(C_SOURCES) $(ASM_SOURCES) \ - > /dev/null - - -# Emacs tags -tags: - etags `find . -name \*.[ch]` `find ../include` - - -# Dummy install target -install: - - -# Remove .o and backup files -clean: - -rm -f drmtest $(TOP)/$(LIB_DIR)/libGL.so* - -rm -f *.o *~ - -rm -f depend depend.bak - -include depend diff --git a/src/glx/mini/NOTES b/src/glx/mini/NOTES deleted file mode 100644 index 1774107d63..0000000000 --- a/src/glx/mini/NOTES +++ /dev/null @@ -1,115 +0,0 @@ - - -Getting MiniGLX up and running ------------------------------- - -It's necessary to do a bit of work to set up an environment to run miniglx. - -For the radeon driver, it's necessary to get the right set of kernel -modules installed before attempting to run any programs: - - rmmod radeon agpgart; - insmod agpgart; - insmod $(MESA)/src/kernel/radeonfb/radeonfb.o; - insmod $(MESA)/src/kernel/radeon/radeon.o; - -For all drivers, its necessary to reach the compiled libraries, and -tell MiniGLX where to find it's configuration file: - - export LD_LIBRARY_PATH=$(MESA)/lib; - export MINIGLX_CONF=$(MESA)/lib/miniglx.conf - ------------------------------------------------------------- - -MiniGLX Example Programs ------------------------- - -The following programs will work with miniglx: - - $(MESA)/tests/miniglx - $(MESA)/xdemos/glxgears - -Thanks to the miniglut stub library, most of the mesa glut demos will -work. In particular, the following have been tested. (Note there is -no keyboard or mouse interaction with these demos). - - $(MESA)/demos/gears - $(MESA)/demos/geartrain - $(MESA)/demos/morph3d - $(MESA)/demos/isosurf - $(MESA)/demos/texobj - $(MESA)/demos/texcyl - $(MESA)/demos/gloss - $(MESA)/demos/fire - $(MESA)/demos/tunnel - $(MESA)/demos/teapot - $(MESA)/samples/prim - $(MESA)/samples/olympic - $(MESA)/samples/star - $(MESA)/samples/wave - ...etc - -In fact most of the glut demos seem to work within the constraints of -having no keyboard/mouse interactivity. Furthermore, the use of the -glut wrapper means that these programs don't require recompilation to -run under MiniGLX -- the same binary works with both regular GLX and -MiniGLX. - - ------------------------------------------------------------- - -Porting GLX apps to MiniGLX ---------------------------- - -A quick list of issues encountered in porting existing GLX apps to -MiniGLX. Listed in no particular order. - -1) No input events - -MiniGLX doesn't provide an input layer, so any X11 input event -handling in the existing app will have to be redone for whatever -input devices exist on the target. - -2) No configuration, expose events - -Many GLX and Xlib programs wait on an event to ensure the window has -become visible after being mapped. MiniGLX provides no equivalent -facility. - -3) Different headers - -X11/Xlib.h, GL/GLX.h, etc must not be used if the program is being -compiled against MiniGLX. - -The equivalent header is GL/MiniGLX.h. - -4) Different library - -It may be necessary to link directly against the minGLX libGL.so. - -5) Reduced number of Xlib and GLX entrypoints. - -By definition (MiniGLX is a subset of GLX), many Xlib and GLX -entrypoints, structures and macros are not present in MiniGLX. It -will be necessary to find and eliminate all references to -non-supported entrypoints. - - ---------------------------------------------------------------- - -Bugs in radeonfb.o -- the radeon framebuffer driver. ----------------------------------------------------- - -Several bugs have been found in the radeonfb.o framebuffer driver. -Most of these are resolved in the version included in the MiniGLX -sources, but some remain: - -1) Occasionally, after entering graphics mode, colors appear 'shifted' -or 'translated', particularly in higher resolution modes. This is -definitely a bug in radeonfb.o as this can be provoked even when using -the software dri driver (fb_dri.so). Importance: High. Workaround: -Use 800x600 as it seems to be less frequent at this resolution, -otherwise, restart the application. - - - diff --git a/src/glx/mini/dispatch.c b/src/glx/mini/dispatch.c deleted file mode 100644 index ac24df9e7d..0000000000 --- a/src/glx/mini/dispatch.c +++ /dev/null @@ -1,64 +0,0 @@ -/** - * \file miniglx/dispatch.c - * - * \brief C-based dispatch of the OpenGL entry points (glAccum(), glBegin(), - * etc). - * - * \author Brian Paul - * - * \note This code IS NOT USED if we're compiling on an x86 system and using - * the glapi_x86.S assembly code. - */ - -/* - * Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -#include "glheader.h" -#include "glapi.h" -#include "glapitable.h" - - -#if !(defined(USE_X86_ASM) || defined(USE_SPARC_ASM)) - -#define KEYWORD1 - -#define KEYWORD2 - -#define NAME(func) gl##func - -#define DISPATCH(func, args, msg) \ - const struct _glapi_table *dispatch; \ - dispatch = _glapi_Dispatch ? _glapi_Dispatch : _glapi_get_dispatch();\ - (dispatch->func) args - -#define RETURN_DISPATCH(func, args, msg) \ - const struct _glapi_table *dispatch; \ - dispatch = _glapi_Dispatch ? _glapi_Dispatch : _glapi_get_dispatch();\ - return (dispatch->func) args - - -#include "glapitemp.h" - -#endif /* USE_X86_ASM */ diff --git a/src/glx/mini/driver.h b/src/glx/mini/driver.h deleted file mode 100644 index 39c0f9b5fa..0000000000 --- a/src/glx/mini/driver.h +++ /dev/null @@ -1,168 +0,0 @@ -/** - * \file driver.h - * \brief DRI utility functions definitions. - * - * This module acts as glue between GLX and the actual hardware driver. A DRI - * driver doesn't really \e have to use any of this - it's optional. But, some - * useful stuff is done here that otherwise would have to be duplicated in most - * drivers. - * - * Basically, these utility functions take care of some of the dirty details of - * screen initialization, context creation, context binding, DRM setup, etc. - * - * These functions are compiled into each DRI driver so libGL.so knows nothing - * about them. - * - * Look for more comments in the dri_util.c file. - * - * \author Kevin E. Martin - * \author Brian Paul - */ - -/* - * Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -#ifndef _driver_H_ -#define _driver_H_ - -#include "GL/gl.h" -#include "GL/internal/glcore.h" - -#include "drm.h" -#include "drm_sarea.h" - -/** - * \brief DRIDriverContext type. - */ -typedef struct DRIDriverContextRec { - const char *pciBusID; - int pciBus; - int pciDevice; - int pciFunc; - int chipset; - int bpp; - int cpp; - int agpmode; - int isPCI; - - int colorTiling; /**< \brief color tiling is enabled */ - - unsigned long FBStart; /**< \brief physical address of the framebuffer */ - unsigned long MMIOStart; /**< \brief physical address of the MMIO region */ - - int FBSize; /**< \brief size of the mmap'd framebuffer in bytes */ - int MMIOSize; /**< \brief size of the mmap'd MMIO region in bytes */ - - void *FBAddress; /**< \brief start of the mmap'd framebuffer */ - void *MMIOAddress; /**< \brief start of the mmap'd MMIO region */ - - /** - * \brief Client configuration details - * - * These are computed on the server and sent to clients as part of - * the initial handshaking. - */ - struct { - drm_handle_t hSAREA; - int SAREASize; - drm_handle_t hFrameBuffer; - int fbOrigin; - int fbSize; - int fbStride; - int virtualWidth; - int virtualHeight; - int Width; - } shared; - - /** - * \name From DRIInfoRec - */ - /*@{*/ - int drmFD; /**< \brief DRM device file descriptor */ - drm_sarea_t *pSAREA; - unsigned int serverContext; /**< \brief DRM context only active on server */ - /*@}*/ - - - /** - * \name Driver private - * - * Populated by __driInitFBDev() - */ - /*@{*/ - void *driverPrivate; - void *driverClientMsg; - int driverClientMsgSize; - /*@}*/ -} DRIDriverContext; - -/** - * \brief Interface to the DRI driver. - * - * This structure is retrieved from the loadable driver by the \e - * __driDriver symbol to access the Mini GLX specific hardware - * initialization and take down routines. - */ -typedef struct DRIDriverRec { - /** - * \brief Validate the framebuffer device mode - */ - int (*validateMode)( const DRIDriverContext *context ); - - /** - * \brief Examine mode returned by fbdev (may differ from the one - * requested), restore any hw regs clobbered by fbdev. - */ - int (*postValidateMode)( const DRIDriverContext *context ); - - /** - * \brief Initialize the framebuffer device. - */ - int (*initFBDev)( DRIDriverContext *context ); - - /** - * \brief Halt the framebuffer device. - */ - void (*haltFBDev)( DRIDriverContext *context ); - - - /** - * \brief Idle and shutdown hardware in preparation for a VT switch. - */ - int (*shutdownHardware)( const DRIDriverContext *context ); - - /** - * \brief Restore hardware state after regaining the VT. - */ - int (*restoreHardware)( const DRIDriverContext *context ); - - /** - * \brief Notify hardware driver of gain/loose focus. May be zero - * as this is of limited utility for most drivers. - */ - void (*notifyFocus)( int have_focus ); -} DRIDriver; - -#endif /* _driver_H_ */ diff --git a/src/glx/mini/example.miniglx.conf b/src/glx/mini/example.miniglx.conf deleted file mode 100644 index 62dd4f65ec..0000000000 --- a/src/glx/mini/example.miniglx.conf +++ /dev/null @@ -1,36 +0,0 @@ -# Example miniglx configuration file (/etc/miniglx.conf) -# - -# Framebuffer device to open: Might need to change this on dual-head -# systems. -fbdevDevice=/dev/fb0 - -# Which driver? -# radeon_dri.so -- HW accelerated radeon driver -# fb_dri.so -- Software rasterizer -clientDriverName=radeon_dri.so - -# The pci bus id of the video card. Find this with scanpci, lspci or -# look in /proc/pci. -pciBusID=PCI:1:0:0 - -# Is the card PCI or AGP ? -isPCI=0 - -# Virtual screen dimensions. Can reduce this to save videocard memory -# at the expense of maximum window size available. -virtualWidth=1280 -virtualHeight=1024 - -# Screen depth. Only 16 & 32bpp supported. -bpp=32 - -# AGP Mode. Not all cards supported (1, 2 or 4) -agpmode=1 - -# Rotated monitor? -- NOTE: only works with subsetted radeon driver! -rotateMode=0 - -# Do we want to use color tiling ? -colorTiling=0 - diff --git a/src/glx/mini/miniglx.c b/src/glx/mini/miniglx.c deleted file mode 100644 index 874b88bc49..0000000000 --- a/src/glx/mini/miniglx.c +++ /dev/null @@ -1,2580 +0,0 @@ -/** - * \file miniglx.c - * \brief Mini GLX interface functions. - * \author Brian Paul - * - * The Mini GLX interface is a subset of the GLX interface, plus a - * minimal set of Xlib functions. - */ - -/* - * Mesa 3-D graphics library - * Version: 6.0.1 - * - * Copyright (C) 1999-2004 Brian Paul All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - - -/** - * \mainpage Mini GLX - * - * \section miniglxIntro Introduction - * - * The Mini GLX interface facilitates OpenGL rendering on embedded devices. The - * interface is a subset of the GLX interface, plus a minimal set of Xlib-like - * functions. - * - * Programs written to the Mini GLX specification should run unchanged - * on systems with the X Window System and the GLX extension (after - * recompilation). The intention is to allow flexibility for - * prototyping and testing. - * - * The files in the src/miniglx/ directory are compiled to build the - * libGL.so library. This is the library which applications link with. - * libGL.so in turn, loads the hardware-specific device driver. - * - * - * \section miniglxDoxygen About Doxygen - * - * For a list of all files, select File List. Choose a file from - * the list for a list of all functions in the file. - * - * For a list of all functions, types, constants, etc. - * select File Members. - * - * - * \section miniglxReferences References - * - * - Mini GLX Specification, - * Tungsten Graphics, Inc. - * - OpenGL Graphics with the X Window System, Silicon Graphics, Inc., - * ftp://ftp.sgi.com/opengl/doc/opengl1.2/glx1.3.ps - * - Xlib - C Language X Interface, X Consortium Standard, X Version 11, - * Release 6.4, ftp://ftp.x.org/pub/R6.4/xc/doc/hardcopy/X11/xlib.PS.gz - * - XFree86 Man pages, The XFree86 Project, Inc., - * http://www.xfree86.org/current/manindex3.html - * - */ - -/** - * \page datatypes Notes on the XVisualInfo, Visual, and __GLXvisualConfig data types - * - * -# X (unfortunately) has two (or three) data types which - * describe visuals. Ideally, there would just be one. - * -# We need the #__GLXvisualConfig type to augment #XVisualInfo and #Visual - * because we need to describe the GLX-specific attributes of visuals. - * -# In this interface there is a one-to-one-to-one correspondence between - * the three types and they're all interconnected. - * -# The #XVisualInfo type has a pointer to a #Visual. The #Visual structure - * (aka MiniGLXVisualRec) has a pointer to the #__GLXvisualConfig. The - * #Visual structure also has a pointer pointing back to the #XVisualInfo. - * -# The #XVisualInfo structure is the only one who's contents are public. - * -# The glXChooseVisual() and XGetVisualInfo() are the only functions that - * return #XVisualInfo structures. They can be freed with XFree(), though - * there is a small memory leak. - */ - - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include /* for gettimeofday */ -#include -#include - -#include "miniglxP.h" -#include "dri_util.h" - -#include "imports.h" -#include "glcontextmodes.h" -#include "glapi.h" - -#include "pciaccess.h" - -static GLboolean __glXCreateContextWithConfig(__DRInativeDisplay *dpy, - int screen, int fbconfigID, void *contextID, - drm_context_t *hHWContext); - -static GLboolean __glXGetDrawableInfo(__DRInativeDisplay *dpy, int scrn, - __DRIid draw, unsigned int * index, unsigned int * stamp, - int * x, int * y, int * width, int * height, - int * numClipRects, drm_clip_rect_t ** pClipRects, - int * backX, int * backY, - int * numBackClipRects, drm_clip_rect_t ** pBackClipRects); - -static __DRIscreen * __glXFindDRIScreen(__DRInativeDisplay *dpy, int scrn); - -static GLboolean __glXWindowExists(__DRInativeDisplay *dpy, __DRIid draw); - -static int __glXGetUST( int64_t * ust ); - -static GLboolean __glXGetMscRate(__DRInativeDisplay * dpy, __DRIid drawable, - int32_t * numerator, int32_t * denominator); - -static GLboolean xf86DRI_DestroyContext(__DRInativeDisplay *dpy, int screen, - __DRIid context_id ); - -static GLboolean xf86DRI_CreateDrawable(__DRInativeDisplay *dpy, int screen, - __DRIid drawable, drm_drawable_t *hHWDrawable ); - -static GLboolean xf86DRI_DestroyDrawable(__DRInativeDisplay *dpy, int screen, - __DRIid drawable); - - -/** Wrapper around either malloc() */ -void * -_mesa_malloc(size_t bytes) -{ - return malloc(bytes); -} - -/** Wrapper around either calloc() */ -void * -_mesa_calloc(size_t bytes) -{ - return calloc(1, bytes); -} - -/** Wrapper around either free() */ -void -_mesa_free(void *ptr) -{ - free(ptr); -} - - -/** - * \brief Current GLX context. - * - * \sa glXGetCurrentContext(). - */ -static GLXContext CurrentContext = NULL; - - - -static Display *SignalDisplay = 0; - -static void SwitchVT(int sig) -{ - fprintf(stderr, "SwitchVT %d dpy %p\n", sig, SignalDisplay); - - if (SignalDisplay) { - SignalDisplay->vtSignalFlag = 1; - switch( sig ) - { - case SIGUSR1: /* vt has been released */ - SignalDisplay->haveVT = 0; - break; - case SIGUSR2: /* vt has been acquired */ - SignalDisplay->haveVT = 1; - break; - } - } -} - -/**********************************************************************/ -/** \name Framebuffer device functions */ -/**********************************************************************/ -/*@{*/ - -/** - * \brief Do the first part of setting up the framebuffer device. - * - * \param dpy the display handle. - * \param use_vt use a VT for display or not - * - * \return GL_TRUE on success, or GL_FALSE on failure. - * - * \sa This is called during XOpenDisplay(). - * - * \internal - * Gets the VT number, opens the respective console TTY device. Saves its state - * to restore when exiting and goes into graphics mode. - * - * Opens the framebuffer device and make a copy of the original variable screen - * information and gets the fixed screen information. Maps the framebuffer and - * MMIO region into the process address space. - */ -static GLboolean -OpenFBDev( Display *dpy, int use_vt ) -{ - char ttystr[1000]; - int fd, vtnumber, ttyfd; - - assert(dpy); - - if (geteuid()) { - fprintf(stderr, "error: you need to be root\n"); - return GL_FALSE; - } - - if (use_vt) { - - /* open /dev/tty0 and get the VT number */ - if ((fd = open("/dev/tty0", O_WRONLY, 0)) < 0) { - fprintf(stderr, "error opening /dev/tty0\n"); - return GL_FALSE; - } - if (ioctl(fd, VT_OPENQRY, &vtnumber) < 0 || vtnumber < 0) { - fprintf(stderr, "error: couldn't get a free vt\n"); - return GL_FALSE; - } - - fprintf(stderr, "*** got vt nr: %d\n", vtnumber); - close(fd); - - /* open the console tty */ - sprintf(ttystr, "/dev/tty%d", vtnumber); /* /dev/tty1-64 */ - dpy->ConsoleFD = open(ttystr, O_RDWR | O_NDELAY, 0); - if (dpy->ConsoleFD < 0) { - fprintf(stderr, "error couldn't open console fd\n"); - return GL_FALSE; - } - - /* save current vt number */ - { - struct vt_stat vts; - if (ioctl(dpy->ConsoleFD, VT_GETSTATE, &vts) == 0) - dpy->OriginalVT = vts.v_active; - } - - /* disconnect from controlling tty */ - ttyfd = open("/dev/tty", O_RDWR); - if (ttyfd >= 0) { - ioctl(ttyfd, TIOCNOTTY, 0); - close(ttyfd); - } - - /* some magic to restore the vt when we exit */ - { - struct vt_mode vt; - struct sigaction sig_tty; - - /* Set-up tty signal handler to catch the signal we request below */ - SignalDisplay = dpy; - memset( &sig_tty, 0, sizeof( sig_tty ) ); - sig_tty.sa_handler = SwitchVT; - sigemptyset( &sig_tty.sa_mask ); - if( sigaction( SIGUSR1, &sig_tty, &dpy->OrigSigUsr1 ) || - sigaction( SIGUSR2, &sig_tty, &dpy->OrigSigUsr2 ) ) - { - fprintf(stderr, "error: can't set up signal handler (%s)", - strerror(errno) ); - return GL_FALSE; - } - - - - vt.mode = VT_PROCESS; - vt.waitv = 0; - vt.relsig = SIGUSR1; - vt.acqsig = SIGUSR2; - if (ioctl(dpy->ConsoleFD, VT_SETMODE, &vt) < 0) { - fprintf(stderr, "error: ioctl(VT_SETMODE) failed: %s\n", - strerror(errno)); - return GL_FALSE; - } - - - if (ioctl(dpy->ConsoleFD, VT_ACTIVATE, vtnumber) != 0) - printf("ioctl VT_ACTIVATE: %s\n", strerror(errno)); - if (ioctl(dpy->ConsoleFD, VT_WAITACTIVE, vtnumber) != 0) - printf("ioctl VT_WAITACTIVE: %s\n", strerror(errno)); - - if (ioctl(dpy->ConsoleFD, VT_GETMODE, &vt) < 0) { - fprintf(stderr, "error: ioctl VT_GETMODE: %s\n", strerror(errno)); - return GL_FALSE; - } - - - - } - - /* go into graphics mode */ - if (ioctl(dpy->ConsoleFD, KDSETMODE, KD_GRAPHICS) < 0) { - fprintf(stderr, "error: ioctl(KDSETMODE, KD_GRAPHICS) failed: %s\n", - strerror(errno)); - return GL_FALSE; - } - } - - /* open the framebuffer device */ - dpy->FrameBufferFD = open(dpy->fbdevDevice, O_RDWR); - if (dpy->FrameBufferFD < 0) { - fprintf(stderr, "Error opening /dev/fb0: %s\n", strerror(errno)); - return GL_FALSE; - } - - /* get the original variable screen info */ - if (ioctl(dpy->FrameBufferFD, FBIOGET_VSCREENINFO, &dpy->OrigVarInfo)) { - fprintf(stderr, "error: ioctl(FBIOGET_VSCREENINFO) failed: %s\n", - strerror(errno)); - return GL_FALSE; - } - - /* make copy */ - dpy->VarInfo = dpy->OrigVarInfo; /* structure copy */ - - /* Turn off hw accels (otherwise mmap of mmio region will be - * refused) - */ - dpy->VarInfo.accel_flags = 0; - if (ioctl(dpy->FrameBufferFD, FBIOPUT_VSCREENINFO, &dpy->VarInfo)) { - fprintf(stderr, "error: ioctl(FBIOPUT_VSCREENINFO) failed: %s\n", - strerror(errno)); - return GL_FALSE; - } - - - - /* Get the fixed screen info */ - if (ioctl(dpy->FrameBufferFD, FBIOGET_FSCREENINFO, &dpy->FixedInfo)) { - fprintf(stderr, "error: ioctl(FBIOGET_FSCREENINFO) failed: %s\n", - strerror(errno)); - return GL_FALSE; - } - - - - /* mmap the framebuffer into our address space */ - dpy->driverContext.FBStart = dpy->FixedInfo.smem_start; - dpy->driverContext.FBSize = dpy->FixedInfo.smem_len; - dpy->driverContext.shared.fbSize = dpy->FixedInfo.smem_len; - dpy->driverContext.FBAddress = (caddr_t) mmap(0, /* start */ - dpy->driverContext.shared.fbSize, /* bytes */ - PROT_READ | PROT_WRITE, /* prot */ - MAP_SHARED, /* flags */ - dpy->FrameBufferFD, /* fd */ - 0 /* offset */); - if (dpy->driverContext.FBAddress == (caddr_t) - 1) { - fprintf(stderr, "error: unable to mmap framebuffer: %s\n", - strerror(errno)); - return GL_FALSE; - } - - /* mmap the MMIO region into our address space */ - dpy->driverContext.MMIOStart = dpy->FixedInfo.mmio_start; - dpy->driverContext.MMIOSize = dpy->FixedInfo.mmio_len; - dpy->driverContext.MMIOAddress = (caddr_t) mmap(0, /* start */ - dpy->driverContext.MMIOSize, /* bytes */ - PROT_READ | PROT_WRITE, /* prot */ - MAP_SHARED, /* flags */ - dpy->FrameBufferFD, /* fd */ - dpy->FixedInfo.smem_len /* offset */); - if (dpy->driverContext.MMIOAddress == (caddr_t) - 1) { - fprintf(stderr, "error: unable to mmap mmio region: %s\n", - strerror(errno)); - return GL_FALSE; - } - - fprintf(stderr, "got MMIOAddress %p offset %d\n", - dpy->driverContext.MMIOAddress, - dpy->FixedInfo.smem_len); - - return GL_TRUE; -} - - - - -/** - * \brief Setup up the desired framebuffer device mode. - * - * \param dpy the display handle. - * - * \return GL_TRUE on success, or GL_FALSE on failure. - * - * \sa This is called during __miniglx_StartServer(). - * - * \internal - * - * Bumps the size of the window the the next supported mode. Sets the - * variable screen information according to the desired mode and asks - * the driver to validate the mode. Certifies that a DirectColor or - * TrueColor visual is used from the updated fixed screen information. - * In the case of DirectColor visuals, sets up an 'identity' colormap to - * mimic a TrueColor visual. - * - * Calls the driver hooks 'ValidateMode' and 'PostValidateMode' to - * allow the driver to make modifications to the chosen mode according - * to hardware constraints, or to save and restore videocard registers - * that may be clobbered by the fbdev driver. - * - * \todo Timings are hard-coded in the source for a set of supported modes. - */ -static GLboolean -SetupFBDev( Display *dpy ) -{ - int width, height; - - assert(dpy); - - width = dpy->driverContext.shared.virtualWidth; - height = dpy->driverContext.shared.virtualHeight; - - if (width==832) - width=800; -#if 0 - /* Bump size up to next supported mode. - */ - if (width <= 720 && height <= 480) { - width = 720; height = 480; - } - else if (width <= 960 && height <= 540) { - width = 960; height = 540; - } - else if (width <= 800 && height <= 600) { - width = 800; height = 600; - } - else if (width <= 1024 && height <= 768) { - width = 1024; height = 768; - } - else if (width <= 768 && height <= 1024) { - width = 768; height = 1024; - } - else if (width <= 1280 && height <= 1024) { - width = 1280; height = 1024; - } -#endif - - dpy->driverContext.shared.fbStride = width * (dpy->driverContext.bpp / 8); - - /* set the depth, resolution, etc */ - dpy->VarInfo = dpy->OrigVarInfo; - dpy->VarInfo.bits_per_pixel = dpy->driverContext.bpp; - dpy->VarInfo.xres_virtual = dpy->driverContext.shared.virtualWidth; - dpy->VarInfo.yres_virtual = dpy->driverContext.shared.virtualHeight; - dpy->VarInfo.xres = dpy->driverContext.shared.Width; - dpy->VarInfo.yres = height; - dpy->VarInfo.xoffset = 0; - dpy->VarInfo.yoffset = 0; - dpy->VarInfo.nonstd = 0; - dpy->VarInfo.vmode &= ~FB_VMODE_YWRAP; /* turn off scrolling */ - - if (dpy->VarInfo.bits_per_pixel == 32) { - dpy->VarInfo.red.offset = 16; - dpy->VarInfo.green.offset = 8; - dpy->VarInfo.blue.offset = 0; - dpy->VarInfo.transp.offset = 24; - dpy->VarInfo.red.length = 8; - dpy->VarInfo.green.length = 8; - dpy->VarInfo.blue.length = 8; - dpy->VarInfo.transp.length = 8; - } - else if (dpy->VarInfo.bits_per_pixel == 16) { - dpy->VarInfo.red.offset = 11; - dpy->VarInfo.green.offset = 5; - dpy->VarInfo.blue.offset = 0; - dpy->VarInfo.red.length = 5; - dpy->VarInfo.green.length = 6; - dpy->VarInfo.blue.length = 5; - dpy->VarInfo.transp.offset = 0; - dpy->VarInfo.transp.length = 0; - } - else { - fprintf(stderr, "Only 32bpp and 16bpp modes supported at the moment\n"); - return 0; - } - - if (!dpy->driver->validateMode( &dpy->driverContext )) { - fprintf(stderr, "Driver validateMode() failed\n"); - return 0; - } - - /* These should be calculated with the gtf.c program, and then we could - remove all this... AlanH. */ - if (dpy->VarInfo.xres == 1280 && - dpy->VarInfo.yres == 1024) { - /* timing values taken from /etc/fb.modes (1280x1024 @ 75Hz) */ - dpy->VarInfo.pixclock = 7408; - dpy->VarInfo.left_margin = 248; - dpy->VarInfo.right_margin = 16; - dpy->VarInfo.upper_margin = 38; - dpy->VarInfo.lower_margin = 1; - dpy->VarInfo.hsync_len = 144; - dpy->VarInfo.vsync_len = 3; - } - else if (dpy->VarInfo.xres == 1024 && - dpy->VarInfo.yres == 768) { - /* timing values taken from /etc/fb.modes (1024x768 @ 75Hz) */ - dpy->VarInfo.pixclock = 12699; - dpy->VarInfo.left_margin = 176; - dpy->VarInfo.right_margin = 16; - dpy->VarInfo.upper_margin = 28; - dpy->VarInfo.lower_margin = 1; - dpy->VarInfo.hsync_len = 96; - dpy->VarInfo.vsync_len = 3; - } - else if (dpy->VarInfo.xres == 800 && - dpy->VarInfo.yres == 600) { - /* timing values taken from /etc/fb.modes (800x600 @ 75Hz) */ - dpy->VarInfo.pixclock = 27778; - dpy->VarInfo.left_margin = 128; - dpy->VarInfo.right_margin = 24; - dpy->VarInfo.upper_margin = 22; - dpy->VarInfo.lower_margin = 1; - dpy->VarInfo.hsync_len = 72; - dpy->VarInfo.vsync_len = 2; - } - else if (dpy->VarInfo.xres == 720 && - dpy->VarInfo.yres == 480) { - dpy->VarInfo.pixclock = 37202; - dpy->VarInfo.left_margin = 88; - dpy->VarInfo.right_margin = 16; - dpy->VarInfo.upper_margin = 14; - dpy->VarInfo.lower_margin = 1; - dpy->VarInfo.hsync_len = 72; - dpy->VarInfo.vsync_len = 3; - } - else if (dpy->VarInfo.xres == 960 && - dpy->VarInfo.yres == 540) { - dpy->VarInfo.pixclock = 24273; - dpy->VarInfo.left_margin = 128; - dpy->VarInfo.right_margin = 32; - dpy->VarInfo.upper_margin = 16; - dpy->VarInfo.lower_margin = 1; - dpy->VarInfo.hsync_len = 96; - dpy->VarInfo.vsync_len = 3; - } - else if (dpy->VarInfo.xres == 768 && - dpy->VarInfo.yres == 1024) { - /* timing values for 768x1024 @ 75Hz */ - dpy->VarInfo.pixclock = 11993; - dpy->VarInfo.left_margin = 136; - dpy->VarInfo.right_margin = 32; - dpy->VarInfo.upper_margin = 41; - dpy->VarInfo.lower_margin = 1; - dpy->VarInfo.hsync_len = 80; - dpy->VarInfo.vsync_len = 3; - } - else { - /* XXX need timings for other screen sizes */ - fprintf(stderr, "XXXX screen size %d x %d not supported at this time!\n", - dpy->VarInfo.xres, dpy->VarInfo.yres); - return GL_FALSE; - } - - fprintf(stderr, "[miniglx] Setting mode: visible %dx%d virtual %dx%dx%d\n", - dpy->VarInfo.xres, dpy->VarInfo.yres, - dpy->VarInfo.xres_virtual, dpy->VarInfo.yres_virtual, - dpy->VarInfo.bits_per_pixel); - - /* set variable screen info */ - if (ioctl(dpy->FrameBufferFD, FBIOPUT_VSCREENINFO, &dpy->VarInfo)) { - fprintf(stderr, "error: ioctl(FBIOPUT_VSCREENINFO) failed: %s\n", - strerror(errno)); - return GL_FALSE; - } - - /* get the variable screen info, in case it has been modified */ - if (ioctl(dpy->FrameBufferFD, FBIOGET_VSCREENINFO, &dpy->VarInfo)) { - fprintf(stderr, "error: ioctl(FBIOGET_VSCREENINFO) failed: %s\n", - strerror(errno)); - return GL_FALSE; - } - - - fprintf(stderr, "[miniglx] Readback mode: visible %dx%d virtual %dx%dx%d\n", - dpy->VarInfo.xres, dpy->VarInfo.yres, - dpy->VarInfo.xres_virtual, dpy->VarInfo.yres_virtual, - dpy->VarInfo.bits_per_pixel); - - /* Get the fixed screen info */ - if (ioctl(dpy->FrameBufferFD, FBIOGET_FSCREENINFO, &dpy->FixedInfo)) { - fprintf(stderr, "error: ioctl(FBIOGET_FSCREENINFO) failed: %s\n", - strerror(errno)); - return GL_FALSE; - } - - if (dpy->FixedInfo.visual != FB_VISUAL_TRUECOLOR && - dpy->FixedInfo.visual != FB_VISUAL_DIRECTCOLOR) { - fprintf(stderr, "non-TRUECOLOR visuals not supported.\n"); - return GL_FALSE; - } - - if (dpy->FixedInfo.visual == FB_VISUAL_DIRECTCOLOR) { - struct fb_cmap cmap; - unsigned short red[256], green[256], blue[256]; - int rcols = 1 << dpy->VarInfo.red.length; - int gcols = 1 << dpy->VarInfo.green.length; - int bcols = 1 << dpy->VarInfo.blue.length; - int i; - - cmap.start = 0; - cmap.len = gcols; - cmap.red = red; - cmap.green = green; - cmap.blue = blue; - cmap.transp = NULL; - - for (i = 0; i < rcols ; i++) - red[i] = (65536/(rcols-1)) * i; - - for (i = 0; i < gcols ; i++) - green[i] = (65536/(gcols-1)) * i; - - for (i = 0; i < bcols ; i++) - blue[i] = (65536/(bcols-1)) * i; - - if (ioctl(dpy->FrameBufferFD, FBIOPUTCMAP, (void *) &cmap) < 0) { - fprintf(stderr, "ioctl(FBIOPUTCMAP) failed [%d]\n", i); - exit(1); - } - } - - /* May need to restore regs fbdev has clobbered: - */ - if (!dpy->driver->postValidateMode( &dpy->driverContext )) { - fprintf(stderr, "Driver postValidateMode() failed\n"); - return 0; - } - - return GL_TRUE; -} - - -/** - * \brief Restore the framebuffer device to state it was in before we started - * - * Undoes the work done by SetupFBDev(). - * - * \param dpy the display handle. - * - * \return GL_TRUE on success, or GL_FALSE on failure. - * - * \sa Called from XDestroyWindow(). - * - * \internal - * Restores the original variable screen info. - */ -static GLboolean -RestoreFBDev( Display *dpy ) -{ - /* restore original variable screen info */ - if (ioctl(dpy->FrameBufferFD, FBIOPUT_VSCREENINFO, &dpy->OrigVarInfo)) { - fprintf(stderr, "ioctl(FBIOPUT_VSCREENINFO failed): %s\n", - strerror(errno)); - return GL_FALSE; - } - dpy->VarInfo = dpy->OrigVarInfo; - - return GL_TRUE; -} - - -/** - * \brief Close the framebuffer device. - * - * \param dpy the display handle. - * - * \sa Called from XCloseDisplay(). - * - * \internal - * Unmaps the framebuffer and MMIO region. Restores the text mode and the - * original virtual terminal. Closes the console and framebuffer devices. - */ -static void -CloseFBDev( Display *dpy ) -{ - struct vt_mode VT; - - munmap(dpy->driverContext.FBAddress, dpy->driverContext.FBSize); - munmap(dpy->driverContext.MMIOAddress, dpy->driverContext.MMIOSize); - - if (dpy->ConsoleFD) { - /* restore text mode */ - ioctl(dpy->ConsoleFD, KDSETMODE, KD_TEXT); - - /* set vt */ - if (ioctl(dpy->ConsoleFD, VT_GETMODE, &VT) != -1) { - VT.mode = VT_AUTO; - ioctl(dpy->ConsoleFD, VT_SETMODE, &VT); - } - - /* restore original vt */ - if (dpy->OriginalVT >= 0) { - ioctl(dpy->ConsoleFD, VT_ACTIVATE, dpy->OriginalVT); - dpy->OriginalVT = -1; - } - - close(dpy->ConsoleFD); - } - close(dpy->FrameBufferFD); -} - -/*@}*/ - - -/**********************************************************************/ -/** \name Misc functions needed for DRI drivers */ -/**********************************************************************/ -/*@{*/ - -/** - * \brief Find the DRI screen dependent methods associated with the display. - * - * \param dpy a display handle, as returned by XOpenDisplay(). - * \param scrn the screen number. Not referenced. - * - * \returns a pointer to a __DRIscreenRec structure. - * - * \internal - * Returns the MiniGLXDisplayRec::driScreen attribute. - */ -static __DRIscreen * -__glXFindDRIScreen(__DRInativeDisplay *dpy, int scrn) -{ - (void) scrn; - return &((Display*)dpy)->driScreen; -} - -/** - * \brief Validate a drawable. - * - * \param dpy a display handle, as returned by XOpenDisplay(). - * \param draw drawable to validate. - * - * \internal - * Since Mini GLX only supports one window, compares the specified drawable with - * the MiniGLXDisplayRec::TheWindow attribute. - */ -static GLboolean -__glXWindowExists(__DRInativeDisplay *dpy, __DRIid draw) -{ - const Display * const display = (Display*)dpy; - if (display->TheWindow == (Window) draw) - return True; - else - return False; -} - -/** - * \brief Get current thread ID. - * - * \return thread ID. - * - * \internal - * Always returns 0. - */ -/*unsigned long -_glthread_GetID(void) -{ - return 0; -}*/ - -/*@}*/ - - -/** - * \brief Scan Linux /prog/bus/pci/devices file to determine hardware - * chipset based on supplied bus ID. - * - * \return probed chipset (non-zero) on success, zero otherwise. - * - * \internal - */ -static int get_chipset_from_busid( Display *dpy ) -{ - char buf[0x200]; - FILE *file; - const char *fname = "/proc/bus/pci/devices"; - int retval = 0; - - if (!(file = fopen(fname,"r"))) { - fprintf(stderr, "couldn't open %s: %s\n", fname, strerror(errno)); - return 0; - } - - while (fgets(buf, sizeof(buf)-1, file)) { - unsigned int nr, bus, dev, fn, vendor, device, encode; - nr = sscanf(buf, "%04x\t%04x%04x", &encode, - &vendor, &device); - - bus = encode >> 8; - dev = (encode & 0xFF) >> 3; - fn = encode & 0x7; - - if (nr != 3) - break; - - if (bus == dpy->driverContext.pciBus && - dev == dpy->driverContext.pciDevice && - fn == dpy->driverContext.pciFunc) { - retval = device; - break; - } - } - - fclose(file); - - if (retval) - fprintf(stderr, "[miniglx] probed chipset 0x%x\n", retval); - else - fprintf(stderr, "[miniglx] failed to probe chipset\n"); - - return retval; -} - - -/** - * \brief Read settings from a configuration file. - * - * The configuration file is usually "/etc/miniglx.conf", but can be overridden - * with the MINIGLX_CONF environment variable. - * - * The format consists in \code option = value \endcode lines. The option names - * corresponds to the fields in MiniGLXDisplayRec. - * - * \param dpy the display handle as. - * - * \return non-zero on success, zero otherwise. - * - * \internal - * Sets some defaults. Opens and parses the the Mini GLX configuration file and - * fills in the MiniGLXDisplayRec field that corresponds for each option. - */ -static int __read_config_file( Display *dpy ) -{ - FILE *file; - const char *fname; - - /* Fallback/defaults - */ - dpy->fbdevDevice = "/dev/fb0"; - dpy->clientDriverName = "fb_dri.so"; - dpy->driverContext.pciBus = 0; - dpy->driverContext.pciDevice = 0; - dpy->driverContext.pciFunc = 0; - dpy->driverContext.chipset = 0; - dpy->driverContext.pciBusID = 0; - dpy->driverContext.shared.virtualWidth = 1280; - dpy->driverContext.shared.virtualHeight = 1024; - dpy->driverContext.bpp = 32; - dpy->driverContext.cpp = 4; - dpy->rotateMode = 0; - dpy->driverContext.agpmode = 1; - dpy->driverContext.isPCI = 0; - dpy->driverContext.colorTiling = 0; - - fname = getenv("MINIGLX_CONF"); - if (!fname) fname = "/etc/miniglx.conf"; - - file = fopen(fname, "r"); - if (!file) { - fprintf(stderr, "couldn't open config file %s: %s\n", fname, strerror(errno)); - return 0; - } - - - while (!feof(file)) { - char buf[81], *opt = buf, *val, *tmp1, *tmp2; - fgets(buf, sizeof(buf), file); - - /* Parse 'opt = val' -- must be easier ways to do this. - */ - while (isspace(*opt)) opt++; - val = opt; - if (*val == '#') continue; /* comment */ - while (!isspace(*val) && *val != '=' && *val) val++; - tmp1 = val; - while (isspace(*val)) val++; - if (*val != '=') continue; - *tmp1 = 0; - val++; - while (isspace(*val)) val++; - tmp2 = val; - while (!isspace(*tmp2) && *tmp2 != '\n' && *tmp2) tmp2++; - *tmp2 = 0; - - - if (strcmp(opt, "fbdevDevice") == 0) - dpy->fbdevDevice = strdup(val); - else if (strcmp(opt, "clientDriverName") == 0) - dpy->clientDriverName = strdup(val); - else if (strcmp(opt, "rotateMode") == 0) - dpy->rotateMode = atoi(val) ? 1 : 0; - else if (strcmp(opt, "pciBusID") == 0) { - if (sscanf(val, "PCI:%d:%d:%d", - &dpy->driverContext.pciBus, - &dpy->driverContext.pciDevice, - &dpy->driverContext.pciFunc) != 3) { - fprintf(stderr, "malformed bus id: %s\n", val); - continue; - } - dpy->driverContext.pciBusID = strdup(val); - } - else if (strcmp(opt, "chipset") == 0) { - if (sscanf(val, "0x%x", &dpy->driverContext.chipset) != 1) - fprintf(stderr, "malformed chipset: %s\n", opt); - } - else if (strcmp(opt, "virtualWidth") == 0) { - if (sscanf(val, "%d", &dpy->driverContext.shared.virtualWidth) != 1) - fprintf(stderr, "malformed virtualWidth: %s\n", opt); - } - else if (strcmp(opt, "virtualHeight") == 0) { - if (sscanf(val, "%d", &dpy->driverContext.shared.virtualHeight) != 1) - fprintf(stderr, "malformed virutalHeight: %s\n", opt); - } - else if (strcmp(opt, "bpp") == 0) { - if (sscanf(val, "%d", &dpy->driverContext.bpp) != 1) - fprintf(stderr, "malformed bpp: %s\n", opt); - dpy->driverContext.cpp = dpy->driverContext.bpp / 8; - } - else if (strcmp(opt, "agpmode") == 0) { - if (sscanf(val, "%d", &dpy->driverContext.agpmode) != 1) - fprintf(stderr, "malformed agpmode: %s\n", opt); - } - else if (strcmp(opt, "isPCI") == 0) { - dpy->driverContext.isPCI = atoi(val) ? 1 : 0; - } - else if (strcmp(opt, "colorTiling") == 0) { - dpy->driverContext.colorTiling = atoi(val) ? 1 : 0; - } - } - - fclose(file); - - if (dpy->driverContext.chipset == 0 && dpy->driverContext.pciBusID != 0) - dpy->driverContext.chipset = get_chipset_from_busid( dpy ); - - return 1; -} - -/** - * Versioned name of the expected \c __driCreateNewScreen function. - * - * The version of the last incompatible loader/driver inteface change is - * appended to the name of the \c __driCreateNewScreen function. This - * prevents loaders from trying to load drivers that are too old. - * - * \todo - * Create a macro or something so that this is automatically updated. - */ -static const char createNewScreenName[] = "__driCreateNewScreen_20050727"; - - -static int InitDriver( Display *dpy ) -{ - /* - * Begin DRI setup. - * We're kind of combining the per-display and per-screen information - * which was kept separate in XFree86/DRI's libGL. - */ - dpy->dlHandle = dlopen(dpy->clientDriverName, RTLD_NOW | RTLD_GLOBAL); - if (!dpy->dlHandle) { - fprintf(stderr, "Unable to open %s: %s\n", dpy->clientDriverName, - dlerror()); - goto failed; - } - - /* Pull in Mini GLX specific hooks: - */ - dpy->driver = (struct DRIDriverRec *) dlsym(dpy->dlHandle, - "__driDriver"); - if (!dpy->driver) { - fprintf(stderr, "Couldn't find __driDriver in %s\n", - dpy->clientDriverName); - goto failed; - } - - /* Pull in standard DRI client-side driver hooks: - */ - dpy->createNewScreen = (PFNCREATENEWSCREENFUNC) - dlsym(dpy->dlHandle, createNewScreenName); - if (!dpy->createNewScreen) { - fprintf(stderr, "Couldn't find %s in %s\n", createNewScreenName, - dpy->clientDriverName); - goto failed; - } - - return GL_TRUE; - -failed: - if (dpy->dlHandle) { - dlclose(dpy->dlHandle); - dpy->dlHandle = 0; - } - return GL_FALSE; -} - - -/**********************************************************************/ -/** \name Public API functions (Xlib and GLX) */ -/**********************************************************************/ -/*@{*/ - - -/** - * \brief Initialize the graphics system. - * - * \param display_name currently ignored. It is recommended to pass it as NULL. - * \return a pointer to a #Display if the function is able to initialize - * the graphics system, NULL otherwise. - * - * Allocates a MiniGLXDisplayRec structure and fills in with information from a - * configuration file. - * - * Calls OpenFBDev() to open the framebuffer device and calls - * DRIDriverRec::initFBDev to do the client-side initialization on it. - * - * Loads the DRI driver and pulls in Mini GLX specific hooks into a - * DRIDriverRec structure, and the standard DRI \e __driCreateScreen hook. - * Asks the driver for a list of supported visuals. Performs the per-screen - * client-side initialization. Also setups the callbacks in the screen private - * information. - * - * Does the framebuffer device setup. Calls __miniglx_open_connections() to - * serve clients. - */ -Display * -__miniglx_StartServer( const char *display_name ) -{ - Display *dpy; - int use_vt = 0; - - pci_system_init(); - - dpy = (Display *)calloc(1, sizeof(Display)); - if (!dpy) - return NULL; - - dpy->IsClient = False; - - if (!__read_config_file( dpy )) { - fprintf(stderr, "Couldn't get configuration details\n"); - free(dpy); - return NULL; - } - - /* Open the fbdev device - */ - if (!OpenFBDev(dpy, use_vt)) { - fprintf(stderr, "OpenFBDev failed\n"); - free(dpy); - return NULL; - } - - if (!InitDriver(dpy)) { - fprintf(stderr, "InitDriver failed\n"); - free(dpy); - return NULL; - } - - /* Perform the initialization normally done in the X server - */ - if (!dpy->driver->initFBDev( &dpy->driverContext )) { - fprintf(stderr, "%s: __driInitFBDev failed\n", __FUNCTION__); - dlclose(dpy->dlHandle); - return GL_FALSE; - } - - /* do fbdev setup - */ - if (!SetupFBDev(dpy)) { - fprintf(stderr, "SetupFBDev failed\n"); - free(dpy); - return NULL; - } - - /* unlock here if not using VT -- JDS */ - if (!use_vt) { - if (dpy->driver->restoreHardware) - dpy->driver->restoreHardware( &dpy->driverContext ); - DRM_UNLOCK( dpy->driverContext.drmFD, - dpy->driverContext.pSAREA, - dpy->driverContext.serverContext ); - dpy->hwActive = 1; - } - - /* Ready for clients: - */ - if (!__miniglx_open_connections(dpy)) { - free(dpy); - return NULL; - } - - return dpy; -} - - -/** - * Implement \c __DRIinterfaceMethods::getProcAddress. - */ -static __DRIfuncPtr get_proc_address( const char * proc_name ) -{ - (void) proc_name; - return NULL; -} - - -/** - * Table of functions exported by the loader to the driver. - */ -static const __DRIinterfaceMethods interface_methods = { - get_proc_address, - - _gl_context_modes_create, - _gl_context_modes_destroy, - - __glXFindDRIScreen, - __glXWindowExists, - - __glXCreateContextWithConfig, - xf86DRI_DestroyContext, - - xf86DRI_CreateDrawable, - xf86DRI_DestroyDrawable, - __glXGetDrawableInfo, - - __glXGetUST, - __glXGetMscRate, -}; - - -static void * -CallCreateNewScreen(Display *dpy, int scrn, __DRIscreen *psc) -{ - void *psp = NULL; - drm_handle_t hSAREA; - drmAddress pSAREA; - const char *BusID; - int i; - __DRIversion ddx_version; - __DRIversion dri_version; - __DRIversion drm_version; - __DRIframebuffer framebuffer; - int fd = -1; - int status; - const char * err_msg; - const char * err_extra; - drmVersionPtr version; - drm_handle_t hFB; - drm_magic_t magic; - - - hSAREA = dpy->driverContext.shared.hSAREA; - BusID = dpy->driverContext.pciBusID; - - fd = drmOpen(NULL, BusID); - - err_msg = "open DRM"; - err_extra = strerror( -fd ); - - if (fd < 0) goto done; - - err_msg = "drmGetMagic"; - err_extra = NULL; - - if (drmGetMagic(fd, &magic)) goto done; - - dpy->authorized = False; - send_char_msg( dpy, 0, _Authorize ); - send_msg( dpy, 0, &magic, sizeof(magic)); - - /* force net buffer flush */ - while (!dpy->authorized) - handle_fd_events( dpy, 0 ); - - version = drmGetVersion(fd); - if (version) { - drm_version.major = version->version_major; - drm_version.minor = version->version_minor; - drm_version.patch = version->version_patchlevel; - drmFreeVersion(version); - } - else { - drm_version.major = -1; - drm_version.minor = -1; - drm_version.patch = -1; - } - - /* - * Get device name (like "tdfx") and the ddx version numbers. - * We'll check the version in each DRI driver's "createScreen" - * function. - */ - ddx_version.major = -1; - ddx_version.minor = 0; - ddx_version.patch = 0; - - /* - * Get the DRI X extension version. - */ - dri_version.major = 4; - dri_version.minor = 0; - dri_version.patch = 0; - - /* - * Get device-specific info. pDevPriv will point to a struct - * (such as DRIRADEONRec in xfree86/driver/ati/radeon_dri.h) - * that has information about the screen size, depth, pitch, - * ancilliary buffers, DRM mmap handles, etc. - */ - hFB = dpy->driverContext.shared.hFrameBuffer; - framebuffer.size = dpy->driverContext.shared.fbSize; - framebuffer.stride = dpy->driverContext.shared.fbStride; - framebuffer.dev_priv_size = dpy->driverContext.driverClientMsgSize; - framebuffer.dev_priv = dpy->driverContext.driverClientMsg; - framebuffer.width = dpy->driverContext.shared.virtualWidth; - framebuffer.height = dpy->driverContext.shared.virtualHeight; - - /* - * Map the framebuffer region. - */ - status = drmMap(fd, hFB, framebuffer.size, - (drmAddressPtr)&framebuffer.base); - - err_msg = "drmMap of framebuffer"; - err_extra = strerror( -status ); - - if ( status != 0 ) goto done; - - /* - * Map the SAREA region. Further mmap regions may be setup in - * each DRI driver's "createScreen" function. - */ - status = drmMap(fd, hSAREA, SAREA_MAX, &pSAREA); - - err_msg = "drmMap of sarea"; - err_extra = strerror( -status ); - - if ( status == 0 ) { - err_msg = "InitDriver"; - err_extra = NULL; - psp = dpy->createNewScreen(dpy, scrn, psc, NULL, - & ddx_version, - & dri_version, - & drm_version, - & framebuffer, - pSAREA, - fd, - 20050727, - & interface_methods, - (__GLcontextModes **) &dpy->driver_modes); - - /* fill in dummy visual ids */ - { - __GLcontextModes *temp; - temp = (__GLcontextModes *)dpy->driver_modes; - i = 1; - while (temp) - { - temp->visualID = i++; - temp=temp->next; - } - } - } - -done: - if ( psp == NULL ) { - if ( pSAREA != MAP_FAILED ) { - (void)drmUnmap(pSAREA, SAREA_MAX); - } - - if ( framebuffer.base != MAP_FAILED ) { - (void)drmUnmap((drmAddress)framebuffer.base, framebuffer.size); - } - - if ( framebuffer.dev_priv != NULL ) { - free(framebuffer.dev_priv); - } - - if ( fd >= 0 ) { - (void)drmClose(fd); - } - - if ( err_extra != NULL ) { - fprintf(stderr, "libGL error: %s failed (%s)\n", err_msg, - err_extra); - } - else { - fprintf(stderr, "libGL error: %s failed\n", err_msg ); - } - - fprintf(stderr, "libGL error: reverting to (slow) indirect rendering\n"); - } - - return psp; -} - -/** - * \brief Initialize the graphics system. - * - * \param display_name currently ignored. It is recommended to pass it as NULL. - * \return a pointer to a #Display if the function is able to initialize - * the graphics system, NULL otherwise. - * - * Allocates a MiniGLXDisplayRec structure and fills in with information from a - * configuration file. - * - * Calls __miniglx_open_connections() to connect to the server. - * - * Loads the DRI driver and pulls in Mini GLX specific hooks into a - * DRIDriverRec structure, and the standard DRI \e __driCreateScreen hook. - * Asks the driver for a list of supported visuals. Performs the per-screen - * client-side initialization. Also setups the callbacks in the screen private - * information. - * - * \todo - * - read config file - * - what about virtualWidth, etc? - * - determine dpy->driverClientMsgSize, - * - allocate dpy->driverClientMsg - */ -Display * -XOpenDisplay( const char *display_name ) -{ - Display *dpy; - - dpy = (Display *)calloc(1, sizeof(Display)); - if (!dpy) - return NULL; - - dpy->IsClient = True; - - /* read config file - */ - if (!__read_config_file( dpy )) { - fprintf(stderr, "Couldn't get configuration details\n"); - free(dpy); - return NULL; - } - - /* Connect to the server and receive driverClientMsg - */ - if (!__miniglx_open_connections(dpy)) { - free(dpy); - return NULL; - } - - /* dlopen the driver .so file - */ - if (!InitDriver(dpy)) { - fprintf(stderr, "InitDriver failed\n"); - free(dpy); - return NULL; - } - - /* Perform the client-side initialization. - * - * Clearly there is a limit of one on the number of windows in - * existence at any time. - * - * Need to shut down DRM and free DRI data in XDestroyWindow(), too. - */ - dpy->driScreen.private = CallCreateNewScreen(dpy, 0, &dpy->driScreen); - if (!dpy->driScreen.private) { - fprintf(stderr, "%s: __driCreateScreen failed\n", __FUNCTION__); - dlclose(dpy->dlHandle); - free(dpy); - return NULL; - } - - /* Anything more to do? - */ - return dpy; -} - - -/** - * \brief Release display resources. - * - * When the application is about to exit, the resources associated with the - * graphics system can be released by calling this function. - * - * \param dpy display handle. It becomes invalid at this point. - * - * Destroys the window if any, and destroys the per-screen - * driver private information. - * Calls __miniglx_close_connections(). - * - * If a server, puts the the framebuffer back into the initial state. - * - * Finally frees the display structure. - */ -void -XCloseDisplay( Display *dpy ) -{ - glXMakeCurrent( dpy, NULL, NULL); - - if (dpy->NumWindows) - XDestroyWindow( dpy, dpy->TheWindow ); - - /* As this is done in XOpenDisplay, need to undo it here: - */ - dpy->driScreen.destroyScreen(dpy, 0, dpy->driScreen.private); - - __miniglx_close_connections( dpy ); - - if (!dpy->IsClient) { - /* put framebuffer back to initial state - */ - (*dpy->driver->haltFBDev)( &dpy->driverContext ); - RestoreFBDev(dpy); - CloseFBDev(dpy); - } - - dlclose(dpy->dlHandle); - free(dpy); -} - - -/** - * \brief Window creation. - * - * \param display a display handle, as returned by XOpenDisplay(). - * \param parent the parent window for the new window. For Mini GLX this should - * be - * \code RootWindow(display, 0) \endcode - * \param x the window abscissa. For Mini GLX, it should be zero. - * \param y the window ordinate. For Mini GLX, it should be zero. - * \param width the window width. For Mini GLX, this specifies the desired - * screen width such as 1024 or 1280. - * \param height the window height. For Mini GLX, this specifies the desired - * screen height such as 768 or 1024. - * \param border_width the border width. For Mini GLX, it should be zero. - * \param depth the window pixel depth. For Mini GLX, this should be the depth - * found in the #XVisualInfo object returned by glXChooseVisual() - * \param winclass the window class. For Mini GLX this value should be - * #InputOutput. - * \param visual the visual type. It should be the visual field of the - * #XVisualInfo object returned by glXChooseVisual(). - * \param valuemask which fields of the XSetWindowAttributes() are to be used. - * For Mini GLX this is typically the bitmask - * \code CWBackPixel | CWBorderPixel | CWColormap \endcode - * \param attributes initial window attributes. The - * XSetWindowAttributes::background_pixel, XSetWindowAttributes::border_pixel - * and XSetWindowAttributes::colormap fields should be set. - * - * \return a window handle if it succeeds or zero if it fails. - * - * \note For Mini GLX, windows are full-screen; they cover the entire frame - * buffer. Also, Mini GLX imposes a limit of one window. A second window - * cannot be created until the first one is destroyed. - * - * This function creates and initializes a ::MiniGLXWindowRec structure after - * ensuring that there is no other window created. Performs the per-drawable - * client-side initialization calling the __DRIscreenRec::createDrawable - * method. - * - */ -Window -XCreateWindow( Display *dpy, Window parent, int x, int y, - unsigned int width, unsigned int height, - unsigned int border_width, int depth, unsigned int winclass, - Visual *visual, unsigned long valuemask, - XSetWindowAttributes *attributes ) -{ - const int empty_attribute_list[1] = { None }; - - Window win; - - /* ignored */ - (void) x; - (void) y; - (void) border_width; - (void) depth; - (void) winclass; - (void) valuemask; - (void) attributes; - - if (!dpy->IsClient) { - fprintf(stderr, "Server process may not create windows (currently)\n"); - return NULL; - } - - if (dpy->NumWindows > 0) - return NULL; /* only allow one window */ - - assert(dpy->TheWindow == NULL); - - win = malloc(sizeof(struct MiniGLXWindowRec)); - if (!win) - return NULL; - - /* In rotated mode, translate incoming x,y,width,height into - * 'normal' coordinates. - */ - if (dpy->rotateMode) { - int tmp; - tmp = width; width = height; height = tmp; - tmp = x; x = y; y = tmp; - } - - /* init other per-window fields */ - win->x = x; - win->y = y; - win->w = width; - win->h = height; - win->visual = visual; /* ptr assignment */ - - win->bytesPerPixel = dpy->driverContext.cpp; - win->rowStride = dpy->driverContext.shared.virtualWidth * win->bytesPerPixel; - win->size = win->rowStride * height; - win->frontStart = dpy->driverContext.FBAddress + (win->rowStride * win->x) + (win->y * win->bytesPerPixel); - win->frontBottom = (GLubyte *) win->frontStart + (height-1) * win->rowStride; - - /* This is incorrect: the hardware driver could put the backbuffer - * just about anywhere. These fields, including the above are - * hardware dependent & don't really belong here. - */ - if (visual->mode->doubleBufferMode) { - win->backStart = (GLubyte *) win->frontStart + - win->rowStride * dpy->driverContext.shared.virtualHeight; - win->backBottom = (GLubyte *) win->backStart - + (height - 1) * win->rowStride; - win->curBottom = win->backBottom; - } - else { - /* single buffered */ - win->backStart = NULL; - win->backBottom = NULL; - win->curBottom = win->frontBottom; - } - - dpy->driScreen.createNewDrawable(dpy, visual->mode, (int) win, - &win->driDrawable, GLX_WINDOW_BIT, empty_attribute_list); - - if (!win->driDrawable.private) { - fprintf(stderr, "%s: dri.createDrawable failed\n", __FUNCTION__); - free(win); - return NULL; - } - - dpy->NumWindows++; - dpy->TheWindow = win; - - return win; -} - - -/** - * \brief Destroy window. - * - * \param display display handle. - * \param w window handle. - * - * This function calls XUnmapWindow() and frees window \p w. - * - * In case of destroying the current buffer first unbinds the GLX context - * by calling glXMakeCurrent() with no drawable. - */ -void -XDestroyWindow( Display *display, Window win ) -{ - if (display && display->IsClient && win) { - /* check if destroying the current buffer */ - Window curDraw = glXGetCurrentDrawable(); - if (win == curDraw) { - glXMakeCurrent( display, NULL, NULL); - } - - XUnmapWindow( display, win ); - - /* Destroy the drawable. */ - win->driDrawable.destroyDrawable(display, win->driDrawable.private); - free(win); - - /* unlink window from display */ - display->NumWindows--; - assert(display->NumWindows == 0); - display->TheWindow = NULL; - } -} - - - - -/** - * \brief Create color map structure. - * - * \param dpy the display handle as returned by XOpenDisplay(). - * \param w the window on whose screen you want to create a color map. This - * parameter is ignored by Mini GLX but should be the value returned by the - * \code RootWindow(display, 0) \endcode macro. - * \param visual a visual type supported on the screen. This parameter is - * ignored by Mini GLX but should be the XVisualInfo::visual returned by - * glXChooseVisual(). - * \param alloc the color map entries to be allocated. This parameter is ignored - * by Mini GLX but should be set to #AllocNone. - * - * \return the color map. - * - * This function is only provided to ease porting. Practically a no-op - - * returns a pointer to a dynamically allocated chunk of memory (one byte). - */ -Colormap -XCreateColormap( Display *dpy, Window w, Visual *visual, int alloc ) -{ - (void) dpy; - (void) w; - (void) visual; - (void) alloc; - return (Colormap) malloc(1); -} - - -/** - * \brief Destroy color map structure. - * - * \param display The display handle as returned by XOpenDisplay(). - * \param colormap the color map to destroy. - * - * This function is only provided to ease porting. Practically a no-op. - * - * Frees the memory pointed by \p colormap. - */ -void -XFreeColormap( Display *display, Colormap colormap ) -{ - (void) display; - (void) colormap; - free(colormap); -} - - -/** - * \brief Free client data. - * - * \param data the data that is to be freed. - * - * Frees the memory pointed by \p data. - */ -void -XFree( void *data ) -{ - free(data); -} - - -/** - * \brief Query available visuals. - * - * \param dpy the display handle, as returned by XOpenDisplay(). - * \param vinfo_mask a bitmask indicating which fields of the \p vinfo_template - * are to be matched. The value must be \c VisualScreenMask. - * \param vinfo_template a template whose fields indicate which visual - * attributes must be matched by the results. The XVisualInfo::screen field of - * this structure must be zero. - * \param nitens_return will hold the number of visuals returned. - * - * \return the address of an array of all available visuals. - * - * An example of using XGetVisualInfo() to get all available visuals follows: - * - * \code - * XVisualInfo vinfo_template, *results; - * int nitens_return; - * Display *dpy = XOpenDisplay(NULL); - * vinfo_template.screen = 0; - * results = XGetVisualInfo(dpy, VisualScreenMask, &vinfo_template, &nitens_return); - * \endcode - * - * Returns the list of all ::XVisualInfo available, one per - * ::__GLcontextMode stored in MiniGLXDisplayRec::modes. - */ -XVisualInfo * -XGetVisualInfo( Display *dpy, long vinfo_mask, XVisualInfo *vinfo_template, int *nitens_return ) -{ - const __GLcontextModes *mode; - XVisualInfo *results; - Visual *visResults; - int i, n=0; - - // ASSERT(vinfo_mask == VisualScreenMask); - ASSERT(vinfo_template.screen == 0); - - if (vinfo_mask == VisualIDMask) - { - for ( mode = dpy->driver_modes ; mode != NULL ; mode= mode->next ) - if (mode->visualID == vinfo_template->visualid) - n=1; - - if (n==0) - return NULL; - - results = (XVisualInfo *)calloc(1, n * sizeof(XVisualInfo)); - if (!results) { - *nitens_return = 0; - return NULL; - } - - visResults = (Visual *)calloc(1, n * sizeof(Visual)); - if (!results) { - free(results); - *nitens_return = 0; - return NULL; - } - - for ( mode = dpy->driver_modes ; mode != NULL ; mode= mode->next ) - if (mode->visualID == vinfo_template->visualid) - { - visResults[0].mode=mode; - visResults[0].visInfo = results; - visResults[0].dpy = dpy; - if (dpy->driverContext.bpp == 32) - visResults[0].pixelFormat = PF_B8G8R8A8; /* XXX: FIX ME */ - else - visResults[0].pixelFormat = PF_B5G6R5; /* XXX: FIX ME */ - - results[0].visual = visResults; - results[0].visualid = mode->visualID; -#if defined(__cplusplus) || defined(c_plusplus) - results[0].c_class = TrueColor; -#else - results[0].class = TrueColor; -#endif - results[0].depth = mode->redBits + - mode->redBits + - mode->redBits + - mode->redBits; - results[0].bits_per_rgb = dpy->driverContext.bpp; - - } - - } - else // if (vinfo_mask == VisualScreenMask) - { - n = 0; - for ( mode = dpy->driver_modes ; mode != NULL ; mode = mode->next ) - n++; - - results = (XVisualInfo *)calloc(1, n * sizeof(XVisualInfo)); - if (!results) { - *nitens_return = 0; - return NULL; - } - - visResults = (Visual *)calloc(1, n * sizeof(Visual)); - if (!results) { - free(results); - *nitens_return = 0; - return NULL; - } - - for ( mode = dpy->driver_modes, i = 0 ; mode != NULL ; mode = mode->next, i++ ) { - visResults[i].mode = mode; - visResults[i].visInfo = results + i; - visResults[i].dpy = dpy; - - if (dpy->driverContext.bpp == 32) - visResults[i].pixelFormat = PF_B8G8R8A8; /* XXX: FIX ME */ - else - visResults[i].pixelFormat = PF_B5G6R5; /* XXX: FIX ME */ - - results[i].visual = visResults + i; - results[i].visualid = mode->visualID; -#if defined(__cplusplus) || defined(c_plusplus) - results[i].c_class = TrueColor; -#else - results[i].class = TrueColor; -#endif - results[i].depth = mode->redBits + - mode->redBits + - mode->redBits + - mode->redBits; - results[i].bits_per_rgb = dpy->driverContext.bpp; - } - } - *nitens_return = n; - return results; -} - - -/** - * \brief Return a visual that matches specified attributes. - * - * \param dpy the display handle, as returned by XOpenDisplay(). - * \param screen the screen number. It is currently ignored by Mini GLX and - * should be zero. - * \param attribList a list of GLX attributes which describe the desired pixel - * format. It is terminated by the token \c None. - * - * The attributes are as follows: - * \arg GLX_USE_GL: - * This attribute should always be present in order to maintain compatibility - * with GLX. - * \arg GLX_RGBA: - * If present, only RGBA pixel formats will be considered. Otherwise, only - * color index formats are considered. - * \arg GLX_DOUBLEBUFFER: - * if present, only double-buffered pixel formats will be chosen. - * \arg GLX_RED_SIZE \e n: - * Must be followed by a non-negative integer indicating the minimum number of - * bits per red pixel component that is acceptable. - * \arg GLX_GREEN_SIZE \e n: - * Must be followed by a non-negative integer indicating the minimum number of - * bits per green pixel component that is acceptable. - * \arg GLX_BLUE_SIZE \e n: - * Must be followed by a non-negative integer indicating the minimum number of - * bits per blue pixel component that is acceptable. - * \arg GLX_ALPHA_SIZE \e n: - * Must be followed by a non-negative integer indicating the minimum number of - * bits per alpha pixel component that is acceptable. - * \arg GLX_STENCIL_SIZE \e n: - * Must be followed by a non-negative integer indicating the minimum number of - * bits per stencil value that is acceptable. - * \arg GLX_DEPTH_SIZE \e n: - * Must be followed by a non-negative integer indicating the minimum number of - * bits per depth component that is acceptable. - * \arg None: - * This token is used to terminate the attribute list. - * - * \return a pointer to an #XVisualInfo object which most closely matches the - * requirements of the attribute list. If there is no visual which matches the - * request, \c NULL will be returned. - * - * \note Visuals with accumulation buffers are not available. - * - * This function searches the list of available visual configurations in - * MiniGLXDisplayRec::configs for a configuration which best matches the GLX - * attribute list parameter. A new ::XVisualInfo object is created which - * describes the visual configuration. The match criteria is described in the - * specification. - */ -XVisualInfo* -glXChooseVisual( Display *dpy, int screen, int *attribList ) -{ - const __GLcontextModes *mode; - Visual *vis; - XVisualInfo *visInfo; - const int *attrib; - GLboolean rgbFlag = GL_FALSE, dbFlag = GL_FALSE, stereoFlag = GL_FALSE; - GLint redBits = 0, greenBits = 0, blueBits = 0, alphaBits = 0; - GLint indexBits = 0, depthBits = 0, stencilBits = 0; - GLint numSamples = 0; - int i=0; - - /* - * XXX in the future, might be interpreted as a VT - */ - ASSERT(dpy); - ASSERT(screen == 0); - - vis = (Visual *)calloc(1, sizeof(Visual)); - if (!vis) - return NULL; - - visInfo = (XVisualInfo *)malloc(sizeof(XVisualInfo)); - if (!visInfo) { - free(vis); - return NULL; - } - - visInfo->visual = vis; - vis->visInfo = visInfo; - vis->dpy = dpy; - - /* parse the attribute list */ - for (attrib = attribList; attrib && *attrib != None; attrib++) { - switch (attrib[0]) { - case GLX_DOUBLEBUFFER: - dbFlag = GL_TRUE; - break; - case GLX_RGBA: - rgbFlag = GL_TRUE; - break; - case GLX_RED_SIZE: - redBits = attrib[1]; - attrib++; - break; - case GLX_GREEN_SIZE: - greenBits = attrib[1]; - attrib++; - break; - case GLX_BLUE_SIZE: - blueBits = attrib[1]; - attrib++; - break; - case GLX_ALPHA_SIZE: - alphaBits = attrib[1]; - attrib++; - break; - case GLX_STENCIL_SIZE: - stencilBits = attrib[1]; - attrib++; - break; - case GLX_DEPTH_SIZE: - depthBits = attrib[1]; - attrib++; - break; -#if 0 - case GLX_ACCUM_RED_SIZE: - accumRedBits = attrib[1]; - attrib++; - break; - case GLX_ACCUM_GREEN_SIZE: - accumGreenBits = attrib[1]; - attrib++; - break; - case GLX_ACCUM_BLUE_SIZE: - accumBlueBits = attrib[1]; - attrib++; - break; - case GLX_ACCUM_ALPHA_SIZE: - accumAlphaBits = attrib[1]; - attrib++; - break; - case GLX_LEVEL: - /* ignored for now */ - break; -#endif - default: - /* unexpected token */ - fprintf(stderr, "unexpected token in glXChooseVisual attrib list\n"); - free(vis); - free(visInfo); - return NULL; - } - } - - /* search screen configs for suitable visual */ - (void) numSamples; - (void) indexBits; - (void) redBits; - (void) greenBits; - (void) blueBits; - (void) alphaBits; - (void) stereoFlag; - for ( mode = dpy->driver_modes ; mode != NULL ; mode = mode->next ) { - i++; - if (mode->rgbMode == rgbFlag && - mode->doubleBufferMode == dbFlag && - mode->redBits >= redBits && - mode->greenBits >= greenBits && - mode->blueBits >= blueBits && - mode->alphaBits >= alphaBits && - mode->depthBits >= depthBits && - mode->stencilBits >= stencilBits) { - /* found it */ - visInfo->visualid = i; - vis->mode = mode; - break; - } - } - if (!vis->mode) - return NULL; - - /* compute depth and bpp */ - if (rgbFlag) { - /* XXX maybe support depth 16 someday */ -#if defined(__cplusplus) || defined(c_plusplus) - visInfo->c_class = TrueColor; -#else - visInfo->class = TrueColor; -#endif - visInfo->depth = dpy->driverContext.bpp; - visInfo->bits_per_rgb = dpy->driverContext.bpp; - if (dpy->driverContext.bpp == 32) - vis->pixelFormat = PF_B8G8R8A8; - else - vis->pixelFormat = PF_B5G6R5; - } - else { - /* color index mode */ -#if defined(__cplusplus) || defined(c_plusplus) - visInfo->c_class = PseudoColor; -#else - visInfo->class = PseudoColor; -#endif - visInfo->depth = 8; - visInfo->bits_per_rgb = 8; /* bits/pixel */ - vis->pixelFormat = PF_CI8; - } - - return visInfo; -} - - -/** - * \brief Return information about GLX visuals. - * - * \param dpy the display handle, as returned by XOpenDisplay(). - * \param vis the visual to be queried, as returned by glXChooseVisual(). - * \param attrib the visual attribute to be returned. - * \param value pointer to an integer in which the result of the query will be - * stored. - * - * \return zero if no error occurs, \c GLX_INVALID_ATTRIBUTE if the attribute - * parameter is invalid, or \c GLX_BAD_VISUAL if the \p vis parameter is - * invalid. - * - * Returns the appropriate attribute of ::__GLXvisualConfig pointed by - * MiniGLXVisualRec::glxConfig of XVisualInfo::visual. - * - * \sa data types. - */ -int -glXGetConfig( Display *dpy, XVisualInfo *vis, int attrib, int *value ) -{ - const __GLcontextModes *mode = vis->visual->mode; - if (!mode) { - *value = 0; - return GLX_BAD_VISUAL; - } - - switch (attrib) { - case GLX_USE_GL: - *value = True; - return 0; - case GLX_RGBA: - *value = mode->rgbMode; - return 0; - case GLX_DOUBLEBUFFER: - *value = mode->doubleBufferMode; - return 0; - case GLX_RED_SIZE: - *value = mode->redBits; - return 0; - case GLX_GREEN_SIZE: - *value = mode->greenBits; - return 0; - case GLX_BLUE_SIZE: - *value = mode->blueBits; - return 0; - case GLX_ALPHA_SIZE: - *value = mode->alphaBits; - return 0; - case GLX_DEPTH_SIZE: - *value = mode->depthBits; - return 0; - case GLX_STENCIL_SIZE: - *value = mode->stencilBits; - return 0; - default: - *value = 0; - return GLX_BAD_ATTRIBUTE; - } - return 0; -} - - -/** - * \brief Create a new GLX rendering context. - * - * \param dpy the display handle, as returned by XOpenDisplay(). - * \param vis the visual that defines the frame buffer resources available to - * the rendering context, as returned by glXChooseVisual(). - * \param shareList If non-zero, texture objects and display lists are shared - * with the named rendering context. If zero, texture objects and display lists - * will (initially) be private to this context. They may be shared when a - * subsequent context is created. - * \param direct whether direct or indirect rendering is desired. For Mini GLX - * this value is ignored but it should be set to \c True. - * - * \return a ::GLXContext handle if it succeeds or zero if it fails due to - * invalid parameter or insufficient resources. - * - * This function creates and initializes a ::MiniGLXContextRec structure and - * calls the __DRIscreenRec::createContext method to initialize the client - * private data. - */ -GLXContext -glXCreateContext( Display *dpy, XVisualInfo *vis, - GLXContext shareList, Bool direct ) -{ - GLXContext ctx; - void *sharePriv; - - ASSERT(vis); - - ctx = (struct MiniGLXContextRec *)calloc(1, sizeof(struct MiniGLXContextRec)); - if (!ctx) - return NULL; - - ctx->vid = vis->visualid; - - if (shareList) - sharePriv = shareList->driContext.private; - else - sharePriv = NULL; - - ctx->driContext.mode = vis->visual->mode; - ctx->driContext.private = dpy->driScreen.createNewContext(dpy, vis->visual->mode, - GLX_WINDOW_BIT, sharePriv, &ctx->driContext); - - if (!ctx->driContext.private) { - free(ctx); - return NULL; - } - - return ctx; -} - - -/** - * \brief Destroy a GLX context. - * - * \param dpy the display handle, as returned by XOpenDisplay(). - * \param ctx the GLX context to be destroyed. - * - * This function frees the \p ctx parameter after unbinding the current context - * by calling the __DRIcontextRec::bindContext method with zeros and calling - * the __DRIcontextRec::destroyContext method. - */ -void -glXDestroyContext( Display *dpy, GLXContext ctx ) -{ - GLXContext glxctx = glXGetCurrentContext(); - - if (ctx) { - if (glxctx == ctx) { - /* destroying current context */ - ctx->driContext.bindContext(dpy, 0, 0, 0, 0); - CurrentContext = 0; - } - ctx->driContext.destroyContext(dpy, 0, ctx->driContext.private); - free(ctx); - } -} - - -/** - * \brief Bind a GLX context to a window or a pixmap. - * - * \param dpy the display handle, as returned by XOpenDisplay(). - * \param drawable the window or drawable to bind to the rendering context. - * This should be the value returned by XCreateWindow(). - * \param ctx the GLX context to be destroyed. - * - * \return \c True if it succeeds, \c False otherwise to indicate an invalid - * display, window or context parameter. - * - * The current rendering context may be unbound by calling glXMakeCurrent() - * with the window and context parameters set to zero. - * - * An application may create any number of rendering contexts and bind them as - * needed. Note that binding a rendering context is generally not a - * light-weight operation. Most simple OpenGL applications create only one - * rendering context. - * - * This function first unbinds any old context via - * __DRIcontextRec::unbindContext and binds the new one via - * __DRIcontextRec::bindContext. - * - * If \p drawable is zero it unbinds the GLX context by calling - * __DRIcontextRec::bindContext with zeros. - */ -Bool -glXMakeCurrent( Display *dpy, GLXDrawable drawable, GLXContext ctx) -{ - if (dpy && drawable && ctx) { - GLXContext oldContext = glXGetCurrentContext(); - GLXDrawable oldDrawable = glXGetCurrentDrawable(); - /* unbind old */ - if (oldContext) { - oldContext->driContext.unbindContext(dpy, 0, - (__DRIid) oldDrawable, (__DRIid) oldDrawable, - &oldContext->driContext); - } - /* bind new */ - CurrentContext = ctx; - ctx->driContext.bindContext(dpy, 0, (__DRIid) drawable, - (__DRIid) drawable, &ctx->driContext); - ctx->drawBuffer = drawable; - ctx->curBuffer = drawable; - } - else if (ctx && dpy) { - /* unbind */ - ctx->driContext.bindContext(dpy, 0, 0, 0, 0); - } - else if (dpy) { - CurrentContext = 0; /* kw: this seems to be intended??? */ - } - - return True; -} - - -/** - * \brief Exchange front and back buffers. - * - * \param dpy the display handle, as returned by XOpenDisplay(). - * \param drawable the drawable whose buffers are to be swapped. - * - * Any pending rendering commands will be completed before the buffer swap - * takes place. - * - * Calling glXSwapBuffers() on a window which is single-buffered has no effect. - * - * This function just calls the __DRIdrawableRec::swapBuffers method to do the - * work. - */ -void -glXSwapBuffers( Display *dpy, GLXDrawable drawable ) -{ - if (!dpy || !drawable) - return; - - drawable->driDrawable.swapBuffers(dpy, drawable->driDrawable.private); -} - - -/** - * \brief Return the current context - * - * \return the current context, as specified by glXMakeCurrent(), or zero if no - * context is currently bound. - * - * \sa glXCreateContext(), glXMakeCurrent() - * - * Returns the value of the ::CurrentContext global variable. - */ -GLXContext -glXGetCurrentContext( void ) -{ - return CurrentContext; -} - - -/** - * \brief Return the current drawable. - * - * \return the current drawable, as specified by glXMakeCurrent(), or zero if - * no drawable is currently bound. - * - * This function gets the current context via glXGetCurrentContext() and - * returns the MiniGLXContextRec::drawBuffer attribute. - */ -GLXDrawable -glXGetCurrentDrawable( void ) -{ - GLXContext glxctx = glXGetCurrentContext(); - if (glxctx) - return glxctx->drawBuffer; - else - return NULL; -} - - -static GLboolean -__glXCreateContextWithConfig(__DRInativeDisplay *dpy, int screen, - int fbconfigID, void *contextID, drm_context_t *hHWContext) -{ - __DRIscreen *pDRIScreen; - __DRIscreenPrivate *psp; - - pDRIScreen = __glXFindDRIScreen(dpy, screen); - if ( (pDRIScreen == NULL) || (pDRIScreen->private == NULL) ) { - return GL_FALSE; - } - - psp = (__DRIscreenPrivate *) pDRIScreen->private; - - if (psp->fd) { - if (drmCreateContext(psp->fd, hHWContext)) { - fprintf(stderr, ">>> drmCreateContext failed\n"); - return GL_FALSE; - } - *(void**)contextID = (void*) *hHWContext; - } - - return GL_TRUE; -} - - -static GLboolean -__glXGetDrawableInfo(__DRInativeDisplay *dpy, int scrn, - __DRIid draw, unsigned int * index, unsigned int * stamp, - int * x, int * y, int * width, int * height, - int * numClipRects, drm_clip_rect_t ** pClipRects, - int * backX, int * backY, - int * numBackClipRects, drm_clip_rect_t ** pBackClipRects) -{ - GLXDrawable drawable = (GLXDrawable) draw; - drm_clip_rect_t * cliprect; - Display* display = (Display*)dpy; - __DRIscreenPrivate *psp = display->driScreen.private; - __DRIcontextPrivate *pcp = (__DRIcontextPrivate *)CurrentContext->driContext.private; - __DRIdrawablePrivate *pdp = pcp->driDrawablePriv; - if (drawable == 0) { - return GL_FALSE; - } - - cliprect = (drm_clip_rect_t*) _mesa_malloc(sizeof(drm_clip_rect_t)); - cliprect->x1 = drawable->x; - cliprect->y1 = drawable->y; - cliprect->x2 = drawable->x + drawable->w; - cliprect->y2 = drawable->y + drawable->h; - - /* the drawable index is by client id */ - *index = display->clientID; - - *stamp = pcp->driScreenPriv->pSAREA->drawableTable[display->clientID].stamp; - drmUpdateDrawableInfo(psp->fd, pdp->hHWDrawable, DRM_DRAWABLE_CLIPRECTS, 1, cliprect); - *x = drawable->x; - *y = drawable->y; - *width = drawable->w; - *height = drawable->h; - *numClipRects = 1; - *pClipRects = cliprect; - - *backX = drawable->x; - *backY = drawable->y; - *numBackClipRects = 0; - *pBackClipRects = 0; - - return GL_TRUE; -} - - -static GLboolean -xf86DRI_DestroyContext(__DRInativeDisplay *dpy, int screen, __DRIid context_id ) -{ - return GL_TRUE; -} - - -static GLboolean -xf86DRI_CreateDrawable(__DRInativeDisplay *dpy, int screen, __DRIid drawable, - drm_drawable_t *hHWDrawable ) -{ - - Display *display = (Display *)dpy; - __DRIscreenPrivate *psp = display->driScreen.private; - int ret; - ret = drmCreateDrawable(psp->fd, hHWDrawable); - - fprintf(stderr, "drawable is %d %08X ret is %d\n", *hHWDrawable, drawable, -ret); - if (ret != 0) - return GL_FALSE; - return GL_TRUE; -} - - -static GLboolean -xf86DRI_DestroyDrawable(__DRInativeDisplay *dpy, int screen, __DRIid drawable) -{ - return GL_TRUE; -} - - -/** - * \brief Query function address. - * - * The glXGetProcAddress() function will return the address of any available - * OpenGL or Mini GLX function. - * - * \param procName name of the function to be returned. - * - * \return If \p procName is a valid function name, a pointer to that function - * will be returned. Otherwise, \c NULL will be returned. - * - * The purpose of glXGetProcAddress() is to facilitate using future extensions - * to OpenGL or Mini GLX. If a future version of the library adds new extension - * functions they'll be accessible via glXGetProcAddress(). The alternative is - * to hard-code calls to the new functions in the application but doing so will - * prevent linking the application with older versions of the library. - * - * Returns the function address by looking up its name in a static (name, - * address) pair list. - */ -void (*glXGetProcAddress(const GLubyte *procname))( void ) -{ - struct name_address { - const char *name; - const void *func; - }; - static const struct name_address functions[] = { - { "glXChooseVisual", (void *) glXChooseVisual }, - { "glXCreateContext", (void *) glXCreateContext }, - { "glXDestroyContext", (void *) glXDestroyContext }, - { "glXMakeCurrent", (void *) glXMakeCurrent }, - { "glXSwapBuffers", (void *) glXSwapBuffers }, - { "glXGetCurrentContext", (void *) glXGetCurrentContext }, - { "glXGetCurrentDrawable", (void *) glXGetCurrentDrawable }, - { "glXGetProcAddress", (void *) glXGetProcAddress }, - { "XOpenDisplay", (void *) XOpenDisplay }, - { "XCloseDisplay", (void *) XCloseDisplay }, - { "XCreateWindow", (void *) XCreateWindow }, - { "XDestroyWindow", (void *) XDestroyWindow }, - { "XMapWindow", (void *) XMapWindow }, - { "XCreateColormap", (void *) XCreateColormap }, - { "XFreeColormap", (void *) XFreeColormap }, - { "XFree", (void *) XFree }, - { "XGetVisualinfo", (void *) XGetVisualInfo }, - { "glXCreatePbuffer", (void *) glXCreatePbuffer }, - { "glXDestroyPbuffer", (void *) glXDestroyPbuffer }, - { "glXChooseFBConfig", (void *) glXChooseFBConfig }, - { "glXGetVisualFromFBConfig", (void *) glXGetVisualFromFBConfig }, - { NULL, NULL } - }; - const struct name_address *entry; - for (entry = functions; entry->name; entry++) { - if (strcmp(entry->name, (const char *) procname) == 0) { - return entry->func; - } - } - return _glapi_get_proc_address((const char *) procname); -} - -void (*glXGetProcAddressARB(const GLubyte *procName))( void ) __attribute__ ((alias ("glXGetProcAddress"))); - -/** - * \brief Query the Mini GLX version. - * - * \param dpy the display handle. It is currently ignored, but should be the - * value returned by XOpenDisplay(). - * \param major receives the major version number of Mini GLX. - * \param minor receives the minor version number of Mini GLX. - * - * \return \c True if the function succeeds, \c False if the function fails due - * to invalid parameters. - * - * \sa #MINI_GLX_VERSION_1_0. - * - * Returns the hard-coded Mini GLX version. - */ -Bool -glXQueryVersion( Display *dpy, int *major, int *minor ) -{ - (void) dpy; - *major = 1; - *minor = 0; - return True; -} - - -/** - * \brief Create a new pbuffer. - */ -GLXPbuffer -glXCreatePbuffer( Display *dpy, GLXFBConfig config, const int *attribList ) -{ - return NULL; -} - - -void -glXDestroyPbuffer( Display *dpy, GLXPbuffer pbuf ) -{ - free(pbuf); -} - - -GLXFBConfig * -glXChooseFBConfig( Display *dpy, int screen, const int *attribList, - int *nitems ) -{ - GLXFBConfig *f = (GLXFBConfig *) malloc(sizeof(GLXFBConfig)); - f->visInfo = glXChooseVisual( dpy, screen, (int *) attribList ); - if (f->visInfo) { - *nitems = 1; - return f; - } - else { - *nitems = 0; - free(f); - return NULL; - } -} - - -XVisualInfo * -glXGetVisualFromFBConfig( Display *dpy, GLXFBConfig config ) -{ - /* XVisualInfo and GLXFBConfig are the same structure */ - (void) dpy; - return config.visInfo; -} - -void *glXAllocateMemoryMESA(Display *dpy, int scrn, - size_t size, float readFreq, - float writeFreq, float priority) -{ - if (dpy->driScreen.private && dpy->driScreen.allocateMemory) { - return (*dpy->driScreen.allocateMemory)( dpy, scrn, size, - readFreq, writeFreq, - priority ); - } - - return NULL; -} - -void glXFreeMemoryMESA(Display *dpy, int scrn, void *pointer) -{ - if (dpy->driScreen.private && dpy->driScreen.freeMemory) { - (*dpy->driScreen.freeMemory)( dpy, scrn, pointer ); - } -} - -GLuint glXGetMemoryOffsetMESA( Display *dpy, int scrn, - const void *pointer ) -{ - if (dpy->driScreen.private && dpy->driScreen.memoryOffset) { - return (*dpy->driScreen.memoryOffset)( dpy, scrn, pointer ); - } - - return 0; -} - - -/** - * Get the unadjusted system time (UST). Currently, the UST is measured in - * microseconds since Epoc. The actual resolution of the UST may vary from - * system to system, and the units may vary from release to release. - * Drivers should not call this function directly. They should instead use - * \c glXGetProcAddress to obtain a pointer to the function. - * - * \param ust Location to store the 64-bit UST - * \returns Zero on success or a negative errno value on failure. - * - * \note - * This function was copied directly from src/glx/x11/glxcmds.c. - */ -static int __glXGetUST( int64_t * ust ) -{ - struct timeval tv; - - if ( ust == NULL ) { - return -EFAULT; - } - - if ( gettimeofday( & tv, NULL ) == 0 ) { - ust[0] = (tv.tv_sec * 1000000) + tv.tv_usec; - return 0; - } else { - return -errno; - } -} - - -/** - * - * \bug - * This needs to be implemented for miniGlx. - */ -static GLboolean __glXGetMscRate(__DRInativeDisplay * dpy, __DRIid drawable, - int32_t * numerator, int32_t * denominator) -{ - *numerator = 0; - *denominator = 0; - return False; -} -/*@}*/ diff --git a/src/glx/mini/miniglxP.h b/src/glx/mini/miniglxP.h deleted file mode 100644 index 96ed0e81cd..0000000000 --- a/src/glx/mini/miniglxP.h +++ /dev/null @@ -1,205 +0,0 @@ -/** - * \file miniglxP.h - * \brief Define replacements for some X data types and define the DRI-related - * data structures. - * - * \note Cut down version of glxclient.h. - * - */ - -#ifndef _mini_GLX_client_h_ -#define _mini_GLX_client_h_ - -#include -#include - -#include -#include "glheader.h" -#include "mtypes.h" - -#include "driver.h" -#include "GL/internal/dri_interface.h" - -/** - * \brief Supported pixel formats. - */ -enum PixelFormat { - PF_B8G8R8, /**< \brief 24-bit BGR */ - PF_B8G8R8A8, /**< \brief 32-bit BGRA */ - PF_B5G6R5, /**< \brief 16-bit BGR */ - PF_B5G5R5, /**< \brief 15-bit BGR */ - PF_CI8 /**< \brief 8-bit color index */ -}; - -/** - * \brief X Visual type. - * - * \sa ::Visual, \ref datatypes. - */ -struct MiniGLXVisualRec { - /** \brief GLX visual information */ - const __GLcontextModes *mode; - - /** \brief pointer back to corresponding ::XVisualInfo */ - XVisualInfo *visInfo; - - /** \brief display handle */ - Display *dpy; - - /** \brief pixel format */ - enum PixelFormat pixelFormat; -}; - - - -/** - * \brief X Window type. - * - * \sa ::Window, \ref datatypes. - */ -struct MiniGLXWindowRec { - Visual *visual; - /** \brief position (always 0,0) */ - int x, y; - /** \brief size */ - unsigned int w, h; - void *frontStart; /**< \brief start of front color buffer */ - void *backStart; /**< \brief start of back color buffer */ - size_t size; /**< \brief color buffer size, in bytes */ - GLuint bytesPerPixel; - GLuint rowStride; /**< \brief in bytes */ - GLubyte *frontBottom; /**< \brief pointer to last row */ - GLubyte *backBottom; /**< \brief pointer to last row */ - GLubyte *curBottom; /**< = frontBottom or backBottom */ - __DRIdrawable driDrawable; - GLuint ismapped; -}; - - -/** - * \brief GLXContext type. - * - * \sa ::GLXContext, \ref datatypes. - */ -struct MiniGLXContextRec { - Window drawBuffer; /**< \brief drawing buffer */ - Window curBuffer; /**< \brief current buffer */ - VisualID vid; /**< \brief visual ID */ - __DRIcontext driContext; /**< \brief context dependent methods */ -}; - -#define MINIGLX_BUF_SIZE 512 -#define MINIGLX_MAX_SERVER_FDS 10 -#define MINIGLX_MAX_CLIENT_FDS 1 -#define MINIGLX_EVENT_QUEUE_SZ 16 -#define MINIGLX_EVENT_QUEUE_MASK (MINIGLX_EVENT_QUEUE_SZ-1) - -/** - * A connection to/from the server - * - * All information is to/from the server is buffered and then dispatched by - * __miniglx_Select() to avoid blocking the server. - */ -struct MiniGLXConnection { - int fd; /**< \brief file descriptor */ - char readbuf[MINIGLX_BUF_SIZE]; /**< \brief read buffer */ - char writebuf[MINIGLX_BUF_SIZE]; /**< \brief write buffer */ - int readbuf_count; /**< \brief count of bytes waiting to be read */ - int writebuf_count; /**< \brief count of bytes waiting to be written */ -}; - - -/** - * \brief X Display type - * - * \sa ::Display, \ref datatypes. - */ -struct MiniGLXDisplayRec { - /** \brief fixed framebuffer screen info */ - struct fb_fix_screeninfo FixedInfo; - /** \brief original and current variable framebuffer screen info */ - struct fb_var_screeninfo OrigVarInfo, VarInfo; - struct sigaction OrigSigUsr1; - struct sigaction OrigSigUsr2; - int OriginalVT; - int ConsoleFD; /**< \brief console TTY device file descriptor */ - int FrameBufferFD; /**< \brief framebuffer device file descriptor */ - int NumWindows; /**< \brief number of open windows */ - Window TheWindow; /**< \brief open window - only allow one window for now */ - int rotateMode; - - - volatile int vtSignalFlag; - volatile int haveVT; /**< \brief whether the VT is hold */ - int hwActive; /**< \brief whether the hardware is active -- mimics - the variations of MiniGLXDisplayRec::haveVT */ - - - int IsClient; /**< \brief whether it's a client or the server */ - int clientID; - int nrFds; /**< \brief number of connections (usually just one for the clients) */ - struct MiniGLXConnection *fd; /**< \brief connections */ - int drmFd; /**< \brief handle to drm device */ - int authorized; /**< \brief has server authorized this process? */ - - struct { - int nr, head, tail; - XEvent queue[MINIGLX_EVENT_QUEUE_SZ]; - } eventqueue; - - /** - * \name Visuals - * - * Visuals (configs) in this screen. - */ - /*@{*/ - const __GLcontextModes *driver_modes; /**< \brief Modes filtered by driver. */ - /*@}*/ - - /** - * \name From __GLXdisplayPrivate - */ - /*@{*/ - PFNCREATENEWSCREENFUNC createNewScreen; /**< \brief \e __driCreateScreen hook */ - __DRIscreen driScreen; /**< \brief Screen dependent methods */ - void *dlHandle; /**< - * \brief handle to the client dynamic - * library - */ - /*@}*/ - - /** - * \brief Mini GLX specific driver hooks - */ - struct DRIDriverRec *driver; - struct DRIDriverContextRec driverContext; - - /** - * \name Configuration details - * - * They are read from a configuration file by __read_config_file(). - */ - /*@{*/ - const char *fbdevDevice; - const char *clientDriverName; - /*@}*/ -}; - -/** Character messages. */ -enum msgs { - _CanIHaveFocus, - _IDontWantFocus, - _YouveGotFocus, - _YouveLostFocus, - _RepaintPlease, - _Authorize, -}; -extern int send_msg( Display *dpy, int i, const void *msg, size_t sz ); -extern int send_char_msg( Display *dpy, int i, char msg ); -extern int blocking_read( Display *dpy, int connection, char *msg, size_t msg_size ); -extern int handle_fd_events( Display *dpy, int nonblock ); - -extern int __miniglx_open_connections( Display *dpy ); -extern void __miniglx_close_connections( Display *dpy ); - -#endif /* !_mini_GLX_client_h_ */ diff --git a/src/glx/mini/miniglx_events.c b/src/glx/mini/miniglx_events.c deleted file mode 100644 index a20d5847b3..0000000000 --- a/src/glx/mini/miniglx_events.c +++ /dev/null @@ -1,983 +0,0 @@ -/** - * \file miniglx_events.c - * \brief Mini GLX client/server communication functions. - * \author Keith Whitwell - * - * The Mini GLX interface is a subset of the GLX interface, plus a - * minimal set of Xlib functions. This file adds interfaces to - * arbitrate a single cliprect between multiple direct rendering - * clients. - * - * A fairly complete client/server non-blocking communication - * mechanism. Probably overkill given that none of our messages - * currently exceed 1 byte in length and take place over the - * relatively benign channel provided by a Unix domain socket. - */ - -/* - * Mesa 3-D graphics library - * Version: 5.0 - * - * Copyright (C) 1999-2003 Brian Paul All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - - - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include "xf86drm.h" -#include "miniglxP.h" - - -#define MINIGLX_FIFO_NAME "/tmp/miniglx.fifo" - -/** - * \brief Allocate an XEvent structure on the event queue. - * - * \param dpy the display handle. - * - * \return Pointer to the queued event structure or NULL on failure. - * - * \internal - * If there is space on the XEvent queue, return a pointer - * to the next free event and increment the eventqueue tail value. - * Otherwise return null. - */ -static XEvent *queue_event( Display *dpy ) -{ - int incr = (dpy->eventqueue.tail + 1) & MINIGLX_EVENT_QUEUE_MASK; - if (incr == dpy->eventqueue.head) { - return 0; - } - else { - XEvent *ev = &dpy->eventqueue.queue[dpy->eventqueue.tail]; - dpy->eventqueue.tail = incr; - return ev; - } -} - -/** - * \brief Dequeue an XEvent and copy it into provided storage. - * - * \param dpy the display handle. - * \param event_return pointer to copy the queued event to. - * - * \return True or False depending on success. - * - * \internal - * If there is a queued XEvent on the queue, copy it to the provided - * pointer and increment the eventqueue head value. Otherwise return - * null. - */ -static int dequeue_event( Display *dpy, XEvent *event_return ) -{ - if (dpy->eventqueue.tail == dpy->eventqueue.head) { - return False; - } - else { - *event_return = dpy->eventqueue.queue[dpy->eventqueue.head]; - dpy->eventqueue.head += 1; - dpy->eventqueue.head &= MINIGLX_EVENT_QUEUE_MASK; - return True; - } -} - -/** - * \brief Shutdown a socket connection. - * - * \param dpy the display handle. - * \param i the index in dpy->fd of the socket connection. - * - * \internal - * Shutdown and close the file descriptor. If this is the special - * connection in fd[0], issue an error message and exit - there's been - * some sort of failure somewhere. Otherwise, let the application - * know about whats happened by issuing a DestroyNotify event. - */ -static void shut_fd( Display *dpy, int i ) -{ - if (dpy->fd[i].fd < 0) - return; - - shutdown (dpy->fd[i].fd, SHUT_RDWR); - close (dpy->fd[i].fd); - dpy->fd[i].fd = -1; - dpy->fd[i].readbuf_count = 0; - dpy->fd[i].writebuf_count = 0; - - if (i == 0) { - fprintf(stderr, "server connection lost\n"); - exit(1); - } - else { - /* Pass this to the application as a DestroyNotify event. - */ - XEvent *er = queue_event(dpy); - if (!er) return; - er->xdestroywindow.type = DestroyNotify; - er->xdestroywindow.serial = 0; - er->xdestroywindow.send_event = 0; - er->xdestroywindow.display = dpy; - er->xdestroywindow.window = (Window)i; - - drmGetLock(dpy->driverContext.drmFD, 1, 0); - drmUnlock(dpy->driverContext.drmFD, 1); - } -} - -/** - * \brief Send a message to a socket connection. - * - * \param dpy the display handle. - * \param i the index in dpy->fd of the socket connection. - * \param msg the message to send. - * \param sz the size of the message - * - * \internal - * Copy the message to the write buffer for the nominated connection. - * This will be actually sent to that file descriptor from - * __miniglx_Select(). - */ -int send_msg( Display *dpy, int i, - const void *msg, size_t sz ) -{ - int cnt = dpy->fd[i].writebuf_count; - if (MINIGLX_BUF_SIZE - cnt < sz) { - fprintf(stderr, "client %d: writebuf overflow\n", i); - return False; - } - - memcpy( dpy->fd[i].writebuf + cnt, msg, sz ); cnt += sz; - dpy->fd[i].writebuf_count = cnt; - return True; -} - -/** - * \brief Send a message to a socket connection. - * - * \param dpy the display handle. - * \param i the index in dpy->fd of the socket connection. - * \param msg the message to send. - * - * \internal - * Use send_msg() to send a one-byte message to a socket. - */ -int send_char_msg( Display *dpy, int i, char msg ) -{ - return send_msg( dpy, i, &msg, sizeof(char)); -} - - -/** - * \brief Block and receive a message from a socket connection. - * - * \param dpy the display handle. - * \param connection the index in dpy->fd of the socket connection. - * \param msg storage for the received message. - * \param msg_size the number of bytes to read. - * - * \internal - * Block and read from the connection's file descriptor - * until msg_size bytes have been received. - * - * Only called from welcome_message_part(). - */ -int blocking_read( Display *dpy, int connection, - char *msg, size_t msg_size ) -{ - int i, r; - - for (i = 0 ; i < msg_size ; i += r) { - r = read(dpy->fd[connection].fd, msg + i, msg_size - i); - if (r < 1) { - fprintf(stderr, "blocking_read: %d %s\n", r, strerror(errno)); - shut_fd(dpy,connection); - return False; - } - } - - return True; -} - -/** - * \brief Send/receive a part of the welcome message. - * - * \param dpy the display handle. - * \param i the index in dpy->fd of the socket connection. - * \param msg storage for the sent/received message. - * \param sz the number of bytes to write/read. - * - * \return True on success, or False on failure. - * - * This function is called by welcome_message_part(), to either send or receive - * (via blocking_read()) part of the welcome message, according to whether - * Display::IsClient is set. - * - * Each part of the welcome message on the wire consists of a count and then the - * actual message data with that number of bytes. - */ -static int welcome_message_part( Display *dpy, int i, void **msg, int sz ) -{ - if (dpy->IsClient) { - int sz; - if (!blocking_read( dpy, i, (char *)&sz, sizeof(sz))) return False; - if (!*msg) *msg = malloc(sz); - if (!*msg) return False; - if (!blocking_read( dpy, i, *msg, sz )) return False; - return sz; - } - else { - if (!send_msg( dpy, i, &sz, sizeof(sz))) return False; - if (!send_msg( dpy, i, *msg, sz )) return False; - } - - return True; -} - -/** - * \brief Send/receive the welcome message. - * - * \param dpy the display handle. - * \param i the index in dpy->fd of the socket connection. - * - * \return True on success, or False on failure. - * - * Using welcome_message_part(), sends/receives the client ID, the client - * configuration details in DRIDriverContext::shared, and the driver private - * message in DRIDriverContext::driverClientMsg. - */ -static int welcome_message( Display *dpy, int i ) -{ - void *tmp = &dpy->driverContext.shared; - int *clientid = dpy->IsClient ? &dpy->clientID : &i; - int size; - - if (!welcome_message_part( dpy, i, (void **)&clientid, sizeof(*clientid))) - return False; - - if (!welcome_message_part( dpy, i, &tmp, sizeof(dpy->driverContext.shared))) - return False; - - size=welcome_message_part( dpy, i, - (void **)&dpy->driverContext.driverClientMsg, - dpy->driverContext.driverClientMsgSize ); - - if (!size) - return False; - - if (dpy->IsClient) { - dpy->driverContext.driverClientMsgSize = size; - } - return True; -} - - -/** - * \brief Handle a new client connection. - * - * \param dpy the display handle. - * - * \return True on success or False on failure. - * - * Accepts the connection, sets it in non-blocking operation, and finds a free - * slot in Display::fd for it. - */ -static int handle_new_client( Display *dpy ) -{ - struct sockaddr_un client_address; - unsigned int l = sizeof(client_address); - int r, i; - - r = accept(dpy->fd[0].fd, (struct sockaddr *) &client_address, &l); - if (r < 0) { - perror ("accept()"); - shut_fd(dpy,0); - return False; - } - - if (fcntl(r, F_SETFL, O_NONBLOCK) != 0) { - perror("fcntl"); - close(r); - return False; - } - - - /* Some rough & ready adaption of the XEvent semantics. - */ - for (i = 1 ; i < dpy->nrFds ; i++) { - if (dpy->fd[i].fd < 0) { - XEvent *er = queue_event(dpy); - if (!er) { - close(r); - return False; - } - - dpy->fd[i].fd = r; - er->xcreatewindow.type = CreateNotify; - er->xcreatewindow.serial = 0; - er->xcreatewindow.send_event = 0; - er->xcreatewindow.display = dpy; - er->xcreatewindow.window = (Window)i; /* fd slot == window, now? */ - - /* Send the driver client message - this is expected as the - * first message on a new connection. The recpient already - * knows the size of the message. - */ - welcome_message( dpy, i ); - return True; - } - } - - - fprintf(stderr, "[miniglx] %s: Max nr clients exceeded\n", __FUNCTION__); - close(r); - return False; -} - -/** - * This routine "puffs out" the very basic communications between - * client and server to full-sized X Events that can be handled by the - * application. - * - * \param dpy the display handle. - * \param i the index in dpy->fd of the socket connection. - * - * \return True on success or False on failure. - * - * \internal - * Interprets the message (see msg) into a XEvent and advances the file FIFO - * buffer. - */ -static int -handle_fifo_read( Display *dpy, int i ) -{ - drm_magic_t magic; - int err; - - while (dpy->fd[i].readbuf_count) { - char id = dpy->fd[i].readbuf[0]; - XEvent *er; - int count = 1; - - if (dpy->IsClient) { - switch (id) { - /* The server has called XMapWindow on a client window */ - case _YouveGotFocus: - er = queue_event(dpy); - if (!er) return False; - er->xmap.type = MapNotify; - er->xmap.serial = 0; - er->xmap.send_event = False; - er->xmap.display = dpy; - er->xmap.event = dpy->TheWindow; - er->xmap.window = dpy->TheWindow; - er->xmap.override_redirect = False; - if (dpy->driver->notifyFocus) - dpy->driver->notifyFocus( 1 ); - break; - - /* The server has called XMapWindow on a client window */ - case _RepaintPlease: - er = queue_event(dpy); - if (!er) return False; - er->xexpose.type = Expose; - er->xexpose.serial = 0; - er->xexpose.send_event = False; - er->xexpose.display = dpy; - er->xexpose.window = dpy->TheWindow; - if (dpy->rotateMode) { - er->xexpose.x = dpy->TheWindow->y; - er->xexpose.y = dpy->TheWindow->x; - er->xexpose.width = dpy->TheWindow->h; - er->xexpose.height = dpy->TheWindow->w; - } - else { - er->xexpose.x = dpy->TheWindow->x; - er->xexpose.y = dpy->TheWindow->y; - er->xexpose.width = dpy->TheWindow->w; - er->xexpose.height = dpy->TheWindow->h; - } - er->xexpose.count = 0; - break; - - /* The server has called 'XUnmapWindow' on a client - * window. - */ - case _YouveLostFocus: - er = queue_event(dpy); - if (!er) return False; - er->xunmap.type = UnmapNotify; - er->xunmap.serial = 0; - er->xunmap.send_event = False; - er->xunmap.display = dpy; - er->xunmap.event = dpy->TheWindow; - er->xunmap.window = dpy->TheWindow; - er->xunmap.from_configure = False; - if (dpy->driver->notifyFocus) - dpy->driver->notifyFocus( 0 ); - break; - - case _Authorize: - dpy->authorized = True; - break; - - default: - fprintf(stderr, "Client received unhandled message type %d\n", id); - shut_fd(dpy, i); /* Actually shuts down the client */ - return False; - } - } - else { - switch (id) { - /* Lets the server know that the client is ready to render - * (having called 'XMapWindow' locally). - */ - case _CanIHaveFocus: - er = queue_event(dpy); - if (!er) return False; - er->xmaprequest.type = MapRequest; - er->xmaprequest.serial = 0; - er->xmaprequest.send_event = False; - er->xmaprequest.display = dpy; - er->xmaprequest.parent = 0; - er->xmaprequest.window = (Window)i; - break; - - /* Both _YouveLostFocus and _IDontWantFocus generate unmap - * events. The idea is that _YouveLostFocus lets the client - * know that it has had focus revoked by the server, whereas - * _IDontWantFocus lets the server know that the client has - * unmapped its own window. - */ - case _IDontWantFocus: - er = queue_event(dpy); - if (!er) return False; - er->xunmap.type = UnmapNotify; - er->xunmap.serial = 0; - er->xunmap.send_event = False; - er->xunmap.display = dpy; - er->xunmap.event = (Window)i; - er->xunmap.window = (Window)i; - er->xunmap.from_configure = False; - break; - - case _Authorize: - /* is full message here yet? */ - if (dpy->fd[i].readbuf_count < count + sizeof(magic)) { - count = 0; - break; - } - memcpy(&magic, dpy->fd[i].readbuf + count, sizeof(magic)); - fprintf(stderr, "Authorize - magic %d\n", magic); - - err = drmAuthMagic(dpy->driverContext.drmFD, magic); - count += sizeof(magic); - - send_char_msg( dpy, i, _Authorize ); - break; - - default: - fprintf(stderr, "Server received unhandled message type %d\n", id); - shut_fd(dpy, i); /* Generates DestroyNotify event */ - return False; - } - } - - dpy->fd[i].readbuf_count -= count; - - if (dpy->fd[i].readbuf_count) { - memmove(dpy->fd[i].readbuf, - dpy->fd[i].readbuf + count, - dpy->fd[i].readbuf_count); - } - } - - return True; -} - -/** - * Handle a VT signal - * - * \param dpy display handle. - * - * The VT switches is detected by comparing Display::haveVT and - * Display::hwActive. When loosing the VT the hardware lock is acquired, the - * hardware is shutdown via a call to DRIDriverRec::shutdownHardware(), and the - * VT released. When acquiring the VT back the hardware state is restored via a - * call to DRIDriverRec::restoreHardware() and the hardware lock released. - */ -static void __driHandleVtSignals( Display *dpy ) -{ - dpy->vtSignalFlag = 0; - - fprintf(stderr, "%s: haveVT %d hwActive %d\n", __FUNCTION__, - dpy->haveVT, dpy->hwActive); - - if (!dpy->haveVT && dpy->hwActive) { - /* Need to get lock and shutdown hardware */ - DRM_LIGHT_LOCK( dpy->driverContext.drmFD, - dpy->driverContext.pSAREA, - dpy->driverContext.serverContext ); - dpy->driver->shutdownHardware( &dpy->driverContext ); - - /* Can now give up control of the VT */ - ioctl( dpy->ConsoleFD, VT_RELDISP, 1 ); - dpy->hwActive = 0; - } - else if (dpy->haveVT && !dpy->hwActive) { - /* Get VT (wait??) */ - ioctl( dpy->ConsoleFD, VT_RELDISP, VT_ACTIVATE ); - - /* restore HW state, release lock */ - dpy->driver->restoreHardware( &dpy->driverContext ); - DRM_UNLOCK( dpy->driverContext.drmFD, - dpy->driverContext.pSAREA, - dpy->driverContext.serverContext ); - dpy->hwActive = 1; - } -} - - -#undef max -#define max(x,y) ((x) > (y) ? (x) : (y)) - -/** - * Logic for the select() call. - * - * \param dpy display handle. - * \param n highest fd in any set plus one. - * \param rfds fd set to be watched for reading, or NULL to create one. - * \param wfds fd set to be watched for writing, or NULL to create one. - * \param xfds fd set to be watched for exceptions or error, or NULL to create one. - * \param tv timeout value, or NULL for no timeout. - * - * \return number of file descriptors contained in the sets, or a negative number on failure. - * - * \note - * This all looks pretty complex, but is necessary especially on the - * server side to prevent a poorly-behaved client from causing the - * server to block in a read or write and hence not service the other - * clients. - * - * \sa - * See select_tut in the Linux manual pages for more discussion. - * - * \internal - * Creates and initializes the file descriptor sets by inspecting Display::fd - * if these aren't passed in the function call. Calls select() and fulfill the - * demands by trying to fill MiniGLXConnection::readbuf and draining - * MiniGLXConnection::writebuf. - * The server fd[0] is handled specially for new connections, by calling - * handle_new_client(). - * - */ -int -__miniglx_Select( Display *dpy, int n, fd_set *rfds, fd_set *wfds, fd_set *xfds, - struct timeval *tv ) -{ - int i; - int retval; - fd_set my_rfds, my_wfds; - struct timeval my_tv; - - if (!rfds) { - rfds = &my_rfds; - FD_ZERO(rfds); - } - - if (!wfds) { - wfds = &my_wfds; - FD_ZERO(wfds); - } - - /* Don't block if there are events queued. Review this if the - * flush in XMapWindow is changed to blocking. (Test case: - * miniglxtest). - */ - if (dpy->eventqueue.head != dpy->eventqueue.tail) { - my_tv.tv_sec = my_tv.tv_usec = 0; - tv = &my_tv; - } - - for (i = 0 ; i < dpy->nrFds; i++) { - if (dpy->fd[i].fd < 0) - continue; - - if (dpy->fd[i].writebuf_count) - FD_SET(dpy->fd[i].fd, wfds); - - if (dpy->fd[i].readbuf_count < MINIGLX_BUF_SIZE) - FD_SET(dpy->fd[i].fd, rfds); - - n = max(n, dpy->fd[i].fd + 1); - } - - if (dpy->vtSignalFlag) - __driHandleVtSignals( dpy ); - - retval = select( n, rfds, wfds, xfds, tv ); - - if (dpy->vtSignalFlag) { - int tmp = errno; - __driHandleVtSignals( dpy ); - errno = tmp; - } - - if (retval < 0) { - FD_ZERO(rfds); - FD_ZERO(wfds); - return retval; - } - - /* Handle server fd[0] specially on the server - accept new client - * connections. - */ - if (!dpy->IsClient) { - if (FD_ISSET(dpy->fd[0].fd, rfds)) { - FD_CLR(dpy->fd[0].fd, rfds); - handle_new_client( dpy ); - } - } - - /* Otherwise, try and fill readbuffer and drain writebuffer: - */ - for (i = 0 ; i < dpy->nrFds ; i++) { - if (dpy->fd[i].fd < 0) - continue; - - /* If there aren't any event slots left, don't examine - * any more file events. This will prevent lost events. - */ - if (dpy->eventqueue.head == - ((dpy->eventqueue.tail + 1) & MINIGLX_EVENT_QUEUE_MASK)) { - fprintf(stderr, "leaving event loop as event queue is full\n"); - return retval; - } - - if (FD_ISSET(dpy->fd[i].fd, wfds)) { - int r = write(dpy->fd[i].fd, - dpy->fd[i].writebuf, - dpy->fd[i].writebuf_count); - - if (r < 1) - shut_fd(dpy,i); - else { - dpy->fd[i].writebuf_count -= r; - if (dpy->fd[i].writebuf_count) { - memmove(dpy->fd[i].writebuf, - dpy->fd[i].writebuf + r, - dpy->fd[i].writebuf_count); - } - } - } - - if (FD_ISSET(dpy->fd[i].fd, rfds)) { - int r = read(dpy->fd[i].fd, - dpy->fd[i].readbuf + dpy->fd[i].readbuf_count, - MINIGLX_BUF_SIZE - dpy->fd[i].readbuf_count); - - if (r < 1) - shut_fd(dpy,i); - else { - dpy->fd[i].readbuf_count += r; - - handle_fifo_read( dpy, i ); - } - } - } - - return retval; -} - -/** - * \brief Handle socket events. - * - * \param dpy the display handle. - * \param nonblock whether to return immediately or wait for an event. - * - * \return True on success, False on failure. Aborts on critical error. - * - * \internal - * This function is the select() main loop. - */ -int handle_fd_events( Display *dpy, int nonblock ) -{ - while (1) { - struct timeval tv = {0, 0}; - int r = __miniglx_Select( dpy, 0, 0, 0, 0, nonblock ? &tv : 0 ); - if (r >= 0) - return True; - if (errno == EINTR || errno == EAGAIN) - continue; - perror ("select()"); - exit (1); - } -} - -/** - * Initializes the connections. - * - * \param dpy the display handle. - * - * \return True on success or False on failure. - * - * Allocates and initializes the Display::fd array and create a Unix socket on - * the first entry. For a server binds the socket to a filename and listen for - * connections. For a client connects to the server and waits for a welcome - * message. Sets the socket in nonblocking mode. - */ -int __miniglx_open_connections( Display *dpy ) -{ - struct sockaddr_un sa; - int i; - - dpy->nrFds = dpy->IsClient ? 1 : MINIGLX_MAX_SERVER_FDS; - dpy->fd = calloc(1, dpy->nrFds * sizeof(struct MiniGLXConnection)); - if (!dpy->fd) - return False; - - for (i = 0 ; i < dpy->nrFds ; i++) - dpy->fd[i].fd = -1; - - if (!dpy->IsClient) { - if (unlink(MINIGLX_FIFO_NAME) != 0 && errno != ENOENT) { - perror("unlink " MINIGLX_FIFO_NAME); - return False; - } - - } - - /* Create a Unix socket -- Note this is *not* a network connection! - */ - dpy->fd[0].fd = socket(PF_UNIX, SOCK_STREAM, 0); - if (dpy->fd[0].fd < 0) { - perror("socket " MINIGLX_FIFO_NAME); - return False; - } - - memset(&sa, 0, sizeof(sa)); - sa.sun_family = AF_UNIX; - strcpy(sa.sun_path, MINIGLX_FIFO_NAME); - - if (dpy->IsClient) { - /* Connect to server - */ - if (connect(dpy->fd[0].fd, (struct sockaddr *)&sa, sizeof(sa)) != 0) { - perror("connect"); - shut_fd(dpy,0); - return False; - } - - /* Wait for configuration messages from the server. - */ - welcome_message( dpy, 0 ); - } - else { - mode_t tmp = umask( 0000 ); /* open to everybody ? */ - - /* Bind socket to our filename - */ - if (bind(dpy->fd[0].fd, (struct sockaddr *)&sa, sizeof(sa)) != 0) { - perror("bind"); - shut_fd(dpy,0); - return False; - } - - umask( tmp ); - - /* Listen for connections - */ - if (listen(dpy->fd[0].fd, 5) != 0) { - perror("listen"); - shut_fd(dpy,0); - return False; - } - } - - if (fcntl(dpy->fd[0].fd, F_SETFL, O_NONBLOCK) != 0) { - perror("fcntl"); - shut_fd(dpy,0); - return False; - } - - - return True; -} - - -/** - * Frees the connections initialized by __miniglx_open_connections(). - * - * \param dpy the display handle. - */ -void __miniglx_close_connections( Display *dpy ) -{ - int i; - - for (i = 0 ; i < dpy->nrFds ; i++) { - if (dpy->fd[i].fd >= 0) { - shutdown (dpy->fd[i].fd, SHUT_RDWR); - close (dpy->fd[i].fd); - } - } - - dpy->nrFds = 0; - free(dpy->fd); -} - - -/** - * Set a drawable flag. - * - * \param dpy the display handle. - * \param w drawable (window). - * \param flag flag. - * - * Sets the specified drawable flag in the SAREA and increment its stamp while - * holding the light hardware lock. - */ -static void set_drawable_flag( Display *dpy, int w, int flag ) -{ - if (dpy->driverContext.pSAREA) { - if (dpy->hwActive) - DRM_LIGHT_LOCK( dpy->driverContext.drmFD, - dpy->driverContext.pSAREA, - dpy->driverContext.serverContext ); - - dpy->driverContext.pSAREA->drawableTable[w].stamp++; - dpy->driverContext.pSAREA->drawableTable[w].flags = flag; - - if (dpy->hwActive) - DRM_UNLOCK( dpy->driverContext.drmFD, - dpy->driverContext.pSAREA, - dpy->driverContext.serverContext ); - } -} - - - -/** - * \brief Map Window. - * - * \param dpy the display handle as returned by XOpenDisplay(). - * \param w the window handle. - * - * If called by a client, sends a request for focus to the server. If - * called by the server, will generate a MapNotify and Expose event at - * the client. - * - */ -void -XMapWindow( Display *dpy, Window w ) -{ - if (dpy->IsClient) - send_char_msg( dpy, 0, _CanIHaveFocus ); - else { - set_drawable_flag( dpy, (int)w, 1 ); - send_char_msg( dpy, (int)w, _YouveGotFocus ); - send_char_msg( dpy, (int)w, _RepaintPlease ); - dpy->TheWindow = w; - } - handle_fd_events( dpy, 0 ); /* flush write queue */ -} - -/** - * \brief Unmap Window. - * - * \param dpy the display handle as returned by XOpenDisplay(). - * \param w the window handle. - * - * Called from the client: Lets the server know that the window won't - * be updated anymore. - * - * Called from the server: Tells the specified client that it no longer - * holds the focus. - */ -void -XUnmapWindow( Display *dpy, Window w ) -{ - if (dpy->IsClient) { - send_char_msg( dpy, 0, _IDontWantFocus ); - } - else { - dpy->TheWindow = 0; - set_drawable_flag( dpy, (int)w, 0 ); - send_char_msg( dpy, (int)w, _YouveLostFocus ); - } - handle_fd_events( dpy, 0 ); /* flush write queue */ -} - - -/** - * \brief Block and wait for next X event. - * - * \param dpy the display handle as returned by XOpenDisplay(). - * \param event_return a pointer to an XEvent structure for the returned data. - * - * Wait until there is a new XEvent pending. - */ -int XNextEvent(Display *dpy, XEvent *event_return) -{ - for (;;) { - if ( dpy->eventqueue.head != dpy->eventqueue.tail ) - return dequeue_event( dpy, event_return ); - - handle_fd_events( dpy, 0 ); - } -} - -/** - * \brief Non-blocking check for next X event. - * - * \param dpy the display handle as returned by XOpenDisplay(). - * \param event_mask ignored. - * \param event_return a pointer to an XEvent structure for the returned data. - * - * Check if there is a new XEvent pending. Note that event_mask is - * ignored and any pending event will be returned. - */ -Bool XCheckMaskEvent(Display *dpy, long event_mask, XEvent *event_return) -{ - if ( dpy->eventqueue.head != dpy->eventqueue.tail ) - return dequeue_event( dpy, event_return ); - - handle_fd_events( dpy, 1 ); - - return dequeue_event( dpy, event_return ); -} diff --git a/src/mesa/.gitignore b/src/mesa/.gitignore deleted file mode 100644 index b83498b1d9..0000000000 --- a/src/mesa/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -*/gen_matypes -*/matypes.h diff --git a/src/mesa/drivers/allegro/amesa.c b/src/mesa/drivers/allegro/amesa.c deleted file mode 100644 index a9d8f62f92..0000000000 --- a/src/mesa/drivers/allegro/amesa.c +++ /dev/null @@ -1,414 +0,0 @@ -/* - * Mesa 3-D graphics library - * Version: 3.0 - * Copyright (C) 1995-1998 Brian Paul - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the Free - * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#include -#include -#include -#include "main/buffers.h" -#include "main/context.h" -#include "main/imports.h" -#include "main/matrix.h" -#include "main/mtypes.h" -#include "amesa.h" - - -struct amesa_visual - { - GLvisual *GLVisual; /* inherit from GLvisual */ - GLboolean DBFlag; /* double buffered? */ - GLuint Depth; /* bits per pixel ( >= 15 ) */ - }; - - -struct amesa_buffer - { - GLframebuffer *GLBuffer; /* inherit from GLframebuffer */ - GLuint Width, Height; - BITMAP *Screen; - BITMAP *Background; - BITMAP *Active; - }; - - -struct amesa_context - { - GLcontext *GLContext; /* inherit from GLcontext */ - AMesaVisual Visual; - AMesaBuffer Buffer; - GLuint ClearColor; - GLuint CurrentColor; - }; - - -static void setup_dd_pointers(GLcontext *ctx); - - -/**********************************************************************/ -/***** drawing functions *****/ -/**********************************************************************/ - -#define FLIP(context, y) (context->Buffer->Height - (y) - 1) - -#include "allegro/generic.h" -#include "allegro/direct.h" - - -/**********************************************************************/ -/***** 15-bit accelerated drawing funcs *****/ -/**********************************************************************/ - -IMPLEMENT_WRITE_RGBA_SPAN(15, unsigned short) -IMPLEMENT_WRITE_RGB_SPAN(15, unsigned short) -IMPLEMENT_WRITE_MONO_RGBA_SPAN(15, unsigned short) -IMPLEMENT_READ_RGBA_SPAN(15, unsigned short) -IMPLEMENT_WRITE_RGBA_PIXELS(15, unsigned short) -IMPLEMENT_WRITE_MONO_RGBA_PIXELS(15, unsigned short) -IMPLEMENT_READ_RGBA_PIXELS(15, unsigned short) - - -/**********************************************************************/ -/***** 16-bit accelerated drawing funcs *****/ -/**********************************************************************/ - -IMPLEMENT_WRITE_RGBA_SPAN(16, unsigned short) -IMPLEMENT_WRITE_RGB_SPAN(16, unsigned short) -IMPLEMENT_WRITE_MONO_RGBA_SPAN(16, unsigned short) -IMPLEMENT_READ_RGBA_SPAN(16, unsigned short) -IMPLEMENT_WRITE_RGBA_PIXELS(16, unsigned short) -IMPLEMENT_WRITE_MONO_RGBA_PIXELS(16, unsigned short) -IMPLEMENT_READ_RGBA_PIXELS(16, unsigned short) - - -/**********************************************************************/ -/***** 32-bit accelerated drawing funcs *****/ -/**********************************************************************/ - -IMPLEMENT_WRITE_RGBA_SPAN(32, unsigned long) -IMPLEMENT_WRITE_RGB_SPAN(32, unsigned long) -IMPLEMENT_WRITE_MONO_RGBA_SPAN(32, unsigned long) -IMPLEMENT_READ_RGBA_SPAN(32, unsigned long) -IMPLEMENT_WRITE_RGBA_PIXELS(32, unsigned long) -IMPLEMENT_WRITE_MONO_RGBA_PIXELS(32, unsigned long) -IMPLEMENT_READ_RGBA_PIXELS(32, unsigned long) - - -/**********************************************************************/ -/***** Miscellaneous device driver funcs *****/ -/**********************************************************************/ - -static GLboolean set_buffer(GLcontext *ctx, GLframebuffer *buffer, GLuint bit) - { - AMesaContext context = (AMesaContext)(ctx->DriverCtx); - GLboolean ok = GL_TRUE; - - if (bit == DD_FRONT_LEFT_BIT) - context->Buffer->Active = context->Buffer->Screen; - - else if (bit == DD_BACK_LEFT) - { - if (context->Buffer->Background) - context->Buffer->Active = context->Buffer->Background; - else - ok = GL_FALSE; - } - - else - ok = GL_FALSE; - - return ok; - } - - -static void get_buffer_size(GLcontext *ctx, GLuint *width, GLuint *height) - { - AMesaContext context = (AMesaContext)(ctx->DriverCtx); - - *width = context->Buffer->Width; - *height = context->Buffer->Height; - } - - -/** - * We only implement this function as a mechanism to check if the - * framebuffer size has changed (and update corresponding state). - */ -static void viewport(GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h) -{ - /* poll for window size change and realloc software Z/stencil/etc if needed */ - GLuint newWidth, newHeight; - GLframebuffer *buffer = ctx->WinSysDrawBuffer; - get_buffer_size( &newWidth, &newHeight ); - if (buffer->Width != newWidth || buffer->Height != newHeight) { - _mesa_resize_framebuffer(ctx, buffer, newWidth, newHeight ); - } - -} - - -/**********************************************************************/ -/**********************************************************************/ - -static void setup_dd_pointers(GLcontext *ctx) - { - AMesaContext context = (AMesaContext)(ctx->DriverCtx); - - /* Initialize all the pointers in the driver struct. Do this whenever */ - /* a new context is made current or we change buffers via set_buffer! */ - - ctx->Driver.UpdateState = setup_dd_pointers; - ctx->Driver.SetBuffer = set_buffer; - ctx->Driver.GetBufferSize = get_buffer_size; - ctx->Driver.Viewport = viewport; - - ctx->Driver.Color = set_color_generic; - ctx->Driver.ClearColor = clear_color_generic; - ctx->Driver.Clear = clear_generic; - ctx->Driver.WriteRGBASpan = write_rgba_span_generic; - ctx->Driver.WriteRGBSpan = write_rgb_span_generic; - ctx->Driver.WriteMonoRGBASpan = write_mono_rgba_span_generic; - ctx->Driver.WriteRGBAPixels = write_rgba_pixels_generic; - ctx->Driver.WriteMonoRGBAPixels = write_mono_rgba_pixels_generic; - ctx->Driver.ReadRGBASpan = read_rgba_span_generic; - ctx->Driver.ReadRGBAPixels = read_rgba_pixels_generic; - - if (context->Buffer->Active != screen) - { - switch (context->Visual->Depth) - { - case 15: - ctx->Driver.WriteRGBASpan = write_rgba_span_15; - ctx->Driver.WriteRGBSpan = write_rgb_span_15; - ctx->Driver.WriteMonoRGBASpan = write_mono_rgba_span_15; - ctx->Driver.WriteRGBAPixels = write_rgba_pixels_15; - ctx->Driver.WriteMonoRGBAPixels = write_mono_rgba_pixels_15; - ctx->Driver.ReadRGBASpan = read_rgba_span_15; - ctx->Driver.ReadRGBAPixels = read_rgba_pixels_15; - break; - - case 16: - ctx->Driver.WriteRGBASpan = write_rgba_span_16; - ctx->Driver.WriteRGBSpan = write_rgb_span_16; - ctx->Driver.WriteMonoRGBASpan = write_mono_rgba_span_16; - ctx->Driver.WriteRGBAPixels = write_rgba_pixels_16; - ctx->Driver.WriteMonoRGBAPixels = write_mono_rgba_pixels_16; - ctx->Driver.ReadRGBASpan = read_rgba_span_16; - ctx->Driver.ReadRGBAPixels = read_rgba_pixels_16; - break; - - case 32: - ctx->Driver.WriteRGBASpan = write_rgba_span_32; - ctx->Driver.WriteRGBSpan = write_rgb_span_32; - ctx->Driver.WriteMonoRGBASpan = write_mono_rgba_span_32; - ctx->Driver.WriteRGBAPixels = write_rgba_pixels_32; - ctx->Driver.WriteMonoRGBAPixels = write_mono_rgba_pixels_32; - ctx->Driver.ReadRGBASpan = read_rgba_span_32; - ctx->Driver.ReadRGBAPixels = read_rgba_pixels_32; - break; - } - } - } - - -/**********************************************************************/ -/***** AMesa Public API Functions *****/ -/**********************************************************************/ - - -AMesaVisual AMesaCreateVisual(GLboolean dbFlag, GLint depth, - GLint depthSize, GLint stencilSize, GLint accumSize) - { - AMesaVisual visual; - GLbyte redBits, greenBits, blueBits; - - visual = (AMesaVisual)calloc(1, sizeof(struct amesa_visual)); - if (!visual) - return NULL; - - switch (depth) - { - case 15: - redBits = 5; - greenBits = 5; - blueBits = 5; - break; - - case 16: - redBits = 5; - greenBits = 6; - blueBits = 5; - break; - - case 24: case 32: - redBits = 8; - greenBits = 8; - blueBits = 8; - break; - - default: - free(visual); - return NULL; - } - - visual->DBFlag = dbFlag; - visual->Depth = depth; - visual->GLVisual = _mesa_create_visual(GL_TRUE, /* rgb mode */ - dbFlag, /* db_flag */ - GL_FALSE, /* stereo */ - redBits, greenBits, blueBits, 8, - 0, /* index bits */ - depthSize, /* depth bits */ - stencilSize,/* stencil bits */ - accumSize, /* accum bits */ - accumSize, /* accum bits */ - accumSize, /* accum bits */ - accumSize, /* accum bits */ - 1 ); - if (!visual->GLVisual) - { - free(visual); - return NULL; - } - - return visual; - } - - -void AMesaDestroyVisual(AMesaVisual visual) - { - _mesa_destroy_visual(visual->GLVisual); - free(visual); - } - - -AMesaBuffer AMesaCreateBuffer(AMesaVisual visual, - GLint width, GLint height) - { - AMesaBuffer buffer; - - buffer = (AMesaBuffer)calloc(1, sizeof(struct amesa_buffer)); - if (!buffer) - return NULL; - - buffer->Screen = NULL; - buffer->Background = NULL; - buffer->Active = NULL; - buffer->Width = width; - buffer->Height = height; - - if (visual->DBFlag) - { - buffer->Background = create_bitmap_ex(visual->Depth, width, height); - if (!buffer->Background) - { - free(buffer); - return NULL; - } - } - - buffer->GLBuffer = _mesa_create_framebuffer(visual->GLVisual); - if (!buffer->GLBuffer) - { - if (buffer->Background) destroy_bitmap(buffer->Background); - free(buffer); - return NULL; - } - - return buffer; - } - - -void AMesaDestroyBuffer(AMesaBuffer buffer) -{ - if (buffer->Screen) destroy_bitmap(buffer->Screen); - if (buffer->Background) destroy_bitmap(buffer->Background); - _mesa_unreference_framebuffer(&buffer->GLBuffer); - free(buffer); -} - - -AMesaContext AMesaCreateContext(AMesaVisual visual, - AMesaContext share) -{ - AMesaContext context; - GLboolean direct = GL_FALSE; - - context = (AMesaContext)calloc(1, sizeof(struct amesa_context)); - if (!context) - return NULL; - - context->Visual = visual; - context->Buffer = NULL; - context->ClearColor = 0; - context->CurrentColor = 0; - context->GLContext = _mesa_create_context(visual->GLVisual, - share ? share->GLContext : NULL, - (void *) context, GL_FALSE ); - if (!context->GLContext) - { - free(context); - return NULL; - } - - return context; -} - - -void AMesaDestroyContext(AMesaContext context) -{ - _mesa_destroy_context(context->GLContext); - free(context); -} - - -GLboolean AMesaMakeCurrent(AMesaContext context, AMesaBuffer buffer) -{ - if (context && buffer) { - set_color_depth(context->Visual->Depth); - if (set_gfx_mode(GFX_AUTODETECT, buffer->Width, buffer->Height, 0, 0) != 0) - return GL_FALSE; - - context->Buffer = buffer; - buffer->Screen = screen; - buffer->Active = buffer->Background ? buffer->Background : screen; - - setup_dd_pointers(context->GLContext); - _mesa_make_current(context->GLContext, buffer->GLBuffer); - } - else { - /* XXX I don't think you want to destroy anything here! */ - destroy_bitmap(context->Buffer->Screen); - context->Buffer->Screen = NULL; - context->Buffer->Active = NULL; - context->Buffer = NULL; - _mesa_make_current(NULL, NULL); - } - - return GL_TRUE; -} - - -void AMesaSwapBuffers(AMesaBuffer buffer) -{ - if (buffer->Background) { - blit(buffer->Background, buffer->Screen, - 0, 0, 0, 0, - buffer->Width, buffer->Height); - } -} diff --git a/src/mesa/drivers/allegro/amesa.h b/src/mesa/drivers/allegro/amesa.h deleted file mode 100644 index 852d34cf4f..0000000000 --- a/src/mesa/drivers/allegro/amesa.h +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Mesa 3-D graphics library - * Version: 3.3 - * - * Copyright (C) 1999-2000 Brian Paul All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - - -/* Allegro (DJGPP) driver by Bernhard Tschirren (bernie-t@geocities.com) */ - - -#ifndef AMESA_H -#define AMESA_H - - -#define AMESA_MAJOR_VERSION 3 -#define AMESA_MINOR_VERSION 3 - - -typedef struct amesa_visual *AMesaVisual; -typedef struct amesa_buffer *AMesaBuffer; -typedef struct amesa_context *AMesaContext; - - -extern AMesaVisual AMesaCreateVisual(GLboolean dbFlag, GLint depth, - GLint depthSize, - GLint stencilSize, - GLint accumSize); - -extern void AMesaDestroyVisual(AMesaVisual visual); - -extern AMesaBuffer AMesaCreateBuffer(AMesaVisual visual, - GLint width, GLint height); - -extern void AMesaDestroyBuffer(AMesaBuffer buffer); - - -extern AMesaContext AMesaCreateContext(AMesaVisual visual, - AMesaContext sharelist); - -extern void AMesaDestroyContext(AMesaContext context); - -extern GLboolean AMesaMakeCurrent(AMesaContext context, AMesaBuffer buffer); - -extern void AMesaSwapBuffers(AMesaBuffer buffer); - - -#endif /* AMESA_H */ diff --git a/src/mesa/drivers/allegro/direct.h b/src/mesa/drivers/allegro/direct.h deleted file mode 100644 index bd8b5eb49d..0000000000 --- a/src/mesa/drivers/allegro/direct.h +++ /dev/null @@ -1,189 +0,0 @@ -/* - * Mesa 3-D graphics library - * Version: 3.0 - * Copyright (C) 1995-1998 Brian Paul - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the Free - * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - - -#define DESTINATION(BMP, X, Y, TYPE) \ - ({ \ - BITMAP *_bmp = BMP; \ - \ - (TYPE*)(_bmp->line[_bmp->h - (Y) - 1]) + (X); \ - }) - - -#define IMPLEMENT_WRITE_RGBA_SPAN(DEPTH, TYPE) \ -static void write_rgba_span_##DEPTH (const GLcontext *ctx, \ - GLuint n, GLint x, GLint y, \ - const GLubyte rgba[][4], \ - const GLubyte mask[]) \ - { \ - AMesaContext context = (AMesaContext)(ctx->DriverCtx); \ - TYPE *d = DESTINATION(context->Buffer->Active, x, y, TYPE); \ - \ - if (mask) \ - { \ - while (n--) \ - { \ - if (mask[0]) d[0] = makecol##DEPTH(rgba[0][RCOMP], rgba[0][GCOMP], rgba[0][BCOMP]); \ - d++; rgba++; mask++; \ - } \ - } \ - else \ - { \ - while (n--) \ - { \ - d[0] = makecol##DEPTH(rgba[0][RCOMP], rgba[0][GCOMP], rgba[0][BCOMP]); \ - d++; rgba++; \ - } \ - } \ - } - - -#define IMPLEMENT_WRITE_RGB_SPAN(DEPTH, TYPE) \ -static void write_rgb_span_##DEPTH (const GLcontext *ctx, \ - GLuint n, GLint x, GLint y, \ - const GLubyte rgb[][3], \ - const GLubyte mask[]) \ - { \ - AMesaContext context = (AMesaContext)(ctx->DriverCtx); \ - TYPE *d = DESTINATION(context->Buffer->Active, x, y, TYPE); \ - \ - if (mask) \ - { \ - while (n--) \ - { \ - if (mask[0]) d[0] = makecol##DEPTH(rgb[0][RCOMP], rgb[0][GCOMP], rgb[0][BCOMP]); \ - d++; rgb++; mask++; \ - } \ - } \ - else \ - { \ - while (n--) \ - { \ - d[0] = makecol##DEPTH(rgb[0][RCOMP], rgb[0][GCOMP], rgb[0][BCOMP]); \ - d++; rgb++; \ - } \ - } \ - } - - -#define IMPLEMENT_WRITE_MONO_RGBA_SPAN(DEPTH, TYPE) \ -static void write_mono_rgba_span_##DEPTH (const GLcontext *ctx, \ - GLuint n, GLint x, GLint y, \ - const GLubyte mask[]) \ - { \ - AMesaContext context = (AMesaContext)(ctx->DriverCtx); \ - TYPE color = context->CurrentColor; \ - TYPE *d = DESTINATION(context->Buffer->Active, x, y, TYPE); \ - \ - while (n--) \ - { \ - if (mask[0]) d[0] = color; \ - d++; mask++; \ - } \ - } - - -#define IMPLEMENT_READ_RGBA_SPAN(DEPTH, TYPE) \ -static void read_rgba_span_##DEPTH (const GLcontext *ctx, \ - GLuint n, GLint x, GLint y, \ - GLubyte rgba[][4]) \ - { \ - AMesaContext context = (AMesaContext)(ctx->DriverCtx); \ - BITMAP *bmp = context->Buffer->Active; \ - TYPE *d = DESTINATION(bmp, x, y, TYPE); \ - \ - while (n--) \ - { \ - rgba[0][RCOMP] = getr##DEPTH(d[0]); \ - rgba[0][GCOMP] = getg##DEPTH(d[0]); \ - rgba[0][BCOMP] = getb##DEPTH(d[0]); \ - rgba[0][ACOMP] = 255; \ - \ - d++; rgba++; \ - } \ - } - - -#define IMPLEMENT_WRITE_RGBA_PIXELS(DEPTH, TYPE) \ -static void write_rgba_pixels_##DEPTH (const GLcontext *ctx, \ - GLuint n, \ - const GLint x[], \ - const GLint y[], \ - const GLubyte rgba[][4], \ - const GLubyte mask[]) \ - { \ - AMesaContext context = (AMesaContext)(ctx->DriverCtx); \ - BITMAP *bmp = context->Buffer->Active; \ - \ - while (n--) \ - { \ - if (mask[0]) *DESTINATION(bmp, x[0], y[0], TYPE) = makecol##DEPTH(rgba[0][RCOMP], rgba[0][GCOMP], rgba[0][BCOMP]); \ - rgba++; x++; y++; mask++; \ - } \ - } - - - -#define IMPLEMENT_WRITE_MONO_RGBA_PIXELS(DEPTH, TYPE) \ -static void write_mono_rgba_pixels_##DEPTH (const GLcontext *ctx, \ - GLuint n, \ - const GLint x[], \ - const GLint y[], \ - const GLubyte mask[]) \ - { \ - AMesaContext context = (AMesaContext)(ctx->DriverCtx); \ - TYPE color = context->CurrentColor; \ - BITMAP *bmp = context->Buffer->Active; \ - \ - while (n--) \ - { \ - if (mask[0]) *DESTINATION(bmp, x[0], y[0], TYPE) = color; \ - x++; y++; mask++; \ - } \ - } - - -#define IMPLEMENT_READ_RGBA_PIXELS(DEPTH, TYPE) \ -static void read_rgba_pixels_##DEPTH (const GLcontext *ctx, \ - GLuint n, \ - const GLint x[], \ - const GLint y[], \ - GLubyte rgba[][4], \ - const GLubyte mask[]) \ - { \ - AMesaContext context = (AMesaContext)(ctx->DriverCtx); \ - BITMAP *bmp = context->Buffer->Active; \ - \ - while (n--) \ - { \ - if (mask[0]) \ - { \ - int color = *DESTINATION(bmp, x[0], y[0], TYPE); \ - \ - rgba[0][RCOMP] = getr##DEPTH(color); \ - rgba[0][GCOMP] = getg##DEPTH(color); \ - rgba[0][BCOMP] = getb##DEPTH(color); \ - rgba[0][ACOMP] = 255; \ - } \ - \ - x++; y++; rgba++; mask++; \ - } \ - } - diff --git a/src/mesa/drivers/allegro/generic.h b/src/mesa/drivers/allegro/generic.h deleted file mode 100644 index 4c8af9b95c..0000000000 --- a/src/mesa/drivers/allegro/generic.h +++ /dev/null @@ -1,234 +0,0 @@ -/* - * Mesa 3-D graphics library - * Version: 3.0 - * Copyright (C) 1995-1998 Brian Paul - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the Free - * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -static void clear_color_generic(GLcontext *ctx, const GLfloat color[4]) - { - AMesaContext context = (AMesaContext)(ctx->DriverCtx); - GLubyte r, g, b; - CLAMPED_FLOAT_TO_UBYTE(r, color[0]); - CLAMPED_FLOAT_TO_UBYTE(g, color[1]); - CLAMPED_FLOAT_TO_UBYTE(b, color[2]); - context->ClearColor = makecol(r, g, b); - } - - -static void set_color_generic(GLcontext *ctx, - GLubyte red, GLubyte green, - GLubyte blue, GLubyte alpha) - { - AMesaContext context = (AMesaContext)(ctx->DriverCtx); - - context->CurrentColor = makecol(red, green, blue); - } - - -static GLbitfield clear_generic(GLcontext *ctx, - GLbitfield mask, GLboolean all, - GLint x, GLint y, - GLint width, GLint height) - { - AMesaContext context = (AMesaContext)(ctx->DriverCtx); - - if (mask & GL_COLOR_BUFFER_BIT) - { - if (all) - clear_to_color(context->Buffer->Active, context->ClearColor); - else - rect(context->Buffer->Active, - x, y, x+width-1, y+height-1, - context->ClearColor); - } - - return mask & (~GL_COLOR_BUFFER_BIT); - } - - -static void write_rgba_span_generic(const GLcontext *ctx, - GLuint n, GLint x, GLint y, - const GLubyte rgba[][4], - const GLubyte mask[]) - { - AMesaContext context = (AMesaContext)(ctx->DriverCtx); - BITMAP *bmp = context->Buffer->Active; - - y = FLIP(context, y); - - if (mask) - { - while (n--) - { - if (mask[0]) putpixel(bmp, x, y, makecol(rgba[0][RCOMP], rgba[0][GCOMP], rgba[0][BCOMP])); - x++; mask++; rgba++; - } - } - else - { - while (n--) - { - putpixel(bmp, x, y, makecol(rgba[0][RCOMP], rgba[0][GCOMP], rgba[0][BCOMP])); - x++; rgba++; - } - } - } - - -static void write_rgb_span_generic(const GLcontext *ctx, - GLuint n, GLint x, GLint y, - const GLubyte rgb[][3], - const GLubyte mask[]) - { - AMesaContext context = (AMesaContext)(ctx->DriverCtx); - BITMAP *bmp = context->Buffer->Active; - - y = FLIP(context, y); - - if (mask) - { - while(n--) - { - if (mask[0]) putpixel(bmp, x, y, makecol(rgb[0][RCOMP], rgb[0][GCOMP], rgb[0][BCOMP])); - x++; mask++; rgb++; - } - } - else - { - while (n--) - { - putpixel(bmp, x, y, makecol(rgb[0][RCOMP], rgb[0][GCOMP], rgb[0][BCOMP])); - x++; rgb++; - } - } - } - - -static void write_mono_rgba_span_generic(const GLcontext *ctx, - GLuint n, GLint x, GLint y, - const GLubyte mask[]) - { - AMesaContext context = (AMesaContext)(ctx->DriverCtx); - BITMAP *bmp = context->Buffer->Active; - int color = context->CurrentColor; - - y = FLIP(context, y); - - if (mask) - { - while(n--) - { - if (mask[0]) putpixel(bmp, x, y, color); - x++; mask++; - } - } - else - { - while(n--) - { - putpixel(bmp, x, y, color); - x++; - } - } - } - - -static void read_rgba_span_generic(const GLcontext *ctx, - GLuint n, GLint x, GLint y, - GLubyte rgba[][4]) - { - AMesaContext context = (AMesaContext)(ctx->DriverCtx); - BITMAP *bmp = context->Buffer->Active; - - y = FLIP(context, y); - - while (n--) - { - int color = getpixel(bmp, x, y); - - rgba[0][RCOMP] = getr(color); - rgba[0][GCOMP] = getg(color); - rgba[0][BCOMP] = getb(color); - rgba[0][ACOMP] = 255; - - x++; rgba++; - } - } - - -static void write_rgba_pixels_generic(const GLcontext *ctx, - GLuint n, - const GLint x[], - const GLint y[], - const GLubyte rgba[][4], - const GLubyte mask[]) - { - AMesaContext context = (AMesaContext)(ctx->DriverCtx); - BITMAP *bmp = context->Buffer->Active; - - while (n--) - { - if (mask[0]) putpixel(bmp, x[0], FLIP(context, y[0]), makecol(rgba[0][RCOMP], rgba[0][GCOMP], rgba[0][BCOMP])); - x++; y++; mask++; - } - } - - -static void write_mono_rgba_pixels_generic(const GLcontext *ctx, - GLuint n, - const GLint x[], - const GLint y[], - const GLubyte mask[]) - { - AMesaContext context = (AMesaContext)(ctx->DriverCtx); - BITMAP *bmp = context->Buffer->Active; - int color = context->CurrentColor; - - while (n--) - { - if (mask[0]) putpixel(bmp, x[0], FLIP(context, y[0]), color); - x++; y++; mask++; - } - } - - -static void read_rgba_pixels_generic(const GLcontext *ctx, - GLuint n, - const GLint x[], - const GLint y[], - GLubyte rgba[][4], - const GLubyte mask[]) - { - AMesaContext context = (AMesaContext)(ctx->DriverCtx); - BITMAP *bmp = context->Buffer->Active; - - while (n--) - { - if (mask[0]) - { - int color = getpixel(bmp, x[0], FLIP(context, y[0])); - - rgba[0][RCOMP] = getr(color); - rgba[0][GCOMP] = getg(color); - rgba[0][BCOMP] = getb(color); - rgba[0][ACOMP] = 255; - } - - x++; y++; mask++; rgba++; - } - } - diff --git a/src/mesa/drivers/d3d/D3DCAPS.CPP b/src/mesa/drivers/d3d/D3DCAPS.CPP deleted file mode 100644 index 80ee91d922..0000000000 --- a/src/mesa/drivers/d3d/D3DCAPS.CPP +++ /dev/null @@ -1,250 +0,0 @@ -/*===========================================================================*/ -/* */ -/* Mesa-3.0 DirectX 6 Driver Build 5 */ -/* */ -/* By Leigh McRae */ -/* */ -/* http://www.altsoftware.com/ */ -/* */ -/* Copyright (c) 1999-1998 alt.software inc. All Rights Reserved */ -/*===========================================================================*/ -#include "D3DHAL.h" -/*===========================================================================*/ -/* Macros. */ -/*===========================================================================*/ -#define SRCBLEND_MAP(gl,d3d,fall) if ( pHAL->D3DHWDevDesc.dpcTriCaps.dwSrcBlendCaps & d3d ) \ - { \ - sprintf( buffer, "SRC Blend: %s -> %s", # gl, # d3d ); \ - DPF(( (DBG_CNTX_INFO|DBG_TXT_INFO), buffer )); \ - pShared->dwSrcBlendCaps[index] = d3d; \ - } \ - else \ - { \ - sprintf( buffer, "SRC Blend: %s -> %s", # gl, # fall ); \ - DPF(( (DBG_CNTX_INFO|DBG_TXT_INFO), buffer )); \ - pShared->dwSrcBlendCaps[index] = fall; \ - } -#define DSTBLEND_MAP(gl,d3d,fall) if ( pHAL->D3DHWDevDesc.dpcTriCaps.dwDestBlendCaps & d3d ) \ - { \ - sprintf( buffer, "DST Blend: %s -> %s", # gl, # d3d ); \ - DPF(( (DBG_CNTX_INFO|DBG_TXT_INFO), buffer )); \ - pShared->dwDestBlendCaps[index] = d3d; \ - } \ - else \ - { \ - sprintf( buffer, "DST Blend: %s -> %s", # gl, # fall ); \ - DPF(( (DBG_CNTX_INFO|DBG_TXT_INFO), buffer )); \ - pShared->dwDestBlendCaps[index] = fall; \ - } - -/*===========================================================================*/ -/* I use this function to handle the fact that the D3D texture blending and */ -/* OpenGL texture blending functions don't map one to one. Also there is the*/ -/* problem with cards not supporting all the D3D functions. So I use the CAPS*/ -/* of the card to make a table of functions that will have defaults for the */ -/* unsupported functions. */ -/* So first I fill the table with the fallback function then I check to see */ -/* if the card supports the requested function. If it does I replace the */ -/* default thats already in the array. Now order does matter as I used an */ -/* enum type in D3DShared.h so that the mapping would be a little easier. */ -/*===========================================================================*/ -/* RETURN: */ -/*===========================================================================*/ -void AlphaBlendTableHAL( PMESAD3DHAL pHAL ) -{ - PMESAD3DSHARED pShared = &pHAL->shared; - int index; - char buffer[128]; - - DPF(( DBG_FUNC, "AlphaBlendTableHAL();" )); - - /* Make the fallback for the Source blend. */ - for( index = 0; index < 14; index++ ) - { - switch( index ) - { - case s_zero: - SRCBLEND_MAP( GL_ZERO, D3DBLEND_ZERO, D3DBLEND_ONE ); - break; - case s_one: - SRCBLEND_MAP( GL_ONE, D3DBLEND_ONE, D3DBLEND_ONE ); - break; - case s_dst_color: - SRCBLEND_MAP( GL_DST_COLOR, D3DBLEND_DESTCOLOR, D3DBLEND_ONE ); - break; - case s_one_minus_dst_color: - SRCBLEND_MAP( GL_ONE_MINUS_DST_COLOR, D3DBLEND_INVDESTCOLOR, D3DBLEND_ONE ); - break; - case s_src_alpha: - SRCBLEND_MAP( GL_SRC_ALPHA, D3DBLEND_SRCALPHA, D3DBLEND_ONE ); - break; - case s_one_minus_src_alpha: - SRCBLEND_MAP( GL_ONE_MINUS_SRC_ALPHA, D3DBLEND_INVSRCALPHA, D3DBLEND_ONE ); - break; - case s_dst_alpha: - SRCBLEND_MAP( GL_DST_ALPHA, D3DBLEND_DESTALPHA, D3DBLEND_ONE ); - break; - case s_one_minus_dst_alpha: - SRCBLEND_MAP( GL_ONE_MINUS_DST_ALPHA, D3DBLEND_INVDESTALPHA, D3DBLEND_ONE ); - break; - case s_src_alpha_saturate: - SRCBLEND_MAP( GL_SRC_ALPHA_SATURATE, D3DBLEND_SRCALPHASAT, D3DBLEND_ONE ); - break; - case s_constant_color: - SRCBLEND_MAP( GL_CONSTANT_COLOR, D3DBLEND_SRCCOLOR, D3DBLEND_ONE ); - break; - case s_one_minus_constant_color: - SRCBLEND_MAP( GL_ONE_MINUS_CONSTANT_COLOR, D3DBLEND_INVSRCCOLOR, D3DBLEND_ONE ); - break; - case s_constant_alpha: - SRCBLEND_MAP( GL_CONSTANT_ALPHA, D3DBLEND_BOTHSRCALPHA, D3DBLEND_ONE ); - break; - case s_one_minus_constant_alpha: - SRCBLEND_MAP( GL_ONE_MINUS_CONSTANT_ALPHA, D3DBLEND_BOTHINVSRCALPHA, D3DBLEND_ONE ); - break; - } - } - - /* Make the fallback for the Destination blend. */ - for( index = 0; index < 14; index++ ) - { - switch( index ) - { - case d_zero: - DSTBLEND_MAP( GL_ZERO, D3DBLEND_ZERO, D3DBLEND_ONE ); - break; - case d_one: - DSTBLEND_MAP( GL_ONE, D3DBLEND_ONE, D3DBLEND_ONE ); - break; - case d_src_color: - DSTBLEND_MAP( GL_SRC_COLOR, D3DBLEND_SRCCOLOR, D3DBLEND_ONE ); - break; - case d_one_minus_src_color: - DSTBLEND_MAP( GL_ONE_MINUS_SRC_COLOR, D3DBLEND_INVSRCCOLOR, D3DBLEND_ONE ); - break; - case d_src_alpha: - DSTBLEND_MAP( GL_SRC_ALPHA, D3DBLEND_SRCALPHA, D3DBLEND_ONE ); - break; - case d_one_minus_src_alpha: - DSTBLEND_MAP( GL_ONE_MINUS_SRC_ALPHA, D3DBLEND_INVSRCALPHA, D3DBLEND_ONE ); - break; - case d_dst_alpha: - DSTBLEND_MAP( GL_DST_ALPHA, D3DBLEND_DESTALPHA, D3DBLEND_ONE ); - break; - case d_one_minus_dst_alpha: - DSTBLEND_MAP( GL_ONE_MINUS_DST_ALPHA, D3DBLEND_INVDESTALPHA, D3DBLEND_ONE ); - break; - case d_constant_color: - DSTBLEND_MAP( GL_CONSTANT_COLOR, D3DBLEND_DESTCOLOR, D3DBLEND_ONE ); - break; - case d_one_minus_constant_color: - DSTBLEND_MAP( GL_ONE_MINUS_CONSTANT_COLOR, D3DBLEND_INVDESTCOLOR, D3DBLEND_ONE ); - break; - case d_constant_alpha: - DSTBLEND_MAP( GL_CONSTANT_ALPHAR, D3DBLEND_BOTHSRCALPHA, D3DBLEND_ONE ); - break; - case d_one_minus_constant_alpha: - DSTBLEND_MAP( GL_ONE_MINUS_CONSTANT_ALPHA, D3DBLEND_BOTHINVSRCALPHA, D3DBLEND_ONE ); - break; - } - } - - /* Make the fallbacks for the texture functions. */ - for( index = 0; index < 4; index++ ) - { - switch( index ) - { - case d3dtblend_decal: - if ( pHAL->D3DHWDevDesc.dpcTriCaps.dwTextureBlendCaps & D3DTBLEND_DECAL ) - { - DPF(( (DBG_CNTX_INFO|DBG_TXT_INFO), "D3DTBLEND_DECAL -> D3DTBLEND_DECAL" )); - pShared->dwTexFunc[index] = D3DTBLEND_DECAL; - } - else - { - if ( pHAL->D3DHWDevDesc.dpcTriCaps.dwTextureBlendCaps & D3DTBLEND_MODULATE ) - { - DPF(( (DBG_CNTX_INFO|DBG_TXT_INFO), "D3DTBLEND_DECAL -> D3DTBLEND_MODULATE" )); - pShared->dwTexFunc[index] = D3DTBLEND_MODULATE; - } - else - { - DPF(( (DBG_CNTX_INFO|DBG_TXT_INFO), "D3DTBLEND_DECAL -> D3DTBLEND_ADD" )); - pShared->dwTexFunc[index] = D3DTBLEND_ADD; - } - } - break; - case d3dtblend_decalalpha: - if ( pHAL->D3DHWDevDesc.dpcTriCaps.dwTextureBlendCaps & D3DTBLEND_DECALALPHA ) - { - DPF(( (DBG_CNTX_INFO|DBG_TXT_INFO), "D3DTBLEND_DECALALPHA -> D3DTBLEND_DECALALPHA" )); - pShared->dwTexFunc[index] = D3DTBLEND_DECALALPHA; - } - else - { - if ( pHAL->D3DHWDevDesc.dpcTriCaps.dwTextureBlendCaps & D3DTBLEND_DECAL ) - { - DPF(( (DBG_CNTX_INFO|DBG_TXT_INFO), "D3DTBLEND_DECALALPA -> D3DTBLEND_DECAL" )); - pShared->dwTexFunc[index] = D3DTBLEND_DECAL; - } - else - { - DPF(( (DBG_CNTX_INFO|DBG_TXT_INFO), "D3DTBLEND_DECALALPHA -> D3DTBLEND_ADD" )); - pShared->dwTexFunc[index] = D3DTBLEND_ADD; - } - } - break; - case d3dtblend_modulate: - if ( pHAL->D3DHWDevDesc.dpcTriCaps.dwTextureBlendCaps & D3DTBLEND_MODULATE ) - { - DPF(( (DBG_CNTX_INFO|DBG_TXT_INFO), "D3DTBLEND_MODULATE -> D3DTBLEND_MODULATE" )); - pShared->dwTexFunc[index] = D3DTBLEND_MODULATE; - } - else - { - if ( pHAL->D3DHWDevDesc.dpcTriCaps.dwTextureBlendCaps & D3DTBLEND_MODULATEALPHA ) - { - DPF(( (DBG_CNTX_INFO|DBG_TXT_INFO), "D3DTBLEND_MODULATE -> D3DTBLEND_MODULATEALPHA" )); - pShared->dwTexFunc[index] = D3DTBLEND_MODULATEALPHA; - } - else if ( pHAL->D3DHWDevDesc.dpcTriCaps.dwTextureBlendCaps & D3DTBLEND_DECAL ) - { - DPF(( (DBG_CNTX_INFO|DBG_TXT_INFO), "D3DTBLEND_MODULATE -> D3DTBLEND_DECAL" )); - pShared->dwTexFunc[index] = D3DTBLEND_DECAL; - } - else - { - DPF(( (DBG_CNTX_INFO|DBG_TXT_INFO), "D3DTBLEND_MODULATE -> D3DTBLEND_ADD" )); - pShared->dwTexFunc[index] = D3DTBLEND_ADD; - } - } - break; - case d3dtblend_modulatealpha: - if ( pHAL->D3DHWDevDesc.dpcTriCaps.dwTextureBlendCaps & D3DTBLEND_MODULATEALPHA ) - { - DPF(( (DBG_CNTX_INFO|DBG_TXT_INFO), "D3DTBLEND_MODULATEALPHA -> D3DTBLEND_MODULATEALPHA" )); - pShared->dwTexFunc[index] = D3DTBLEND_MODULATEALPHA; - } - else - { - if ( pHAL->D3DHWDevDesc.dpcTriCaps.dwTextureBlendCaps & D3DTBLEND_MODULATE ) - { - DPF(( (DBG_CNTX_INFO|DBG_TXT_INFO), "D3DTBLEND_MODULATEALPHA -> D3DTBLEND_MODULATE" )); - pShared->dwTexFunc[index] = D3DTBLEND_MODULATE; - } - else if ( pHAL->D3DHWDevDesc.dpcTriCaps.dwTextureBlendCaps & D3DTBLEND_DECAL ) - { - DPF(( (DBG_CNTX_INFO|DBG_TXT_INFO), "D3DTBLEND_MODULATEALPHA -> D3DTBLEND_DECALE" )); - pShared->dwTexFunc[index] = D3DTBLEND_DECAL; - } - else - { - DPF(( (DBG_CNTX_INFO|DBG_TXT_INFO), "D3DTBLEND_MODULATEALPHA -> D3DTBLEND_ADD" )); - pShared->dwTexFunc[index] = D3DTBLEND_ADD; - } - } - break; - } - } -} - diff --git a/src/mesa/drivers/d3d/D3DHAL.H b/src/mesa/drivers/d3d/D3DHAL.H deleted file mode 100644 index 2496d164e5..0000000000 --- a/src/mesa/drivers/d3d/D3DHAL.H +++ /dev/null @@ -1,68 +0,0 @@ -/*===========================================================================*/ -/* */ -/* Mesa-3.0 DirectX 6 Driver */ -/* */ -/* By Leigh McRae */ -/* */ -/* http://www.altsoftware.com/ */ -/* */ -/* Copyright (c) 1999-1998 alt.software inc. All Rights Reserved */ -/*===========================================================================*/ -#ifndef _D3D_HAL_INC -#define _D3D_HAL_INC - -/*===========================================================================*/ -/* Includes. */ -/*===========================================================================*/ -#include -#include -#include -#include -#include -#include "D3DShared.h" -#include "D3DTextureMgr.h" -#include "Debug.h" -/*===========================================================================*/ -/* Defines. */ -/*===========================================================================*/ -#define DX_RESTORE(ps) if ( (ps) && (ps)->IsLost() ) (ps)->Restore(); -/*===========================================================================*/ -/* Type defines. */ -/*===========================================================================*/ -typedef struct _d3d_hal_struct -{ - MESAD3DSHARED shared; - - GUID guid; - LPDIRECTDRAW lpDD; - LPDIRECTDRAW4 lpDD4; - LPDIRECT3D3 lpD3D3; - LPDIRECT3DDEVICE3 lpD3DDevice; - D3DDEVICEDESC D3DHWDevDesc; - LPDIRECTDRAWSURFACE4 lpDDSPrimary, - lpDDSRender, - lpDDSZbuffer; - LPDIRECT3DVIEWPORT3 lpViewport; - LPDIRECTDRAWCLIPPER lpClipper; - DDPIXELFORMAT ddpf, - ddpfZBuffer; - PTM_OBJECT pTMList; - -} MESAD3DHAL, *PMESAD3DHAL; -/*===========================================================================*/ -/* External function prototypes. */ -/*===========================================================================*/ -extern BOOL InitTMgrHAL( PMESAD3DHAL pHAL ); -extern void TermTMgrHAL( PMESAD3DHAL pHAL ); -extern void AlphaBlendTableHAL( PMESAD3DHAL pHAL ); - -extern void Solve8BitChannelPixelFormat( DDPIXELFORMAT *pddpf, PPIXELINFO pPixel ); -extern char *ErrorStringD3D( HRESULT hr ); -extern void FatalShutDown( PMESAD3DHAL pHAL ); -/*===========================================================================*/ -/* Global variables. */ -/*===========================================================================*/ -extern char *errorMsg; - -#endif - diff --git a/src/mesa/drivers/d3d/D3DInit.cpp b/src/mesa/drivers/d3d/D3DInit.cpp deleted file mode 100644 index e21cd21e25..0000000000 --- a/src/mesa/drivers/d3d/D3DInit.cpp +++ /dev/null @@ -1,891 +0,0 @@ -/*===========================================================================*/ -/* */ -/* Mesa-3.0 DirectX 6 Driver Build 5 */ -/* */ -/* By Leigh McRae */ -/* */ -/* http://www.altsoftware.com/ */ -/* */ -/* Copyright (c) 1999-1998 alt.software inc. All Rights Reserved */ -/*===========================================================================*/ -#include "D3DHAL.h" -/*===========================================================================*/ -/* Local function prototypes. */ -/*===========================================================================*/ -static void DestroyAllSurfaces( PMESAD3DHAL pHAL ); -static void DestroyDevice( PMESAD3DHAL pHAL ); -static void DestroyInterfaces( PMESAD3DHAL pHAL ); - -HRESULT WINAPI EnumSurfacesHook( LPDIRECTDRAWSURFACE4 lpDDS, LPDDSURFACEDESC2 lpDDSDesc, LPVOID pVoid ); -HRESULT CALLBACK EnumZBufferHook( DDPIXELFORMAT* pddpf, VOID *pVoid ); -HRESULT CALLBACK EnumDeviceHook( GUID FAR* lpGuid, LPSTR lpDesc, LPSTR lpName, LPD3DDEVICEDESC lpD3DHWDesc, LPD3DDEVICEDESC lpD3DHELDesc, void *pVoid ); -/*===========================================================================*/ -/* Globals. */ -/*===========================================================================*/ -//char *errorMsg; -/*===========================================================================*/ -/* This function is responable for allocating the actual MESAD3DHAL struct. */ -/* Each Mesa context will have its own MESAD3DHAL struct so its like a mini */ -/* context to some extent. All one time allocations/operations get done here.*/ -/*===========================================================================*/ -/* RETURN: TRUE, FALSE. */ -/*===========================================================================*/ -extern "C" PMESAD3DSHARED InitHAL( HWND hwnd ) -{ - PMESAD3DHAL pHAL; - ULONG rc; - - DPF(( DBG_FUNC, "InitHAL();" )); - DPF(( DBG_CNTX_INFO, "hwnd: %d", hwnd )); - - /* Allocate the structure and zero it out. */ - pHAL = (PMESAD3DHAL)ALLOC( sizeof(MESAD3DHAL) ); - if ( pHAL == NULL ) - { - RIP( pHAL, "InitHAL->", "Memory Allocation" ); - return (PMESAD3DSHARED)NULL; - } - memset( pHAL, 0, sizeof(MESAD3DHAL) ); - - /* Get the texture manager going. */ - rc = InitTMgrHAL( pHAL ); - if ( rc == FALSE ) - { - RIP( pHAL, "InitTMgrHAL->", "Failed" ); - return (PMESAD3DSHARED)NULL; - } - - /* Fill in the window parameters if we can. */ - pHAL->shared.hwnd = hwnd; - - /* Parse the user's enviroment variables to generate a debug mask. */ - ReadDBGEnv(); - - return (PMESAD3DSHARED)pHAL; -} -/*===========================================================================*/ -/* This function will unload all the resources that the MESAD3DHAL struct */ -/* has bound to it. The actual structure itself will be freed. */ -/*===========================================================================*/ -/* RETURN: */ -/*===========================================================================*/ -extern "C" void TermHAL( PMESAD3DSHARED pShared ) -{ - PMESAD3DHAL pHAL = (PMESAD3DHAL)pShared; - - DPF(( DBG_FUNC, "TermHAL();" )); - - /* Check for an empty wrapper structure. */ - if ( pHAL == NULL ) - return; - - /* Kill this texture manager. */ - TermTMgrHAL( pHAL ); - - /* Kill any DDraw stuff if exists. */ - DestroyDevice( pHAL ); - DestroyAllSurfaces( pHAL ); - DestroyInterfaces( pHAL ); - - FREE( pHAL ); -} -/*===========================================================================*/ -/* This function is used to init and resize the rendering surface as the two*/ -/* are almost the same. First the device and all the surfaces are destoryed */ -/* if they already exist. Next we create a OffScreen rendering surface and */ -/* save some pixelformat info to do color convertions. Next we start to take */ -/* care of getting the most out of the hardware. I use bHardware to determine*/ -/* the state of the device we found in the device enumeration. The enum proc*/ -/* will try for hardware first. I next use a bForceSW to make the enum proc */ -/* choose a software device. So I will try some combinations with HW first */ -/* until I feel I have to set the bForceSW and call this function again. If */ -/* this function is called with no width or height then use the internals. */ -/* NOTE: The worst case is that all will be in SW (RGBDevice) and really */ -/* I should forget the whole thing and fall back to a DDraw span type*/ -/* rendering but what is the point. This way I always know I have a */ -/* D3DDevice and that makes things easier. I do impliment the span */ -/* rendering function for stuff that I haven't done support for such */ -/* as points and lines. */ -/*===========================================================================*/ -/* RETURN: TRUE, FALSE */ -/*===========================================================================*/ -extern "C" BOOL CreateHAL( PMESAD3DSHARED pShared ) -{ - PMESAD3DHAL pHAL = (PMESAD3DHAL)pShared; - DDSURFACEDESC2 ddsd2; - D3DDEVICEDESC D3DSWDevDesc; - DDSCAPS2 ddscaps; - DWORD dwCoopFlags, - dwWidth, - dwHeight; - ULONG rc; - - DPF(( DBG_FUNC, "CreateHAL();" )); - -#define InitDDSD2(f) memset( &ddsd2, 0, sizeof(DDSURFACEDESC2) ); \ - ddsd2.dwSize = sizeof( DDSURFACEDESC2 ); \ - ddsd2.dwFlags = f; - - if ( pHAL == NULL ) - return FALSE; - - /* Use the internal rectangle struct. */ - dwWidth = pShared->rectW.right - pShared->rectW.left; - dwHeight = pShared->rectW.bottom - pShared->rectW.top; - - DPF(( DBG_CNTX_INFO, "Width: %d Height: %d", dwWidth, dwHeight )); - - /* The dimensions might still be the same so just leave. */ - if ( (dwWidth == pShared->dwWidth) && (dwHeight == pShared->dwHeight) ) - { - DPF(( DBG_CNTX_WARN, "Context size hasn't changed" )); - return TRUE; - } - - /* If one of the dimensions are zero then leave. WM_SIZE should get us back here. */ - if ( (dwWidth == 0) || (dwHeight == 0) ) - return TRUE; - - /* Save the renders dimensions. */ - pShared->dwWidth = dwWidth; - pShared->dwHeight = dwHeight; - - DPF(( DBG_CNTX_INFO, "Creating Context:\n cx:%d cy:%d", pShared->dwWidth, pShared->dwHeight )); - - /*=================================*/ - /* Create all required interfaces. */ - /*=================================*/ - - /* Kill any DDraw stuff if exists. */ - DestroyDevice( pHAL ); - DestroyAllSurfaces( pHAL ); - DestroyInterfaces( pHAL ); - - /* Create a instance of DDraw using the Primary display driver. */ - rc = DirectDrawCreate( NULL, &pHAL->lpDD, NULL ); - if( FAILED(rc) ) - { - RIP( pHAL, "DirectDrawCreate->", ErrorStringD3D(rc) ); - return FALSE; - } - - /* Get the DDraw4 interface. */ - rc = pHAL->lpDD->QueryInterface( IID_IDirectDraw4, (void **)&pHAL->lpDD4 ); - if( FAILED(rc) ) - { - RIP( pHAL, "QueryInterface (IID_IDirectDraw4) ->", ErrorStringD3D(rc) ); - return FALSE; - } - - /* Get the Direct3D3 interface. */ - rc = pHAL->lpDD4->QueryInterface( IID_IDirect3D3, (void **)&pHAL->lpD3D3 ); - if( FAILED(rc) ) - { - RIP( pHAL, "QueryInterface (IID_IDirect3D3) ->", ErrorStringD3D(rc) ); - return FALSE; - } - - /* Set the Cooperative level. NOTE: we need to know if we are FS at this point.*/ - dwCoopFlags = (pShared->bWindow == TRUE) ? DDSCL_NORMAL : (DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN); - rc = pHAL->lpDD4->SetCooperativeLevel( pShared->hwnd, dwCoopFlags ); - if ( FAILED(rc) ) - { - RIP( pHAL, "SetCooperativeLevel->", ErrorStringD3D(rc) ); - return FALSE; - } - - /*==================================================================*/ - /* Get the best device we can and note whether its hardware or not. */ - /*==================================================================*/ - pShared->bForceSW = FALSE; - pHAL->lpD3D3->EnumDevices( EnumDeviceHook, (void *)pHAL ); - pShared->bHardware = IsEqualIID( pHAL->guid, IID_IDirect3DHALDevice ); - DPF(( DBG_CNTX_INFO, "bHardware: %s", (pShared->bHardware) ? "TRUE" : "FALSE" )); - DPF(( DBG_CNTX_INFO, "bWindowed: %s", (pShared->bWindow) ? "TRUE" : "FALSE" )); - - /*========================================================================*/ - /* HARDWARE was found. */ - /*========================================================================*/ - if ( pShared->bHardware == TRUE ) - { - /*===================================*/ - /* HARDWARE -> Z-BUFFER. */ - /*===================================*/ - - /* Get a Z-Buffer pixelformat. */ - memset( &ddsd2, 0, sizeof(DDSURFACEDESC2) ); - ddsd2.dwSize = sizeof( DDSURFACEDESC2 ); - rc = pHAL->lpD3D3->EnumZBufferFormats( pHAL->guid, EnumZBufferHook, (VOID*)&ddsd2.ddpfPixelFormat ); - if ( FAILED(rc) ) - { - RIP( pHAL, "EnumZBufferFormatsl->", ErrorStringD3D(rc) ); - return FALSE; - } - - /* Setup our request structure for the Z-buffer surface. */ - ddsd2.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT | DDSD_PIXELFORMAT; - ddsd2.ddsCaps.dwCaps = DDSCAPS_ZBUFFER | DDSCAPS_VIDEOMEMORY; - ddsd2.dwWidth = dwWidth; - ddsd2.dwHeight = dwHeight; - rc = pHAL->lpDD4->CreateSurface( &ddsd2, &pHAL->lpDDSZbuffer, NULL ); - if ( !FAILED(rc) ) - { - DPF(( DBG_CNTX_INFO, "HW ZBuffer" )); - - /*===================================*/ - /* HARDWARE -> Z-BUFFER -> FLIPABLE */ - /*===================================*/ - if ( pShared->bWindow == FALSE ) - { - InitDDSD2( DDSD_CAPS | DDSD_BACKBUFFERCOUNT ); - ddsd2.dwBackBufferCount = 1; - ddsd2.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE | DDSCAPS_3DDEVICE | DDSCAPS_FLIP | DDSCAPS_COMPLEX; - rc = pHAL->lpDD4->CreateSurface( &ddsd2, &pHAL->lpDDSPrimary, NULL ); - if ( FAILED(rc) ) - { - /* Make sure we try the next fall back. */ - DPF(( DBG_CNTX_WARN, "HW Flip/Complex not available" )); - pHAL->lpDDSPrimary = NULL; - } - else - { - /* Get the back buffer that was created. */ - ddscaps.dwCaps = DDSCAPS_BACKBUFFER; - rc = pHAL->lpDDSPrimary->GetAttachedSurface( &ddscaps, &pHAL->lpDDSRender ); - if ( FAILED(rc) ) - { - DPF(( DBG_CNTX_WARN, "GetAttachedSurface failed -> HW Flip/Complex" )); - - /* Make sure we try the next fall back. */ - pHAL->lpDDSPrimary->Release(); - pHAL->lpDDSPrimary = NULL; - } - else - { - /* I have had problems when a complex surface comes back */ - /* with the back buffer being created in SW. Not sure why */ - /* or how this is possable but I'm checking for it here. */ - memset( &ddsd2, 0, sizeof(DDSURFACEDESC2) ); - ddsd2.dwSize = sizeof( DDSURFACEDESC2 ); - DX_RESTORE( pHAL->lpDDSRender ); - rc = pHAL->lpDDSRender->GetSurfaceDesc( &ddsd2 ); - if ( FAILED(rc) ) - { - RIP( pHAL, "GetSurfaceDesc (RENDER) ->", ErrorStringD3D(rc) ); - return FALSE; - } - - /* If the surface is in VID then we are happy with are Flipable. */ - if ( ddsd2.ddsCaps.dwCaps & DDSCAPS_LOCALVIDMEM ) - { - pShared->bFlipable = TRUE; - DPF(( DBG_CNTX_INFO, "HW Flip/Complex!" )); - } - else - { - /* Kill this setup. */ - pHAL->lpDDSPrimary->Release(); - pHAL->lpDDSPrimary = NULL; - } - } - } - } - - /*===================================*/ - /* HARDWARE -> Z-BUFFER -> BLT */ - /*===================================*/ - if ( pHAL->lpDDSPrimary == NULL ) - { - pShared->bFlipable = FALSE; - - /* Create the Primary (front buffer). */ - InitDDSD2( DDSD_CAPS ); - ddsd2.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE; - rc = pHAL->lpDD4->CreateSurface( &ddsd2, &pHAL->lpDDSPrimary, NULL ); - if ( FAILED(rc) ) - { - /* This is an error as we should be able to do this at minimum. */ - RIP( pHAL, "CreateSurface (PRIMARY) ->", ErrorStringD3D(rc) ); - return FALSE; - } - - /* Create the Render (back buffer). */ - InitDDSD2( DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT ); - ddsd2.dwWidth = dwWidth; - ddsd2.dwHeight = dwHeight; - ddsd2.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE; - rc = pHAL->lpDD4->CreateSurface( &ddsd2, &pHAL->lpDDSRender, NULL ); - if ( FAILED(rc) ) - { - DPF(( DBG_CNTX_WARN, "Failed HW Offscreen surface" )); - - /* Make sure we try the next fall back. */ - pHAL->lpDDSPrimary->Release(); - pHAL->lpDDSPrimary = NULL; - } - else - { - /* Might as well check here too see if this surface is in */ - /* hardware. If nothing else just to be consistant. */ - memset( &ddsd2, 0, sizeof(DDSURFACEDESC2) ); - ddsd2.dwSize = sizeof( DDSURFACEDESC2 ); - DX_RESTORE( pHAL->lpDDSRender ); - rc = pHAL->lpDDSRender->GetSurfaceDesc( &ddsd2 ); - if ( FAILED(rc) ) - { - RIP( pHAL, "GetSurfaceDesc (RENDER) ->", ErrorStringD3D(rc) ); - return FALSE; - } - - /* If the surface is in VID then we are happy. */ - if ( ddsd2.ddsCaps.dwCaps & DDSCAPS_LOCALVIDMEM ) - { - /* Create a clipper object so that DDraw will be able to blt windows that */ - /* have been clipped by the screen or other windows. */ - pHAL->lpDD4->CreateClipper( 0, &pHAL->lpClipper, NULL ); - pHAL->lpClipper->SetHWnd( 0, pShared->hwnd ); - pHAL->lpDDSPrimary->SetClipper( pHAL->lpClipper ); - pHAL->lpClipper->Release(); - DPF(( DBG_CNTX_INFO, "HW RENDER surface" )); - } - else - { - /* Kill this setup. */ - pHAL->lpDDSRender->Release(); - pHAL->lpDDSRender = NULL; - pHAL->lpDDSPrimary->Release(); - pHAL->lpDDSPrimary = NULL; - } - } - } - - /*===================================*/ - /* Create D3DDEVICE -> HARDWARE. */ - /*===================================*/ - if ( pHAL->lpDDSZbuffer && pHAL->lpDDSPrimary && pHAL->lpDDSRender ) - { - DX_RESTORE( pHAL->lpDDSRender ); - DX_RESTORE( pHAL->lpDDSZbuffer ); - - rc = pHAL->lpDDSRender->AddAttachedSurface( pHAL->lpDDSZbuffer ); - if ( FAILED(rc) ) - { - RIP( pHAL, "AddAttachedSurface (ZBUFFER) ->", ErrorStringD3D(rc) ); - return FALSE; - } - - rc = pHAL->lpD3D3->CreateDevice( IID_IDirect3DHALDevice, pHAL->lpDDSRender, &pHAL->lpD3DDevice, NULL ); - if ( rc != D3D_OK ) - { - DPF(( DBG_CNTX_WARN, "Failed HW Device" )); - pHAL->lpD3DDevice = NULL; - } - else - { - DPF(( DBG_CNTX_INFO, "HW Device" )); - } - } - } - } - - /*========================================================================*/ - /* SOFTWARE fallback. */ - /*========================================================================*/ - if ( pHAL->lpD3DDevice == NULL ) - { - DPF(( DBG_CNTX_INFO, "SW fallback :(" )); - - /* Make sure we have no surfaces allocated. Just incase. */ - DestroyAllSurfaces( pHAL ); - - /* Get a software device. */ - pShared->bFlipable = FALSE; - pShared->bForceSW = TRUE; - pHAL->lpD3D3->EnumDevices( EnumDeviceHook, (void *)pHAL ); - pShared->bHardware = IsEqualIID( pHAL->guid, IID_IDirect3DHALDevice ); - - /*===================================*/ - /* SOFTWARE -> Z-BUFFER. */ - /*===================================*/ - - /*===================================*/ - /* SOFTWARE -> Z-BUFFER -> FLIPABLE */ - /*===================================*/ - if ( pShared->bWindow == FALSE ) - { - InitDDSD2( DDSD_CAPS | DDSD_BACKBUFFERCOUNT ); - ddsd2.dwBackBufferCount = 1; - ddsd2.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE | DDSCAPS_3DDEVICE | DDSCAPS_FLIP | DDSCAPS_COMPLEX; - ddsd2.ddpfPixelFormat.dwSize = sizeof( DDPIXELFORMAT ); - ddsd2.ddpfPixelFormat.dwFlags = (DDPF_RGB | DDPF_ALPHAPIXELS); - rc = pHAL->lpDD4->CreateSurface( &ddsd2, &pHAL->lpDDSPrimary, NULL ); - if ( FAILED(rc) ) - { - DPF(( DBG_CNTX_WARN, "Failed SW Flip/Complex" )); - - /* Make sure we try the next fall back. */ - pHAL->lpDDSPrimary = NULL; - } - else - { - ddscaps.dwCaps = DDSCAPS_BACKBUFFER; - rc = pHAL->lpDDSPrimary->GetAttachedSurface( &ddscaps, &pHAL->lpDDSRender ); - if ( FAILED(rc) ) - { - /* Make sure we try the next fall back. */ - DPF(( DBG_CNTX_WARN, "GetAttachedSurface failed -> SW Flip/Complex" )); - pHAL->lpDDSPrimary->Release(); - pHAL->lpDDSPrimary = NULL; - } - else - { - DPF(( DBG_CNTX_INFO, "SW Flip/Complex" )); - pShared->bFlipable = TRUE; - } - } - } - - /*===================================*/ - /* SOFTWARE -> Z-BUFFER -> BLT */ - /*===================================*/ - if ( pHAL->lpDDSPrimary == NULL ) - { - /* Create the Primary (front buffer). */ - InitDDSD2( DDSD_CAPS ); - ddsd2.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE; - rc = pHAL->lpDD4->CreateSurface( &ddsd2, &pHAL->lpDDSPrimary, NULL ); - if ( FAILED(rc) ) - { - /* This is an error as we should be able to do this at minimum. */ - RIP( pHAL, "CreateSurface (PRIMARY) ->", ErrorStringD3D(rc) ); - return FALSE; - } - - /* Create the Render (back buffer). */ - InitDDSD2( DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT ); - ddsd2.dwWidth = dwWidth; - ddsd2.dwHeight = dwHeight; - ddsd2.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE; - ddsd2.ddpfPixelFormat.dwSize = sizeof( DDPIXELFORMAT ); - ddsd2.ddpfPixelFormat.dwFlags = (DDPF_RGB | DDPF_ALPHAPIXELS); - rc = pHAL->lpDD4->CreateSurface( &ddsd2, &pHAL->lpDDSRender, NULL ); - if ( FAILED(rc) ) - { - /* That was our last hope. */ - RIP( pHAL, "CreateSurface (RENDER) ->", ErrorStringD3D(rc) ); - return FALSE; - } - else - { - DPF(( DBG_CNTX_INFO, "SW RENDER surface" )); - - /* Create a clipper object so that DDraw will be able to blt windows that */ - /* have been clipped by the screen or other windows. */ - pHAL->lpDD4->CreateClipper( 0, &pHAL->lpClipper, NULL ); - pHAL->lpClipper->SetHWnd( 0, pShared->hwnd ); - pHAL->lpDDSPrimary->SetClipper( pHAL->lpClipper ); - pHAL->lpClipper->Release(); - } - } - - /*===================================*/ - /* Create D3DDEVICE -> SOFTWARE. */ - /*===================================*/ - if ( pHAL->lpDDSPrimary && pHAL->lpDDSRender ) - { - DX_RESTORE( pHAL->lpDDSRender ); - rc = pHAL->lpD3D3->CreateDevice( IID_IDirect3DRGBDevice, pHAL->lpDDSRender, &pHAL->lpD3DDevice, NULL ); - if ( rc != D3D_OK ) - { - /* That was our last hope. */ - RIP( pHAL, "CreateDevice (IID_IDirect3DRGBDevice) ->", ErrorStringD3D(rc) ); - return FALSE; - } - - DPF(( DBG_CNTX_INFO, "SW Device" )); - } - } - - /*==============================================================================*/ - /* Get a copy of the render pixelformat so that wgl.c can call GetPixelInfoD3D. */ - /*==============================================================================*/ - memset( &pHAL->ddpf, 0, sizeof(DDPIXELFORMAT) ); - pHAL->ddpf.dwSize = sizeof( DDPIXELFORMAT ); - rc = pHAL->lpDDSRender->GetPixelFormat( &pHAL->ddpf ); - if ( FAILED(rc) ) - { - RIP( pHAL, "GetPixelFormat ->", ErrorStringD3D(rc) ); - return FALSE; - } - DebugPixelFormat( "Using OFFSCREEN", &pHAL->ddpf ); - DebugPixelFormat( "Using ZBUFFER", &ddsd2.ddpfPixelFormat ); - - /* Get a copy of what the D3DDevice supports for later use. */ - memset( &D3DSWDevDesc, 0, sizeof(D3DDEVICEDESC) ); - memset( &pHAL->D3DHWDevDesc, 0, sizeof(D3DDEVICEDESC) ); - D3DSWDevDesc.dwSize = sizeof( D3DDEVICEDESC ); - pHAL->D3DHWDevDesc.dwSize = sizeof( D3DDEVICEDESC ); - rc = pHAL->lpD3DDevice->GetCaps( &pHAL->D3DHWDevDesc, &D3DSWDevDesc ); - if ( FAILED(rc) ) - { - RIP( pHAL, "GetCaps ->", ErrorStringD3D(rc) ); - return FALSE; - } - - /* Get a copy of the pixel convertion stuff for direct buffer access. */ - Solve8BitChannelPixelFormat( &pHAL->ddpf, &pShared->pixel ); - AlphaBlendTableHAL( pHAL ); - - /* We must prime the Begin/End scene for SwapBuffers to work. */ - rc = pHAL->lpD3DDevice->BeginScene(); - if ( FAILED(rc) ) - { - RIP( pHAL, "BeginScene ->", ErrorStringD3D(rc) ); - return FALSE; - } - -#undef InitDDSD2 - - return TRUE; -} -/*===========================================================================*/ -/* This function will make sure a viewport is created and set for the device*/ -/* in the supplied structure. If a rect is supplied then it will be used for*/ -/* the viewport otherwise the current setting in the strucute will be used. */ -/* Note that the rect is relative to the window. So left/top must be 0,0 to */ -/* use the whole window else there is scissoring going down. */ -/*===========================================================================*/ -/* RETURN: TRUE, FALSE. */ -/*===========================================================================*/ -extern "C" BOOL SetViewportHAL( PMESAD3DSHARED pShared, RECT *pRect, float minZ, float maxZ ) -{ - PMESAD3DHAL pHAL = (PMESAD3DHAL)pShared; - D3DVIEWPORT2 vdData; - ULONG rc; - POINT pt; - - DPF(( DBG_FUNC, "SetViewportHAL();" )); - - /* Make sure we have enough info. */ - if ( !pHAL || !pHAL->lpDDSPrimary || !pHAL->lpD3DDevice ) - { - DPF(( DBG_CNTX_WARN, "SetViewport() -> NULL Pointer" )); - return FALSE; - } - - /* TODO: this is just a temp fix to stop redundant changes. */ - if ( pRect && - (pShared->rectV.left == pRect->left) && - (pShared->rectV.right == pRect->right) && - (pShared->rectV.top == pRect->top) && - (pShared->rectV.bottom == pRect->bottom) ) - { - DPF(( DBG_CNTX_WARN, "Redundant viewport" )); - return TRUE; - } - - DPF(( DBG_CNTX_INFO, "Current Viewport:" )); - DPF(( DBG_CNTX_INFO, "x: %d y: %d", pShared->rectV.left, pShared->rectV.top )); - DPF(( DBG_CNTX_INFO, "cx: %d cy: %d", (pShared->rectV.right-pShared->rectV.left), (pShared->rectV.bottom-pShared->rectV.top) )); - DPF(( DBG_CNTX_INFO, "New Viewport:" )); - DPF(( DBG_CNTX_INFO, "x: %d y: %d", pRect->left, pRect->top )); - DPF(( DBG_CNTX_INFO, "cx: %d cy: %d", (pRect->right-pRect->left), (pRect->bottom-pRect->top) )); - - /* Update the current viewport rect if one is supplied. */ - if ( pRect ) - memcpy( &pShared->rectV, pRect, sizeof(RECT) ); - - /* Build the request structure. */ - memset( &vdData, 0, sizeof(D3DVIEWPORT2) ); - vdData.dwSize = sizeof(D3DVIEWPORT2); - vdData.dwX = pShared->rectV.left; - vdData.dwY = pShared->rectV.top; - vdData.dwWidth = (pShared->rectV.right - pShared->rectV.left); - vdData.dwHeight = (pShared->rectV.bottom - pShared->rectV.top); - - if ( !vdData.dwWidth || !vdData.dwHeight ) - { - GetClientRect( pShared->hwnd, &pShared->rectW ); - pt.x = pt.y = 0; - ClientToScreen( pShared->hwnd, &pt ); - OffsetRect( &pShared->rectW, pt.x, pt.y); - vdData.dwX = pShared->rectW.left; - vdData.dwY = pShared->rectW.top; - vdData.dwWidth = (pShared->rectW.right - pShared->rectW.left); - vdData.dwHeight = (pShared->rectW.bottom - pShared->rectW.top); - memcpy( &pShared->rectV, &pShared->rectW, sizeof(RECT) ); - } - - // The dvClipX, dvClipY, dvClipWidth, dvClipHeight, dvMinZ, - // and dvMaxZ members define the non-normalized post-perspective - // 3-D view volume which is visible to the viewer. In most cases, - // dvClipX is set to -1.0 and dvClipY is set to the inverse of - // the viewport's aspect ratio on the target surface, which can be - // calculated by dividing the dwHeight member by dwWidth. Similarly, - // the dvClipWidth member is typically 2.0 and dvClipHeight is set - // to twice the aspect ratio set in dwClipY. The dvMinZ and dvMaxZ - // are usually set to 0.0 and 1.0. - vdData.dvClipX = -1.0f; - vdData.dvClipWidth = 2.0f; - vdData.dvClipY = 1.0f; - vdData.dvClipHeight = 2.0f; - vdData.dvMaxZ = maxZ; - vdData.dvMinZ = minZ; - - DPF(( DBG_CNTX_INFO, "zMin: %f zMax: %f", minZ, maxZ )); - - /* I'm going to destroy the viewport everytime as when we size we will */ - /* have a new D3DDevice. As this area doesn't need to be fast... */ - if ( pHAL->lpViewport ) - { - DPF(( DBG_CNTX_INFO, "DeleteViewport" )); - - pHAL->lpD3DDevice->DeleteViewport( pHAL->lpViewport ); - rc = pHAL->lpViewport->Release(); - pHAL->lpViewport = NULL; - } - - rc = pHAL->lpD3D3->CreateViewport( &pHAL->lpViewport, NULL ); - if ( rc != D3D_OK ) - { - DPF(( DBG_CNTX_ERROR, "CreateViewport Failed" )); - return FALSE; - } - - /* Update the device with the new viewport. */ - pHAL->lpD3DDevice->AddViewport( pHAL->lpViewport ); - pHAL->lpViewport->SetViewport2( &vdData ); - pHAL->lpD3DDevice->SetCurrentViewport( pHAL->lpViewport ); - - return TRUE; -} -/*===========================================================================*/ -/* */ -/* */ -/*===========================================================================*/ -/* RETURN: */ -/*===========================================================================*/ -HRESULT WINAPI EnumSurfacesHook( LPDIRECTDRAWSURFACE4 lpDDS, LPDDSURFACEDESC2 lpDDSDesc, LPVOID pVoid ) -{ - DDSURFACEDESC2 *pddsd2 = (DDSURFACEDESC2 *)pVoid; - - DPF(( DBG_FUNC, "EnumSurfacesHook();" )); - - if ( (lpDDSDesc->ddpfPixelFormat.dwFlags == pddsd2->ddpfPixelFormat.dwFlags) && (lpDDSDesc->ddsCaps.dwCaps == pddsd2->ddsCaps.dwCaps) ) - { - /* Save the pixelformat now so that we know we have one. */ - memcpy( pddsd2, lpDDSDesc, sizeof(DDSURFACEDESC2) ); - - return D3DENUMRET_CANCEL; - } - - return D3DENUMRET_OK; -} -/*===========================================================================*/ -/* This is the callback proc to get a Z-Buffer. Thats it. */ -/*===========================================================================*/ -/* RETURN: */ -/*===========================================================================*/ -HRESULT CALLBACK EnumZBufferHook( DDPIXELFORMAT* pddpf, VOID *pVoid ) -{ - DDPIXELFORMAT *pddpfChoice = (DDPIXELFORMAT *)pVoid; - - DPF(( DBG_FUNC, "EnumZBufferHook();" )); - - /* If this is ANY type of depth-buffer, stop. */ - if( pddpf->dwFlags == DDPF_ZBUFFER ) - { - /* Save the pixelformat now so that we know we have one. */ - memcpy( pddpfChoice, pddpf, sizeof(DDPIXELFORMAT) ); - - /* I feel if the hardware supports this low then lets use it. Could get ugly. */ - if( pddpf->dwZBufferBitDepth >= 8 ) - { - return D3DENUMRET_CANCEL; - } - } - - return D3DENUMRET_OK; -} -/*===========================================================================*/ -/* This function handles the callback for the D3DDevice enumeration. Good */ -/* god who's idea was this? The D3D wrapper has two variable related to what*/ -/* kind of device we want and have. First we have a Bool that is set if we */ -/* have allocated a HW device. We always look for the HW device first. The */ -/* other variable is used to force SW. If we have run into a case that we */ -/* want to fallback to SW then we set this. We will fallback if we cannot */ -/* texture in video memory (among others). */ -/*===========================================================================*/ -/* RETURN: */ -/*===========================================================================*/ -HRESULT CALLBACK EnumDeviceHook( GUID FAR* lpGuid, LPSTR lpDesc, LPSTR lpName, LPD3DDEVICEDESC lpD3DHWDesc, LPD3DDEVICEDESC lpD3DHELDesc, void *pVoid ) -{ - PMESAD3DHAL pHAL = (PMESAD3DHAL)pVoid; - LPD3DDEVICEDESC pChoice = lpD3DHWDesc; - - DPF(( DBG_FUNC, "EnumDeviceHook();" )); - - /* Determine if which device description is valid. */ - if ( pChoice->dcmColorModel == 0 ) - pChoice = lpD3DHELDesc; - - /* Make sure we always have a GUID. */ - memcpy( &pHAL->guid, lpGuid, sizeof(GUID) ); - - /* This controls whether we will except HW or not. */ - if ( pHAL->shared.bForceSW == TRUE ) - { - return (pChoice == lpD3DHELDesc) ? D3DENUMRET_CANCEL : D3DENUMRET_OK; - } - - /* Always try for hardware. */ - if ( pChoice == lpD3DHWDesc ) - { - return D3DENUMRET_CANCEL; - } - - return D3DENUMRET_OK; -} -/*===========================================================================*/ -/* This function will destroy any and all surfaces that this context has */ -/* allocated. If there is a clipper object then it will also be destoryed as*/ -/* it is part of the Primary Surface. */ -/*===========================================================================*/ -/* RETURN: */ -/*===========================================================================*/ -static void DestroyAllSurfaces( PMESAD3DHAL pHAL ) -{ - LONG refCount; - - DPF(( DBG_FUNC, "DestroyAllSurfaces();" )); - - DX_RESTORE( pHAL->lpDDSPrimary ); - DX_RESTORE( pHAL->lpDDSRender ); - DX_RESTORE( pHAL->lpDDSZbuffer); - - if ( pHAL->lpDDSRender ) - { - pHAL->lpDDSRender->Unlock( NULL ); - - /* If this isn't a Flipable surface then we must clean up the render. */ - if ( pHAL->shared.bFlipable == FALSE) - { - if ( pHAL->lpDDSZbuffer ) - { - DPF(( DBG_CNTX_INFO, "Remove attached surfaces from RENDER" )); - pHAL->lpDDSRender->DeleteAttachedSurface( 0, NULL ); - } - - DPF(( DBG_CNTX_INFO, "Release RENDER" )); - refCount = pHAL->lpDDSRender->Release(); - pHAL->lpDDSRender = NULL; - } - } - - if ( pHAL->lpDDSZbuffer ) - { - DPF(( DBG_CNTX_INFO, "Release ZBuffer" )); - pHAL->lpDDSZbuffer->Unlock( NULL ); - refCount = pHAL->lpDDSZbuffer->Release(); - pHAL->lpDDSZbuffer = NULL; - } - - if ( pHAL->lpClipper ) - { - DPF(( DBG_CNTX_INFO, "Release Clipper" )); - refCount = pHAL->lpClipper->Release(); - pHAL->lpClipper = NULL; - } - - if ( pHAL->lpDDSPrimary ) - { - pHAL->lpDDSPrimary->Unlock( NULL ); - - DPF(( DBG_CNTX_INFO, "Release PRIMARY" )); - refCount = pHAL->lpDDSPrimary->Release(); - pHAL->lpDDSPrimary = NULL; - } -} -/*===========================================================================*/ -/* This function will destroy the current D3DDevice and any resources that */ -/* belong to it. */ -/*===========================================================================*/ -/* RETURN: */ -/*===========================================================================*/ -static void DestroyDevice( PMESAD3DHAL pHAL ) -{ - LONG refCount; - - DPF(( DBG_FUNC, "DestroyDevice();" )); - - /* Kill the D3D stuff if exists. */ - if ( pHAL->lpViewport ) - { - DPF(( DBG_CNTX_INFO, "Delete Viewport" )); - pHAL->lpD3DDevice->DeleteViewport( pHAL->lpViewport ); - - DPF(( DBG_CNTX_INFO, "Release Viewport" )); - refCount = pHAL->lpViewport->Release(); - pHAL->lpViewport = NULL; - } - - if ( pHAL->lpD3DDevice != NULL ) - { - DPF(( DBG_CNTX_INFO, "Release D3DDevice" )); - refCount = pHAL->lpD3DDevice->EndScene(); - refCount = pHAL->lpD3DDevice->Release(); - pHAL->lpD3DDevice = NULL; - } -} -/*===========================================================================*/ -/* This function will destroy the current D3DDevice and any resources that */ -/* belong to it. */ -/*===========================================================================*/ -/* RETURN: */ -/*===========================================================================*/ -static void DestroyInterfaces( PMESAD3DHAL pHAL ) -{ - LONG refCount; - - DPF(( DBG_FUNC, "DestroyInterfaces();" )); - - if ( pHAL->lpD3D3 != NULL ) - { - DPF(( DBG_CNTX_INFO, "Release Direct3D3" )); - refCount = pHAL->lpD3D3->Release(); - pHAL->lpD3D3 = NULL; - } - - if ( pHAL->lpDD4 != NULL ) - { - DPF(( DBG_CNTX_INFO, "Release DDraw4" )); - refCount = pHAL->lpDD4->Release(); - pHAL->lpDD4 = NULL; - } - - if ( pHAL->lpDD != NULL ) - { - DPF(( DBG_CNTX_INFO, "Release DDraw" )); - refCount = pHAL->lpDD->Release(); - pHAL->lpDD = NULL; - } -} -/*===========================================================================*/ -/* This function will first send (not post) a message to the client window */ -/* that this context is using. The client will respond by unbinding itself */ -/* and binding the 'default' context. This allows the API to be supported */ -/* until the window can be destroyed. Finally we post the quit message to */ -/* the client in hopes to end the application. */ -/*===========================================================================*/ -/* RETURN: */ -/*===========================================================================*/ -void FatalShutDown( PMESAD3DHAL pHAL ) -{ - /* Whip this baby in too try and support the API until we die... */ - if ( pHAL ) - SendMessage( pHAL->shared.hwnd, UM_FATALSHUTDOWN, 0L, 0L ); - - /* Close the client application down. */ - PostQuitMessage( 0 ); -} - diff --git a/src/mesa/drivers/d3d/D3DMESA.H b/src/mesa/drivers/d3d/D3DMESA.H deleted file mode 100644 index 71a7cd8aed..0000000000 --- a/src/mesa/drivers/d3d/D3DMESA.H +++ /dev/null @@ -1,84 +0,0 @@ -/*===========================================================================*/ -/* */ -/* Mesa-3.0 DirectX 6 Driver */ -/* */ -/* By Leigh McRae */ -/* */ -/* http://www.altsoftware.com/ */ -/* */ -/* Copyright (c) 1999-1998 alt.software inc. All Rights Reserved */ -/*===========================================================================*/ -#ifndef D3D_MESA_H -#define D3D_MESA_H -/*===========================================================================*/ -/* Includes. */ -/*===========================================================================*/ -#include -#include -#include -#include "matrix.h" -#include "context.h" -#include "mtypes.h" -#include "vb.h" -#include "D3DShared.h" -#include "Debug.h" -#include "NULLProcs.h" -/*===========================================================================*/ -/* Macros. */ -/*===========================================================================*/ -#define FLIP(h,y) (h-y) -/*===========================================================================*/ -/* Magic numbers. */ -/*===========================================================================*/ -/*===========================================================================*/ -/* Type defines. */ -/*===========================================================================*/ -struct __extensions__ -{ - PROC proc; - char *name; -}; - -typedef GLbitfield (*ClearPROC)( GLcontext *ctx, GLbitfield mask, GLboolean all, GLint x, GLint y, GLint width, GLint height ); -typedef void (*WSpanRGBPROC)( const GLcontext* ctx, GLuint n, GLint x, GLint y, const GLubyte rgb[][3], const GLubyte mask[] ); -typedef void (*WSpanRGBAPROC)( const GLcontext* ctx, GLuint n, GLint x, GLint y, const GLubyte rgba[][4], const GLubyte mask[] ); -typedef void (*WSpanRGBAMonoPROC)( const GLcontext* ctx, GLuint n, GLint x, GLint y, const GLubyte mask[] ); -typedef void (*WPixelsRGBAPROC)( const GLcontext* ctx, GLuint n, const GLint x[], const GLint y[], const GLubyte rgba[][4], const GLubyte mask[] ); -typedef void (*WPixelsRGBAMonoPROC)( const GLcontext* ctx, GLuint n, const GLint x[], const GLint y[], const GLubyte mask[] ); -typedef void (*RSpanRGBAPROC)( const GLcontext* ctx, GLuint n, GLint x, GLint y, GLubyte rgba[][4] ); -typedef void (*RPixelsRGBAPROC)( const GLcontext* ctx, GLuint n, const GLint x[], const GLint y[], GLubyte rgba[][4], const GLubyte mask[] ); - -typedef struct D3D_mesa_context -{ - PMESAD3DSHARED pShared; - - GLcontext *gl_ctx; /* The core GL/Mesa context */ - GLvisual *gl_visual; /* Describes the buffers */ - GLframebuffer *gl_buffer; /* Depth, stencil, accum, etc buffers */ - - HDC hdc; - WNDPROC hOldProc; - - UCHAR rClear, /* Current clear colors. */ - gClear, - bClear, - aClear, - rCurrent, /* Current rendering colors. */ - gCurrent, - bCurrent, - aCurrent; - - struct D3D_mesa_context *next; - -} D3DMESACONTEXT, *PD3DMESACONTEXT; -/*===========================================================================*/ -/* Extern function prototypes. */ -/*===========================================================================*/ -extern void gl_Viewport( GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height ); -/*===========================================================================*/ -/* Global variables. */ -/*===========================================================================*/ -extern D3DTLVERTEX D3DTLVertices[(VB_MAX*6)]; - -#endif - diff --git a/src/mesa/drivers/d3d/D3DRaster.cpp b/src/mesa/drivers/d3d/D3DRaster.cpp deleted file mode 100644 index 41e42ad94c..0000000000 --- a/src/mesa/drivers/d3d/D3DRaster.cpp +++ /dev/null @@ -1,213 +0,0 @@ -/*===========================================================================*/ -/* */ -/* Mesa-3.0 DirectX 6 Driver */ -/* */ -/* By Leigh McRae */ -/* */ -/* http://www.altsoftware.com/ */ -/* */ -/* Copyright (c) 1999-1998 alt.software inc. All Rights Reserved */ -/*===========================================================================*/ -#include "D3DHAL.h" -/*===========================================================================*/ -/* This function clears the context bound to the supplied shared context. */ -/* The function takes the D3D flags D3DCLEAR_TARGET, D3DCLEAR_STENCIL and */ -/* D3DCLEAR_ZBUFFER. Set bAll to TRUE for a full clear else supply the coord*/ -/* of the rect to be cleared relative to the window. The color is always a */ -/* 32bit value (RGBA). Fill in the z-value and stencil if needed. */ -/* */ -/* TODO: this can be redone to be called by Mesa directly. */ -/*===========================================================================*/ -/* RETURN: */ -/*===========================================================================*/ -extern "C" void ClearHAL( PMESAD3DSHARED pShared, DWORD dwFlags, BOOL bAll, int x, int y, int cx, int cy, DWORD dwColor, float zv, DWORD dwStencil ) -{ - PMESAD3DHAL pHAL = (PMESAD3DHAL)pShared; - D3DRECT d3dRect; - -#ifdef D3D_DEBUG - HRESULT rc; - - DPF(( DBG_FUNC, "CleaHAL();" )); - - /* Make sure we have enough info. */ - if ( (pHAL == NULL) || (pHAL->lpViewport == NULL) ) - return; -#endif - - if ( bAll ) - { - /* I assume my viewport is valid. */ - d3dRect.lX1 = pShared->rectV.left; - d3dRect.lY1 = pShared->rectV.top; - d3dRect.lX2 = pShared->rectV.right; - d3dRect.lY2 = pShared->rectV.bottom; - } - else - { - d3dRect.lX1 = pShared->rectV.left + x; - d3dRect.lY1 = pShared->rectV.top + y; - d3dRect.lX2 = d3dRect.lX1 + cx; - d3dRect.lY2 = d3dRect.lY1 + cy; - } - -#ifdef D3D_DEBUG - rc = pHAL->lpViewport->Clear2( 1, &d3dRect, dwFlags, dwColor, zv, dwStencil ); - if ( FAILED(rc) ) - { - RIP( pHAL, "Clear2 ->", ErrorStringD3D(rc) ); - } -#else - pHAL->lpViewport->Clear2( 1, &d3dRect, dwFlags, dwColor, zv, dwStencil ); -#endif -} -/*===========================================================================*/ -/* Well this is the guts of it all. Here we rasterize the primitives that */ -/* are in their final form. OpenGL has done all the lighting, transfomations*/ -/* and clipping at this point. */ -/* */ -/* TODO: I'm not sure if I want to bother to check for errors on this call. */ -/* The overhead kills me... */ -/*===========================================================================*/ -/* RETURN: */ -/*===========================================================================*/ -extern "C" void DrawPrimitiveHAL( PMESAD3DSHARED pShared, D3DPRIMITIVETYPE dptPrimitiveType, D3DTLVERTEX *pVertices, DWORD dwCount ) -{ - PMESAD3DHAL pHAL = (PMESAD3DHAL)pShared; - -#ifdef D3D_DEBUG - HRESULT rc; - - DPF(( DBG_FUNC, "DrawPrimitveHAL();" )); - - /* Make sure we have enough info. */ - if ( (pHAL == NULL) || (pHAL->lpD3DDevice == NULL) ) - return; - - DPF(( DBG_PRIM_INFO, "DP( %d )", dwCount )); - - rc = pHAL->lpD3DDevice->DrawPrimitive( dptPrimitiveType, - D3DFVF_TLVERTEX, - (LPVOID)pVertices, - dwCount, - (D3DDP_DONOTCLIP | D3DDP_DONOTLIGHT) ); - if ( FAILED(rc) ) - { - RIP( pHAL, "DrawPrimitive ->", ErrorStringD3D(rc) ); - } -#else - pHAL->lpD3DDevice->DrawPrimitive( dptPrimitiveType, - D3DFVF_TLVERTEX, - (LPVOID)pVertices, - dwCount, - (D3DDP_DONOTCLIP | D3DDP_DONOTLIGHT) ); -#endif -} -/*===========================================================================*/ -/* This call will handle the swapping of the buffers. Now I didn't bother */ -/* to support single buffered so this will be used for glFlush() as its all */ -/* the same. So first we do an EndScene as we are always considered to be in*/ -/* a BeginScene because when we leave we do a BeginScene. Now note that when*/ -/* the context is created in the first place we do a BeginScene also just to */ -/* get things going. The call will use either Flip/blt based on the type of */ -/* surface was created for rendering. */ -/*===========================================================================*/ -/* RETURN: */ -/*===========================================================================*/ -extern "C" void SwapBuffersHAL( PMESAD3DSHARED pShared ) -{ - PMESAD3DHAL pHAL = (PMESAD3DHAL)pShared; - -#ifdef D3D_DEBUG - HRESULT rc; - - DPF(( DBG_FUNC, "SwapBuffersHAL();" )); - DPF(( DBG_ALL_PROFILE, "=================SWAP===================" )); - - /* Make sure we have enough info. */ - if ( (pHAL == NULL) || (pHAL->lpD3DDevice == NULL) ) - return; - - /* Make sure we have enough info. */ - if ( pHAL->lpDDSPrimary != NULL ) - { - rc = pHAL->lpD3DDevice->EndScene(); - if ( FAILED(rc) ) - { - RIP( pHAL, "EndScene ->", ErrorStringD3D(rc) ); - } - - if ( pShared->bFlipable ) - { - DPF(( DBG_CNTX_PROFILE, "Swap->FLIP" )); - rc = pHAL->lpDDSPrimary->Flip( NULL, DDFLIP_WAIT ); - } - else - { - DPF(( DBG_CNTX_PROFILE, "Swap->Blt" )); - rc = pHAL->lpDDSPrimary->Blt( &pShared->rectW, pHAL->lpDDSRender, NULL, DDBLT_WAIT, NULL ); - } - if ( FAILED(rc) ) - { - RIP( pHAL, "Blt (RENDER/PRIMARY) ->", ErrorStringD3D(rc) ); - } - - rc = pHAL->lpD3DDevice->BeginScene(); - if ( FAILED(rc) ) - { - RIP( pHAL, "BeginScene ->", ErrorStringD3D(rc) ); - } - } -#else - pHAL->lpD3DDevice->EndScene(); - - if ( pShared->bFlipable ) - pHAL->lpDDSPrimary->Flip( NULL, DDFLIP_WAIT ); - else - pHAL->lpDDSPrimary->Blt( &pShared->rectW, pHAL->lpDDSRender, NULL, DDBLT_WAIT, NULL ); - - pHAL->lpD3DDevice->BeginScene(); - -#endif -} -/*===========================================================================*/ -/* This function is a very thin wrapper for the D3D call 'SetRenderState'. */ -/* Using this function requires all the types to be defined by including the */ -/* D3D header file. */ -/* */ -/* TODO: would be much better to get ride of all these calls per VBRender. */ -/* I feel I should get this call into SetRenderStates() the RenderVB. */ -/*===========================================================================*/ -/* RETURN: */ -/*===========================================================================*/ -extern "C" void SetStateHAL( PMESAD3DSHARED pShared, DWORD dwType, DWORD dwState ) -{ - PMESAD3DHAL pHAL = (PMESAD3DHAL)pShared; - -#ifdef D3D_DEBUG - HRESULT rc; - - DPF(( DBG_FUNC, "SetStateHAL();" )); - - /* Make sure we have enough info. */ - if ( (pHAL == NULL) || (pHAL->lpD3DDevice == NULL) ) - return; - - rc = pHAL->lpD3DDevice->SetRenderState( (D3DRENDERSTATETYPE)dwType, dwState ); - if ( FAILED(rc) ) - { - RIP( pHAL, "SetRenderState ->", ErrorStringD3D(rc) ); - } - -#else - pHAL->lpD3DDevice->SetRenderState( (D3DRENDERSTATETYPE)dwType, dwState ); -#endif -} - - - - - - - - diff --git a/src/mesa/drivers/d3d/D3DShared.h b/src/mesa/drivers/d3d/D3DShared.h deleted file mode 100644 index cc629e2111..0000000000 --- a/src/mesa/drivers/d3d/D3DShared.h +++ /dev/null @@ -1,154 +0,0 @@ -/*===========================================================================*/ -/* */ -/* Mesa-3.0 DirectX 6 Driver */ -/* */ -/* By Leigh McRae */ -/* */ -/* http://www.altsoftware.com/ */ -/* */ -/* Copyright (c) 1999-1998 alt.software inc. All Rights Reserved */ -/*===========================================================================*/ -#ifndef D3D_MESA_ALL_H -#define D3D_MESA_ALL_H - -#ifdef __cplusplus -extern "C" { -#endif - -/*===========================================================================*/ -/* Includes. */ -/*===========================================================================*/ -#include -#include -/*===========================================================================*/ -/* Magic numbers. */ -/*===========================================================================*/ -#define TM_ACTION_LOAD 0x01 -#define TM_ACTION_BIND 0x02 -#define TM_ACTION_UPDATE 0x04 - -#define UM_FATALSHUTDOWN (WM_USER+42) -/*===========================================================================*/ -/* Macros defines. */ -/*===========================================================================*/ -#define ALLOC(cb) malloc( (cb) ) -#define FREE(p) { free( (p) ); (p) = NULL; } -/*===========================================================================*/ -/* Type defines. */ -/*===========================================================================*/ -typedef struct _pixel_convert -{ - int cb, /* Count in bytes of one pixel. */ - rShift, /* Shift count that postions each componet. */ - gShift, - bShift, - aShift; - float rScale, /* Value that scales a color that ranges 0.0 -> 1.0 */ - gScale, /* to this pixel format. */ - bScale, - aScale; - DWORD dwRMask, /* Color mask per component. */ - dwGMask, - dwBMask, - dwAMask; - -} PIXELINFO, *PPIXELINFO; - - -typedef struct _d3d_shared_info -{ - HWND hwnd; - BOOL bWindow, - bFlipable, - bForceSW, - bHardware; - RECT rectW, /* Window size and postion in screen space. */ - rectV; /* Viewport size and postion. */ - DWORD dwWidth, /* Current render size for quick checks. */ - dwHeight; - - PIXELINFO pixel; - DWORD dwSrcBlendCaps[14], /* See D3DCAPS.CPP */ - dwDestBlendCaps[14], - dwTexFunc[4]; - -} MESAD3DSHARED, *PMESAD3DSHARED; - -typedef struct _render_options -{ - BOOL bForceSoftware, /* TODO: Add user switches. */ - bStretchtoPrimary; - -} USER_CTRL, *PUSER_CRTL; - -enum { s_zero = 0, - s_one, - s_dst_color, - s_one_minus_dst_color, - s_src_alpha, - s_one_minus_src_alpha, - s_dst_alpha, - s_one_minus_dst_alpha, - s_src_alpha_saturate, - s_constant_color, - s_one_minus_constant_color, - s_constant_alpha, - s_one_minus_constant_alpha }; - -enum { d_zero = 0, - d_one, - d_src_color, - d_one_minus_src_color, - d_src_alpha, - d_one_minus_src_alpha, - d_dst_alpha, - d_one_minus_dst_alpha, - d_constant_color, - d_one_minus_constant_color, - d_constant_alpha, - d_one_minus_constant_alpha }; - -enum { d3dtblend_decal = 0, - d3dtblend_decalalpha, - d3dtblend_modulate, - d3dtblend_modulatealpha }; - -/*===========================================================================*/ -/* Function prototypes. */ -/*===========================================================================*/ -PMESAD3DSHARED InitHAL( HWND hwnd ); -void TermHAL( PMESAD3DSHARED pShared ); -BOOL CreateHAL( PMESAD3DSHARED pShared ); -BOOL SetViewportHAL( PMESAD3DSHARED pShared, RECT *pRect, float minZ, float maxZ ); - -void ClearHAL( PMESAD3DSHARED pShared, DWORD dwFlags, BOOL bAll, int x, int y, int cx, int cy, DWORD dwColor, float zv, DWORD dwStencil ); -void SetStateHAL( PMESAD3DSHARED pShared, DWORD dwType, DWORD dwState ); -void DrawPrimitiveHAL( PMESAD3DSHARED pShared, D3DPRIMITIVETYPE dptPrimitiveType, D3DTLVERTEX *pVertices, DWORD dwCount ); - -void SwapBuffersHAL( PMESAD3DSHARED pShared ); -DDSURFACEDESC2 *LockHAL( PMESAD3DSHARED pShared, BOOL bBack ); -void UnlockHAL( PMESAD3DSHARED pShared, BOOL bBack ); -void UpdateScreenPosHAL( PMESAD3DSHARED pShared ); -void GetPixelInfoHAL( PMESAD3DSHARED pShared, PPIXELINFO pPixel ); -BOOL CreateTMgrHAL( PMESAD3DSHARED pShared, DWORD dwName, int level, DWORD dwRequestFlags, RECT *rectDirty, DWORD dwWidth, DWORD dwHeight, DWORD dwAction, void *pPixels ); -void DisableTMgrHAL( PMESAD3DSHARED pShared ); - - -int SaveDIBitmap( char *filename, BITMAPINFO *info, void *bits ); -int ARGB_SaveBitmap( char *filename, int width, int height, unsigned char *pARGB ); -int BGRA_SaveBitmap( char *filename, int width, int height, unsigned char *pBGRA ); -int BGR_SaveBitmap( char *filename, int width, int height, unsigned char *pBGR ); -/*===========================================================================*/ -/* Global variables. */ -/*===========================================================================*/ -extern float g_DepthScale, /* Mesa needs to scale Z in SW. The HAL */ - g_MaxDepth; /* doesn't but I wanted SW still to work.*/ - -#ifdef __cplusplus -} -#endif - -#endif - - - diff --git a/src/mesa/drivers/d3d/D3DTEXT.CPP b/src/mesa/drivers/d3d/D3DTEXT.CPP deleted file mode 100644 index 39855b65fa..0000000000 --- a/src/mesa/drivers/d3d/D3DTEXT.CPP +++ /dev/null @@ -1,576 +0,0 @@ -/*===========================================================================*/ -/* */ -/* Mesa-3.0 DirectX 6 Driver */ -/* */ -/* By Leigh McRae */ -/* */ -/* http://www.altsoftware.com/ */ -/* */ -/* Copyright (c) 1999-1998 alt.software inc. All Rights Reserved */ -/*===========================================================================*/ -#include "d3dText.h" - -/*============================================================================= - - 1 - ------ - | | - 6 | | 2 - | 7 | - ------ - | | - 5 | | 3 - | | - ------ - 4 - - TL_0 TR_0 -TLL TL_1 TR_1 TRR - -MLL_0 ML_0 MR_0 MRR_0 -MLL_1 ML_1 MR_1 MRR_1 - -BLL BL_0 BR_0 BRR - BL_1 BR_1 - -=============================================================================*/ - -#define TLL 0 -#define TRR 1 -#define TL_0 2 -#define TL_1 3 -#define TR_0 4 -#define TR_1 5 - -#define MLL_0 6 -#define MLL_1 7 -#define MRR_0 8 -#define MRR_1 9 - -#define ML_0 10 -#define ML_1 11 -#define MR_0 12 -#define MR_1 13 - -#define BL_0 14 -#define BL_1 15 -#define BR_0 16 -#define BR_1 17 -#define BLL 18 -#define BRR 19 - -#define BIT1 0x00000001 -#define BIT2 0x00000002 -#define BIT3 0x00000004 -#define BIT4 0x00000008 -#define BIT5 0x00000010 -#define BIT6 0x00000020 -#define BIT7 0x00000040 - -#define TOP BIT4 -#define MIDDLE BIT7 -#define BOTTOM BIT1 -#define TLEFT BIT5 -#define BLEFT BIT6 -#define LEFT (TLEFT|BLEFT) -#define TRIGHT BIT3 -#define BRIGHT BIT2 -#define RIGHT (TRIGHT|BRIGHT) -#define ALL 0xFFFFFFFF - -/*===========================================================================*/ -/* This is the static array that will map the ASCII value of the character */ -/* being draw to the bit mask that will be scan converted to the LED display.*/ -/*===========================================================================*/ -DWORD textBitMasks[] = -{ - 0xFFFFFFFF, // 000 - 0xFFFFFFFF, // 001 - 0xFFFFFFFF, // 002 - 0xFFFFFFFF, // 003 - 0xFFFFFFFF, // 004 - 0xFFFFFFFF, // 005 - 0xFFFFFFFF, // 006 - 0xFFFFFFFF, // 007 - 0xFFFFFFFF, // 008 - 0xFFFFFFFF, // 009 - 0xFFFFFFFF, // 010 - 0xFFFFFFFF, // 011 - 0xFFFFFFFF, // 012 - 0xFFFFFFFF, // 013 - 0xFFFFFFFF, // 014 - 0xFFFFFFFF, // 015 - 0xFFFFFFFF, // 016 - 0xFFFFFFFF, // 017 - 0xFFFFFFFF, // 018 - 0xFFFFFFFF, // 019 - 0xFFFFFFFF, // 020 - 0xFFFFFFFF, // 021 - 0xFFFFFFFF, // 022 - 0xFFFFFFFF, // 023 - 0xFFFFFFFF, // 024 - 0xFFFFFFFF, // 025 - 0xFFFFFFFF, // 026 - 0xFFFFFFFF, // 027 - 0xFFFFFFFF, // 028 - 0xFFFFFFFF, // 029 - 0xFFFFFFFF, // 030 - 0XFFFFFFFF, // 031 - 0x00000000, // 032 'SPC' - 0xFFFFFFFF, // 033 - 0xFFFFFFFF, // 034 - 0xFFFFFFFF, // 035 - 0xFFFFFFFF, // 036 - 0xFFFFFFFF, // 037 - 0xFFFFFFFF, // 038 - 0xFFFFFFFF, // 039 - 0xFFFFFFFF, // 040 - 0xFFFFFFFF, // 041 - 0xFFFFFFFF, // 042 - 0xFFFFFFFF, // 043 - 0xFFFFFFFF, // 044 - 0xFFFFFFFF, // 045 - 0xFFFFFFFF, // 046 - 0xFFFFFFFF, // 047 - (ALL &~ MIDDLE), // 048 '0' - (RIGHT), // 049 '1' - (ALL &~ TLEFT &~ BRIGHT), // 050 '2' - (ALL &~ LEFT), // 051 '3' - (TLEFT | MIDDLE | RIGHT), // 052 '4' - (ALL &~ TRIGHT &~ BLEFT), // 053 '5' - (ALL &~ TRIGHT), // 054 '6' - (TOP | RIGHT), // 055 '7' - (ALL), // 056 '8' - (ALL &~ BOTTOM &~ BLEFT), // 057 '9' - 0xFFFFFFFF, // 058 - 0xFFFFFFFF, // 059 - 0xFFFFFFFF, // 060 - 0XFFFFFFFF, // 061 - 0xFFFFFFFF, // 062 - 0xFFFFFFFF, // 063 - 0xFFFFFFFF, // 064 - (ALL &~ BOTTOM), // 065 'A' - (ALL), // 066 'B' - (TOP | LEFT | BOTTOM), // 067 'C' - (ALL &~ MIDDLE), // 068 'D' - (ALL &~ RIGHT), // 069 'E' - (LEFT | TOP | MIDDLE), // 070 'F' - 0x00000000, // 071 'G' - (ALL &~ TOP &~ BOTTOM), // 072 'H' - (RIGHT), // 073 'I' - (RIGHT | BOTTOM), // 074 'J' - 0x00000000, // 075 'K' - (LEFT | BOTTOM), // 076 'L' - 0x00000000, // 088 'M' - 0x00000000, // 089 'N' - (ALL &~ MIDDLE), // 090 'O' - (ALL &~ BRIGHT &~ BOTTOM),// 091 'P' - 0x00000000, // 092 'Q' - 0x00000000, // 093 'R' - (ALL &~ TRIGHT &~ BLEFT), // 094 'S' - 0X00000000, // 095 'T' - (LEFT | RIGHT | BOTTOM), // 096 'U' - 0x00000000, // 097 'V' - 0x00000000, // 098 'W' - 0x00000000, // 099 'X' - 0x00000000, // 1000 'Z' - 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, // 100 - 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, // 104 - 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, // 108 - 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, // 112 - 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, // 116 - 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, // 120 - 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF // 124 -}; - -#define CT 1.0f -#define CX 7.0f -#define CY 13.0f -#define CM ((CY-(CT*3.0f))/2.0f) - -float lCoords[][2] = -{ - /* Top outsides. */ - { 0, (CY-CT) }, - { CX, (CY-CT) }, - - /* Top Line. */ - { CT, CY }, - { CT, (CY-CT) }, - { (CX-CT), CY }, - { (CX-CT), (CY-CT) }, - - /* Middle outsides. */ - { 0.0f, (CT+CM+CT) }, - { 0.0f, (CT+CM) }, - { CX, (CT+CM+CT) }, - { CX, (CT+CM) }, - - /* Middle Line. */ - { CT, (CT+CM+CT) }, - { CT, (CT+CM) }, - { (CX-CT), (CT+CM+CT) }, - { (CX-CT), (CT+CM) }, - - /* Bottom line. */ - { CT, CT }, - { CT, 0.0f }, - { (CX-CT), CT }, - { (CX-CT), 0.0f }, - - /* Bottom outsides. */ - { 0.0f, CT}, - { CX, CT } -}; - -static int ConvertCharacter( char *c, int cIndex, PD3DFONTMETRICS pfntMetrics ); - -D3DTLVERTEX TextVertices[MAX_VERTICES]; -/*===========================================================================*/ -/* When we attach I will zero out the whole D3D vertex buffer I'm using for */ -/* the text. This way I don't need to set all the redundant values. I also */ -/* set all the oow values to 1 as I will be doing direct rendering. */ -/*===========================================================================*/ -/* RETURN: TRUE, FALSE. */ -/*===========================================================================*/ -extern "C" BOOL InitD3DText( void ) -{ - int index; - - /* Set the D3D Vertex Buffer up once so we don't do redundant changes. */ - memset( &TextVertices[0], 0, sizeof(TextVertices) ); - for( index = 0; index < MAX_VERTICES; index++ ) - TextVertices[index].rhw = D3DVAL( 1.0 ); - - return TRUE; -} -/*===========================================================================*/ -/* This function takes a single character and draw it using the supplied */ -/* fontmetrics structure. */ -/*===========================================================================*/ -/* RETURN: */ -/*===========================================================================*/ -extern "C" void d3dTextDrawString( char *pszString, int x, int y, PD3DFONTMETRICS pfntMetrics ) -{ - int cIndex, - nIndex, - index; - float cWidth = CX, - cHeight = CY; - - /* Find the max width/height of a character and add the spacing so */ - /* that we can use this value to calculate the x,y of the character.*/ - cWidth = (cWidth * pfntMetrics->fntXScale) + pfntMetrics->fntXSpacing; - cHeight = (cHeight * pfntMetrics->fntYScale) + pfntMetrics->fntYSpacing; - - /* Walk the string. This must be NULL terminated. */ - for( cIndex = 0, nIndex = 0; *pszString; pszString++, cIndex = nIndex, x++ ) - { - /* Convert the character and get the index into the text vertex buffer. */ - nIndex = ConvertCharacter( &pszString[0], cIndex, pfntMetrics ); - if ( (nIndex - cIndex) > 2 ) - { - /* Modify the text vertex buffer based on the fntMetrics structure. */ - for( index = cIndex; index < nIndex; index++ ) - { - /* Scale the character. */ - TextVertices[index].sx *= pfntMetrics->fntXScale; - TextVertices[index].sy *= pfntMetrics->fntYScale; - - /* Move the character. */ - TextVertices[index].sx += (cWidth*x); - TextVertices[index].sy += (cHeight*y); - - /* Set the color. */ - TextVertices[index].color = pfntMetrics->dwColor; - } - } - } - - if ( nIndex < 3 ) - return; - - /* Set the states that slim things down. */ - pfntMetrics->lpD3DDevice->SetRenderState( D3DRENDERSTATE_CULLMODE, D3DCULL_NONE ); - pfntMetrics->lpD3DDevice->SetRenderState( D3DRENDERSTATE_FILLMODE, D3DFILL_SOLID ); - pfntMetrics->lpD3DDevice->SetRenderState( D3DRENDERSTATE_ZENABLE, FALSE ); - pfntMetrics->lpD3DDevice->SetRenderState( D3DRENDERSTATE_ZWRITEENABLE , FALSE ); - pfntMetrics->lpD3DDevice->SetRenderState( D3DRENDERSTATE_ALPHATESTENABLE, FALSE ); - pfntMetrics->lpD3DDevice->SetRenderState( D3DRENDERSTATE_ALPHABLENDENABLE, FALSE ); - - /* Blast them baby... */ - pfntMetrics->lpD3DDevice->DrawPrimitive( D3DPT_TRIANGLELIST, - D3DFVF_TLVERTEX, - (LPVOID)&TextVertices[0], - nIndex, - (D3DDP_DONOTCLIP | D3DDP_DONOTLIGHT) ); -} -/*===========================================================================*/ -/* This function takes a single character and draw it directly to the screen*/ -/* unsing the supplied fntMetrics structure. The character will be drawn at */ -/* the supplied x,y. The x,y position is relative to the top left and uses */ -/* the spacing in the fntMetrics structure. */ -/*===========================================================================*/ -/* RETURN: */ -/*===========================================================================*/ -extern "C" void d3dTextDrawCharacter( char *c, int x, int y, PD3DFONTMETRICS pfntMetrics ) -{ - int cIndex = 0, - index; - float cWidth = CX, - cHeight = CY; - - /* Convert the character and get the index into the text vertex buffer. */ - cIndex = ConvertCharacter( c, 0, pfntMetrics ); - if ( cIndex < 3 ) - return; - - /* Find the max width/height of a character and add the spacing so */ - /* that we can use this value to calculate the x,y of the character.*/ - cWidth = (cWidth * pfntMetrics->fntXScale) + pfntMetrics->fntXSpacing; - cHeight = (cHeight * pfntMetrics->fntYScale) + pfntMetrics->fntYSpacing; - - /* Modify the text vertex buffer based on the fntMetrics structure. */ - for( index = 0; index < cIndex; index++ ) - { - /* Scale the character. */ - TextVertices[index].sx *= pfntMetrics->fntXScale; - TextVertices[index].sy *= pfntMetrics->fntYScale; - - /* Move the character. */ - TextVertices[index].sx += (cWidth*x); - TextVertices[index].sy += (cHeight*y); - - /* Set the color. */ - TextVertices[index].color = pfntMetrics->dwColor; - } - - - /* Set the states that slim things down. */ - pfntMetrics->lpD3DDevice->SetRenderState( D3DRENDERSTATE_CULLMODE, D3DCULL_NONE ); - pfntMetrics->lpD3DDevice->SetRenderState( D3DRENDERSTATE_FILLMODE, D3DFILL_SOLID ); - pfntMetrics->lpD3DDevice->SetRenderState( D3DRENDERSTATE_ZENABLE, FALSE ); - pfntMetrics->lpD3DDevice->SetRenderState( D3DRENDERSTATE_ZWRITEENABLE , FALSE ); - pfntMetrics->lpD3DDevice->SetRenderState( D3DRENDERSTATE_ALPHATESTENABLE, FALSE ); - pfntMetrics->lpD3DDevice->SetRenderState( D3DRENDERSTATE_ALPHABLENDENABLE, FALSE ); - - /* Blast them baby... */ - pfntMetrics->lpD3DDevice->DrawPrimitive( D3DPT_TRIANGLELIST, - D3DFVF_TLVERTEX, - (LPVOID)&TextVertices[0], - cIndex, - (D3DDP_DONOTCLIP | D3DDP_DONOTLIGHT) ); -} -/*===========================================================================*/ -/* This function takes a single character and draw it using the supplied */ -/* fontmetrics structure. */ -/*===========================================================================*/ -/* RETURN: */ -/*===========================================================================*/ -static int ConvertCharacter( char *c, int cIndex, PD3DFONTMETRICS pfntMetrics ) -{ - DWORD asciiChar = (int)(*c); - - /* Handle the TOP line. */ - if ( textBitMasks[asciiChar] & BIT1 ) - { - TextVertices[cIndex].sx = D3DVAL( lCoords[TL_0][0] ); - TextVertices[cIndex++].sy= D3DVAL( lCoords[TL_0][1] ); - TextVertices[cIndex].sx = D3DVAL( lCoords[TR_0][0] ); - TextVertices[cIndex++].sy= D3DVAL( lCoords[TR_0][1] ); - TextVertices[cIndex].sx = D3DVAL( lCoords[TR_1][0] ); - TextVertices[cIndex++].sy= D3DVAL( lCoords[TR_1][1] ); - TextVertices[cIndex].sx = D3DVAL( lCoords[TR_1][0] ); - TextVertices[cIndex++].sy= D3DVAL( lCoords[TR_1][1] ); - TextVertices[cIndex].sx = D3DVAL( lCoords[TL_1][0] ); - TextVertices[cIndex++].sy= D3DVAL( lCoords[TL_1][1] ); - TextVertices[cIndex].sx = D3DVAL( lCoords[TL_0][0] ); - TextVertices[cIndex++].sy= D3DVAL( lCoords[TL_0][1] ); - } - - /* Handle the TOP/BOTTOM RIGHT lines. */ - // if ( textBitMasks[index] & (BIT2|BIT3) ) - if ( 1 == 0 ) - { - TextVertices[cIndex].sx = D3DVAL( lCoords[TR_1][0] ); - TextVertices[cIndex++].sy= D3DVAL( lCoords[TR_1][1] ); - TextVertices[cIndex].sx = D3DVAL( lCoords[TRR][0] ); - TextVertices[cIndex++].sy= D3DVAL( lCoords[TRR][1] ); - TextVertices[cIndex].sx = D3DVAL( lCoords[BRR][0] ); - TextVertices[cIndex++].sy= D3DVAL( lCoords[BRR][1] ); - TextVertices[cIndex].sx = D3DVAL( lCoords[BRR][0] ); - TextVertices[cIndex++].sy= D3DVAL( lCoords[BRR][1] ); - TextVertices[cIndex].sx = D3DVAL( lCoords[BR_0][0] ); - TextVertices[cIndex++].sy= D3DVAL( lCoords[BR_0][1] ); - TextVertices[cIndex].sx = D3DVAL( lCoords[TR_1][0] ); - TextVertices[cIndex++].sy= D3DVAL( lCoords[TR_1][1] ); - } - else - { - if ( textBitMasks[asciiChar] & BIT2 ) - { - TextVertices[cIndex].sx = D3DVAL( lCoords[TR_1][0] ); - TextVertices[cIndex++].sy = D3DVAL( lCoords[TR_1][1] ); - TextVertices[cIndex].sx = D3DVAL( lCoords[TRR][0] ); - TextVertices[cIndex++].sy = D3DVAL( lCoords[TRR][1] ); - TextVertices[cIndex].sx = D3DVAL( lCoords[MRR_0][0] ); - TextVertices[cIndex++].sy = D3DVAL( lCoords[MRR_0][1] ); - TextVertices[cIndex].sx = D3DVAL( lCoords[MRR_0][0] ); - TextVertices[cIndex++].sy = D3DVAL( lCoords[MRR_0][1] ); - TextVertices[cIndex].sx = D3DVAL( lCoords[MR_0][0] ); - TextVertices[cIndex++].sy = D3DVAL( lCoords[MR_0][1] ); - TextVertices[cIndex].sx = D3DVAL( lCoords[TR_1][0] ); - TextVertices[cIndex++].sy = D3DVAL( lCoords[TR_1][1] ); - } - if ( textBitMasks[asciiChar] & BIT3 ) - { - TextVertices[cIndex].sx = D3DVAL( lCoords[MR_1][0] ); - TextVertices[cIndex++].sy = D3DVAL( lCoords[MR_1][1] ); - TextVertices[cIndex].sx = D3DVAL( lCoords[MRR_1][0] ); - TextVertices[cIndex++].sy = D3DVAL( lCoords[MRR_1][1] ); - TextVertices[cIndex].sx = D3DVAL( lCoords[BRR][0] ); - TextVertices[cIndex++].sy = D3DVAL( lCoords[BRR][1] ); - TextVertices[cIndex].sx = D3DVAL( lCoords[BRR][0] ); - TextVertices[cIndex++].sy = D3DVAL( lCoords[BRR][1] ); - TextVertices[cIndex].sx = D3DVAL( lCoords[BR_0][0] ); - TextVertices[cIndex++].sy = D3DVAL( lCoords[BR_0][1] ); - TextVertices[cIndex].sx = D3DVAL( lCoords[MR_1][0] ); - TextVertices[cIndex++].sy = D3DVAL( lCoords[MR_1][1] ); - } - } - - /* Handle the TOP/BOTTOM LEFT lines. */ - // if ( textBitMasks[asciiChar] & (BIT5|BIT6) ) - if ( 1 == 0 ) - { - TextVertices[cIndex].sx = D3DVAL( lCoords[TLL][0] ); - TextVertices[cIndex++].sy= D3DVAL( lCoords[TLL][1] ); - TextVertices[cIndex].sx = D3DVAL( lCoords[TL_1][0] ); - TextVertices[cIndex++].sy= D3DVAL( lCoords[TL_1][1] ); - TextVertices[cIndex].sx = D3DVAL( lCoords[BL_0][0] ); - TextVertices[cIndex++].sy= D3DVAL( lCoords[BL_0][1] ); - TextVertices[cIndex].sx = D3DVAL( lCoords[BL_0][0] ); - TextVertices[cIndex++].sy= D3DVAL( lCoords[BL_0][1] ); - TextVertices[cIndex].sx = D3DVAL( lCoords[BLL][0] ); - TextVertices[cIndex++].sy= D3DVAL( lCoords[BLL][1] ); - TextVertices[cIndex].sx = D3DVAL( lCoords[TLL][0] ); - TextVertices[cIndex++].sy= D3DVAL( lCoords[TLL][1] ); - } - else - { - if ( textBitMasks[asciiChar] & BIT5 ) - { - TextVertices[cIndex].sx = D3DVAL( lCoords[MLL_1][0] ); - TextVertices[cIndex++].sy = D3DVAL( lCoords[MLL_1][1] ); - TextVertices[cIndex].sx = D3DVAL( lCoords[ML_1][0] ); - TextVertices[cIndex++].sy = D3DVAL( lCoords[ML_1][1] ); - TextVertices[cIndex].sx = D3DVAL( lCoords[BL_0][0] ); - TextVertices[cIndex++].sy = D3DVAL( lCoords[BL_0][1] ); - TextVertices[cIndex].sx = D3DVAL( lCoords[BL_0][0] ); - TextVertices[cIndex++].sy = D3DVAL( lCoords[BL_0][1] ); - TextVertices[cIndex].sx = D3DVAL( lCoords[BLL][0] ); - TextVertices[cIndex++].sy = D3DVAL( lCoords[BLL][1] ); - TextVertices[cIndex].sx = D3DVAL( lCoords[MLL_1][0] ); - TextVertices[cIndex++].sy = D3DVAL( lCoords[MLL_1][1] ); - } - if ( textBitMasks[asciiChar] & BIT6 ) - { - TextVertices[cIndex].sx = D3DVAL( lCoords[TLL][0] ); - TextVertices[cIndex++].sy = D3DVAL( lCoords[TLL][1] ); - TextVertices[cIndex].sx = D3DVAL( lCoords[TL_1][0] ); - TextVertices[cIndex++].sy = D3DVAL( lCoords[TL_1][1] ); - TextVertices[cIndex].sx = D3DVAL( lCoords[ML_0][0] ); - TextVertices[cIndex++].sy = D3DVAL( lCoords[ML_0][1] ); - TextVertices[cIndex].sx = D3DVAL( lCoords[ML_0][0] ); - TextVertices[cIndex++].sy = D3DVAL( lCoords[ML_0][1] ); - TextVertices[cIndex].sx = D3DVAL( lCoords[MLL_0][0] ); - TextVertices[cIndex++].sy = D3DVAL( lCoords[MLL_0][1] ); - TextVertices[cIndex].sx = D3DVAL( lCoords[TLL][0] ); - TextVertices[cIndex++].sy = D3DVAL( lCoords[TLL][1] ); - } - } - - /* Handle the MIDDLE line. */ - if ( textBitMasks[asciiChar] & BIT7 ) - { - TextVertices[cIndex].sx = D3DVAL( lCoords[ML_0][0] ); - TextVertices[cIndex++].sy= D3DVAL( lCoords[ML_0][1] ); - TextVertices[cIndex].sx = D3DVAL( lCoords[MR_0][0] ); - TextVertices[cIndex++].sy= D3DVAL( lCoords[MR_0][1] ); - TextVertices[cIndex].sx = D3DVAL( lCoords[MR_1][0] ); - TextVertices[cIndex++].sy= D3DVAL( lCoords[MR_1][1] ); - TextVertices[cIndex].sx = D3DVAL( lCoords[MR_1][0] ); - TextVertices[cIndex++].sy= D3DVAL( lCoords[MR_1][1] ); - TextVertices[cIndex].sx = D3DVAL( lCoords[ML_1][0] ); - TextVertices[cIndex++].sy= D3DVAL( lCoords[ML_1][1] ); - TextVertices[cIndex].sx = D3DVAL( lCoords[ML_0][0] ); - TextVertices[cIndex++].sy= D3DVAL( lCoords[ML_0][1] ); - } - - /* Handle the BOTTOM line. */ - if ( textBitMasks[asciiChar] & BIT4 ) - { - TextVertices[cIndex].sx = D3DVAL( lCoords[BL_0][0] ); - TextVertices[cIndex++].sy= D3DVAL( lCoords[BL_0][1] ); - TextVertices[cIndex].sx = D3DVAL( lCoords[BR_0][0] ); - TextVertices[cIndex++].sy= D3DVAL( lCoords[BR_0][1] ); - TextVertices[cIndex].sx = D3DVAL( lCoords[BR_1][0] ); - TextVertices[cIndex++].sy= D3DVAL( lCoords[BR_1][1] ); - TextVertices[cIndex].sx = D3DVAL( lCoords[BR_1][0] ); - TextVertices[cIndex++].sy= D3DVAL( lCoords[BR_1][1] ); - TextVertices[cIndex].sx = D3DVAL( lCoords[BL_1][0] ); - TextVertices[cIndex++].sy= D3DVAL( lCoords[BL_1][1] ); - TextVertices[cIndex].sx = D3DVAL( lCoords[BL_0][0] ); - TextVertices[cIndex++].sy= D3DVAL( lCoords[BL_0][1] ); - } - - return cIndex; -} - -#undef CM -#undef CY -#undef CX -#undef CT - -#undef TLL -#undef TRR -#undef TL_0 -#undef TL_1 -#undef TR_0 -#undef TR_1 - -#undef MLL_0 -#undef MLL_1 -#undef MRR_0 -#undef MRR_1 - -#undef ML_0 -#undef ML_1 -#undef MR_0 -#undef MR_1 - -#undef BL_0 -#undef BL_1 -#undef BR_0 -#undef BR_1 -#undef BLL -#undef BRR - -#undef BIT1 -#undef BIT2 -#undef BIT3 -#undef BIT4 -#undef BIT5 -#undef BIT6 -#undef BIT7 - -#undef TOP -#undef MIDDLE -#undef BOTTOM -#undef TLEFT -#undef BLEFT -#undef LEFT -#undef TRIGHT -#undef BRIGHT -#undef RIGHT -#undef ALL diff --git a/src/mesa/drivers/d3d/D3DTextureMgr.cpp b/src/mesa/drivers/d3d/D3DTextureMgr.cpp deleted file mode 100644 index a6600cab02..0000000000 --- a/src/mesa/drivers/d3d/D3DTextureMgr.cpp +++ /dev/null @@ -1,947 +0,0 @@ -/*===========================================================================*/ -/* */ -/* Mesa-3.0 DirectX 6 Driver */ -/* */ -/* By Leigh McRae */ -/* */ -/* http://www.altsoftware.com/ */ -/* */ -/* Copyright (c) 1999-1998 alt.software inc. All Rights Reserved */ -/*===========================================================================*/ -#include "D3DHAL.h" -/*===========================================================================*/ -/* Local function prototypes. */ -/*===========================================================================*/ -static void UpdateTexture( PTM_OBJECT pTMObj, BOOL bVideo, RECT *pRect, UCHAR *pixels ); -static BOOL LoadTextureInVideo( PMESAD3DHAL pHAL, PTM_OBJECT pTMObj ); -static BOOL FreeTextureMemory( PMESAD3DHAL pHAL, PTM_OBJECT pTMObject ); -static BOOL DestroyTextureObject( PMESAD3DHAL pHAL, PTM_OBJECT pTMObject ); -HRESULT CALLBACK EnumPFHook( LPDDPIXELFORMAT lpDDPixFmt, LPVOID lpContext ); -/*===========================================================================*/ -/* This function will simply set the top of stack to NULL. I only used it */ -/* just incase I want to add something later. */ -/*===========================================================================*/ -/* RETURN: TRUE. */ -/*===========================================================================*/ -BOOL InitTMgrHAL( PMESAD3DHAL pHAL ) -{ - DPF(( DBG_FUNC, "InitTMgrHAL();" )); - - /* Be clean my friend. */ - pHAL->pTMList = NULL; - - return TRUE; -} -/*===========================================================================*/ -/* This function will walk the Texture Managers linked list and destroy all */ -/* surfaces (SYSTEM/VIDEO). The texture objects themselves also will be */ -/* freed. */ -/* NOTE: this is per/context. */ -/*===========================================================================*/ -/* RETURN: */ -/*===========================================================================*/ -void TermTMgrHAL( PMESAD3DHAL pHAL ) -{ - DPF(( DBG_FUNC, "TermTMgrHAL();" )); - - if ( pHAL && pHAL->pTMList ) - { - /* Destroy the surface and remove the TMO from the stack. */ - while( DestroyTextureObject(pHAL,NULL) ); - - /* Be clean my friend. */ - pHAL->pTMList = NULL; - } -} -/*===========================================================================*/ -/* This function is a HACK as I don't know how I can disable a texture with-*/ -/* out booting it out. Is there know state change? */ -/*===========================================================================*/ -/* RETURN: */ -/*===========================================================================*/ -extern "C" void DisableTMgrHAL( PMESAD3DSHARED pShared ) -{ - PMESAD3DHAL pHAL = (PMESAD3DHAL)pShared; - - DPF(( DBG_FUNC, "DisableTMgrHAL();" )); - - /* Check too see that we have a valid context. */ - if ( (pHAL == NULL) && (pHAL->lpD3DDevice != NULL) ) - { - DPF(( DBG_TXT_WARN, "Null HAL/Direct3D Device!" )); - return; - } - - // TODO: This is a hack to shut off textures. - pHAL->lpD3DDevice->SetTexture( 0, NULL ); -} -/*===========================================================================*/ -/* This function is the only entry into the TextureManager that Mesa/wgl */ -/* will see. It uses a dwAction to specify what we are doing. I did this as*/ -/* depending on the cards resources the action taken can change. */ -/* When this function is called we will always search the Texture Managers */ -/* linked list (per context remember) and try and find a structure that has */ -/* the same dwName. If we have a match we pull it out of the list and put it*/ -/* at the top of the list (TOL). If we don't find one then we create a struc*/ -/* and put it a TOL. This TOL idea makes for some caching as we will always */ -/* destroy Texture Surfaces from the bottom up... */ -/* All texture objects at this point will create a texture surface in System*/ -/* memory (SMEM). Then we will copy the Mesa texture into the surface using */ -/* the 'pixel' struc to get the translation info. So now this means that all*/ -/* textures that Mesa gives me I will have a Surface with a copy. If Mesa */ -/* changes the texture the I update the surface in (SMEM). */ -/* Now we have a texture struc and a Texture Surface in SMEM. At this point*/ -/* we create another surface on the card (VMEM). Finally we blt from the */ -/* SMEM to the VMEM and set the texture as current. Why do I need two? First*/ -/* this solves square textures. If the cards CAPS is square textures only */ -/* then I change the dimensions of the VMEM surface and the blt solves it for*/ -/* me. Second it saves me from filling D3D textures over and over if the */ -/* card needs to be creating and destroying surfaces because of low memory. */ -/* The surface in SMEM is expected to work always. When a surface has to be*/ -/* created in VMEM then we put it in a loop that tries to create the surface.*/ -/* If we create the surface ok then we brake from the loop. If we fail then */ -/* we will call 'FreeTextureMemory' that will return TRUE/FALSE as to whether*/ -/* memory was freed. If memory was freed then we can try again. If no memory*/ -/* was freed then it just can't fit. */ -/* 'FreeTextureMemory' will find the end of the list and start freeing VMEM */ -/* (never SMEM) surfaces that are not locked. */ -/* BIND - when we bind and there is a texture struct with a texture surface */ -/* in VMEM then we just make it current. If we have a struct and a surface */ -/* in SMEM but no VMEM surface then we create the surface in VMEM and blt */ -/* from the SMEM surface. If we have nothing its just like a creation... */ -/*===========================================================================*/ -/* RETURN: TRUE, FALSE. */ -/*===========================================================================*/ -extern "C" BOOL CreateTMgrHAL( PMESAD3DSHARED pShared, DWORD dwName, int level, DWORD dwRequestFlags, - RECT *rectDirty, DWORD dwWidth, DWORD dwHeight, DWORD dwAction, void *pPixels ) -{ - PMESAD3DHAL pHAL = (PMESAD3DHAL)pShared; - PTM_OBJECT pTMObj, - pTemp; - DDSURFACEDESC2 ddsd2; - HRESULT rc; - - - DPF(( DBG_FUNC, "CreateTMgrHAL();" )); - - DPF(( DBG_TXT_INFO, "Texture:" )); - DPF(( DBG_TXT_INFO, "cx: %d cy: %d", dwWidth, dwHeight )); - DPF(( DBG_TXT_INFO, "Rect:" )); - if ( rectDirty ) - { - DPF(( DBG_TXT_INFO, "x0: %d y0: %d", rectDirty->left, rectDirty->top )); - DPF(( DBG_TXT_INFO, "x1: %d y1: %d", rectDirty->right, rectDirty->bottom )); - } - - /* Check too see that we have a valid context. */ - if ( (pHAL == NULL) && (pHAL->lpD3DDevice != NULL) ) - { - DPF(( DBG_TXT_WARN, "Null HAL/Direct3D Device!" )); - return FALSE; - } - - /*=================================================*/ - /* See if we can find this texture object by name. */ - /*=================================================*/ - for( pTMObj = pHAL->pTMList; pTMObj && (pTMObj->dwName != dwName); pTMObj = pTMObj->next ); - - /*=========================================================*/ - /* Allocate a new object if we didn't get a matching name. */ - /*=========================================================*/ - if ( pTMObj == NULL ) - { - pTMObj = (PTM_OBJECT)ALLOC( sizeof(TM_OBJECT) ); - if ( pTMObj == NULL ) - return FALSE; - memset( pTMObj, 0, sizeof(TM_OBJECT) ); - - /* Put the object at the beginning of the list. */ - pTMObj->next = pHAL->pTMList; - if ( pTMObj->next ) - { - pTemp = pTMObj->next; - pTemp->prev = pTMObj; - } - pHAL->pTMList = pTMObj; - } - else - { - /*===============================================================*/ - /* Make some caching happen by pulling this object to the front. */ - /*===============================================================*/ - if ( pHAL->pTMList != pTMObj ) - { - /* Pull the object out of the list. */ - if ( pTMObj->prev ) - { - pTemp = pTMObj->prev; - pTemp->next = pTMObj->next; - } - if ( pTMObj->next ) - { - pTemp = pTMObj->next; - pTemp->prev = pTMObj->prev; - } - - pTMObj->prev = NULL; - pTMObj->next = NULL; - - /* Put the object at the front of the list. */ - pTMObj->next = pHAL->pTMList; - if ( pTMObj->next ) - { - pTemp = pTMObj->next; - pTemp->prev = pTMObj; - } - pHAL->pTMList = pTMObj; - } - } - - /*========================================================*/ - /* If we are doing BIND and the texture is in VID memory. */ - /*========================================================*/ - if ( (dwAction == TM_ACTION_BIND) && pTMObj->lpDDS_Video ) - { - DPF(( DBG_TXT_PROFILE, "Cache HIT (%d)", dwName )); - - /* Make this the current texture. */ - rc = pHAL->lpD3DDevice->SetTexture( 0, pTMObj->lpD3DTexture2 ); - if ( FAILED(rc) ) - { - DPF(( DBG_TXT_WARN, "Failed SetTexture() (%s)", ErrorStringD3D(rc) )); - pHAL->lpD3DDevice->SetTexture( 0, NULL ); - return FALSE; - } - - return TRUE; - } - - /*=================================================================*/ - /* If we are doing BIND and the texture is at least in SYS memory. */ - /*=================================================================*/ - if ( (dwAction == TM_ACTION_BIND) && pTMObj->lpDDS_System ) - { - DPF(( DBG_TXT_PROFILE, "Cache MISS (%d)", dwName )); - - /* Create the texture on the card. */ - rc = LoadTextureInVideo( pHAL, pTMObj ); - if ( rc == FALSE ) - return FALSE; - - /* Make this the current texture. */ - rc = pHAL->lpD3DDevice->SetTexture( 0, pTMObj->lpD3DTexture2 ); - if ( FAILED(rc) ) - { - DPF(( DBG_TXT_WARN, "Failed SetTexture() (%s)", ErrorStringD3D(rc) )); - pHAL->lpD3DDevice->SetTexture( 0, NULL ); - return FALSE; - } - - return TRUE; - } - - /*=========================================================*/ - /* If we are doing UPDATE then try in VID first for speed. */ - /*=========================================================*/ - if ( (dwAction == TM_ACTION_UPDATE) && pTMObj->lpDDS_Video && - !(pHAL->D3DHWDevDesc.dpcTriCaps.dwTextureCaps & D3DPTEXTURECAPS_SQUAREONLY) ) - { - DPF(( DBG_TXT_INFO, "Fix the SubTexture update Leigh!" )); - - /* Update the texture on the card. */ - UpdateTexture( pTMObj, TRUE, rectDirty, (UCHAR *)pPixels ); - - /* We updated the texture in VID so kill the SYS so we know its dirty. */ - if ( pTMObj->lpDDS_System ) - { - DPF(( DBG_TXT_INFO, "Release texture (SYS)" )); - DX_RESTORE( pTMObj->lpDDS_System ); - pTMObj->lpDDS_System->Release(); - pTMObj->lpDDS_System = NULL; - } - - /* Make this the current texture. */ - rc = pHAL->lpD3DDevice->SetTexture( 0, pTMObj->lpD3DTexture2 ); - if ( FAILED(rc) ) - { - DPF(( DBG_TXT_WARN, "Failed SetTexture() (%s)", ErrorStringD3D(rc) )); - pHAL->lpD3DDevice->SetTexture( 0, NULL ); - return FALSE; - } - - return TRUE; - } - - /*===========================================================*/ - /* If we are doing UPDATE then try in SYS still gives speed. */ - /*===========================================================*/ - if ( (dwAction == TM_ACTION_UPDATE) && pTMObj->lpDDS_System ) - { - DPF(( DBG_TXT_INFO, "Fix the SubTexture update Leigh!" )); - - /* Update the texture in SYS. */ - UpdateTexture( pTMObj, FALSE, NULL, (UCHAR *)pPixels ); - - /* We updated the SYS texture only so now blt to the VID. */ - rc = LoadTextureInVideo( pHAL, pTMObj ); - if ( rc == FALSE ) - return FALSE; - - /* Make this the current texture. */ - rc = pHAL->lpD3DDevice->SetTexture( 0, pTMObj->lpD3DTexture2 ); - if ( FAILED(rc) ) - { - DPF(( DBG_TXT_WARN, "Failed SetTexture() (%s)", ErrorStringD3D(rc) )); - pHAL->lpD3DDevice->SetTexture( 0, NULL ); - return FALSE; - } - - return TRUE; - } - - /* At this point we have a valid Texture Manager Object with updated */ - /* links. We now need to create or update a texture surface that is */ - /* in system memory. Every texture has a copy in system so we can use*/ - /* blt to solve problems with textures allocated on the card (square */ - /* only textures, pixelformats...). */ - - // TODO: make support for update also. Dirty rectangle basicly... - - /* Kill the interface if we have one no matter what. */ - if ( pTMObj->lpD3DTexture2 ) - { - DPF(( DBG_TXT_INFO, "Release Texture2" )); - pTMObj->lpD3DTexture2->Release(); - pTMObj->lpD3DTexture2 = NULL; - } - - /* Kill the system surface. TODO: should try to get the SubIMage going again */ - if ( pTMObj->lpDDS_System ) - { - DPF(( DBG_TXT_INFO, "Release texture (SYS)" )); - DX_RESTORE( pTMObj->lpDDS_System ); - pTMObj->lpDDS_System->Release(); - pTMObj->lpDDS_System = NULL; - } - - /* Kill the Video surface. TODO: need some reuse system... */ - if ( pTMObj->lpDDS_Video ) - { - DPF(( DBG_TXT_INFO, "Release texture (VID)" )); - DX_RESTORE( pTMObj->lpDDS_Video ); - pTMObj->lpDDS_Video->Release(); - pTMObj->lpDDS_Video = NULL; - } - - /*================================================================*/ - /* Translate the the Mesa/OpenGL pixel channels to the D3D flags. */ - /*================================================================*/ - switch( dwRequestFlags ) - { - case GL_ALPHA: - dwRequestFlags = DDPF_ALPHA; - DPF(( DBG_TXT_WARN, "GL_ALPHA not supported!)" )); - return FALSE; - - case GL_INTENSITY: - case GL_LUMINANCE: - DPF(( DBG_TXT_WARN, "GL_INTENSITY/GL_LUMINANCE not supported!)" )); - dwRequestFlags = DDPF_LUMINANCE; - return FALSE; - - case GL_LUMINANCE_ALPHA: - DPF(( DBG_TXT_WARN, "GL_LUMINANCE_ALPHA not supported!)" )); - dwRequestFlags = DDPF_LUMINANCE | DDPF_ALPHAPIXELS; - return FALSE; - - case GL_RGB: - DPF(( DBG_TXT_INFO, "Texture -> GL_RGB" )); - dwRequestFlags = DDPF_RGB; - break; - - case GL_RGBA: - DPF(( DBG_TXT_INFO, "Texture -> GL_RGBA" )); - dwRequestFlags = DDPF_RGB | DDPF_ALPHAPIXELS; - break; - } - - /*==============================*/ - /* Populate the texture object. */ - /*==============================*/ - pTMObj->dwName = dwName; - pTMObj->lpD3DDevice = pHAL->lpD3DDevice; - pTMObj->dwFlags = dwRequestFlags; - if ( pHAL->D3DHWDevDesc.dpcTriCaps.dwTextureCaps & D3DPTEXTURECAPS_SQUAREONLY ) - { - DPF(( DBG_TXT_INFO, "Convert to Square..." )); - pTMObj->dwSHeight = dwHeight; - pTMObj->dwSWidth = dwWidth; - - /* Shrink non-square textures. */ - pTMObj->dwVHeight = (dwHeight > dwWidth) ? dwWidth : dwHeight; - pTMObj->dwVWidth = (dwHeight > dwWidth) ? dwWidth : dwHeight; - } - else - { - pTMObj->dwSHeight = dwHeight; - pTMObj->dwSWidth = dwWidth; - pTMObj->dwVHeight = dwHeight; - pTMObj->dwVWidth = dwWidth; - } - - /*========================*/ - /* Create SYSTEM surface. */ - /*========================*/ - - /* Request a surface in system memory. */ - memset( &ddsd2, 0, sizeof(DDSURFACEDESC2) ); - ddsd2.dwSize = sizeof( DDSURFACEDESC2 ); - ddsd2.dwWidth = pTMObj->dwSWidth; - ddsd2.dwHeight = pTMObj->dwSHeight; - ddsd2.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT | DDSD_PIXELFORMAT; - ddsd2.ddsCaps.dwCaps = DDSCAPS_TEXTURE | DDSCAPS_SYSTEMMEMORY; - ddsd2.ddsCaps.dwCaps2 = 0L; - memset( &ddsd2.ddpfPixelFormat, 0, sizeof(DDPIXELFORMAT) ); - ddsd2.ddpfPixelFormat.dwSize = sizeof( DDPIXELFORMAT ); - ddsd2.ddpfPixelFormat.dwFlags = dwRequestFlags; - rc = pHAL->lpD3DDevice->EnumTextureFormats( EnumPFHook, &ddsd2.ddpfPixelFormat ); - if ( FAILED(rc) ) - { - RIP( pHAL, "EnumerTextureFormats (SYSTEM)->", ErrorStringD3D(rc) ); - return FALSE; - } - - /* Create the surface using the enumerated pixelformat. */ - rc = pHAL->lpDD4->CreateSurface( &ddsd2, &pTMObj->lpDDS_System, NULL ); - if ( FAILED(rc) ) - { - RIP( pHAL, "CreateSurface (TEXTURE/SYSTEM)->", ErrorStringD3D(rc) ); - return FALSE; - } - - /* Solve the pixel mapping info using the surface pixelformat. */ - Solve8BitChannelPixelFormat( &ddsd2.ddpfPixelFormat, &pTMObj->pixel ); - - /*===================================================================*/ - /* Fill the texture using the PixelInfo structure to do the mapping. */ - /*===================================================================*/ - UpdateTexture( pTMObj, FALSE, NULL, (UCHAR *)pPixels ); - - /*=======================*/ - /* Create VIDEO surface. */ - /*=======================*/ - rc = LoadTextureInVideo( pHAL, pTMObj ); - if ( rc == FALSE ) - return FALSE; - - /* Make this the current texture. */ - rc = pHAL->lpD3DDevice->SetTexture( 0, pTMObj->lpD3DTexture2 ); - if ( FAILED(rc) ) - { - DPF(( DBG_TXT_WARN, "Failed SetTexture() (%s)", ErrorStringD3D(rc) )); - pHAL->lpD3DDevice->SetTexture( 0, NULL ); - return FALSE; - } - - return TRUE; -} -/*===========================================================================*/ -/* This function will handle the creation and destruction of the texture */ -/* surfaces on the card. Using the dw'V'Width/Height dimensions the call */ -/* try and create the texture on the card and keep using FreeTextureMemory */ -/* until the surace can be created. Once the surface is created we get the */ -/* interface that we will use to make it the current texture. I didn't put */ -/* the code to make the texture current in this function as BIND needs to */ -/* use the same code and this function doesn't always get called when we do a*/ -/* bind. */ -/*===========================================================================*/ -/* RETURN: TRUE, FALSE. */ -/*===========================================================================*/ -static BOOL LoadTextureInVideo( PMESAD3DHAL pHAL, PTM_OBJECT pTMObj ) -{ - DDSURFACEDESC2 ddsd2; - HRESULT rc; - - DPF(( DBG_FUNC, "LoadTextureInVideo();" )); - - /* Kill the interface if we have one no matter what. */ - if ( pTMObj->lpD3DTexture2 ) - { - DPF(( DBG_TXT_INFO, "Release Texture2" )); - pTMObj->lpD3DTexture2->Release(); - pTMObj->lpD3DTexture2 = NULL; - } - - /* Kill the Video surface. TODO: need some reuse system... */ - if ( pTMObj->lpDDS_Video ) - { - DPF(( DBG_TXT_INFO, "Release texture (VID)" )); - DX_RESTORE( pTMObj->lpDDS_Video ); - pTMObj->lpDDS_Video->Release(); - pTMObj->lpDDS_Video = NULL; - } - - /* Request a surface in Video memory. */ - memset( &ddsd2, 0, sizeof(DDSURFACEDESC2) ); - ddsd2.dwSize = sizeof( DDSURFACEDESC2 ); - ddsd2.dwWidth = pTMObj->dwVWidth; - ddsd2.dwHeight = pTMObj->dwVHeight; - ddsd2.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT | DDSD_PIXELFORMAT; - ddsd2.ddsCaps.dwCaps = DDSCAPS_TEXTURE | DDSCAPS_VIDEOMEMORY; - ddsd2.ddsCaps.dwCaps2 = 0L; - memset( &ddsd2.ddpfPixelFormat, 0, sizeof(DDPIXELFORMAT) ); - ddsd2.ddpfPixelFormat.dwSize = sizeof( DDPIXELFORMAT ); - ddsd2.ddpfPixelFormat.dwFlags = pTMObj->dwFlags; - rc = pHAL->lpD3DDevice->EnumTextureFormats( EnumPFHook, &ddsd2.ddpfPixelFormat ); - if ( FAILED(rc) ) - { - RIP( pHAL, "EnumerTextureFormats ->", ErrorStringD3D(rc) ); - return FALSE; - } - - /* Make sure we lock so we don't nuke this texture trying to free memory for it. */ - pTMObj->bLock = TRUE; - - /* Start a loop that will free all textures until we have created the texture */ - /* surface or we can't free up more memory. */ - do - { - /* Try to create the texture surface. */ - rc = pHAL->lpDD4->CreateSurface( &ddsd2, &pTMObj->lpDDS_Video, NULL ); - if ( !FAILED(rc) ) - break; - - DPF(( DBG_TXT_INFO, "Free Texture Memory" )); - - /* DestroyTexture will return TRUE if a surface was freed. */ - } while( FreeTextureMemory(pHAL,NULL) ); - - /* Make sure we unlock or we won't be able to nuke the TMO later. */ - pTMObj->bLock = FALSE; - - /* Did we create a valid texture surface? */ - if ( FAILED(rc) ) - { - DPF(( DBG_TXT_WARN, "Failed to load texture" )); - pHAL->lpD3DDevice->SetTexture( 0, NULL ); - return FALSE; - } - - DX_RESTORE( pTMObj->lpDDS_System ); - DX_RESTORE( pTMObj->lpDDS_Video ); - - DPF(( DBG_TXT_INFO, "Texture Blt SYSTEM -> VID" )); - - /* Now blt the texture in system memory to the card. */ - rc = pTMObj->lpDDS_Video->Blt( NULL, pTMObj->lpDDS_System, NULL, DDBLT_WAIT, NULL ); - if ( FAILED(rc) ) - { - RIP( pHAL, "Blt (TEXTURE) ->", ErrorStringD3D(rc) ); - return FALSE; - } - - /* Get the Texture interface that is used to render with. */ - pTMObj->lpDDS_Video->QueryInterface( IID_IDirect3DTexture2, (void **)&pTMObj->lpD3DTexture2 ); - if ( pTMObj->lpD3DTexture2 == NULL ) - { - DPF(( DBG_TXT_WARN, "Failed QueryTextureInterface" )); - pHAL->lpD3DDevice->SetTexture( 0, NULL ); - return FALSE; - } - - return TRUE; -} -/*===========================================================================*/ -/* If this function gets a texture object struc then we will try and free */ -/* it. If we get a NULL then we will search from the bottom up and free one */ -/* VMEM surface. I can only free when the surface isn't locked and of course*/ -/* there must be a VMEM surface. We never free SMEM surfaces as that isn't */ -/* the point. */ -/* TODO: should have a pointer to the bottom of the stack really. */ -/*===========================================================================*/ -/* RETURN: */ -/*===========================================================================*/ -static BOOL FreeTextureMemory( PMESAD3DHAL pHAL, PTM_OBJECT pTMObject ) -{ - PTM_OBJECT pCurrent; - BOOL bFreed = FALSE; - - DPF(( DBG_FUNC, "FreeTextureMemory();" )); - DPF(( DBG_TXT_WARN, "FREE TEXTURE!" )); - - /* Just to be safe. */ - if ( !pHAL || !pHAL->pTMList ) - { - DPF(( DBG_TXT_WARN, "FreeTextureMemory() -> NULL pHAL/pHAL->pTMList" )); - return FALSE; - } - - /* Free the last texture in the list. */ - if ( pTMObject == NULL ) - { - DPF(( DBG_TXT_INFO, "Free Last texture in cache" )); - - /* Find the last texture object. */ - for( pCurrent = pHAL->pTMList; pCurrent->next; pCurrent = pCurrent->next ); - - /* Now backup until we find a texture on the card. */ - while( pCurrent && (pCurrent->lpDDS_Video == NULL) && (pCurrent->bLock == FALSE) ) - pCurrent = pCurrent->prev; - - /* Didn't find anything. */ - if ( pCurrent == NULL ) - { - DPF(( DBG_TXT_INFO, "No texture memory freed" )); - return FALSE; - } - } - else - { - /* See if we can find this texture object. */ - for( pCurrent = pHAL->pTMList; pCurrent && (pCurrent != pTMObject); pCurrent = pCurrent->next ); - - /* Didn't find anything. */ - if ( pCurrent == NULL ) - { - DPF(( DBG_TXT_INFO, "Requested texture to be freed NOT FOUND" )); - return FALSE; - } - } - - /* Can't free this baby. */ - if ( pCurrent->bLock == TRUE ) - { - DPF(( DBG_TXT_WARN, "Requested texture LOCKED" )); - return FALSE; - } - - /* Free the texture memory. */ - if ( pCurrent->lpD3DTexture2 ) - { - DPF(( DBG_TXT_INFO, "Release Texture2" )); - pCurrent->lpD3DTexture2->Release(); - pCurrent->lpD3DTexture2 = NULL; - bFreed = TRUE; - } - if ( pCurrent->lpDDS_Video ) - { - DPF(( DBG_TXT_INFO, "Release texture (VID):" )); - DPF(( DBG_TXT_INFO, "dwName: %d", pCurrent->dwName )); - DPF(( DBG_TXT_INFO, "cx: %d, cy: %d", pCurrent->dwVWidth, pCurrent->dwVHeight )); - pCurrent->lpDDS_Video->Release(); - pCurrent->lpDDS_Video = NULL; - bFreed = TRUE; - } - - return bFreed; -} -/*===========================================================================*/ -/* This function searches the linked list of texture objects in the supplied*/ -/* D3Dwrapper structure. If it finds a match it will free it and pull it out*/ -/* of the linked list. The function works on the bases of a matching pointer*/ -/* to the object (not matching content). */ -/* If the function gets passed a NULL then we want to free the last texture */ -/* object in the list. Used in a loop to destory all. */ -/*===========================================================================*/ -/* RETURN: TRUE, FALSE. */ -/*===========================================================================*/ -static BOOL DestroyTextureObject( PMESAD3DHAL pHAL, PTM_OBJECT pTMObject ) -{ - PTM_OBJECT pCurrent; - - DPF(( DBG_FUNC, "DestoryTextureObject();" )); - - /* Just to be safe. */ - if ( !pHAL || !pHAL->pTMList ) - { - DPF(( DBG_TXT_WARN, "DestroyTextureObject() -> NULL pHAL/pHAL->pTMList" )); - return FALSE; - } - - /* Free the last texture in the list. */ - if ( pTMObject == NULL ) - { - /* Find the last texture object. */ - for( pCurrent = pHAL->pTMList; pCurrent->next; pCurrent = pCurrent->next ); - } - else - { - /* See if we can find this texture object. */ - for( pCurrent = pHAL->pTMList; pCurrent && (pCurrent != pTMObject); pCurrent = pCurrent->next ); - - /* Didn't find anything. */ - if ( pCurrent == NULL ) - { - DPF(( DBG_TXT_WARN, "No textures to be freed" )); - return FALSE; - } - } - - /* Can't free this baby. */ - if ( pCurrent->bLock == TRUE ) - { - DPF(( DBG_TXT_WARN, "Requested texture to be freed LOCKED" )); - return FALSE; - } - - /* Free the texture memory. */ - if ( pCurrent->lpD3DTexture2 ) - { - DPF(( DBG_TXT_INFO, "Release Texture2" )); - pCurrent->lpD3DTexture2->Release(); - pCurrent->lpD3DTexture2 = NULL; - } - if ( pCurrent->lpDDS_Video ) - { - DPF(( DBG_TXT_INFO, "Release texture (VID):" )); - pCurrent->lpDDS_Video->Release(); - pCurrent->lpDDS_Video = NULL; - } - if ( pCurrent->lpDDS_System ) - { - DPF(( DBG_TXT_INFO, "Release texture (SYS):" )); - pCurrent->lpDDS_System->Release(); - pCurrent->lpDDS_System = NULL; - } - - /* Pull this texture out of the list. */ - if ( pCurrent == pHAL->pTMList ) - pHAL->pTMList = NULL; - if ( pCurrent->prev ) - (pCurrent->prev)->next = pCurrent->next; - if ( pCurrent->next ) - (pCurrent->next)->prev = pCurrent->prev; - FREE( pCurrent ); - - return TRUE; -} -/*===========================================================================*/ -/* This function is the callback function that gets called when we are doing*/ -/* an enumeration of the texture formats supported by this device. The choice*/ -/* is made by checking to see if we have a match with the supplied D3D pixel-*/ -/* format. So the enumeration has to pass a desired D3D PF as the user var. */ -/*===========================================================================*/ -/* RETURN: D3DENUMRET_OK, D3DENUMRET_CANCEL. */ -/*===========================================================================*/ -static void UpdateTexture( PTM_OBJECT pTMObj, BOOL bVideo, RECT *pRect, UCHAR *pixels ) -{ - LPDIRECTDRAWSURFACE4 lpDDS; - DDSURFACEDESC2 ddsd2; - DWORD srcPitch, - dwHeight, - dwWidth, - dwCol, - dwColor; - UCHAR *pSrc, - *pSrcRow, - *pDest, - *pDestRow; - int rc; - - // TODO: Do I need to pass the h/w when its in the object! - DPF(( DBG_FUNC, "UpdateTexture();" )); - - /* Get the surface pointer we are looking for. */ - lpDDS = (bVideo) ? pTMObj->lpDDS_Video : pTMObj->lpDDS_System; - - /*===================================================================*/ - /* Fill the texture using the PixelInfo structure to do the mapping. */ - /*===================================================================*/ - - /* Get the surface pointer. */ - memset( &ddsd2, 0, sizeof(DDSURFACEDESC2) ); - ddsd2.dwSize = sizeof(DDSURFACEDESC2); - rc = lpDDS->Lock( NULL, &ddsd2, DDLOCK_WAIT, NULL ); - if ( FAILED(rc) ) - { - RIP( NULL, "Lock (TEXTURE/SYSTEM)->", ErrorStringD3D(rc) ); - return; - } - - /* For now we are only updating the system surface so use its dimensions. */ - dwWidth = (bVideo) ? pTMObj->dwVWidth : pTMObj->dwSWidth; - dwHeight = (bVideo) ? pTMObj->dwVHeight : pTMObj->dwSHeight; - - /* If we are updating the whole surface then the pDest/pSrc will */ - /* always be the same. */ - if ( pRect == NULL ) - { - pDest = (UCHAR *)ddsd2.lpSurface; - pSrc = pixels; - } - - /* Fill the texture surface based on the pixelformat flags. */ - if ( pTMObj->dwFlags == (DDPF_RGB | DDPF_ALPHAPIXELS) ) - { - srcPitch = dwWidth * 4; - if ( pRect ) - { - pDest = ((UCHAR *)ddsd2.lpSurface) + (pRect->top * ddsd2.lPitch) + (pRect->left * pTMObj->pixel.cb); - pSrc = pixels + (pRect->top * dwWidth * 4) + (pRect->left * 4); - dwHeight = (pRect->bottom - pRect->top); - dwWidth = (pRect->right - pRect->left); - } - - for( pDestRow = pDest, pSrcRow = pSrc; dwHeight > 0; dwHeight--, pDestRow += ddsd2.lPitch, pSrcRow += srcPitch ) - { - for( dwCol = 0, pDest = pDestRow, pSrc = pSrcRow; dwCol < dwWidth; dwCol++ ) - { - dwColor = ( ((DWORD)(*(pSrc ) * pTMObj->pixel.rScale)) << pTMObj->pixel.rShift ); - dwColor |= ( ((DWORD)(*(pSrc+1) * pTMObj->pixel.gScale)) << pTMObj->pixel.gShift ); - dwColor |= ( ((DWORD)(*(pSrc+2) * pTMObj->pixel.bScale)) << pTMObj->pixel.bShift ); - if ( pTMObj->pixel.aScale == -1.0 ) - dwColor |= ( (*(pSrc+3) & 0x80) ? (1 << pTMObj->pixel.aShift) : 0 ); - else - dwColor |= ( ((DWORD)(*(pSrc+3) * pTMObj->pixel.aScale)) << pTMObj->pixel.aShift ); - memcpy( pDest, &dwColor, pTMObj->pixel.cb ); - pDest += pTMObj->pixel.cb; - pSrc += 4; - } - } - } - else if ( pTMObj->dwFlags == DDPF_RGB ) - { - srcPitch = dwWidth * 3; - if ( pRect ) - { - pDest = ((UCHAR *)ddsd2.lpSurface) + (pRect->top * ddsd2.lPitch) + (pRect->left * pTMObj->pixel.cb); - pSrc = pixels + (pRect->top * dwWidth * 3) + (pRect->left * 3); - dwHeight = (pRect->bottom - pRect->top); - dwWidth = (pRect->right - pRect->left); - } - - for( pDestRow = pDest, pSrcRow = pSrc; dwHeight > 0; dwHeight--, pDestRow += ddsd2.lPitch, pSrcRow += srcPitch ) - { - for( dwCol = 0, pDest = pDestRow, pSrc = pSrcRow; dwCol < dwWidth; dwCol++ ) - { - dwColor = ( ((DWORD)(*(pSrc ) * pTMObj->pixel.rScale)) << pTMObj->pixel.rShift ); - dwColor |= ( ((DWORD)(*(pSrc+1) * pTMObj->pixel.gScale)) << pTMObj->pixel.gShift ); - dwColor |= ( ((DWORD)(*(pSrc+2) * pTMObj->pixel.bScale)) << pTMObj->pixel.bShift ); - memcpy( pDest, &dwColor, pTMObj->pixel.cb ); - pDest += pTMObj->pixel.cb; - pSrc += 3; - } - } - } - else if ( pTMObj->dwFlags == (DDPF_LUMINANCE | DDPF_ALPHAPIXELS) ) - { - srcPitch = dwWidth * 2; - if ( pRect ) - { - pDest = ((UCHAR *)ddsd2.lpSurface) + (pRect->top * ddsd2.lPitch) + (pRect->left * pTMObj->pixel.cb); - pSrc = pixels + (pRect->top * dwWidth * 2) + (pRect->left * 2); - dwHeight = (pRect->bottom - pRect->top); - dwWidth = (pRect->right - pRect->left); - } - - for( pDestRow = pDest, pSrcRow = pSrc; dwHeight > 0; dwHeight--, pDestRow += ddsd2.lPitch, pSrcRow += srcPitch ) - { - for( dwCol = 0, pDest = pDestRow, pSrc = pSrcRow; dwCol < dwWidth; dwCol++ ) - { - dwColor = ( ((DWORD)(*(pSrc ) * pTMObj->pixel.rScale)) << pTMObj->pixel.rShift ); - if ( pTMObj->pixel.aScale == -1.0 ) - dwColor |= ( (*(pSrc+1) & 0x80) ? (1 << pTMObj->pixel.aShift) : 0 ); - else - dwColor |= ( ((DWORD)(*(pSrc+1) * pTMObj->pixel.aScale)) << pTMObj->pixel.aShift ); - memcpy( pDest, &dwColor, pTMObj->pixel.cb ); - pDest += pTMObj->pixel.cb; - pSrc += 2; - } - } - } - else if ( pTMObj->dwFlags == DDPF_LUMINANCE ) - { - srcPitch = dwWidth; - if ( pRect ) - { - pDest = ((UCHAR *)ddsd2.lpSurface) + (pRect->top * ddsd2.lPitch) + (pRect->left * pTMObj->pixel.cb); - pSrc = pixels + (pRect->top * dwWidth) + (pRect->left); - dwHeight = (pRect->bottom - pRect->top); - dwWidth = (pRect->right - pRect->left); - } - - for( pDestRow = pDest, pSrcRow = pSrc; dwHeight > 0; dwHeight--, pDestRow += ddsd2.lPitch, pSrcRow += srcPitch ) - { - for( dwCol = 0, pDest = pDestRow, pSrc = pSrcRow; dwCol < dwWidth; dwCol++ ) - { - dwColor = ( ((DWORD)(*pSrc * pTMObj->pixel.rScale)) << pTMObj->pixel.rShift ); - memcpy( pDest, &dwColor, pTMObj->pixel.cb ); - pDest += pTMObj->pixel.cb; - pSrc++; - } - } - } - else if ( pTMObj->dwFlags == DDPF_ALPHAPIXELS ) - { - srcPitch = dwWidth; - if ( pRect ) - { - pDest = ((UCHAR *)ddsd2.lpSurface) + (pRect->top * ddsd2.lPitch) + (pRect->left * pTMObj->pixel.cb); - pSrc = pixels + (pRect->top * dwWidth) + (pRect->left); - dwHeight = (pRect->bottom - pRect->top); - dwWidth = (pRect->right - pRect->left); - } - - for( pDestRow = pDest, pSrcRow = pSrc; dwHeight > 0; dwHeight--, pDestRow += ddsd2.lPitch, pSrcRow += srcPitch ) - { - for( dwCol = 0, pDest = pDestRow, pSrc = pSrcRow; dwCol < dwWidth; dwCol++ ) - { - if ( pTMObj->pixel.aScale == -1.0 ) - dwColor = ( (*pSrc & 0x80) ? (1 << pTMObj->pixel.aShift) : 0 ); - else - dwColor = ( ((DWORD)(*pSrc * pTMObj->pixel.aScale)) << pTMObj->pixel.aShift ); - memcpy( pDest, &dwColor, pTMObj->pixel.cb ); - pDest += pTMObj->pixel.cb; - pSrc++; - } - } - } - - /* Unlock the surface. */ - rc = lpDDS->Unlock( NULL ); - if ( FAILED(rc) ) - { - RIP( NULL, "Unlock (TEXTURE/SYSTEM)->", ErrorStringD3D(rc) ); - } -} -/*===========================================================================*/ -/* This function is the callback function that gets called when we are doing*/ -/* an enumeration of the texture formats supported by this device. The choice*/ -/* is made by checking to see if we have a match with the supplied D3D pixel-*/ -/* format. So the enumeration has to pass a desired D3D PF as the user var. */ -/*===========================================================================*/ -/* RETURN: D3DENUMRET_OK, D3DENUMRET_CANCEL. */ -/*===========================================================================*/ -HRESULT CALLBACK EnumPFHook( LPDDPIXELFORMAT lpDDPixFmt, LPVOID lpContext ) -{ - LPDDPIXELFORMAT lpDDPixFmtRequest = (LPDDPIXELFORMAT)lpContext; - PIXELINFO pixel; - - DPF(( DBG_FUNC, "EnumPFHook();" )); - - if ( lpDDPixFmt->dwFlags == lpDDPixFmtRequest->dwFlags ) - { - /* Are we looking for an alpha channel? */ - if ( lpDDPixFmtRequest->dwFlags & DDPF_ALPHAPIXELS ) - { - /* Try for something that has more then 1bits of Alpha. */ - Solve8BitChannelPixelFormat( lpDDPixFmt, &pixel ); - if ( pixel.aScale == -1.0 ) - { - /* Save this format no matter what as its a match of sorts. */ - memcpy( lpDDPixFmtRequest, lpDDPixFmt, sizeof(DDPIXELFORMAT) ); - return D3DENUMRET_OK; - } - } - - /* Save this format as its a good match. */ - memcpy( lpDDPixFmtRequest, lpDDPixFmt, sizeof(DDPIXELFORMAT) ); - - /* We are happy at this point so lets leave. */ - return D3DENUMRET_CANCEL; - } - - return D3DENUMRET_OK; -} - - diff --git a/src/mesa/drivers/d3d/D3DTextureMgr.h b/src/mesa/drivers/d3d/D3DTextureMgr.h deleted file mode 100644 index 8a64ceaaec..0000000000 --- a/src/mesa/drivers/d3d/D3DTextureMgr.h +++ /dev/null @@ -1,62 +0,0 @@ -/*===========================================================================*/ -/* */ -/* Mesa-3.0 DirectX 6 Driver */ -/* */ -/* By Leigh McRae */ -/* */ -/* http://www.altsoftware.com/ */ -/* */ -/* Copyright (c) 1999-1998 alt.software inc. All Rights Reserved */ -/*===========================================================================*/ -#ifndef _TEXTURE_MGR_INC -#define _TEXTURE_MGR_INC - -/*===========================================================================*/ -/* Includes. */ -/*===========================================================================*/ -#include -#include -#include -#include -#include -#include "GL/gl.h" -/*========================================================================*/ -/* Defines. */ -/*========================================================================*/ -/*========================================================================*/ -/* Type defines. */ -/*========================================================================*/ -typedef struct _local_texture_object -{ - DWORD dwName, - dwPriority, - dwFlags, - dwSWidth, - dwSHeight, - dwVWidth, - dwVHeight; - BOOL bLock, - bDirty; /* I only update VID on SubImage calls so the system */ - /* texture can get invalid. */ - - LPDIRECT3DDEVICE3 lpD3DDevice; /* If the device changes we must get new handles... */ - LPDIRECTDRAWSURFACE4 lpDDS_System, - lpDDS_Video; - LPDIRECT3DTEXTURE2 lpD3DTexture2; - - PIXELINFO pixel; - - struct _local_texture_object *next; - struct _local_texture_object *prev; - -} TM_OBJECT, *PTM_OBJECT; -/*========================================================================*/ -/* Function prototypes. */ -/*========================================================================*/ -void APIENTRY InitTMD3D( void *pVoid ); -void APIENTRY TermTMD3D( void *pVoid ); -/*========================================================================*/ -/* Global variables declaration. */ -/*========================================================================*/ - -#endif diff --git a/src/mesa/drivers/d3d/D3DUTILS.CPP b/src/mesa/drivers/d3d/D3DUTILS.CPP deleted file mode 100644 index 02664f96e4..0000000000 --- a/src/mesa/drivers/d3d/D3DUTILS.CPP +++ /dev/null @@ -1,638 +0,0 @@ -/*===========================================================================*/ -/* */ -/* Mesa-3.0 DirectX 6 Driver */ -/* */ -/* By Leigh McRae */ -/* */ -/* http://www.altsoftware.com/ */ -/* */ -/* Copyright (c) 1999-1998 alt.software inc. All Rights Reserved */ -/*===========================================================================*/ -#include "D3DHAL.h" -/*===========================================================================*/ -/* Local only functions. */ -/*===========================================================================*/ -static int CountTrailingZeros( DWORD dwMask ); -/*===========================================================================*/ -/* This function is used to get the pointer to the surface and the pitch for*/ -/* the scanline rendering functions. */ -/*===========================================================================*/ -/* RETURN: */ -/*===========================================================================*/ -extern "C" DDSURFACEDESC2 *LockHAL( PMESAD3DSHARED pShared, BOOL bBack ) -{ - PMESAD3DHAL pHAL = (PMESAD3DHAL)pShared; - static DDSURFACEDESC2 ddsd2; - HRESULT rc; - - DPF(( DBG_FUNC, "LockHAL();" )); - - /* Set the request structure up first. */ - memset( &ddsd2, 0, sizeof(DDSURFACEDESC2) ); - ddsd2.dwSize = sizeof(DDSURFACEDESC2); - - /* Make sure we have enough info. */ - if ( pHAL ) - { - rc = pHAL->lpDDSRender->Lock( NULL, &ddsd2, DDLOCK_WAIT, NULL ); - if ( FAILED(rc) ) - { - RIP( pHAL, "Lock (RENDER) ->", ErrorStringD3D(rc) ); - } - } - - return &ddsd2; -} -/*===========================================================================*/ -/* This is just a simple wrapper. I probably don't need to do any error */ -/* checking as the Lock must have worked inorder to get here... */ -/*===========================================================================*/ -/* RETURN: */ -/*===========================================================================*/ -extern "C" void UnlockHAL( PMESAD3DSHARED pShared, BOOL bBack ) -{ - PMESAD3DHAL pHAL = (PMESAD3DHAL)pShared; - HRESULT rc; - - DPF(( DBG_FUNC, "UnlockHAL();" )); - - /* Make sure we have enough info. */ - if ( pHAL ) - { - rc = pHAL->lpDDSRender->Unlock( NULL ); - if ( FAILED(rc) ) - { - RIP( pHAL, "Unlock (RENDER) ->", ErrorStringD3D(rc) ); - } - } -} -/*===========================================================================*/ -/* This function will track the main/Primary window that will be used as the*/ -/* target for the Blt in SwapBuffers. As a side effect the call will check */ -/* to see if the primary surface is the same size and position as the screen.*/ -/* If they are the same size we will call it fullscreen... */ -/*===========================================================================*/ -/* RETURN: */ -/*===========================================================================*/ -extern "C" void UpdateScreenPosHAL( PMESAD3DSHARED pShared ) -{ - PMESAD3DHAL pHAL = (PMESAD3DHAL)pShared; - POINT pt; - DWORD dwWidth, dwHeight; - - DPF(( DBG_FUNC, "UpdateScreenPosHAL();" )); - - /* Make sure we have enough info. */ - if ( pHAL != NULL ) - { - /* Update the windows screen position. */ - GetClientRect( pShared->hwnd, &pShared->rectW ); - pt.x = pt.y = 0; - ClientToScreen( pShared->hwnd, &pt ); - OffsetRect( &pShared->rectW, pt.x, pt.y); - - /* Compare the primary to the screen. */ - dwWidth = GetSystemMetrics( SM_CXSCREEN ); - dwHeight = GetSystemMetrics( SM_CYSCREEN ); - if ( (pShared->rectW.left > 0) || (pShared->rectW.top > 0) || - (pShared->rectW.right > dwWidth) || (pShared->rectW.bottom > dwHeight) ) - pShared->bWindow = TRUE; - else - pShared->bWindow = FALSE; - } -} -/*===========================================================================*/ -/* This function will fill in the pixel info structure defined in D3Dshared.*/ -/* Basicly it will take a DirectDraw pixelformat structure and make scaling */ -/* values that will convert from 8bit channels to whatever the supplied ddpf */ -/* uses. Also we will generate shift values that will be used to get move */ -/* each component of the pixel into place. */ -/* I have now added a special case for a 1bit alpha channel. If I find a 1b*/ -/* alpha then I will set the scale to -1.0 which should be unique. Later I */ -/* can check the alpha scale value too see if its -1.0 and thus handle it. I*/ -/* was finding that the case was not working tom my advantage so this is my */ -/* HACK for the day. As a TODO I should work on this... */ -/*===========================================================================*/ -/* RETURN: */ -/*===========================================================================*/ -void Solve8BitChannelPixelFormat( DDPIXELFORMAT *pddpf, PPIXELINFO pPixel ) -{ - DPF(( DBG_FUNC, "Solve8BitChannelPixelFromat();" )); - - memset( pPixel, 0, sizeof(PPIXELINFO) ); - - /* Check too see if the color space is valid in the PF. */ - if ( pddpf->dwFlags & DDPF_RGB ) - { - /* Solve the red stuff. */ - pPixel->dwRMask = pddpf->dwRBitMask; - pPixel->rShift = CountTrailingZeros( pPixel->dwRMask ); - pPixel->rScale = (float)0.00392156 * (float)(pPixel->dwRMask >> pPixel->rShift); - - /* Solve the green thingy's. */ - pPixel->dwGMask = pddpf->dwGBitMask; - pPixel->gShift = CountTrailingZeros( pPixel->dwGMask ); - pPixel->gScale = (float)0.00392156 * (float)(pPixel->dwGMask >> pPixel->gShift); - - /* Solve the blues. */ - pPixel->dwBMask = pddpf->dwBBitMask; - pPixel->bShift = CountTrailingZeros( pddpf->dwBBitMask ); - pPixel->bScale = (float)0.00392156 * (float)(pddpf->dwBBitMask >> pPixel->bShift); - } - - /* Do the alpha channel if there is one. */ - if ( pddpf->dwFlags & DDPF_ALPHAPIXELS ) - { - pPixel->dwAMask = pddpf->dwRGBAlphaBitMask; - pPixel->aShift = CountTrailingZeros( pPixel->dwAMask ); - - /* Special case a 1bit alpha. */ - if ( (pPixel->dwAMask >> pPixel->aShift) == 1 ) - pPixel->aScale = -1.0; - else - pPixel->aScale = (float)0.00392156 * (float)(pPixel->dwAMask >> pPixel->aShift); - } - - /* Get the size of the pixel in bytes. Should work as dwRGBBitCount is in a union. */ - pPixel->cb = pddpf->dwRGBBitCount / 8; -} -/*===========================================================================*/ -/* See RETURN :) */ -/*===========================================================================*/ -/* RETURN: number of contiguous zeros starting from the right. */ -/*===========================================================================*/ -static int CountTrailingZeros( DWORD dwMask ) -{ - DWORD Mask; - - if ( dwMask == 0 ) - return 32; - - /* Can't take credit for this one! */ - Mask = dwMask & -(int)dwMask; - return ((Mask & 0xFFFF0000)!=0) << 4 - | ((Mask & 0xFF00FF00)!=0) << 3 - | ((Mask & 0xF0F0F0F0)!=0) << 2 - | ((Mask & 0xCCCCCCCC)!=0) << 1 - | ((Mask & 0xAAAAAAAA)!=0); -} -/*===========================================================================*/ -/* This function will convert the DDraw error code to its macro string. The*/ -/* returned pointer is static so you need not worry about memory managemnet */ -/* but the error message gets written over from call to call... */ -/*===========================================================================*/ -/* RETURN: pointer to the single static buffer that hold the error message. */ -/*===========================================================================*/ -char *ErrorStringD3D( HRESULT hr ) -{ - static char errorString[128]; - - switch( hr ) - { - case DDERR_ALREADYINITIALIZED: - strcpy( errorString, "DDERR_ALREADYINITIALIZED" ); - break; - - case DDERR_CANNOTATTACHSURFACE: - strcpy( errorString, "DDERR_CANNOTATTACHSURFACE" ); - break; - - case DDERR_CANNOTDETACHSURFACE: - strcpy( errorString, "DDERR_CANNOTDETACHSURFACE" ); - break; - - case DDERR_CURRENTLYNOTAVAIL: - strcpy( errorString, "DDERR_CURRENTLYNOTAVAIL" ); - break; - - case DDERR_EXCEPTION: - strcpy( errorString, "DDERR_EXCEPTION" ); - break; - - case DDERR_GENERIC: - strcpy( errorString, "DDERR_GENERIC" ); - break; - - case DDERR_HEIGHTALIGN: - strcpy( errorString, "DDERR_HEIGHTALIGN" ); - break; - - case DDERR_INCOMPATIBLEPRIMARY: - strcpy( errorString, "DDERR_INCOMPATIBLEPRIMARY" ); - break; - - case DDERR_INVALIDCAPS: - strcpy( errorString, "DDERR_INVALIDCAPS" ); - break; - - case DDERR_INVALIDCLIPLIST: - strcpy( errorString, "DDERR_INVALIDCLIPLIST" ); - break; - - case DDERR_INVALIDMODE: - strcpy( errorString, "DDERR_INVALIDMODE" ); - break; - - case DDERR_INVALIDOBJECT: - strcpy( errorString, "DDERR_INVALIDOBJECT" ); - break; - - case DDERR_INVALIDPARAMS: - strcpy( errorString, "DDERR_INVALIDPARAMS" ); - break; - - case DDERR_INVALIDPIXELFORMAT: - strcpy( errorString, "DDERR_INVALIDPIXELFORMAT" ); - break; - - case DDERR_INVALIDRECT: - strcpy( errorString, "DDERR_INVALIDRECT" ); - break; - - case DDERR_LOCKEDSURFACES: - strcpy( errorString, "DDERR_LOCKEDSURFACES" ); - break; - - case DDERR_NO3D: - strcpy( errorString, "DDERR_NO3D" ); - break; - - case DDERR_NOALPHAHW: - strcpy( errorString, "DDERR_NOALPHAHW" ); - break; - - case DDERR_NOCLIPLIST: - strcpy( errorString, "DDERR_NOCLIPLIST" ); - break; - - case DDERR_NOCOLORCONVHW: - strcpy( errorString, "DDERR_NOCOLORCONVHW" ); - break; - - case DDERR_NOCOOPERATIVELEVELSET: - strcpy( errorString, "DDERR_NOCOOPERATIVELEVELSET" ); - break; - - case DDERR_NOCOLORKEY: - strcpy( errorString, "DDERR_NOCOLORKEY" ); - break; - - case DDERR_NOCOLORKEYHW: - strcpy( errorString, "DDERR_NOCOLORKEYHW" ); - break; - - case DDERR_NODIRECTDRAWSUPPORT: - strcpy( errorString, "DDERR_NODIRECTDRAWSUPPORT" ); - break; - - case DDERR_NOEXCLUSIVEMODE: - strcpy( errorString, "DDERR_NOEXCLUSIVEMODE" ); - break; - - case DDERR_NOFLIPHW: - strcpy( errorString, "DDERR_NOFLIPHW" ); - break; - - case DDERR_NOGDI: - strcpy( errorString, "DDERR_NOGDI" ); - break; - - case DDERR_NOMIRRORHW: - strcpy( errorString, "DDERR_NOMIRRORHW" ); - break; - - case DDERR_NOTFOUND: - strcpy( errorString, "DDERR_NOTFOUND" ); - break; - - case DDERR_NOOVERLAYHW: - strcpy( errorString, "DDERR_NOOVERLAYHW" ); - break; - - case DDERR_OVERLAPPINGRECTS: - strcpy( errorString, "DDERR_OVERLAPPINGRECTS" ); - break; - - case DDERR_NORASTEROPHW: - strcpy( errorString, "DDERR_NORASTEROPHW" ); - break; - - case DDERR_NOROTATIONHW: - strcpy( errorString, "DDERR_NOROTATIONHW" ); - break; - - case DDERR_NOSTRETCHHW: - strcpy( errorString, "DDERR_NOSTRETCHHW" ); - break; - - case DDERR_NOT4BITCOLOR: - strcpy( errorString, "DDERR_NOT4BITCOLOR" ); - break; - - case DDERR_NOT4BITCOLORINDEX: - strcpy( errorString, "DDERR_NOT4BITCOLORINDEX" ); - break; - - case DDERR_NOT8BITCOLOR: - strcpy( errorString, "DDERR_NOT8BITCOLOR" ); - break; - - case DDERR_NOTEXTUREHW: - strcpy( errorString, "DDERR_NOTEXTUREHW" ); - break; - - case DDERR_NOVSYNCHW: - strcpy( errorString, "DDERR_NOVSYNCHW" ); - break; - - case DDERR_NOZBUFFERHW: - strcpy( errorString, "DDERR_NOZBUFFERHW" ); - break; - - case DDERR_NOZOVERLAYHW: - strcpy( errorString, "DDERR_NOZOVERLAYHW" ); - break; - - case DDERR_OUTOFCAPS: - strcpy( errorString, "DDERR_OUTOFCAPS" ); - break; - - case DDERR_OUTOFMEMORY: - strcpy( errorString, "DDERR_OUTOFMEMORY" ); - break; - - case DDERR_OUTOFVIDEOMEMORY: - strcpy( errorString, "DDERR_OUTOFVIDEOMEMORY" ); - break; - - case DDERR_OVERLAYCANTCLIP: - strcpy( errorString, "DDERR_OVERLAYCANTCLIP" ); - break; - - case DDERR_OVERLAYCOLORKEYONLYONEACTIVE: - strcpy( errorString, "DDERR_OVERLAYCOLORKEYONLYONEACTIVE" ); - break; - - case DDERR_PALETTEBUSY: - strcpy( errorString, "DDERR_PALETTEBUSY" ); - break; - - case DDERR_COLORKEYNOTSET: - strcpy( errorString, "DDERR_COLORKEYNOTSET" ); - break; - - case DDERR_SURFACEALREADYATTACHED: - strcpy( errorString, "DDERR_SURFACEALREADYATTACHED" ); - break; - - case DDERR_SURFACEALREADYDEPENDENT: - strcpy( errorString, "DDERR_SURFACEALREADYDEPENDENT" ); - break; - - case DDERR_SURFACEBUSY: - strcpy( errorString, "DDERR_SURFACEBUSY" ); - break; - - case DDERR_CANTLOCKSURFACE: - strcpy( errorString, "DDERR_CANTLOCKSURFACE" ); - break; - - case DDERR_SURFACEISOBSCURED: - strcpy( errorString, "DDERR_SURFACEISOBSCURED" ); - break; - - case DDERR_SURFACELOST: - strcpy( errorString, "DDERR_SURFACELOST" ); - break; - - case DDERR_SURFACENOTATTACHED: - strcpy( errorString, "DDERR_SURFACENOTATTACHED" ); - break; - - case DDERR_TOOBIGHEIGHT: - strcpy( errorString, "DDERR_TOOBIGHEIGHT" ); - break; - - case DDERR_TOOBIGSIZE: - strcpy( errorString, "DDERR_TOOBIGSIZE" ); - break; - - case DDERR_TOOBIGWIDTH: - strcpy( errorString, "DDERR_TOOBIGWIDTH" ); - break; - - case DDERR_UNSUPPORTED: - strcpy( errorString, "DDERR_UNSUPPORTED" ); - break; - - case DDERR_UNSUPPORTEDFORMAT: - strcpy( errorString, "DDERR_UNSUPPORTEDFORMAT" ); - break; - - case DDERR_UNSUPPORTEDMASK: - strcpy( errorString, "DDERR_UNSUPPORTEDMASK" ); - break; - - case DDERR_INVALIDSTREAM: - strcpy( errorString, "DDERR_INVALIDSTREAM" ); - break; - - case DDERR_VERTICALBLANKINPROGRESS: - strcpy( errorString, "DDERR_VERTICALBLANKINPROGRESS" ); - break; - - case DDERR_WASSTILLDRAWING: - strcpy( errorString, "DDERR_WASSTILLDRAWING" ); - break; - - case DDERR_XALIGN: - strcpy( errorString, "DDERR_XALIGN" ); - break; - - case DDERR_INVALIDDIRECTDRAWGUID: - strcpy( errorString, "DDERR_INVALIDDIRECTDRAWGUID" ); - break; - - case DDERR_DIRECTDRAWALREADYCREATED: - strcpy( errorString, "DDERR_DIRECTDRAWALREADYCREATED" ); - break; - - case DDERR_NODIRECTDRAWHW: - strcpy( errorString, "DDERR_NODIRECTDRAWHW" ); - break; - - case DDERR_PRIMARYSURFACEALREADYEXISTS: - strcpy( errorString, "DDERR_PRIMARYSURFACEALREADYEXISTS" ); - break; - - case DDERR_NOEMULATION: - strcpy( errorString, "DDERR_NOEMULATION" ); - break; - - case DDERR_REGIONTOOSMALL: - strcpy( errorString, "DDERR_REGIONTOOSMALL" ); - break; - - case DDERR_CLIPPERISUSINGHWND: - strcpy( errorString, "DDERR_CLIPPERISUSINGHWND" ); - break; - - case DDERR_NOCLIPPERATTACHED: - strcpy( errorString, "DDERR_NOCLIPPERATTACHED" ); - break; - - case DDERR_NOHWND: - strcpy( errorString, "DDERR_NOHWND" ); - break; - - case DDERR_HWNDSUBCLASSED: - strcpy( errorString, "DDERR_HWNDSUBCLASSED" ); - break; - - case DDERR_HWNDALREADYSET: - strcpy( errorString, "DDERR_HWNDALREADYSET" ); - break; - - case DDERR_NOPALETTEATTACHED: - strcpy( errorString, "DDERR_NOPALETTEATTACHED" ); - break; - - case DDERR_NOPALETTEHW: - strcpy( errorString, "DDERR_NOPALETTEHW" ); - break; - - case DDERR_BLTFASTCANTCLIP: - strcpy( errorString, "DDERR_BLTFASTCANTCLIP" ); - break; - - case DDERR_NOBLTHW: - strcpy( errorString, "DDERR_NOBLTHW" ); - break; - - case DDERR_NODDROPSHW: - strcpy( errorString, "DDERR_NODDROPSHW" ); - break; - - case DDERR_OVERLAYNOTVISIBLE: - strcpy( errorString, "DDERR_OVERLAYNOTVISIBLE" ); - break; - - case DDERR_NOOVERLAYDEST: - strcpy( errorString, "DDERR_NOOVERLAYDEST" ); - break; - - case DDERR_INVALIDPOSITION: - strcpy( errorString, "DDERR_INVALIDPOSITION" ); - break; - - case DDERR_NOTAOVERLAYSURFACE: - strcpy( errorString, "DDERR_NOTAOVERLAYSURFACE" ); - break; - - case DDERR_EXCLUSIVEMODEALREADYSET: - strcpy( errorString, "DDERR_EXCLUSIVEMODEALREADYSET" ); - break; - - case DDERR_NOTFLIPPABLE: - strcpy( errorString, "DDERR_NOTFLIPPABLE" ); - break; - - case DDERR_CANTDUPLICATE: - strcpy( errorString, "DDERR_CANTDUPLICATE" ); - break; - - case DDERR_NOTLOCKED: - strcpy( errorString, "DDERR_NOTLOCKED" ); - break; - - case DDERR_CANTCREATEDC: - strcpy( errorString, "DDERR_CANTCREATEDC" ); - break; - - case DDERR_NODC: - strcpy( errorString, "DDERR_NODC" ); - break; - - case DDERR_WRONGMODE: - strcpy( errorString, "DDERR_WRONGMODE" ); - break; - - case DDERR_IMPLICITLYCREATED: - strcpy( errorString, "DDERR_IMPLICITLYCREATED" ); - break; - - case DDERR_NOTPALETTIZED: - strcpy( errorString, "DDERR_NOTPALETTIZED" ); - break; - - case DDERR_UNSUPPORTEDMODE: - strcpy( errorString, "DDERR_UNSUPPORTEDMODE" ); - break; - - case DDERR_NOMIPMAPHW: - strcpy( errorString, "DDERR_NOMIPMAPHW" ); - break; - - case DDERR_INVALIDSURFACETYPE: - strcpy( errorString, "DDERR_INVALIDSURFACETYPE" ); - break; - - case DDERR_NOOPTIMIZEHW: - strcpy( errorString, "DDERR_NOOPTIMIZEHW" ); - break; - - case DDERR_NOTLOADED: - strcpy( errorString, "DDERR_NOTLOADED" ); - break; - - case DDERR_NOFOCUSWINDOW: - strcpy( errorString, "DDERR_NOFOCUSWINDOW" ); - break; - - case DDERR_DCALREADYCREATED: - strcpy( errorString, "DDERR_DCALREADYCREATED" ); - break; - - case DDERR_NONONLOCALVIDMEM: - strcpy( errorString, "DDERR_NONONLOCALVIDMEM" ); - break; - - case DDERR_CANTPAGELOCK: - strcpy( errorString, "DDERR_CANTPAGELOCK" ); - break; - - case DDERR_CANTPAGEUNLOCK: - strcpy( errorString, "DDERR_CANTPAGEUNLOCK" ); - break; - - case DDERR_NOTPAGELOCKED: - strcpy( errorString, "DDERR_NOTPAGELOCKED" ); - break; - - case DDERR_MOREDATA: - strcpy( errorString, "DDERR_MOREDATA" ); - break; - - case DDERR_EXPIRED: - strcpy( errorString, "DDERR_EXPIRED" ); - break; - - case DDERR_VIDEONOTACTIVE: - strcpy( errorString, "DDERR_VIDEONOTACTIVE" ); - break; - - case DDERR_DEVICEDOESNTOWNSURFACE: - strcpy( errorString, "DDERR_DEVICEDOESNTOWNSURFACE" ); - break; - - case DDERR_NOTINITIALIZED: - strcpy( errorString, "DDERR_NOTINITIALIZED" ); - break; - - default: - strcpy( errorString, "" ); - break; - } - - return &errorString[0]; -} diff --git a/src/mesa/drivers/d3d/D3Dvbrender.c b/src/mesa/drivers/d3d/D3Dvbrender.c deleted file mode 100644 index 09857f1dc8..0000000000 --- a/src/mesa/drivers/d3d/D3Dvbrender.c +++ /dev/null @@ -1,2149 +0,0 @@ -/*===========================================================================*/ -/* */ -/* Mesa-3.0 DirectX 6 Driver */ -/* */ -/* By Leigh McRae */ -/* */ -/* http://www.altsoftware.com/ */ -/* */ -/* Copyright (c) 1999-1998 alt.software inc. All Rights Reserved */ -/*===========================================================================*/ -#include -#include "clip.h" -#include "context.h" -#include "light.h" -#include "lines.h" -#include "macros.h" -#include "matrix.h" -#include "pb.h" -#include "points.h" -#include "mtypes.h" -#include "vb.h" -#include "vbrender.h" -#include "xform.h" -#include "D3DMesa.h" - -static void SetRenderStates( GLcontext *ctx ); -static void DebugRenderStates( GLcontext *ctx, BOOL bForce ); - -static void RenderPointsVB( GLcontext *ctx, GLuint start, GLuint end ); -static void RenderTriangleVB( GLcontext *ctx, GLuint start, GLuint end ); -static void RenderTriangleFanVB( GLcontext *ctx, GLuint start, GLuint end ); -static void RenderTriangleStripVB( GLcontext *ctx, GLuint start, GLuint end ); -static void RenderQuadVB( GLcontext *ctx, GLuint start, GLuint end ); -static void RenderQuad( GLcontext *ctx, GLuint v1, GLuint v2, GLuint v3, GLuint v4, GLuint pv ); -void RenderOneTriangle( GLcontext *ctx, GLuint v1, GLuint v2, GLuint v3, GLuint pv ); -void RenderOneLine( GLcontext *ctx, GLuint v1, GLuint v2, GLuint pv ); - -/* I went with a D3D vertex buffer that is 6 times that of the Mesa one */ -/* instead of having the D3D one flush when its full. This way Mesa will*/ -/* handle all the flushing. I need x6 as points can use 4 vertex each. */ -D3DTLVERTEX D3DTLVertices[ (VB_MAX*6) ]; -GLuint VList[VB_SIZE]; -/*===========================================================================*/ -/* Compute Z offsets for a polygon with plane defined by (A,B,C,D) */ -/* D is not needed. TODO: Currently we are calculating this but not using it.*/ -/*===========================================================================*/ -/* RETURN: */ -/*===========================================================================*/ -static void OffsetPolygon( GLcontext *ctx, GLfloat a, GLfloat b, GLfloat c ) -{ - GLfloat ac, - bc, - m, - offset; - - DPF(( DBG_FUNC, "OffsetPolygon();" )); - - if ( (c < 0.001F) && (c > - 0.001F) ) - { - /* Prevents underflow problems. */ - ctx->PointZoffset = 0.0F; - ctx->LineZoffset = 0.0F; - ctx->PolygonZoffset = 0.0F; - } - else - { - ac = a / c; - bc = b / c; - if ( ac < 0.0F ) - ac = -ac; - if ( bc<0.0F ) - bc = -bc; - m = MAX2( ac, bc ); /* m = sqrt( ac*ac + bc*bc ); */ - - offset = (m * ctx->Polygon.OffsetFactor + ctx->Polygon.OffsetUnits); - ctx->PointZoffset = ctx->Polygon.OffsetPoint ? offset : 0.0F; - ctx->LineZoffset = ctx->Polygon.OffsetLine ? offset : 0.0F; - ctx->PolygonZoffset = ctx->Polygon.OffsetFill ? offset : 0.0F; - } - - DPF(( DBG_PRIM_INFO, "OffsetPolygon: %f", offset )); -} -/*===========================================================================*/ -/* Compute signed area of the n-sided polgyon specified by vertices */ -/* vb->Win[] and vertex list vlist[]. */ -/* A clockwise polygon will return a negative area. A counter-clockwise */ -/* polygon will return a positive area. I have changed this function to */ -/* actually calculate twice the area as its faster and still gives the sign. */ -/*===========================================================================*/ -/* RETURN: signed area of the polgon. */ -/*===========================================================================*/ -static GLfloat PolygonArea( const struct vertex_buffer *vb, GLuint n, const GLuint vlist[] ) -{ - GLfloat area; - GLuint i; - - DPF(( DBG_FUNC, "PolygonArea();" )); - -#define j0 vlist[i] -#define j1 vlist[(i+1)%n] -#define x0 vb->Win[j0][0] -#define y0 vb->Win[j0][1] -#define x1 vb->Win[j1][0] -#define y1 vb->Win[j1][1] - - /* area = sum of trapezoids */ - for( i = 0, area = 0.0; i < n; i++ ) - area += ((x0 - x1) * (y0 + y1)); /* Note: no divide by two here! */ - -#undef x0 -#undef y0 -#undef x1 -#undef y1 -#undef j1 -#undef j0 - - // TODO: I don't see the point or * 0.5 as we just want the sign... - return area; -} -/*===========================================================================*/ -/* Render a polygon that needs clipping on at least one vertex. The function*/ -/* will first clip the polygon to any user clipping planes then clip to the */ -/* viewing volume. The final polygon will be draw as single triangles that */ -/* first need minor proccessing (culling, offset, etc) before we draw the */ -/* polygon as a fan. NOTE: the fan is draw as single triangles as its not */ -/* formed sequentaly in the VB but is in the vlist[]. */ -/*===========================================================================*/ -/* RETURN: */ -/*===========================================================================*/ -static void RenderClippedPolygon( GLcontext *ctx, GLuint n, GLuint vlist[] ) -{ - struct vertex_buffer *VB = ctx->VB; - GLfloat (*win)[3] = VB->Win, - *proj = ctx->ProjectionMatrix, - ex, ey, - fx, fy, c, - wInv; - GLuint index, - pv, - facing; - - DPF(( DBG_FUNC, "RenderClippedPolygon();" )); - - DPF(( DBG_PRIM_INFO, "RenderClippedtPolygon( %d )", n )); - - /* Which vertex dictates the color when flat shading. */ - pv = (ctx->Primitive==GL_POLYGON) ? vlist[0] : vlist[n-1]; - - /* Clipping may introduce new vertices. New vertices will be stored in */ - /* the vertex buffer arrays starting with location VB->Free. After we've*/ - /* rendered the polygon, these extra vertices can be overwritten. */ - VB->Free = VB_MAX; - - /* Clip against user clipping planes in eye coord space. */ - if ( ctx->Transform.AnyClip ) - { - n = gl_userclip_polygon( ctx, n, vlist ); - if ( n < 3 ) - return; - - /* Transform vertices from eye to clip coordinates: clip = Proj * eye */ - for( index = 0; index < n; index++ ) - { - TRANSFORM_POINT( VB->Clip[vlist[index]], proj, VB->Eye[vlist[index]] ); - } - } - - /* Clip against view volume in clip coord space */ - n = gl_viewclip_polygon( ctx, n, vlist ); - if ( n < 3 ) - return; - - /* Transform new vertices from clip to ndc to window coords. */ - /* ndc = clip / W window = viewport_mapping(ndc) */ - /* Note that window Z values are scaled to the range of integer */ - /* depth buffer values. */ - - /* Only need to compute window coords for new vertices */ - for( index = VB_MAX; index < VB->Free; index++ ) - { - if ( VB->Clip[index][3] != 0.0F ) - { - wInv = 1.0F / VB->Clip[index][3]; - - win[index][0] = VB->Clip[index][0] * wInv * ctx->Viewport.Sx + ctx->Viewport.Tx; - win[index][1] = VB->Clip[index][1] * wInv * ctx->Viewport.Sy + ctx->Viewport.Ty; - win[index][2] = VB->Clip[index][2] * wInv * ctx->Viewport.Sz + ctx->Viewport.Tz; - } - else - { - /* Can't divide by zero, so... */ - win[index][0] = win[index][1] = win[index][2] = 0.0F; - } - } - - /* Draw filled polygon as a triangle fan */ - for( index = 2; index < n; index++ ) - { - /* Compute orientation of triangle */ - ex = win[vlist[index-1]][0] - win[vlist[0]][0]; - ey = win[vlist[index-1]][1] - win[vlist[0]][1]; - fx = win[vlist[index]][0] - win[vlist[0]][0]; - fy = win[vlist[index]][1] - win[vlist[0]][1]; - c = (ex * fy) - (ey * fx); - - /* polygon is perpindicular to view plane, don't draw it */ - if ( (c == 0.0F) && !ctx->Polygon.Unfilled ) - continue; - - /* Backface culling. */ - facing = (c < 0.0F) ^ ctx->Polygon.FrontBit; - if ( (facing + 1) & ctx->Polygon.CullBits ) - continue; - - if ( ctx->IndirectTriangles & DD_TRI_LIGHT_TWOSIDE ) - { - if ( facing == 1 ) - { - /* use back color */ - VB->Color = VB->Bcolor; - VB->Specular= VB->Bspec; - } - else - { - /* use front color */ - VB->Color = VB->Fcolor; - VB->Specular= VB->Fspec; - } - } - - if ( ctx->IndirectTriangles & DD_TRI_OFFSET ) - { - /* finish computing plane equation of polygon, compute offset */ - GLfloat fz = win[vlist[index]][2] - win[vlist[0]][2]; - GLfloat ez = win[vlist[index-1]][2] - win[vlist[0]][2]; - GLfloat a = (ey * fz) - (ez * fy); - GLfloat b = (ez * fx) - (ex * fz); - OffsetPolygon( ctx, a, b, c ); - } - RenderOneTriangle( ctx, vlist[0], vlist[index-1], vlist[index], pv ); - } -} -/*===========================================================================*/ -/* This function gets called when either the vertex buffer is full or glEnd */ -/* has been called. If the we aren't in rendering mode (FEEDBACK) then I */ -/* pass the vertex buffer back to Mesa to deal with by returning FALSE. */ -/* If I can render the primitive types in the buffer directly then I will */ -/* return TRUE after I render the vertex buffer and reset the vertex buffer. */ -/* */ -/* TODO: I don't handle the special case of when the vertex buffer is full */ -/* and we have a primitive that bounds this buffer and the next one to */ -/* come. I'm not sure right now if Mesa handles this for me... */ -/*===========================================================================*/ -/* RETURN: TRUE, FALSE. */ -/*===========================================================================*/ -GLboolean RenderVertexBuffer( GLcontext *ctx, GLboolean allDone ) -{ - struct vertex_buffer *VB = ctx->VB; - GLuint index, - vlist[VB_SIZE]; - - DPF(( DBG_FUNC, "RenderVertexBuffer();" )); - - /* We only need to hook actual tri's that need rendering. */ - if ( ctx->RenderMode != GL_RENDER ) - { - // (ctx->Visual->AccumBits > 0) ) - // (ctx->Visual->StencilBits > 0) ) - DPF(( DBG_PRIM_INFO, "Passing VB back to Mesa" )); - return FALSE; - } - - /* I'm going to set the states here so that all functions will */ - /* be assured to have the right states. If Mesa's vertex bufefr */ - /* function calls one of my primitive functions (TRI,POINT,LINE) */ - /* it will need the right states. So instead of doing it in the */ - /* primitive function I will always do it here at risk of some */ - /* slow down to some cases... */ - SetRenderStates( ctx ); - - switch( ctx->Primitive ) - { - case GL_POINTS: - DPF(( DBG_PRIM_INFO, "GL_POINTS( %d )", VB->Count )); - RenderPointsVB( ctx, 0, VB->Count ); - break; - - case GL_LINES: - case GL_LINE_STRIP: - case GL_LINE_LOOP: - /* Not supported functions yet so pass back that we failed to */ - /* render the vertex buffer and Mesa will have to do it. */ - DPF(( DBG_PRIM_INFO, "GL_LINE_?( %d )", VB->Count )); - return FALSE; - - case GL_TRIANGLES: - if ( VB->Count < 3 ) - { - DPF(( DBG_PRIM_WARN, "GL_TRIANGLES( %d )", VB->Count )); - return FALSE; - } - - DPF(( DBG_PRIM_INFO, "GL_TRIANGLES( %d )", VB->Count )); - RenderTriangleVB( ctx, 0, VB->Count ); - break; - - case GL_TRIANGLE_STRIP: - if ( VB->Count < 3 ) - { - DPF(( DBG_PRIM_WARN, "GL_TRIANGLE_STRIP( %d )", VB->Count )); - return FALSE; - } - - DPF(( DBG_PRIM_INFO, "GL_TRIANGLE_STRIP( %d )", VB->Count )); - RenderTriangleStripVB( ctx, 0, VB->Count ); - break; - - case GL_TRIANGLE_FAN: - if ( VB->Count < 3 ) - { - DPF(( DBG_PRIM_WARN, "GL_TRIANGLE_FAN( %d )", VB->Count )); - return FALSE; - } - - DPF(( DBG_PRIM_INFO, "GL_TRIANGLE_FAN( %d )", VB->Count )); - RenderTriangleFanVB( ctx, 0, VB->Count ); - break; - - case GL_QUADS: - if ( VB->Count < 4 ) - { - DPF(( DBG_PRIM_WARN, "GL_QUADS( %d )", VB->Count )); - return FALSE; - } - - DPF(( DBG_PRIM_INFO, "GL_QUADS( %d )", VB->Count )); - RenderQuadVB( ctx, 0, VB->Count ); - break; - - case GL_QUAD_STRIP: - if ( VB->Count < 4 ) - { - DPF(( DBG_PRIM_WARN, "GL_QUAD_STRIP( %d )", VB->Count )); - return FALSE; - } - - DPF(( DBG_PRIM_INFO, "GL_QUAD_STRIP( %d )", VB->Count )); - - if ( VB->ClipOrMask ) - { - for( index = 3; index < VB->Count; index += 2 ) - { - if ( VB->ClipMask[index-3] & VB->ClipMask[index-2] & VB->ClipMask[index-1] & VB->ClipMask[index] & CLIP_ALL_BITS ) - { - /* All points clipped by common plane */ - DPF(( DBG_PRIM_WARN, "GL_QUAD_STRIP( %d )", VB->Count )); - continue; - } - else if ( VB->ClipMask[index-3] | VB->ClipMask[index-2] | VB->ClipMask[index-1] | VB->ClipMask[index] ) - { - vlist[0] = index - 3; - vlist[1] = index - 2; - vlist[2] = index; - vlist[3] = index - 1; - RenderClippedPolygon( ctx, 4, vlist ); - } - else - { - RenderQuad( ctx, (index-3), (index-2), index, (index-1), index ); - } - } - } - else - { - /* No clipping needed */ - for( index = 3; index < VB->Count; index += 2 ) - RenderQuad( ctx, (index-3), (index-2), index, (index-1), index ); - } - break; - - case GL_POLYGON: - if ( VB->Count < 3 ) - { - DPF(( DBG_PRIM_WARN, "GL_POLYGON( %d )", VB->Count )); - return FALSE; - } - - DPF(( DBG_PRIM_INFO, "GL_POLYGON( %d )", VB->Count )); - - /* All points clipped by common plane, draw nothing */ - if ( !(VB->ClipAndMask & CLIP_ALL_BITS) ) - RenderTriangleFanVB( ctx, 0, VB->Count ); - break; - - default: - /* should never get here */ - _mesa_problem( ctx, "invalid mode in gl_render_vb" ); - } - - DPF(( DBG_PRIM_INFO, "ResetVB" )); - - /* We return TRUE to indicate we rendered the VB. */ - gl_reset_vb( ctx, allDone ); - return TRUE; -} -/*===========================================================================*/ -/* This function will render the current vertex buffer as triangles. The */ -/* buffer has to be able to be rendered directly. This means that we are */ -/* filled, no offsets, no culling and one sided rendering. Also we must be */ -/* in render mode of course. */ -/* First I will fill the global D3D vertice buffer. Next I will set all the*/ -/* states for D3D based on the current OGL state. Finally I pass the D3D VB */ -/* to the wrapper that call DrawPrimitives. */ -/*===========================================================================*/ -/* RETURN: */ -/*===========================================================================*/ -static void RenderTriangleVB( GLcontext *ctx, GLuint start, GLuint end ) -{ - D3DMESACONTEXT *pContext = (D3DMESACONTEXT *)ctx->DriverCtx; - struct vertex_buffer *VB = ctx->VB; - int index, - cVertex, - height = (pContext->pShared->rectW.bottom - pContext->pShared->rectW.top); - DWORD dwPVColor; - GLfloat ex, ey, - fx, fy, c; - GLuint facing; - - DPF(( DBG_FUNC, "RenderTriangleVB" )); - - if ( !VB->ClipOrMask ) - { - DPF(( DBG_PRIM_INFO, "DirectTriangles( %d )", (end-start) )); - for( index = start, cVertex = 0; index < end; ) - { - dwPVColor = (VB->Color[(index+2)][3]<<24) | (VB->Color[(index+2)][0]<<16) | (VB->Color[(index+2)][1]<<8) | VB->Color[(index+2)][2]; - - /*=====================================*/ - /* Populate the the triangle vertices. */ - /*=====================================*/ - D3DTLVertices[cVertex].sx = D3DVAL( VB->Win[index][0] ); - D3DTLVertices[cVertex].sy = D3DVAL( (height - VB->Win[index][1]) ); - D3DTLVertices[cVertex].sz = D3DVAL( VB->Win[index][2] ); - D3DTLVertices[cVertex].tu = D3DVAL( VB->TexCoord[index][0] ); - D3DTLVertices[cVertex].tv = D3DVAL( VB->TexCoord[index][1] ); - D3DTLVertices[cVertex].rhw = D3DVAL( (1.0 / VB->Clip[index][3]) ); - D3DTLVertices[cVertex++].color= (ctx->Light.ShadeModel == GL_FLAT) ? - dwPVColor : - (VB->Color[index][3]<<24) | (VB->Color[index][0]<<16) | (VB->Color[index][1]<<8) | VB->Color[index][2]; - index++; - - D3DTLVertices[cVertex].sx = D3DVAL( VB->Win[index][0] ); - D3DTLVertices[cVertex].sy = D3DVAL( (height - VB->Win[index][1]) ); - D3DTLVertices[cVertex].sz = D3DVAL( VB->Win[index][2] ); - D3DTLVertices[cVertex].tu = D3DVAL( VB->TexCoord[index][0] ); - D3DTLVertices[cVertex].tv = D3DVAL( VB->TexCoord[index][1] ); - D3DTLVertices[cVertex].rhw = D3DVAL( (1.0 / VB->Clip[index][3]) ); - D3DTLVertices[cVertex++].color= (ctx->Light.ShadeModel == GL_FLAT) ? - dwPVColor : - (VB->Color[index][3]<<24) | (VB->Color[index][0]<<16) | (VB->Color[index][1]<<8) | VB->Color[index][2]; - index++; - - D3DTLVertices[cVertex].sx = D3DVAL( VB->Win[index][0] ); - D3DTLVertices[cVertex].sy = D3DVAL( (height - VB->Win[index][1]) ); - D3DTLVertices[cVertex].sz = D3DVAL( VB->Win[index][2] ); - D3DTLVertices[cVertex].tu = D3DVAL( VB->TexCoord[index][0] ); - D3DTLVertices[cVertex].tv = D3DVAL( VB->TexCoord[index][1] ); - D3DTLVertices[cVertex].rhw = D3DVAL( (1.0 / VB->Clip[index][3]) ); - D3DTLVertices[cVertex++].color= dwPVColor; - index++; - } - } - else - { -#define v1 index -#define v2 (index+1) -#define v3 (index+2) - - for( index = start, cVertex = 0; index < end; index += 3 ) - { - if ( VB->ClipMask[v1] & VB->ClipMask[v2] & VB->ClipMask[v3] & CLIP_ALL_BITS ) - { - continue; - } - else if ( VB->ClipMask[v1] | VB->ClipMask[v2] | VB->ClipMask[v3] ) - { - VList[0] = v1; - VList[1] = v2; - VList[2] = v3; - RenderClippedPolygon( ctx, 3, VList ); - continue; - } - - /* Compute orientation of triangle */ - ex = VB->Win[v2][0] - VB->Win[v1][0]; - ey = VB->Win[v2][1] - VB->Win[v1][1]; - fx = VB->Win[v3][0] - VB->Win[v1][0]; - fy = VB->Win[v3][1] - VB->Win[v1][1]; - c = (ex * fy) - (ey * fx); - - /* polygon is perpindicular to view plane, don't draw it */ - if ( (c == 0.0F) && !ctx->Polygon.Unfilled ) - continue; - - /* Backface culling. */ - facing = (c < 0.0F) ^ ctx->Polygon.FrontBit; - if ( (facing + 1) & ctx->Polygon.CullBits ) - continue; - - if ( ctx->IndirectTriangles & DD_TRI_LIGHT_TWOSIDE ) - { - if ( facing == 1 ) - { - /* use back color */ - VB->Color = VB->Bcolor; - VB->Specular= VB->Bspec; - } - else - { - /* use front color */ - VB->Color = VB->Fcolor; - VB->Specular= VB->Fspec; - } - } - - if ( ctx->IndirectTriangles & DD_TRI_OFFSET ) - { - /* Finish computing plane equation of polygon, compute offset */ - GLfloat fz = VB->Win[v3][2] - VB->Win[v1][2]; - GLfloat ez = VB->Win[v2][2] - VB->Win[v1][2]; - GLfloat a = (ey * fz) - (ez * fy); - GLfloat b = (ez * fx) - (ex * fz); - OffsetPolygon( ctx, a, b, c ); - } - - /*=====================================*/ - /* Populate the the triangle vertices. */ - /*=====================================*/ - /* Solve the prevoking vertex color as we need it for the 3rd triangle and flat shading. */ - dwPVColor = (VB->Color[v3][3]<<24) | (VB->Color[v3][0]<<16) | (VB->Color[v3][1]<<8) | VB->Color[v3][2]; - - D3DTLVertices[cVertex].sx = D3DVAL( VB->Win[v1][0] ); - D3DTLVertices[cVertex].sy = D3DVAL( (height - VB->Win[v1][1]) ); - D3DTLVertices[cVertex].sz = D3DVAL( (VB->Win[v1][2] + ctx->PolygonZoffset) ); - D3DTLVertices[cVertex].tu = D3DVAL( VB->TexCoord[v1][0] ); - D3DTLVertices[cVertex].tv = D3DVAL( VB->TexCoord[v1][1] ); - D3DTLVertices[cVertex].rhw = D3DVAL( (1.0 / VB->Clip[v1][3]) ); - D3DTLVertices[cVertex++].color= (ctx->Light.ShadeModel == GL_FLAT) ? - dwPVColor : - (VB->Color[v1][3]<<24) | (VB->Color[v1][0]<<16) | (VB->Color[v1][1]<<8) | VB->Color[v1][2]; - - D3DTLVertices[cVertex].sx = D3DVAL( VB->Win[v2][0] ); - D3DTLVertices[cVertex].sy = D3DVAL( (height - VB->Win[v2][1]) ); - D3DTLVertices[cVertex].sz = D3DVAL( (VB->Win[v2][2] + ctx->PolygonZoffset) ); - D3DTLVertices[cVertex].tu = D3DVAL( VB->TexCoord[v2][0] ); - D3DTLVertices[cVertex].tv = D3DVAL( VB->TexCoord[v2][1] ); - D3DTLVertices[cVertex].rhw = D3DVAL( (1.0 / VB->Clip[v2][3]) ); - D3DTLVertices[cVertex++].color= (ctx->Light.ShadeModel == GL_FLAT) ? - dwPVColor : - (VB->Color[v2][3]<<24) | (VB->Color[v2][0]<<16) | (VB->Color[v2][1]<<8) | VB->Color[v2][2]; - - D3DTLVertices[cVertex].sx = D3DVAL( VB->Win[v3][0] ); - D3DTLVertices[cVertex].sy = D3DVAL( (height - VB->Win[v3][1]) ); - D3DTLVertices[cVertex].sz = D3DVAL( (VB->Win[v3][2] + ctx->PolygonZoffset) ); - D3DTLVertices[cVertex].tu = D3DVAL( VB->TexCoord[v3][0] ); - D3DTLVertices[cVertex].tv = D3DVAL( VB->TexCoord[v3][1] ); - D3DTLVertices[cVertex].rhw = D3DVAL( (1.0 / VB->Clip[v3][3]) ); - D3DTLVertices[cVertex++].color= dwPVColor; - } -#undef v1 -#undef v2 -#undef v3 - } - - /* Render the converted vertex buffer. */ - if ( cVertex > 2 ) - DrawPrimitiveHAL( pContext->pShared, D3DPT_TRIANGLELIST, &D3DTLVertices[0], cVertex ); -} -/*===========================================================================*/ -/* This function will render the current vertex buffer as a triangle fan. */ -/* The buffer has to be able to be rendered directly. This means that we are*/ -/* filled, no offsets, no culling and one sided rendering. Also we must be */ -/* in render mode of course. */ -/* First I will fill the global D3D vertice buffer. Next I will set all the*/ -/* states for D3D based on the current OGL state. Finally I pass the D3D VB */ -/* to the wrapper that call DrawPrimitives. */ -/*===========================================================================*/ -/* RETURN: */ -/*===========================================================================*/ -static void RenderTriangleFanVB( GLcontext *ctx, GLuint start, GLuint end ) -{ - D3DMESACONTEXT *pContext = (D3DMESACONTEXT *)ctx->DriverCtx; - struct vertex_buffer *VB = ctx->VB; - int index, - cVertex, - height = (pContext->pShared->rectW.bottom - pContext->pShared->rectW.top); - GLfloat ex, ey, - fx, fy, c; - GLuint facing; - DWORD dwPVColor; - - DPF(( DBG_FUNC, "RenderTriangleFanVB();" )); - - /* Special case that we can blast the fan without culling, offset, etc... */ - if ( !VB->ClipOrMask && (ctx->Light.ShadeModel != GL_FLAT) ) - { - DPF(( DBG_PRIM_INFO, "DirectTriangles( %d )", (end-start) )); - - /* Seed the the fan. */ - D3DTLVertices[0].sx = D3DVAL( VB->Win[start][0] ); - D3DTLVertices[0].sy = D3DVAL( (height - VB->Win[start][1]) ); - D3DTLVertices[0].sz = D3DVAL( VB->Win[start][2] ); - D3DTLVertices[0].tu = D3DVAL( VB->TexCoord[start][0] ); - D3DTLVertices[0].tv = D3DVAL( VB->TexCoord[start][1] ); - D3DTLVertices[0].rhw = D3DVAL( (1.0 / VB->Clip[start][3]) ); - D3DTLVertices[0].color= (VB->Color[start][3]<<24) | (VB->Color[start][0]<<16) | (VB->Color[start][1]<<8) | VB->Color[start][2]; - - /* Seed the the fan. */ - D3DTLVertices[1].sx = D3DVAL( VB->Win[(start+1)][0] ); - D3DTLVertices[1].sy = D3DVAL( (height - VB->Win[(start+1)][1]) ); - D3DTLVertices[1].sz = D3DVAL( VB->Win[(start+1)][2] ); - D3DTLVertices[1].tu = D3DVAL( VB->TexCoord[(start+1)][0] ); - D3DTLVertices[1].tv = D3DVAL( VB->TexCoord[(start+1)][1] ); - D3DTLVertices[1].rhw = D3DVAL( (1.0 / VB->Clip[(start+1)][3]) ); - D3DTLVertices[1].color= (VB->Color[(start+1)][3]<<24) | (VB->Color[(start+1)][0]<<16) | (VB->Color[(start+1)][1]<<8) | VB->Color[(start+1)][2]; - - for( index = (start+2), cVertex = 2; index < end; index++, cVertex++ ) - { - /*=================================*/ - /* Add the next vertex to the fan. */ - /*=================================*/ - D3DTLVertices[cVertex].sx = D3DVAL( VB->Win[index][0] ); - D3DTLVertices[cVertex].sy = D3DVAL( (height - VB->Win[index][1]) ); - D3DTLVertices[cVertex].sz = D3DVAL( VB->Win[index][2] ); - D3DTLVertices[cVertex].tu = D3DVAL( VB->TexCoord[index][0] ); - D3DTLVertices[cVertex].tv = D3DVAL( VB->TexCoord[index][1] ); - D3DTLVertices[cVertex].rhw = D3DVAL( (1.0 / VB->Clip[index][3]) ); - D3DTLVertices[cVertex].color = (VB->Color[index][3]<<24) | (VB->Color[index][0]<<16) | (VB->Color[index][1]<<8) | VB->Color[index][2]; - } - - /* Render the converted vertex buffer. */ - if ( cVertex ) - DrawPrimitiveHAL( pContext->pShared, D3DPT_TRIANGLEFAN, &D3DTLVertices[0], cVertex ); - } - else - { -#define v1 start -#define v2 (index-1) -#define v3 index - - for( index = (start+2), cVertex = 0; index < end; index++ ) - { - if ( VB->ClipOrMask ) - { - /* All points clipped by common plane */ - if ( VB->ClipMask[v1] & VB->ClipMask[v2] & VB->ClipMask[v3] & CLIP_ALL_BITS ) - { - continue; - } - else if ( VB->ClipMask[v1] | VB->ClipMask[v2] | VB->ClipMask[v3] ) - { - VList[0] = v1; - VList[1] = v2; - VList[2] = v3; - RenderClippedPolygon( ctx, 3, VList ); - continue; - } - } - - /* Compute orientation of triangle */ - ex = VB->Win[v2][0] - VB->Win[v1][0]; - ey = VB->Win[v2][1] - VB->Win[v1][1]; - fx = VB->Win[v3][0] - VB->Win[v1][0]; - fy = VB->Win[v3][1] - VB->Win[v1][1]; - c = (ex * fy) - (ey * fx); - - /* polygon is perpindicular to view plane, don't draw it */ - if ( (c == 0.0F) && !ctx->Polygon.Unfilled ) - continue; - - /* Backface culling. */ - facing = (c < 0.0F) ^ ctx->Polygon.FrontBit; - if ( (facing + 1) & ctx->Polygon.CullBits ) - continue; - - if ( ctx->IndirectTriangles & DD_TRI_OFFSET ) - { - /* Finish computing plane equation of polygon, compute offset */ - GLfloat fz = VB->Win[v3][2] - VB->Win[v1][2]; - GLfloat ez = VB->Win[v2][2] - VB->Win[v1][2]; - GLfloat a = (ey * fz) - (ez * fy); - GLfloat b = (ez * fx) - (ex * fz); - OffsetPolygon( ctx, a, b, c ); - } - - /*=====================================*/ - /* Populate the the triangle vertices. */ - /*=====================================*/ - dwPVColor = (VB->Color[v3][3]<<24) | (VB->Color[v3][0]<<16) | (VB->Color[v3][1]<<8) | VB->Color[v3][2]; - - D3DTLVertices[cVertex].sx = D3DVAL( VB->Win[v1][0] ); - D3DTLVertices[cVertex].sy = D3DVAL( (height - VB->Win[v1][1]) ); - D3DTLVertices[cVertex].sz = D3DVAL( (VB->Win[v1][2] + ctx->PolygonZoffset) ); - D3DTLVertices[cVertex].tu = D3DVAL( VB->TexCoord[v1][0] ); - D3DTLVertices[cVertex].tv = D3DVAL( VB->TexCoord[v1][1] ); - D3DTLVertices[cVertex].rhw = D3DVAL( (1.0 / VB->Clip[v1][3]) ); - D3DTLVertices[cVertex++].color= (ctx->Light.ShadeModel == GL_FLAT) ? dwPVColor : - (VB->Color[v1][3]<<24) | (VB->Color[v1][0]<<16) | (VB->Color[v1][1]<<8) | VB->Color[v1][2]; - - D3DTLVertices[cVertex].sx = D3DVAL( VB->Win[v2][0] ); - D3DTLVertices[cVertex].sy = D3DVAL( (height - VB->Win[v2][1]) ); - D3DTLVertices[cVertex].sz = D3DVAL( (VB->Win[v2][2] + ctx->PolygonZoffset) ); - D3DTLVertices[cVertex].tu = D3DVAL( VB->TexCoord[v2][0] ); - D3DTLVertices[cVertex].tv = D3DVAL( VB->TexCoord[v2][1] ); - D3DTLVertices[cVertex].rhw = D3DVAL( (1.0 / VB->Clip[v2][3]) ); - D3DTLVertices[cVertex++].color= (ctx->Light.ShadeModel == GL_FLAT) ? dwPVColor : - (VB->Color[v2][3]<<24) | (VB->Color[v2][0]<<16) | (VB->Color[v2][1]<<8) | VB->Color[v2][2]; - - D3DTLVertices[cVertex].sx = D3DVAL( VB->Win[v3][0] ); - D3DTLVertices[cVertex].sy = D3DVAL( (height - VB->Win[v3][1]) ); - D3DTLVertices[cVertex].sz = D3DVAL( (VB->Win[v3][2] + ctx->PolygonZoffset) ); - D3DTLVertices[cVertex].tu = D3DVAL( VB->TexCoord[v3][0] ); - D3DTLVertices[cVertex].tv = D3DVAL( VB->TexCoord[v3][1] ); - D3DTLVertices[cVertex].rhw = D3DVAL( (1.0 / VB->Clip[v3][3]) ); - D3DTLVertices[cVertex++].color= dwPVColor; - } - - /* Render the converted vertex buffer. */ - if ( cVertex ) - DrawPrimitiveHAL( pContext->pShared, D3DPT_TRIANGLELIST, &D3DTLVertices[0], cVertex ); -#undef v1 -#undef v2 -#undef v3 - } -} -/*===========================================================================*/ -/* This function will render the current vertex buffer as a triangle strip. */ -/* The buffer has to be able to be rendered directly. This means that we are*/ -/* filled, no offsets, no culling and one sided rendering. Also we must be */ -/* in render mode of course. */ -/* First I will fill the global D3D vertice buffer. Next I will set all the*/ -/* states for D3D based on the current OGL state. Finally I pass the D3D VB */ -/* to the wrapper that call DrawPrimitives. */ -/*===========================================================================*/ -/* RETURN: */ -/*===========================================================================*/ -static void RenderTriangleStripVB( GLcontext *ctx, GLuint start, GLuint end ) -{ - D3DMESACONTEXT *pContext = (D3DMESACONTEXT *)ctx->DriverCtx; - struct vertex_buffer *VB = ctx->VB; - int index, - cVertex = 0, - v1, v2, v3, - height = (pContext->pShared->rectW.bottom - pContext->pShared->rectW.top); - GLfloat ex, ey, - fx, fy, c; - GLuint facing; - DWORD dwPVColor; - - DPF(( DBG_FUNC, "RenderTriangleStripVB();" )); - - /* Special case that we can blast the fan without culling, offset, etc... */ - if ( !VB->ClipOrMask && (ctx->Light.ShadeModel != GL_FLAT) ) - { - DPF(( DBG_PRIM_PROFILE, "DirectTriangles" )); - - /* Seed the the strip. */ - D3DTLVertices[0].sx = D3DVAL( VB->Win[start][0] ); - D3DTLVertices[0].sy = D3DVAL( (height - VB->Win[start][1]) ); - D3DTLVertices[0].sz = D3DVAL( VB->Win[start][2] ); - D3DTLVertices[0].tu = D3DVAL( VB->TexCoord[start][0] ); - D3DTLVertices[0].tv = D3DVAL( VB->TexCoord[start][1] ); - D3DTLVertices[0].rhw = D3DVAL( (1.0 / VB->Clip[start][3]) ); - D3DTLVertices[0].color= (VB->Color[start][3]<<24) | (VB->Color[start][0]<<16) | (VB->Color[start][1]<<8) | VB->Color[start][2]; - - /* Seed the the strip. */ - D3DTLVertices[1].sx = D3DVAL( VB->Win[(start+1)][0] ); - D3DTLVertices[1].sy = D3DVAL( (height - VB->Win[(start+1)][1]) ); - D3DTLVertices[1].sz = D3DVAL( VB->Win[(start+1)][2] ); - D3DTLVertices[1].tu = D3DVAL( VB->TexCoord[(start+1)][0] ); - D3DTLVertices[1].tv = D3DVAL( VB->TexCoord[(start+1)][1] ); - D3DTLVertices[1].rhw = D3DVAL( (1.0 / VB->Clip[(start+1)][3]) ); - D3DTLVertices[1].color= (VB->Color[(start+1)][3]<<24) | (VB->Color[(start+1)][0]<<16) | (VB->Color[(start+1)][1]<<8) | VB->Color[(start+1)][2]; - - for( index = (start+2), cVertex = 2; index < end; index++, cVertex++ ) - { - /*===================================*/ - /* Add the next vertex to the strip. */ - /*===================================*/ - D3DTLVertices[cVertex].sx = D3DVAL( VB->Win[index][0] ); - D3DTLVertices[cVertex].sy = D3DVAL( (height - VB->Win[index][1]) ); - D3DTLVertices[cVertex].sz = D3DVAL( VB->Win[index][2] ); - D3DTLVertices[cVertex].tu = D3DVAL( VB->TexCoord[index][0] ); - D3DTLVertices[cVertex].tv = D3DVAL( VB->TexCoord[index][1] ); - D3DTLVertices[cVertex].rhw = D3DVAL( (1.0 / VB->Clip[index][3]) ); - D3DTLVertices[cVertex].color = (VB->Color[index][3]<<24) | (VB->Color[index][0]<<16) | (VB->Color[index][1]<<8) | VB->Color[index][2]; - } - - /* Render the converted vertex buffer. */ - if ( cVertex ) - DrawPrimitiveHAL( pContext->pShared, D3DPT_TRIANGLESTRIP, &D3DTLVertices[0], cVertex ); - } - else - { - for( index = (start+2); index < end; index++ ) - { - /* We need to switch order so that winding won't be a problem. */ - if ( index & 1 ) - { - v1 = index - 1; - v2 = index - 2; - v3 = index - 0; - } - else - { - v1 = index - 2; - v2 = index - 1; - v3 = index - 0; - } - - /* All vertices clipped by common plane */ - if ( VB->ClipMask[v1] & VB->ClipMask[v2] & VB->ClipMask[v3] & CLIP_ALL_BITS ) - continue; - - /* Check if any vertices need clipping. */ - if ( VB->ClipMask[v1] | VB->ClipMask[v2] | VB->ClipMask[v3] ) - { - VList[0] = v1; - VList[1] = v2; - VList[2] = v3; - RenderClippedPolygon( ctx, 3, VList ); - } - else - { - /* Compute orientation of triangle */ - ex = VB->Win[v2][0] - VB->Win[v1][0]; - ey = VB->Win[v2][1] - VB->Win[v1][1]; - fx = VB->Win[v3][0] - VB->Win[v1][0]; - fy = VB->Win[v3][1] - VB->Win[v1][1]; - c = (ex * fy) - (ey * fx); - - /* Polygon is perpindicular to view plane, don't draw it */ - if ( (c == 0.0F) && !ctx->Polygon.Unfilled ) - continue; - - /* Backface culling. */ - facing = (c < 0.0F) ^ ctx->Polygon.FrontBit; - if ( (facing + 1) & ctx->Polygon.CullBits ) - continue; - - /* Need right color if we have two sided lighting. */ - if ( ctx->IndirectTriangles & DD_TRI_LIGHT_TWOSIDE ) - { - if ( facing == 1 ) - { - /* use back color */ - VB->Color = VB->Bcolor; - VB->Specular= VB->Bspec; - } - else - { - /* use front color */ - VB->Color = VB->Fcolor; - VB->Specular= VB->Fspec; - } - } - - if ( ctx->IndirectTriangles & DD_TRI_OFFSET ) - { - /* Finish computing plane equation of polygon, compute offset */ - GLfloat fz = VB->Win[v3][2] - VB->Win[v1][2]; - GLfloat ez = VB->Win[v2][2] - VB->Win[v1][2]; - GLfloat a = (ey * fz) - (ez * fy); - GLfloat b = (ez * fx) - (ex * fz); - OffsetPolygon( ctx, a, b, c ); - } - /*=====================================*/ - /* Populate the the triangle vertices. */ - /*=====================================*/ - - /* Solve the prevoking vertex color as we need it for the 3rd triangle and flat shading. */ - dwPVColor = (VB->Color[v3][3]<<24) | (VB->Color[v3][0]<<16) | (VB->Color[v3][1]<<8) | VB->Color[v3][2]; - - D3DTLVertices[cVertex].sx = D3DVAL( VB->Win[v1][0] ); - D3DTLVertices[cVertex].sy = D3DVAL( (height - VB->Win[v1][1]) ); - D3DTLVertices[cVertex].sz = D3DVAL( (VB->Win[v1][2] + ctx->PolygonZoffset) ); - D3DTLVertices[cVertex].tu = D3DVAL( VB->TexCoord[v1][0] ); - D3DTLVertices[cVertex].tv = D3DVAL( VB->TexCoord[v1][1] ); - D3DTLVertices[cVertex].rhw = D3DVAL( (1.0 / VB->Clip[v1][3]) ); - D3DTLVertices[cVertex++].color= (ctx->Light.ShadeModel == GL_FLAT) ? - dwPVColor : - (VB->Color[v1][3]<<24) | (VB->Color[v1][0]<<16) | (VB->Color[v1][1]<<8) | VB->Color[v1][2]; - - D3DTLVertices[cVertex].sx = D3DVAL( VB->Win[v2][0] ); - D3DTLVertices[cVertex].sy = D3DVAL( (height - VB->Win[v2][1]) ); - D3DTLVertices[cVertex].sz = D3DVAL( (VB->Win[v2][2] + ctx->PolygonZoffset) ); - D3DTLVertices[cVertex].tu = D3DVAL( VB->TexCoord[v2][0] ); - D3DTLVertices[cVertex].tv = D3DVAL( VB->TexCoord[v2][1] ); - D3DTLVertices[cVertex].rhw = D3DVAL( (1.0 / VB->Clip[v2][3]) ); - D3DTLVertices[cVertex++].color= (ctx->Light.ShadeModel == GL_FLAT) ? - dwPVColor : - (VB->Color[v2][3]<<24) | (VB->Color[v2][0]<<16) | (VB->Color[v2][1]<<8) | VB->Color[v2][2]; - - D3DTLVertices[cVertex].sx = D3DVAL( VB->Win[v3][0] ); - D3DTLVertices[cVertex].sy = D3DVAL( (height - VB->Win[v3][1]) ); - D3DTLVertices[cVertex].sz = D3DVAL( (VB->Win[v3][2] + ctx->PolygonZoffset) ); - D3DTLVertices[cVertex].tu = D3DVAL( VB->TexCoord[v3][0] ); - D3DTLVertices[cVertex].tv = D3DVAL( VB->TexCoord[v3][1] ); - D3DTLVertices[cVertex].rhw = D3DVAL( (1.0 / VB->Clip[v3][3]) ); - D3DTLVertices[cVertex++].color= dwPVColor; - } - } - - /* Render the converted vertex buffer. */ - if ( cVertex ) - DrawPrimitiveHAL( pContext->pShared, D3DPT_TRIANGLELIST, &D3DTLVertices[0], cVertex ); - } -} -/*===========================================================================*/ -/* This function will render the current vertex buffer as Quads. The buffer*/ -/* has to be able to be rendered directly. This means that we are filled, no*/ -/* offsets, no culling and one sided rendering. Also we must be in render */ -/* mode of cource. */ -/* First I will fill the global D3D vertice buffer. Next I will set all the*/ -/* states for D3D based on the current OGL state. Finally I pass the D3D VB */ -/* to the wrapper that call DrawPrimitives. */ -/*===========================================================================*/ -/* RETURN: */ -/*===========================================================================*/ -static void RenderQuadVB( GLcontext *ctx, GLuint start, GLuint end ) -{ - D3DMESACONTEXT *pContext = (D3DMESACONTEXT *)ctx->DriverCtx; - struct vertex_buffer *VB = ctx->VB; - int index, - cVertex, - height = (pContext->pShared->rectW.bottom - pContext->pShared->rectW.top); - DWORD dwPVColor; - GLfloat ex, ey, - fx, fy, c; - GLuint facing; /* 0=front, 1=back */ - - DPF(( DBG_FUNC, "RenderQuadVB();" )); - -#define v1 (index) -#define v2 (index+1) -#define v3 (index+2) -#define v4 (index+3) - - if ( !VB->ClipOrMask ) - { - DPF(( DBG_PRIM_PROFILE, "DirectTriangles" )); - - for( cVertex = 0, index = start; index < end; index += 4 ) - { - if ( ctx->Light.ShadeModel == GL_FLAT ) - dwPVColor = (VB->Color[v4][3]<<24) | (VB->Color[v4][0]<<16) | (VB->Color[v4][1]<<8) | VB->Color[v4][2]; - - /*=====================================*/ - /* Populate the the triangle vertices. */ - /*=====================================*/ - D3DTLVertices[cVertex].sx = D3DVAL( VB->Win[v1][0] ); - D3DTLVertices[cVertex].sy = D3DVAL( (height - VB->Win[v1][1]) ); - D3DTLVertices[cVertex].sz = D3DVAL( VB->Win[v1][2] ); - D3DTLVertices[cVertex].tu = D3DVAL( VB->TexCoord[v1][0] ); - D3DTLVertices[cVertex].tv = D3DVAL( VB->TexCoord[v1][1] ); - D3DTLVertices[cVertex].rhw = D3DVAL( (1.0 / VB->Clip[v1][3]) ); - D3DTLVertices[cVertex++].color= (ctx->Light.ShadeModel == GL_FLAT) ? - dwPVColor : - (VB->Color[v1][3]<<24) | (VB->Color[v1][0]<<16) | (VB->Color[v1][1]<<8) | VB->Color[v1][2]; - - D3DTLVertices[cVertex].sx = D3DVAL( VB->Win[v2][0] ); - D3DTLVertices[cVertex].sy = D3DVAL( (height - VB->Win[v2][1]) ); - D3DTLVertices[cVertex].sz = D3DVAL( VB->Win[v2][2] ); - D3DTLVertices[cVertex].tu = D3DVAL( VB->TexCoord[v2][0] ); - D3DTLVertices[cVertex].tv = D3DVAL( VB->TexCoord[v2][1] ); - D3DTLVertices[cVertex].rhw = D3DVAL( (1.0 / VB->Clip[v2][3]) ); - D3DTLVertices[cVertex++].color= (ctx->Light.ShadeModel == GL_FLAT) ? - dwPVColor : - (VB->Color[v2][3]<<24) | (VB->Color[v2][0]<<16) | (VB->Color[v2][1]<<8) | VB->Color[v2][2]; - - D3DTLVertices[cVertex].sx = D3DVAL( VB->Win[v3][0] ); - D3DTLVertices[cVertex].sy = D3DVAL( (height - VB->Win[v3][1]) ); - D3DTLVertices[cVertex].sz = D3DVAL( VB->Win[v3][2] ); - D3DTLVertices[cVertex].tu = D3DVAL( VB->TexCoord[v3][0] ); - D3DTLVertices[cVertex].tv = D3DVAL( VB->TexCoord[v3][1] ); - D3DTLVertices[cVertex].rhw = D3DVAL( (1.0 / VB->Clip[v3][3]) ); - D3DTLVertices[cVertex++].color= (ctx->Light.ShadeModel == GL_FLAT) ? - dwPVColor : - (VB->Color[v3][3]<<24) | (VB->Color[v3][0]<<16) | (VB->Color[v3][1]<<8) | VB->Color[v3][2]; - - D3DTLVertices[cVertex].sx = D3DVAL( VB->Win[v1][0] ); - D3DTLVertices[cVertex].sy = D3DVAL( (height - VB->Win[v1][1]) ); - D3DTLVertices[cVertex].sz = D3DVAL( VB->Win[v1][2] ); - D3DTLVertices[cVertex].tu = D3DVAL( VB->TexCoord[v1][0] ); - D3DTLVertices[cVertex].tv = D3DVAL( VB->TexCoord[v1][1] ); - D3DTLVertices[cVertex].rhw = D3DVAL( (1.0 / VB->Clip[v1][3]) ); - D3DTLVertices[cVertex++].color= (ctx->Light.ShadeModel == GL_FLAT) ? - dwPVColor : - (VB->Color[v1][3]<<24) | (VB->Color[v1][0]<<16) | (VB->Color[v1][1]<<8) | VB->Color[v1][2]; - - D3DTLVertices[cVertex].sx = D3DVAL( VB->Win[v3][0] ); - D3DTLVertices[cVertex].sy = D3DVAL( (height - VB->Win[v3][1]) ); - D3DTLVertices[cVertex].sz = D3DVAL( VB->Win[v3][2] ); - D3DTLVertices[cVertex].tu = D3DVAL( VB->TexCoord[v3][0] ); - D3DTLVertices[cVertex].tv = D3DVAL( VB->TexCoord[v3][1] ); - D3DTLVertices[cVertex].rhw = D3DVAL( (1.0 / VB->Clip[v3][3]) ); - D3DTLVertices[cVertex++].color= (ctx->Light.ShadeModel == GL_FLAT) ? - dwPVColor : - (VB->Color[v3][3]<<24) | (VB->Color[v3][0]<<16) | (VB->Color[v3][1]<<8) | VB->Color[v3][2]; - - D3DTLVertices[cVertex].sx = D3DVAL( VB->Win[v4][0] ); - D3DTLVertices[cVertex].sy = D3DVAL( (height - VB->Win[v4][1]) ); - D3DTLVertices[cVertex].sz = D3DVAL( VB->Win[v4][2] ); - D3DTLVertices[cVertex].tu = D3DVAL( VB->TexCoord[v4][0] ); - D3DTLVertices[cVertex].tv = D3DVAL( VB->TexCoord[v4][1] ); - D3DTLVertices[cVertex].rhw = D3DVAL( (1.0 / VB->Clip[v4][3]) ); - D3DTLVertices[cVertex++].color= (ctx->Light.ShadeModel == GL_FLAT) ? - dwPVColor : - (VB->Color[v4][3]<<24) | (VB->Color[v4][0]<<16) | (VB->Color[v4][1]<<8) | VB->Color[v4][2]; - } - } - else - { - for( cVertex = 0, index = start; index < end; index += 4 ) - { - if ( VB->ClipMask[v1] & VB->ClipMask[v2] & VB->ClipMask[v3] & VB->ClipMask[v4] & CLIP_ALL_BITS ) - { - continue; - } - else if ( VB->ClipMask[v1] | VB->ClipMask[v2] | VB->ClipMask[v3] | VB->ClipMask[v4] ) - { - VList[0] = v1; - VList[1] = v2; - VList[2] = v3; - VList[3] = v4; - RenderClippedPolygon( ctx, 4, VList ); - continue; - } - - /* Compute orientation of triangle */ - ex = VB->Win[v2][0] - VB->Win[v1][0]; - ey = VB->Win[v2][1] - VB->Win[v1][1]; - fx = VB->Win[v3][0] - VB->Win[v1][0]; - fy = VB->Win[v3][1] - VB->Win[v1][1]; - c = (ex * fy) - (ey * fx); - - /* polygon is perpindicular to view plane, don't draw it */ - if ( (c == 0.0F) && !ctx->Polygon.Unfilled ) - continue; - - /* Backface culling. */ - facing = (c < 0.0F) ^ ctx->Polygon.FrontBit; - if ( (facing + 1) & ctx->Polygon.CullBits ) - continue; - - if ( ctx->IndirectTriangles & DD_TRI_LIGHT_TWOSIDE ) - { - if ( facing == 1 ) - { - /* use back color */ - VB->Color = VB->Bcolor; - VB->Specular= VB->Bspec; - } - else - { - /* use front color */ - VB->Color = VB->Fcolor; - VB->Specular= VB->Fspec; - } - } - - if ( ctx->IndirectTriangles & DD_TRI_OFFSET ) - { - /* Finish computing plane equation of polygon, compute offset */ - GLfloat fz = VB->Win[v3][2] - VB->Win[v1][2]; - GLfloat ez = VB->Win[v2][2] - VB->Win[v1][2]; - GLfloat a = (ey * fz) - (ez * fy); - GLfloat b = (ez * fx) - (ex * fz); - OffsetPolygon( ctx, a, b, c ); - } - - if ( ctx->Light.ShadeModel == GL_FLAT ) - dwPVColor = (VB->Color[v4][3]<<24) | (VB->Color[v4][0]<<16) | (VB->Color[v4][1]<<8) | VB->Color[v4][2]; - - /*=====================================*/ - /* Populate the the triangle vertices. */ - /*=====================================*/ - D3DTLVertices[cVertex].sx = D3DVAL( VB->Win[v1][0] ); - D3DTLVertices[cVertex].sy = D3DVAL( (height - VB->Win[v1][1]) ); - D3DTLVertices[cVertex].sz = D3DVAL( (VB->Win[v1][2] + ctx->PolygonZoffset) ); - D3DTLVertices[cVertex].tu = D3DVAL( VB->TexCoord[v1][0] ); - D3DTLVertices[cVertex].tv = D3DVAL( VB->TexCoord[v1][1] ); - D3DTLVertices[cVertex].rhw = D3DVAL( (1.0 / VB->Clip[v1][3]) ); - D3DTLVertices[cVertex++].color= (ctx->Light.ShadeModel == GL_FLAT) ? - dwPVColor : - (VB->Color[v1][3]<<24) | (VB->Color[v1][0]<<16) | (VB->Color[v1][1]<<8) | VB->Color[v1][2]; - - D3DTLVertices[cVertex].sx = D3DVAL( VB->Win[v2][0] ); - D3DTLVertices[cVertex].sy = D3DVAL( (height - VB->Win[v2][1]) ); - D3DTLVertices[cVertex].sz = D3DVAL( (VB->Win[v2][2] + ctx->PolygonZoffset) ); - D3DTLVertices[cVertex].tu = D3DVAL( VB->TexCoord[v2][0] ); - D3DTLVertices[cVertex].tv = D3DVAL( VB->TexCoord[v2][1] ); - D3DTLVertices[cVertex].rhw = D3DVAL( (1.0 / VB->Clip[v2][3]) ); - D3DTLVertices[cVertex++].color= (ctx->Light.ShadeModel == GL_FLAT) ? - dwPVColor : - (VB->Color[v2][3]<<24) | (VB->Color[v2][0]<<16) | (VB->Color[v2][1]<<8) | VB->Color[v2][2]; - - D3DTLVertices[cVertex].sx = D3DVAL( VB->Win[v3][0] ); - D3DTLVertices[cVertex].sy = D3DVAL( (height - VB->Win[v3][1]) ); - D3DTLVertices[cVertex].sz = D3DVAL( (VB->Win[v3][2] + ctx->PolygonZoffset) ); - D3DTLVertices[cVertex].tu = D3DVAL( VB->TexCoord[v3][0] ); - D3DTLVertices[cVertex].tv = D3DVAL( VB->TexCoord[v3][1] ); - D3DTLVertices[cVertex].rhw = D3DVAL( (1.0 / VB->Clip[v3][3]) ); - D3DTLVertices[cVertex++].color= (ctx->Light.ShadeModel == GL_FLAT) ? - dwPVColor : - (VB->Color[v3][3]<<24) | (VB->Color[v3][0]<<16) | (VB->Color[v3][1]<<8) | VB->Color[v3][2]; - - D3DTLVertices[cVertex].sx = D3DVAL( VB->Win[v1][0] ); - D3DTLVertices[cVertex].sy = D3DVAL( (height - VB->Win[v1][1]) ); - D3DTLVertices[cVertex].sz = D3DVAL( (VB->Win[v1][2] + ctx->PolygonZoffset) ); - D3DTLVertices[cVertex].tu = D3DVAL( VB->TexCoord[v1][0] ); - D3DTLVertices[cVertex].tv = D3DVAL( VB->TexCoord[v1][1] ); - D3DTLVertices[cVertex].rhw = D3DVAL( (1.0 / VB->Clip[v1][3]) ); - D3DTLVertices[cVertex++].color= (ctx->Light.ShadeModel == GL_FLAT) ? - dwPVColor : - (VB->Color[v1][3]<<24) | (VB->Color[v1][0]<<16) | (VB->Color[v1][1]<<8) | VB->Color[v1][2]; - - D3DTLVertices[cVertex].sx = D3DVAL( VB->Win[v3][0] ); - D3DTLVertices[cVertex].sy = D3DVAL( (height - VB->Win[v3][1]) ); - D3DTLVertices[cVertex].sz = D3DVAL( (VB->Win[v3][2] + ctx->PolygonZoffset) ); - D3DTLVertices[cVertex].tu = D3DVAL( VB->TexCoord[v3][0] ); - D3DTLVertices[cVertex].tv = D3DVAL( VB->TexCoord[v3][1] ); - D3DTLVertices[cVertex].rhw = D3DVAL( (1.0 / VB->Clip[v3][3]) ); - D3DTLVertices[cVertex++].color= (ctx->Light.ShadeModel == GL_FLAT) ? - dwPVColor : - (VB->Color[v3][3]<<24) | (VB->Color[v3][0]<<16) | (VB->Color[v3][1]<<8) | VB->Color[v3][2]; - - D3DTLVertices[cVertex].sx = D3DVAL( VB->Win[v4][0] ); - D3DTLVertices[cVertex].sy = D3DVAL( (height - VB->Win[v4][1]) ); - D3DTLVertices[cVertex].sz = D3DVAL( (VB->Win[v4][2] + ctx->PolygonZoffset) ); - D3DTLVertices[cVertex].tu = D3DVAL( VB->TexCoord[v4][0] ); - D3DTLVertices[cVertex].tv = D3DVAL( VB->TexCoord[v4][1] ); - D3DTLVertices[cVertex].rhw = D3DVAL( (1.0 / VB->Clip[v4][3]) ); - D3DTLVertices[cVertex++].color= (ctx->Light.ShadeModel == GL_FLAT) ? - dwPVColor : - (VB->Color[v4][3]<<24) | (VB->Color[v4][0]<<16) | (VB->Color[v4][1]<<8) | VB->Color[v4][2]; - } - } - -#undef v4 -#undef v3 -#undef v2 -#undef v1 - - /* Render the converted vertex buffer. */ - if ( cVertex ) - DrawPrimitiveHAL( pContext->pShared, D3DPT_TRIANGLELIST, &D3DTLVertices[0], cVertex ); -} -/*===========================================================================*/ -/* */ -/*===========================================================================*/ -/* RETURN: TRUE, FALSE. */ -/*===========================================================================*/ -static void RenderQuad( GLcontext *ctx, GLuint v1, GLuint v2, GLuint v3, GLuint v4, GLuint pv ) -{ - D3DMESACONTEXT *pContext = (D3DMESACONTEXT *)ctx->DriverCtx; - struct vertex_buffer *VB = ctx->VB; - int height = (pContext->pShared->rectW.bottom - pContext->pShared->rectW.top); - DWORD dwPVColor; - GLfloat ex, ey, - fx, fy, c; - GLuint facing; /* 0=front, 1=back */ - static D3DTLVERTEX TLVertices[6]; - - DPF(( DBG_FUNC, "RenderQuad" )); - DPF(( DBG_PRIM_INFO, "RenderQuad( 1 )" )); - - /* Compute orientation of triangle */ - ex = VB->Win[v2][0] - VB->Win[v1][0]; - ey = VB->Win[v2][1] - VB->Win[v1][1]; - fx = VB->Win[v3][0] - VB->Win[v1][0]; - fy = VB->Win[v3][1] - VB->Win[v1][1]; - c = (ex * fy) - (ey * fx); - - /* polygon is perpindicular to view plane, don't draw it */ - if ( (c == 0.0F) && !ctx->Polygon.Unfilled ) - return; - - /* Backface culling. */ - facing = (c < 0.0F) ^ ctx->Polygon.FrontBit; - if ( (facing + 1) & ctx->Polygon.CullBits ) - return; - - if ( ctx->IndirectTriangles & DD_TRI_LIGHT_TWOSIDE ) - { - if ( facing == 1 ) - { - /* use back color */ - VB->Color = VB->Bcolor; - VB->Specular= VB->Bspec; - } - else - { - /* use front color */ - VB->Color = VB->Fcolor; - VB->Specular= VB->Fspec; - } - } - - if ( ctx->IndirectTriangles & DD_TRI_OFFSET ) - { - /* Finish computing plane equation of polygon, compute offset */ - GLfloat fz = VB->Win[v3][2] - VB->Win[v1][2]; - GLfloat ez = VB->Win[v2][2] - VB->Win[v1][2]; - GLfloat a = (ey * fz) - (ez * fy); - GLfloat b = (ez * fx) - (ex * fz); - OffsetPolygon( ctx, a, b, c ); - } - - if ( ctx->Light.ShadeModel == GL_FLAT ) - dwPVColor = (VB->Color[pv][3]<<24) | (VB->Color[pv][0]<<16) | (VB->Color[pv][1]<<8) | VB->Color[pv][2]; - - /*=====================================*/ - /* Populate the the triangle vertices. */ - /*=====================================*/ - TLVertices[0].sx = D3DVAL( VB->Win[v1][0] ); - TLVertices[0].sy = D3DVAL( (height - VB->Win[v1][1]) ); - TLVertices[0].sz = D3DVAL( (VB->Win[v1][2] + ctx->PolygonZoffset) ); - TLVertices[0].tu = D3DVAL( VB->TexCoord[v1][0] ); - TLVertices[0].tv = D3DVAL( VB->TexCoord[v1][1] ); - TLVertices[0].rhw = D3DVAL( (1.0 / VB->Clip[v1][3]) ); - TLVertices[0].color = (ctx->Light.ShadeModel == GL_FLAT) ? dwPVColor : - (VB->Color[v1][3]<<24) | (VB->Color[v1][0]<<16) | (VB->Color[v1][1]<<8) | VB->Color[v1][2]; - - TLVertices[1].sx = D3DVAL( VB->Win[v2][0] ); - TLVertices[1].sy = D3DVAL( (height - VB->Win[v2][1]) ); - TLVertices[1].sz = D3DVAL( (VB->Win[v2][2] + ctx->PolygonZoffset) ); - TLVertices[1].tu = D3DVAL( VB->TexCoord[v2][0] ); - TLVertices[1].tv = D3DVAL( VB->TexCoord[v2][1] ); - TLVertices[1].rhw = D3DVAL( (1.0 / VB->Clip[v2][3]) ); - TLVertices[1].color = (ctx->Light.ShadeModel == GL_FLAT) ? dwPVColor : - (VB->Color[v2][3]<<24) | (VB->Color[v2][0]<<16) | (VB->Color[v2][1]<<8) | VB->Color[v2][2]; - - TLVertices[2].sx = D3DVAL( VB->Win[v3][0] ); - TLVertices[2].sy = D3DVAL( (height - VB->Win[v3][1]) ); - TLVertices[2].sz = D3DVAL( (VB->Win[v3][2] + ctx->PolygonZoffset) ); - TLVertices[2].tu = D3DVAL( VB->TexCoord[v3][0] ); - TLVertices[2].tv = D3DVAL( VB->TexCoord[v3][1] ); - TLVertices[2].rhw = D3DVAL( (1.0 / VB->Clip[v3][3]) ); - TLVertices[2].color = (ctx->Light.ShadeModel == GL_FLAT) ? dwPVColor : - (VB->Color[v3][3]<<24) | (VB->Color[v3][0]<<16) | (VB->Color[v3][1]<<8) | VB->Color[v3][2]; - - TLVertices[3].sx = D3DVAL( VB->Win[v3][0] ); - TLVertices[3].sy = D3DVAL( (height - VB->Win[v3][1]) ); - TLVertices[3].sz = D3DVAL( (VB->Win[v3][2] + ctx->PolygonZoffset) ); - TLVertices[3].tu = D3DVAL( VB->TexCoord[v3][0] ); - TLVertices[3].tv = D3DVAL( VB->TexCoord[v3][1] ); - TLVertices[3].rhw = D3DVAL( (1.0 / VB->Clip[v3][3]) ); - TLVertices[3].color = (ctx->Light.ShadeModel == GL_FLAT) ? dwPVColor : - (VB->Color[v3][3]<<24) | (VB->Color[v3][0]<<16) | (VB->Color[v3][1]<<8) | VB->Color[v3][2]; - - TLVertices[4].sx = D3DVAL( VB->Win[v4][0] ); - TLVertices[4].sy = D3DVAL( (height - VB->Win[v4][1]) ); - TLVertices[4].sz = D3DVAL( (VB->Win[v4][2] + ctx->PolygonZoffset) ); - TLVertices[4].tu = D3DVAL( VB->TexCoord[v4][0] ); - TLVertices[4].tv = D3DVAL( VB->TexCoord[v4][1] ); - TLVertices[4].rhw = D3DVAL( (1.0 / VB->Clip[v4][3]) ); - TLVertices[4].color = (ctx->Light.ShadeModel == GL_FLAT) ? dwPVColor : - (VB->Color[v4][3]<<24) | (VB->Color[v4][0]<<16) | (VB->Color[v4][1]<<8) | VB->Color[v4][2]; - - TLVertices[5].sx = D3DVAL( VB->Win[v1][0] ); - TLVertices[5].sy = D3DVAL( (height - VB->Win[v1][1]) ); - TLVertices[5].sz = D3DVAL( (VB->Win[v1][2] + ctx->PolygonZoffset) ); - TLVertices[5].tu = D3DVAL( VB->TexCoord[v1][0] ); - TLVertices[5].tv = D3DVAL( VB->TexCoord[v1][1] ); - TLVertices[5].rhw = D3DVAL( (1.0 / VB->Clip[v1][3]) ); - TLVertices[5].color = (ctx->Light.ShadeModel == GL_FLAT) ? dwPVColor : - (VB->Color[v1][3]<<24) | (VB->Color[v1][0]<<16) | (VB->Color[v1][1]<<8) | VB->Color[v1][2]; - - /* Draw the two triangles. */ - DrawPrimitiveHAL( pContext->pShared, D3DPT_TRIANGLELIST, &TLVertices[0], 6 ); -} -/*===========================================================================*/ -/* */ -/*===========================================================================*/ -/* RETURN: TRUE, FALSE. */ -/*===========================================================================*/ -void RenderOneTriangle( GLcontext *ctx, GLuint v1, GLuint v2, GLuint v3, GLuint pv ) -{ - D3DMESACONTEXT *pContext = (D3DMESACONTEXT *)ctx->DriverCtx; - struct vertex_buffer *VB = ctx->VB; - int height = (pContext->pShared->rectW.bottom - pContext->pShared->rectW.top); - DWORD dwPVColor; - static D3DTLVERTEX TLVertices[3]; - - DPF(( DBG_FUNC, "RenderOneTriangle" )); - DPF(( DBG_PRIM_INFO, "RenderTriangle( 1 )" )); - - /*=====================================*/ - /* Populate the the triangle vertices. */ - /*=====================================*/ - if ( ctx->Light.ShadeModel == GL_FLAT ) - dwPVColor = (VB->Color[pv][3]<<24) | (VB->Color[pv][0]<<16) | (VB->Color[pv][1]<<8) | VB->Color[pv][2]; - - TLVertices[0].sx = D3DVAL( VB->Win[v1][0] ); - TLVertices[0].sy = D3DVAL( (height - VB->Win[v1][1]) ); - TLVertices[0].sz = D3DVAL( (VB->Win[v1][2] + ctx->PolygonZoffset) ); - TLVertices[0].tu = D3DVAL( VB->TexCoord[v1][0] ); - TLVertices[0].tv = D3DVAL( VB->TexCoord[v1][1] ); - TLVertices[0].rhw = D3DVAL( (1.0 / VB->Clip[v1][3]) ); - TLVertices[0].color = (ctx->Light.ShadeModel == GL_FLAT) ? dwPVColor : - (VB->Color[v1][3]<<24) | (VB->Color[v1][0]<<16) | (VB->Color[v1][1]<<8) | VB->Color[v1][2]; - DPF(( DBG_PRIM_INFO, "V1 -> x:%f y:%f z:%f c:%x", - TLVertices[0].sx, - TLVertices[0].sy, - TLVertices[0].sz, - TLVertices[0].color )); - - TLVertices[1].sx = D3DVAL( VB->Win[v2][0] ); - TLVertices[1].sy = D3DVAL( (height - VB->Win[v2][1]) ); - TLVertices[1].sz = D3DVAL( (VB->Win[v2][2] + ctx->PolygonZoffset) ); - TLVertices[1].tu = D3DVAL( VB->TexCoord[v2][0] ); - TLVertices[1].tv = D3DVAL( VB->TexCoord[v2][1] ); - TLVertices[1].rhw = D3DVAL( (1.0 / VB->Clip[v2][3]) ); - TLVertices[1].color = (ctx->Light.ShadeModel == GL_FLAT) ? dwPVColor : - (VB->Color[v2][3]<<24) | (VB->Color[v2][0]<<16) | (VB->Color[v2][1]<<8) | VB->Color[v2][2]; - DPF(( DBG_PRIM_INFO, "V2 -> x:%f y:%f z:%f c:%x", - TLVertices[1].sx, - TLVertices[1].sy, - TLVertices[1].sz, - TLVertices[1].color )); - - TLVertices[2].sx = D3DVAL( VB->Win[v3][0] ); - TLVertices[2].sy = D3DVAL( (height - VB->Win[v3][1]) ); - TLVertices[2].sz = D3DVAL( (VB->Win[v3][2] + ctx->PolygonZoffset) ); - TLVertices[2].tu = D3DVAL( VB->TexCoord[v3][0] ); - TLVertices[2].tv = D3DVAL( VB->TexCoord[v3][1] ); - TLVertices[2].rhw = D3DVAL( (1.0 / VB->Clip[v3][3]) ); - TLVertices[2].color = (ctx->Light.ShadeModel == GL_FLAT) ? dwPVColor : - (VB->Color[v3][3]<<24) | (VB->Color[v3][0]<<16) | (VB->Color[v3][1]<<8) | VB->Color[v3][2]; - DPF(( DBG_PRIM_INFO, "V3 -> x:%f y:%f z:%f c:%x", - TLVertices[2].sx, - TLVertices[2].sy, - TLVertices[2].sz, - TLVertices[2].color )); - - /* Draw the triangle. */ - DrawPrimitiveHAL( pContext->pShared, D3DPT_TRIANGLELIST, &TLVertices[0], 3 ); -} -/*===========================================================================*/ -/* */ -/*===========================================================================*/ -/* RETURN: TRUE, FALSE. */ -/*===========================================================================*/ -void RenderOneLine( GLcontext *ctx, GLuint v1, GLuint v2, GLuint pv ) -{ - D3DMESACONTEXT *pContext = (D3DMESACONTEXT *)ctx->DriverCtx; - struct vertex_buffer *VB = ctx->VB; - int height = (pContext->pShared->rectW.bottom - pContext->pShared->rectW.top); - DWORD dwPVColor; - static D3DTLVERTEX TLVertices[2]; - - DPF(( DBG_FUNC, "RenderOneLine" )); - DPF(( DBG_PRIM_INFO, "RenderLine( 1 )" )); - - if ( VB->MonoColor ) - dwPVColor = (pContext->aCurrent<<24) | (pContext->rCurrent<<16) | (pContext->gCurrent<<8) | pContext->bCurrent; - else - dwPVColor = (VB->Color[pv][3]<<24) | (VB->Color[pv][0]<<16) | (VB->Color[pv][1]<<8) | VB->Color[pv][2]; - - TLVertices[0].sx = D3DVAL( VB->Win[v1][0] ); - TLVertices[0].sy = D3DVAL( (height - VB->Win[v1][1]) ); - TLVertices[0].sz = D3DVAL( (VB->Win[v1][2] + ctx->LineZoffset) ); - TLVertices[0].tu = D3DVAL( VB->TexCoord[v1][0] ); - TLVertices[0].tv = D3DVAL( VB->TexCoord[v1][1] ); - TLVertices[0].rhw = D3DVAL( (1.0 / VB->Clip[v1][3]) ); - TLVertices[0].color = (ctx->Light.ShadeModel == GL_FLAT) ? dwPVColor : - (VB->Color[v1][3]<<24) | (VB->Color[v1][0]<<16) | (VB->Color[v1][1]<<8) | VB->Color[v1][2]; - - TLVertices[1].sx = D3DVAL( VB->Win[v2][0] ); - TLVertices[1].sy = D3DVAL( (height - VB->Win[v2][1]) ); - TLVertices[1].sz = D3DVAL( (VB->Win[v2][2] + ctx->LineZoffset) ); - TLVertices[1].tu = D3DVAL( VB->TexCoord[v2][0] ); - TLVertices[1].tv = D3DVAL( VB->TexCoord[v2][1] ); - TLVertices[1].rhw = D3DVAL( (1.0 / VB->Clip[v2][3]) ); - TLVertices[1].color = (ctx->Light.ShadeModel == GL_FLAT) ? dwPVColor : - (VB->Color[v2][3]<<24) | (VB->Color[v2][0]<<16) | (VB->Color[v2][1]<<8) | VB->Color[v2][2]; - - /* Draw line from (x0,y0) to (x1,y1) with current pixel color/index */ - DrawPrimitiveHAL( pContext->pShared, D3DPT_LINELIST, &TLVertices[0], 2 ); -} -/*===========================================================================*/ -/* This function was written to convert points into triangles. I did this */ -/* as all card accelerate triangles and most drivers do this anyway. In hind*/ -/* thought this might be a bad idea as some cards do better. */ -/*===========================================================================*/ -/* RETURN: */ -/*===========================================================================*/ -static void RenderPointsVB( GLcontext *ctx, GLuint start, GLuint end ) -{ - D3DMESACONTEXT *pContext = (D3DMESACONTEXT *)ctx->DriverCtx; - struct vertex_buffer *VB = ctx->VB; - struct pixel_buffer *PB = ctx->PB; - GLuint index; - GLfloat radius, z, - xmin, ymin, - xmax, ymax; - GLint cVertex, - height = (pContext->pShared->rectW.bottom - pContext->pShared->rectW.top); - DWORD dwPVColor; - - DPF(( DBG_FUNC, "RenderPointsVB();" )); - - radius = CLAMP( ctx->Point.Size, MIN_POINT_SIZE, MAX_POINT_SIZE ) * 0.5F; - - for( index = start, cVertex = 0; index <= end; index++ ) - { - if ( VB->ClipMask[index] == 0 ) - { - xmin = D3DVAL( VB->Win[index][0] - radius ); - xmax = D3DVAL( VB->Win[index][0] + radius ); - ymin = D3DVAL( height - VB->Win[index][1] - radius ); - ymax = D3DVAL( height - VB->Win[index][1] + radius ); - z = D3DVAL( (VB->Win[index][2] + ctx->PointZoffset) ); - - dwPVColor = (VB->Color[index][3]<<24) | - (VB->Color[index][0]<<16) | - (VB->Color[index][1]<<8) | - VB->Color[index][2]; - - D3DTLVertices[cVertex].sx = xmin; - D3DTLVertices[cVertex].sy = ymax; - D3DTLVertices[cVertex].sz = z; - D3DTLVertices[cVertex].tu = 0.0; - D3DTLVertices[cVertex].tv = 0.0; - D3DTLVertices[cVertex].rhw = D3DVAL( (1.0 / VB->Clip[index][3]) ); - D3DTLVertices[cVertex++].color = dwPVColor; - - D3DTLVertices[cVertex].sx = xmin; - D3DTLVertices[cVertex].sy = ymin; - D3DTLVertices[cVertex].sz = z; - D3DTLVertices[cVertex].tu = 0.0; - D3DTLVertices[cVertex].tv = 0.0; - D3DTLVertices[cVertex].rhw = D3DVAL( (1.0 / VB->Clip[index][3]) ); - D3DTLVertices[cVertex++].color = dwPVColor; - - D3DTLVertices[cVertex].sx = xmax; - D3DTLVertices[cVertex].sy = ymin; - D3DTLVertices[cVertex].sz = z; - D3DTLVertices[cVertex].tu = 0.0; - D3DTLVertices[cVertex].tv = 0.0; - D3DTLVertices[cVertex].rhw = D3DVAL( (1.0 / VB->Clip[index][3]) ); - D3DTLVertices[cVertex++].color = dwPVColor; - - D3DTLVertices[cVertex].sx = xmax; - D3DTLVertices[cVertex].sy = ymin; - D3DTLVertices[cVertex].sz = z; - D3DTLVertices[cVertex].tu = 0.0; - D3DTLVertices[cVertex].tv = 0.0; - D3DTLVertices[cVertex].rhw = D3DVAL( (1.0 / VB->Clip[index][3]) ); - D3DTLVertices[cVertex++].color = dwPVColor; - - D3DTLVertices[cVertex].sx = xmax; - D3DTLVertices[cVertex].sy = ymax; - D3DTLVertices[cVertex].sz = z; - D3DTLVertices[cVertex].tu = 0.0; - D3DTLVertices[cVertex].tv = 0.0; - D3DTLVertices[cVertex].rhw = D3DVAL( (1.0 / VB->Clip[index][3]) ); - D3DTLVertices[cVertex++].color = dwPVColor; - - D3DTLVertices[cVertex].sx = xmin; - D3DTLVertices[cVertex].sy = ymax; - D3DTLVertices[cVertex].sz = z; - D3DTLVertices[cVertex].tu = 0.0; - D3DTLVertices[cVertex].tv = 0.0; - D3DTLVertices[cVertex].rhw = D3DVAL( (1.0 / VB->Clip[index][3]) ); - D3DTLVertices[cVertex++].color = dwPVColor; - } - } - - /* Render the converted vertex buffer. */ - if ( cVertex ) - DrawPrimitiveHAL( pContext->pShared, D3DPT_TRIANGLELIST, &D3DTLVertices[0], cVertex ); -} -/*===========================================================================*/ -/* This gets call before we render any primitives so that the current OGL */ -/* states will be mapped the D3D context. I'm still not sure how D3D works */ -/* but I'm finding that it doesn't act like a state machine as OGL is. It */ -/* looks like the state gets set back to the defaults after a DrawPrimitives */ -/* or an EndScene. Also I set states that are the default even though this */ -/* is redundant as the defaults seem screwed up. */ -/* TODO: make a batch call. */ -/*===========================================================================*/ -/* RETURN: */ -/*===========================================================================*/ -static void SetRenderStates( GLcontext *ctx ) -{ - D3DMESACONTEXT *pContext = (D3DMESACONTEXT *)ctx->DriverCtx; - DWORD dwFunc; - static BOOL bTexture = FALSE; - static int texName = -1; - - DPF(( DBG_FUNC, "SetRenderStates();" )); - - if ( g_DBGMask & DBG_STATES ) - DebugRenderStates( ctx, FALSE ); - - SetStateHAL( pContext->pShared, D3DRENDERSTATE_CULLMODE, D3DCULL_NONE ); - SetStateHAL( pContext->pShared, D3DRENDERSTATE_DITHERENABLE, (ctx->Color.DitherFlag) ? TRUE : FALSE ); - - /*================================================*/ - /* Check too see if there are new TEXTURE states. */ - /*================================================*/ - if ( ctx->Texture._EnabledUnits ) - { - switch( ctx->Texture.Set[ctx->Texture.CurrentSet].EnvMode ) - { - case GL_MODULATE: - if ( ctx->Texture.Set[ctx->Texture.CurrentSet].Current->Image[0][0]->Format == GL_RGBA ) - dwFunc = pContext->pShared->dwTexFunc[d3dtblend_modulatealpha]; - else - dwFunc = pContext->pShared->dwTexFunc[d3dtblend_modulate]; - break; - - case GL_BLEND: - dwFunc = pContext->pShared->dwTexFunc[d3dtblend_decalalpha]; - break; - - case GL_REPLACE: - dwFunc = pContext->pShared->dwTexFunc[d3dtblend_decal]; - break; - - case GL_DECAL: - if ( ctx->Texture.Set[ctx->Texture.CurrentSet].Current->Image[0][0]->Format == GL_RGBA ) - dwFunc = pContext->pShared->dwTexFunc[d3dtblend_decalalpha]; - else - dwFunc = pContext->pShared->dwTexFunc[d3dtblend_decal]; - break; - } - SetStateHAL( pContext->pShared, D3DRENDERSTATE_TEXTUREMAPBLEND, dwFunc ); - - switch( ctx->Texture.Set[ctx->Texture.CurrentSet].Current->MagFilter ) - { - case GL_NEAREST: - dwFunc = D3DFILTER_NEAREST; - break; - case GL_LINEAR: - dwFunc = D3DFILTER_LINEAR; - break; - case GL_NEAREST_MIPMAP_NEAREST: - dwFunc = D3DFILTER_MIPNEAREST; - break; - case GL_LINEAR_MIPMAP_NEAREST: - dwFunc = D3DFILTER_LINEARMIPNEAREST; - break; - case GL_NEAREST_MIPMAP_LINEAR: - dwFunc = D3DFILTER_MIPLINEAR; - break; - case GL_LINEAR_MIPMAP_LINEAR: - dwFunc = D3DFILTER_LINEARMIPLINEAR; - break; - } - SetStateHAL( pContext->pShared, D3DRENDERSTATE_TEXTUREMAG, dwFunc ); - - switch( ctx->Texture.Set[ctx->Texture.CurrentSet].Current->MinFilter ) - { - case GL_NEAREST: - dwFunc = D3DFILTER_NEAREST; - break; - case GL_LINEAR: - dwFunc = D3DFILTER_LINEAR; - break; - case GL_NEAREST_MIPMAP_NEAREST: - dwFunc = D3DFILTER_MIPNEAREST; - break; - case GL_LINEAR_MIPMAP_NEAREST: - dwFunc = D3DFILTER_LINEARMIPNEAREST; - break; - case GL_NEAREST_MIPMAP_LINEAR: - dwFunc = D3DFILTER_MIPLINEAR; - break; - case GL_LINEAR_MIPMAP_LINEAR: - dwFunc = D3DFILTER_LINEARMIPLINEAR; - break; - } - SetStateHAL( pContext->pShared, D3DRENDERSTATE_TEXTUREMIN, dwFunc ); - - /* Another hack to cut down on redundant texture binding. */ - // if ( texName != ctx->Texture.Set[ctx->Texture.CurrentSet].Current->Name ) - // { - texName = ctx->Texture.Set[ctx->Texture.CurrentSet].Current->Name; - CreateTMgrHAL( pContext->pShared, - texName, - 0, - ctx->Texture.Set[ctx->Texture.CurrentSet].Current->Image[0][0]->Format, - (RECT *)NULL, - ctx->Texture.Set[ctx->Texture.CurrentSet].Current->Image[0][0]->Width, - ctx->Texture.Set[ctx->Texture.CurrentSet].Current->Image[0][0]->Height, - TM_ACTION_BIND, - (void *)ctx->Texture.Set[ctx->Texture.CurrentSet].Current->Image[0][0]->Data ); - // } - bTexture = TRUE; - } - else - { - /* This is nasty but should cut down on the number of redundant calls. */ - if ( bTexture == TRUE ) - { - DisableTMgrHAL( pContext->pShared ); - bTexture = FALSE; - } - } - - /*===============================================*/ - /* Check too see if there are new RASTER states. */ - /*===============================================*/ - - // TODO: no concept of front & back. - switch( ctx->Polygon.FrontMode ) - { - case GL_POINT: - SetStateHAL( pContext->pShared, D3DRENDERSTATE_FILLMODE, D3DFILL_POINT ); - break; - case GL_LINE: - SetStateHAL( pContext->pShared, D3DRENDERSTATE_FILLMODE, D3DFILL_WIREFRAME ); - break; - case GL_FILL: - SetStateHAL( pContext->pShared, D3DRENDERSTATE_FILLMODE, D3DFILL_SOLID ); - break; - } - - /*************/ - /* Z-Buffer. */ - /*************/ - if ( ctx->Depth.Test == GL_TRUE ) - { - switch( ctx->Depth.Func ) - { - case GL_NEVER: - dwFunc = D3DCMP_NEVER; - break; - case GL_LESS: - dwFunc = D3DCMP_LESS; - break; - case GL_GEQUAL: - dwFunc = D3DCMP_GREATEREQUAL; - break; - case GL_LEQUAL: - dwFunc = D3DCMP_LESSEQUAL; - break; - case GL_GREATER: - dwFunc = D3DCMP_GREATER; - break; - case GL_NOTEQUAL: - dwFunc = D3DCMP_NOTEQUAL; - break; - case GL_EQUAL: - dwFunc = D3DCMP_EQUAL; - break; - case GL_ALWAYS: - dwFunc = D3DCMP_ALWAYS; - break; - } - SetStateHAL( pContext->pShared, D3DRENDERSTATE_ZFUNC, dwFunc ); - SetStateHAL( pContext->pShared, D3DRENDERSTATE_ZENABLE, TRUE ); - } - else - { - SetStateHAL( pContext->pShared, D3DRENDERSTATE_ZENABLE, FALSE ); - } - - /*******************/ - /* Z-Write Enable. */ - /*******************/ - SetStateHAL( pContext->pShared, D3DRENDERSTATE_ZWRITEENABLE , (ctx->Depth.Mask == GL_TRUE) ? TRUE : FALSE ); - - /***************/ - /* Alpha test. */ - /***************/ - if ( ctx->Color.AlphaEnabled == GL_TRUE ) - { - switch( ctx->Color.AlphaFunc ) - { - case GL_NEVER: - dwFunc = D3DCMP_NEVER; - break; - case GL_LESS: - dwFunc = D3DCMP_LESS; - break; - case GL_GEQUAL: - dwFunc = D3DCMP_GREATEREQUAL; - break; - case GL_LEQUAL: - dwFunc = D3DCMP_LESSEQUAL; - break; - case GL_GREATER: - dwFunc = D3DCMP_GREATER; - break; - case GL_NOTEQUAL: - dwFunc = D3DCMP_NOTEQUAL; - break; - case GL_EQUAL: - dwFunc = D3DCMP_EQUAL; - break; - case GL_ALWAYS: - dwFunc = D3DCMP_ALWAYS; - break; - } - SetStateHAL( pContext->pShared, D3DRENDERSTATE_ALPHAFUNC , dwFunc ); - SetStateHAL( pContext->pShared, D3DRENDERSTATE_ALPHATESTENABLE, TRUE ); - } - else - { - SetStateHAL( pContext->pShared, D3DRENDERSTATE_ALPHATESTENABLE, FALSE ); - } - - /****************/ - /* Alpha blend. */ - /****************/ - if ( ctx->Color.BlendEnabled == GL_TRUE ) - { - switch( ctx->Color.BlendSrc ) - { - case GL_ZERO: - dwFunc = pContext->pShared->dwSrcBlendCaps[s_zero]; - break; - case GL_ONE: - dwFunc = pContext->pShared->dwSrcBlendCaps[s_one]; - break; - case GL_DST_COLOR: - dwFunc = pContext->pShared->dwSrcBlendCaps[s_dst_color]; - break; - case GL_ONE_MINUS_DST_COLOR: - dwFunc = pContext->pShared->dwSrcBlendCaps[s_one_minus_dst_color]; - break; - case GL_SRC_ALPHA: - dwFunc = pContext->pShared->dwSrcBlendCaps[s_src_alpha]; - break; - case GL_ONE_MINUS_SRC_ALPHA: - dwFunc = pContext->pShared->dwSrcBlendCaps[s_one_minus_src_alpha]; - break; - case GL_DST_ALPHA: - dwFunc = pContext->pShared->dwSrcBlendCaps[s_dst_alpha]; - break; - case GL_ONE_MINUS_DST_ALPHA: - dwFunc = pContext->pShared->dwSrcBlendCaps[s_one_minus_dst_alpha]; - break; - case GL_SRC_ALPHA_SATURATE: - dwFunc = pContext->pShared->dwSrcBlendCaps[s_src_alpha_saturate]; - break; - case GL_CONSTANT_COLOR: - dwFunc = pContext->pShared->dwSrcBlendCaps[s_constant_color]; - break; - case GL_ONE_MINUS_CONSTANT_COLOR: - dwFunc = pContext->pShared->dwSrcBlendCaps[s_one_minus_constant_color]; - break; - case GL_CONSTANT_ALPHA: - dwFunc = pContext->pShared->dwSrcBlendCaps[s_constant_alpha]; - break; - case GL_ONE_MINUS_CONSTANT_ALPHA: - dwFunc = pContext->pShared->dwSrcBlendCaps[s_one_minus_constant_alpha]; - break; - } - SetStateHAL( pContext->pShared, D3DRENDERSTATE_SRCBLEND, dwFunc ); - - switch( ctx->Color.BlendDst ) - { - case GL_ZERO: - dwFunc = pContext->pShared->dwDestBlendCaps[d_zero]; - break; - case GL_ONE: - dwFunc = pContext->pShared->dwDestBlendCaps[d_one]; - break; - case GL_SRC_COLOR: - dwFunc = pContext->pShared->dwDestBlendCaps[d_src_color]; - break; - case GL_ONE_MINUS_SRC_COLOR: - dwFunc = pContext->pShared->dwDestBlendCaps[d_one_minus_src_color]; - break; - case GL_SRC_ALPHA: - dwFunc = pContext->pShared->dwDestBlendCaps[d_src_alpha]; - break; - case GL_ONE_MINUS_SRC_ALPHA: - dwFunc = pContext->pShared->dwDestBlendCaps[d_one_minus_src_alpha]; - break; - case GL_DST_ALPHA: - dwFunc = pContext->pShared->dwDestBlendCaps[d_dst_alpha]; - break; - case GL_ONE_MINUS_DST_ALPHA: - dwFunc = pContext->pShared->dwDestBlendCaps[d_one_minus_dst_alpha]; - break; - case GL_CONSTANT_COLOR: - dwFunc = pContext->pShared->dwDestBlendCaps[d_constant_color]; - break; - case GL_ONE_MINUS_CONSTANT_COLOR: - dwFunc = pContext->pShared->dwDestBlendCaps[d_one_minus_constant_color]; - break; - case GL_CONSTANT_ALPHA: - dwFunc = pContext->pShared->dwDestBlendCaps[d_constant_alpha]; - break; - case GL_ONE_MINUS_CONSTANT_ALPHA: - dwFunc = pContext->pShared->dwDestBlendCaps[d_one_minus_constant_alpha]; - break; - } - SetStateHAL( pContext->pShared, D3DRENDERSTATE_DESTBLEND, dwFunc ); - SetStateHAL( pContext->pShared, D3DRENDERSTATE_ALPHABLENDENABLE, TRUE ); - } - else - { - SetStateHAL( pContext->pShared, D3DRENDERSTATE_ALPHABLENDENABLE, FALSE ); - } -} -/*===========================================================================*/ -/* If this function is called it will track the changes to the current */ -/* states that I'm setting in Direct3D. I did this so that the DPF's would */ -/* be under control! */ -/*===========================================================================*/ -/* RETURN: */ -/*===========================================================================*/ -static void DebugRenderStates( GLcontext *ctx, BOOL bForce ) -{ - D3DMESACONTEXT *pContext = (D3DMESACONTEXT *)ctx->DriverCtx; - DWORD dwFunc; - static int dither = -1, - texture = -1, - textName = -1, - textEnv = -1, - textMin = -1, - textMag = -1, - polyMode = -1, - depthTest = -1, - depthFunc = -1, - depthMask = -1, - alphaTest = -1, - alphaFunc = -1, - blend = -1, - blendSrc = -1, - blendDest = -1; - - /* Force a displayed update of all current states. */ - if ( bForce ) - { - dither = texture = textName = textEnv = textMin = textMag = -1; - polyMode = depthTest = depthFunc = depthMask = -1; - alphaTest = alphaFunc = blend = blendSrc = blendDest = -1; - } - - if ( dither != ctx->Color.DitherFlag ) - { - dither = ctx->Color.DitherFlag; - DPF(( 0, "\tDither\t\t%s", (dither) ? "ENABLED" : "--------" )); - } - if ( depthTest != ctx->Depth.Test ) - { - depthTest = ctx->Depth.Test; - DPF(( 0, "\tDepth Test\t%s", (depthTest) ? "ENABLED" : "--------" )); - } - if ( alphaTest != ctx->Color.AlphaEnabled ) - { - alphaTest = ctx->Color.AlphaEnabled; - - DPF(( 0, "\tAlpha Test\t%s", (alphaTest) ? "ENABLED" : "--------" )); - } - if ( blend != ctx->Color.BlendEnabled ) - { - blend = ctx->Color.BlendEnabled; - - DPF(( 0, "\tBlending\t%s", (blend) ? "ENABLED" : "--------" )); - } - - /*================================================*/ - /* Check too see if there are new TEXTURE states. */ - /*================================================*/ - if ( texture != ctx->Texture._EnabledUnits ) - { - texture = ctx->Texture._EnabledUnits; - DPF(( 0, "\tTexture\t\t%s", (texture) ? "ENABLED" : "--------" )); - } - - if ( ctx->Texture.Set[ctx->Texture.CurrentSet].Current ) - { - if ( ctx->Texture.Set[ctx->Texture.CurrentSet].Current->Name != textName ) - { - textName = ctx->Texture.Set[ctx->Texture.CurrentSet].Current->Name; - DPF(( 0, "\tTexture Name:\t%d", textName )); - DPF(( 0, "\tTexture Format:\t%s", - (ctx->Texture.Set[ctx->Texture.CurrentSet].Current->Image[0][0]->Format == GL_RGBA) ? - "GL_RGBA" : "GLRGB" )); - } - - if ( textEnv != ctx->Texture.Set[ctx->Texture.CurrentSet].EnvMode ) - { - textEnv = ctx->Texture.Set[ctx->Texture.CurrentSet].EnvMode; - - switch( textEnv ) - { - case GL_MODULATE: - DPF(( 0, "\tTexture\tMode\tGL_MODULATE" )); - break; - case GL_BLEND: - DPF(( 0, "\tTexture\tMode\tGL_BLEND" )); - break; - case GL_REPLACE: - DPF(( 0, "\tTexture\tMode\tGL_REPLACE" )); - break; - case GL_DECAL: - DPF(( 0, "\tTexture\tMode\tGL_DECAL" )); - break; - } - } - - if ( textMag != ctx->Texture.Set[ctx->Texture.CurrentSet].Current->MagFilter ) - { - textMag = ctx->Texture.Set[ctx->Texture.CurrentSet].Current->MagFilter; - - switch( textMag ) - { - case GL_NEAREST: - DPF(( 0, "\tTexture MAG\tGL_NEAREST" )); - break; - case GL_LINEAR: - DPF(( 0, "\tTexture MAG\tGL_LINEAR" )); - break; - case GL_NEAREST_MIPMAP_NEAREST: - DPF(( 0, "\tTexture MAG\tGL_NEAREST_MIPMAP_NEAREST" )); - break; - case GL_LINEAR_MIPMAP_NEAREST: - DPF(( 0, "\tTexture MAG\tGL_LINEAR_MIPMAP_NEAREST" )); - break; - case GL_NEAREST_MIPMAP_LINEAR: - DPF(( 0, "\tTexture MAG\tGL_NEAREST_MIPMAP_LINEAR" )); - break; - case GL_LINEAR_MIPMAP_LINEAR: - DPF(( 0, "\tTexture MAG\tGL_LINEAR_MIPMAP_LINEAR" )); - break; - } - } - - if ( textMin != ctx->Texture.Set[ctx->Texture.CurrentSet].Current->MinFilter ) - { - textMin = ctx->Texture.Set[ctx->Texture.CurrentSet].Current->MinFilter; - - switch( textMin ) - { - case GL_NEAREST: - DPF(( 0, "\tTexture MIN\tGL_NEAREST" )); - break; - case GL_LINEAR: - DPF(( 0, "\tTexture MIN\tGL_LINEAR" )); - break; - case GL_NEAREST_MIPMAP_NEAREST: - DPF(( 0, "\tTexture MIN\tGL_NEAREST_MIPMAP_NEAREST" )); - break; - case GL_LINEAR_MIPMAP_NEAREST: - DPF(( 0, "\tTexture MIN\tGL_LINEAR_MIPMAP_NEAREST" )); - break; - case GL_NEAREST_MIPMAP_LINEAR: - DPF(( 0, "\tTexture MIN\tGL_LINEAR_MIPMAP_LINEAR" )); - break; - case GL_LINEAR_MIPMAP_LINEAR: - DPF(( 0, "\tTexture MIN\tGL_LINEAR_MIPMAP_LINEAR" )); - break; - } - } - } - - if ( ctx->Polygon.FrontMode != polyMode ) - { - polyMode = ctx->Polygon.FrontMode; - - switch( polyMode ) - { - case GL_POINT: - DPF(( 0, "\tMode\t\tGL_POINT" )); - break; - case GL_LINE: - DPF(( 0, "\tMode\t\tGL_LINE" )); - break; - case GL_FILL: - DPF(( 0, "\tMode\t\tGL_FILL" )); - break; - } - } - - if ( depthFunc != ctx->Depth.Func ) - { - depthFunc = ctx->Depth.Func; - - switch( depthFunc ) - { - case GL_NEVER: - DPF(( 0, "\tDepth Func\tGL_NEVER" )); - break; - case GL_LESS: - DPF(( 0, "\tDepth Func\tGL_LESS" )); - break; - case GL_GEQUAL: - DPF(( 0, "\tDepth Func\tGL_GEQUAL" )); - break; - case GL_LEQUAL: - DPF(( 0, "\tDepth Func\tGL_LEQUAL" )); - break; - case GL_GREATER: - DPF(( 0, "\tDepth Func\tGL_GREATER" )); - break; - case GL_NOTEQUAL: - DPF(( 0, "\tDepth Func\tGL_NOTEQUAL" )); - break; - case GL_EQUAL: - DPF(( 0, "\tDepth Func\tGL_EQUAL" )); - break; - case GL_ALWAYS: - DPF(( 0, "\tDepth Func\tGL_ALWAYS" )); - break; - } - } - - if ( depthMask != ctx->Depth.Mask ) - { - depthMask = ctx->Depth.Mask; - DPF(( 0, "\tZWrite\t\t%s", (depthMask) ? "ENABLED" : "--------" )); - } - - if ( alphaFunc != ctx->Color.AlphaFunc ) - { - alphaFunc = ctx->Color.AlphaFunc; - - switch( alphaFunc ) - { - case GL_NEVER: - DPF(( 0, "\tAlpha Func\tGL_NEVER" )); - break; - case GL_LESS: - DPF(( 0, "\tAlpha Func\tGL_LESS" )); - break; - case GL_GEQUAL: - DPF(( 0, "\tAlpha Func\tGL_GEQUAL" )); - break; - case GL_LEQUAL: - DPF(( 0, "\tAlpha Func\tGL_LEQUAL" )); - break; - case GL_GREATER: - DPF(( 0, "\tAlpha Func\tGL_GREATER" )); - break; - case GL_NOTEQUAL: - DPF(( 0, "\tAlpha Func\tGL_NOTEQUAL" )); - break; - case GL_EQUAL: - DPF(( 0, "\tAlpha Func\tGL_EQUAL" )); - break; - case GL_ALWAYS: - DPF(( 0, "\tAlpha Func\tGL_ALWAYS" )); - break; - } - } - - if ( blendSrc != ctx->Color.BlendSrc ) - { - blendSrc = ctx->Color.BlendSrc; - - switch( blendSrc ) - { - case GL_ZERO: - DPF(( 0, "\tSRC Blend\tGL_ZERO" )); - break; - case GL_ONE: - DPF(( 0, "\tSRC Blend\tGL_ONE" )); - break; - case GL_DST_COLOR: - DPF(( 0, "\tSRC Blend\tGL_DST_COLOR" )); - break; - case GL_ONE_MINUS_DST_COLOR: - DPF(( 0, "\tSRC Blend\tGL_ONE_MINUS_DST_COLOR" )); - break; - case GL_SRC_ALPHA: - DPF(( 0, "\tSRC Blend\tGL_SRC_ALPHA" )); - break; - case GL_ONE_MINUS_SRC_ALPHA: - DPF(( 0, "\tSRC Blend\tGL_MINUS_SRC_ALPHA" )); - break; - case GL_DST_ALPHA: - DPF(( 0, "\tSRC Blend\tGL_DST_ALPHA" )); - break; - case GL_ONE_MINUS_DST_ALPHA: - DPF(( 0, "\tSRC Blend\tGL_ONE_MINUS_DST_ALPHA" )); - break; - case GL_SRC_ALPHA_SATURATE: - DPF(( 0, "\tSRC Blend\tGL_SRC_ALPHA_SATURATE" )); - break; - case GL_CONSTANT_COLOR: - DPF(( 0, "\tSRC Blend\tGL_CONSTANT_COLOR" )); - break; - case GL_ONE_MINUS_CONSTANT_COLOR: - DPF(( 0, "\tSRC Blend\tGL_ONE_MINUS_CONSTANT_COLOR" )); - break; - case GL_CONSTANT_ALPHA: - DPF(( 0, "\tSRC Blend\tGL_CONSTANT_ALPHA" )); - break; - case GL_ONE_MINUS_CONSTANT_ALPHA: - DPF(( 0, "\tSRC Blend\tGL_ONE_MINUS_CONSTANT_ALPHA" )); - break; - } - } - - if ( blendDest != ctx->Color.BlendDst ) - { - blendDest = ctx->Color.BlendDst; - - switch( blendDest ) - { - case GL_ZERO: - DPF(( 0, "\tDST Blend\tGL_ZERO" )); - break; - case GL_ONE: - DPF(( 0, "\tDST Blend\tGL_ONE" )); - break; - case GL_SRC_COLOR: - DPF(( 0, "\tDST Blend\tGL_SRC_COLOR" )); - break; - case GL_ONE_MINUS_SRC_COLOR: - DPF(( 0, "\tDST Blend\tGL_ONE_MINUS_SRC_COLOR" )); - break; - case GL_SRC_ALPHA: - DPF(( 0, "\tDST Blend\tGL_SRC_ALPHA" )); - break; - case GL_ONE_MINUS_SRC_ALPHA: - DPF(( 0, "\tDST Blend\tGL_ONE_MINUS_SRC_ALPHA" )); - break; - case GL_DST_ALPHA: - DPF(( 0, "\tDST Blend\tGL_DST_ALPHA" )); - break; - case GL_ONE_MINUS_DST_ALPHA: - DPF(( 0, "\tDST Blend\tGL_ONE_MINUS_DST_ALPHA" )); - break; - case GL_CONSTANT_COLOR: - DPF(( 0, "\tDST Blend\tGL_CONSTANT_COLOR" )); - break; - case GL_ONE_MINUS_CONSTANT_COLOR: - DPF(( 0, "\tDST Blend\tGL_ONE_MINUS_CONSTANT_COLOR" )); - break; - case GL_CONSTANT_ALPHA: - DPF(( 0, "\tDST Blend\tGL_CONSTANT_ALPHA" )); - break; - case GL_ONE_MINUS_CONSTANT_ALPHA: - DPF(( 0, "\tDST Blend\tGL_ONE_MINUS_CONSTANT_ALPHA" )); - break; - } - } -} diff --git a/src/mesa/drivers/d3d/DDrawPROCS.c b/src/mesa/drivers/d3d/DDrawPROCS.c deleted file mode 100644 index 10dcfdbabb..0000000000 --- a/src/mesa/drivers/d3d/DDrawPROCS.c +++ /dev/null @@ -1,399 +0,0 @@ -/*===========================================================================*/ -/* */ -/* Mesa-3.0 DirectX 6 Driver */ -/* */ -/* By Leigh McRae */ -/* */ -/* http://www.altsoftware.com/ */ -/* */ -/* Copyright (c) 1999-1998 alt.software inc. All Rights Reserved */ -/*===========================================================================*/ -#include "D3DMesa.h" -/*===========================================================================*/ -/* This call will clear the render surface using the pixel info built from */ -/* the surface at creation time. The call uses Lock/Unlock to access the */ -/* surface. The call also special cases a full clear or a dirty rectangle. */ -/* Finally the call returns the new clear mask that reflects that the color */ -/* buffer was cleared. */ -/*===========================================================================*/ -/* RETURN: the original mask with the bits cleared that represents the buffer*/ -/* or buffers we just cleared. */ -/*===========================================================================*/ -GLbitfield ClearBuffers( GLcontext *ctx, GLbitfield mask, GLboolean all, GLint x, GLint y, GLint width, GLint height ) -{ - D3DMESACONTEXT *pContext = (D3DMESACONTEXT *)ctx->DriverCtx; - DDSURFACEDESC2 *pddsd2; - UCHAR *pBuffer, - *pScanLine; - int index, - index2; - DWORD dwColor; - - if ( mask & GL_COLOR_BUFFER_BIT ) - { - /* Lock the surface to get the surface pointer. */ - pddsd2 = LockHAL( pContext->pShared, TRUE ); - - /* Solve the color once only. */ - dwColor = ( ((DWORD)((float)pContext->rClear * pContext->pShared->pixel.rScale)) << pContext->pShared->pixel.rShift ); - dwColor |= ( ((DWORD)((float)pContext->gClear * pContext->pShared->pixel.gScale)) << pContext->pShared->pixel.gShift ); - dwColor |= ( ((DWORD)((float)pContext->bClear * pContext->pShared->pixel.bScale)) << pContext->pShared->pixel.bShift ); - - if ( all ) - { - for( index = 0, pScanLine = (UCHAR *)pddsd2->lpSurface; index < pContext->pShared->dwHeight; index++, pScanLine += pddsd2->lPitch ) - for( pBuffer = pScanLine, index2 = 0; index2 < pContext->pShared->dwWidth; index2++, pBuffer += pContext->pShared->pixel.cb ) - memcpy( pBuffer, &dwColor, pContext->pShared->pixel.cb ); - } - else - { - pScanLine = ((UCHAR *)pddsd2->lpSurface) + - ( (FLIP( pContext->pShared->dwHeight, (y+height)) * pddsd2->lPitch) + (x * pContext->pShared->pixel.cb) ); - - for( index = 0; index < height; index++, pScanLine += pddsd2->lPitch ) - { - for( index2 = 0, pBuffer = pScanLine; index2 < width; index2++, pBuffer += pContext->pShared->pixel.cb ) - memcpy( pBuffer, &dwColor, pContext->pShared->pixel.cb ); - } - } - - UnlockHAL( pContext->pShared, TRUE ); - } - - return (mask & ~GL_COLOR_BUFFER_BIT); -} -/*===========================================================================*/ -/* This proc (as all others) has been written for the general case. I use */ -/* the PIXELINFO structure to pack the pixel from RGB24 to whatever the Off- */ -/* Screen render surface uses. The alpha is ignored as Mesa does it in SW. */ -/*===========================================================================*/ -/* RETURN: */ -/*===========================================================================*/ -void WSpanRGB( const GLcontext* ctx, GLuint n, GLint x, GLint y, const GLubyte rgb[][3], const GLubyte mask[] ) -{ - D3DMESACONTEXT *pContext = (D3DMESACONTEXT *)ctx->DriverCtx; - DDSURFACEDESC2 *pddsd2; - UCHAR *pBuffer; - int index; - DWORD dwColor; - - /* Get the surface pointer and the pitch. */ - pddsd2 = LockHAL( pContext->pShared, TRUE ); - - /* Find the start of the span. Invert y for Windows. */ - pBuffer = (UCHAR *)pddsd2->lpSurface + (FLIP(pContext->pShared->dwHeight,y) * pddsd2->lPitch) + (x*pContext->pShared->pixel.cb); - - if ( mask ) - { - for( index = 0; index < n; index++, pBuffer += pContext->pShared->pixel.cb ) - { - if ( mask[index] ) - { - /* Pack the color components. */ - dwColor = ( ((DWORD)((float)rgb[index][RCOMP] * pContext->pShared->pixel.rScale)) << pContext->pShared->pixel.rShift ); - dwColor |= ( ((DWORD)((float)rgb[index][GCOMP] * pContext->pShared->pixel.gScale)) << pContext->pShared->pixel.gShift ); - dwColor |= ( ((DWORD)((float)rgb[index][BCOMP] * pContext->pShared->pixel.bScale)) << pContext->pShared->pixel.bShift ); - memcpy( pBuffer, &dwColor, pContext->pShared->pixel.cb ); - } - } - } - else - { - for( index = 0; index < n; index++, pBuffer += pContext->pShared->pixel.cb ) - { - /* Pack the color components. */ - dwColor = ( ((DWORD)((float)rgb[index][RCOMP] * pContext->pShared->pixel.rScale)) << pContext->pShared->pixel.rShift ); - dwColor |= ( ((DWORD)((float)rgb[index][GCOMP] * pContext->pShared->pixel.gScale)) << pContext->pShared->pixel.gShift ); - dwColor |= ( ((DWORD)((float)rgb[index][BCOMP] * pContext->pShared->pixel.bScale)) << pContext->pShared->pixel.bShift ); - memcpy( pBuffer, &dwColor, pContext->pShared->pixel.cb ); - } - } - - /* Giver back. */ - UnlockHAL( pContext->pShared, TRUE ); -} -/*===========================================================================*/ -/* This proc (as all others) has been written for the general case. I use */ -/* the PIXELINFO structure to pack the pixel from RGB24 to whatever the Off- */ -/* Screen render surface uses. The alpha is ignored as Mesa does it in SW. */ -/*===========================================================================*/ -/* RETURN: */ -/*===========================================================================*/ -void WSpanRGBA( const GLcontext* ctx, GLuint n, GLint x, GLint y, const GLubyte rgba[][4], const GLubyte mask[] ) -{ - D3DMESACONTEXT *pContext = (D3DMESACONTEXT *)ctx->DriverCtx; - DDSURFACEDESC2 *pddsd2; - UCHAR *pBuffer; - int index; - DWORD dwColor; - - /* Get the surface pointer and the pitch. */ - pddsd2 = LockHAL( pContext->pShared, TRUE ); - - /* Find the start of the span. Invert y for Windows. */ - pBuffer = (UCHAR *)pddsd2->lpSurface + (FLIP(pContext->pShared->dwHeight,y) * pddsd2->lPitch) + (x*pContext->pShared->pixel.cb); - - if ( mask ) - { - for( index = 0; index < n; index++, pBuffer += pContext->pShared->pixel.cb ) - { - if ( mask[index] ) - { - /* Pack the color components. */ - dwColor = ( ((DWORD)((float)rgba[index][RCOMP] * pContext->pShared->pixel.rScale)) << pContext->pShared->pixel.rShift ); - dwColor |= ( ((DWORD)((float)rgba[index][GCOMP] * pContext->pShared->pixel.gScale)) << pContext->pShared->pixel.gShift ); - dwColor |= ( ((DWORD)((float)rgba[index][BCOMP] * pContext->pShared->pixel.bScale)) << pContext->pShared->pixel.bShift ); - memcpy( pBuffer, &dwColor, pContext->pShared->pixel.cb ); - } - } - } - else - { - for( index = 0; index < n; index++, pBuffer += pContext->pShared->pixel.cb ) - { - /* Pack the color components. */ - dwColor = ( ((DWORD)((float)rgba[index][RCOMP] * pContext->pShared->pixel.rScale)) << pContext->pShared->pixel.rShift ); - dwColor |= ( ((DWORD)((float)rgba[index][GCOMP] * pContext->pShared->pixel.gScale)) << pContext->pShared->pixel.gShift ); - dwColor |= ( ((DWORD)((float)rgba[index][BCOMP] * pContext->pShared->pixel.bScale)) << pContext->pShared->pixel.bShift ); - memcpy( pBuffer, &dwColor, pContext->pShared->pixel.cb ); - } - } - - /* Giver back. */ - UnlockHAL( pContext->pShared, TRUE ); -} -/*===========================================================================*/ -/* This proc (as all others) has been written for the general case. I use */ -/* the PIXELINFO structure to pack the pixel from RGB24 to whatever the Off- */ -/* Screen render surface uses. The color is solved once from the current */ -/* color components. The alpha is ignored as Mesa is doing it in SW. */ -/*===========================================================================*/ -/* RETURN: */ -/*===========================================================================*/ -void WSpanRGBAMono( const GLcontext* ctx, GLuint n, GLint x, GLint y, const GLubyte mask[] ) -{ - D3DMESACONTEXT *pContext = (D3DMESACONTEXT *)ctx->DriverCtx; - DDSURFACEDESC2 *pddsd2; - UCHAR *pBuffer; - int index; - DWORD dwColor; - - /* Lock the surface to get the surface pointer and the pitch. */ - pddsd2 = LockHAL( pContext->pShared, TRUE ); - - /* Solve the color once only. (no alpha) */ - dwColor = ( ((DWORD)((float)pContext->rCurrent * pContext->pShared->pixel.rScale)) << pContext->pShared->pixel.rShift ); - dwColor |= ( ((DWORD)((float)pContext->gCurrent * pContext->pShared->pixel.gScale)) << pContext->pShared->pixel.gShift ); - dwColor |= ( ((DWORD)((float)pContext->bCurrent * pContext->pShared->pixel.bScale)) << pContext->pShared->pixel.bShift ); - - /* Find the start of the span. Invert y for Windows. */ - pBuffer = (UCHAR *)pddsd2->lpSurface + (FLIP(pContext->pShared->dwHeight,y) * pddsd2->lPitch) + (x*pContext->pShared->pixel.cb); - - if ( mask ) - { - for( index = 0; index < n; index++, pBuffer += pContext->pShared->pixel.cb ) - if ( mask[index] ) - memcpy( pBuffer, &dwColor, pContext->pShared->pixel.cb ); - } - else - { - for( index = 0; index < n; index++, pBuffer += pContext->pShared->pixel.cb ) - memcpy( pBuffer, &dwColor, pContext->pShared->pixel.cb ); - } - - /* Giver back. */ - UnlockHAL( pContext->pShared, TRUE ); -} -/*===========================================================================*/ -/* This proc (as all others) has been written for the general case. I use */ -/* the PIXELINFO structure to pack the pixel from RGB24 to whatever the Off- */ -/* Screen render surface uses. The alpha is ignored as Mesa does it in SW. */ -/*===========================================================================*/ -/* RETURN: */ -/*===========================================================================*/ -void WPixelsRGBA( const GLcontext* ctx, GLuint n, const GLint x[], const GLint y[], const GLubyte rgba[][4], const GLubyte mask[] ) -{ - D3DMESACONTEXT *pContext = (D3DMESACONTEXT *)ctx->DriverCtx; - DDSURFACEDESC2 *pddsd2; - UCHAR *pBuffer; - int index; - DWORD dwColor; - - /* Get the surface pointer and the pitch. */ - pddsd2 = LockHAL( pContext->pShared, TRUE ); - - if ( mask ) - { - for( index = 0; index < n; index++ ) - { - if ( mask[index] ) - { - /* Pack the color components. */ - dwColor = ( ((DWORD)((float)rgba[index][RCOMP] * pContext->pShared->pixel.rScale)) << pContext->pShared->pixel.rShift ); - dwColor |= ( ((DWORD)((float)rgba[index][GCOMP] * pContext->pShared->pixel.gScale)) << pContext->pShared->pixel.gShift ); - dwColor |= ( ((DWORD)((float)rgba[index][BCOMP] * pContext->pShared->pixel.bScale)) << pContext->pShared->pixel.bShift ); - - /* Find the pixel. Invert y for Windows. */ - pBuffer = (UCHAR *)pddsd2->lpSurface + (FLIP(pContext->pShared->dwHeight,y[index]) * pddsd2->lPitch) + (x[index]*pContext->pShared->pixel.cb); - memcpy( pBuffer, &dwColor, pContext->pShared->pixel.cb ); - } - } - } - else - { - for( index = 0; index < n; index++ ) - { - /* Pack the color components. */ - dwColor = ( ((DWORD)((float)rgba[index][RCOMP] * pContext->pShared->pixel.rScale)) << pContext->pShared->pixel.rShift ); - dwColor |= ( ((DWORD)((float)rgba[index][GCOMP] * pContext->pShared->pixel.gScale)) << pContext->pShared->pixel.gShift ); - dwColor |= ( ((DWORD)((float)rgba[index][BCOMP] * pContext->pShared->pixel.bScale)) << pContext->pShared->pixel.bShift ); - - /* Find the pixel. Invert y for Windows. */ - pBuffer = (UCHAR *)pddsd2->lpSurface + (FLIP(pContext->pShared->dwHeight,y[index]) * pddsd2->lPitch) + (x[index]*pContext->pShared->pixel.cb); - memcpy( pBuffer, &dwColor, pContext->pShared->pixel.cb ); - } - } - - /* Giver back. */ - UnlockHAL( pContext->pShared, TRUE ); -} -/*===========================================================================*/ -/* This proc (as all others) has been written for the general case. I use */ -/* the PIXELINFO structure to pack the pixel from RGB24 to whatever the Off- */ -/* Screen render surface uses. The color is solved once from the current */ -/* color components. The alpha is ignored as Mesa is doing it in SW. */ -/*===========================================================================*/ -/* RETURN: */ -/*===========================================================================*/ -void WPixelsRGBAMono( const GLcontext* ctx, GLuint n, const GLint x[], const GLint y[], const GLubyte mask[] ) -{ - D3DMESACONTEXT *pContext = (D3DMESACONTEXT *)ctx->DriverCtx; - DDSURFACEDESC2 *pddsd2; - UCHAR *pBuffer; - int index; - DWORD dwColor; - - /* Get the surface pointer and the pitch. */ - pddsd2 = LockHAL( pContext->pShared, TRUE ); - - /* Solve the color once only. I don't uses the alpha. */ - dwColor = ( ((DWORD)((float)pContext->rCurrent * pContext->pShared->pixel.rScale)) << pContext->pShared->pixel.rShift ); - dwColor |= ( ((DWORD)((float)pContext->gCurrent * pContext->pShared->pixel.gScale)) << pContext->pShared->pixel.gShift ); - dwColor |= ( ((DWORD)((float)pContext->bCurrent * pContext->pShared->pixel.bScale)) << pContext->pShared->pixel.bShift ); - - if ( mask ) - { - /* We store the surface pointer as a UCHAR so that pixel.cb (count in btyles) will work for all. */ - for( index = 0; index < n; index++ ) - { - if ( mask[index] ) - { - /* Find the pixel. Invert y for Windows. */ - pBuffer = (UCHAR *)pddsd2->lpSurface + (FLIP(pContext->pShared->dwHeight,y[index]) * pddsd2->lPitch) + (x[index]*pContext->pShared->pixel.cb); - memcpy( pBuffer, &dwColor, pContext->pShared->pixel.cb ); - } - } - } - else - { - /* We store the surface pointer as a UCHAR so that pixel.cb (count in btyles) will work for all. */ - for( index = 0; index < n; index++ ) - { - /* Find the pixel. Invert y for Windows. */ - pBuffer = (UCHAR *)pddsd2->lpSurface + (FLIP(pContext->pShared->dwHeight,y[index]) * pddsd2->lPitch) + (x[index]*pContext->pShared->pixel.cb); - memcpy( pBuffer, &dwColor, pContext->pShared->pixel.cb ); - } - } - - /* Giver back. */ - UnlockHAL( pContext->pShared, TRUE ); -} -/*===========================================================================*/ -/* This proc isn't written for speed rather its to handle the general case. */ -/* I grab each pixel from the surface and unpack the info using the PIXELINFO*/ -/* structure that was generated from the OffScreen surface pixelformat. The */ -/* function will not fill in the alpha value as Mesa I have Mesa allocate its*/ -/* own alpha channel when the context was created. I did this as I didn't */ -/* feel that it was worth the effort to try and get HW to work (bus bound). */ -/*===========================================================================*/ -/* RETURN: */ -/*===========================================================================*/ -void RSpanRGBA( const GLcontext* ctx, GLuint n, GLint x, GLint y, GLubyte rgba[][4] ) -{ - D3DMESACONTEXT *pContext = (D3DMESACONTEXT *)ctx->DriverCtx; - DDSURFACEDESC2 *pddsd2; - UCHAR *pBuffer; - int index; - DWORD *pdwColor; - - /* Get the surface pointer and the pitch. */ - pddsd2 = LockHAL( pContext->pShared, TRUE ); - - /* Find the start of the span. Invert y for Windows. */ - pBuffer = (UCHAR *)pddsd2->lpSurface + - (FLIP(pContext->pShared->dwHeight,y) * pddsd2->lPitch) + - (x*pContext->pShared->pixel.cb); - - /* We store the surface pointer as a UCHAR so that pixel.cb (count in btyles) will work for all. */ - for( index = 0; index < n; index++, pBuffer += pContext->pShared->pixel.cb ) - { - pdwColor = (DWORD *)pBuffer; - rgba[index][RCOMP] = (GLubyte)((float)((*pdwColor & pContext->pShared->pixel.dwRMask) >> pContext->pShared->pixel.rShift) / pContext->pShared->pixel.rScale); - rgba[index][GCOMP] = (GLubyte)((float)((*pdwColor & pContext->pShared->pixel.dwGMask) >> pContext->pShared->pixel.gShift) / pContext->pShared->pixel.gScale); - rgba[index][BCOMP] = (GLubyte)((float)((*pdwColor & pContext->pShared->pixel.dwBMask) >> pContext->pShared->pixel.bShift) / pContext->pShared->pixel.bScale); - } - - /* Giver back. */ - UnlockHAL( pContext->pShared, TRUE ); -} -/*===========================================================================*/ -/* This proc isn't written for speed rather its to handle the general case. */ -/* I grab each pixel from the surface and unpack the info using the PIXELINFO*/ -/* structure that was generated from the OffScreen surface pixelformat. The */ -/* function will not fill in the alpha value as Mesa I have Mesa allocate its*/ -/* own alpha channel when the context was created. I did this as I didn't */ -/* feel that it was worth the effort to try and get HW to work (bus bound). */ -/*===========================================================================*/ -/* RETURN: */ -/*===========================================================================*/ -void RPixelsRGBA( const GLcontext* ctx, GLuint n, const GLint x[], const GLint y[], GLubyte rgba[][4], const GLubyte mask[] ) -{ - D3DMESACONTEXT *pContext = (D3DMESACONTEXT *)ctx->DriverCtx; - DDSURFACEDESC2 *pddsd2; - int index; - DWORD *pdwColor; - - /* Get the surface pointer and the pitch. */ - pddsd2 = LockHAL( pContext->pShared, TRUE ); - - if ( mask ) - { - /* We store the surface pointer as a UCHAR so that pixel.cb (count in btyles) will work for all. */ - for( index = 0; index < n; index++ ) - { - if ( mask[index] ) - { - /* Find the start of the pixel. Invert y for Windows. */ - pdwColor = (DWORD *)((UCHAR *)pddsd2->lpSurface + (FLIP(pContext->pShared->dwHeight,y[index]) * pddsd2->lPitch) + (x[index]*pContext->pShared->pixel.cb)); - rgba[index][RCOMP] = (GLubyte)((float)((*pdwColor & pContext->pShared->pixel.dwRMask) >> pContext->pShared->pixel.rShift) / pContext->pShared->pixel.rScale); - rgba[index][GCOMP] = (GLubyte)((float)((*pdwColor & pContext->pShared->pixel.dwGMask) >> pContext->pShared->pixel.gShift) / pContext->pShared->pixel.gScale); - rgba[index][BCOMP] = (GLubyte)((float)((*pdwColor & pContext->pShared->pixel.dwBMask) >> pContext->pShared->pixel.bShift) / pContext->pShared->pixel.bScale); - } - } - } - else - { - /* We store the surface pointer as a UCHAR so that pixel.cb (count in btyles) will work for all. */ - for( index = 0; index < n; index++ ) - { - /* Find the start of the pixel. Invert y for Windows. */ - pdwColor = (DWORD *)((UCHAR *)pddsd2->lpSurface + (FLIP(pContext->pShared->dwHeight,y[index]) * pddsd2->lPitch) + (x[index]*pContext->pShared->pixel.cb)); - rgba[index][RCOMP] = (GLubyte)((float)((*pdwColor & pContext->pShared->pixel.dwRMask) >> pContext->pShared->pixel.rShift) / pContext->pShared->pixel.rScale); - rgba[index][GCOMP] = (GLubyte)((float)((*pdwColor & pContext->pShared->pixel.dwGMask) >> pContext->pShared->pixel.gShift) / pContext->pShared->pixel.gScale); - rgba[index][BCOMP] = (GLubyte)((float)((*pdwColor & pContext->pShared->pixel.dwBMask) >> pContext->pShared->pixel.bShift) / pContext->pShared->pixel.bScale); - } - } - - /* Giver back. */ - UnlockHAL( pContext->pShared, TRUE ); -} diff --git a/src/mesa/drivers/d3d/DEBUG.C b/src/mesa/drivers/d3d/DEBUG.C deleted file mode 100644 index 79e273903a..0000000000 --- a/src/mesa/drivers/d3d/DEBUG.C +++ /dev/null @@ -1,143 +0,0 @@ -/*===========================================================================*/ -/* */ -/* Mesa-3.0 DirectX 6 Driver */ -/* */ -/* By Leigh McRae */ -/* */ -/* http://www.altsoftware.com/ */ -/* */ -/* Copyright (c) 1999-1998 alt.software inc. All Rights Reserved */ -/*===========================================================================*/ -#include "Debug.h" -/*===========================================================================*/ -/* Global variables. */ -/*===========================================================================*/ -DWORD g_DBGMask = DBG_ALL_ERROR; -/*===========================================================================*/ -/* This is your basic DPF function with printf like support. The function */ -/* also works with a global debug mask variable. I have written support that*/ -/* allows for the user's enviroment variable space to be read and set the */ -/* masks. This is done when the dll starts and is only in the debug version.*/ -/*===========================================================================*/ -/* RETURN: */ -/*===========================================================================*/ -void _cdecl DebugPrint( int mask, char *pszFormat, ... ) -{ - char buffer[512]; - va_list args; - - /* A mask of 0 will always pass. Easy to remeber. */ - if ( (mask == 0) || (mask & g_DBGMask) ) - { - va_start( args, pszFormat ); - - if ( mask & DBG_ALL_ERROR ) - OutputDebugString( "MesaD3D: (ERROR)" ); - else - OutputDebugString( "MesaD3D: " ); - - vsprintf( buffer, pszFormat, args ); - strcat( buffer, "\n" ); - OutputDebugString( buffer ); - - va_end( args ); - } -} -/*===========================================================================*/ -/* This call reads the users enviroment variables and sets any debug mask */ -/* that they have set to TRUE. Now the value must be "TRUE". */ -/*===========================================================================*/ -/* RETURN: */ -/*===========================================================================*/ -void ReadDBGEnv( void ) -{ - g_DBGMask = DBG_ALL_ERROR; - -#define IS_VAR_SET(v) if ( getenv( # v ) && !strcmp(getenv( # v ),"TRUE") ) g_DBGMask |= v; - - IS_VAR_SET( DBG_FUNC ); - IS_VAR_SET( DBG_STATES ); - - IS_VAR_SET( DBG_CNTX_INFO ); - IS_VAR_SET( DBG_CNTX_WARN ); - IS_VAR_SET( DBG_CNTX_PROFILE ); - IS_VAR_SET( DBG_CNTX_ERROR ); - IS_VAR_SET( DBG_CNTX_ALL ); - - IS_VAR_SET( DBG_PRIM_INFO ); - IS_VAR_SET( DBG_PRIM_WARN ); - IS_VAR_SET( DBG_PRIM_PROFILE ); - IS_VAR_SET( DBG_PRIM_ERROR ); - IS_VAR_SET( DBG_PRIM_ALL ); - - IS_VAR_SET( DBG_TXT_INFO ); - IS_VAR_SET( DBG_TXT_WARN ); - IS_VAR_SET( DBG_TXT_PROFILE ); - IS_VAR_SET( DBG_TXT_ERROR ); - IS_VAR_SET( DBG_TXT_ALL ); - - IS_VAR_SET( DBG_ALL_INFO ); - IS_VAR_SET( DBG_ALL_WARN ); - IS_VAR_SET( DBG_ALL_PROFILE ); - IS_VAR_SET( DBG_ALL_ERROR ); - IS_VAR_SET( DBG_ALL ); - -#undef IS_VAR_SET -} -/*===========================================================================*/ -/* This function will take a pointer to a DDSURFACEDESC2 structure & display*/ -/* the parsed information using a DPF call. */ -/*===========================================================================*/ -/* RETURN: */ -/*===========================================================================*/ -void DebugPixelFormat( char *pszSurfaceName, DDPIXELFORMAT *pddpf ) -{ - char buffer[256]; - - /* Parse the flag type and write the string equivalent. */ - if ( pddpf->dwFlags & DDPF_ALPHA ) - strcat( buffer, "DDPF_ALPHA " ); - if ( pddpf->dwFlags & DDPF_ALPHAPIXELS ) - strcat( buffer, "DDPF_ALPHAPIXELS " ); - if ( pddpf->dwFlags & DDPF_ALPHAPREMULT ) - strcat( buffer, "DDPF_ALPHAPREMULT " ); - if ( pddpf->dwFlags & DDPF_BUMPLUMINANCE ) - strcat( buffer, "DDPF_BUMPLUMINANCE " ); - if ( pddpf->dwFlags & DDPF_BUMPDUDV ) - strcat( buffer, "DDPF_BUMPDUDV " ); - if ( pddpf->dwFlags & DDPF_COMPRESSED ) - strcat( buffer, "DDPF_COMPRESSED " ); - if ( pddpf->dwFlags & DDPF_FOURCC ) - strcat( buffer, "DDPF_FOURCC " ); - if ( pddpf->dwFlags & DDPF_LUMINANCE ) - strcat( buffer, "DDPF_LUMINANCE " ); - if ( pddpf->dwFlags & DDPF_PALETTEINDEXED1 ) - strcat( buffer, "DDPF_PALETTEINDEXED1 " ); - if ( pddpf->dwFlags & DDPF_PALETTEINDEXED2 ) - strcat( buffer, "DDPF_PALETTEINDEXED2 " ); - if ( pddpf->dwFlags & DDPF_PALETTEINDEXED4 ) - strcat( buffer, "DDPF_PALETTEINDEXED4 " ); - if ( pddpf->dwFlags & DDPF_PALETTEINDEXED8 ) - strcat( buffer, "DDPF_PALETTEINDEXED8 " ); - if ( pddpf->dwFlags & DDPF_PALETTEINDEXEDTO8 ) - strcat( buffer, "DDPF_PALETTEINDEXEDTO8 " ); - if ( pddpf->dwFlags & DDPF_RGB ) - strcat( buffer, "DDPF_RGB " ); - if ( pddpf->dwFlags & DDPF_RGBTOYUV ) - strcat( buffer, "DDPF_RGBTOYUV " ); - if ( pddpf->dwFlags & DDPF_STENCILBUFFER ) - strcat( buffer, "DDPF_STENCILBUFFER " ); - if ( pddpf->dwFlags & DDPF_YUV ) - strcat( buffer, "DDPF_YUV " ); - if ( pddpf->dwFlags & DDPF_ZBUFFER ) - strcat( buffer, "DDPF_ZBUFFER " ); - if ( pddpf->dwFlags & DDPF_ZPIXELS ) - strcat( buffer, "DDPF_ZPIXELS " ); - - DPF(( (DBG_TXT_INFO|DBG_CNTX_INFO),"%s", buffer )); -} - - - - - diff --git a/src/mesa/drivers/d3d/DEBUG.H b/src/mesa/drivers/d3d/DEBUG.H deleted file mode 100644 index daeeb72278..0000000000 --- a/src/mesa/drivers/d3d/DEBUG.H +++ /dev/null @@ -1,90 +0,0 @@ -/*===========================================================================*/ -/* */ -/* Mesa-3.0 DirectX 6 Driver */ -/* */ -/* By Leigh McRae */ -/* */ -/* http://www.altsoftware.com/ */ -/* */ -/* Copyright (c) 1999-1998 alt.software inc. All Rights Reserved */ -/*===========================================================================*/ -#ifndef _DEBUG_H -#define _DEBUG_H - -#ifdef __cplusplus -extern "C" { -#endif - -/*===========================================================================*/ -/* Includes. */ -/*===========================================================================*/ -#include -#include -#include -#include -#include "D3DShared.h" -/*===========================================================================*/ -/* Magic numbers. */ -/*===========================================================================*/ -/*===========================================================================*/ -/* Macros defines. */ -/*===========================================================================*/ -#define DBG_FUNC 0x00000001 -#define DBG_STATES 0x00000002 - -#define DBG_CNTX_INFO 0x00000010 -#define DBG_CNTX_WARN 0x00000020 -#define DBG_CNTX_PROFILE 0x00000040 -#define DBG_CNTX_ERROR 0x00000080 -#define DBG_CNTX_ALL 0x000000F0 - -#define DBG_PRIM_INFO 0x00000100 -#define DBG_PRIM_WARN 0x00000200 -#define DBG_PRIM_PROFILE 0x00000400 -#define DBG_PRIM_ERROR 0x00000800 -#define DBG_PRIM_ALL 0x00000F00 - -#define DBG_TXT_INFO 0x00001000 -#define DBG_TXT_WARN 0x00002000 -#define DBG_TXT_PROFILE 0x00004000 -#define DBG_TXT_ERROR 0x00008000 -#define DBG_TXT_ALL 0x0000F000 - -#define DBG_ALL_INFO 0x11111110 -#define DBG_ALL_WARN 0x22222220 -#define DBG_ALL_PROFILE 0x44444440 -#define DBG_ALL_ERROR 0x88888880 -#define DBG_ALL 0xFFFFFFFF - -#ifdef D3D_DEBUG -# define DPF(arg) DebugPrint arg -# define RIP(pH,msg,err) OutputDebugString(msg); \ - OutputDebugString(err); \ - OutputDebugString("\n"); \ - FatalShutDown(pH) -#else -# define DPF(arg) -# define RIP(pH,msg,err) FatalShutDown(pH) -#endif -/*===========================================================================*/ -/* Type defines. */ -/*===========================================================================*/ -/*===========================================================================*/ -/* Function prototypes. */ -/*===========================================================================*/ -extern void ReadDBGEnv( void ); -extern void _cdecl DebugPrint( int mask, char *pszFormat, ... ); -extern void DebugPixelFormat( char *pszSurfaceName, DDPIXELFORMAT *pddpf ); -/*===========================================================================*/ -/* Global variables. */ -/*===========================================================================*/ -extern DWORD g_DBGMask; - -#ifdef __cplusplus -} -#endif - -#endif - - - diff --git a/src/mesa/drivers/d3d/DbgEnv.bat b/src/mesa/drivers/d3d/DbgEnv.bat deleted file mode 100644 index acea045856..0000000000 --- a/src/mesa/drivers/d3d/DbgEnv.bat +++ /dev/null @@ -1,25 +0,0 @@ -SET DBG_FUNC=FALSE - -SET DBG_CNTX_INFO=TRUE -SET DBG_CNTX_WARN=TRUE -SET DBG_CNTX_PROFILE=FALSE -SET DBG_CNTX_ERROR=TRUE -SET DBG_CNTX_ALL=TRUE - -SET DBG_PRIM_INFO=FALSE -SET DBG_PRIM_WARN=FALSE -SET DBG_PRIM_PROFILE=FALSE -SET DBG_PRIM_ERROR=TRUE -SET DBG_PRIM_ALL=FALSE - -SET DBG_TXT_INFO=FALSE -SET DBG_TXT_WARN=TRUE -SET DBG_TXT_PROFILE=FALSE -SET DBG_TXT_ERROR=TRUE -SET DBG_TXT_ALL=FALSE - -SET DBG_ALL_INFO=FALSE -SET DBG_ALL_WARN=TRUE -SET DBG_ALL_PROFILE=FALSE -SET DBG_ALL_ERROR=TRUE -SET DBG_ALL=FALSE diff --git a/src/mesa/drivers/d3d/MAKEFILE b/src/mesa/drivers/d3d/MAKEFILE deleted file mode 100644 index 6aa88f3cef..0000000000 --- a/src/mesa/drivers/d3d/MAKEFILE +++ /dev/null @@ -1,101 +0,0 @@ -############################################################################## -# -# Mesa-3.0 Makefile for DirectX 6 Driver -# -# By Leigh McRae -# -# http://www.altsoftware.com/ -# -# Copyright (c) 1999-1998 alt.software inc. All Rights Reserved -############################################################################## -NAME= -TARGET= WGL Driver (D3DHAL) - -D3D_DIR=$(MAKEDIR)\D3D -TARGET_DIR=e:\WinNT\System32 -TEMP_DIR=c:\Temp - -SPACE=- -LINKER=link.exe - -INCLUDE=$(SDKROOT)\include;$(INCLUDE) -LIB=$(SDKROOT)\lib;$(LIB) -############################################################################## -CFLAGS = /c /nologo /W1 /G5 /I..\ /I..\..\Include \ - /D "_WIN32" /D "WIN32" /D "_WINDOWS" /D "__WIN32__" /D "__MSC__" /D "MESAD3D" -CPPFLAGS= /c /nologo /W1 /G5 /I..\ /I..\..\Include \ - /D "_WIN32" /D "WIN32" /D "_WINDOWS" /D "__WIN32__" /D "__MSC__" /D "MESAD3D" - -!IF "$(DEBUG)" == "1" - -CFLAGS = /MTd /Od /Z7 /Yd /D "_DEBUG" /D "D3D_DEBUG" $(CFLAGS) -CPPFLAGS = /MTd /Od /Z7 /Yd /D "_DEBUG" /D "D3D_DEBUG" $(CPPFLAGS) -BUILD_TYPE=debug - -!ELSE - -CFLAGS = /MT /Ox /D "NDEBUG" $(CFLAGS) -CPPFLAGS = /MT /Ox /D "NDEBUG" $(CPPFLAGS) -BUILD_TYPE=release - -!ENDIF -############################################################################## -SRCS_WGL = wgl.c D3Dvbrender.c DDrawPROCS.c NULLProcs.c Debug.c -SRCS_HAL = D3DInit.cpp D3DRaster.cpp D3DTextureMgr.cpp D3DUtils.cpp D3DCaps.cpp -OBJS_WGL = $(SRCS_WGL:.c=.obj) -OBJS_HAL = $(SRCS_HAL:.cpp=.obj) - -WINLIBS = kernel32.lib user32.lib gdi32.lib oldnames.lib -DXLIBS = -LIBS = $(WINLIBS) $(DXLIBS) -############################################################################### -# Primary Targets # -############################################################################### - -default: header WGL HAL footer - -all: default - -WGL : $(OBJS_WGL) - -HAL : $(OBJS_HAL) - -install : forceit - @echo $(SPACE) - @echo ======================================== - @echo Install files created. - @echo ======================================== - - -############################################################################### -# Secondary Targets # -############################################################################### - -clean: - @echo ======================================== - @echo Cleaning $(TARGET) - @del *.obj - @del *.dep - @del *.exp - @del *.ncb - @del *.plg - @del *.lib - @echo ======================================== - -header: - @echo ============================================================ - @echo Building $(TARGET) ($(BUILD_TYPE) version) - @echo ============================================================ - @echo $(SPACE) - -footer: - @echo $(SPACE) - @echo ============================================================ - @echo DONE building $(TARGET) ($(BUILD_TYPE) version) - @echo ============================================================ - -forceit: - - - - diff --git a/src/mesa/drivers/d3d/NULLProcs.h b/src/mesa/drivers/d3d/NULLProcs.h deleted file mode 100644 index f0bbd2162d..0000000000 --- a/src/mesa/drivers/d3d/NULLProcs.h +++ /dev/null @@ -1,49 +0,0 @@ -/*===========================================================================*/ -/* */ -/* Mesa-3.0 DirectX 6 Driver */ -/* */ -/* By Leigh McRae */ -/* */ -/* http://www.altsoftware.com/ */ -/* */ -/* Copyright (c) 1999-1998 alt.software inc. All Rights Reserved */ -/*===========================================================================*/ -#ifndef NULL_MESA_PROCS_INC -#define NULL_MESA_PROCS_INC -/*===========================================================================*/ -/* Includes. */ -/*===========================================================================*/ -#include "matrix.h" -#include "context.h" -#include "types.h" -#include "vb.h" -/*===========================================================================*/ -/* Macros. */ -/*===========================================================================*/ -/*===========================================================================*/ -/* Magic numbers. */ -/*===========================================================================*/ -/*===========================================================================*/ -/* Type defines. */ -/*===========================================================================*/ -void NULLSetColor( GLcontext *ctx, GLubyte r, GLubyte g, GLubyte b, GLubyte a ); -void NULLClearColor( GLcontext *ctx, GLubyte r, GLubyte g, GLubyte b, GLubyte a ); -GLboolean NULLSetBuffer( GLcontext *ctx, GLenum mode ); -void NULLGetBufferSize( GLcontext *ctx, GLuint *width, GLuint *height ); -GLbitfield NULLClearBuffers( GLcontext *ctx, GLbitfield m, GLboolean a, GLint x, GLint y, GLint w, GLint h ); -void NULLWrSpRGB( const GLcontext* ctx, GLuint n, GLint x, GLint y, const GLubyte r[][3], const GLubyte m[] ); -void NULLWrSpRGBA( const GLcontext* ctx, GLuint n, GLint x, GLint y, const GLubyte r[][4], const GLubyte m[] ); -void NULLWrSpRGBAMono( const GLcontext* ctx, GLuint n, GLint x, GLint y, const GLubyte m[] ); -void NULLWrPiRGBA( const GLcontext* ctx, GLuint n, const GLint x[], const GLint y[], const GLubyte r[][4], const GLubyte m[] ); -void NULLWrPiRGBAMono( const GLcontext* ctx, GLuint n, const GLint x[], const GLint y[], const GLubyte m[] ); -void NULLReSpRGBA( const GLcontext* ctx, GLuint n, GLint x, GLint y, GLubyte r[][4] ); -void NULLRePiRGBA( const GLcontext* ctx, GLuint n, const GLint x[], const GLint y[], GLubyte r[][4], const GLubyte m[] ); -/*===========================================================================*/ -/* Extern function prototypes. */ -/*===========================================================================*/ -/*===========================================================================*/ -/* Global variables. */ -/*===========================================================================*/ - -#endif - diff --git a/src/mesa/drivers/d3d/NullProcs.c b/src/mesa/drivers/d3d/NullProcs.c deleted file mode 100644 index d6fb598074..0000000000 --- a/src/mesa/drivers/d3d/NullProcs.c +++ /dev/null @@ -1,49 +0,0 @@ -/*===========================================================================*/ -/* */ -/* Mesa-3.0 DirectX 6 Driver */ -/* */ -/* By Leigh McRae */ -/* */ -/* http://www.altsoftware.com/ */ -/* */ -/* Copyright (c) 1999-1998 alt.software inc. All Rights Reserved */ -/*===========================================================================*/ -#ifndef NULL_MESA_PROCS_INC -#define NULL_MESA_PROCS_INC -/*===========================================================================*/ -/* Includes. */ -/*===========================================================================*/ -#include "matrix.h" -#include "context.h" -#include "mtypes.h" -#include "vb.h" -/*===========================================================================*/ -/* Macros. */ -/*===========================================================================*/ -/*===========================================================================*/ -/* Magic numbers. */ -/*===========================================================================*/ -/*===========================================================================*/ -/* Type defines. */ -/*===========================================================================*/ -void NULLSetColor( GLcontext *ctx, GLubyte r, GLubyte g, GLubyte b, GLubyte a ); -void NULLClearColor( GLcontext *ctx, GLubyte r, GLubyte g, GLubyte b, GLubyte a ); -GLboolean NULLSetBuffer( GLcontext *ctx, GLframebuffer *buffer, GLuint bit ); -void NULLGetBufferSize( GLcontext *ctx, GLuint *width, GLuint *height ); -GLbitfield NULLClearBuffers( GLcontext *ctx, GLbitfield m, GLboolean a, GLint x, GLint y, GLint w, GLint h ); -void NULLWrSpRGB( const GLcontext* ctx, GLuint n, GLint x, GLint y, const GLubyte r[][3], const GLubyte m[] ); -void NULLWrSpRGBA( const GLcontext* ctx, GLuint n, GLint x, GLint y, const GLubyte r[][4], const GLubyte m[] ); -void NULLWrSpRGBAMono( const GLcontext* ctx, GLuint n, GLint x, GLint y, const GLubyte m[] ); -void NULLWrPiRGBA( const GLcontext* ctx, GLuint n, const GLint x[], const GLint y[], const GLubyte r[][4], const GLubyte m[] ); -void NULLWrPiRGBAMono( const GLcontext* ctx, GLuint n, const GLint x[], const GLint y[], const GLubyte m[] ); -void NULLReSpRGBA( const GLcontext* ctx, GLuint n, GLint x, GLint y, GLubyte r[][4] ); -void NULLRePiRGBA( const GLcontext* ctx, GLuint n, const GLint x[], const GLint y[], GLubyte r[][4], const GLubyte m[] ); -/*===========================================================================*/ -/* Extern function prototypes. */ -/*===========================================================================*/ -/*===========================================================================*/ -/* Global variables. */ -/*===========================================================================*/ - -#endif - diff --git a/src/mesa/drivers/d3d/OPENGL32.DEF b/src/mesa/drivers/d3d/OPENGL32.DEF deleted file mode 100644 index bc0304da33..0000000000 --- a/src/mesa/drivers/d3d/OPENGL32.DEF +++ /dev/null @@ -1,442 +0,0 @@ -;=========================================================================== -; -; Mesa-3.0 DirectX 6 Driver -; -; By Leigh McRae -; -; http://www.altsoftware.com/ -; -; Copyright (c) 1999-1998 alt.software inc. All Rights Reserved -;=========================================================================== -NAME OpenGL32.DLL -DESCRIPTION "Mesa-3.0 DX6 Driver Version 0.5" - -EXPORTS - DllMain - glAccum - glAlphaFunc - glAreTexturesResident - glAreTexturesResidentEXT - glArrayElement - glArrayElementEXT - glBegin - glBindTexture - glBindTextureEXT - glBitmap - glBlendColorEXT - glBlendEquationEXT - glBlendFunc - glCallList - glCallLists - glClear - glClearAccum - glClearColor - glClearDepth - glClearIndex - glClearStencil - glClipPlane - glColor3b - glColor3bv - glColor3d - glColor3dv - glColor3f - glColor3fv - glColor3i - glColor3iv - glColor3s - glColor3sv - glColor3ub - glColor3ubv - glColor3ui - glColor3uiv - glColor3us - glColor3usv - glColor4b - glColor4bv - glColor4d - glColor4dv - glColor4f - glColor4fv - glColor4i - glColor4iv - glColor4s - glColor4sv - glColor4ub - glColor4ubv - glColor4ui - glColor4uiv - glColor4us - glColor4usv - glColorMask - glColorMaterial - glColorPointer - glColorPointerEXT - glColorSubTableEXT - glColorTableEXT - glCopyPixels - glCopyTexImage1D - glCopyTexImage2D - glCopyTexSubImage1D - glCopyTexSubImage2D - glCopyTexSubImage3DEXT - glCullFace - glDeleteLists - glDeleteTextures - glDeleteTexturesEXT - glDepthFunc - glDepthMask - glDepthRange - glDisable - glDisableClientState - glDrawArrays - glDrawArraysEXT - glDrawBuffer - glDrawElements - glDrawPixels - glEdgeFlag - glEdgeFlagPointer - glEdgeFlagPointerEXT - glEdgeFlagv - glEnable - glEnableClientState - glEnd - glEndList - glEvalCoord1d - glEvalCoord1dv - glEvalCoord1f - glEvalCoord1fv - glEvalCoord2d - glEvalCoord2dv - glEvalCoord2f - glEvalCoord2fv - glEvalMesh1 - glEvalMesh2 - glEvalPoint1 - glEvalPoint2 - glFeedbackBuffer - glFinish - glFlush - glFogf - glFogfv - glFogi - glFogiv - glFrontFace - glFrustum - glGenLists - glGenTextures - glGenTexturesEXT - glGetBooleanv - glGetClipPlane - glGetColorTableEXT - glGetColorTableParameterfvEXT - glGetColorTableParameterivEXT - glGetDoublev - glGetError - glGetFloatv - glGetIntegerv - glGetLightfv - glGetLightiv - glGetMapdv - glGetMapfv - glGetMapiv - glGetMaterialfv - glGetMaterialiv - glGetPixelMapfv - glGetPixelMapuiv - glGetPixelMapusv - glGetPointerv - glGetPointervEXT - glGetPolygonStipple - glGetString - glGetTexEnvfv - glGetTexEnviv - glGetTexGendv - glGetTexGenfv - glGetTexGeniv - glGetTexImage - glGetTexLevelParameterfv - glGetTexLevelParameteriv - glGetTexParameterfv - glGetTexParameteriv - glHint - glIndexd - glIndexdv - glIndexf - glIndexfv - glIndexi - glIndexiv - glIndexMask - glIndexPointer - glIndexPointerEXT - glIndexs - glIndexsv - glIndexub - glIndexubv - glInitNames - glInterleavedArrays - glIsEnabled - glIsList - glIsTexture - glIsTextureEXT - glLightf - glLightfv - glLighti - glLightiv - glLightModelf - glLightModelfv - glLightModeli - glLightModeliv - glLineStipple - glLineWidth - glListBase - glLoadIdentity - glLoadMatrixd - glLoadMatrixf - glLoadName - glLogicOp - glMap1d - glMap1f - glMap2d - glMap2f - glMapGrid1d - glMapGrid1f - glMapGrid2d - glMapGrid2f - glMaterialf - glMaterialfv - glMateriali - glMaterialiv - glMatrixMode - glMultMatrixd - glMultMatrixf - glNewList - glNormal3b - glNormal3bv - glNormal3d - glNormal3dv - glNormal3f - glNormal3fv - glNormal3i - glNormal3iv - glNormal3s - glNormal3sv - glNormalPointer - glNormalPointerEXT - glOrtho - glPassThrough - glPixelMapfv - glPixelMapuiv - glPixelMapusv - glPixelStoref - glPixelStorei - glPixelTransferf - glPixelTransferi - glPixelZoom - glPointParameterfEXT - glPointParameterfvEXT - glPointSize - glPolygonMode - glPolygonOffset - glPolygonOffsetEXT - glPolygonStipple - glPopAttrib - glPopClientAttrib - glPopMatrix - glPopName - glPrioritizeTextures - glPrioritizeTexturesEXT - glPushAttrib - glPushClientAttrib - glPushMatrix - glPushName - glRasterPos2d - glRasterPos2dv - glRasterPos2f - glRasterPos2fv - glRasterPos2i - glRasterPos2iv - glRasterPos2s - glRasterPos2sv - glRasterPos3d - glRasterPos3dv - glRasterPos3f - glRasterPos3fv - glRasterPos3i - glRasterPos3iv - glRasterPos3s - glRasterPos3sv - glRasterPos4d - glRasterPos4dv - glRasterPos4f - glRasterPos4fv - glRasterPos4i - glRasterPos4iv - glRasterPos4s - glRasterPos4sv - glReadBuffer - glReadPixels - glRectd - glRectdv - glRectf - glRectfv - glRecti - glRectiv - glRects - glRectsv - glRenderMode - glResizeBuffersMESA - glRotated - glRotatef - glScaled - glScalef - glScissor - glSelectBuffer - glShadeModel - glStencilFunc - glStencilMask - glStencilOp - glTexCoord1d - glTexCoord1dv - glTexCoord1f - glTexCoord1fv - glTexCoord1i - glTexCoord1iv - glTexCoord1s - glTexCoord1sv - glTexCoord2d - glTexCoord2dv - glTexCoord2f - glTexCoord2fv - glTexCoord2i - glTexCoord2iv - glTexCoord2s - glTexCoord2sv - glTexCoord3d - glTexCoord3dv - glTexCoord3f - glTexCoord3fv - glTexCoord3i - glTexCoord3iv - glTexCoord3s - glTexCoord3sv - glTexCoord4d - glTexCoord4dv - glTexCoord4f - glTexCoord4fv - glTexCoord4i - glTexCoord4iv - glTexCoord4s - glTexCoord4sv - glTexCoordPointer - glTexCoordPointerEXT - glTexEnvf - glTexEnvfv - glTexEnvi - glTexEnviv - glTexGend - glTexGendv - glTexGenf - glTexGenfv - glTexGeni - glTexGeniv - glTexImage1D - glTexImage2D - glTexImage3DEXT - glTexParameterf - glTexParameterfv - glTexParameteri - glTexParameteriv - glTexSubImage1D - glTexSubImage2D - glTexSubImage3DEXT - glTranslated - glTranslatef - glVertex2d - glVertex2dv - glVertex2f - glVertex2fv - glVertex2i - glVertex2iv - glVertex2s - glVertex2sv - glVertex3d - glVertex3dv - glVertex3f - glVertex3fv - glVertex3i - glVertex3iv - glVertex3s - glVertex3sv - glVertex4d - glVertex4dv - glVertex4f - glVertex4fv - glVertex4i - glVertex4iv - glVertex4s - glVertex4sv - glVertexPointer - glVertexPointerEXT - glViewport - glWindowPos2dMESA - glWindowPos2dvMESA - glWindowPos2fMESA - glWindowPos2fvMESA - glWindowPos2iMESA - glWindowPos2ivMESA - glWindowPos2sMESA - glWindowPos2svMESA - glWindowPos3dMESA - glWindowPos3dvMESA - glWindowPos3fMESA - glWindowPos3fvMESA - glWindowPos3iMESA - glWindowPos3ivMESA - glWindowPos3sMESA - glWindowPos3svMESA - glWindowPos4dMESA - glWindowPos4dvMESA - glWindowPos4fMESA - glWindowPos4fvMESA - glWindowPos4iMESA - glWindowPos4ivMESA - glWindowPos4sMESA - glWindowPos4svMESA -; WMesaCreateContext -; WMesaDestroyContext -; WMesaMakeCurrent -; WMesaPaletteChange -; WMesaSwapBuffers -; OSMesaCreateContext -; OSMesaDestroyContext -; OSMesaMakeCurrent -; OSMesaGetCurrentContext -; OSMesaPixelStore -; OSMesaGetIntegerv -; OSMesaGetDepthBuffer - wglCopyContext - wglCreateContext - wglCreateLayerContext - wglDeleteContext -; wglDescribeLayerPlane - wglGetCurrentContext - wglGetCurrentDC -; wglGetLayerPaletteEntries - wglGetProcAddress - wglMakeCurrent -; wglRealizeLayerPalette -; wglSetLayerPaletteEntries - wglShareLists - wglSwapLayerBuffers - wglUseFontBitmapsA - wglUseFontBitmapsW - wglUseFontOutlinesA - wglUseFontOutlinesW - wglChoosePixelFormat - wglDescribePixelFormat - wglGetPixelFormat - wglSetPixelFormat - wglSwapBuffers - - - diff --git a/src/mesa/drivers/d3d/WGL.C b/src/mesa/drivers/d3d/WGL.C deleted file mode 100644 index 170d094ed4..0000000000 --- a/src/mesa/drivers/d3d/WGL.C +++ /dev/null @@ -1,1262 +0,0 @@ -/*===========================================================================*/ -/* */ -/* Mesa-3.0 Makefile for DirectX 6 */ -/* */ -/* By Leigh McRae */ -/* */ -/* http://www.altsoftware.com/ */ -/* */ -/* Copyright (c) 1998-1997 alt.software inc. All Rights Reserved */ -/*===========================================================================*/ -#include "D3DMesa.h" -/*===========================================================================*/ -/* Window managment. */ -/*===========================================================================*/ -static BOOL InitOpenGL( HINSTANCE hInst ); -static BOOL TermOpenGL( HINSTANCE hInst ); -static BOOL ResizeContext( GLcontext *ctx ); -static BOOL MakeCurrent( D3DMESACONTEXT *pContext ); -static void DestroyContext( D3DMESACONTEXT *pContext ); -static BOOL UnBindWindow( D3DMESACONTEXT *pContext ); -LONG APIENTRY wglMonitorProc( HWND hwnd, UINT message, UINT wParam, LONG lParam ); -/*===========================================================================*/ -/* Mesa hooks. */ -/*===========================================================================*/ -static void SetupDDPointers( GLcontext *ctx ); -static void SetupSWDDPointers( GLcontext *ctx ); -static void SetupHWDDPointers( GLcontext *ctx ); -static void SetupNULLDDPointers( GLcontext *ctx ); -static const char *RendererString( void ); - -/* State Management hooks. */ -static void SetColor( GLcontext *ctx, GLubyte r, GLubyte g, GLubyte b, GLubyte a ); -static void ClearColor( GLcontext *ctx, GLubyte r, GLubyte g, GLubyte b, GLubyte a ); -static GLboolean SetBuffer( GLcontext *ctx, GLenum buffer ); - -/* Window Management hooks. */ -static void GetBufferSize( GLcontext *ctx, GLuint *width, GLuint *height ); -static void SetViewport( GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h ); -static void Flush( GLcontext *ctx ); - -/* Span rendering hooks. */ -void WSpanRGB( const GLcontext* ctx, GLuint n, GLint x, GLint y, const GLubyte rgb[][3], const GLubyte mask[] ); -void WSpanRGBA( const GLcontext* ctx, GLuint n, GLint x, GLint y, const GLubyte rgba[][4], const GLubyte mask[] ); -void WSpanRGBAMono( const GLcontext* ctx, GLuint n, GLint x, GLint y, const GLubyte mask[] ); -void WPixelsRGBA( const GLcontext* ctx, GLuint n, const GLint x[], const GLint y[], const GLubyte rgba[][4], const GLubyte mask[] ); -void WPixelsRGBAMono( const GLcontext* ctx, GLuint n, const GLint x[], const GLint y[], const GLubyte mask[] ); -void RSpanRGBA( const GLcontext* ctx, GLuint n, GLint x, GLint y, GLubyte rgba[][4] ); -void RPixelsRGBA( const GLcontext* ctx, GLuint n, const GLint x[], const GLint y[], GLubyte rgba[][4], const GLubyte mask[] ); -GLbitfield ClearBuffers( GLcontext *ctx, GLbitfield mask, GLboolean all, GLint x, GLint y, GLint width, GLint height ); - -/* Primitve rendering hooks. */ -GLboolean RenderVertexBuffer( GLcontext *ctx, GLboolean allDone ); -void RenderOneTriangle( GLcontext *ctx, GLuint v1, GLuint v2, GLuint v3, GLuint pv ); -void RenderOneLine( GLcontext *ctx, GLuint v1, GLuint v2, GLuint pv ); -GLbitfield ClearBuffersD3D( GLcontext *ctx, GLbitfield mask, GLboolean all, GLint x, GLint y, GLint width, GLint height ); - -/* Texture Management hooks. */ -static void TextureBind( GLcontext *ctx, GLenum target, struct gl_texture_object *tObj ); -static void TextureLoad( GLcontext *ctx, GLenum target, struct gl_texture_object *tObj, GLint level, GLint internalFormat, const struct gl_texture_image *image ); -static void TextureSubImage( GLcontext *ctx, GLenum target, struct gl_texture_object *tObj, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLint internalFormat, const struct gl_texture_image *image ); -/*===========================================================================*/ -/* Global variables. */ -/*===========================================================================*/ -D3DMESACONTEXT *pD3DCurrent, - *pD3DDefault; /* Thin support context. */ - -struct __extensions__ ext[] = { - - { (PROC)glPolygonOffsetEXT, "glPolygonOffsetEXT" }, - { (PROC)glBlendEquationEXT, "glBlendEquationEXT" }, - { (PROC)glBlendColorEXT, "glBlendColorExt" }, - { (PROC)glVertexPointerEXT, "glVertexPointerEXT" }, - { (PROC)glNormalPointerEXT, "glNormalPointerEXT" }, - { (PROC)glColorPointerEXT, "glColorPointerEXT" }, - { (PROC)glIndexPointerEXT, "glIndexPointerEXT" }, - { (PROC)glTexCoordPointerEXT, "glTexCoordPointer" }, - { (PROC)glEdgeFlagPointerEXT, "glEdgeFlagPointerEXT" }, - { (PROC)glGetPointervEXT, "glGetPointervEXT" }, - { (PROC)glArrayElementEXT, "glArrayElementEXT" }, - { (PROC)glDrawArraysEXT, "glDrawArrayEXT" }, - { (PROC)glAreTexturesResidentEXT, "glAreTexturesResidentEXT" }, - { (PROC)glBindTextureEXT, "glBindTextureEXT" }, - { (PROC)glDeleteTexturesEXT, "glDeleteTexturesEXT" }, - { (PROC)glGenTexturesEXT, "glGenTexturesEXT" }, - { (PROC)glIsTextureEXT, "glIsTextureEXT" }, - { (PROC)glPrioritizeTexturesEXT, "glPrioritizeTexturesEXT" }, - { (PROC)glCopyTexSubImage3DEXT, "glCopyTexSubImage3DEXT" }, - { (PROC)glTexImage3DEXT, "glTexImage3DEXT" }, - { (PROC)glTexSubImage3DEXT, "glTexSubImage3DEXT" }, -}; - -int qt_ext = sizeof(ext) / sizeof(ext[0]); -float g_DepthScale, - g_MaxDepth; -/*===========================================================================*/ -/* When a process loads this DLL we will setup the linked list for context */ -/* management and create a default context that will support the API until */ -/* the user creates and binds thier own. This THIN default context is useful*/ -/* to have around. */ -/* When the process terminates we will clean up all resources here. */ -/*===========================================================================*/ -/* RETURN: TRUE, FALSE. */ -/*===========================================================================*/ -BOOL APIENTRY DllMain( HINSTANCE hInst, DWORD reason, LPVOID reserved ) -{ - switch( reason ) - { - case DLL_PROCESS_ATTACH: - return InitOpenGL( hInst ); - - case DLL_PROCESS_DETACH: - return TermOpenGL( hInst ); - } - - return TRUE; -} -/*===========================================================================*/ -/* The first thing we do when this dll is hit is connect to the dll that has*/ -/* handles all the DirectX 6 rendering. I decided to use another dll as DX6 */ -/* is all C++ and Mesa-3.0 is C (thats a good thing). This way I can write */ -/* the DX6 in C++ and Mesa-3.0 in C without having to worry about linkage. */ -/* I feel this is easy and better then using static wrappers as it is likely */ -/* faster and it allows me to just develope the one without compiling the */ -/* other. */ -/* NOTE that at this point we don't have much other than a very thin context*/ -/* that will support the API calls only to the point of not causing the app */ -/* to crash from the API table being empty. */ -/*===========================================================================*/ -/* RETURN: TRUE, FALSE. */ -/*===========================================================================*/ -static BOOL InitOpenGL( HINSTANCE hInst ) -{ - /* Allocate and clear the default context. */ - pD3DDefault = (PD3DMESACONTEXT)ALLOC( sizeof(D3DMESACONTEXT) ); - if ( pD3DDefault == NULL ) - return FALSE; - memset( pD3DDefault, 0, sizeof(D3DMESACONTEXT) ); - - /* Clear the D3D vertex buffer so that values not used will be zero. This */ - /* save me from some redundant work. */ - memset( &D3DTLVertices, 0, sizeof(D3DTLVertices) ); - - /* Update the link. We uses a circular list so that it is easy to */ - /* add and search. This context will also be used for head and tail.*/ - pD3DDefault->next = pD3DDefault; - - /*========================================================================*/ - /* Do all core Mesa stuff. */ - /*========================================================================*/ - pD3DDefault->gl_visual = _mesa_create_visual( TRUE, - FALSE, /* db_flag */ - GL_FALSE, /* stereo */ - 8,8,8,8, /* r, g, b, a bits */ - 0, /* index bits */ - 16, /* depth_bits */ - 8, /* stencil_bits */ - 8,8,8,8, /* accum_bits */ - 1 ); - - if ( pD3DDefault->gl_visual == NULL) - { - FREE( pD3DDefault ); - return FALSE; - } - - /* Allocate a new Mesa context */ - pD3DDefault->gl_ctx = _mesa_create_context( pD3DDefault->gl_visual, NULL, pD3DDefault, GL_TRUE ); - if ( pD3DDefault->gl_ctx == NULL ) - { - _mesa_destroy_visual( pD3DDefault->gl_visual ); - FREE( pD3DDefault ); - return FALSE; - } - - /* Allocate a new Mesa frame buffer */ - pD3DDefault->gl_buffer = _mesa_create_framebuffer( pD3DDefault->gl_visual ); - if ( pD3DDefault->gl_buffer == NULL ) - { - _mesa_destroy_visual( pD3DDefault->gl_visual ); - _mesa_destroy_context( pD3DDefault->gl_ctx ); - FREE( pD3DDefault ); - return FALSE; - } - SetupDDPointers( pD3DDefault->gl_ctx ); - _mesa_make_current( pD3DDefault->gl_ctx, pD3DDefault->gl_buffer ); - - return TRUE; -} -/*===========================================================================*/ -/* This function will create a new D3D context but will not create the D3D */ -/* surfaces or even an instance of D3D (see at GetBufferSize). The only stuff*/ -/* done here is the internal Mesa stuff and some Win32 handles. */ -/*===========================================================================*/ -/* RETURN: casted pointer to the context, NULL. */ -/*===========================================================================*/ -HGLRC APIENTRY wglCreateContext( HDC hdc ) -{ - D3DMESACONTEXT *pNewContext; - DWORD dwCoopFlags = DDSCL_NORMAL; - RECT rectClient; - POINT pt; - - /* ALLOC and clear the new context. */ - pNewContext = (PD3DMESACONTEXT)ALLOC( sizeof(D3DMESACONTEXT) ); - if ( pNewContext == NULL ) - { - SetLastError( 0 ); - return (HGLRC)NULL; - } - memset( pNewContext, 0, sizeof(D3DMESACONTEXT) ); - - /*========================================================================*/ - /* Do all core Mesa stuff. */ - /*========================================================================*/ - - /* TODO: support more then one visual. */ - pNewContext->gl_visual = _mesa_create_visual( TRUE, - TRUE, /* db_flag */ - GL_FALSE, /* stereo */ - 8,8,8,8, /* r, g, b, a bits */ - 0, /* index bits */ - 16, /* depth_bits */ - 8, /* stencil_bits */ - 16,16,16,16,/* accum_bits */ - 1 ); - if ( pNewContext->gl_visual == NULL) - { - FREE( pNewContext ); - SetLastError( 0 ); - return (HGLRC)NULL; - } - - /* Allocate a new Mesa context */ - pNewContext->gl_ctx = _mesa_create_context( pNewContext->gl_visual, NULL, pNewContext, GL_TRUE ); - if ( pNewContext->gl_ctx == NULL ) - { - _mesa_destroy_visual( pNewContext->gl_visual ); - FREE( pNewContext ); - SetLastError( 0 ); - return (HGLRC)NULL; - } - - /* Allocate a new Mesa frame buffer */ - pNewContext->gl_buffer = _mesa_create_framebuffer( pNewContext->gl_visual ); - if ( pNewContext->gl_buffer == NULL ) - { - _mesa_destroy_visual( pNewContext->gl_visual ); - _mesa_destroy_context( pNewContext->gl_ctx ); - FREE( pNewContext ); - SetLastError( 0 ); - return (HGLRC)NULL; - } - - /*========================================================================*/ - /* Do all the driver stuff. */ - /*========================================================================*/ - pNewContext->hdc = hdc; - pNewContext->next = pD3DDefault->next; - pD3DDefault->next = pNewContext; /* Add to circular list. */ - - /* Create the HAL for the new context. */ - pNewContext->pShared = InitHAL( WindowFromDC(hdc) ); - - return (HGLRC)pNewContext; -} -/*===========================================================================*/ -/* This is a wrapper function that is supported by MakeCurrent. */ -/*===========================================================================*/ -/* RETURN: TRUE, FALSE. */ -/*===========================================================================*/ -BOOL APIENTRY wglMakeCurrent( HDC hdc, HGLRC hglrc ) -{ - return MakeCurrent((D3DMESACONTEXT *)hglrc); -} -/*===========================================================================*/ -/* MakeCurrent will unbind whatever context is current (if any) & then bind */ -/* the supplied context. A context that is bound has it's window proc hooked*/ -/* with the wglMonitorProc and the context pointer is saved in pD3DCurrent. */ -/* Once the context is bound we update the Mesa-3.0 hooks (SetDDPointers) and*/ -/* the viewport (Mesa-.30 and DX6). */ -/* */ -/* TODO: this function can't fail. */ -/*===========================================================================*/ -/* RETURN: TRUE */ -/*===========================================================================*/ -static BOOL MakeCurrent( D3DMESACONTEXT *pContext ) -{ - D3DMESACONTEXT *pNext; - - /*====================================================================*/ - /* This is a special case that is a request to have no context bound. */ - /*====================================================================*/ - if ( pContext == NULL ) - { - /* Walk the whole list. We start and end at the Default context. */ - for( pNext = pD3DDefault->next; pNext != pD3DDefault; pNext = pNext->next ) - UnBindWindow( pNext ); - - return TRUE; - } - - /*=================================================*/ - /* Make for a fast redundant use of this function. */ - /*=================================================*/ - if ( pD3DCurrent == pContext ) - return TRUE; - - /*=============================*/ - /* Unbind the current context. */ - /*=============================*/ - UnBindWindow( pD3DCurrent ); - - /*=====================================*/ - /* Let Mesa-3.0 we have a new context. */ - /*=====================================*/ - SetupDDPointers( pContext->gl_ctx ); - _mesa_make_current( pContext->gl_ctx, pContext->gl_buffer ); - - /* We are done so set the internal current context. */ - if ( pContext != pD3DDefault ) - { - ResizeContext( pContext->gl_ctx ); - pContext->hOldProc = (WNDPROC)GetWindowLong( pContext->pShared->hwnd, GWL_WNDPROC ); - SetWindowLong( pContext->pShared->hwnd, GWL_WNDPROC, (LONG)wglMonitorProc ); - } - pD3DCurrent = pContext; - - return TRUE; -} -/*===========================================================================*/ -/* This function will only return the current window size. I have re-done */ -/* this function so that it doesn't check the current size and react to it as*/ -/* I should be able to have all the react code in the WM_SIZE message. The */ -/* old version would check the current window size and create/resize the HAL */ -/* surfaces if they have changed. I needed to delay the creation if the */ -/* surfaces because sometimes I wouldn't have a window size so this is where */ -/* I delayed it. If you are reading this then all went ok! */ -/* The default context will return a zero sized window and I'm not sure if */ -/* this is ok at this point (TODO). */ -/*===========================================================================*/ -/* RETURN: */ -/*===========================================================================*/ -static void GetBufferSize( GLcontext *ctx, GLuint *width, GLuint *height ) -{ - D3DMESACONTEXT *pContext = (D3DMESACONTEXT *)ctx->DriverCtx; - - /* Fall through for the default because that is one of the uses for it. */ - if ( pContext == pD3DDefault ) - { - *width = 0; - *height = 0; - } - else - { - *width = pContext->pShared->dwWidth; - *height = pContext->pShared->dwHeight; - } -} -/*===========================================================================*/ -/* */ -/* */ -/*===========================================================================*/ -/* RETURN: */ -/*===========================================================================*/ -static BOOL ResizeContext( GLcontext *ctx ) -{ - D3DMESACONTEXT *pContext = (D3DMESACONTEXT *)ctx->DriverCtx, - *pCurrentTemp; - RECT rectClient; - POINT pt; - DWORD dwWidth, - dwHeight; - static BOOL bDDrawLock = FALSE; - - /* Make sure we have some values. */ - if ( (pContext->hdc == NULL ) || - (pContext->pShared->hwnd != WindowFromDC(pContext->hdc)) || - (pContext == pD3DDefault) ) - return FALSE; - - /* Having problems with DDraw sending resize messages before I was done. */ - if( bDDrawLock == TRUE ) - return FALSE; - - // TODO: don't think I need this anymore. - pCurrentTemp = pD3DCurrent; - pD3DCurrent = pD3DDefault; - bDDrawLock = TRUE; - - /* Get the current window dimentions. */ - UpdateScreenPosHAL( pContext->pShared ); - dwWidth = pContext->pShared->rectW.right - pContext->pShared->rectW.left; - dwHeight = pContext->pShared->rectW.bottom - pContext->pShared->rectW.top; - - /* Is the size of the OffScreen Render different? */ - if ( (dwWidth != pContext->pShared->dwWidth) || (dwHeight != pContext->pShared->dwHeight) ) - { - /* Create all the D3D surfaces and device. */ - CreateHAL( pContext->pShared ); - - /* I did this so that software rendering would still work as */ - /* I don't need to scale the z values twice. */ - g_DepthScale = (pContext->pShared->bHardware) ? 1.0 : ((float)0x00FFFFFF); - g_MaxDepth = (pContext->pShared->bHardware) ? 1.0 : ((float)0x00FFFFFF); - gl_DepthRange( pContext->gl_ctx, ctx->Viewport.Near, ctx->Viewport.Far ); - - /* Make sure we have a viewport. */ - gl_Viewport( pContext->gl_ctx, 0, 0, dwWidth, dwHeight ); - - /* Update Mesa as we might have changed from SW <-> HW. */ - SetupDDPointers( pContext->gl_ctx ); - _mesa_make_current( pContext->gl_ctx, pContext->gl_buffer ); - - /* If we are in HW we need to load the current texture if there is one already. */ - // if ( (ctx->Texture.Set[ctx->Texture.CurrentSet].Current != NULL) && - // (pContext->pShared->bHardware == TRUE) ) - // { - // CreateTMgrHAL( pContext->pShared, - // ctx->Texture.Set[ctx->Texture.CurrentSet].Current->Name, - // 0, - // ctx->Texture.Set[ctx->Texture.CurrentSet].Current->Image[0]->Format, - // (RECT *)NULL, - // ctx->Texture.Set[ctx->Texture.CurrentSet].Current->Image[0]->Width, - // ctx->Texture.Set[ctx->Texture.CurrentSet].Current->Image[0]->Height, - // TM_ACTION_BIND, - // (void *)ctx->Texture.Set[ctx->Texture.CurrentSet].Current->Image[0]->Data ); - // } - } - - // TODO: don't think I need this anymore. - pD3DCurrent = pCurrentTemp; - bDDrawLock = FALSE; - - return TRUE; -} - -/*===========================================================================* -/* This function will Blt the render buffer to the PRIMARY surface. I repeat*/ -/* this code for the other SwapBuffer like functions and the flush (didn't */ -/* want the function calling overhead). Thsi could have been a macro... */ -/* */ -/* TODO: there are some problems with viewport/scissoring. */ -/*===========================================================================*/ -/* RETURN: TRUE, FALSE. */ -/*===========================================================================*/ -BOOL APIENTRY wglSwapBuffers( HDC hdc ) -{ - /* Fall through for the default because that is one of the uses for it. */ - if ( pD3DCurrent == pD3DDefault ) - return FALSE; - - SwapBuffersHAL( pD3DCurrent->pShared ); - - return TRUE; -} -/*===========================================================================*/ -/* Same as wglSwapBuffers. */ -/*===========================================================================*/ -/* RETURN: TRUE, FALSE. */ -/*===========================================================================*/ -BOOL APIENTRY SwapBuffers( HDC hdc ) -{ - /* Fall through for the default because that is one of the uses for it. */ - if ( pD3DCurrent == pD3DDefault ) - return FALSE; - - SwapBuffersHAL( pD3DCurrent->pShared ); - - return TRUE; -} -/*===========================================================================*/ -/* This should be ok as none of the SwapBuffers will cause a redundant Blt */ -/* as none of my Swap functions will call flush. This should also allow */ -/* sinlge buffered applications to work (not really worried though). Some */ -/* applications may flush then swap but then this is there fault IMHO. */ -/*===========================================================================*/ -/* RETURN: */ -/*===========================================================================*/ -static void Flush( GLcontext *ctx ) -{ - /* Fall through for the default because that is one of the uses for it. */ - if ( pD3DCurrent == pD3DDefault ) - return; - - SwapBuffersHAL( pD3DCurrent->pShared ); -} -/*===========================================================================*/ -/* For now this function will ignore the supplied PF. If I'm going to allow */ -/* the user to choice the mode and device at startup I'm going to have to do */ -/* something different. */ -/* */ -/* TODO: use the linked list of modes to build a pixel format to be returned */ -/* to the caller. */ -/*===========================================================================*/ -/* RETURN: 1. */ -/*===========================================================================*/ -int APIENTRY wglChoosePixelFormat( HDC hdc, CONST PIXELFORMATDESCRIPTOR *ppfd ) -{ - return 1; -} -/*===========================================================================*/ -/* See wglChoosePixelFormat. */ -/*===========================================================================*/ -/* RETURN: 1. */ -/*===========================================================================*/ -int APIENTRY ChoosePixelFormat( HDC hdc, CONST PIXELFORMATDESCRIPTOR *ppfd ) -{ - return wglChoosePixelFormat(hdc,ppfd); -} -/*===========================================================================*/ -/* This function (for now) returns a static PF everytime. This is just to */ -/* allow things to continue. */ -/*===========================================================================*/ -/* RETURN: 1. */ -/*===========================================================================*/ -int APIENTRY wglDescribePixelFormat( HDC hdc, int iPixelFormat, UINT nBytes, LPPIXELFORMATDESCRIPTOR ppfd ) -{ - static PIXELFORMATDESCRIPTOR pfd = - { - sizeof(PIXELFORMATDESCRIPTOR), /* size */ - 1, /* version */ - PFD_SUPPORT_OPENGL | - PFD_DRAW_TO_WINDOW | - PFD_DOUBLEBUFFER, /* support double-buffering */ - PFD_TYPE_RGBA, /* color type */ - 16, /* prefered color depth */ - 0, 0, 0, 0, 0, 0, /* color bits (ignored) */ - 0, /* no alpha buffer */ - 0, /* alpha bits (ignored) */ - 0, /* no accumulation buffer */ - 0, 0, 0, 0, /* accum bits (ignored) */ - 16, /* depth buffer */ - 0, /* no stencil buffer */ - 0, /* no auxiliary buffers */ - PFD_MAIN_PLANE, /* main layer */ - 0, /* reserved */ - 0, 0, 0, /* no layer, visible, damage masks */ - }; - - /* Return the address of this static PF if one was requested. */ - if ( ppfd != NULL ) - memcpy( ppfd, &pfd, sizeof(PIXELFORMATDESCRIPTOR) ); - - return 1; -} -/*===========================================================================*/ -/* See wglDescribePixelFormat. */ -/*===========================================================================*/ -/* RETURN: 1. */ -/*===========================================================================*/ -int APIENTRY DescribePixelFormat( HDC hdc, int iPixelFormat, UINT nBytes, LPPIXELFORMATDESCRIPTOR ppfd ) -{ - return wglDescribePixelFormat(hdc,iPixelFormat,nBytes,ppfd); -} -/*===========================================================================*/ -/* This function will always return 1 for now. Just to allow for support. */ -/*===========================================================================*/ -/* RETURN: 1. */ -/*===========================================================================*/ -int APIENTRY wglGetPixelFormat( HDC hdc ) -{ - return 1; -} -/*===========================================================================*/ -/* See wglGetPixelFormat. */ -/*===========================================================================*/ -/* RETURN: 1. */ -/*===========================================================================*/ -int APIENTRY GetPixelFormat( HDC hdc ) -{ - return wglGetPixelFormat(hdc); -} -/*===========================================================================*/ -/* This will aways work for now. */ -/*===========================================================================*/ -/* RETURN: TRUE. */ -/*===========================================================================*/ -BOOL APIENTRY wglSetPixelFormat( HDC hdc, int iPixelFormat, CONST PIXELFORMATDESCRIPTOR *ppfd ) -{ - return TRUE; -} -/*===========================================================================*/ -/* See wglSetPixelFormat. */ -/*===========================================================================*/ -/* RETURN: TRUE, FALSE. */ -/*===========================================================================*/ -BOOL APIENTRY SetPixelFormat( HDC hdc, int iPixelFormat, CONST PIXELFORMATDESCRIPTOR *ppfd ) -{ - return wglSetPixelFormat(hdc,iPixelFormat,ppfd); -} -/*===========================================================================*/ -/* This is a wrapper function that is supported by my own internal function.*/ -/* that takes my own D3D Mesa context structure. This so I can reuse the */ -/* function (no need for speed). */ -/*===========================================================================*/ -/* RETURN: TRUE. */ -/*===========================================================================*/ -BOOL APIENTRY wglDeleteContext( HGLRC hglrc ) -{ - DestroyContext( (D3DMESACONTEXT *)hglrc ); - - return TRUE; -} -/*===========================================================================*/ -/* Simple getter function that uses a cast. */ -/*===========================================================================*/ -/* RETURN: casted pointer to the context, NULL. */ -/*===========================================================================*/ -HGLRC APIENTRY wglGetCurrentContext( VOID ) -{ - return (pD3DCurrent) ? (HGLRC)pD3DCurrent : (HGLRC)NULL; -} -/*===========================================================================*/ -/* No support. */ -/*===========================================================================*/ -/* RETURN: FALSE. */ -/*===========================================================================*/ -BOOL APIENTRY wglCopyContext( HGLRC hglrcSrc, HGLRC hglrcDst, UINT mask ) -{ - SetLastError( 0 ); - return FALSE; -} -/*===========================================================================*/ -/* No support. */ -/*===========================================================================*/ -/* RETURN: NULL. */ -/*===========================================================================*/ -HGLRC APIENTRY wglCreateLayerContext( HDC hdc,int iLayerPlane ) -{ - SetLastError( 0 ); - return (HGLRC)NULL; -} -/*===========================================================================*/ -/* Simple getter function. */ -/*===========================================================================*/ -/* RETURN: FALSE. */ -/*===========================================================================*/ -HDC APIENTRY wglGetCurrentDC( VOID ) -{ - return (pD3DCurrent) ? pD3DCurrent->hdc : (HDC)NULL; -} -/*===========================================================================*/ -/* Simply call that searches the supported extensions for a match & returns */ -/* the pointer to the function that lends support. */ -/*===========================================================================*/ -/* RETURN: pointer to API call, NULL. */ -/*===========================================================================*/ -PROC APIENTRY wglGetProcAddress( LPCSTR lpszProc ) -{ - int index; - - for( index = 0; index < qt_ext; index++ ) - if( !strcmp(lpszProc,ext[index].name) ) - return ext[index].proc; - - SetLastError( 0 ); - return NULL; -} -/*===========================================================================*/ -/* No support. */ -/*===========================================================================*/ -/* RETURN: FALSE. */ -/*===========================================================================*/ -BOOL APIENTRY wglShareLists( HGLRC hglrc1, HGLRC hglrc2 ) -{ - SetLastError( 0 ); - return FALSE; -} -/*===========================================================================*/ -/* No support. */ -/*===========================================================================*/ -/* RETURN: FALSE. */ -/*===========================================================================*/ -BOOL APIENTRY wglUseFontBitmaps( HDC fontDevice, DWORD firstChar, DWORD numChars, DWORD listBase ) -{ - SetLastError( 0 ); - return FALSE; -} -/*===========================================================================*/ -/* No support. */ -/*===========================================================================*/ -/* RETURN: FALSE. */ -/*===========================================================================*/ -BOOL APIENTRY wglUseFontBitmapsW( HDC hdc,DWORD first,DWORD count,DWORD listBase ) -{ - SetLastError( 0 ); - return FALSE; -} -/*===========================================================================*/ -/* No support. */ -/*===========================================================================*/ -/* RETURN: FALSE. */ -/*===========================================================================*/ -BOOL APIENTRY wglUseFontOutlinesA( HDC hdc, DWORD first, DWORD count, DWORD listBase, FLOAT deviation, FLOAT extrusion, int format, LPGLYPHMETRICSFLOAT lpgmf ) -{ - SetLastError( 0 ); - return FALSE; -} -/*===========================================================================*/ -/* No support. */ -/*===========================================================================*/ -/* RETURN: FALSE. */ -/*===========================================================================*/ -BOOL APIENTRY wglUseFontOutlinesW( HDC hdc,DWORD first,DWORD count, DWORD listBase,FLOAT deviation, FLOAT extrusion,int format, LPGLYPHMETRICSFLOAT lpgmf ) -{ - SetLastError( 0 ); - return FALSE ; -} -/*===========================================================================*/ -/* No support. */ -/*===========================================================================*/ -/* RETURN: FALSE. */ -/*===========================================================================*/ -BOOL APIENTRY wglSwapLayerBuffers( HDC hdc, UINT fuPlanes ) -{ - SetLastError( 0 ); - return FALSE; -} -/*===========================================================================*/ -/* This function will be hooked into the window that has been bound. Right */ -/* now it is used to track the window size and position. Also the we clean */ -/* up the currrent context when the window is close/destroyed. */ -/* */ -/* TODO: there might be something wrong here as some games (Heretic II) don't*/ -/* track the window quit right. */ -/*===========================================================================*/ -/* RETURN: */ -/*===========================================================================*/ -LONG APIENTRY wglMonitorProc( HWND hwnd, UINT message, UINT wParam, LONG lParam ) -{ - WNDPROC hOldProc; - GLint width, - height; - - switch( message ) - { -// case WM_PAINT: -// break; -// case WM_ACTIVATE: -// break; -// case WM_SHOWWINDOW: -// break; - - case UM_FATALSHUTDOWN: - /* Support the API until we die... */ - MakeCurrent( pD3DDefault ); - break; - - case WM_MOVE: - case WM_DISPLAYCHANGE: - case WM_SIZE: - ResizeContext( pD3DCurrent->gl_ctx ); - break; - - case WM_CLOSE: - case WM_DESTROY: - /* Support the API until we die... */ - hOldProc = pD3DCurrent->hOldProc; - DestroyContext( pD3DCurrent ); - return (hOldProc)(hwnd,message,wParam,lParam); - } - - return (pD3DCurrent->hOldProc)(hwnd,message,wParam,lParam); -} - -/**********************************************************************/ -/***** Miscellaneous device driver funcs *****/ -/**********************************************************************/ - -/*===========================================================================*/ -/* Not reacting to this as I'm only supporting drawing to the back buffer */ -/* right now. */ -/*===========================================================================*/ -/* RETURN: TRUE. */ -/*===========================================================================*/ -static GLboolean SetBuffer( GLcontext *ctx, GLenum buffer ) -{ - if (buffer == GL_BACK_LEFT) - return GL_TRUE; - else - return GL_FALSE; -} -/*===========================================================================*/ -/* This proc will be called by Mesa when the viewport has been set. So if */ -/* we have a context and it isn't the default then we should let D3D know of */ -/* the change. */ -/*===========================================================================*/ -/* RETURN: */ -/*===========================================================================*/ -static void SetViewport( GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h ) -{ - D3DMESACONTEXT *pContext = (D3DMESACONTEXT *)ctx->DriverCtx; - RECT rect; - - /* Make sure we can set a viewport. */ - if ( pContext->pShared && (pContext != pD3DDefault) ) - { - // TODO: might be needed. - UpdateScreenPosHAL( pContext->pShared ); - rect.left = x; - rect.right = x + w; - rect.top = y; - rect.bottom = y + h; - - // TODO: shared struct should make this call smaller - SetViewportHAL( pContext->pShared, &rect, 0.0F, 1.0F ); - } -} -/*===========================================================================*/ -/* This function could be better I guess but I decided just to grab the four*/ -/* components and store then seperately. Makes it easier to use IMHO. */ -/*===========================================================================*/ -/* RETURN: */ -/*===========================================================================*/ -static void ClearColor( GLcontext *ctx, GLubyte r, GLubyte g, GLubyte b, GLubyte a ) -{ - D3DMESACONTEXT *pContext = (D3DMESACONTEXT *)ctx->DriverCtx; - - pContext->aClear = a; - pContext->bClear = b; - pContext->gClear = g; - pContext->rClear = r; -} -/*===========================================================================*/ -/* This function could be better I guess but I decided just to grab the four*/ -/* components and store then seperately. Makes it easier to use IMHO. */ -/* (is there an echo in here?) */ -/*===========================================================================*/ -/* RETURN: */ -/*===========================================================================*/ -static void SetColor( GLcontext *ctx, GLubyte r, GLubyte g, GLubyte b, GLubyte a ) -{ - D3DMESACONTEXT *pContext = (D3DMESACONTEXT *)ctx->DriverCtx; - - pContext->aCurrent = a; - pContext->bCurrent = b; - pContext->gCurrent = g; - pContext->rCurrent = r; -} -/*===========================================================================*/ -/* */ -/* */ -/*===========================================================================*/ -/* RETURN: */ -/*===========================================================================*/ -static const char *RendererString( void ) -{ - static char pszRender[64]; - - strcpy( pszRender, "altD3D " ); - - if ( pD3DCurrent->pShared->bHardware ) - strcat( pszRender, "(HW)"); - else - strcat( pszRender, "(SW)"); - - return (const char *)pszRender; -} -/*===========================================================================*/ -/* This function will choose which set of pointers Mesa will use based on */ -/* whether we hard using hardware or software. I have added another set of */ -/* pointers that will do nothing but stop the API from crashing. */ -/*===========================================================================*/ -/* RETURN: */ -/*===========================================================================*/ -static void SetupDDPointers( GLcontext *ctx ) -{ - D3DMESACONTEXT *pContext = (D3DMESACONTEXT *)ctx->DriverCtx; - - // TODO: write a generic NULL support for the span render. - if ( pContext->pShared && pContext->pShared->bHardware ) - { - ctx->Driver.UpdateState = SetupHWDDPointers; - } - else if ( pContext == pD3DDefault ) - { - ctx->Driver.UpdateState = SetupNULLDDPointers; - } - else - { - ctx->Driver.UpdateState = SetupSWDDPointers; - } -} -/*===========================================================================*/ -/* This function will populate all the Mesa driver hooks. This version of */ -/* hooks will do nothing but support the API when we don't have a valid */ -/* context bound. This is mostly for applications that don't behave right */ -/* and also to help exit as clean as possable when we have a FatalError. */ -/*===========================================================================*/ -/* RETURN: pointer to the specific function. */ -/*===========================================================================*/ -static void SetupNULLDDPointers( GLcontext *ctx ) -{ - D3DMESACONTEXT *pContext = (D3DMESACONTEXT *)ctx->DriverCtx; - - /* Initialize all the pointers in the DD struct. Do this whenever */ - /* a new context is made current or we change buffers via set_buffer! */ - ctx->Driver.UpdateState = SetupNULLDDPointers; - - /* State management hooks. */ - ctx->Driver.Color = NULLSetColor; - ctx->Driver.ClearColor = NULLClearColor; - ctx->Driver.Clear = NULLClearBuffers; - ctx->Driver.SetBuffer = NULLSetBuffer; - - /* Window management hooks. */ - ctx->Driver.GetBufferSize = NULLGetBufferSize; - - /* Primitive rendering hooks. */ - ctx->Driver.TriangleFunc = NULL; - ctx->Driver.RenderVB = NULL; - - /* Pixel/span writing functions: */ - ctx->Driver.WriteRGBASpan = NULLWrSpRGBA; - ctx->Driver.WriteRGBSpan = NULLWrSpRGB; - ctx->Driver.WriteMonoRGBASpan = NULLWrSpRGBAMono; - ctx->Driver.WriteRGBAPixels = NULLWrPiRGBA; - ctx->Driver.WriteMonoRGBAPixels = NULLWrPiRGBAMono; - - /* Pixel/span reading functions: */ - ctx->Driver.ReadRGBASpan = NULLReSpRGBA; - ctx->Driver.ReadRGBAPixels = NULLRePiRGBA; - - /* Misc. hooks. */ - ctx->Driver.RendererString = RendererString; -} -/*===========================================================================*/ -/* This function will populate all the Mesa driver hooks. There are two of */ -/* these functions. One if we have hardware support and one is there is only*/ -/* software. These functions will be called by Mesa and by the wgl.c when we*/ -/* have resized (or created) the buffers. The thing is that if a window gets*/ -/* resized we may loose hardware support or gain it... */ -/*===========================================================================*/ -/* RETURN: pointer to the specific function. */ -/*===========================================================================*/ -static void SetupSWDDPointers( GLcontext *ctx ) -{ - D3DMESACONTEXT *pContext = (D3DMESACONTEXT *)ctx->DriverCtx; - - /* Initialize all the pointers in the DD struct. Do this whenever */ - /* a new context is made current or we change buffers via set_buffer! */ - ctx->Driver.UpdateState = SetupSWDDPointers; - - /* State management hooks. */ - ctx->Driver.Color = SetColor; - ctx->Driver.ClearColor = ClearColor; - ctx->Driver.Clear = ClearBuffers; - ctx->Driver.SetBuffer = SetBuffer; - - /* Window management hooks. */ - ctx->Driver.GetBufferSize = GetBufferSize; - ctx->Driver.Viewport = SetViewport; - - /* Primitive rendering hooks. */ - ctx->Driver.TriangleFunc = NULL; - ctx->Driver.RenderVB = NULL; - - /* Texture management hooks. */ - - /* Pixel/span writing functions: */ - ctx->Driver.WriteRGBASpan = WSpanRGBA; - ctx->Driver.WriteRGBSpan = WSpanRGB; - ctx->Driver.WriteMonoRGBASpan = WSpanRGBAMono; - ctx->Driver.WriteRGBAPixels = WPixelsRGBA; - ctx->Driver.WriteMonoRGBAPixels = WPixelsRGBAMono; - - /* Pixel/span reading functions: */ - ctx->Driver.ReadRGBASpan = RSpanRGBA; - ctx->Driver.ReadRGBAPixels = RPixelsRGBA; - - /* Misc. hooks. */ - ctx->Driver.Flush = Flush; - ctx->Driver.RendererString = RendererString; -} -/*===========================================================================*/ -/* This function will populate all the Mesa driver hooks. There are two of */ -/* these functions. One if we have hardware support and one is there is only*/ -/* software. These functions will be called by Mesa and by the wgl.c when we*/ -/* have resized (or created) the buffers. The thing is that if a window gets*/ -/* resized we may loose hardware support or gain it... */ -/*===========================================================================*/ -/* RETURN: pointer to the specific function. */ -/*===========================================================================*/ -static void SetupHWDDPointers( GLcontext *ctx ) -{ - D3DMESACONTEXT *pContext = (D3DMESACONTEXT *)ctx->DriverCtx; - - /* Initialize all the pointers in the DD struct. Do this whenever */ - /* a new context is made current or we change buffers via set_buffer! */ - ctx->Driver.UpdateState = SetupHWDDPointers; - - /* State management hooks. */ - ctx->Driver.Color = SetColor; - ctx->Driver.ClearColor = ClearColor; - ctx->Driver.Clear = ClearBuffersD3D; - ctx->Driver.SetBuffer = SetBuffer; - - /* Window management hooks. */ - ctx->Driver.GetBufferSize = GetBufferSize; - ctx->Driver.Viewport = SetViewport; - - /* Primitive rendering hooks. */ - ctx->Driver.TriangleFunc = RenderOneTriangle; - ctx->Driver.LineFunc = RenderOneLine; - ctx->Driver.RenderVB = RenderVertexBuffer; - - /* Pixel/span writing functions: */ - ctx->Driver.WriteRGBASpan = WSpanRGBA; - ctx->Driver.WriteRGBSpan = WSpanRGB; - ctx->Driver.WriteMonoRGBASpan = WSpanRGBAMono; - ctx->Driver.WriteRGBAPixels = WPixelsRGBA; - ctx->Driver.WriteMonoRGBAPixels = WPixelsRGBAMono; - - /* Pixel/span reading functions: */ - ctx->Driver.ReadRGBASpan = RSpanRGBA; - ctx->Driver.ReadRGBAPixels = RPixelsRGBA; - - /* Texture management hooks. */ - // ctx->Driver.BindTexture = TextureBind; - ctx->Driver.TexImage = TextureLoad; - ctx->Driver.TexSubImage = TextureSubImage; - - /* Misc. hooks. */ - ctx->Driver.Flush = Flush; - ctx->Driver.RendererString = RendererString; -} -/*===========================================================================*/ -/* This function will release all resources used by the DLL. Every context */ -/* will be clobbered by releaseing all driver desources and then freeing the */ -/* context memory. Most all the work is done in DestroyContext. */ -/*===========================================================================*/ -/* RETURN: TRUE. */ -/*===========================================================================*/ -static BOOL TermOpenGL( HINSTANCE hInst ) -{ - D3DMESACONTEXT *pTmp, - *pNext; - - /* Just incase we are still getting paint msg. */ - MakeCurrent( pD3DDefault ); - - /* Walk the list until we get back to the default context. */ - for( pTmp = pD3DDefault->next; pTmp != pD3DDefault; pTmp = pNext ) - { - pNext = pTmp->next; - DestroyContext( pTmp ); - } - DestroyContext( pD3DDefault ); - - return TRUE; -} -/*===========================================================================*/ -/* This function is an internal function that will clean up all the Mesa */ -/* context bound to this D3D context. Also any D3D stuff that this context */ -/* uses will be unloaded. */ -/*===========================================================================*/ -/* RETURN: TRUE, FALSE. */ -/*===========================================================================*/ -static void DestroyContext( D3DMESACONTEXT *pContext ) -{ - D3DMESACONTEXT *pTmp; - - /* Walk the list until we find the context before this one. */ - for( pTmp = pD3DDefault; pTmp && (pTmp->next != pContext); pTmp = pTmp->next ) - if ( pTmp == pTmp->next ) - break; - - /* If we never found it it must already be deleted. */ - if ( pTmp->next != pContext ) - return; - - /* Make sure we are not using this context. */ - if ( pContext == pD3DCurrent ) - MakeCurrent( pD3DDefault ); - - /* Free the Mesa stuff. */ - if ( pContext->gl_visual ) - { - _mesa_destroy_visual( pContext->gl_visual ); - pContext->gl_visual = NULL; - } - if ( pContext->gl_buffer ) - { - _mesa_destroy_framebuffer( pContext->gl_buffer ); - pContext->gl_buffer = NULL; - } - if ( pContext->gl_ctx ) - { - _mesa_destroy_context( pContext->gl_ctx ); - pContext->gl_ctx = NULL; - } - - /* Now dump the D3D. */ - if ( pContext->pShared ) - TermHAL( pContext->pShared ); - - /* Update the previous context's link. */ - pTmp->next = pContext->next; - - /* Gonzo. */ - FREE( pContext ); -} -/*===========================================================================*/ -/* This function will pull the supplied context away from Win32. Basicly it*/ -/* will remove the hook from the window Proc. */ -/* */ -/* TODO: might want to serialize this stuff... */ -/*===========================================================================*/ -/* RETURN: TRUE, FALSE. */ -/*===========================================================================*/ -static BOOL UnBindWindow( D3DMESACONTEXT *pContext ) -{ - if ( pContext == NULL ) - return FALSE; - - if ( pContext == pD3DDefault ) - return TRUE; - - /* Make sure we always have a context bound. */ - if ( pContext == pD3DCurrent ) - pD3DCurrent = pD3DDefault; - - SetWindowLong( pContext->pShared->hwnd, GWL_WNDPROC, (LONG)pContext->hOldProc ); - pContext->hOldProc = NULL; - - return TRUE; -} -/*===========================================================================*/ -/* There are two cases that allow for a faster clear when we know that the */ -/* whole buffer is cleared and that there is no clipping. */ -/*===========================================================================*/ -/* RETURN: the original mask with the bits cleared that represents the buffer* -/* or buffers we just cleared. */ -/*===========================================================================*/ -GLbitfield ClearBuffersD3D( GLcontext *ctx, GLbitfield mask, GLboolean all, GLint x, GLint y, GLint width, GLint height ) -{ - D3DMESACONTEXT *pContext = (D3DMESACONTEXT *)ctx->DriverCtx; - DWORD dwFlags = 0; - - if ( mask & GL_COLOR_BUFFER_BIT ) - { - dwFlags |= D3DCLEAR_TARGET; - mask &= ~GL_COLOR_BUFFER_BIT; - } - if ( mask & GL_DEPTH_BUFFER_BIT ) - { - dwFlags |= D3DCLEAR_ZBUFFER; - mask &= ~GL_DEPTH_BUFFER_BIT; - } - if ( dwFlags == 0 ) - return mask; - - ClearHAL( pContext->pShared, - dwFlags, - all, - x, y, - width, height, - ((pContext->aClear<<24) | (pContext->rClear<<16) | (pContext->gClear<<8) | (pContext->bClear)), - ctx->Depth.Clear, - 0 ); - - return mask; -} - - - -/*===========================================================================*/ -/* TEXTURE MANAGER: ok here is how I did textures. Mesa-3.0 will keep track*/ -/* of all the textures for us. So this means that at anytime we can go to */ -/* the Mesa context and get the current texture. With this in mind this is */ -/* what I did. I really don't care about what textures get or are loaded */ -/* until I actually have to draw a tri that is textured. At this point I */ -/* must have the texture so I demand the texture by destorying all other */ -/* texture surfaces if need be and load the current one. This allows for the*/ -/* best preformance on low memory cards as time is not wasted loading and */ -/* unload textures. */ -/*===========================================================================*/ - - - - - -/*===========================================================================*/ -/* TextureLoad will try and create a D3D surface from the supplied texture */ -/* object if its level 0 (first). The surface will be fully filled with the */ -/* texture. */ -/*===========================================================================*/ -/* RETURN: */ -/*===========================================================================*/ -static void TextureLoad( GLcontext *ctx, GLenum target, struct gl_texture_object *tObj, GLint level, GLint internalFormat, const struct gl_texture_image *image ) -{ - D3DMESACONTEXT *pContext = (D3DMESACONTEXT *)ctx->DriverCtx; - - /* TODO: only doing first LOD. */ - if ( (ctx->DriverCtx == NULL) || (level != 0) ) - return; - - CreateTMgrHAL( pContext->pShared, - tObj->Name, - level, - tObj->Image[level]->Format, - (RECT *)NULL, - tObj->Image[level]->Width, - tObj->Image[level]->Height, - TM_ACTION_LOAD, - (void *)tObj->Image[level]->Data ); -} -/*===========================================================================*/ -/* TextureBind make sure that the texture is on the card. Thats it. */ -/*===========================================================================*/ -/* RETURN: */ -/*===========================================================================*/ -static void TextureBind( GLcontext *ctx, GLenum target, struct gl_texture_object *tObj ) -{ - D3DMESACONTEXT *pContext = (D3DMESACONTEXT *)ctx->DriverCtx; - - /* TODO: only doing first LOD. */ - if ( (tObj->Image[0] == NULL) || (ctx->DriverCtx == NULL) ) - return; - - CreateTMgrHAL( pContext->pShared, - tObj->Name, - 0, - tObj->Image[0]->Format, - (RECT *)NULL, - tObj->Image[0]->Width, - tObj->Image[0]->Height, - TM_ACTION_BIND, - (void *)tObj->Image[0]->Data ); -} -/*===========================================================================*/ -/* TextureSubImage will make sure that the texture being updated is updated */ -/* if its on the card. */ -/*===========================================================================*/ -/* RETURN: */ -/*===========================================================================*/ -static void TextureSubImage( GLcontext *ctx, GLenum target, struct gl_texture_object *tObj, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLint internalFormat, const struct gl_texture_image *image ) -{ - D3DMESACONTEXT *pContext = (D3DMESACONTEXT *)ctx->DriverCtx; - RECT rect; - - /* TODO: only doing first LOD. */ - if ( (ctx->DriverCtx == NULL) || (level > 0) ) - return; - - /* Create a dirty rectangle structure. */ - rect.left = xoffset; - rect.right = xoffset + width; - rect.top = yoffset; - rect.bottom = yoffset + height; - - CreateTMgrHAL( pContext->pShared, - tObj->Name, - 0, - tObj->Image[0]->Format, - &rect, - tObj->Image[0]->Width, - tObj->Image[0]->Height, - TM_ACTION_UPDATE, - (void *)tObj->Image[0]->Data ); -} - diff --git a/src/mesa/drivers/d3d/d3dText.h b/src/mesa/drivers/d3d/d3dText.h deleted file mode 100644 index 9ff0650518..0000000000 --- a/src/mesa/drivers/d3d/d3dText.h +++ /dev/null @@ -1,53 +0,0 @@ -#ifndef D3D_TEXT_H -#define D3D_TEXT_H - - -#ifdef __cplusplus -extern "C" { -#endif - -/*===========================================================================*/ -/* Includes. */ -/*===========================================================================*/ -#include -#include -#include -/*===========================================================================*/ -/* Magic numbers. */ -/*===========================================================================*/ -#define D3DLTEXT_BITSUSED 0xFFFFFFFF -#define MAX_VERTICES 700 // (14*40) 14 per character, 40 characters -/*===========================================================================*/ -/* Macros defines. */ -/*===========================================================================*/ -/*===========================================================================*/ -/* Type defines. */ -/*===========================================================================*/ -typedef struct _d3dText_metrics -{ - float fntYScale, - fntXScale; - - int fntXSpacing, - fntYSpacing; - - DWORD dwColor; - LPDIRECT3DDEVICE3 lpD3DDevice; - -} D3DFONTMETRICS, *PD3DFONTMETRICS; -/*===========================================================================*/ -/* Function prototypes. */ -/*===========================================================================*/ -extern BOOL InitD3DText( void ); -extern void d3dTextDrawCharacter( char *c, int x, int y, PD3DFONTMETRICS pfntMetrics ); -extern void d3dTextDrawString( char *pszString, int x, int y, PD3DFONTMETRICS pfntMetrics ); -/*===========================================================================*/ -/* Global variables. */ -/*===========================================================================*/ - -#ifdef __cplusplus -} -#endif - - -#endif diff --git a/src/mesa/drivers/dri/common/xmlpool/.gitignore b/src/mesa/drivers/dri/common/xmlpool/.gitignore deleted file mode 100644 index a5a437849b..0000000000 --- a/src/mesa/drivers/dri/common/xmlpool/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -de -es -fr -nl -sv diff --git a/src/mesa/drivers/dri/r200/.gitignore b/src/mesa/drivers/dri/r200/.gitignore deleted file mode 100644 index 3773d8ea73..0000000000 --- a/src/mesa/drivers/dri/r200/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -radeon_chipset.h -radeon_screen.* -server diff --git a/src/mesa/drivers/dri/r300/.gitignore b/src/mesa/drivers/dri/r300/.gitignore deleted file mode 100644 index 3689a6a78e..0000000000 --- a/src/mesa/drivers/dri/r300/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -radeon_chipset.h -radeon_screen.[ch] -radeon_span.h -server diff --git a/src/mesa/drivers/dri/r300/Lindent b/src/mesa/drivers/dri/r300/Lindent old mode 100755 new mode 100644 diff --git a/src/mesa/drivers/ggi/default/.gitignore b/src/mesa/drivers/ggi/default/.gitignore deleted file mode 100644 index c8a526b14d..0000000000 --- a/src/mesa/drivers/ggi/default/.gitignore +++ /dev/null @@ -1 +0,0 @@ -genkgi.conf diff --git a/src/mesa/drivers/ggi/display/.gitignore b/src/mesa/drivers/ggi/display/.gitignore deleted file mode 100644 index 98858db2c0..0000000000 --- a/src/mesa/drivers/ggi/display/.gitignore +++ /dev/null @@ -1 +0,0 @@ -fbdev.conf diff --git a/src/mesa/drivers/windows/gldirect/dx7/gld_driver_dx7.c b/src/mesa/drivers/windows/gldirect/dx7/gld_driver_dx7.c deleted file mode 100644 index d5fa642800..0000000000 --- a/src/mesa/drivers/windows/gldirect/dx7/gld_driver_dx7.c +++ /dev/null @@ -1,1196 +0,0 @@ -/**************************************************************************** -* -* Mesa 3-D graphics library -* Direct3D Driver Interface -* -* ======================================================================== -* -* Copyright (C) 1991-2004 SciTech Software, Inc. All rights reserved. -* -* Permission is hereby granted, free of charge, to any person obtaining a -* copy of this software and associated documentation files (the "Software"), -* to deal in the Software without restriction, including without limitation -* the rights to use, copy, modify, merge, publish, distribute, sublicense, -* and/or sell copies of the Software, and to permit persons to whom the -* Software is furnished to do so, subject to the following conditions: -* -* The above copyright notice and this permission notice shall be included -* in all copies or substantial portions of the Software. -* -* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -* SCITECH SOFTWARE INC BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF -* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -* SOFTWARE. -* -* ====================================================================== -* -* Language: ANSI C -* Environment: Windows 9x/2000/XP/XBox (Win32) -* -* Description: Driver interface code to Mesa -* -****************************************************************************/ - -//#include -#include "dglcontext.h" -#include "ddlog.h" -#include "gld_dx7.h" - -#include "glheader.h" -#include "context.h" -#include "colormac.h" -#include "depth.h" -#include "extensions.h" -#include "macros.h" -#include "matrix.h" -// #include "mem.h" -//#include "mmath.h" -#include "mtypes.h" -#include "texformat.h" -#include "teximage.h" -#include "texstore.h" -#include "vbo/vbo.h" -#include "swrast_setup/swrast_setup.h" -#include "swrast_setup/ss_context.h" -#include "tnl/tnl.h" -#include "tnl/t_context.h" -#include "tnl/t_pipeline.h" - -extern BOOL dglSwapBuffers(HDC hDC); - -// HACK: Hack the _33 member of the OpenGL perspective projection matrix -const float _fPersp_33 = 1.6f; - -//--------------------------------------------------------------------------- -// Internal functions -//--------------------------------------------------------------------------- - -void _gld_mesa_warning( - __GLcontext *gc, - char *str) -{ - // Intercept Mesa's internal warning mechanism - gldLogPrintf(GLDLOG_WARN, "Mesa warning: %s", str); -} - -//--------------------------------------------------------------------------- - -void _gld_mesa_fatal( - __GLcontext *gc, - char *str) -{ - // Intercept Mesa's internal fatal-message mechanism - gldLogPrintf(GLDLOG_CRITICAL, "Mesa FATAL: %s", str); - - // Mesa calls abort(0) here. - ddlogClose(); - exit(0); -} - -//--------------------------------------------------------------------------- - -D3DSTENCILOP _gldConvertStencilOp( - GLenum StencilOp) -{ - // Used by Stencil: pass, fail and zfail - - switch (StencilOp) { - case GL_KEEP: - return D3DSTENCILOP_KEEP; - case GL_ZERO: - return D3DSTENCILOP_ZERO; - case GL_REPLACE: - return D3DSTENCILOP_REPLACE; - case GL_INCR: - return D3DSTENCILOP_INCRSAT; - case GL_DECR: - return D3DSTENCILOP_DECRSAT; - case GL_INVERT: - return D3DSTENCILOP_INVERT; - case GL_INCR_WRAP_EXT: // GL_EXT_stencil_wrap - return D3DSTENCILOP_INCR; - case GL_DECR_WRAP_EXT: // GL_EXT_stencil_wrap - return D3DSTENCILOP_DECR; - } - -#ifdef _DEBUG - gldLogMessage(GLDLOG_ERROR, "_gldConvertStencilOp: Unknown StencilOp\n"); -#endif - - return D3DSTENCILOP_KEEP; -} - -//--------------------------------------------------------------------------- - -D3DCMPFUNC _gldConvertCompareFunc( - GLenum CmpFunc) -{ - // Used for Alpha func, depth func and stencil func. - - switch (CmpFunc) { - case GL_NEVER: - return D3DCMP_NEVER; - case GL_LESS: - return D3DCMP_LESS; - case GL_EQUAL: - return D3DCMP_EQUAL; - case GL_LEQUAL: - return D3DCMP_LESSEQUAL; - case GL_GREATER: - return D3DCMP_GREATER; - case GL_NOTEQUAL: - return D3DCMP_NOTEQUAL; - case GL_GEQUAL: - return D3DCMP_GREATEREQUAL; - case GL_ALWAYS: - return D3DCMP_ALWAYS; - }; - -#ifdef _DEBUG - gldLogMessage(GLDLOG_ERROR, "_gldConvertCompareFunc: Unknown CompareFunc\n"); -#endif - - return D3DCMP_ALWAYS; -} - -//--------------------------------------------------------------------------- - -D3DBLEND _gldConvertBlendFunc( - GLenum blend, - GLenum DefaultBlend) -{ - switch (blend) { - case GL_ZERO: - return D3DBLEND_ZERO; - case GL_ONE: - return D3DBLEND_ONE; - case GL_DST_COLOR: - return D3DBLEND_DESTCOLOR; - case GL_SRC_COLOR: - return D3DBLEND_SRCCOLOR; - case GL_ONE_MINUS_DST_COLOR: - return D3DBLEND_INVDESTCOLOR; - case GL_ONE_MINUS_SRC_COLOR: - return D3DBLEND_INVSRCCOLOR; - case GL_SRC_ALPHA: - return D3DBLEND_SRCALPHA; - case GL_ONE_MINUS_SRC_ALPHA: - return D3DBLEND_INVSRCALPHA; - case GL_DST_ALPHA: - return D3DBLEND_DESTALPHA; - case GL_ONE_MINUS_DST_ALPHA: - return D3DBLEND_INVDESTALPHA; - case GL_SRC_ALPHA_SATURATE: - return D3DBLEND_SRCALPHASAT; - } - -#ifdef _DEBUG - gldLogMessage(GLDLOG_ERROR, "_gldConvertBlendFunc: Unknown BlendFunc\n"); -#endif - - return DefaultBlend; -} - -//--------------------------------------------------------------------------- -// Misc. functions -//--------------------------------------------------------------------------- - -void gld_Noop_DX7( - GLcontext *ctx) -{ -#ifdef _DEBUG - gldLogMessage(GLDLOG_ERROR, "gld_Noop called!\n"); -#endif -} - -//--------------------------------------------------------------------------- - -void gld_Error_DX7( - GLcontext *ctx) -{ -#ifdef _DEBUG - // Quite useless. -// gldLogMessage(GLDLOG_ERROR, "ctx->Driver.Error called!\n"); -#endif -} - -//--------------------------------------------------------------------------- -// Required Mesa functions -//--------------------------------------------------------------------------- - -static GLboolean gld_set_draw_buffer_DX7( - GLcontext *ctx, - GLenum mode) -{ - (void) ctx; - if ((mode==GL_FRONT_LEFT) || (mode == GL_BACK_LEFT)) { - return GL_TRUE; - } - else { - return GL_FALSE; - } -} - -//--------------------------------------------------------------------------- - -static void gld_set_read_buffer_DX7( - GLcontext *ctx, - GLframebuffer *buffer, - GLenum mode) -{ - /* separate read buffer not supported */ -/* - ASSERT(buffer == ctx->DrawBuffer); - ASSERT(mode == GL_FRONT_LEFT); -*/ -} - -//--------------------------------------------------------------------------- - -void gld_Clear_DX7( - GLcontext *ctx, - GLbitfield mask, - GLboolean all, - GLint x, - GLint y, - GLint width, - GLint height) -{ - GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); - GLD_driver_dx7 *gld = GLD_GET_DX7_DRIVER(gldCtx); - - DWORD dwFlags = 0; - D3DCOLOR Color = 0; - float Z = 0.0f; - DWORD Stencil = 0; - D3DRECT d3dClearRect; - - // TODO: Colourmask - const GLuint *colorMask = (GLuint *) &ctx->Color.ColorMask; - - if (!gld->pDev) - return; - - if (mask & (DD_FRONT_LEFT_BIT | DD_BACK_LEFT_BIT)) { - GLubyte col[4]; - CLAMPED_FLOAT_TO_UBYTE(col[0], ctx->Color.ClearColor[0]); - CLAMPED_FLOAT_TO_UBYTE(col[1], ctx->Color.ClearColor[1]); - CLAMPED_FLOAT_TO_UBYTE(col[2], ctx->Color.ClearColor[2]); - CLAMPED_FLOAT_TO_UBYTE(col[3], ctx->Color.ClearColor[3]); - dwFlags |= D3DCLEAR_TARGET; - Color = D3DCOLOR_RGBA(col[0], col[1], col[2], col[3]); -// ctx->Color.ClearColor[1], -// ctx->Color.ClearColor[2], -// ctx->Color.ClearColor[3]); - } - - if (mask & DD_DEPTH_BIT) { - // D3D7 will fail the Clear call if we try and clear a - // depth buffer and we haven't created one. - // Also, some apps try and clear a depth buffer, - // when a depth buffer hasn't been requested by the app. - if (ctx->Visual.depthBits == 0) { - mask &= ~DD_DEPTH_BIT; // Remove depth bit from mask - } else { - dwFlags |= D3DCLEAR_ZBUFFER; - Z = ctx->Depth.Clear; - } - } - - if (mask & DD_STENCIL_BIT) { - if (ctx->Visual.stencilBits == 0) { - // No stencil bits in depth buffer - mask &= ~DD_STENCIL_BIT; // Remove stencil bit from mask - } else { - dwFlags |= D3DCLEAR_STENCIL; - Stencil = ctx->Stencil.Clear; - } - } - - // Some apps do really weird things with the rect, such as Quake3. - if ((x < 0) || (y < 0) || (width <= 0) || (height <= 0)) { - all = GL_TRUE; - } - - if (!all) { - // Calculate clear subrect - d3dClearRect.x1 = x; - d3dClearRect.y1 = gldCtx->dwHeight - (y + height); - d3dClearRect.x2 = x + width; - d3dClearRect.y2 = d3dClearRect.y1 + height; - } - - // dwFlags will be zero if there's nothing to clear - if (dwFlags) { - _GLD_DX7_DEV(Clear( - gld->pDev, - all ? 0 : 1, - all ? NULL : &d3dClearRect, - dwFlags, - Color, Z, Stencil)); - } - - if (mask & DD_ACCUM_BIT) { - // Clear accumulation buffer - } -} - -//--------------------------------------------------------------------------- - -// Mesa 5: Parameter change -static void gld_buffer_size_DX7( -// GLcontext *ctx, - GLframebuffer *fb, - GLuint *width, - GLuint *height) -{ -// GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); - - *width = fb->Width; // gldCtx->dwWidth; - *height = fb->Height; // gldCtx->dwHeight; -} - -//--------------------------------------------------------------------------- - -static void gld_Finish_DX7( - GLcontext *ctx) -{ -} - -//--------------------------------------------------------------------------- - -static void gld_Flush_DX7( - GLcontext *ctx) -{ - GLD_context *gld = GLD_GET_CONTEXT(ctx); - - // TODO: Detect apps that glFlush() then SwapBuffers() ? - - if (gld->EmulateSingle) { - // Emulating a single-buffered context. - // [Direct3D doesn't allow rendering to front buffer] - dglSwapBuffers(gld->hDC); - } -} - -//--------------------------------------------------------------------------- - -void gld_NEW_STENCIL( - GLcontext *ctx) -{ - GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); - GLD_driver_dx7 *gld = GLD_GET_DX7_DRIVER(gldCtx); - - // Two-sided stencil. New for Mesa 5 - const GLuint uiFace = 0UL; - - struct gl_stencil_attrib *pStencil = &ctx->Stencil; - - _GLD_DX7_DEV(SetRenderState(gld->pDev, D3DRENDERSTATE_STENCILENABLE, pStencil->Enabled ? TRUE : FALSE)); - if (pStencil->Enabled) { - _GLD_DX7_DEV(SetRenderState(gld->pDev, D3DRENDERSTATE_STENCILFUNC, _gldConvertCompareFunc(pStencil->Function[uiFace]))); - _GLD_DX7_DEV(SetRenderState(gld->pDev, D3DRENDERSTATE_STENCILREF, pStencil->Ref[uiFace])); - _GLD_DX7_DEV(SetRenderState(gld->pDev, D3DRENDERSTATE_STENCILMASK, pStencil->ValueMask[uiFace])); - _GLD_DX7_DEV(SetRenderState(gld->pDev, D3DRENDERSTATE_STENCILWRITEMASK, pStencil->WriteMask[uiFace])); - _GLD_DX7_DEV(SetRenderState(gld->pDev, D3DRENDERSTATE_STENCILFAIL, _gldConvertStencilOp(pStencil->FailFunc[uiFace]))); - _GLD_DX7_DEV(SetRenderState(gld->pDev, D3DRENDERSTATE_STENCILZFAIL, _gldConvertStencilOp(pStencil->ZFailFunc[uiFace]))); - _GLD_DX7_DEV(SetRenderState(gld->pDev, D3DRENDERSTATE_STENCILPASS, _gldConvertStencilOp(pStencil->ZPassFunc[uiFace]))); - } -} - -//--------------------------------------------------------------------------- - -void gld_NEW_COLOR( - GLcontext *ctx) -{ - GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); - GLD_driver_dx7 *gld = GLD_GET_DX7_DRIVER(gldCtx); - - DWORD dwFlags = 0; - D3DBLEND src; - D3DBLEND dest; - - // Alpha func - _GLD_DX7_DEV(SetRenderState(gld->pDev, D3DRENDERSTATE_ALPHAFUNC, _gldConvertCompareFunc(ctx->Color.AlphaFunc))); - _GLD_DX7_DEV(SetRenderState(gld->pDev, D3DRENDERSTATE_ALPHAREF, (DWORD)ctx->Color.AlphaRef)); - _GLD_DX7_DEV(SetRenderState(gld->pDev, D3DRENDERSTATE_ALPHATESTENABLE, ctx->Color.AlphaEnabled)); - - // Blend func - _GLD_DX7_DEV(SetRenderState(gld->pDev, D3DRENDERSTATE_ALPHABLENDENABLE, ctx->Color.BlendEnabled)); - src = _gldConvertBlendFunc(ctx->Color.BlendSrcRGB, GL_ONE); - dest = _gldConvertBlendFunc(ctx->Color.BlendDstRGB, GL_ZERO); - _GLD_DX7_DEV(SetRenderState(gld->pDev, D3DRENDERSTATE_SRCBLEND, src)); - _GLD_DX7_DEV(SetRenderState(gld->pDev, D3DRENDERSTATE_DESTBLEND, dest)); - -/* - // Color mask - unsupported by DX7 - if (ctx->Color.ColorMask[0]) dwFlags |= D3DCOLORWRITEENABLE_RED; - if (ctx->Color.ColorMask[1]) dwFlags |= D3DCOLORWRITEENABLE_GREEN; - if (ctx->Color.ColorMask[2]) dwFlags |= D3DCOLORWRITEENABLE_BLUE; - if (ctx->Color.ColorMask[3]) dwFlags |= D3DCOLORWRITEENABLE_ALPHA; - _GLD_DX7_DEV(SetRenderState(gld->pDev, D3DRENDERSTATE_COLORWRITEENABLE, dwFlags)); -*/ -} - -//--------------------------------------------------------------------------- - -void gld_NEW_DEPTH( - GLcontext *ctx) -{ - GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); - GLD_driver_dx7 *gld = GLD_GET_DX7_DRIVER(gldCtx); - - _GLD_DX7_DEV(SetRenderState(gld->pDev, D3DRENDERSTATE_ZENABLE, ctx->Depth.Test ? D3DZB_TRUE : D3DZB_FALSE)); - _GLD_DX7_DEV(SetRenderState(gld->pDev, D3DRENDERSTATE_ZFUNC, _gldConvertCompareFunc(ctx->Depth.Func))); - _GLD_DX7_DEV(SetRenderState(gld->pDev, D3DRENDERSTATE_ZWRITEENABLE, ctx->Depth.Mask ? TRUE : FALSE)); -} - -//--------------------------------------------------------------------------- - -void gld_NEW_POLYGON( - GLcontext *ctx) -{ - GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); - GLD_driver_dx7 *gld = GLD_GET_DX7_DRIVER(gldCtx); - - D3DFILLMODE d3dFillMode = D3DFILL_SOLID; - D3DCULL d3dCullMode = D3DCULL_NONE; - int iOffset = 0; - - // Fillmode - switch (ctx->Polygon.FrontMode) { - case GL_POINT: - d3dFillMode = D3DFILL_POINT; - break; - case GL_LINE: - d3dFillMode = D3DFILL_WIREFRAME; - break; - case GL_FILL: - d3dFillMode = D3DFILL_SOLID; - break; - } - _GLD_DX7_DEV(SetRenderState(gld->pDev, D3DRENDERSTATE_FILLMODE, d3dFillMode)); - - if (ctx->Polygon.CullFlag) { - switch (ctx->Polygon.CullFaceMode) { - case GL_BACK: - if (ctx->Polygon.FrontFace == GL_CCW) - d3dCullMode = D3DCULL_CW; - else - d3dCullMode = D3DCULL_CCW; - break; - case GL_FRONT: - if (ctx->Polygon.FrontFace == GL_CCW) - d3dCullMode = D3DCULL_CCW; - else - d3dCullMode = D3DCULL_CW; - break; - case GL_FRONT_AND_BACK: - d3dCullMode = D3DCULL_NONE; - break; - default: - break; - } - } else { - d3dCullMode = D3DCULL_NONE; - } -// d3dCullMode = D3DCULL_NONE; // TODO: DEBUGGING - _GLD_DX7_DEV(SetRenderState(gld->pDev, D3DRENDERSTATE_CULLMODE, d3dCullMode)); - - // Polygon offset - // ZBIAS ranges from 0 to 16 and can only move towards the viewer - // Mesa5: ctx->Polygon._OffsetAny removed - if (ctx->Polygon.OffsetFill) { - iOffset = (int)ctx->Polygon.OffsetUnits; - if (iOffset < 0) - iOffset = -iOffset; - else - iOffset = 0; // D3D can't push away - } - _GLD_DX7_DEV(SetRenderState(gld->pDev, D3DRENDERSTATE_ZBIAS, iOffset)); -} - -//--------------------------------------------------------------------------- - -void gld_NEW_FOG( - GLcontext *ctx) -{ - GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); - GLD_driver_dx7 *gld = GLD_GET_DX7_DRIVER(gldCtx); - - D3DCOLOR d3dFogColour; - D3DFOGMODE d3dFogMode = D3DFOG_LINEAR; - - // TODO: Fog is calculated seperately in the Mesa pipeline - _GLD_DX7_DEV(SetRenderState(gld->pDev, D3DRENDERSTATE_FOGENABLE, FALSE)); - return; - - // Fog enable - _GLD_DX7_DEV(SetRenderState(gld->pDev, D3DRENDERSTATE_FOGENABLE, ctx->Fog.Enabled)); - if (!ctx->Fog.Enabled) { - _GLD_DX7_DEV(SetRenderState(gld->pDev, D3DRENDERSTATE_FOGTABLEMODE, D3DFOG_NONE)); - _GLD_DX7_DEV(SetRenderState(gld->pDev, D3DRENDERSTATE_FOGVERTEXMODE, D3DFOG_NONE)); - return; // If disabled, don't bother setting any fog state - } - - // Fog colour - d3dFogColour = D3DCOLOR_COLORVALUE( ctx->Fog.Color[0], - ctx->Fog.Color[1], - ctx->Fog.Color[2], - ctx->Fog.Color[3]); - _GLD_DX7_DEV(SetRenderState(gld->pDev, D3DRENDERSTATE_FOGCOLOR, d3dFogColour)); - - // Fog density - _GLD_DX7_DEV(SetRenderState(gld->pDev, D3DRENDERSTATE_FOGDENSITY, *((DWORD*) (&ctx->Fog.Density)))); - - // Fog start - _GLD_DX7_DEV(SetRenderState(gld->pDev, D3DRENDERSTATE_FOGSTART, *((DWORD*) (&ctx->Fog.Start)))); - - // Fog end - _GLD_DX7_DEV(SetRenderState(gld->pDev, D3DRENDERSTATE_FOGEND, *((DWORD*) (&ctx->Fog.End)))); - - // Fog mode - switch (ctx->Fog.Mode) { - case GL_LINEAR: - d3dFogMode = D3DFOG_LINEAR; - break; - case GL_EXP: - d3dFogMode = D3DFOG_EXP; - break; - case GL_EXP2: - d3dFogMode = D3DFOG_EXP2; - break; - } - _GLD_DX7_DEV(SetRenderState(gld->pDev, D3DRENDERSTATE_FOGTABLEMODE, d3dFogMode)); - _GLD_DX7_DEV(SetRenderState(gld->pDev, D3DRENDERSTATE_FOGVERTEXMODE, D3DFOG_NONE)); -} - -//--------------------------------------------------------------------------- - -void gld_NEW_LIGHT( - GLcontext *ctx) -{ - GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); - GLD_driver_dx7 *gld = GLD_GET_DX7_DRIVER(gldCtx); - DWORD dwSpecularEnable; - - // Shademode - _GLD_DX7_DEV(SetRenderState(gld->pDev, D3DRENDERSTATE_SHADEMODE, (ctx->Light.ShadeModel == GL_SMOOTH) ? D3DSHADE_GOURAUD : D3DSHADE_FLAT)); - - // Separate specular colour - if (ctx->Light.Enabled) - dwSpecularEnable = (ctx->_TriangleCaps & DD_SEPARATE_SPECULAR) ? TRUE: FALSE; - else - dwSpecularEnable = FALSE; - _GLD_DX7_DEV(SetRenderState(gld->pDev, D3DRENDERSTATE_SPECULARENABLE, dwSpecularEnable)); -} - -//--------------------------------------------------------------------------- - -void gld_NEW_MODELVIEW( - GLcontext *ctx) -{ - GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); - GLD_driver_dx7 *gld = GLD_GET_DX7_DRIVER(gldCtx); - - D3DMATRIX m; - //GLfloat *pM = ctx->ModelView.m; - // Mesa5: Model-view is now a stack - GLfloat *pM = ctx->ModelviewMatrixStack.Top->m; - m._11 = pM[0]; - m._12 = pM[1]; - m._13 = pM[2]; - m._14 = pM[3]; - m._21 = pM[4]; - m._22 = pM[5]; - m._23 = pM[6]; - m._24 = pM[7]; - m._31 = pM[8]; - m._32 = pM[9]; - m._33 = pM[10]; - m._34 = pM[11]; - m._41 = pM[12]; - m._42 = pM[13]; - m._43 = pM[14]; - m._44 = pM[15]; -/* m[0][0] = pM[0]; - m[0][1] = pM[1]; - m[0][2] = pM[2]; - m[0][3] = pM[3]; - m[1][0] = pM[4]; - m[1][1] = pM[5]; - m[1][2] = pM[6]; - m[1][3] = pM[7]; - m[2][0] = pM[8]; - m[2][1] = pM[9]; - m[2][2] = pM[10]; - m[2][3] = pM[11]; - m[3][0] = pM[12]; - m[3][1] = pM[13]; - m[3][2] = pM[14]; - m[3][3] = pM[15];*/ - - gld->matModelView = m; -} - -//--------------------------------------------------------------------------- - -void gld_NEW_PROJECTION( - GLcontext *ctx) -{ - GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); - GLD_driver_dx7 *gld = GLD_GET_DX7_DRIVER(gldCtx); - - D3DMATRIX m; - //GLfloat *pM = ctx->ProjectionMatrix.m; - // Mesa 5: Now a stack - GLfloat *pM = ctx->ProjectionMatrixStack.Top->m; - m._11 = pM[0]; - m._12 = pM[1]; - m._13 = pM[2]; - m._14 = pM[3]; - - m._21 = pM[4]; - m._22 = pM[5]; - m._23 = pM[6]; - m._24 = pM[7]; - - m._31 = pM[8]; - m._32 = pM[9]; - m._33 = pM[10] / _fPersp_33; // / 1.6f; - m._34 = pM[11]; - - m._41 = pM[12]; - m._42 = pM[13]; - m._43 = pM[14] / 2.0f; - m._44 = pM[15]; - - gld->matProjection = m; -} - -//--------------------------------------------------------------------------- -/* -void gldFrustumHook_DX7( - GLdouble left, - GLdouble right, - GLdouble bottom, - GLdouble top, - GLdouble nearval, - GLdouble farval) -{ - GET_CURRENT_CONTEXT(ctx); - GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); - GLD_driver_dx7 *gld = GLD_GET_DX7_DRIVER(gldCtx); - - // Pass values on to Mesa first (in case we mess with them) - _mesa_Frustum(left, right, bottom, top, nearval, farval); - - _fPersp_33 = farval / (nearval - farval); - -// ddlogPrintf(GLDLOG_SYSTEM, "Frustum: %f", farval/nearval); -} - -//--------------------------------------------------------------------------- - -void gldOrthoHook_DX7( - GLdouble left, - GLdouble right, - GLdouble bottom, - GLdouble top, - GLdouble nearval, - GLdouble farval) -{ - GET_CURRENT_CONTEXT(ctx); - GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); - GLD_driver_dx7 *gld = GLD_GET_DX7_DRIVER(gldCtx); - - // Pass values on to Mesa first (in case we mess with them) - _mesa_Ortho(left, right, bottom, top, nearval, farval); - - _fPersp_33 = 1.6f; - -// ddlogPrintf(GLDLOG_SYSTEM, "Ortho: %f", farval/nearval); -} -*/ -//--------------------------------------------------------------------------- - -void gld_NEW_VIEWPORT( - GLcontext *ctx) -{ - GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); - GLD_driver_dx7 *gld = GLD_GET_DX7_DRIVER(gldCtx); - - D3DVIEWPORT7 d3dvp; -// GLint x, y; -// GLsizei w, h; - - // Set depth range - _GLD_DX7_DEV(GetViewport(gld->pDev, &d3dvp)); - // D3D can't do Quake1/Quake2 z-trick - if (ctx->Viewport.Near <= ctx->Viewport.Far) { - d3dvp.dvMinZ = ctx->Viewport.Near; - d3dvp.dvMaxZ = ctx->Viewport.Far; - } else { - d3dvp.dvMinZ = ctx->Viewport.Far; - d3dvp.dvMaxZ = ctx->Viewport.Near; - } -/* x = ctx->Viewport.X; - y = ctx->Viewport.Y; - w = ctx->Viewport.Width; - h = ctx->Viewport.Height; - if (x < 0) x = 0; - if (y < 0) y = 0; - if (w > gldCtx->dwWidth) w = gldCtx->dwWidth; - if (h > gldCtx->dwHeight) h = gldCtx->dwHeight; - // Ditto for D3D viewport dimensions - if (w+x > gldCtx->dwWidth) w = gldCtx->dwWidth-x; - if (h+y > gldCtx->dwHeight) h = gldCtx->dwHeight-y; - d3dvp.X = x; - d3dvp.Y = gldCtx->dwHeight - (y + h); - d3dvp.Width = w; - d3dvp.Height = h;*/ - _GLD_DX7_DEV(SetViewport(gld->pDev, &d3dvp)); - -// gld->fFlipWindowY = (float)gldCtx->dwHeight; -} - -//--------------------------------------------------------------------------- - -__inline BOOL _gldAnyEvalEnabled( - GLcontext *ctx) -{ - struct gl_eval_attrib *eval = &ctx->Eval; - - if ((eval->AutoNormal) || - (eval->Map1Color4) || - (eval->Map1Index) || - (eval->Map1Normal) || - (eval->Map1TextureCoord1) || - (eval->Map1TextureCoord2) || - (eval->Map1TextureCoord3) || - (eval->Map1TextureCoord4) || - (eval->Map1Vertex3) || - (eval->Map1Vertex4) || - (eval->Map2Color4) || - (eval->Map2Index) || - (eval->Map2Normal) || - (eval->Map2TextureCoord1) || - (eval->Map2TextureCoord2) || - (eval->Map2TextureCoord3) || - (eval->Map2TextureCoord4) || - (eval->Map2Vertex3) || - (eval->Map2Vertex4) - ) - return TRUE; - - return FALSE; -} - -//--------------------------------------------------------------------------- - -BOOL _gldChooseInternalPipeline( - GLcontext *ctx, - GLD_driver_dx7 *gld) -{ -// return TRUE; // DEBUGGING: ALWAYS USE MESA -// return FALSE; // DEBUGGING: ALWAYS USE D3D - - if ((glb.dwTnL == GLDS_TNL_MESA) || (gld->bHasHWTnL == FALSE)) - { - gld->PipelineUsage.qwMesa.QuadPart++; - return TRUE; // Force Mesa TnL - } - - if ((ctx->Light.Enabled) || - (1) || - (ctx->Texture._TexGenEnabled) || - (ctx->Texture._TexMatEnabled) || -// (ctx->Transform._AnyClip) || - (ctx->Scissor.Enabled) || - _gldAnyEvalEnabled(ctx) // Put this last so we can early-out - ) - { - gld->PipelineUsage.qwMesa.QuadPart++; - return TRUE; - } - - gld->PipelineUsage.qwD3DFVF.QuadPart++; - return FALSE; - -/* // Force Mesa pipeline? - if (glb.dwTnL == GLDS_TNL_MESA) { - gld->PipelineUsage.dwMesa.QuadPart++; - return GLD_PIPELINE_MESA; - } - - // Test for functionality not exposed in the D3D pathways - if ((ctx->Texture._GenFlags)) { - gld->PipelineUsage.dwMesa.QuadPart++; - return GLD_PIPELINE_MESA; - } - - // Now decide if vertex shader can be used. - // If two sided lighting is enabled then we must either - // use Mesa TnL or the vertex shader - if (ctx->_TriangleCaps & DD_TRI_LIGHT_TWOSIDE) { - if (gld->VStwosidelight.hShader && !ctx->Fog.Enabled) { - // Use Vertex Shader - gld->PipelineUsage.dwD3D2SVS.QuadPart++; - return GLD_PIPELINE_D3D_VS_TWOSIDE; - } else { - // Use Mesa TnL - gld->PipelineUsage.dwMesa.QuadPart++; - return GLD_PIPELINE_MESA; - } - } - - // Must be D3D fixed-function pipeline - gld->PipelineUsage.dwD3DFVF.QuadPart++; - return GLD_PIPELINE_D3D_FVF; -*/ -} - -//--------------------------------------------------------------------------- - -void gld_update_state_DX7( - GLcontext *ctx, - GLuint new_state) -{ - GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); - GLD_driver_dx7 *gld = GLD_GET_DX7_DRIVER(gldCtx); - TNLcontext *tnl = TNL_CONTEXT(ctx); - GLD_pb_dx7 *gldPB; - - if (!gld || !gld->pDev) - return; - - _swsetup_InvalidateState( ctx, new_state ); - _vbo_InvalidateState( ctx, new_state ); - _tnl_InvalidateState( ctx, new_state ); - - // SetupIndex will be used in the pipelines for choosing setup function - if ((ctx->_TriangleCaps & (DD_TRI_LIGHT_TWOSIDE | DD_SEPARATE_SPECULAR)) || - (ctx->Fog.Enabled)) - { - if (ctx->_TriangleCaps & DD_FLATSHADE) - gld->iSetupFunc = GLD_SI_FLAT_EXTRAS; - else - gld->iSetupFunc = GLD_SI_SMOOTH_EXTRAS; - } else { - if (ctx->_TriangleCaps & DD_FLATSHADE) - gld->iSetupFunc = GLD_SI_FLAT; // Setup flat shade + texture - else - gld->iSetupFunc = GLD_SI_SMOOTH; // Setup smooth shade + texture - } - - gld->bUseMesaTnL = _gldChooseInternalPipeline(ctx, gld); - if (gld->bUseMesaTnL) { - gldPB = &gld->PB2d; - // DX7 Does not implement D3DRS_SOFTWAREVERTEXPROCESSING -// _GLD_DX7_DEV(SetRenderState(gld->pDev, D3DRENDERSTATE_SOFTWAREVERTEXPROCESSING, TRUE)); - _GLD_DX7_DEV(SetRenderState(gld->pDev, D3DRENDERSTATE_CLIPPING, FALSE)); -// _GLD_DX7_DEV(SetVertexShader(gld->pDev, gldPB->dwFVF)); - } else { - gldPB = &gld->PB3d; - _GLD_DX7_DEV(SetRenderState(gld->pDev, D3DRENDERSTATE_CLIPPING, TRUE)); -// if (gld->TnLPipeline == GLD_PIPELINE_D3D_VS_TWOSIDE) { -// _GLD_DX7_DEV(SetRenderState(gld->pDev, D3DRENDERSTATE_SOFTWAREVERTEXPROCESSING, !gld->VStwosidelight.bHardware)); -// _GLD_DX7_DEV(SetVertexShader(gld->pDev, gld->VStwosidelight.hShader)); -// } else { - // DX7 Does not implement D3DRS_SOFTWAREVERTEXPROCESSING -// _GLD_DX7_DEV(SetRenderState(gld->pDev, D3DRENDERSTATE_SOFTWAREVERTEXPROCESSING, !gld->bHasHWTnL)); -// _GLD_DX7_DEV(SetVertexShader(gld->pDev, gldPB->dwFVF)); -// } - } - -#define _GLD_TEST_STATE(a) \ - if (new_state & (a)) { \ - gld##a(ctx); \ - new_state &= ~(a); \ - } - -#define _GLD_TEST_STATE_DX7(a) \ - if (new_state & (a)) { \ - gld##a##_DX7(ctx); \ - new_state &= ~(a); \ - } - -#define _GLD_IGNORE_STATE(a) new_state &= ~(a); - -// if (!gld->bUseMesaTnL) { - // Not required if Mesa is doing the TnL. - // Problem: If gld->bUseMesaTnL is TRUE when these are signaled, - // then we'll miss updating the D3D TnL pipeline. - // Therefore, don't test for gld->bUseMesaTnL - _GLD_TEST_STATE(_NEW_MODELVIEW); - _GLD_TEST_STATE(_NEW_PROJECTION); -// } - - _GLD_TEST_STATE_DX7(_NEW_TEXTURE); // extern, so guard with _DX7 - _GLD_TEST_STATE(_NEW_COLOR); - _GLD_TEST_STATE(_NEW_DEPTH); - _GLD_TEST_STATE(_NEW_POLYGON); - _GLD_TEST_STATE(_NEW_STENCIL); - _GLD_TEST_STATE(_NEW_FOG); - _GLD_TEST_STATE(_NEW_LIGHT); - _GLD_TEST_STATE(_NEW_VIEWPORT); - - _GLD_IGNORE_STATE(_NEW_TRANSFORM); - - -// Stubs for future use. -/* _GLD_TEST_STATE(_NEW_TEXTURE_MATRIX); - _GLD_TEST_STATE(_NEW_COLOR_MATRIX); - _GLD_TEST_STATE(_NEW_ACCUM); - _GLD_TEST_STATE(_NEW_EVAL); - _GLD_TEST_STATE(_NEW_HINT); - _GLD_TEST_STATE(_NEW_LINE); - _GLD_TEST_STATE(_NEW_PIXEL); - _GLD_TEST_STATE(_NEW_POINT); - _GLD_TEST_STATE(_NEW_POLYGONSTIPPLE); - _GLD_TEST_STATE(_NEW_SCISSOR); - _GLD_TEST_STATE(_NEW_PACKUNPACK); - _GLD_TEST_STATE(_NEW_ARRAY); - _GLD_TEST_STATE(_NEW_RENDERMODE); - _GLD_TEST_STATE(_NEW_BUFFERS); - _GLD_TEST_STATE(_NEW_MULTISAMPLE); -*/ - -// For debugging. -#if 0 -#define _GLD_TEST_UNHANDLED_STATE(a) \ - if (new_state & (a)) { \ - gldLogMessage(GLDLOG_ERROR, "Unhandled " #a "\n"); \ - } - _GLD_TEST_UNHANDLED_STATE(_NEW_TEXTURE_MATRIX); - _GLD_TEST_UNHANDLED_STATE(_NEW_COLOR_MATRIX); - _GLD_TEST_UNHANDLED_STATE(_NEW_ACCUM); - _GLD_TEST_UNHANDLED_STATE(_NEW_EVAL); - _GLD_TEST_UNHANDLED_STATE(_NEW_HINT); - _GLD_TEST_UNHANDLED_STATE(_NEW_LINE); - _GLD_TEST_UNHANDLED_STATE(_NEW_PIXEL); - _GLD_TEST_UNHANDLED_STATE(_NEW_POINT); - _GLD_TEST_UNHANDLED_STATE(_NEW_POLYGONSTIPPLE); - _GLD_TEST_UNHANDLED_STATE(_NEW_SCISSOR); - _GLD_TEST_UNHANDLED_STATE(_NEW_PACKUNPACK); - _GLD_TEST_UNHANDLED_STATE(_NEW_ARRAY); - _GLD_TEST_UNHANDLED_STATE(_NEW_RENDERMODE); - _GLD_TEST_UNHANDLED_STATE(_NEW_BUFFERS); - _GLD_TEST_UNHANDLED_STATE(_NEW_MULTISAMPLE); -#undef _GLD_UNHANDLED_STATE -#endif - -#undef _GLD_TEST_STATE -} - -//--------------------------------------------------------------------------- -// Viewport -//--------------------------------------------------------------------------- - -void gld_Viewport_DX7( - GLcontext *ctx, - GLint x, - GLint y, - GLsizei w, - GLsizei h) -{ - GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); - GLD_driver_dx7 *gld = GLD_GET_DX7_DRIVER(gldCtx); - - D3DVIEWPORT7 d3dvp; - - if (!gld || !gld->pDev) - return; - - // This is a hack. When the app is minimized, Mesa passes - // w=1 and h=1 for viewport dimensions. Without this test - // we get a GPF in gld_wgl_resize_buffers(). - if ((w==1) && (h==1)) - return; - - // Call ResizeBuffersMESA. This function will early-out - // if no resize is needed. - //ctx->Driver.ResizeBuffersMESA(ctx); - // Mesa 5: Changed parameters - ctx->Driver.ResizeBuffers(gldCtx->glBuffer); - -#if 0 - ddlogPrintf(GLDLOG_SYSTEM, ">> Viewport x=%d y=%d w=%d h=%d", x,y,w,h); -#endif - - // ** D3D viewport must not be outside the render target surface ** - // Sanity check the GL viewport dimensions - if (x < 0) x = 0; - if (y < 0) y = 0; - if (w > gldCtx->dwWidth) w = gldCtx->dwWidth; - if (h > gldCtx->dwHeight) h = gldCtx->dwHeight; - // Ditto for D3D viewport dimensions - if (w+x > gldCtx->dwWidth) w = gldCtx->dwWidth-x; - if (h+y > gldCtx->dwHeight) h = gldCtx->dwHeight-y; - - d3dvp.dwX = x; - d3dvp.dwY = gldCtx->dwHeight - (y + h); - d3dvp.dwWidth = w; - d3dvp.dwHeight = h; - if (ctx->Viewport.Near <= ctx->Viewport.Far) { - d3dvp.dvMinZ = ctx->Viewport.Near; - d3dvp.dvMaxZ = ctx->Viewport.Far; - } else { - d3dvp.dvMinZ = ctx->Viewport.Far; - d3dvp.dvMaxZ = ctx->Viewport.Near; - } - - // TODO: DEBUGGING -// d3dvp.MinZ = 0.0f; -// d3dvp.MaxZ = 1.0f; - - _GLD_DX7_DEV(SetViewport(gld->pDev, &d3dvp)); - -} - -//--------------------------------------------------------------------------- - -extern BOOL dglWglResizeBuffers(GLcontext *ctx, BOOL bDefaultDriver); - -// Mesa 5: Parameter change -void gldResizeBuffers_DX7( -// GLcontext *ctx) - GLframebuffer *fb) -{ - GET_CURRENT_CONTEXT(ctx); - dglWglResizeBuffers(ctx, TRUE); -} - -//--------------------------------------------------------------------------- -#ifdef _DEBUG -// This is only for debugging. -// To use, plug into ctx->Driver.Enable pointer below. -void gld_Enable( - GLcontext *ctx, - GLenum e, - GLboolean b) -{ - char buf[1024]; - sprintf(buf, "Enable: %s (%s)\n", _mesa_lookup_enum_by_nr(e), b?"TRUE":"FALSE"); - ddlogMessage(DDLOG_SYSTEM, buf); -} -#endif -//--------------------------------------------------------------------------- -// Driver pointer setup -//--------------------------------------------------------------------------- - -extern const GLubyte* _gldGetStringGeneric(GLcontext*, GLenum); - -void gldSetupDriverPointers_DX7( - GLcontext *ctx) -{ - GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); - GLD_driver_dx7 *gld = GLD_GET_DX7_DRIVER(gldCtx); - - TNLcontext *tnl = TNL_CONTEXT(ctx); - - // Mandatory functions - ctx->Driver.GetString = _gldGetStringGeneric; - ctx->Driver.UpdateState = gld_update_state_DX7; - ctx->Driver.Clear = gld_Clear_DX7; - ctx->Driver.DrawBuffer = gld_set_draw_buffer_DX7; - ctx->Driver.GetBufferSize = gld_buffer_size_DX7; - ctx->Driver.Finish = gld_Finish_DX7; - ctx->Driver.Flush = gld_Flush_DX7; - ctx->Driver.Error = gld_Error_DX7; - - // Hardware accumulation buffer - ctx->Driver.Accum = NULL; // TODO: gld_Accum; - - // Bitmap functions - ctx->Driver.CopyPixels = gld_CopyPixels_DX7; - ctx->Driver.DrawPixels = gld_DrawPixels_DX7; - ctx->Driver.ReadPixels = gld_ReadPixels_DX7; - ctx->Driver.Bitmap = gld_Bitmap_DX7; - - // Buffer resize - ctx->Driver.ResizeBuffers = gldResizeBuffers_DX7; - - // Texture image functions - ctx->Driver.ChooseTextureFormat = gld_ChooseTextureFormat_DX7; - ctx->Driver.TexImage1D = gld_TexImage1D_DX7; - ctx->Driver.TexImage2D = gld_TexImage2D_DX7; - ctx->Driver.TexImage3D = _mesa_store_teximage3d; - ctx->Driver.TexSubImage1D = gld_TexSubImage1D_DX7; - ctx->Driver.TexSubImage2D = gld_TexSubImage2D_DX7; - ctx->Driver.TexSubImage3D = _mesa_store_texsubimage3d; - - ctx->Driver.CopyTexImage1D = gldCopyTexImage1D_DX7; //NULL; - ctx->Driver.CopyTexImage2D = gldCopyTexImage2D_DX7; //NULL; - ctx->Driver.CopyTexSubImage1D = gldCopyTexSubImage1D_DX7; //NULL; - ctx->Driver.CopyTexSubImage2D = gldCopyTexSubImage2D_DX7; //NULL; - ctx->Driver.CopyTexSubImage3D = gldCopyTexSubImage3D_DX7; - ctx->Driver.TestProxyTexImage = _mesa_test_proxy_teximage; - - // Texture object functions - ctx->Driver.BindTexture = NULL; - ctx->Driver.NewTextureObject = NULL; // Not yet implemented by Mesa!; - ctx->Driver.DeleteTexture = gld_DeleteTexture_DX7; - ctx->Driver.PrioritizeTexture = NULL; - - // Imaging functionality - ctx->Driver.CopyColorTable = NULL; - ctx->Driver.CopyColorSubTable = NULL; - ctx->Driver.CopyConvolutionFilter1D = NULL; - ctx->Driver.CopyConvolutionFilter2D = NULL; - - // State changing functions - ctx->Driver.AlphaFunc = NULL; //gld_AlphaFunc; - ctx->Driver.BlendFuncSeparate = NULL; //gld_BlendFunc; - ctx->Driver.ClearColor = NULL; //gld_ClearColor; - ctx->Driver.ClearDepth = NULL; //gld_ClearDepth; - ctx->Driver.ClearStencil = NULL; //gld_ClearStencil; - ctx->Driver.ColorMask = NULL; //gld_ColorMask; - ctx->Driver.CullFace = NULL; //gld_CullFace; - ctx->Driver.ClipPlane = NULL; //gld_ClipPlane; - ctx->Driver.FrontFace = NULL; //gld_FrontFace; - ctx->Driver.DepthFunc = NULL; //gld_DepthFunc; - ctx->Driver.DepthMask = NULL; //gld_DepthMask; - ctx->Driver.DepthRange = NULL; - ctx->Driver.Enable = NULL; //gld_Enable; - ctx->Driver.Fogfv = NULL; //gld_Fogfv; - ctx->Driver.Hint = NULL; //gld_Hint; - ctx->Driver.Lightfv = NULL; //gld_Lightfv; - ctx->Driver.LightModelfv = NULL; //gld_LightModelfv; - ctx->Driver.LineStipple = NULL; //gld_LineStipple; - ctx->Driver.LineWidth = NULL; //gld_LineWidth; - ctx->Driver.LogicOpcode = NULL; //gld_LogicOpcode; - ctx->Driver.PointParameterfv = NULL; //gld_PointParameterfv; - ctx->Driver.PointSize = NULL; //gld_PointSize; - ctx->Driver.PolygonMode = NULL; //gld_PolygonMode; - ctx->Driver.PolygonOffset = NULL; //gld_PolygonOffset; - ctx->Driver.PolygonStipple = NULL; //gld_PolygonStipple; - ctx->Driver.RenderMode = NULL; //gld_RenderMode; - ctx->Driver.Scissor = NULL; //gld_Scissor; - ctx->Driver.ShadeModel = NULL; //gld_ShadeModel; - ctx->Driver.StencilFunc = NULL; //gld_StencilFunc; - ctx->Driver.StencilMask = NULL; //gld_StencilMask; - ctx->Driver.StencilOp = NULL; //gld_StencilOp; - ctx->Driver.TexGen = NULL; //gld_TexGen; - ctx->Driver.TexEnv = NULL; - ctx->Driver.TexParameter = NULL; - ctx->Driver.TextureMatrix = NULL; //gld_TextureMatrix; - ctx->Driver.Viewport = gld_Viewport_DX7; - - _swsetup_Wakeup(ctx); - - tnl->Driver.RunPipeline = _tnl_run_pipeline; - tnl->Driver.Render.ResetLineStipple = gld_ResetLineStipple_DX7; - tnl->Driver.Render.ClippedPolygon = _tnl_RenderClippedPolygon; - tnl->Driver.Render.ClippedLine = _tnl_RenderClippedLine; - - // Hook into glFrustum() and glOrtho() -// ctx->Exec->Frustum = gldFrustumHook_DX7; -// ctx->Exec->Ortho = gldOrthoHook_DX7; - -} - -//--------------------------------------------------------------------------- diff --git a/src/mesa/drivers/windows/gldirect/dx7/gld_dx7.h b/src/mesa/drivers/windows/gldirect/dx7/gld_dx7.h deleted file mode 100644 index b5a491e41b..0000000000 --- a/src/mesa/drivers/windows/gldirect/dx7/gld_dx7.h +++ /dev/null @@ -1,292 +0,0 @@ -/**************************************************************************** -* -* Mesa 3-D graphics library -* Direct3D Driver Interface -* -* ======================================================================== -* -* Copyright (C) 1991-2004 SciTech Software, Inc. All rights reserved. -* -* Permission is hereby granted, free of charge, to any person obtaining a -* copy of this software and associated documentation files (the "Software"), -* to deal in the Software without restriction, including without limitation -* the rights to use, copy, modify, merge, publish, distribute, sublicense, -* and/or sell copies of the Software, and to permit persons to whom the -* Software is furnished to do so, subject to the following conditions: -* -* The above copyright notice and this permission notice shall be included -* in all copies or substantial portions of the Software. -* -* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -* SCITECH SOFTWARE INC BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF -* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -* SOFTWARE. -* -* ====================================================================== -* -* Language: ANSI C -* Environment: Windows 9x/2000/XP/XBox (Win32) -* -* Description: GLDirect Direct3D 7.0a header file -* -****************************************************************************/ - -#ifndef _GLD_DX7_H -#define _GLD_DX7_H - -//--------------------------------------------------------------------------- -// Windows includes -//--------------------------------------------------------------------------- - -#define DIRECTDRAW_VERSION 0x0700 -#define DIRECT3D_VERSION 0x0700 -#include -#include - -// Typedef for obtaining function from d3d7.dll -//typedef IDirect3D7* (WINAPI *FNDIRECT3DCREATE7) (UINT); - - -//--------------------------------------------------------------------------- -// Defines -//--------------------------------------------------------------------------- - -#ifdef _DEBUG -// Debug build tests the return value of D3D calls -#define _GLD_TEST_HRESULT(h) \ -{ \ - HRESULT _hr = (h); \ - if (FAILED(_hr)) { \ - gldLogError(GLDLOG_ERROR, #h, _hr); \ - } \ -} -#define _GLD_DX7(func) _GLD_TEST_HRESULT(IDirect3D7_##func##) -#define _GLD_DX7_DEV(func) _GLD_TEST_HRESULT(IDirect3DDevice7_##func##) -#define _GLD_DX7_VB(func) _GLD_TEST_HRESULT(IDirect3DVertexBuffer7_##func##) -#define _GLD_DX7_TEX(func) _GLD_TEST_HRESULT(IDirectDrawSurface7_##func##) -#else -#define _GLD_DX7(func) IDirect3D7_##func -#define _GLD_DX7_DEV(func) IDirect3DDevice7_##func -#define _GLD_DX7_VB(func) IDirect3DVertexBuffer7_##func -#define _GLD_DX7_TEX(func) IDirectDrawSurface7_##func -#endif - -#define SAFE_RELEASE(p) \ -{ \ - if (p) { \ - (p)->lpVtbl->Release(p); \ - (p) = NULL; \ - } \ -} - -#define SAFE_RELEASE_VB7(p) \ -{ \ - if (p) { \ - IDirect3DVertexBuffer7_Release((p)); \ - (p) = NULL; \ - } \ -} - -#define SAFE_RELEASE_SURFACE7(p) \ -{ \ - if (p) { \ - IDirectDrawSurface7_Release((p)); \ - (p) = NULL; \ - } \ -} - -// Emulate some DX8 defines -#define D3DCOLOR_ARGB(a,r,g,b) ((D3DCOLOR)((((a)&0xff)<<24)|(((r)&0xff)<<16)|(((g)&0xff)<<8)|((b)&0xff))) -#define D3DCOLOR_RGBA(r,g,b,a) D3DCOLOR_ARGB(a,r,g,b) -#define D3DCOLOR_COLORVALUE(r,g,b,a) D3DCOLOR_RGBA((DWORD)((r)*255.f),(DWORD)((g)*255.f),(DWORD)((b)*255.f),(DWORD)((a)*255.f)) - - -// Setup index. -enum { - GLD_SI_FLAT = 0, - GLD_SI_SMOOTH = 1, - GLD_SI_FLAT_EXTRAS = 2, - GLD_SI_SMOOTH_EXTRAS = 3, -}; - -//--------------------------------------------------------------------------- -// Vertex definitions for Fixed-Function pipeline -//--------------------------------------------------------------------------- - -// -// NOTE: If the number of texture units is altered then most of -// the texture code will need to be revised. -// - -#define GLD_MAX_TEXTURE_UNITS_DX7 2 - -// -// 2D vertex transformed by Mesa -// -#define GLD_FVF_2D_VERTEX ( D3DFVF_XYZRHW | \ - D3DFVF_DIFFUSE | \ - D3DFVF_SPECULAR | \ - D3DFVF_TEX2) -typedef struct { - FLOAT x, y; // 2D raster coords - FLOAT sz; // Screen Z (depth) - FLOAT rhw; // Reciprocal homogenous W - DWORD diffuse; // Diffuse colour - DWORD specular; // For separate-specular support - FLOAT t0_u, t0_v; // 1st set of texture coords - FLOAT t1_u, t1_v; // 2nd set of texture coords -} GLD_2D_VERTEX; - - -// -// 3D vertex transformed by Direct3D -// -#define GLD_FVF_3D_VERTEX ( D3DFVF_XYZ | \ - D3DFVF_DIFFUSE | \ - D3DFVF_TEX2) - -typedef struct { - D3DXVECTOR3 Position; // XYZ Vector in object space - D3DCOLOR Diffuse; // Diffuse colour - D3DXVECTOR2 TexUnit0; // Texture unit 0 - D3DXVECTOR2 TexUnit1; // Texture unit 1 -} GLD_3D_VERTEX; - -//--------------------------------------------------------------------------- -// Structs -//--------------------------------------------------------------------------- - -// This keeps a count of how many times we choose each individual internal -// pathway. Useful for seeing if a certain pathway was ever used by an app, and -// how much each pathway is biased. -// Zero the members at context creation and dump stats at context deletion. -typedef struct { - // Note: DWORD is probably too small - ULARGE_INTEGER qwMesa; // Mesa TnL pipeline - ULARGE_INTEGER qwD3DFVF; // Direct3D Fixed-Function pipeline -} GLD_pipeline_usage; - -// GLDirect Primitive Buffer (points, lines, triangles and quads) -typedef struct { - // Data for IDirect3D7::CreateVertexBuffer() - DWORD dwStride; // Stride of vertex - DWORD dwCreateFlags; // Create flags - DWORD dwFVF; // Direct3D Flexible Vertex Format - - IDirect3DVertexBuffer7 *pVB; // Holds points, lines, tris and quads. - - // Point list is assumed to be at start of buffer - DWORD iFirstLine; // Index of start of line list - DWORD iFirstTriangle; // Index of start of triangle list - - BYTE *pPoints; // Pointer to next free point - BYTE *pLines; // Pointer to next free line - BYTE *pTriangles; // Pointer to next free triangle - - DWORD nPoints; // Number of points ready to render - DWORD nLines; // Number of lines ready to render - DWORD nTriangles; // Number of triangles ready to render -} GLD_pb_dx7; - -// GLDirect DX7 driver data -typedef struct { - // GLDirect vars - BOOL bDoublebuffer; // Doublebuffer (otherwise single-buffered) - BOOL bDepthStencil; // Depth buffer needed (stencil optional) - D3DX_SURFACEFORMAT RenderFormat; // Format of back/front buffer - D3DX_SURFACEFORMAT DepthFormat; // Format of depth/stencil - - // Direct3D vars - DDCAPS ddCaps; - D3DDEVICEDESC7 d3dCaps; - BOOL bHasHWTnL; // Device has Hardware Transform/Light? - ID3DXContext *pD3DXContext; // Base D3DX context - IDirectDraw7 *pDD; // DirectDraw7 interface - IDirect3D7 *pD3D; // Base Direct3D7 interface - IDirect3DDevice7 *pDev; // Direct3D7 Device interface - GLD_pb_dx7 PB2d; // Vertices transformed by Mesa - GLD_pb_dx7 PB3d; // Vertices transformed by Direct3D - D3DPRIMITIVETYPE d3dpt; // Current Direct3D primitive type - D3DMATRIX matProjection; // Projection matrix for D3D TnL - D3DMATRIX matModelView; // Model/View matrix for D3D TnL - int iSetupFunc; // Which setup functions to use - BOOL bUseMesaTnL; // Whether to use Mesa or D3D for TnL - - GLD_pipeline_usage PipelineUsage; -} GLD_driver_dx7; - -#define GLD_GET_DX7_DRIVER(c) (GLD_driver_dx7*)(c)->glPriv - -//--------------------------------------------------------------------------- -// Function prototypes -//--------------------------------------------------------------------------- - -PROC gldGetProcAddress_DX7(LPCSTR a); -void gldEnableExtensions_DX7(GLcontext *ctx); -void gldInstallPipeline_DX7(GLcontext *ctx); -void gldSetupDriverPointers_DX7(GLcontext *ctx); -void gldResizeBuffers_DX7(GLframebuffer *fb); - - -// Texture functions - -void gldCopyTexImage1D_DX7(GLcontext *ctx, GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLint border); -void gldCopyTexImage2D_DX7(GLcontext *ctx, GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); -void gldCopyTexSubImage1D_DX7(GLcontext *ctx, GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width ); -void gldCopyTexSubImage2D_DX7(GLcontext *ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height ); -void gldCopyTexSubImage3D_DX7(GLcontext *ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height ); - -void gld_NEW_TEXTURE_DX7(GLcontext *ctx); -void gld_DrawPixels_DX7(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, const struct gl_pixelstore_attrib *unpack, const GLvoid *pixels); -void gld_ReadPixels_DX7(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, const struct gl_pixelstore_attrib *unpack, GLvoid *dest); -void gld_CopyPixels_DX7(GLcontext *ctx, GLint srcx, GLint srcy, GLsizei width, GLsizei height, GLint dstx, GLint dsty, GLenum type); -void gld_Bitmap_DX7(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height, const struct gl_pixelstore_attrib *unpack, const GLubyte *bitmap); -const struct gl_texture_format* gld_ChooseTextureFormat_DX7(GLcontext *ctx, GLint internalFormat, GLenum srcFormat, GLenum srcType); -void gld_TexImage2D_DX7(GLcontext *ctx, GLenum target, GLint level, GLint internalFormat, GLint width, GLint height, GLint border, GLenum format, GLenum type, const GLvoid *pixels, const struct gl_pixelstore_attrib *packing, struct gl_texture_object *tObj, struct gl_texture_image *texImage); -void gld_TexImage1D_DX7(GLcontext *ctx, GLenum target, GLint level, GLint internalFormat, GLint width, GLint border, GLenum format, GLenum type, const GLvoid *pixels, const struct gl_pixelstore_attrib *packing, struct gl_texture_object *texObj, struct gl_texture_image *texImage ); -void gld_TexSubImage2D_DX7( GLcontext *ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels, const struct gl_pixelstore_attrib *packing, struct gl_texture_object *texObj, struct gl_texture_image *texImage ); -void gld_TexSubImage1D_DX7(GLcontext *ctx, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels, const struct gl_pixelstore_attrib *packing, struct gl_texture_object *texObj, struct gl_texture_image *texImage); -void gld_DeleteTexture_DX7(GLcontext *ctx, struct gl_texture_object *tObj); -void gld_ResetLineStipple_DX7(GLcontext *ctx); - -// 2D primitive functions - -void gld_Points2D_DX7(GLcontext *ctx, GLuint first, GLuint last); - -void gld_Line2DFlat_DX7(GLcontext *ctx, GLuint v0, GLuint v1); -void gld_Line2DSmooth_DX7(GLcontext *ctx, GLuint v0, GLuint v1); - -void gld_Triangle2DFlat_DX7(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2); -void gld_Triangle2DSmooth_DX7(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2); -void gld_Triangle2DFlatExtras_DX7(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2); -void gld_Triangle2DSmoothExtras_DX7(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2); - -void gld_Quad2DFlat_DX7(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3); -void gld_Quad2DSmooth_DX7(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3); -void gld_Quad2DFlatExtras_DX7(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3); -void gld_Quad2DSmoothExtras_DX7(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3); - -// 3D primitive functions - -void gld_Points3D_DX7(GLcontext *ctx, GLuint first, GLuint last); -void gld_Line3DFlat_DX7(GLcontext *ctx, GLuint v0, GLuint v1); -void gld_Triangle3DFlat_DX7(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2); -void gld_Quad3DFlat_DX7(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3); -void gld_Line3DSmooth_DX7(GLcontext *ctx, GLuint v0, GLuint v1); -void gld_Triangle3DSmooth_DX7(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2); -void gld_Quad3DSmooth_DX7(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3); - -// Primitive functions for Two-sided-lighting Vertex Shader - -void gld_Points2DTwoside_DX7(GLcontext *ctx, GLuint first, GLuint last); -void gld_Line2DFlatTwoside_DX7(GLcontext *ctx, GLuint v0, GLuint v1); -void gld_Line2DSmoothTwoside_DX7(GLcontext *ctx, GLuint v0, GLuint v1); -void gld_Triangle2DFlatTwoside_DX7(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2); -void gld_Triangle2DSmoothTwoside_DX7(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2); -void gld_Quad2DFlatTwoside_DX7(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3); -void gld_Quad2DSmoothTwoside_DX7(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3); - -#endif diff --git a/src/mesa/drivers/windows/gldirect/dx7/gld_dxerr7.h b/src/mesa/drivers/windows/gldirect/dx7/gld_dxerr7.h deleted file mode 100644 index df6fceb43e..0000000000 --- a/src/mesa/drivers/windows/gldirect/dx7/gld_dxerr7.h +++ /dev/null @@ -1,77 +0,0 @@ -/*==========================================================================; - * - * - * File: dxerr8.h - * Content: DirectX Error Library Include File - * - ****************************************************************************/ - -#ifndef _GLD_DXERR7_H_ -#define _GLD_DXERR7_H_ - - -#include - -// -// DXGetErrorString8 -// -// Desc: Converts an DirectX HRESULT to a string -// -// Args: HRESULT hr Can be any error code from -// DPLAY D3D8 D3DX8 DMUSIC DSOUND -// -// Return: Converted string -// -const char* __stdcall DXGetErrorString8A(HRESULT hr); -const WCHAR* __stdcall DXGetErrorString8W(HRESULT hr); - -#ifdef UNICODE - #define DXGetErrorString8 DXGetErrorString8W -#else - #define DXGetErrorString8 DXGetErrorString8A -#endif - - -// -// DXTrace -// -// Desc: Outputs a formatted error message to the debug stream -// -// Args: CHAR* strFile The current file, typically passed in using the -// __FILE__ macro. -// DWORD dwLine The current line number, typically passed in using the -// __LINE__ macro. -// HRESULT hr An HRESULT that will be traced to the debug stream. -// CHAR* strMsg A string that will be traced to the debug stream (may be NULL) -// BOOL bPopMsgBox If TRUE, then a message box will popup also containing the passed info. -// -// Return: The hr that was passed in. -// -//HRESULT __stdcall DXTraceA( char* strFile, DWORD dwLine, HRESULT hr, char* strMsg, BOOL bPopMsgBox = FALSE ); -//HRESULT __stdcall DXTraceW( char* strFile, DWORD dwLine, HRESULT hr, WCHAR* strMsg, BOOL bPopMsgBox = FALSE ); -HRESULT __stdcall DXTraceA( char* strFile, DWORD dwLine, HRESULT hr, char* strMsg, BOOL bPopMsgBox); -HRESULT __stdcall DXTraceW( char* strFile, DWORD dwLine, HRESULT hr, WCHAR* strMsg, BOOL bPopMsgBox); - -#ifdef UNICODE - #define DXTrace DXTraceW -#else - #define DXTrace DXTraceA -#endif - - -// -// Helper macros -// -#if defined(DEBUG) | defined(_DEBUG) - #define DXTRACE_MSG(str) DXTrace( __FILE__, (DWORD)__LINE__, 0, str, FALSE ) - #define DXTRACE_ERR(str,hr) DXTrace( __FILE__, (DWORD)__LINE__, hr, str, TRUE ) - #define DXTRACE_ERR_NOMSGBOX(str,hr) DXTrace( __FILE__, (DWORD)__LINE__, hr, str, FALSE ) -#else - #define DXTRACE_MSG(str) (0L) - #define DXTRACE_ERR(str,hr) (hr) - #define DXTRACE_ERR_NOMSGBOX(str,hr) (hr) -#endif - - -#endif - diff --git a/src/mesa/drivers/windows/gldirect/dx7/gld_ext_dx7.c b/src/mesa/drivers/windows/gldirect/dx7/gld_ext_dx7.c deleted file mode 100644 index ba60980bbe..0000000000 --- a/src/mesa/drivers/windows/gldirect/dx7/gld_ext_dx7.c +++ /dev/null @@ -1,346 +0,0 @@ -/**************************************************************************** -* -* Mesa 3-D graphics library -* Direct3D Driver Interface -* -* ======================================================================== -* -* Copyright (C) 1991-2004 SciTech Software, Inc. All rights reserved. -* -* Permission is hereby granted, free of charge, to any person obtaining a -* copy of this software and associated documentation files (the "Software"), -* to deal in the Software without restriction, including without limitation -* the rights to use, copy, modify, merge, publish, distribute, sublicense, -* and/or sell copies of the Software, and to permit persons to whom the -* Software is furnished to do so, subject to the following conditions: -* -* The above copyright notice and this permission notice shall be included -* in all copies or substantial portions of the Software. -* -* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -* SCITECH SOFTWARE INC BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF -* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -* SOFTWARE. -* -* ====================================================================== -* -* Language: ANSI C -* Environment: Windows 9x/2000/XP/XBox (Win32) -* -* Description: GL extensions -* -****************************************************************************/ - -//#include "../GLDirect.h" -//#include "../gld_log.h" -//#include "../gld_settings.h" - -#include -#define GL_GLEXT_PROTOTYPES -#include -#include - -//#include "ddlog.h" -//#include "gld_dx8.h" - -#include "glheader.h" -#include "context.h" -#include "colormac.h" -#include "depth.h" -#include "extensions.h" -#include "macros.h" -#include "matrix.h" -// #include "mem.h" -//#include "mmath.h" -#include "mtypes.h" -#include "texformat.h" -#include "texstore.h" -#include "vbo/vbo.h" -#include "swrast_setup/swrast_setup.h" -#include "swrast_setup/ss_context.h" -#include "tnl/tnl.h" -#include "tnl/t_context.h" -#include "tnl/t_pipeline.h" - -#include "dglcontext.h" -#include "extensions.h" - -// For some reason this is not defined in an above header... -extern void _mesa_enable_imaging_extensions(GLcontext *ctx); - -//--------------------------------------------------------------------------- -// Hack for the SGIS_multitexture extension that was removed from Mesa -// NOTE: SGIS_multitexture enums also clash with GL_SGIX_async_pixel - - // NOTE: Quake2 ran *slower* with this enabled, so I've - // disabled it for now. - // To enable, uncomment: - // _mesa_add_extension(ctx, GL_TRUE, szGL_SGIS_multitexture, 0); - -//--------------------------------------------------------------------------- - -enum { - /* Quake2 GL_SGIS_multitexture */ - GL_SELECTED_TEXTURE_SGIS = 0x835B, - GL_SELECTED_TEXTURE_COORD_SET_SGIS = 0x835C, - GL_MAX_TEXTURES_SGIS = 0x835D, - GL_TEXTURE0_SGIS = 0x835E, - GL_TEXTURE1_SGIS = 0x835F, - GL_TEXTURE2_SGIS = 0x8360, - GL_TEXTURE3_SGIS = 0x8361, - GL_TEXTURE_COORD_SET_SOURCE_SGIS = 0x8363, -}; - -//--------------------------------------------------------------------------- - -void APIENTRY gldSelectTextureSGIS( - GLenum target) -{ - GLenum ARB_target = GL_TEXTURE0_ARB + (target - GL_TEXTURE0_SGIS); - glActiveTextureARB(ARB_target); -} - -//--------------------------------------------------------------------------- - -void APIENTRY gldMTexCoord2fSGIS( - GLenum target, - GLfloat s, - GLfloat t) -{ - GLenum ARB_target = GL_TEXTURE0_ARB + (target - GL_TEXTURE0_SGIS); - glMultiTexCoord2fARB(ARB_target, s, t); -} - -//--------------------------------------------------------------------------- - -void APIENTRY gldMTexCoord2fvSGIS( - GLenum target, - const GLfloat *v) -{ - GLenum ARB_target = GL_TEXTURE0_ARB + (target - GL_TEXTURE0_SGIS); - glMultiTexCoord2fvARB(ARB_target, v); -} - -//--------------------------------------------------------------------------- -// Extensions -//--------------------------------------------------------------------------- - -typedef struct { - PROC proc; - char *name; -} GLD_extension; - -GLD_extension GLD_extList[] = { -#ifdef GL_EXT_polygon_offset - { (PROC)glPolygonOffsetEXT, "glPolygonOffsetEXT" }, -#endif - { (PROC)glBlendEquationEXT, "glBlendEquationEXT" }, - { (PROC)glBlendColorEXT, "glBlendColorExt" }, - { (PROC)glVertexPointerEXT, "glVertexPointerEXT" }, - { (PROC)glNormalPointerEXT, "glNormalPointerEXT" }, - { (PROC)glColorPointerEXT, "glColorPointerEXT" }, - { (PROC)glIndexPointerEXT, "glIndexPointerEXT" }, - { (PROC)glTexCoordPointerEXT, "glTexCoordPointer" }, - { (PROC)glEdgeFlagPointerEXT, "glEdgeFlagPointerEXT" }, - { (PROC)glGetPointervEXT, "glGetPointervEXT" }, - { (PROC)glArrayElementEXT, "glArrayElementEXT" }, - { (PROC)glDrawArraysEXT, "glDrawArrayEXT" }, - { (PROC)glAreTexturesResidentEXT, "glAreTexturesResidentEXT" }, - { (PROC)glBindTextureEXT, "glBindTextureEXT" }, - { (PROC)glDeleteTexturesEXT, "glDeleteTexturesEXT" }, - { (PROC)glGenTexturesEXT, "glGenTexturesEXT" }, - { (PROC)glIsTextureEXT, "glIsTextureEXT" }, - { (PROC)glPrioritizeTexturesEXT, "glPrioritizeTexturesEXT" }, - { (PROC)glCopyTexSubImage3DEXT, "glCopyTexSubImage3DEXT" }, - { (PROC)glTexImage3DEXT, "glTexImage3DEXT" }, - { (PROC)glTexSubImage3DEXT, "glTexSubImage3DEXT" }, - { (PROC)glPointParameterfEXT, "glPointParameterfEXT" }, - { (PROC)glPointParameterfvEXT, "glPointParameterfvEXT" }, - - { (PROC)glLockArraysEXT, "glLockArraysEXT" }, - { (PROC)glUnlockArraysEXT, "glUnlockArraysEXT" }, - { NULL, "\0" } -}; - -GLD_extension GLD_multitexList[] = { -/* - { (PROC)glMultiTexCoord1dSGIS, "glMTexCoord1dSGIS" }, - { (PROC)glMultiTexCoord1dvSGIS, "glMTexCoord1dvSGIS" }, - { (PROC)glMultiTexCoord1fSGIS, "glMTexCoord1fSGIS" }, - { (PROC)glMultiTexCoord1fvSGIS, "glMTexCoord1fvSGIS" }, - { (PROC)glMultiTexCoord1iSGIS, "glMTexCoord1iSGIS" }, - { (PROC)glMultiTexCoord1ivSGIS, "glMTexCoord1ivSGIS" }, - { (PROC)glMultiTexCoord1sSGIS, "glMTexCoord1sSGIS" }, - { (PROC)glMultiTexCoord1svSGIS, "glMTexCoord1svSGIS" }, - { (PROC)glMultiTexCoord2dSGIS, "glMTexCoord2dSGIS" }, - { (PROC)glMultiTexCoord2dvSGIS, "glMTexCoord2dvSGIS" }, - { (PROC)glMultiTexCoord2fSGIS, "glMTexCoord2fSGIS" }, - { (PROC)glMultiTexCoord2fvSGIS, "glMTexCoord2fvSGIS" }, - { (PROC)glMultiTexCoord2iSGIS, "glMTexCoord2iSGIS" }, - { (PROC)glMultiTexCoord2ivSGIS, "glMTexCoord2ivSGIS" }, - { (PROC)glMultiTexCoord2sSGIS, "glMTexCoord2sSGIS" }, - { (PROC)glMultiTexCoord2svSGIS, "glMTexCoord2svSGIS" }, - { (PROC)glMultiTexCoord3dSGIS, "glMTexCoord3dSGIS" }, - { (PROC)glMultiTexCoord3dvSGIS, "glMTexCoord3dvSGIS" }, - { (PROC)glMultiTexCoord3fSGIS, "glMTexCoord3fSGIS" }, - { (PROC)glMultiTexCoord3fvSGIS, "glMTexCoord3fvSGIS" }, - { (PROC)glMultiTexCoord3iSGIS, "glMTexCoord3iSGIS" }, - { (PROC)glMultiTexCoord3ivSGIS, "glMTexCoord3ivSGIS" }, - { (PROC)glMultiTexCoord3sSGIS, "glMTexCoord3sSGIS" }, - { (PROC)glMultiTexCoord3svSGIS, "glMTexCoord3svSGIS" }, - { (PROC)glMultiTexCoord4dSGIS, "glMTexCoord4dSGIS" }, - { (PROC)glMultiTexCoord4dvSGIS, "glMTexCoord4dvSGIS" }, - { (PROC)glMultiTexCoord4fSGIS, "glMTexCoord4fSGIS" }, - { (PROC)glMultiTexCoord4fvSGIS, "glMTexCoord4fvSGIS" }, - { (PROC)glMultiTexCoord4iSGIS, "glMTexCoord4iSGIS" }, - { (PROC)glMultiTexCoord4ivSGIS, "glMTexCoord4ivSGIS" }, - { (PROC)glMultiTexCoord4sSGIS, "glMTexCoord4sSGIS" }, - { (PROC)glMultiTexCoord4svSGIS, "glMTexCoord4svSGIS" }, - { (PROC)glMultiTexCoordPointerSGIS, "glMTexCoordPointerSGIS" }, - { (PROC)glSelectTextureSGIS, "glSelectTextureSGIS" }, - { (PROC)glSelectTextureCoordSetSGIS, "glSelectTextureCoordSetSGIS" }, -*/ - { (PROC)glActiveTextureARB, "glActiveTextureARB" }, - { (PROC)glClientActiveTextureARB, "glClientActiveTextureARB" }, - { (PROC)glMultiTexCoord1dARB, "glMultiTexCoord1dARB" }, - { (PROC)glMultiTexCoord1dvARB, "glMultiTexCoord1dvARB" }, - { (PROC)glMultiTexCoord1fARB, "glMultiTexCoord1fARB" }, - { (PROC)glMultiTexCoord1fvARB, "glMultiTexCoord1fvARB" }, - { (PROC)glMultiTexCoord1iARB, "glMultiTexCoord1iARB" }, - { (PROC)glMultiTexCoord1ivARB, "glMultiTexCoord1ivARB" }, - { (PROC)glMultiTexCoord1sARB, "glMultiTexCoord1sARB" }, - { (PROC)glMultiTexCoord1svARB, "glMultiTexCoord1svARB" }, - { (PROC)glMultiTexCoord2dARB, "glMultiTexCoord2dARB" }, - { (PROC)glMultiTexCoord2dvARB, "glMultiTexCoord2dvARB" }, - { (PROC)glMultiTexCoord2fARB, "glMultiTexCoord2fARB" }, - { (PROC)glMultiTexCoord2fvARB, "glMultiTexCoord2fvARB" }, - { (PROC)glMultiTexCoord2iARB, "glMultiTexCoord2iARB" }, - { (PROC)glMultiTexCoord2ivARB, "glMultiTexCoord2ivARB" }, - { (PROC)glMultiTexCoord2sARB, "glMultiTexCoord2sARB" }, - { (PROC)glMultiTexCoord2svARB, "glMultiTexCoord2svARB" }, - { (PROC)glMultiTexCoord3dARB, "glMultiTexCoord3dARB" }, - { (PROC)glMultiTexCoord3dvARB, "glMultiTexCoord3dvARB" }, - { (PROC)glMultiTexCoord3fARB, "glMultiTexCoord3fARB" }, - { (PROC)glMultiTexCoord3fvARB, "glMultiTexCoord3fvARB" }, - { (PROC)glMultiTexCoord3iARB, "glMultiTexCoord3iARB" }, - { (PROC)glMultiTexCoord3ivARB, "glMultiTexCoord3ivARB" }, - { (PROC)glMultiTexCoord3sARB, "glMultiTexCoord3sARB" }, - { (PROC)glMultiTexCoord3svARB, "glMultiTexCoord3svARB" }, - { (PROC)glMultiTexCoord4dARB, "glMultiTexCoord4dARB" }, - { (PROC)glMultiTexCoord4dvARB, "glMultiTexCoord4dvARB" }, - { (PROC)glMultiTexCoord4fARB, "glMultiTexCoord4fARB" }, - { (PROC)glMultiTexCoord4fvARB, "glMultiTexCoord4fvARB" }, - { (PROC)glMultiTexCoord4iARB, "glMultiTexCoord4iARB" }, - { (PROC)glMultiTexCoord4ivARB, "glMultiTexCoord4ivARB" }, - { (PROC)glMultiTexCoord4sARB, "glMultiTexCoord4sARB" }, - { (PROC)glMultiTexCoord4svARB, "glMultiTexCoord4svARB" }, - - // Descent3 doesn't use correct string, hence this hack - { (PROC)glMultiTexCoord4fARB, "glMultiTexCoord4f" }, - - // Quake2 SGIS multitexture - { (PROC)gldSelectTextureSGIS, "glSelectTextureSGIS" }, - { (PROC)gldMTexCoord2fSGIS, "glMTexCoord2fSGIS" }, - { (PROC)gldMTexCoord2fvSGIS, "glMTexCoord2fvSGIS" }, - - { NULL, "\0" } -}; - -//--------------------------------------------------------------------------- - -PROC gldGetProcAddress_DX( - LPCSTR a) -{ - int i; - PROC proc = NULL; - - for (i=0; GLD_extList[i].proc; i++) { - if (!strcmp(a, GLD_extList[i].name)) { - proc = GLD_extList[i].proc; - break; - } - } - - if (glb.bMultitexture) { - for (i=0; GLD_multitexList[i].proc; i++) { - if (!strcmp(a, GLD_multitexList[i].name)) { - proc = GLD_multitexList[i].proc; - break; - } - } - } - - gldLogPrintf(GLDLOG_INFO, "GetProcAddress: %s (%s)", a, proc ? "OK" : "Failed"); - - return proc; -} - -//--------------------------------------------------------------------------- - -void gldEnableExtensions_DX7( - GLcontext *ctx) -{ - GLuint i; - - // Mesa enables some extensions by default. - // This table decides which ones we want to switch off again. - - // NOTE: GL_EXT_compiled_vertex_array appears broken. - - const char *gld_disable_extensions[] = { -// "GL_ARB_transpose_matrix", -// "GL_EXT_compiled_vertex_array", -// "GL_EXT_polygon_offset", -// "GL_EXT_rescale_normal", - "GL_EXT_texture3D", -// "GL_NV_texgen_reflection", - "GL_EXT_abgr", - "GL_EXT_bgra", - NULL - }; - - const char *gld_multitex_extensions[] = { - "GL_ARB_multitexture", // Quake 3 - NULL - }; - - // Quake 2 engines - const char *szGL_SGIS_multitexture = "GL_SGIS_multitexture"; - - const char *gld_enable_extensions[] = { - "GL_EXT_texture_env_add", // Quake 3 - "GL_ARB_texture_env_add", // Quake 3 - NULL - }; - - for (i=0; gld_disable_extensions[i]; i++) { - _mesa_disable_extension(ctx, gld_disable_extensions[i]); - } - - for (i=0; gld_enable_extensions[i]; i++) { - _mesa_enable_extension(ctx, gld_enable_extensions[i]); - } - - if (glb.bMultitexture) { - for (i=0; gld_multitex_extensions[i]; i++) { - _mesa_enable_extension(ctx, gld_multitex_extensions[i]); - } - - // GL_SGIS_multitexture - // NOTE: Quake2 ran *slower* with this enabled, so I've - // disabled it for now. - // Fair bit slower on GeForce256, - // Much slower on 3dfx Voodoo5 5500. -// _mesa_add_extension(ctx, GL_TRUE, szGL_SGIS_multitexture, 0); - - } - - _mesa_enable_imaging_extensions(ctx); - _mesa_enable_1_3_extensions(ctx); - _mesa_enable_1_4_extensions(ctx); -} - -//--------------------------------------------------------------------------- diff --git a/src/mesa/drivers/windows/gldirect/dx7/gld_pipeline_dx7.c b/src/mesa/drivers/windows/gldirect/dx7/gld_pipeline_dx7.c deleted file mode 100644 index 9ccec69b98..0000000000 --- a/src/mesa/drivers/windows/gldirect/dx7/gld_pipeline_dx7.c +++ /dev/null @@ -1,77 +0,0 @@ -/**************************************************************************** -* -* Mesa 3-D graphics library -* Direct3D Driver Interface -* -* ======================================================================== -* -* Copyright (C) 1991-2004 SciTech Software, Inc. All rights reserved. -* -* Permission is hereby granted, free of charge, to any person obtaining a -* copy of this software and associated documentation files (the "Software"), -* to deal in the Software without restriction, including without limitation -* the rights to use, copy, modify, merge, publish, distribute, sublicense, -* and/or sell copies of the Software, and to permit persons to whom the -* Software is furnished to do so, subject to the following conditions: -* -* The above copyright notice and this permission notice shall be included -* in all copies or substantial portions of the Software. -* -* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -* SCITECH SOFTWARE INC BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF -* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -* SOFTWARE. -* -* ====================================================================== -* -* Language: ANSI C -* Environment: Windows 9x/2000/XP/XBox (Win32) -* -* Description: Mesa transformation pipeline with GLDirect fastpath -* -****************************************************************************/ - -//#include "../GLDirect.h" - -#include "dglcontext.h" -#include "ddlog.h" -#include "gld_dx7.h" - -#include "tnl/tnl.h" -#include "tnl/t_context.h" -#include "tnl/t_pipeline.h" - -//--------------------------------------------------------------------------- - -extern struct tnl_pipeline_stage _gld_d3d_render_stage; -extern struct tnl_pipeline_stage _gld_mesa_render_stage; - -static const struct tnl_pipeline_stage *gld_pipeline[] = { - &_gld_d3d_render_stage, // Direct3D TnL - &_tnl_vertex_transform_stage, - &_tnl_normal_transform_stage, - &_tnl_lighting_stage, - &_tnl_fog_coordinate_stage, /* TODO: Omit fog stage. ??? */ - &_tnl_texgen_stage, - &_tnl_texture_transform_stage, - &_tnl_point_attenuation_stage, - &_gld_mesa_render_stage, // Mesa TnL, D3D rendering - 0, -}; - -//--------------------------------------------------------------------------- - -void gldInstallPipeline_DX7( - GLcontext *ctx) -{ - // Remove any existing pipeline stages, - // then install GLDirect pipeline stages. - - _tnl_destroy_pipeline(ctx); - _tnl_install_pipeline(ctx, gld_pipeline); -} - -//--------------------------------------------------------------------------- diff --git a/src/mesa/drivers/windows/gldirect/dx7/gld_primitive_dx7.c b/src/mesa/drivers/windows/gldirect/dx7/gld_primitive_dx7.c deleted file mode 100644 index c99ba0bba5..0000000000 --- a/src/mesa/drivers/windows/gldirect/dx7/gld_primitive_dx7.c +++ /dev/null @@ -1,1448 +0,0 @@ -/**************************************************************************** -* -* Mesa 3-D graphics library -* Direct3D Driver Interface -* -* ======================================================================== -* -* Copyright (C) 1991-2004 SciTech Software, Inc. All rights reserved. -* -* Permission is hereby granted, free of charge, to any person obtaining a -* copy of this software and associated documentation files (the "Software"), -* to deal in the Software without restriction, including without limitation -* the rights to use, copy, modify, merge, publish, distribute, sublicense, -* and/or sell copies of the Software, and to permit persons to whom the -* Software is furnished to do so, subject to the following conditions: -* -* The above copyright notice and this permission notice shall be included -* in all copies or substantial portions of the Software. -* -* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -* SCITECH SOFTWARE INC BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF -* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -* SOFTWARE. -* -* ====================================================================== -* -* Language: ANSI C -* Environment: Windows 9x/2000/XP/XBox (Win32) -* -* Description: Primitive (points/lines/tris/quads) rendering -* -****************************************************************************/ - -//#include "../GLDirect.h" - -//#include "gld_dx8.h" - -#include "dglcontext.h" -#include "ddlog.h" -#include "gld_dx7.h" - -#include "glheader.h" -#include "context.h" -#include "colormac.h" -#include "depth.h" -#include "extensions.h" -#include "macros.h" -#include "matrix.h" -// #include "mem.h" -//#include "mmath.h" -#include "mtypes.h" -#include "texformat.h" -#include "texstore.h" -#include "vbo/vbo.h" -#include "swrast/swrast.h" -#include "swrast_setup/swrast_setup.h" -#include "swrast_setup/ss_context.h" -#include "swrast/s_context.h" -#include "swrast/s_depth.h" -#include "swrast/s_lines.h" -#include "swrast/s_triangle.h" -#include "swrast/s_trispan.h" -#include "tnl/tnl.h" -#include "tnl/t_context.h" -#include "tnl/t_pipeline.h" - -// Disable compiler complaints about unreferenced local variables -#pragma warning (disable:4101) - -//--------------------------------------------------------------------------- -// Helper defines for primitives -//--------------------------------------------------------------------------- - -//static const float ooZ = 1.0f / 65536.0f; // One over Z - -#define GLD_COLOUR (D3DCOLOR_RGBA(swv->color[0], swv->color[1], swv->color[2], swv->color[3])) -#define GLD_SPECULAR (D3DCOLOR_RGBA(swv->specular[0], swv->specular[1], swv->specular[2], swv->specular[3])) -#define GLD_FLIP_Y(y) (gldCtx->dwHeight - (y)) - -//--------------------------------------------------------------------------- -// 2D vertex setup -//--------------------------------------------------------------------------- - -#define GLD_SETUP_2D_VARS_POINTS \ - GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); \ - GLD_driver_dx7 *gld = GLD_GET_DX7_DRIVER(gldCtx); \ - GLD_2D_VERTEX *pV = (GLD_2D_VERTEX*)gld->PB2d.pPoints; \ - SScontext *ss = SWSETUP_CONTEXT(ctx); \ - SWvertex *swv; \ - DWORD dwSpecularColour; \ - DWORD dwFlatColour - -#define GLD_SETUP_2D_VARS_LINES \ - GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); \ - GLD_driver_dx7 *gld = GLD_GET_DX7_DRIVER(gldCtx); \ - GLD_2D_VERTEX *pV = (GLD_2D_VERTEX*)gld->PB2d.pLines; \ - SScontext *ss = SWSETUP_CONTEXT(ctx); \ - SWvertex *swv; \ - DWORD dwSpecularColour; \ - DWORD dwFlatColour - -#define GLD_SETUP_2D_VARS_TRIANGLES \ - BOOL bFog = ctx->Fog.Enabled; \ - GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); \ - GLD_driver_dx7 *gld = GLD_GET_DX7_DRIVER(gldCtx); \ - GLD_2D_VERTEX *pV = (GLD_2D_VERTEX*)gld->PB2d.pTriangles; \ - SScontext *ss = SWSETUP_CONTEXT(ctx); \ - SWvertex *swv; \ - DWORD dwSpecularColour; \ - DWORD dwFlatColour; \ - GLuint facing = 0; \ - struct vertex_buffer *VB; \ - GLchan (*vbcolor)[4]; \ - GLchan (*vbspec)[4] - -#define GLD_SETUP_GET_SWVERT(s) \ - swv = &ss->verts[##s] - -#define GLD_SETUP_2D_VERTEX \ - pV->x = swv->win[0]; \ - pV->y = GLD_FLIP_Y(swv->win[1]); \ - pV->rhw = swv->win[3] - -#define GLD_SETUP_SMOOTH_COLOUR \ - pV->diffuse = GLD_COLOUR - -#define GLD_SETUP_GET_FLAT_COLOUR \ - dwFlatColour = GLD_COLOUR -#define GLD_SETUP_GET_FLAT_FOG_COLOUR \ - dwFlatColour = _gldComputeFog(ctx, swv) - -#define GLD_SETUP_USE_FLAT_COLOUR \ - pV->diffuse = dwFlatColour - -#define GLD_SETUP_GET_FLAT_SPECULAR \ - dwSpecularColour= GLD_SPECULAR - -#define GLD_SETUP_USE_FLAT_SPECULAR \ - pV->specular = dwSpecularColour - -#define GLD_SETUP_DEPTH \ - pV->sz = swv->win[2] / ctx->DepthMaxF -// pV->z = swv->win[2] * ooZ; - -#define GLD_SETUP_SPECULAR \ - pV->specular = GLD_SPECULAR - -#define GLD_SETUP_FOG \ - pV->diffuse = _gldComputeFog(ctx, swv) - -#define GLD_SETUP_TEX0 \ - pV->t0_u = swv->texcoord[0][0]; \ - pV->t0_v = swv->texcoord[0][1] - -#define GLD_SETUP_TEX1 \ - pV->t1_u = swv->texcoord[1][0]; \ - pV->t1_v = swv->texcoord[1][1] - -#define GLD_SETUP_LIGHTING(v) \ - if (facing == 1) { \ - pV->diffuse = D3DCOLOR_RGBA(vbcolor[##v][0], vbcolor[##v][1], vbcolor[##v][2], vbcolor[##v][3]); \ - if (vbspec) { \ - pV->specular = D3DCOLOR_RGBA(vbspec[##v][0], vbspec[##v][1], vbspec[##v][2], vbspec[##v][3]); \ - } \ - } else { \ - if (bFog) \ - GLD_SETUP_FOG; \ - else \ - GLD_SETUP_SMOOTH_COLOUR; \ - GLD_SETUP_SPECULAR; \ - } - -#define GLD_SETUP_GET_FLAT_LIGHTING(v) \ - if (facing == 1) { \ - dwFlatColour = D3DCOLOR_RGBA(vbcolor[##v][0], vbcolor[##v][1], vbcolor[##v][2], vbcolor[##v][3]); \ - if (vbspec) { \ - dwSpecularColour = D3DCOLOR_RGBA(vbspec[##v][0], vbspec[##v][1], vbspec[##v][2], vbspec[##v][3]); \ - } \ - } - -#define GLD_SETUP_TWOSIDED_LIGHTING \ - /* Two-sided lighting */ \ - if (ctx->_TriangleCaps & DD_TRI_LIGHT_TWOSIDE) { \ - SWvertex *verts = SWSETUP_CONTEXT(ctx)->verts; \ - SWvertex *v[3]; \ - GLfloat ex,ey,fx,fy,cc; \ - /* Get vars for later */ \ - VB = &TNL_CONTEXT(ctx)->vb; \ - vbcolor = (GLchan (*)[4])VB->ColorPtr[1]->data; \ - if (VB->SecondaryColorPtr[1]) { \ - vbspec = (GLchan (*)[4])VB->SecondaryColorPtr[1]->data; \ - } else { \ - vbspec = NULL; \ - } \ - v[0] = &verts[v0]; \ - v[1] = &verts[v1]; \ - v[2] = &verts[v2]; \ - ex = v[0]->win[0] - v[2]->win[0]; \ - ey = v[0]->win[1] - v[2]->win[1]; \ - fx = v[1]->win[0] - v[2]->win[0]; \ - fy = v[1]->win[1] - v[2]->win[1]; \ - cc = ex*fy - ey*fx; \ - facing = (cc < 0.0) ^ ctx->Polygon._FrontBit; \ - } - -//--------------------------------------------------------------------------- -// 3D vertex setup -//--------------------------------------------------------------------------- - -#define GLD_SETUP_3D_VARS_POINTS \ - GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); \ - GLD_driver_dx7 *gld = GLD_GET_DX7_DRIVER(gldCtx); \ - GLD_3D_VERTEX *pV = (GLD_3D_VERTEX*)gld->PB3d.pPoints; \ - TNLcontext *tnl = TNL_CONTEXT(ctx); \ - struct vertex_buffer *VB = &tnl->vb; \ - GLfloat (*p4f)[4]; \ - GLfloat (*tc)[4]; \ - DWORD dwColor; - -#define GLD_SETUP_3D_VARS_LINES \ - GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); \ - GLD_driver_dx7 *gld = GLD_GET_DX7_DRIVER(gldCtx); \ - GLD_3D_VERTEX *pV = (GLD_3D_VERTEX*)gld->PB3d.pLines; \ - TNLcontext *tnl = TNL_CONTEXT(ctx); \ - struct vertex_buffer *VB = &tnl->vb; \ - GLfloat (*p4f)[4]; \ - GLfloat (*tc)[4]; \ - DWORD dwColor; - -#define GLD_SETUP_3D_VARS_TRIANGLES \ - GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); \ - GLD_driver_dx7 *gld = GLD_GET_DX7_DRIVER(gldCtx); \ - GLD_3D_VERTEX *pV = (GLD_3D_VERTEX*)gld->PB3d.pTriangles; \ - TNLcontext *tnl = TNL_CONTEXT(ctx); \ - struct vertex_buffer *VB = &tnl->vb; \ - GLfloat (*p4f)[4]; \ - GLfloat (*tc)[4]; \ - DWORD dwColor; - -#define GLD_SETUP_3D_VERTEX(v) \ - p4f = VB->ObjPtr->data; \ - pV->Position.x = p4f[##v][0]; \ - pV->Position.y = p4f[##v][1]; \ - pV->Position.z = p4f[##v][2]; - -#define GLD_SETUP_SMOOTH_COLOUR_3D(v) \ - p4f = (GLfloat (*)[4])VB->ColorPtr[0]->data; \ - pV->Diffuse = D3DCOLOR_COLORVALUE(p4f[##v][0], p4f[##v][1], p4f[##v][2], p4f[##v][3]); - - -#define GLD_SETUP_GET_FLAT_COLOUR_3D(v) \ - p4f = (GLfloat (*)[4])VB->ColorPtr[0]->data; \ - dwColor = D3DCOLOR_COLORVALUE(p4f[##v][0], p4f[##v][1], p4f[##v][2], p4f[##v][3]); - -#define GLD_SETUP_USE_FLAT_COLOUR_3D \ - pV->Diffuse = dwColor; - -#define GLD_SETUP_TEX0_3D(v) \ - if (VB->TexCoordPtr[0]) { \ - tc = VB->TexCoordPtr[0]->data; \ - pV->TexUnit0.x = tc[##v][0]; \ - pV->TexUnit0.y = tc[##v][1]; \ - } - -#define GLD_SETUP_TEX1_3D(v) \ - if (VB->TexCoordPtr[1]) { \ - tc = VB->TexCoordPtr[1]->data; \ - pV->TexUnit1.x = tc[##v][0]; \ - pV->TexUnit1.y = tc[##v][1]; \ - } - -//--------------------------------------------------------------------------- -// Helper functions -//--------------------------------------------------------------------------- - -__inline DWORD _gldComputeFog( - GLcontext *ctx, - SWvertex *swv) -{ - // Full fog calculation. - // Based on Mesa code. - - GLchan rFog, gFog, bFog; - GLchan fR, fG, fB; - const GLfloat f = swv->fog; - const GLfloat g = 1.0 - f; - - UNCLAMPED_FLOAT_TO_CHAN(rFog, ctx->Fog.Color[RCOMP]); - UNCLAMPED_FLOAT_TO_CHAN(gFog, ctx->Fog.Color[GCOMP]); - UNCLAMPED_FLOAT_TO_CHAN(bFog, ctx->Fog.Color[BCOMP]); - fR = f * swv->color[0] + g * rFog; - fG = f * swv->color[1] + g * gFog; - fB = f * swv->color[2] + g * bFog; - return D3DCOLOR_RGBA(fR, fG, fB, swv->color[3]); -} - -//--------------------------------------------------------------------------- - -void gld_ResetLineStipple_DX7( - GLcontext *ctx) -{ - // TODO: Fake stipple with a 32x32 texture. -} - -//--------------------------------------------------------------------------- -// 2D (post-transformed) primitives -//--------------------------------------------------------------------------- - -void gld_Points2D_DX7( - GLcontext *ctx, - GLuint first, - GLuint last) -{ - GLD_SETUP_2D_VARS_POINTS; - - unsigned i; - struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; - - // _Size is already clamped to MaxPointSize and MinPointSize - // Not supported by DX7 -// IDirect3DDevice8_SetRenderState(gld->pDev, D3DRS_POINTSIZE, *((DWORD*)&ctx->Point._Size)); - - if (VB->Elts) { - for (i=first; iClipMask[VB->Elts[i]] == 0) { -// _swrast_Point( ctx, &verts[VB->Elts[i]] ); - GLD_SETUP_GET_SWVERT(VB->Elts[i]); - GLD_SETUP_2D_VERTEX; - GLD_SETUP_SMOOTH_COLOUR; - GLD_SETUP_DEPTH; - GLD_SETUP_SPECULAR; - GLD_SETUP_TEX0; - GLD_SETUP_TEX1; - } - } - } else { - GLD_SETUP_GET_SWVERT(first); - for (i=first; iClipMask[i] == 0) { -// _swrast_Point( ctx, &verts[i] ); - GLD_SETUP_2D_VERTEX; - GLD_SETUP_SMOOTH_COLOUR; - GLD_SETUP_DEPTH; - GLD_SETUP_SPECULAR; - GLD_SETUP_TEX0; - GLD_SETUP_TEX1; - } - } - } - - gld->PB2d.pPoints = (BYTE*)pV; - gld->PB2d.nPoints += (last-first); -} - -//--------------------------------------------------------------------------- - -void gld_Line2DFlat_DX7( - GLcontext *ctx, - GLuint v0, - GLuint v1) -{ - GLD_SETUP_2D_VARS_LINES; - - GLD_SETUP_GET_SWVERT(v1); - GLD_SETUP_2D_VERTEX; - GLD_SETUP_DEPTH; - GLD_SETUP_TEX0; - GLD_SETUP_TEX1; - GLD_SETUP_GET_FLAT_COLOUR; - GLD_SETUP_USE_FLAT_COLOUR; - GLD_SETUP_GET_FLAT_SPECULAR; - GLD_SETUP_USE_FLAT_SPECULAR; - pV++; - - GLD_SETUP_GET_SWVERT(v0); - GLD_SETUP_2D_VERTEX; - GLD_SETUP_DEPTH; - GLD_SETUP_TEX0; - GLD_SETUP_TEX1; - GLD_SETUP_USE_FLAT_COLOUR; - GLD_SETUP_USE_FLAT_SPECULAR; - pV++; - - gld->PB2d.pLines = (BYTE*)pV; - gld->PB2d.nLines++; -} - -//--------------------------------------------------------------------------- - -void gld_Line2DSmooth_DX7( - GLcontext *ctx, - GLuint v0, - GLuint v1) -{ - GLD_SETUP_2D_VARS_LINES; - - GLD_SETUP_GET_SWVERT(v0); - GLD_SETUP_2D_VERTEX; - GLD_SETUP_SMOOTH_COLOUR; - GLD_SETUP_DEPTH; - GLD_SETUP_SPECULAR; - GLD_SETUP_TEX0; - GLD_SETUP_TEX1; - pV++; - - GLD_SETUP_GET_SWVERT(v1); - GLD_SETUP_2D_VERTEX; - GLD_SETUP_SMOOTH_COLOUR; - GLD_SETUP_SPECULAR; - GLD_SETUP_DEPTH; - GLD_SETUP_TEX0; - GLD_SETUP_TEX1; - pV++; - - gld->PB2d.pLines = (BYTE*)pV; - gld->PB2d.nLines++; -} - -//--------------------------------------------------------------------------- - -void gld_Triangle2DFlat_DX7( - GLcontext *ctx, - GLuint v0, - GLuint v1, - GLuint v2) -{ - GLD_SETUP_2D_VARS_TRIANGLES; - - GLD_SETUP_GET_SWVERT(v2); - GLD_SETUP_2D_VERTEX; - GLD_SETUP_DEPTH; - GLD_SETUP_TEX0; - GLD_SETUP_TEX1; - GLD_SETUP_GET_FLAT_COLOUR; - GLD_SETUP_USE_FLAT_COLOUR; - pV++;; - - GLD_SETUP_GET_SWVERT(v0); - GLD_SETUP_2D_VERTEX; - GLD_SETUP_DEPTH; - GLD_SETUP_TEX0; - GLD_SETUP_TEX1; - GLD_SETUP_USE_FLAT_COLOUR; - pV++; - - GLD_SETUP_GET_SWVERT(v1); - GLD_SETUP_2D_VERTEX; - GLD_SETUP_DEPTH; - GLD_SETUP_TEX0; - GLD_SETUP_TEX1; - GLD_SETUP_USE_FLAT_COLOUR; - pV++; - - gld->PB2d.pTriangles = (BYTE*)pV; - gld->PB2d.nTriangles++; -} - -//--------------------------------------------------------------------------- - -void gld_Triangle2DSmooth_DX7( - GLcontext *ctx, - GLuint v0, - GLuint v1, - GLuint v2) -{ - - GLD_SETUP_2D_VARS_TRIANGLES; - - GLD_SETUP_GET_SWVERT(v0); - GLD_SETUP_2D_VERTEX; - GLD_SETUP_SMOOTH_COLOUR; - GLD_SETUP_DEPTH; - GLD_SETUP_TEX0; - GLD_SETUP_TEX1; - pV++; - - GLD_SETUP_GET_SWVERT(v1); - GLD_SETUP_2D_VERTEX; - GLD_SETUP_SMOOTH_COLOUR; - GLD_SETUP_DEPTH; - GLD_SETUP_TEX0; - GLD_SETUP_TEX1; - pV++; - - GLD_SETUP_GET_SWVERT(v2); - GLD_SETUP_2D_VERTEX; - GLD_SETUP_SMOOTH_COLOUR; - GLD_SETUP_DEPTH; - GLD_SETUP_TEX0; - GLD_SETUP_TEX1; - pV++; - - gld->PB2d.pTriangles = (BYTE*)pV; - gld->PB2d.nTriangles++; -} - -//--------------------------------------------------------------------------- - -void gld_Triangle2DFlatExtras_DX7( - GLcontext *ctx, - GLuint v0, - GLuint v1, - GLuint v2) -{ - GLD_SETUP_2D_VARS_TRIANGLES; - - GLD_SETUP_TWOSIDED_LIGHTING(v2); - - GLD_SETUP_GET_SWVERT(v2); - GLD_SETUP_2D_VERTEX; - GLD_SETUP_DEPTH; - GLD_SETUP_TEX0; - GLD_SETUP_TEX1; - if (bFog) - GLD_SETUP_GET_FLAT_FOG_COLOUR; - else - GLD_SETUP_GET_FLAT_COLOUR; - GLD_SETUP_GET_FLAT_SPECULAR; - GLD_SETUP_GET_FLAT_LIGHTING(v2); - GLD_SETUP_USE_FLAT_COLOUR; - GLD_SETUP_USE_FLAT_SPECULAR; - pV++; - - GLD_SETUP_GET_SWVERT(v0); - GLD_SETUP_2D_VERTEX; - GLD_SETUP_DEPTH; - GLD_SETUP_TEX0; - GLD_SETUP_TEX1; - GLD_SETUP_USE_FLAT_COLOUR; - GLD_SETUP_USE_FLAT_SPECULAR; - pV++; - - GLD_SETUP_GET_SWVERT(v1); - GLD_SETUP_2D_VERTEX; - GLD_SETUP_DEPTH; - GLD_SETUP_TEX0; - GLD_SETUP_TEX1; - GLD_SETUP_USE_FLAT_COLOUR; - GLD_SETUP_USE_FLAT_SPECULAR; - pV++; - - gld->PB2d.pTriangles = (BYTE*)pV; - gld->PB2d.nTriangles++; -} - -//--------------------------------------------------------------------------- - -void gld_Triangle2DSmoothExtras_DX7( - GLcontext *ctx, - GLuint v0, - GLuint v1, - GLuint v2) -{ - GLD_SETUP_2D_VARS_TRIANGLES; - - GLD_SETUP_TWOSIDED_LIGHTING(v0); - - GLD_SETUP_GET_SWVERT(v0); - GLD_SETUP_2D_VERTEX; - GLD_SETUP_DEPTH; - GLD_SETUP_TEX0; - GLD_SETUP_TEX1; - GLD_SETUP_LIGHTING(v0); - pV++; - - GLD_SETUP_GET_SWVERT(v1); - GLD_SETUP_2D_VERTEX; - GLD_SETUP_DEPTH; - GLD_SETUP_TEX0; - GLD_SETUP_TEX1; - GLD_SETUP_LIGHTING(v1); - pV++; - - GLD_SETUP_GET_SWVERT(v2); - GLD_SETUP_2D_VERTEX; - GLD_SETUP_DEPTH; - GLD_SETUP_TEX0; - GLD_SETUP_TEX1; - GLD_SETUP_LIGHTING(v2); - pV++; - - gld->PB2d.pTriangles = (BYTE*)pV; - gld->PB2d.nTriangles++; -} - -//--------------------------------------------------------------------------- - -void gld_Quad2DFlat_DX7( - GLcontext *ctx, - GLuint v0, - GLuint v1, - GLuint v2, - GLuint v3) -{ - GLD_SETUP_2D_VARS_TRIANGLES; - - GLD_SETUP_GET_SWVERT(v3); - GLD_SETUP_2D_VERTEX; - GLD_SETUP_DEPTH; - GLD_SETUP_TEX0; - GLD_SETUP_TEX1; - GLD_SETUP_GET_FLAT_COLOUR; - GLD_SETUP_USE_FLAT_COLOUR; - pV++; - - GLD_SETUP_GET_SWVERT(v0); - GLD_SETUP_2D_VERTEX; - GLD_SETUP_DEPTH; - GLD_SETUP_TEX0; - GLD_SETUP_TEX1; - GLD_SETUP_USE_FLAT_COLOUR; - pV++; - - GLD_SETUP_GET_SWVERT(v1); - GLD_SETUP_2D_VERTEX; - GLD_SETUP_DEPTH; - GLD_SETUP_TEX0; - GLD_SETUP_TEX1; - GLD_SETUP_USE_FLAT_COLOUR; - pV++; - - GLD_SETUP_GET_SWVERT(v1); - GLD_SETUP_2D_VERTEX; - GLD_SETUP_DEPTH; - GLD_SETUP_TEX0; - GLD_SETUP_TEX1; - GLD_SETUP_USE_FLAT_COLOUR; - pV++; - - GLD_SETUP_GET_SWVERT(v2); - GLD_SETUP_2D_VERTEX; - GLD_SETUP_DEPTH; - GLD_SETUP_TEX0; - GLD_SETUP_TEX1; - GLD_SETUP_USE_FLAT_COLOUR; - pV++; - - GLD_SETUP_GET_SWVERT(v3); - GLD_SETUP_2D_VERTEX; - GLD_SETUP_DEPTH; - GLD_SETUP_TEX0; - GLD_SETUP_TEX1; - GLD_SETUP_USE_FLAT_COLOUR; - pV++; - - gld->PB2d.pTriangles = (BYTE*)pV; - gld->PB2d.nTriangles += 2; -} - -//--------------------------------------------------------------------------- - -void gld_Quad2DSmooth_DX7( - GLcontext *ctx, - GLuint v0, - GLuint v1, - GLuint v2, - GLuint v3) -{ - GLD_SETUP_2D_VARS_TRIANGLES; - - GLD_SETUP_GET_SWVERT(v0); - GLD_SETUP_2D_VERTEX; - GLD_SETUP_SMOOTH_COLOUR; - GLD_SETUP_DEPTH; - GLD_SETUP_TEX0; - GLD_SETUP_TEX1; - pV++; - - GLD_SETUP_GET_SWVERT(v1); - GLD_SETUP_2D_VERTEX; - GLD_SETUP_SMOOTH_COLOUR; - GLD_SETUP_DEPTH; - GLD_SETUP_TEX0; - GLD_SETUP_TEX1; - pV++; - - GLD_SETUP_GET_SWVERT(v2); - GLD_SETUP_2D_VERTEX; - GLD_SETUP_SMOOTH_COLOUR; - GLD_SETUP_DEPTH; - GLD_SETUP_TEX0; - GLD_SETUP_TEX1; - pV++; - - GLD_SETUP_GET_SWVERT(v2); - GLD_SETUP_2D_VERTEX; - GLD_SETUP_SMOOTH_COLOUR; - GLD_SETUP_DEPTH; - GLD_SETUP_TEX0; - GLD_SETUP_TEX1; - pV++; - - GLD_SETUP_GET_SWVERT(v3); - GLD_SETUP_2D_VERTEX; - GLD_SETUP_SMOOTH_COLOUR; - GLD_SETUP_DEPTH; - GLD_SETUP_TEX0; - GLD_SETUP_TEX1; - pV++; - - GLD_SETUP_GET_SWVERT(v0); - GLD_SETUP_2D_VERTEX; - GLD_SETUP_SMOOTH_COLOUR; - GLD_SETUP_DEPTH; - GLD_SETUP_TEX0; - GLD_SETUP_TEX1; - pV++; - - gld->PB2d.pTriangles = (BYTE*)pV; - gld->PB2d.nTriangles += 2; -} - -//--------------------------------------------------------------------------- - -void gld_Quad2DFlatExtras_DX7( - GLcontext *ctx, - GLuint v0, - GLuint v1, - GLuint v2, - GLuint v3) -{ - GLD_SETUP_2D_VARS_TRIANGLES; - - GLD_SETUP_TWOSIDED_LIGHTING(v3); - - GLD_SETUP_GET_SWVERT(v3); - GLD_SETUP_2D_VERTEX; - GLD_SETUP_DEPTH; - GLD_SETUP_TEX0; - GLD_SETUP_TEX1; - if (bFog) - GLD_SETUP_GET_FLAT_FOG_COLOUR; - else - GLD_SETUP_GET_FLAT_COLOUR; - GLD_SETUP_GET_FLAT_SPECULAR; - GLD_SETUP_GET_FLAT_LIGHTING(v3); - GLD_SETUP_USE_FLAT_COLOUR; - GLD_SETUP_USE_FLAT_SPECULAR; - pV++; - - GLD_SETUP_GET_SWVERT(v0); - GLD_SETUP_2D_VERTEX; - GLD_SETUP_DEPTH; - GLD_SETUP_TEX0; - GLD_SETUP_TEX1; - GLD_SETUP_USE_FLAT_COLOUR; - GLD_SETUP_USE_FLAT_SPECULAR; - pV++; - - GLD_SETUP_GET_SWVERT(v1); - GLD_SETUP_2D_VERTEX; - GLD_SETUP_DEPTH; - GLD_SETUP_TEX0; - GLD_SETUP_TEX1; - GLD_SETUP_USE_FLAT_COLOUR; - GLD_SETUP_USE_FLAT_SPECULAR; - pV++; - - GLD_SETUP_GET_SWVERT(v1); - GLD_SETUP_2D_VERTEX; - GLD_SETUP_DEPTH; - GLD_SETUP_TEX0; - GLD_SETUP_TEX1; - GLD_SETUP_USE_FLAT_COLOUR; - GLD_SETUP_USE_FLAT_SPECULAR; - pV++; - - GLD_SETUP_GET_SWVERT(v2); - GLD_SETUP_2D_VERTEX; - GLD_SETUP_DEPTH; - GLD_SETUP_TEX0; - GLD_SETUP_TEX1; - GLD_SETUP_USE_FLAT_COLOUR; - GLD_SETUP_USE_FLAT_SPECULAR; - pV++; - - GLD_SETUP_GET_SWVERT(v3); - GLD_SETUP_2D_VERTEX; - GLD_SETUP_DEPTH; - GLD_SETUP_TEX0; - GLD_SETUP_TEX1; - GLD_SETUP_USE_FLAT_COLOUR; - GLD_SETUP_USE_FLAT_SPECULAR; - pV++; - - gld->PB2d.pTriangles = (BYTE*)pV; - gld->PB2d.nTriangles += 2; -} - -//--------------------------------------------------------------------------- - -void gld_Quad2DSmoothExtras_DX7( - GLcontext *ctx, - GLuint v0, - GLuint v1, - GLuint v2, - GLuint v3) -{ - GLD_SETUP_2D_VARS_TRIANGLES; - - GLD_SETUP_TWOSIDED_LIGHTING(v0); - - GLD_SETUP_GET_SWVERT(v0); - GLD_SETUP_2D_VERTEX; - GLD_SETUP_DEPTH; - GLD_SETUP_TEX0; - GLD_SETUP_TEX1; - GLD_SETUP_LIGHTING(v0); - pV++; - - GLD_SETUP_GET_SWVERT(v1); - GLD_SETUP_2D_VERTEX; - GLD_SETUP_DEPTH; - GLD_SETUP_TEX0; - GLD_SETUP_TEX1; - GLD_SETUP_LIGHTING(v1); - pV++; - - GLD_SETUP_GET_SWVERT(v2); - GLD_SETUP_2D_VERTEX; - GLD_SETUP_DEPTH; - GLD_SETUP_TEX0; - GLD_SETUP_TEX1; - GLD_SETUP_LIGHTING(v2); - pV++; - - GLD_SETUP_GET_SWVERT(v2); - GLD_SETUP_2D_VERTEX; - GLD_SETUP_DEPTH; - GLD_SETUP_TEX0; - GLD_SETUP_TEX1; - GLD_SETUP_LIGHTING(v2); - pV++; - - GLD_SETUP_GET_SWVERT(v3); - GLD_SETUP_2D_VERTEX; - GLD_SETUP_DEPTH; - GLD_SETUP_TEX0; - GLD_SETUP_TEX1; - GLD_SETUP_LIGHTING(v3); - pV++; - - GLD_SETUP_GET_SWVERT(v0); - GLD_SETUP_2D_VERTEX; - GLD_SETUP_DEPTH; - GLD_SETUP_TEX0; - GLD_SETUP_TEX1; - GLD_SETUP_LIGHTING(v0); - pV++; - - gld->PB2d.pTriangles = (BYTE*)pV; - gld->PB2d.nTriangles += 2; -} - -//--------------------------------------------------------------------------- -// 3D (pre-transformed) primitives -//--------------------------------------------------------------------------- - -void gld_Points3D_DX7( - GLcontext *ctx, - GLuint first, - GLuint last) -{ - GLD_SETUP_3D_VARS_POINTS - - unsigned i; -// struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; - - // _Size is already clamped to MaxPointSize and MinPointSize - // Not supported by DX7 -// IDirect3DDevice8_SetRenderState(gld->pDev, D3DRS_POINTSIZE, *((DWORD*)&ctx->Point._Size)); - - if (VB->Elts) { - for (i=first; iClipMask[VB->Elts[i]] == 0) { -// _swrast_Point( ctx, &verts[VB->Elts[i]] ); -// GLD_SETUP_GET_SWVERT(VB->Elts[i]); - GLD_SETUP_3D_VERTEX(VB->Elts[i]) - GLD_SETUP_SMOOTH_COLOUR_3D(i) - GLD_SETUP_TEX0_3D(i) - GLD_SETUP_TEX1_3D(i) - } - } - } else { -// GLD_SETUP_GET_SWVERT(first); - for (i=first; iClipMask[i] == 0) { -// _swrast_Point( ctx, &verts[i] ); - GLD_SETUP_3D_VERTEX(i) - GLD_SETUP_SMOOTH_COLOUR_3D(i) - GLD_SETUP_TEX0_3D(i) - GLD_SETUP_TEX1_3D(i) - } - } - } -/* - for (i=first; iPB3d.pPoints = (BYTE*)pV; - gld->PB3d.nPoints += (last-first); -} - -//--------------------------------------------------------------------------- -// Line functions -//--------------------------------------------------------------------------- - -void gld_Line3DFlat_DX7( - GLcontext *ctx, - GLuint v0, - GLuint v1) -{ - GLD_SETUP_3D_VARS_LINES - - GLD_SETUP_3D_VERTEX(v1) - GLD_SETUP_GET_FLAT_COLOUR_3D(v1) - GLD_SETUP_USE_FLAT_COLOUR_3D - GLD_SETUP_TEX0_3D(v1) - GLD_SETUP_TEX1_3D(v1) - pV++; - - GLD_SETUP_3D_VERTEX(v0) - GLD_SETUP_USE_FLAT_COLOUR_3D - GLD_SETUP_TEX0_3D(v0) - GLD_SETUP_TEX1_3D(v0) - pV++; - - gld->PB3d.pLines = (BYTE*)pV; - gld->PB3d.nLines++; -} - -//--------------------------------------------------------------------------- - -void gld_Line3DSmooth_DX7( - GLcontext *ctx, - GLuint v0, - GLuint v1) -{ - GLD_SETUP_3D_VARS_LINES - - GLD_SETUP_3D_VERTEX(v1) - GLD_SETUP_SMOOTH_COLOUR_3D(v1) - GLD_SETUP_TEX0_3D(v1) - GLD_SETUP_TEX1_3D(v1) - pV++; - - GLD_SETUP_3D_VERTEX(v0) - GLD_SETUP_SMOOTH_COLOUR_3D(v0) - GLD_SETUP_TEX0_3D(v0) - GLD_SETUP_TEX1_3D(v0) - pV++; - - gld->PB3d.pLines = (BYTE*)pV; - gld->PB3d.nLines++; -} - -//--------------------------------------------------------------------------- -// Triangle functions -//--------------------------------------------------------------------------- - -void gld_Triangle3DFlat_DX7( - GLcontext *ctx, - GLuint v0, - GLuint v1, - GLuint v2) -{ - GLD_SETUP_3D_VARS_TRIANGLES - - GLD_SETUP_3D_VERTEX(v2) - GLD_SETUP_TEX0_3D(v2) - GLD_SETUP_TEX1_3D(v2) - GLD_SETUP_GET_FLAT_COLOUR_3D(v2) - GLD_SETUP_USE_FLAT_COLOUR_3D - pV++; - - GLD_SETUP_3D_VERTEX(v0) - GLD_SETUP_TEX0_3D(v0) - GLD_SETUP_TEX1_3D(v0) - GLD_SETUP_USE_FLAT_COLOUR_3D - pV++; - - GLD_SETUP_3D_VERTEX(v1) - GLD_SETUP_TEX0_3D(v1) - GLD_SETUP_TEX1_3D(v1) - GLD_SETUP_USE_FLAT_COLOUR_3D - pV++; - - gld->PB3d.pTriangles = (BYTE*)pV; - gld->PB3d.nTriangles++; -} - -//--------------------------------------------------------------------------- - -void gld_Triangle3DSmooth_DX7( - GLcontext *ctx, - GLuint v0, - GLuint v1, - GLuint v2) -{ - GLD_SETUP_3D_VARS_TRIANGLES - - GLD_SETUP_3D_VERTEX(v0) - GLD_SETUP_SMOOTH_COLOUR_3D(v0) - GLD_SETUP_TEX0_3D(v0) - GLD_SETUP_TEX1_3D(v0) - pV++; - - GLD_SETUP_3D_VERTEX(v1) - GLD_SETUP_SMOOTH_COLOUR_3D(v1) - GLD_SETUP_TEX0_3D(v1) - GLD_SETUP_TEX1_3D(v1) - pV++; - - GLD_SETUP_3D_VERTEX(v2) - GLD_SETUP_SMOOTH_COLOUR_3D(v2) - GLD_SETUP_TEX0_3D(v2) - GLD_SETUP_TEX1_3D(v2) - pV++; - - gld->PB3d.pTriangles = (BYTE*)pV; - gld->PB3d.nTriangles++; -} - -//--------------------------------------------------------------------------- -// Quad functions -//--------------------------------------------------------------------------- - -void gld_Quad3DFlat_DX7( - GLcontext *ctx, - GLuint v0, - GLuint v1, - GLuint v2, - GLuint v3) -{ - GLD_SETUP_3D_VARS_TRIANGLES - - GLD_SETUP_3D_VERTEX(v3) - GLD_SETUP_GET_FLAT_COLOUR_3D(v3) - GLD_SETUP_USE_FLAT_COLOUR_3D - GLD_SETUP_TEX0_3D(v3) - GLD_SETUP_TEX1_3D(v3) - pV++; - - GLD_SETUP_3D_VERTEX(v0) - GLD_SETUP_USE_FLAT_COLOUR_3D - GLD_SETUP_TEX0_3D(v0) - GLD_SETUP_TEX1_3D(v0) - pV++; - - GLD_SETUP_3D_VERTEX(v1) - GLD_SETUP_USE_FLAT_COLOUR_3D - GLD_SETUP_TEX0_3D(v1) - GLD_SETUP_TEX1_3D(v1) - pV++; - - GLD_SETUP_3D_VERTEX(v1) - GLD_SETUP_USE_FLAT_COLOUR_3D - GLD_SETUP_TEX0_3D(v1) - GLD_SETUP_TEX1_3D(v1) - pV++; - - GLD_SETUP_3D_VERTEX(v2) - GLD_SETUP_USE_FLAT_COLOUR_3D - GLD_SETUP_TEX0_3D(v2) - GLD_SETUP_TEX1_3D(v2) - pV++; - - GLD_SETUP_3D_VERTEX(v3) - GLD_SETUP_USE_FLAT_COLOUR_3D - GLD_SETUP_TEX0_3D(v3) - GLD_SETUP_TEX1_3D(v3) - pV++; - - gld->PB3d.pTriangles = (BYTE*)pV; - gld->PB3d.nTriangles += 2; -} - -//--------------------------------------------------------------------------- - -void gld_Quad3DSmooth_DX7( - GLcontext *ctx, - GLuint v0, - GLuint v1, - GLuint v2, - GLuint v3) -{ - GLD_SETUP_3D_VARS_TRIANGLES - - GLD_SETUP_3D_VERTEX(v0) - GLD_SETUP_SMOOTH_COLOUR_3D(v0) - GLD_SETUP_TEX0_3D(v0) - GLD_SETUP_TEX1_3D(v0) - pV++; - - GLD_SETUP_3D_VERTEX(v1) - GLD_SETUP_SMOOTH_COLOUR_3D(v1) - GLD_SETUP_TEX0_3D(v1) - GLD_SETUP_TEX1_3D(v1) - pV++; - - GLD_SETUP_3D_VERTEX(v2) - GLD_SETUP_SMOOTH_COLOUR_3D(v2) - GLD_SETUP_TEX0_3D(v2) - GLD_SETUP_TEX1_3D(v2) - pV++; - - GLD_SETUP_3D_VERTEX(v2) - GLD_SETUP_SMOOTH_COLOUR_3D(v2) - GLD_SETUP_TEX0_3D(v2) - GLD_SETUP_TEX1_3D(v2) - pV++; - - GLD_SETUP_3D_VERTEX(v3) - GLD_SETUP_SMOOTH_COLOUR_3D(v3) - GLD_SETUP_TEX0_3D(v3) - GLD_SETUP_TEX1_3D(v3) - pV++; - - GLD_SETUP_3D_VERTEX(v0) - GLD_SETUP_SMOOTH_COLOUR_3D(v0) - GLD_SETUP_TEX0_3D(v0) - GLD_SETUP_TEX1_3D(v0) - pV++; - - gld->PB3d.pTriangles = (BYTE*)pV; - gld->PB3d.nTriangles += 2; -} - -//--------------------------------------------------------------------------- -// Vertex setup for two-sided-lighting vertex shader -//--------------------------------------------------------------------------- - -/* - -void gld_Points2DTwoside_DX8(GLcontext *ctx, GLuint first, GLuint last) -{ - // NOTE: Two-sided lighting does not apply to Points -} - -//--------------------------------------------------------------------------- - -void gld_Line2DFlatTwoside_DX8(GLcontext *ctx, GLuint v0, GLuint v1) -{ - // NOTE: Two-sided lighting does not apply to Lines -} - -//--------------------------------------------------------------------------- - -void gld_Line2DSmoothTwoside_DX8(GLcontext *ctx, GLuint v0, GLuint v1) -{ - // NOTE: Two-sided lighting does not apply to Lines -} - -//--------------------------------------------------------------------------- - -void gld_Triangle2DFlatTwoside_DX8(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2) -{ -} - -//--------------------------------------------------------------------------- - -void gld_Triangle2DSmoothTwoside_DX8(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2) -{ - GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); - GLD_driver_dx8 *gld = GLD_GET_DX8_DRIVER(gldCtx); - GLD_TWOSIDED_VERTEX *pV = (GLD_TWOSIDED_VERTEX*)gld->PBtwosidelight.pTriangles; - SScontext *ss = SWSETUP_CONTEXT(ctx); - SWvertex *swv; - DWORD dwSpecularColour; - DWORD dwFlatColour; - GLuint facing = 0; - struct vertex_buffer *VB; - GLchan (*vbcolor)[4]; - GLchan (*vbspec)[4]; - - // Reciprocal of DepthMax - const float ooDepthMax = 1.0f / ctx->DepthMaxF; - - // 1st vert - swv = &ss->verts[v0]; - pV->Position.x = swv->win[0]; - pV->Position.y = GLD_FLIP_Y(swv->win[1]); - pV->Position.z = swv->win[2] * ooDepthMax; - pV->Position.w = swv->win[3]; - pV->TexUnit0.x = swv->texcoord[0][0]; - pV->TexUnit0.y = swv->texcoord[0][1]; - pV->TexUnit1.x = swv->texcoord[1][0]; - pV->TexUnit1.y = swv->texcoord[1][1]; - pV->FrontDiffuse = GLD_COLOUR; - pV->FrontSpecular = GLD_SPECULAR; - pV++; - - // 2nd vert - swv = &ss->verts[v1]; - pV->Position.x = swv->win[0]; - pV->Position.y = GLD_FLIP_Y(swv->win[1]); - pV->Position.z = swv->win[2] * ooDepthMax; - pV->Position.w = swv->win[3]; - pV->TexUnit0.x = swv->texcoord[0][0]; - pV->TexUnit0.y = swv->texcoord[0][1]; - pV->TexUnit1.x = swv->texcoord[1][0]; - pV->TexUnit1.y = swv->texcoord[1][1]; - pV->FrontDiffuse = GLD_COLOUR; - pV->FrontSpecular = GLD_SPECULAR; - pV++; - - // 3rd vert - swv = &ss->verts[v2]; - pV->Position.x = swv->win[0]; - pV->Position.y = GLD_FLIP_Y(swv->win[1]); - pV->Position.z = swv->win[2] * ooDepthMax; - pV->Position.w = swv->win[3]; - pV->TexUnit0.x = swv->texcoord[0][0]; - pV->TexUnit0.y = swv->texcoord[0][1]; - pV->TexUnit1.x = swv->texcoord[1][0]; - pV->TexUnit1.y = swv->texcoord[1][1]; - pV->FrontDiffuse = GLD_COLOUR; - pV->FrontSpecular = GLD_SPECULAR; - pV++; - - gld->PBtwosidelight.pTriangles = (BYTE*)pV; - gld->PBtwosidelight.nTriangles++; -} - -//--------------------------------------------------------------------------- - -void gld_Quad2DFlatTwoside_DX8(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3) -{ - GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); - GLD_driver_dx8 *gld = GLD_GET_DX8_DRIVER(gldCtx); - GLD_TWOSIDED_VERTEX *pV = (GLD_TWOSIDED_VERTEX*)gld->PBtwosidelight.pTriangles; - SScontext *ss = SWSETUP_CONTEXT(ctx); - SWvertex *swv; - DWORD dwSpecularColour; - DWORD dwFlatColour; - GLuint facing = 0; - struct vertex_buffer *VB; - GLchan (*vbcolor)[4]; - GLchan (*vbspec)[4]; - - // Reciprocal of DepthMax - const float ooDepthMax = 1.0f / ctx->DepthMaxF; - - // 1st vert - swv = &ss->verts[v0]; - pV->Position.x = swv->win[0]; - pV->Position.y = GLD_FLIP_Y(swv->win[1]); - pV->Position.z = swv->win[2] * ooDepthMax; - pV->Position.w = swv->win[3]; - pV->TexUnit0.x = swv->texcoord[0][0]; - pV->TexUnit0.y = swv->texcoord[0][1]; - pV->TexUnit1.x = swv->texcoord[1][0]; - pV->TexUnit1.y = swv->texcoord[1][1]; - pV->FrontDiffuse = GLD_COLOUR; - pV->FrontSpecular = GLD_SPECULAR; - pV++; - - // 2nd vert - swv = &ss->verts[v1]; - pV->Position.x = swv->win[0]; - pV->Position.y = GLD_FLIP_Y(swv->win[1]); - pV->Position.z = swv->win[2] * ooDepthMax; - pV->Position.w = swv->win[3]; - pV->TexUnit0.x = swv->texcoord[0][0]; - pV->TexUnit0.y = swv->texcoord[0][1]; - pV->TexUnit1.x = swv->texcoord[1][0]; - pV->TexUnit1.y = swv->texcoord[1][1]; - pV->FrontDiffuse = GLD_COLOUR; - pV->FrontSpecular = GLD_SPECULAR; - pV++; - - // 3rd vert - swv = &ss->verts[v2]; - pV->Position.x = swv->win[0]; - pV->Position.y = GLD_FLIP_Y(swv->win[1]); - pV->Position.z = swv->win[2] * ooDepthMax; - pV->Position.w = swv->win[3]; - pV->TexUnit0.x = swv->texcoord[0][0]; - pV->TexUnit0.y = swv->texcoord[0][1]; - pV->TexUnit1.x = swv->texcoord[1][0]; - pV->TexUnit1.y = swv->texcoord[1][1]; - pV->FrontDiffuse = GLD_COLOUR; - pV->FrontSpecular = GLD_SPECULAR; - pV++; - - // 4th vert - swv = &ss->verts[v2]; - pV->Position.x = swv->win[0]; - pV->Position.y = GLD_FLIP_Y(swv->win[1]); - pV->Position.z = swv->win[2] * ooDepthMax; - pV->Position.w = swv->win[3]; - pV->TexUnit0.x = swv->texcoord[0][0]; - pV->TexUnit0.y = swv->texcoord[0][1]; - pV->TexUnit1.x = swv->texcoord[1][0]; - pV->TexUnit1.y = swv->texcoord[1][1]; - pV->FrontDiffuse = GLD_COLOUR; - pV->FrontSpecular = GLD_SPECULAR; - pV++; - - // 5th vert - swv = &ss->verts[v3]; - pV->Position.x = swv->win[0]; - pV->Position.y = GLD_FLIP_Y(swv->win[1]); - pV->Position.z = swv->win[2] * ooDepthMax; - pV->Position.w = swv->win[3]; - pV->TexUnit0.x = swv->texcoord[0][0]; - pV->TexUnit0.y = swv->texcoord[0][1]; - pV->TexUnit1.x = swv->texcoord[1][0]; - pV->TexUnit1.y = swv->texcoord[1][1]; - pV->FrontDiffuse = GLD_COLOUR; - pV->FrontSpecular = GLD_SPECULAR; - pV++; - - // 6th vert - swv = &ss->verts[v0]; - pV->Position.x = swv->win[0]; - pV->Position.y = GLD_FLIP_Y(swv->win[1]); - pV->Position.z = swv->win[2] * ooDepthMax; - pV->Position.w = swv->win[3]; - pV->TexUnit0.x = swv->texcoord[0][0]; - pV->TexUnit0.y = swv->texcoord[0][1]; - pV->TexUnit1.x = swv->texcoord[1][0]; - pV->TexUnit1.y = swv->texcoord[1][1]; - pV->FrontDiffuse = GLD_COLOUR; - pV->FrontSpecular = GLD_SPECULAR; - pV++; - - gld->PBtwosidelight.pTriangles = (BYTE*)pV; - gld->PBtwosidelight.nTriangles += 2; -} - -//--------------------------------------------------------------------------- - -void gld_Quad2DSmoothTwoside_DX8(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3) -{ - GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); - GLD_driver_dx8 *gld = GLD_GET_DX8_DRIVER(gldCtx); - GLD_TWOSIDED_VERTEX *pV = (GLD_TWOSIDED_VERTEX*)gld->PBtwosidelight.pTriangles; - SScontext *ss = SWSETUP_CONTEXT(ctx); - SWvertex *swv; - DWORD dwSpecularColour; - DWORD dwFlatColour; - GLuint facing = 0; - struct vertex_buffer *VB; - GLchan (*vbcolor)[4]; - GLchan (*vbspec)[4]; - - // Reciprocal of DepthMax - const float ooDepthMax = 1.0f / ctx->DepthMaxF; - - // 1st vert - swv = &ss->verts[v0]; - pV->Position.x = swv->win[0]; - pV->Position.y = GLD_FLIP_Y(swv->win[1]); - pV->Position.z = swv->win[2] * ooDepthMax; - pV->Position.w = swv->win[3]; - pV->TexUnit0.x = swv->texcoord[0][0]; - pV->TexUnit0.y = swv->texcoord[0][1]; - pV->TexUnit1.x = swv->texcoord[1][0]; - pV->TexUnit1.y = swv->texcoord[1][1]; - pV->FrontDiffuse = GLD_COLOUR; - pV->FrontSpecular = GLD_SPECULAR; - pV++; - - // 2nd vert - swv = &ss->verts[v1]; - pV->Position.x = swv->win[0]; - pV->Position.y = GLD_FLIP_Y(swv->win[1]); - pV->Position.z = swv->win[2] * ooDepthMax; - pV->Position.w = swv->win[3]; - pV->TexUnit0.x = swv->texcoord[0][0]; - pV->TexUnit0.y = swv->texcoord[0][1]; - pV->TexUnit1.x = swv->texcoord[1][0]; - pV->TexUnit1.y = swv->texcoord[1][1]; - pV->FrontDiffuse = GLD_COLOUR; - pV->FrontSpecular = GLD_SPECULAR; - pV++; - - // 3rd vert - swv = &ss->verts[v2]; - pV->Position.x = swv->win[0]; - pV->Position.y = GLD_FLIP_Y(swv->win[1]); - pV->Position.z = swv->win[2] * ooDepthMax; - pV->Position.w = swv->win[3]; - pV->TexUnit0.x = swv->texcoord[0][0]; - pV->TexUnit0.y = swv->texcoord[0][1]; - pV->TexUnit1.x = swv->texcoord[1][0]; - pV->TexUnit1.y = swv->texcoord[1][1]; - pV->FrontDiffuse = GLD_COLOUR; - pV->FrontSpecular = GLD_SPECULAR; - pV++; - - // 4th vert - swv = &ss->verts[v2]; - pV->Position.x = swv->win[0]; - pV->Position.y = GLD_FLIP_Y(swv->win[1]); - pV->Position.z = swv->win[2] * ooDepthMax; - pV->Position.w = swv->win[3]; - pV->TexUnit0.x = swv->texcoord[0][0]; - pV->TexUnit0.y = swv->texcoord[0][1]; - pV->TexUnit1.x = swv->texcoord[1][0]; - pV->TexUnit1.y = swv->texcoord[1][1]; - pV->FrontDiffuse = GLD_COLOUR; - pV->FrontSpecular = GLD_SPECULAR; - pV++; - - // 5th vert - swv = &ss->verts[v3]; - pV->Position.x = swv->win[0]; - pV->Position.y = GLD_FLIP_Y(swv->win[1]); - pV->Position.z = swv->win[2] * ooDepthMax; - pV->Position.w = swv->win[3]; - pV->TexUnit0.x = swv->texcoord[0][0]; - pV->TexUnit0.y = swv->texcoord[0][1]; - pV->TexUnit1.x = swv->texcoord[1][0]; - pV->TexUnit1.y = swv->texcoord[1][1]; - pV->FrontDiffuse = GLD_COLOUR; - pV->FrontSpecular = GLD_SPECULAR; - pV++; - - // 6th vert - swv = &ss->verts[v0]; - pV->Position.x = swv->win[0]; - pV->Position.y = GLD_FLIP_Y(swv->win[1]); - pV->Position.z = swv->win[2] * ooDepthMax; - pV->Position.w = swv->win[3]; - pV->TexUnit0.x = swv->texcoord[0][0]; - pV->TexUnit0.y = swv->texcoord[0][1]; - pV->TexUnit1.x = swv->texcoord[1][0]; - pV->TexUnit1.y = swv->texcoord[1][1]; - pV->FrontDiffuse = GLD_COLOUR; - pV->FrontSpecular = GLD_SPECULAR; - pV++; - - gld->PBtwosidelight.pTriangles = (BYTE*)pV; - gld->PBtwosidelight.nTriangles += 2; -} - -//--------------------------------------------------------------------------- - -*/ diff --git a/src/mesa/drivers/windows/gldirect/dx7/gld_texture_dx7.c b/src/mesa/drivers/windows/gldirect/dx7/gld_texture_dx7.c deleted file mode 100644 index bbe673516d..0000000000 --- a/src/mesa/drivers/windows/gldirect/dx7/gld_texture_dx7.c +++ /dev/null @@ -1,2196 +0,0 @@ -/**************************************************************************** -* -* Mesa 3-D graphics library -* Direct3D Driver Interface -* -* ======================================================================== -* -* Copyright (C) 1991-2004 SciTech Software, Inc. All rights reserved. -* -* Permission is hereby granted, free of charge, to any person obtaining a -* copy of this software and associated documentation files (the "Software"), -* to deal in the Software without restriction, including without limitation -* the rights to use, copy, modify, merge, publish, distribute, sublicense, -* and/or sell copies of the Software, and to permit persons to whom the -* Software is furnished to do so, subject to the following conditions: -* -* The above copyright notice and this permission notice shall be included -* in all copies or substantial portions of the Software. -* -* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -* SCITECH SOFTWARE INC BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF -* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -* SOFTWARE. -* -* ====================================================================== -* -* Language: ANSI C -* Environment: Windows 9x/2000/XP/XBox (Win32) -* -* Description: Texture / Bitmap functions -* -****************************************************************************/ - -#include "dglcontext.h" -#include "ddlog.h" -#include "gld_dx7.h" - -//#include - -#include "texformat.h" -#include "colormac.h" -#include "texstore.h" -#include "image.h" -// #include "mem.h" - -//--------------------------------------------------------------------------- - -#define GLD_FLIP_HEIGHT(y,h) (gldCtx->dwHeight - (y) - (h)) - -D3DX_SURFACEFORMAT _gldD3DXFormatFromSurface(IDirectDrawSurface7 *pSurface); - -//--------------------------------------------------------------------------- -// 1D texture fetch -//--------------------------------------------------------------------------- - -#define CHAN_SRC( t, i, j, k, sz ) \ - ((GLchan *)(t)->Data + (i) * (sz)) -#define UBYTE_SRC( t, i, j, k, sz ) \ - ((GLubyte *)(t)->Data + (i) * (sz)) -#define USHORT_SRC( t, i, j, k ) \ - ((GLushort *)(t)->Data + (i)) -#define FLOAT_SRC( t, i, j, k ) \ - ((GLfloat *)(t)->Data + (i)) - -//--------------------------------------------------------------------------- - -static void gld_fetch_1d_texel_X8R8G8B8( - const struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, GLchan *texel ) -{ - const GLchan *src = CHAN_SRC( texImage, i, j, k, 4 ); - GLchan *rgba = (GLchan *)texel; - rgba[RCOMP] = src[2]; - rgba[GCOMP] = src[1]; - rgba[BCOMP] = src[0]; - rgba[ACOMP] = CHAN_MAX; -} - -//--------------------------------------------------------------------------- - -static void gld_fetch_1d_texel_f_X8R8G8B8( - const struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel ) -{ - const GLchan *src = CHAN_SRC( texImage, i, j, k, 4 ); - texel[RCOMP] = CHAN_TO_FLOAT(src[0]); - texel[GCOMP] = CHAN_TO_FLOAT(src[1]); - texel[BCOMP] = CHAN_TO_FLOAT(src[2]); - texel[ACOMP] = 1.f; -} - -//--------------------------------------------------------------------------- - -static void gld_fetch_1d_texel_X1R5G5B5( - const struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, GLchan *texel ) -{ - const GLushort *src = USHORT_SRC( texImage, i, j, k ); - GLchan *rgba = (GLchan *) texel; GLushort s = *src; - rgba[RCOMP] = UBYTE_TO_CHAN( ((s >> 10) & 0xf8) * 255 / 0xf8 ); - rgba[GCOMP] = UBYTE_TO_CHAN( ((s >> 5) & 0xf8) * 255 / 0xf8 ); - rgba[BCOMP] = UBYTE_TO_CHAN( ((s ) & 0xf8) * 255 / 0xf8 ); - rgba[ACOMP] = CHAN_MAX; -} - -//--------------------------------------------------------------------------- - -static void gld_fetch_1d_texel_f_X1R5G5B5( - const struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel ) -{ - const GLushort *src = USHORT_SRC( texImage, i, j, k ); - GLushort s = *src; - texel[RCOMP] = UBYTE_TO_FLOAT( ((s >> 10) & 0xf8) * 255 / 0xf8 ); - texel[GCOMP] = UBYTE_TO_FLOAT( ((s >> 5) & 0xf8) * 255 / 0xf8 ); - texel[BCOMP] = UBYTE_TO_FLOAT( ((s ) & 0xf8) * 255 / 0xf8 ); - texel[ACOMP] = 1.f; -} - -//--------------------------------------------------------------------------- - -static void gld_fetch_1d_texel_X4R4G4B4( - const struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, GLchan *texel ) -{ - const GLushort *src = USHORT_SRC( texImage, i, j, k ); - GLchan *rgba = (GLchan *) texel; GLushort s = *src; - rgba[RCOMP] = UBYTE_TO_CHAN( ((s >> 8) & 0xf) * 255 / 0xf ); - rgba[GCOMP] = UBYTE_TO_CHAN( ((s >> 4) & 0xf) * 255 / 0xf ); - rgba[BCOMP] = UBYTE_TO_CHAN( ((s ) & 0xf) * 255 / 0xf ); - rgba[ACOMP] = CHAN_MAX; -} - -//--------------------------------------------------------------------------- - -static void gld_fetch_1d_texel_f_X4R4G4B4( - const struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel ) -{ - const GLushort *src = USHORT_SRC( texImage, i, j, k ); - GLushort s = *src; - texel[RCOMP] = UBYTE_TO_FLOAT( ((s >> 8) & 0xf) * 255 / 0xf ); - texel[GCOMP] = UBYTE_TO_FLOAT( ((s >> 4) & 0xf) * 255 / 0xf ); - texel[BCOMP] = UBYTE_TO_FLOAT( ((s ) & 0xf) * 255 / 0xf ); - texel[ACOMP] = 1.f; -} - -//--------------------------------------------------------------------------- - -#undef CHAN_SRC -#undef UBYTE_SRC -#undef USHORT_SRC -#undef FLOAT_SRC - -//--------------------------------------------------------------------------- -// 2D texture fetch -//--------------------------------------------------------------------------- - -#define CHAN_SRC( t, i, j, k, sz ) \ - ((GLchan *)(t)->Data + ((t)->Width * (j) + (i)) * (sz)) -#define UBYTE_SRC( t, i, j, k, sz ) \ - ((GLubyte *)(t)->Data + ((t)->Width * (j) + (i)) * (sz)) -#define USHORT_SRC( t, i, j, k ) \ - ((GLushort *)(t)->Data + ((t)->Width * (j) + (i))) -#define FLOAT_SRC( t, i, j, k ) \ - ((GLfloat *)(t)->Data + ((t)->Width * (j) + (i))) - -//--------------------------------------------------------------------------- - -static void gld_fetch_2d_texel_X8R8G8B8( - const struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, GLchan *texel ) -{ - const GLchan *src = CHAN_SRC( texImage, i, j, k, 4 ); - GLchan *rgba = (GLchan *)texel; - rgba[RCOMP] = src[2]; - rgba[GCOMP] = src[1]; - rgba[BCOMP] = src[0]; - rgba[ACOMP] = CHAN_MAX; -} - -//--------------------------------------------------------------------------- - -static void gld_fetch_2d_texel_f_X8R8G8B8( - const struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel ) -{ - const GLchan *src = CHAN_SRC( texImage, i, j, k, 4 ); - texel[RCOMP] = CHAN_TO_FLOAT(src[0]); - texel[GCOMP] = CHAN_TO_FLOAT(src[1]); - texel[BCOMP] = CHAN_TO_FLOAT(src[2]); - texel[ACOMP] = 1.f; -} - -//--------------------------------------------------------------------------- - -static void gld_fetch_2d_texel_X1R5G5B5( - const struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, GLchan *texel ) -{ - const GLushort *src = USHORT_SRC( texImage, i, j, k ); - GLchan *rgba = (GLchan *) texel; GLushort s = *src; - rgba[RCOMP] = UBYTE_TO_CHAN( ((s >> 10) & 0xf8) * 255 / 0xf8 ); - rgba[GCOMP] = UBYTE_TO_CHAN( ((s >> 5) & 0xf8) * 255 / 0xf8 ); - rgba[BCOMP] = UBYTE_TO_CHAN( ((s ) & 0xf8) * 255 / 0xf8 ); - rgba[ACOMP] = CHAN_MAX; -} - -//--------------------------------------------------------------------------- - -static void gld_fetch_2d_texel_f_X1R5G5B5( - const struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel ) -{ - const GLushort *src = USHORT_SRC( texImage, i, j, k ); - GLushort s = *src; - texel[RCOMP] = UBYTE_TO_FLOAT( ((s >> 10) & 0xf8) * 255 / 0xf8 ); - texel[GCOMP] = UBYTE_TO_FLOAT( ((s >> 5) & 0xf8) * 255 / 0xf8 ); - texel[BCOMP] = UBYTE_TO_FLOAT( ((s ) & 0xf8) * 255 / 0xf8 ); - texel[ACOMP] = 1.f; -} - -//--------------------------------------------------------------------------- - -static void gld_fetch_2d_texel_X4R4G4B4( - const struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, GLchan *texel ) -{ - const GLushort *src = USHORT_SRC( texImage, i, j, k ); - GLchan *rgba = (GLchan *) texel; GLushort s = *src; - rgba[RCOMP] = UBYTE_TO_CHAN( ((s >> 8) & 0xf) * 255 / 0xf ); - rgba[GCOMP] = UBYTE_TO_CHAN( ((s >> 4) & 0xf) * 255 / 0xf ); - rgba[BCOMP] = UBYTE_TO_CHAN( ((s ) & 0xf) * 255 / 0xf ); - rgba[ACOMP] = CHAN_MAX; -} - -//--------------------------------------------------------------------------- - -static void gld_fetch_2d_texel_f_X4R4G4B4( - const struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel ) -{ - const GLushort *src = USHORT_SRC( texImage, i, j, k ); - GLushort s = *src; - texel[RCOMP] = UBYTE_TO_FLOAT( ((s >> 8) & 0xf) * 255 / 0xf ); - texel[GCOMP] = UBYTE_TO_FLOAT( ((s >> 4) & 0xf) * 255 / 0xf ); - texel[BCOMP] = UBYTE_TO_FLOAT( ((s ) & 0xf) * 255 / 0xf ); - texel[ACOMP] = 1.f; -} - -//--------------------------------------------------------------------------- - -#undef CHAN_SRC -#undef UBYTE_SRC -#undef USHORT_SRC -#undef FLOAT_SRC - -//--------------------------------------------------------------------------- -// 3D texture fetch -//--------------------------------------------------------------------------- - -#define CHAN_SRC( t, i, j, k, sz ) \ - (GLchan *)(t)->Data + (((t)->Height * (k) + (j)) * \ - (t)->Width + (i)) * (sz) -#define UBYTE_SRC( t, i, j, k, sz ) \ - ((GLubyte *)(t)->Data + (((t)->Height * (k) + (j)) * \ - (t)->Width + (i)) * (sz)) -#define USHORT_SRC( t, i, j, k ) \ - ((GLushort *)(t)->Data + (((t)->Height * (k) + (j)) * \ - (t)->Width + (i))) -#define FLOAT_SRC( t, i, j, k ) \ - ((GLfloat *)(t)->Data + (((t)->Height * (k) + (j)) * \ - (t)->Width + (i))) - -//--------------------------------------------------------------------------- - -static void gld_fetch_3d_texel_X8R8G8B8( - const struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, GLchan *texel ) -{ - const GLchan *src = CHAN_SRC( texImage, i, j, k, 4 ); - GLchan *rgba = (GLchan *)texel; - rgba[RCOMP] = src[2]; - rgba[GCOMP] = src[1]; - rgba[BCOMP] = src[0]; - rgba[ACOMP] = CHAN_MAX; -} - -//--------------------------------------------------------------------------- - -static void gld_fetch_3d_texel_f_X8R8G8B8( - const struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel ) -{ - const GLchan *src = CHAN_SRC( texImage, i, j, k, 4 ); - texel[RCOMP] = CHAN_TO_FLOAT(src[0]); - texel[GCOMP] = CHAN_TO_FLOAT(src[1]); - texel[BCOMP] = CHAN_TO_FLOAT(src[2]); - texel[ACOMP] = 1.f; -} - -//--------------------------------------------------------------------------- - -static void gld_fetch_3d_texel_X1R5G5B5( - const struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, GLchan *texel ) -{ - const GLushort *src = USHORT_SRC( texImage, i, j, k ); - GLchan *rgba = (GLchan *) texel; GLushort s = *src; - rgba[RCOMP] = UBYTE_TO_CHAN( ((s >> 10) & 0xf8) * 255 / 0xf8 ); - rgba[GCOMP] = UBYTE_TO_CHAN( ((s >> 5) & 0xf8) * 255 / 0xf8 ); - rgba[BCOMP] = UBYTE_TO_CHAN( ((s ) & 0xf8) * 255 / 0xf8 ); - rgba[ACOMP] = CHAN_MAX; -} - -//--------------------------------------------------------------------------- - -static void gld_fetch_3d_texel_f_X1R5G5B5( - const struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel ) -{ - const GLushort *src = USHORT_SRC( texImage, i, j, k ); - GLushort s = *src; - texel[RCOMP] = UBYTE_TO_FLOAT( ((s >> 10) & 0xf8) * 255 / 0xf8 ); - texel[GCOMP] = UBYTE_TO_FLOAT( ((s >> 5) & 0xf8) * 255 / 0xf8 ); - texel[BCOMP] = UBYTE_TO_FLOAT( ((s ) & 0xf8) * 255 / 0xf8 ); - texel[ACOMP] = 1.f; -} - -//--------------------------------------------------------------------------- - -static void gld_fetch_3d_texel_X4R4G4B4( - const struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, GLchan *texel ) -{ - const GLushort *src = USHORT_SRC( texImage, i, j, k ); - GLchan *rgba = (GLchan *) texel; GLushort s = *src; - rgba[RCOMP] = UBYTE_TO_CHAN( ((s >> 8) & 0xf) * 255 / 0xf ); - rgba[GCOMP] = UBYTE_TO_CHAN( ((s >> 4) & 0xf) * 255 / 0xf ); - rgba[BCOMP] = UBYTE_TO_CHAN( ((s ) & 0xf) * 255 / 0xf ); - rgba[ACOMP] = CHAN_MAX; -} - -//--------------------------------------------------------------------------- - -static void gld_fetch_3d_texel_f_X4R4G4B4( - const struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel ) -{ - const GLushort *src = USHORT_SRC( texImage, i, j, k ); - GLushort s = *src; - texel[RCOMP] = UBYTE_TO_FLOAT( ((s >> 8) & 0xf) * 255 / 0xf ); - texel[GCOMP] = UBYTE_TO_FLOAT( ((s >> 4) & 0xf) * 255 / 0xf ); - texel[BCOMP] = UBYTE_TO_FLOAT( ((s ) & 0xf) * 255 / 0xf ); - texel[ACOMP] = 1.f; -} - -//--------------------------------------------------------------------------- - -#undef CHAN_SRC -#undef UBYTE_SRC -#undef USHORT_SRC -#undef FLOAT_SRC - -//--------------------------------------------------------------------------- -// Direct3D texture formats that have no Mesa equivalent -//--------------------------------------------------------------------------- - -const struct gl_texture_format _gld_texformat_X8R8G8B8 = { - MESA_FORMAT_ARGB8888, /* MesaFormat */ - GL_RGBA, /* BaseFormat */ - GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ - 8, /* RedBits */ - 8, /* GreenBits */ - 8, /* BlueBits */ - 0, /* AlphaBits */ - 0, /* LuminanceBits */ - 0, /* IntensityBits */ - 0, /* IndexBits */ - 0, /* DepthBits */ - 4, /* TexelBytes */ - _mesa_texstore_argb8888, /* StoreTexImageFunc */ - gld_fetch_1d_texel_X8R8G8B8, /* FetchTexel1D */ - gld_fetch_2d_texel_X8R8G8B8, /* FetchTexel2D */ - gld_fetch_3d_texel_X8R8G8B8, /* FetchTexel3D */ - gld_fetch_1d_texel_f_X8R8G8B8, /* FetchTexel1Df */ - gld_fetch_2d_texel_f_X8R8G8B8, /* FetchTexel2Df */ - gld_fetch_3d_texel_f_X8R8G8B8, /* FetchTexel3Df */ -}; - -const struct gl_texture_format _gld_texformat_X1R5G5B5 = { - MESA_FORMAT_ARGB1555, /* MesaFormat */ - GL_RGBA, /* BaseFormat */ - GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ - 5, /* RedBits */ - 5, /* GreenBits */ - 5, /* BlueBits */ - 0, /* AlphaBits */ - 0, /* LuminanceBits */ - 0, /* IntensityBits */ - 0, /* IndexBits */ - 0, /* DepthBits */ - 2, /* TexelBytes */ - _mesa_texstore_argb1555, /* StoreTexImageFunc */ - gld_fetch_1d_texel_X1R5G5B5, /* FetchTexel1D */ - gld_fetch_2d_texel_X1R5G5B5, /* FetchTexel2D */ - gld_fetch_3d_texel_X1R5G5B5, /* FetchTexel3D */ - gld_fetch_1d_texel_f_X1R5G5B5, /* FetchTexel1Df */ - gld_fetch_2d_texel_f_X1R5G5B5, /* FetchTexel2Df */ - gld_fetch_3d_texel_f_X1R5G5B5, /* FetchTexel3Df */ -}; - -const struct gl_texture_format _gld_texformat_X4R4G4B4 = { - MESA_FORMAT_ARGB4444, /* MesaFormat */ - GL_RGBA, /* BaseFormat */ - GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ - 4, /* RedBits */ - 4, /* GreenBits */ - 4, /* BlueBits */ - 0, /* AlphaBits */ - 0, /* LuminanceBits */ - 0, /* IntensityBits */ - 0, /* IndexBits */ - 0, /* DepthBits */ - 2, /* TexelBytes */ - _mesa_texstore_argb4444, /* StoreTexImageFunc */ - gld_fetch_1d_texel_X4R4G4B4, /* FetchTexel1D */ - gld_fetch_2d_texel_X4R4G4B4, /* FetchTexel2D */ - gld_fetch_3d_texel_X4R4G4B4, /* FetchTexel3D */ - gld_fetch_1d_texel_f_X4R4G4B4, /* FetchTexel1Df */ - gld_fetch_2d_texel_f_X4R4G4B4, /* FetchTexel2Df */ - gld_fetch_3d_texel_f_X4R4G4B4, /* FetchTexel3Df */ -}; - -//--------------------------------------------------------------------------- -// Texture unit constants -//--------------------------------------------------------------------------- - -// List of possible combinations of texture environments. -// Example: GLD_TEXENV_MODULATE_RGBA means -// GL_MODULATE, GL_RGBA base internal format. -#define GLD_TEXENV_DECAL_RGB 0 -#define GLD_TEXENV_DECAL_RGBA 1 -#define GLD_TEXENV_DECAL_ALPHA 2 -#define GLD_TEXENV_REPLACE_RGB 3 -#define GLD_TEXENV_REPLACE_RGBA 4 -#define GLD_TEXENV_REPLACE_ALPHA 5 -#define GLD_TEXENV_MODULATE_RGB 6 -#define GLD_TEXENV_MODULATE_RGBA 7 -#define GLD_TEXENV_MODULATE_ALPHA 8 -#define GLD_TEXENV_BLEND_RGB 9 -#define GLD_TEXENV_BLEND_RGBA 10 -#define GLD_TEXENV_BLEND_ALPHA 11 -#define GLD_TEXENV_ADD_RGB 12 -#define GLD_TEXENV_ADD_RGBA 13 -#define GLD_TEXENV_ADD_ALPHA 14 - -// Per-stage (i.e. per-unit) texture environment -typedef struct { - DWORD ColorArg1; // Colour argument 1 - D3DTEXTUREOP ColorOp; // Colour operation - DWORD ColorArg2; // Colour argument 2 - DWORD AlphaArg1; // Alpha argument 1 - D3DTEXTUREOP AlphaOp; // Alpha operation - DWORD AlphaArg2; // Alpha argument 2 -} GLD_texenv; - -// TODO: Do we really need to set ARG1 and ARG2 every time? -// They seem to always be TEXTURE and CURRENT respectively. - -// C = Colour out -// A = Alpha out -// Ct = Colour from Texture -// Cf = Colour from fragment (diffuse) -// At = Alpha from Texture -// Af = Alpha from fragment (diffuse) -// Cc = GL_TEXTURE_ENV_COLOUR (GL_BLEND) -const GLD_texenv gldTexEnv[] = { - // DECAL_RGB: C=Ct, A=Af - {D3DTA_TEXTURE, D3DTOP_SELECTARG1, D3DTA_CURRENT, - D3DTA_TEXTURE, D3DTOP_SELECTARG2, D3DTA_CURRENT}, - // DECAL_RGBA: C=Cf(1-At)+CtAt, A=Af - {D3DTA_TEXTURE, D3DTOP_BLENDTEXTUREALPHA, D3DTA_CURRENT, - D3DTA_TEXTURE, D3DTOP_SELECTARG2, D3DTA_CURRENT}, - // DECAL_ALPHA: use DECAL_RGB - {D3DTA_TEXTURE, D3DTOP_SELECTARG1, D3DTA_CURRENT, - D3DTA_TEXTURE, D3DTOP_SELECTARG2, D3DTA_CURRENT}, - - // REPLACE_RGB: C=Ct, A=Af - {D3DTA_TEXTURE, D3DTOP_SELECTARG1, D3DTA_CURRENT, - D3DTA_TEXTURE, D3DTOP_SELECTARG2, D3DTA_CURRENT}, - // REPLACE_RGBA: C=Ct, A=At - {D3DTA_TEXTURE, D3DTOP_SELECTARG1, D3DTA_CURRENT, - D3DTA_TEXTURE, D3DTOP_SELECTARG1, D3DTA_CURRENT}, - // REPLACE_ALPHA: C=Cf, A=At - {D3DTA_TEXTURE, D3DTOP_SELECTARG2, D3DTA_CURRENT, - D3DTA_TEXTURE, D3DTOP_SELECTARG1, D3DTA_CURRENT}, - - // MODULATE_RGB: C=CfCt, A=Af - {D3DTA_TEXTURE, D3DTOP_MODULATE, D3DTA_CURRENT, - D3DTA_TEXTURE, D3DTOP_SELECTARG2, D3DTA_CURRENT}, - // MODULATE_RGBA: C=CfCt, A=AfAt - {D3DTA_TEXTURE, D3DTOP_MODULATE, D3DTA_CURRENT, - D3DTA_TEXTURE, D3DTOP_MODULATE, D3DTA_CURRENT}, - // MODULATE_ALPHA: C=Cf, A=AfAt - {D3DTA_TEXTURE, D3DTOP_SELECTARG2, D3DTA_CURRENT, - D3DTA_TEXTURE, D3DTOP_MODULATE, D3DTA_CURRENT}, - - // - // DX7 Does not support D3DTOP_LERP - // Emulate(?) via D3DTOP_ADDSMOOTH - // -#if 0 - // BLEND_RGB: C=Cf(1-Ct)+CcCt, A=Af - {D3DTA_TEXTURE, D3DTOP_LERP, D3DTA_CURRENT, - D3DTA_TEXTURE, D3DTOP_SELECTARG2, D3DTA_CURRENT}, - // BLEND_RGBA: C=Cf(1-Ct)+CcCt, A=AfAt - {D3DTA_TEXTURE, D3DTOP_LERP, D3DTA_CURRENT, - D3DTA_TEXTURE, D3DTOP_MODULATE, D3DTA_CURRENT}, -#else - // BLEND_RGB: C=Cf(1-Ct)+CcCt, A=Af - {D3DTA_TEXTURE, D3DTOP_ADDSMOOTH, D3DTA_CURRENT, - D3DTA_TEXTURE, D3DTOP_SELECTARG2, D3DTA_CURRENT}, - // BLEND_RGBA: C=Cf(1-Ct)+CcCt, A=AfAt - {D3DTA_TEXTURE, D3DTOP_ADDSMOOTH, D3DTA_CURRENT, - D3DTA_TEXTURE, D3DTOP_MODULATE, D3DTA_CURRENT}, -#endif - // BLEND_ALPHA: C=Cf, A=AfAt - {D3DTA_TEXTURE, D3DTOP_SELECTARG2, D3DTA_CURRENT, - D3DTA_TEXTURE, D3DTOP_MODULATE, D3DTA_CURRENT}, - - // ADD_RGB: C=Cf+Ct, A=Af - {D3DTA_TEXTURE, D3DTOP_ADD, D3DTA_CURRENT, - D3DTA_TEXTURE, D3DTOP_SELECTARG2, D3DTA_CURRENT}, - // ADD_RGBA: C=Cf+Ct, A=AfAt - {D3DTA_TEXTURE, D3DTOP_ADD, D3DTA_CURRENT, - D3DTA_TEXTURE, D3DTOP_MODULATE, D3DTA_CURRENT}, - // ADD_ALPHA: C=Cf, A=AfAt - {D3DTA_TEXTURE, D3DTOP_SELECTARG2, D3DTA_CURRENT, - D3DTA_TEXTURE, D3DTOP_MODULATE, D3DTA_CURRENT}, -}; - -//--------------------------------------------------------------------------- - -D3DTEXTUREADDRESS _gldConvertWrap( - GLenum wrap) -{ -// ASSERT(wrap==GL_CLAMP || wrap==GL_REPEAT); - return (wrap == GL_CLAMP) ? D3DTADDRESS_CLAMP : D3DTADDRESS_WRAP; -} - -//--------------------------------------------------------------------------- - -D3DTEXTUREMAGFILTER _gldConvertMagFilter( - GLenum magfilter) -{ - ASSERT(magfilter==GL_LINEAR || magfilter==GL_NEAREST); - return (magfilter == GL_LINEAR) ? D3DTFG_LINEAR : D3DTFG_POINT; -} - -//--------------------------------------------------------------------------- - -void _gldConvertMinFilter( - GLenum minfilter, - D3DTEXTUREMINFILTER *min_filter, - D3DTEXTUREMIPFILTER *mip_filter) -{ - switch (minfilter) { - case GL_NEAREST: - *min_filter = D3DTFN_POINT; - *mip_filter = D3DTFP_NONE; - break; - case GL_LINEAR: - *min_filter = D3DTFN_LINEAR; - *mip_filter = D3DTFP_NONE; - break; - case GL_NEAREST_MIPMAP_NEAREST: - *min_filter = D3DTFN_POINT; - *mip_filter = D3DTFP_POINT; - break; - case GL_LINEAR_MIPMAP_NEAREST: - *min_filter = D3DTFN_LINEAR; - *mip_filter = D3DTFP_POINT; - break; - case GL_NEAREST_MIPMAP_LINEAR: - *min_filter = D3DTFN_POINT; - *mip_filter = D3DTFP_LINEAR; - break; - case GL_LINEAR_MIPMAP_LINEAR: - *min_filter = D3DTFN_LINEAR; - *mip_filter = D3DTFP_LINEAR; - break; - default: - ASSERT(0); - } -} - -//--------------------------------------------------------------------------- - -D3DX_SURFACEFORMAT _gldGLFormatToD3DFormat( - GLenum internalFormat) -{ - switch (internalFormat) { - case GL_INTENSITY: - case GL_INTENSITY4: - case GL_INTENSITY8: - case GL_INTENSITY12: - case GL_INTENSITY16: - // LUNIMANCE != INTENSITY, but D3D doesn't have I8 textures - return D3DX_SF_L8; - case 1: - case GL_LUMINANCE: - case GL_LUMINANCE4: - case GL_LUMINANCE8: - case GL_LUMINANCE12: - case GL_LUMINANCE16: - return D3DX_SF_L8; - case GL_ALPHA: - case GL_ALPHA4: - case GL_ALPHA8: - case GL_ALPHA12: - case GL_ALPHA16: - return D3DX_SF_A8; - case GL_COLOR_INDEX: - case GL_COLOR_INDEX1_EXT: - case GL_COLOR_INDEX2_EXT: - case GL_COLOR_INDEX4_EXT: - case GL_COLOR_INDEX8_EXT: - case GL_COLOR_INDEX12_EXT: - case GL_COLOR_INDEX16_EXT: - return D3DX_SF_X8R8G8B8; - case 2: - case GL_LUMINANCE_ALPHA: - case GL_LUMINANCE4_ALPHA4: - case GL_LUMINANCE6_ALPHA2: - case GL_LUMINANCE8_ALPHA8: - case GL_LUMINANCE12_ALPHA4: - case GL_LUMINANCE12_ALPHA12: - case GL_LUMINANCE16_ALPHA16: - return D3DX_SF_A8L8; - case GL_R3_G3_B2: - // TODO: Mesa does not support RGB332 internally - return D3DX_SF_X4R4G4B4; //D3DFMT_R3G3B2; - case GL_RGB4: - return D3DX_SF_X4R4G4B4; - case GL_RGB5: - return D3DX_SF_R5G5B5; - case 3: - case GL_RGB: - case GL_RGB8: - case GL_RGB10: - case GL_RGB12: - case GL_RGB16: - return D3DX_SF_R8G8B8; - case GL_RGBA4: - return D3DX_SF_A4R4G4B4; - case 4: - case GL_RGBA: - case GL_RGBA2: - case GL_RGBA8: - case GL_RGB10_A2: - case GL_RGBA12: - case GL_RGBA16: - return D3DX_SF_A8R8G8B8; - case GL_RGB5_A1: - return D3DX_SF_A1R5G5B5; - } - - ASSERT(0); - - // Return an acceptable default - return D3DX_SF_A8R8G8B8; -} - -//--------------------------------------------------------------------------- - -GLenum _gldDecodeBaseFormat( - IDirectDrawSurface7 *pTex) -{ - // Examine Direct3D texture and return base OpenGL internal texture format - // NOTE: We can't use any base format info from Mesa because D3D might have - // used a different texture format when we used D3DXCreateTexture(). - - // Base internal format is one of (Red Book p355): - // GL_ALPHA, - // GL_LUMINANCE, - // GL_LUMINANCE_ALPHA, - // GL_INTENSITY, - // GL_RGB, - // GL_RGBA - - // NOTE: INTENSITY not used (not supported by Direct3D) - // LUMINANCE has same texture functions as RGB - // LUMINANCE_ALPHA has same texture functions as RGBA - - // TODO: cache format instead of using GetLevelDesc() -// D3DSURFACE_DESC desc; -// _GLD_DX7_TEX(GetLevelDesc(pTex, 0, &desc)); - - D3DX_SURFACEFORMAT sf; - - sf = _gldD3DXFormatFromSurface(pTex); - - switch (sf) { - case D3DX_SF_R8G8B8: - case D3DX_SF_X8R8G8B8: - case D3DX_SF_R5G6B5: - case D3DX_SF_R5G5B5: - case D3DX_SF_R3G3B2: - case D3DX_SF_X4R4G4B4: - case D3DX_SF_PALETTE8: - case D3DX_SF_L8: - return GL_RGB; - case D3DX_SF_A8R8G8B8: - case D3DX_SF_A1R5G5B5: - case D3DX_SF_A4R4G4B4: -// case D3DX_SF_A8R3G3B2: // Unsupported by DX7 -// case D3DX_SF_A8P8: // Unsupported by DX7 - case D3DX_SF_A8L8: -// case D3DX_SF_A4L4: // Unsupported by DX7 - return GL_RGBA; - case D3DX_SF_A8: - return GL_ALPHA; - // Compressed texture formats. Need to check these... - case D3DX_SF_DXT1: - return GL_RGBA; -// case D3DX_SF_DXT2: // Unsupported by DX7 - return GL_RGB; - case D3DX_SF_DXT3: - return GL_RGBA; -// case D3DX_SF_DXT4: // Unsupported by DX7 - return GL_RGB; - case D3DX_SF_DXT5: - return GL_RGBA; - } - - // Fell through. Return arbitary default. - ASSERT(0); // BANG! - return GL_RGBA; -} - -//--------------------------------------------------------------------------- - -const struct gl_texture_format* _gldMesaFormatForD3DFormat( - D3DX_SURFACEFORMAT d3dfmt) -{ - switch (d3dfmt) { - case D3DX_SF_A8R8G8B8: - return &_mesa_texformat_argb8888; - case D3DX_SF_R8G8B8: - return &_mesa_texformat_rgb888; - case D3DX_SF_R5G6B5: - return &_mesa_texformat_rgb565; - case D3DX_SF_A4R4G4B4: - return &_mesa_texformat_argb4444; - case D3DX_SF_A1R5G5B5: - return &_mesa_texformat_argb1555; - case D3DX_SF_A8L8: - return &_mesa_texformat_al88; - case D3DX_SF_R3G3B2: - return &_mesa_texformat_rgb332; - case D3DX_SF_A8: - return &_mesa_texformat_a8; - case D3DX_SF_L8: - return &_mesa_texformat_l8; - case D3DX_SF_X8R8G8B8: - return &_gld_texformat_X8R8G8B8; - case D3DX_SF_R5G5B5: - return &_gld_texformat_X1R5G5B5; - case D3DX_SF_X4R4G4B4: - return &_gld_texformat_X4R4G4B4; - } - - // If we reach here then we've made an error somewhere else - // by allowing a format that is not supported. - ASSERT(0); - - return NULL; // Shut up compiler warning -} - -//--------------------------------------------------------------------------- - -D3DX_SURFACEFORMAT _gldD3DXFormatFromSurface( - IDirectDrawSurface7 *pSurface) -{ - DDPIXELFORMAT ddpf; - - ddpf.dwSize = sizeof(ddpf); - - // Obtain pixel format of surface - _GLD_DX7_TEX(GetPixelFormat(pSurface, &ddpf)); - // Decode to D3DX surface format - return D3DXMakeSurfaceFormat(&ddpf); -} - -//--------------------------------------------------------------------------- - -void _gldClearSurface( - IDirectDrawSurface *pSurface, - D3DCOLOR dwColour) -{ - DDBLTFX bltFX; // Used for colour fill - - // Initialise struct - bltFX.dwSize = sizeof(bltFX); - // Set clear colour - bltFX.dwFillColor = dwColour; - // Clear surface. HW accelerated if available. - IDirectDrawSurface7_Blt(pSurface, NULL, NULL, NULL, DDBLT_COLORFILL, &bltFX); -} - -//--------------------------------------------------------------------------- -// Copy* functions -//--------------------------------------------------------------------------- - -void gldCopyTexImage1D_DX7( - GLcontext *ctx, - GLenum target, GLint level, - GLenum internalFormat, - GLint x, GLint y, - GLsizei width, GLint border ) -{ - // TODO -} - -//--------------------------------------------------------------------------- - -void gldCopyTexImage2D_DX7( - GLcontext *ctx, - GLenum target, - GLint level, - GLenum internalFormat, - GLint x, - GLint y, - GLsizei width, - GLsizei height, - GLint border) -{ - // TODO -} - -//--------------------------------------------------------------------------- - -void gldCopyTexSubImage1D_DX7( - GLcontext *ctx, - GLenum target, GLint level, - GLint xoffset, GLint x, GLint y, GLsizei width ) -{ - // TODO -} - -//--------------------------------------------------------------------------- - -void gldCopyTexSubImage2D_DX7( - GLcontext *ctx, - GLenum target, - GLint level, - GLint xoffset, - GLint yoffset, - GLint x, - GLint y, - GLsizei width, - GLsizei height) -{ - // TODO -} - -//--------------------------------------------------------------------------- - -void gldCopyTexSubImage3D_DX7( - GLcontext *ctx, - GLenum target, - GLint level, - GLint xoffset, - GLint yoffset, - GLint zoffset, - GLint x, - GLint y, - GLsizei width, - GLsizei height ) -{ - // TODO ? -} - -//--------------------------------------------------------------------------- -// Bitmap/Pixel functions -//--------------------------------------------------------------------------- - -#define GLD_FLIP_Y(y) (gldCtx->dwHeight - (y)) - -#define _GLD_FVF_IMAGE (D3DFVF_XYZRHW | D3DFVF_TEX1) - -typedef struct { - FLOAT x, y; // 2D raster coords - FLOAT z; // depth value - FLOAT rhw; // reciprocal homogenous W (always 1.0f) - FLOAT tu, tv; // texture coords -} _GLD_IMAGE_VERTEX; - -//--------------------------------------------------------------------------- - -HRESULT _gldDrawPixels( - GLcontext *ctx, - BOOL bChromakey, // Alpha test for glBitmap() images - GLint x, // GL x position - GLint y, // GL y position (needs flipping) - GLsizei width, // Width of input image - GLsizei height, // Height of input image - IDirectDrawSurface7 *pImage) -{ - // - // Draw input image as texture implementing PixelZoom and clipping. - // Any fragment operations currently enabled will be used. - // - - // NOTE: This DX7 version does not create a new texture in which - // to copy the input image, as the image is already a texture. - - GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); - GLD_driver_dx7 *gld = GLD_GET_DX7_DRIVER(gldCtx); - - DDSURFACEDESC2 ddsd; - _GLD_IMAGE_VERTEX v[4]; - - float ZoomWidth, ZoomHeight; - float ScaleWidth, ScaleHeight; - - // Fixup for rasterisation rules - const float cfEpsilon = 1.0f / (float)height; - - // - // Set up the quad like this (ascii-art ahead!) - // - // 3--2 - // | | - // 0--1 - // - // - - // Set depth - v[0].z = v[1].z = v[2].z = v[3].z = ctx->Current.RasterPos[2]; - // Set Reciprocal Homogenous W - v[0].rhw = v[1].rhw = v[2].rhw = v[3].rhw = 1.0f; - - // Set texcoords - // Examine texture size - if different to input width and height - // then we'll need to munge the texcoords to fit. - ddsd.dwSize = sizeof(DDSURFACEDESC2); - IDirectDrawSurface7_GetSurfaceDesc(pImage, &ddsd); - ScaleWidth = (float)width / (float)ddsd.dwWidth; - ScaleHeight = (float)height / (float)ddsd.dwHeight; - v[0].tu = 0.0f; v[0].tv = 0.0f; - v[1].tu = ScaleWidth; v[1].tv = 0.0f; - v[2].tu = ScaleWidth; v[2].tv = ScaleHeight; - v[3].tu = 0.0f; v[3].tv = ScaleHeight; - - // Set raster positions - ZoomWidth = (float)width * ctx->Pixel.ZoomX; - ZoomHeight = (float)height * ctx->Pixel.ZoomY; - - v[0].x = x; v[0].y = GLD_FLIP_Y(y+cfEpsilon); - v[1].x = x+ZoomWidth; v[1].y = GLD_FLIP_Y(y+cfEpsilon); - v[2].x = x+ZoomWidth; v[2].y = GLD_FLIP_Y(y+ZoomHeight+cfEpsilon); - v[3].x = x; v[3].y = GLD_FLIP_Y(y+ZoomHeight+cfEpsilon); - - // Draw image with full HW acceleration - // NOTE: Be nice to use a State Block for all this state... - IDirect3DDevice7_SetTexture(gld->pDev, 0, pImage); - IDirect3DDevice7_SetRenderState(gld->pDev, D3DRENDERSTATE_CULLMODE, D3DCULL_NONE); - IDirect3DDevice7_SetRenderState(gld->pDev, D3DRENDERSTATE_CLIPPING, TRUE); - IDirect3DDevice7_SetTextureStageState(gld->pDev, 0, D3DTSS_MINFILTER, D3DTFN_POINT); - IDirect3DDevice7_SetTextureStageState(gld->pDev, 0, D3DTSS_MIPFILTER, D3DTFP_POINT); - IDirect3DDevice7_SetTextureStageState(gld->pDev, 0, D3DTSS_MAGFILTER, D3DTFG_POINT); - IDirect3DDevice7_SetTextureStageState(gld->pDev, 0, D3DTSS_ADDRESSU, D3DTADDRESS_CLAMP); - IDirect3DDevice7_SetTextureStageState(gld->pDev, 0, D3DTSS_ADDRESSV, D3DTADDRESS_CLAMP); - IDirect3DDevice7_SetTextureStageState(gld->pDev, 0, D3DTSS_COLOROP, D3DTOP_SELECTARG1); - IDirect3DDevice7_SetTextureStageState(gld->pDev, 0, D3DTSS_ALPHAOP, D3DTOP_SELECTARG1); - IDirect3DDevice7_SetTextureStageState(gld->pDev, 0, D3DTSS_COLORARG1, D3DTA_TEXTURE); - IDirect3DDevice7_SetTextureStageState(gld->pDev, 0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE); - // Ensure texture unit 1 is disabled - IDirect3DDevice7_SetTextureStageState(gld->pDev, 1, D3DTSS_COLOROP, D3DTOP_DISABLE); - IDirect3DDevice7_SetTextureStageState(gld->pDev, 1, D3DTSS_ALPHAOP, D3DTOP_DISABLE); - - // - // Emulate Chromakey with an Alpha Test. - // [Alpha Test is more widely supported anyway] - // - if (bChromakey) { - // Switch on alpha testing - IDirect3DDevice7_SetRenderState(gld->pDev, D3DRENDERSTATE_ALPHATESTENABLE, TRUE); - // Fragment passes is alpha is greater than reference value - IDirect3DDevice7_SetRenderState(gld->pDev, D3DRENDERSTATE_ALPHAFUNC, D3DCMP_GREATER); - // Set alpha reference value between Bitmap alpha values of - // zero (transparent) and one (opaque). - IDirect3DDevice7_SetRenderState(gld->pDev, D3DRENDERSTATE_ALPHAREF, 0x7f); - } - - IDirect3DDevice7_DrawPrimitive(gld->pDev, D3DPT_TRIANGLEFAN, _GLD_FVF_IMAGE, &v, 4, 0); - - // Reset state to before we messed it up - FLUSH_VERTICES(ctx, _NEW_ALL); - - return S_OK; -} - -//--------------------------------------------------------------------------- - -void gld_DrawPixels_DX7( - GLcontext *ctx, - GLint x, GLint y, GLsizei width, GLsizei height, - GLenum format, GLenum type, - const struct gl_pixelstore_attrib *unpack, - const GLvoid *pixels ) -{ - GLD_context *gldCtx; - GLD_driver_dx7 *gld; - - IDirectDrawSurface7 *pImage; - HRESULT hr; - DDSURFACEDESC2 ddsd; - DWORD dwFlags; - D3DX_SURFACEFORMAT sf; - DWORD dwMipmaps; - - const struct gl_texture_format *MesaFormat; - - MesaFormat = _mesa_choose_tex_format(ctx, format, format, type); - - gldCtx = GLD_GET_CONTEXT(ctx); - gld = GLD_GET_DX7_DRIVER(gldCtx); - - dwFlags = D3DX_TEXTURE_NOMIPMAP; - sf = D3DX_SF_A8R8G8B8; - dwMipmaps = 1; - - hr = D3DXCreateTexture( - gld->pDev, - &dwFlags, - &width, &height, - &sf, // format - NULL, // palette - &pImage, // Output texture - &dwMipmaps); - if (FAILED(hr)) { - return; - } - - // D3DXCreateTexture() may not clear the texture is creates. - _gldClearSurface(pImage, 0); - - // - // Use Mesa to fill in image - // - - // Lock all of surface - ddsd.dwSize = sizeof(DDSURFACEDESC2); - dwFlags = DDLOCK_SURFACEMEMORYPTR | DDLOCK_WAIT; - hr = IDirectDrawSurface7_Lock(pImage, NULL, &ddsd, dwFlags, NULL); - if (FAILED(hr)) { - SAFE_RELEASE_SURFACE7(pImage); - return; - } - - // unpack image, apply transfer ops and store directly in texture - MesaFormat->StoreImage( - ctx, - 2, - GL_RGBA, - &_mesa_texformat_argb8888, - ddsd.lpSurface, - width, height, 1, 0, 0, 0, - ddsd.lPitch, - 0, /* dstImageStride */ - format, type, pixels, unpack); - - IDirectDrawSurface7_Unlock(pImage, NULL); - - _gldDrawPixels(ctx, FALSE, x, y, width, height, pImage); - - SAFE_RELEASE_SURFACE7(pImage); -} - -//--------------------------------------------------------------------------- - -void gld_ReadPixels_DX7( - GLcontext *ctx, - GLint x, GLint y, GLsizei width, GLsizei height, - GLenum format, GLenum type, - const struct gl_pixelstore_attrib *pack, - GLvoid *dest) -{ -// TODO -#if 0 - GLD_context *gldCtx; - GLD_driver_dx7 *gld; - - IDirect3DSurface8 *pBackbuffer = NULL; - IDirect3DSurface8 *pNativeImage = NULL; - IDirect3DSurface8 *pCanonicalImage = NULL; - - D3DSURFACE_DESC d3dsd; - RECT rcSrc; // Source rect - POINT ptDst; // Dest point - HRESULT hr; - D3DLOCKED_RECT d3dLockedRect; - struct gl_pixelstore_attrib srcPacking; - int i; - GLint DstRowStride; - const struct gl_texture_format *MesaFormat; - - switch (format) { - case GL_STENCIL_INDEX: - case GL_DEPTH_COMPONENT: - return; - } - - MesaFormat = _mesa_choose_tex_format(ctx, format, format, type); - DstRowStride = _mesa_image_row_stride(pack, width, format, type); - - gldCtx = GLD_GET_CONTEXT(ctx); - gld = GLD_GET_DX7_DRIVER(gldCtx); - - // Get backbuffer - hr = IDirect3DDevice8_GetBackBuffer( - gld->pDev, - 0, // First backbuffer - D3DBACKBUFFER_TYPE_MONO, - &pBackbuffer); - if (FAILED(hr)) - return; - - // Get backbuffer description - hr = IDirect3DSurface8_GetDesc(pBackbuffer, &d3dsd); - if (FAILED(hr)) { - goto gld_ReadPixels_DX7_return; - } - - // Create a surface compatible with backbuffer - hr = IDirect3DDevice8_CreateImageSurface( - gld->pDev, - width, - height, - d3dsd.Format, - &pNativeImage); - if (FAILED(hr)) { - goto gld_ReadPixels_DX7_return; - } - - // Compute source rect and dest point - SetRect(&rcSrc, 0, 0, width, height); - OffsetRect(&rcSrc, x, GLD_FLIP_HEIGHT(y, height)); - ptDst.x = ptDst.y = 0; - - // Get source pixels. - // - // This intermediate surface ensure that we can use CopyRects() - // instead of relying on D3DXLoadSurfaceFromSurface(), which may - // try and lock the backbuffer. This way seems safer. - // - hr = IDirect3DDevice8_CopyRects( - gld->pDev, - pBackbuffer, - &rcSrc, - 1, - pNativeImage, - &ptDst); - if (FAILED(hr)) { - goto gld_ReadPixels_DX7_return; - } - - // Create an RGBA8888 surface - hr = IDirect3DDevice8_CreateImageSurface( - gld->pDev, - width, - height, - D3DFMT_A8R8G8B8, - &pCanonicalImage); - if (FAILED(hr)) { - goto gld_ReadPixels_DX7_return; - } - - // Convert to RGBA8888 - hr = D3DXLoadSurfaceFromSurface( - pCanonicalImage, // Dest surface - NULL, NULL, // Dest palette, RECT - pNativeImage, // Src surface - NULL, NULL, // Src palette, RECT - D3DX_FILTER_NONE, // Filter - 0); // Colourkey - if (FAILED(hr)) { - goto gld_ReadPixels_DX7_return; - } - - srcPacking.Alignment = 1; - srcPacking.ImageHeight = height; - srcPacking.LsbFirst = GL_FALSE; - srcPacking.RowLength = 0; - srcPacking.SkipImages = 0; - srcPacking.SkipPixels = 0; - srcPacking.SkipRows = 0; - srcPacking.SwapBytes = GL_FALSE; - - // Lock all of image - hr = IDirect3DSurface8_LockRect(pCanonicalImage, &d3dLockedRect, NULL, 0); - if (FAILED(hr)) { - goto gld_ReadPixels_DX7_return; - } - - // We need to flip the data. Yuck. - // Perhaps Mesa has a span packer we can use in future... - for (i=0; iTexFormat->StoreImage( - ctx, - 2, - GL_RGBA, // base format - MesaFormat, // dst format - pDestRow, // dest addr - width, 1, 1, 0, 0, 0, // src x,y,z & dst offsets x,y,z - DstRowStride, // dst row stride - 0, // dstImageStride - GL_BGRA, // src format - GL_UNSIGNED_BYTE, // src type - pSrcRow, // src addr - &srcPacking); // packing params of source image - } - - IDirect3DSurface8_UnlockRect(pCanonicalImage); - -gld_ReadPixels_DX7_return: - SAFE_RELEASE_SURFACE8(pCanonicalImage); - SAFE_RELEASE_SURFACE8(pNativeImage); - SAFE_RELEASE_SURFACE8(pBackbuffer); -#endif -} - -//--------------------------------------------------------------------------- - -void gld_CopyPixels_DX7( - GLcontext *ctx, - GLint srcx, - GLint srcy, - GLsizei width, - GLsizei height, - GLint dstx, - GLint dsty, - GLenum type) -{ -// TODO -#if 0 - // - // NOTE: Not allowed to copy vidmem to vidmem! - // Therefore we use an intermediate image surface. - // - - GLD_context *gldCtx; - GLD_driver_dx7 *gld; - - IDirect3DSurface8 *pBackbuffer; - D3DSURFACE_DESC d3dsd; - IDirect3DSurface8 *pImage; - RECT rcSrc; // Source rect - POINT ptDst; // Dest point - HRESULT hr; - - // Only backbuffer - if (type != GL_COLOR) - return; - - gldCtx = GLD_GET_CONTEXT(ctx); - gld = GLD_GET_DX7_DRIVER(gldCtx); - - // Get backbuffer - hr = IDirect3DDevice8_GetBackBuffer( - gld->pDev, - 0, // First backbuffer - D3DBACKBUFFER_TYPE_MONO, - &pBackbuffer); - if (FAILED(hr)) - return; - - // Get backbuffer description - hr = IDirect3DSurface8_GetDesc(pBackbuffer, &d3dsd); - if (FAILED(hr)) { - IDirect3DSurface8_Release(pBackbuffer); - return; - } - - // Create a surface compatible with backbuffer - hr = IDirect3DDevice8_CreateImageSurface( - gld->pDev, - width, - height, - d3dsd.Format, - &pImage); - if (FAILED(hr)) { - IDirect3DSurface8_Release(pBackbuffer); - return; - } - - // Compute source rect and dest point - SetRect(&rcSrc, 0, 0, width, height); - OffsetRect(&rcSrc, srcx, GLD_FLIP_HEIGHT(srcy, height)); - ptDst.x = ptDst.y = 0; - - // Get source pixels - hr = IDirect3DDevice8_CopyRects( - gld->pDev, - pBackbuffer, - &rcSrc, - 1, - pImage, - &ptDst); - IDirect3DSurface8_Release(pBackbuffer); - if (FAILED(hr)) { - IDirect3DSurface8_Release(pImage); - return; - } - - _gldDrawPixels(ctx, FALSE, dstx, dsty, width, height, pImage); - - IDirect3DSurface8_Release(pImage); -#endif -} - -//--------------------------------------------------------------------------- - -void gld_Bitmap_DX7( - GLcontext *ctx, - GLint x, - GLint y, - GLsizei width, - GLsizei height, - const struct gl_pixelstore_attrib *unpack, - const GLubyte *bitmap) -{ - GLD_context *gldCtx; - GLD_driver_dx7 *gld; - - IDirectDrawSurface7 *pImage; // Bitmap texture - HRESULT hr; - BYTE *pTempBitmap; // Pointer to unpacked bitmap - D3DCOLOR clBitmapOne; // Opaque bitmap colour - D3DCOLOR clBitmapZero; // Transparent bitmap colour - D3DCOLOR *pBits; // Pointer to texture surface - const GLubyte *src; - int i, j, k; - - DDSURFACEDESC2 ddsd; // Surface desc returned by lock call - DWORD dwFlags; - D3DX_SURFACEFORMAT sf; - DWORD dwMipmaps; - - // Keep a copy of width/height as D3DXCreateTexture() call may alter input dimensions - GLsizei dwWidth = width; - GLsizei dwHeight = height; - - gldCtx = GLD_GET_CONTEXT(ctx); - gld = GLD_GET_DX7_DRIVER(gldCtx); - - // Bail if no bitmap (only raster pos is updated) - if ((bitmap == NULL) && (width==0) && (height==0)) - return; - - // - // TODO: Detect conditions when created texture (pImage) is non-pow2. - // Texture coords may need to be adjusted to compensate. - // - - clBitmapZero = D3DCOLOR_RGBA(0,0,0,0); // NOTE: Alpha is Zero - clBitmapOne = D3DCOLOR_COLORVALUE( - ctx->Current.RasterColor[0], - ctx->Current.RasterColor[1], - ctx->Current.RasterColor[2], - 1.0f); // NOTE: Alpha is One - - // Use Mesa to unpack bitmap into a canonical format - pTempBitmap = _mesa_unpack_bitmap(width, height, bitmap, unpack); - if (pTempBitmap == NULL) - return; - - // Flags for texture creation - dwFlags = D3DX_TEXTURE_NOMIPMAP; - sf = D3DX_SF_A8R8G8B8; - dwMipmaps = 1; - - // Create a D3D texture to hold the bitmap - hr = D3DXCreateTexture( - gld->pDev, - &dwFlags, - &dwWidth, &dwHeight, - &sf, // format - NULL, // palette - &pImage, // Output texture - &dwMipmaps); - if (FAILED(hr)) { - FREE(pTempBitmap); - return; - } - - // D3DXCreateTexture may return a texture bigger than we asked for - // (i.e. padded to POW2) so let's clear the entire image bitmap. - // Additional: Looks like this is not strictly necessary. -// _gldClearSurface(pImage, clBitmapZero); - - ddsd.dwSize = sizeof(DDSURFACEDESC2); - dwFlags = DDLOCK_SURFACEMEMORYPTR | DDLOCK_WAIT; - hr = IDirectDrawSurface7_Lock(pImage, NULL, &ddsd, dwFlags, NULL); - if (FAILED(hr)) { - FREE(pTempBitmap); - SAFE_RELEASE_SURFACE7(pImage); - return; - } - -#if 0 - // DEBUG CODE - if (!(width==ddsd.dwWidth && height==ddsd.dwHeight)) - ddlogPrintf(GLDLOG_WARN, "gld_Bitmap: In=%d,%d / Tex=%d,%d", width,height,ddsd.dwWidth,ddsd.dwHeight); -#endif - -#if 0 - // DEBUG CODE - ddlogPrintf(GLDLOG_SYSTEM, "gld_Bitmap: In=%d,%d / Tex=%d,%d", width,height,ddsd.dwWidth,ddsd.dwHeight); - ddlogPrintf(GLDLOG_SYSTEM, "gld_Bitmap: bpp=%d", ddsd.ddpfPixelFormat.dwRGBBitCount); -#endif - - // Cast texel pointer to texture surface. - // We can do this because we used D3DX_SF_A8R8G8B8 as the format - pBits = (D3DCOLOR*)ddsd.lpSurface; - - - // Copy from the input bitmap into the texture - for (i=0; iDefaultPacking, pTempBitmap, width, height, GL_COLOR_INDEX, GL_BITMAP, - 0, i, 0); - for (j=0; j<(width>>3); j++) { - byte = *src++; - for (k=0; k<8; k++) { - *pBits++ = (byte & 128) ? clBitmapOne : clBitmapZero; - byte <<= 1; - } - } - // Fill remaining bits from bitmap - if (width & 7) { - byte = *src; - for (k=0; k<(width & 7); k++) { - *pBits++ = (byte & 128) ? clBitmapOne : clBitmapZero; - byte <<= 1; - } - } - } - - // We're done with the unpacked bitmap - FREE(pTempBitmap); - - // Finished with texture surface - unlock it - IDirectDrawSurface7_Unlock(pImage, NULL); - - // Use internal function to draw bitmap onto rendertarget - _gldDrawPixels(ctx, TRUE, x, y, width, height, pImage); - - // We're done with the bitmap texure - release it - IDirectDrawSurface7_Release(pImage); -} - -//--------------------------------------------------------------------------- -// Texture functions -//--------------------------------------------------------------------------- - -void _gldAllocateTexture( - GLcontext *ctx, - struct gl_texture_object *tObj, - struct gl_texture_image *texImage) -{ - GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); - GLD_driver_dx7 *gld = GLD_GET_DX7_DRIVER(gldCtx); - - HRESULT hr; - IDirectDrawSurface7 *pTex; - D3DX_SURFACEFORMAT d3dFormat; - DWORD dwFlags; - DWORD dwMipmaps; - DWORD dwWidth, dwHeight; - - if (!tObj || !texImage) - return; - - pTex = (IDirectDrawSurface7*)tObj->DriverData; - if (pTex) { - // Decide whether we can keep existing D3D texture - // by examining top-level surface. - DDSURFACEDESC2 ddsd; - ddsd.dwSize = sizeof(DDSURFACEDESC2); - _GLD_DX7_TEX(GetSurfaceDesc(pTex, &ddsd)); - // Release existing texture if not compatible - if ((ddsd.dwWidth == texImage->Width) || - (ddsd.dwHeight == texImage->Height)) - { - return; // Keep the existing texture - } - tObj->DriverData = NULL; - _GLD_DX7_TEX(Release(pTex)); - } - - dwFlags = (glb.bUseMipmaps) ? 0 : D3DX_TEXTURE_NOMIPMAP; - dwMipmaps = (glb.bUseMipmaps) ? D3DX_DEFAULT : 1; - dwWidth = texImage->Width; - dwHeight = texImage->Height; - - d3dFormat = _gldGLFormatToD3DFormat(texImage->IntFormat); - hr = D3DXCreateTexture( - gld->pDev, - &dwFlags, - &dwWidth, - &dwHeight, - &d3dFormat, - NULL, - &pTex, - &dwMipmaps); - if (FAILED(hr)) { - gldLogError(GLDLOG_ERROR, "AllocateTexture failed", hr); - } - tObj->DriverData = pTex; -} - -//--------------------------------------------------------------------------- - -const struct gl_texture_format* gld_ChooseTextureFormat_DX7( - GLcontext *ctx, - GLint internalFormat, - GLenum srcFormat, - GLenum srcType) -{ - // [Based on mesa_choose_tex_format()] - // - // We will choose only texture formats that are supported - // by Direct3D. If the hardware doesn't support a particular - // texture format, then the D3DX texture calls that we use - // will automatically use a HW supported format. - // - // The most critical aim is to reduce copying; if we can use - // texture-image data directly then it will be a big performance assist. - // - - switch (internalFormat) { - case GL_INTENSITY: - case GL_INTENSITY4: - case GL_INTENSITY8: - case GL_INTENSITY12: - case GL_INTENSITY16: - return &_mesa_texformat_l8; // D3DFMT_L8 - case 1: - case GL_LUMINANCE: - case GL_LUMINANCE4: - case GL_LUMINANCE8: - case GL_LUMINANCE12: - case GL_LUMINANCE16: - return &_mesa_texformat_l8; // D3DFMT_L8 - case GL_ALPHA: - case GL_ALPHA4: - case GL_ALPHA8: - case GL_ALPHA12: - case GL_ALPHA16: - return &_mesa_texformat_a8; // D3DFMT_A8 - case GL_COLOR_INDEX: - case GL_COLOR_INDEX1_EXT: - case GL_COLOR_INDEX2_EXT: - case GL_COLOR_INDEX4_EXT: - case GL_COLOR_INDEX8_EXT: - case GL_COLOR_INDEX12_EXT: - case GL_COLOR_INDEX16_EXT: - return &_mesa_texformat_rgb565; // D3DFMT_R5G6B5 - // Mesa will convert this for us later... - // return &_mesa_texformat_ci8; // D3DFMT_R5G6B5 - case 2: - case GL_LUMINANCE_ALPHA: - case GL_LUMINANCE4_ALPHA4: - case GL_LUMINANCE6_ALPHA2: - case GL_LUMINANCE8_ALPHA8: - case GL_LUMINANCE12_ALPHA4: - case GL_LUMINANCE12_ALPHA12: - case GL_LUMINANCE16_ALPHA16: - return &_mesa_texformat_al88; // D3DFMT_A8L8 - case GL_R3_G3_B2: - return &_mesa_texformat_rgb332; // D3DFMT_R3G3B2 - case GL_RGB4: - case GL_RGBA4: - case GL_RGBA2: - return &_mesa_texformat_argb4444; // D3DFMT_A4R4G4B4 - case 3: - case GL_RGB: - case GL_RGB5: - case GL_RGB8: - case GL_RGB10: - case GL_RGB12: - case GL_RGB16: - return &_mesa_texformat_rgb565; - case 4: - case GL_RGBA: - case GL_RGBA8: - case GL_RGB10_A2: - case GL_RGBA12: - case GL_RGBA16: - return &_mesa_texformat_argb8888; - case GL_RGB5_A1: - return &_mesa_texformat_argb1555; - default: - _mesa_problem(NULL, "unexpected format in fxDDChooseTextureFormat"); - return NULL; - } -} - -//--------------------------------------------------------------------------- - -/* -// Safer(?), slower version. -void gld_TexImage2D_DX7( - GLcontext *ctx, - GLenum target, - GLint level, - GLint internalFormat, - GLint width, - GLint height, - GLint border, - GLenum format, - GLenum type, - const GLvoid *pixels, - const struct gl_pixelstore_attrib *packing, - struct gl_texture_object *tObj, - struct gl_texture_image *texImage) -{ - GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); - GLD_driver_dx7 *gld = GLD_GET_DX7_DRIVER(gldCtx); - - IDirect3DTexture8 *pTex; - IDirect3DSurface8 *pSurface; - RECT rcSrcRect; - HRESULT hr; - GLint texelBytes = 4; - GLvoid *tempImage; - - if (!tObj || !texImage) - return; - - if (level == 0) { - _gldAllocateTexture(ctx, tObj, texImage); - } - - pTex = (IDirect3DTexture8*)tObj->DriverData; - if (!pTex) - return; // Texture has not been created - if (level >= IDirect3DTexture8_GetLevelCount(pTex)) - return; // Level does not exist - hr = IDirect3DTexture8_GetSurfaceLevel(pTex, level, &pSurface); - if (FAILED(hr)) - return; // Surface level doesn't exist (or just a plain error) - - tempImage = MALLOC(width * height * texelBytes); - if (!tempImage) { - _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage2D"); - IDirect3DSurface8_Release(pSurface); - return; - } - // unpack image, apply transfer ops and store in tempImage - texImage->TexFormat->StoreImage(ctx, 2, texImage->Format, - &_mesa_texformat_argb8888, // dest format - tempImage, - width, height, 1, 0, 0, 0, - width * texelBytes, - 0, // dstImageStride - format, type, pixels, packing); - - SetRect(&rcSrcRect, 0, 0, width, height); - D3DXLoadSurfaceFromMemory( - pSurface, - NULL, - NULL, - tempImage, - D3DFMT_A8R8G8B8, - width * texelBytes, - NULL, - &rcSrcRect, - D3DX_FILTER_NONE, - 0); - - FREE(tempImage); - IDirect3DSurface8_Release(pSurface); -} -*/ - -//--------------------------------------------------------------------------- - -// Faster, more efficient version. -// Copies subimage straight to dest texture -void gld_TexImage2D_DX7( - GLcontext *ctx, - GLenum target, - GLint level, - GLint internalFormat, - GLint width, - GLint height, - GLint border, - GLenum format, - GLenum type, - const GLvoid *pixels, - const struct gl_pixelstore_attrib *packing, - struct gl_texture_object *tObj, - struct gl_texture_image *texImage) -{ - GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); - GLD_driver_dx7 *gld = GLD_GET_DX7_DRIVER(gldCtx); - - IDirectDrawSurface7 *pTex = NULL; - IDirectDrawSurface7 *pSurface = NULL; - HRESULT hr; - DDSURFACEDESC2 ddsd; - int i; - DDSCAPS2 ddsCaps; - - if (!tObj || !texImage) - return; - - // GLQUAKE FIX - // Test for input alpha data with non-alpha internalformat - if (((internalFormat==3) || (internalFormat==GL_RGB)) && (format==GL_RGBA)) { - // Input format has alpha, but a non-alpha format has been requested. - texImage->IntFormat = GL_RGBA; - internalFormat = GL_RGBA; - } - - if (level == 0) { - _gldAllocateTexture(ctx, tObj, texImage); - } - - pTex = (IDirectDrawSurface7*)tObj->DriverData; - if (!pTex) { - ASSERT(0); - return; // Texture has not been created - } - - pSurface = pTex; - if (level != 0) { - ddsd.dwSize = sizeof(ddsd); - _GLD_DX7_TEX(GetSurfaceDesc(pTex, &ddsd)); - if ((level > 0) && (level >= ddsd.dwMipMapCount)) - return; // Level does not exist - ZeroMemory(&ddsCaps, sizeof(ddsCaps)); - for (i=0; iTexFormat->StoreImage( - ctx, - 2, - texImage->Format, - //_gldMesaFormatForD3DFormat(d3dsd.Format), - _gldMesaFormatForD3DFormat(_gldD3DXFormatFromSurface(pSurface)), - ddsd.lpSurface, - width, height, 1, 0, 0, 0, - ddsd.lPitch, - 0, // dstImageStride - format, type, pixels, packing); - - IDirectDrawSurface7_Unlock(pSurface, NULL); -} - -//--------------------------------------------------------------------------- - -void gld_TexImage1D_DX7(GLcontext *ctx, GLenum target, GLint level, - GLint internalFormat, - GLint width, GLint border, - GLenum format, GLenum type, const GLvoid *pixels, - const struct gl_pixelstore_attrib *packing, - struct gl_texture_object *texObj, - struct gl_texture_image *texImage ) -{ - // A 1D texture is a 2D texture with a height of zero - gld_TexImage2D_DX7(ctx, target, level, internalFormat, width, 1, border, format, type, pixels, packing, texObj, texImage); -} - -//--------------------------------------------------------------------------- - -/* -void gld_TexSubImage2D( GLcontext *ctx, GLenum target, GLint level, - GLint xoffset, GLint yoffset, - GLsizei width, GLsizei height, - GLenum format, GLenum type, - const GLvoid *pixels, - const struct gl_pixelstore_attrib *packing, - struct gl_texture_object *tObj, - struct gl_texture_image *texImage ) -{ - GLD_GET_CONTEXT - IDirect3DTexture8 *pTex; - IDirect3DSurface8 *pSurface; - D3DFORMAT d3dFormat; - HRESULT hr; - GLint texelBytes = 4; - GLvoid *tempImage; - RECT rcSrcRect; - RECT rcDstRect; - - if (!tObj || !texImage) - return; - - pTex = (IDirect3DTexture8*)tObj->DriverData; - if (!pTex) - return; // Texture has not been created - if (level >= _GLD_DX8_TEX(GetLevelCount(pTex)) - return; // Level does not exist - hr = _GLD_DX8_TEX(GetSurfaceLevel(pTex, level, &pSurface); - if (FAILED(hr)) - return; // Surface level doesn't exist (or just a plain error) - - d3dFormat = _gldGLFormatToD3DFormat(texImage->Format); - tempImage = MALLOC(width * height * texelBytes); - if (!tempImage) { - _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage2D"); - IDirect3DSurface8_Release(pSurface); - return; - } - - // unpack image, apply transfer ops and store in tempImage - texImage->TexFormat->StoreImage(ctx, 2, texImage->Format, - &_mesa_texformat_argb8888, // dest format - tempImage, - width, height, 1, 0, 0, 0, - width * texelBytes, - 0, // dstImageStride - format, type, pixels, packing); - - // Source rectangle is whole of input image - SetRect(&rcSrcRect, 0, 0, width, height); - - // Dest rectangle must be offset to dest image - SetRect(&rcDstRect, 0, 0, width, height); - OffsetRect(&rcDstRect, xoffset, yoffset); - - D3DXLoadSurfaceFromMemory( - pSurface, - NULL, - &rcDstRect, - tempImage, - D3DFMT_A8R8G8B8, - width * texelBytes, - NULL, - &rcSrcRect, - D3DX_FILTER_NONE, - 0); - - FREE(tempImage); - IDirect3DSurface8_Release(pSurface); -} -*/ - -//--------------------------------------------------------------------------- - -// Faster, more efficient version. -// Copies subimage straight to dest texture -void gld_TexSubImage2D_DX7( GLcontext *ctx, GLenum target, GLint level, - GLint xoffset, GLint yoffset, - GLsizei width, GLsizei height, - GLenum format, GLenum type, - const GLvoid *pixels, - const struct gl_pixelstore_attrib *packing, - struct gl_texture_object *tObj, - struct gl_texture_image *texImage ) -{ - GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); - GLD_driver_dx7 *gld = GLD_GET_DX7_DRIVER(gldCtx); - - IDirectDrawSurface7 *pTex; - IDirectDrawSurface7 *pSurface; - HRESULT hr; - RECT rcDstRect; - DDSURFACEDESC2 ddsd; - int i; - DDSCAPS2 ddsCaps; - - if (!tObj || !texImage) - return; - - pTex = (IDirectDrawSurface7*)tObj->DriverData; - if (!pTex) - return; // Texture has not been created - - __try { - - ddsd.dwSize = sizeof(ddsd); - _GLD_DX7_TEX(GetSurfaceDesc(pTex, &ddsd)); - if ((level > 0) && (level >= ddsd.dwMipMapCount)) - return; // Level does not exist - - ZeroMemory(&ddsCaps, sizeof(ddsCaps)); - pSurface = pTex; - for (i=0; iTexFormat->StoreImage(ctx, 2, texImage->Format, - _gldMesaFormatForD3DFormat(_gldD3DXFormatFromSurface(pSurface)), - ddsd.lpSurface, - width, height, 1, - 0, 0, 0, // NOTE: d3dLockedRect.pBits is already offset!!! - ddsd.lPitch, - 0, // dstImageStride - format, type, pixels, packing); - - - IDirectDrawSurface7_Unlock(pSurface, &rcDstRect); - } - __except(EXCEPTION_EXECUTE_HANDLER) { - ; - } -} - -//--------------------------------------------------------------------------- - -void gld_TexSubImage1D_DX7( GLcontext *ctx, GLenum target, GLint level, - GLint xoffset, GLsizei width, - GLenum format, GLenum type, - const GLvoid *pixels, - const struct gl_pixelstore_attrib *packing, - struct gl_texture_object *texObj, - struct gl_texture_image *texImage ) -{ - gld_TexSubImage2D_DX7(ctx, target, level, xoffset, 0, width, 1, format, type, pixels, packing, texObj, texImage); -} - -//--------------------------------------------------------------------------- - -void gld_DeleteTexture_DX7( - GLcontext *ctx, - struct gl_texture_object *tObj) -{ - GLD_context *gld = (GLD_context*)(ctx->DriverCtx); - - __try { - - if (tObj) { - IDirectDrawSurface7 *pTex = (IDirectDrawSurface7*)tObj->DriverData; - if (pTex) { -/* // Make sure texture is not bound to a stage before releasing it - for (int i=0; iCurrentTexture[i] == pTex) { - gld->pDev->SetTexture(i, NULL); - gld->CurrentTexture[i] = NULL; - } - }*/ - _GLD_DX7_TEX(Release(pTex)); - tObj->DriverData = NULL; - } - } - - } - __except(EXCEPTION_EXECUTE_HANDLER) { - ; - } -} - -//--------------------------------------------------------------------------- - -__inline void _gldSetColorOps( - const GLD_driver_dx7 *gld, - GLuint unit, - DWORD ColorArg1, - D3DTEXTUREOP ColorOp, - DWORD ColorArg2) -{ - _GLD_DX7_DEV(SetTextureStageState(gld->pDev, unit, D3DTSS_COLORARG1, ColorArg1)); - _GLD_DX7_DEV(SetTextureStageState(gld->pDev, unit, D3DTSS_COLOROP, ColorOp)); - _GLD_DX7_DEV(SetTextureStageState(gld->pDev, unit, D3DTSS_COLORARG2, ColorArg2)); -} - -//--------------------------------------------------------------------------- - -__inline void _gldSetAlphaOps( - const GLD_driver_dx7 *gld, - GLuint unit, - DWORD AlphaArg1, - D3DTEXTUREOP AlphaOp, - DWORD AlphaArg2) -{ - _GLD_DX7_DEV(SetTextureStageState(gld->pDev, unit, D3DTSS_ALPHAARG1, AlphaArg1)); - _GLD_DX7_DEV(SetTextureStageState(gld->pDev, unit, D3DTSS_ALPHAOP, AlphaOp)); - _GLD_DX7_DEV(SetTextureStageState(gld->pDev, unit, D3DTSS_ALPHAARG2, AlphaArg2)); -} - -//--------------------------------------------------------------------------- - -void gldUpdateTextureUnit( - GLcontext *ctx, - GLuint unit, - BOOL bPassThrough) -{ - GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); - GLD_driver_dx7 *gld = GLD_GET_DX7_DRIVER(gldCtx); - - D3DTEXTUREMINFILTER minfilter; - D3DTEXTUREMIPFILTER mipfilter; - GLenum BaseFormat; - DWORD dwColorArg0; - int iTexEnv = 0; - GLD_texenv *pTexenv; - - // NOTE: If bPassThrough is FALSE then texture stage can be - // disabled otherwise it must pass-through it's current fragment. - - const struct gl_texture_unit *pUnit = &ctx->Texture.Unit[unit]; - const struct gl_texture_object *tObj = pUnit->_Current; - - IDirectDrawSurface7 *pTex = NULL; - if (tObj) { - pTex = (IDirectDrawSurface7*)tObj->DriverData; - } - - __try { - - // Enable texturing if unit is enabled and a valid D3D texture exists - // Mesa 5: TEXTUREn_x altered to TEXTURE_nD_BIT - //if (pTex && (pUnit->Enabled & (TEXTURE0_1D | TEXTURE0_2D))) { - if (pTex && (pUnit->_ReallyEnabled & (TEXTURE_1D_BIT | TEXTURE_2D_BIT))) { - // Enable texturing - _GLD_DX7_DEV(SetTexture(gld->pDev, unit, pTex)); - } else { - // Disable texturing, then return - _GLD_DX7_DEV(SetTexture(gld->pDev, unit, NULL)); - if (bPassThrough) { - _gldSetColorOps(gld, unit, D3DTA_TEXTURE, D3DTOP_SELECTARG2, D3DTA_DIFFUSE); - _gldSetAlphaOps(gld, unit, D3DTA_TEXTURE, D3DTOP_SELECTARG2, D3DTA_DIFFUSE); - } else { - _gldSetColorOps(gld, unit, D3DTA_TEXTURE, D3DTOP_DISABLE, D3DTA_DIFFUSE); - _gldSetAlphaOps(gld, unit, D3DTA_TEXTURE, D3DTOP_DISABLE, D3DTA_DIFFUSE); - } - return; - } - - // Texture parameters - _gldConvertMinFilter(tObj->MinFilter, &minfilter, &mipfilter); - _GLD_DX7_DEV(SetTextureStageState(gld->pDev, unit, D3DTSS_MINFILTER, minfilter)); - _GLD_DX7_DEV(SetTextureStageState(gld->pDev, unit, D3DTSS_MIPFILTER, mipfilter)); - _GLD_DX7_DEV(SetTextureStageState(gld->pDev, unit, D3DTSS_MAGFILTER, _gldConvertMagFilter(tObj->MagFilter))); - _GLD_DX7_DEV(SetTextureStageState(gld->pDev, unit, D3DTSS_ADDRESSU, _gldConvertWrap(tObj->WrapS))); - _GLD_DX7_DEV(SetTextureStageState(gld->pDev, unit, D3DTSS_ADDRESSV, _gldConvertWrap(tObj->WrapT))); - - // Texture priority - _GLD_DX7_TEX(SetPriority(pTex, (DWORD)(tObj->Priority*65535.0f))); - - // Texture environment - // TODO: Examine input texture for alpha and use specific alpha/non-alpha ops. - // See Page 355 of the Red Book. - BaseFormat = _gldDecodeBaseFormat(pTex); - - switch (BaseFormat) { - case GL_RGB: - iTexEnv = 0; - break; - case GL_RGBA: - iTexEnv = 1; - break; - case GL_ALPHA: - iTexEnv = 2; - break; - } - - switch (pUnit->EnvMode) { - case GL_DECAL: - iTexEnv += 0; - break; - case GL_REPLACE: - iTexEnv += 3; - break; - case GL_MODULATE: - iTexEnv += 6; - break; - case GL_BLEND: - // Set blend colour - // Unsupported by DX7 -// dwColorArg0 = D3DCOLOR_COLORVALUE(pUnit->EnvColor[0], pUnit->EnvColor[1], pUnit->EnvColor[2], pUnit->EnvColor[3]); -// _GLD_DX7_DEV(SetTextureStageState(gld->pDev, unit, D3DTSS_COLORARG0, dwColorArg0)); -// gldLogMessage(GLDLOG_WARN, "GL_BLEND\n"); - iTexEnv += 9; - break; - case GL_ADD: - iTexEnv += 12; - break; - } - pTexenv = (GLD_texenv*)&gldTexEnv[iTexEnv]; - _gldSetColorOps(gld, unit, pTexenv->ColorArg1, pTexenv->ColorOp, pTexenv->ColorArg2); - _gldSetAlphaOps(gld, unit, pTexenv->AlphaArg1, pTexenv->AlphaOp, pTexenv->AlphaArg2); - - } - __except(EXCEPTION_EXECUTE_HANDLER) { - ; - } -} - -//--------------------------------------------------------------------------- - -void gld_NEW_TEXTURE_DX7( - GLcontext *ctx) -{ - // TODO: Support for three (ATI Radeon) or more (nVidia GeForce3) texture units - - BOOL bUnit0Enabled; - BOOL bUnit1Enabled; - - if (!ctx) - return; // Sanity check - - if (ctx->Const.MaxTextureUnits == 1) { - gldUpdateTextureUnit(ctx, 0, TRUE); - return; - } - - // - // NOTE: THE FOLLOWING RELATES TO TWO TEXTURE UNITS, AND TWO ONLY!! - // - - // Mesa 5: Texture Units altered - bUnit0Enabled = (ctx->Texture.Unit[0]._ReallyEnabled & (TEXTURE_1D_BIT | TEXTURE_2D_BIT)) ? TRUE : FALSE; - bUnit1Enabled = (ctx->Texture.Unit[1]._ReallyEnabled & (TEXTURE_1D_BIT | TEXTURE_2D_BIT)) ? TRUE : FALSE; - - // If Unit0 is disabled and Unit1 is enabled then we must pass-though - gldUpdateTextureUnit(ctx, 0, (!bUnit0Enabled && bUnit1Enabled) ? TRUE : FALSE); - // We can always disable the last texture unit - gldUpdateTextureUnit(ctx, 1, FALSE); - -#ifdef _DEBUG - { - // Find out whether device supports current renderstates - GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); - GLD_driver_dx7 *gld = GLD_GET_DX7_DRIVER(gldCtx); - - DWORD dwPasses; - _GLD_DX7_DEV(ValidateDevice(gld->pDev, &dwPasses)); -#if 0 - if (FAILED(hr)) { - gldLogError(GLDLOG_ERROR, "ValidateDevice failed", hr); - } -#endif - if (dwPasses != 1) { - gldLogMessage(GLDLOG_ERROR, "ValidateDevice: Can't do in one pass\n"); - } - } -#endif -}; - -//--------------------------------------------------------------------------- diff --git a/src/mesa/drivers/windows/gldirect/dx7/gld_vb_d3d_render_dx7.c b/src/mesa/drivers/windows/gldirect/dx7/gld_vb_d3d_render_dx7.c deleted file mode 100644 index a85620dde8..0000000000 --- a/src/mesa/drivers/windows/gldirect/dx7/gld_vb_d3d_render_dx7.c +++ /dev/null @@ -1,257 +0,0 @@ -/**************************************************************************** -* -* Mesa 3-D graphics library -* Direct3D Driver Interface -* -* ======================================================================== -* -* Copyright (C) 1991-2004 SciTech Software, Inc. All rights reserved. -* -* Permission is hereby granted, free of charge, to any person obtaining a -* copy of this software and associated documentation files (the "Software"), -* to deal in the Software without restriction, including without limitation -* the rights to use, copy, modify, merge, publish, distribute, sublicense, -* and/or sell copies of the Software, and to permit persons to whom the -* Software is furnished to do so, subject to the following conditions: -* -* The above copyright notice and this permission notice shall be included -* in all copies or substantial portions of the Software. -* -* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -* SCITECH SOFTWARE INC BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF -* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -* SOFTWARE. -* -* ====================================================================== -* -* Language: ANSI C -* Environment: Windows 9x/2000/XP/XBox (Win32) -* -* Description: GLDirect fastpath pipeline stage -* -****************************************************************************/ - -//--------------------------------------------------------------------------- - -//#include "../GLDirect.h" -//#include "../gld_log.h" -//#include "gld_dx8.h" - -#include "dglcontext.h" -#include "ddlog.h" -#include "gld_dx7.h" - -//--------------------------------------------------------------------------- - -#include "glheader.h" -#include "context.h" -#include "macros.h" -// #include "mem.h" -#include "mtypes.h" -//#include "mmath.h" - -#include "math/m_matrix.h" -#include "math/m_xform.h" - -#include "tnl/t_pipeline.h" - -//--------------------------------------------------------------------------- -/* -__inline void _gldSetVertexShaderConstants( - GLcontext *ctx, - GLD_driver_dx8 *gld) -{ - D3DXMATRIX mat, matView, matProj; - GLfloat *pM; - - // Mesa 5: Altered to a Stack - //pM = ctx->ModelView.m; - pM = ctx->ModelviewMatrixStack.Top->m; - matView._11 = pM[0]; - matView._12 = pM[1]; - matView._13 = pM[2]; - matView._14 = pM[3]; - matView._21 = pM[4]; - matView._22 = pM[5]; - matView._23 = pM[6]; - matView._24 = pM[7]; - matView._31 = pM[8]; - matView._32 = pM[9]; - matView._33 = pM[10]; - matView._34 = pM[11]; - matView._41 = pM[12]; - matView._42 = pM[13]; - matView._43 = pM[14]; - matView._44 = pM[15]; - - // Mesa 5: Altered to a Stack - //pM = ctx->ProjectionMatrix.m; - pM = ctx->ProjectionMatrixStack.Top->m; - matProj._11 = pM[0]; - matProj._12 = pM[1]; - matProj._13 = pM[2]; - matProj._14 = pM[3]; - matProj._21 = pM[4]; - matProj._22 = pM[5]; - matProj._23 = pM[6]; - matProj._24 = pM[7]; - matProj._31 = pM[8]; - matProj._32 = pM[9]; - matProj._33 = pM[10]; - matProj._34 = pM[11]; - matProj._41 = pM[12]; - matProj._42 = pM[13]; - matProj._43 = pM[14]; - matProj._44 = pM[15]; - - D3DXMatrixMultiply( &mat, &matView, &matProj ); - D3DXMatrixTranspose( &mat, &mat ); - - _GLD_DX8_DEV(SetVertexShaderConstant(gld->pDev, 0, &mat, 4)); -} -*/ -//--------------------------------------------------------------------------- - -static GLboolean gld_d3d_render_stage_run( - GLcontext *ctx, - struct tnl_pipeline_stage *stage) -{ - GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); - GLD_driver_dx7 *gld = GLD_GET_DX7_DRIVER(gldCtx); - - TNLcontext *tnl; - struct vertex_buffer *VB; - tnl_render_func *tab; - GLint pass; - GLD_pb_dx7 *gldPB = &gld->PB3d; - DWORD dwFlags; - -/* - static int count = 0; - count++; - if (count != 2) - return GL_FALSE; -*/ - // The "check" function should disable this stage, - // but we'll test gld->bUseMesaTnL anyway. - if (gld->bUseMesaTnL) { - // Do nothing in this stage, but continue pipeline - return GL_TRUE; - } - - tnl = TNL_CONTEXT(ctx); - VB = &tnl->vb; - pass = 0; - - tnl->Driver.Render.Start( ctx ); - -#if 0 - // For debugging: Useful to see if an app passes colour data in - // an unusual format. - switch (VB->ColorPtr[0]->Type) { - case GL_FLOAT: - ddlogMessage(GLDLOG_SYSTEM, "ColorPtr: GL_FLOAT\n"); - break; - case GL_UNSIGNED_BYTE: - ddlogMessage(GLDLOG_SYSTEM, "ColorPtr: GL_UNSIGNED_BYTE\n"); - break; - default: - ddlogMessage(GLDLOG_SYSTEM, "ColorPtr: *?*\n"); - break; - } -#endif - - tnl->Driver.Render.Points = gld_Points3D_DX7; - if (ctx->_TriangleCaps & DD_FLATSHADE) { - tnl->Driver.Render.Line = gld_Line3DFlat_DX7; - tnl->Driver.Render.Triangle = gld_Triangle3DFlat_DX7; - tnl->Driver.Render.Quad = gld_Quad3DFlat_DX7; - } else { - tnl->Driver.Render.Line = gld_Line3DSmooth_DX7; - tnl->Driver.Render.Triangle = gld_Triangle3DSmooth_DX7; - tnl->Driver.Render.Quad = gld_Quad3DSmooth_DX7; - } - -// _GLD_DX7_VB(Lock(gldPB->pVB, 0, 0, &gldPB->pPoints, D3DLOCK_DISCARD)); - dwFlags = DDLOCK_DISCARDCONTENTS | DDLOCK_WAIT | DDLOCK_SURFACEMEMORYPTR | DDLOCK_WRITEONLY; - _GLD_DX7_VB(Lock(gldPB->pVB, dwFlags, &gldPB->pPoints, NULL)); - gldPB->nPoints = gldPB->nLines = gldPB->nTriangles = 0; - // Allocate primitive pointers - // gldPB->pPoints is always first - gldPB->pLines = gldPB->pPoints + (gldPB->dwStride * gldPB->iFirstLine); - gldPB->pTriangles = gldPB->pPoints + (gldPB->dwStride * gldPB->iFirstTriangle); - - ASSERT(tnl->Driver.Render.BuildVertices); - ASSERT(tnl->Driver.Render.PrimitiveNotify); - ASSERT(tnl->Driver.Render.Points); - ASSERT(tnl->Driver.Render.Line); - ASSERT(tnl->Driver.Render.Triangle); - ASSERT(tnl->Driver.Render.Quad); - ASSERT(tnl->Driver.Render.ResetLineStipple); - ASSERT(tnl->Driver.Render.Interp); - ASSERT(tnl->Driver.Render.CopyPV); - ASSERT(tnl->Driver.Render.ClippedLine); - ASSERT(tnl->Driver.Render.ClippedPolygon); - ASSERT(tnl->Driver.Render.Finish); - - tab = (VB->Elts ? tnl->Driver.Render.PrimTabElts : tnl->Driver.Render.PrimTabVerts); - - do { - GLuint i, length, flags = 0; - for (i = 0 ; !(flags & PRIM_END) ; i += length) - { - flags = VB->Primitive[i].mode; - length= VB->Primitive[i].count; - ASSERT(length || (flags & PRIM_END)); - ASSERT((flags & PRIM_MODE_MASK) <= GL_POLYGON+1); - if (length) - tab[flags & PRIM_MODE_MASK]( ctx, i, i + length, flags ); - } - } while (tnl->Driver.Render.Multipass && - tnl->Driver.Render.Multipass( ctx, ++pass )); - - _GLD_DX7_VB(Unlock(gldPB->pVB)); - -// _GLD_DX7_DEV(SetStreamSource(gld->pDev, 0, gldPB->pVB, gldPB->dwStride)); - - _GLD_DX7_DEV(SetTransform(gld->pDev, D3DTRANSFORMSTATE_PROJECTION, &gld->matProjection)); - _GLD_DX7_DEV(SetTransform(gld->pDev, D3DTRANSFORMSTATE_WORLD, &gld->matModelView)); - - if (gldPB->nPoints) { -// _GLD_DX7_DEV(DrawPrimitive(gld->pDev, D3DPT_POINTLIST, 0, gldPB->nPoints)); - _GLD_DX7_DEV(DrawPrimitiveVB(gld->pDev, D3DPT_POINTLIST, gldPB->pVB, 0, gldPB->nPoints, 0)); - gldPB->nPoints = 0; - } - - if (gldPB->nLines) { -// _GLD_DX7_DEV(DrawPrimitive(gld->pDev, D3DPT_LINELIST, gldPB->iFirstLine, gldPB->nLines)); - _GLD_DX7_DEV(DrawPrimitiveVB(gld->pDev, D3DPT_LINELIST, gldPB->pVB, gldPB->iFirstLine, gldPB->nLines, 0)); - gldPB->nLines = 0; - } - - if (gldPB->nTriangles) { -// _GLD_DX7_DEV(DrawPrimitive(gld->pDev, D3DPT_TRIANGLELIST, gldPB->iFirstTriangle, gldPB->nTriangles)); - _GLD_DX7_DEV(DrawPrimitiveVB(gld->pDev, D3DPT_TRIANGLELIST, gldPB->pVB, gldPB->iFirstTriangle, gldPB->nTriangles, 0)); - gldPB->nTriangles = 0; - } - - return GL_FALSE; /* finished the pipe */ -} - - -//--------------------------------------------------------------------------- - -const struct tnl_pipeline_stage _gld_d3d_render_stage = -{ - "gld_d3d_render_stage", - NULL, - NULL, - NULL, - NULL, - gld_d3d_render_stage_run /* run */ -}; - -//--------------------------------------------------------------------------- diff --git a/src/mesa/drivers/windows/gldirect/dx7/gld_vb_mesa_render_dx7.c b/src/mesa/drivers/windows/gldirect/dx7/gld_vb_mesa_render_dx7.c deleted file mode 100644 index 72e5e1308c..0000000000 --- a/src/mesa/drivers/windows/gldirect/dx7/gld_vb_mesa_render_dx7.c +++ /dev/null @@ -1,422 +0,0 @@ - -/* - * Mesa 3-D graphics library - * Version: 3.5 - * - * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - * Authors: - * Keith Whitwell - */ - - -/* - * Render whole vertex buffers, including projection of vertices from - * clip space and clipping of primitives. - * - * This file makes calls to project vertices and to the point, line - * and triangle rasterizers via the function pointers: - * - * context->Driver.Render.* - * - */ - - -//--------------------------------------------------------------------------- - -//#include "../GLDirect.h" -//#include "../gld_log.h" -//#include "gld_dx8.h" - -#include "dglcontext.h" -#include "ddlog.h" -#include "gld_dx7.h" - -//--------------------------------------------------------------------------- - -#include "glheader.h" -#include "context.h" -#include "macros.h" -// #include "mem.h" -#include "mtypes.h" -//#include "mmath.h" - -#include "math/m_matrix.h" -#include "math/m_xform.h" - -#include "tnl/t_pipeline.h" - -/**********************************************************************/ -/* Clip single primitives */ -/**********************************************************************/ - - -#if defined(USE_IEEE) -#define NEGATIVE(x) (GET_FLOAT_BITS(x) & (1<<31)) -//#define DIFFERENT_SIGNS(x,y) ((GET_FLOAT_BITS(x) ^ GET_FLOAT_BITS(y)) & (1<<31)) -#else -#define NEGATIVE(x) (x < 0) -//#define DIFFERENT_SIGNS(x,y) (x * y <= 0 && x - y != 0) -/* Could just use (x*y<0) except for the flatshading requirements. - * Maybe there's a better way? - */ -#endif - - -#define W(i) coord[i][3] -#define Z(i) coord[i][2] -#define Y(i) coord[i][1] -#define X(i) coord[i][0] -#define SIZE 4 -#define TAG(x) x##_4 -#include "tnl/t_vb_cliptmp.h" - - - -/**********************************************************************/ -/* Clip and render whole begin/end objects */ -/**********************************************************************/ - -#define NEED_EDGEFLAG_SETUP (ctx->_TriangleCaps & DD_TRI_UNFILLED) -#define EDGEFLAG_GET(idx) VB->EdgeFlag[idx] -#define EDGEFLAG_SET(idx, val) VB->EdgeFlag[idx] = val - - -/* Vertices, with the possibility of clipping. - */ -#define RENDER_POINTS( start, count ) \ - tnl->Driver.Render.Points( ctx, start, count ) - -#define RENDER_LINE( v1, v2 ) \ -do { \ - GLubyte c1 = mask[v1], c2 = mask[v2]; \ - GLubyte ormask = c1|c2; \ - if (!ormask) \ - LineFunc( ctx, v1, v2 ); \ - else if (!(c1 & c2 & 0x3f)) \ - clip_line_4( ctx, v1, v2, ormask ); \ -} while (0) - -#define RENDER_TRI( v1, v2, v3 ) \ -do { \ - GLubyte c1 = mask[v1], c2 = mask[v2], c3 = mask[v3]; \ - GLubyte ormask = c1|c2|c3; \ - if (!ormask) \ - TriangleFunc( ctx, v1, v2, v3 ); \ - else if (!(c1 & c2 & c3 & 0x3f)) \ - clip_tri_4( ctx, v1, v2, v3, ormask ); \ -} while (0) - -#define RENDER_QUAD( v1, v2, v3, v4 ) \ -do { \ - GLubyte c1 = mask[v1], c2 = mask[v2]; \ - GLubyte c3 = mask[v3], c4 = mask[v4]; \ - GLubyte ormask = c1|c2|c3|c4; \ - if (!ormask) \ - QuadFunc( ctx, v1, v2, v3, v4 ); \ - else if (!(c1 & c2 & c3 & c4 & 0x3f)) \ - clip_quad_4( ctx, v1, v2, v3, v4, ormask ); \ -} while (0) - - -#define LOCAL_VARS \ - TNLcontext *tnl = TNL_CONTEXT(ctx); \ - struct vertex_buffer *VB = &tnl->vb; \ - const GLuint * const elt = VB->Elts; \ - const GLubyte *mask = VB->ClipMask; \ - const GLuint sz = VB->ClipPtr->size; \ - const tnl_line_func LineFunc = tnl->Driver.Render.Line; \ - const tnl_triangle_func TriangleFunc = tnl->Driver.Render.Triangle; \ - const tnl_quad_func QuadFunc = tnl->Driver.Render.Quad; \ - const GLboolean stipple = ctx->Line.StippleFlag; \ - (void) (LineFunc && TriangleFunc && QuadFunc); \ - (void) elt; (void) mask; (void) sz; (void) stipple; - -#define TAG(x) clip_##x##_verts -#define INIT(x) tnl->Driver.Render.PrimitiveNotify( ctx, x ) -#define RESET_STIPPLE if (stipple) tnl->Driver.Render.ResetLineStipple( ctx ) -#define PRESERVE_VB_DEFS -#include "tnl/t_vb_rendertmp.h" - - - -/* Elts, with the possibility of clipping. - */ -#undef ELT -#undef TAG -#define ELT(x) elt[x] -#define TAG(x) clip_##x##_elts -#include "tnl/t_vb_rendertmp.h" - -/* TODO: do this for all primitives, verts and elts: - */ -static void clip_elt_triangles( GLcontext *ctx, - GLuint start, - GLuint count, - GLuint flags ) -{ - TNLcontext *tnl = TNL_CONTEXT(ctx); - tnl_render_func render_tris = tnl->Driver.Render.PrimTabElts[GL_TRIANGLES]; - struct vertex_buffer *VB = &tnl->vb; - const GLuint * const elt = VB->Elts; - GLubyte *mask = VB->ClipMask; - GLuint last = count-2; - GLuint j; - (void) flags; - - tnl->Driver.Render.PrimitiveNotify( ctx, GL_TRIANGLES ); - - for (j=start; j < last; j+=3 ) { - GLubyte c1 = mask[elt[j]]; - GLubyte c2 = mask[elt[j+1]]; - GLubyte c3 = mask[elt[j+2]]; - GLubyte ormask = c1|c2|c3; - if (ormask) { - if (start < j) - render_tris( ctx, start, j, 0 ); - if (!(c1&c2&c3&0x3f)) - clip_tri_4( ctx, elt[j], elt[j+1], elt[j+2], ormask ); - start = j+3; - } - } - - if (start < j) - render_tris( ctx, start, j, 0 ); -} - -/**********************************************************************/ -/* Render whole begin/end objects */ -/**********************************************************************/ - -#define NEED_EDGEFLAG_SETUP (ctx->_TriangleCaps & DD_TRI_UNFILLED) -#define EDGEFLAG_GET(idx) VB->EdgeFlag[idx] -#define EDGEFLAG_SET(idx, val) VB->EdgeFlag[idx] = val - - -/* Vertices, no clipping. - */ -#define RENDER_POINTS( start, count ) \ - tnl->Driver.Render.Points( ctx, start, count ) - -#define RENDER_LINE( v1, v2 ) \ - LineFunc( ctx, v1, v2 ) - -#define RENDER_TRI( v1, v2, v3 ) \ - TriangleFunc( ctx, v1, v2, v3 ) - -#define RENDER_QUAD( v1, v2, v3, v4 ) \ - QuadFunc( ctx, v1, v2, v3, v4 ) - -#define TAG(x) _gld_tnl_##x##_verts - -#define LOCAL_VARS \ - TNLcontext *tnl = TNL_CONTEXT(ctx); \ - struct vertex_buffer *VB = &tnl->vb; \ - const GLuint * const elt = VB->Elts; \ - const tnl_line_func LineFunc = tnl->Driver.Render.Line; \ - const tnl_triangle_func TriangleFunc = tnl->Driver.Render.Triangle; \ - const tnl_quad_func QuadFunc = tnl->Driver.Render.Quad; \ - (void) (LineFunc && TriangleFunc && QuadFunc); \ - (void) elt; - -#define RESET_STIPPLE tnl->Driver.Render.ResetLineStipple( ctx ) -#define INIT(x) tnl->Driver.Render.PrimitiveNotify( ctx, x ) -#define RENDER_TAB_QUALIFIER -#define PRESERVE_VB_DEFS -#include "tnl/t_vb_rendertmp.h" - - -/* Elts, no clipping. - */ -#undef ELT -#define TAG(x) _gld_tnl_##x##_elts -#define ELT(x) elt[x] -#include "tnl/t_vb_rendertmp.h" - - -/**********************************************************************/ -/* Helper functions for drivers */ -/**********************************************************************/ -/* -void _tnl_RenderClippedPolygon( GLcontext *ctx, const GLuint *elts, GLuint n ) -{ - TNLcontext *tnl = TNL_CONTEXT(ctx); - struct vertex_buffer *VB = &tnl->vb; - GLuint *tmp = VB->Elts; - - VB->Elts = (GLuint *)elts; - tnl->Driver.Render.PrimTabElts[GL_POLYGON]( ctx, 0, n, PRIM_BEGIN|PRIM_END ); - VB->Elts = tmp; -} - -void _tnl_RenderClippedLine( GLcontext *ctx, GLuint ii, GLuint jj ) -{ - TNLcontext *tnl = TNL_CONTEXT(ctx); - tnl->Driver.Render.Line( ctx, ii, jj ); -} -*/ - - -/**********************************************************************/ -/* Clip and render whole vertex buffers */ -/**********************************************************************/ - -tnl_points_func _gldSetupPoints[4] = { - gld_Points2D_DX7, - gld_Points2D_DX7, - gld_Points2D_DX7, - gld_Points2D_DX7 -}; -tnl_line_func _gldSetupLine[4] = { - gld_Line2DFlat_DX7, - gld_Line2DSmooth_DX7, - gld_Line2DFlat_DX7, - gld_Line2DSmooth_DX7, -}; -tnl_triangle_func _gldSetupTriangle[4] = { - gld_Triangle2DFlat_DX7, - gld_Triangle2DSmooth_DX7, - gld_Triangle2DFlatExtras_DX7, - gld_Triangle2DSmoothExtras_DX7 -}; -tnl_quad_func _gldSetupQuad[4] = { - gld_Quad2DFlat_DX7, - gld_Quad2DSmooth_DX7, - gld_Quad2DFlatExtras_DX7, - gld_Quad2DSmoothExtras_DX7 -}; - -//--------------------------------------------------------------------------- - -static GLboolean _gld_mesa_render_stage_run( - GLcontext *ctx, - struct tnl_pipeline_stage *stage) -{ - GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); - GLD_driver_dx7 *gld = GLD_GET_DX7_DRIVER(gldCtx); - - TNLcontext *tnl = TNL_CONTEXT(ctx); - struct vertex_buffer *VB = &tnl->vb; - tnl_render_func *tab; - GLint pass = 0; - GLD_pb_dx7 *gldPB; - DWORD dwFlags; - - /* Allow the drivers to lock before projected verts are built so - * that window coordinates are guarenteed not to change before - * rendering. - */ - ASSERT(tnl->Driver.Render.Start); - - tnl->Driver.Render.Start( ctx ); - - gldPB = &gld->PB2d; - tnl->Driver.Render.Points = _gldSetupPoints[gld->iSetupFunc]; - tnl->Driver.Render.Line = _gldSetupLine[gld->iSetupFunc]; - tnl->Driver.Render.Triangle = _gldSetupTriangle[gld->iSetupFunc]; - tnl->Driver.Render.Quad = _gldSetupQuad[gld->iSetupFunc]; - - dwFlags = DDLOCK_DISCARDCONTENTS | DDLOCK_WAIT | DDLOCK_SURFACEMEMORYPTR | DDLOCK_WRITEONLY; - _GLD_DX7_VB(Lock(gldPB->pVB, dwFlags, &gldPB->pPoints, NULL)); - gldPB->nPoints = gldPB->nLines = gldPB->nTriangles = 0; - - // Allocate primitive pointers - gldPB->pPoints is always first - gldPB->pLines = gldPB->pPoints + (gldPB->dwStride * gldPB->iFirstLine); - gldPB->pTriangles = gldPB->pPoints + (gldPB->dwStride * gldPB->iFirstTriangle); - - ASSERT(tnl->Driver.Render.BuildVertices); - ASSERT(tnl->Driver.Render.PrimitiveNotify); - ASSERT(tnl->Driver.Render.Points); - ASSERT(tnl->Driver.Render.Line); - ASSERT(tnl->Driver.Render.Triangle); - ASSERT(tnl->Driver.Render.Quad); - ASSERT(tnl->Driver.Render.ResetLineStipple); - ASSERT(tnl->Driver.Render.Interp); - ASSERT(tnl->Driver.Render.CopyPV); - ASSERT(tnl->Driver.Render.ClippedLine); - ASSERT(tnl->Driver.Render.ClippedPolygon); - ASSERT(tnl->Driver.Render.Finish); - - tnl->Driver.Render.BuildVertices( ctx, 0, VB->Count, ~0 ); - - if (VB->ClipOrMask) { - tab = VB->Elts ? clip_render_tab_elts : clip_render_tab_verts; - clip_render_tab_elts[GL_TRIANGLES] = clip_elt_triangles; - } - else { - tab = (VB->Elts ? - tnl->Driver.Render.PrimTabElts : - tnl->Driver.Render.PrimTabVerts); - } - - do { - GLuint i, length, flags = 0; - for (i = 0 ; !(flags & PRIM_END) ; i += length) { - flags = VB->Primitive[i].mode; - length= VB->Primitive[i].count; - ASSERT(length || (flags & PRIM_END)); - ASSERT((flags & PRIM_MODE_MASK) <= GL_POLYGON+1); - if (length) - tab[flags & PRIM_MODE_MASK]( ctx, i, i + length, flags ); - } - } while (tnl->Driver.Render.Multipass && - tnl->Driver.Render.Multipass( ctx, ++pass )); - - -// tnl->Driver.Render.Finish( ctx ); - - _GLD_DX7_VB(Unlock(gldPB->pVB)); - - if (gldPB->nPoints) { - _GLD_DX7_DEV(DrawPrimitiveVB(gld->pDev, D3DPT_POINTLIST, gldPB->pVB, 0, gldPB->nPoints, 0)); - gldPB->nPoints = 0; - } - - if (gldPB->nLines) { - _GLD_DX7_DEV(DrawPrimitiveVB(gld->pDev, D3DPT_LINELIST, gldPB->pVB, gldPB->iFirstLine, gldPB->nLines*2, 0)); - gldPB->nLines = 0; - } - - if (gldPB->nTriangles) { - _GLD_DX7_DEV(DrawPrimitiveVB(gld->pDev, D3DPT_TRIANGLELIST, gldPB->pVB, gldPB->iFirstTriangle, gldPB->nTriangles*3, 0)); - gldPB->nTriangles = 0; - } - - return GL_FALSE; /* finished the pipe */ -} - - -/**********************************************************************/ -/* Render pipeline stage */ -/**********************************************************************/ - - - -const struct tnl_pipeline_stage _gld_mesa_render_stage = -{ - "gld_mesa_render_stage", - NULL, - NULL, - NULL, - NULL, - _gld_mesa_render_stage_run /* run */ -}; - -//--------------------------------------------------------------------------- diff --git a/src/mesa/drivers/windows/gldirect/dx7/gld_wgl_dx7.c b/src/mesa/drivers/windows/gldirect/dx7/gld_wgl_dx7.c deleted file mode 100644 index 0f8fe33eb1..0000000000 --- a/src/mesa/drivers/windows/gldirect/dx7/gld_wgl_dx7.c +++ /dev/null @@ -1,1611 +0,0 @@ -/**************************************************************************** -* -* Mesa 3-D graphics library -* Direct3D Driver Interface -* -* ======================================================================== -* -* Copyright (C) 1991-2004 SciTech Software, Inc. All rights reserved. -* -* Permission is hereby granted, free of charge, to any person obtaining a -* copy of this software and associated documentation files (the "Software"), -* to deal in the Software without restriction, including without limitation -* the rights to use, copy, modify, merge, publish, distribute, sublicense, -* and/or sell copies of the Software, and to permit persons to whom the -* Software is furnished to do so, subject to the following conditions: -* -* The above copyright notice and this permission notice shall be included -* in all copies or substantial portions of the Software. -* -* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -* SCITECH SOFTWARE INC BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF -* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -* SOFTWARE. -* -* ====================================================================== -* -* Language: ANSI C -* Environment: Windows 9x/2000/XP/XBox (Win32) -* -* Description: GLDirect Direct3D 8.x WGL (WindowsGL) -* -****************************************************************************/ - -#include "dglcontext.h" -#include "gld_driver.h" -//#include "gld_dxerr8.h" -#include "gld_dx7.h" - -#include "tnl/tnl.h" -#include "tnl/t_context.h" - -// Copied from dglcontect.c -#define GLDERR_NONE 0 -#define GLDERR_MEM 1 -#define GLDERR_DDRAW 2 -#define GLDERR_D3D 3 -#define GLDERR_BPP 4 -#define GLDERR_DDS 5 -// This external var keeps track of any error -extern int nContextError; - -// Uncomment this for persistant resources -//#define _GLD_PERSISTANT - -#define DDLOG_CRITICAL_OR_WARN DDLOG_CRITICAL - -extern void _gld_mesa_warning(GLcontext *, char *); -extern void _gld_mesa_fatal(GLcontext *, char *); - -//--------------------------------------------------------------------------- - -static char szColorDepthWarning[] = -"GLDirect does not support the current desktop\n\ -color depth.\n\n\ -You may need to change the display resolution to\n\ -16 bits per pixel or higher color depth using\n\ -the Windows Display Settings control panel\n\ -before running this OpenGL application.\n"; - -// The only depth-stencil formats currently supported by Direct3D -// Surface Format Depth Stencil Total Bits -// D3DFMT_D32 32 - 32 -// D3DFMT_D15S1 15 1 16 -// D3DFMT_D24S8 24 8 32 -// D3DFMT_D16 16 - 16 -// D3DFMT_D24X8 24 - 32 -// D3DFMT_D24X4S4 24 4 32 - -// This pixel format will be used as a template when compiling the list -// of pixel formats supported by the hardware. Many fields will be -// filled in at runtime. -// PFD flag defaults are upgraded to match ChoosePixelFormat() -- DaveM -static DGL_pixelFormat pfTemplateHW = -{ - { - sizeof(PIXELFORMATDESCRIPTOR), // Size of the data structure - 1, // Structure version - should be 1 - // Flags: - PFD_DRAW_TO_WINDOW | // The buffer can draw to a window or device surface. - PFD_DRAW_TO_BITMAP | // The buffer can draw to a bitmap. (DaveM) - PFD_SUPPORT_GDI | // The buffer supports GDI drawing. (DaveM) - PFD_SUPPORT_OPENGL | // The buffer supports OpenGL drawing. - PFD_DOUBLEBUFFER | // The buffer is double-buffered. - 0, // Placeholder for easy commenting of above flags - PFD_TYPE_RGBA, // Pixel type RGBA. - 16, // Total colour bitplanes (excluding alpha bitplanes) - 5, 0, // Red bits, shift - 5, 0, // Green bits, shift - 5, 0, // Blue bits, shift - 0, 0, // Alpha bits, shift (destination alpha) - 0, // Accumulator bits (total) - 0, 0, 0, 0, // Accumulator bits: Red, Green, Blue, Alpha - 0, // Depth bits - 0, // Stencil bits - 0, // Number of auxiliary buffers - 0, // Layer type - 0, // Specifies the number of overlay and underlay planes. - 0, // Layer mask - 0, // Specifies the transparent color or index of an underlay plane. - 0 // Damage mask - }, - D3DX_SF_UNKNOWN, // No depth/stencil buffer -}; - -//--------------------------------------------------------------------------- -// Vertex Shaders -//--------------------------------------------------------------------------- -/* -// Vertex Shader Declaration -static DWORD dwTwoSidedLightingDecl[] = -{ - D3DVSD_STREAM(0), - D3DVSD_REG(0, D3DVSDT_FLOAT3), // XYZ position - D3DVSD_REG(1, D3DVSDT_FLOAT3), // XYZ normal - D3DVSD_REG(2, D3DVSDT_D3DCOLOR), // Diffuse color - D3DVSD_REG(3, D3DVSDT_D3DCOLOR), // Specular color - D3DVSD_REG(4, D3DVSDT_FLOAT2), // 2D texture unit 0 - D3DVSD_REG(5, D3DVSDT_FLOAT2), // 2D texture unit 1 - D3DVSD_END() -}; - -// Vertex Shader for two-sided lighting -static char *szTwoSidedLightingVS = -// This is a test shader! -"vs.1.0\n" -"m4x4 oPos,v0,c0\n" -"mov oD0,v2\n" -"mov oD1,v3\n" -"mov oT0,v4\n" -"mov oT1,v5\n" -; -*/ -//--------------------------------------------------------------------------- -//--------------------------------------------------------------------------- - -typedef struct { -// HINSTANCE hD3D8DLL; // Handle to d3d8.dll -// FNDIRECT3DCREATE7 fnDirect3DCreate7; // Direct3DCreate8 function prototype -// BOOL bDirect3D; // Persistant Direct3D7 exists -// BOOL bDirect3DDevice; // Persistant Direct3DDevice7 exists -// IDirect3D7 *pD3D; // Persistant Direct3D7 -// IDirect3DDevice7 *pDev; // Persistant Direct3DDevice7 - BOOL bD3DXStarted; -} GLD_dx7_globals; - -// These are "global" to all DX7 contexts. KeithH -static GLD_dx7_globals dx7Globals; - -// Added for correct clipping of multiple open windows. (DaveM) -LPDIRECTDRAWSURFACE7 lpDDSPrimary = NULL; -LPDIRECTDRAWCLIPPER lpDDClipper = NULL; - -//--------------------------------------------------------------------------- -//--------------------------------------------------------------------------- - -BOOL gldGetDXErrorString_DX( - HRESULT hr, - char *buf, - int nBufSize) -{ - // - // Return a string describing the input HRESULT error code - // - - D3DXGetErrorString(hr, nBufSize, buf); - return TRUE; -} - -//--------------------------------------------------------------------------- -// -// DX7 does not support multisample -/* -static D3DMULTISAMPLE_TYPE _gldGetDeviceMultiSampleType( - IDirect3D8 *pD3D8, - D3DFORMAT SurfaceFormat, - D3DDEVTYPE d3dDevType, - BOOL Windowed) -{ - int i; - HRESULT hr; - - if (glb.dwMultisample == GLDS_MULTISAMPLE_NONE) - return D3DMULTISAMPLE_NONE; - - if (glb.dwMultisample == GLDS_MULTISAMPLE_FASTEST) { - // Find fastest multisample - for (i=2; i<17; i++) { - hr = IDirect3D8_CheckDeviceMultiSampleType( - pD3D8, - glb.dwAdapter, - d3dDevType, - SurfaceFormat, - Windowed, - (D3DMULTISAMPLE_TYPE)i); - if (SUCCEEDED(hr)) { - return (D3DMULTISAMPLE_TYPE)i; - } - } - } else { - // Find nicest multisample - for (i=16; i>1; i--) { - hr = IDirect3D8_CheckDeviceMultiSampleType( - pD3D8, - glb.dwAdapter, - d3dDevType, - SurfaceFormat, - Windowed, - (D3DMULTISAMPLE_TYPE)i); - if (SUCCEEDED(hr)) { - return (D3DMULTISAMPLE_TYPE)i; - } - } - } - - // Nothing found - return default - return D3DMULTISAMPLE_NONE; -} -*/ -//--------------------------------------------------------------------------- - -void _gldDestroyPrimitiveBuffer( - GLD_pb_dx7 *gldVB) -{ - SAFE_RELEASE(gldVB->pVB); - - // Sanity check... - gldVB->nLines = gldVB->nPoints = gldVB->nTriangles = 0; -} - -//--------------------------------------------------------------------------- - -HRESULT _gldCreatePrimitiveBuffer( - GLcontext *ctx, - GLD_driver_dx7 *lpCtx, - GLD_pb_dx7 *gldVB) -{ - HRESULT hResult; - char *szCreateVertexBufferFailed = "CreateVertexBuffer failed"; - DWORD dwMaxVertices; // Max number of vertices in vertex buffer - DWORD dwVBSize; // Total size of vertex buffer - D3DVERTEXBUFFERDESC vbdesc; - - // If CVA (Compiled Vertex Array) is used by an OpenGL app, then we - // will need enough vertices to cater for Mesa::Const.MaxArrayLockSize. - // We'll use IMM_SIZE if it's larger (which it should not be). - dwMaxVertices = MAX_ARRAY_LOCK_SIZE; - - // Max vertex buffer size limited in DX7. (DaveM) - if (dwMaxVertices*9 > D3DMAXNUMVERTICES) - dwMaxVertices = D3DMAXNUMVERTICES/9; - - // Now calculate how many vertices to allow for in total - // 1 per point, 2 per line, 6 per quad = 9 - dwVBSize = dwMaxVertices * 9 * gldVB->dwStride; - - vbdesc.dwSize = sizeof(vbdesc); - vbdesc.dwCaps = gldVB->dwCreateFlags; - vbdesc.dwFVF = gldVB->dwFVF; - vbdesc.dwNumVertices = dwMaxVertices * 9; - -/* hResult = IDirect3DDevice8_CreateVertexBuffer( - lpCtx->pDev, - dwVBSize, -RAgldVB->dwUsage, - gldVB->dwFVF, - gldVB->dwPool, - &gldVB->pVB);*/ - hResult = IDirect3D7_CreateVertexBuffer( - lpCtx->pD3D, - &vbdesc, - &gldVB->pVB, - 0); - if (FAILED(hResult)) { - ddlogMessage(DDLOG_CRITICAL_OR_WARN, szCreateVertexBufferFailed); - return hResult; - } - - gldVB->nLines = gldVB->nPoints = gldVB->nTriangles = 0; - gldVB->pPoints = gldVB->pLines = gldVB->pTriangles = NULL; - gldVB->iFirstLine = dwMaxVertices; // Index of first line in VB - gldVB->iFirstTriangle = dwMaxVertices*3; // Index of first triangle in VB - - return S_OK; -} - -//--------------------------------------------------------------------------- -// Function: _gldCreateVertexShaders -// Create DX8 Vertex Shaders. -//--------------------------------------------------------------------------- -/* -void _gldCreateVertexShaders( - GLD_driver_dx8 *gld) -{ - DWORD dwFlags; - LPD3DXBUFFER pVSOpcodeBuffer; // Vertex Shader opcode buffer - HRESULT hr; - -#ifdef _DEBUG - dwFlags = D3DXASM_DEBUG; -#else - dwFlags = 0; // D3DXASM_SKIPVALIDATION; -#endif - - ddlogMessage(DDLOG_INFO, "Creating shaders...\n"); - - // Init the shader handle - gld->VStwosidelight.hShader = 0; - - if (gld->d3dCaps8.MaxStreams == 0) { - // Lame DX8 driver doesn't support streams - // Not fatal, as defaults will be used - ddlogMessage(DDLOG_WARN, "Driver doesn't support Vertex Shaders (MaxStreams==0)\n"); - return; - } - - // ** THIS DISABLES VERTEX SHADER SUPPORT ** -// return; - // ** THIS DISABLES VERTEX SHADER SUPPORT ** - - // - // Two-sided lighting - // - -#if 0 - // - // DEBUGGING: Load shader from a text file - // - { - LPD3DXBUFFER pVSErrorBuffer; // Vertex Shader error buffer - hr = D3DXAssembleShaderFromFile( - "twoside.vsh", - dwFlags, - NULL, // No constants - &pVSOpcodeBuffer, - &pVSErrorBuffer); - if (pVSErrorBuffer && pVSErrorBuffer->lpVtbl->GetBufferPointer(pVSErrorBuffer)) - ddlogMessage(DDLOG_INFO, pVSErrorBuffer->lpVtbl->GetBufferPointer(pVSErrorBuffer)); - SAFE_RELEASE(pVSErrorBuffer); - } -#else - { - LPD3DXBUFFER pVSErrorBuffer; // Vertex Shader error buffer - // Assemble ascii shader text into shader opcodes - hr = D3DXAssembleShader( - szTwoSidedLightingVS, - strlen(szTwoSidedLightingVS), - dwFlags, - NULL, // No constants - &pVSOpcodeBuffer, - &pVSErrorBuffer); - if (pVSErrorBuffer && pVSErrorBuffer->lpVtbl->GetBufferPointer(pVSErrorBuffer)) - ddlogMessage(DDLOG_INFO, pVSErrorBuffer->lpVtbl->GetBufferPointer(pVSErrorBuffer)); - SAFE_RELEASE(pVSErrorBuffer); - } -#endif - if (FAILED(hr)) { - ddlogError(DDLOG_WARN, "AssembleShader failed", hr); - SAFE_RELEASE(pVSOpcodeBuffer); - return; - } - -// This is for debugging. Remove to enable vertex shaders in HW -#define _GLD_FORCE_SW_VS 0 - - if (_GLD_FORCE_SW_VS) { - // _GLD_FORCE_SW_VS should be disabled for Final Release - ddlogMessage(DDLOG_SYSTEM, "[Forcing shaders in SW]\n"); - } - - // Try and create shader in hardware. - // NOTE: The D3D Ref device appears to succeed when trying to - // create the device in hardware, but later complains - // when trying to set it with SetVertexShader(). Go figure. - if (_GLD_FORCE_SW_VS || glb.dwDriver == GLDS_DRIVER_REF) { - // Don't try and create a hardware shader with the Ref device - hr = E_FAIL; // COM error/fail result - } else { - gld->VStwosidelight.bHardware = TRUE; - hr = IDirect3DDevice8_CreateVertexShader( - gld->pDev, - dwTwoSidedLightingDecl, - pVSOpcodeBuffer->lpVtbl->GetBufferPointer(pVSOpcodeBuffer), - &gld->VStwosidelight.hShader, - 0); - } - if (FAILED(hr)) { - ddlogMessage(DDLOG_INFO, "... HW failed, trying SW...\n"); - // Failed. Try and create shader for software processing - hr = IDirect3DDevice8_CreateVertexShader( - gld->pDev, - dwTwoSidedLightingDecl, - pVSOpcodeBuffer->lpVtbl->GetBufferPointer(pVSOpcodeBuffer), - &gld->VStwosidelight.hShader, - D3DUSAGE_SOFTWAREPROCESSING); - if (FAILED(hr)) { - gld->VStwosidelight.hShader = 0; // Sanity check - ddlogError(DDLOG_WARN, "CreateVertexShader failed", hr); - return; - } - // Succeeded, but for software processing - gld->VStwosidelight.bHardware = FALSE; - } - - SAFE_RELEASE(pVSOpcodeBuffer); - - ddlogMessage(DDLOG_INFO, "... OK\n"); -} - -//--------------------------------------------------------------------------- - -void _gldDestroyVertexShaders( - GLD_driver_dx8 *gld) -{ - if (gld->VStwosidelight.hShader) { - IDirect3DDevice8_DeleteVertexShader(gld->pDev, gld->VStwosidelight.hShader); - gld->VStwosidelight.hShader = 0; - } -} -*/ -//--------------------------------------------------------------------------- - -BOOL gldCreateDrawable_DX( - DGL_ctx *ctx, -// BOOL bDefaultDriver, - BOOL bDirectDrawPersistant, - BOOL bPersistantBuffers) -{ - // - // bDirectDrawPersistant: applies to IDirect3D8 - // bPersistantBuffers: applies to IDirect3DDevice8 - // - -// D3DDEVTYPE d3dDevType; -// D3DPRESENT_PARAMETERS d3dpp; -// D3DDISPLAYMODE d3ddm; -// DWORD dwBehaviourFlags; -// D3DADAPTER_IDENTIFIER8 d3dIdent; - - HRESULT hr; - GLD_driver_dx7 *lpCtx = NULL; - D3DX_VIDMODEDESC d3ddm; - - // Parameters for D3DXCreateContextEx - // These will be different for fullscreen and windowed - DWORD dwDeviceIndex; - DWORD dwFlags; - HWND hwnd; - HWND hwndFocus; - DWORD numColorBits; - DWORD numAlphaBits; - DWORD numDepthBits; - DWORD numStencilBits; - DWORD numBackBuffers; - DWORD dwWidth; - DWORD dwHeight; - DWORD refreshRate; - - // Error if context is NULL. - if (ctx == NULL) - return FALSE; - - if (ctx->glPriv) { - lpCtx = ctx->glPriv; - // Release any existing interfaces (in reverse order) - SAFE_RELEASE(lpCtx->pDev); - SAFE_RELEASE(lpCtx->pD3D); - lpCtx->pD3DXContext->lpVtbl->Release(lpCtx->pD3DXContext); - lpCtx->pD3DXContext = NULL; - } else { - lpCtx = (GLD_driver_dx7*)malloc(sizeof(GLD_driver_dx7)); - ZeroMemory(lpCtx, sizeof(lpCtx)); - } - -// d3dDevType = (glb.dwDriver == GLDS_DRIVER_HAL) ? D3DDEVTYPE_HAL : D3DDEVTYPE_REF; - // Use REF device if requested. Otherwise D3DX_DEFAULT will choose highest level - // of HW acceleration. - dwDeviceIndex = (glb.dwDriver == GLDS_DRIVER_REF) ? D3DX_HWLEVEL_REFERENCE : D3DX_DEFAULT; - - // TODO: Check this -// if (bDefaultDriver) -// d3dDevType = D3DDEVTYPE_REF; - -#ifdef _GLD_PERSISTANT - // Use persistant interface if needed - if (bDirectDrawPersistant && dx7Globals.bDirect3D) { - lpCtx->pD3D = dx7Globals.pD3D; - IDirect3D7_AddRef(lpCtx->pD3D); - goto SkipDirectDrawCreate; - } -#endif -/* - // Create Direct3D7 object - lpCtx->pD3D = dx7Globals.fnDirect3DCreate8(D3D_SDK_VERSION_DX8_SUPPORT_WIN95); - if (lpCtx->pD3D == NULL) { - MessageBox(NULL, "Unable to initialize Direct3D8", "GLDirect", MB_OK); - ddlogMessage(DDLOG_CRITICAL_OR_WARN, "Unable to create Direct3D8 interface"); - nContextError = GLDERR_D3D; - goto return_with_error; - } -*/ - -#ifdef _GLD_PERSISTANT - // Cache Direct3D interface for subsequent GLRCs - if (bDirectDrawPersistant && !dx8Globals.bDirect3D) { - dx7Globals.pD3D = lpCtx->pD3D; - IDirect3D7_AddRef(dx7Globals.pD3D); - dx7Globals.bDirect3D = TRUE; - } -SkipDirectDrawCreate: -#endif -/* - // Get the display mode so we can make a compatible backbuffer - hResult = IDirect3D8_GetAdapterDisplayMode(lpCtx->pD3D, glb.dwAdapter, &d3ddm); - if (FAILED(hResult)) { - nContextError = GLDERR_D3D; - goto return_with_error; - } -*/ - -#if 0 - // Get device caps - hResult = IDirect3D8_GetDeviceCaps(lpCtx->pD3D, glb.dwAdapter, d3dDevType, &lpCtx->d3dCaps8); - if (FAILED(hResult)) { - ddlogError(DDLOG_CRITICAL_OR_WARN, "IDirect3D8_GetDeviceCaps failed", hResult); - nContextError = GLDERR_D3D; - goto return_with_error; - } - - // Check for hardware transform & lighting - lpCtx->bHasHWTnL = lpCtx->d3dCaps8.DevCaps & D3DDEVCAPS_HWTRANSFORMANDLIGHT ? TRUE : FALSE; - - // If this flag is present then we can't default to Mesa - // SW rendering between BeginScene() and EndScene(). - if (lpCtx->d3dCaps8.Caps2 & D3DCAPS2_NO2DDURING3DSCENE) { - ddlogMessage(DDLOG_WARN, - "Warning : No 2D allowed during 3D scene.\n"); - } -#endif - - // - // Create the Direct3D context - // - -#ifdef _GLD_PERSISTANT - // Re-use original IDirect3DDevice if persistant buffers exist. - // Note that we test for persistant IDirect3D8 as well - // bDirectDrawPersistant == persistant IDirect3D8 (DirectDraw8 does not exist) - if (bDirectDrawPersistant && bPersistantBuffers && dx7Globals.pD3D && dx7Globals.pDev) { - lpCtx->pDev = dx7Globals.pDev; - IDirect3DDevice7_AddRef(dx7Globals.pDev); - goto skip_direct3ddevice_create; - } -#endif -/* - // Clear the presentation parameters (sets all members to zero) - ZeroMemory(&d3dpp, sizeof(d3dpp)); - - // Recommended by MS; needed for MultiSample. - // Be careful if altering this for FullScreenBlit - d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD; - - d3dpp.BackBufferFormat = d3ddm.Format; - d3dpp.BackBufferCount = 1; - d3dpp.MultiSampleType = _gldGetDeviceMultiSampleType(lpCtx->pD3D, d3ddm.Format, d3dDevType, !ctx->bFullscreen); - d3dpp.AutoDepthStencilFormat = ctx->lpPF->dwDriverData; - d3dpp.EnableAutoDepthStencil = (d3dpp.AutoDepthStencilFormat == D3DFMT_UNKNOWN) ? FALSE : TRUE; - - if (ctx->bFullscreen) { - ddlogWarnOption(FALSE); // Don't popup any messages in fullscreen - d3dpp.Windowed = FALSE; - d3dpp.BackBufferWidth = d3ddm.Width; - d3dpp.BackBufferHeight = d3ddm.Height; - d3dpp.hDeviceWindow = ctx->hWnd; - d3dpp.FullScreen_RefreshRateInHz = D3DPRESENT_RATE_DEFAULT; - - // Support for vertical retrace synchronisation. - // Set default presentation interval in case caps bits are missing - d3dpp.FullScreen_PresentationInterval = D3DPRESENT_INTERVAL_DEFAULT; - if (glb.bWaitForRetrace) { - if (lpCtx->d3dCaps8.PresentationIntervals & D3DPRESENT_INTERVAL_ONE) - d3dpp.FullScreen_PresentationInterval = D3DPRESENT_INTERVAL_ONE; - } else { - if (lpCtx->d3dCaps8.PresentationIntervals & D3DPRESENT_INTERVAL_IMMEDIATE) - d3dpp.FullScreen_PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE; - } - } else { - ddlogWarnOption(glb.bMessageBoxWarnings); // OK to popup messages - d3dpp.Windowed = TRUE; - d3dpp.BackBufferWidth = ctx->dwWidth; - d3dpp.BackBufferHeight = ctx->dwHeight; - d3dpp.hDeviceWindow = ctx->hWnd; - d3dpp.FullScreen_RefreshRateInHz = 0; - // FullScreen_PresentationInterval must be default for Windowed mode - d3dpp.FullScreen_PresentationInterval = D3DPRESENT_INTERVAL_DEFAULT; - } - - // Decide if we can use hardware TnL - dwBehaviourFlags = (lpCtx->bHasHWTnL) ? - D3DCREATE_MIXED_VERTEXPROCESSING : D3DCREATE_SOFTWARE_VERTEXPROCESSING; - // Add flag to tell D3D to be thread-safe - if (glb.bMultiThreaded) - dwBehaviourFlags |= D3DCREATE_MULTITHREADED; - hResult = IDirect3D8_CreateDevice(lpCtx->pD3D, - glb.dwAdapter, - d3dDevType, - ctx->hWnd, - dwBehaviourFlags, - &d3dpp, - &lpCtx->pDev); - if (FAILED(hResult)) { - ddlogError(DDLOG_CRITICAL_OR_WARN, "IDirect3D8_CreateDevice failed", hResult); - nContextError = GLDERR_D3D; - goto return_with_error; - } -*/ - - // Create D3DX context - if (ctx->bFullscreen) { - // - // FULLSCREEN - // - - // Get display mode - D3DXGetCurrentVideoMode(D3DX_DEFAULT, &d3ddm); - - // Fullscreen Parameters - dwFlags = D3DX_CONTEXT_FULLSCREEN; - hwnd = ctx->hWnd; - hwndFocus = ctx->hWnd; - numColorBits = ctx->lpPF->pfd.cColorBits; - numAlphaBits = ctx->lpPF->pfd.cAlphaBits; - numDepthBits = ctx->lpPF->pfd.cDepthBits + ctx->lpPF->pfd.cStencilBits; - numStencilBits = ctx->lpPF->pfd.cStencilBits; - numBackBuffers = D3DX_DEFAULT; // Default is 1 backbuffer - dwWidth = d3ddm.width; - dwHeight = d3ddm.height; - refreshRate = d3ddm.refreshRate; // D3DX_DEFAULT; - } else { - // - // WINDOWED - // - - // Windowed Parameters - dwFlags = 0; // No flags means "windowed" - hwnd = ctx->hWnd; - hwndFocus = (HWND)D3DX_DEFAULT; - numColorBits = D3DX_DEFAULT; // Use Desktop depth - numAlphaBits = ctx->lpPF->pfd.cAlphaBits; - numDepthBits = ctx->lpPF->pfd.cDepthBits + ctx->lpPF->pfd.cStencilBits; - numStencilBits = ctx->lpPF->pfd.cStencilBits; - numBackBuffers = D3DX_DEFAULT; // Default is 1 backbuffer - dwWidth = ctx->dwWidth; - dwHeight = ctx->dwHeight; - refreshRate = D3DX_DEFAULT; - } - hr = D3DXCreateContextEx(dwDeviceIndex, dwFlags, hwnd, hwndFocus, - numColorBits, numAlphaBits, numDepthBits, numStencilBits, - numBackBuffers, - dwWidth, dwHeight, refreshRate, - &lpCtx->pD3DXContext); - if (FAILED(hr)) { - ddlogError(DDLOG_CRITICAL_OR_WARN, "D3DXCreateContextEx failed", hr); - nContextError = GLDERR_D3D; - goto return_with_error; - } - - // Obtain D3D7 interfaces from ID3DXContext -// lpCtx->pDD = ID3DXContext_GetDD(lpCtx->pD3DXContext); - lpCtx->pDD = lpCtx->pD3DXContext->lpVtbl->GetDD(lpCtx->pD3DXContext); - if (lpCtx->pDD == NULL) - goto return_with_error; - lpCtx->pD3D = lpCtx->pD3DXContext->lpVtbl->GetD3D(lpCtx->pD3DXContext); - if (lpCtx->pD3D == NULL) - goto return_with_error; - lpCtx->pDev = lpCtx->pD3DXContext->lpVtbl->GetD3DDevice(lpCtx->pD3DXContext); - if (lpCtx->pDev == NULL) - goto return_with_error; - - // Need to manage clipper manually for multiple windows - // since DX7 D3DX utility lib does not appear to do that. (DaveM) - if (!ctx->bFullscreen) { - // Get primary surface too - lpDDSPrimary = lpCtx->pD3DXContext->lpVtbl->GetPrimary(lpCtx->pD3DXContext); - if (lpDDSPrimary == NULL) { - ddlogPrintf(DDLOG_WARN, "GetPrimary"); - goto return_with_error; - } - // Create clipper for correct window updates - if (IDirectDraw7_CreateClipper(lpCtx->pDD, 0, &lpDDClipper, NULL) != DD_OK) { - ddlogPrintf(DDLOG_WARN, "CreateClipper"); - goto return_with_error; - } - // Set the window that the clipper belongs to - if (IDirectDrawClipper_SetHWnd(lpDDClipper, 0, hwnd) != DD_OK) { - ddlogPrintf(DDLOG_WARN, "SetHWnd"); - goto return_with_error; - } - // Attach the clipper to the primary surface - if (IDirectDrawSurface7_SetClipper(lpDDSPrimary, lpDDClipper) != DD_OK) { - ddlogPrintf(DDLOG_WARN, "SetClipper"); - goto return_with_error; - } - } - - // Get device caps - IDirect3DDevice7_GetCaps(lpCtx->pDev, &lpCtx->d3dCaps); - - // Determine HW TnL - lpCtx->bHasHWTnL = lpCtx->d3dCaps.dwDevCaps & D3DDEVCAPS_HWTRANSFORMANDLIGHT ? TRUE : FALSE; - -#ifdef _GLD_PERSISTANT - if (bDirectDrawPersistant && bPersistantBuffers && dx7Globals.pD3D) { - dx7Globals.pDev = lpCtx->pDev; - dx7Globals.bDirect3DDevice = TRUE; - } -#endif - -#if 0 - // Dump some useful stats - hResult = IDirect3D8_GetAdapterIdentifier( - lpCtx->pD3D, - glb.dwAdapter, - D3DENUM_NO_WHQL_LEVEL, // Avoids 1 to 2 second delay - &d3dIdent); - if (SUCCEEDED(hResult)) { - ddlogPrintf(DDLOG_INFO, "[Driver Description: %s]", &d3dIdent.Description); - ddlogPrintf(DDLOG_INFO, "[Driver file: %s %d.%d.%02d.%d]", - d3dIdent.Driver, - HIWORD(d3dIdent.DriverVersion.HighPart), - LOWORD(d3dIdent.DriverVersion.HighPart), - HIWORD(d3dIdent.DriverVersion.LowPart), - LOWORD(d3dIdent.DriverVersion.LowPart)); - ddlogPrintf(DDLOG_INFO, "[VendorId: 0x%X, DeviceId: 0x%X, SubSysId: 0x%X, Revision: 0x%X]", - d3dIdent.VendorId, d3dIdent.DeviceId, d3dIdent.SubSysId, d3dIdent.Revision); - } -#endif - - // Init projection matrix for D3D TnL - D3DXMatrixIdentity((D3DXMATRIX*)&lpCtx->matProjection); - lpCtx->matModelView = lpCtx->matProjection; -// gld->bUseMesaProjection = TRUE; - -skip_direct3ddevice_create: - - // Create buffers to hold primitives - lpCtx->PB2d.dwFVF = GLD_FVF_2D_VERTEX; -// lpCtx->PB2d.dwPool = D3DPOOL_SYSTEMMEM; - lpCtx->PB2d.dwStride = sizeof(GLD_2D_VERTEX); - lpCtx->PB2d.dwCreateFlags = D3DVBCAPS_DONOTCLIP | - D3DVBCAPS_SYSTEMMEMORY | - D3DVBCAPS_WRITEONLY; - hr = _gldCreatePrimitiveBuffer(ctx->glCtx, lpCtx, &lpCtx->PB2d); - if (FAILED(hr)) - goto return_with_error; - - lpCtx->PB3d.dwFVF = GLD_FVF_3D_VERTEX; -// lpCtx->PB3d.dwPool = D3DPOOL_DEFAULT; - lpCtx->PB3d.dwStride = sizeof(GLD_3D_VERTEX); - lpCtx->PB3d.dwCreateFlags = D3DVBCAPS_WRITEONLY; - - hr = _gldCreatePrimitiveBuffer(ctx->glCtx, lpCtx, &lpCtx->PB3d); - if (FAILED(hr)) - goto return_with_error; - - // Zero the pipeline usage counters - lpCtx->PipelineUsage.qwMesa.QuadPart = -// lpCtx->PipelineUsage.dwD3D2SVS.QuadPart = - lpCtx->PipelineUsage.qwD3DFVF.QuadPart = 0; - - // Assign drawable to GL private - ctx->glPriv = lpCtx; - return TRUE; - -return_with_error: - // Clean up and bail - _gldDestroyPrimitiveBuffer(&lpCtx->PB3d); - _gldDestroyPrimitiveBuffer(&lpCtx->PB2d); - - SAFE_RELEASE(lpCtx->pDev); - SAFE_RELEASE(lpCtx->pD3D); - //SAFE_RELEASE(lpCtx->pD3DXContext); - lpCtx->pD3DXContext->lpVtbl->Release(lpCtx->pD3DXContext); - return FALSE; -} - -//--------------------------------------------------------------------------- - -BOOL gldResizeDrawable_DX( - DGL_ctx *ctx, - BOOL bDefaultDriver, - BOOL bPersistantInterface, - BOOL bPersistantBuffers) -{ - GLD_driver_dx7 *gld = NULL; -// D3DDEVTYPE d3dDevType; -// D3DPRESENT_PARAMETERS d3dpp; -// D3DDISPLAYMODE d3ddm; - D3DX_VIDMODEDESC d3ddm; - HRESULT hr; - DWORD dwWidth, dwHeight; - - // Error if context is NULL. - if (ctx == NULL) - return FALSE; - - gld = ctx->glPriv; - if (gld == NULL) - return FALSE; - - if (ctx->bSceneStarted) { - IDirect3DDevice7_EndScene(gld->pDev); - ctx->bSceneStarted = FALSE; - } -/* - d3dDevType = (glb.dwDriver == GLDS_DRIVER_HAL) ? D3DDEVTYPE_HAL : D3DDEVTYPE_REF; - if (!bDefaultDriver) - d3dDevType = D3DDEVTYPE_REF; // Force Direct3D Reference Rasterise (software) - - // Get the display mode so we can make a compatible backbuffer - hResult = IDirect3D8_GetAdapterDisplayMode(gld->pD3D, glb.dwAdapter, &d3ddm); - if (FAILED(hResult)) { - nContextError = GLDERR_D3D; -// goto return_with_error; - return FALSE; - } -*/ - // Release objects before Reset() - _gldDestroyPrimitiveBuffer(&gld->PB3d); - _gldDestroyPrimitiveBuffer(&gld->PB2d); - -/* - // Clear the presentation parameters (sets all members to zero) - ZeroMemory(&d3dpp, sizeof(d3dpp)); - - // Recommended by MS; needed for MultiSample. - // Be careful if altering this for FullScreenBlit - d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD; - - d3dpp.BackBufferFormat = d3ddm.Format; - d3dpp.BackBufferCount = 1; - d3dpp.MultiSampleType = _gldGetDeviceMultiSampleType(gld->pD3D, d3ddm.Format, d3dDevType, !ctx->bFullscreen); - d3dpp.AutoDepthStencilFormat = ctx->lpPF->dwDriverData; - d3dpp.EnableAutoDepthStencil = (d3dpp.AutoDepthStencilFormat == D3DFMT_UNKNOWN) ? FALSE : TRUE; - - // TODO: Sync to refresh - - if (ctx->bFullscreen) { - ddlogWarnOption(FALSE); // Don't popup any messages in fullscreen - d3dpp.Windowed = FALSE; - d3dpp.BackBufferWidth = d3ddm.Width; - d3dpp.BackBufferHeight = d3ddm.Height; - d3dpp.hDeviceWindow = ctx->hWnd; - d3dpp.FullScreen_RefreshRateInHz = D3DPRESENT_RATE_DEFAULT; - d3dpp.FullScreen_PresentationInterval = D3DPRESENT_INTERVAL_DEFAULT; - // Get better benchmark results? KeithH -// d3dpp.FullScreen_RefreshRateInHz = D3DPRESENT_RATE_UNLIMITED; - } else { - ddlogWarnOption(glb.bMessageBoxWarnings); // OK to popup messages - d3dpp.Windowed = TRUE; - d3dpp.BackBufferWidth = ctx->dwWidth; - d3dpp.BackBufferHeight = ctx->dwHeight; - d3dpp.hDeviceWindow = ctx->hWnd; - d3dpp.FullScreen_RefreshRateInHz = 0; - d3dpp.FullScreen_PresentationInterval = D3DPRESENT_INTERVAL_DEFAULT; - } - hResult = IDirect3DDevice8_Reset(gld->pDev, &d3dpp); - if (FAILED(hResult)) { - ddlogError(DDLOG_CRITICAL_OR_WARN, "dglResize: Reset failed", hResult); - return FALSE; - //goto cleanup_and_return_with_error; - } -*/ - // Obtain dimensions of 'window' - if (ctx->bFullscreen) { - D3DXGetCurrentVideoMode(D3DX_DEFAULT, &d3ddm); - dwWidth = d3ddm.width; - dwHeight = d3ddm.height; - } else { - dwWidth = ctx->dwWidth; - dwHeight = ctx->dwHeight; - } - - // Resize context - hr = gld->pD3DXContext->lpVtbl->Resize(gld->pD3DXContext, dwWidth, dwHeight); - if (FAILED(hr)) { - ddlogError(DDLOG_CRITICAL_OR_WARN, "gldResizeDrawable_DX: Resize failed", hr); - return FALSE; - } - - // Clear the resized surface (DaveM) - { - D3DVIEWPORT7 vp1, vp2; - IDirect3DDevice7_GetViewport(gld->pDev, &vp1); - IDirect3DDevice7_GetViewport(gld->pDev, &vp2); - vp2.dwX = 0; - vp2.dwY = 0; - vp2.dwWidth = dwWidth; - vp2.dwHeight = dwHeight; - IDirect3DDevice7_SetViewport(gld->pDev, &vp2); - hr = gld->pD3DXContext->lpVtbl->Clear(gld->pD3DXContext, D3DCLEAR_TARGET); - if (FAILED(hr)) - ddlogError(DDLOG_WARN, "gldResizeDrawable_DX: Clear failed", hr); - IDirect3DDevice7_SetViewport(gld->pDev, &vp1); - } - - // - // Recreate objects - // - _gldCreatePrimitiveBuffer(ctx->glCtx, gld, &gld->PB2d); - _gldCreatePrimitiveBuffer(ctx->glCtx, gld, &gld->PB3d); - - // Signal a complete state update - ctx->glCtx->Driver.UpdateState(ctx->glCtx, _NEW_ALL); - - // Begin a new scene - IDirect3DDevice7_BeginScene(gld->pDev); - ctx->bSceneStarted = TRUE; - - return TRUE; -} - -//--------------------------------------------------------------------------- - -BOOL gldDestroyDrawable_DX( - DGL_ctx *ctx) -{ - GLD_driver_dx7 *lpCtx = NULL; - - // Error if context is NULL. - if (!ctx) - return FALSE; - - // Error if the drawable does not exist. - if (!ctx->glPriv) - return FALSE; - - lpCtx = ctx->glPriv; - -#ifdef _DEBUG - // Dump out stats - ddlogPrintf(DDLOG_SYSTEM, "Usage: M:0x%X%X, D:0x%X%X", - lpCtx->PipelineUsage.qwMesa.HighPart, - lpCtx->PipelineUsage.qwMesa.LowPart, - lpCtx->PipelineUsage.qwD3DFVF.HighPart, - lpCtx->PipelineUsage.qwD3DFVF.LowPart); -#endif - - // Destroy Primtive Buffers - _gldDestroyPrimitiveBuffer(&lpCtx->PB3d); - _gldDestroyPrimitiveBuffer(&lpCtx->PB2d); - - // Release DX interfaces (in reverse order) - SAFE_RELEASE(lpCtx->pDev); - SAFE_RELEASE(lpCtx->pD3D); - //SAFE_RELEASE(lpCtx->pD3DXContext); - lpCtx->pD3DXContext->lpVtbl->Release(lpCtx->pD3DXContext); - - // Free the private drawable data - free(ctx->glPriv); - ctx->glPriv = NULL; - - return TRUE; -} - -//--------------------------------------------------------------------------- - -BOOL gldCreatePrivateGlobals_DX(void) -{ -/* - ZeroMemory(&dx7Globals, sizeof(dx7Globals)); - - // Load d3d8.dll - dx8Globals.hD3D8DLL = LoadLibrary("D3D8.DLL"); - if (dx8Globals.hD3D8DLL == NULL) - return FALSE; - - // Now try and obtain Direct3DCreate8 - dx8Globals.fnDirect3DCreate8 = (FNDIRECT3DCREATE8)GetProcAddress(dx8Globals.hD3D8DLL, "Direct3DCreate8"); - if (dx8Globals.fnDirect3DCreate8 == NULL) { - FreeLibrary(dx8Globals.hD3D8DLL); - return FALSE; - } -*/ - - // Initialise D3DX - return FAILED(D3DXInitialize()) ? FALSE : TRUE; -} - -//--------------------------------------------------------------------------- - -BOOL gldDestroyPrivateGlobals_DX(void) -{ -/* - if (dx7Globals.bDirect3DDevice) { - SAFE_RELEASE(dx7Globals.pDev); - dx7Globals.bDirect3DDevice = FALSE; - } - if (dx7Globals.bDirect3D) { - SAFE_RELEASE(dx7Globals.pD3D); - dx7Globals.bDirect3D = FALSE; - } - - FreeLibrary(dx8Globals.hD3D8DLL); - dx8Globals.hD3D8DLL = NULL; - dx8Globals.fnDirect3DCreate8 = NULL; -*/ - return FAILED(D3DXUninitialize()) ? FALSE : TRUE; -} - -//--------------------------------------------------------------------------- - -static void _BitsFromDisplayFormat( - D3DX_SURFACEFORMAT fmt, - BYTE *cColorBits, - BYTE *cRedBits, - BYTE *cGreenBits, - BYTE *cBlueBits, - BYTE *cAlphaBits) -{ - switch (fmt) { -/* case D3DX_SF_X1R5G5B5: - *cColorBits = 16; - *cRedBits = 5; - *cGreenBits = 5; - *cBlueBits = 5; - *cAlphaBits = 0; - return;*/ - case D3DX_SF_R5G5B5: - *cColorBits = 16; - *cRedBits = 5; - *cGreenBits = 5; - *cBlueBits = 5; - *cAlphaBits = 0; - return; - case D3DX_SF_R5G6B5: - *cColorBits = 16; - *cRedBits = 5; - *cGreenBits = 6; - *cBlueBits = 5; - *cAlphaBits = 0; - return; - case D3DX_SF_X8R8G8B8: - *cColorBits = 32; - *cRedBits = 8; - *cGreenBits = 8; - *cBlueBits = 8; - *cAlphaBits = 0; - return; - case D3DX_SF_A8R8G8B8: - *cColorBits = 32; - *cRedBits = 8; - *cGreenBits = 8; - *cBlueBits = 8; - *cAlphaBits = 8; - return; - } - - // Should not get here! - *cColorBits = 32; - *cRedBits = 8; - *cGreenBits = 8; - *cBlueBits = 8; - *cAlphaBits = 0; -} - -//--------------------------------------------------------------------------- - -static void _BitsFromDepthStencilFormat( - D3DX_SURFACEFORMAT fmt, - BYTE *cDepthBits, - BYTE *cStencilBits) -{ - // NOTE: GL expects either 32 or 16 as depth bits. - switch (fmt) { - case D3DX_SF_Z16S0: - *cDepthBits = 16; - *cStencilBits = 0; - return; - case D3DX_SF_Z32S0: - *cDepthBits = 32; - *cStencilBits = 0; - return; - case D3DX_SF_Z15S1: - *cDepthBits = 15; - *cStencilBits = 1; - return; - case D3DX_SF_Z24S8: - *cDepthBits = 24; - *cStencilBits = 8; - return; - case D3DX_SF_S1Z15: - *cDepthBits = 15; - *cStencilBits = 1; - return; - case D3DX_SF_S8Z24: - *cDepthBits = 24; - *cStencilBits = 8; - return; - } -} - -//--------------------------------------------------------------------------- -/* -BOOL GLD_CheckDepthStencilMatch( - DWORD dwDeviceIndex, - D3DX_SURFACEFORMAT sfWant) -{ - // Emulate function built in to DX9 - D3DX_SURFACEFORMAT sfFound; - int i; - int nFormats = D3DXGetMaxSurfaceFormats(dwDeviceIndex, NULL, D3DX_SC_DEPTHBUFFER); - if (nFormats) { - for (i=0; ilpVtbl->GetZBuffer(pD3DXContext); - - // Get pixel format of depth buffer - ddpf.dwSize = sizeof(ddpf); - pZBuffer->lpVtbl->GetPixelFormat(pZBuffer, &ddpf); - // Done with surface - release it - pZBuffer->lpVtbl->Release(pZBuffer); - - // Done with D3DX context - pD3DXContext->lpVtbl->Release(pD3DXContext); - - // Convert and return - return D3DXMakeSurfaceFormat(&ddpf); -} - -//--------------------------------------------------------------------------- - -BOOL gldBuildPixelformatList_DX(void) -{ - D3DX_DEVICEDESC d3dxdd; - D3DX_VIDMODEDESC d3ddm; - D3DX_SURFACEFORMAT fmt[64]; // 64 should be enough... - DWORD dwDeviceIndex; - DWORD surfClassFlags; -// IDirect3D7 *pD3D = NULL; - HRESULT hr; - int nSupportedFormats = 0; // Total formats - int nDepthOnlyFormats = 0; - int nDepthStencilFormats = 0; - int i; - DGL_pixelFormat *pPF; - BYTE cColorBits, cRedBits, cGreenBits, cBlueBits, cAlphaBits; -// char buf[128]; -// char cat[8]; - - // Direct3D (SW or HW) - // These are arranged so that 'best' pixelformat - // is higher in the list (for ChoosePixelFormat). -/* const D3DFORMAT DepthStencil[4] = { - D3DX_SF_Z16S0, //D3DX_SF_D16, - D3DX_SF_Z15S1, //D3DX_SF_D15S1, - D3DX_SF_Z32S0, //D3DX_SF_D32, - D3DX_SF_Z24S8, //D3DX_SF_D24S8, - //D3DX_SF_D24X8, - //D3DX_SF_D24X4S4, - };*/ - - // Dump DX version - ddlogMessage(GLDLOG_SYSTEM, "DirectX Version : 7.0\n"); - - // Release any existing pixelformat list - if (glb.lpPF) { - free(glb.lpPF); - } - - glb.nPixelFormatCount = 0; - glb.lpPF = NULL; - - // - // Pixelformats for Direct3D (SW or HW) rendering - // - - dwDeviceIndex = (glb.dwDriver == GLDS_DRIVER_REF) ? D3DX_HWLEVEL_REFERENCE : D3DX_DEFAULT; - - // Dump description - D3DXGetDeviceDescription(dwDeviceIndex, &d3dxdd); - ddlogPrintf(GLDLOG_SYSTEM, "Device: %s", d3dxdd.driverDesc); - - // Get display mode - D3DXGetCurrentVideoMode(D3DX_DEFAULT, &d3ddm); - -#if 0 - // Phooey - this don't work... -/* - // Since D3DXGetMaxSurfaceFormats() can lie to us, we'll need a workaround. - // Explicitly test for matching depth/stencil to display bpp. - if (d3ddm.bpp <= 16) { - if (GLD_CheckDepthStencilMatch(dwDeviceIndex, D3DX_SF_Z16S0)) - fmt[nSupportedFormats++] = D3DX_SF_Z16S0; - if (GLD_CheckDepthStencilMatch(dwDeviceIndex, D3DX_SF_Z15S1)) - fmt[nSupportedFormats++] = D3DX_SF_Z15S1; - if (GLD_CheckDepthStencilMatch(dwDeviceIndex, D3DX_SF_S1Z15)) - fmt[nSupportedFormats++] = D3DX_SF_S1Z15; - // Didn't find anything? Try default - if (nSupportedFormats == 0) { - if (GLD_CheckDepthStencilMatch(dwDeviceIndex, D3DX_SF_Z32S0)) - fmt[nSupportedFormats++] = D3DX_SF_Z32S0; - } - } else { - if (GLD_CheckDepthStencilMatch(dwDeviceIndex, D3DX_SF_Z32S0)) - fmt[nSupportedFormats++] = D3DX_SF_Z32S0; - if (GLD_CheckDepthStencilMatch(dwDeviceIndex, D3DX_SF_Z24S8)) - fmt[nSupportedFormats++] = D3DX_SF_Z24S8; - if (GLD_CheckDepthStencilMatch(dwDeviceIndex, D3DX_SF_S8Z24)) - fmt[nSupportedFormats++] = D3DX_SF_S8Z24; - // Didn't find anything? Try default - if (nSupportedFormats == 0) { - if (GLD_CheckDepthStencilMatch(dwDeviceIndex, D3DX_SF_Z16S0)) - fmt[nSupportedFormats++] = D3DX_SF_Z16S0; - } - } -*/ - // Go the Whole Hog... - fmt[nSupportedFormats++] = _gldFindCompatibleDepthStencilFormat(dwDeviceIndex); -#else - // - // Depth buffer formats WITHOUT stencil - // - surfClassFlags = D3DX_SC_DEPTHBUFFER; - nDepthOnlyFormats = D3DXGetMaxSurfaceFormats(dwDeviceIndex, NULL, surfClassFlags); - // - // Depth buffer formats WITH stencil - // - surfClassFlags = D3DX_SC_DEPTHBUFFER | D3DX_SC_STENCILBUFFER; - nDepthStencilFormats = D3DXGetMaxSurfaceFormats(dwDeviceIndex, NULL, surfClassFlags); - - // Work out how many formats we have in total - if ((nDepthOnlyFormats + nDepthStencilFormats) == 0) - return FALSE; // Bail: no compliant pixelformats - - // Get depth buffer formats WITHOUT stencil - surfClassFlags = D3DX_SC_DEPTHBUFFER; - for (i=0; ipfd.dwFlags &= ~PFD_DOUBLEBUFFER; // Remove doublebuffer flag - pPF->pfd.cColorBits = cColorBits; - pPF->pfd.cRedBits = cRedBits; - pPF->pfd.cGreenBits = cGreenBits; - pPF->pfd.cBlueBits = cBlueBits; - pPF->pfd.cAlphaBits = cAlphaBits; - pPF->pfd.cDepthBits = 0; - pPF->pfd.cStencilBits = 0; - pPF->dwDriverData = D3DX_SF_UNKNOWN; - pPF++;*/ - - for (i=0; ipfd.dwFlags &= ~PFD_DOUBLEBUFFER; // Remove doublebuffer flag - pPF->pfd.cColorBits = cColorBits; - pPF->pfd.cRedBits = cRedBits; - pPF->pfd.cGreenBits = cGreenBits; - pPF->pfd.cBlueBits = cBlueBits; - pPF->pfd.cAlphaBits = cAlphaBits; - _BitsFromDepthStencilFormat(fmt[i], &pPF->pfd.cDepthBits, &pPF->pfd.cStencilBits); - pPF->dwDriverData = fmt[i]; - } - - // - // Add double-buffer formats - // - -/* memcpy(pPF, &pfTemplateHW, sizeof(DGL_pixelFormat)); - pPF->pfd.cColorBits = cColorBits; - pPF->pfd.cRedBits = cRedBits; - pPF->pfd.cGreenBits = cGreenBits; - pPF->pfd.cBlueBits = cBlueBits; - pPF->pfd.cAlphaBits = cAlphaBits; - pPF->pfd.cDepthBits = 0; - pPF->pfd.cStencilBits = 0; - pPF->dwDriverData = D3DX_SF_UNKNOWN; - pPF++;*/ - - for (i=0; ipfd.cColorBits = cColorBits; - pPF->pfd.cRedBits = cRedBits; - pPF->pfd.cGreenBits = cGreenBits; - pPF->pfd.cBlueBits = cBlueBits; - pPF->pfd.cAlphaBits = cAlphaBits; - _BitsFromDepthStencilFormat(fmt[i], &pPF->pfd.cDepthBits, &pPF->pfd.cStencilBits); - pPF->dwDriverData = fmt[i]; - } - - // Popup warning message if non RGB color mode - { - // This is a hack. KeithH - HDC hdcDesktop = GetDC(NULL); - DWORD dwDisplayBitDepth = GetDeviceCaps(hdcDesktop, BITSPIXEL); - ReleaseDC(0, hdcDesktop); - if (dwDisplayBitDepth <= 8) { - ddlogPrintf(DDLOG_WARN, "Current Color Depth %d bpp is not supported", dwDisplayBitDepth); - MessageBox(NULL, szColorDepthWarning, "GLDirect", MB_OK | MB_ICONWARNING); - } - } - - // Mark list as 'current' - glb.bPixelformatsDirty = FALSE; - - return TRUE; -} - -//--------------------------------------------------------------------------- - -BOOL gldInitialiseMesa_DX( - DGL_ctx *lpCtx) -{ - GLD_driver_dx7 *gld = NULL; - int MaxTextureSize, TextureLevels; - BOOL bSoftwareTnL; - - if (lpCtx == NULL) - return FALSE; - - gld = lpCtx->glPriv; - if (gld == NULL) - return FALSE; - - if (glb.bMultitexture) { - lpCtx->glCtx->Const.MaxTextureUnits = gld->d3dCaps.wMaxSimultaneousTextures; - // Only support MAX_TEXTURE_UNITS texture units. - // ** If this is altered then the FVF formats must be reviewed **. - if (lpCtx->glCtx->Const.MaxTextureUnits > GLD_MAX_TEXTURE_UNITS_DX7) - lpCtx->glCtx->Const.MaxTextureUnits = GLD_MAX_TEXTURE_UNITS_DX7; - } else { - // Multitexture override - lpCtx->glCtx->Const.MaxTextureUnits = 1; - } - - // max texture size -// MaxTextureSize = min(gld->d3dCaps8.MaxTextureHeight, gld->d3dCaps8.MaxTextureWidth); - MaxTextureSize = min(gld->d3dCaps.dwMaxTextureHeight, gld->d3dCaps.dwMaxTextureWidth); - if (MaxTextureSize == 0) - MaxTextureSize = 256; // Sanity check - - // - // HACK!! - if (MaxTextureSize > 1024) - MaxTextureSize = 1024; // HACK - CLAMP TO 1024 - // HACK!! - // - - // TODO: Check this again for Mesa 5 - // Got to set MAX_TEXTURE_SIZE as max levels. - // Who thought this stupid idea up? ;) - TextureLevels = 0; - // Calculate power-of-two. - while (MaxTextureSize) { - TextureLevels++; - MaxTextureSize >>= 1; - } - lpCtx->glCtx->Const.MaxTextureLevels = (TextureLevels) ? TextureLevels : 8; - - // Defaults - IDirect3DDevice7_SetRenderState(gld->pDev, D3DRENDERSTATE_LIGHTING, FALSE); - IDirect3DDevice7_SetRenderState(gld->pDev, D3DRENDERSTATE_CULLMODE, D3DCULL_NONE); - IDirect3DDevice7_SetRenderState(gld->pDev, D3DRENDERSTATE_DITHERENABLE, TRUE); - IDirect3DDevice7_SetRenderState(gld->pDev, D3DRENDERSTATE_SHADEMODE, D3DSHADE_GOURAUD); - - // Set texture coord set to be used with each stage - IDirect3DDevice7_SetTextureStageState(gld->pDev, 0, D3DTSS_TEXCOORDINDEX, 0); - IDirect3DDevice7_SetTextureStageState(gld->pDev, 1, D3DTSS_TEXCOORDINDEX, 1); - - // Set up Depth buffer - IDirect3DDevice7_SetRenderState(gld->pDev, D3DRENDERSTATE_ZENABLE, - (lpCtx->lpPF->dwDriverData!=D3DX_SF_UNKNOWN) ? D3DZB_TRUE : D3DZB_FALSE); - - // Set the view matrix - { - D3DXMATRIX vm; -#if 1 - D3DXMatrixIdentity(&vm); -#else - D3DXVECTOR3 Eye(0.0f, 0.0f, 0.0f); - D3DXVECTOR3 At(0.0f, 0.0f, -1.0f); - D3DXVECTOR3 Up(0.0f, 1.0f, 0.0f); - D3DXMatrixLookAtRH(&vm, &Eye, &At, &Up); - vm._31 = -vm._31; - vm._32 = -vm._32; - vm._33 = -vm._33; - vm._34 = -vm._34; -#endif - IDirect3DDevice7_SetTransform(gld->pDev, D3DTRANSFORMSTATE_VIEW, &vm); - } - -// DX7 does not support D3DRS_SOFTWAREVERTEXPROCESSING -/* - if (gld->bHasHWTnL) { - if (glb.dwTnL == GLDS_TNL_DEFAULT) - bSoftwareTnL = FALSE; // HW TnL - else { - bSoftwareTnL = ((glb.dwTnL == GLDS_TNL_MESA) || (glb.dwTnL == GLDS_TNL_D3DSW)) ? TRUE : FALSE; - } - } else { - // No HW TnL, so no choice possible - bSoftwareTnL = TRUE; - } - IDirect3DDevice8_SetRenderState(gld->pDev, D3DRS_SOFTWAREVERTEXPROCESSING, bSoftwareTnL); -*/ - -// Dump this in a Release build as well, now. -//#ifdef _DEBUG - ddlogPrintf(DDLOG_INFO, "HW TnL: %s", -// gld->bHasHWTnL ? (bSoftwareTnL ? "Disabled" : "Enabled") : "Unavailable"); - gld->bHasHWTnL ? "Enabled" : "Unavailable"); -//#endif - - // Set up interfaces to Mesa - gldEnableExtensions_DX7(lpCtx->glCtx); - gldInstallPipeline_DX7(lpCtx->glCtx); - gldSetupDriverPointers_DX7(lpCtx->glCtx); - - // Signal a complete state update - lpCtx->glCtx->Driver.UpdateState(lpCtx->glCtx, _NEW_ALL); - - // Start a scene - IDirect3DDevice7_BeginScene(gld->pDev); - lpCtx->bSceneStarted = TRUE; - - return TRUE; -} - -//--------------------------------------------------------------------------- - -BOOL gldSwapBuffers_DX( - DGL_ctx *ctx, - HDC hDC, - HWND hWnd) -{ - HRESULT hr; - GLD_driver_dx7 *gld = NULL; - DWORD dwFlags; - - if (ctx == NULL) - return FALSE; - - gld = ctx->glPriv; - if (gld == NULL) - return FALSE; - - - // End the scene if one is started - if (ctx->bSceneStarted) { - IDirect3DDevice7_EndScene(gld->pDev); - ctx->bSceneStarted = FALSE; - } - - // Needed by D3DX for MDI multi-window apps (DaveM) - if (lpDDClipper) - IDirectDrawClipper_SetHWnd(lpDDClipper, 0, hWnd); - - // Swap the buffers. hWnd may override the hWnd used for CreateDevice() -// hr = IDirect3DDevice8_Present(gld->pDev, NULL, NULL, hWnd, NULL); - - // Set refresh sync flag - dwFlags = glb.bWaitForRetrace ? 0 : D3DX_UPDATE_NOVSYNC; - // Render and show frame - hr = gld->pD3DXContext->lpVtbl->UpdateFrame(gld->pD3DXContext, dwFlags); - if (FAILED(hr)) - ddlogError(DDLOG_WARN, "gldSwapBuffers_DX: UpdateFrame", hr); - - if (hr == DDERR_SURFACELOST) { - hr = gld->pD3DXContext->lpVtbl->RestoreSurfaces(gld->pD3DXContext); - if (FAILED(hr)) - ddlogError(DDLOG_WARN, "gldSwapBuffers_DX: RestoreSurfaces", hr); - } - -exit_swap: - // Begin a new scene - IDirect3DDevice7_BeginScene(gld->pDev); - ctx->bSceneStarted = TRUE; - - return (FAILED(hr)) ? FALSE : TRUE; -} - -//--------------------------------------------------------------------------- - -BOOL gldGetDisplayMode_DX( - DGL_ctx *ctx, - GLD_displayMode *glddm) -{ -// D3DDISPLAYMODE d3ddm; - D3DX_VIDMODEDESC d3ddm; - HRESULT hr; - GLD_driver_dx7 *lpCtx = NULL; - BYTE cColorBits, cRedBits, cGreenBits, cBlueBits, cAlphaBits; - - if ((glddm == NULL) || (ctx == NULL)) - return FALSE; - - lpCtx = ctx->glPriv; - if (lpCtx == NULL) - return FALSE; - - if (lpCtx->pD3D == NULL) - return FALSE; - -// hr = IDirect3D8_GetAdapterDisplayMode(lpCtx->pD3D, glb.dwAdapter, &d3ddm); - hr = D3DXGetCurrentVideoMode(D3DX_DEFAULT, &d3ddm); - if (FAILED(hr)) - return FALSE; - - // Get info from the display format -// _BitsFromDisplayFormat(d3ddm.Format, -// &cColorBits, &cRedBits, &cGreenBits, &cBlueBits, &cAlphaBits); - - glddm->Width = d3ddm.width; - glddm->Height = d3ddm.height; - glddm->BPP = d3ddm.bpp; - glddm->Refresh = d3ddm.refreshRate; - - return TRUE; -} - -//--------------------------------------------------------------------------- - diff --git a/src/mesa/drivers/windows/gldirect/dx8/gld_driver_dx8.c b/src/mesa/drivers/windows/gldirect/dx8/gld_driver_dx8.c deleted file mode 100644 index 7afa9190cd..0000000000 --- a/src/mesa/drivers/windows/gldirect/dx8/gld_driver_dx8.c +++ /dev/null @@ -1,1176 +0,0 @@ -/**************************************************************************** -* -* Mesa 3-D graphics library -* Direct3D Driver Interface -* -* ======================================================================== -* -* Copyright (C) 1991-2004 SciTech Software, Inc. All rights reserved. -* -* Permission is hereby granted, free of charge, to any person obtaining a -* copy of this software and associated documentation files (the "Software"), -* to deal in the Software without restriction, including without limitation -* the rights to use, copy, modify, merge, publish, distribute, sublicense, -* and/or sell copies of the Software, and to permit persons to whom the -* Software is furnished to do so, subject to the following conditions: -* -* The above copyright notice and this permission notice shall be included -* in all copies or substantial portions of the Software. -* -* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -* SCITECH SOFTWARE INC BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF -* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -* SOFTWARE. -* -* ====================================================================== -* -* Language: ANSI C -* Environment: Windows 9x/2000/XP/XBox (Win32) -* -* Description: Driver interface code to Mesa -* -****************************************************************************/ - -//#include -#include "dglcontext.h" -#include "ddlog.h" -#include "gld_dx8.h" - -#include "glheader.h" -#include "context.h" -#include "colormac.h" -#include "depth.h" -#include "extensions.h" -#include "macros.h" -#include "matrix.h" -// #include "mem.h" -//#include "mmath.h" -#include "mtypes.h" -#include "texformat.h" -#include "teximage.h" -#include "texstore.h" -#include "vbo/vbo.h" -#include "swrast_setup/swrast_setup.h" -#include "swrast_setup/ss_context.h" -#include "tnl/tnl.h" -#include "tnl/t_context.h" -#include "tnl/t_pipeline.h" - -extern BOOL dglSwapBuffers(HDC hDC); - -// HACK: Hack the _33 member of the OpenGL perspective projection matrix -const float _fPersp_33 = 1.6f; - -//--------------------------------------------------------------------------- -// Internal functions -//--------------------------------------------------------------------------- - -void _gld_mesa_warning( - __GLcontext *gc, - char *str) -{ - // Intercept Mesa's internal warning mechanism - gldLogPrintf(GLDLOG_WARN, "Mesa warning: %s", str); -} - -//--------------------------------------------------------------------------- - -void _gld_mesa_fatal( - __GLcontext *gc, - char *str) -{ - // Intercept Mesa's internal fatal-message mechanism - gldLogPrintf(GLDLOG_CRITICAL, "Mesa FATAL: %s", str); - - // Mesa calls abort(0) here. - ddlogClose(); - exit(0); -} - -//--------------------------------------------------------------------------- - -D3DSTENCILOP _gldConvertStencilOp( - GLenum StencilOp) -{ - // Used by Stencil: pass, fail and zfail - - switch (StencilOp) { - case GL_KEEP: - return D3DSTENCILOP_KEEP; - case GL_ZERO: - return D3DSTENCILOP_ZERO; - case GL_REPLACE: - return D3DSTENCILOP_REPLACE; - case GL_INCR: - return D3DSTENCILOP_INCRSAT; - case GL_DECR: - return D3DSTENCILOP_DECRSAT; - case GL_INVERT: - return D3DSTENCILOP_INVERT; - case GL_INCR_WRAP_EXT: // GL_EXT_stencil_wrap - return D3DSTENCILOP_INCR; - case GL_DECR_WRAP_EXT: // GL_EXT_stencil_wrap - return D3DSTENCILOP_DECR; - } - -#ifdef _DEBUG - gldLogMessage(GLDLOG_ERROR, "_gldConvertStencilOp: Unknown StencilOp\n"); -#endif - - return D3DSTENCILOP_KEEP; -} - -//--------------------------------------------------------------------------- - -D3DCMPFUNC _gldConvertCompareFunc( - GLenum CmpFunc) -{ - // Used for Alpha func, depth func and stencil func. - - switch (CmpFunc) { - case GL_NEVER: - return D3DCMP_NEVER; - case GL_LESS: - return D3DCMP_LESS; - case GL_EQUAL: - return D3DCMP_EQUAL; - case GL_LEQUAL: - return D3DCMP_LESSEQUAL; - case GL_GREATER: - return D3DCMP_GREATER; - case GL_NOTEQUAL: - return D3DCMP_NOTEQUAL; - case GL_GEQUAL: - return D3DCMP_GREATEREQUAL; - case GL_ALWAYS: - return D3DCMP_ALWAYS; - }; - -#ifdef _DEBUG - gldLogMessage(GLDLOG_ERROR, "_gldConvertCompareFunc: Unknown CompareFunc\n"); -#endif - - return D3DCMP_ALWAYS; -} - -//--------------------------------------------------------------------------- - -D3DBLEND _gldConvertBlendFunc( - GLenum blend, - GLenum DefaultBlend) -{ - switch (blend) { - case GL_ZERO: - return D3DBLEND_ZERO; - case GL_ONE: - return D3DBLEND_ONE; - case GL_DST_COLOR: - return D3DBLEND_DESTCOLOR; - case GL_SRC_COLOR: - return D3DBLEND_SRCCOLOR; - case GL_ONE_MINUS_DST_COLOR: - return D3DBLEND_INVDESTCOLOR; - case GL_ONE_MINUS_SRC_COLOR: - return D3DBLEND_INVSRCCOLOR; - case GL_SRC_ALPHA: - return D3DBLEND_SRCALPHA; - case GL_ONE_MINUS_SRC_ALPHA: - return D3DBLEND_INVSRCALPHA; - case GL_DST_ALPHA: - return D3DBLEND_DESTALPHA; - case GL_ONE_MINUS_DST_ALPHA: - return D3DBLEND_INVDESTALPHA; - case GL_SRC_ALPHA_SATURATE: - return D3DBLEND_SRCALPHASAT; - } - -#ifdef _DEBUG - gldLogMessage(GLDLOG_ERROR, "_gldConvertBlendFunc: Unknown BlendFunc\n"); -#endif - - return DefaultBlend; -} - -//--------------------------------------------------------------------------- -// Misc. functions -//--------------------------------------------------------------------------- - -void gld_Noop_DX8( - GLcontext *ctx) -{ -#ifdef _DEBUG - gldLogMessage(GLDLOG_ERROR, "gld_Noop called!\n"); -#endif -} - -//--------------------------------------------------------------------------- - -void gld_Error_DX8( - GLcontext *ctx) -{ -#ifdef _DEBUG - // Quite useless. -// gldLogMessage(GLDLOG_ERROR, "ctx->Driver.Error called!\n"); -#endif -} - -//--------------------------------------------------------------------------- -// Required Mesa functions -//--------------------------------------------------------------------------- - -static GLboolean gld_set_draw_buffer_DX8( - GLcontext *ctx, - GLenum mode) -{ - (void) ctx; - if ((mode==GL_FRONT_LEFT) || (mode == GL_BACK_LEFT)) { - return GL_TRUE; - } - else { - return GL_FALSE; - } -} - -//--------------------------------------------------------------------------- - -static void gld_set_read_buffer_DX8( - GLcontext *ctx, - GLframebuffer *buffer, - GLenum mode) -{ - /* separate read buffer not supported */ -/* - ASSERT(buffer == ctx->DrawBuffer); - ASSERT(mode == GL_FRONT_LEFT); -*/ -} - -//--------------------------------------------------------------------------- - -void gld_Clear_DX8( - GLcontext *ctx, - GLbitfield mask, - GLboolean all, - GLint x, - GLint y, - GLint width, - GLint height) -{ - GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); - GLD_driver_dx8 *gld = GLD_GET_DX8_DRIVER(gldCtx); - - DWORD dwFlags = 0; - D3DCOLOR Color = 0; - float Z = 0.0f; - DWORD Stencil = 0; - D3DRECT d3dClearRect; - - // TODO: Colourmask - const GLuint *colorMask = (GLuint *) &ctx->Color.ColorMask; - - if (!gld->pDev) - return; - - if (mask & (DD_FRONT_LEFT_BIT | DD_BACK_LEFT_BIT)) { - GLubyte col[4]; - CLAMPED_FLOAT_TO_UBYTE(col[0], ctx->Color.ClearColor[0]); - CLAMPED_FLOAT_TO_UBYTE(col[1], ctx->Color.ClearColor[1]); - CLAMPED_FLOAT_TO_UBYTE(col[2], ctx->Color.ClearColor[2]); - CLAMPED_FLOAT_TO_UBYTE(col[3], ctx->Color.ClearColor[3]); - dwFlags |= D3DCLEAR_TARGET; - Color = D3DCOLOR_RGBA(col[0], col[1], col[2], col[3]); -// ctx->Color.ClearColor[1], -// ctx->Color.ClearColor[2], -// ctx->Color.ClearColor[3]); - } - - if (mask & DD_DEPTH_BIT) { - // D3D8 will fail the Clear call if we try and clear a - // depth buffer and we haven't created one. - // Also, some apps try and clear a depth buffer, - // when a depth buffer hasn't been requested by the app. - if (ctx->Visual.depthBits == 0) { - mask &= ~DD_DEPTH_BIT; // Remove depth bit from mask - } else { - dwFlags |= D3DCLEAR_ZBUFFER; - Z = ctx->Depth.Clear; - } - } - - if (mask & DD_STENCIL_BIT) { - if (ctx->Visual.stencilBits == 0) { - // No stencil bits in depth buffer - mask &= ~DD_STENCIL_BIT; // Remove stencil bit from mask - } else { - dwFlags |= D3DCLEAR_STENCIL; - Stencil = ctx->Stencil.Clear; - } - } - - // Some apps do really weird things with the rect, such as Quake3. - if ((x < 0) || (y < 0) || (width <= 0) || (height <= 0)) { - all = GL_TRUE; - } - - if (!all) { - // Calculate clear subrect - d3dClearRect.x1 = x; - d3dClearRect.y1 = gldCtx->dwHeight - (y + height); - d3dClearRect.x2 = x + width; - d3dClearRect.y2 = d3dClearRect.y1 + height; - } - - // dwFlags will be zero if there's nothing to clear - if (dwFlags) { - _GLD_DX8_DEV(Clear( - gld->pDev, - all ? 0 : 1, - all ? NULL : &d3dClearRect, - dwFlags, - Color, Z, Stencil)); - } - - if (mask & DD_ACCUM_BIT) { - // Clear accumulation buffer - } -} - -//--------------------------------------------------------------------------- - -// Mesa 5: Parameter change -static void gld_buffer_size_DX8( -// GLcontext *ctx, - GLframebuffer *fb, - GLuint *width, - GLuint *height) -{ -// GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); - - *width = fb->Width; // gldCtx->dwWidth; - *height = fb->Height; // gldCtx->dwHeight; -} - -//--------------------------------------------------------------------------- - -static void gld_Finish_DX8( - GLcontext *ctx) -{ -} - -//--------------------------------------------------------------------------- - -static void gld_Flush_DX8( - GLcontext *ctx) -{ - GLD_context *gld = GLD_GET_CONTEXT(ctx); - - // TODO: Detect apps that glFlush() then SwapBuffers() ? - - if (gld->EmulateSingle) { - // Emulating a single-buffered context. - // [Direct3D doesn't allow rendering to front buffer] - dglSwapBuffers(gld->hDC); - } -} - -//--------------------------------------------------------------------------- - -void gld_NEW_STENCIL( - GLcontext *ctx) -{ - GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); - GLD_driver_dx8 *gld = GLD_GET_DX8_DRIVER(gldCtx); - - // Two-sided stencil. New for Mesa 5 - const GLuint uiFace = 0UL; - - struct gl_stencil_attrib *pStencil = &ctx->Stencil; - - _GLD_DX8_DEV(SetRenderState(gld->pDev, D3DRS_STENCILENABLE, pStencil->Enabled ? TRUE : FALSE)); - if (pStencil->Enabled) { - _GLD_DX8_DEV(SetRenderState(gld->pDev, D3DRS_STENCILFUNC, _gldConvertCompareFunc(pStencil->Function[uiFace]))); - _GLD_DX8_DEV(SetRenderState(gld->pDev, D3DRS_STENCILREF, pStencil->Ref[uiFace])); - _GLD_DX8_DEV(SetRenderState(gld->pDev, D3DRS_STENCILMASK, pStencil->ValueMask[uiFace])); - _GLD_DX8_DEV(SetRenderState(gld->pDev, D3DRS_STENCILWRITEMASK, pStencil->WriteMask[uiFace])); - _GLD_DX8_DEV(SetRenderState(gld->pDev, D3DRS_STENCILFAIL, _gldConvertStencilOp(pStencil->FailFunc[uiFace]))); - _GLD_DX8_DEV(SetRenderState(gld->pDev, D3DRS_STENCILZFAIL, _gldConvertStencilOp(pStencil->ZFailFunc[uiFace]))); - _GLD_DX8_DEV(SetRenderState(gld->pDev, D3DRS_STENCILPASS, _gldConvertStencilOp(pStencil->ZPassFunc[uiFace]))); - } -} - -//--------------------------------------------------------------------------- - -void gld_NEW_COLOR( - GLcontext *ctx) -{ - GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); - GLD_driver_dx8 *gld = GLD_GET_DX8_DRIVER(gldCtx); - - DWORD dwFlags = 0; - D3DBLEND src; - D3DBLEND dest; - - // Alpha func - _GLD_DX8_DEV(SetRenderState(gld->pDev, D3DRS_ALPHAFUNC, _gldConvertCompareFunc(ctx->Color.AlphaFunc))); - _GLD_DX8_DEV(SetRenderState(gld->pDev, D3DRS_ALPHAREF, (DWORD)ctx->Color.AlphaRef)); - _GLD_DX8_DEV(SetRenderState(gld->pDev, D3DRS_ALPHATESTENABLE, ctx->Color.AlphaEnabled)); - - // Blend func - _GLD_DX8_DEV(SetRenderState(gld->pDev, D3DRS_ALPHABLENDENABLE, ctx->Color.BlendEnabled)); - src = _gldConvertBlendFunc(ctx->Color.BlendSrcRGB, GL_ONE); - dest = _gldConvertBlendFunc(ctx->Color.BlendDstRGB, GL_ZERO); - _GLD_DX8_DEV(SetRenderState(gld->pDev, D3DRS_SRCBLEND, src)); - _GLD_DX8_DEV(SetRenderState(gld->pDev, D3DRS_DESTBLEND, dest)); - - // Color mask - if (ctx->Color.ColorMask[0]) dwFlags |= D3DCOLORWRITEENABLE_RED; - if (ctx->Color.ColorMask[1]) dwFlags |= D3DCOLORWRITEENABLE_GREEN; - if (ctx->Color.ColorMask[2]) dwFlags |= D3DCOLORWRITEENABLE_BLUE; - if (ctx->Color.ColorMask[3]) dwFlags |= D3DCOLORWRITEENABLE_ALPHA; - _GLD_DX8_DEV(SetRenderState(gld->pDev, D3DRS_COLORWRITEENABLE, dwFlags)); -} - -//--------------------------------------------------------------------------- - -void gld_NEW_DEPTH( - GLcontext *ctx) -{ - GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); - GLD_driver_dx8 *gld = GLD_GET_DX8_DRIVER(gldCtx); - - _GLD_DX8_DEV(SetRenderState(gld->pDev, D3DRS_ZENABLE, ctx->Depth.Test ? D3DZB_TRUE : D3DZB_FALSE)); - _GLD_DX8_DEV(SetRenderState(gld->pDev, D3DRS_ZFUNC, _gldConvertCompareFunc(ctx->Depth.Func))); - _GLD_DX8_DEV(SetRenderState(gld->pDev, D3DRS_ZWRITEENABLE, ctx->Depth.Mask ? TRUE : FALSE)); -} - -//--------------------------------------------------------------------------- - -void gld_NEW_POLYGON( - GLcontext *ctx) -{ - GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); - GLD_driver_dx8 *gld = GLD_GET_DX8_DRIVER(gldCtx); - - D3DFILLMODE d3dFillMode = D3DFILL_SOLID; - D3DCULL d3dCullMode = D3DCULL_NONE; - int iOffset = 0; - - // Fillmode - switch (ctx->Polygon.FrontMode) { - case GL_POINT: - d3dFillMode = D3DFILL_POINT; - break; - case GL_LINE: - d3dFillMode = D3DFILL_WIREFRAME; - break; - case GL_FILL: - d3dFillMode = D3DFILL_SOLID; - break; - } - _GLD_DX8_DEV(SetRenderState(gld->pDev, D3DRS_FILLMODE, d3dFillMode)); - - if (ctx->Polygon.CullFlag) { - switch (ctx->Polygon.CullFaceMode) { - case GL_BACK: - if (ctx->Polygon.FrontFace == GL_CCW) - d3dCullMode = D3DCULL_CW; - else - d3dCullMode = D3DCULL_CCW; - break; - case GL_FRONT: - if (ctx->Polygon.FrontFace == GL_CCW) - d3dCullMode = D3DCULL_CCW; - else - d3dCullMode = D3DCULL_CW; - break; - case GL_FRONT_AND_BACK: - d3dCullMode = D3DCULL_NONE; - break; - default: - break; - } - } else { - d3dCullMode = D3DCULL_NONE; - } -// d3dCullMode = D3DCULL_NONE; // TODO: DEBUGGING - _GLD_DX8_DEV(SetRenderState(gld->pDev, D3DRS_CULLMODE, d3dCullMode)); - - // Polygon offset - // ZBIAS ranges from 0 to 16 and can only move towards the viewer - // Mesa5: ctx->Polygon._OffsetAny removed - if (ctx->Polygon.OffsetFill) { - iOffset = (int)ctx->Polygon.OffsetUnits; - if (iOffset < 0) - iOffset = -iOffset; - else - iOffset = 0; // D3D can't push away - } - _GLD_DX8_DEV(SetRenderState(gld->pDev, D3DRS_ZBIAS, iOffset)); -} - -//--------------------------------------------------------------------------- - -void gld_NEW_FOG( - GLcontext *ctx) -{ - GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); - GLD_driver_dx8 *gld = GLD_GET_DX8_DRIVER(gldCtx); - - D3DCOLOR d3dFogColour; - D3DFOGMODE d3dFogMode = D3DFOG_LINEAR; - - // TODO: Fog is calculated seperately in the Mesa pipeline - _GLD_DX8_DEV(SetRenderState(gld->pDev, D3DRS_FOGENABLE, FALSE)); - return; - - // Fog enable - _GLD_DX8_DEV(SetRenderState(gld->pDev, D3DRS_FOGENABLE, ctx->Fog.Enabled)); - if (!ctx->Fog.Enabled) { - _GLD_DX8_DEV(SetRenderState(gld->pDev, D3DRS_FOGTABLEMODE, D3DFOG_NONE)); - _GLD_DX8_DEV(SetRenderState(gld->pDev, D3DRS_FOGVERTEXMODE, D3DFOG_NONE)); - return; // If disabled, don't bother setting any fog state - } - - // Fog colour - d3dFogColour = D3DCOLOR_COLORVALUE( ctx->Fog.Color[0], - ctx->Fog.Color[1], - ctx->Fog.Color[2], - ctx->Fog.Color[3]); - _GLD_DX8_DEV(SetRenderState(gld->pDev, D3DRS_FOGCOLOR, d3dFogColour)); - - // Fog density - _GLD_DX8_DEV(SetRenderState(gld->pDev, D3DRS_FOGDENSITY, *((DWORD*) (&ctx->Fog.Density)))); - - // Fog start - _GLD_DX8_DEV(SetRenderState(gld->pDev, D3DRS_FOGSTART, *((DWORD*) (&ctx->Fog.Start)))); - - // Fog end - _GLD_DX8_DEV(SetRenderState(gld->pDev, D3DRS_FOGEND, *((DWORD*) (&ctx->Fog.End)))); - - // Fog mode - switch (ctx->Fog.Mode) { - case GL_LINEAR: - d3dFogMode = D3DFOG_LINEAR; - break; - case GL_EXP: - d3dFogMode = D3DFOG_EXP; - break; - case GL_EXP2: - d3dFogMode = D3DFOG_EXP2; - break; - } - _GLD_DX8_DEV(SetRenderState(gld->pDev, D3DRS_FOGTABLEMODE, d3dFogMode)); - _GLD_DX8_DEV(SetRenderState(gld->pDev, D3DRS_FOGVERTEXMODE, D3DFOG_NONE)); -} - -//--------------------------------------------------------------------------- - -void gld_NEW_LIGHT( - GLcontext *ctx) -{ - GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); - GLD_driver_dx8 *gld = GLD_GET_DX8_DRIVER(gldCtx); - DWORD dwSpecularEnable; - - // Shademode - _GLD_DX8_DEV(SetRenderState(gld->pDev, D3DRS_SHADEMODE, (ctx->Light.ShadeModel == GL_SMOOTH) ? D3DSHADE_GOURAUD : D3DSHADE_FLAT)); - - // Separate specular colour - if (ctx->Light.Enabled) - dwSpecularEnable = (ctx->_TriangleCaps & DD_SEPARATE_SPECULAR) ? TRUE: FALSE; - else - dwSpecularEnable = FALSE; - _GLD_DX8_DEV(SetRenderState(gld->pDev, D3DRS_SPECULARENABLE, dwSpecularEnable)); -} - -//--------------------------------------------------------------------------- - -void gld_NEW_MODELVIEW( - GLcontext *ctx) -{ - GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); - GLD_driver_dx8 *gld = GLD_GET_DX8_DRIVER(gldCtx); - - D3DMATRIX m; - //GLfloat *pM = ctx->ModelView.m; - // Mesa5: Model-view is now a stack - GLfloat *pM = ctx->ModelviewMatrixStack.Top->m; - m._11 = pM[0]; - m._12 = pM[1]; - m._13 = pM[2]; - m._14 = pM[3]; - m._21 = pM[4]; - m._22 = pM[5]; - m._23 = pM[6]; - m._24 = pM[7]; - m._31 = pM[8]; - m._32 = pM[9]; - m._33 = pM[10]; - m._34 = pM[11]; - m._41 = pM[12]; - m._42 = pM[13]; - m._43 = pM[14]; - m._44 = pM[15]; - - gld->matModelView = m; -} - -//--------------------------------------------------------------------------- - -void gld_NEW_PROJECTION( - GLcontext *ctx) -{ - GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); - GLD_driver_dx8 *gld = GLD_GET_DX8_DRIVER(gldCtx); - - D3DMATRIX m; - //GLfloat *pM = ctx->ProjectionMatrix.m; - // Mesa 5: Now a stack - GLfloat *pM = ctx->ProjectionMatrixStack.Top->m; - m._11 = pM[0]; - m._12 = pM[1]; - m._13 = pM[2]; - m._14 = pM[3]; - - m._21 = pM[4]; - m._22 = pM[5]; - m._23 = pM[6]; - m._24 = pM[7]; - - m._31 = pM[8]; - m._32 = pM[9]; - m._33 = pM[10] / _fPersp_33; // / 1.6f; - m._34 = pM[11]; - - m._41 = pM[12]; - m._42 = pM[13]; - m._43 = pM[14] / 2.0f; - m._44 = pM[15]; - - gld->matProjection = m; -} - -//--------------------------------------------------------------------------- -/* -void gldFrustumHook_DX8( - GLdouble left, - GLdouble right, - GLdouble bottom, - GLdouble top, - GLdouble nearval, - GLdouble farval) -{ - GET_CURRENT_CONTEXT(ctx); - GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); - GLD_driver_dx8 *gld = GLD_GET_DX8_DRIVER(gldCtx); - - // Pass values on to Mesa first (in case we mess with them) - _mesa_Frustum(left, right, bottom, top, nearval, farval); - - _fPersp_33 = farval / (nearval - farval); - -// ddlogPrintf(GLDLOG_SYSTEM, "Frustum: %f", farval/nearval); -} - -//--------------------------------------------------------------------------- - -void gldOrthoHook_DX8( - GLdouble left, - GLdouble right, - GLdouble bottom, - GLdouble top, - GLdouble nearval, - GLdouble farval) -{ - GET_CURRENT_CONTEXT(ctx); - GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); - GLD_driver_dx8 *gld = GLD_GET_DX8_DRIVER(gldCtx); - - // Pass values on to Mesa first (in case we mess with them) - _mesa_Ortho(left, right, bottom, top, nearval, farval); - - _fPersp_33 = 1.6f; - -// ddlogPrintf(GLDLOG_SYSTEM, "Ortho: %f", farval/nearval); -} -*/ -//--------------------------------------------------------------------------- - -void gld_NEW_VIEWPORT( - GLcontext *ctx) -{ - GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); - GLD_driver_dx8 *gld = GLD_GET_DX8_DRIVER(gldCtx); - - D3DVIEWPORT8 d3dvp; -// GLint x, y; -// GLsizei w, h; - - // Set depth range - _GLD_DX8_DEV(GetViewport(gld->pDev, &d3dvp)); - // D3D can't do Quake1/Quake2 z-trick - if (ctx->Viewport.Near <= ctx->Viewport.Far) { - d3dvp.MinZ = ctx->Viewport.Near; - d3dvp.MaxZ = ctx->Viewport.Far; - } else { - d3dvp.MinZ = ctx->Viewport.Far; - d3dvp.MaxZ = ctx->Viewport.Near; - } -/* x = ctx->Viewport.X; - y = ctx->Viewport.Y; - w = ctx->Viewport.Width; - h = ctx->Viewport.Height; - if (x < 0) x = 0; - if (y < 0) y = 0; - if (w > gldCtx->dwWidth) w = gldCtx->dwWidth; - if (h > gldCtx->dwHeight) h = gldCtx->dwHeight; - // Ditto for D3D viewport dimensions - if (w+x > gldCtx->dwWidth) w = gldCtx->dwWidth-x; - if (h+y > gldCtx->dwHeight) h = gldCtx->dwHeight-y; - d3dvp.X = x; - d3dvp.Y = gldCtx->dwHeight - (y + h); - d3dvp.Width = w; - d3dvp.Height = h;*/ - _GLD_DX8_DEV(SetViewport(gld->pDev, &d3dvp)); - -// gld->fFlipWindowY = (float)gldCtx->dwHeight; -} - -//--------------------------------------------------------------------------- - -__inline BOOL _gldAnyEvalEnabled( - GLcontext *ctx) -{ - struct gl_eval_attrib *eval = &ctx->Eval; - - if ((eval->AutoNormal) || - (eval->Map1Color4) || - (eval->Map1Index) || - (eval->Map1Normal) || - (eval->Map1TextureCoord1) || - (eval->Map1TextureCoord2) || - (eval->Map1TextureCoord3) || - (eval->Map1TextureCoord4) || - (eval->Map1Vertex3) || - (eval->Map1Vertex4) || - (eval->Map2Color4) || - (eval->Map2Index) || - (eval->Map2Normal) || - (eval->Map2TextureCoord1) || - (eval->Map2TextureCoord2) || - (eval->Map2TextureCoord3) || - (eval->Map2TextureCoord4) || - (eval->Map2Vertex3) || - (eval->Map2Vertex4) - ) - return TRUE; - - return FALSE; -} - -//--------------------------------------------------------------------------- - -BOOL _gldChooseInternalPipeline( - GLcontext *ctx, - GLD_driver_dx8 *gld) -{ -// return TRUE; // DEBUGGING: ALWAYS USE MESA -// return FALSE; // DEBUGGING: ALWAYS USE D3D - - if ((glb.dwTnL == GLDS_TNL_MESA) || (gld->bHasHWTnL == FALSE)) - { - gld->PipelineUsage.qwMesa.QuadPart++; - return TRUE; // Force Mesa TnL - } - - if ((ctx->Light.Enabled) || - (1) || - (ctx->Texture._TexGenEnabled) || - (ctx->Texture._TexMatEnabled) || -// (ctx->Transform._AnyClip) || - (ctx->Scissor.Enabled) || - _gldAnyEvalEnabled(ctx) // Put this last so we can early-out - ) - { - gld->PipelineUsage.qwMesa.QuadPart++; - return TRUE; - } - - gld->PipelineUsage.qwD3DFVF.QuadPart++; - return FALSE; - -/* // Force Mesa pipeline? - if (glb.dwTnL == GLDS_TNL_MESA) { - gld->PipelineUsage.dwMesa.QuadPart++; - return GLD_PIPELINE_MESA; - } - - // Test for functionality not exposed in the D3D pathways - if ((ctx->Texture._GenFlags)) { - gld->PipelineUsage.dwMesa.QuadPart++; - return GLD_PIPELINE_MESA; - } - - // Now decide if vertex shader can be used. - // If two sided lighting is enabled then we must either - // use Mesa TnL or the vertex shader - if (ctx->_TriangleCaps & DD_TRI_LIGHT_TWOSIDE) { - if (gld->VStwosidelight.hShader && !ctx->Fog.Enabled) { - // Use Vertex Shader - gld->PipelineUsage.dwD3D2SVS.QuadPart++; - return GLD_PIPELINE_D3D_VS_TWOSIDE; - } else { - // Use Mesa TnL - gld->PipelineUsage.dwMesa.QuadPart++; - return GLD_PIPELINE_MESA; - } - } - - // Must be D3D fixed-function pipeline - gld->PipelineUsage.dwD3DFVF.QuadPart++; - return GLD_PIPELINE_D3D_FVF; -*/ -} - -//--------------------------------------------------------------------------- - -void gld_update_state_DX8( - GLcontext *ctx, - GLuint new_state) -{ - GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); - GLD_driver_dx8 *gld = GLD_GET_DX8_DRIVER(gldCtx); - TNLcontext *tnl = TNL_CONTEXT(ctx); - GLD_pb_dx8 *gldPB; - - if (!gld || !gld->pDev) - return; - - _swsetup_InvalidateState( ctx, new_state ); - _vbo_InvalidateState( ctx, new_state ); - _tnl_InvalidateState( ctx, new_state ); - - // SetupIndex will be used in the pipelines for choosing setup function - if ((ctx->_TriangleCaps & (DD_TRI_LIGHT_TWOSIDE | DD_SEPARATE_SPECULAR)) || - (ctx->Fog.Enabled)) - { - if (ctx->_TriangleCaps & DD_FLATSHADE) - gld->iSetupFunc = GLD_SI_FLAT_EXTRAS; - else - gld->iSetupFunc = GLD_SI_SMOOTH_EXTRAS; - } else { - if (ctx->_TriangleCaps & DD_FLATSHADE) - gld->iSetupFunc = GLD_SI_FLAT; // Setup flat shade + texture - else - gld->iSetupFunc = GLD_SI_SMOOTH; // Setup smooth shade + texture - } - - gld->bUseMesaTnL = _gldChooseInternalPipeline(ctx, gld); - if (gld->bUseMesaTnL) { - gldPB = &gld->PB2d; - _GLD_DX8_DEV(SetRenderState(gld->pDev, D3DRS_SOFTWAREVERTEXPROCESSING, TRUE)); - _GLD_DX8_DEV(SetRenderState(gld->pDev, D3DRS_CLIPPING, FALSE)); - _GLD_DX8_DEV(SetVertexShader(gld->pDev, gldPB->dwFVF)); - } else { - gldPB = &gld->PB3d; - _GLD_DX8_DEV(SetRenderState(gld->pDev, D3DRS_CLIPPING, TRUE)); -// if (gld->TnLPipeline == GLD_PIPELINE_D3D_VS_TWOSIDE) { -// _GLD_DX8_DEV(SetRenderState(gld->pDev, D3DRS_SOFTWAREVERTEXPROCESSING, !gld->VStwosidelight.bHardware)); -// _GLD_DX8_DEV(SetVertexShader(gld->pDev, gld->VStwosidelight.hShader)); -// } else { - _GLD_DX8_DEV(SetRenderState(gld->pDev, D3DRS_SOFTWAREVERTEXPROCESSING, !gld->bHasHWTnL)); - _GLD_DX8_DEV(SetVertexShader(gld->pDev, gldPB->dwFVF)); -// } - } - -#define _GLD_TEST_STATE(a) \ - if (new_state & (a)) { \ - gld##a(ctx); \ - new_state &= ~(a); \ - } - -#define _GLD_TEST_STATE_DX8(a) \ - if (new_state & (a)) { \ - gld##a##_DX8(ctx); \ - new_state &= ~(a); \ - } - -#define _GLD_IGNORE_STATE(a) new_state &= ~(a); - -// if (!gld->bUseMesaTnL) { - // Not required if Mesa is doing the TnL. - // Problem: If gld->bUseMesaTnL is TRUE when these are signaled, - // then we'll miss updating the D3D TnL pipeline. - // Therefore, don't test for gld->bUseMesaTnL - _GLD_TEST_STATE(_NEW_MODELVIEW); - _GLD_TEST_STATE(_NEW_PROJECTION); -// } - - _GLD_TEST_STATE_DX8(_NEW_TEXTURE); // extern, so guard with _DX8 - _GLD_TEST_STATE(_NEW_COLOR); - _GLD_TEST_STATE(_NEW_DEPTH); - _GLD_TEST_STATE(_NEW_POLYGON); - _GLD_TEST_STATE(_NEW_STENCIL); - _GLD_TEST_STATE(_NEW_FOG); - _GLD_TEST_STATE(_NEW_LIGHT); - _GLD_TEST_STATE(_NEW_VIEWPORT); - - _GLD_IGNORE_STATE(_NEW_TRANSFORM); - - -// Stubs for future use. -/* _GLD_TEST_STATE(_NEW_TEXTURE_MATRIX); - _GLD_TEST_STATE(_NEW_COLOR_MATRIX); - _GLD_TEST_STATE(_NEW_ACCUM); - _GLD_TEST_STATE(_NEW_EVAL); - _GLD_TEST_STATE(_NEW_HINT); - _GLD_TEST_STATE(_NEW_LINE); - _GLD_TEST_STATE(_NEW_PIXEL); - _GLD_TEST_STATE(_NEW_POINT); - _GLD_TEST_STATE(_NEW_POLYGONSTIPPLE); - _GLD_TEST_STATE(_NEW_SCISSOR); - _GLD_TEST_STATE(_NEW_PACKUNPACK); - _GLD_TEST_STATE(_NEW_ARRAY); - _GLD_TEST_STATE(_NEW_RENDERMODE); - _GLD_TEST_STATE(_NEW_BUFFERS); - _GLD_TEST_STATE(_NEW_MULTISAMPLE); -*/ - -// For debugging. -#if 0 -#define _GLD_TEST_UNHANDLED_STATE(a) \ - if (new_state & (a)) { \ - gldLogMessage(GLDLOG_ERROR, "Unhandled " #a "\n"); \ - } - _GLD_TEST_UNHANDLED_STATE(_NEW_TEXTURE_MATRIX); - _GLD_TEST_UNHANDLED_STATE(_NEW_COLOR_MATRIX); - _GLD_TEST_UNHANDLED_STATE(_NEW_ACCUM); - _GLD_TEST_UNHANDLED_STATE(_NEW_EVAL); - _GLD_TEST_UNHANDLED_STATE(_NEW_HINT); - _GLD_TEST_UNHANDLED_STATE(_NEW_LINE); - _GLD_TEST_UNHANDLED_STATE(_NEW_PIXEL); - _GLD_TEST_UNHANDLED_STATE(_NEW_POINT); - _GLD_TEST_UNHANDLED_STATE(_NEW_POLYGONSTIPPLE); - _GLD_TEST_UNHANDLED_STATE(_NEW_SCISSOR); - _GLD_TEST_UNHANDLED_STATE(_NEW_PACKUNPACK); - _GLD_TEST_UNHANDLED_STATE(_NEW_ARRAY); - _GLD_TEST_UNHANDLED_STATE(_NEW_RENDERMODE); - _GLD_TEST_UNHANDLED_STATE(_NEW_BUFFERS); - _GLD_TEST_UNHANDLED_STATE(_NEW_MULTISAMPLE); -#undef _GLD_UNHANDLED_STATE -#endif - -#undef _GLD_TEST_STATE -} - -//--------------------------------------------------------------------------- -// Viewport -//--------------------------------------------------------------------------- - -void gld_Viewport_DX8( - GLcontext *ctx, - GLint x, - GLint y, - GLsizei w, - GLsizei h) -{ - GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); - GLD_driver_dx8 *gld = GLD_GET_DX8_DRIVER(gldCtx); - - D3DVIEWPORT8 d3dvp; - - if (!gld || !gld->pDev) - return; - - // This is a hack. When the app is minimized, Mesa passes - // w=1 and h=1 for viewport dimensions. Without this test - // we get a GPF in gld_wgl_resize_buffers(). - if ((w==1) && (h==1)) - return; - - // Call ResizeBuffersMESA. This function will early-out - // if no resize is needed. - //ctx->Driver.ResizeBuffersMESA(ctx); - // Mesa 5: Changed parameters - ctx->Driver.ResizeBuffers(gldCtx->glBuffer); - -#if 0 - ddlogPrintf(GLDLOG_SYSTEM, ">> Viewport x=%d y=%d w=%d h=%d", x,y,w,h); -#endif - - // ** D3D viewport must not be outside the render target surface ** - // Sanity check the GL viewport dimensions - if (x < 0) x = 0; - if (y < 0) y = 0; - if (w > gldCtx->dwWidth) w = gldCtx->dwWidth; - if (h > gldCtx->dwHeight) h = gldCtx->dwHeight; - // Ditto for D3D viewport dimensions - if (w+x > gldCtx->dwWidth) w = gldCtx->dwWidth-x; - if (h+y > gldCtx->dwHeight) h = gldCtx->dwHeight-y; - - d3dvp.X = x; - d3dvp.Y = gldCtx->dwHeight - (y + h); - d3dvp.Width = w; - d3dvp.Height = h; - if (ctx->Viewport.Near <= ctx->Viewport.Far) { - d3dvp.MinZ = ctx->Viewport.Near; - d3dvp.MaxZ = ctx->Viewport.Far; - } else { - d3dvp.MinZ = ctx->Viewport.Far; - d3dvp.MaxZ = ctx->Viewport.Near; - } - - // TODO: DEBUGGING -// d3dvp.MinZ = 0.0f; -// d3dvp.MaxZ = 1.0f; - - _GLD_DX8_DEV(SetViewport(gld->pDev, &d3dvp)); - -} - -//--------------------------------------------------------------------------- - -extern BOOL dglWglResizeBuffers(GLcontext *ctx, BOOL bDefaultDriver); - -// Mesa 5: Parameter change -void gldResizeBuffers_DX8( -// GLcontext *ctx) - GLframebuffer *fb) -{ - GET_CURRENT_CONTEXT(ctx); - dglWglResizeBuffers(ctx, TRUE); -} - -//--------------------------------------------------------------------------- -#ifdef _DEBUG -// This is only for debugging. -// To use, plug into ctx->Driver.Enable pointer below. -void gld_Enable( - GLcontext *ctx, - GLenum e, - GLboolean b) -{ - char buf[1024]; - sprintf(buf, "Enable: %s (%s)\n", _mesa_lookup_enum_by_nr(e), b?"TRUE":"FALSE"); - ddlogMessage(DDLOG_SYSTEM, buf); -} -#endif -//--------------------------------------------------------------------------- -// Driver pointer setup -//--------------------------------------------------------------------------- - -extern const GLubyte* _gldGetStringGeneric(GLcontext*, GLenum); - -void gldSetupDriverPointers_DX8( - GLcontext *ctx) -{ - GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); - GLD_driver_dx8 *gld = GLD_GET_DX8_DRIVER(gldCtx); - - TNLcontext *tnl = TNL_CONTEXT(ctx); - - // Mandatory functions - ctx->Driver.GetString = _gldGetStringGeneric; - ctx->Driver.UpdateState = gld_update_state_DX8; - ctx->Driver.Clear = gld_Clear_DX8; - ctx->Driver.DrawBuffer = gld_set_draw_buffer_DX8; - ctx->Driver.GetBufferSize = gld_buffer_size_DX8; - ctx->Driver.Finish = gld_Finish_DX8; - ctx->Driver.Flush = gld_Flush_DX8; - ctx->Driver.Error = gld_Error_DX8; - - // Hardware accumulation buffer - ctx->Driver.Accum = NULL; // TODO: gld_Accum; - - // Bitmap functions - ctx->Driver.CopyPixels = gld_CopyPixels_DX8; - ctx->Driver.DrawPixels = gld_DrawPixels_DX8; - ctx->Driver.ReadPixels = gld_ReadPixels_DX8; - ctx->Driver.Bitmap = gld_Bitmap_DX8; - - // Buffer resize - ctx->Driver.ResizeBuffers = gldResizeBuffers_DX8; - - // Texture image functions - ctx->Driver.ChooseTextureFormat = gld_ChooseTextureFormat_DX8; - ctx->Driver.TexImage1D = gld_TexImage1D_DX8; - ctx->Driver.TexImage2D = gld_TexImage2D_DX8; - ctx->Driver.TexImage3D = _mesa_store_teximage3d; - ctx->Driver.TexSubImage1D = gld_TexSubImage1D_DX8; - ctx->Driver.TexSubImage2D = gld_TexSubImage2D_DX8; - ctx->Driver.TexSubImage3D = _mesa_store_texsubimage3d; - - ctx->Driver.CopyTexImage1D = gldCopyTexImage1D_DX8; //NULL; - ctx->Driver.CopyTexImage2D = gldCopyTexImage2D_DX8; //NULL; - ctx->Driver.CopyTexSubImage1D = gldCopyTexSubImage1D_DX8; //NULL; - ctx->Driver.CopyTexSubImage2D = gldCopyTexSubImage2D_DX8; //NULL; - ctx->Driver.CopyTexSubImage3D = gldCopyTexSubImage3D_DX8; - ctx->Driver.TestProxyTexImage = _mesa_test_proxy_teximage; - - // Texture object functions - ctx->Driver.BindTexture = NULL; - ctx->Driver.NewTextureObject = NULL; // Not yet implemented by Mesa!; - ctx->Driver.DeleteTexture = gld_DeleteTexture_DX8; - ctx->Driver.PrioritizeTexture = NULL; - - // Imaging functionality - ctx->Driver.CopyColorTable = NULL; - ctx->Driver.CopyColorSubTable = NULL; - ctx->Driver.CopyConvolutionFilter1D = NULL; - ctx->Driver.CopyConvolutionFilter2D = NULL; - - // State changing functions - ctx->Driver.AlphaFunc = NULL; //gld_AlphaFunc; - ctx->Driver.BlendFuncSeparate = NULL; //gld_BlendFunc; - ctx->Driver.ClearColor = NULL; //gld_ClearColor; - ctx->Driver.ClearDepth = NULL; //gld_ClearDepth; - ctx->Driver.ClearStencil = NULL; //gld_ClearStencil; - ctx->Driver.ColorMask = NULL; //gld_ColorMask; - ctx->Driver.CullFace = NULL; //gld_CullFace; - ctx->Driver.ClipPlane = NULL; //gld_ClipPlane; - ctx->Driver.FrontFace = NULL; //gld_FrontFace; - ctx->Driver.DepthFunc = NULL; //gld_DepthFunc; - ctx->Driver.DepthMask = NULL; //gld_DepthMask; - ctx->Driver.DepthRange = NULL; - ctx->Driver.Enable = NULL; //gld_Enable; - ctx->Driver.Fogfv = NULL; //gld_Fogfv; - ctx->Driver.Hint = NULL; //gld_Hint; - ctx->Driver.Lightfv = NULL; //gld_Lightfv; - ctx->Driver.LightModelfv = NULL; //gld_LightModelfv; - ctx->Driver.LineStipple = NULL; //gld_LineStipple; - ctx->Driver.LineWidth = NULL; //gld_LineWidth; - ctx->Driver.LogicOpcode = NULL; //gld_LogicOpcode; - ctx->Driver.PointParameterfv = NULL; //gld_PointParameterfv; - ctx->Driver.PointSize = NULL; //gld_PointSize; - ctx->Driver.PolygonMode = NULL; //gld_PolygonMode; - ctx->Driver.PolygonOffset = NULL; //gld_PolygonOffset; - ctx->Driver.PolygonStipple = NULL; //gld_PolygonStipple; - ctx->Driver.RenderMode = NULL; //gld_RenderMode; - ctx->Driver.Scissor = NULL; //gld_Scissor; - ctx->Driver.ShadeModel = NULL; //gld_ShadeModel; - ctx->Driver.StencilFunc = NULL; //gld_StencilFunc; - ctx->Driver.StencilMask = NULL; //gld_StencilMask; - ctx->Driver.StencilOp = NULL; //gld_StencilOp; - ctx->Driver.TexGen = NULL; //gld_TexGen; - ctx->Driver.TexEnv = NULL; - ctx->Driver.TexParameter = NULL; - ctx->Driver.TextureMatrix = NULL; //gld_TextureMatrix; - ctx->Driver.Viewport = gld_Viewport_DX8; - - _swsetup_Wakeup(ctx); - - tnl->Driver.RunPipeline = _tnl_run_pipeline; - tnl->Driver.Render.ResetLineStipple = gld_ResetLineStipple_DX8; - tnl->Driver.Render.ClippedPolygon = _tnl_RenderClippedPolygon; - tnl->Driver.Render.ClippedLine = _tnl_RenderClippedLine; - - // Hook into glFrustum() and glOrtho() -// ctx->Exec->Frustum = gldFrustumHook_DX8; -// ctx->Exec->Ortho = gldOrthoHook_DX8; - -} - -//--------------------------------------------------------------------------- diff --git a/src/mesa/drivers/windows/gldirect/dx8/gld_dx8.h b/src/mesa/drivers/windows/gldirect/dx8/gld_dx8.h deleted file mode 100644 index 7efec7cae8..0000000000 --- a/src/mesa/drivers/windows/gldirect/dx8/gld_dx8.h +++ /dev/null @@ -1,324 +0,0 @@ -/**************************************************************************** -* -* Mesa 3-D graphics library -* Direct3D Driver Interface -* -* ======================================================================== -* -* Copyright (C) 1991-2004 SciTech Software, Inc. All rights reserved. -* -* Permission is hereby granted, free of charge, to any person obtaining a -* copy of this software and associated documentation files (the "Software"), -* to deal in the Software without restriction, including without limitation -* the rights to use, copy, modify, merge, publish, distribute, sublicense, -* and/or sell copies of the Software, and to permit persons to whom the -* Software is furnished to do so, subject to the following conditions: -* -* The above copyright notice and this permission notice shall be included -* in all copies or substantial portions of the Software. -* -* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -* SCITECH SOFTWARE INC BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF -* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -* SOFTWARE. -* -* ====================================================================== -* -* Language: ANSI C -* Environment: Windows 9x/2000/XP/XBox (Win32) -* -* Description: GLDirect Direct3D 8.0 header file -* -****************************************************************************/ - -#ifndef _GLD_DX8_H -#define _GLD_DX8_H - -//--------------------------------------------------------------------------- -// Windows includes -//--------------------------------------------------------------------------- - -//#ifndef STRICT -//#define STRICT -//#endif - -//#define WIN32_LEAN_AND_MEAN -//#include -#include -#include - -// MS screwed up with the DX8.1 SDK - there's no compile-time -// method of compiling for 8.0 via the 8.1 SDK unless you -// "make sure you don't use any 8.1 interfaces". -// We CAN use 8.1 D3DX static functions, though - just not new 8.1 interfaces. -// -// D3D_SDK_VERSION is 120 for 8.0 (supported by Windows 95). -// D3D_SDK_VERSION is 220 for 8.1 (NOT supported by Windows 95). -// -#define D3D_SDK_VERSION_DX8_SUPPORT_WIN95 120 - -// Typedef for obtaining function from d3d8.dll -typedef IDirect3D8* (WINAPI *FNDIRECT3DCREATE8) (UINT); - - -//--------------------------------------------------------------------------- -// Defines -//--------------------------------------------------------------------------- - -#ifdef _DEBUG -#define _GLD_TEST_HRESULT(h) \ -{ \ - HRESULT _hr = (h); \ - if (FAILED(_hr)) { \ - gldLogError(GLDLOG_ERROR, #h, _hr); \ - } \ -} -#define _GLD_DX8(func) _GLD_TEST_HRESULT(IDirect3D8_##func##) -#define _GLD_DX8_DEV(func) _GLD_TEST_HRESULT(IDirect3DDevice8_##func##) -#define _GLD_DX8_VB(func) _GLD_TEST_HRESULT(IDirect3DVertexBuffer8_##func##) -#define _GLD_DX8_TEX(func) _GLD_TEST_HRESULT(IDirect3DTexture8_##func##) -#else -#define _GLD_DX8(func) IDirect3D8_##func -#define _GLD_DX8_DEV(func) IDirect3DDevice8_##func -#define _GLD_DX8_VB(func) IDirect3DVertexBuffer8_##func -#define _GLD_DX8_TEX(func) IDirect3DTexture8_##func -#endif - -#define SAFE_RELEASE(p) \ -{ \ - if (p) { \ - (p)->lpVtbl->Release(p); \ - (p) = NULL; \ - } \ -} - -#define SAFE_RELEASE_VB8(p) \ -{ \ - if (p) { \ - IDirect3DVertexBuffer8_Release((p)); \ - (p) = NULL; \ - } \ -} - -#define SAFE_RELEASE_SURFACE8(p) \ -{ \ - if (p) { \ - IDirect3DSurface8_Release((p)); \ - (p) = NULL; \ - } \ -} - -// Setup index. -enum { - GLD_SI_FLAT = 0, - GLD_SI_SMOOTH = 1, - GLD_SI_FLAT_EXTRAS = 2, - GLD_SI_SMOOTH_EXTRAS = 3, -}; -/* -// Internal pipeline -typedef enum { - GLD_PIPELINE_MESA = 0, // Mesa pipeline - GLD_PIPELINE_D3D_FVF = 1, // Direct3D Fixed-function pipeline - GLD_PIPELINE_D3D_VS_TWOSIDE = 2 // Direct3D two-sided-lighting vertex shader -} GLD_tnl_pipeline; -*/ -//--------------------------------------------------------------------------- -// Vertex definitions for Fixed-Function pipeline -//--------------------------------------------------------------------------- - -// -// NOTE: If the number of texture units is altered then most of -// the texture code will need to be revised. -// - -#define GLD_MAX_TEXTURE_UNITS_DX8 2 - -// -// 2D vertex transformed by Mesa -// -#define GLD_FVF_2D_VERTEX ( D3DFVF_XYZRHW | \ - D3DFVF_DIFFUSE | \ - D3DFVF_SPECULAR | \ - D3DFVF_TEX2) -typedef struct { - FLOAT x, y; // 2D raster coords - FLOAT sz; // Screen Z (depth) - FLOAT rhw; // Reciprocal homogenous W - DWORD diffuse; // Diffuse colour - DWORD specular; // For separate-specular support - FLOAT t0_u, t0_v; // 1st set of texture coords - FLOAT t1_u, t1_v; // 2nd set of texture coords -} GLD_2D_VERTEX; - - -// -// 3D vertex transformed by Direct3D -// -#define GLD_FVF_3D_VERTEX ( D3DFVF_XYZ | \ - D3DFVF_DIFFUSE | \ - D3DFVF_TEX2) - -typedef struct { - D3DXVECTOR3 Position; // XYZ Vector in object space - D3DCOLOR Diffuse; // Diffuse colour - D3DXVECTOR2 TexUnit0; // Texture unit 0 - D3DXVECTOR2 TexUnit1; // Texture unit 1 -} GLD_3D_VERTEX; - -//--------------------------------------------------------------------------- -// Vertex Shaders -//--------------------------------------------------------------------------- -/* -// DX8 Vertex Shader -typedef struct { - DWORD hShader; // If NULL, shader is invalid and cannot be used - BOOL bHardware; // If TRUE then shader was created for hardware, - // otherwise shader was created for software. -} GLD_vertexShader; -*/ -//--------------------------------------------------------------------------- -// Structs -//--------------------------------------------------------------------------- - -// This keeps a count of how many times we choose each individual internal -// pathway. Useful for seeing if a certain pathway was ever used by an app, and -// how much each pathway is biased. -// Zero the members at context creation and dump stats at context deletion. -typedef struct { - // Note: DWORD is probably too small - ULARGE_INTEGER qwMesa; // Mesa TnL pipeline - ULARGE_INTEGER qwD3DFVF; // Direct3D Fixed-Function pipeline -// ULARGE_INTEGER dwD3D2SVS; // Direct3D Two-Sided Vertex Shader pipeline -} GLD_pipeline_usage; - -// GLDirect Primitive Buffer (points, lines, triangles and quads) -typedef struct { - // Data for IDirect3DDevice8::CreateVertexBuffer() - DWORD dwStride; // Stride of vertex - DWORD dwUsage; // Usage flags - DWORD dwFVF; // Direct3D Flexible Vertex Format - DWORD dwPool; // Pool flags - - IDirect3DVertexBuffer8 *pVB; // Holds points, lines, tris and quads. - - // Point list is assumed to be at start of buffer - DWORD iFirstLine; // Index of start of line list - DWORD iFirstTriangle; // Index of start of triangle list - - BYTE *pPoints; // Pointer to next free point - BYTE *pLines; // Pointer to next free line - BYTE *pTriangles; // Pointer to next free triangle - - DWORD nPoints; // Number of points ready to render - DWORD nLines; // Number of lines ready to render - DWORD nTriangles; // Number of triangles ready to render -} GLD_pb_dx8; - -// GLDirect DX8 driver data -typedef struct { - // GLDirect vars - BOOL bDoublebuffer; // Doublebuffer (otherwise single-buffered) - BOOL bDepthStencil; // Depth buffer needed (stencil optional) - D3DFORMAT RenderFormat; // Format of back/front buffer - D3DFORMAT DepthFormat; // Format of depth/stencil -// float fFlipWindowY; // Value for flipping viewport Y coord - - // Direct3D vars - D3DCAPS8 d3dCaps8; - BOOL bHasHWTnL; // Device has Hardware Transform/Light? - IDirect3D8 *pD3D; // Base Direct3D8 interface - IDirect3DDevice8 *pDev; // Direct3D8 Device interface - GLD_pb_dx8 PB2d; // Vertices transformed by Mesa - GLD_pb_dx8 PB3d; // Vertices transformed by Direct3D - D3DPRIMITIVETYPE d3dpt; // Current Direct3D primitive type - D3DXMATRIX matProjection; // Projection matrix for D3D TnL - D3DXMATRIX matModelView; // Model/View matrix for D3D TnL - int iSetupFunc; // Which setup functions to use - BOOL bUseMesaTnL; // Whether to use Mesa or D3D for TnL - - // Direct3D vars for two-sided lighting -// GLD_vertexShader VStwosidelight; // Vertex Shader for two-sided lighting -// D3DXMATRIX matWorldViewProj;// World/View/Projection matrix for shaders - - -// GLD_tnl_pipeline TnLPipeline; // Index of current internal pipeline - GLD_pipeline_usage PipelineUsage; -} GLD_driver_dx8; - -#define GLD_GET_DX8_DRIVER(c) (GLD_driver_dx8*)(c)->glPriv - -//--------------------------------------------------------------------------- -// Function prototypes -//--------------------------------------------------------------------------- - -PROC gldGetProcAddress_DX8(LPCSTR a); -void gldEnableExtensions_DX8(GLcontext *ctx); -void gldInstallPipeline_DX8(GLcontext *ctx); -void gldSetupDriverPointers_DX8(GLcontext *ctx); -//void gldResizeBuffers_DX8(GLcontext *ctx); -void gldResizeBuffers_DX8(GLframebuffer *fb); - - -// Texture functions - -void gldCopyTexImage1D_DX8(GLcontext *ctx, GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLint border); -void gldCopyTexImage2D_DX8(GLcontext *ctx, GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); -void gldCopyTexSubImage1D_DX8(GLcontext *ctx, GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width ); -void gldCopyTexSubImage2D_DX8(GLcontext *ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height ); -void gldCopyTexSubImage3D_DX8(GLcontext *ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height ); - -void gld_NEW_TEXTURE_DX8(GLcontext *ctx); -void gld_DrawPixels_DX8(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, const struct gl_pixelstore_attrib *unpack, const GLvoid *pixels); -void gld_ReadPixels_DX8(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, const struct gl_pixelstore_attrib *unpack, GLvoid *dest); -void gld_CopyPixels_DX8(GLcontext *ctx, GLint srcx, GLint srcy, GLsizei width, GLsizei height, GLint dstx, GLint dsty, GLenum type); -void gld_Bitmap_DX8(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height, const struct gl_pixelstore_attrib *unpack, const GLubyte *bitmap); -const struct gl_texture_format* gld_ChooseTextureFormat_DX8(GLcontext *ctx, GLint internalFormat, GLenum srcFormat, GLenum srcType); -void gld_TexImage2D_DX8(GLcontext *ctx, GLenum target, GLint level, GLint internalFormat, GLint width, GLint height, GLint border, GLenum format, GLenum type, const GLvoid *pixels, const struct gl_pixelstore_attrib *packing, struct gl_texture_object *tObj, struct gl_texture_image *texImage); -void gld_TexImage1D_DX8(GLcontext *ctx, GLenum target, GLint level, GLint internalFormat, GLint width, GLint border, GLenum format, GLenum type, const GLvoid *pixels, const struct gl_pixelstore_attrib *packing, struct gl_texture_object *texObj, struct gl_texture_image *texImage ); -void gld_TexSubImage2D_DX8( GLcontext *ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels, const struct gl_pixelstore_attrib *packing, struct gl_texture_object *texObj, struct gl_texture_image *texImage ); -void gld_TexSubImage1D_DX8(GLcontext *ctx, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels, const struct gl_pixelstore_attrib *packing, struct gl_texture_object *texObj, struct gl_texture_image *texImage); -void gld_DeleteTexture_DX8(GLcontext *ctx, struct gl_texture_object *tObj); -void gld_ResetLineStipple_DX8(GLcontext *ctx); - -// 2D primitive functions - -void gld_Points2D_DX8(GLcontext *ctx, GLuint first, GLuint last); - -void gld_Line2DFlat_DX8(GLcontext *ctx, GLuint v0, GLuint v1); -void gld_Line2DSmooth_DX8(GLcontext *ctx, GLuint v0, GLuint v1); - -void gld_Triangle2DFlat_DX8(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2); -void gld_Triangle2DSmooth_DX8(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2); -void gld_Triangle2DFlatExtras_DX8(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2); -void gld_Triangle2DSmoothExtras_DX8(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2); - -void gld_Quad2DFlat_DX8(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3); -void gld_Quad2DSmooth_DX8(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3); -void gld_Quad2DFlatExtras_DX8(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3); -void gld_Quad2DSmoothExtras_DX8(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3); - -// 3D primitive functions - -void gld_Points3D_DX8(GLcontext *ctx, GLuint first, GLuint last); -void gld_Line3DFlat_DX8(GLcontext *ctx, GLuint v0, GLuint v1); -void gld_Triangle3DFlat_DX8(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2); -void gld_Quad3DFlat_DX8(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3); -void gld_Line3DSmooth_DX8(GLcontext *ctx, GLuint v0, GLuint v1); -void gld_Triangle3DSmooth_DX8(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2); -void gld_Quad3DSmooth_DX8(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3); - -// Primitive functions for Two-sided-lighting Vertex Shader - -void gld_Points2DTwoside_DX8(GLcontext *ctx, GLuint first, GLuint last); -void gld_Line2DFlatTwoside_DX8(GLcontext *ctx, GLuint v0, GLuint v1); -void gld_Line2DSmoothTwoside_DX8(GLcontext *ctx, GLuint v0, GLuint v1); -void gld_Triangle2DFlatTwoside_DX8(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2); -void gld_Triangle2DSmoothTwoside_DX8(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2); -void gld_Quad2DFlatTwoside_DX8(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3); -void gld_Quad2DSmoothTwoside_DX8(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3); - -#endif diff --git a/src/mesa/drivers/windows/gldirect/dx8/gld_dxerr8.h b/src/mesa/drivers/windows/gldirect/dx8/gld_dxerr8.h deleted file mode 100644 index f8e92b936e..0000000000 --- a/src/mesa/drivers/windows/gldirect/dx8/gld_dxerr8.h +++ /dev/null @@ -1,77 +0,0 @@ -/*==========================================================================; - * - * - * File: dxerr8.h - * Content: DirectX Error Library Include File - * - ****************************************************************************/ - -#ifndef _GLD_DXERR8_H_ -#define _GLD_DXERR8_H_ - - -#include - -// -// DXGetErrorString8 -// -// Desc: Converts an DirectX HRESULT to a string -// -// Args: HRESULT hr Can be any error code from -// DPLAY D3D8 D3DX8 DMUSIC DSOUND -// -// Return: Converted string -// -const char* __stdcall DXGetErrorString8A(HRESULT hr); -const WCHAR* __stdcall DXGetErrorString8W(HRESULT hr); - -#ifdef UNICODE - #define DXGetErrorString8 DXGetErrorString8W -#else - #define DXGetErrorString8 DXGetErrorString8A -#endif - - -// -// DXTrace -// -// Desc: Outputs a formatted error message to the debug stream -// -// Args: CHAR* strFile The current file, typically passed in using the -// __FILE__ macro. -// DWORD dwLine The current line number, typically passed in using the -// __LINE__ macro. -// HRESULT hr An HRESULT that will be traced to the debug stream. -// CHAR* strMsg A string that will be traced to the debug stream (may be NULL) -// BOOL bPopMsgBox If TRUE, then a message box will popup also containing the passed info. -// -// Return: The hr that was passed in. -// -//HRESULT __stdcall DXTraceA( char* strFile, DWORD dwLine, HRESULT hr, char* strMsg, BOOL bPopMsgBox = FALSE ); -//HRESULT __stdcall DXTraceW( char* strFile, DWORD dwLine, HRESULT hr, WCHAR* strMsg, BOOL bPopMsgBox = FALSE ); -HRESULT __stdcall DXTraceA( char* strFile, DWORD dwLine, HRESULT hr, char* strMsg, BOOL bPopMsgBox); -HRESULT __stdcall DXTraceW( char* strFile, DWORD dwLine, HRESULT hr, WCHAR* strMsg, BOOL bPopMsgBox); - -#ifdef UNICODE - #define DXTrace DXTraceW -#else - #define DXTrace DXTraceA -#endif - - -// -// Helper macros -// -#if defined(DEBUG) | defined(_DEBUG) - #define DXTRACE_MSG(str) DXTrace( __FILE__, (DWORD)__LINE__, 0, str, FALSE ) - #define DXTRACE_ERR(str,hr) DXTrace( __FILE__, (DWORD)__LINE__, hr, str, TRUE ) - #define DXTRACE_ERR_NOMSGBOX(str,hr) DXTrace( __FILE__, (DWORD)__LINE__, hr, str, FALSE ) -#else - #define DXTRACE_MSG(str) (0L) - #define DXTRACE_ERR(str,hr) (hr) - #define DXTRACE_ERR_NOMSGBOX(str,hr) (hr) -#endif - - -#endif - diff --git a/src/mesa/drivers/windows/gldirect/dx8/gld_ext_dx8.c b/src/mesa/drivers/windows/gldirect/dx8/gld_ext_dx8.c deleted file mode 100644 index b51bba9b3c..0000000000 --- a/src/mesa/drivers/windows/gldirect/dx8/gld_ext_dx8.c +++ /dev/null @@ -1,344 +0,0 @@ -/**************************************************************************** -* -* Mesa 3-D graphics library -* Direct3D Driver Interface -* -* ======================================================================== -* -* Copyright (C) 1991-2004 SciTech Software, Inc. All rights reserved. -* -* Permission is hereby granted, free of charge, to any person obtaining a -* copy of this software and associated documentation files (the "Software"), -* to deal in the Software without restriction, including without limitation -* the rights to use, copy, modify, merge, publish, distribute, sublicense, -* and/or sell copies of the Software, and to permit persons to whom the -* Software is furnished to do so, subject to the following conditions: -* -* The above copyright notice and this permission notice shall be included -* in all copies or substantial portions of the Software. -* -* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -* SCITECH SOFTWARE INC BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF -* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -* SOFTWARE. -* -* ====================================================================== -* -* Language: ANSI C -* Environment: Windows 9x/2000/XP/XBox (Win32) -* -* Description: GL extensions -* -****************************************************************************/ - -//#include "../GLDirect.h" -//#include "../gld_log.h" -//#include "../gld_settings.h" - -#include -#define GL_GLEXT_PROTOTYPES -#include -#include - -//#include "ddlog.h" -//#include "gld_dx8.h" - -#include "glheader.h" -#include "context.h" -#include "colormac.h" -#include "depth.h" -#include "extensions.h" -#include "macros.h" -#include "matrix.h" -// #include "mem.h" -//#include "mmath.h" -#include "mtypes.h" -#include "texformat.h" -#include "texstore.h" -#include "vbo/vbo.h" -#include "swrast_setup/swrast_setup.h" -#include "swrast_setup/ss_context.h" -#include "tnl/tnl.h" -#include "tnl/t_context.h" -#include "tnl/t_pipeline.h" - -#include "dglcontext.h" -#include "extensions.h" - -// For some reason this is not defined in an above header... -extern void _mesa_enable_imaging_extensions(GLcontext *ctx); - -//--------------------------------------------------------------------------- -// Hack for the SGIS_multitexture extension that was removed from Mesa -// NOTE: SGIS_multitexture enums also clash with GL_SGIX_async_pixel - - // NOTE: Quake2 ran *slower* with this enabled, so I've - // disabled it for now. - // To enable, uncomment: - // _mesa_add_extension(ctx, GL_TRUE, szGL_SGIS_multitexture, 0); - -//--------------------------------------------------------------------------- - -enum { - /* Quake2 GL_SGIS_multitexture */ - GL_SELECTED_TEXTURE_SGIS = 0x835B, - GL_SELECTED_TEXTURE_COORD_SET_SGIS = 0x835C, - GL_MAX_TEXTURES_SGIS = 0x835D, - GL_TEXTURE0_SGIS = 0x835E, - GL_TEXTURE1_SGIS = 0x835F, - GL_TEXTURE2_SGIS = 0x8360, - GL_TEXTURE3_SGIS = 0x8361, - GL_TEXTURE_COORD_SET_SOURCE_SGIS = 0x8363, -}; - -//--------------------------------------------------------------------------- - -void APIENTRY gldSelectTextureSGIS( - GLenum target) -{ - GLenum ARB_target = GL_TEXTURE0_ARB + (target - GL_TEXTURE0_SGIS); - glActiveTextureARB(ARB_target); -} - -//--------------------------------------------------------------------------- - -void APIENTRY gldMTexCoord2fSGIS( - GLenum target, - GLfloat s, - GLfloat t) -{ - GLenum ARB_target = GL_TEXTURE0_ARB + (target - GL_TEXTURE0_SGIS); - glMultiTexCoord2fARB(ARB_target, s, t); -} - -//--------------------------------------------------------------------------- - -void APIENTRY gldMTexCoord2fvSGIS( - GLenum target, - const GLfloat *v) -{ - GLenum ARB_target = GL_TEXTURE0_ARB + (target - GL_TEXTURE0_SGIS); - glMultiTexCoord2fvARB(ARB_target, v); -} - -//--------------------------------------------------------------------------- -// Extensions -//--------------------------------------------------------------------------- - -typedef struct { - PROC proc; - char *name; -} GLD_extension; - -GLD_extension GLD_extList[] = { -#ifdef GL_EXT_polygon_offset - { (PROC)glPolygonOffsetEXT, "glPolygonOffsetEXT" }, -#endif - { (PROC)glBlendEquationEXT, "glBlendEquationEXT" }, - { (PROC)glBlendColorEXT, "glBlendColorExt" }, - { (PROC)glVertexPointerEXT, "glVertexPointerEXT" }, - { (PROC)glNormalPointerEXT, "glNormalPointerEXT" }, - { (PROC)glColorPointerEXT, "glColorPointerEXT" }, - { (PROC)glIndexPointerEXT, "glIndexPointerEXT" }, - { (PROC)glTexCoordPointerEXT, "glTexCoordPointer" }, - { (PROC)glEdgeFlagPointerEXT, "glEdgeFlagPointerEXT" }, - { (PROC)glGetPointervEXT, "glGetPointervEXT" }, - { (PROC)glArrayElementEXT, "glArrayElementEXT" }, - { (PROC)glDrawArraysEXT, "glDrawArrayEXT" }, - { (PROC)glAreTexturesResidentEXT, "glAreTexturesResidentEXT" }, - { (PROC)glBindTextureEXT, "glBindTextureEXT" }, - { (PROC)glDeleteTexturesEXT, "glDeleteTexturesEXT" }, - { (PROC)glGenTexturesEXT, "glGenTexturesEXT" }, - { (PROC)glIsTextureEXT, "glIsTextureEXT" }, - { (PROC)glPrioritizeTexturesEXT, "glPrioritizeTexturesEXT" }, - { (PROC)glCopyTexSubImage3DEXT, "glCopyTexSubImage3DEXT" }, - { (PROC)glTexImage3DEXT, "glTexImage3DEXT" }, - { (PROC)glTexSubImage3DEXT, "glTexSubImage3DEXT" }, - { (PROC)glPointParameterfEXT, "glPointParameterfEXT" }, - { (PROC)glPointParameterfvEXT, "glPointParameterfvEXT" }, - - { (PROC)glLockArraysEXT, "glLockArraysEXT" }, - { (PROC)glUnlockArraysEXT, "glUnlockArraysEXT" }, - { NULL, "\0" } -}; - -GLD_extension GLD_multitexList[] = { -/* - { (PROC)glMultiTexCoord1dSGIS, "glMTexCoord1dSGIS" }, - { (PROC)glMultiTexCoord1dvSGIS, "glMTexCoord1dvSGIS" }, - { (PROC)glMultiTexCoord1fSGIS, "glMTexCoord1fSGIS" }, - { (PROC)glMultiTexCoord1fvSGIS, "glMTexCoord1fvSGIS" }, - { (PROC)glMultiTexCoord1iSGIS, "glMTexCoord1iSGIS" }, - { (PROC)glMultiTexCoord1ivSGIS, "glMTexCoord1ivSGIS" }, - { (PROC)glMultiTexCoord1sSGIS, "glMTexCoord1sSGIS" }, - { (PROC)glMultiTexCoord1svSGIS, "glMTexCoord1svSGIS" }, - { (PROC)glMultiTexCoord2dSGIS, "glMTexCoord2dSGIS" }, - { (PROC)glMultiTexCoord2dvSGIS, "glMTexCoord2dvSGIS" }, - { (PROC)glMultiTexCoord2fSGIS, "glMTexCoord2fSGIS" }, - { (PROC)glMultiTexCoord2fvSGIS, "glMTexCoord2fvSGIS" }, - { (PROC)glMultiTexCoord2iSGIS, "glMTexCoord2iSGIS" }, - { (PROC)glMultiTexCoord2ivSGIS, "glMTexCoord2ivSGIS" }, - { (PROC)glMultiTexCoord2sSGIS, "glMTexCoord2sSGIS" }, - { (PROC)glMultiTexCoord2svSGIS, "glMTexCoord2svSGIS" }, - { (PROC)glMultiTexCoord3dSGIS, "glMTexCoord3dSGIS" }, - { (PROC)glMultiTexCoord3dvSGIS, "glMTexCoord3dvSGIS" }, - { (PROC)glMultiTexCoord3fSGIS, "glMTexCoord3fSGIS" }, - { (PROC)glMultiTexCoord3fvSGIS, "glMTexCoord3fvSGIS" }, - { (PROC)glMultiTexCoord3iSGIS, "glMTexCoord3iSGIS" }, - { (PROC)glMultiTexCoord3ivSGIS, "glMTexCoord3ivSGIS" }, - { (PROC)glMultiTexCoord3sSGIS, "glMTexCoord3sSGIS" }, - { (PROC)glMultiTexCoord3svSGIS, "glMTexCoord3svSGIS" }, - { (PROC)glMultiTexCoord4dSGIS, "glMTexCoord4dSGIS" }, - { (PROC)glMultiTexCoord4dvSGIS, "glMTexCoord4dvSGIS" }, - { (PROC)glMultiTexCoord4fSGIS, "glMTexCoord4fSGIS" }, - { (PROC)glMultiTexCoord4fvSGIS, "glMTexCoord4fvSGIS" }, - { (PROC)glMultiTexCoord4iSGIS, "glMTexCoord4iSGIS" }, - { (PROC)glMultiTexCoord4ivSGIS, "glMTexCoord4ivSGIS" }, - { (PROC)glMultiTexCoord4sSGIS, "glMTexCoord4sSGIS" }, - { (PROC)glMultiTexCoord4svSGIS, "glMTexCoord4svSGIS" }, - { (PROC)glMultiTexCoordPointerSGIS, "glMTexCoordPointerSGIS" }, - { (PROC)glSelectTextureSGIS, "glSelectTextureSGIS" }, - { (PROC)glSelectTextureCoordSetSGIS, "glSelectTextureCoordSetSGIS" }, -*/ - { (PROC)glActiveTextureARB, "glActiveTextureARB" }, - { (PROC)glClientActiveTextureARB, "glClientActiveTextureARB" }, - { (PROC)glMultiTexCoord1dARB, "glMultiTexCoord1dARB" }, - { (PROC)glMultiTexCoord1dvARB, "glMultiTexCoord1dvARB" }, - { (PROC)glMultiTexCoord1fARB, "glMultiTexCoord1fARB" }, - { (PROC)glMultiTexCoord1fvARB, "glMultiTexCoord1fvARB" }, - { (PROC)glMultiTexCoord1iARB, "glMultiTexCoord1iARB" }, - { (PROC)glMultiTexCoord1ivARB, "glMultiTexCoord1ivARB" }, - { (PROC)glMultiTexCoord1sARB, "glMultiTexCoord1sARB" }, - { (PROC)glMultiTexCoord1svARB, "glMultiTexCoord1svARB" }, - { (PROC)glMultiTexCoord2dARB, "glMultiTexCoord2dARB" }, - { (PROC)glMultiTexCoord2dvARB, "glMultiTexCoord2dvARB" }, - { (PROC)glMultiTexCoord2fARB, "glMultiTexCoord2fARB" }, - { (PROC)glMultiTexCoord2fvARB, "glMultiTexCoord2fvARB" }, - { (PROC)glMultiTexCoord2iARB, "glMultiTexCoord2iARB" }, - { (PROC)glMultiTexCoord2ivARB, "glMultiTexCoord2ivARB" }, - { (PROC)glMultiTexCoord2sARB, "glMultiTexCoord2sARB" }, - { (PROC)glMultiTexCoord2svARB, "glMultiTexCoord2svARB" }, - { (PROC)glMultiTexCoord3dARB, "glMultiTexCoord3dARB" }, - { (PROC)glMultiTexCoord3dvARB, "glMultiTexCoord3dvARB" }, - { (PROC)glMultiTexCoord3fARB, "glMultiTexCoord3fARB" }, - { (PROC)glMultiTexCoord3fvARB, "glMultiTexCoord3fvARB" }, - { (PROC)glMultiTexCoord3iARB, "glMultiTexCoord3iARB" }, - { (PROC)glMultiTexCoord3ivARB, "glMultiTexCoord3ivARB" }, - { (PROC)glMultiTexCoord3sARB, "glMultiTexCoord3sARB" }, - { (PROC)glMultiTexCoord3svARB, "glMultiTexCoord3svARB" }, - { (PROC)glMultiTexCoord4dARB, "glMultiTexCoord4dARB" }, - { (PROC)glMultiTexCoord4dvARB, "glMultiTexCoord4dvARB" }, - { (PROC)glMultiTexCoord4fARB, "glMultiTexCoord4fARB" }, - { (PROC)glMultiTexCoord4fvARB, "glMultiTexCoord4fvARB" }, - { (PROC)glMultiTexCoord4iARB, "glMultiTexCoord4iARB" }, - { (PROC)glMultiTexCoord4ivARB, "glMultiTexCoord4ivARB" }, - { (PROC)glMultiTexCoord4sARB, "glMultiTexCoord4sARB" }, - { (PROC)glMultiTexCoord4svARB, "glMultiTexCoord4svARB" }, - - // Descent3 doesn't use correct string, hence this hack - { (PROC)glMultiTexCoord4fARB, "glMultiTexCoord4f" }, - - // Quake2 SGIS multitexture - { (PROC)gldSelectTextureSGIS, "glSelectTextureSGIS" }, - { (PROC)gldMTexCoord2fSGIS, "glMTexCoord2fSGIS" }, - { (PROC)gldMTexCoord2fvSGIS, "glMTexCoord2fvSGIS" }, - - { NULL, "\0" } -}; - -//--------------------------------------------------------------------------- - -PROC gldGetProcAddress_DX( - LPCSTR a) -{ - int i; - PROC proc = NULL; - - for (i=0; GLD_extList[i].proc; i++) { - if (!strcmp(a, GLD_extList[i].name)) { - proc = GLD_extList[i].proc; - break; - } - } - - if (glb.bMultitexture) { - for (i=0; GLD_multitexList[i].proc; i++) { - if (!strcmp(a, GLD_multitexList[i].name)) { - proc = GLD_multitexList[i].proc; - break; - } - } - } - - gldLogPrintf(GLDLOG_INFO, "GetProcAddress: %s (%s)", a, proc ? "OK" : "Failed"); - - return proc; -} - -//--------------------------------------------------------------------------- - -void gldEnableExtensions_DX8( - GLcontext *ctx) -{ - GLuint i; - - // Mesa enables some extensions by default. - // This table decides which ones we want to switch off again. - - // NOTE: GL_EXT_compiled_vertex_array appears broken. - - const char *gld_disable_extensions[] = { -// "GL_ARB_transpose_matrix", -// "GL_EXT_compiled_vertex_array", -// "GL_EXT_polygon_offset", -// "GL_EXT_rescale_normal", - "GL_EXT_texture3D", -// "GL_NV_texgen_reflection", - NULL - }; - - const char *gld_multitex_extensions[] = { - "GL_ARB_multitexture", // Quake 3 - NULL - }; - - // Quake 2 engines - const char *szGL_SGIS_multitexture = "GL_SGIS_multitexture"; - - const char *gld_enable_extensions[] = { - "GL_EXT_texture_env_add", // Quake 3 - "GL_ARB_texture_env_add", // Quake 3 - NULL - }; - - for (i=0; gld_disable_extensions[i]; i++) { - _mesa_disable_extension(ctx, gld_disable_extensions[i]); - } - - for (i=0; gld_enable_extensions[i]; i++) { - _mesa_enable_extension(ctx, gld_enable_extensions[i]); - } - - if (glb.bMultitexture) { - for (i=0; gld_multitex_extensions[i]; i++) { - _mesa_enable_extension(ctx, gld_multitex_extensions[i]); - } - - // GL_SGIS_multitexture - // NOTE: Quake2 ran *slower* with this enabled, so I've - // disabled it for now. - // Fair bit slower on GeForce256, - // Much slower on 3dfx Voodoo5 5500. -// _mesa_add_extension(ctx, GL_TRUE, szGL_SGIS_multitexture, 0); - - } - - _mesa_enable_imaging_extensions(ctx); - _mesa_enable_1_3_extensions(ctx); - _mesa_enable_1_4_extensions(ctx); -} - -//--------------------------------------------------------------------------- diff --git a/src/mesa/drivers/windows/gldirect/dx8/gld_pipeline_dx8.c b/src/mesa/drivers/windows/gldirect/dx8/gld_pipeline_dx8.c deleted file mode 100644 index 2baea57443..0000000000 --- a/src/mesa/drivers/windows/gldirect/dx8/gld_pipeline_dx8.c +++ /dev/null @@ -1,77 +0,0 @@ -/**************************************************************************** -* -* Mesa 3-D graphics library -* Direct3D Driver Interface -* -* ======================================================================== -* -* Copyright (C) 1991-2004 SciTech Software, Inc. All rights reserved. -* -* Permission is hereby granted, free of charge, to any person obtaining a -* copy of this software and associated documentation files (the "Software"), -* to deal in the Software without restriction, including without limitation -* the rights to use, copy, modify, merge, publish, distribute, sublicense, -* and/or sell copies of the Software, and to permit persons to whom the -* Software is furnished to do so, subject to the following conditions: -* -* The above copyright notice and this permission notice shall be included -* in all copies or substantial portions of the Software. -* -* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -* SCITECH SOFTWARE INC BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF -* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -* SOFTWARE. -* -* ====================================================================== -* -* Language: ANSI C -* Environment: Windows 9x/2000/XP/XBox (Win32) -* -* Description: Mesa transformation pipeline with GLDirect fastpath -* -****************************************************************************/ - -//#include "../GLDirect.h" - -#include "dglcontext.h" -#include "ddlog.h" -#include "gld_dx8.h" - -#include "tnl/tnl.h" -#include "tnl/t_context.h" -#include "tnl/t_pipeline.h" - -//--------------------------------------------------------------------------- - -extern struct tnl_pipeline_stage _gld_d3d_render_stage; -extern struct tnl_pipeline_stage _gld_mesa_render_stage; - -static const struct tnl_pipeline_stage *gld_pipeline[] = { - &_gld_d3d_render_stage, // Direct3D TnL - &_tnl_vertex_transform_stage, - &_tnl_normal_transform_stage, - &_tnl_lighting_stage, - &_tnl_fog_coordinate_stage, /* TODO: Omit fog stage. ??? */ - &_tnl_texgen_stage, - &_tnl_texture_transform_stage, - &_tnl_point_attenuation_stage, - &_gld_mesa_render_stage, // Mesa TnL, D3D rendering - 0, -}; - -//--------------------------------------------------------------------------- - -void gldInstallPipeline_DX8( - GLcontext *ctx) -{ - // Remove any existing pipeline stages, - // then install GLDirect pipeline stages. - - _tnl_destroy_pipeline(ctx); - _tnl_install_pipeline(ctx, gld_pipeline); -} - -//--------------------------------------------------------------------------- diff --git a/src/mesa/drivers/windows/gldirect/dx8/gld_primitive_dx8.c b/src/mesa/drivers/windows/gldirect/dx8/gld_primitive_dx8.c deleted file mode 100644 index a5b5462f03..0000000000 --- a/src/mesa/drivers/windows/gldirect/dx8/gld_primitive_dx8.c +++ /dev/null @@ -1,1446 +0,0 @@ -/**************************************************************************** -* -* Mesa 3-D graphics library -* Direct3D Driver Interface -* -* ======================================================================== -* -* Copyright (C) 1991-2004 SciTech Software, Inc. All rights reserved. -* -* Permission is hereby granted, free of charge, to any person obtaining a -* copy of this software and associated documentation files (the "Software"), -* to deal in the Software without restriction, including without limitation -* the rights to use, copy, modify, merge, publish, distribute, sublicense, -* and/or sell copies of the Software, and to permit persons to whom the -* Software is furnished to do so, subject to the following conditions: -* -* The above copyright notice and this permission notice shall be included -* in all copies or substantial portions of the Software. -* -* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -* SCITECH SOFTWARE INC BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF -* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -* SOFTWARE. -* -* ====================================================================== -* -* Language: ANSI C -* Environment: Windows 9x/2000/XP/XBox (Win32) -* -* Description: Primitive (points/lines/tris/quads) rendering -* -****************************************************************************/ - -//#include "../GLDirect.h" - -//#include "gld_dx8.h" - -#include "dglcontext.h" -#include "ddlog.h" -#include "gld_dx8.h" - -#include "glheader.h" -#include "context.h" -#include "colormac.h" -#include "depth.h" -#include "extensions.h" -#include "macros.h" -#include "matrix.h" -// #include "mem.h" -//#include "mmath.h" -#include "mtypes.h" -#include "texformat.h" -#include "texstore.h" -#include "vbo/vbo.h" -#include "swrast/swrast.h" -#include "swrast_setup/swrast_setup.h" -#include "swrast_setup/ss_context.h" -#include "swrast/s_context.h" -#include "swrast/s_depth.h" -#include "swrast/s_lines.h" -#include "swrast/s_triangle.h" -#include "swrast/s_trispan.h" -#include "tnl/tnl.h" -#include "tnl/t_context.h" -#include "tnl/t_pipeline.h" - -// Disable compiler complaints about unreferenced local variables -#pragma warning (disable:4101) - -//--------------------------------------------------------------------------- -// Helper defines for primitives -//--------------------------------------------------------------------------- - -//static const float ooZ = 1.0f / 65536.0f; // One over Z - -#define GLD_COLOUR (D3DCOLOR_RGBA(swv->color[0], swv->color[1], swv->color[2], swv->color[3])) -#define GLD_SPECULAR (D3DCOLOR_RGBA(swv->specular[0], swv->specular[1], swv->specular[2], swv->specular[3])) -#define GLD_FLIP_Y(y) (gldCtx->dwHeight - (y)) - -//--------------------------------------------------------------------------- -// 2D vertex setup -//--------------------------------------------------------------------------- - -#define GLD_SETUP_2D_VARS_POINTS \ - GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); \ - GLD_driver_dx8 *gld = GLD_GET_DX8_DRIVER(gldCtx); \ - GLD_2D_VERTEX *pV = (GLD_2D_VERTEX*)gld->PB2d.pPoints; \ - SScontext *ss = SWSETUP_CONTEXT(ctx); \ - SWvertex *swv; \ - DWORD dwSpecularColour; \ - DWORD dwFlatColour - -#define GLD_SETUP_2D_VARS_LINES \ - GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); \ - GLD_driver_dx8 *gld = GLD_GET_DX8_DRIVER(gldCtx); \ - GLD_2D_VERTEX *pV = (GLD_2D_VERTEX*)gld->PB2d.pLines; \ - SScontext *ss = SWSETUP_CONTEXT(ctx); \ - SWvertex *swv; \ - DWORD dwSpecularColour; \ - DWORD dwFlatColour - -#define GLD_SETUP_2D_VARS_TRIANGLES \ - BOOL bFog = ctx->Fog.Enabled; \ - GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); \ - GLD_driver_dx8 *gld = GLD_GET_DX8_DRIVER(gldCtx); \ - GLD_2D_VERTEX *pV = (GLD_2D_VERTEX*)gld->PB2d.pTriangles; \ - SScontext *ss = SWSETUP_CONTEXT(ctx); \ - SWvertex *swv; \ - DWORD dwSpecularColour; \ - DWORD dwFlatColour; \ - GLuint facing = 0; \ - struct vertex_buffer *VB; \ - GLchan (*vbcolor)[4]; \ - GLchan (*vbspec)[4] - -#define GLD_SETUP_GET_SWVERT(s) \ - swv = &ss->verts[##s] - -#define GLD_SETUP_2D_VERTEX \ - pV->x = swv->win[0]; \ - pV->y = GLD_FLIP_Y(swv->win[1]); \ - pV->rhw = swv->win[3] - -#define GLD_SETUP_SMOOTH_COLOUR \ - pV->diffuse = GLD_COLOUR - -#define GLD_SETUP_GET_FLAT_COLOUR \ - dwFlatColour = GLD_COLOUR -#define GLD_SETUP_GET_FLAT_FOG_COLOUR \ - dwFlatColour = _gldComputeFog(ctx, swv) - -#define GLD_SETUP_USE_FLAT_COLOUR \ - pV->diffuse = dwFlatColour - -#define GLD_SETUP_GET_FLAT_SPECULAR \ - dwSpecularColour= GLD_SPECULAR - -#define GLD_SETUP_USE_FLAT_SPECULAR \ - pV->specular = dwSpecularColour - -#define GLD_SETUP_DEPTH \ - pV->sz = swv->win[2] / ctx->DepthMaxF -// pV->z = swv->win[2] * ooZ; - -#define GLD_SETUP_SPECULAR \ - pV->specular = GLD_SPECULAR - -#define GLD_SETUP_FOG \ - pV->diffuse = _gldComputeFog(ctx, swv) - -#define GLD_SETUP_TEX0 \ - pV->t0_u = swv->texcoord[0][0]; \ - pV->t0_v = swv->texcoord[0][1] - -#define GLD_SETUP_TEX1 \ - pV->t1_u = swv->texcoord[1][0]; \ - pV->t1_v = swv->texcoord[1][1] - -#define GLD_SETUP_LIGHTING(v) \ - if (facing == 1) { \ - pV->diffuse = D3DCOLOR_RGBA(vbcolor[##v][0], vbcolor[##v][1], vbcolor[##v][2], vbcolor[##v][3]); \ - if (vbspec) { \ - pV->specular = D3DCOLOR_RGBA(vbspec[##v][0], vbspec[##v][1], vbspec[##v][2], vbspec[##v][3]); \ - } \ - } else { \ - if (bFog) \ - GLD_SETUP_FOG; \ - else \ - GLD_SETUP_SMOOTH_COLOUR; \ - GLD_SETUP_SPECULAR; \ - } - -#define GLD_SETUP_GET_FLAT_LIGHTING(v) \ - if (facing == 1) { \ - dwFlatColour = D3DCOLOR_RGBA(vbcolor[##v][0], vbcolor[##v][1], vbcolor[##v][2], vbcolor[##v][3]); \ - if (vbspec) { \ - dwSpecularColour = D3DCOLOR_RGBA(vbspec[##v][0], vbspec[##v][1], vbspec[##v][2], vbspec[##v][3]); \ - } \ - } - -#define GLD_SETUP_TWOSIDED_LIGHTING \ - /* Two-sided lighting */ \ - if (ctx->_TriangleCaps & DD_TRI_LIGHT_TWOSIDE) { \ - SWvertex *verts = SWSETUP_CONTEXT(ctx)->verts; \ - SWvertex *v[3]; \ - GLfloat ex,ey,fx,fy,cc; \ - /* Get vars for later */ \ - VB = &TNL_CONTEXT(ctx)->vb; \ - vbcolor = (GLchan (*)[4])VB->ColorPtr[1]->data; \ - if (VB->SecondaryColorPtr[1]) { \ - vbspec = (GLchan (*)[4])VB->SecondaryColorPtr[1]->data; \ - } else { \ - vbspec = NULL; \ - } \ - v[0] = &verts[v0]; \ - v[1] = &verts[v1]; \ - v[2] = &verts[v2]; \ - ex = v[0]->win[0] - v[2]->win[0]; \ - ey = v[0]->win[1] - v[2]->win[1]; \ - fx = v[1]->win[0] - v[2]->win[0]; \ - fy = v[1]->win[1] - v[2]->win[1]; \ - cc = ex*fy - ey*fx; \ - facing = (cc < 0.0) ^ ctx->Polygon._FrontBit; \ - } - -//--------------------------------------------------------------------------- -// 3D vertex setup -//--------------------------------------------------------------------------- - -#define GLD_SETUP_3D_VARS_POINTS \ - GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); \ - GLD_driver_dx8 *gld = GLD_GET_DX8_DRIVER(gldCtx); \ - GLD_3D_VERTEX *pV = (GLD_3D_VERTEX*)gld->PB3d.pPoints; \ - TNLcontext *tnl = TNL_CONTEXT(ctx); \ - struct vertex_buffer *VB = &tnl->vb; \ - GLfloat (*p4f)[4]; \ - GLfloat (*tc)[4]; \ - DWORD dwColor; - -#define GLD_SETUP_3D_VARS_LINES \ - GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); \ - GLD_driver_dx8 *gld = GLD_GET_DX8_DRIVER(gldCtx); \ - GLD_3D_VERTEX *pV = (GLD_3D_VERTEX*)gld->PB3d.pLines; \ - TNLcontext *tnl = TNL_CONTEXT(ctx); \ - struct vertex_buffer *VB = &tnl->vb; \ - GLfloat (*p4f)[4]; \ - GLfloat (*tc)[4]; \ - DWORD dwColor; - -#define GLD_SETUP_3D_VARS_TRIANGLES \ - GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); \ - GLD_driver_dx8 *gld = GLD_GET_DX8_DRIVER(gldCtx); \ - GLD_3D_VERTEX *pV = (GLD_3D_VERTEX*)gld->PB3d.pTriangles; \ - TNLcontext *tnl = TNL_CONTEXT(ctx); \ - struct vertex_buffer *VB = &tnl->vb; \ - GLfloat (*p4f)[4]; \ - GLfloat (*tc)[4]; \ - DWORD dwColor; - -#define GLD_SETUP_3D_VERTEX(v) \ - p4f = VB->ObjPtr->data; \ - pV->Position.x = p4f[##v][0]; \ - pV->Position.y = p4f[##v][1]; \ - pV->Position.z = p4f[##v][2]; - -#define GLD_SETUP_SMOOTH_COLOUR_3D(v) \ - p4f = (GLfloat (*)[4])VB->ColorPtr[0]->data; \ - pV->Diffuse = D3DCOLOR_COLORVALUE(p4f[##v][0], p4f[##v][1], p4f[##v][2], p4f[##v][3]); - - -#define GLD_SETUP_GET_FLAT_COLOUR_3D(v) \ - p4f = (GLfloat (*)[4])VB->ColorPtr[0]->data; \ - dwColor = D3DCOLOR_COLORVALUE(p4f[##v][0], p4f[##v][1], p4f[##v][2], p4f[##v][3]); - -#define GLD_SETUP_USE_FLAT_COLOUR_3D \ - pV->Diffuse = dwColor; - -#define GLD_SETUP_TEX0_3D(v) \ - if (VB->TexCoordPtr[0]) { \ - tc = VB->TexCoordPtr[0]->data; \ - pV->TexUnit0.x = tc[##v][0]; \ - pV->TexUnit0.y = tc[##v][1]; \ - } - -#define GLD_SETUP_TEX1_3D(v) \ - if (VB->TexCoordPtr[1]) { \ - tc = VB->TexCoordPtr[1]->data; \ - pV->TexUnit1.x = tc[##v][0]; \ - pV->TexUnit1.y = tc[##v][1]; \ - } - -//--------------------------------------------------------------------------- -// Helper functions -//--------------------------------------------------------------------------- - -__inline DWORD _gldComputeFog( - GLcontext *ctx, - SWvertex *swv) -{ - // Full fog calculation. - // Based on Mesa code. - - GLchan rFog, gFog, bFog; - GLchan fR, fG, fB; - const GLfloat f = swv->fog; - const GLfloat g = 1.0f - f; - - UNCLAMPED_FLOAT_TO_CHAN(rFog, ctx->Fog.Color[RCOMP]); - UNCLAMPED_FLOAT_TO_CHAN(gFog, ctx->Fog.Color[GCOMP]); - UNCLAMPED_FLOAT_TO_CHAN(bFog, ctx->Fog.Color[BCOMP]); - fR = f * swv->color[0] + g * rFog; - fG = f * swv->color[1] + g * gFog; - fB = f * swv->color[2] + g * bFog; - return D3DCOLOR_RGBA(fR, fG, fB, swv->color[3]); -} - -//--------------------------------------------------------------------------- - -void gld_ResetLineStipple_DX8( - GLcontext *ctx) -{ - // TODO: Fake stipple with a 32x32 texture. -} - -//--------------------------------------------------------------------------- -// 2D (post-transformed) primitives -//--------------------------------------------------------------------------- - -void gld_Points2D_DX8( - GLcontext *ctx, - GLuint first, - GLuint last) -{ - GLD_SETUP_2D_VARS_POINTS; - - unsigned i; - struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; - - // _Size is already clamped to MaxPointSize and MinPointSize - IDirect3DDevice8_SetRenderState(gld->pDev, D3DRS_POINTSIZE, *((DWORD*)&ctx->Point._Size)); - - if (VB->Elts) { - for (i=first; iClipMask[VB->Elts[i]] == 0) { -// _swrast_Point( ctx, &verts[VB->Elts[i]] ); - GLD_SETUP_GET_SWVERT(VB->Elts[i]); - GLD_SETUP_2D_VERTEX; - GLD_SETUP_SMOOTH_COLOUR; - GLD_SETUP_DEPTH; - GLD_SETUP_SPECULAR; - GLD_SETUP_TEX0; - GLD_SETUP_TEX1; - } - } - } else { - GLD_SETUP_GET_SWVERT(first); - for (i=first; iClipMask[i] == 0) { -// _swrast_Point( ctx, &verts[i] ); - GLD_SETUP_2D_VERTEX; - GLD_SETUP_SMOOTH_COLOUR; - GLD_SETUP_DEPTH; - GLD_SETUP_SPECULAR; - GLD_SETUP_TEX0; - GLD_SETUP_TEX1; - } - } - } - - gld->PB2d.pPoints = (BYTE*)pV; - gld->PB2d.nPoints += (last-first); -} - -//--------------------------------------------------------------------------- - -void gld_Line2DFlat_DX8( - GLcontext *ctx, - GLuint v0, - GLuint v1) -{ - GLD_SETUP_2D_VARS_LINES; - - GLD_SETUP_GET_SWVERT(v1); - GLD_SETUP_2D_VERTEX; - GLD_SETUP_DEPTH; - GLD_SETUP_TEX0; - GLD_SETUP_TEX1; - GLD_SETUP_GET_FLAT_COLOUR; - GLD_SETUP_USE_FLAT_COLOUR; - GLD_SETUP_GET_FLAT_SPECULAR; - GLD_SETUP_USE_FLAT_SPECULAR; - pV++; - - GLD_SETUP_GET_SWVERT(v0); - GLD_SETUP_2D_VERTEX; - GLD_SETUP_DEPTH; - GLD_SETUP_TEX0; - GLD_SETUP_TEX1; - GLD_SETUP_USE_FLAT_COLOUR; - GLD_SETUP_USE_FLAT_SPECULAR; - pV++; - - gld->PB2d.pLines = (BYTE*)pV; - gld->PB2d.nLines++; -} - -//--------------------------------------------------------------------------- - -void gld_Line2DSmooth_DX8( - GLcontext *ctx, - GLuint v0, - GLuint v1) -{ - GLD_SETUP_2D_VARS_LINES; - - GLD_SETUP_GET_SWVERT(v0); - GLD_SETUP_2D_VERTEX; - GLD_SETUP_SMOOTH_COLOUR; - GLD_SETUP_DEPTH; - GLD_SETUP_SPECULAR; - GLD_SETUP_TEX0; - GLD_SETUP_TEX1; - pV++; - - GLD_SETUP_GET_SWVERT(v1); - GLD_SETUP_2D_VERTEX; - GLD_SETUP_SMOOTH_COLOUR; - GLD_SETUP_SPECULAR; - GLD_SETUP_DEPTH; - GLD_SETUP_TEX0; - GLD_SETUP_TEX1; - pV++; - - gld->PB2d.pLines = (BYTE*)pV; - gld->PB2d.nLines++; -} - -//--------------------------------------------------------------------------- - -void gld_Triangle2DFlat_DX8( - GLcontext *ctx, - GLuint v0, - GLuint v1, - GLuint v2) -{ - GLD_SETUP_2D_VARS_TRIANGLES; - - GLD_SETUP_GET_SWVERT(v2); - GLD_SETUP_2D_VERTEX; - GLD_SETUP_DEPTH; - GLD_SETUP_TEX0; - GLD_SETUP_TEX1; - GLD_SETUP_GET_FLAT_COLOUR; - GLD_SETUP_USE_FLAT_COLOUR; - pV++;; - - GLD_SETUP_GET_SWVERT(v0); - GLD_SETUP_2D_VERTEX; - GLD_SETUP_DEPTH; - GLD_SETUP_TEX0; - GLD_SETUP_TEX1; - GLD_SETUP_USE_FLAT_COLOUR; - pV++; - - GLD_SETUP_GET_SWVERT(v1); - GLD_SETUP_2D_VERTEX; - GLD_SETUP_DEPTH; - GLD_SETUP_TEX0; - GLD_SETUP_TEX1; - GLD_SETUP_USE_FLAT_COLOUR; - pV++; - - gld->PB2d.pTriangles = (BYTE*)pV; - gld->PB2d.nTriangles++; -} - -//--------------------------------------------------------------------------- - -void gld_Triangle2DSmooth_DX8( - GLcontext *ctx, - GLuint v0, - GLuint v1, - GLuint v2) -{ - - GLD_SETUP_2D_VARS_TRIANGLES; - - GLD_SETUP_GET_SWVERT(v0); - GLD_SETUP_2D_VERTEX; - GLD_SETUP_SMOOTH_COLOUR; - GLD_SETUP_DEPTH; - GLD_SETUP_TEX0; - GLD_SETUP_TEX1; - pV++; - - GLD_SETUP_GET_SWVERT(v1); - GLD_SETUP_2D_VERTEX; - GLD_SETUP_SMOOTH_COLOUR; - GLD_SETUP_DEPTH; - GLD_SETUP_TEX0; - GLD_SETUP_TEX1; - pV++; - - GLD_SETUP_GET_SWVERT(v2); - GLD_SETUP_2D_VERTEX; - GLD_SETUP_SMOOTH_COLOUR; - GLD_SETUP_DEPTH; - GLD_SETUP_TEX0; - GLD_SETUP_TEX1; - pV++; - - gld->PB2d.pTriangles = (BYTE*)pV; - gld->PB2d.nTriangles++; -} - -//--------------------------------------------------------------------------- - -void gld_Triangle2DFlatExtras_DX8( - GLcontext *ctx, - GLuint v0, - GLuint v1, - GLuint v2) -{ - GLD_SETUP_2D_VARS_TRIANGLES; - - GLD_SETUP_TWOSIDED_LIGHTING(v2); - - GLD_SETUP_GET_SWVERT(v2); - GLD_SETUP_2D_VERTEX; - GLD_SETUP_DEPTH; - GLD_SETUP_TEX0; - GLD_SETUP_TEX1; - if (bFog) - GLD_SETUP_GET_FLAT_FOG_COLOUR; - else - GLD_SETUP_GET_FLAT_COLOUR; - GLD_SETUP_GET_FLAT_SPECULAR; - GLD_SETUP_GET_FLAT_LIGHTING(v2); - GLD_SETUP_USE_FLAT_COLOUR; - GLD_SETUP_USE_FLAT_SPECULAR; - pV++; - - GLD_SETUP_GET_SWVERT(v0); - GLD_SETUP_2D_VERTEX; - GLD_SETUP_DEPTH; - GLD_SETUP_TEX0; - GLD_SETUP_TEX1; - GLD_SETUP_USE_FLAT_COLOUR; - GLD_SETUP_USE_FLAT_SPECULAR; - pV++; - - GLD_SETUP_GET_SWVERT(v1); - GLD_SETUP_2D_VERTEX; - GLD_SETUP_DEPTH; - GLD_SETUP_TEX0; - GLD_SETUP_TEX1; - GLD_SETUP_USE_FLAT_COLOUR; - GLD_SETUP_USE_FLAT_SPECULAR; - pV++; - - gld->PB2d.pTriangles = (BYTE*)pV; - gld->PB2d.nTriangles++; -} - -//--------------------------------------------------------------------------- - -void gld_Triangle2DSmoothExtras_DX8( - GLcontext *ctx, - GLuint v0, - GLuint v1, - GLuint v2) -{ - GLD_SETUP_2D_VARS_TRIANGLES; - - GLD_SETUP_TWOSIDED_LIGHTING(v0); - - GLD_SETUP_GET_SWVERT(v0); - GLD_SETUP_2D_VERTEX; - GLD_SETUP_DEPTH; - GLD_SETUP_TEX0; - GLD_SETUP_TEX1; - GLD_SETUP_LIGHTING(v0); - pV++; - - GLD_SETUP_GET_SWVERT(v1); - GLD_SETUP_2D_VERTEX; - GLD_SETUP_DEPTH; - GLD_SETUP_TEX0; - GLD_SETUP_TEX1; - GLD_SETUP_LIGHTING(v1); - pV++; - - GLD_SETUP_GET_SWVERT(v2); - GLD_SETUP_2D_VERTEX; - GLD_SETUP_DEPTH; - GLD_SETUP_TEX0; - GLD_SETUP_TEX1; - GLD_SETUP_LIGHTING(v2); - pV++; - - gld->PB2d.pTriangles = (BYTE*)pV; - gld->PB2d.nTriangles++; -} - -//--------------------------------------------------------------------------- - -void gld_Quad2DFlat_DX8( - GLcontext *ctx, - GLuint v0, - GLuint v1, - GLuint v2, - GLuint v3) -{ - GLD_SETUP_2D_VARS_TRIANGLES; - - GLD_SETUP_GET_SWVERT(v3); - GLD_SETUP_2D_VERTEX; - GLD_SETUP_DEPTH; - GLD_SETUP_TEX0; - GLD_SETUP_TEX1; - GLD_SETUP_GET_FLAT_COLOUR; - GLD_SETUP_USE_FLAT_COLOUR; - pV++; - - GLD_SETUP_GET_SWVERT(v0); - GLD_SETUP_2D_VERTEX; - GLD_SETUP_DEPTH; - GLD_SETUP_TEX0; - GLD_SETUP_TEX1; - GLD_SETUP_USE_FLAT_COLOUR; - pV++; - - GLD_SETUP_GET_SWVERT(v1); - GLD_SETUP_2D_VERTEX; - GLD_SETUP_DEPTH; - GLD_SETUP_TEX0; - GLD_SETUP_TEX1; - GLD_SETUP_USE_FLAT_COLOUR; - pV++; - - GLD_SETUP_GET_SWVERT(v1); - GLD_SETUP_2D_VERTEX; - GLD_SETUP_DEPTH; - GLD_SETUP_TEX0; - GLD_SETUP_TEX1; - GLD_SETUP_USE_FLAT_COLOUR; - pV++; - - GLD_SETUP_GET_SWVERT(v2); - GLD_SETUP_2D_VERTEX; - GLD_SETUP_DEPTH; - GLD_SETUP_TEX0; - GLD_SETUP_TEX1; - GLD_SETUP_USE_FLAT_COLOUR; - pV++; - - GLD_SETUP_GET_SWVERT(v3); - GLD_SETUP_2D_VERTEX; - GLD_SETUP_DEPTH; - GLD_SETUP_TEX0; - GLD_SETUP_TEX1; - GLD_SETUP_USE_FLAT_COLOUR; - pV++; - - gld->PB2d.pTriangles = (BYTE*)pV; - gld->PB2d.nTriangles += 2; -} - -//--------------------------------------------------------------------------- - -void gld_Quad2DSmooth_DX8( - GLcontext *ctx, - GLuint v0, - GLuint v1, - GLuint v2, - GLuint v3) -{ - GLD_SETUP_2D_VARS_TRIANGLES; - - GLD_SETUP_GET_SWVERT(v0); - GLD_SETUP_2D_VERTEX; - GLD_SETUP_SMOOTH_COLOUR; - GLD_SETUP_DEPTH; - GLD_SETUP_TEX0; - GLD_SETUP_TEX1; - pV++; - - GLD_SETUP_GET_SWVERT(v1); - GLD_SETUP_2D_VERTEX; - GLD_SETUP_SMOOTH_COLOUR; - GLD_SETUP_DEPTH; - GLD_SETUP_TEX0; - GLD_SETUP_TEX1; - pV++; - - GLD_SETUP_GET_SWVERT(v2); - GLD_SETUP_2D_VERTEX; - GLD_SETUP_SMOOTH_COLOUR; - GLD_SETUP_DEPTH; - GLD_SETUP_TEX0; - GLD_SETUP_TEX1; - pV++; - - GLD_SETUP_GET_SWVERT(v2); - GLD_SETUP_2D_VERTEX; - GLD_SETUP_SMOOTH_COLOUR; - GLD_SETUP_DEPTH; - GLD_SETUP_TEX0; - GLD_SETUP_TEX1; - pV++; - - GLD_SETUP_GET_SWVERT(v3); - GLD_SETUP_2D_VERTEX; - GLD_SETUP_SMOOTH_COLOUR; - GLD_SETUP_DEPTH; - GLD_SETUP_TEX0; - GLD_SETUP_TEX1; - pV++; - - GLD_SETUP_GET_SWVERT(v0); - GLD_SETUP_2D_VERTEX; - GLD_SETUP_SMOOTH_COLOUR; - GLD_SETUP_DEPTH; - GLD_SETUP_TEX0; - GLD_SETUP_TEX1; - pV++; - - gld->PB2d.pTriangles = (BYTE*)pV; - gld->PB2d.nTriangles += 2; -} - -//--------------------------------------------------------------------------- - -void gld_Quad2DFlatExtras_DX8( - GLcontext *ctx, - GLuint v0, - GLuint v1, - GLuint v2, - GLuint v3) -{ - GLD_SETUP_2D_VARS_TRIANGLES; - - GLD_SETUP_TWOSIDED_LIGHTING(v3); - - GLD_SETUP_GET_SWVERT(v3); - GLD_SETUP_2D_VERTEX; - GLD_SETUP_DEPTH; - GLD_SETUP_TEX0; - GLD_SETUP_TEX1; - if (bFog) - GLD_SETUP_GET_FLAT_FOG_COLOUR; - else - GLD_SETUP_GET_FLAT_COLOUR; - GLD_SETUP_GET_FLAT_SPECULAR; - GLD_SETUP_GET_FLAT_LIGHTING(v3); - GLD_SETUP_USE_FLAT_COLOUR; - GLD_SETUP_USE_FLAT_SPECULAR; - pV++; - - GLD_SETUP_GET_SWVERT(v0); - GLD_SETUP_2D_VERTEX; - GLD_SETUP_DEPTH; - GLD_SETUP_TEX0; - GLD_SETUP_TEX1; - GLD_SETUP_USE_FLAT_COLOUR; - GLD_SETUP_USE_FLAT_SPECULAR; - pV++; - - GLD_SETUP_GET_SWVERT(v1); - GLD_SETUP_2D_VERTEX; - GLD_SETUP_DEPTH; - GLD_SETUP_TEX0; - GLD_SETUP_TEX1; - GLD_SETUP_USE_FLAT_COLOUR; - GLD_SETUP_USE_FLAT_SPECULAR; - pV++; - - GLD_SETUP_GET_SWVERT(v1); - GLD_SETUP_2D_VERTEX; - GLD_SETUP_DEPTH; - GLD_SETUP_TEX0; - GLD_SETUP_TEX1; - GLD_SETUP_USE_FLAT_COLOUR; - GLD_SETUP_USE_FLAT_SPECULAR; - pV++; - - GLD_SETUP_GET_SWVERT(v2); - GLD_SETUP_2D_VERTEX; - GLD_SETUP_DEPTH; - GLD_SETUP_TEX0; - GLD_SETUP_TEX1; - GLD_SETUP_USE_FLAT_COLOUR; - GLD_SETUP_USE_FLAT_SPECULAR; - pV++; - - GLD_SETUP_GET_SWVERT(v3); - GLD_SETUP_2D_VERTEX; - GLD_SETUP_DEPTH; - GLD_SETUP_TEX0; - GLD_SETUP_TEX1; - GLD_SETUP_USE_FLAT_COLOUR; - GLD_SETUP_USE_FLAT_SPECULAR; - pV++; - - gld->PB2d.pTriangles = (BYTE*)pV; - gld->PB2d.nTriangles += 2; -} - -//--------------------------------------------------------------------------- - -void gld_Quad2DSmoothExtras_DX8( - GLcontext *ctx, - GLuint v0, - GLuint v1, - GLuint v2, - GLuint v3) -{ - GLD_SETUP_2D_VARS_TRIANGLES; - - GLD_SETUP_TWOSIDED_LIGHTING(v0); - - GLD_SETUP_GET_SWVERT(v0); - GLD_SETUP_2D_VERTEX; - GLD_SETUP_DEPTH; - GLD_SETUP_TEX0; - GLD_SETUP_TEX1; - GLD_SETUP_LIGHTING(v0); - pV++; - - GLD_SETUP_GET_SWVERT(v1); - GLD_SETUP_2D_VERTEX; - GLD_SETUP_DEPTH; - GLD_SETUP_TEX0; - GLD_SETUP_TEX1; - GLD_SETUP_LIGHTING(v1); - pV++; - - GLD_SETUP_GET_SWVERT(v2); - GLD_SETUP_2D_VERTEX; - GLD_SETUP_DEPTH; - GLD_SETUP_TEX0; - GLD_SETUP_TEX1; - GLD_SETUP_LIGHTING(v2); - pV++; - - GLD_SETUP_GET_SWVERT(v2); - GLD_SETUP_2D_VERTEX; - GLD_SETUP_DEPTH; - GLD_SETUP_TEX0; - GLD_SETUP_TEX1; - GLD_SETUP_LIGHTING(v2); - pV++; - - GLD_SETUP_GET_SWVERT(v3); - GLD_SETUP_2D_VERTEX; - GLD_SETUP_DEPTH; - GLD_SETUP_TEX0; - GLD_SETUP_TEX1; - GLD_SETUP_LIGHTING(v3); - pV++; - - GLD_SETUP_GET_SWVERT(v0); - GLD_SETUP_2D_VERTEX; - GLD_SETUP_DEPTH; - GLD_SETUP_TEX0; - GLD_SETUP_TEX1; - GLD_SETUP_LIGHTING(v0); - pV++; - - gld->PB2d.pTriangles = (BYTE*)pV; - gld->PB2d.nTriangles += 2; -} - -//--------------------------------------------------------------------------- -// 3D (pre-transformed) primitives -//--------------------------------------------------------------------------- - -void gld_Points3D_DX8( - GLcontext *ctx, - GLuint first, - GLuint last) -{ - GLD_SETUP_3D_VARS_POINTS - - unsigned i; -// struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; - - // _Size is already clamped to MaxPointSize and MinPointSize - IDirect3DDevice8_SetRenderState(gld->pDev, D3DRS_POINTSIZE, *((DWORD*)&ctx->Point._Size)); - - if (VB->Elts) { - for (i=first; iClipMask[VB->Elts[i]] == 0) { -// _swrast_Point( ctx, &verts[VB->Elts[i]] ); -// GLD_SETUP_GET_SWVERT(VB->Elts[i]); - GLD_SETUP_3D_VERTEX(VB->Elts[i]) - GLD_SETUP_SMOOTH_COLOUR_3D(i) - GLD_SETUP_TEX0_3D(i) - GLD_SETUP_TEX1_3D(i) - } - } - } else { -// GLD_SETUP_GET_SWVERT(first); - for (i=first; iClipMask[i] == 0) { -// _swrast_Point( ctx, &verts[i] ); - GLD_SETUP_3D_VERTEX(i) - GLD_SETUP_SMOOTH_COLOUR_3D(i) - GLD_SETUP_TEX0_3D(i) - GLD_SETUP_TEX1_3D(i) - } - } - } -/* - for (i=first; iPB3d.pPoints = (BYTE*)pV; - gld->PB3d.nPoints += (last-first); -} - -//--------------------------------------------------------------------------- -// Line functions -//--------------------------------------------------------------------------- - -void gld_Line3DFlat_DX8( - GLcontext *ctx, - GLuint v0, - GLuint v1) -{ - GLD_SETUP_3D_VARS_LINES - - GLD_SETUP_3D_VERTEX(v1) - GLD_SETUP_GET_FLAT_COLOUR_3D(v1) - GLD_SETUP_USE_FLAT_COLOUR_3D - GLD_SETUP_TEX0_3D(v1) - GLD_SETUP_TEX1_3D(v1) - pV++; - - GLD_SETUP_3D_VERTEX(v0) - GLD_SETUP_USE_FLAT_COLOUR_3D - GLD_SETUP_TEX0_3D(v0) - GLD_SETUP_TEX1_3D(v0) - pV++; - - gld->PB3d.pLines = (BYTE*)pV; - gld->PB3d.nLines++; -} - -//--------------------------------------------------------------------------- - -void gld_Line3DSmooth_DX8( - GLcontext *ctx, - GLuint v0, - GLuint v1) -{ - GLD_SETUP_3D_VARS_LINES - - GLD_SETUP_3D_VERTEX(v1) - GLD_SETUP_SMOOTH_COLOUR_3D(v1) - GLD_SETUP_TEX0_3D(v1) - GLD_SETUP_TEX1_3D(v1) - pV++; - - GLD_SETUP_3D_VERTEX(v0) - GLD_SETUP_SMOOTH_COLOUR_3D(v0) - GLD_SETUP_TEX0_3D(v0) - GLD_SETUP_TEX1_3D(v0) - pV++; - - gld->PB3d.pLines = (BYTE*)pV; - gld->PB3d.nLines++; -} - -//--------------------------------------------------------------------------- -// Triangle functions -//--------------------------------------------------------------------------- - -void gld_Triangle3DFlat_DX8( - GLcontext *ctx, - GLuint v0, - GLuint v1, - GLuint v2) -{ - GLD_SETUP_3D_VARS_TRIANGLES - - GLD_SETUP_3D_VERTEX(v2) - GLD_SETUP_TEX0_3D(v2) - GLD_SETUP_TEX1_3D(v2) - GLD_SETUP_GET_FLAT_COLOUR_3D(v2) - GLD_SETUP_USE_FLAT_COLOUR_3D - pV++; - - GLD_SETUP_3D_VERTEX(v0) - GLD_SETUP_TEX0_3D(v0) - GLD_SETUP_TEX1_3D(v0) - GLD_SETUP_USE_FLAT_COLOUR_3D - pV++; - - GLD_SETUP_3D_VERTEX(v1) - GLD_SETUP_TEX0_3D(v1) - GLD_SETUP_TEX1_3D(v1) - GLD_SETUP_USE_FLAT_COLOUR_3D - pV++; - - gld->PB3d.pTriangles = (BYTE*)pV; - gld->PB3d.nTriangles++; -} - -//--------------------------------------------------------------------------- - -void gld_Triangle3DSmooth_DX8( - GLcontext *ctx, - GLuint v0, - GLuint v1, - GLuint v2) -{ - GLD_SETUP_3D_VARS_TRIANGLES - - GLD_SETUP_3D_VERTEX(v0) - GLD_SETUP_SMOOTH_COLOUR_3D(v0) - GLD_SETUP_TEX0_3D(v0) - GLD_SETUP_TEX1_3D(v0) - pV++; - - GLD_SETUP_3D_VERTEX(v1) - GLD_SETUP_SMOOTH_COLOUR_3D(v1) - GLD_SETUP_TEX0_3D(v1) - GLD_SETUP_TEX1_3D(v1) - pV++; - - GLD_SETUP_3D_VERTEX(v2) - GLD_SETUP_SMOOTH_COLOUR_3D(v2) - GLD_SETUP_TEX0_3D(v2) - GLD_SETUP_TEX1_3D(v2) - pV++; - - gld->PB3d.pTriangles = (BYTE*)pV; - gld->PB3d.nTriangles++; -} - -//--------------------------------------------------------------------------- -// Quad functions -//--------------------------------------------------------------------------- - -void gld_Quad3DFlat_DX8( - GLcontext *ctx, - GLuint v0, - GLuint v1, - GLuint v2, - GLuint v3) -{ - GLD_SETUP_3D_VARS_TRIANGLES - - GLD_SETUP_3D_VERTEX(v3) - GLD_SETUP_GET_FLAT_COLOUR_3D(v3) - GLD_SETUP_USE_FLAT_COLOUR_3D - GLD_SETUP_TEX0_3D(v3) - GLD_SETUP_TEX1_3D(v3) - pV++; - - GLD_SETUP_3D_VERTEX(v0) - GLD_SETUP_USE_FLAT_COLOUR_3D - GLD_SETUP_TEX0_3D(v0) - GLD_SETUP_TEX1_3D(v0) - pV++; - - GLD_SETUP_3D_VERTEX(v1) - GLD_SETUP_USE_FLAT_COLOUR_3D - GLD_SETUP_TEX0_3D(v1) - GLD_SETUP_TEX1_3D(v1) - pV++; - - GLD_SETUP_3D_VERTEX(v1) - GLD_SETUP_USE_FLAT_COLOUR_3D - GLD_SETUP_TEX0_3D(v1) - GLD_SETUP_TEX1_3D(v1) - pV++; - - GLD_SETUP_3D_VERTEX(v2) - GLD_SETUP_USE_FLAT_COLOUR_3D - GLD_SETUP_TEX0_3D(v2) - GLD_SETUP_TEX1_3D(v2) - pV++; - - GLD_SETUP_3D_VERTEX(v3) - GLD_SETUP_USE_FLAT_COLOUR_3D - GLD_SETUP_TEX0_3D(v3) - GLD_SETUP_TEX1_3D(v3) - pV++; - - gld->PB3d.pTriangles = (BYTE*)pV; - gld->PB3d.nTriangles += 2; -} - -//--------------------------------------------------------------------------- - -void gld_Quad3DSmooth_DX8( - GLcontext *ctx, - GLuint v0, - GLuint v1, - GLuint v2, - GLuint v3) -{ - GLD_SETUP_3D_VARS_TRIANGLES - - GLD_SETUP_3D_VERTEX(v0) - GLD_SETUP_SMOOTH_COLOUR_3D(v0) - GLD_SETUP_TEX0_3D(v0) - GLD_SETUP_TEX1_3D(v0) - pV++; - - GLD_SETUP_3D_VERTEX(v1) - GLD_SETUP_SMOOTH_COLOUR_3D(v1) - GLD_SETUP_TEX0_3D(v1) - GLD_SETUP_TEX1_3D(v1) - pV++; - - GLD_SETUP_3D_VERTEX(v2) - GLD_SETUP_SMOOTH_COLOUR_3D(v2) - GLD_SETUP_TEX0_3D(v2) - GLD_SETUP_TEX1_3D(v2) - pV++; - - GLD_SETUP_3D_VERTEX(v2) - GLD_SETUP_SMOOTH_COLOUR_3D(v2) - GLD_SETUP_TEX0_3D(v2) - GLD_SETUP_TEX1_3D(v2) - pV++; - - GLD_SETUP_3D_VERTEX(v3) - GLD_SETUP_SMOOTH_COLOUR_3D(v3) - GLD_SETUP_TEX0_3D(v3) - GLD_SETUP_TEX1_3D(v3) - pV++; - - GLD_SETUP_3D_VERTEX(v0) - GLD_SETUP_SMOOTH_COLOUR_3D(v0) - GLD_SETUP_TEX0_3D(v0) - GLD_SETUP_TEX1_3D(v0) - pV++; - - gld->PB3d.pTriangles = (BYTE*)pV; - gld->PB3d.nTriangles += 2; -} - -//--------------------------------------------------------------------------- -// Vertex setup for two-sided-lighting vertex shader -//--------------------------------------------------------------------------- - -/* - -void gld_Points2DTwoside_DX8(GLcontext *ctx, GLuint first, GLuint last) -{ - // NOTE: Two-sided lighting does not apply to Points -} - -//--------------------------------------------------------------------------- - -void gld_Line2DFlatTwoside_DX8(GLcontext *ctx, GLuint v0, GLuint v1) -{ - // NOTE: Two-sided lighting does not apply to Lines -} - -//--------------------------------------------------------------------------- - -void gld_Line2DSmoothTwoside_DX8(GLcontext *ctx, GLuint v0, GLuint v1) -{ - // NOTE: Two-sided lighting does not apply to Lines -} - -//--------------------------------------------------------------------------- - -void gld_Triangle2DFlatTwoside_DX8(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2) -{ -} - -//--------------------------------------------------------------------------- - -void gld_Triangle2DSmoothTwoside_DX8(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2) -{ - GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); - GLD_driver_dx8 *gld = GLD_GET_DX8_DRIVER(gldCtx); - GLD_TWOSIDED_VERTEX *pV = (GLD_TWOSIDED_VERTEX*)gld->PBtwosidelight.pTriangles; - SScontext *ss = SWSETUP_CONTEXT(ctx); - SWvertex *swv; - DWORD dwSpecularColour; - DWORD dwFlatColour; - GLuint facing = 0; - struct vertex_buffer *VB; - GLchan (*vbcolor)[4]; - GLchan (*vbspec)[4]; - - // Reciprocal of DepthMax - const float ooDepthMax = 1.0f / ctx->DepthMaxF; - - // 1st vert - swv = &ss->verts[v0]; - pV->Position.x = swv->win[0]; - pV->Position.y = GLD_FLIP_Y(swv->win[1]); - pV->Position.z = swv->win[2] * ooDepthMax; - pV->Position.w = swv->win[3]; - pV->TexUnit0.x = swv->texcoord[0][0]; - pV->TexUnit0.y = swv->texcoord[0][1]; - pV->TexUnit1.x = swv->texcoord[1][0]; - pV->TexUnit1.y = swv->texcoord[1][1]; - pV->FrontDiffuse = GLD_COLOUR; - pV->FrontSpecular = GLD_SPECULAR; - pV++; - - // 2nd vert - swv = &ss->verts[v1]; - pV->Position.x = swv->win[0]; - pV->Position.y = GLD_FLIP_Y(swv->win[1]); - pV->Position.z = swv->win[2] * ooDepthMax; - pV->Position.w = swv->win[3]; - pV->TexUnit0.x = swv->texcoord[0][0]; - pV->TexUnit0.y = swv->texcoord[0][1]; - pV->TexUnit1.x = swv->texcoord[1][0]; - pV->TexUnit1.y = swv->texcoord[1][1]; - pV->FrontDiffuse = GLD_COLOUR; - pV->FrontSpecular = GLD_SPECULAR; - pV++; - - // 3rd vert - swv = &ss->verts[v2]; - pV->Position.x = swv->win[0]; - pV->Position.y = GLD_FLIP_Y(swv->win[1]); - pV->Position.z = swv->win[2] * ooDepthMax; - pV->Position.w = swv->win[3]; - pV->TexUnit0.x = swv->texcoord[0][0]; - pV->TexUnit0.y = swv->texcoord[0][1]; - pV->TexUnit1.x = swv->texcoord[1][0]; - pV->TexUnit1.y = swv->texcoord[1][1]; - pV->FrontDiffuse = GLD_COLOUR; - pV->FrontSpecular = GLD_SPECULAR; - pV++; - - gld->PBtwosidelight.pTriangles = (BYTE*)pV; - gld->PBtwosidelight.nTriangles++; -} - -//--------------------------------------------------------------------------- - -void gld_Quad2DFlatTwoside_DX8(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3) -{ - GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); - GLD_driver_dx8 *gld = GLD_GET_DX8_DRIVER(gldCtx); - GLD_TWOSIDED_VERTEX *pV = (GLD_TWOSIDED_VERTEX*)gld->PBtwosidelight.pTriangles; - SScontext *ss = SWSETUP_CONTEXT(ctx); - SWvertex *swv; - DWORD dwSpecularColour; - DWORD dwFlatColour; - GLuint facing = 0; - struct vertex_buffer *VB; - GLchan (*vbcolor)[4]; - GLchan (*vbspec)[4]; - - // Reciprocal of DepthMax - const float ooDepthMax = 1.0f / ctx->DepthMaxF; - - // 1st vert - swv = &ss->verts[v0]; - pV->Position.x = swv->win[0]; - pV->Position.y = GLD_FLIP_Y(swv->win[1]); - pV->Position.z = swv->win[2] * ooDepthMax; - pV->Position.w = swv->win[3]; - pV->TexUnit0.x = swv->texcoord[0][0]; - pV->TexUnit0.y = swv->texcoord[0][1]; - pV->TexUnit1.x = swv->texcoord[1][0]; - pV->TexUnit1.y = swv->texcoord[1][1]; - pV->FrontDiffuse = GLD_COLOUR; - pV->FrontSpecular = GLD_SPECULAR; - pV++; - - // 2nd vert - swv = &ss->verts[v1]; - pV->Position.x = swv->win[0]; - pV->Position.y = GLD_FLIP_Y(swv->win[1]); - pV->Position.z = swv->win[2] * ooDepthMax; - pV->Position.w = swv->win[3]; - pV->TexUnit0.x = swv->texcoord[0][0]; - pV->TexUnit0.y = swv->texcoord[0][1]; - pV->TexUnit1.x = swv->texcoord[1][0]; - pV->TexUnit1.y = swv->texcoord[1][1]; - pV->FrontDiffuse = GLD_COLOUR; - pV->FrontSpecular = GLD_SPECULAR; - pV++; - - // 3rd vert - swv = &ss->verts[v2]; - pV->Position.x = swv->win[0]; - pV->Position.y = GLD_FLIP_Y(swv->win[1]); - pV->Position.z = swv->win[2] * ooDepthMax; - pV->Position.w = swv->win[3]; - pV->TexUnit0.x = swv->texcoord[0][0]; - pV->TexUnit0.y = swv->texcoord[0][1]; - pV->TexUnit1.x = swv->texcoord[1][0]; - pV->TexUnit1.y = swv->texcoord[1][1]; - pV->FrontDiffuse = GLD_COLOUR; - pV->FrontSpecular = GLD_SPECULAR; - pV++; - - // 4th vert - swv = &ss->verts[v2]; - pV->Position.x = swv->win[0]; - pV->Position.y = GLD_FLIP_Y(swv->win[1]); - pV->Position.z = swv->win[2] * ooDepthMax; - pV->Position.w = swv->win[3]; - pV->TexUnit0.x = swv->texcoord[0][0]; - pV->TexUnit0.y = swv->texcoord[0][1]; - pV->TexUnit1.x = swv->texcoord[1][0]; - pV->TexUnit1.y = swv->texcoord[1][1]; - pV->FrontDiffuse = GLD_COLOUR; - pV->FrontSpecular = GLD_SPECULAR; - pV++; - - // 5th vert - swv = &ss->verts[v3]; - pV->Position.x = swv->win[0]; - pV->Position.y = GLD_FLIP_Y(swv->win[1]); - pV->Position.z = swv->win[2] * ooDepthMax; - pV->Position.w = swv->win[3]; - pV->TexUnit0.x = swv->texcoord[0][0]; - pV->TexUnit0.y = swv->texcoord[0][1]; - pV->TexUnit1.x = swv->texcoord[1][0]; - pV->TexUnit1.y = swv->texcoord[1][1]; - pV->FrontDiffuse = GLD_COLOUR; - pV->FrontSpecular = GLD_SPECULAR; - pV++; - - // 6th vert - swv = &ss->verts[v0]; - pV->Position.x = swv->win[0]; - pV->Position.y = GLD_FLIP_Y(swv->win[1]); - pV->Position.z = swv->win[2] * ooDepthMax; - pV->Position.w = swv->win[3]; - pV->TexUnit0.x = swv->texcoord[0][0]; - pV->TexUnit0.y = swv->texcoord[0][1]; - pV->TexUnit1.x = swv->texcoord[1][0]; - pV->TexUnit1.y = swv->texcoord[1][1]; - pV->FrontDiffuse = GLD_COLOUR; - pV->FrontSpecular = GLD_SPECULAR; - pV++; - - gld->PBtwosidelight.pTriangles = (BYTE*)pV; - gld->PBtwosidelight.nTriangles += 2; -} - -//--------------------------------------------------------------------------- - -void gld_Quad2DSmoothTwoside_DX8(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3) -{ - GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); - GLD_driver_dx8 *gld = GLD_GET_DX8_DRIVER(gldCtx); - GLD_TWOSIDED_VERTEX *pV = (GLD_TWOSIDED_VERTEX*)gld->PBtwosidelight.pTriangles; - SScontext *ss = SWSETUP_CONTEXT(ctx); - SWvertex *swv; - DWORD dwSpecularColour; - DWORD dwFlatColour; - GLuint facing = 0; - struct vertex_buffer *VB; - GLchan (*vbcolor)[4]; - GLchan (*vbspec)[4]; - - // Reciprocal of DepthMax - const float ooDepthMax = 1.0f / ctx->DepthMaxF; - - // 1st vert - swv = &ss->verts[v0]; - pV->Position.x = swv->win[0]; - pV->Position.y = GLD_FLIP_Y(swv->win[1]); - pV->Position.z = swv->win[2] * ooDepthMax; - pV->Position.w = swv->win[3]; - pV->TexUnit0.x = swv->texcoord[0][0]; - pV->TexUnit0.y = swv->texcoord[0][1]; - pV->TexUnit1.x = swv->texcoord[1][0]; - pV->TexUnit1.y = swv->texcoord[1][1]; - pV->FrontDiffuse = GLD_COLOUR; - pV->FrontSpecular = GLD_SPECULAR; - pV++; - - // 2nd vert - swv = &ss->verts[v1]; - pV->Position.x = swv->win[0]; - pV->Position.y = GLD_FLIP_Y(swv->win[1]); - pV->Position.z = swv->win[2] * ooDepthMax; - pV->Position.w = swv->win[3]; - pV->TexUnit0.x = swv->texcoord[0][0]; - pV->TexUnit0.y = swv->texcoord[0][1]; - pV->TexUnit1.x = swv->texcoord[1][0]; - pV->TexUnit1.y = swv->texcoord[1][1]; - pV->FrontDiffuse = GLD_COLOUR; - pV->FrontSpecular = GLD_SPECULAR; - pV++; - - // 3rd vert - swv = &ss->verts[v2]; - pV->Position.x = swv->win[0]; - pV->Position.y = GLD_FLIP_Y(swv->win[1]); - pV->Position.z = swv->win[2] * ooDepthMax; - pV->Position.w = swv->win[3]; - pV->TexUnit0.x = swv->texcoord[0][0]; - pV->TexUnit0.y = swv->texcoord[0][1]; - pV->TexUnit1.x = swv->texcoord[1][0]; - pV->TexUnit1.y = swv->texcoord[1][1]; - pV->FrontDiffuse = GLD_COLOUR; - pV->FrontSpecular = GLD_SPECULAR; - pV++; - - // 4th vert - swv = &ss->verts[v2]; - pV->Position.x = swv->win[0]; - pV->Position.y = GLD_FLIP_Y(swv->win[1]); - pV->Position.z = swv->win[2] * ooDepthMax; - pV->Position.w = swv->win[3]; - pV->TexUnit0.x = swv->texcoord[0][0]; - pV->TexUnit0.y = swv->texcoord[0][1]; - pV->TexUnit1.x = swv->texcoord[1][0]; - pV->TexUnit1.y = swv->texcoord[1][1]; - pV->FrontDiffuse = GLD_COLOUR; - pV->FrontSpecular = GLD_SPECULAR; - pV++; - - // 5th vert - swv = &ss->verts[v3]; - pV->Position.x = swv->win[0]; - pV->Position.y = GLD_FLIP_Y(swv->win[1]); - pV->Position.z = swv->win[2] * ooDepthMax; - pV->Position.w = swv->win[3]; - pV->TexUnit0.x = swv->texcoord[0][0]; - pV->TexUnit0.y = swv->texcoord[0][1]; - pV->TexUnit1.x = swv->texcoord[1][0]; - pV->TexUnit1.y = swv->texcoord[1][1]; - pV->FrontDiffuse = GLD_COLOUR; - pV->FrontSpecular = GLD_SPECULAR; - pV++; - - // 6th vert - swv = &ss->verts[v0]; - pV->Position.x = swv->win[0]; - pV->Position.y = GLD_FLIP_Y(swv->win[1]); - pV->Position.z = swv->win[2] * ooDepthMax; - pV->Position.w = swv->win[3]; - pV->TexUnit0.x = swv->texcoord[0][0]; - pV->TexUnit0.y = swv->texcoord[0][1]; - pV->TexUnit1.x = swv->texcoord[1][0]; - pV->TexUnit1.y = swv->texcoord[1][1]; - pV->FrontDiffuse = GLD_COLOUR; - pV->FrontSpecular = GLD_SPECULAR; - pV++; - - gld->PBtwosidelight.pTriangles = (BYTE*)pV; - gld->PBtwosidelight.nTriangles += 2; -} - -//--------------------------------------------------------------------------- - -*/ diff --git a/src/mesa/drivers/windows/gldirect/dx8/gld_texture_dx8.c b/src/mesa/drivers/windows/gldirect/dx8/gld_texture_dx8.c deleted file mode 100644 index f24b3cfb74..0000000000 --- a/src/mesa/drivers/windows/gldirect/dx8/gld_texture_dx8.c +++ /dev/null @@ -1,2046 +0,0 @@ -/**************************************************************************** -* -* Mesa 3-D graphics library -* Direct3D Driver Interface -* -* ======================================================================== -* -* Copyright (C) 1991-2004 SciTech Software, Inc. All rights reserved. -* -* Permission is hereby granted, free of charge, to any person obtaining a -* copy of this software and associated documentation files (the "Software"), -* to deal in the Software without restriction, including without limitation -* the rights to use, copy, modify, merge, publish, distribute, sublicense, -* and/or sell copies of the Software, and to permit persons to whom the -* Software is furnished to do so, subject to the following conditions: -* -* The above copyright notice and this permission notice shall be included -* in all copies or substantial portions of the Software. -* -* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -* SCITECH SOFTWARE INC BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF -* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -* SOFTWARE. -* -* ====================================================================== -* -* Language: ANSI C -* Environment: Windows 9x/2000/XP/XBox (Win32) -* -* Description: Texture / Bitmap functions -* -****************************************************************************/ - -#include "dglcontext.h" -#include "ddlog.h" -#include "gld_dx8.h" - -#include - -#include "texformat.h" -#include "colormac.h" -#include "texstore.h" -#include "image.h" -// #include "mem.h" - -//--------------------------------------------------------------------------- - -#define GLD_FLIP_HEIGHT(y,h) (gldCtx->dwHeight - (y) - (h)) - -//--------------------------------------------------------------------------- -// 1D texture fetch -//--------------------------------------------------------------------------- - -#define CHAN_SRC( t, i, j, k, sz ) \ - ((GLchan *)(t)->Data + (i) * (sz)) -#define UBYTE_SRC( t, i, j, k, sz ) \ - ((GLubyte *)(t)->Data + (i) * (sz)) -#define USHORT_SRC( t, i, j, k ) \ - ((GLushort *)(t)->Data + (i)) -#define FLOAT_SRC( t, i, j, k ) \ - ((GLfloat *)(t)->Data + (i)) - -//--------------------------------------------------------------------------- - -static void gld_fetch_1d_texel_X8R8G8B8( - const struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, GLchan *texel ) -{ - const GLchan *src = CHAN_SRC( texImage, i, j, k, 4 ); - GLchan *rgba = (GLchan *)texel; - rgba[RCOMP] = src[2]; - rgba[GCOMP] = src[1]; - rgba[BCOMP] = src[0]; - rgba[ACOMP] = CHAN_MAX; -} - -//--------------------------------------------------------------------------- - -static void gld_fetch_1d_texel_f_X8R8G8B8( - const struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel ) -{ - const GLchan *src = CHAN_SRC( texImage, i, j, k, 4 ); - texel[RCOMP] = CHAN_TO_FLOAT(src[0]); - texel[GCOMP] = CHAN_TO_FLOAT(src[1]); - texel[BCOMP] = CHAN_TO_FLOAT(src[2]); - texel[ACOMP] = 1.f; -} - -//--------------------------------------------------------------------------- - -static void gld_fetch_1d_texel_X1R5G5B5( - const struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, GLchan *texel ) -{ - const GLushort *src = USHORT_SRC( texImage, i, j, k ); - GLchan *rgba = (GLchan *) texel; GLushort s = *src; - rgba[RCOMP] = UBYTE_TO_CHAN( ((s >> 10) & 0xf8) * 255 / 0xf8 ); - rgba[GCOMP] = UBYTE_TO_CHAN( ((s >> 5) & 0xf8) * 255 / 0xf8 ); - rgba[BCOMP] = UBYTE_TO_CHAN( ((s ) & 0xf8) * 255 / 0xf8 ); - rgba[ACOMP] = CHAN_MAX; -} - -//--------------------------------------------------------------------------- - -static void gld_fetch_1d_texel_f_X1R5G5B5( - const struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel ) -{ - const GLushort *src = USHORT_SRC( texImage, i, j, k ); - GLushort s = *src; - texel[RCOMP] = UBYTE_TO_FLOAT( ((s >> 10) & 0xf8) * 255 / 0xf8 ); - texel[GCOMP] = UBYTE_TO_FLOAT( ((s >> 5) & 0xf8) * 255 / 0xf8 ); - texel[BCOMP] = UBYTE_TO_FLOAT( ((s ) & 0xf8) * 255 / 0xf8 ); - texel[ACOMP] = 1.f; -} - -//--------------------------------------------------------------------------- - -static void gld_fetch_1d_texel_X4R4G4B4( - const struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, GLchan *texel ) -{ - const GLushort *src = USHORT_SRC( texImage, i, j, k ); - GLchan *rgba = (GLchan *) texel; GLushort s = *src; - rgba[RCOMP] = UBYTE_TO_CHAN( ((s >> 8) & 0xf) * 255 / 0xf ); - rgba[GCOMP] = UBYTE_TO_CHAN( ((s >> 4) & 0xf) * 255 / 0xf ); - rgba[BCOMP] = UBYTE_TO_CHAN( ((s ) & 0xf) * 255 / 0xf ); - rgba[ACOMP] = CHAN_MAX; -} - -//--------------------------------------------------------------------------- - -static void gld_fetch_1d_texel_f_X4R4G4B4( - const struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel ) -{ - const GLushort *src = USHORT_SRC( texImage, i, j, k ); - GLushort s = *src; - texel[RCOMP] = UBYTE_TO_FLOAT( ((s >> 8) & 0xf) * 255 / 0xf ); - texel[GCOMP] = UBYTE_TO_FLOAT( ((s >> 4) & 0xf) * 255 / 0xf ); - texel[BCOMP] = UBYTE_TO_FLOAT( ((s ) & 0xf) * 255 / 0xf ); - texel[ACOMP] = 1.f; -} - -//--------------------------------------------------------------------------- - -#undef CHAN_SRC -#undef UBYTE_SRC -#undef USHORT_SRC -#undef FLOAT_SRC - -//--------------------------------------------------------------------------- -// 2D texture fetch -//--------------------------------------------------------------------------- - -#define CHAN_SRC( t, i, j, k, sz ) \ - ((GLchan *)(t)->Data + ((t)->Width * (j) + (i)) * (sz)) -#define UBYTE_SRC( t, i, j, k, sz ) \ - ((GLubyte *)(t)->Data + ((t)->Width * (j) + (i)) * (sz)) -#define USHORT_SRC( t, i, j, k ) \ - ((GLushort *)(t)->Data + ((t)->Width * (j) + (i))) -#define FLOAT_SRC( t, i, j, k ) \ - ((GLfloat *)(t)->Data + ((t)->Width * (j) + (i))) - -//--------------------------------------------------------------------------- - -static void gld_fetch_2d_texel_X8R8G8B8( - const struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, GLchan *texel ) -{ - const GLchan *src = CHAN_SRC( texImage, i, j, k, 4 ); - GLchan *rgba = (GLchan *)texel; - rgba[RCOMP] = src[2]; - rgba[GCOMP] = src[1]; - rgba[BCOMP] = src[0]; - rgba[ACOMP] = CHAN_MAX; -} - -//--------------------------------------------------------------------------- - -static void gld_fetch_2d_texel_f_X8R8G8B8( - const struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel ) -{ - const GLchan *src = CHAN_SRC( texImage, i, j, k, 4 ); - texel[RCOMP] = CHAN_TO_FLOAT(src[0]); - texel[GCOMP] = CHAN_TO_FLOAT(src[1]); - texel[BCOMP] = CHAN_TO_FLOAT(src[2]); - texel[ACOMP] = 1.f; -} - -//--------------------------------------------------------------------------- - -static void gld_fetch_2d_texel_X1R5G5B5( - const struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, GLchan *texel ) -{ - const GLushort *src = USHORT_SRC( texImage, i, j, k ); - GLchan *rgba = (GLchan *) texel; GLushort s = *src; - rgba[RCOMP] = UBYTE_TO_CHAN( ((s >> 10) & 0xf8) * 255 / 0xf8 ); - rgba[GCOMP] = UBYTE_TO_CHAN( ((s >> 5) & 0xf8) * 255 / 0xf8 ); - rgba[BCOMP] = UBYTE_TO_CHAN( ((s ) & 0xf8) * 255 / 0xf8 ); - rgba[ACOMP] = CHAN_MAX; -} - -//--------------------------------------------------------------------------- - -static void gld_fetch_2d_texel_f_X1R5G5B5( - const struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel ) -{ - const GLushort *src = USHORT_SRC( texImage, i, j, k ); - GLushort s = *src; - texel[RCOMP] = UBYTE_TO_FLOAT( ((s >> 10) & 0xf8) * 255 / 0xf8 ); - texel[GCOMP] = UBYTE_TO_FLOAT( ((s >> 5) & 0xf8) * 255 / 0xf8 ); - texel[BCOMP] = UBYTE_TO_FLOAT( ((s ) & 0xf8) * 255 / 0xf8 ); - texel[ACOMP] = 1.f; -} - -//--------------------------------------------------------------------------- - -static void gld_fetch_2d_texel_X4R4G4B4( - const struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, GLchan *texel ) -{ - const GLushort *src = USHORT_SRC( texImage, i, j, k ); - GLchan *rgba = (GLchan *) texel; GLushort s = *src; - rgba[RCOMP] = UBYTE_TO_CHAN( ((s >> 8) & 0xf) * 255 / 0xf ); - rgba[GCOMP] = UBYTE_TO_CHAN( ((s >> 4) & 0xf) * 255 / 0xf ); - rgba[BCOMP] = UBYTE_TO_CHAN( ((s ) & 0xf) * 255 / 0xf ); - rgba[ACOMP] = CHAN_MAX; -} - -//--------------------------------------------------------------------------- - -static void gld_fetch_2d_texel_f_X4R4G4B4( - const struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel ) -{ - const GLushort *src = USHORT_SRC( texImage, i, j, k ); - GLushort s = *src; - texel[RCOMP] = UBYTE_TO_FLOAT( ((s >> 8) & 0xf) * 255 / 0xf ); - texel[GCOMP] = UBYTE_TO_FLOAT( ((s >> 4) & 0xf) * 255 / 0xf ); - texel[BCOMP] = UBYTE_TO_FLOAT( ((s ) & 0xf) * 255 / 0xf ); - texel[ACOMP] = 1.f; -} - -//--------------------------------------------------------------------------- - -#undef CHAN_SRC -#undef UBYTE_SRC -#undef USHORT_SRC -#undef FLOAT_SRC - -//--------------------------------------------------------------------------- -// 3D texture fetch -//--------------------------------------------------------------------------- - -#define CHAN_SRC( t, i, j, k, sz ) \ - (GLchan *)(t)->Data + (((t)->Height * (k) + (j)) * \ - (t)->Width + (i)) * (sz) -#define UBYTE_SRC( t, i, j, k, sz ) \ - ((GLubyte *)(t)->Data + (((t)->Height * (k) + (j)) * \ - (t)->Width + (i)) * (sz)) -#define USHORT_SRC( t, i, j, k ) \ - ((GLushort *)(t)->Data + (((t)->Height * (k) + (j)) * \ - (t)->Width + (i))) -#define FLOAT_SRC( t, i, j, k ) \ - ((GLfloat *)(t)->Data + (((t)->Height * (k) + (j)) * \ - (t)->Width + (i))) - -//--------------------------------------------------------------------------- - -static void gld_fetch_3d_texel_X8R8G8B8( - const struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, GLchan *texel ) -{ - const GLchan *src = CHAN_SRC( texImage, i, j, k, 4 ); - GLchan *rgba = (GLchan *)texel; - rgba[RCOMP] = src[2]; - rgba[GCOMP] = src[1]; - rgba[BCOMP] = src[0]; - rgba[ACOMP] = CHAN_MAX; -} - -//--------------------------------------------------------------------------- - -static void gld_fetch_3d_texel_f_X8R8G8B8( - const struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel ) -{ - const GLchan *src = CHAN_SRC( texImage, i, j, k, 4 ); - texel[RCOMP] = CHAN_TO_FLOAT(src[0]); - texel[GCOMP] = CHAN_TO_FLOAT(src[1]); - texel[BCOMP] = CHAN_TO_FLOAT(src[2]); - texel[ACOMP] = 1.f; -} - -//--------------------------------------------------------------------------- - -static void gld_fetch_3d_texel_X1R5G5B5( - const struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, GLchan *texel ) -{ - const GLushort *src = USHORT_SRC( texImage, i, j, k ); - GLchan *rgba = (GLchan *) texel; GLushort s = *src; - rgba[RCOMP] = UBYTE_TO_CHAN( ((s >> 10) & 0xf8) * 255 / 0xf8 ); - rgba[GCOMP] = UBYTE_TO_CHAN( ((s >> 5) & 0xf8) * 255 / 0xf8 ); - rgba[BCOMP] = UBYTE_TO_CHAN( ((s ) & 0xf8) * 255 / 0xf8 ); - rgba[ACOMP] = CHAN_MAX; -} - -//--------------------------------------------------------------------------- - -static void gld_fetch_3d_texel_f_X1R5G5B5( - const struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel ) -{ - const GLushort *src = USHORT_SRC( texImage, i, j, k ); - GLushort s = *src; - texel[RCOMP] = UBYTE_TO_FLOAT( ((s >> 10) & 0xf8) * 255 / 0xf8 ); - texel[GCOMP] = UBYTE_TO_FLOAT( ((s >> 5) & 0xf8) * 255 / 0xf8 ); - texel[BCOMP] = UBYTE_TO_FLOAT( ((s ) & 0xf8) * 255 / 0xf8 ); - texel[ACOMP] = 1.f; -} - -//--------------------------------------------------------------------------- - -static void gld_fetch_3d_texel_X4R4G4B4( - const struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, GLchan *texel ) -{ - const GLushort *src = USHORT_SRC( texImage, i, j, k ); - GLchan *rgba = (GLchan *) texel; GLushort s = *src; - rgba[RCOMP] = UBYTE_TO_CHAN( ((s >> 8) & 0xf) * 255 / 0xf ); - rgba[GCOMP] = UBYTE_TO_CHAN( ((s >> 4) & 0xf) * 255 / 0xf ); - rgba[BCOMP] = UBYTE_TO_CHAN( ((s ) & 0xf) * 255 / 0xf ); - rgba[ACOMP] = CHAN_MAX; -} - -//--------------------------------------------------------------------------- - -static void gld_fetch_3d_texel_f_X4R4G4B4( - const struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel ) -{ - const GLushort *src = USHORT_SRC( texImage, i, j, k ); - GLushort s = *src; - texel[RCOMP] = UBYTE_TO_FLOAT( ((s >> 8) & 0xf) * 255 / 0xf ); - texel[GCOMP] = UBYTE_TO_FLOAT( ((s >> 4) & 0xf) * 255 / 0xf ); - texel[BCOMP] = UBYTE_TO_FLOAT( ((s ) & 0xf) * 255 / 0xf ); - texel[ACOMP] = 1.f; -} - -//--------------------------------------------------------------------------- - -#undef CHAN_SRC -#undef UBYTE_SRC -#undef USHORT_SRC -#undef FLOAT_SRC - -//--------------------------------------------------------------------------- -// Direct3D texture formats that have no Mesa equivalent -//--------------------------------------------------------------------------- - -const struct gl_texture_format _gld_texformat_X8R8G8B8 = { - MESA_FORMAT_ARGB8888, /* MesaFormat */ - GL_RGBA, /* BaseFormat */ - GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ - 8, /* RedBits */ - 8, /* GreenBits */ - 8, /* BlueBits */ - 0, /* AlphaBits */ - 0, /* LuminanceBits */ - 0, /* IntensityBits */ - 0, /* IndexBits */ - 0, /* DepthBits */ - 4, /* TexelBytes */ - _mesa_texstore_argb8888, /* StoreTexImageFunc */ - gld_fetch_1d_texel_X8R8G8B8, /* FetchTexel1D */ - gld_fetch_2d_texel_X8R8G8B8, /* FetchTexel2D */ - gld_fetch_3d_texel_X8R8G8B8, /* FetchTexel3D */ - gld_fetch_1d_texel_f_X8R8G8B8, /* FetchTexel1Df */ - gld_fetch_2d_texel_f_X8R8G8B8, /* FetchTexel2Df */ - gld_fetch_3d_texel_f_X8R8G8B8, /* FetchTexel3Df */ -}; - -const struct gl_texture_format _gld_texformat_X1R5G5B5 = { - MESA_FORMAT_ARGB1555, /* MesaFormat */ - GL_RGBA, /* BaseFormat */ - GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ - 5, /* RedBits */ - 5, /* GreenBits */ - 5, /* BlueBits */ - 0, /* AlphaBits */ - 0, /* LuminanceBits */ - 0, /* IntensityBits */ - 0, /* IndexBits */ - 0, /* DepthBits */ - 2, /* TexelBytes */ - _mesa_texstore_argb1555, /* StoreTexImageFunc */ - gld_fetch_1d_texel_X1R5G5B5, /* FetchTexel1D */ - gld_fetch_2d_texel_X1R5G5B5, /* FetchTexel2D */ - gld_fetch_3d_texel_X1R5G5B5, /* FetchTexel3D */ - gld_fetch_1d_texel_f_X1R5G5B5, /* FetchTexel1Df */ - gld_fetch_2d_texel_f_X1R5G5B5, /* FetchTexel2Df */ - gld_fetch_3d_texel_f_X1R5G5B5, /* FetchTexel3Df */ -}; - -const struct gl_texture_format _gld_texformat_X4R4G4B4 = { - MESA_FORMAT_ARGB4444, /* MesaFormat */ - GL_RGBA, /* BaseFormat */ - GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ - 4, /* RedBits */ - 4, /* GreenBits */ - 4, /* BlueBits */ - 0, /* AlphaBits */ - 0, /* LuminanceBits */ - 0, /* IntensityBits */ - 0, /* IndexBits */ - 0, /* DepthBits */ - 2, /* TexelBytes */ - _mesa_texstore_argb4444, /* StoreTexImageFunc */ - gld_fetch_1d_texel_X4R4G4B4, /* FetchTexel1D */ - gld_fetch_2d_texel_X4R4G4B4, /* FetchTexel2D */ - gld_fetch_3d_texel_X4R4G4B4, /* FetchTexel3D */ - gld_fetch_1d_texel_f_X4R4G4B4, /* FetchTexel1Df */ - gld_fetch_2d_texel_f_X4R4G4B4, /* FetchTexel2Df */ - gld_fetch_3d_texel_f_X4R4G4B4, /* FetchTexel3Df */ -}; - -//--------------------------------------------------------------------------- -// Texture unit constants -//--------------------------------------------------------------------------- - -// List of possible combinations of texture environments. -// Example: GLD_TEXENV_MODULATE_RGBA means -// GL_MODULATE, GL_RGBA base internal format. -#define GLD_TEXENV_DECAL_RGB 0 -#define GLD_TEXENV_DECAL_RGBA 1 -#define GLD_TEXENV_DECAL_ALPHA 2 -#define GLD_TEXENV_REPLACE_RGB 3 -#define GLD_TEXENV_REPLACE_RGBA 4 -#define GLD_TEXENV_REPLACE_ALPHA 5 -#define GLD_TEXENV_MODULATE_RGB 6 -#define GLD_TEXENV_MODULATE_RGBA 7 -#define GLD_TEXENV_MODULATE_ALPHA 8 -#define GLD_TEXENV_BLEND_RGB 9 -#define GLD_TEXENV_BLEND_RGBA 10 -#define GLD_TEXENV_BLEND_ALPHA 11 -#define GLD_TEXENV_ADD_RGB 12 -#define GLD_TEXENV_ADD_RGBA 13 -#define GLD_TEXENV_ADD_ALPHA 14 - -// Per-stage (i.e. per-unit) texture environment -typedef struct { - DWORD ColorArg1; // Colour argument 1 - D3DTEXTUREOP ColorOp; // Colour operation - DWORD ColorArg2; // Colour argument 2 - DWORD AlphaArg1; // Alpha argument 1 - D3DTEXTUREOP AlphaOp; // Alpha operation - DWORD AlphaArg2; // Alpha argument 2 -} GLD_texenv; - -// TODO: Do we really need to set ARG1 and ARG2 every time? -// They seem to always be TEXTURE and CURRENT respectively. - -// C = Colour out -// A = Alpha out -// Ct = Colour from Texture -// Cf = Colour from fragment (diffuse) -// At = Alpha from Texture -// Af = Alpha from fragment (diffuse) -// Cc = GL_TEXTURE_ENV_COLOUR (GL_BLEND) -const GLD_texenv gldTexEnv[] = { - // DECAL_RGB: C=Ct, A=Af - {D3DTA_TEXTURE, D3DTOP_SELECTARG1, D3DTA_CURRENT, - D3DTA_TEXTURE, D3DTOP_SELECTARG2, D3DTA_CURRENT}, - // DECAL_RGBA: C=Cf(1-At)+CtAt, A=Af - {D3DTA_TEXTURE, D3DTOP_BLENDTEXTUREALPHA, D3DTA_CURRENT, - D3DTA_TEXTURE, D3DTOP_SELECTARG2, D3DTA_CURRENT}, - // DECAL_ALPHA: use DECAL_RGB - {D3DTA_TEXTURE, D3DTOP_SELECTARG1, D3DTA_CURRENT, - D3DTA_TEXTURE, D3DTOP_SELECTARG2, D3DTA_CURRENT}, - - // REPLACE_RGB: C=Ct, A=Af - {D3DTA_TEXTURE, D3DTOP_SELECTARG1, D3DTA_CURRENT, - D3DTA_TEXTURE, D3DTOP_SELECTARG2, D3DTA_CURRENT}, - // REPLACE_RGBA: C=Ct, A=At - {D3DTA_TEXTURE, D3DTOP_SELECTARG1, D3DTA_CURRENT, - D3DTA_TEXTURE, D3DTOP_SELECTARG1, D3DTA_CURRENT}, - // REPLACE_ALPHA: C=Cf, A=At - {D3DTA_TEXTURE, D3DTOP_SELECTARG2, D3DTA_CURRENT, - D3DTA_TEXTURE, D3DTOP_SELECTARG1, D3DTA_CURRENT}, - - // MODULATE_RGB: C=CfCt, A=Af - {D3DTA_TEXTURE, D3DTOP_MODULATE, D3DTA_CURRENT, - D3DTA_TEXTURE, D3DTOP_SELECTARG2, D3DTA_CURRENT}, - // MODULATE_RGBA: C=CfCt, A=AfAt - {D3DTA_TEXTURE, D3DTOP_MODULATE, D3DTA_CURRENT, - D3DTA_TEXTURE, D3DTOP_MODULATE, D3DTA_CURRENT}, - // MODULATE_ALPHA: C=Cf, A=AfAt - {D3DTA_TEXTURE, D3DTOP_SELECTARG2, D3DTA_CURRENT, - D3DTA_TEXTURE, D3DTOP_MODULATE, D3DTA_CURRENT}, - - // BLEND_RGB: C=Cf(1-Ct)+CcCt, A=Af - {D3DTA_TEXTURE, D3DTOP_LERP, D3DTA_CURRENT, - D3DTA_TEXTURE, D3DTOP_SELECTARG2, D3DTA_CURRENT}, - // BLEND_RGBA: C=Cf(1-Ct)+CcCt, A=AfAt - {D3DTA_TEXTURE, D3DTOP_LERP, D3DTA_CURRENT, - D3DTA_TEXTURE, D3DTOP_MODULATE, D3DTA_CURRENT}, - // BLEND_ALPHA: C=Cf, A=AfAt - {D3DTA_TEXTURE, D3DTOP_SELECTARG2, D3DTA_CURRENT, - D3DTA_TEXTURE, D3DTOP_MODULATE, D3DTA_CURRENT}, - - // ADD_RGB: C=Cf+Ct, A=Af - {D3DTA_TEXTURE, D3DTOP_ADD, D3DTA_CURRENT, - D3DTA_TEXTURE, D3DTOP_SELECTARG2, D3DTA_CURRENT}, - // ADD_RGBA: C=Cf+Ct, A=AfAt - {D3DTA_TEXTURE, D3DTOP_ADD, D3DTA_CURRENT, - D3DTA_TEXTURE, D3DTOP_MODULATE, D3DTA_CURRENT}, - // ADD_ALPHA: C=Cf, A=AfAt - {D3DTA_TEXTURE, D3DTOP_SELECTARG2, D3DTA_CURRENT, - D3DTA_TEXTURE, D3DTOP_MODULATE, D3DTA_CURRENT}, -}; - -//--------------------------------------------------------------------------- - -D3DTEXTUREADDRESS _gldConvertWrap( - GLenum wrap) -{ - return (wrap == GL_CLAMP) ? D3DTADDRESS_CLAMP : D3DTADDRESS_WRAP; -} - -//--------------------------------------------------------------------------- - -D3DTEXTUREFILTERTYPE _gldConvertMagFilter( - GLenum magfilter) -{ - return (magfilter == GL_LINEAR) ? D3DTEXF_LINEAR : D3DTEXF_POINT; -} - -//--------------------------------------------------------------------------- - -void _gldConvertMinFilter( - GLenum minfilter, - D3DTEXTUREFILTERTYPE *min_filter, - D3DTEXTUREFILTERTYPE *mip_filter) -{ - switch (minfilter) { - case GL_NEAREST: - *min_filter = D3DTEXF_POINT; - *mip_filter = D3DTEXF_NONE; - break; - case GL_LINEAR: - *min_filter = D3DTEXF_LINEAR; - *mip_filter = D3DTEXF_NONE; - break; - case GL_NEAREST_MIPMAP_NEAREST: - *min_filter = D3DTEXF_POINT; - *mip_filter = D3DTEXF_POINT; - break; - case GL_LINEAR_MIPMAP_NEAREST: - *min_filter = D3DTEXF_LINEAR; - *mip_filter = D3DTEXF_POINT; - break; - case GL_NEAREST_MIPMAP_LINEAR: - *min_filter = D3DTEXF_POINT; - *mip_filter = D3DTEXF_LINEAR; - break; - case GL_LINEAR_MIPMAP_LINEAR: - *min_filter = D3DTEXF_LINEAR; - *mip_filter = D3DTEXF_LINEAR; - break; - } -} - -//--------------------------------------------------------------------------- - -D3DFORMAT _gldGLFormatToD3DFormat( - GLenum internalFormat) -{ - switch (internalFormat) { - case GL_INTENSITY: - case GL_INTENSITY4: - case GL_INTENSITY8: - case GL_INTENSITY12: - case GL_INTENSITY16: - // LUNIMANCE != INTENSITY, but D3D doesn't have I8 textures - return D3DFMT_L8; - case 1: - case GL_LUMINANCE: - case GL_LUMINANCE4: - case GL_LUMINANCE8: - case GL_LUMINANCE12: - case GL_LUMINANCE16: - return D3DFMT_L8; - case GL_ALPHA: - case GL_ALPHA4: - case GL_ALPHA8: - case GL_ALPHA12: - case GL_ALPHA16: - return D3DFMT_A8; - case GL_COLOR_INDEX: - case GL_COLOR_INDEX1_EXT: - case GL_COLOR_INDEX2_EXT: - case GL_COLOR_INDEX4_EXT: - case GL_COLOR_INDEX8_EXT: - case GL_COLOR_INDEX12_EXT: - case GL_COLOR_INDEX16_EXT: - return D3DFMT_X8R8G8B8; - case 2: - case GL_LUMINANCE_ALPHA: - case GL_LUMINANCE4_ALPHA4: - case GL_LUMINANCE6_ALPHA2: - case GL_LUMINANCE8_ALPHA8: - case GL_LUMINANCE12_ALPHA4: - case GL_LUMINANCE12_ALPHA12: - case GL_LUMINANCE16_ALPHA16: - return D3DFMT_A8L8; - case GL_R3_G3_B2: - // TODO: Mesa does not support RGB332 internally - return D3DFMT_X4R4G4B4; //D3DFMT_R3G3B2; - case GL_RGB4: - return D3DFMT_X4R4G4B4; - case GL_RGB5: - return D3DFMT_X1R5G5B5; - case 3: - case GL_RGB: - case GL_RGB8: - case GL_RGB10: - case GL_RGB12: - case GL_RGB16: - return D3DFMT_R8G8B8; - case GL_RGBA4: - return D3DFMT_A4R4G4B4; - case 4: - case GL_RGBA: - case GL_RGBA2: - case GL_RGBA8: - case GL_RGB10_A2: - case GL_RGBA12: - case GL_RGBA16: - return D3DFMT_A8R8G8B8; - case GL_RGB5_A1: - return D3DFMT_A1R5G5B5; - } - - // Return an acceptable default - return D3DFMT_A8R8G8B8; -} - -//--------------------------------------------------------------------------- - -GLenum _gldDecodeBaseFormat( - IDirect3DTexture8 *pTex) -{ - // Examine Direct3D texture and return base OpenGL internal texture format - // NOTE: We can't use any base format info from Mesa because D3D might have - // used a different texture format when we used D3DXCreateTexture(). - - // Base internal format is one of (Red Book p355): - // GL_ALPHA, - // GL_LUMINANCE, - // GL_LUMINANCE_ALPHA, - // GL_INTENSITY, - // GL_RGB, - // GL_RGBA - - // NOTE: INTENSITY not used (not supported by Direct3D) - // LUMINANCE has same texture functions as RGB - // LUMINANCE_ALPHA has same texture functions as RGBA - - // TODO: cache format instead of using GetLevelDesc() - D3DSURFACE_DESC desc; - _GLD_DX8_TEX(GetLevelDesc(pTex, 0, &desc)); - - switch (desc.Format) { - case D3DFMT_R8G8B8: - case D3DFMT_X8R8G8B8: - case D3DFMT_R5G6B5: - case D3DFMT_X1R5G5B5: - case D3DFMT_R3G3B2: - case D3DFMT_X4R4G4B4: - case D3DFMT_P8: - case D3DFMT_L8: - return GL_RGB; - case D3DFMT_A8R8G8B8: - case D3DFMT_A1R5G5B5: - case D3DFMT_A4R4G4B4: - case D3DFMT_A8R3G3B2: - case D3DFMT_A8P8: - case D3DFMT_A8L8: - case D3DFMT_A4L4: - return GL_RGBA; - case D3DFMT_A8: - return GL_ALPHA; - // Compressed texture formats. Need to check these... - case D3DFMT_DXT1: - return GL_RGBA; - case D3DFMT_DXT2: - return GL_RGB; - case D3DFMT_DXT3: - return GL_RGBA; - case D3DFMT_DXT4: - return GL_RGB; - case D3DFMT_DXT5: - return GL_RGBA; - } - - // Fell through. Return arbitary default. - return GL_RGBA; -} - -//--------------------------------------------------------------------------- - -const struct gl_texture_format* _gldMesaFormatForD3DFormat( - D3DFORMAT d3dfmt) -{ - switch (d3dfmt) { - case D3DFMT_A8R8G8B8: - return &_mesa_texformat_argb8888; - case D3DFMT_R8G8B8: - return &_mesa_texformat_rgb888; - case D3DFMT_R5G6B5: - return &_mesa_texformat_rgb565; - case D3DFMT_A4R4G4B4: - return &_mesa_texformat_argb4444; - case D3DFMT_A1R5G5B5: - return &_mesa_texformat_argb1555; - case D3DFMT_A8L8: - return &_mesa_texformat_al88; - case D3DFMT_R3G3B2: - return &_mesa_texformat_rgb332; - case D3DFMT_A8: - return &_mesa_texformat_a8; - case D3DFMT_L8: - return &_mesa_texformat_l8; - case D3DFMT_X8R8G8B8: - return &_gld_texformat_X8R8G8B8; - case D3DFMT_X1R5G5B5: - return &_gld_texformat_X1R5G5B5; - case D3DFMT_X4R4G4B4: - return &_gld_texformat_X4R4G4B4; - } - - // If we reach here then we've made an error somewhere else - // by allowing a format that is not supported. - assert(0); - - return NULL; // Shut up compiler warning -} - -//--------------------------------------------------------------------------- -// Copy* functions -//--------------------------------------------------------------------------- - -void gldCopyTexImage1D_DX8( - GLcontext *ctx, - GLenum target, GLint level, - GLenum internalFormat, - GLint x, GLint y, - GLsizei width, GLint border ) -{ - // TODO -} - -//--------------------------------------------------------------------------- - -void gldCopyTexImage2D_DX8( - GLcontext *ctx, - GLenum target, - GLint level, - GLenum internalFormat, - GLint x, - GLint y, - GLsizei width, - GLsizei height, - GLint border) -{ - // TODO -} - -//--------------------------------------------------------------------------- - -void gldCopyTexSubImage1D_DX8( - GLcontext *ctx, - GLenum target, GLint level, - GLint xoffset, GLint x, GLint y, GLsizei width ) -{ - // TODO -} - -//--------------------------------------------------------------------------- - -void gldCopyTexSubImage2D_DX8( - GLcontext *ctx, - GLenum target, - GLint level, - GLint xoffset, - GLint yoffset, - GLint x, - GLint y, - GLsizei width, - GLsizei height) -{ - // TODO -} - -//--------------------------------------------------------------------------- - -void gldCopyTexSubImage3D_DX8( - GLcontext *ctx, - GLenum target, - GLint level, - GLint xoffset, - GLint yoffset, - GLint zoffset, - GLint x, - GLint y, - GLsizei width, - GLsizei height ) -{ - // TODO ? -} - -//--------------------------------------------------------------------------- -// Bitmap/Pixel functions -//--------------------------------------------------------------------------- - -#define GLD_FLIP_Y(y) (gldCtx->dwHeight - (y)) - -#define _GLD_FVF_IMAGE (D3DFVF_XYZRHW | D3DFVF_TEX1) - -typedef struct { - FLOAT x, y; // 2D raster coords - FLOAT z; // depth value - FLOAT rhw; // reciprocal homogenous W (always 1.0f) - FLOAT tu, tv; // texture coords -} _GLD_IMAGE_VERTEX; - -//--------------------------------------------------------------------------- - -HRESULT _gldDrawPixels( - GLcontext *ctx, - BOOL bChromakey, // Alpha test for glBitmap() images - GLint x, // GL x position - GLint y, // GL y position (needs flipping) - GLsizei width, // Width of input image - GLsizei height, // Height of input image - IDirect3DSurface8 *pImage) -{ - // - // Draw input image as texture implementing PixelZoom and clipping. - // Any fragment operations currently enabled will be used. - // - - GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); - GLD_driver_dx8 *gld = GLD_GET_DX8_DRIVER(gldCtx); - - IDirect3DTexture8 *pTexture; - D3DSURFACE_DESC d3dsd; - IDirect3DSurface8 *pSurface; - _GLD_IMAGE_VERTEX v[4]; - HRESULT hr; - - float ZoomWidth, ZoomHeight; - float ScaleWidth, ScaleHeight; - - // Create a texture to hold image - hr = D3DXCreateTexture( - gld->pDev, - width, height, - 1, // miplevels - 0, // usage - D3DFMT_A8R8G8B8, // format - D3DPOOL_MANAGED, // pool - &pTexture); - if (FAILED(hr)) - return hr; - - hr = IDirect3DTexture8_GetSurfaceLevel(pTexture, 0, &pSurface); - if (FAILED(hr)) { - IDirect3DTexture8_Release(pTexture); - return hr; - } - - // Copy image into texture - hr = D3DXLoadSurfaceFromSurface( - pSurface, NULL, NULL, // Dest surface - pImage, NULL, NULL, // Src surface - D3DX_FILTER_NONE, - 0); - IDirect3DSurface8_Release(pSurface); - if (FAILED(hr)) { - IDirect3DTexture8_Release(pTexture); - return hr; - } - - // - // Set up the quad like this (ascii-art ahead!) - // - // 3--2 - // | | - // 0--1 - // - // - - // Set depth - v[0].z = v[1].z = v[2].z = v[3].z = ctx->Current.RasterPos[2]; - // Set Reciprocal Homogenous W - v[0].rhw = v[1].rhw = v[2].rhw = v[3].rhw = 1.0f; - - // Set texcoords - // Examine texture size - if different to input width and height - // then we'll need to munge the texcoords to fit. - IDirect3DTexture8_GetLevelDesc(pTexture, 0, &d3dsd); - ScaleWidth = (float)width / (float)d3dsd.Width; - ScaleHeight = (float)height / (float)d3dsd.Height; - v[0].tu = 0.0f; v[0].tv = 0.0f; - v[1].tu = ScaleWidth; v[1].tv = 0.0f; - v[2].tu = ScaleWidth; v[2].tv = ScaleHeight; - v[3].tu = 0.0f; v[3].tv = ScaleHeight; - - // Set raster positions - ZoomWidth = (float)width * ctx->Pixel.ZoomX; - ZoomHeight = (float)height * ctx->Pixel.ZoomY; - - v[0].x = x; v[0].y = GLD_FLIP_Y(y); - v[1].x = x+ZoomWidth; v[1].y = GLD_FLIP_Y(y); - v[2].x = x+ZoomWidth; v[2].y = GLD_FLIP_Y(y+ZoomHeight); - v[3].x = x; v[3].y = GLD_FLIP_Y(y+ZoomHeight); - - // Draw image with full HW acceleration - // NOTE: Be nice to use a State Block for all this state... - IDirect3DDevice8_SetTexture(gld->pDev, 0, pTexture); - IDirect3DDevice8_SetRenderState(gld->pDev, D3DRS_CULLMODE, D3DCULL_NONE); - IDirect3DDevice8_SetRenderState(gld->pDev, D3DRS_CLIPPING, TRUE); - IDirect3DDevice8_SetTextureStageState(gld->pDev, 0, D3DTSS_MINFILTER, D3DTEXF_POINT); - IDirect3DDevice8_SetTextureStageState(gld->pDev, 0, D3DTSS_MIPFILTER, D3DTEXF_POINT); - IDirect3DDevice8_SetTextureStageState(gld->pDev, 0, D3DTSS_MAGFILTER, D3DTEXF_POINT); - IDirect3DDevice8_SetTextureStageState(gld->pDev, 0, D3DTSS_ADDRESSU, D3DTADDRESS_CLAMP); - IDirect3DDevice8_SetTextureStageState(gld->pDev, 0, D3DTSS_ADDRESSV, D3DTADDRESS_CLAMP); - IDirect3DDevice8_SetTextureStageState(gld->pDev, 0, D3DTSS_COLOROP, D3DTOP_SELECTARG1); - IDirect3DDevice8_SetTextureStageState(gld->pDev, 0, D3DTSS_ALPHAOP, D3DTOP_SELECTARG1); - IDirect3DDevice8_SetTextureStageState(gld->pDev, 0, D3DTSS_COLORARG1, D3DTA_TEXTURE); - IDirect3DDevice8_SetTextureStageState(gld->pDev, 0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE); - IDirect3DDevice8_SetTextureStageState(gld->pDev, 1, D3DTSS_COLOROP, D3DTOP_DISABLE); - IDirect3DDevice8_SetTextureStageState(gld->pDev, 1, D3DTSS_ALPHAOP, D3DTOP_DISABLE); - IDirect3DDevice8_SetVertexShader(gld->pDev, _GLD_FVF_IMAGE); - - // - // Emulate Chromakey with an Alpha Test. - // [Alpha Test is more widely supported anyway] - // - if (bChromakey) { - // Switch on alpha testing - IDirect3DDevice8_SetRenderState(gld->pDev, D3DRS_ALPHATESTENABLE, TRUE); - // Fragment passes is alpha is greater than reference value - IDirect3DDevice8_SetRenderState(gld->pDev, D3DRS_ALPHAFUNC, D3DCMP_GREATER); - // Set alpha reference value between Bitmap alpha values of - // zero (transparent) and one (opaque). - IDirect3DDevice8_SetRenderState(gld->pDev, D3DRS_ALPHAREF, 0x7f); - } - - IDirect3DDevice8_DrawPrimitiveUP(gld->pDev, D3DPT_TRIANGLEFAN, 2, &v, sizeof(_GLD_IMAGE_VERTEX)); - - // Release texture - IDirect3DDevice8_SetTexture(gld->pDev, 0, NULL); - IDirect3DTexture8_Release(pTexture); - - // Reset state to before we messed it up - FLUSH_VERTICES(ctx, _NEW_ALL); - - return S_OK; -} - -//--------------------------------------------------------------------------- - -void gld_DrawPixels_DX8( - GLcontext *ctx, - GLint x, GLint y, GLsizei width, GLsizei height, - GLenum format, GLenum type, - const struct gl_pixelstore_attrib *unpack, - const GLvoid *pixels ) -{ - GLD_context *gldCtx; - GLD_driver_dx8 *gld; - - IDirect3DSurface8 *pImage; - HRESULT hr; - D3DLOCKED_RECT d3dLockedRect; - - const struct gl_texture_format *MesaFormat; - - gldCtx = GLD_GET_CONTEXT(ctx); - gld = GLD_GET_DX8_DRIVER(gldCtx); - - hr = IDirect3DDevice8_CreateImageSurface( - gld->pDev, - width, - height, - D3DFMT_A8R8G8B8, - &pImage); - if (FAILED(hr)) { - return; - } - - // - // Use Mesa to fill in image - // - - // Lock all of surface - hr = IDirect3DSurface8_LockRect(pImage, &d3dLockedRect, NULL, 0); - if (FAILED(hr)) { - IDirect3DSurface8_Release(pImage); - return; - } - - MesaFormat = _mesa_choose_tex_format(ctx, format, format, type); - - // unpack image, apply transfer ops and store directly in texture - MesaFormat->StoreImage( - ctx, - 2, - GL_RGBA, - &_mesa_texformat_argb8888, - d3dLockedRect.pBits, - width, height, 1, 0, 0, 0, - d3dLockedRect.Pitch, - 0, /* dstImageStride */ - format, type, pixels, unpack); - - IDirect3DSurface8_UnlockRect(pImage); - - _gldDrawPixels(ctx, FALSE, x, y, width, height, pImage); - - IDirect3DSurface8_Release(pImage); -} - -//--------------------------------------------------------------------------- - -void gld_ReadPixels_DX8( - GLcontext *ctx, - GLint x, GLint y, GLsizei width, GLsizei height, - GLenum format, GLenum type, - const struct gl_pixelstore_attrib *pack, - GLvoid *dest) -{ - - GLD_context *gldCtx; - GLD_driver_dx8 *gld; - - IDirect3DSurface8 *pBackbuffer = NULL; - IDirect3DSurface8 *pNativeImage = NULL; - IDirect3DSurface8 *pCanonicalImage = NULL; - - D3DSURFACE_DESC d3dsd; - RECT rcSrc; // Source rect - POINT ptDst; // Dest point - HRESULT hr; - D3DLOCKED_RECT d3dLockedRect; - struct gl_pixelstore_attrib srcPacking; - int i; - GLint DstRowStride; - const struct gl_texture_format *MesaFormat; - - switch (format) { - case GL_STENCIL_INDEX: - case GL_DEPTH_COMPONENT: - return; - } - - MesaFormat = _mesa_choose_tex_format(ctx, format, format, type); - DstRowStride = _mesa_image_row_stride(pack, width, format, type); - - gldCtx = GLD_GET_CONTEXT(ctx); - gld = GLD_GET_DX8_DRIVER(gldCtx); - - // Get backbuffer - hr = IDirect3DDevice8_GetBackBuffer( - gld->pDev, - 0, // First backbuffer - D3DBACKBUFFER_TYPE_MONO, - &pBackbuffer); - if (FAILED(hr)) - return; - - // Get backbuffer description - hr = IDirect3DSurface8_GetDesc(pBackbuffer, &d3dsd); - if (FAILED(hr)) { - goto gld_ReadPixels_DX8_return; - } - - // Create a surface compatible with backbuffer - hr = IDirect3DDevice8_CreateImageSurface( - gld->pDev, - width, - height, - d3dsd.Format, - &pNativeImage); - if (FAILED(hr)) { - goto gld_ReadPixels_DX8_return; - } - - // Compute source rect and dest point - SetRect(&rcSrc, 0, 0, width, height); - OffsetRect(&rcSrc, x, GLD_FLIP_HEIGHT(y, height)); - ptDst.x = ptDst.y = 0; - - // Get source pixels. - // - // This intermediate surface ensure that we can use CopyRects() - // instead of relying on D3DXLoadSurfaceFromSurface(), which may - // try and lock the backbuffer. This way seems safer. - // - hr = IDirect3DDevice8_CopyRects( - gld->pDev, - pBackbuffer, - &rcSrc, - 1, - pNativeImage, - &ptDst); - if (FAILED(hr)) { - goto gld_ReadPixels_DX8_return; - } - - // Create an RGBA8888 surface - hr = IDirect3DDevice8_CreateImageSurface( - gld->pDev, - width, - height, - D3DFMT_A8R8G8B8, - &pCanonicalImage); - if (FAILED(hr)) { - goto gld_ReadPixels_DX8_return; - } - - // Convert to RGBA8888 - hr = D3DXLoadSurfaceFromSurface( - pCanonicalImage, // Dest surface - NULL, NULL, // Dest palette, RECT - pNativeImage, // Src surface - NULL, NULL, // Src palette, RECT - D3DX_FILTER_NONE, // Filter - 0); // Colourkey - if (FAILED(hr)) { - goto gld_ReadPixels_DX8_return; - } - - srcPacking.Alignment = 1; - srcPacking.ImageHeight = height; - srcPacking.LsbFirst = GL_FALSE; - srcPacking.RowLength = 0; - srcPacking.SkipImages = 0; - srcPacking.SkipPixels = 0; - srcPacking.SkipRows = 0; - srcPacking.SwapBytes = GL_FALSE; - - // Lock all of image - hr = IDirect3DSurface8_LockRect(pCanonicalImage, &d3dLockedRect, NULL, 0); - if (FAILED(hr)) { - goto gld_ReadPixels_DX8_return; - } - - // We need to flip the data. Yuck. - // Perhaps Mesa has a span packer we can use in future... - for (i=0; iStoreImage( - ctx, - 2, - GL_RGBA, // base format - MesaFormat, // dst format - pDestRow, // dest addr - width, 1, 1, 0, 0, 0, // src x,y,z & dst offsets x,y,z - DstRowStride, // dst row stride - 0, // dstImageStride - GL_BGRA, // src format - GL_UNSIGNED_BYTE, // src type - pSrcRow, // src addr - &srcPacking); // packing params of source image - } - - IDirect3DSurface8_UnlockRect(pCanonicalImage); - -gld_ReadPixels_DX8_return: - SAFE_RELEASE_SURFACE8(pCanonicalImage); - SAFE_RELEASE_SURFACE8(pNativeImage); - SAFE_RELEASE_SURFACE8(pBackbuffer); -} - -//--------------------------------------------------------------------------- - -void gld_CopyPixels_DX8( - GLcontext *ctx, - GLint srcx, - GLint srcy, - GLsizei width, - GLsizei height, - GLint dstx, - GLint dsty, - GLenum type) -{ - // - // NOTE: Not allowed to copy vidmem to vidmem! - // Therefore we use an intermediate image surface. - // - - GLD_context *gldCtx; - GLD_driver_dx8 *gld; - - IDirect3DSurface8 *pBackbuffer; - D3DSURFACE_DESC d3dsd; - IDirect3DSurface8 *pImage; - RECT rcSrc; // Source rect - POINT ptDst; // Dest point - HRESULT hr; - - // Only backbuffer - if (type != GL_COLOR) - return; - - gldCtx = GLD_GET_CONTEXT(ctx); - gld = GLD_GET_DX8_DRIVER(gldCtx); - - // Get backbuffer - hr = IDirect3DDevice8_GetBackBuffer( - gld->pDev, - 0, // First backbuffer - D3DBACKBUFFER_TYPE_MONO, - &pBackbuffer); - if (FAILED(hr)) - return; - - // Get backbuffer description - hr = IDirect3DSurface8_GetDesc(pBackbuffer, &d3dsd); - if (FAILED(hr)) { - IDirect3DSurface8_Release(pBackbuffer); - return; - } - - // Create a surface compatible with backbuffer - hr = IDirect3DDevice8_CreateImageSurface( - gld->pDev, - width, - height, - d3dsd.Format, - &pImage); - if (FAILED(hr)) { - IDirect3DSurface8_Release(pBackbuffer); - return; - } - - // Compute source rect and dest point - SetRect(&rcSrc, 0, 0, width, height); - OffsetRect(&rcSrc, srcx, GLD_FLIP_HEIGHT(srcy, height)); - ptDst.x = ptDst.y = 0; - - // Get source pixels - hr = IDirect3DDevice8_CopyRects( - gld->pDev, - pBackbuffer, - &rcSrc, - 1, - pImage, - &ptDst); - IDirect3DSurface8_Release(pBackbuffer); - if (FAILED(hr)) { - IDirect3DSurface8_Release(pImage); - return; - } - - _gldDrawPixels(ctx, FALSE, dstx, dsty, width, height, pImage); - - IDirect3DSurface8_Release(pImage); -} - -//--------------------------------------------------------------------------- - -void gld_Bitmap_DX8( - GLcontext *ctx, - GLint x, - GLint y, - GLsizei width, - GLsizei height, - const struct gl_pixelstore_attrib *unpack, - const GLubyte *bitmap) -{ - GLD_context *gldCtx; - GLD_driver_dx8 *gld; - - IDirect3DSurface8 *pImage; - HRESULT hr; - D3DLOCKED_RECT d3dLockedRect; - BYTE *pTempBitmap; - D3DCOLOR clBitmapOne, clBitmapZero; - D3DCOLOR *pBits; - const GLubyte *src; - int i, j, k; - - gldCtx = GLD_GET_CONTEXT(ctx); - gld = GLD_GET_DX8_DRIVER(gldCtx); - - clBitmapZero = D3DCOLOR_RGBA(0,0,0,0); // NOTE: Alpha is Zero - clBitmapOne = D3DCOLOR_COLORVALUE( - ctx->Current.RasterColor[0], - ctx->Current.RasterColor[1], - ctx->Current.RasterColor[2], - 1.0f); // NOTE: Alpha is One - - hr = IDirect3DDevice8_CreateImageSurface( - gld->pDev, - width, - height, - D3DFMT_A8R8G8B8, - &pImage); - if (FAILED(hr)) { - return; - } - - // Lock all of surface - hr = IDirect3DSurface8_LockRect(pImage, &d3dLockedRect, NULL, 0); - if (FAILED(hr)) { - IDirect3DSurface8_Release(pImage); - return; - } - - pTempBitmap = _mesa_unpack_bitmap(width, height, bitmap, unpack); - if (pTempBitmap == NULL) { - IDirect3DSurface8_Release(pImage); - return; - } - - pBits = (D3DCOLOR*)d3dLockedRect.pBits; - - for (i=0; iDefaultPacking, pTempBitmap, width, height, GL_COLOR_INDEX, GL_BITMAP, - 0, i, 0); - for (j=0; j<(width>>3); j++) { - byte = *src++; - for (k=0; k<8; k++) { - *pBits++ = (byte & 128) ? clBitmapOne : clBitmapZero; - byte <<= 1; - } - } - // Fill remaining bits from bitmap - if (width & 7) { - byte = *src; - for (k=0; k<(width & 7); k++) { - *pBits++ = (byte & 128) ? clBitmapOne : clBitmapZero; - byte <<= 1; - } - } - } - - FREE(pTempBitmap); - -/* - // unpack image, apply transfer ops and store directly in texture - texImage->TexFormat->StoreImage( - ctx, - 2, - GL_BITMAP, - &_mesa_texformat_argb8888, - d3dLockedRect.pBits, - width, height, 1, 0, 0, 0, - d3dLockedRect.Pitch, - 0, // dstImageStride - GL_BITMAP, GL_COLOR_INDEX, bitmap, unpack); -*/ - IDirect3DSurface8_UnlockRect(pImage); - - _gldDrawPixels(ctx, TRUE, x, y, width, height, pImage); - - IDirect3DSurface8_Release(pImage); -} - -//--------------------------------------------------------------------------- -// Texture functions -//--------------------------------------------------------------------------- - -void _gldAllocateTexture( - GLcontext *ctx, - struct gl_texture_object *tObj, - struct gl_texture_image *texImage) -{ - GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); - GLD_driver_dx8 *gld = GLD_GET_DX8_DRIVER(gldCtx); - - IDirect3DTexture8 *pTex; - D3DFORMAT d3dFormat; - - if (!tObj || !texImage) - return; - - pTex = (IDirect3DTexture8*)tObj->DriverData; - if (pTex) { - // Decide whether we can keep existing D3D texture - // by examining top-level surface. - D3DSURFACE_DESC d3dsd; - _GLD_DX8_TEX(GetLevelDesc(pTex, 0, &d3dsd)); - // Release existing texture if not compatible - if ((d3dsd.Width == texImage->Width) || - (d3dsd.Height == texImage->Height)) - { - return; // Keep the existing texture - } - tObj->DriverData = NULL; - _GLD_DX8_TEX(Release(pTex)); - } - - d3dFormat = _gldGLFormatToD3DFormat(texImage->IntFormat); - D3DXCreateTexture( - gld->pDev, - texImage->Width, - texImage->Height, - // TODO: Re-evaluate mipmapping - (glb.bUseMipmaps) ? D3DX_DEFAULT : 1, - 0, // Usage - d3dFormat, - D3DPOOL_MANAGED, - &pTex); - tObj->DriverData = pTex; -} - -//--------------------------------------------------------------------------- - -const struct gl_texture_format* gld_ChooseTextureFormat_DX8( - GLcontext *ctx, - GLint internalFormat, - GLenum srcFormat, - GLenum srcType) -{ - // [Based on mesa_choose_tex_format()] - // - // We will choose only texture formats that are supported - // by Direct3D. If the hardware doesn't support a particular - // texture format, then the D3DX texture calls that we use - // will automatically use a HW supported format. - // - // The most critical aim is to reduce copying; if we can use - // texture-image data directly then it will be a big performance assist. - // - - switch (internalFormat) { - case GL_INTENSITY: - case GL_INTENSITY4: - case GL_INTENSITY8: - case GL_INTENSITY12: - case GL_INTENSITY16: - return &_mesa_texformat_l8; // D3DFMT_L8 - case 1: - case GL_LUMINANCE: - case GL_LUMINANCE4: - case GL_LUMINANCE8: - case GL_LUMINANCE12: - case GL_LUMINANCE16: - return &_mesa_texformat_l8; // D3DFMT_L8 - case GL_ALPHA: - case GL_ALPHA4: - case GL_ALPHA8: - case GL_ALPHA12: - case GL_ALPHA16: - return &_mesa_texformat_a8; // D3DFMT_A8 - case GL_COLOR_INDEX: - case GL_COLOR_INDEX1_EXT: - case GL_COLOR_INDEX2_EXT: - case GL_COLOR_INDEX4_EXT: - case GL_COLOR_INDEX8_EXT: - case GL_COLOR_INDEX12_EXT: - case GL_COLOR_INDEX16_EXT: - return &_mesa_texformat_rgb565; // D3DFMT_R5G6B5 - // Mesa will convert this for us later... - // return &_mesa_texformat_ci8; // D3DFMT_R5G6B5 - case 2: - case GL_LUMINANCE_ALPHA: - case GL_LUMINANCE4_ALPHA4: - case GL_LUMINANCE6_ALPHA2: - case GL_LUMINANCE8_ALPHA8: - case GL_LUMINANCE12_ALPHA4: - case GL_LUMINANCE12_ALPHA12: - case GL_LUMINANCE16_ALPHA16: - return &_mesa_texformat_al88; // D3DFMT_A8L8 - case GL_R3_G3_B2: - return &_mesa_texformat_rgb332; // D3DFMT_R3G3B2 - case GL_RGB4: - case GL_RGBA4: - case GL_RGBA2: - return &_mesa_texformat_argb4444; // D3DFMT_A4R4G4B4 - case 3: - case GL_RGB: - case GL_RGB5: - case GL_RGB8: - case GL_RGB10: - case GL_RGB12: - case GL_RGB16: - return &_mesa_texformat_rgb565; - case 4: - case GL_RGBA: - case GL_RGBA8: - case GL_RGB10_A2: - case GL_RGBA12: - case GL_RGBA16: - return &_mesa_texformat_argb8888; - case GL_RGB5_A1: - return &_mesa_texformat_argb1555; - default: - _mesa_problem(NULL, "unexpected format in fxDDChooseTextureFormat"); - return NULL; - } -} - -//--------------------------------------------------------------------------- - -/* -// Safer(?), slower version. -void gld_TexImage2D_DX8( - GLcontext *ctx, - GLenum target, - GLint level, - GLint internalFormat, - GLint width, - GLint height, - GLint border, - GLenum format, - GLenum type, - const GLvoid *pixels, - const struct gl_pixelstore_attrib *packing, - struct gl_texture_object *tObj, - struct gl_texture_image *texImage) -{ - GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); - GLD_driver_dx8 *gld = GLD_GET_DX8_DRIVER(gldCtx); - - IDirect3DTexture8 *pTex; - IDirect3DSurface8 *pSurface; - RECT rcSrcRect; - HRESULT hr; - GLint texelBytes = 4; - GLvoid *tempImage; - - if (!tObj || !texImage) - return; - - if (level == 0) { - _gldAllocateTexture(ctx, tObj, texImage); - } - - pTex = (IDirect3DTexture8*)tObj->DriverData; - if (!pTex) - return; // Texture has not been created - if (level >= IDirect3DTexture8_GetLevelCount(pTex)) - return; // Level does not exist - hr = IDirect3DTexture8_GetSurfaceLevel(pTex, level, &pSurface); - if (FAILED(hr)) - return; // Surface level doesn't exist (or just a plain error) - - tempImage = MALLOC(width * height * texelBytes); - if (!tempImage) { - _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage2D"); - IDirect3DSurface8_Release(pSurface); - return; - } - // unpack image, apply transfer ops and store in tempImage - texImage->TexFormat->StoreImage(ctx, 2, texImage->Format, - &_mesa_texformat_argb8888, // dest format - tempImage, - width, height, 1, 0, 0, 0, - width * texelBytes, - 0, // dstImageStride - format, type, pixels, packing); - - SetRect(&rcSrcRect, 0, 0, width, height); - D3DXLoadSurfaceFromMemory( - pSurface, - NULL, - NULL, - tempImage, - D3DFMT_A8R8G8B8, - width * texelBytes, - NULL, - &rcSrcRect, - D3DX_FILTER_NONE, - 0); - - FREE(tempImage); - IDirect3DSurface8_Release(pSurface); -} -*/ - -//--------------------------------------------------------------------------- - -// Faster, more efficient version. -// Copies subimage straight to dest texture -void gld_TexImage2D_DX8( - GLcontext *ctx, - GLenum target, - GLint level, - GLint internalFormat, - GLint width, - GLint height, - GLint border, - GLenum format, - GLenum type, - const GLvoid *pixels, - const struct gl_pixelstore_attrib *packing, - struct gl_texture_object *tObj, - struct gl_texture_image *texImage) -{ - GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); - GLD_driver_dx8 *gld = GLD_GET_DX8_DRIVER(gldCtx); - - IDirect3DTexture8 *pTex; - IDirect3DSurface8 *pSurface; - HRESULT hr; - D3DLOCKED_RECT d3dLockedRect; - D3DSURFACE_DESC d3dsd; - - if (!tObj || !texImage) - return; - - // GLQUAKE FIX - // Test for input alpha data with non-alpha internalformat - if (((internalFormat==3) || (internalFormat==GL_RGB)) && (format==GL_RGBA)) { - // Input format has alpha, but a non-alpha format has been requested. - texImage->IntFormat = GL_RGBA; - internalFormat = GL_RGBA; - } - - if (level == 0) { - _gldAllocateTexture(ctx, tObj, texImage); - } - - pTex = (IDirect3DTexture8*)tObj->DriverData; - if (!pTex) - return; // Texture has not been created - if (level >= IDirect3DTexture8_GetLevelCount(pTex)) - return; // Level does not exist - hr = IDirect3DTexture8_GetSurfaceLevel(pTex, level, &pSurface); - if (FAILED(hr)) - return; // Surface level doesn't exist (or just a plain error) - - IDirect3DSurface8_GetDesc(pSurface, &d3dsd); - - // Lock all of surface - hr = IDirect3DSurface8_LockRect(pSurface, &d3dLockedRect, NULL, 0); - if (FAILED(hr)) { - IDirect3DSurface8_Release(pSurface); - return; - } - - // unpack image, apply transfer ops and store directly in texture - texImage->TexFormat->StoreImage( - ctx, - 2, - texImage->Format, - _gldMesaFormatForD3DFormat(d3dsd.Format), - d3dLockedRect.pBits, - width, height, 1, 0, 0, 0, - d3dLockedRect.Pitch, - 0, // dstImageStride - format, type, pixels, packing); - - IDirect3DSurface8_UnlockRect(pSurface); - IDirect3DSurface8_Release(pSurface); -} - -//--------------------------------------------------------------------------- - -void gld_TexImage1D_DX8(GLcontext *ctx, GLenum target, GLint level, - GLint internalFormat, - GLint width, GLint border, - GLenum format, GLenum type, const GLvoid *pixels, - const struct gl_pixelstore_attrib *packing, - struct gl_texture_object *texObj, - struct gl_texture_image *texImage ) -{ - // A 1D texture is a 2D texture with a height of zero - gld_TexImage2D_DX8(ctx, target, level, internalFormat, width, 1, border, format, type, pixels, packing, texObj, texImage); -} - -//--------------------------------------------------------------------------- - -/* -void gld_TexSubImage2D( GLcontext *ctx, GLenum target, GLint level, - GLint xoffset, GLint yoffset, - GLsizei width, GLsizei height, - GLenum format, GLenum type, - const GLvoid *pixels, - const struct gl_pixelstore_attrib *packing, - struct gl_texture_object *tObj, - struct gl_texture_image *texImage ) -{ - GLD_GET_CONTEXT - IDirect3DTexture8 *pTex; - IDirect3DSurface8 *pSurface; - D3DFORMAT d3dFormat; - HRESULT hr; - GLint texelBytes = 4; - GLvoid *tempImage; - RECT rcSrcRect; - RECT rcDstRect; - - if (!tObj || !texImage) - return; - - pTex = (IDirect3DTexture8*)tObj->DriverData; - if (!pTex) - return; // Texture has not been created - if (level >= _GLD_DX8_TEX(GetLevelCount(pTex)) - return; // Level does not exist - hr = _GLD_DX8_TEX(GetSurfaceLevel(pTex, level, &pSurface); - if (FAILED(hr)) - return; // Surface level doesn't exist (or just a plain error) - - d3dFormat = _gldGLFormatToD3DFormat(texImage->Format); - tempImage = MALLOC(width * height * texelBytes); - if (!tempImage) { - _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage2D"); - IDirect3DSurface8_Release(pSurface); - return; - } - - // unpack image, apply transfer ops and store in tempImage - texImage->TexFormat->StoreImage(ctx, 2, texImage->Format, - &_mesa_texformat_argb8888, // dest format - tempImage, - width, height, 1, 0, 0, 0, - width * texelBytes, - 0, // dstImageStride - format, type, pixels, packing); - - // Source rectangle is whole of input image - SetRect(&rcSrcRect, 0, 0, width, height); - - // Dest rectangle must be offset to dest image - SetRect(&rcDstRect, 0, 0, width, height); - OffsetRect(&rcDstRect, xoffset, yoffset); - - D3DXLoadSurfaceFromMemory( - pSurface, - NULL, - &rcDstRect, - tempImage, - D3DFMT_A8R8G8B8, - width * texelBytes, - NULL, - &rcSrcRect, - D3DX_FILTER_NONE, - 0); - - FREE(tempImage); - IDirect3DSurface8_Release(pSurface); -} -*/ - -//--------------------------------------------------------------------------- - -// Faster, more efficient version. -// Copies subimage straight to dest texture -void gld_TexSubImage2D_DX8( GLcontext *ctx, GLenum target, GLint level, - GLint xoffset, GLint yoffset, - GLsizei width, GLsizei height, - GLenum format, GLenum type, - const GLvoid *pixels, - const struct gl_pixelstore_attrib *packing, - struct gl_texture_object *tObj, - struct gl_texture_image *texImage ) -{ - GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); - GLD_driver_dx8 *gld = GLD_GET_DX8_DRIVER(gldCtx); - - IDirect3DTexture8 *pTex; - IDirect3DSurface8 *pSurface; - HRESULT hr; - RECT rcDstRect; - D3DLOCKED_RECT d3dLockedRect; - D3DSURFACE_DESC d3dsd; - - if (!tObj || !texImage) - return; - - pTex = (IDirect3DTexture8*)tObj->DriverData; - if (!pTex) - return; // Texture has not been created - if (level >= IDirect3DTexture8_GetLevelCount(pTex)) - return; // Level does not exist - hr = IDirect3DTexture8_GetSurfaceLevel(pTex, level, &pSurface); - if (FAILED(hr)) - return; // Surface level doesn't exist (or just a plain error) - - IDirect3DSurface8_GetDesc(pSurface, &d3dsd); - - // Dest rectangle must be offset to dest image - SetRect(&rcDstRect, 0, 0, width, height); - OffsetRect(&rcDstRect, xoffset, yoffset); - - // Lock sub-rect of surface - hr = IDirect3DSurface8_LockRect(pSurface, &d3dLockedRect, &rcDstRect, 0); - if (FAILED(hr)) { - IDirect3DSurface8_Release(pSurface); - return; - } - - // unpack image, apply transfer ops and store directly in texture - texImage->TexFormat->StoreImage(ctx, 2, texImage->Format, - _gldMesaFormatForD3DFormat(d3dsd.Format), - d3dLockedRect.pBits, - width, height, 1, - 0, 0, 0, // NOTE: d3dLockedRect.pBits is already offset!!! - d3dLockedRect.Pitch, - 0, // dstImageStride - format, type, pixels, packing); - - - IDirect3DSurface8_UnlockRect(pSurface); - IDirect3DSurface8_Release(pSurface); -} - -//--------------------------------------------------------------------------- - -void gld_TexSubImage1D_DX8( GLcontext *ctx, GLenum target, GLint level, - GLint xoffset, GLsizei width, - GLenum format, GLenum type, - const GLvoid *pixels, - const struct gl_pixelstore_attrib *packing, - struct gl_texture_object *texObj, - struct gl_texture_image *texImage ) -{ - gld_TexSubImage2D_DX8(ctx, target, level, xoffset, 0, width, 1, format, type, pixels, packing, texObj, texImage); -} - -//--------------------------------------------------------------------------- - -void gld_DeleteTexture_DX8( - GLcontext *ctx, - struct gl_texture_object *tObj) -{ - GLD_context *gld = (GLD_context*)(ctx->DriverCtx); - - if (tObj) { - IDirect3DTexture8 *pTex = (IDirect3DTexture8*)tObj->DriverData; - if (pTex) { -/* // Make sure texture is not bound to a stage before releasing it - for (int i=0; iCurrentTexture[i] == pTex) { - gld->pDev->SetTexture(i, NULL); - gld->CurrentTexture[i] = NULL; - } - }*/ - _GLD_DX8_TEX(Release(pTex)); - tObj->DriverData = NULL; - } - } -} - -//--------------------------------------------------------------------------- - -__inline void _gldSetColorOps( - const GLD_driver_dx8 *gld, - GLuint unit, - DWORD ColorArg1, - D3DTEXTUREOP ColorOp, - DWORD ColorArg2) -{ - _GLD_DX8_DEV(SetTextureStageState(gld->pDev, unit, D3DTSS_COLORARG1, ColorArg1)); - _GLD_DX8_DEV(SetTextureStageState(gld->pDev, unit, D3DTSS_COLOROP, ColorOp)); - _GLD_DX8_DEV(SetTextureStageState(gld->pDev, unit, D3DTSS_COLORARG2, ColorArg2)); -} - -//--------------------------------------------------------------------------- - -__inline void _gldSetAlphaOps( - const GLD_driver_dx8 *gld, - GLuint unit, - DWORD AlphaArg1, - D3DTEXTUREOP AlphaOp, - DWORD AlphaArg2) -{ - _GLD_DX8_DEV(SetTextureStageState(gld->pDev, unit, D3DTSS_ALPHAARG1, AlphaArg1)); - _GLD_DX8_DEV(SetTextureStageState(gld->pDev, unit, D3DTSS_ALPHAOP, AlphaOp)); - _GLD_DX8_DEV(SetTextureStageState(gld->pDev, unit, D3DTSS_ALPHAARG2, AlphaArg2)); -} - -//--------------------------------------------------------------------------- - -void gldUpdateTextureUnit( - GLcontext *ctx, - GLuint unit, - BOOL bPassThrough) -{ - GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); - GLD_driver_dx8 *gld = GLD_GET_DX8_DRIVER(gldCtx); - - D3DTEXTUREFILTERTYPE minfilter; - D3DTEXTUREFILTERTYPE mipfilter; - GLenum BaseFormat; - DWORD dwColorArg0; - int iTexEnv = 0; - GLD_texenv *pTexenv; - - // NOTE: If bPassThrough is FALSE then texture stage can be - // disabled otherwise it must pass-through it's current fragment. - - const struct gl_texture_unit *pUnit = &ctx->Texture.Unit[unit]; - const struct gl_texture_object *tObj = pUnit->_Current; - - IDirect3DTexture8 *pTex = NULL; - if (tObj) { - pTex = (IDirect3DTexture8*)tObj->DriverData; - } - - // Enable texturing if unit is enabled and a valid D3D texture exists - // Mesa 5: TEXTUREn_x altered to TEXTURE_nD_BIT - //if (pTex && (pUnit->Enabled & (TEXTURE0_1D | TEXTURE0_2D))) { - if (pTex && (pUnit->_ReallyEnabled & (TEXTURE_1D_BIT | TEXTURE_2D_BIT))) { - // Enable texturing - _GLD_DX8_DEV(SetTexture(gld->pDev, unit, pTex)); - } else { - // Disable texturing, then return - _GLD_DX8_DEV(SetTexture(gld->pDev, unit, NULL)); - if (bPassThrough) { - _gldSetColorOps(gld, unit, D3DTA_TEXTURE, D3DTOP_SELECTARG2, D3DTA_DIFFUSE); - _gldSetAlphaOps(gld, unit, D3DTA_TEXTURE, D3DTOP_SELECTARG2, D3DTA_DIFFUSE); - } else { - _gldSetColorOps(gld, unit, D3DTA_TEXTURE, D3DTOP_DISABLE, D3DTA_DIFFUSE); - _gldSetAlphaOps(gld, unit, D3DTA_TEXTURE, D3DTOP_DISABLE, D3DTA_DIFFUSE); - } - return; - } - - // Texture parameters - _gldConvertMinFilter(tObj->MinFilter, &minfilter, &mipfilter); - _GLD_DX8_DEV(SetTextureStageState(gld->pDev, unit, D3DTSS_MINFILTER, minfilter)); - _GLD_DX8_DEV(SetTextureStageState(gld->pDev, unit, D3DTSS_MIPFILTER, mipfilter)); - _GLD_DX8_DEV(SetTextureStageState(gld->pDev, unit, D3DTSS_MAGFILTER, _gldConvertMagFilter(tObj->MagFilter))); - _GLD_DX8_DEV(SetTextureStageState(gld->pDev, unit, D3DTSS_ADDRESSU, _gldConvertWrap(tObj->WrapS))); - _GLD_DX8_DEV(SetTextureStageState(gld->pDev, unit, D3DTSS_ADDRESSV, _gldConvertWrap(tObj->WrapT))); - - // Texture priority - _GLD_DX8_TEX(SetPriority(pTex, (DWORD)(tObj->Priority*65535.0f))); - - // Texture environment - // TODO: Examine input texture for alpha and use specific alpha/non-alpha ops. - // See Page 355 of the Red Book. - BaseFormat = _gldDecodeBaseFormat(pTex); - - switch (BaseFormat) { - case GL_RGB: - iTexEnv = 0; - break; - case GL_RGBA: - iTexEnv = 1; - break; - case GL_ALPHA: - iTexEnv = 2; - break; - } - - switch (pUnit->EnvMode) { - case GL_DECAL: - iTexEnv += 0; - break; - case GL_REPLACE: - iTexEnv += 3; - break; - case GL_MODULATE: - iTexEnv += 6; - break; - case GL_BLEND: - // Set blend colour - dwColorArg0 = D3DCOLOR_COLORVALUE(pUnit->EnvColor[0], pUnit->EnvColor[1], pUnit->EnvColor[2], pUnit->EnvColor[3]); - _GLD_DX8_DEV(SetTextureStageState(gld->pDev, unit, D3DTSS_COLORARG0, dwColorArg0)); - iTexEnv += 9; - break; - case GL_ADD: - iTexEnv += 12; - break; - } - pTexenv = (GLD_texenv*)&gldTexEnv[iTexEnv]; - _gldSetColorOps(gld, unit, pTexenv->ColorArg1, pTexenv->ColorOp, pTexenv->ColorArg2); - _gldSetAlphaOps(gld, unit, pTexenv->AlphaArg1, pTexenv->AlphaOp, pTexenv->AlphaArg2); -} - -//--------------------------------------------------------------------------- - -void gld_NEW_TEXTURE_DX8( - GLcontext *ctx) -{ - // TODO: Support for three (ATI Radeon) or more (nVidia GeForce3) texture units - - BOOL bUnit0Enabled; - BOOL bUnit1Enabled; - - if (!ctx) - return; // Sanity check - - if (ctx->Const.MaxTextureUnits == 1) { - gldUpdateTextureUnit(ctx, 0, TRUE); - return; - } - - // - // NOTE: THE FOLLOWING RELATES TO TWO TEXTURE UNITS, AND TWO ONLY!! - // - - // Mesa 5: Texture Units altered - //bUnit0Enabled = (ctx->Texture._ReallyEnabled & (TEXTURE0_1D | TEXTURE0_2D)) ? TRUE : FALSE; - //bUnit1Enabled = (ctx->Texture._ReallyEnabled & (TEXTURE1_1D | TEXTURE1_2D)) ? TRUE : FALSE; - bUnit0Enabled = (ctx->Texture.Unit[0]._ReallyEnabled & (TEXTURE_1D_BIT | TEXTURE_2D_BIT)) ? TRUE : FALSE; - bUnit1Enabled = (ctx->Texture.Unit[1]._ReallyEnabled & (TEXTURE_1D_BIT | TEXTURE_2D_BIT)) ? TRUE : FALSE; - - // If Unit0 is disabled and Unit1 is enabled then we must pass-though - gldUpdateTextureUnit(ctx, 0, (!bUnit0Enabled && bUnit1Enabled) ? TRUE : FALSE); - // We can always disable the last texture unit - gldUpdateTextureUnit(ctx, 1, FALSE); - -#ifdef _DEBUG - { - // Find out whether device supports current renderstates - GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); - GLD_driver_dx8 *gld = GLD_GET_DX8_DRIVER(gldCtx); -// GLD_context *gld = GLD_GET_CONTEXT(ctx); - - DWORD dwPasses; - _GLD_DX8_DEV(ValidateDevice(gld->pDev, &dwPasses)); -// if (FAILED(hr)) { -// gldLogError(GLDLOG_ERROR, "ValidateDevice failed", hr); -// } - if (dwPasses != 1) { - gldLogMessage(GLDLOG_ERROR, "ValidateDevice: Can't do in one pass\n"); - } - } -#endif -}; - -//--------------------------------------------------------------------------- diff --git a/src/mesa/drivers/windows/gldirect/dx8/gld_vb_d3d_render_dx8.c b/src/mesa/drivers/windows/gldirect/dx8/gld_vb_d3d_render_dx8.c deleted file mode 100644 index cafbf4f5c5..0000000000 --- a/src/mesa/drivers/windows/gldirect/dx8/gld_vb_d3d_render_dx8.c +++ /dev/null @@ -1,249 +0,0 @@ -/**************************************************************************** -* -* Mesa 3-D graphics library -* Direct3D Driver Interface -* -* ======================================================================== -* -* Copyright (C) 1991-2004 SciTech Software, Inc. All rights reserved. -* -* Permission is hereby granted, free of charge, to any person obtaining a -* copy of this software and associated documentation files (the "Software"), -* to deal in the Software without restriction, including without limitation -* the rights to use, copy, modify, merge, publish, distribute, sublicense, -* and/or sell copies of the Software, and to permit persons to whom the -* Software is furnished to do so, subject to the following conditions: -* -* The above copyright notice and this permission notice shall be included -* in all copies or substantial portions of the Software. -* -* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -* SCITECH SOFTWARE INC BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF -* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -* SOFTWARE. -* -* ====================================================================== -* -* Language: ANSI C -* Environment: Windows 9x/2000/XP/XBox (Win32) -* -* Description: GLDirect fastpath pipeline stage -* -****************************************************************************/ - -//--------------------------------------------------------------------------- - -//#include "../GLDirect.h" -//#include "../gld_log.h" -//#include "gld_dx8.h" - -#include "dglcontext.h" -#include "ddlog.h" -#include "gld_dx8.h" - -//--------------------------------------------------------------------------- - -#include "glheader.h" -#include "context.h" -#include "macros.h" -// #include "mem.h" -#include "mtypes.h" -//#include "mmath.h" - -#include "math/m_matrix.h" -#include "math/m_xform.h" - -#include "tnl/t_pipeline.h" - -//--------------------------------------------------------------------------- - -__inline void _gldSetVertexShaderConstants( - GLcontext *ctx, - GLD_driver_dx8 *gld) -{ - D3DXMATRIX mat, matView, matProj; - GLfloat *pM; - - // Mesa 5: Altered to a Stack - //pM = ctx->ModelView.m; - pM = ctx->ModelviewMatrixStack.Top->m; - matView._11 = pM[0]; - matView._12 = pM[1]; - matView._13 = pM[2]; - matView._14 = pM[3]; - matView._21 = pM[4]; - matView._22 = pM[5]; - matView._23 = pM[6]; - matView._24 = pM[7]; - matView._31 = pM[8]; - matView._32 = pM[9]; - matView._33 = pM[10]; - matView._34 = pM[11]; - matView._41 = pM[12]; - matView._42 = pM[13]; - matView._43 = pM[14]; - matView._44 = pM[15]; - - // Mesa 5: Altered to a Stack - //pM = ctx->ProjectionMatrix.m; - pM = ctx->ProjectionMatrixStack.Top->m; - matProj._11 = pM[0]; - matProj._12 = pM[1]; - matProj._13 = pM[2]; - matProj._14 = pM[3]; - matProj._21 = pM[4]; - matProj._22 = pM[5]; - matProj._23 = pM[6]; - matProj._24 = pM[7]; - matProj._31 = pM[8]; - matProj._32 = pM[9]; - matProj._33 = pM[10]; - matProj._34 = pM[11]; - matProj._41 = pM[12]; - matProj._42 = pM[13]; - matProj._43 = pM[14]; - matProj._44 = pM[15]; - - D3DXMatrixMultiply( &mat, &matView, &matProj ); - D3DXMatrixTranspose( &mat, &mat ); - - _GLD_DX8_DEV(SetVertexShaderConstant(gld->pDev, 0, &mat, 4)); -} - -//--------------------------------------------------------------------------- - -static GLboolean gld_d3d_render_stage_run( - GLcontext *ctx, - struct tnl_pipeline_stage *stage) -{ - GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); - GLD_driver_dx8 *gld = GLD_GET_DX8_DRIVER(gldCtx); - - TNLcontext *tnl; - struct vertex_buffer *VB; - tnl_render_func *tab; - GLint pass; - GLD_pb_dx8 *gldPB = &gld->PB3d; -/* - static int count = 0; - count++; - if (count != 2) - return GL_FALSE; -*/ - // The "check" function should disable this stage, - // but we'll test gld->bUseMesaTnL anyway. - if (gld->bUseMesaTnL) { - // Do nothing in this stage, but continue pipeline - return GL_TRUE; - } - - tnl = TNL_CONTEXT(ctx); - VB = &tnl->vb; - pass = 0; - - tnl->Driver.Render.Start( ctx ); - -#if 0 - // For debugging: Useful to see if an app passes colour data in - // an unusual format. - switch (VB->ColorPtr[0]->Type) { - case GL_FLOAT: - ddlogMessage(GLDLOG_SYSTEM, "ColorPtr: GL_FLOAT\n"); - break; - case GL_UNSIGNED_BYTE: - ddlogMessage(GLDLOG_SYSTEM, "ColorPtr: GL_UNSIGNED_BYTE\n"); - break; - default: - ddlogMessage(GLDLOG_SYSTEM, "ColorPtr: *?*\n"); - break; - } -#endif - - tnl->Driver.Render.Points = gld_Points3D_DX8; - if (ctx->_TriangleCaps & DD_FLATSHADE) { - tnl->Driver.Render.Line = gld_Line3DFlat_DX8; - tnl->Driver.Render.Triangle = gld_Triangle3DFlat_DX8; - tnl->Driver.Render.Quad = gld_Quad3DFlat_DX8; - } else { - tnl->Driver.Render.Line = gld_Line3DSmooth_DX8; - tnl->Driver.Render.Triangle = gld_Triangle3DSmooth_DX8; - tnl->Driver.Render.Quad = gld_Quad3DSmooth_DX8; - } - - _GLD_DX8_VB(Lock(gldPB->pVB, 0, 0, &gldPB->pPoints, D3DLOCK_DISCARD)); - gldPB->nPoints = gldPB->nLines = gldPB->nTriangles = 0; - // Allocate primitive pointers - // gldPB->pPoints is always first - gldPB->pLines = gldPB->pPoints + (gldPB->dwStride * gldPB->iFirstLine); - gldPB->pTriangles = gldPB->pPoints + (gldPB->dwStride * gldPB->iFirstTriangle); - - ASSERT(tnl->Driver.Render.BuildVertices); - ASSERT(tnl->Driver.Render.PrimitiveNotify); - ASSERT(tnl->Driver.Render.Points); - ASSERT(tnl->Driver.Render.Line); - ASSERT(tnl->Driver.Render.Triangle); - ASSERT(tnl->Driver.Render.Quad); - ASSERT(tnl->Driver.Render.ResetLineStipple); - ASSERT(tnl->Driver.Render.Interp); - ASSERT(tnl->Driver.Render.CopyPV); - ASSERT(tnl->Driver.Render.ClippedLine); - ASSERT(tnl->Driver.Render.ClippedPolygon); - ASSERT(tnl->Driver.Render.Finish); - - tab = (VB->Elts ? tnl->Driver.Render.PrimTabElts : tnl->Driver.Render.PrimTabVerts); - - do { - GLuint i, length, flags = 0; - for (i = 0 ; !(flags & PRIM_END) ; i += length) - { - flags = VB->Primitive[i].mode; - length= VB->Primitive[i].count; - ASSERT(length || (flags & PRIM_END)); - ASSERT((flags & PRIM_MODE_MASK) <= GL_POLYGON+1); - if (length) - tab[flags & PRIM_MODE_MASK]( ctx, i, i + length, flags ); - } - } while (tnl->Driver.Render.Multipass && - tnl->Driver.Render.Multipass( ctx, ++pass )); - - _GLD_DX8_VB(Unlock(gldPB->pVB)); - - _GLD_DX8_DEV(SetStreamSource(gld->pDev, 0, gldPB->pVB, gldPB->dwStride)); - - _GLD_DX8_DEV(SetTransform(gld->pDev, D3DTS_PROJECTION, &gld->matProjection)); - _GLD_DX8_DEV(SetTransform(gld->pDev, D3DTS_WORLD, &gld->matModelView)); - - if (gldPB->nPoints) { - _GLD_DX8_DEV(DrawPrimitive(gld->pDev, D3DPT_POINTLIST, 0, gldPB->nPoints)); - gldPB->nPoints = 0; - } - - if (gldPB->nLines) { - _GLD_DX8_DEV(DrawPrimitive(gld->pDev, D3DPT_LINELIST, gldPB->iFirstLine, gldPB->nLines)); - gldPB->nLines = 0; - } - - if (gldPB->nTriangles) { - _GLD_DX8_DEV(DrawPrimitive(gld->pDev, D3DPT_TRIANGLELIST, gldPB->iFirstTriangle, gldPB->nTriangles)); - gldPB->nTriangles = 0; - } - - return GL_FALSE; /* finished the pipe */ -} - -//--------------------------------------------------------------------------- - -const struct tnl_pipeline_stage _gld_d3d_render_stage = -{ - "gld_d3d_render_stage", - NULL, - NULL, - NULL, - NULL, - gld_d3d_render_stage_run /* run */ -}; - -//--------------------------------------------------------------------------- diff --git a/src/mesa/drivers/windows/gldirect/dx8/gld_vb_mesa_render_dx8.c b/src/mesa/drivers/windows/gldirect/dx8/gld_vb_mesa_render_dx8.c deleted file mode 100644 index 9ab562010c..0000000000 --- a/src/mesa/drivers/windows/gldirect/dx8/gld_vb_mesa_render_dx8.c +++ /dev/null @@ -1,448 +0,0 @@ - -/* - * Mesa 3-D graphics library - * Version: 3.5 - * - * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - * Authors: - * Keith Whitwell - */ - - -/* - * Render whole vertex buffers, including projection of vertices from - * clip space and clipping of primitives. - * - * This file makes calls to project vertices and to the point, line - * and triangle rasterizers via the function pointers: - * - * context->Driver.Render.* - * - */ - - -//--------------------------------------------------------------------------- - -//#include "../GLDirect.h" -//#include "../gld_log.h" -//#include "gld_dx8.h" - -#include "dglcontext.h" -#include "ddlog.h" -#include "gld_dx8.h" - -//--------------------------------------------------------------------------- - -#include "glheader.h" -#include "context.h" -#include "macros.h" -// #include "mem.h" -#include "mtypes.h" -//#include "mmath.h" - -#include "math/m_matrix.h" -#include "math/m_xform.h" - -#include "tnl/t_pipeline.h" - -/**********************************************************************/ -/* Clip single primitives */ -/**********************************************************************/ - - -#if defined(USE_IEEE) -#define NEGATIVE(x) (GET_FLOAT_BITS(x) & (1<<31)) -//#define DIFFERENT_SIGNS(x,y) ((GET_FLOAT_BITS(x) ^ GET_FLOAT_BITS(y)) & (1<<31)) -#else -#define NEGATIVE(x) (x < 0) -//#define DIFFERENT_SIGNS(x,y) (x * y <= 0 && x - y != 0) -/* Could just use (x*y<0) except for the flatshading requirements. - * Maybe there's a better way? - */ -#endif - - -#define W(i) coord[i][3] -#define Z(i) coord[i][2] -#define Y(i) coord[i][1] -#define X(i) coord[i][0] -#define SIZE 4 -#define TAG(x) x##_4 -#include "tnl/t_vb_cliptmp.h" - - - -/**********************************************************************/ -/* Clip and render whole begin/end objects */ -/**********************************************************************/ - -#define NEED_EDGEFLAG_SETUP (ctx->_TriangleCaps & DD_TRI_UNFILLED) -#define EDGEFLAG_GET(idx) VB->EdgeFlag[idx] -#define EDGEFLAG_SET(idx, val) VB->EdgeFlag[idx] = val - - -/* Vertices, with the possibility of clipping. - */ -#define RENDER_POINTS( start, count ) \ - tnl->Driver.Render.Points( ctx, start, count ) - -#define RENDER_LINE( v1, v2 ) \ -do { \ - GLubyte c1 = mask[v1], c2 = mask[v2]; \ - GLubyte ormask = c1|c2; \ - if (!ormask) \ - LineFunc( ctx, v1, v2 ); \ - else if (!(c1 & c2 & 0x3f)) \ - clip_line_4( ctx, v1, v2, ormask ); \ -} while (0) - -#define RENDER_TRI( v1, v2, v3 ) \ -do { \ - GLubyte c1 = mask[v1], c2 = mask[v2], c3 = mask[v3]; \ - GLubyte ormask = c1|c2|c3; \ - if (!ormask) \ - TriangleFunc( ctx, v1, v2, v3 ); \ - else if (!(c1 & c2 & c3 & 0x3f)) \ - clip_tri_4( ctx, v1, v2, v3, ormask ); \ -} while (0) - -#define RENDER_QUAD( v1, v2, v3, v4 ) \ -do { \ - GLubyte c1 = mask[v1], c2 = mask[v2]; \ - GLubyte c3 = mask[v3], c4 = mask[v4]; \ - GLubyte ormask = c1|c2|c3|c4; \ - if (!ormask) \ - QuadFunc( ctx, v1, v2, v3, v4 ); \ - else if (!(c1 & c2 & c3 & c4 & 0x3f)) \ - clip_quad_4( ctx, v1, v2, v3, v4, ormask ); \ -} while (0) - - -#define LOCAL_VARS \ - TNLcontext *tnl = TNL_CONTEXT(ctx); \ - struct vertex_buffer *VB = &tnl->vb; \ - const GLuint * const elt = VB->Elts; \ - const GLubyte *mask = VB->ClipMask; \ - const GLuint sz = VB->ClipPtr->size; \ - const tnl_line_func LineFunc = tnl->Driver.Render.Line; \ - const tnl_triangle_func TriangleFunc = tnl->Driver.Render.Triangle; \ - const tnl_quad_func QuadFunc = tnl->Driver.Render.Quad; \ - const GLboolean stipple = ctx->Line.StippleFlag; \ - (void) (LineFunc && TriangleFunc && QuadFunc); \ - (void) elt; (void) mask; (void) sz; (void) stipple; - -#define TAG(x) clip_##x##_verts -#define INIT(x) tnl->Driver.Render.PrimitiveNotify( ctx, x ) -#define RESET_STIPPLE if (stipple) tnl->Driver.Render.ResetLineStipple( ctx ) -#define PRESERVE_VB_DEFS -#include "tnl/t_vb_rendertmp.h" - - - -/* Elts, with the possibility of clipping. - */ -#undef ELT -#undef TAG -#define ELT(x) elt[x] -#define TAG(x) clip_##x##_elts -#include "tnl/t_vb_rendertmp.h" - -/* TODO: do this for all primitives, verts and elts: - */ -static void clip_elt_triangles( GLcontext *ctx, - GLuint start, - GLuint count, - GLuint flags ) -{ - TNLcontext *tnl = TNL_CONTEXT(ctx); - tnl_render_func render_tris = tnl->Driver.Render.PrimTabElts[GL_TRIANGLES]; - struct vertex_buffer *VB = &tnl->vb; - const GLuint * const elt = VB->Elts; - GLubyte *mask = VB->ClipMask; - GLuint last = count-2; - GLuint j; - (void) flags; - - tnl->Driver.Render.PrimitiveNotify( ctx, GL_TRIANGLES ); - - for (j=start; j < last; j+=3 ) { - GLubyte c1 = mask[elt[j]]; - GLubyte c2 = mask[elt[j+1]]; - GLubyte c3 = mask[elt[j+2]]; - GLubyte ormask = c1|c2|c3; - if (ormask) { - if (start < j) - render_tris( ctx, start, j, 0 ); - if (!(c1&c2&c3&0x3f)) - clip_tri_4( ctx, elt[j], elt[j+1], elt[j+2], ormask ); - start = j+3; - } - } - - if (start < j) - render_tris( ctx, start, j, 0 ); -} - -/**********************************************************************/ -/* Render whole begin/end objects */ -/**********************************************************************/ - -#define NEED_EDGEFLAG_SETUP (ctx->_TriangleCaps & DD_TRI_UNFILLED) -#define EDGEFLAG_GET(idx) VB->EdgeFlag[idx] -#define EDGEFLAG_SET(idx, val) VB->EdgeFlag[idx] = val - - -/* Vertices, no clipping. - */ -#define RENDER_POINTS( start, count ) \ - tnl->Driver.Render.Points( ctx, start, count ) - -#define RENDER_LINE( v1, v2 ) \ - LineFunc( ctx, v1, v2 ) - -#define RENDER_TRI( v1, v2, v3 ) \ - TriangleFunc( ctx, v1, v2, v3 ) - -#define RENDER_QUAD( v1, v2, v3, v4 ) \ - QuadFunc( ctx, v1, v2, v3, v4 ) - -#define TAG(x) _gld_tnl_##x##_verts - -#define LOCAL_VARS \ - TNLcontext *tnl = TNL_CONTEXT(ctx); \ - struct vertex_buffer *VB = &tnl->vb; \ - const GLuint * const elt = VB->Elts; \ - const tnl_line_func LineFunc = tnl->Driver.Render.Line; \ - const tnl_triangle_func TriangleFunc = tnl->Driver.Render.Triangle; \ - const tnl_quad_func QuadFunc = tnl->Driver.Render.Quad; \ - (void) (LineFunc && TriangleFunc && QuadFunc); \ - (void) elt; - -#define RESET_STIPPLE tnl->Driver.Render.ResetLineStipple( ctx ) -#define INIT(x) tnl->Driver.Render.PrimitiveNotify( ctx, x ) -#define RENDER_TAB_QUALIFIER -#define PRESERVE_VB_DEFS -#include "tnl/t_vb_rendertmp.h" - - -/* Elts, no clipping. - */ -#undef ELT -#define TAG(x) _gld_tnl_##x##_elts -#define ELT(x) elt[x] -#include "tnl/t_vb_rendertmp.h" - - -/**********************************************************************/ -/* Helper functions for drivers */ -/**********************************************************************/ -/* -void _tnl_RenderClippedPolygon( GLcontext *ctx, const GLuint *elts, GLuint n ) -{ - TNLcontext *tnl = TNL_CONTEXT(ctx); - struct vertex_buffer *VB = &tnl->vb; - GLuint *tmp = VB->Elts; - - VB->Elts = (GLuint *)elts; - tnl->Driver.Render.PrimTabElts[GL_POLYGON]( ctx, 0, n, PRIM_BEGIN|PRIM_END ); - VB->Elts = tmp; -} - -void _tnl_RenderClippedLine( GLcontext *ctx, GLuint ii, GLuint jj ) -{ - TNLcontext *tnl = TNL_CONTEXT(ctx); - tnl->Driver.Render.Line( ctx, ii, jj ); -} -*/ - - -/**********************************************************************/ -/* Clip and render whole vertex buffers */ -/**********************************************************************/ - -tnl_points_func _gldSetupPoints[4] = { - gld_Points2D_DX8, - gld_Points2D_DX8, - gld_Points2D_DX8, - gld_Points2D_DX8 -}; -tnl_line_func _gldSetupLine[4] = { - gld_Line2DFlat_DX8, - gld_Line2DSmooth_DX8, - gld_Line2DFlat_DX8, - gld_Line2DSmooth_DX8, -}; -tnl_triangle_func _gldSetupTriangle[4] = { - gld_Triangle2DFlat_DX8, - gld_Triangle2DSmooth_DX8, - gld_Triangle2DFlatExtras_DX8, - gld_Triangle2DSmoothExtras_DX8 -}; -tnl_quad_func _gldSetupQuad[4] = { - gld_Quad2DFlat_DX8, - gld_Quad2DSmooth_DX8, - gld_Quad2DFlatExtras_DX8, - gld_Quad2DSmoothExtras_DX8 -}; - -//--------------------------------------------------------------------------- - -static GLboolean _gld_mesa_render_stage_run( - GLcontext *ctx, - struct tnl_pipeline_stage *stage) -{ - GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); - GLD_driver_dx8 *gld = GLD_GET_DX8_DRIVER(gldCtx); - - TNLcontext *tnl = TNL_CONTEXT(ctx); - struct vertex_buffer *VB = &tnl->vb; - tnl_render_func *tab; - GLint pass = 0; - GLD_pb_dx8 *gldPB; - - /* Allow the drivers to lock before projected verts are built so - * that window coordinates are guarenteed not to change before - * rendering. - */ - ASSERT(tnl->Driver.Render.Start); - - tnl->Driver.Render.Start( ctx ); - - // NOTE: Setting D3DRS_SOFTWAREVERTEXPROCESSING for a mixed-mode device resets - // stream, indices and shader to default values of NULL or 0. -/* if ((ctx->_TriangleCaps & DD_TRI_LIGHT_TWOSIDE) && - gld->VStwosidelight.hShader && - !ctx->Fog.Enabled) - { - IDirect3DDevice8_SetRenderState(gld->pDev, D3DRS_SOFTWAREVERTEXPROCESSING, !gld->VStwosidelight.bHardware); - _GLD_DX8_DEV(SetVertexShader(gld->pDev, gld->VStwosidelight.hShader)); - gldPB = &gld->PBtwosidelight; - tnl->Driver.Render.Points = gld_Points2DTwoside_DX8; - if (ctx->_TriangleCaps & DD_FLATSHADE) { - tnl->Driver.Render.Line = gld_Line2DFlatTwoside_DX8; - tnl->Driver.Render.Triangle = gld_Triangle2DFlatTwoside_DX8; - tnl->Driver.Render.Quad = gld_Quad2DFlatTwoside_DX8; - } else { - tnl->Driver.Render.Line = gld_Line2DSmoothTwoside_DX8; - tnl->Driver.Render.Triangle = gld_Triangle2DSmoothTwoside_DX8; - tnl->Driver.Render.Quad = gld_Quad2DSmoothTwoside_DX8; - } - } else {*/ - IDirect3DDevice8_SetRenderState(gld->pDev, D3DRS_SOFTWAREVERTEXPROCESSING, TRUE); - gldPB = &gld->PB2d; - _GLD_DX8_DEV(SetVertexShader(gld->pDev, gldPB->dwFVF)); - tnl->Driver.Render.Points = _gldSetupPoints[gld->iSetupFunc]; - tnl->Driver.Render.Line = _gldSetupLine[gld->iSetupFunc]; - tnl->Driver.Render.Triangle = _gldSetupTriangle[gld->iSetupFunc]; - tnl->Driver.Render.Quad = _gldSetupQuad[gld->iSetupFunc]; -// } - - _GLD_DX8_VB(Lock(gldPB->pVB, 0, 0, &gldPB->pPoints, D3DLOCK_DISCARD)); - gldPB->nPoints = gldPB->nLines = gldPB->nTriangles = 0; - // Allocate primitive pointers - // gldPB->pPoints is always first - gldPB->pLines = gldPB->pPoints + (gldPB->dwStride * gldPB->iFirstLine); - gldPB->pTriangles = gldPB->pPoints + (gldPB->dwStride * gldPB->iFirstTriangle); - - ASSERT(tnl->Driver.Render.BuildVertices); - ASSERT(tnl->Driver.Render.PrimitiveNotify); - ASSERT(tnl->Driver.Render.Points); - ASSERT(tnl->Driver.Render.Line); - ASSERT(tnl->Driver.Render.Triangle); - ASSERT(tnl->Driver.Render.Quad); - ASSERT(tnl->Driver.Render.ResetLineStipple); - ASSERT(tnl->Driver.Render.Interp); - ASSERT(tnl->Driver.Render.CopyPV); - ASSERT(tnl->Driver.Render.ClippedLine); - ASSERT(tnl->Driver.Render.ClippedPolygon); - ASSERT(tnl->Driver.Render.Finish); - - tnl->Driver.Render.BuildVertices( ctx, 0, VB->Count, ~0 ); - - if (VB->ClipOrMask) { - tab = VB->Elts ? clip_render_tab_elts : clip_render_tab_verts; - clip_render_tab_elts[GL_TRIANGLES] = clip_elt_triangles; - } - else { - tab = (VB->Elts ? - tnl->Driver.Render.PrimTabElts : - tnl->Driver.Render.PrimTabVerts); - } - - do { - GLuint i, length, flags = 0; - for (i = 0 ; !(flags & PRIM_END) ; i += length) { - flags = VB->Primitive[i].mode; - length= VB->Primitive[i].count; - ASSERT(length || (flags & PRIM_END)); - ASSERT((flags & PRIM_MODE_MASK) <= GL_POLYGON+1); - if (length) - tab[flags & PRIM_MODE_MASK]( ctx, i, i + length, flags ); - } - } while (tnl->Driver.Render.Multipass && - tnl->Driver.Render.Multipass( ctx, ++pass )); - - -// tnl->Driver.Render.Finish( ctx ); - - _GLD_DX8_VB(Unlock(gldPB->pVB)); - - _GLD_DX8_DEV(SetStreamSource(gld->pDev, 0, gldPB->pVB, gldPB->dwStride)); - - if (gldPB->nPoints) { - _GLD_DX8_DEV(DrawPrimitive(gld->pDev, D3DPT_POINTLIST, 0, gldPB->nPoints)); - gldPB->nPoints = 0; - } - - if (gldPB->nLines) { - _GLD_DX8_DEV(DrawPrimitive(gld->pDev, D3DPT_LINELIST, gldPB->iFirstLine, gldPB->nLines)); - gldPB->nLines = 0; - } - - if (gldPB->nTriangles) { - _GLD_DX8_DEV(DrawPrimitive(gld->pDev, D3DPT_TRIANGLELIST, gldPB->iFirstTriangle, gldPB->nTriangles)); - gldPB->nTriangles = 0; - } - - return GL_FALSE; /* finished the pipe */ -} - - -/**********************************************************************/ -/* Render pipeline stage */ -/**********************************************************************/ - - - - -//--------------------------------------------------------------------------- - -const struct tnl_pipeline_stage _gld_mesa_render_stage = -{ - "gld_mesa_render_stage", - NULL, - NULL, - NULL, - NULL, - _gld_mesa_render_stage_run /* run */ -}; - -//--------------------------------------------------------------------------- diff --git a/src/mesa/drivers/windows/gldirect/dx8/gld_wgl_dx8.c b/src/mesa/drivers/windows/gldirect/dx8/gld_wgl_dx8.c deleted file mode 100644 index 690f68b68f..0000000000 --- a/src/mesa/drivers/windows/gldirect/dx8/gld_wgl_dx8.c +++ /dev/null @@ -1,1335 +0,0 @@ -/**************************************************************************** -* -* Mesa 3-D graphics library -* Direct3D Driver Interface -* -* ======================================================================== -* -* Copyright (C) 1991-2004 SciTech Software, Inc. All rights reserved. -* -* Permission is hereby granted, free of charge, to any person obtaining a -* copy of this software and associated documentation files (the "Software"), -* to deal in the Software without restriction, including without limitation -* the rights to use, copy, modify, merge, publish, distribute, sublicense, -* and/or sell copies of the Software, and to permit persons to whom the -* Software is furnished to do so, subject to the following conditions: -* -* The above copyright notice and this permission notice shall be included -* in all copies or substantial portions of the Software. -* -* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -* SCITECH SOFTWARE INC BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF -* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -* SOFTWARE. -* -* ====================================================================== -* -* Language: ANSI C -* Environment: Windows 9x/2000/XP/XBox (Win32) -* -* Description: GLDirect Direct3D 8.x WGL (WindowsGL) -* -****************************************************************************/ - -#include "dglcontext.h" -#include "gld_driver.h" -#include "gld_dxerr8.h" -#include "gld_dx8.h" - -#include "tnl/tnl.h" -#include "tnl/t_context.h" - -// Copied from dglcontect.c -#define GLDERR_NONE 0 -#define GLDERR_MEM 1 -#define GLDERR_DDRAW 2 -#define GLDERR_D3D 3 -#define GLDERR_BPP 4 -#define GLDERR_DDS 5 -// This external var keeps track of any error -extern int nContextError; - -#define DDLOG_CRITICAL_OR_WARN DDLOG_CRITICAL - -extern void _gld_mesa_warning(GLcontext *, char *); -extern void _gld_mesa_fatal(GLcontext *, char *); - -//--------------------------------------------------------------------------- - -static char szColorDepthWarning[] = -"GLDirect does not support the current desktop\n\ -color depth.\n\n\ -You may need to change the display resolution to\n\ -16 bits per pixel or higher color depth using\n\ -the Windows Display Settings control panel\n\ -before running this OpenGL application.\n"; - -// The only depth-stencil formats currently supported by Direct3D -// Surface Format Depth Stencil Total Bits -// D3DFMT_D32 32 - 32 -// D3DFMT_D15S1 15 1 16 -// D3DFMT_D24S8 24 8 32 -// D3DFMT_D16 16 - 16 -// D3DFMT_D24X8 24 - 32 -// D3DFMT_D24X4S4 24 4 32 - -// This pixel format will be used as a template when compiling the list -// of pixel formats supported by the hardware. Many fields will be -// filled in at runtime. -// PFD flag defaults are upgraded to match ChoosePixelFormat() -- DaveM -static DGL_pixelFormat pfTemplateHW = -{ - { - sizeof(PIXELFORMATDESCRIPTOR), // Size of the data structure - 1, // Structure version - should be 1 - // Flags: - PFD_DRAW_TO_WINDOW | // The buffer can draw to a window or device surface. - PFD_DRAW_TO_BITMAP | // The buffer can draw to a bitmap. (DaveM) - PFD_SUPPORT_GDI | // The buffer supports GDI drawing. (DaveM) - PFD_SUPPORT_OPENGL | // The buffer supports OpenGL drawing. - PFD_DOUBLEBUFFER | // The buffer is double-buffered. - 0, // Placeholder for easy commenting of above flags - PFD_TYPE_RGBA, // Pixel type RGBA. - 16, // Total colour bitplanes (excluding alpha bitplanes) - 5, 0, // Red bits, shift - 5, 0, // Green bits, shift - 5, 0, // Blue bits, shift - 0, 0, // Alpha bits, shift (destination alpha) - 0, // Accumulator bits (total) - 0, 0, 0, 0, // Accumulator bits: Red, Green, Blue, Alpha - 0, // Depth bits - 0, // Stencil bits - 0, // Number of auxiliary buffers - 0, // Layer type - 0, // Specifies the number of overlay and underlay planes. - 0, // Layer mask - 0, // Specifies the transparent color or index of an underlay plane. - 0 // Damage mask - }, - D3DFMT_UNKNOWN, // No depth/stencil buffer -}; - -//--------------------------------------------------------------------------- -// Vertex Shaders -//--------------------------------------------------------------------------- - -// Vertex Shader Declaration -static DWORD dwTwoSidedLightingDecl[] = -{ - D3DVSD_STREAM(0), - D3DVSD_REG(0, D3DVSDT_FLOAT3), // XYZ position - D3DVSD_REG(1, D3DVSDT_FLOAT3), // XYZ normal - D3DVSD_REG(2, D3DVSDT_D3DCOLOR), // Diffuse color - D3DVSD_REG(3, D3DVSDT_D3DCOLOR), // Specular color - D3DVSD_REG(4, D3DVSDT_FLOAT2), // 2D texture unit 0 - D3DVSD_REG(5, D3DVSDT_FLOAT2), // 2D texture unit 1 - D3DVSD_END() -}; - -// Vertex Shader for two-sided lighting -static char *szTwoSidedLightingVS = -// This is a test shader! -"vs.1.0\n" -"m4x4 oPos,v0,c0\n" -"mov oD0,v2\n" -"mov oD1,v3\n" -"mov oT0,v4\n" -"mov oT1,v5\n" -; - -//--------------------------------------------------------------------------- -//--------------------------------------------------------------------------- - -typedef struct { - HINSTANCE hD3D8DLL; // Handle to d3d8.dll - FNDIRECT3DCREATE8 fnDirect3DCreate8; // Direct3DCreate8 function prototype - BOOL bDirect3D; // Persistant Direct3D8 exists - BOOL bDirect3DDevice; // Persistant Direct3DDevice8 exists - IDirect3D8 *pD3D; // Persistant Direct3D8 - IDirect3DDevice8 *pDev; // Persistant Direct3DDevice8 -} GLD_dx8_globals; - -// These are "global" to all DX8 contexts. KeithH -static GLD_dx8_globals dx8Globals; - -//--------------------------------------------------------------------------- -//--------------------------------------------------------------------------- - -BOOL gldGetDXErrorString_DX( - HRESULT hr, - char *buf, - int nBufSize) -{ - // - // Return a string describing the input HRESULT error code - // - - D3DXGetErrorString(hr, buf, nBufSize); - return TRUE; -} - -//--------------------------------------------------------------------------- - -static D3DMULTISAMPLE_TYPE _gldGetDeviceMultiSampleType( - IDirect3D8 *pD3D8, - D3DFORMAT SurfaceFormat, - D3DDEVTYPE d3dDevType, - BOOL Windowed) -{ - int i; - HRESULT hr; - - if (glb.dwMultisample == GLDS_MULTISAMPLE_NONE) - return D3DMULTISAMPLE_NONE; - - if (glb.dwMultisample == GLDS_MULTISAMPLE_FASTEST) { - // Find fastest multisample - for (i=2; i<17; i++) { - hr = IDirect3D8_CheckDeviceMultiSampleType( - pD3D8, - glb.dwAdapter, - d3dDevType, - SurfaceFormat, - Windowed, - (D3DMULTISAMPLE_TYPE)i); - if (SUCCEEDED(hr)) { - return (D3DMULTISAMPLE_TYPE)i; - } - } - } else { - // Find nicest multisample - for (i=16; i>1; i--) { - hr = IDirect3D8_CheckDeviceMultiSampleType( - pD3D8, - glb.dwAdapter, - d3dDevType, - SurfaceFormat, - Windowed, - (D3DMULTISAMPLE_TYPE)i); - if (SUCCEEDED(hr)) { - return (D3DMULTISAMPLE_TYPE)i; - } - } - } - - // Nothing found - return default - return D3DMULTISAMPLE_NONE; -} - -//--------------------------------------------------------------------------- - -void _gldDestroyPrimitiveBuffer( - GLD_pb_dx8 *gldVB) -{ - SAFE_RELEASE(gldVB->pVB); - - // Sanity check... - gldVB->nLines = gldVB->nPoints = gldVB->nTriangles = 0; -} - -//--------------------------------------------------------------------------- - -HRESULT _gldCreatePrimitiveBuffer( - GLcontext *ctx, - GLD_driver_dx8 *lpCtx, - GLD_pb_dx8 *gldVB) -{ - HRESULT hResult; - char *szCreateVertexBufferFailed = "CreateVertexBuffer failed"; - DWORD dwMaxVertices; // Max number of vertices in vertex buffer - DWORD dwVBSize; // Total size of vertex buffer - - // If CVA (Compiled Vertex Array) is used by an OpenGL app, then we - // will need enough vertices to cater for Mesa::Const.MaxArrayLockSize. - // We'll use IMM_SIZE if it's larger (which it should not be). - dwMaxVertices = MAX_ARRAY_LOCK_SIZE; - - // Now calculate how many vertices to allow for in total - // 1 per point, 2 per line, 6 per quad = 9 - dwVBSize = dwMaxVertices * 9 * gldVB->dwStride; - - hResult = IDirect3DDevice8_CreateVertexBuffer( - lpCtx->pDev, - dwVBSize, - gldVB->dwUsage, - gldVB->dwFVF, - gldVB->dwPool, - &gldVB->pVB); - if (FAILED(hResult)) { - ddlogMessage(DDLOG_CRITICAL_OR_WARN, szCreateVertexBufferFailed); - return hResult; - } - - gldVB->nLines = gldVB->nPoints = gldVB->nTriangles = 0; - gldVB->pPoints = gldVB->pLines = gldVB->pTriangles = NULL; - gldVB->iFirstLine = dwMaxVertices; // Index of first line in VB - gldVB->iFirstTriangle = dwMaxVertices*3; // Index of first triangle in VB - - return S_OK; -} - -//--------------------------------------------------------------------------- -// Function: _gldCreateVertexShaders -// Create DX8 Vertex Shaders. -//--------------------------------------------------------------------------- -/* -void _gldCreateVertexShaders( - GLD_driver_dx8 *gld) -{ - DWORD dwFlags; - LPD3DXBUFFER pVSOpcodeBuffer; // Vertex Shader opcode buffer - HRESULT hr; - -#ifdef _DEBUG - dwFlags = D3DXASM_DEBUG; -#else - dwFlags = 0; // D3DXASM_SKIPVALIDATION; -#endif - - ddlogMessage(DDLOG_INFO, "Creating shaders...\n"); - - // Init the shader handle - gld->VStwosidelight.hShader = 0; - - if (gld->d3dCaps8.MaxStreams == 0) { - // Lame DX8 driver doesn't support streams - // Not fatal, as defaults will be used - ddlogMessage(DDLOG_WARN, "Driver doesn't support Vertex Shaders (MaxStreams==0)\n"); - return; - } - - // ** THIS DISABLES VERTEX SHADER SUPPORT ** -// return; - // ** THIS DISABLES VERTEX SHADER SUPPORT ** - - // - // Two-sided lighting - // - -#if 0 - // - // DEBUGGING: Load shader from a text file - // - { - LPD3DXBUFFER pVSErrorBuffer; // Vertex Shader error buffer - hr = D3DXAssembleShaderFromFile( - "twoside.vsh", - dwFlags, - NULL, // No constants - &pVSOpcodeBuffer, - &pVSErrorBuffer); - if (pVSErrorBuffer && pVSErrorBuffer->lpVtbl->GetBufferPointer(pVSErrorBuffer)) - ddlogMessage(DDLOG_INFO, pVSErrorBuffer->lpVtbl->GetBufferPointer(pVSErrorBuffer)); - SAFE_RELEASE(pVSErrorBuffer); - } -#else - { - LPD3DXBUFFER pVSErrorBuffer; // Vertex Shader error buffer - // Assemble ascii shader text into shader opcodes - hr = D3DXAssembleShader( - szTwoSidedLightingVS, - strlen(szTwoSidedLightingVS), - dwFlags, - NULL, // No constants - &pVSOpcodeBuffer, - &pVSErrorBuffer); - if (pVSErrorBuffer && pVSErrorBuffer->lpVtbl->GetBufferPointer(pVSErrorBuffer)) - ddlogMessage(DDLOG_INFO, pVSErrorBuffer->lpVtbl->GetBufferPointer(pVSErrorBuffer)); - SAFE_RELEASE(pVSErrorBuffer); - } -#endif - if (FAILED(hr)) { - ddlogError(DDLOG_WARN, "AssembleShader failed", hr); - SAFE_RELEASE(pVSOpcodeBuffer); - return; - } - -// This is for debugging. Remove to enable vertex shaders in HW -#define _GLD_FORCE_SW_VS 0 - - if (_GLD_FORCE_SW_VS) { - // _GLD_FORCE_SW_VS should be disabled for Final Release - ddlogMessage(DDLOG_SYSTEM, "[Forcing shaders in SW]\n"); - } - - // Try and create shader in hardware. - // NOTE: The D3D Ref device appears to succeed when trying to - // create the device in hardware, but later complains - // when trying to set it with SetVertexShader(). Go figure. - if (_GLD_FORCE_SW_VS || glb.dwDriver == GLDS_DRIVER_REF) { - // Don't try and create a hardware shader with the Ref device - hr = E_FAIL; // COM error/fail result - } else { - gld->VStwosidelight.bHardware = TRUE; - hr = IDirect3DDevice8_CreateVertexShader( - gld->pDev, - dwTwoSidedLightingDecl, - pVSOpcodeBuffer->lpVtbl->GetBufferPointer(pVSOpcodeBuffer), - &gld->VStwosidelight.hShader, - 0); - } - if (FAILED(hr)) { - ddlogMessage(DDLOG_INFO, "... HW failed, trying SW...\n"); - // Failed. Try and create shader for software processing - hr = IDirect3DDevice8_CreateVertexShader( - gld->pDev, - dwTwoSidedLightingDecl, - pVSOpcodeBuffer->lpVtbl->GetBufferPointer(pVSOpcodeBuffer), - &gld->VStwosidelight.hShader, - D3DUSAGE_SOFTWAREPROCESSING); - if (FAILED(hr)) { - gld->VStwosidelight.hShader = 0; // Sanity check - ddlogError(DDLOG_WARN, "CreateVertexShader failed", hr); - return; - } - // Succeeded, but for software processing - gld->VStwosidelight.bHardware = FALSE; - } - - SAFE_RELEASE(pVSOpcodeBuffer); - - ddlogMessage(DDLOG_INFO, "... OK\n"); -} - -//--------------------------------------------------------------------------- - -void _gldDestroyVertexShaders( - GLD_driver_dx8 *gld) -{ - if (gld->VStwosidelight.hShader) { - IDirect3DDevice8_DeleteVertexShader(gld->pDev, gld->VStwosidelight.hShader); - gld->VStwosidelight.hShader = 0; - } -} -*/ -//--------------------------------------------------------------------------- - -LPVOID lpOpaque1 = NULL; -LPVOID lpOpaque2 = NULL; - -BOOL gldCreateDrawable_DX( - DGL_ctx *ctx, -// BOOL bDefaultDriver, - BOOL bDirectDrawPersistant, - BOOL bPersistantBuffers) -{ - // - // bDirectDrawPersistant: applies to IDirect3D8 - // bPersistantBuffers: applies to IDirect3DDevice8 - // - - HRESULT hResult; - GLD_driver_dx8 *lpCtx = NULL; - D3DDEVTYPE d3dDevType; - D3DPRESENT_PARAMETERS d3dpp; - D3DDISPLAYMODE d3ddm; - DWORD dwBehaviourFlags; - D3DADAPTER_IDENTIFIER8 d3dIdent; - - // Error if context is NULL. - if (ctx == NULL) - return FALSE; - - if (ctx->glPriv) { - lpCtx = ctx->glPriv; - // Release any existing interfaces - SAFE_RELEASE(lpCtx->pDev); - SAFE_RELEASE(lpCtx->pD3D); - } else { - lpCtx = (GLD_driver_dx8*)malloc(sizeof(GLD_driver_dx8)); - ZeroMemory(lpCtx, sizeof(lpCtx)); - } - - d3dDevType = (glb.dwDriver == GLDS_DRIVER_HAL) ? D3DDEVTYPE_HAL : D3DDEVTYPE_REF; - // TODO: Check this -// if (bDefaultDriver) -// d3dDevType = D3DDEVTYPE_REF; - - // Use persistant interface if needed - if (bDirectDrawPersistant && dx8Globals.bDirect3D) { - lpCtx->pD3D = dx8Globals.pD3D; - IDirect3D8_AddRef(lpCtx->pD3D); - goto SkipDirectDrawCreate; - } - - // Create Direct3D8 object - lpCtx->pD3D = dx8Globals.fnDirect3DCreate8(D3D_SDK_VERSION_DX8_SUPPORT_WIN95); - if (lpCtx->pD3D == NULL) { - MessageBox(NULL, "Unable to initialize Direct3D8", "GLDirect", MB_OK); - ddlogMessage(DDLOG_CRITICAL_OR_WARN, "Unable to create Direct3D8 interface"); - nContextError = GLDERR_D3D; - goto return_with_error; - } - - // Cache Direct3D interface for subsequent GLRCs - if (bDirectDrawPersistant && !dx8Globals.bDirect3D) { - dx8Globals.pD3D = lpCtx->pD3D; - IDirect3D8_AddRef(dx8Globals.pD3D); - dx8Globals.bDirect3D = TRUE; - } -SkipDirectDrawCreate: - - // Get the display mode so we can make a compatible backbuffer - hResult = IDirect3D8_GetAdapterDisplayMode(lpCtx->pD3D, glb.dwAdapter, &d3ddm); - if (FAILED(hResult)) { - nContextError = GLDERR_D3D; - goto return_with_error; - } - - // Get device caps - hResult = IDirect3D8_GetDeviceCaps(lpCtx->pD3D, glb.dwAdapter, d3dDevType, &lpCtx->d3dCaps8); - if (FAILED(hResult)) { - ddlogError(DDLOG_CRITICAL_OR_WARN, "IDirect3D8_GetDeviceCaps failed", hResult); - nContextError = GLDERR_D3D; - goto return_with_error; - } - - // Check for hardware transform & lighting - lpCtx->bHasHWTnL = lpCtx->d3dCaps8.DevCaps & D3DDEVCAPS_HWTRANSFORMANDLIGHT ? TRUE : FALSE; - - // If this flag is present then we can't default to Mesa - // SW rendering between BeginScene() and EndScene(). - if (lpCtx->d3dCaps8.Caps2 & D3DCAPS2_NO2DDURING3DSCENE) { - ddlogMessage(DDLOG_WARN, - "Warning : No 2D allowed during 3D scene.\n"); - } - - // - // Create the Direct3D context - // - - // Re-use original IDirect3DDevice if persistant buffers exist. - // Note that we test for persistant IDirect3D8 as well - // bDirectDrawPersistant == persistant IDirect3D8 (DirectDraw8 does not exist) - if (bDirectDrawPersistant && bPersistantBuffers && dx8Globals.pD3D && dx8Globals.pDev) { - lpCtx->pDev = dx8Globals.pDev; - IDirect3DDevice8_AddRef(dx8Globals.pDev); - goto skip_direct3ddevice_create; - } - - // Clear the presentation parameters (sets all members to zero) - ZeroMemory(&d3dpp, sizeof(d3dpp)); - - // Recommended by MS; needed for MultiSample. - // Be careful if altering this for FullScreenBlit - d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD; - - d3dpp.BackBufferFormat = d3ddm.Format; - d3dpp.BackBufferCount = 1; - d3dpp.MultiSampleType = _gldGetDeviceMultiSampleType(lpCtx->pD3D, d3ddm.Format, d3dDevType, !ctx->bFullscreen); - d3dpp.AutoDepthStencilFormat = ctx->lpPF->dwDriverData; - d3dpp.EnableAutoDepthStencil = (d3dpp.AutoDepthStencilFormat == D3DFMT_UNKNOWN) ? FALSE : TRUE; - - if (ctx->bFullscreen) { - ddlogWarnOption(FALSE); // Don't popup any messages in fullscreen - d3dpp.Windowed = FALSE; - d3dpp.BackBufferWidth = d3ddm.Width; - d3dpp.BackBufferHeight = d3ddm.Height; - d3dpp.hDeviceWindow = ctx->hWnd; - d3dpp.FullScreen_RefreshRateInHz = D3DPRESENT_RATE_DEFAULT; - - // Support for vertical retrace synchronisation. - // Set default presentation interval in case caps bits are missing - d3dpp.FullScreen_PresentationInterval = D3DPRESENT_INTERVAL_DEFAULT; - if (glb.bWaitForRetrace) { - if (lpCtx->d3dCaps8.PresentationIntervals & D3DPRESENT_INTERVAL_ONE) - d3dpp.FullScreen_PresentationInterval = D3DPRESENT_INTERVAL_ONE; - } else { - if (lpCtx->d3dCaps8.PresentationIntervals & D3DPRESENT_INTERVAL_IMMEDIATE) - d3dpp.FullScreen_PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE; - } - } else { - ddlogWarnOption(glb.bMessageBoxWarnings); // OK to popup messages - d3dpp.Windowed = TRUE; - d3dpp.BackBufferWidth = ctx->dwWidth; - d3dpp.BackBufferHeight = ctx->dwHeight; - d3dpp.hDeviceWindow = ctx->hWnd; - d3dpp.FullScreen_RefreshRateInHz = 0; - // FullScreen_PresentationInterval must be default for Windowed mode - d3dpp.FullScreen_PresentationInterval = D3DPRESENT_INTERVAL_DEFAULT; - } - - // Decide if we can use hardware TnL - dwBehaviourFlags = (lpCtx->bHasHWTnL) ? - D3DCREATE_MIXED_VERTEXPROCESSING : D3DCREATE_SOFTWARE_VERTEXPROCESSING; - // Add flag to tell D3D to be thread-safe - if (glb.bMultiThreaded) - dwBehaviourFlags |= D3DCREATE_MULTITHREADED; - // Add flag to tell D3D to be FPU-safe - if (!glb.bFastFPU) - dwBehaviourFlags |= D3DCREATE_FPU_PRESERVE; - hResult = IDirect3D8_CreateDevice(lpCtx->pD3D, - glb.dwAdapter, - d3dDevType, - ctx->hWnd, - dwBehaviourFlags, - &d3dpp, - &lpCtx->pDev); - if (FAILED(hResult)) { - ddlogError(DDLOG_CRITICAL_OR_WARN, "IDirect3D8_CreateDevice failed", hResult); - nContextError = GLDERR_D3D; - goto return_with_error; - } - - if (bDirectDrawPersistant && bPersistantBuffers && dx8Globals.pD3D) { - dx8Globals.pDev = lpCtx->pDev; - dx8Globals.bDirect3DDevice = TRUE; - } - -/* - // See if DDraw interfaces are available (DaveM) - hResult = IDirect3D8_QueryInterface(lpCtx->pDev, - &IID_IDirectDraw7, (LPVOID*)&lpOpaque1); - if (FAILED(hResult) || lpOpaque1 == NULL) { - ddlogMessage(DDLOG_INFO, "DirectDraw QueryInterface unavailable\n"); - } - - hResult = IDirect3DDevice8_QueryInterface(lpCtx->pDev, - &IID_IDirectDrawSurface7, (LPVOID*)&lpOpaque2); - if (FAILED(hResult) || lpOpaque2 == NULL) { - ddlogMessage(DDLOG_INFO, "DirectDrawSurface QueryInterface unavialable\n"); - } -*/ - // Dump some useful stats - hResult = IDirect3D8_GetAdapterIdentifier( - lpCtx->pD3D, - glb.dwAdapter, - D3DENUM_NO_WHQL_LEVEL, // Avoids 1 to 2 second delay - &d3dIdent); - if (SUCCEEDED(hResult)) { - ddlogPrintf(DDLOG_INFO, "[Driver Description: %s]", &d3dIdent.Description); - ddlogPrintf(DDLOG_INFO, "[Driver file: %s %d.%d.%02d.%d]", - d3dIdent.Driver, - HIWORD(d3dIdent.DriverVersion.HighPart), - LOWORD(d3dIdent.DriverVersion.HighPart), - HIWORD(d3dIdent.DriverVersion.LowPart), - LOWORD(d3dIdent.DriverVersion.LowPart)); - ddlogPrintf(DDLOG_INFO, "[VendorId: 0x%X, DeviceId: 0x%X, SubSysId: 0x%X, Revision: 0x%X]", - d3dIdent.VendorId, d3dIdent.DeviceId, d3dIdent.SubSysId, d3dIdent.Revision); - } - - // Init projection matrix for D3D TnL - D3DXMatrixIdentity(&lpCtx->matProjection); - lpCtx->matModelView = lpCtx->matProjection; -// gld->bUseMesaProjection = TRUE; - -skip_direct3ddevice_create: - - // Create buffers to hold primitives - lpCtx->PB2d.dwFVF = GLD_FVF_2D_VERTEX; - lpCtx->PB2d.dwPool = D3DPOOL_SYSTEMMEM; - lpCtx->PB2d.dwStride = sizeof(GLD_2D_VERTEX); - lpCtx->PB2d.dwUsage = D3DUSAGE_DONOTCLIP | - D3DUSAGE_DYNAMIC | - D3DUSAGE_SOFTWAREPROCESSING | - D3DUSAGE_WRITEONLY; - hResult = _gldCreatePrimitiveBuffer(ctx->glCtx, lpCtx, &lpCtx->PB2d); - if (FAILED(hResult)) - goto return_with_error; - - lpCtx->PB3d.dwFVF = GLD_FVF_3D_VERTEX; - lpCtx->PB3d.dwPool = D3DPOOL_DEFAULT; - lpCtx->PB3d.dwStride = sizeof(GLD_3D_VERTEX); - lpCtx->PB3d.dwUsage = D3DUSAGE_DYNAMIC | - D3DUSAGE_SOFTWAREPROCESSING | - D3DUSAGE_WRITEONLY; - hResult = _gldCreatePrimitiveBuffer(ctx->glCtx, lpCtx, &lpCtx->PB3d); - if (FAILED(hResult)) - goto return_with_error; - -/* // NOTE: A FVF code of zero indicates a non-FVF vertex buffer (for vertex shaders) - lpCtx->PBtwosidelight.dwFVF = 0; //GLD_FVF_TWOSIDED_VERTEX; - lpCtx->PBtwosidelight.dwPool = D3DPOOL_DEFAULT; - lpCtx->PBtwosidelight.dwStride = sizeof(GLD_TWOSIDED_VERTEX); - lpCtx->PBtwosidelight.dwUsage = D3DUSAGE_DONOTCLIP | - D3DUSAGE_DYNAMIC | - D3DUSAGE_SOFTWAREPROCESSING | - D3DUSAGE_WRITEONLY; - hResult = _gldCreatePrimitiveBuffer(ctx->glCtx, lpCtx, &lpCtx->PBtwosidelight); - if (FAILED(hResult)) - goto return_with_error;*/ - - // Now try and create the DX8 Vertex Shaders -// _gldCreateVertexShaders(lpCtx); - - // Zero the pipeline usage counters - lpCtx->PipelineUsage.qwMesa.QuadPart = -// lpCtx->PipelineUsage.dwD3D2SVS.QuadPart = - lpCtx->PipelineUsage.qwD3DFVF.QuadPart = 0; - - // Assign drawable to GL private - ctx->glPriv = lpCtx; - return TRUE; - -return_with_error: - // Clean up and bail - -// _gldDestroyVertexShaders(lpCtx); - -// _gldDestroyPrimitiveBuffer(&lpCtx->PBtwosidelight); - _gldDestroyPrimitiveBuffer(&lpCtx->PB3d); - _gldDestroyPrimitiveBuffer(&lpCtx->PB2d); - - SAFE_RELEASE(lpCtx->pDev); - SAFE_RELEASE(lpCtx->pD3D); - return FALSE; -} - -//--------------------------------------------------------------------------- - -BOOL gldResizeDrawable_DX( - DGL_ctx *ctx, - BOOL bDefaultDriver, - BOOL bPersistantInterface, - BOOL bPersistantBuffers) -{ - GLD_driver_dx8 *gld = NULL; - D3DDEVTYPE d3dDevType; - D3DPRESENT_PARAMETERS d3dpp; - D3DDISPLAYMODE d3ddm; - HRESULT hResult; - - // Error if context is NULL. - if (ctx == NULL) - return FALSE; - - gld = ctx->glPriv; - if (gld == NULL) - return FALSE; - - if (ctx->bSceneStarted) { - IDirect3DDevice8_EndScene(gld->pDev); - ctx->bSceneStarted = FALSE; - } - - d3dDevType = (glb.dwDriver == GLDS_DRIVER_HAL) ? D3DDEVTYPE_HAL : D3DDEVTYPE_REF; - if (!bDefaultDriver) - d3dDevType = D3DDEVTYPE_REF; // Force Direct3D Reference Rasterise (software) - - // Get the display mode so we can make a compatible backbuffer - hResult = IDirect3D8_GetAdapterDisplayMode(gld->pD3D, glb.dwAdapter, &d3ddm); - if (FAILED(hResult)) { - nContextError = GLDERR_D3D; -// goto return_with_error; - return FALSE; - } - - // Destroy DX8 Vertex Shaders before Reset() -// _gldDestroyVertexShaders(gld); - - // Release POOL_DEFAULT objects before Reset() - if (gld->PB2d.dwPool == D3DPOOL_DEFAULT) - _gldDestroyPrimitiveBuffer(&gld->PB2d); - if (gld->PB3d.dwPool == D3DPOOL_DEFAULT) - _gldDestroyPrimitiveBuffer(&gld->PB3d); -// if (gld->PBtwosidelight.dwPool == D3DPOOL_DEFAULT) -// _gldDestroyPrimitiveBuffer(&gld->PBtwosidelight); - - // Clear the presentation parameters (sets all members to zero) - ZeroMemory(&d3dpp, sizeof(d3dpp)); - - // Recommended by MS; needed for MultiSample. - // Be careful if altering this for FullScreenBlit - d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD; - - d3dpp.BackBufferFormat = d3ddm.Format; - d3dpp.BackBufferCount = 1; - d3dpp.MultiSampleType = _gldGetDeviceMultiSampleType(gld->pD3D, d3ddm.Format, d3dDevType, !ctx->bFullscreen); - d3dpp.AutoDepthStencilFormat = ctx->lpPF->dwDriverData; - d3dpp.EnableAutoDepthStencil = (d3dpp.AutoDepthStencilFormat == D3DFMT_UNKNOWN) ? FALSE : TRUE; - - // TODO: Sync to refresh - - if (ctx->bFullscreen) { - ddlogWarnOption(FALSE); // Don't popup any messages in fullscreen - d3dpp.Windowed = FALSE; - d3dpp.BackBufferWidth = d3ddm.Width; - d3dpp.BackBufferHeight = d3ddm.Height; - d3dpp.hDeviceWindow = ctx->hWnd; - d3dpp.FullScreen_RefreshRateInHz = D3DPRESENT_RATE_DEFAULT; - d3dpp.FullScreen_PresentationInterval = D3DPRESENT_INTERVAL_DEFAULT; - // Get better benchmark results? KeithH -// d3dpp.FullScreen_RefreshRateInHz = D3DPRESENT_RATE_UNLIMITED; - } else { - ddlogWarnOption(glb.bMessageBoxWarnings); // OK to popup messages - d3dpp.Windowed = TRUE; - d3dpp.BackBufferWidth = ctx->dwWidth; - d3dpp.BackBufferHeight = ctx->dwHeight; - d3dpp.hDeviceWindow = ctx->hWnd; - d3dpp.FullScreen_RefreshRateInHz = 0; - d3dpp.FullScreen_PresentationInterval = D3DPRESENT_INTERVAL_DEFAULT; - } - hResult = IDirect3DDevice8_Reset(gld->pDev, &d3dpp); - if (FAILED(hResult)) { - ddlogError(DDLOG_CRITICAL_OR_WARN, "dglResize: Reset failed", hResult); - return FALSE; - //goto cleanup_and_return_with_error; - } - - // Explicitly Clear resized surfaces (DaveM) - { - D3DVIEWPORT8 d3dvp1, d3dvp2; - IDirect3DDevice8_GetViewport(gld->pDev, &d3dvp1); - IDirect3DDevice8_GetViewport(gld->pDev, &d3dvp2); - d3dvp1.X = 0; - d3dvp1.Y = 0; - d3dvp1.Width = ctx->dwWidth; - d3dvp1.Height = ctx->dwHeight; - IDirect3DDevice8_SetViewport(gld->pDev, &d3dvp1); - IDirect3DDevice8_Clear(gld->pDev,0,NULL,D3DCLEAR_TARGET,0,0,0); - IDirect3DDevice8_SetViewport(gld->pDev, &d3dvp2); - } - - // - // Recreate POOL_DEFAULT objects - // - if (gld->PB2d.dwPool == D3DPOOL_DEFAULT) { - _gldCreatePrimitiveBuffer(ctx->glCtx, gld, &gld->PB2d); - } - if (gld->PB3d.dwPool == D3DPOOL_DEFAULT) { - _gldCreatePrimitiveBuffer(ctx->glCtx, gld, &gld->PB3d); - } -// if (gld->PBtwosidelight.dwPool == D3DPOOL_DEFAULT) { -// _gldCreatePrimitiveBuffer(ctx->glCtx, gld, &gld->PB2d); -// } - - // Recreate DX8 Vertex Shaders -// _gldCreateVertexShaders(gld); - - // Signal a complete state update - ctx->glCtx->Driver.UpdateState(ctx->glCtx, _NEW_ALL); - - // Begin a new scene - IDirect3DDevice8_BeginScene(gld->pDev); - ctx->bSceneStarted = TRUE; - - return TRUE; -} - -//--------------------------------------------------------------------------- - -BOOL gldDestroyDrawable_DX( - DGL_ctx *ctx) -{ - GLD_driver_dx8 *lpCtx = NULL; - - // Error if context is NULL. - if (!ctx) - return FALSE; - - // Error if the drawable does not exist. - if (!ctx->glPriv) - return FALSE; - - lpCtx = ctx->glPriv; - -#ifdef _DEBUG - // Dump out stats - ddlogPrintf(DDLOG_SYSTEM, "Usage: M:0x%X%X, D:0x%X%X", - lpCtx->PipelineUsage.qwMesa.HighPart, - lpCtx->PipelineUsage.qwMesa.LowPart, - lpCtx->PipelineUsage.qwD3DFVF.HighPart, - lpCtx->PipelineUsage.qwD3DFVF.LowPart); -#endif - -// _gldDestroyVertexShaders(lpCtx); - -// _gldDestroyPrimitiveBuffer(&lpCtx->PBtwosidelight); - _gldDestroyPrimitiveBuffer(&lpCtx->PB3d); - _gldDestroyPrimitiveBuffer(&lpCtx->PB2d); - - SAFE_RELEASE(lpCtx->pDev); - SAFE_RELEASE(lpCtx->pD3D); - - // Free the private drawable data - free(ctx->glPriv); - ctx->glPriv = NULL; - - return TRUE; -} - -//--------------------------------------------------------------------------- - -BOOL gldCreatePrivateGlobals_DX(void) -{ - ZeroMemory(&dx8Globals, sizeof(dx8Globals)); - - // Load d3d8.dll - dx8Globals.hD3D8DLL = LoadLibrary("D3D8.DLL"); - if (dx8Globals.hD3D8DLL == NULL) - return FALSE; - - // Now try and obtain Direct3DCreate8 - dx8Globals.fnDirect3DCreate8 = (FNDIRECT3DCREATE8)GetProcAddress(dx8Globals.hD3D8DLL, "Direct3DCreate8"); - if (dx8Globals.fnDirect3DCreate8 == NULL) { - FreeLibrary(dx8Globals.hD3D8DLL); - return FALSE; - } - - return TRUE; -} - -//--------------------------------------------------------------------------- - -BOOL gldDestroyPrivateGlobals_DX(void) -{ - if (dx8Globals.bDirect3DDevice) { - SAFE_RELEASE(dx8Globals.pDev); - dx8Globals.bDirect3DDevice = FALSE; - } - if (dx8Globals.bDirect3D) { - SAFE_RELEASE(dx8Globals.pD3D); - dx8Globals.bDirect3D = FALSE; - } - - FreeLibrary(dx8Globals.hD3D8DLL); - dx8Globals.hD3D8DLL = NULL; - dx8Globals.fnDirect3DCreate8 = NULL; - - return TRUE; -} - -//--------------------------------------------------------------------------- - -static void _BitsFromDisplayFormat( - D3DFORMAT fmt, - BYTE *cColorBits, - BYTE *cRedBits, - BYTE *cGreenBits, - BYTE *cBlueBits, - BYTE *cAlphaBits) -{ - switch (fmt) { - case D3DFMT_X1R5G5B5: - *cColorBits = 16; - *cRedBits = 5; - *cGreenBits = 5; - *cBlueBits = 5; - *cAlphaBits = 0; - return; - case D3DFMT_R5G6B5: - *cColorBits = 16; - *cRedBits = 5; - *cGreenBits = 6; - *cBlueBits = 5; - *cAlphaBits = 0; - return; - case D3DFMT_X8R8G8B8: - *cColorBits = 32; - *cRedBits = 8; - *cGreenBits = 8; - *cBlueBits = 8; - *cAlphaBits = 0; - return; - case D3DFMT_A8R8G8B8: - *cColorBits = 32; - *cRedBits = 8; - *cGreenBits = 8; - *cBlueBits = 8; - *cAlphaBits = 8; - return; - } - - // Should not get here! - *cColorBits = 32; - *cRedBits = 8; - *cGreenBits = 8; - *cBlueBits = 8; - *cAlphaBits = 0; -} - -//--------------------------------------------------------------------------- - -static void _BitsFromDepthStencilFormat( - D3DFORMAT fmt, - BYTE *cDepthBits, - BYTE *cStencilBits) -{ - // NOTE: GL expects either 32 or 16 as depth bits. - switch (fmt) { - case D3DFMT_D32: - *cDepthBits = 32; - *cStencilBits = 0; - return; - case D3DFMT_D15S1: - *cDepthBits = 16; - *cStencilBits = 1; - return; - case D3DFMT_D24S8: - *cDepthBits = 32; - *cStencilBits = 8; - return; - case D3DFMT_D16: - *cDepthBits = 16; - *cStencilBits = 0; - return; - case D3DFMT_D24X8: - *cDepthBits = 32; - *cStencilBits = 0; - return; - case D3DFMT_D24X4S4: - *cDepthBits = 32; - *cStencilBits = 4; - return; - } -} - -//--------------------------------------------------------------------------- - -BOOL gldBuildPixelformatList_DX(void) -{ - D3DDISPLAYMODE d3ddm; - D3DFORMAT fmt[6]; - IDirect3D8 *pD3D = NULL; - HRESULT hr; - int nSupportedFormats = 0; - int i; - DGL_pixelFormat *pPF; - BYTE cColorBits, cRedBits, cGreenBits, cBlueBits, cAlphaBits; -// char buf[128]; -// char cat[8]; - - // Direct3D (SW or HW) - // These are arranged so that 'best' pixelformat - // is higher in the list (for ChoosePixelFormat). - const D3DFORMAT DepthStencil[6] = { - D3DFMT_D15S1, - D3DFMT_D16, - D3DFMT_D24X8, - D3DFMT_D24X4S4, - D3DFMT_D24S8, - D3DFMT_D32, - }; - - // Dump DX version - ddlogMessage(GLDLOG_SYSTEM, "DirectX Version : 8.0\n"); - - // Release any existing pixelformat list - if (glb.lpPF) { - free(glb.lpPF); - } - - glb.nPixelFormatCount = 0; - glb.lpPF = NULL; - - // - // Pixelformats for Direct3D (SW or HW) rendering - // - - // Get a Direct3D 8.0 interface - pD3D = dx8Globals.fnDirect3DCreate8(D3D_SDK_VERSION_DX8_SUPPORT_WIN95); - if (!pD3D) { - return FALSE; - } - - // We will use the display mode format when finding compliant - // rendertarget/depth-stencil surfaces. - hr = IDirect3D8_GetAdapterDisplayMode(pD3D, glb.dwAdapter, &d3ddm); - if (FAILED(hr)) { - IDirect3D8_Release(pD3D); - return FALSE; - } - - // Run through the possible formats and detect supported formats - for (i=0; i<6; i++) { - hr = IDirect3D8_CheckDeviceFormat( - pD3D, - glb.dwAdapter, - glb.dwDriver==GLDS_DRIVER_HAL ? D3DDEVTYPE_HAL : D3DDEVTYPE_REF, - d3ddm.Format, - D3DUSAGE_DEPTHSTENCIL, - D3DRTYPE_SURFACE, - DepthStencil[i]); - if (FAILED(hr)) - // A failure here is not fatal. - continue; - - // Verify that the depth format is compatible. - hr = IDirect3D8_CheckDepthStencilMatch( - pD3D, - glb.dwAdapter, - glb.dwDriver==GLDS_DRIVER_HAL ? D3DDEVTYPE_HAL : D3DDEVTYPE_REF, - d3ddm.Format, - d3ddm.Format, - DepthStencil[i]); - if (FAILED(hr)) - // A failure here is not fatal, just means depth-stencil - // format is not compatible with this display mode. - continue; - - fmt[nSupportedFormats++] = DepthStencil[i]; - } - - IDirect3D8_Release(pD3D); - - if (nSupportedFormats == 0) - return FALSE; // Bail: no compliant pixelformats - - // Total count of pixelformats is: - // (nSupportedFormats+1)*2 - glb.lpPF = (DGL_pixelFormat *)calloc((nSupportedFormats)*2, sizeof(DGL_pixelFormat)); - glb.nPixelFormatCount = (nSupportedFormats)*2; - if (glb.lpPF == NULL) { - glb.nPixelFormatCount = 0; - return FALSE; - } - - // Get a copy of pointer that we can alter - pPF = glb.lpPF; - - // Cache colour bits from display format - _BitsFromDisplayFormat(d3ddm.Format, &cColorBits, &cRedBits, &cGreenBits, &cBlueBits, &cAlphaBits); - - // - // Add single-buffer formats - // - - // Single-buffer, no depth-stencil buffer -/* memcpy(pPF, &pfTemplateHW, sizeof(DGL_pixelFormat)); - pPF->pfd.dwFlags &= ~PFD_DOUBLEBUFFER; // Remove doublebuffer flag - pPF->pfd.cColorBits = cColorBits; - pPF->pfd.cRedBits = cRedBits; - pPF->pfd.cGreenBits = cGreenBits; - pPF->pfd.cBlueBits = cBlueBits; - pPF->pfd.cAlphaBits = cAlphaBits; - pPF->pfd.cDepthBits = 0; - pPF->pfd.cStencilBits = 0; - pPF->dwDriverData = D3DFMT_UNKNOWN; - pPF++;*/ - - for (i=0; ipfd.dwFlags &= ~PFD_DOUBLEBUFFER; // Remove doublebuffer flag - pPF->pfd.cColorBits = cColorBits; - pPF->pfd.cRedBits = cRedBits; - pPF->pfd.cGreenBits = cGreenBits; - pPF->pfd.cBlueBits = cBlueBits; - pPF->pfd.cAlphaBits = cAlphaBits; - _BitsFromDepthStencilFormat(fmt[i], &pPF->pfd.cDepthBits, &pPF->pfd.cStencilBits); - pPF->dwDriverData = fmt[i]; - } - - // - // Add double-buffer formats - // - -/* memcpy(pPF, &pfTemplateHW, sizeof(DGL_pixelFormat)); - pPF->pfd.cColorBits = cColorBits; - pPF->pfd.cRedBits = cRedBits; - pPF->pfd.cGreenBits = cGreenBits; - pPF->pfd.cBlueBits = cBlueBits; - pPF->pfd.cAlphaBits = cAlphaBits; - pPF->pfd.cDepthBits = 0; - pPF->pfd.cStencilBits = 0; - pPF->dwDriverData = D3DFMT_UNKNOWN; - pPF++;*/ - - for (i=0; ipfd.cColorBits = cColorBits; - pPF->pfd.cRedBits = cRedBits; - pPF->pfd.cGreenBits = cGreenBits; - pPF->pfd.cBlueBits = cBlueBits; - pPF->pfd.cAlphaBits = cAlphaBits; - _BitsFromDepthStencilFormat(fmt[i], &pPF->pfd.cDepthBits, &pPF->pfd.cStencilBits); - pPF->dwDriverData = fmt[i]; - } - - // Popup warning message if non RGB color mode - { - // This is a hack. KeithH - HDC hdcDesktop = GetDC(NULL); - DWORD dwDisplayBitDepth = GetDeviceCaps(hdcDesktop, BITSPIXEL); - ReleaseDC(0, hdcDesktop); - if (dwDisplayBitDepth <= 8) { - ddlogPrintf(DDLOG_WARN, "Current Color Depth %d bpp is not supported", dwDisplayBitDepth); - MessageBox(NULL, szColorDepthWarning, "GLDirect", MB_OK | MB_ICONWARNING); - } - } - - // Mark list as 'current' - glb.bPixelformatsDirty = FALSE; - - return TRUE; -} - -//--------------------------------------------------------------------------- - -BOOL gldInitialiseMesa_DX( - DGL_ctx *lpCtx) -{ - GLD_driver_dx8 *gld = NULL; - int MaxTextureSize, TextureLevels; - BOOL bSoftwareTnL; - - if (lpCtx == NULL) - return FALSE; - - gld = lpCtx->glPriv; - if (gld == NULL) - return FALSE; - - if (glb.bMultitexture) { - lpCtx->glCtx->Const.MaxTextureUnits = gld->d3dCaps8.MaxSimultaneousTextures; - // Only support MAX_TEXTURE_UNITS texture units. - // ** If this is altered then the FVF formats must be reviewed **. - if (lpCtx->glCtx->Const.MaxTextureUnits > GLD_MAX_TEXTURE_UNITS_DX8) - lpCtx->glCtx->Const.MaxTextureUnits = GLD_MAX_TEXTURE_UNITS_DX8; - } else { - // Multitexture override - lpCtx->glCtx->Const.MaxTextureUnits = 1; - } - - // max texture size - MaxTextureSize = min(gld->d3dCaps8.MaxTextureHeight, gld->d3dCaps8.MaxTextureWidth); - if (MaxTextureSize == 0) - MaxTextureSize = 256; // Sanity check - - // - // HACK!! - if (MaxTextureSize > 1024) - MaxTextureSize = 1024; // HACK - CLAMP TO 1024 - // HACK!! - // - - // Got to set MAX_TEXTURE_SIZE as max levels. - // Who thought this stupid idea up? ;) - TextureLevels = 0; - // Calculate power-of-two. - while (MaxTextureSize) { - TextureLevels++; - MaxTextureSize >>= 1; - } - lpCtx->glCtx->Const.MaxTextureLevels = (TextureLevels) ? TextureLevels : 8; - - IDirect3DDevice8_SetRenderState(gld->pDev, D3DRS_LIGHTING, FALSE); - IDirect3DDevice8_SetRenderState(gld->pDev, D3DRS_CULLMODE, D3DCULL_NONE); - IDirect3DDevice8_SetRenderState(gld->pDev, D3DRS_DITHERENABLE, TRUE); - IDirect3DDevice8_SetRenderState(gld->pDev, D3DRS_SHADEMODE, D3DSHADE_GOURAUD); - - IDirect3DDevice8_SetRenderState(gld->pDev, D3DRS_ZENABLE, - (lpCtx->lpPF->dwDriverData!=D3DFMT_UNKNOWN) ? D3DZB_TRUE : D3DZB_FALSE); - - // Set the view matrix - { - D3DXMATRIX vm; -#if 1 - D3DXMatrixIdentity(&vm); -#else - D3DXVECTOR3 Eye(0.0f, 0.0f, 0.0f); - D3DXVECTOR3 At(0.0f, 0.0f, -1.0f); - D3DXVECTOR3 Up(0.0f, 1.0f, 0.0f); - D3DXMatrixLookAtRH(&vm, &Eye, &At, &Up); - vm._31 = -vm._31; - vm._32 = -vm._32; - vm._33 = -vm._33; - vm._34 = -vm._34; -#endif - IDirect3DDevice8_SetTransform(gld->pDev, D3DTS_VIEW, &vm); - } - - if (gld->bHasHWTnL) { - if (glb.dwTnL == GLDS_TNL_DEFAULT) - bSoftwareTnL = FALSE; // HW TnL - else { - bSoftwareTnL = ((glb.dwTnL == GLDS_TNL_MESA) || (glb.dwTnL == GLDS_TNL_D3DSW)) ? TRUE : FALSE; - } - } else { - // No HW TnL, so no choice possible - bSoftwareTnL = TRUE; - } - IDirect3DDevice8_SetRenderState(gld->pDev, D3DRS_SOFTWAREVERTEXPROCESSING, bSoftwareTnL); - -// Dump this in a Release build as well, now. -//#ifdef _DEBUG - ddlogPrintf(DDLOG_INFO, "HW TnL: %s", - gld->bHasHWTnL ? (bSoftwareTnL ? "Disabled" : "Enabled") : "Unavailable"); -//#endif - - gldEnableExtensions_DX8(lpCtx->glCtx); - gldInstallPipeline_DX8(lpCtx->glCtx); - gldSetupDriverPointers_DX8(lpCtx->glCtx); - - // Signal a complete state update - lpCtx->glCtx->Driver.UpdateState(lpCtx->glCtx, _NEW_ALL); - - // Start a scene - IDirect3DDevice8_BeginScene(gld->pDev); - lpCtx->bSceneStarted = TRUE; - - return TRUE; -} - -//--------------------------------------------------------------------------- - -BOOL gldSwapBuffers_DX( - DGL_ctx *ctx, - HDC hDC, - HWND hWnd) -{ - HRESULT hr; - GLD_driver_dx8 *gld = NULL; - - if (ctx == NULL) - return FALSE; - - gld = ctx->glPriv; - if (gld == NULL) - return FALSE; - - if (ctx->bSceneStarted) { - IDirect3DDevice8_EndScene(gld->pDev); - ctx->bSceneStarted = FALSE; - } - - // Swap the buffers. hWnd may override the hWnd used for CreateDevice() - hr = IDirect3DDevice8_Present(gld->pDev, NULL, NULL, hWnd, NULL); - - IDirect3DDevice8_BeginScene(gld->pDev); - ctx->bSceneStarted = TRUE; - - return (FAILED(hr)) ? FALSE : TRUE; -} - -//--------------------------------------------------------------------------- - -BOOL gldGetDisplayMode_DX( - DGL_ctx *ctx, - GLD_displayMode *glddm) -{ - D3DDISPLAYMODE d3ddm; - HRESULT hr; - GLD_driver_dx8 *lpCtx = NULL; - BYTE cColorBits, cRedBits, cGreenBits, cBlueBits, cAlphaBits; - - if ((glddm == NULL) || (ctx == NULL)) - return FALSE; - - lpCtx = ctx->glPriv; - if (lpCtx == NULL) - return FALSE; - - if (lpCtx->pD3D == NULL) - return FALSE; - - hr = IDirect3D8_GetAdapterDisplayMode(lpCtx->pD3D, glb.dwAdapter, &d3ddm); - if (FAILED(hr)) - return FALSE; - - // Get info from the display format - _BitsFromDisplayFormat(d3ddm.Format, - &cColorBits, &cRedBits, &cGreenBits, &cBlueBits, &cAlphaBits); - - glddm->Width = d3ddm.Width; - glddm->Height = d3ddm.Height; - glddm->BPP = cColorBits; - glddm->Refresh = d3ddm.RefreshRate; - - return TRUE; -} - -//--------------------------------------------------------------------------- - diff --git a/src/mesa/drivers/windows/gldirect/dx9/gld_driver_dx9.c b/src/mesa/drivers/windows/gldirect/dx9/gld_driver_dx9.c deleted file mode 100644 index c191564d6e..0000000000 --- a/src/mesa/drivers/windows/gldirect/dx9/gld_driver_dx9.c +++ /dev/null @@ -1,1206 +0,0 @@ -/**************************************************************************** -* -* Mesa 3-D graphics library -* Direct3D Driver Interface -* -* ======================================================================== -* -* Copyright (C) 1991-2004 SciTech Software, Inc. All rights reserved. -* -* Permission is hereby granted, free of charge, to any person obtaining a -* copy of this software and associated documentation files (the "Software"), -* to deal in the Software without restriction, including without limitation -* the rights to use, copy, modify, merge, publish, distribute, sublicense, -* and/or sell copies of the Software, and to permit persons to whom the -* Software is furnished to do so, subject to the following conditions: -* -* The above copyright notice and this permission notice shall be included -* in all copies or substantial portions of the Software. -* -* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -* SCITECH SOFTWARE INC BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF -* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -* SOFTWARE. -* -* ====================================================================== -* -* Language: ANSI C -* Environment: Windows 9x/2000/XP/XBox (Win32) -* -* Description: Driver interface code to Mesa -* -****************************************************************************/ - -//#include -#include "dglcontext.h" -#include "ddlog.h" -#include "gld_dx9.h" - -#include "glheader.h" -#include "context.h" -#include "colormac.h" -#include "depth.h" -#include "extensions.h" -#include "macros.h" -#include "matrix.h" -// #include "mem.h" -//#include "mmath.h" -#include "mtypes.h" -#include "texformat.h" -#include "teximage.h" -#include "texstore.h" -#include "vbo/vbo.h" -#include "swrast_setup/swrast_setup.h" -#include "swrast_setup/ss_context.h" -#include "tnl/tnl.h" -#include "tnl/t_context.h" -#include "tnl/t_pipeline.h" - -extern BOOL dglSwapBuffers(HDC hDC); - -// HACK: Hack the _33 member of the OpenGL perspective projection matrix -const float _fPersp_33 = 1.6f; - -//--------------------------------------------------------------------------- -// Internal functions -//--------------------------------------------------------------------------- - -void _gld_mesa_warning( - __GLcontext *gc, - char *str) -{ - // Intercept Mesa's internal warning mechanism - gldLogPrintf(GLDLOG_WARN, "Mesa warning: %s", str); -} - -//--------------------------------------------------------------------------- - -void _gld_mesa_fatal( - __GLcontext *gc, - char *str) -{ - // Intercept Mesa's internal fatal-message mechanism - gldLogPrintf(GLDLOG_CRITICAL, "Mesa FATAL: %s", str); - - // Mesa calls abort(0) here. - ddlogClose(); - exit(0); -} - -//--------------------------------------------------------------------------- - -D3DSTENCILOP _gldConvertStencilOp( - GLenum StencilOp) -{ - // Used by Stencil: pass, fail and zfail - - switch (StencilOp) { - case GL_KEEP: - return D3DSTENCILOP_KEEP; - case GL_ZERO: - return D3DSTENCILOP_ZERO; - case GL_REPLACE: - return D3DSTENCILOP_REPLACE; - case GL_INCR: - return D3DSTENCILOP_INCRSAT; - case GL_DECR: - return D3DSTENCILOP_DECRSAT; - case GL_INVERT: - return D3DSTENCILOP_INVERT; - case GL_INCR_WRAP_EXT: // GL_EXT_stencil_wrap - return D3DSTENCILOP_INCR; - case GL_DECR_WRAP_EXT: // GL_EXT_stencil_wrap - return D3DSTENCILOP_DECR; - } - -#ifdef _DEBUG - gldLogMessage(GLDLOG_ERROR, "_gldConvertStencilOp: Unknown StencilOp\n"); -#endif - - return D3DSTENCILOP_KEEP; -} - -//--------------------------------------------------------------------------- - -D3DCMPFUNC _gldConvertCompareFunc( - GLenum CmpFunc) -{ - // Used for Alpha func, depth func and stencil func. - - switch (CmpFunc) { - case GL_NEVER: - return D3DCMP_NEVER; - case GL_LESS: - return D3DCMP_LESS; - case GL_EQUAL: - return D3DCMP_EQUAL; - case GL_LEQUAL: - return D3DCMP_LESSEQUAL; - case GL_GREATER: - return D3DCMP_GREATER; - case GL_NOTEQUAL: - return D3DCMP_NOTEQUAL; - case GL_GEQUAL: - return D3DCMP_GREATEREQUAL; - case GL_ALWAYS: - return D3DCMP_ALWAYS; - }; - -#ifdef _DEBUG - gldLogMessage(GLDLOG_ERROR, "_gldConvertCompareFunc: Unknown CompareFunc\n"); -#endif - - return D3DCMP_ALWAYS; -} - -//--------------------------------------------------------------------------- - -D3DBLEND _gldConvertBlendFunc( - GLenum blend, - GLenum DefaultBlend) -{ - switch (blend) { - case GL_ZERO: - return D3DBLEND_ZERO; - case GL_ONE: - return D3DBLEND_ONE; - case GL_DST_COLOR: - return D3DBLEND_DESTCOLOR; - case GL_SRC_COLOR: - return D3DBLEND_SRCCOLOR; - case GL_ONE_MINUS_DST_COLOR: - return D3DBLEND_INVDESTCOLOR; - case GL_ONE_MINUS_SRC_COLOR: - return D3DBLEND_INVSRCCOLOR; - case GL_SRC_ALPHA: - return D3DBLEND_SRCALPHA; - case GL_ONE_MINUS_SRC_ALPHA: - return D3DBLEND_INVSRCALPHA; - case GL_DST_ALPHA: - return D3DBLEND_DESTALPHA; - case GL_ONE_MINUS_DST_ALPHA: - return D3DBLEND_INVDESTALPHA; - case GL_SRC_ALPHA_SATURATE: - return D3DBLEND_SRCALPHASAT; - } - -#ifdef _DEBUG - gldLogMessage(GLDLOG_ERROR, "_gldConvertBlendFunc: Unknown BlendFunc\n"); -#endif - - return DefaultBlend; -} - -//--------------------------------------------------------------------------- -// Misc. functions -//--------------------------------------------------------------------------- - -void gld_Noop_DX9( - GLcontext *ctx) -{ -#ifdef _DEBUG - gldLogMessage(GLDLOG_ERROR, "gld_Noop called!\n"); -#endif -} - -//--------------------------------------------------------------------------- - -void gld_Error_DX9( - GLcontext *ctx) -{ -#ifdef _DEBUG - // Quite useless. -// gldLogMessage(GLDLOG_ERROR, "ctx->Driver.Error called!\n"); -#endif -} - -//--------------------------------------------------------------------------- -// Required Mesa functions -//--------------------------------------------------------------------------- - -static GLboolean gld_set_draw_buffer_DX9( - GLcontext *ctx, - GLenum mode) -{ - (void) ctx; - if ((mode==GL_FRONT_LEFT) || (mode == GL_BACK_LEFT)) { - return GL_TRUE; - } - else { - return GL_FALSE; - } -} - -//--------------------------------------------------------------------------- - -static void gld_set_read_buffer_DX9( - GLcontext *ctx, - GLframebuffer *buffer, - GLenum mode) -{ - /* separate read buffer not supported */ -/* - ASSERT(buffer == ctx->DrawBuffer); - ASSERT(mode == GL_FRONT_LEFT); -*/ -} - -//--------------------------------------------------------------------------- - -void gld_Clear_DX9( - GLcontext *ctx, - GLbitfield mask, - GLboolean all, - GLint x, - GLint y, - GLint width, - GLint height) -{ - GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); - GLD_driver_dx9 *gld = GLD_GET_DX9_DRIVER(gldCtx); - - DWORD dwFlags = 0; - D3DCOLOR Color = 0; - float Z = 0.0f; - DWORD Stencil = 0; - D3DRECT d3dClearRect; - - // TODO: Colourmask - const GLuint *colorMask = (GLuint *) &ctx->Color.ColorMask; - - if (!gld->pDev) - return; - - if (mask & (DD_FRONT_LEFT_BIT | DD_BACK_LEFT_BIT)) { - GLubyte col[4]; - CLAMPED_FLOAT_TO_UBYTE(col[0], ctx->Color.ClearColor[0]); - CLAMPED_FLOAT_TO_UBYTE(col[1], ctx->Color.ClearColor[1]); - CLAMPED_FLOAT_TO_UBYTE(col[2], ctx->Color.ClearColor[2]); - CLAMPED_FLOAT_TO_UBYTE(col[3], ctx->Color.ClearColor[3]); - dwFlags |= D3DCLEAR_TARGET; - Color = D3DCOLOR_RGBA(col[0], col[1], col[2], col[3]); - } - - if (mask & DD_DEPTH_BIT) { - // D3D8 will fail the Clear call if we try and clear a - // depth buffer and we haven't created one. - // Also, some apps try and clear a depth buffer, - // when a depth buffer hasn't been requested by the app. - if (ctx->Visual.depthBits == 0) { - mask &= ~DD_DEPTH_BIT; // Remove depth bit from mask - } else { - dwFlags |= D3DCLEAR_ZBUFFER; - Z = ctx->Depth.Clear; - } - } - - if (mask & DD_STENCIL_BIT) { - if (ctx->Visual.stencilBits == 0) { - // No stencil bits in depth buffer - mask &= ~DD_STENCIL_BIT; // Remove stencil bit from mask - } else { - dwFlags |= D3DCLEAR_STENCIL; - Stencil = ctx->Stencil.Clear; - } - } - - // Some apps do really weird things with the rect, such as Quake3. - if ((x < 0) || (y < 0) || (width <= 0) || (height <= 0)) { - all = GL_TRUE; - } - - if (!all) { - // Calculate clear subrect - d3dClearRect.x1 = x; - d3dClearRect.y1 = gldCtx->dwHeight - (y + height); - d3dClearRect.x2 = x + width; - d3dClearRect.y2 = d3dClearRect.y1 + height; -// gldLogPrintf(GLDLOG_INFO, "Rect %d,%d %d,%d", x,y,width,height); - } - - // dwFlags will be zero if there's nothing to clear - if (dwFlags) { - _GLD_DX9_DEV(Clear( - gld->pDev, - all ? 0 : 1, - all ? NULL : &d3dClearRect, - dwFlags, - Color, Z, Stencil)); - } - - if (mask & DD_ACCUM_BIT) { - // Clear accumulation buffer - } -} - -//--------------------------------------------------------------------------- - -// Mesa 5: Parameter change -static void gld_buffer_size_DX9( -// GLcontext *ctx, - GLframebuffer *fb, - GLuint *width, - GLuint *height) -{ -// GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); - - *width = fb->Width; // gldCtx->dwWidth; - *height = fb->Height; // gldCtx->dwHeight; -} - -//--------------------------------------------------------------------------- - -static void gld_Finish_DX9( - GLcontext *ctx) -{ -} - -//--------------------------------------------------------------------------- - -static void gld_Flush_DX9( - GLcontext *ctx) -{ - GLD_context *gld = GLD_GET_CONTEXT(ctx); - - // TODO: Detect apps that glFlush() then SwapBuffers() ? - - if (gld->EmulateSingle) { - // Emulating a single-buffered context. - // [Direct3D doesn't allow rendering to front buffer] - dglSwapBuffers(gld->hDC); - } -} - -//--------------------------------------------------------------------------- - -void gld_NEW_STENCIL( - GLcontext *ctx) -{ - GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); - GLD_driver_dx9 *gld = GLD_GET_DX9_DRIVER(gldCtx); - - // Two-sided stencil. New for Mesa 5 - const GLuint uiFace = 0UL; - - struct gl_stencil_attrib *pStencil = &ctx->Stencil; - - _GLD_DX9_DEV(SetRenderState(gld->pDev, D3DRS_STENCILENABLE, pStencil->Enabled ? TRUE : FALSE)); - if (pStencil->Enabled) { - _GLD_DX9_DEV(SetRenderState(gld->pDev, D3DRS_STENCILFUNC, _gldConvertCompareFunc(pStencil->Function[uiFace]))); - _GLD_DX9_DEV(SetRenderState(gld->pDev, D3DRS_STENCILREF, pStencil->Ref[uiFace])); - _GLD_DX9_DEV(SetRenderState(gld->pDev, D3DRS_STENCILMASK, pStencil->ValueMask[uiFace])); - _GLD_DX9_DEV(SetRenderState(gld->pDev, D3DRS_STENCILWRITEMASK, pStencil->WriteMask[uiFace])); - _GLD_DX9_DEV(SetRenderState(gld->pDev, D3DRS_STENCILFAIL, _gldConvertStencilOp(pStencil->FailFunc[uiFace]))); - _GLD_DX9_DEV(SetRenderState(gld->pDev, D3DRS_STENCILZFAIL, _gldConvertStencilOp(pStencil->ZFailFunc[uiFace]))); - _GLD_DX9_DEV(SetRenderState(gld->pDev, D3DRS_STENCILPASS, _gldConvertStencilOp(pStencil->ZPassFunc[uiFace]))); - } -} - -//--------------------------------------------------------------------------- - -void gld_NEW_COLOR( - GLcontext *ctx) -{ - GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); - GLD_driver_dx9 *gld = GLD_GET_DX9_DRIVER(gldCtx); - - DWORD dwFlags = 0; - D3DBLEND src; - D3DBLEND dest; - - // Alpha func - _GLD_DX9_DEV(SetRenderState(gld->pDev, D3DRS_ALPHAFUNC, _gldConvertCompareFunc(ctx->Color.AlphaFunc))); - _GLD_DX9_DEV(SetRenderState(gld->pDev, D3DRS_ALPHAREF, (DWORD)ctx->Color.AlphaRef)); - _GLD_DX9_DEV(SetRenderState(gld->pDev, D3DRS_ALPHATESTENABLE, ctx->Color.AlphaEnabled)); - - // Blend func - _GLD_DX9_DEV(SetRenderState(gld->pDev, D3DRS_ALPHABLENDENABLE, ctx->Color.BlendEnabled)); - src = _gldConvertBlendFunc(ctx->Color.BlendSrcRGB, GL_ONE); - dest = _gldConvertBlendFunc(ctx->Color.BlendDstRGB, GL_ZERO); - _GLD_DX9_DEV(SetRenderState(gld->pDev, D3DRS_SRCBLEND, src)); - _GLD_DX9_DEV(SetRenderState(gld->pDev, D3DRS_DESTBLEND, dest)); - - // Color mask - if (ctx->Color.ColorMask[0]) dwFlags |= D3DCOLORWRITEENABLE_RED; - if (ctx->Color.ColorMask[1]) dwFlags |= D3DCOLORWRITEENABLE_GREEN; - if (ctx->Color.ColorMask[2]) dwFlags |= D3DCOLORWRITEENABLE_BLUE; - if (ctx->Color.ColorMask[3]) dwFlags |= D3DCOLORWRITEENABLE_ALPHA; - _GLD_DX9_DEV(SetRenderState(gld->pDev, D3DRS_COLORWRITEENABLE, dwFlags)); -} - -//--------------------------------------------------------------------------- - -void gld_NEW_DEPTH( - GLcontext *ctx) -{ - GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); - GLD_driver_dx9 *gld = GLD_GET_DX9_DRIVER(gldCtx); - - _GLD_DX9_DEV(SetRenderState(gld->pDev, D3DRS_ZENABLE, ctx->Depth.Test ? D3DZB_TRUE : D3DZB_FALSE)); - _GLD_DX9_DEV(SetRenderState(gld->pDev, D3DRS_ZFUNC, _gldConvertCompareFunc(ctx->Depth.Func))); - _GLD_DX9_DEV(SetRenderState(gld->pDev, D3DRS_ZWRITEENABLE, ctx->Depth.Mask ? TRUE : FALSE)); -} - -//--------------------------------------------------------------------------- - -void gld_NEW_POLYGON( - GLcontext *ctx) -{ - GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); - GLD_driver_dx9 *gld = GLD_GET_DX9_DRIVER(gldCtx); - - D3DFILLMODE d3dFillMode = D3DFILL_SOLID; - D3DCULL d3dCullMode = D3DCULL_NONE; - float fOffset = 0; // Changed from int to float for DX9 - - // Fillmode - switch (ctx->Polygon.FrontMode) { - case GL_POINT: - d3dFillMode = D3DFILL_POINT; - break; - case GL_LINE: - d3dFillMode = D3DFILL_WIREFRAME; - break; - case GL_FILL: - d3dFillMode = D3DFILL_SOLID; - break; - } - _GLD_DX9_DEV(SetRenderState(gld->pDev, D3DRS_FILLMODE, d3dFillMode)); - - if (ctx->Polygon.CullFlag) { - switch (ctx->Polygon.CullFaceMode) { - case GL_BACK: - if (ctx->Polygon.FrontFace == GL_CCW) - d3dCullMode = D3DCULL_CW; - else - d3dCullMode = D3DCULL_CCW; - break; - case GL_FRONT: - if (ctx->Polygon.FrontFace == GL_CCW) - d3dCullMode = D3DCULL_CCW; - else - d3dCullMode = D3DCULL_CW; - break; - case GL_FRONT_AND_BACK: - d3dCullMode = D3DCULL_NONE; - break; - default: - break; - } - } else { - d3dCullMode = D3DCULL_NONE; - } -// d3dCullMode = D3DCULL_NONE; // FOR DEBUGGING - _GLD_DX9_DEV(SetRenderState(gld->pDev, D3DRS_CULLMODE, d3dCullMode)); - - // Polygon offset - // ZBIAS ranges from 0 to 16 and can only move towards the viewer - // Mesa5: ctx->Polygon._OffsetAny removed - if (ctx->Polygon.OffsetFill) { - fOffset = ctx->Polygon.OffsetUnits; -// if (iOffset < 0.0f) -// iOffset = -iOffset; -// else -// iOffset = 0.0f; // D3D can't push away - } - // NOTE: SetRenderState() required a DWORD, so need to cast - _GLD_DX9_DEV(SetRenderState(gld->pDev, D3DRS_DEPTHBIAS, *((DWORD*)&fOffset))); -} - -//--------------------------------------------------------------------------- - -void gld_NEW_FOG( - GLcontext *ctx) -{ - GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); - GLD_driver_dx9 *gld = GLD_GET_DX9_DRIVER(gldCtx); - - D3DCOLOR d3dFogColour; - D3DFOGMODE d3dFogMode = D3DFOG_LINEAR; - - // TODO: Fog is calculated seperately in the Mesa pipeline - _GLD_DX9_DEV(SetRenderState(gld->pDev, D3DRS_FOGENABLE, FALSE)); - return; - - // Fog enable - _GLD_DX9_DEV(SetRenderState(gld->pDev, D3DRS_FOGENABLE, ctx->Fog.Enabled)); - if (!ctx->Fog.Enabled) { - _GLD_DX9_DEV(SetRenderState(gld->pDev, D3DRS_FOGTABLEMODE, D3DFOG_NONE)); - _GLD_DX9_DEV(SetRenderState(gld->pDev, D3DRS_FOGVERTEXMODE, D3DFOG_NONE)); - return; // If disabled, don't bother setting any fog state - } - - // Fog colour - d3dFogColour = D3DCOLOR_COLORVALUE( ctx->Fog.Color[0], - ctx->Fog.Color[1], - ctx->Fog.Color[2], - ctx->Fog.Color[3]); - _GLD_DX9_DEV(SetRenderState(gld->pDev, D3DRS_FOGCOLOR, d3dFogColour)); - - // Fog density - _GLD_DX9_DEV(SetRenderState(gld->pDev, D3DRS_FOGDENSITY, *((DWORD*) (&ctx->Fog.Density)))); - - // Fog start - _GLD_DX9_DEV(SetRenderState(gld->pDev, D3DRS_FOGSTART, *((DWORD*) (&ctx->Fog.Start)))); - - // Fog end - _GLD_DX9_DEV(SetRenderState(gld->pDev, D3DRS_FOGEND, *((DWORD*) (&ctx->Fog.End)))); - - // Fog mode - switch (ctx->Fog.Mode) { - case GL_LINEAR: - d3dFogMode = D3DFOG_LINEAR; - break; - case GL_EXP: - d3dFogMode = D3DFOG_EXP; - break; - case GL_EXP2: - d3dFogMode = D3DFOG_EXP2; - break; - } - _GLD_DX9_DEV(SetRenderState(gld->pDev, D3DRS_FOGTABLEMODE, d3dFogMode)); - _GLD_DX9_DEV(SetRenderState(gld->pDev, D3DRS_FOGVERTEXMODE, D3DFOG_NONE)); -} - -//--------------------------------------------------------------------------- - -void gld_NEW_LIGHT( - GLcontext *ctx) -{ - GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); - GLD_driver_dx9 *gld = GLD_GET_DX9_DRIVER(gldCtx); - DWORD dwSpecularEnable; - - // Shademode - _GLD_DX9_DEV(SetRenderState(gld->pDev, D3DRS_SHADEMODE, (ctx->Light.ShadeModel == GL_SMOOTH) ? D3DSHADE_GOURAUD : D3DSHADE_FLAT)); - - // Separate specular colour - if (ctx->Light.Enabled) - dwSpecularEnable = (ctx->_TriangleCaps & DD_SEPARATE_SPECULAR) ? TRUE: FALSE; - else - dwSpecularEnable = FALSE; - _GLD_DX9_DEV(SetRenderState(gld->pDev, D3DRS_SPECULARENABLE, dwSpecularEnable)); -} - -//--------------------------------------------------------------------------- - -void gld_NEW_MODELVIEW( - GLcontext *ctx) -{ - GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); - GLD_driver_dx9 *gld = GLD_GET_DX9_DRIVER(gldCtx); - - D3DMATRIX m; - //GLfloat *pM = ctx->ModelView.m; - // Mesa5: Model-view is now a stack - GLfloat *pM = ctx->ModelviewMatrixStack.Top->m; - m._11 = pM[0]; - m._12 = pM[1]; - m._13 = pM[2]; - m._14 = pM[3]; - m._21 = pM[4]; - m._22 = pM[5]; - m._23 = pM[6]; - m._24 = pM[7]; - m._31 = pM[8]; - m._32 = pM[9]; - m._33 = pM[10]; - m._34 = pM[11]; - m._41 = pM[12]; - m._42 = pM[13]; - m._43 = pM[14]; - m._44 = pM[15]; - - gld->matModelView = m; -} - -//--------------------------------------------------------------------------- - -void gld_NEW_PROJECTION( - GLcontext *ctx) -{ - GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); - GLD_driver_dx9 *gld = GLD_GET_DX9_DRIVER(gldCtx); - - D3DMATRIX m; - //GLfloat *pM = ctx->ProjectionMatrix.m; - // Mesa 5: Now a stack - GLfloat *pM = ctx->ProjectionMatrixStack.Top->m; - m._11 = pM[0]; - m._12 = pM[1]; - m._13 = pM[2]; - m._14 = pM[3]; - - m._21 = pM[4]; - m._22 = pM[5]; - m._23 = pM[6]; - m._24 = pM[7]; - - m._31 = pM[8]; - m._32 = pM[9]; - m._33 = pM[10] / _fPersp_33; // / 1.6f; - m._34 = pM[11]; - - m._41 = pM[12]; - m._42 = pM[13]; - m._43 = pM[14] / 2.0f; - m._44 = pM[15]; - - gld->matProjection = m; -} - -//--------------------------------------------------------------------------- -/* -void gldFrustumHook_DX9( - GLdouble left, - GLdouble right, - GLdouble bottom, - GLdouble top, - GLdouble nearval, - GLdouble farval) -{ - GET_CURRENT_CONTEXT(ctx); - GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); - GLD_driver_dx9 *gld = GLD_GET_DX9_DRIVER(gldCtx); - - // Pass values on to Mesa first (in case we mess with them) - _mesa_Frustum(left, right, bottom, top, nearval, farval); - - _fPersp_33 = farval / (nearval - farval); - -// ddlogPrintf(GLDLOG_SYSTEM, "Frustum: %f", farval/nearval); -} - -//--------------------------------------------------------------------------- - -void gldOrthoHook_DX9( - GLdouble left, - GLdouble right, - GLdouble bottom, - GLdouble top, - GLdouble nearval, - GLdouble farval) -{ - GET_CURRENT_CONTEXT(ctx); - GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); - GLD_driver_dx9 *gld = GLD_GET_DX9_DRIVER(gldCtx); - - // Pass values on to Mesa first (in case we mess with them) - _mesa_Ortho(left, right, bottom, top, nearval, farval); - - _fPersp_33 = 1.6f; - -// ddlogPrintf(GLDLOG_SYSTEM, "Ortho: %f", farval/nearval); -} -*/ -//--------------------------------------------------------------------------- - -void gld_NEW_VIEWPORT( - GLcontext *ctx) -{ - GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); - GLD_driver_dx9 *gld = GLD_GET_DX9_DRIVER(gldCtx); - - D3DVIEWPORT9 d3dvp; -// GLint x, y; -// GLsizei w, h; - - // Set depth range - _GLD_DX9_DEV(GetViewport(gld->pDev, &d3dvp)); - // D3D can't do Quake1/Quake2 z-trick - if (ctx->Viewport.Near <= ctx->Viewport.Far) { - d3dvp.MinZ = ctx->Viewport.Near; - d3dvp.MaxZ = ctx->Viewport.Far; - } else { - d3dvp.MinZ = ctx->Viewport.Far; - d3dvp.MaxZ = ctx->Viewport.Near; - } -/* x = ctx->Viewport.X; - y = ctx->Viewport.Y; - w = ctx->Viewport.Width; - h = ctx->Viewport.Height; - if (x < 0) x = 0; - if (y < 0) y = 0; - if (w > gldCtx->dwWidth) w = gldCtx->dwWidth; - if (h > gldCtx->dwHeight) h = gldCtx->dwHeight; - // Ditto for D3D viewport dimensions - if (w+x > gldCtx->dwWidth) w = gldCtx->dwWidth-x; - if (h+y > gldCtx->dwHeight) h = gldCtx->dwHeight-y; - d3dvp.X = x; - d3dvp.Y = gldCtx->dwHeight - (y + h); - d3dvp.Width = w; - d3dvp.Height = h;*/ - _GLD_DX9_DEV(SetViewport(gld->pDev, &d3dvp)); - -// gld->fFlipWindowY = (float)gldCtx->dwHeight; -} - -//--------------------------------------------------------------------------- - -void gld_NEW_SCISSOR( - GLcontext *ctx) -{ - GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); - GLD_driver_dx9 *gld = GLD_GET_DX9_DRIVER(gldCtx); - - // Bail if IHV driver cannot scissor - if (!gld->bCanScissor) - return; - - // Set scissor rect - if (ctx->Scissor.Enabled) { - RECT rcRect; - // Keep in mind that RECT's need an extra row and column - rcRect.left = ctx->Scissor.X; - rcRect.right = ctx->Scissor.X + ctx->Scissor.Width; // + 1; - rcRect.top = gldCtx->dwHeight - (ctx->Scissor.Y + ctx->Scissor.Height); - rcRect.bottom = rcRect.top + ctx->Scissor.Height; - IDirect3DDevice9_SetScissorRect(gld->pDev, &rcRect); - } - - // Enable/disable scissor as required - _GLD_DX9_DEV(SetRenderState(gld->pDev, D3DRS_SCISSORTESTENABLE, ctx->Scissor.Enabled)); -} - -//--------------------------------------------------------------------------- - -__inline BOOL _gldAnyEvalEnabled( - GLcontext *ctx) -{ - struct gl_eval_attrib *eval = &ctx->Eval; - - if ((eval->AutoNormal) || - (eval->Map1Color4) || - (eval->Map1Index) || - (eval->Map1Normal) || - (eval->Map1TextureCoord1) || - (eval->Map1TextureCoord2) || - (eval->Map1TextureCoord3) || - (eval->Map1TextureCoord4) || - (eval->Map1Vertex3) || - (eval->Map1Vertex4) || - (eval->Map2Color4) || - (eval->Map2Index) || - (eval->Map2Normal) || - (eval->Map2TextureCoord1) || - (eval->Map2TextureCoord2) || - (eval->Map2TextureCoord3) || - (eval->Map2TextureCoord4) || - (eval->Map2Vertex3) || - (eval->Map2Vertex4) - ) - return TRUE; - - return FALSE; -} - -//--------------------------------------------------------------------------- - -BOOL _gldChooseInternalPipeline( - GLcontext *ctx, - GLD_driver_dx9 *gld) -{ -// return TRUE; // DEBUGGING: ALWAYS USE MESA -// return FALSE; // DEBUGGING: ALWAYS USE D3D - - if ((glb.dwTnL == GLDS_TNL_MESA) || (gld->bHasHWTnL == FALSE)) - { - gld->PipelineUsage.qwMesa.QuadPart++; - return TRUE; // Force Mesa TnL - } - - if ((ctx->Light.Enabled) || - (1) || - (ctx->Texture._TexGenEnabled) || - (ctx->Texture._TexMatEnabled) || -// (ctx->Transform._AnyClip) || - (ctx->Scissor.Enabled) || - _gldAnyEvalEnabled(ctx) // Put this last so we can early-out - ) - { - gld->PipelineUsage.qwMesa.QuadPart++; - return TRUE; - } - - gld->PipelineUsage.qwD3DFVF.QuadPart++; - return FALSE; - -/* // Force Mesa pipeline? - if (glb.dwTnL == GLDS_TNL_MESA) { - gld->PipelineUsage.dwMesa.QuadPart++; - return GLD_PIPELINE_MESA; - } - - // Test for functionality not exposed in the D3D pathways - if ((ctx->Texture._GenFlags)) { - gld->PipelineUsage.dwMesa.QuadPart++; - return GLD_PIPELINE_MESA; - } - - // Now decide if vertex shader can be used. - // If two sided lighting is enabled then we must either - // use Mesa TnL or the vertex shader - if (ctx->_TriangleCaps & DD_TRI_LIGHT_TWOSIDE) { - if (gld->VStwosidelight.hShader && !ctx->Fog.Enabled) { - // Use Vertex Shader - gld->PipelineUsage.dwD3D2SVS.QuadPart++; - return GLD_PIPELINE_D3D_VS_TWOSIDE; - } else { - // Use Mesa TnL - gld->PipelineUsage.dwMesa.QuadPart++; - return GLD_PIPELINE_MESA; - } - } - - // Must be D3D fixed-function pipeline - gld->PipelineUsage.dwD3DFVF.QuadPart++; - return GLD_PIPELINE_D3D_FVF; -*/ -} - -//--------------------------------------------------------------------------- - -void gld_update_state_DX9( - GLcontext *ctx, - GLuint new_state) -{ - GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); - GLD_driver_dx9 *gld = GLD_GET_DX9_DRIVER(gldCtx); - TNLcontext *tnl = TNL_CONTEXT(ctx); - GLD_pb_dx9 *gldPB; - - if (!gld || !gld->pDev) - return; - - _swsetup_InvalidateState( ctx, new_state ); - _vbo_InvalidateState( ctx, new_state ); - _tnl_InvalidateState( ctx, new_state ); - - // SetupIndex will be used in the pipelines for choosing setup function - if ((ctx->_TriangleCaps & (DD_TRI_LIGHT_TWOSIDE | DD_SEPARATE_SPECULAR)) || - (ctx->Fog.Enabled)) - { - if (ctx->_TriangleCaps & DD_FLATSHADE) - gld->iSetupFunc = GLD_SI_FLAT_EXTRAS; - else - gld->iSetupFunc = GLD_SI_SMOOTH_EXTRAS; - } else { - if (ctx->_TriangleCaps & DD_FLATSHADE) - gld->iSetupFunc = GLD_SI_FLAT; // Setup flat shade + texture - else - gld->iSetupFunc = GLD_SI_SMOOTH; // Setup smooth shade + texture - } - - gld->bUseMesaTnL = _gldChooseInternalPipeline(ctx, gld); - if (gld->bUseMesaTnL) { - gldPB = &gld->PB2d; - _GLD_DX9_DEV(SetSoftwareVertexProcessing(gld->pDev, TRUE)); - _GLD_DX9_DEV(SetRenderState(gld->pDev, D3DRS_CLIPPING, FALSE)); - _GLD_DX9_DEV(SetVertexShader(gld->pDev, NULL)); - _GLD_DX9_DEV(SetFVF(gld->pDev, gldPB->dwFVF)); - } else { - gldPB = &gld->PB3d; - _GLD_DX9_DEV(SetRenderState(gld->pDev, D3DRS_CLIPPING, TRUE)); -// if (gld->TnLPipeline == GLD_PIPELINE_D3D_VS_TWOSIDE) { -// _GLD_DX9_DEV(SetRenderState(gld->pDev, D3DRS_SOFTWAREVERTEXPROCESSING, !gld->VStwosidelight.bHardware)); -// _GLD_DX9_DEV(SetVertexShader(gld->pDev, gld->VStwosidelight.hShader)); -// } else { -// _GLD_DX9_DEV(SetRenderState(gld->pDev, D3DRS_SOFTWAREVERTEXPROCESSING, !gld->bHasHWTnL)); - _GLD_DX9_DEV(SetSoftwareVertexProcessing(gld->pDev, !gld->bHasHWTnL)); - _GLD_DX9_DEV(SetVertexShader(gld->pDev, NULL)); - _GLD_DX9_DEV(SetFVF(gld->pDev, gldPB->dwFVF)); -// } - } - -#define _GLD_TEST_STATE(a) \ - if (new_state & (a)) { \ - gld##a(ctx); \ - new_state &= ~(a); \ - } - -#define _GLD_TEST_STATE_DX9(a) \ - if (new_state & (a)) { \ - gld##a##_DX9(ctx); \ - new_state &= ~(a); \ - } - -#define _GLD_IGNORE_STATE(a) new_state &= ~(a); - -// if (!gld->bUseMesaTnL) { - // Not required if Mesa is doing the TnL. - // Problem: If gld->bUseMesaTnL is TRUE when these are signaled, - // then we'll miss updating the D3D TnL pipeline. - // Therefore, don't test for gld->bUseMesaTnL - _GLD_TEST_STATE(_NEW_MODELVIEW); - _GLD_TEST_STATE(_NEW_PROJECTION); -// } - - _GLD_TEST_STATE_DX9(_NEW_TEXTURE); // extern, so guard with _DX9 - _GLD_TEST_STATE(_NEW_COLOR); - _GLD_TEST_STATE(_NEW_DEPTH); - _GLD_TEST_STATE(_NEW_POLYGON); - _GLD_TEST_STATE(_NEW_STENCIL); - _GLD_TEST_STATE(_NEW_FOG); - _GLD_TEST_STATE(_NEW_LIGHT); - _GLD_TEST_STATE(_NEW_VIEWPORT); - - _GLD_IGNORE_STATE(_NEW_TRANSFORM); - - // Scissor Test: New for DX9 - _GLD_TEST_STATE(_NEW_SCISSOR); - -// Stubs for future use. -/* _GLD_TEST_STATE(_NEW_TEXTURE_MATRIX); - _GLD_TEST_STATE(_NEW_COLOR_MATRIX); - _GLD_TEST_STATE(_NEW_ACCUM); - _GLD_TEST_STATE(_NEW_EVAL); - _GLD_TEST_STATE(_NEW_HINT); - _GLD_TEST_STATE(_NEW_LINE); - _GLD_TEST_STATE(_NEW_PIXEL); - _GLD_TEST_STATE(_NEW_POINT); - _GLD_TEST_STATE(_NEW_POLYGONSTIPPLE); - _GLD_TEST_STATE(_NEW_PACKUNPACK); - _GLD_TEST_STATE(_NEW_ARRAY); - _GLD_TEST_STATE(_NEW_RENDERMODE); - _GLD_TEST_STATE(_NEW_BUFFERS); - _GLD_TEST_STATE(_NEW_MULTISAMPLE); -*/ - -// For debugging. -#if 0 -#define _GLD_TEST_UNHANDLED_STATE(a) \ - if (new_state & (a)) { \ - gldLogMessage(GLDLOG_ERROR, "Unhandled " #a "\n"); \ - } - _GLD_TEST_UNHANDLED_STATE(_NEW_TEXTURE_MATRIX); - _GLD_TEST_UNHANDLED_STATE(_NEW_COLOR_MATRIX); - _GLD_TEST_UNHANDLED_STATE(_NEW_ACCUM); - _GLD_TEST_UNHANDLED_STATE(_NEW_EVAL); - _GLD_TEST_UNHANDLED_STATE(_NEW_HINT); - _GLD_TEST_UNHANDLED_STATE(_NEW_LINE); - _GLD_TEST_UNHANDLED_STATE(_NEW_PIXEL); - _GLD_TEST_UNHANDLED_STATE(_NEW_POINT); - _GLD_TEST_UNHANDLED_STATE(_NEW_POLYGONSTIPPLE); -// _GLD_TEST_UNHANDLED_STATE(_NEW_SCISSOR); - _GLD_TEST_UNHANDLED_STATE(_NEW_PACKUNPACK); - _GLD_TEST_UNHANDLED_STATE(_NEW_ARRAY); - _GLD_TEST_UNHANDLED_STATE(_NEW_RENDERMODE); - _GLD_TEST_UNHANDLED_STATE(_NEW_BUFFERS); - _GLD_TEST_UNHANDLED_STATE(_NEW_MULTISAMPLE); -#undef _GLD_UNHANDLED_STATE -#endif - -#undef _GLD_TEST_STATE -} - -//--------------------------------------------------------------------------- -// Viewport -//--------------------------------------------------------------------------- - -void gld_Viewport_DX9( - GLcontext *ctx, - GLint x, - GLint y, - GLsizei w, - GLsizei h) -{ - GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); - GLD_driver_dx9 *gld = GLD_GET_DX9_DRIVER(gldCtx); - - D3DVIEWPORT9 d3dvp; - - if (!gld || !gld->pDev) - return; - - // This is a hack. When the app is minimized, Mesa passes - // w=1 and h=1 for viewport dimensions. Without this test - // we get a GPF in gld_wgl_resize_buffers(). - if ((w==1) && (h==1)) - return; - - // Call ResizeBuffersMESA. This function will early-out - // if no resize is needed. - //ctx->Driver.ResizeBuffersMESA(ctx); - // Mesa 5: Changed parameters - ctx->Driver.ResizeBuffers(gldCtx->glBuffer); - -#if 0 - ddlogPrintf(GLDLOG_SYSTEM, ">> Viewport x=%d y=%d w=%d h=%d", x,y,w,h); -#endif - - // ** D3D viewport must not be outside the render target surface ** - // Sanity check the GL viewport dimensions - if (x < 0) x = 0; - if (y < 0) y = 0; - if (w > gldCtx->dwWidth) w = gldCtx->dwWidth; - if (h > gldCtx->dwHeight) h = gldCtx->dwHeight; - // Ditto for D3D viewport dimensions - if (w+x > gldCtx->dwWidth) w = gldCtx->dwWidth-x; - if (h+y > gldCtx->dwHeight) h = gldCtx->dwHeight-y; - - d3dvp.X = x; - d3dvp.Y = gldCtx->dwHeight - (y + h); - d3dvp.Width = w; - d3dvp.Height = h; - if (ctx->Viewport.Near <= ctx->Viewport.Far) { - d3dvp.MinZ = ctx->Viewport.Near; - d3dvp.MaxZ = ctx->Viewport.Far; - } else { - d3dvp.MinZ = ctx->Viewport.Far; - d3dvp.MaxZ = ctx->Viewport.Near; - } - - // TODO: DEBUGGING -// d3dvp.MinZ = 0.0f; -// d3dvp.MaxZ = 1.0f; - - _GLD_DX9_DEV(SetViewport(gld->pDev, &d3dvp)); - -} - -//--------------------------------------------------------------------------- - -extern BOOL dglWglResizeBuffers(GLcontext *ctx, BOOL bDefaultDriver); - -// Mesa 5: Parameter change -void gldResizeBuffers_DX9( -// GLcontext *ctx) - GLframebuffer *fb) -{ - GET_CURRENT_CONTEXT(ctx); - dglWglResizeBuffers(ctx, TRUE); -} - -//--------------------------------------------------------------------------- -#ifdef _DEBUG -// This is only for debugging. -// To use, plug into ctx->Driver.Enable pointer below. -void gld_Enable( - GLcontext *ctx, - GLenum e, - GLboolean b) -{ - char buf[1024]; - sprintf(buf, "Enable: %s (%s)\n", _mesa_lookup_enum_by_nr(e), b?"TRUE":"FALSE"); - ddlogMessage(DDLOG_SYSTEM, buf); -} -#endif -//--------------------------------------------------------------------------- -// Driver pointer setup -//--------------------------------------------------------------------------- - -extern const GLubyte* _gldGetStringGeneric(GLcontext*, GLenum); - -void gldSetupDriverPointers_DX9( - GLcontext *ctx) -{ - GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); - GLD_driver_dx9 *gld = GLD_GET_DX9_DRIVER(gldCtx); - - TNLcontext *tnl = TNL_CONTEXT(ctx); - - // Mandatory functions - ctx->Driver.GetString = _gldGetStringGeneric; - ctx->Driver.UpdateState = gld_update_state_DX9; - ctx->Driver.Clear = gld_Clear_DX9; - ctx->Driver.DrawBuffer = gld_set_draw_buffer_DX9; - ctx->Driver.GetBufferSize = gld_buffer_size_DX9; - ctx->Driver.Finish = gld_Finish_DX9; - ctx->Driver.Flush = gld_Flush_DX9; - ctx->Driver.Error = gld_Error_DX9; - - // Hardware accumulation buffer - ctx->Driver.Accum = NULL; // TODO: gld_Accum; - - // Bitmap functions - ctx->Driver.CopyPixels = gld_CopyPixels_DX9; - ctx->Driver.DrawPixels = gld_DrawPixels_DX9; - ctx->Driver.ReadPixels = gld_ReadPixels_DX9; - ctx->Driver.Bitmap = gld_Bitmap_DX9; - - // Buffer resize - ctx->Driver.ResizeBuffers = gldResizeBuffers_DX9; - - // Texture image functions - ctx->Driver.ChooseTextureFormat = gld_ChooseTextureFormat_DX9; - ctx->Driver.TexImage1D = gld_TexImage1D_DX9; - ctx->Driver.TexImage2D = gld_TexImage2D_DX9; - ctx->Driver.TexImage3D = _mesa_store_teximage3d; - ctx->Driver.TexSubImage1D = gld_TexSubImage1D_DX9; - ctx->Driver.TexSubImage2D = gld_TexSubImage2D_DX9; - ctx->Driver.TexSubImage3D = _mesa_store_texsubimage3d; - - ctx->Driver.CopyTexImage1D = gldCopyTexImage1D_DX9; //NULL; - ctx->Driver.CopyTexImage2D = gldCopyTexImage2D_DX9; //NULL; - ctx->Driver.CopyTexSubImage1D = gldCopyTexSubImage1D_DX9; //NULL; - ctx->Driver.CopyTexSubImage2D = gldCopyTexSubImage2D_DX9; //NULL; - ctx->Driver.CopyTexSubImage3D = gldCopyTexSubImage3D_DX9; - ctx->Driver.TestProxyTexImage = _mesa_test_proxy_teximage; - - // Texture object functions - ctx->Driver.BindTexture = NULL; - ctx->Driver.NewTextureObject = NULL; // Not yet implemented by Mesa!; - ctx->Driver.DeleteTexture = gld_DeleteTexture_DX9; - ctx->Driver.PrioritizeTexture = NULL; - - // Imaging functionality - ctx->Driver.CopyColorTable = NULL; - ctx->Driver.CopyColorSubTable = NULL; - ctx->Driver.CopyConvolutionFilter1D = NULL; - ctx->Driver.CopyConvolutionFilter2D = NULL; - - // State changing functions - ctx->Driver.AlphaFunc = NULL; //gld_AlphaFunc; - ctx->Driver.BlendFuncSeparate = NULL; //gld_BlendFunc; - ctx->Driver.ClearColor = NULL; //gld_ClearColor; - ctx->Driver.ClearDepth = NULL; //gld_ClearDepth; - ctx->Driver.ClearStencil = NULL; //gld_ClearStencil; - ctx->Driver.ColorMask = NULL; //gld_ColorMask; - ctx->Driver.CullFace = NULL; //gld_CullFace; - ctx->Driver.ClipPlane = NULL; //gld_ClipPlane; - ctx->Driver.FrontFace = NULL; //gld_FrontFace; - ctx->Driver.DepthFunc = NULL; //gld_DepthFunc; - ctx->Driver.DepthMask = NULL; //gld_DepthMask; - ctx->Driver.DepthRange = NULL; - ctx->Driver.Enable = NULL; //gld_Enable; - ctx->Driver.Fogfv = NULL; //gld_Fogfv; - ctx->Driver.Hint = NULL; //gld_Hint; - ctx->Driver.Lightfv = NULL; //gld_Lightfv; - ctx->Driver.LightModelfv = NULL; //gld_LightModelfv; - ctx->Driver.LineStipple = NULL; //gld_LineStipple; - ctx->Driver.LineWidth = NULL; //gld_LineWidth; - ctx->Driver.LogicOpcode = NULL; //gld_LogicOpcode; - ctx->Driver.PointParameterfv = NULL; //gld_PointParameterfv; - ctx->Driver.PointSize = NULL; //gld_PointSize; - ctx->Driver.PolygonMode = NULL; //gld_PolygonMode; - ctx->Driver.PolygonOffset = NULL; //gld_PolygonOffset; - ctx->Driver.PolygonStipple = NULL; //gld_PolygonStipple; - ctx->Driver.RenderMode = NULL; //gld_RenderMode; - ctx->Driver.Scissor = NULL; //gld_Scissor; - ctx->Driver.ShadeModel = NULL; //gld_ShadeModel; - ctx->Driver.StencilFunc = NULL; //gld_StencilFunc; - ctx->Driver.StencilMask = NULL; //gld_StencilMask; - ctx->Driver.StencilOp = NULL; //gld_StencilOp; - ctx->Driver.TexGen = NULL; //gld_TexGen; - ctx->Driver.TexEnv = NULL; - ctx->Driver.TexParameter = NULL; - ctx->Driver.TextureMatrix = NULL; //gld_TextureMatrix; - ctx->Driver.Viewport = gld_Viewport_DX9; - - _swsetup_Wakeup(ctx); - - tnl->Driver.RunPipeline = _tnl_run_pipeline; - tnl->Driver.Render.ResetLineStipple = gld_ResetLineStipple_DX9; - tnl->Driver.Render.ClippedPolygon = _tnl_RenderClippedPolygon; - tnl->Driver.Render.ClippedLine = _tnl_RenderClippedLine; - - // Hook into glFrustum() and glOrtho() -// ctx->Exec->Frustum = gldFrustumHook_DX9; -// ctx->Exec->Ortho = gldOrthoHook_DX9; - -} - -//--------------------------------------------------------------------------- diff --git a/src/mesa/drivers/windows/gldirect/dx9/gld_dx9.h b/src/mesa/drivers/windows/gldirect/dx9/gld_dx9.h deleted file mode 100644 index aec40ac9dd..0000000000 --- a/src/mesa/drivers/windows/gldirect/dx9/gld_dx9.h +++ /dev/null @@ -1,327 +0,0 @@ -/**************************************************************************** -* -* Mesa 3-D graphics library -* Direct3D Driver Interface -* -* ======================================================================== -* -* Copyright (C) 1991-2004 SciTech Software, Inc. All rights reserved. -* -* Permission is hereby granted, free of charge, to any person obtaining a -* copy of this software and associated documentation files (the "Software"), -* to deal in the Software without restriction, including without limitation -* the rights to use, copy, modify, merge, publish, distribute, sublicense, -* and/or sell copies of the Software, and to permit persons to whom the -* Software is furnished to do so, subject to the following conditions: -* -* The above copyright notice and this permission notice shall be included -* in all copies or substantial portions of the Software. -* -* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -* SCITECH SOFTWARE INC BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF -* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -* SOFTWARE. -* -* ====================================================================== -* -* Language: ANSI C -* Environment: Windows 9x/2000/XP/XBox (Win32) -* -* Description: GLDirect Direct3D 9.0 header file -* -****************************************************************************/ - -#ifndef _GLD_DX9_H -#define _GLD_DX9_H - -//--------------------------------------------------------------------------- -// Windows includes -//--------------------------------------------------------------------------- - -//#ifndef STRICT -//#define STRICT -//#endif - -//#define WIN32_LEAN_AND_MEAN -//#include -#include -#include - -// MS screwed up with the DX8.1 SDK - there's no compile-time -// method of compiling for 8.0 via the 8.1 SDK unless you -// "make sure you don't use any 8.1 interfaces". -// We CAN use 8.1 D3DX static functions, though - just not new 8.1 interfaces. -// -// D3D_SDK_VERSION is 120 for 8.0 (supported by Windows 95). -// D3D_SDK_VERSION is 220 for 8.1 (NOT supported by Windows 95). -// -//#define D3D_SDK_VERSION_DX9_SUPPORT_WIN95 120 -//#define D3D_SDK_VERSION_DX91 220 - -// Typedef for obtaining function from d3d8.dll -typedef IDirect3D9* (WINAPI *FNDIRECT3DCREATE9) (UINT); - - -//--------------------------------------------------------------------------- -// Defines -//--------------------------------------------------------------------------- - -#ifdef _DEBUG -#define _GLD_TEST_HRESULT(h) \ -{ \ - HRESULT _hr = (h); \ - if (FAILED(_hr)) { \ - gldLogError(GLDLOG_ERROR, #h, _hr); \ - } \ -} -#define _GLD_DX9(func) _GLD_TEST_HRESULT(IDirect3D9_##func##) -#define _GLD_DX9_DEV(func) _GLD_TEST_HRESULT(IDirect3DDevice9_##func##) -#define _GLD_DX9_VB(func) _GLD_TEST_HRESULT(IDirect3DVertexBuffer9_##func##) -#define _GLD_DX9_TEX(func) _GLD_TEST_HRESULT(IDirect3DTexture9_##func##) -#else -#define _GLD_DX9(func) IDirect3D9_##func -#define _GLD_DX9_DEV(func) IDirect3DDevice9_##func -#define _GLD_DX9_VB(func) IDirect3DVertexBuffer9_##func -#define _GLD_DX9_TEX(func) IDirect3DTexture9_##func -#endif - -#define SAFE_RELEASE(p) \ -{ \ - if (p) { \ - (p)->lpVtbl->Release(p); \ - (p) = NULL; \ - } \ -} - -#define SAFE_RELEASE_VB9(p) \ -{ \ - if (p) { \ - IDirect3DVertexBuffer9_Release((p)); \ - (p) = NULL; \ - } \ -} - -#define SAFE_RELEASE_SURFACE9(p) \ -{ \ - if (p) { \ - IDirect3DSurface9_Release((p)); \ - (p) = NULL; \ - } \ -} - -// Setup index. -enum { - GLD_SI_FLAT = 0, - GLD_SI_SMOOTH = 1, - GLD_SI_FLAT_EXTRAS = 2, - GLD_SI_SMOOTH_EXTRAS = 3, -}; -/* -// Internal pipeline -typedef enum { - GLD_PIPELINE_MESA = 0, // Mesa pipeline - GLD_PIPELINE_D3D_FVF = 1, // Direct3D Fixed-function pipeline - GLD_PIPELINE_D3D_VS_TWOSIDE = 2 // Direct3D two-sided-lighting vertex shader -} GLD_tnl_pipeline; -*/ -//--------------------------------------------------------------------------- -// Vertex definitions for Fixed-Function pipeline -//--------------------------------------------------------------------------- - -// -// NOTE: If the number of texture units is altered then most of -// the texture code will need to be revised. -// - -#define GLD_MAX_TEXTURE_UNITS_DX9 2 - -// -// 2D vertex transformed by Mesa -// -#define GLD_FVF_2D_VERTEX ( D3DFVF_XYZRHW | \ - D3DFVF_DIFFUSE | \ - D3DFVF_SPECULAR | \ - D3DFVF_TEX2) -typedef struct { - FLOAT x, y; // 2D raster coords - FLOAT sz; // Screen Z (depth) - FLOAT rhw; // Reciprocal homogenous W - DWORD diffuse; // Diffuse colour - DWORD specular; // For separate-specular support - FLOAT t0_u, t0_v; // 1st set of texture coords - FLOAT t1_u, t1_v; // 2nd set of texture coords -} GLD_2D_VERTEX; - - -// -// 3D vertex transformed by Direct3D -// -#define GLD_FVF_3D_VERTEX ( D3DFVF_XYZ | \ - D3DFVF_DIFFUSE | \ - D3DFVF_TEX2) - -typedef struct { - D3DXVECTOR3 Position; // XYZ Vector in object space - D3DCOLOR Diffuse; // Diffuse colour - D3DXVECTOR2 TexUnit0; // Texture unit 0 - D3DXVECTOR2 TexUnit1; // Texture unit 1 -} GLD_3D_VERTEX; - -//--------------------------------------------------------------------------- -// Vertex Shaders -//--------------------------------------------------------------------------- -/* -// DX8 Vertex Shader -typedef struct { - DWORD hShader; // If NULL, shader is invalid and cannot be used - BOOL bHardware; // If TRUE then shader was created for hardware, - // otherwise shader was created for software. -} GLD_vertexShader; -*/ -//--------------------------------------------------------------------------- -// Structs -//--------------------------------------------------------------------------- - -// This keeps a count of how many times we choose each individual internal -// pathway. Useful for seeing if a certain pathway was ever used by an app, and -// how much each pathway is biased. -// Zero the members at context creation and dump stats at context deletion. -typedef struct { - // Note: DWORD is probably too small - ULARGE_INTEGER qwMesa; // Mesa TnL pipeline - ULARGE_INTEGER qwD3DFVF; // Direct3D Fixed-Function pipeline -// ULARGE_INTEGER dwD3D2SVS; // Direct3D Two-Sided Vertex Shader pipeline -} GLD_pipeline_usage; - -// GLDirect Primitive Buffer (points, lines, triangles and quads) -typedef struct { - // Data for IDirect3DDevice9::CreateVertexBuffer() - DWORD dwStride; // Stride of vertex - DWORD dwUsage; // Usage flags - DWORD dwFVF; // Direct3D Flexible Vertex Format - DWORD dwPool; // Pool flags - - IDirect3DVertexBuffer9 *pVB; // Holds points, lines, tris and quads. - - // Point list is assumed to be at start of buffer - DWORD iFirstLine; // Index of start of line list - DWORD iFirstTriangle; // Index of start of triangle list - - BYTE *pPoints; // Pointer to next free point - BYTE *pLines; // Pointer to next free line - BYTE *pTriangles; // Pointer to next free triangle - - DWORD nPoints; // Number of points ready to render - DWORD nLines; // Number of lines ready to render - DWORD nTriangles; // Number of triangles ready to render -} GLD_pb_dx9; - -// GLDirect DX9 driver data -typedef struct { - // GLDirect vars - BOOL bDoublebuffer; // Doublebuffer (otherwise single-buffered) - BOOL bDepthStencil; // Depth buffer needed (stencil optional) - D3DFORMAT RenderFormat; // Format of back/front buffer - D3DFORMAT DepthFormat; // Format of depth/stencil -// float fFlipWindowY; // Value for flipping viewport Y coord - - // Direct3D vars - D3DCAPS9 d3dCaps9; - BOOL bHasHWTnL; // Device has Hardware Transform/Light? - IDirect3D9 *pD3D; // Base Direct3D9 interface - IDirect3DDevice9 *pDev; // Direct3D9 Device interface - GLD_pb_dx9 PB2d; // Vertices transformed by Mesa - GLD_pb_dx9 PB3d; // Vertices transformed by Direct3D - D3DPRIMITIVETYPE d3dpt; // Current Direct3D primitive type - D3DXMATRIX matProjection; // Projection matrix for D3D TnL - D3DXMATRIX matModelView; // Model/View matrix for D3D TnL - int iSetupFunc; // Which setup functions to use - BOOL bUseMesaTnL; // Whether to use Mesa or D3D for TnL - - // Direct3D vars for two-sided lighting -// GLD_vertexShader VStwosidelight; // Vertex Shader for two-sided lighting -// D3DXMATRIX matWorldViewProj;// World/View/Projection matrix for shaders - - -// GLD_tnl_pipeline TnLPipeline; // Index of current internal pipeline - GLD_pipeline_usage PipelineUsage; - - BOOL bCanScissor; // Scissor test - new for DX9 -} GLD_driver_dx9; - -#define GLD_GET_DX9_DRIVER(c) (GLD_driver_dx9*)(c)->glPriv - -//--------------------------------------------------------------------------- -// Function prototypes -//--------------------------------------------------------------------------- - -PROC gldGetProcAddress_DX9(LPCSTR a); -void gldEnableExtensions_DX9(GLcontext *ctx); -void gldInstallPipeline_DX9(GLcontext *ctx); -void gldSetupDriverPointers_DX9(GLcontext *ctx); -//void gldResizeBuffers_DX9(GLcontext *ctx); -void gldResizeBuffers_DX9(GLframebuffer *fb); - - -// Texture functions - -void gldCopyTexImage1D_DX9(GLcontext *ctx, GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLint border); -void gldCopyTexImage2D_DX9(GLcontext *ctx, GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); -void gldCopyTexSubImage1D_DX9(GLcontext *ctx, GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width ); -void gldCopyTexSubImage2D_DX9(GLcontext *ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height ); -void gldCopyTexSubImage3D_DX9(GLcontext *ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height ); - -void gld_NEW_TEXTURE_DX9(GLcontext *ctx); -void gld_DrawPixels_DX9(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, const struct gl_pixelstore_attrib *unpack, const GLvoid *pixels); -void gld_ReadPixels_DX9(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, const struct gl_pixelstore_attrib *unpack, GLvoid *dest); -void gld_CopyPixels_DX9(GLcontext *ctx, GLint srcx, GLint srcy, GLsizei width, GLsizei height, GLint dstx, GLint dsty, GLenum type); -void gld_Bitmap_DX9(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height, const struct gl_pixelstore_attrib *unpack, const GLubyte *bitmap); -const struct gl_texture_format* gld_ChooseTextureFormat_DX9(GLcontext *ctx, GLint internalFormat, GLenum srcFormat, GLenum srcType); -void gld_TexImage2D_DX9(GLcontext *ctx, GLenum target, GLint level, GLint internalFormat, GLint width, GLint height, GLint border, GLenum format, GLenum type, const GLvoid *pixels, const struct gl_pixelstore_attrib *packing, struct gl_texture_object *tObj, struct gl_texture_image *texImage); -void gld_TexImage1D_DX9(GLcontext *ctx, GLenum target, GLint level, GLint internalFormat, GLint width, GLint border, GLenum format, GLenum type, const GLvoid *pixels, const struct gl_pixelstore_attrib *packing, struct gl_texture_object *texObj, struct gl_texture_image *texImage ); -void gld_TexSubImage2D_DX9( GLcontext *ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels, const struct gl_pixelstore_attrib *packing, struct gl_texture_object *texObj, struct gl_texture_image *texImage ); -void gld_TexSubImage1D_DX9(GLcontext *ctx, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels, const struct gl_pixelstore_attrib *packing, struct gl_texture_object *texObj, struct gl_texture_image *texImage); -void gld_DeleteTexture_DX9(GLcontext *ctx, struct gl_texture_object *tObj); -void gld_ResetLineStipple_DX9(GLcontext *ctx); - -// 2D primitive functions - -void gld_Points2D_DX9(GLcontext *ctx, GLuint first, GLuint last); - -void gld_Line2DFlat_DX9(GLcontext *ctx, GLuint v0, GLuint v1); -void gld_Line2DSmooth_DX9(GLcontext *ctx, GLuint v0, GLuint v1); - -void gld_Triangle2DFlat_DX9(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2); -void gld_Triangle2DSmooth_DX9(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2); -void gld_Triangle2DFlatExtras_DX9(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2); -void gld_Triangle2DSmoothExtras_DX9(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2); - -void gld_Quad2DFlat_DX9(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3); -void gld_Quad2DSmooth_DX9(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3); -void gld_Quad2DFlatExtras_DX9(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3); -void gld_Quad2DSmoothExtras_DX9(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3); - -// 3D primitive functions - -void gld_Points3D_DX9(GLcontext *ctx, GLuint first, GLuint last); -void gld_Line3DFlat_DX9(GLcontext *ctx, GLuint v0, GLuint v1); -void gld_Triangle3DFlat_DX9(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2); -void gld_Quad3DFlat_DX9(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3); -void gld_Line3DSmooth_DX9(GLcontext *ctx, GLuint v0, GLuint v1); -void gld_Triangle3DSmooth_DX9(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2); -void gld_Quad3DSmooth_DX9(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3); - -// Primitive functions for Two-sided-lighting Vertex Shader - -void gld_Points2DTwoside_DX9(GLcontext *ctx, GLuint first, GLuint last); -void gld_Line2DFlatTwoside_DX9(GLcontext *ctx, GLuint v0, GLuint v1); -void gld_Line2DSmoothTwoside_DX9(GLcontext *ctx, GLuint v0, GLuint v1); -void gld_Triangle2DFlatTwoside_DX9(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2); -void gld_Triangle2DSmoothTwoside_DX9(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2); -void gld_Quad2DFlatTwoside_DX9(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3); -void gld_Quad2DSmoothTwoside_DX9(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3); - -#endif diff --git a/src/mesa/drivers/windows/gldirect/dx9/gld_dxerr9.h b/src/mesa/drivers/windows/gldirect/dx9/gld_dxerr9.h deleted file mode 100644 index 1d6b7b1c76..0000000000 --- a/src/mesa/drivers/windows/gldirect/dx9/gld_dxerr9.h +++ /dev/null @@ -1,77 +0,0 @@ -/*==========================================================================; - * - * - * File: dxerr9.h - * Content: DirectX Error Library Include File - * - ****************************************************************************/ - -#ifndef _GLD_DXERR9_H_ -#define _GLD_DXERR9_H_ - - -#include - -// -// DXGetErrorString9 -// -// Desc: Converts an DirectX HRESULT to a string -// -// Args: HRESULT hr Can be any error code from -// DPLAY D3D8 D3DX8 DMUSIC DSOUND -// -// Return: Converted string -// -const char* __stdcall DXGetErrorString9A(HRESULT hr); -const WCHAR* __stdcall DXGetErrorString9W(HRESULT hr); - -#ifdef UNICODE - #define DXGetErrorString9 DXGetErrorString9W -#else - #define DXGetErrorString9 DXGetErrorString9A -#endif - - -// -// DXTrace -// -// Desc: Outputs a formatted error message to the debug stream -// -// Args: CHAR* strFile The current file, typically passed in using the -// __FILE__ macro. -// DWORD dwLine The current line number, typically passed in using the -// __LINE__ macro. -// HRESULT hr An HRESULT that will be traced to the debug stream. -// CHAR* strMsg A string that will be traced to the debug stream (may be NULL) -// BOOL bPopMsgBox If TRUE, then a message box will popup also containing the passed info. -// -// Return: The hr that was passed in. -// -//HRESULT __stdcall DXTraceA( char* strFile, DWORD dwLine, HRESULT hr, char* strMsg, BOOL bPopMsgBox = FALSE ); -//HRESULT __stdcall DXTraceW( char* strFile, DWORD dwLine, HRESULT hr, WCHAR* strMsg, BOOL bPopMsgBox = FALSE ); -HRESULT __stdcall DXTraceA( char* strFile, DWORD dwLine, HRESULT hr, char* strMsg, BOOL bPopMsgBox); -HRESULT __stdcall DXTraceW( char* strFile, DWORD dwLine, HRESULT hr, WCHAR* strMsg, BOOL bPopMsgBox); - -#ifdef UNICODE - #define DXTrace DXTraceW -#else - #define DXTrace DXTraceA -#endif - - -// -// Helper macros -// -#if defined(DEBUG) | defined(_DEBUG) - #define DXTRACE_MSG(str) DXTrace( __FILE__, (DWORD)__LINE__, 0, str, FALSE ) - #define DXTRACE_ERR(str,hr) DXTrace( __FILE__, (DWORD)__LINE__, hr, str, TRUE ) - #define DXTRACE_ERR_NOMSGBOX(str,hr) DXTrace( __FILE__, (DWORD)__LINE__, hr, str, FALSE ) -#else - #define DXTRACE_MSG(str) (0L) - #define DXTRACE_ERR(str,hr) (hr) - #define DXTRACE_ERR_NOMSGBOX(str,hr) (hr) -#endif - - -#endif - diff --git a/src/mesa/drivers/windows/gldirect/dx9/gld_ext_dx9.c b/src/mesa/drivers/windows/gldirect/dx9/gld_ext_dx9.c deleted file mode 100644 index e8c73a6ff8..0000000000 --- a/src/mesa/drivers/windows/gldirect/dx9/gld_ext_dx9.c +++ /dev/null @@ -1,344 +0,0 @@ -/**************************************************************************** -* -* Mesa 3-D graphics library -* Direct3D Driver Interface -* -* ======================================================================== -* -* Copyright (C) 1991-2004 SciTech Software, Inc. All rights reserved. -* -* Permission is hereby granted, free of charge, to any person obtaining a -* copy of this software and associated documentation files (the "Software"), -* to deal in the Software without restriction, including without limitation -* the rights to use, copy, modify, merge, publish, distribute, sublicense, -* and/or sell copies of the Software, and to permit persons to whom the -* Software is furnished to do so, subject to the following conditions: -* -* The above copyright notice and this permission notice shall be included -* in all copies or substantial portions of the Software. -* -* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -* SCITECH SOFTWARE INC BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF -* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -* SOFTWARE. -* -* ====================================================================== -* -* Language: ANSI C -* Environment: Windows 9x/2000/XP/XBox (Win32) -* -* Description: GL extensions -* -****************************************************************************/ - -//#include "../GLDirect.h" -//#include "../gld_log.h" -//#include "../gld_settings.h" - -#include -#define GL_GLEXT_PROTOTYPES -#include -#include - -//#include "ddlog.h" -//#include "gld_dx8.h" - -#include "glheader.h" -#include "context.h" -#include "colormac.h" -#include "depth.h" -#include "extensions.h" -#include "macros.h" -#include "matrix.h" -// #include "mem.h" -//#include "mmath.h" -#include "mtypes.h" -#include "texformat.h" -#include "texstore.h" -#include "vbo/vbo.h" -#include "swrast_setup/swrast_setup.h" -#include "swrast_setup/ss_context.h" -#include "tnl/tnl.h" -#include "tnl/t_context.h" -#include "tnl/t_pipeline.h" - -#include "dglcontext.h" -#include "extensions.h" - -// For some reason this is not defined in an above header... -extern void _mesa_enable_imaging_extensions(GLcontext *ctx); - -//--------------------------------------------------------------------------- -// Hack for the SGIS_multitexture extension that was removed from Mesa -// NOTE: SGIS_multitexture enums also clash with GL_SGIX_async_pixel - - // NOTE: Quake2 ran *slower* with this enabled, so I've - // disabled it for now. - // To enable, uncomment: - // _mesa_add_extension(ctx, GL_TRUE, szGL_SGIS_multitexture, 0); - -//--------------------------------------------------------------------------- - -enum { - /* Quake2 GL_SGIS_multitexture */ - GL_SELECTED_TEXTURE_SGIS = 0x835B, - GL_SELECTED_TEXTURE_COORD_SET_SGIS = 0x835C, - GL_MAX_TEXTURES_SGIS = 0x835D, - GL_TEXTURE0_SGIS = 0x835E, - GL_TEXTURE1_SGIS = 0x835F, - GL_TEXTURE2_SGIS = 0x8360, - GL_TEXTURE3_SGIS = 0x8361, - GL_TEXTURE_COORD_SET_SOURCE_SGIS = 0x8363, -}; - -//--------------------------------------------------------------------------- - -void APIENTRY gldSelectTextureSGIS( - GLenum target) -{ - GLenum ARB_target = GL_TEXTURE0_ARB + (target - GL_TEXTURE0_SGIS); - glActiveTextureARB(ARB_target); -} - -//--------------------------------------------------------------------------- - -void APIENTRY gldMTexCoord2fSGIS( - GLenum target, - GLfloat s, - GLfloat t) -{ - GLenum ARB_target = GL_TEXTURE0_ARB + (target - GL_TEXTURE0_SGIS); - glMultiTexCoord2fARB(ARB_target, s, t); -} - -//--------------------------------------------------------------------------- - -void APIENTRY gldMTexCoord2fvSGIS( - GLenum target, - const GLfloat *v) -{ - GLenum ARB_target = GL_TEXTURE0_ARB + (target - GL_TEXTURE0_SGIS); - glMultiTexCoord2fvARB(ARB_target, v); -} - -//--------------------------------------------------------------------------- -// Extensions -//--------------------------------------------------------------------------- - -typedef struct { - PROC proc; - char *name; -} GLD_extension; - -GLD_extension GLD_extList[] = { -#ifdef GL_EXT_polygon_offset - { (PROC)glPolygonOffsetEXT, "glPolygonOffsetEXT" }, -#endif - { (PROC)glBlendEquationEXT, "glBlendEquationEXT" }, - { (PROC)glBlendColorEXT, "glBlendColorExt" }, - { (PROC)glVertexPointerEXT, "glVertexPointerEXT" }, - { (PROC)glNormalPointerEXT, "glNormalPointerEXT" }, - { (PROC)glColorPointerEXT, "glColorPointerEXT" }, - { (PROC)glIndexPointerEXT, "glIndexPointerEXT" }, - { (PROC)glTexCoordPointerEXT, "glTexCoordPointer" }, - { (PROC)glEdgeFlagPointerEXT, "glEdgeFlagPointerEXT" }, - { (PROC)glGetPointervEXT, "glGetPointervEXT" }, - { (PROC)glArrayElementEXT, "glArrayElementEXT" }, - { (PROC)glDrawArraysEXT, "glDrawArrayEXT" }, - { (PROC)glAreTexturesResidentEXT, "glAreTexturesResidentEXT" }, - { (PROC)glBindTextureEXT, "glBindTextureEXT" }, - { (PROC)glDeleteTexturesEXT, "glDeleteTexturesEXT" }, - { (PROC)glGenTexturesEXT, "glGenTexturesEXT" }, - { (PROC)glIsTextureEXT, "glIsTextureEXT" }, - { (PROC)glPrioritizeTexturesEXT, "glPrioritizeTexturesEXT" }, - { (PROC)glCopyTexSubImage3DEXT, "glCopyTexSubImage3DEXT" }, - { (PROC)glTexImage3DEXT, "glTexImage3DEXT" }, - { (PROC)glTexSubImage3DEXT, "glTexSubImage3DEXT" }, - { (PROC)glPointParameterfEXT, "glPointParameterfEXT" }, - { (PROC)glPointParameterfvEXT, "glPointParameterfvEXT" }, - - { (PROC)glLockArraysEXT, "glLockArraysEXT" }, - { (PROC)glUnlockArraysEXT, "glUnlockArraysEXT" }, - { NULL, "\0" } -}; - -GLD_extension GLD_multitexList[] = { -/* - { (PROC)glMultiTexCoord1dSGIS, "glMTexCoord1dSGIS" }, - { (PROC)glMultiTexCoord1dvSGIS, "glMTexCoord1dvSGIS" }, - { (PROC)glMultiTexCoord1fSGIS, "glMTexCoord1fSGIS" }, - { (PROC)glMultiTexCoord1fvSGIS, "glMTexCoord1fvSGIS" }, - { (PROC)glMultiTexCoord1iSGIS, "glMTexCoord1iSGIS" }, - { (PROC)glMultiTexCoord1ivSGIS, "glMTexCoord1ivSGIS" }, - { (PROC)glMultiTexCoord1sSGIS, "glMTexCoord1sSGIS" }, - { (PROC)glMultiTexCoord1svSGIS, "glMTexCoord1svSGIS" }, - { (PROC)glMultiTexCoord2dSGIS, "glMTexCoord2dSGIS" }, - { (PROC)glMultiTexCoord2dvSGIS, "glMTexCoord2dvSGIS" }, - { (PROC)glMultiTexCoord2fSGIS, "glMTexCoord2fSGIS" }, - { (PROC)glMultiTexCoord2fvSGIS, "glMTexCoord2fvSGIS" }, - { (PROC)glMultiTexCoord2iSGIS, "glMTexCoord2iSGIS" }, - { (PROC)glMultiTexCoord2ivSGIS, "glMTexCoord2ivSGIS" }, - { (PROC)glMultiTexCoord2sSGIS, "glMTexCoord2sSGIS" }, - { (PROC)glMultiTexCoord2svSGIS, "glMTexCoord2svSGIS" }, - { (PROC)glMultiTexCoord3dSGIS, "glMTexCoord3dSGIS" }, - { (PROC)glMultiTexCoord3dvSGIS, "glMTexCoord3dvSGIS" }, - { (PROC)glMultiTexCoord3fSGIS, "glMTexCoord3fSGIS" }, - { (PROC)glMultiTexCoord3fvSGIS, "glMTexCoord3fvSGIS" }, - { (PROC)glMultiTexCoord3iSGIS, "glMTexCoord3iSGIS" }, - { (PROC)glMultiTexCoord3ivSGIS, "glMTexCoord3ivSGIS" }, - { (PROC)glMultiTexCoord3sSGIS, "glMTexCoord3sSGIS" }, - { (PROC)glMultiTexCoord3svSGIS, "glMTexCoord3svSGIS" }, - { (PROC)glMultiTexCoord4dSGIS, "glMTexCoord4dSGIS" }, - { (PROC)glMultiTexCoord4dvSGIS, "glMTexCoord4dvSGIS" }, - { (PROC)glMultiTexCoord4fSGIS, "glMTexCoord4fSGIS" }, - { (PROC)glMultiTexCoord4fvSGIS, "glMTexCoord4fvSGIS" }, - { (PROC)glMultiTexCoord4iSGIS, "glMTexCoord4iSGIS" }, - { (PROC)glMultiTexCoord4ivSGIS, "glMTexCoord4ivSGIS" }, - { (PROC)glMultiTexCoord4sSGIS, "glMTexCoord4sSGIS" }, - { (PROC)glMultiTexCoord4svSGIS, "glMTexCoord4svSGIS" }, - { (PROC)glMultiTexCoordPointerSGIS, "glMTexCoordPointerSGIS" }, - { (PROC)glSelectTextureSGIS, "glSelectTextureSGIS" }, - { (PROC)glSelectTextureCoordSetSGIS, "glSelectTextureCoordSetSGIS" }, -*/ - { (PROC)glActiveTextureARB, "glActiveTextureARB" }, - { (PROC)glClientActiveTextureARB, "glClientActiveTextureARB" }, - { (PROC)glMultiTexCoord1dARB, "glMultiTexCoord1dARB" }, - { (PROC)glMultiTexCoord1dvARB, "glMultiTexCoord1dvARB" }, - { (PROC)glMultiTexCoord1fARB, "glMultiTexCoord1fARB" }, - { (PROC)glMultiTexCoord1fvARB, "glMultiTexCoord1fvARB" }, - { (PROC)glMultiTexCoord1iARB, "glMultiTexCoord1iARB" }, - { (PROC)glMultiTexCoord1ivARB, "glMultiTexCoord1ivARB" }, - { (PROC)glMultiTexCoord1sARB, "glMultiTexCoord1sARB" }, - { (PROC)glMultiTexCoord1svARB, "glMultiTexCoord1svARB" }, - { (PROC)glMultiTexCoord2dARB, "glMultiTexCoord2dARB" }, - { (PROC)glMultiTexCoord2dvARB, "glMultiTexCoord2dvARB" }, - { (PROC)glMultiTexCoord2fARB, "glMultiTexCoord2fARB" }, - { (PROC)glMultiTexCoord2fvARB, "glMultiTexCoord2fvARB" }, - { (PROC)glMultiTexCoord2iARB, "glMultiTexCoord2iARB" }, - { (PROC)glMultiTexCoord2ivARB, "glMultiTexCoord2ivARB" }, - { (PROC)glMultiTexCoord2sARB, "glMultiTexCoord2sARB" }, - { (PROC)glMultiTexCoord2svARB, "glMultiTexCoord2svARB" }, - { (PROC)glMultiTexCoord3dARB, "glMultiTexCoord3dARB" }, - { (PROC)glMultiTexCoord3dvARB, "glMultiTexCoord3dvARB" }, - { (PROC)glMultiTexCoord3fARB, "glMultiTexCoord3fARB" }, - { (PROC)glMultiTexCoord3fvARB, "glMultiTexCoord3fvARB" }, - { (PROC)glMultiTexCoord3iARB, "glMultiTexCoord3iARB" }, - { (PROC)glMultiTexCoord3ivARB, "glMultiTexCoord3ivARB" }, - { (PROC)glMultiTexCoord3sARB, "glMultiTexCoord3sARB" }, - { (PROC)glMultiTexCoord3svARB, "glMultiTexCoord3svARB" }, - { (PROC)glMultiTexCoord4dARB, "glMultiTexCoord4dARB" }, - { (PROC)glMultiTexCoord4dvARB, "glMultiTexCoord4dvARB" }, - { (PROC)glMultiTexCoord4fARB, "glMultiTexCoord4fARB" }, - { (PROC)glMultiTexCoord4fvARB, "glMultiTexCoord4fvARB" }, - { (PROC)glMultiTexCoord4iARB, "glMultiTexCoord4iARB" }, - { (PROC)glMultiTexCoord4ivARB, "glMultiTexCoord4ivARB" }, - { (PROC)glMultiTexCoord4sARB, "glMultiTexCoord4sARB" }, - { (PROC)glMultiTexCoord4svARB, "glMultiTexCoord4svARB" }, - - // Descent3 doesn't use correct string, hence this hack - { (PROC)glMultiTexCoord4fARB, "glMultiTexCoord4f" }, - - // Quake2 SGIS multitexture - { (PROC)gldSelectTextureSGIS, "glSelectTextureSGIS" }, - { (PROC)gldMTexCoord2fSGIS, "glMTexCoord2fSGIS" }, - { (PROC)gldMTexCoord2fvSGIS, "glMTexCoord2fvSGIS" }, - - { NULL, "\0" } -}; - -//--------------------------------------------------------------------------- - -PROC gldGetProcAddress_DX( - LPCSTR a) -{ - int i; - PROC proc = NULL; - - for (i=0; GLD_extList[i].proc; i++) { - if (!strcmp(a, GLD_extList[i].name)) { - proc = GLD_extList[i].proc; - break; - } - } - - if (glb.bMultitexture) { - for (i=0; GLD_multitexList[i].proc; i++) { - if (!strcmp(a, GLD_multitexList[i].name)) { - proc = GLD_multitexList[i].proc; - break; - } - } - } - - gldLogPrintf(GLDLOG_INFO, "GetProcAddress: %s (%s)", a, proc ? "OK" : "Failed"); - - return proc; -} - -//--------------------------------------------------------------------------- - -void gldEnableExtensions_DX9( - GLcontext *ctx) -{ - GLuint i; - - // Mesa enables some extensions by default. - // This table decides which ones we want to switch off again. - - // NOTE: GL_EXT_compiled_vertex_array appears broken. - - const char *gld_disable_extensions[] = { -// "GL_ARB_transpose_matrix", -// "GL_EXT_compiled_vertex_array", -// "GL_EXT_polygon_offset", -// "GL_EXT_rescale_normal", - "GL_EXT_texture3D", -// "GL_NV_texgen_reflection", - NULL - }; - - const char *gld_multitex_extensions[] = { - "GL_ARB_multitexture", // Quake 3 - NULL - }; - - // Quake 2 engines - const char *szGL_SGIS_multitexture = "GL_SGIS_multitexture"; - - const char *gld_enable_extensions[] = { - "GL_EXT_texture_env_add", // Quake 3 - "GL_ARB_texture_env_add", // Quake 3 - NULL - }; - - for (i=0; gld_disable_extensions[i]; i++) { - _mesa_disable_extension(ctx, gld_disable_extensions[i]); - } - - for (i=0; gld_enable_extensions[i]; i++) { - _mesa_enable_extension(ctx, gld_enable_extensions[i]); - } - - if (glb.bMultitexture) { - for (i=0; gld_multitex_extensions[i]; i++) { - _mesa_enable_extension(ctx, gld_multitex_extensions[i]); - } - - // GL_SGIS_multitexture - // NOTE: Quake2 ran *slower* with this enabled, so I've - // disabled it for now. - // Fair bit slower on GeForce256, - // Much slower on 3dfx Voodoo5 5500. -// _mesa_add_extension(ctx, GL_TRUE, szGL_SGIS_multitexture, 0); - - } - - _mesa_enable_imaging_extensions(ctx); - _mesa_enable_1_3_extensions(ctx); - _mesa_enable_1_4_extensions(ctx); -} - -//--------------------------------------------------------------------------- diff --git a/src/mesa/drivers/windows/gldirect/dx9/gld_pipeline_dx9.c b/src/mesa/drivers/windows/gldirect/dx9/gld_pipeline_dx9.c deleted file mode 100644 index 2b272aa628..0000000000 --- a/src/mesa/drivers/windows/gldirect/dx9/gld_pipeline_dx9.c +++ /dev/null @@ -1,77 +0,0 @@ -/**************************************************************************** -* -* Mesa 3-D graphics library -* Direct3D Driver Interface -* -* ======================================================================== -* -* Copyright (C) 1991-2004 SciTech Software, Inc. All rights reserved. -* -* Permission is hereby granted, free of charge, to any person obtaining a -* copy of this software and associated documentation files (the "Software"), -* to deal in the Software without restriction, including without limitation -* the rights to use, copy, modify, merge, publish, distribute, sublicense, -* and/or sell copies of the Software, and to permit persons to whom the -* Software is furnished to do so, subject to the following conditions: -* -* The above copyright notice and this permission notice shall be included -* in all copies or substantial portions of the Software. -* -* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -* SCITECH SOFTWARE INC BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF -* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -* SOFTWARE. -* -* ====================================================================== -* -* Language: ANSI C -* Environment: Windows 9x/2000/XP/XBox (Win32) -* -* Description: Mesa transformation pipeline with GLDirect fastpath -* -****************************************************************************/ - -//#include "../GLDirect.h" - -#include "dglcontext.h" -#include "ddlog.h" -#include "gld_dx9.h" - -#include "tnl/tnl.h" -#include "tnl/t_context.h" -#include "tnl/t_pipeline.h" - -//--------------------------------------------------------------------------- - -extern struct tnl_pipeline_stage _gld_d3d_render_stage; -extern struct tnl_pipeline_stage _gld_mesa_render_stage; - -static const struct tnl_pipeline_stage *gld_pipeline[] = { - &_gld_d3d_render_stage, // Direct3D TnL - &_tnl_vertex_transform_stage, - &_tnl_normal_transform_stage, - &_tnl_lighting_stage, - &_tnl_fog_coordinate_stage, /* TODO: Omit fog stage. ??? */ - &_tnl_texgen_stage, - &_tnl_texture_transform_stage, - &_tnl_point_attenuation_stage, - &_gld_mesa_render_stage, // Mesa TnL, D3D rendering - 0, -}; - -//--------------------------------------------------------------------------- - -void gldInstallPipeline_DX9( - GLcontext *ctx) -{ - // Remove any existing pipeline stages, - // then install GLDirect pipeline stages. - - _tnl_destroy_pipeline(ctx); - _tnl_install_pipeline(ctx, gld_pipeline); -} - -//--------------------------------------------------------------------------- diff --git a/src/mesa/drivers/windows/gldirect/dx9/gld_primitive_dx9.c b/src/mesa/drivers/windows/gldirect/dx9/gld_primitive_dx9.c deleted file mode 100644 index 403a9d5f86..0000000000 --- a/src/mesa/drivers/windows/gldirect/dx9/gld_primitive_dx9.c +++ /dev/null @@ -1,1446 +0,0 @@ -/**************************************************************************** -* -* Mesa 3-D graphics library -* Direct3D Driver Interface -* -* ======================================================================== -* -* Copyright (C) 1991-2004 SciTech Software, Inc. All rights reserved. -* -* Permission is hereby granted, free of charge, to any person obtaining a -* copy of this software and associated documentation files (the "Software"), -* to deal in the Software without restriction, including without limitation -* the rights to use, copy, modify, merge, publish, distribute, sublicense, -* and/or sell copies of the Software, and to permit persons to whom the -* Software is furnished to do so, subject to the following conditions: -* -* The above copyright notice and this permission notice shall be included -* in all copies or substantial portions of the Software. -* -* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -* SCITECH SOFTWARE INC BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF -* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -* SOFTWARE. -* -* ====================================================================== -* -* Language: ANSI C -* Environment: Windows 9x/2000/XP/XBox (Win32) -* -* Description: Primitive (points/lines/tris/quads) rendering -* -****************************************************************************/ - -//#include "../GLDirect.h" - -//#include "gld_dx8.h" - -#include "dglcontext.h" -#include "ddlog.h" -#include "gld_dx9.h" - -#include "glheader.h" -#include "context.h" -#include "colormac.h" -#include "depth.h" -#include "extensions.h" -#include "macros.h" -#include "matrix.h" -// #include "mem.h" -//#include "mmath.h" -#include "mtypes.h" -#include "texformat.h" -#include "texstore.h" -#include "vbo/vbo.h" -#include "swrast/swrast.h" -#include "swrast_setup/swrast_setup.h" -#include "swrast_setup/ss_context.h" -#include "swrast/s_context.h" -#include "swrast/s_depth.h" -#include "swrast/s_lines.h" -#include "swrast/s_triangle.h" -#include "swrast/s_trispan.h" -#include "tnl/tnl.h" -#include "tnl/t_context.h" -#include "tnl/t_pipeline.h" - -// Disable compiler complaints about unreferenced local variables -#pragma warning (disable:4101) - -//--------------------------------------------------------------------------- -// Helper defines for primitives -//--------------------------------------------------------------------------- - -//static const float ooZ = 1.0f / 65536.0f; // One over Z - -#define GLD_COLOUR (D3DCOLOR_RGBA(swv->color[0], swv->color[1], swv->color[2], swv->color[3])) -#define GLD_SPECULAR (D3DCOLOR_RGBA(swv->specular[0], swv->specular[1], swv->specular[2], swv->specular[3])) -#define GLD_FLIP_Y(y) (gldCtx->dwHeight - (y)) - -//--------------------------------------------------------------------------- -// 2D vertex setup -//--------------------------------------------------------------------------- - -#define GLD_SETUP_2D_VARS_POINTS \ - GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); \ - GLD_driver_dx9 *gld = GLD_GET_DX9_DRIVER(gldCtx); \ - GLD_2D_VERTEX *pV = (GLD_2D_VERTEX*)gld->PB2d.pPoints; \ - SScontext *ss = SWSETUP_CONTEXT(ctx); \ - SWvertex *swv; \ - DWORD dwSpecularColour; \ - DWORD dwFlatColour - -#define GLD_SETUP_2D_VARS_LINES \ - GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); \ - GLD_driver_dx9 *gld = GLD_GET_DX9_DRIVER(gldCtx); \ - GLD_2D_VERTEX *pV = (GLD_2D_VERTEX*)gld->PB2d.pLines; \ - SScontext *ss = SWSETUP_CONTEXT(ctx); \ - SWvertex *swv; \ - DWORD dwSpecularColour; \ - DWORD dwFlatColour - -#define GLD_SETUP_2D_VARS_TRIANGLES \ - BOOL bFog = ctx->Fog.Enabled; \ - GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); \ - GLD_driver_dx9 *gld = GLD_GET_DX9_DRIVER(gldCtx); \ - GLD_2D_VERTEX *pV = (GLD_2D_VERTEX*)gld->PB2d.pTriangles; \ - SScontext *ss = SWSETUP_CONTEXT(ctx); \ - SWvertex *swv; \ - DWORD dwSpecularColour; \ - DWORD dwFlatColour; \ - GLuint facing = 0; \ - struct vertex_buffer *VB; \ - GLchan (*vbcolor)[4]; \ - GLchan (*vbspec)[4] - -#define GLD_SETUP_GET_SWVERT(s) \ - swv = &ss->verts[##s] - -#define GLD_SETUP_2D_VERTEX \ - pV->x = swv->win[0]; \ - pV->y = GLD_FLIP_Y(swv->win[1]); \ - pV->rhw = swv->win[3] - -#define GLD_SETUP_SMOOTH_COLOUR \ - pV->diffuse = GLD_COLOUR - -#define GLD_SETUP_GET_FLAT_COLOUR \ - dwFlatColour = GLD_COLOUR -#define GLD_SETUP_GET_FLAT_FOG_COLOUR \ - dwFlatColour = _gldComputeFog(ctx, swv) - -#define GLD_SETUP_USE_FLAT_COLOUR \ - pV->diffuse = dwFlatColour - -#define GLD_SETUP_GET_FLAT_SPECULAR \ - dwSpecularColour= GLD_SPECULAR - -#define GLD_SETUP_USE_FLAT_SPECULAR \ - pV->specular = dwSpecularColour - -#define GLD_SETUP_DEPTH \ - pV->sz = swv->win[2] / ctx->DepthMaxF -// pV->z = swv->win[2] * ooZ; - -#define GLD_SETUP_SPECULAR \ - pV->specular = GLD_SPECULAR - -#define GLD_SETUP_FOG \ - pV->diffuse = _gldComputeFog(ctx, swv) - -#define GLD_SETUP_TEX0 \ - pV->t0_u = swv->texcoord[0][0]; \ - pV->t0_v = swv->texcoord[0][1] - -#define GLD_SETUP_TEX1 \ - pV->t1_u = swv->texcoord[1][0]; \ - pV->t1_v = swv->texcoord[1][1] - -#define GLD_SETUP_LIGHTING(v) \ - if (facing == 1) { \ - pV->diffuse = D3DCOLOR_RGBA(vbcolor[##v][0], vbcolor[##v][1], vbcolor[##v][2], vbcolor[##v][3]); \ - if (vbspec) { \ - pV->specular = D3DCOLOR_RGBA(vbspec[##v][0], vbspec[##v][1], vbspec[##v][2], vbspec[##v][3]); \ - } \ - } else { \ - if (bFog) \ - GLD_SETUP_FOG; \ - else \ - GLD_SETUP_SMOOTH_COLOUR; \ - GLD_SETUP_SPECULAR; \ - } - -#define GLD_SETUP_GET_FLAT_LIGHTING(v) \ - if (facing == 1) { \ - dwFlatColour = D3DCOLOR_RGBA(vbcolor[##v][0], vbcolor[##v][1], vbcolor[##v][2], vbcolor[##v][3]); \ - if (vbspec) { \ - dwSpecularColour = D3DCOLOR_RGBA(vbspec[##v][0], vbspec[##v][1], vbspec[##v][2], vbspec[##v][3]); \ - } \ - } - -#define GLD_SETUP_TWOSIDED_LIGHTING \ - /* Two-sided lighting */ \ - if (ctx->_TriangleCaps & DD_TRI_LIGHT_TWOSIDE) { \ - SWvertex *verts = SWSETUP_CONTEXT(ctx)->verts; \ - SWvertex *v[3]; \ - GLfloat ex,ey,fx,fy,cc; \ - /* Get vars for later */ \ - VB = &TNL_CONTEXT(ctx)->vb; \ - vbcolor = (GLchan (*)[4])VB->ColorPtr[1]->data; \ - if (VB->SecondaryColorPtr[1]) { \ - vbspec = (GLchan (*)[4])VB->SecondaryColorPtr[1]->data; \ - } else { \ - vbspec = NULL; \ - } \ - v[0] = &verts[v0]; \ - v[1] = &verts[v1]; \ - v[2] = &verts[v2]; \ - ex = v[0]->win[0] - v[2]->win[0]; \ - ey = v[0]->win[1] - v[2]->win[1]; \ - fx = v[1]->win[0] - v[2]->win[0]; \ - fy = v[1]->win[1] - v[2]->win[1]; \ - cc = ex*fy - ey*fx; \ - facing = (cc < 0.0) ^ ctx->Polygon._FrontBit; \ - } - -//--------------------------------------------------------------------------- -// 3D vertex setup -//--------------------------------------------------------------------------- - -#define GLD_SETUP_3D_VARS_POINTS \ - GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); \ - GLD_driver_dx9 *gld = GLD_GET_DX9_DRIVER(gldCtx); \ - GLD_3D_VERTEX *pV = (GLD_3D_VERTEX*)gld->PB3d.pPoints; \ - TNLcontext *tnl = TNL_CONTEXT(ctx); \ - struct vertex_buffer *VB = &tnl->vb; \ - GLfloat (*p4f)[4]; \ - GLfloat (*tc)[4]; \ - DWORD dwColor; - -#define GLD_SETUP_3D_VARS_LINES \ - GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); \ - GLD_driver_dx9 *gld = GLD_GET_DX9_DRIVER(gldCtx); \ - GLD_3D_VERTEX *pV = (GLD_3D_VERTEX*)gld->PB3d.pLines; \ - TNLcontext *tnl = TNL_CONTEXT(ctx); \ - struct vertex_buffer *VB = &tnl->vb; \ - GLfloat (*p4f)[4]; \ - GLfloat (*tc)[4]; \ - DWORD dwColor; - -#define GLD_SETUP_3D_VARS_TRIANGLES \ - GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); \ - GLD_driver_dx9 *gld = GLD_GET_DX9_DRIVER(gldCtx); \ - GLD_3D_VERTEX *pV = (GLD_3D_VERTEX*)gld->PB3d.pTriangles; \ - TNLcontext *tnl = TNL_CONTEXT(ctx); \ - struct vertex_buffer *VB = &tnl->vb; \ - GLfloat (*p4f)[4]; \ - GLfloat (*tc)[4]; \ - DWORD dwColor; - -#define GLD_SETUP_3D_VERTEX(v) \ - p4f = VB->ObjPtr->data; \ - pV->Position.x = p4f[##v][0]; \ - pV->Position.y = p4f[##v][1]; \ - pV->Position.z = p4f[##v][2]; - -#define GLD_SETUP_SMOOTH_COLOUR_3D(v) \ - p4f = (GLfloat (*)[4])VB->ColorPtr[0]->data; \ - pV->Diffuse = D3DCOLOR_COLORVALUE(p4f[##v][0], p4f[##v][1], p4f[##v][2], p4f[##v][3]); - - -#define GLD_SETUP_GET_FLAT_COLOUR_3D(v) \ - p4f = (GLfloat (*)[4])VB->ColorPtr[0]->data; \ - dwColor = D3DCOLOR_COLORVALUE(p4f[##v][0], p4f[##v][1], p4f[##v][2], p4f[##v][3]); - -#define GLD_SETUP_USE_FLAT_COLOUR_3D \ - pV->Diffuse = dwColor; - -#define GLD_SETUP_TEX0_3D(v) \ - if (VB->TexCoordPtr[0]) { \ - tc = VB->TexCoordPtr[0]->data; \ - pV->TexUnit0.x = tc[##v][0]; \ - pV->TexUnit0.y = tc[##v][1]; \ - } - -#define GLD_SETUP_TEX1_3D(v) \ - if (VB->TexCoordPtr[1]) { \ - tc = VB->TexCoordPtr[1]->data; \ - pV->TexUnit1.x = tc[##v][0]; \ - pV->TexUnit1.y = tc[##v][1]; \ - } - -//--------------------------------------------------------------------------- -// Helper functions -//--------------------------------------------------------------------------- - -__inline DWORD _gldComputeFog( - GLcontext *ctx, - SWvertex *swv) -{ - // Full fog calculation. - // Based on Mesa code. - - GLchan rFog, gFog, bFog; - GLchan fR, fG, fB; - const GLfloat f = swv->fog; - const GLfloat g = 1.0 - f; - - UNCLAMPED_FLOAT_TO_CHAN(rFog, ctx->Fog.Color[RCOMP]); - UNCLAMPED_FLOAT_TO_CHAN(gFog, ctx->Fog.Color[GCOMP]); - UNCLAMPED_FLOAT_TO_CHAN(bFog, ctx->Fog.Color[BCOMP]); - fR = f * swv->color[0] + g * rFog; - fG = f * swv->color[1] + g * gFog; - fB = f * swv->color[2] + g * bFog; - return D3DCOLOR_RGBA(fR, fG, fB, swv->color[3]); -} - -//--------------------------------------------------------------------------- - -void gld_ResetLineStipple_DX9( - GLcontext *ctx) -{ - // TODO: Fake stipple with a 32x32 texture. -} - -//--------------------------------------------------------------------------- -// 2D (post-transformed) primitives -//--------------------------------------------------------------------------- - -void gld_Points2D_DX9( - GLcontext *ctx, - GLuint first, - GLuint last) -{ - GLD_SETUP_2D_VARS_POINTS; - - unsigned i; - struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; - - // _Size is already clamped to MaxPointSize and MinPointSize - IDirect3DDevice9_SetRenderState(gld->pDev, D3DRS_POINTSIZE, *((DWORD*)&ctx->Point._Size)); - - if (VB->Elts) { - for (i=first; iClipMask[VB->Elts[i]] == 0) { -// _swrast_Point( ctx, &verts[VB->Elts[i]] ); - GLD_SETUP_GET_SWVERT(VB->Elts[i]); - GLD_SETUP_2D_VERTEX; - GLD_SETUP_SMOOTH_COLOUR; - GLD_SETUP_DEPTH; - GLD_SETUP_SPECULAR; - GLD_SETUP_TEX0; - GLD_SETUP_TEX1; - } - } - } else { - GLD_SETUP_GET_SWVERT(first); - for (i=first; iClipMask[i] == 0) { -// _swrast_Point( ctx, &verts[i] ); - GLD_SETUP_2D_VERTEX; - GLD_SETUP_SMOOTH_COLOUR; - GLD_SETUP_DEPTH; - GLD_SETUP_SPECULAR; - GLD_SETUP_TEX0; - GLD_SETUP_TEX1; - } - } - } - - gld->PB2d.pPoints = (BYTE*)pV; - gld->PB2d.nPoints += (last-first); -} - -//--------------------------------------------------------------------------- - -void gld_Line2DFlat_DX9( - GLcontext *ctx, - GLuint v0, - GLuint v1) -{ - GLD_SETUP_2D_VARS_LINES; - - GLD_SETUP_GET_SWVERT(v1); - GLD_SETUP_2D_VERTEX; - GLD_SETUP_DEPTH; - GLD_SETUP_TEX0; - GLD_SETUP_TEX1; - GLD_SETUP_GET_FLAT_COLOUR; - GLD_SETUP_USE_FLAT_COLOUR; - GLD_SETUP_GET_FLAT_SPECULAR; - GLD_SETUP_USE_FLAT_SPECULAR; - pV++; - - GLD_SETUP_GET_SWVERT(v0); - GLD_SETUP_2D_VERTEX; - GLD_SETUP_DEPTH; - GLD_SETUP_TEX0; - GLD_SETUP_TEX1; - GLD_SETUP_USE_FLAT_COLOUR; - GLD_SETUP_USE_FLAT_SPECULAR; - pV++; - - gld->PB2d.pLines = (BYTE*)pV; - gld->PB2d.nLines++; -} - -//--------------------------------------------------------------------------- - -void gld_Line2DSmooth_DX9( - GLcontext *ctx, - GLuint v0, - GLuint v1) -{ - GLD_SETUP_2D_VARS_LINES; - - GLD_SETUP_GET_SWVERT(v0); - GLD_SETUP_2D_VERTEX; - GLD_SETUP_SMOOTH_COLOUR; - GLD_SETUP_DEPTH; - GLD_SETUP_SPECULAR; - GLD_SETUP_TEX0; - GLD_SETUP_TEX1; - pV++; - - GLD_SETUP_GET_SWVERT(v1); - GLD_SETUP_2D_VERTEX; - GLD_SETUP_SMOOTH_COLOUR; - GLD_SETUP_SPECULAR; - GLD_SETUP_DEPTH; - GLD_SETUP_TEX0; - GLD_SETUP_TEX1; - pV++; - - gld->PB2d.pLines = (BYTE*)pV; - gld->PB2d.nLines++; -} - -//--------------------------------------------------------------------------- - -void gld_Triangle2DFlat_DX9( - GLcontext *ctx, - GLuint v0, - GLuint v1, - GLuint v2) -{ - GLD_SETUP_2D_VARS_TRIANGLES; - - GLD_SETUP_GET_SWVERT(v2); - GLD_SETUP_2D_VERTEX; - GLD_SETUP_DEPTH; - GLD_SETUP_TEX0; - GLD_SETUP_TEX1; - GLD_SETUP_GET_FLAT_COLOUR; - GLD_SETUP_USE_FLAT_COLOUR; - pV++;; - - GLD_SETUP_GET_SWVERT(v0); - GLD_SETUP_2D_VERTEX; - GLD_SETUP_DEPTH; - GLD_SETUP_TEX0; - GLD_SETUP_TEX1; - GLD_SETUP_USE_FLAT_COLOUR; - pV++; - - GLD_SETUP_GET_SWVERT(v1); - GLD_SETUP_2D_VERTEX; - GLD_SETUP_DEPTH; - GLD_SETUP_TEX0; - GLD_SETUP_TEX1; - GLD_SETUP_USE_FLAT_COLOUR; - pV++; - - gld->PB2d.pTriangles = (BYTE*)pV; - gld->PB2d.nTriangles++; -} - -//--------------------------------------------------------------------------- - -void gld_Triangle2DSmooth_DX9( - GLcontext *ctx, - GLuint v0, - GLuint v1, - GLuint v2) -{ - - GLD_SETUP_2D_VARS_TRIANGLES; - - GLD_SETUP_GET_SWVERT(v0); - GLD_SETUP_2D_VERTEX; - GLD_SETUP_SMOOTH_COLOUR; - GLD_SETUP_DEPTH; - GLD_SETUP_TEX0; - GLD_SETUP_TEX1; - pV++; - - GLD_SETUP_GET_SWVERT(v1); - GLD_SETUP_2D_VERTEX; - GLD_SETUP_SMOOTH_COLOUR; - GLD_SETUP_DEPTH; - GLD_SETUP_TEX0; - GLD_SETUP_TEX1; - pV++; - - GLD_SETUP_GET_SWVERT(v2); - GLD_SETUP_2D_VERTEX; - GLD_SETUP_SMOOTH_COLOUR; - GLD_SETUP_DEPTH; - GLD_SETUP_TEX0; - GLD_SETUP_TEX1; - pV++; - - gld->PB2d.pTriangles = (BYTE*)pV; - gld->PB2d.nTriangles++; -} - -//--------------------------------------------------------------------------- - -void gld_Triangle2DFlatExtras_DX9( - GLcontext *ctx, - GLuint v0, - GLuint v1, - GLuint v2) -{ - GLD_SETUP_2D_VARS_TRIANGLES; - - GLD_SETUP_TWOSIDED_LIGHTING(v2); - - GLD_SETUP_GET_SWVERT(v2); - GLD_SETUP_2D_VERTEX; - GLD_SETUP_DEPTH; - GLD_SETUP_TEX0; - GLD_SETUP_TEX1; - if (bFog) - GLD_SETUP_GET_FLAT_FOG_COLOUR; - else - GLD_SETUP_GET_FLAT_COLOUR; - GLD_SETUP_GET_FLAT_SPECULAR; - GLD_SETUP_GET_FLAT_LIGHTING(v2); - GLD_SETUP_USE_FLAT_COLOUR; - GLD_SETUP_USE_FLAT_SPECULAR; - pV++; - - GLD_SETUP_GET_SWVERT(v0); - GLD_SETUP_2D_VERTEX; - GLD_SETUP_DEPTH; - GLD_SETUP_TEX0; - GLD_SETUP_TEX1; - GLD_SETUP_USE_FLAT_COLOUR; - GLD_SETUP_USE_FLAT_SPECULAR; - pV++; - - GLD_SETUP_GET_SWVERT(v1); - GLD_SETUP_2D_VERTEX; - GLD_SETUP_DEPTH; - GLD_SETUP_TEX0; - GLD_SETUP_TEX1; - GLD_SETUP_USE_FLAT_COLOUR; - GLD_SETUP_USE_FLAT_SPECULAR; - pV++; - - gld->PB2d.pTriangles = (BYTE*)pV; - gld->PB2d.nTriangles++; -} - -//--------------------------------------------------------------------------- - -void gld_Triangle2DSmoothExtras_DX9( - GLcontext *ctx, - GLuint v0, - GLuint v1, - GLuint v2) -{ - GLD_SETUP_2D_VARS_TRIANGLES; - - GLD_SETUP_TWOSIDED_LIGHTING(v0); - - GLD_SETUP_GET_SWVERT(v0); - GLD_SETUP_2D_VERTEX; - GLD_SETUP_DEPTH; - GLD_SETUP_TEX0; - GLD_SETUP_TEX1; - GLD_SETUP_LIGHTING(v0); - pV++; - - GLD_SETUP_GET_SWVERT(v1); - GLD_SETUP_2D_VERTEX; - GLD_SETUP_DEPTH; - GLD_SETUP_TEX0; - GLD_SETUP_TEX1; - GLD_SETUP_LIGHTING(v1); - pV++; - - GLD_SETUP_GET_SWVERT(v2); - GLD_SETUP_2D_VERTEX; - GLD_SETUP_DEPTH; - GLD_SETUP_TEX0; - GLD_SETUP_TEX1; - GLD_SETUP_LIGHTING(v2); - pV++; - - gld->PB2d.pTriangles = (BYTE*)pV; - gld->PB2d.nTriangles++; -} - -//--------------------------------------------------------------------------- - -void gld_Quad2DFlat_DX9( - GLcontext *ctx, - GLuint v0, - GLuint v1, - GLuint v2, - GLuint v3) -{ - GLD_SETUP_2D_VARS_TRIANGLES; - - GLD_SETUP_GET_SWVERT(v3); - GLD_SETUP_2D_VERTEX; - GLD_SETUP_DEPTH; - GLD_SETUP_TEX0; - GLD_SETUP_TEX1; - GLD_SETUP_GET_FLAT_COLOUR; - GLD_SETUP_USE_FLAT_COLOUR; - pV++; - - GLD_SETUP_GET_SWVERT(v0); - GLD_SETUP_2D_VERTEX; - GLD_SETUP_DEPTH; - GLD_SETUP_TEX0; - GLD_SETUP_TEX1; - GLD_SETUP_USE_FLAT_COLOUR; - pV++; - - GLD_SETUP_GET_SWVERT(v1); - GLD_SETUP_2D_VERTEX; - GLD_SETUP_DEPTH; - GLD_SETUP_TEX0; - GLD_SETUP_TEX1; - GLD_SETUP_USE_FLAT_COLOUR; - pV++; - - GLD_SETUP_GET_SWVERT(v1); - GLD_SETUP_2D_VERTEX; - GLD_SETUP_DEPTH; - GLD_SETUP_TEX0; - GLD_SETUP_TEX1; - GLD_SETUP_USE_FLAT_COLOUR; - pV++; - - GLD_SETUP_GET_SWVERT(v2); - GLD_SETUP_2D_VERTEX; - GLD_SETUP_DEPTH; - GLD_SETUP_TEX0; - GLD_SETUP_TEX1; - GLD_SETUP_USE_FLAT_COLOUR; - pV++; - - GLD_SETUP_GET_SWVERT(v3); - GLD_SETUP_2D_VERTEX; - GLD_SETUP_DEPTH; - GLD_SETUP_TEX0; - GLD_SETUP_TEX1; - GLD_SETUP_USE_FLAT_COLOUR; - pV++; - - gld->PB2d.pTriangles = (BYTE*)pV; - gld->PB2d.nTriangles += 2; -} - -//--------------------------------------------------------------------------- - -void gld_Quad2DSmooth_DX9( - GLcontext *ctx, - GLuint v0, - GLuint v1, - GLuint v2, - GLuint v3) -{ - GLD_SETUP_2D_VARS_TRIANGLES; - - GLD_SETUP_GET_SWVERT(v0); - GLD_SETUP_2D_VERTEX; - GLD_SETUP_SMOOTH_COLOUR; - GLD_SETUP_DEPTH; - GLD_SETUP_TEX0; - GLD_SETUP_TEX1; - pV++; - - GLD_SETUP_GET_SWVERT(v1); - GLD_SETUP_2D_VERTEX; - GLD_SETUP_SMOOTH_COLOUR; - GLD_SETUP_DEPTH; - GLD_SETUP_TEX0; - GLD_SETUP_TEX1; - pV++; - - GLD_SETUP_GET_SWVERT(v2); - GLD_SETUP_2D_VERTEX; - GLD_SETUP_SMOOTH_COLOUR; - GLD_SETUP_DEPTH; - GLD_SETUP_TEX0; - GLD_SETUP_TEX1; - pV++; - - GLD_SETUP_GET_SWVERT(v2); - GLD_SETUP_2D_VERTEX; - GLD_SETUP_SMOOTH_COLOUR; - GLD_SETUP_DEPTH; - GLD_SETUP_TEX0; - GLD_SETUP_TEX1; - pV++; - - GLD_SETUP_GET_SWVERT(v3); - GLD_SETUP_2D_VERTEX; - GLD_SETUP_SMOOTH_COLOUR; - GLD_SETUP_DEPTH; - GLD_SETUP_TEX0; - GLD_SETUP_TEX1; - pV++; - - GLD_SETUP_GET_SWVERT(v0); - GLD_SETUP_2D_VERTEX; - GLD_SETUP_SMOOTH_COLOUR; - GLD_SETUP_DEPTH; - GLD_SETUP_TEX0; - GLD_SETUP_TEX1; - pV++; - - gld->PB2d.pTriangles = (BYTE*)pV; - gld->PB2d.nTriangles += 2; -} - -//--------------------------------------------------------------------------- - -void gld_Quad2DFlatExtras_DX9( - GLcontext *ctx, - GLuint v0, - GLuint v1, - GLuint v2, - GLuint v3) -{ - GLD_SETUP_2D_VARS_TRIANGLES; - - GLD_SETUP_TWOSIDED_LIGHTING(v3); - - GLD_SETUP_GET_SWVERT(v3); - GLD_SETUP_2D_VERTEX; - GLD_SETUP_DEPTH; - GLD_SETUP_TEX0; - GLD_SETUP_TEX1; - if (bFog) - GLD_SETUP_GET_FLAT_FOG_COLOUR; - else - GLD_SETUP_GET_FLAT_COLOUR; - GLD_SETUP_GET_FLAT_SPECULAR; - GLD_SETUP_GET_FLAT_LIGHTING(v3); - GLD_SETUP_USE_FLAT_COLOUR; - GLD_SETUP_USE_FLAT_SPECULAR; - pV++; - - GLD_SETUP_GET_SWVERT(v0); - GLD_SETUP_2D_VERTEX; - GLD_SETUP_DEPTH; - GLD_SETUP_TEX0; - GLD_SETUP_TEX1; - GLD_SETUP_USE_FLAT_COLOUR; - GLD_SETUP_USE_FLAT_SPECULAR; - pV++; - - GLD_SETUP_GET_SWVERT(v1); - GLD_SETUP_2D_VERTEX; - GLD_SETUP_DEPTH; - GLD_SETUP_TEX0; - GLD_SETUP_TEX1; - GLD_SETUP_USE_FLAT_COLOUR; - GLD_SETUP_USE_FLAT_SPECULAR; - pV++; - - GLD_SETUP_GET_SWVERT(v1); - GLD_SETUP_2D_VERTEX; - GLD_SETUP_DEPTH; - GLD_SETUP_TEX0; - GLD_SETUP_TEX1; - GLD_SETUP_USE_FLAT_COLOUR; - GLD_SETUP_USE_FLAT_SPECULAR; - pV++; - - GLD_SETUP_GET_SWVERT(v2); - GLD_SETUP_2D_VERTEX; - GLD_SETUP_DEPTH; - GLD_SETUP_TEX0; - GLD_SETUP_TEX1; - GLD_SETUP_USE_FLAT_COLOUR; - GLD_SETUP_USE_FLAT_SPECULAR; - pV++; - - GLD_SETUP_GET_SWVERT(v3); - GLD_SETUP_2D_VERTEX; - GLD_SETUP_DEPTH; - GLD_SETUP_TEX0; - GLD_SETUP_TEX1; - GLD_SETUP_USE_FLAT_COLOUR; - GLD_SETUP_USE_FLAT_SPECULAR; - pV++; - - gld->PB2d.pTriangles = (BYTE*)pV; - gld->PB2d.nTriangles += 2; -} - -//--------------------------------------------------------------------------- - -void gld_Quad2DSmoothExtras_DX9( - GLcontext *ctx, - GLuint v0, - GLuint v1, - GLuint v2, - GLuint v3) -{ - GLD_SETUP_2D_VARS_TRIANGLES; - - GLD_SETUP_TWOSIDED_LIGHTING(v0); - - GLD_SETUP_GET_SWVERT(v0); - GLD_SETUP_2D_VERTEX; - GLD_SETUP_DEPTH; - GLD_SETUP_TEX0; - GLD_SETUP_TEX1; - GLD_SETUP_LIGHTING(v0); - pV++; - - GLD_SETUP_GET_SWVERT(v1); - GLD_SETUP_2D_VERTEX; - GLD_SETUP_DEPTH; - GLD_SETUP_TEX0; - GLD_SETUP_TEX1; - GLD_SETUP_LIGHTING(v1); - pV++; - - GLD_SETUP_GET_SWVERT(v2); - GLD_SETUP_2D_VERTEX; - GLD_SETUP_DEPTH; - GLD_SETUP_TEX0; - GLD_SETUP_TEX1; - GLD_SETUP_LIGHTING(v2); - pV++; - - GLD_SETUP_GET_SWVERT(v2); - GLD_SETUP_2D_VERTEX; - GLD_SETUP_DEPTH; - GLD_SETUP_TEX0; - GLD_SETUP_TEX1; - GLD_SETUP_LIGHTING(v2); - pV++; - - GLD_SETUP_GET_SWVERT(v3); - GLD_SETUP_2D_VERTEX; - GLD_SETUP_DEPTH; - GLD_SETUP_TEX0; - GLD_SETUP_TEX1; - GLD_SETUP_LIGHTING(v3); - pV++; - - GLD_SETUP_GET_SWVERT(v0); - GLD_SETUP_2D_VERTEX; - GLD_SETUP_DEPTH; - GLD_SETUP_TEX0; - GLD_SETUP_TEX1; - GLD_SETUP_LIGHTING(v0); - pV++; - - gld->PB2d.pTriangles = (BYTE*)pV; - gld->PB2d.nTriangles += 2; -} - -//--------------------------------------------------------------------------- -// 3D (pre-transformed) primitives -//--------------------------------------------------------------------------- - -void gld_Points3D_DX9( - GLcontext *ctx, - GLuint first, - GLuint last) -{ - GLD_SETUP_3D_VARS_POINTS - - unsigned i; -// struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; - - // _Size is already clamped to MaxPointSize and MinPointSize - IDirect3DDevice9_SetRenderState(gld->pDev, D3DRS_POINTSIZE, *((DWORD*)&ctx->Point._Size)); - - if (VB->Elts) { - for (i=first; iClipMask[VB->Elts[i]] == 0) { -// _swrast_Point( ctx, &verts[VB->Elts[i]] ); -// GLD_SETUP_GET_SWVERT(VB->Elts[i]); - GLD_SETUP_3D_VERTEX(VB->Elts[i]) - GLD_SETUP_SMOOTH_COLOUR_3D(i) - GLD_SETUP_TEX0_3D(i) - GLD_SETUP_TEX1_3D(i) - } - } - } else { -// GLD_SETUP_GET_SWVERT(first); - for (i=first; iClipMask[i] == 0) { -// _swrast_Point( ctx, &verts[i] ); - GLD_SETUP_3D_VERTEX(i) - GLD_SETUP_SMOOTH_COLOUR_3D(i) - GLD_SETUP_TEX0_3D(i) - GLD_SETUP_TEX1_3D(i) - } - } - } -/* - for (i=first; iPB3d.pPoints = (BYTE*)pV; - gld->PB3d.nPoints += (last-first); -} - -//--------------------------------------------------------------------------- -// Line functions -//--------------------------------------------------------------------------- - -void gld_Line3DFlat_DX9( - GLcontext *ctx, - GLuint v0, - GLuint v1) -{ - GLD_SETUP_3D_VARS_LINES - - GLD_SETUP_3D_VERTEX(v1) - GLD_SETUP_GET_FLAT_COLOUR_3D(v1) - GLD_SETUP_USE_FLAT_COLOUR_3D - GLD_SETUP_TEX0_3D(v1) - GLD_SETUP_TEX1_3D(v1) - pV++; - - GLD_SETUP_3D_VERTEX(v0) - GLD_SETUP_USE_FLAT_COLOUR_3D - GLD_SETUP_TEX0_3D(v0) - GLD_SETUP_TEX1_3D(v0) - pV++; - - gld->PB3d.pLines = (BYTE*)pV; - gld->PB3d.nLines++; -} - -//--------------------------------------------------------------------------- - -void gld_Line3DSmooth_DX9( - GLcontext *ctx, - GLuint v0, - GLuint v1) -{ - GLD_SETUP_3D_VARS_LINES - - GLD_SETUP_3D_VERTEX(v1) - GLD_SETUP_SMOOTH_COLOUR_3D(v1) - GLD_SETUP_TEX0_3D(v1) - GLD_SETUP_TEX1_3D(v1) - pV++; - - GLD_SETUP_3D_VERTEX(v0) - GLD_SETUP_SMOOTH_COLOUR_3D(v0) - GLD_SETUP_TEX0_3D(v0) - GLD_SETUP_TEX1_3D(v0) - pV++; - - gld->PB3d.pLines = (BYTE*)pV; - gld->PB3d.nLines++; -} - -//--------------------------------------------------------------------------- -// Triangle functions -//--------------------------------------------------------------------------- - -void gld_Triangle3DFlat_DX9( - GLcontext *ctx, - GLuint v0, - GLuint v1, - GLuint v2) -{ - GLD_SETUP_3D_VARS_TRIANGLES - - GLD_SETUP_3D_VERTEX(v2) - GLD_SETUP_TEX0_3D(v2) - GLD_SETUP_TEX1_3D(v2) - GLD_SETUP_GET_FLAT_COLOUR_3D(v2) - GLD_SETUP_USE_FLAT_COLOUR_3D - pV++; - - GLD_SETUP_3D_VERTEX(v0) - GLD_SETUP_TEX0_3D(v0) - GLD_SETUP_TEX1_3D(v0) - GLD_SETUP_USE_FLAT_COLOUR_3D - pV++; - - GLD_SETUP_3D_VERTEX(v1) - GLD_SETUP_TEX0_3D(v1) - GLD_SETUP_TEX1_3D(v1) - GLD_SETUP_USE_FLAT_COLOUR_3D - pV++; - - gld->PB3d.pTriangles = (BYTE*)pV; - gld->PB3d.nTriangles++; -} - -//--------------------------------------------------------------------------- - -void gld_Triangle3DSmooth_DX9( - GLcontext *ctx, - GLuint v0, - GLuint v1, - GLuint v2) -{ - GLD_SETUP_3D_VARS_TRIANGLES - - GLD_SETUP_3D_VERTEX(v0) - GLD_SETUP_SMOOTH_COLOUR_3D(v0) - GLD_SETUP_TEX0_3D(v0) - GLD_SETUP_TEX1_3D(v0) - pV++; - - GLD_SETUP_3D_VERTEX(v1) - GLD_SETUP_SMOOTH_COLOUR_3D(v1) - GLD_SETUP_TEX0_3D(v1) - GLD_SETUP_TEX1_3D(v1) - pV++; - - GLD_SETUP_3D_VERTEX(v2) - GLD_SETUP_SMOOTH_COLOUR_3D(v2) - GLD_SETUP_TEX0_3D(v2) - GLD_SETUP_TEX1_3D(v2) - pV++; - - gld->PB3d.pTriangles = (BYTE*)pV; - gld->PB3d.nTriangles++; -} - -//--------------------------------------------------------------------------- -// Quad functions -//--------------------------------------------------------------------------- - -void gld_Quad3DFlat_DX9( - GLcontext *ctx, - GLuint v0, - GLuint v1, - GLuint v2, - GLuint v3) -{ - GLD_SETUP_3D_VARS_TRIANGLES - - GLD_SETUP_3D_VERTEX(v3) - GLD_SETUP_GET_FLAT_COLOUR_3D(v3) - GLD_SETUP_USE_FLAT_COLOUR_3D - GLD_SETUP_TEX0_3D(v3) - GLD_SETUP_TEX1_3D(v3) - pV++; - - GLD_SETUP_3D_VERTEX(v0) - GLD_SETUP_USE_FLAT_COLOUR_3D - GLD_SETUP_TEX0_3D(v0) - GLD_SETUP_TEX1_3D(v0) - pV++; - - GLD_SETUP_3D_VERTEX(v1) - GLD_SETUP_USE_FLAT_COLOUR_3D - GLD_SETUP_TEX0_3D(v1) - GLD_SETUP_TEX1_3D(v1) - pV++; - - GLD_SETUP_3D_VERTEX(v1) - GLD_SETUP_USE_FLAT_COLOUR_3D - GLD_SETUP_TEX0_3D(v1) - GLD_SETUP_TEX1_3D(v1) - pV++; - - GLD_SETUP_3D_VERTEX(v2) - GLD_SETUP_USE_FLAT_COLOUR_3D - GLD_SETUP_TEX0_3D(v2) - GLD_SETUP_TEX1_3D(v2) - pV++; - - GLD_SETUP_3D_VERTEX(v3) - GLD_SETUP_USE_FLAT_COLOUR_3D - GLD_SETUP_TEX0_3D(v3) - GLD_SETUP_TEX1_3D(v3) - pV++; - - gld->PB3d.pTriangles = (BYTE*)pV; - gld->PB3d.nTriangles += 2; -} - -//--------------------------------------------------------------------------- - -void gld_Quad3DSmooth_DX9( - GLcontext *ctx, - GLuint v0, - GLuint v1, - GLuint v2, - GLuint v3) -{ - GLD_SETUP_3D_VARS_TRIANGLES - - GLD_SETUP_3D_VERTEX(v0) - GLD_SETUP_SMOOTH_COLOUR_3D(v0) - GLD_SETUP_TEX0_3D(v0) - GLD_SETUP_TEX1_3D(v0) - pV++; - - GLD_SETUP_3D_VERTEX(v1) - GLD_SETUP_SMOOTH_COLOUR_3D(v1) - GLD_SETUP_TEX0_3D(v1) - GLD_SETUP_TEX1_3D(v1) - pV++; - - GLD_SETUP_3D_VERTEX(v2) - GLD_SETUP_SMOOTH_COLOUR_3D(v2) - GLD_SETUP_TEX0_3D(v2) - GLD_SETUP_TEX1_3D(v2) - pV++; - - GLD_SETUP_3D_VERTEX(v2) - GLD_SETUP_SMOOTH_COLOUR_3D(v2) - GLD_SETUP_TEX0_3D(v2) - GLD_SETUP_TEX1_3D(v2) - pV++; - - GLD_SETUP_3D_VERTEX(v3) - GLD_SETUP_SMOOTH_COLOUR_3D(v3) - GLD_SETUP_TEX0_3D(v3) - GLD_SETUP_TEX1_3D(v3) - pV++; - - GLD_SETUP_3D_VERTEX(v0) - GLD_SETUP_SMOOTH_COLOUR_3D(v0) - GLD_SETUP_TEX0_3D(v0) - GLD_SETUP_TEX1_3D(v0) - pV++; - - gld->PB3d.pTriangles = (BYTE*)pV; - gld->PB3d.nTriangles += 2; -} - -//--------------------------------------------------------------------------- -// Vertex setup for two-sided-lighting vertex shader -//--------------------------------------------------------------------------- - -/* - -void gld_Points2DTwoside_DX9(GLcontext *ctx, GLuint first, GLuint last) -{ - // NOTE: Two-sided lighting does not apply to Points -} - -//--------------------------------------------------------------------------- - -void gld_Line2DFlatTwoside_DX9(GLcontext *ctx, GLuint v0, GLuint v1) -{ - // NOTE: Two-sided lighting does not apply to Lines -} - -//--------------------------------------------------------------------------- - -void gld_Line2DSmoothTwoside_DX9(GLcontext *ctx, GLuint v0, GLuint v1) -{ - // NOTE: Two-sided lighting does not apply to Lines -} - -//--------------------------------------------------------------------------- - -void gld_Triangle2DFlatTwoside_DX9(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2) -{ -} - -//--------------------------------------------------------------------------- - -void gld_Triangle2DSmoothTwoside_DX9(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2) -{ - GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); - GLD_driver_dx9 *gld = GLD_GET_DX9_DRIVER(gldCtx); - GLD_TWOSIDED_VERTEX *pV = (GLD_TWOSIDED_VERTEX*)gld->PBtwosidelight.pTriangles; - SScontext *ss = SWSETUP_CONTEXT(ctx); - SWvertex *swv; - DWORD dwSpecularColour; - DWORD dwFlatColour; - GLuint facing = 0; - struct vertex_buffer *VB; - GLchan (*vbcolor)[4]; - GLchan (*vbspec)[4]; - - // Reciprocal of DepthMax - const float ooDepthMax = 1.0f / ctx->DepthMaxF; - - // 1st vert - swv = &ss->verts[v0]; - pV->Position.x = swv->win[0]; - pV->Position.y = GLD_FLIP_Y(swv->win[1]); - pV->Position.z = swv->win[2] * ooDepthMax; - pV->Position.w = swv->win[3]; - pV->TexUnit0.x = swv->texcoord[0][0]; - pV->TexUnit0.y = swv->texcoord[0][1]; - pV->TexUnit1.x = swv->texcoord[1][0]; - pV->TexUnit1.y = swv->texcoord[1][1]; - pV->FrontDiffuse = GLD_COLOUR; - pV->FrontSpecular = GLD_SPECULAR; - pV++; - - // 2nd vert - swv = &ss->verts[v1]; - pV->Position.x = swv->win[0]; - pV->Position.y = GLD_FLIP_Y(swv->win[1]); - pV->Position.z = swv->win[2] * ooDepthMax; - pV->Position.w = swv->win[3]; - pV->TexUnit0.x = swv->texcoord[0][0]; - pV->TexUnit0.y = swv->texcoord[0][1]; - pV->TexUnit1.x = swv->texcoord[1][0]; - pV->TexUnit1.y = swv->texcoord[1][1]; - pV->FrontDiffuse = GLD_COLOUR; - pV->FrontSpecular = GLD_SPECULAR; - pV++; - - // 3rd vert - swv = &ss->verts[v2]; - pV->Position.x = swv->win[0]; - pV->Position.y = GLD_FLIP_Y(swv->win[1]); - pV->Position.z = swv->win[2] * ooDepthMax; - pV->Position.w = swv->win[3]; - pV->TexUnit0.x = swv->texcoord[0][0]; - pV->TexUnit0.y = swv->texcoord[0][1]; - pV->TexUnit1.x = swv->texcoord[1][0]; - pV->TexUnit1.y = swv->texcoord[1][1]; - pV->FrontDiffuse = GLD_COLOUR; - pV->FrontSpecular = GLD_SPECULAR; - pV++; - - gld->PBtwosidelight.pTriangles = (BYTE*)pV; - gld->PBtwosidelight.nTriangles++; -} - -//--------------------------------------------------------------------------- - -void gld_Quad2DFlatTwoside_DX9(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3) -{ - GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); - GLD_driver_dx9 *gld = GLD_GET_DX9_DRIVER(gldCtx); - GLD_TWOSIDED_VERTEX *pV = (GLD_TWOSIDED_VERTEX*)gld->PBtwosidelight.pTriangles; - SScontext *ss = SWSETUP_CONTEXT(ctx); - SWvertex *swv; - DWORD dwSpecularColour; - DWORD dwFlatColour; - GLuint facing = 0; - struct vertex_buffer *VB; - GLchan (*vbcolor)[4]; - GLchan (*vbspec)[4]; - - // Reciprocal of DepthMax - const float ooDepthMax = 1.0f / ctx->DepthMaxF; - - // 1st vert - swv = &ss->verts[v0]; - pV->Position.x = swv->win[0]; - pV->Position.y = GLD_FLIP_Y(swv->win[1]); - pV->Position.z = swv->win[2] * ooDepthMax; - pV->Position.w = swv->win[3]; - pV->TexUnit0.x = swv->texcoord[0][0]; - pV->TexUnit0.y = swv->texcoord[0][1]; - pV->TexUnit1.x = swv->texcoord[1][0]; - pV->TexUnit1.y = swv->texcoord[1][1]; - pV->FrontDiffuse = GLD_COLOUR; - pV->FrontSpecular = GLD_SPECULAR; - pV++; - - // 2nd vert - swv = &ss->verts[v1]; - pV->Position.x = swv->win[0]; - pV->Position.y = GLD_FLIP_Y(swv->win[1]); - pV->Position.z = swv->win[2] * ooDepthMax; - pV->Position.w = swv->win[3]; - pV->TexUnit0.x = swv->texcoord[0][0]; - pV->TexUnit0.y = swv->texcoord[0][1]; - pV->TexUnit1.x = swv->texcoord[1][0]; - pV->TexUnit1.y = swv->texcoord[1][1]; - pV->FrontDiffuse = GLD_COLOUR; - pV->FrontSpecular = GLD_SPECULAR; - pV++; - - // 3rd vert - swv = &ss->verts[v2]; - pV->Position.x = swv->win[0]; - pV->Position.y = GLD_FLIP_Y(swv->win[1]); - pV->Position.z = swv->win[2] * ooDepthMax; - pV->Position.w = swv->win[3]; - pV->TexUnit0.x = swv->texcoord[0][0]; - pV->TexUnit0.y = swv->texcoord[0][1]; - pV->TexUnit1.x = swv->texcoord[1][0]; - pV->TexUnit1.y = swv->texcoord[1][1]; - pV->FrontDiffuse = GLD_COLOUR; - pV->FrontSpecular = GLD_SPECULAR; - pV++; - - // 4th vert - swv = &ss->verts[v2]; - pV->Position.x = swv->win[0]; - pV->Position.y = GLD_FLIP_Y(swv->win[1]); - pV->Position.z = swv->win[2] * ooDepthMax; - pV->Position.w = swv->win[3]; - pV->TexUnit0.x = swv->texcoord[0][0]; - pV->TexUnit0.y = swv->texcoord[0][1]; - pV->TexUnit1.x = swv->texcoord[1][0]; - pV->TexUnit1.y = swv->texcoord[1][1]; - pV->FrontDiffuse = GLD_COLOUR; - pV->FrontSpecular = GLD_SPECULAR; - pV++; - - // 5th vert - swv = &ss->verts[v3]; - pV->Position.x = swv->win[0]; - pV->Position.y = GLD_FLIP_Y(swv->win[1]); - pV->Position.z = swv->win[2] * ooDepthMax; - pV->Position.w = swv->win[3]; - pV->TexUnit0.x = swv->texcoord[0][0]; - pV->TexUnit0.y = swv->texcoord[0][1]; - pV->TexUnit1.x = swv->texcoord[1][0]; - pV->TexUnit1.y = swv->texcoord[1][1]; - pV->FrontDiffuse = GLD_COLOUR; - pV->FrontSpecular = GLD_SPECULAR; - pV++; - - // 6th vert - swv = &ss->verts[v0]; - pV->Position.x = swv->win[0]; - pV->Position.y = GLD_FLIP_Y(swv->win[1]); - pV->Position.z = swv->win[2] * ooDepthMax; - pV->Position.w = swv->win[3]; - pV->TexUnit0.x = swv->texcoord[0][0]; - pV->TexUnit0.y = swv->texcoord[0][1]; - pV->TexUnit1.x = swv->texcoord[1][0]; - pV->TexUnit1.y = swv->texcoord[1][1]; - pV->FrontDiffuse = GLD_COLOUR; - pV->FrontSpecular = GLD_SPECULAR; - pV++; - - gld->PBtwosidelight.pTriangles = (BYTE*)pV; - gld->PBtwosidelight.nTriangles += 2; -} - -//--------------------------------------------------------------------------- - -void gld_Quad2DSmoothTwoside_DX9(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3) -{ - GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); - GLD_driver_dx9 *gld = GLD_GET_DX9_DRIVER(gldCtx); - GLD_TWOSIDED_VERTEX *pV = (GLD_TWOSIDED_VERTEX*)gld->PBtwosidelight.pTriangles; - SScontext *ss = SWSETUP_CONTEXT(ctx); - SWvertex *swv; - DWORD dwSpecularColour; - DWORD dwFlatColour; - GLuint facing = 0; - struct vertex_buffer *VB; - GLchan (*vbcolor)[4]; - GLchan (*vbspec)[4]; - - // Reciprocal of DepthMax - const float ooDepthMax = 1.0f / ctx->DepthMaxF; - - // 1st vert - swv = &ss->verts[v0]; - pV->Position.x = swv->win[0]; - pV->Position.y = GLD_FLIP_Y(swv->win[1]); - pV->Position.z = swv->win[2] * ooDepthMax; - pV->Position.w = swv->win[3]; - pV->TexUnit0.x = swv->texcoord[0][0]; - pV->TexUnit0.y = swv->texcoord[0][1]; - pV->TexUnit1.x = swv->texcoord[1][0]; - pV->TexUnit1.y = swv->texcoord[1][1]; - pV->FrontDiffuse = GLD_COLOUR; - pV->FrontSpecular = GLD_SPECULAR; - pV++; - - // 2nd vert - swv = &ss->verts[v1]; - pV->Position.x = swv->win[0]; - pV->Position.y = GLD_FLIP_Y(swv->win[1]); - pV->Position.z = swv->win[2] * ooDepthMax; - pV->Position.w = swv->win[3]; - pV->TexUnit0.x = swv->texcoord[0][0]; - pV->TexUnit0.y = swv->texcoord[0][1]; - pV->TexUnit1.x = swv->texcoord[1][0]; - pV->TexUnit1.y = swv->texcoord[1][1]; - pV->FrontDiffuse = GLD_COLOUR; - pV->FrontSpecular = GLD_SPECULAR; - pV++; - - // 3rd vert - swv = &ss->verts[v2]; - pV->Position.x = swv->win[0]; - pV->Position.y = GLD_FLIP_Y(swv->win[1]); - pV->Position.z = swv->win[2] * ooDepthMax; - pV->Position.w = swv->win[3]; - pV->TexUnit0.x = swv->texcoord[0][0]; - pV->TexUnit0.y = swv->texcoord[0][1]; - pV->TexUnit1.x = swv->texcoord[1][0]; - pV->TexUnit1.y = swv->texcoord[1][1]; - pV->FrontDiffuse = GLD_COLOUR; - pV->FrontSpecular = GLD_SPECULAR; - pV++; - - // 4th vert - swv = &ss->verts[v2]; - pV->Position.x = swv->win[0]; - pV->Position.y = GLD_FLIP_Y(swv->win[1]); - pV->Position.z = swv->win[2] * ooDepthMax; - pV->Position.w = swv->win[3]; - pV->TexUnit0.x = swv->texcoord[0][0]; - pV->TexUnit0.y = swv->texcoord[0][1]; - pV->TexUnit1.x = swv->texcoord[1][0]; - pV->TexUnit1.y = swv->texcoord[1][1]; - pV->FrontDiffuse = GLD_COLOUR; - pV->FrontSpecular = GLD_SPECULAR; - pV++; - - // 5th vert - swv = &ss->verts[v3]; - pV->Position.x = swv->win[0]; - pV->Position.y = GLD_FLIP_Y(swv->win[1]); - pV->Position.z = swv->win[2] * ooDepthMax; - pV->Position.w = swv->win[3]; - pV->TexUnit0.x = swv->texcoord[0][0]; - pV->TexUnit0.y = swv->texcoord[0][1]; - pV->TexUnit1.x = swv->texcoord[1][0]; - pV->TexUnit1.y = swv->texcoord[1][1]; - pV->FrontDiffuse = GLD_COLOUR; - pV->FrontSpecular = GLD_SPECULAR; - pV++; - - // 6th vert - swv = &ss->verts[v0]; - pV->Position.x = swv->win[0]; - pV->Position.y = GLD_FLIP_Y(swv->win[1]); - pV->Position.z = swv->win[2] * ooDepthMax; - pV->Position.w = swv->win[3]; - pV->TexUnit0.x = swv->texcoord[0][0]; - pV->TexUnit0.y = swv->texcoord[0][1]; - pV->TexUnit1.x = swv->texcoord[1][0]; - pV->TexUnit1.y = swv->texcoord[1][1]; - pV->FrontDiffuse = GLD_COLOUR; - pV->FrontSpecular = GLD_SPECULAR; - pV++; - - gld->PBtwosidelight.pTriangles = (BYTE*)pV; - gld->PBtwosidelight.nTriangles += 2; -} - -//--------------------------------------------------------------------------- - -*/ diff --git a/src/mesa/drivers/windows/gldirect/dx9/gld_texture_dx9.c b/src/mesa/drivers/windows/gldirect/dx9/gld_texture_dx9.c deleted file mode 100644 index 5a82235616..0000000000 --- a/src/mesa/drivers/windows/gldirect/dx9/gld_texture_dx9.c +++ /dev/null @@ -1,2104 +0,0 @@ -/**************************************************************************** -* -* Mesa 3-D graphics library -* Direct3D Driver Interface -* -* ======================================================================== -* -* Copyright (C) 1991-2004 SciTech Software, Inc. All rights reserved. -* -* Permission is hereby granted, free of charge, to any person obtaining a -* copy of this software and associated documentation files (the "Software"), -* to deal in the Software without restriction, including without limitation -* the rights to use, copy, modify, merge, publish, distribute, sublicense, -* and/or sell copies of the Software, and to permit persons to whom the -* Software is furnished to do so, subject to the following conditions: -* -* The above copyright notice and this permission notice shall be included -* in all copies or substantial portions of the Software. -* -* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -* SCITECH SOFTWARE INC BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF -* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -* SOFTWARE. -* -* ====================================================================== -* -* Language: ANSI C -* Environment: Windows 9x/2000/XP/XBox (Win32) -* -* Description: Texture / Bitmap functions -* -****************************************************************************/ - -#include "dglcontext.h" -#include "ddlog.h" -#include "gld_dx9.h" - -#include - -#include "texformat.h" -#include "colormac.h" -#include "texstore.h" -#include "image.h" -// #include "mem.h" - -//--------------------------------------------------------------------------- - -#define GLD_FLIP_HEIGHT(y,h) (gldCtx->dwHeight - (y) - (h)) - -//--------------------------------------------------------------------------- -// 1D texture fetch -//--------------------------------------------------------------------------- - -#define CHAN_SRC( t, i, j, k, sz ) \ - ((GLchan *)(t)->Data + (i) * (sz)) -#define UBYTE_SRC( t, i, j, k, sz ) \ - ((GLubyte *)(t)->Data + (i) * (sz)) -#define USHORT_SRC( t, i, j, k ) \ - ((GLushort *)(t)->Data + (i)) -#define FLOAT_SRC( t, i, j, k ) \ - ((GLfloat *)(t)->Data + (i)) - -//--------------------------------------------------------------------------- - -static void gld_fetch_1d_texel_X8R8G8B8( - const struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, GLchan *texel ) -{ - const GLchan *src = CHAN_SRC( texImage, i, j, k, 4 ); - GLchan *rgba = (GLchan *)texel; - rgba[RCOMP] = src[2]; - rgba[GCOMP] = src[1]; - rgba[BCOMP] = src[0]; - rgba[ACOMP] = CHAN_MAX; -} - -//--------------------------------------------------------------------------- - -static void gld_fetch_1d_texel_f_X8R8G8B8( - const struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel ) -{ - const GLchan *src = CHAN_SRC( texImage, i, j, k, 4 ); - texel[RCOMP] = CHAN_TO_FLOAT(src[0]); - texel[GCOMP] = CHAN_TO_FLOAT(src[1]); - texel[BCOMP] = CHAN_TO_FLOAT(src[2]); - texel[ACOMP] = 1.f; -} - -//--------------------------------------------------------------------------- - -static void gld_fetch_1d_texel_X1R5G5B5( - const struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, GLchan *texel ) -{ - const GLushort *src = USHORT_SRC( texImage, i, j, k ); - GLchan *rgba = (GLchan *) texel; GLushort s = *src; - rgba[RCOMP] = UBYTE_TO_CHAN( ((s >> 10) & 0xf8) * 255 / 0xf8 ); - rgba[GCOMP] = UBYTE_TO_CHAN( ((s >> 5) & 0xf8) * 255 / 0xf8 ); - rgba[BCOMP] = UBYTE_TO_CHAN( ((s ) & 0xf8) * 255 / 0xf8 ); - rgba[ACOMP] = CHAN_MAX; -} - -//--------------------------------------------------------------------------- - -static void gld_fetch_1d_texel_f_X1R5G5B5( - const struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel ) -{ - const GLushort *src = USHORT_SRC( texImage, i, j, k ); - GLushort s = *src; - texel[RCOMP] = UBYTE_TO_FLOAT( ((s >> 10) & 0xf8) * 255 / 0xf8 ); - texel[GCOMP] = UBYTE_TO_FLOAT( ((s >> 5) & 0xf8) * 255 / 0xf8 ); - texel[BCOMP] = UBYTE_TO_FLOAT( ((s ) & 0xf8) * 255 / 0xf8 ); - texel[ACOMP] = 1.f; -} - -//--------------------------------------------------------------------------- - -static void gld_fetch_1d_texel_X4R4G4B4( - const struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, GLchan *texel ) -{ - const GLushort *src = USHORT_SRC( texImage, i, j, k ); - GLchan *rgba = (GLchan *) texel; GLushort s = *src; - rgba[RCOMP] = UBYTE_TO_CHAN( ((s >> 8) & 0xf) * 255 / 0xf ); - rgba[GCOMP] = UBYTE_TO_CHAN( ((s >> 4) & 0xf) * 255 / 0xf ); - rgba[BCOMP] = UBYTE_TO_CHAN( ((s ) & 0xf) * 255 / 0xf ); - rgba[ACOMP] = CHAN_MAX; -} - -//--------------------------------------------------------------------------- - -static void gld_fetch_1d_texel_f_X4R4G4B4( - const struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel ) -{ - const GLushort *src = USHORT_SRC( texImage, i, j, k ); - GLushort s = *src; - texel[RCOMP] = UBYTE_TO_FLOAT( ((s >> 8) & 0xf) * 255 / 0xf ); - texel[GCOMP] = UBYTE_TO_FLOAT( ((s >> 4) & 0xf) * 255 / 0xf ); - texel[BCOMP] = UBYTE_TO_FLOAT( ((s ) & 0xf) * 255 / 0xf ); - texel[ACOMP] = 1.f; -} - -//--------------------------------------------------------------------------- - -#undef CHAN_SRC -#undef UBYTE_SRC -#undef USHORT_SRC -#undef FLOAT_SRC - -//--------------------------------------------------------------------------- -// 2D texture fetch -//--------------------------------------------------------------------------- - -#define CHAN_SRC( t, i, j, k, sz ) \ - ((GLchan *)(t)->Data + ((t)->Width * (j) + (i)) * (sz)) -#define UBYTE_SRC( t, i, j, k, sz ) \ - ((GLubyte *)(t)->Data + ((t)->Width * (j) + (i)) * (sz)) -#define USHORT_SRC( t, i, j, k ) \ - ((GLushort *)(t)->Data + ((t)->Width * (j) + (i))) -#define FLOAT_SRC( t, i, j, k ) \ - ((GLfloat *)(t)->Data + ((t)->Width * (j) + (i))) - -//--------------------------------------------------------------------------- - -static void gld_fetch_2d_texel_X8R8G8B8( - const struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, GLchan *texel ) -{ - const GLchan *src = CHAN_SRC( texImage, i, j, k, 4 ); - GLchan *rgba = (GLchan *)texel; - rgba[RCOMP] = src[2]; - rgba[GCOMP] = src[1]; - rgba[BCOMP] = src[0]; - rgba[ACOMP] = CHAN_MAX; -} - -//--------------------------------------------------------------------------- - -static void gld_fetch_2d_texel_f_X8R8G8B8( - const struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel ) -{ - const GLchan *src = CHAN_SRC( texImage, i, j, k, 4 ); - texel[RCOMP] = CHAN_TO_FLOAT(src[0]); - texel[GCOMP] = CHAN_TO_FLOAT(src[1]); - texel[BCOMP] = CHAN_TO_FLOAT(src[2]); - texel[ACOMP] = 1.f; -} - -//--------------------------------------------------------------------------- - -static void gld_fetch_2d_texel_X1R5G5B5( - const struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, GLchan *texel ) -{ - const GLushort *src = USHORT_SRC( texImage, i, j, k ); - GLchan *rgba = (GLchan *) texel; GLushort s = *src; - rgba[RCOMP] = UBYTE_TO_CHAN( ((s >> 10) & 0xf8) * 255 / 0xf8 ); - rgba[GCOMP] = UBYTE_TO_CHAN( ((s >> 5) & 0xf8) * 255 / 0xf8 ); - rgba[BCOMP] = UBYTE_TO_CHAN( ((s ) & 0xf8) * 255 / 0xf8 ); - rgba[ACOMP] = CHAN_MAX; -} - -//--------------------------------------------------------------------------- - -static void gld_fetch_2d_texel_f_X1R5G5B5( - const struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel ) -{ - const GLushort *src = USHORT_SRC( texImage, i, j, k ); - GLushort s = *src; - texel[RCOMP] = UBYTE_TO_FLOAT( ((s >> 10) & 0xf8) * 255 / 0xf8 ); - texel[GCOMP] = UBYTE_TO_FLOAT( ((s >> 5) & 0xf8) * 255 / 0xf8 ); - texel[BCOMP] = UBYTE_TO_FLOAT( ((s ) & 0xf8) * 255 / 0xf8 ); - texel[ACOMP] = 1.f; -} - -//--------------------------------------------------------------------------- - -static void gld_fetch_2d_texel_X4R4G4B4( - const struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, GLchan *texel ) -{ - const GLushort *src = USHORT_SRC( texImage, i, j, k ); - GLchan *rgba = (GLchan *) texel; GLushort s = *src; - rgba[RCOMP] = UBYTE_TO_CHAN( ((s >> 8) & 0xf) * 255 / 0xf ); - rgba[GCOMP] = UBYTE_TO_CHAN( ((s >> 4) & 0xf) * 255 / 0xf ); - rgba[BCOMP] = UBYTE_TO_CHAN( ((s ) & 0xf) * 255 / 0xf ); - rgba[ACOMP] = CHAN_MAX; -} - -//--------------------------------------------------------------------------- - -static void gld_fetch_2d_texel_f_X4R4G4B4( - const struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel ) -{ - const GLushort *src = USHORT_SRC( texImage, i, j, k ); - GLushort s = *src; - texel[RCOMP] = UBYTE_TO_FLOAT( ((s >> 8) & 0xf) * 255 / 0xf ); - texel[GCOMP] = UBYTE_TO_FLOAT( ((s >> 4) & 0xf) * 255 / 0xf ); - texel[BCOMP] = UBYTE_TO_FLOAT( ((s ) & 0xf) * 255 / 0xf ); - texel[ACOMP] = 1.f; -} - -//--------------------------------------------------------------------------- - -#undef CHAN_SRC -#undef UBYTE_SRC -#undef USHORT_SRC -#undef FLOAT_SRC - -//--------------------------------------------------------------------------- -// 3D texture fetch -//--------------------------------------------------------------------------- - -#define CHAN_SRC( t, i, j, k, sz ) \ - (GLchan *)(t)->Data + (((t)->Height * (k) + (j)) * \ - (t)->Width + (i)) * (sz) -#define UBYTE_SRC( t, i, j, k, sz ) \ - ((GLubyte *)(t)->Data + (((t)->Height * (k) + (j)) * \ - (t)->Width + (i)) * (sz)) -#define USHORT_SRC( t, i, j, k ) \ - ((GLushort *)(t)->Data + (((t)->Height * (k) + (j)) * \ - (t)->Width + (i))) -#define FLOAT_SRC( t, i, j, k ) \ - ((GLfloat *)(t)->Data + (((t)->Height * (k) + (j)) * \ - (t)->Width + (i))) - -//--------------------------------------------------------------------------- - -static void gld_fetch_3d_texel_X8R8G8B8( - const struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, GLchan *texel ) -{ - const GLchan *src = CHAN_SRC( texImage, i, j, k, 4 ); - GLchan *rgba = (GLchan *)texel; - rgba[RCOMP] = src[2]; - rgba[GCOMP] = src[1]; - rgba[BCOMP] = src[0]; - rgba[ACOMP] = CHAN_MAX; -} - -//--------------------------------------------------------------------------- - -static void gld_fetch_3d_texel_f_X8R8G8B8( - const struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel ) -{ - const GLchan *src = CHAN_SRC( texImage, i, j, k, 4 ); - texel[RCOMP] = CHAN_TO_FLOAT(src[0]); - texel[GCOMP] = CHAN_TO_FLOAT(src[1]); - texel[BCOMP] = CHAN_TO_FLOAT(src[2]); - texel[ACOMP] = 1.f; -} - -//--------------------------------------------------------------------------- - -static void gld_fetch_3d_texel_X1R5G5B5( - const struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, GLchan *texel ) -{ - const GLushort *src = USHORT_SRC( texImage, i, j, k ); - GLchan *rgba = (GLchan *) texel; GLushort s = *src; - rgba[RCOMP] = UBYTE_TO_CHAN( ((s >> 10) & 0xf8) * 255 / 0xf8 ); - rgba[GCOMP] = UBYTE_TO_CHAN( ((s >> 5) & 0xf8) * 255 / 0xf8 ); - rgba[BCOMP] = UBYTE_TO_CHAN( ((s ) & 0xf8) * 255 / 0xf8 ); - rgba[ACOMP] = CHAN_MAX; -} - -//--------------------------------------------------------------------------- - -static void gld_fetch_3d_texel_f_X1R5G5B5( - const struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel ) -{ - const GLushort *src = USHORT_SRC( texImage, i, j, k ); - GLushort s = *src; - texel[RCOMP] = UBYTE_TO_FLOAT( ((s >> 10) & 0xf8) * 255 / 0xf8 ); - texel[GCOMP] = UBYTE_TO_FLOAT( ((s >> 5) & 0xf8) * 255 / 0xf8 ); - texel[BCOMP] = UBYTE_TO_FLOAT( ((s ) & 0xf8) * 255 / 0xf8 ); - texel[ACOMP] = 1.f; -} - -//--------------------------------------------------------------------------- - -static void gld_fetch_3d_texel_X4R4G4B4( - const struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, GLchan *texel ) -{ - const GLushort *src = USHORT_SRC( texImage, i, j, k ); - GLchan *rgba = (GLchan *) texel; GLushort s = *src; - rgba[RCOMP] = UBYTE_TO_CHAN( ((s >> 8) & 0xf) * 255 / 0xf ); - rgba[GCOMP] = UBYTE_TO_CHAN( ((s >> 4) & 0xf) * 255 / 0xf ); - rgba[BCOMP] = UBYTE_TO_CHAN( ((s ) & 0xf) * 255 / 0xf ); - rgba[ACOMP] = CHAN_MAX; -} - -//--------------------------------------------------------------------------- - -static void gld_fetch_3d_texel_f_X4R4G4B4( - const struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel ) -{ - const GLushort *src = USHORT_SRC( texImage, i, j, k ); - GLushort s = *src; - texel[RCOMP] = UBYTE_TO_FLOAT( ((s >> 8) & 0xf) * 255 / 0xf ); - texel[GCOMP] = UBYTE_TO_FLOAT( ((s >> 4) & 0xf) * 255 / 0xf ); - texel[BCOMP] = UBYTE_TO_FLOAT( ((s ) & 0xf) * 255 / 0xf ); - texel[ACOMP] = 1.f; -} - -//--------------------------------------------------------------------------- - -#undef CHAN_SRC -#undef UBYTE_SRC -#undef USHORT_SRC -#undef FLOAT_SRC - -//--------------------------------------------------------------------------- -// Direct3D texture formats that have no Mesa equivalent -//--------------------------------------------------------------------------- - -const struct gl_texture_format _gld_texformat_X8R8G8B8 = { - MESA_FORMAT_ARGB8888, /* MesaFormat */ - GL_RGBA, /* BaseFormat */ - GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ - 8, /* RedBits */ - 8, /* GreenBits */ - 8, /* BlueBits */ - 0, /* AlphaBits */ - 0, /* LuminanceBits */ - 0, /* IntensityBits */ - 0, /* IndexBits */ - 0, /* DepthBits */ - 4, /* TexelBytes */ - _mesa_texstore_argb8888, /* StoreTexImageFunc */ - gld_fetch_1d_texel_X8R8G8B8, /* FetchTexel1D */ - gld_fetch_2d_texel_X8R8G8B8, /* FetchTexel2D */ - gld_fetch_3d_texel_X8R8G8B8, /* FetchTexel3D */ - gld_fetch_1d_texel_f_X8R8G8B8, /* FetchTexel1Df */ - gld_fetch_2d_texel_f_X8R8G8B8, /* FetchTexel2Df */ - gld_fetch_3d_texel_f_X8R8G8B8, /* FetchTexel3Df */ -}; - -const struct gl_texture_format _gld_texformat_X1R5G5B5 = { - MESA_FORMAT_ARGB1555, /* MesaFormat */ - GL_RGBA, /* BaseFormat */ - GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ - 5, /* RedBits */ - 5, /* GreenBits */ - 5, /* BlueBits */ - 0, /* AlphaBits */ - 0, /* LuminanceBits */ - 0, /* IntensityBits */ - 0, /* IndexBits */ - 0, /* DepthBits */ - 2, /* TexelBytes */ - _mesa_texstore_argb1555, /* StoreTexImageFunc */ - gld_fetch_1d_texel_X1R5G5B5, /* FetchTexel1D */ - gld_fetch_2d_texel_X1R5G5B5, /* FetchTexel2D */ - gld_fetch_3d_texel_X1R5G5B5, /* FetchTexel3D */ - gld_fetch_1d_texel_f_X1R5G5B5, /* FetchTexel1Df */ - gld_fetch_2d_texel_f_X1R5G5B5, /* FetchTexel2Df */ - gld_fetch_3d_texel_f_X1R5G5B5, /* FetchTexel3Df */ -}; - -const struct gl_texture_format _gld_texformat_X4R4G4B4 = { - MESA_FORMAT_ARGB4444, /* MesaFormat */ - GL_RGBA, /* BaseFormat */ - GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ - 4, /* RedBits */ - 4, /* GreenBits */ - 4, /* BlueBits */ - 0, /* AlphaBits */ - 0, /* LuminanceBits */ - 0, /* IntensityBits */ - 0, /* IndexBits */ - 0, /* DepthBits */ - 2, /* TexelBytes */ - _mesa_texstore_argb4444, /* StoreTexImageFunc */ - gld_fetch_1d_texel_X4R4G4B4, /* FetchTexel1D */ - gld_fetch_2d_texel_X4R4G4B4, /* FetchTexel2D */ - gld_fetch_3d_texel_X4R4G4B4, /* FetchTexel3D */ - gld_fetch_1d_texel_f_X4R4G4B4, /* FetchTexel1Df */ - gld_fetch_2d_texel_f_X4R4G4B4, /* FetchTexel2Df */ - gld_fetch_3d_texel_f_X4R4G4B4, /* FetchTexel3Df */ -}; - -//--------------------------------------------------------------------------- -// Texture unit constants -//--------------------------------------------------------------------------- - -// List of possible combinations of texture environments. -// Example: GLD_TEXENV_MODULATE_RGBA means -// GL_MODULATE, GL_RGBA base internal format. -#define GLD_TEXENV_DECAL_RGB 0 -#define GLD_TEXENV_DECAL_RGBA 1 -#define GLD_TEXENV_DECAL_ALPHA 2 -#define GLD_TEXENV_REPLACE_RGB 3 -#define GLD_TEXENV_REPLACE_RGBA 4 -#define GLD_TEXENV_REPLACE_ALPHA 5 -#define GLD_TEXENV_MODULATE_RGB 6 -#define GLD_TEXENV_MODULATE_RGBA 7 -#define GLD_TEXENV_MODULATE_ALPHA 8 -#define GLD_TEXENV_BLEND_RGB 9 -#define GLD_TEXENV_BLEND_RGBA 10 -#define GLD_TEXENV_BLEND_ALPHA 11 -#define GLD_TEXENV_ADD_RGB 12 -#define GLD_TEXENV_ADD_RGBA 13 -#define GLD_TEXENV_ADD_ALPHA 14 - -// Per-stage (i.e. per-unit) texture environment -typedef struct { - DWORD ColorArg1; // Colour argument 1 - D3DTEXTUREOP ColorOp; // Colour operation - DWORD ColorArg2; // Colour argument 2 - DWORD AlphaArg1; // Alpha argument 1 - D3DTEXTUREOP AlphaOp; // Alpha operation - DWORD AlphaArg2; // Alpha argument 2 -} GLD_texenv; - -// TODO: Do we really need to set ARG1 and ARG2 every time? -// They seem to always be TEXTURE and CURRENT respectively. - -// C = Colour out -// A = Alpha out -// Ct = Colour from Texture -// Cf = Colour from fragment (diffuse) -// At = Alpha from Texture -// Af = Alpha from fragment (diffuse) -// Cc = GL_TEXTURE_ENV_COLOUR (GL_BLEND) -const GLD_texenv gldTexEnv[] = { - // DECAL_RGB: C=Ct, A=Af - {D3DTA_TEXTURE, D3DTOP_SELECTARG1, D3DTA_CURRENT, - D3DTA_TEXTURE, D3DTOP_SELECTARG2, D3DTA_CURRENT}, - // DECAL_RGBA: C=Cf(1-At)+CtAt, A=Af - {D3DTA_TEXTURE, D3DTOP_BLENDTEXTUREALPHA, D3DTA_CURRENT, - D3DTA_TEXTURE, D3DTOP_SELECTARG2, D3DTA_CURRENT}, - // DECAL_ALPHA: use DECAL_RGB - {D3DTA_TEXTURE, D3DTOP_SELECTARG1, D3DTA_CURRENT, - D3DTA_TEXTURE, D3DTOP_SELECTARG2, D3DTA_CURRENT}, - - // REPLACE_RGB: C=Ct, A=Af - {D3DTA_TEXTURE, D3DTOP_SELECTARG1, D3DTA_CURRENT, - D3DTA_TEXTURE, D3DTOP_SELECTARG2, D3DTA_CURRENT}, - // REPLACE_RGBA: C=Ct, A=At - {D3DTA_TEXTURE, D3DTOP_SELECTARG1, D3DTA_CURRENT, - D3DTA_TEXTURE, D3DTOP_SELECTARG1, D3DTA_CURRENT}, - // REPLACE_ALPHA: C=Cf, A=At - {D3DTA_TEXTURE, D3DTOP_SELECTARG2, D3DTA_CURRENT, - D3DTA_TEXTURE, D3DTOP_SELECTARG1, D3DTA_CURRENT}, - - // MODULATE_RGB: C=CfCt, A=Af - {D3DTA_TEXTURE, D3DTOP_MODULATE, D3DTA_CURRENT, - D3DTA_TEXTURE, D3DTOP_SELECTARG2, D3DTA_CURRENT}, - // MODULATE_RGBA: C=CfCt, A=AfAt - {D3DTA_TEXTURE, D3DTOP_MODULATE, D3DTA_CURRENT, - D3DTA_TEXTURE, D3DTOP_MODULATE, D3DTA_CURRENT}, - // MODULATE_ALPHA: C=Cf, A=AfAt - {D3DTA_TEXTURE, D3DTOP_SELECTARG2, D3DTA_CURRENT, - D3DTA_TEXTURE, D3DTOP_MODULATE, D3DTA_CURRENT}, - - // BLEND_RGB: C=Cf(1-Ct)+CcCt, A=Af - {D3DTA_TEXTURE, D3DTOP_LERP, D3DTA_CURRENT, - D3DTA_TEXTURE, D3DTOP_SELECTARG2, D3DTA_CURRENT}, - // BLEND_RGBA: C=Cf(1-Ct)+CcCt, A=AfAt - {D3DTA_TEXTURE, D3DTOP_LERP, D3DTA_CURRENT, - D3DTA_TEXTURE, D3DTOP_MODULATE, D3DTA_CURRENT}, - // BLEND_ALPHA: C=Cf, A=AfAt - {D3DTA_TEXTURE, D3DTOP_SELECTARG2, D3DTA_CURRENT, - D3DTA_TEXTURE, D3DTOP_MODULATE, D3DTA_CURRENT}, - - // ADD_RGB: C=Cf+Ct, A=Af - {D3DTA_TEXTURE, D3DTOP_ADD, D3DTA_CURRENT, - D3DTA_TEXTURE, D3DTOP_SELECTARG2, D3DTA_CURRENT}, - // ADD_RGBA: C=Cf+Ct, A=AfAt - {D3DTA_TEXTURE, D3DTOP_ADD, D3DTA_CURRENT, - D3DTA_TEXTURE, D3DTOP_MODULATE, D3DTA_CURRENT}, - // ADD_ALPHA: C=Cf, A=AfAt - {D3DTA_TEXTURE, D3DTOP_SELECTARG2, D3DTA_CURRENT, - D3DTA_TEXTURE, D3DTOP_MODULATE, D3DTA_CURRENT}, -}; - -//--------------------------------------------------------------------------- - -D3DTEXTUREADDRESS _gldConvertWrap( - GLenum wrap) -{ - return (wrap == GL_CLAMP) ? D3DTADDRESS_CLAMP : D3DTADDRESS_WRAP; -} - -//--------------------------------------------------------------------------- - -D3DTEXTUREFILTERTYPE _gldConvertMagFilter( - GLenum magfilter) -{ - return (magfilter == GL_LINEAR) ? D3DTEXF_LINEAR : D3DTEXF_POINT; -} - -//--------------------------------------------------------------------------- - -void _gldConvertMinFilter( - GLenum minfilter, - D3DTEXTUREFILTERTYPE *min_filter, - D3DTEXTUREFILTERTYPE *mip_filter) -{ - switch (minfilter) { - case GL_NEAREST: - *min_filter = D3DTEXF_POINT; - *mip_filter = D3DTEXF_NONE; - break; - case GL_LINEAR: - *min_filter = D3DTEXF_LINEAR; - *mip_filter = D3DTEXF_NONE; - break; - case GL_NEAREST_MIPMAP_NEAREST: - *min_filter = D3DTEXF_POINT; - *mip_filter = D3DTEXF_POINT; - break; - case GL_LINEAR_MIPMAP_NEAREST: - *min_filter = D3DTEXF_LINEAR; - *mip_filter = D3DTEXF_POINT; - break; - case GL_NEAREST_MIPMAP_LINEAR: - *min_filter = D3DTEXF_POINT; - *mip_filter = D3DTEXF_LINEAR; - break; - case GL_LINEAR_MIPMAP_LINEAR: - *min_filter = D3DTEXF_LINEAR; - *mip_filter = D3DTEXF_LINEAR; - break; - } -} - -//--------------------------------------------------------------------------- - -D3DFORMAT _gldGLFormatToD3DFormat( - GLenum internalFormat) -{ - switch (internalFormat) { - case GL_INTENSITY: - case GL_INTENSITY4: - case GL_INTENSITY8: - case GL_INTENSITY12: - case GL_INTENSITY16: - // LUNIMANCE != INTENSITY, but D3D doesn't have I8 textures - return D3DFMT_L8; - case 1: - case GL_LUMINANCE: - case GL_LUMINANCE4: - case GL_LUMINANCE8: - case GL_LUMINANCE12: - case GL_LUMINANCE16: - return D3DFMT_L8; - case GL_ALPHA: - case GL_ALPHA4: - case GL_ALPHA8: - case GL_ALPHA12: - case GL_ALPHA16: - return D3DFMT_A8; - case GL_COLOR_INDEX: - case GL_COLOR_INDEX1_EXT: - case GL_COLOR_INDEX2_EXT: - case GL_COLOR_INDEX4_EXT: - case GL_COLOR_INDEX8_EXT: - case GL_COLOR_INDEX12_EXT: - case GL_COLOR_INDEX16_EXT: - return D3DFMT_X8R8G8B8; - case 2: - case GL_LUMINANCE_ALPHA: - case GL_LUMINANCE4_ALPHA4: - case GL_LUMINANCE6_ALPHA2: - case GL_LUMINANCE8_ALPHA8: - case GL_LUMINANCE12_ALPHA4: - case GL_LUMINANCE12_ALPHA12: - case GL_LUMINANCE16_ALPHA16: - return D3DFMT_A8L8; - case GL_R3_G3_B2: - // TODO: Mesa does not support RGB332 internally - return D3DFMT_X4R4G4B4; //D3DFMT_R3G3B2; - case GL_RGB4: - return D3DFMT_X4R4G4B4; - case GL_RGB5: - return D3DFMT_X1R5G5B5; - case 3: - case GL_RGB: - case GL_RGB8: - case GL_RGB10: - case GL_RGB12: - case GL_RGB16: - return D3DFMT_R8G8B8; - case GL_RGBA4: - return D3DFMT_A4R4G4B4; - case 4: - case GL_RGBA: - case GL_RGBA2: - case GL_RGBA8: - case GL_RGB10_A2: - case GL_RGBA12: - case GL_RGBA16: - return D3DFMT_A8R8G8B8; - case GL_RGB5_A1: - return D3DFMT_A1R5G5B5; - } - - // Return an acceptable default - return D3DFMT_A8R8G8B8; -} - -//--------------------------------------------------------------------------- - -GLenum _gldDecodeBaseFormat( - IDirect3DTexture9 *pTex) -{ - // Examine Direct3D texture and return base OpenGL internal texture format - // NOTE: We can't use any base format info from Mesa because D3D might have - // used a different texture format when we used D3DXCreateTexture(). - - // Base internal format is one of (Red Book p355): - // GL_ALPHA, - // GL_LUMINANCE, - // GL_LUMINANCE_ALPHA, - // GL_INTENSITY, - // GL_RGB, - // GL_RGBA - - // NOTE: INTENSITY not used (not supported by Direct3D) - // LUMINANCE has same texture functions as RGB - // LUMINANCE_ALPHA has same texture functions as RGBA - - // TODO: cache format instead of using GetLevelDesc() - D3DSURFACE_DESC desc; - _GLD_DX9_TEX(GetLevelDesc(pTex, 0, &desc)); - - switch (desc.Format) { - case D3DFMT_R8G8B8: - case D3DFMT_X8R8G8B8: - case D3DFMT_R5G6B5: - case D3DFMT_X1R5G5B5: - case D3DFMT_R3G3B2: - case D3DFMT_X4R4G4B4: - case D3DFMT_P8: - case D3DFMT_L8: - return GL_RGB; - case D3DFMT_A8R8G8B8: - case D3DFMT_A1R5G5B5: - case D3DFMT_A4R4G4B4: - case D3DFMT_A8R3G3B2: - case D3DFMT_A8P8: - case D3DFMT_A8L8: - case D3DFMT_A4L4: - return GL_RGBA; - case D3DFMT_A8: - return GL_ALPHA; - // Compressed texture formats. Need to check these... - case D3DFMT_DXT1: - return GL_RGBA; - case D3DFMT_DXT2: - return GL_RGB; - case D3DFMT_DXT3: - return GL_RGBA; - case D3DFMT_DXT4: - return GL_RGB; - case D3DFMT_DXT5: - return GL_RGBA; - } - - // Fell through. Return arbitary default. - return GL_RGBA; -} - -//--------------------------------------------------------------------------- - -const struct gl_texture_format* _gldMesaFormatForD3DFormat( - D3DFORMAT d3dfmt) -{ - switch (d3dfmt) { - case D3DFMT_A8R8G8B8: - return &_mesa_texformat_argb8888; - case D3DFMT_R8G8B8: - return &_mesa_texformat_rgb888; - case D3DFMT_R5G6B5: - return &_mesa_texformat_rgb565; - case D3DFMT_A4R4G4B4: - return &_mesa_texformat_argb4444; - case D3DFMT_A1R5G5B5: - return &_mesa_texformat_argb1555; - case D3DFMT_A8L8: - return &_mesa_texformat_al88; - case D3DFMT_R3G3B2: - return &_mesa_texformat_rgb332; - case D3DFMT_A8: - return &_mesa_texformat_a8; - case D3DFMT_L8: - return &_mesa_texformat_l8; - case D3DFMT_X8R8G8B8: - return &_gld_texformat_X8R8G8B8; - case D3DFMT_X1R5G5B5: - return &_gld_texformat_X1R5G5B5; - case D3DFMT_X4R4G4B4: - return &_gld_texformat_X4R4G4B4; - } - - // If we reach here then we've made an error somewhere else - // by allowing a format that is not supported. - assert(0); - - return NULL; // Shut up compiler warning -} - -//--------------------------------------------------------------------------- -// Copy* functions -//--------------------------------------------------------------------------- - -void gldCopyTexImage1D_DX9( - GLcontext *ctx, - GLenum target, GLint level, - GLenum internalFormat, - GLint x, GLint y, - GLsizei width, GLint border ) -{ - // TODO -} - -//--------------------------------------------------------------------------- - -void gldCopyTexImage2D_DX9( - GLcontext *ctx, - GLenum target, - GLint level, - GLenum internalFormat, - GLint x, - GLint y, - GLsizei width, - GLsizei height, - GLint border) -{ - // TODO -} - -//--------------------------------------------------------------------------- - -void gldCopyTexSubImage1D_DX9( - GLcontext *ctx, - GLenum target, GLint level, - GLint xoffset, GLint x, GLint y, GLsizei width ) -{ - // TODO -} - -//--------------------------------------------------------------------------- - -void gldCopyTexSubImage2D_DX9( - GLcontext *ctx, - GLenum target, - GLint level, - GLint xoffset, - GLint yoffset, - GLint x, - GLint y, - GLsizei width, - GLsizei height) -{ - // TODO -} - -//--------------------------------------------------------------------------- - -void gldCopyTexSubImage3D_DX9( - GLcontext *ctx, - GLenum target, - GLint level, - GLint xoffset, - GLint yoffset, - GLint zoffset, - GLint x, - GLint y, - GLsizei width, - GLsizei height ) -{ - // TODO ? -} - -//--------------------------------------------------------------------------- -// Bitmap/Pixel functions -//--------------------------------------------------------------------------- - -#define GLD_FLIP_Y(y) (gldCtx->dwHeight - (y)) - -#define _GLD_FVF_IMAGE (D3DFVF_XYZRHW | D3DFVF_TEX1) - -typedef struct { - FLOAT x, y; // 2D raster coords - FLOAT z; // depth value - FLOAT rhw; // reciprocal homogenous W (always 1.0f) - FLOAT tu, tv; // texture coords -} _GLD_IMAGE_VERTEX; - -//--------------------------------------------------------------------------- - -HRESULT _gldDrawPixels( - GLcontext *ctx, - BOOL bChromakey, // Alpha test for glBitmap() images - GLint x, // GL x position - GLint y, // GL y position (needs flipping) - GLsizei width, // Width of input image - GLsizei height, // Height of input image - IDirect3DSurface9 *pImage) -{ - // - // Draw input image as texture implementing PixelZoom and clipping. - // Any fragment operations currently enabled will be used. - // - - GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); - GLD_driver_dx9 *gld = GLD_GET_DX9_DRIVER(gldCtx); - - IDirect3DTexture9 *pTexture; - D3DSURFACE_DESC d3dsd; - IDirect3DSurface9 *pSurface; - _GLD_IMAGE_VERTEX v[4]; - HRESULT hr; - - float ZoomWidth, ZoomHeight; - float ScaleWidth, ScaleHeight; - - // Create a texture to hold image - hr = D3DXCreateTexture( - gld->pDev, - width, height, - 1, // miplevels - 0, // usage - D3DFMT_A8R8G8B8, // format - D3DPOOL_MANAGED, // pool - &pTexture); - if (FAILED(hr)) - return hr; - - hr = IDirect3DTexture9_GetSurfaceLevel(pTexture, 0, &pSurface); - if (FAILED(hr)) { - IDirect3DTexture9_Release(pTexture); - return hr; - } - - // Copy image into texture - hr = D3DXLoadSurfaceFromSurface( - pSurface, NULL, NULL, // Dest surface - pImage, NULL, NULL, // Src surface - D3DX_FILTER_NONE, - 0); - IDirect3DSurface9_Release(pSurface); - if (FAILED(hr)) { - IDirect3DTexture9_Release(pTexture); - return hr; - } - - // - // Set up the quad like this (ascii-art ahead!) - // - // 3--2 - // | | - // 0--1 - // - // - - // Set depth - v[0].z = v[1].z = v[2].z = v[3].z = ctx->Current.RasterPos[2]; - // Set Reciprocal Homogenous W - v[0].rhw = v[1].rhw = v[2].rhw = v[3].rhw = 1.0f; - - // Set texcoords - // Examine texture size - if different to input width and height - // then we'll need to munge the texcoords to fit. - IDirect3DTexture9_GetLevelDesc(pTexture, 0, &d3dsd); - ScaleWidth = (float)width / (float)d3dsd.Width; - ScaleHeight = (float)height / (float)d3dsd.Height; - v[0].tu = 0.0f; v[0].tv = 0.0f; - v[1].tu = ScaleWidth; v[1].tv = 0.0f; - v[2].tu = ScaleWidth; v[2].tv = ScaleHeight; - v[3].tu = 0.0f; v[3].tv = ScaleHeight; - - // Set raster positions - ZoomWidth = (float)width * ctx->Pixel.ZoomX; - ZoomHeight = (float)height * ctx->Pixel.ZoomY; - - v[0].x = x; v[0].y = GLD_FLIP_Y(y); - v[1].x = x+ZoomWidth; v[1].y = GLD_FLIP_Y(y); - v[2].x = x+ZoomWidth; v[2].y = GLD_FLIP_Y(y+ZoomHeight); - v[3].x = x; v[3].y = GLD_FLIP_Y(y+ZoomHeight); - - // Draw image with full HW acceleration - // NOTE: Be nice to use a State Block for all this state... - IDirect3DDevice9_SetTexture(gld->pDev, 0, pTexture); - IDirect3DDevice9_SetRenderState(gld->pDev, D3DRS_CULLMODE, D3DCULL_NONE); - IDirect3DDevice9_SetRenderState(gld->pDev, D3DRS_CLIPPING, TRUE); - -// IDirect3DDevice9_SetTextureStageState(gld->pDev, 0, D3DTSS_MINFILTER, D3DTEXF_POINT); -// IDirect3DDevice9_SetTextureStageState(gld->pDev, 0, D3DTSS_MIPFILTER, D3DTEXF_POINT); -// IDirect3DDevice9_SetTextureStageState(gld->pDev, 0, D3DTSS_MAGFILTER, D3DTEXF_POINT); -// IDirect3DDevice9_SetTextureStageState(gld->pDev, 0, D3DTSS_ADDRESSU, D3DTADDRESS_CLAMP); -// IDirect3DDevice9_SetTextureStageState(gld->pDev, 0, D3DTSS_ADDRESSV, D3DTADDRESS_CLAMP); - IDirect3DDevice9_SetSamplerState(gld->pDev, 0, D3DSAMP_MINFILTER, D3DTEXF_POINT); - IDirect3DDevice9_SetSamplerState(gld->pDev, 0, D3DSAMP_MIPFILTER, D3DTEXF_POINT); - IDirect3DDevice9_SetSamplerState(gld->pDev, 0, D3DSAMP_MAGFILTER, D3DTEXF_POINT); - IDirect3DDevice9_SetSamplerState(gld->pDev, 0, D3DSAMP_ADDRESSU, D3DTADDRESS_CLAMP); - IDirect3DDevice9_SetSamplerState(gld->pDev, 0, D3DSAMP_ADDRESSV, D3DTADDRESS_CLAMP); - - IDirect3DDevice9_SetTextureStageState(gld->pDev, 0, D3DTSS_COLOROP, D3DTOP_SELECTARG1); - IDirect3DDevice9_SetTextureStageState(gld->pDev, 0, D3DTSS_ALPHAOP, D3DTOP_SELECTARG1); - IDirect3DDevice9_SetTextureStageState(gld->pDev, 0, D3DTSS_COLORARG1, D3DTA_TEXTURE); - IDirect3DDevice9_SetTextureStageState(gld->pDev, 0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE); - IDirect3DDevice9_SetTextureStageState(gld->pDev, 1, D3DTSS_COLOROP, D3DTOP_DISABLE); - IDirect3DDevice9_SetTextureStageState(gld->pDev, 1, D3DTSS_ALPHAOP, D3DTOP_DISABLE); - - IDirect3DDevice9_SetVertexShader(gld->pDev, NULL); - IDirect3DDevice9_SetFVF(gld->pDev, _GLD_FVF_IMAGE); - - // - // Emulate Chromakey with an Alpha Test. - // [Alpha Test is more widely supported anyway] - // - if (bChromakey) { - // Switch on alpha testing - IDirect3DDevice9_SetRenderState(gld->pDev, D3DRS_ALPHATESTENABLE, TRUE); - // Fragment passes is alpha is greater than reference value - IDirect3DDevice9_SetRenderState(gld->pDev, D3DRS_ALPHAFUNC, D3DCMP_GREATER); - // Set alpha reference value between Bitmap alpha values of - // zero (transparent) and one (opaque). - IDirect3DDevice9_SetRenderState(gld->pDev, D3DRS_ALPHAREF, 0x7f); - } - - IDirect3DDevice9_DrawPrimitiveUP(gld->pDev, D3DPT_TRIANGLEFAN, 2, &v, sizeof(_GLD_IMAGE_VERTEX)); - - // Release texture - IDirect3DDevice9_SetTexture(gld->pDev, 0, NULL); - IDirect3DTexture9_Release(pTexture); - - // Reset state to before we messed it up - FLUSH_VERTICES(ctx, _NEW_ALL); - - return S_OK; -} - -//--------------------------------------------------------------------------- - -void gld_DrawPixels_DX9( - GLcontext *ctx, - GLint x, GLint y, GLsizei width, GLsizei height, - GLenum format, GLenum type, - const struct gl_pixelstore_attrib *unpack, - const GLvoid *pixels ) -{ - GLD_context *gldCtx; - GLD_driver_dx9 *gld; - - IDirect3DSurface9 *pImage; - HRESULT hr; - D3DLOCKED_RECT d3dLockedRect; - - const struct gl_texture_format *MesaFormat; - - MesaFormat = _mesa_choose_tex_format(ctx, format, format, type); - - // Mesa does not currently handle this format. - if (format == GL_BGR) - return; - - gldCtx = GLD_GET_CONTEXT(ctx); - gld = GLD_GET_DX9_DRIVER(gldCtx); - - hr = IDirect3DDevice9_CreateOffscreenPlainSurface( - gld->pDev, - width, - height, - D3DFMT_A8R8G8B8, - D3DPOOL_SCRATCH, - &pImage, - NULL); - if (FAILED(hr)) { - return; - } - - // - // Use Mesa to fill in image - // - - // Lock all of surface - hr = IDirect3DSurface9_LockRect(pImage, &d3dLockedRect, NULL, 0); - if (FAILED(hr)) { - IDirect3DSurface9_Release(pImage); - return; - } - - // unpack image, apply transfer ops and store directly in texture - MesaFormat->StoreImage( - ctx, - 2, - GL_RGBA, - &_mesa_texformat_argb8888, - d3dLockedRect.pBits, - width, height, 1, 0, 0, 0, - d3dLockedRect.Pitch, - 0, /* dstImageStride */ - format, type, pixels, unpack); - - IDirect3DSurface9_UnlockRect(pImage); - - _gldDrawPixels(ctx, FALSE, x, y, width, height, pImage); - - IDirect3DSurface9_Release(pImage); -} - -//--------------------------------------------------------------------------- - -void gld_ReadPixels_DX9( - GLcontext *ctx, - GLint x, GLint y, GLsizei width, GLsizei height, - GLenum format, GLenum type, - const struct gl_pixelstore_attrib *pack, - GLvoid *dest) -{ - - GLD_context *gldCtx; - GLD_driver_dx9 *gld; - - IDirect3DSurface9 *pBackbuffer = NULL; - IDirect3DSurface9 *pNativeImage = NULL; - IDirect3DSurface9 *pCanonicalImage = NULL; - - D3DSURFACE_DESC d3dsd; - RECT rcSrc; // Source rect - POINT ptDst; // Dest point - HRESULT hr; - D3DLOCKED_RECT d3dLockedRect; - struct gl_pixelstore_attrib srcPacking; - int i; - GLint DstRowStride; - const struct gl_texture_format *MesaFormat; - - switch (format) { - case GL_STENCIL_INDEX: - case GL_DEPTH_COMPONENT: - return; - } - - MesaFormat = _mesa_choose_tex_format(ctx, format, format, type); - DstRowStride = _mesa_image_row_stride(pack, width, format, type); - - gldCtx = GLD_GET_CONTEXT(ctx); - gld = GLD_GET_DX9_DRIVER(gldCtx); - - // Get backbuffer - hr = IDirect3DDevice9_GetBackBuffer( - gld->pDev, - 0, // First swapchain - 0, // First backbuffer - D3DBACKBUFFER_TYPE_MONO, - &pBackbuffer); - if (FAILED(hr)) - return; - - // Get backbuffer description - hr = IDirect3DSurface9_GetDesc(pBackbuffer, &d3dsd); - if (FAILED(hr)) { - goto gld_ReadPixels_DX9_return; - } - - // Create a surface compatible with backbuffer - hr = IDirect3DDevice9_CreateOffscreenPlainSurface( - gld->pDev, - width, - height, - d3dsd.Format, - D3DPOOL_SCRATCH, - &pNativeImage, - NULL); - if (FAILED(hr)) { - goto gld_ReadPixels_DX9_return; - } - - // Compute source rect and dest point - SetRect(&rcSrc, 0, 0, width, height); - OffsetRect(&rcSrc, x, GLD_FLIP_HEIGHT(y, height)); - ptDst.x = ptDst.y = 0; - - // Get source pixels. - // - // This intermediate surface ensure that we can use CopyRects() - // instead of relying on D3DXLoadSurfaceFromSurface(), which may - // try and lock the backbuffer. This way seems safer. - // - // CopyRects has been removed for DX9. - // -/* hr = IDirect3DDevice9_CopyRects( - gld->pDev, - pBackbuffer, - &rcSrc, - 1, - pNativeImage, - &ptDst);*/ - hr = D3DXLoadSurfaceFromSurface( - pNativeImage, // Dest surface - NULL, // Dest palette - &rcSrc, // Dest rect - pBackbuffer, // Src surface - NULL, // Src palette - &rcSrc, // Src rect - D3DX_FILTER_NONE, // Filter - 0 // Colorkey (0=no colorkey) - ); - if (FAILED(hr)) { - goto gld_ReadPixels_DX9_return; - } - - // Create an RGBA8888 surface - hr = IDirect3DDevice9_CreateOffscreenPlainSurface( - gld->pDev, - width, - height, - D3DFMT_A8R8G8B8, - D3DPOOL_SCRATCH, - &pCanonicalImage, - NULL); - if (FAILED(hr)) { - goto gld_ReadPixels_DX9_return; - } - - // Convert to RGBA8888 - hr = D3DXLoadSurfaceFromSurface( - pCanonicalImage, // Dest surface - NULL, NULL, // Dest palette, RECT - pNativeImage, // Src surface - NULL, NULL, // Src palette, RECT - D3DX_FILTER_NONE, // Filter - 0); // Colourkey - if (FAILED(hr)) { - goto gld_ReadPixels_DX9_return; - } - - srcPacking.Alignment = 1; - srcPacking.ImageHeight = height; - srcPacking.LsbFirst = GL_FALSE; - srcPacking.RowLength = 0; - srcPacking.SkipImages = 0; - srcPacking.SkipPixels = 0; - srcPacking.SkipRows = 0; - srcPacking.SwapBytes = GL_FALSE; - - // Lock all of image - hr = IDirect3DSurface9_LockRect(pCanonicalImage, &d3dLockedRect, NULL, 0); - if (FAILED(hr)) { - goto gld_ReadPixels_DX9_return; - } - - // We need to flip the data. Yuck. - // Perhaps Mesa has a span packer we can use in future... - for (i=0; iStoreImage( - ctx, - 2, - GL_RGBA, // base format - MesaFormat, // dst format - pDestRow, // dest addr - width, 1, 1, 0, 0, 0, // src x,y,z & dst offsets x,y,z - DstRowStride, // dst row stride - 0, // dstImageStride - GL_BGRA, // src format - GL_UNSIGNED_BYTE, // src type - pSrcRow, // src addr - &srcPacking); // packing params of source image - } - - IDirect3DSurface9_UnlockRect(pCanonicalImage); - -gld_ReadPixels_DX9_return: - SAFE_RELEASE_SURFACE9(pCanonicalImage); - SAFE_RELEASE_SURFACE9(pNativeImage); - SAFE_RELEASE_SURFACE9(pBackbuffer); -} - -//--------------------------------------------------------------------------- - -void gld_CopyPixels_DX9( - GLcontext *ctx, - GLint srcx, - GLint srcy, - GLsizei width, - GLsizei height, - GLint dstx, - GLint dsty, - GLenum type) -{ - // - // NOTE: Not allowed to copy vidmem to vidmem! - // Therefore we use an intermediate image surface. - // - - GLD_context *gldCtx; - GLD_driver_dx9 *gld; - - IDirect3DSurface9 *pBackbuffer; - D3DSURFACE_DESC d3dsd; - IDirect3DSurface9 *pImage; - RECT rcSrc; // Source rect - POINT ptDst; // Dest point - HRESULT hr; - - // Only backbuffer - if (type != GL_COLOR) - return; - - gldCtx = GLD_GET_CONTEXT(ctx); - gld = GLD_GET_DX9_DRIVER(gldCtx); - - // Get backbuffer - hr = IDirect3DDevice9_GetBackBuffer( - gld->pDev, - 0, // First swapchain - 0, // First backbuffer - D3DBACKBUFFER_TYPE_MONO, - &pBackbuffer); - if (FAILED(hr)) - return; - - // Get backbuffer description - hr = IDirect3DSurface9_GetDesc(pBackbuffer, &d3dsd); - if (FAILED(hr)) { - IDirect3DSurface9_Release(pBackbuffer); - return; - } - - // Create a surface compatible with backbuffer - hr = IDirect3DDevice9_CreateOffscreenPlainSurface( - gld->pDev, - width, - height, - d3dsd.Format, - D3DPOOL_SCRATCH, - &pImage, - NULL); - if (FAILED(hr)) { - IDirect3DSurface9_Release(pBackbuffer); - return; - } - - // Compute source rect and dest point - SetRect(&rcSrc, 0, 0, width, height); - OffsetRect(&rcSrc, srcx, GLD_FLIP_HEIGHT(srcy, height)); - ptDst.x = ptDst.y = 0; - - // Get source pixels -/* hr = IDirect3DDevice8_CopyRects( - gld->pDev, - pBackbuffer, - &rcSrc, - 1, - pImage, - &ptDst);*/ - hr = D3DXLoadSurfaceFromSurface( - pImage, // Dest surface - NULL, // Dest palette - &rcSrc, // Dest rect - pBackbuffer, // Src surface - NULL, // Src palette - &rcSrc, // Src rect - D3DX_FILTER_NONE, // Filter - 0 // Colorkey (0=no colorkey) - ); - IDirect3DSurface9_Release(pBackbuffer); - if (FAILED(hr)) { - IDirect3DSurface9_Release(pImage); - return; - } - - _gldDrawPixels(ctx, FALSE, dstx, dsty, width, height, pImage); - - IDirect3DSurface9_Release(pImage); -} - -//--------------------------------------------------------------------------- - -void gld_Bitmap_DX9( - GLcontext *ctx, - GLint x, - GLint y, - GLsizei width, - GLsizei height, - const struct gl_pixelstore_attrib *unpack, - const GLubyte *bitmap) -{ - GLD_context *gldCtx; - GLD_driver_dx9 *gld; - - IDirect3DSurface9 *pImage; - HRESULT hr; - D3DLOCKED_RECT d3dLockedRect; - BYTE *pTempBitmap; - D3DCOLOR clBitmapOne, clBitmapZero; - D3DCOLOR *pBits; - const GLubyte *src; - int i, j, k; - - gldCtx = GLD_GET_CONTEXT(ctx); - gld = GLD_GET_DX9_DRIVER(gldCtx); - - // A NULL bitmap is valid, but merely advances the raster position - if ((bitmap == NULL) || (width == 0) || (height == 0)) - return; - - clBitmapZero = D3DCOLOR_RGBA(0,0,0,0); // NOTE: Alpha is Zero - clBitmapOne = D3DCOLOR_COLORVALUE( - ctx->Current.RasterColor[0], - ctx->Current.RasterColor[1], - ctx->Current.RasterColor[2], - 1.0f); // NOTE: Alpha is One - - hr = IDirect3DDevice9_CreateOffscreenPlainSurface( - gld->pDev, - width, - height, - D3DFMT_A8R8G8B8, - D3DPOOL_SCRATCH, - &pImage, - NULL); - if (FAILED(hr)) { - return; - } - - // Lock all of surface - hr = IDirect3DSurface9_LockRect(pImage, &d3dLockedRect, NULL, 0); - if (FAILED(hr)) { - IDirect3DSurface9_Release(pImage); - return; - } - - pTempBitmap = _mesa_unpack_bitmap(width, height, bitmap, unpack); - if (pTempBitmap == NULL) { - IDirect3DSurface9_Release(pImage); - return; - } - - pBits = (D3DCOLOR*)d3dLockedRect.pBits; - - for (i=0; iDefaultPacking, pTempBitmap, width, height, GL_COLOR_INDEX, GL_BITMAP, - 0, i, 0); - for (j=0; j<(width>>3); j++) { - byte = *src++; - for (k=0; k<8; k++) { - *pBits++ = (byte & 128) ? clBitmapOne : clBitmapZero; - byte <<= 1; - } - } - // Fill remaining bits from bitmap - if (width & 7) { - byte = *src; - for (k=0; k<(width & 7); k++) { - *pBits++ = (byte & 128) ? clBitmapOne : clBitmapZero; - byte <<= 1; - } - } - } - - FREE(pTempBitmap); - -/* - // unpack image, apply transfer ops and store directly in texture - texImage->TexFormat->StoreImage( - ctx, - 2, - GL_BITMAP, - &_mesa_texformat_argb8888, - d3dLockedRect.pBits, - width, height, 1, 0, 0, 0, - d3dLockedRect.Pitch, - 0, // dstImageStride - GL_BITMAP, GL_COLOR_INDEX, bitmap, unpack); -*/ - IDirect3DSurface9_UnlockRect(pImage); - - _gldDrawPixels(ctx, TRUE, x, y, width, height, pImage); - - IDirect3DSurface9_Release(pImage); -} - -//--------------------------------------------------------------------------- -// Texture functions -//--------------------------------------------------------------------------- - -void _gldAllocateTexture( - GLcontext *ctx, - struct gl_texture_object *tObj, - struct gl_texture_image *texImage) -{ - GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); - GLD_driver_dx9 *gld = GLD_GET_DX9_DRIVER(gldCtx); - - IDirect3DTexture9 *pTex; - D3DFORMAT d3dFormat; - - if (!tObj || !texImage) - return; - - pTex = (IDirect3DTexture9*)tObj->DriverData; - if (pTex) { - // Decide whether we can keep existing D3D texture - // by examining top-level surface. - D3DSURFACE_DESC d3dsd; - _GLD_DX9_TEX(GetLevelDesc(pTex, 0, &d3dsd)); - // Release existing texture if not compatible - if ((d3dsd.Width == texImage->Width) || - (d3dsd.Height == texImage->Height)) - { - return; // Keep the existing texture - } - tObj->DriverData = NULL; - _GLD_DX9_TEX(Release(pTex)); - } - - d3dFormat = _gldGLFormatToD3DFormat(texImage->IntFormat); - D3DXCreateTexture( - gld->pDev, - texImage->Width, - texImage->Height, - // TODO: Re-evaluate mipmapping - (glb.bUseMipmaps) ? D3DX_DEFAULT : 1, - 0, // Usage - d3dFormat, - D3DPOOL_MANAGED, - &pTex); - tObj->DriverData = pTex; -} - -//--------------------------------------------------------------------------- - -const struct gl_texture_format* gld_ChooseTextureFormat_DX9( - GLcontext *ctx, - GLint internalFormat, - GLenum srcFormat, - GLenum srcType) -{ - // [Based on mesa_choose_tex_format()] - // - // We will choose only texture formats that are supported - // by Direct3D. If the hardware doesn't support a particular - // texture format, then the D3DX texture calls that we use - // will automatically use a HW supported format. - // - // The most critical aim is to reduce copying; if we can use - // texture-image data directly then it will be a big performance assist. - // - - switch (internalFormat) { - case GL_INTENSITY: - case GL_INTENSITY4: - case GL_INTENSITY8: - case GL_INTENSITY12: - case GL_INTENSITY16: - return &_mesa_texformat_l8; // D3DFMT_L8 - case 1: - case GL_LUMINANCE: - case GL_LUMINANCE4: - case GL_LUMINANCE8: - case GL_LUMINANCE12: - case GL_LUMINANCE16: - return &_mesa_texformat_l8; // D3DFMT_L8 - case GL_ALPHA: - case GL_ALPHA4: - case GL_ALPHA8: - case GL_ALPHA12: - case GL_ALPHA16: - return &_mesa_texformat_a8; // D3DFMT_A8 - case GL_COLOR_INDEX: - case GL_COLOR_INDEX1_EXT: - case GL_COLOR_INDEX2_EXT: - case GL_COLOR_INDEX4_EXT: - case GL_COLOR_INDEX8_EXT: - case GL_COLOR_INDEX12_EXT: - case GL_COLOR_INDEX16_EXT: - return &_mesa_texformat_rgb565; // D3DFMT_R5G6B5 - // Mesa will convert this for us later... - // return &_mesa_texformat_ci8; // D3DFMT_R5G6B5 - case 2: - case GL_LUMINANCE_ALPHA: - case GL_LUMINANCE4_ALPHA4: - case GL_LUMINANCE6_ALPHA2: - case GL_LUMINANCE8_ALPHA8: - case GL_LUMINANCE12_ALPHA4: - case GL_LUMINANCE12_ALPHA12: - case GL_LUMINANCE16_ALPHA16: - return &_mesa_texformat_al88; // D3DFMT_A8L8 - case GL_R3_G3_B2: - return &_mesa_texformat_rgb332; // D3DFMT_R3G3B2 - case GL_RGB4: - case GL_RGBA4: - case GL_RGBA2: - return &_mesa_texformat_argb4444; // D3DFMT_A4R4G4B4 - case 3: - case GL_RGB: - case GL_RGB5: - case GL_RGB8: - case GL_RGB10: - case GL_RGB12: - case GL_RGB16: - return &_mesa_texformat_rgb565; - case 4: - case GL_RGBA: - case GL_RGBA8: - case GL_RGB10_A2: - case GL_RGBA12: - case GL_RGBA16: - return &_mesa_texformat_argb8888; - case GL_RGB5_A1: - return &_mesa_texformat_argb1555; - default: - _mesa_problem(NULL, "unexpected format in fxDDChooseTextureFormat"); - return NULL; - } -} - -//--------------------------------------------------------------------------- - -/* -// Safer(?), slower version. -void gld_TexImage2D_DX9( - GLcontext *ctx, - GLenum target, - GLint level, - GLint internalFormat, - GLint width, - GLint height, - GLint border, - GLenum format, - GLenum type, - const GLvoid *pixels, - const struct gl_pixelstore_attrib *packing, - struct gl_texture_object *tObj, - struct gl_texture_image *texImage) -{ - GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); - GLD_driver_dx9 *gld = GLD_GET_DX9_DRIVER(gldCtx); - - IDirect3DTexture9 *pTex; - IDirect3DSurface9 *pSurface; - RECT rcSrcRect; - HRESULT hr; - GLint texelBytes = 4; - GLvoid *tempImage; - - if (!tObj || !texImage) - return; - - if (level == 0) { - _gldAllocateTexture(ctx, tObj, texImage); - } - - pTex = (IDirect3DTexture9*)tObj->DriverData; - if (!pTex) - return; // Texture has not been created - if (level >= IDirect3DTexture9_GetLevelCount(pTex)) - return; // Level does not exist - hr = IDirect3DTexture9_GetSurfaceLevel(pTex, level, &pSurface); - if (FAILED(hr)) - return; // Surface level doesn't exist (or just a plain error) - - tempImage = MALLOC(width * height * texelBytes); - if (!tempImage) { - _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage2D"); - IDirect3DSurface9_Release(pSurface); - return; - } - // unpack image, apply transfer ops and store in tempImage - texImage->TexFormat->StoreImage(ctx, 2, texImage->Format, - &_mesa_texformat_argb8888, // dest format - tempImage, - width, height, 1, 0, 0, 0, - width * texelBytes, - 0, // dstImageStride - format, type, pixels, packing); - - SetRect(&rcSrcRect, 0, 0, width, height); - D3DXLoadSurfaceFromMemory( - pSurface, - NULL, - NULL, - tempImage, - D3DFMT_A8R8G8B8, - width * texelBytes, - NULL, - &rcSrcRect, - D3DX_FILTER_NONE, - 0); - - FREE(tempImage); - IDirect3DSurface9_Release(pSurface); -} -*/ - -//--------------------------------------------------------------------------- - -// Faster, more efficient version. -// Copies subimage straight to dest texture -void gld_TexImage2D_DX9( - GLcontext *ctx, - GLenum target, - GLint level, - GLint internalFormat, - GLint width, - GLint height, - GLint border, - GLenum format, - GLenum type, - const GLvoid *pixels, - const struct gl_pixelstore_attrib *packing, - struct gl_texture_object *tObj, - struct gl_texture_image *texImage) -{ - GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); - GLD_driver_dx9 *gld = GLD_GET_DX9_DRIVER(gldCtx); - - IDirect3DTexture9 *pTex; - IDirect3DSurface9 *pSurface; - HRESULT hr; - D3DLOCKED_RECT d3dLockedRect; - D3DSURFACE_DESC d3dsd; - - if (!tObj || !texImage) - return; - - // GLQUAKE FIX - // Test for input alpha data with non-alpha internalformat - if (((internalFormat==3) || (internalFormat==GL_RGB)) && (format==GL_RGBA)) { - // Input format has alpha, but a non-alpha format has been requested. - texImage->IntFormat = GL_RGBA; - internalFormat = GL_RGBA; - } - - if (level == 0) { - _gldAllocateTexture(ctx, tObj, texImage); - } - - pTex = (IDirect3DTexture9*)tObj->DriverData; - if (!pTex) - return; // Texture has not been created - if (level >= IDirect3DTexture9_GetLevelCount(pTex)) - return; // Level does not exist - hr = IDirect3DTexture9_GetSurfaceLevel(pTex, level, &pSurface); - if (FAILED(hr)) - return; // Surface level doesn't exist (or just a plain error) - - IDirect3DSurface9_GetDesc(pSurface, &d3dsd); - - // Lock all of surface - hr = IDirect3DSurface9_LockRect(pSurface, &d3dLockedRect, NULL, 0); - if (FAILED(hr)) { - IDirect3DSurface9_Release(pSurface); - return; - } - - // unpack image, apply transfer ops and store directly in texture - texImage->TexFormat->StoreImage( - ctx, - 2, - texImage->Format, - _gldMesaFormatForD3DFormat(d3dsd.Format), - d3dLockedRect.pBits, - width, height, 1, 0, 0, 0, - d3dLockedRect.Pitch, - 0, // dstImageStride - format, type, pixels, packing); - - IDirect3DSurface9_UnlockRect(pSurface); - IDirect3DSurface9_Release(pSurface); -} - -//--------------------------------------------------------------------------- - -void gld_TexImage1D_DX9(GLcontext *ctx, GLenum target, GLint level, - GLint internalFormat, - GLint width, GLint border, - GLenum format, GLenum type, const GLvoid *pixels, - const struct gl_pixelstore_attrib *packing, - struct gl_texture_object *texObj, - struct gl_texture_image *texImage ) -{ - // A 1D texture is a 2D texture with a height of zero - gld_TexImage2D_DX9(ctx, target, level, internalFormat, width, 1, border, format, type, pixels, packing, texObj, texImage); -} - -//--------------------------------------------------------------------------- - -/* -void gld_TexSubImage2D( GLcontext *ctx, GLenum target, GLint level, - GLint xoffset, GLint yoffset, - GLsizei width, GLsizei height, - GLenum format, GLenum type, - const GLvoid *pixels, - const struct gl_pixelstore_attrib *packing, - struct gl_texture_object *tObj, - struct gl_texture_image *texImage ) -{ - GLD_GET_CONTEXT - IDirect3DTexture9 *pTex; - IDirect3DSurface9 *pSurface; - D3DFORMAT d3dFormat; - HRESULT hr; - GLint texelBytes = 4; - GLvoid *tempImage; - RECT rcSrcRect; - RECT rcDstRect; - - if (!tObj || !texImage) - return; - - pTex = (IDirect3DTexture9*)tObj->DriverData; - if (!pTex) - return; // Texture has not been created - if (level >= _GLD_DX9_TEX(GetLevelCount(pTex)) - return; // Level does not exist - hr = _GLD_DX9_TEX(GetSurfaceLevel(pTex, level, &pSurface); - if (FAILED(hr)) - return; // Surface level doesn't exist (or just a plain error) - - d3dFormat = _gldGLFormatToD3DFormat(texImage->Format); - tempImage = MALLOC(width * height * texelBytes); - if (!tempImage) { - _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage2D"); - IDirect3DSurface9_Release(pSurface); - return; - } - - // unpack image, apply transfer ops and store in tempImage - texImage->TexFormat->StoreImage(ctx, 2, texImage->Format, - &_mesa_texformat_argb8888, // dest format - tempImage, - width, height, 1, 0, 0, 0, - width * texelBytes, - 0, // dstImageStride - format, type, pixels, packing); - - // Source rectangle is whole of input image - SetRect(&rcSrcRect, 0, 0, width, height); - - // Dest rectangle must be offset to dest image - SetRect(&rcDstRect, 0, 0, width, height); - OffsetRect(&rcDstRect, xoffset, yoffset); - - D3DXLoadSurfaceFromMemory( - pSurface, - NULL, - &rcDstRect, - tempImage, - D3DFMT_A8R8G8B8, - width * texelBytes, - NULL, - &rcSrcRect, - D3DX_FILTER_NONE, - 0); - - FREE(tempImage); - IDirect3DSurface9_Release(pSurface); -} -*/ - -//--------------------------------------------------------------------------- - -// Faster, more efficient version. -// Copies subimage straight to dest texture -void gld_TexSubImage2D_DX9( GLcontext *ctx, GLenum target, GLint level, - GLint xoffset, GLint yoffset, - GLsizei width, GLsizei height, - GLenum format, GLenum type, - const GLvoid *pixels, - const struct gl_pixelstore_attrib *packing, - struct gl_texture_object *tObj, - struct gl_texture_image *texImage ) -{ - GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); - GLD_driver_dx9 *gld = GLD_GET_DX9_DRIVER(gldCtx); - - IDirect3DTexture9 *pTex; - IDirect3DSurface9 *pSurface; - HRESULT hr; - RECT rcDstRect; - D3DLOCKED_RECT d3dLockedRect; - D3DSURFACE_DESC d3dsd; - - if (!tObj || !texImage) - return; - - pTex = (IDirect3DTexture9*)tObj->DriverData; - if (!pTex) - return; // Texture has not been created - if (level >= IDirect3DTexture9_GetLevelCount(pTex)) - return; // Level does not exist - hr = IDirect3DTexture9_GetSurfaceLevel(pTex, level, &pSurface); - if (FAILED(hr)) - return; // Surface level doesn't exist (or just a plain error) - - IDirect3DSurface9_GetDesc(pSurface, &d3dsd); - - // Dest rectangle must be offset to dest image - SetRect(&rcDstRect, 0, 0, width, height); - OffsetRect(&rcDstRect, xoffset, yoffset); - - // Lock sub-rect of surface - hr = IDirect3DSurface9_LockRect(pSurface, &d3dLockedRect, &rcDstRect, 0); - if (FAILED(hr)) { - IDirect3DSurface9_Release(pSurface); - return; - } - - // unpack image, apply transfer ops and store directly in texture - texImage->TexFormat->StoreImage(ctx, 2, texImage->Format, - _gldMesaFormatForD3DFormat(d3dsd.Format), - d3dLockedRect.pBits, - width, height, 1, - 0, 0, 0, // NOTE: d3dLockedRect.pBits is already offset!!! - d3dLockedRect.Pitch, - 0, // dstImageStride - format, type, pixels, packing); - - - IDirect3DSurface9_UnlockRect(pSurface); - IDirect3DSurface9_Release(pSurface); -} - -//--------------------------------------------------------------------------- - -void gld_TexSubImage1D_DX9( GLcontext *ctx, GLenum target, GLint level, - GLint xoffset, GLsizei width, - GLenum format, GLenum type, - const GLvoid *pixels, - const struct gl_pixelstore_attrib *packing, - struct gl_texture_object *texObj, - struct gl_texture_image *texImage ) -{ - gld_TexSubImage2D_DX9(ctx, target, level, xoffset, 0, width, 1, format, type, pixels, packing, texObj, texImage); -} - -//--------------------------------------------------------------------------- - -void gld_DeleteTexture_DX9( - GLcontext *ctx, - struct gl_texture_object *tObj) -{ - GLD_context *gld = (GLD_context*)(ctx->DriverCtx); - - if (tObj) { - IDirect3DTexture9 *pTex = (IDirect3DTexture9*)tObj->DriverData; - if (pTex) { -/* // Make sure texture is not bound to a stage before releasing it - for (int i=0; iCurrentTexture[i] == pTex) { - gld->pDev->SetTexture(i, NULL); - gld->CurrentTexture[i] = NULL; - } - }*/ - _GLD_DX9_TEX(Release(pTex)); - tObj->DriverData = NULL; - } - } -} - -//--------------------------------------------------------------------------- - -__inline void _gldSetColorOps( - const GLD_driver_dx9 *gld, - GLuint unit, - DWORD ColorArg1, - D3DTEXTUREOP ColorOp, - DWORD ColorArg2) -{ - _GLD_DX9_DEV(SetTextureStageState(gld->pDev, unit, D3DTSS_COLORARG1, ColorArg1)); - _GLD_DX9_DEV(SetTextureStageState(gld->pDev, unit, D3DTSS_COLOROP, ColorOp)); - _GLD_DX9_DEV(SetTextureStageState(gld->pDev, unit, D3DTSS_COLORARG2, ColorArg2)); -} - -//--------------------------------------------------------------------------- - -__inline void _gldSetAlphaOps( - const GLD_driver_dx9 *gld, - GLuint unit, - DWORD AlphaArg1, - D3DTEXTUREOP AlphaOp, - DWORD AlphaArg2) -{ - _GLD_DX9_DEV(SetTextureStageState(gld->pDev, unit, D3DTSS_ALPHAARG1, AlphaArg1)); - _GLD_DX9_DEV(SetTextureStageState(gld->pDev, unit, D3DTSS_ALPHAOP, AlphaOp)); - _GLD_DX9_DEV(SetTextureStageState(gld->pDev, unit, D3DTSS_ALPHAARG2, AlphaArg2)); -} - -//--------------------------------------------------------------------------- - -void gldUpdateTextureUnit( - GLcontext *ctx, - GLuint unit, - BOOL bPassThrough) -{ - GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); - GLD_driver_dx9 *gld = GLD_GET_DX9_DRIVER(gldCtx); - - D3DTEXTUREFILTERTYPE minfilter; - D3DTEXTUREFILTERTYPE mipfilter; - GLenum BaseFormat; - DWORD dwColorArg0; - int iTexEnv = 0; - GLD_texenv *pTexenv; - - // NOTE: If bPassThrough is FALSE then texture stage can be - // disabled otherwise it must pass-through it's current fragment. - - const struct gl_texture_unit *pUnit = &ctx->Texture.Unit[unit]; - const struct gl_texture_object *tObj = pUnit->_Current; - - IDirect3DTexture9 *pTex = NULL; - if (tObj) { - pTex = (IDirect3DTexture9*)tObj->DriverData; - } - - // Enable texturing if unit is enabled and a valid D3D texture exists - // Mesa 5: TEXTUREn_x altered to TEXTURE_nD_BIT - //if (pTex && (pUnit->Enabled & (TEXTURE0_1D | TEXTURE0_2D))) { - if (pTex && (pUnit->_ReallyEnabled & (TEXTURE_1D_BIT | TEXTURE_2D_BIT))) { - // Enable texturing - _GLD_DX9_DEV(SetTexture(gld->pDev, unit, pTex)); - } else { - // Disable texturing, then return - _GLD_DX9_DEV(SetTexture(gld->pDev, unit, NULL)); - if (bPassThrough) { - _gldSetColorOps(gld, unit, D3DTA_TEXTURE, D3DTOP_SELECTARG2, D3DTA_DIFFUSE); - _gldSetAlphaOps(gld, unit, D3DTA_TEXTURE, D3DTOP_SELECTARG2, D3DTA_DIFFUSE); - } else { - _gldSetColorOps(gld, unit, D3DTA_TEXTURE, D3DTOP_DISABLE, D3DTA_DIFFUSE); - _gldSetAlphaOps(gld, unit, D3DTA_TEXTURE, D3DTOP_DISABLE, D3DTA_DIFFUSE); - } - return; - } - - // Texture parameters - _gldConvertMinFilter(tObj->MinFilter, &minfilter, &mipfilter); -// _GLD_DX9_DEV(SetTextureStageState(gld->pDev, unit, D3DTSS_MINFILTER, minfilter)); -// _GLD_DX9_DEV(SetTextureStageState(gld->pDev, unit, D3DTSS_MIPFILTER, mipfilter)); -// _GLD_DX9_DEV(SetTextureStageState(gld->pDev, unit, D3DTSS_MAGFILTER, _gldConvertMagFilter(tObj->MagFilter))); -// _GLD_DX9_DEV(SetTextureStageState(gld->pDev, unit, D3DTSS_ADDRESSU, _gldConvertWrap(tObj->WrapS))); -// _GLD_DX9_DEV(SetTextureStageState(gld->pDev, unit, D3DTSS_ADDRESSV, _gldConvertWrap(tObj->WrapT))); - _GLD_DX9_DEV(SetSamplerState(gld->pDev, unit, D3DSAMP_MINFILTER, minfilter)); - _GLD_DX9_DEV(SetSamplerState(gld->pDev, unit, D3DSAMP_MIPFILTER, mipfilter)); - _GLD_DX9_DEV(SetSamplerState(gld->pDev, unit, D3DSAMP_MAGFILTER, _gldConvertMagFilter(tObj->MagFilter))); - _GLD_DX9_DEV(SetSamplerState(gld->pDev, unit, D3DSAMP_ADDRESSU, _gldConvertWrap(tObj->WrapS))); - _GLD_DX9_DEV(SetSamplerState(gld->pDev, unit, D3DSAMP_ADDRESSV, _gldConvertWrap(tObj->WrapT))); - - // Texture priority - _GLD_DX9_TEX(SetPriority(pTex, (DWORD)(tObj->Priority*65535.0f))); - - // Texture environment - // TODO: Examine input texture for alpha and use specific alpha/non-alpha ops. - // See Page 355 of the Red Book. - BaseFormat = _gldDecodeBaseFormat(pTex); - - switch (BaseFormat) { - case GL_RGB: - iTexEnv = 0; - break; - case GL_RGBA: - iTexEnv = 1; - break; - case GL_ALPHA: - iTexEnv = 2; - break; - } - - switch (pUnit->EnvMode) { - case GL_DECAL: - iTexEnv += 0; - break; - case GL_REPLACE: - iTexEnv += 3; - break; - case GL_MODULATE: - iTexEnv += 6; - break; - case GL_BLEND: - // Set blend colour - dwColorArg0 = D3DCOLOR_COLORVALUE(pUnit->EnvColor[0], pUnit->EnvColor[1], pUnit->EnvColor[2], pUnit->EnvColor[3]); - _GLD_DX9_DEV(SetTextureStageState(gld->pDev, unit, D3DTSS_COLORARG0, dwColorArg0)); - iTexEnv += 9; - break; - case GL_ADD: - iTexEnv += 12; - break; - } - pTexenv = (GLD_texenv*)&gldTexEnv[iTexEnv]; - _gldSetColorOps(gld, unit, pTexenv->ColorArg1, pTexenv->ColorOp, pTexenv->ColorArg2); - _gldSetAlphaOps(gld, unit, pTexenv->AlphaArg1, pTexenv->AlphaOp, pTexenv->AlphaArg2); -} - -//--------------------------------------------------------------------------- - -void gld_NEW_TEXTURE_DX9( - GLcontext *ctx) -{ - // TODO: Support for three (ATI Radeon) or more (nVidia GeForce3) texture units - - BOOL bUnit0Enabled; - BOOL bUnit1Enabled; - - if (!ctx) - return; // Sanity check - - if (ctx->Const.MaxTextureUnits == 1) { - gldUpdateTextureUnit(ctx, 0, TRUE); - return; - } - - // - // NOTE: THE FOLLOWING RELATES TO TWO TEXTURE UNITS, AND TWO ONLY!! - // - - // Mesa 5: Texture Units altered - //bUnit0Enabled = (ctx->Texture._ReallyEnabled & (TEXTURE0_1D | TEXTURE0_2D)) ? TRUE : FALSE; - //bUnit1Enabled = (ctx->Texture._ReallyEnabled & (TEXTURE1_1D | TEXTURE1_2D)) ? TRUE : FALSE; - bUnit0Enabled = (ctx->Texture.Unit[0]._ReallyEnabled & (TEXTURE_1D_BIT | TEXTURE_2D_BIT)) ? TRUE : FALSE; - bUnit1Enabled = (ctx->Texture.Unit[1]._ReallyEnabled & (TEXTURE_1D_BIT | TEXTURE_2D_BIT)) ? TRUE : FALSE; - - // If Unit0 is disabled and Unit1 is enabled then we must pass-though - gldUpdateTextureUnit(ctx, 0, (!bUnit0Enabled && bUnit1Enabled) ? TRUE : FALSE); - // We can always disable the last texture unit - gldUpdateTextureUnit(ctx, 1, FALSE); - -#ifdef _DEBUG -#if 0 - { - // Find out whether device supports current renderstates - GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); - GLD_driver_dx9 *gld = GLD_GET_DX9_DRIVER(gldCtx); -// GLD_context *gld = GLD_GET_CONTEXT(ctx); - - DWORD dwPasses; - _GLD_DX9_DEV(ValidateDevice(gld->pDev, &dwPasses)); -// if (FAILED(hr)) { -// gldLogError(GLDLOG_ERROR, "ValidateDevice failed", hr); -// } - if (dwPasses != 1) { - gldLogMessage(GLDLOG_ERROR, "ValidateDevice: Can't do in one pass\n"); - } - } -#endif -#endif -}; - -//--------------------------------------------------------------------------- diff --git a/src/mesa/drivers/windows/gldirect/dx9/gld_vb_d3d_render_dx9.c b/src/mesa/drivers/windows/gldirect/dx9/gld_vb_d3d_render_dx9.c deleted file mode 100644 index 4fa6bcaf1a..0000000000 --- a/src/mesa/drivers/windows/gldirect/dx9/gld_vb_d3d_render_dx9.c +++ /dev/null @@ -1,263 +0,0 @@ -/**************************************************************************** -* -* Mesa 3-D graphics library -* Direct3D Driver Interface -* -* ======================================================================== -* -* Copyright (C) 1991-2004 SciTech Software, Inc. All rights reserved. -* -* Permission is hereby granted, free of charge, to any person obtaining a -* copy of this software and associated documentation files (the "Software"), -* to deal in the Software without restriction, including without limitation -* the rights to use, copy, modify, merge, publish, distribute, sublicense, -* and/or sell copies of the Software, and to permit persons to whom the -* Software is furnished to do so, subject to the following conditions: -* -* The above copyright notice and this permission notice shall be included -* in all copies or substantial portions of the Software. -* -* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -* SCITECH SOFTWARE INC BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF -* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -* SOFTWARE. -* -* ====================================================================== -* -* Language: ANSI C -* Environment: Windows 9x/2000/XP/XBox (Win32) -* -* Description: GLDirect fastpath pipeline stage -* -****************************************************************************/ - -//--------------------------------------------------------------------------- - -//#include "../GLDirect.h" -//#include "../gld_log.h" -//#include "gld_dx8.h" - -#include "dglcontext.h" -#include "ddlog.h" -#include "gld_dx9.h" - -//--------------------------------------------------------------------------- - -#include "glheader.h" -#include "context.h" -#include "macros.h" -// #include "mem.h" -#include "mtypes.h" -//#include "mmath.h" - -#include "math/m_matrix.h" -#include "math/m_xform.h" - -#include "tnl/t_pipeline.h" - -//--------------------------------------------------------------------------- - -__inline void _gldSetVertexShaderConstants( - GLcontext *ctx, - GLD_driver_dx9 *gld) -{ - D3DXMATRIX mat, matView, matProj; - GLfloat *pM; - - // Mesa 5: Altered to a Stack - //pM = ctx->ModelView.m; - pM = ctx->ModelviewMatrixStack.Top->m; - matView._11 = pM[0]; - matView._12 = pM[1]; - matView._13 = pM[2]; - matView._14 = pM[3]; - matView._21 = pM[4]; - matView._22 = pM[5]; - matView._23 = pM[6]; - matView._24 = pM[7]; - matView._31 = pM[8]; - matView._32 = pM[9]; - matView._33 = pM[10]; - matView._34 = pM[11]; - matView._41 = pM[12]; - matView._42 = pM[13]; - matView._43 = pM[14]; - matView._44 = pM[15]; - - // Mesa 5: Altered to a Stack - //pM = ctx->ProjectionMatrix.m; - pM = ctx->ProjectionMatrixStack.Top->m; - matProj._11 = pM[0]; - matProj._12 = pM[1]; - matProj._13 = pM[2]; - matProj._14 = pM[3]; - matProj._21 = pM[4]; - matProj._22 = pM[5]; - matProj._23 = pM[6]; - matProj._24 = pM[7]; - matProj._31 = pM[8]; - matProj._32 = pM[9]; - matProj._33 = pM[10]; - matProj._34 = pM[11]; - matProj._41 = pM[12]; - matProj._42 = pM[13]; - matProj._43 = pM[14]; - matProj._44 = pM[15]; - - D3DXMatrixMultiply( &mat, &matView, &matProj ); - D3DXMatrixTranspose( &mat, &mat ); - - _GLD_DX9_DEV(SetVertexShaderConstantF(gld->pDev, 0, (float*)&mat, 4)); -} - -//--------------------------------------------------------------------------- - -static GLboolean gld_d3d_render_stage_run( - GLcontext *ctx, - struct tnl_pipeline_stage *stage) -{ - GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); - GLD_driver_dx9 *gld = GLD_GET_DX9_DRIVER(gldCtx); - - TNLcontext *tnl; - struct vertex_buffer *VB; - tnl_render_func *tab; - GLint pass; - GLD_pb_dx9 *gldPB = &gld->PB3d; -/* - static int count = 0; - count++; - if (count != 2) - return GL_FALSE; -*/ - // The "check" function should disable this stage, - // but we'll test gld->bUseMesaTnL anyway. - if (gld->bUseMesaTnL) { - // Do nothing in this stage, but continue pipeline - return GL_TRUE; - } - - tnl = TNL_CONTEXT(ctx); - VB = &tnl->vb; - pass = 0; - - tnl->Driver.Render.Start( ctx ); - -#if 0 - // For debugging: Useful to see if an app passes colour data in - // an unusual format. - switch (VB->ColorPtr[0]->Type) { - case GL_FLOAT: - ddlogMessage(GLDLOG_SYSTEM, "ColorPtr: GL_FLOAT\n"); - break; - case GL_UNSIGNED_BYTE: - ddlogMessage(GLDLOG_SYSTEM, "ColorPtr: GL_UNSIGNED_BYTE\n"); - break; - default: - ddlogMessage(GLDLOG_SYSTEM, "ColorPtr: *?*\n"); - break; - } -#endif - - tnl->Driver.Render.Points = gld_Points3D_DX9; - if (ctx->_TriangleCaps & DD_FLATSHADE) { - tnl->Driver.Render.Line = gld_Line3DFlat_DX9; - tnl->Driver.Render.Triangle = gld_Triangle3DFlat_DX9; - tnl->Driver.Render.Quad = gld_Quad3DFlat_DX9; - } else { - tnl->Driver.Render.Line = gld_Line3DSmooth_DX9; - tnl->Driver.Render.Triangle = gld_Triangle3DSmooth_DX9; - tnl->Driver.Render.Quad = gld_Quad3DSmooth_DX9; - } - - _GLD_DX9_VB(Lock(gldPB->pVB, 0, 0, &gldPB->pPoints, D3DLOCK_DISCARD)); - gldPB->nPoints = gldPB->nLines = gldPB->nTriangles = 0; - // Allocate primitive pointers - // gldPB->pPoints is always first - gldPB->pLines = gldPB->pPoints + (gldPB->dwStride * gldPB->iFirstLine); - gldPB->pTriangles = gldPB->pPoints + (gldPB->dwStride * gldPB->iFirstTriangle); - - ASSERT(tnl->Driver.Render.BuildVertices); - ASSERT(tnl->Driver.Render.PrimitiveNotify); - ASSERT(tnl->Driver.Render.Points); - ASSERT(tnl->Driver.Render.Line); - ASSERT(tnl->Driver.Render.Triangle); - ASSERT(tnl->Driver.Render.Quad); - ASSERT(tnl->Driver.Render.ResetLineStipple); - ASSERT(tnl->Driver.Render.Interp); - ASSERT(tnl->Driver.Render.CopyPV); - ASSERT(tnl->Driver.Render.ClippedLine); - ASSERT(tnl->Driver.Render.ClippedPolygon); - ASSERT(tnl->Driver.Render.Finish); - - tab = (VB->Elts ? tnl->Driver.Render.PrimTabElts : tnl->Driver.Render.PrimTabVerts); - - do { - GLuint i, length, flags = 0; - for (i = 0 ; !(flags & PRIM_END) ; i += length) - { - flags = VB->Primitive[i].mode; - length= VB->Primitive[i].count; - ASSERT(length || (flags & PRIM_END)); - ASSERT((flags & PRIM_MODE_MASK) <= GL_POLYGON+1); - if (length) - tab[flags & PRIM_MODE_MASK]( ctx, i, i + length, flags ); - } - } while (tnl->Driver.Render.Multipass && - tnl->Driver.Render.Multipass( ctx, ++pass )); - - _GLD_DX9_VB(Unlock(gldPB->pVB)); - - _GLD_DX9_DEV(SetStreamSource(gld->pDev, 0, gldPB->pVB, 0, gldPB->dwStride)); - - _GLD_DX9_DEV(SetTransform(gld->pDev, D3DTS_PROJECTION, &gld->matProjection)); - _GLD_DX9_DEV(SetTransform(gld->pDev, D3DTS_WORLD, &gld->matModelView)); - - if (gldPB->nPoints) { - _GLD_DX9_DEV(DrawPrimitive(gld->pDev, D3DPT_POINTLIST, 0, gldPB->nPoints)); - gldPB->nPoints = 0; - } - - if (gldPB->nLines) { - _GLD_DX9_DEV(DrawPrimitive(gld->pDev, D3DPT_LINELIST, gldPB->iFirstLine, gldPB->nLines)); - gldPB->nLines = 0; - } - - if (gldPB->nTriangles) { - _GLD_DX9_DEV(DrawPrimitive(gld->pDev, D3DPT_TRIANGLELIST, gldPB->iFirstTriangle, gldPB->nTriangles)); - gldPB->nTriangles = 0; - } - - return GL_FALSE; /* finished the pipe */ -} - -//--------------------------------------------------------------------------- - -static void gld_d3d_render_stage_check( - GLcontext *ctx, - struct tnl_pipeline_stage *stage) -{ - GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); - GLD_driver_dx9 *gld = GLD_GET_DX9_DRIVER(gldCtx); - // Is this thread safe? - stage->active = (gld->bUseMesaTnL) ? GL_FALSE : GL_TRUE; - return; -} - - -//--------------------------------------------------------------------------- - -const struct tnl_pipeline_stage _gld_d3d_render_stage = -{ - "gld_d3d_render_stage", - NULL, - NULL, - NULL, - NULL, - gld_d3d_render_stage_run /* run */ -}; - -//--------------------------------------------------------------------------- diff --git a/src/mesa/drivers/windows/gldirect/dx9/gld_vb_mesa_render_dx9.c b/src/mesa/drivers/windows/gldirect/dx9/gld_vb_mesa_render_dx9.c deleted file mode 100644 index 64acab2d2a..0000000000 --- a/src/mesa/drivers/windows/gldirect/dx9/gld_vb_mesa_render_dx9.c +++ /dev/null @@ -1,443 +0,0 @@ - -/* - * Mesa 3-D graphics library - * Version: 3.5 - * - * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - * Authors: - * Keith Whitwell - */ - - -/* - * Render whole vertex buffers, including projection of vertices from - * clip space and clipping of primitives. - * - * This file makes calls to project vertices and to the point, line - * and triangle rasterizers via the function pointers: - * - * context->Driver.Render.* - * - */ - - -//--------------------------------------------------------------------------- - -#include "dglcontext.h" -#include "ddlog.h" -#include "gld_dx9.h" - -//--------------------------------------------------------------------------- - -#include "glheader.h" -#include "context.h" -#include "macros.h" -#include "mtypes.h" -//#include "mmath.h" - -#include "math/m_matrix.h" -#include "math/m_xform.h" - -#include "tnl/t_pipeline.h" - -/**********************************************************************/ -/* Clip single primitives */ -/**********************************************************************/ - - -#if defined(USE_IEEE) -#define NEGATIVE(x) (GET_FLOAT_BITS(x) & (1<<31)) -//#define DIFFERENT_SIGNS(x,y) ((GET_FLOAT_BITS(x) ^ GET_FLOAT_BITS(y)) & (1<<31)) -#else -#define NEGATIVE(x) (x < 0) -//#define DIFFERENT_SIGNS(x,y) (x * y <= 0 && x - y != 0) -/* Could just use (x*y<0) except for the flatshading requirements. - * Maybe there's a better way? - */ -#endif - - -#define W(i) coord[i][3] -#define Z(i) coord[i][2] -#define Y(i) coord[i][1] -#define X(i) coord[i][0] -#define SIZE 4 -#define TAG(x) x##_4 -#include "tnl/t_vb_cliptmp.h" - - - -/**********************************************************************/ -/* Clip and render whole begin/end objects */ -/**********************************************************************/ - -#define NEED_EDGEFLAG_SETUP (ctx->_TriangleCaps & DD_TRI_UNFILLED) -#define EDGEFLAG_GET(idx) VB->EdgeFlag[idx] -#define EDGEFLAG_SET(idx, val) VB->EdgeFlag[idx] = val - - -/* Vertices, with the possibility of clipping. - */ -#define RENDER_POINTS( start, count ) \ - tnl->Driver.Render.Points( ctx, start, count ) - -#define RENDER_LINE( v1, v2 ) \ -do { \ - GLubyte c1 = mask[v1], c2 = mask[v2]; \ - GLubyte ormask = c1|c2; \ - if (!ormask) \ - LineFunc( ctx, v1, v2 ); \ - else if (!(c1 & c2 & 0x3f)) \ - clip_line_4( ctx, v1, v2, ormask ); \ -} while (0) - -#define RENDER_TRI( v1, v2, v3 ) \ -do { \ - GLubyte c1 = mask[v1], c2 = mask[v2], c3 = mask[v3]; \ - GLubyte ormask = c1|c2|c3; \ - if (!ormask) \ - TriangleFunc( ctx, v1, v2, v3 ); \ - else if (!(c1 & c2 & c3 & 0x3f)) \ - clip_tri_4( ctx, v1, v2, v3, ormask ); \ -} while (0) - -#define RENDER_QUAD( v1, v2, v3, v4 ) \ -do { \ - GLubyte c1 = mask[v1], c2 = mask[v2]; \ - GLubyte c3 = mask[v3], c4 = mask[v4]; \ - GLubyte ormask = c1|c2|c3|c4; \ - if (!ormask) \ - QuadFunc( ctx, v1, v2, v3, v4 ); \ - else if (!(c1 & c2 & c3 & c4 & 0x3f)) \ - clip_quad_4( ctx, v1, v2, v3, v4, ormask ); \ -} while (0) - - -#define LOCAL_VARS \ - TNLcontext *tnl = TNL_CONTEXT(ctx); \ - struct vertex_buffer *VB = &tnl->vb; \ - const GLuint * const elt = VB->Elts; \ - const GLubyte *mask = VB->ClipMask; \ - const GLuint sz = VB->ClipPtr->size; \ - const tnl_line_func LineFunc = tnl->Driver.Render.Line; \ - const tnl_triangle_func TriangleFunc = tnl->Driver.Render.Triangle; \ - const tnl_quad_func QuadFunc = tnl->Driver.Render.Quad; \ - const GLboolean stipple = ctx->Line.StippleFlag; \ - (void) (LineFunc && TriangleFunc && QuadFunc); \ - (void) elt; (void) mask; (void) sz; (void) stipple; - -#define TAG(x) clip_##x##_verts -#define INIT(x) tnl->Driver.Render.PrimitiveNotify( ctx, x ) -#define RESET_STIPPLE if (stipple) tnl->Driver.Render.ResetLineStipple( ctx ) -#define PRESERVE_VB_DEFS -#include "tnl/t_vb_rendertmp.h" - - - -/* Elts, with the possibility of clipping. - */ -#undef ELT -#undef TAG -#define ELT(x) elt[x] -#define TAG(x) clip_##x##_elts -#include "tnl/t_vb_rendertmp.h" - -/* TODO: do this for all primitives, verts and elts: - */ -static void clip_elt_triangles( GLcontext *ctx, - GLuint start, - GLuint count, - GLuint flags ) -{ - TNLcontext *tnl = TNL_CONTEXT(ctx); - tnl_render_func render_tris = tnl->Driver.Render.PrimTabElts[GL_TRIANGLES]; - struct vertex_buffer *VB = &tnl->vb; - const GLuint * const elt = VB->Elts; - GLubyte *mask = VB->ClipMask; - GLuint last = count-2; - GLuint j; - (void) flags; - - tnl->Driver.Render.PrimitiveNotify( ctx, GL_TRIANGLES ); - - for (j=start; j < last; j+=3 ) { - GLubyte c1 = mask[elt[j]]; - GLubyte c2 = mask[elt[j+1]]; - GLubyte c3 = mask[elt[j+2]]; - GLubyte ormask = c1|c2|c3; - if (ormask) { - if (start < j) - render_tris( ctx, start, j, 0 ); - if (!(c1&c2&c3&0x3f)) - clip_tri_4( ctx, elt[j], elt[j+1], elt[j+2], ormask ); - start = j+3; - } - } - - if (start < j) - render_tris( ctx, start, j, 0 ); -} - -/**********************************************************************/ -/* Render whole begin/end objects */ -/**********************************************************************/ - -#define NEED_EDGEFLAG_SETUP (ctx->_TriangleCaps & DD_TRI_UNFILLED) -#define EDGEFLAG_GET(idx) VB->EdgeFlag[idx] -#define EDGEFLAG_SET(idx, val) VB->EdgeFlag[idx] = val - - -/* Vertices, no clipping. - */ -#define RENDER_POINTS( start, count ) \ - tnl->Driver.Render.Points( ctx, start, count ) - -#define RENDER_LINE( v1, v2 ) \ - LineFunc( ctx, v1, v2 ) - -#define RENDER_TRI( v1, v2, v3 ) \ - TriangleFunc( ctx, v1, v2, v3 ) - -#define RENDER_QUAD( v1, v2, v3, v4 ) \ - QuadFunc( ctx, v1, v2, v3, v4 ) - -#define TAG(x) _gld_tnl_##x##_verts - -#define LOCAL_VARS \ - TNLcontext *tnl = TNL_CONTEXT(ctx); \ - struct vertex_buffer *VB = &tnl->vb; \ - const GLuint * const elt = VB->Elts; \ - const tnl_line_func LineFunc = tnl->Driver.Render.Line; \ - const tnl_triangle_func TriangleFunc = tnl->Driver.Render.Triangle; \ - const tnl_quad_func QuadFunc = tnl->Driver.Render.Quad; \ - (void) (LineFunc && TriangleFunc && QuadFunc); \ - (void) elt; - -#define RESET_STIPPLE tnl->Driver.Render.ResetLineStipple( ctx ) -#define INIT(x) tnl->Driver.Render.PrimitiveNotify( ctx, x ) -#define RENDER_TAB_QUALIFIER -#define PRESERVE_VB_DEFS -#include "tnl/t_vb_rendertmp.h" - - -/* Elts, no clipping. - */ -#undef ELT -#define TAG(x) _gld_tnl_##x##_elts -#define ELT(x) elt[x] -#include "tnl/t_vb_rendertmp.h" - - -/**********************************************************************/ -/* Helper functions for drivers */ -/**********************************************************************/ -/* -void _tnl_RenderClippedPolygon( GLcontext *ctx, const GLuint *elts, GLuint n ) -{ - TNLcontext *tnl = TNL_CONTEXT(ctx); - struct vertex_buffer *VB = &tnl->vb; - GLuint *tmp = VB->Elts; - - VB->Elts = (GLuint *)elts; - tnl->Driver.Render.PrimTabElts[GL_POLYGON]( ctx, 0, n, PRIM_BEGIN|PRIM_END ); - VB->Elts = tmp; -} - -void _tnl_RenderClippedLine( GLcontext *ctx, GLuint ii, GLuint jj ) -{ - TNLcontext *tnl = TNL_CONTEXT(ctx); - tnl->Driver.Render.Line( ctx, ii, jj ); -} -*/ - - -/**********************************************************************/ -/* Clip and render whole vertex buffers */ -/**********************************************************************/ - -tnl_points_func _gldSetupPoints[4] = { - gld_Points2D_DX9, - gld_Points2D_DX9, - gld_Points2D_DX9, - gld_Points2D_DX9 -}; -tnl_line_func _gldSetupLine[4] = { - gld_Line2DFlat_DX9, - gld_Line2DSmooth_DX9, - gld_Line2DFlat_DX9, - gld_Line2DSmooth_DX9, -}; -tnl_triangle_func _gldSetupTriangle[4] = { - gld_Triangle2DFlat_DX9, - gld_Triangle2DSmooth_DX9, - gld_Triangle2DFlatExtras_DX9, - gld_Triangle2DSmoothExtras_DX9 -}; -tnl_quad_func _gldSetupQuad[4] = { - gld_Quad2DFlat_DX9, - gld_Quad2DSmooth_DX9, - gld_Quad2DFlatExtras_DX9, - gld_Quad2DSmoothExtras_DX9 -}; - -//--------------------------------------------------------------------------- - -static GLboolean _gld_mesa_render_stage_run( - GLcontext *ctx, - struct tnl_pipeline_stage *stage) -{ - GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); - GLD_driver_dx9 *gld = GLD_GET_DX9_DRIVER(gldCtx); - - TNLcontext *tnl = TNL_CONTEXT(ctx); - struct vertex_buffer *VB = &tnl->vb; - tnl_render_func *tab; - GLint pass = 0; - GLD_pb_dx9 *gldPB; - - /* Allow the drivers to lock before projected verts are built so - * that window coordinates are guarenteed not to change before - * rendering. - */ - ASSERT(tnl->Driver.Render.Start); - - tnl->Driver.Render.Start( ctx ); - - // NOTE: Setting D3DRS_SOFTWAREVERTEXPROCESSING for a mixed-mode device resets - // stream, indices and shader to default values of NULL or 0. -/* if ((ctx->_TriangleCaps & DD_TRI_LIGHT_TWOSIDE) && - gld->VStwosidelight.hShader && - !ctx->Fog.Enabled) - { - IDirect3DDevice8_SetRenderState(gld->pDev, D3DRS_SOFTWAREVERTEXPROCESSING, !gld->VStwosidelight.bHardware); - _GLD_DX9_DEV(SetVertexShader(gld->pDev, gld->VStwosidelight.hShader)); - gldPB = &gld->PBtwosidelight; - tnl->Driver.Render.Points = gld_Points2DTwoside_DX9; - if (ctx->_TriangleCaps & DD_FLATSHADE) { - tnl->Driver.Render.Line = gld_Line2DFlatTwoside_DX9; - tnl->Driver.Render.Triangle = gld_Triangle2DFlatTwoside_DX9; - tnl->Driver.Render.Quad = gld_Quad2DFlatTwoside_DX9; - } else { - tnl->Driver.Render.Line = gld_Line2DSmoothTwoside_DX9; - tnl->Driver.Render.Triangle = gld_Triangle2DSmoothTwoside_DX9; - tnl->Driver.Render.Quad = gld_Quad2DSmoothTwoside_DX9; - } - } else {*/ -// IDirect3DDevice8_SetRenderState(gld->pDev, D3DRS_SOFTWAREVERTEXPROCESSING, TRUE); - IDirect3DDevice9_SetSoftwareVertexProcessing(gld->pDev, TRUE); - gldPB = &gld->PB2d; - _GLD_DX9_DEV(SetVertexShader(gld->pDev, NULL)); - _GLD_DX9_DEV(SetFVF(gld->pDev, gldPB->dwFVF)); - tnl->Driver.Render.Points = _gldSetupPoints[gld->iSetupFunc]; - tnl->Driver.Render.Line = _gldSetupLine[gld->iSetupFunc]; - tnl->Driver.Render.Triangle = _gldSetupTriangle[gld->iSetupFunc]; - tnl->Driver.Render.Quad = _gldSetupQuad[gld->iSetupFunc]; -// } - - _GLD_DX9_VB(Lock(gldPB->pVB, 0, 0, &gldPB->pPoints, D3DLOCK_DISCARD)); - gldPB->nPoints = gldPB->nLines = gldPB->nTriangles = 0; - // Allocate primitive pointers - // gldPB->pPoints is always first - gldPB->pLines = gldPB->pPoints + (gldPB->dwStride * gldPB->iFirstLine); - gldPB->pTriangles = gldPB->pPoints + (gldPB->dwStride * gldPB->iFirstTriangle); - - ASSERT(tnl->Driver.Render.BuildVertices); - ASSERT(tnl->Driver.Render.PrimitiveNotify); - ASSERT(tnl->Driver.Render.Points); - ASSERT(tnl->Driver.Render.Line); - ASSERT(tnl->Driver.Render.Triangle); - ASSERT(tnl->Driver.Render.Quad); - ASSERT(tnl->Driver.Render.ResetLineStipple); - ASSERT(tnl->Driver.Render.Interp); - ASSERT(tnl->Driver.Render.CopyPV); - ASSERT(tnl->Driver.Render.ClippedLine); - ASSERT(tnl->Driver.Render.ClippedPolygon); - ASSERT(tnl->Driver.Render.Finish); - - tnl->Driver.Render.BuildVertices( ctx, 0, VB->Count, ~0 ); - - if (VB->ClipOrMask) { - tab = VB->Elts ? clip_render_tab_elts : clip_render_tab_verts; - clip_render_tab_elts[GL_TRIANGLES] = clip_elt_triangles; - } - else { - tab = (VB->Elts ? - tnl->Driver.Render.PrimTabElts : - tnl->Driver.Render.PrimTabVerts); - } - - do { - GLuint i, length, flags = 0; - for (i = 0 ; !(flags & PRIM_END) ; i += length) { - flags = VB->Primitive[i].mode; - length= VB->Primitive[i].count; - ASSERT(length || (flags & PRIM_END)); - ASSERT((flags & PRIM_MODE_MASK) <= GL_POLYGON+1); - if (length) - tab[flags & PRIM_MODE_MASK]( ctx, i, i + length, flags ); - } - } while (tnl->Driver.Render.Multipass && - tnl->Driver.Render.Multipass( ctx, ++pass )); - - -// tnl->Driver.Render.Finish( ctx ); - - _GLD_DX9_VB(Unlock(gldPB->pVB)); - - _GLD_DX9_DEV(SetStreamSource(gld->pDev, 0, gldPB->pVB, 0, gldPB->dwStride)); - - if (gldPB->nPoints) { - _GLD_DX9_DEV(DrawPrimitive(gld->pDev, D3DPT_POINTLIST, 0, gldPB->nPoints)); - gldPB->nPoints = 0; - } - - if (gldPB->nLines) { - _GLD_DX9_DEV(DrawPrimitive(gld->pDev, D3DPT_LINELIST, gldPB->iFirstLine, gldPB->nLines)); - gldPB->nLines = 0; - } - - if (gldPB->nTriangles) { - _GLD_DX9_DEV(DrawPrimitive(gld->pDev, D3DPT_TRIANGLELIST, gldPB->iFirstTriangle, gldPB->nTriangles)); - gldPB->nTriangles = 0; - } - - return GL_FALSE; /* finished the pipe */ -} - - -/**********************************************************************/ -/* Render pipeline stage */ -/**********************************************************************/ - - - - -const struct tnl_pipeline_stage _gld_mesa_render_stage = -{ - "gld_mesa_render_stage", - NULL, - NULL, - NULL, - NULL, - _gld_mesa_render_stage_run /* run */ -}; - -//--------------------------------------------------------------------------- diff --git a/src/mesa/drivers/windows/gldirect/dx9/gld_wgl_dx9.c b/src/mesa/drivers/windows/gldirect/dx9/gld_wgl_dx9.c deleted file mode 100644 index dc465c5418..0000000000 --- a/src/mesa/drivers/windows/gldirect/dx9/gld_wgl_dx9.c +++ /dev/null @@ -1,1345 +0,0 @@ -/**************************************************************************** -* -* Mesa 3-D graphics library -* Direct3D Driver Interface -* -* ======================================================================== -* -* Copyright (C) 1991-2004 SciTech Software, Inc. All rights reserved. -* -* Permission is hereby granted, free of charge, to any person obtaining a -* copy of this software and associated documentation files (the "Software"), -* to deal in the Software without restriction, including without limitation -* the rights to use, copy, modify, merge, publish, distribute, sublicense, -* and/or sell copies of the Software, and to permit persons to whom the -* Software is furnished to do so, subject to the following conditions: -* -* The above copyright notice and this permission notice shall be included -* in all copies or substantial portions of the Software. -* -* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -* SCITECH SOFTWARE INC BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF -* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -* SOFTWARE. -* -* ====================================================================== -* -* Language: ANSI C -* Environment: Windows 9x/2000/XP/XBox (Win32) -* -* Description: GLDirect Direct3D 8.x WGL (WindowsGL) -* -****************************************************************************/ - -#include "dglcontext.h" -#include "gld_driver.h" -#include "gld_dxerr9.h" -#include "gld_dx9.h" - -#include "tnl/tnl.h" -#include "tnl/t_context.h" - -// Copied from dglcontect.c -#define GLDERR_NONE 0 -#define GLDERR_MEM 1 -#define GLDERR_DDRAW 2 -#define GLDERR_D3D 3 -#define GLDERR_BPP 4 -#define GLDERR_DDS 5 -// This external var keeps track of any error -extern int nContextError; - -#define DDLOG_CRITICAL_OR_WARN DDLOG_CRITICAL - -extern void _gld_mesa_warning(GLcontext *, char *); -extern void _gld_mesa_fatal(GLcontext *, char *); - -//--------------------------------------------------------------------------- - -static char szColorDepthWarning[] = -"GLDirect does not support the current desktop\n\ -color depth.\n\n\ -You may need to change the display resolution to\n\ -16 bits per pixel or higher color depth using\n\ -the Windows Display Settings control panel\n\ -before running this OpenGL application.\n"; - -// The only depth-stencil formats currently supported by Direct3D -// Surface Format Depth Stencil Total Bits -// D3DFMT_D32 32 - 32 -// D3DFMT_D15S1 15 1 16 -// D3DFMT_D24S8 24 8 32 -// D3DFMT_D16 16 - 16 -// D3DFMT_D24X8 24 - 32 -// D3DFMT_D24X4S4 24 4 32 - -// This pixel format will be used as a template when compiling the list -// of pixel formats supported by the hardware. Many fields will be -// filled in at runtime. -// PFD flag defaults are upgraded to match ChoosePixelFormat() -- DaveM -static DGL_pixelFormat pfTemplateHW = -{ - { - sizeof(PIXELFORMATDESCRIPTOR), // Size of the data structure - 1, // Structure version - should be 1 - // Flags: - PFD_DRAW_TO_WINDOW | // The buffer can draw to a window or device surface. - PFD_DRAW_TO_BITMAP | // The buffer can draw to a bitmap. (DaveM) - PFD_SUPPORT_GDI | // The buffer supports GDI drawing. (DaveM) - PFD_SUPPORT_OPENGL | // The buffer supports OpenGL drawing. - PFD_DOUBLEBUFFER | // The buffer is double-buffered. - 0, // Placeholder for easy commenting of above flags - PFD_TYPE_RGBA, // Pixel type RGBA. - 16, // Total colour bitplanes (excluding alpha bitplanes) - 5, 0, // Red bits, shift - 5, 0, // Green bits, shift - 5, 0, // Blue bits, shift - 0, 0, // Alpha bits, shift (destination alpha) - 0, // Accumulator bits (total) - 0, 0, 0, 0, // Accumulator bits: Red, Green, Blue, Alpha - 0, // Depth bits - 0, // Stencil bits - 0, // Number of auxiliary buffers - 0, // Layer type - 0, // Specifies the number of overlay and underlay planes. - 0, // Layer mask - 0, // Specifies the transparent color or index of an underlay plane. - 0 // Damage mask - }, - D3DFMT_UNKNOWN, // No depth/stencil buffer -}; - -//--------------------------------------------------------------------------- -// Vertex Shaders -//--------------------------------------------------------------------------- -/* -// Vertex Shader Declaration -static DWORD dwTwoSidedLightingDecl[] = -{ - D3DVSD_STREAM(0), - D3DVSD_REG(0, D3DVSDT_FLOAT3), // XYZ position - D3DVSD_REG(1, D3DVSDT_FLOAT3), // XYZ normal - D3DVSD_REG(2, D3DVSDT_D3DCOLOR), // Diffuse color - D3DVSD_REG(3, D3DVSDT_D3DCOLOR), // Specular color - D3DVSD_REG(4, D3DVSDT_FLOAT2), // 2D texture unit 0 - D3DVSD_REG(5, D3DVSDT_FLOAT2), // 2D texture unit 1 - D3DVSD_END() -}; - -// Vertex Shader for two-sided lighting -static char *szTwoSidedLightingVS = -// This is a test shader! -"vs.1.0\n" -"m4x4 oPos,v0,c0\n" -"mov oD0,v2\n" -"mov oD1,v3\n" -"mov oT0,v4\n" -"mov oT1,v5\n" -; -*/ -//--------------------------------------------------------------------------- -//--------------------------------------------------------------------------- - -typedef struct { - HINSTANCE hD3D9DLL; // Handle to d3d9.dll - FNDIRECT3DCREATE9 fnDirect3DCreate9; // Direct3DCreate9 function prototype - BOOL bDirect3D; // Persistant Direct3D9 exists - BOOL bDirect3DDevice; // Persistant Direct3DDevice9 exists - IDirect3D9 *pD3D; // Persistant Direct3D9 - IDirect3DDevice9 *pDev; // Persistant Direct3DDevice9 -} GLD_dx9_globals; - -// These are "global" to all DX9 contexts. KeithH -static GLD_dx9_globals dx9Globals; - -//--------------------------------------------------------------------------- -//--------------------------------------------------------------------------- - -BOOL gldGetDXErrorString_DX( - HRESULT hr, - char *buf, - int nBufSize) -{ - // - // Return a string describing the input HRESULT error code - // - - const char *pStr = DXGetErrorString9(hr); - - if (pStr == NULL) - return FALSE; - - if (strlen(pStr) > nBufSize) - strncpy(buf, pStr, nBufSize); - else - strcpy(buf, pStr); - -// D3DXGetErrorString(hr, buf, nBufSize); - - return TRUE; -} - -//--------------------------------------------------------------------------- - -static D3DMULTISAMPLE_TYPE _gldGetDeviceMultiSampleType( - IDirect3D9 *pD3D9, - D3DFORMAT SurfaceFormat, - D3DDEVTYPE d3dDevType, - BOOL Windowed) -{ - int i; - HRESULT hr; - - if (glb.dwMultisample == GLDS_MULTISAMPLE_NONE) - return D3DMULTISAMPLE_NONE; - - if (glb.dwMultisample == GLDS_MULTISAMPLE_FASTEST) { - // Find fastest multisample - for (i=2; i<17; i++) { - hr = IDirect3D9_CheckDeviceMultiSampleType( - pD3D9, - glb.dwAdapter, - d3dDevType, - SurfaceFormat, - Windowed, - (D3DMULTISAMPLE_TYPE)i, - NULL); - if (SUCCEEDED(hr)) { - return (D3DMULTISAMPLE_TYPE)i; - } - } - } else { - // Find nicest multisample - for (i=16; i>1; i--) { - hr = IDirect3D9_CheckDeviceMultiSampleType( - pD3D9, - glb.dwAdapter, - d3dDevType, - SurfaceFormat, - Windowed, - (D3DMULTISAMPLE_TYPE)i, - NULL); - if (SUCCEEDED(hr)) { - return (D3DMULTISAMPLE_TYPE)i; - } - } - } - - // Nothing found - return default - return D3DMULTISAMPLE_NONE; -} - -//--------------------------------------------------------------------------- - -void _gldDestroyPrimitiveBuffer( - GLD_pb_dx9 *gldVB) -{ - SAFE_RELEASE(gldVB->pVB); - - // Sanity check... - gldVB->nLines = gldVB->nPoints = gldVB->nTriangles = 0; -} - -//--------------------------------------------------------------------------- - -HRESULT _gldCreatePrimitiveBuffer( - GLcontext *ctx, - GLD_driver_dx9 *lpCtx, - GLD_pb_dx9 *gldVB) -{ - HRESULT hResult; - char *szCreateVertexBufferFailed = "CreateVertexBuffer failed"; - DWORD dwMaxVertices; // Max number of vertices in vertex buffer - DWORD dwVBSize; // Total size of vertex buffer - - // If CVA (Compiled Vertex Array) is used by an OpenGL app, then we - // will need enough vertices to cater for Mesa::Const.MaxArrayLockSize. - // We'll use IMM_SIZE if it's larger (which it should not be). - dwMaxVertices = MAX_ARRAY_LOCK_SIZE; - - // Now calculate how many vertices to allow for in total - // 1 per point, 2 per line, 6 per quad = 9 - dwVBSize = dwMaxVertices * 9 * gldVB->dwStride; - - hResult = IDirect3DDevice9_CreateVertexBuffer( - lpCtx->pDev, - dwVBSize, - gldVB->dwUsage, - gldVB->dwFVF, - gldVB->dwPool, - &gldVB->pVB, - NULL); - if (FAILED(hResult)) { - ddlogMessage(DDLOG_CRITICAL_OR_WARN, szCreateVertexBufferFailed); - return hResult; - } - - gldVB->nLines = gldVB->nPoints = gldVB->nTriangles = 0; - gldVB->pPoints = gldVB->pLines = gldVB->pTriangles = NULL; - gldVB->iFirstLine = dwMaxVertices; // Index of first line in VB - gldVB->iFirstTriangle = dwMaxVertices*3; // Index of first triangle in VB - - return S_OK; -} - -//--------------------------------------------------------------------------- -// Function: _gldCreateVertexShaders -// Create DX9 Vertex Shaders. -//--------------------------------------------------------------------------- -/* -void _gldCreateVertexShaders( - GLD_driver_dx9 *gld) -{ - DWORD dwFlags; - LPD3DXBUFFER pVSOpcodeBuffer; // Vertex Shader opcode buffer - HRESULT hr; - -#ifdef _DEBUG - dwFlags = D3DXASM_DEBUG; -#else - dwFlags = 0; // D3DXASM_SKIPVALIDATION; -#endif - - ddlogMessage(DDLOG_INFO, "Creating shaders...\n"); - - // Init the shader handle - gld->VStwosidelight.hShader = 0; - - if (gld->d3dCaps8.MaxStreams == 0) { - // Lame DX8 driver doesn't support streams - // Not fatal, as defaults will be used - ddlogMessage(DDLOG_WARN, "Driver doesn't support Vertex Shaders (MaxStreams==0)\n"); - return; - } - - // ** THIS DISABLES VERTEX SHADER SUPPORT ** -// return; - // ** THIS DISABLES VERTEX SHADER SUPPORT ** - - // - // Two-sided lighting - // - -#if 0 - // - // DEBUGGING: Load shader from a text file - // - { - LPD3DXBUFFER pVSErrorBuffer; // Vertex Shader error buffer - hr = D3DXAssembleShaderFromFile( - "twoside.vsh", - dwFlags, - NULL, // No constants - &pVSOpcodeBuffer, - &pVSErrorBuffer); - if (pVSErrorBuffer && pVSErrorBuffer->lpVtbl->GetBufferPointer(pVSErrorBuffer)) - ddlogMessage(DDLOG_INFO, pVSErrorBuffer->lpVtbl->GetBufferPointer(pVSErrorBuffer)); - SAFE_RELEASE(pVSErrorBuffer); - } -#else - { - LPD3DXBUFFER pVSErrorBuffer; // Vertex Shader error buffer - // Assemble ascii shader text into shader opcodes - hr = D3DXAssembleShader( - szTwoSidedLightingVS, - strlen(szTwoSidedLightingVS), - dwFlags, - NULL, // No constants - &pVSOpcodeBuffer, - &pVSErrorBuffer); - if (pVSErrorBuffer && pVSErrorBuffer->lpVtbl->GetBufferPointer(pVSErrorBuffer)) - ddlogMessage(DDLOG_INFO, pVSErrorBuffer->lpVtbl->GetBufferPointer(pVSErrorBuffer)); - SAFE_RELEASE(pVSErrorBuffer); - } -#endif - if (FAILED(hr)) { - ddlogError(DDLOG_WARN, "AssembleShader failed", hr); - SAFE_RELEASE(pVSOpcodeBuffer); - return; - } - -// This is for debugging. Remove to enable vertex shaders in HW -#define _GLD_FORCE_SW_VS 0 - - if (_GLD_FORCE_SW_VS) { - // _GLD_FORCE_SW_VS should be disabled for Final Release - ddlogMessage(DDLOG_SYSTEM, "[Forcing shaders in SW]\n"); - } - - // Try and create shader in hardware. - // NOTE: The D3D Ref device appears to succeed when trying to - // create the device in hardware, but later complains - // when trying to set it with SetVertexShader(). Go figure. - if (_GLD_FORCE_SW_VS || glb.dwDriver == GLDS_DRIVER_REF) { - // Don't try and create a hardware shader with the Ref device - hr = E_FAIL; // COM error/fail result - } else { - gld->VStwosidelight.bHardware = TRUE; - hr = IDirect3DDevice8_CreateVertexShader( - gld->pDev, - dwTwoSidedLightingDecl, - pVSOpcodeBuffer->lpVtbl->GetBufferPointer(pVSOpcodeBuffer), - &gld->VStwosidelight.hShader, - 0); - } - if (FAILED(hr)) { - ddlogMessage(DDLOG_INFO, "... HW failed, trying SW...\n"); - // Failed. Try and create shader for software processing - hr = IDirect3DDevice8_CreateVertexShader( - gld->pDev, - dwTwoSidedLightingDecl, - pVSOpcodeBuffer->lpVtbl->GetBufferPointer(pVSOpcodeBuffer), - &gld->VStwosidelight.hShader, - D3DUSAGE_SOFTWAREPROCESSING); - if (FAILED(hr)) { - gld->VStwosidelight.hShader = 0; // Sanity check - ddlogError(DDLOG_WARN, "CreateVertexShader failed", hr); - return; - } - // Succeeded, but for software processing - gld->VStwosidelight.bHardware = FALSE; - } - - SAFE_RELEASE(pVSOpcodeBuffer); - - ddlogMessage(DDLOG_INFO, "... OK\n"); -} - -//--------------------------------------------------------------------------- - -void _gldDestroyVertexShaders( - GLD_driver_dx9 *gld) -{ - if (gld->VStwosidelight.hShader) { - IDirect3DDevice8_DeleteVertexShader(gld->pDev, gld->VStwosidelight.hShader); - gld->VStwosidelight.hShader = 0; - } -} -*/ -//--------------------------------------------------------------------------- - -BOOL gldCreateDrawable_DX( - DGL_ctx *ctx, -// BOOL bDefaultDriver, - BOOL bDirectDrawPersistant, - BOOL bPersistantBuffers) -{ - // - // bDirectDrawPersistant: applies to IDirect3D9 - // bPersistantBuffers: applies to IDirect3DDevice9 - // - - HRESULT hResult; - GLD_driver_dx9 *lpCtx = NULL; - D3DDEVTYPE d3dDevType; - D3DPRESENT_PARAMETERS d3dpp; - D3DDISPLAYMODE d3ddm; - DWORD dwBehaviourFlags; - D3DADAPTER_IDENTIFIER9 d3dIdent; - - // Error if context is NULL. - if (ctx == NULL) - return FALSE; - - if (ctx->glPriv) { - lpCtx = ctx->glPriv; - // Release any existing interfaces - SAFE_RELEASE(lpCtx->pDev); - SAFE_RELEASE(lpCtx->pD3D); - } else { - lpCtx = (GLD_driver_dx9*)malloc(sizeof(GLD_driver_dx9)); - ZeroMemory(lpCtx, sizeof(lpCtx)); - } - - d3dDevType = (glb.dwDriver == GLDS_DRIVER_HAL) ? D3DDEVTYPE_HAL : D3DDEVTYPE_REF; - // TODO: Check this -// if (bDefaultDriver) -// d3dDevType = D3DDEVTYPE_REF; - - // Use persistant interface if needed - if (bDirectDrawPersistant && dx9Globals.bDirect3D) { - lpCtx->pD3D = dx9Globals.pD3D; - IDirect3D9_AddRef(lpCtx->pD3D); - goto SkipDirectDrawCreate; - } - - // Create Direct3D9 object - lpCtx->pD3D = dx9Globals.fnDirect3DCreate9(D3D_SDK_VERSION); - if (lpCtx->pD3D == NULL) { - MessageBox(NULL, "Unable to initialize Direct3D9", "GLDirect", MB_OK); - ddlogMessage(DDLOG_CRITICAL_OR_WARN, "Unable to create Direct3D9 interface"); - nContextError = GLDERR_D3D; - goto return_with_error; - } - - // Cache Direct3D interface for subsequent GLRCs - if (bDirectDrawPersistant && !dx9Globals.bDirect3D) { - dx9Globals.pD3D = lpCtx->pD3D; - IDirect3D9_AddRef(dx9Globals.pD3D); - dx9Globals.bDirect3D = TRUE; - } -SkipDirectDrawCreate: - - // Get the display mode so we can make a compatible backbuffer - hResult = IDirect3D9_GetAdapterDisplayMode(lpCtx->pD3D, glb.dwAdapter, &d3ddm); - if (FAILED(hResult)) { - nContextError = GLDERR_D3D; - goto return_with_error; - } - - // Get device caps - hResult = IDirect3D9_GetDeviceCaps(lpCtx->pD3D, glb.dwAdapter, d3dDevType, &lpCtx->d3dCaps9); - if (FAILED(hResult)) { - ddlogError(DDLOG_CRITICAL_OR_WARN, "IDirect3D9_GetDeviceCaps failed", hResult); - nContextError = GLDERR_D3D; - goto return_with_error; - } - - // Check for hardware transform & lighting - lpCtx->bHasHWTnL = lpCtx->d3dCaps9.DevCaps & D3DDEVCAPS_HWTRANSFORMANDLIGHT ? TRUE : FALSE; - -/* - // - // GONE FOR DX9? - // - // If this flag is present then we can't default to Mesa - // SW rendering between BeginScene() and EndScene(). - if (lpCtx->d3dCaps9.Caps2 & D3DCAPS2_NO2DDURING3DSCENE) { - ddlogMessage(DDLOG_WARN, - "Warning : No 2D allowed during 3D scene.\n"); - } -*/ - - // - // Create the Direct3D context - // - - // Re-use original IDirect3DDevice if persistant buffers exist. - // Note that we test for persistant IDirect3D9 as well - // bDirectDrawPersistant == persistant IDirect3D9 (DirectDraw9 does not exist) - if (bDirectDrawPersistant && bPersistantBuffers && dx9Globals.pD3D && dx9Globals.pDev) { - lpCtx->pDev = dx9Globals.pDev; - IDirect3DDevice9_AddRef(dx9Globals.pDev); - goto skip_direct3ddevice_create; - } - - // Clear the presentation parameters (sets all members to zero) - ZeroMemory(&d3dpp, sizeof(d3dpp)); - - // Recommended by MS; needed for MultiSample. - // Be careful if altering this for FullScreenBlit - d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD; - - d3dpp.BackBufferFormat = d3ddm.Format; - d3dpp.BackBufferCount = 2; //1; - d3dpp.MultiSampleType = _gldGetDeviceMultiSampleType(lpCtx->pD3D, d3ddm.Format, d3dDevType, !ctx->bFullscreen); - d3dpp.AutoDepthStencilFormat = ctx->lpPF->dwDriverData; - d3dpp.EnableAutoDepthStencil = (d3dpp.AutoDepthStencilFormat == D3DFMT_UNKNOWN) ? FALSE : TRUE; - - if (ctx->bFullscreen) { - ddlogWarnOption(FALSE); // Don't popup any messages in fullscreen - d3dpp.Windowed = FALSE; - d3dpp.BackBufferWidth = d3ddm.Width; - d3dpp.BackBufferHeight = d3ddm.Height; - d3dpp.hDeviceWindow = ctx->hWnd; - d3dpp.FullScreen_RefreshRateInHz = D3DPRESENT_RATE_DEFAULT; - - // Support for vertical retrace synchronisation. - // Set default presentation interval in case caps bits are missing - d3dpp.PresentationInterval = D3DPRESENT_INTERVAL_DEFAULT; - if (glb.bWaitForRetrace) { - if (lpCtx->d3dCaps9.PresentationIntervals & D3DPRESENT_INTERVAL_ONE) - d3dpp.PresentationInterval = D3DPRESENT_INTERVAL_ONE; - } else { - if (lpCtx->d3dCaps9.PresentationIntervals & D3DPRESENT_INTERVAL_IMMEDIATE) - d3dpp.PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE; - } - } else { - ddlogWarnOption(glb.bMessageBoxWarnings); // OK to popup messages - d3dpp.Windowed = TRUE; - d3dpp.BackBufferWidth = ctx->dwWidth; - d3dpp.BackBufferHeight = ctx->dwHeight; - d3dpp.hDeviceWindow = ctx->hWnd; - d3dpp.FullScreen_RefreshRateInHz = 0; - // PresentationInterval Windowed mode is optional now in DX9 (DaveM) - d3dpp.PresentationInterval = D3DPRESENT_INTERVAL_DEFAULT; - if (glb.bWaitForRetrace) { - d3dpp.PresentationInterval = D3DPRESENT_INTERVAL_ONE; - } else { - d3dpp.PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE; - } - } - - // Decide if we can use hardware TnL - dwBehaviourFlags = (lpCtx->bHasHWTnL) ? - D3DCREATE_MIXED_VERTEXPROCESSING : D3DCREATE_SOFTWARE_VERTEXPROCESSING; - // Add flag to tell D3D to be thread-safe - if (glb.bMultiThreaded) - dwBehaviourFlags |= D3DCREATE_MULTITHREADED; - // Add flag to tell D3D to be FPU-safe - if (!glb.bFastFPU) - dwBehaviourFlags |= D3DCREATE_FPU_PRESERVE; - hResult = IDirect3D9_CreateDevice(lpCtx->pD3D, - glb.dwAdapter, - d3dDevType, - ctx->hWnd, - dwBehaviourFlags, - &d3dpp, - &lpCtx->pDev); - if (FAILED(hResult)) { - ddlogError(DDLOG_CRITICAL_OR_WARN, "IDirect3D9_CreateDevice failed", hResult); - nContextError = GLDERR_D3D; - goto return_with_error; - } - - if (bDirectDrawPersistant && bPersistantBuffers && dx9Globals.pD3D) { - dx9Globals.pDev = lpCtx->pDev; - dx9Globals.bDirect3DDevice = TRUE; - } - - // Dump some useful stats - hResult = IDirect3D9_GetAdapterIdentifier( - lpCtx->pD3D, - glb.dwAdapter, - 0, // No WHQL detection (avoid few seconds delay) - &d3dIdent); - if (SUCCEEDED(hResult)) { - ddlogPrintf(DDLOG_INFO, "[Driver Description: %s]", &d3dIdent.Description); - ddlogPrintf(DDLOG_INFO, "[Driver file: %s %d.%d.%02d.%d]", - d3dIdent.Driver, - HIWORD(d3dIdent.DriverVersion.HighPart), - LOWORD(d3dIdent.DriverVersion.HighPart), - HIWORD(d3dIdent.DriverVersion.LowPart), - LOWORD(d3dIdent.DriverVersion.LowPart)); - ddlogPrintf(DDLOG_INFO, "[VendorId: 0x%X, DeviceId: 0x%X, SubSysId: 0x%X, Revision: 0x%X]", - d3dIdent.VendorId, d3dIdent.DeviceId, d3dIdent.SubSysId, d3dIdent.Revision); - } - - // Test to see if IHV driver exposes Scissor Test (new for DX9) - lpCtx->bCanScissor = lpCtx->d3dCaps9.RasterCaps & D3DPRASTERCAPS_SCISSORTEST; - ddlogPrintf(DDLOG_INFO, "Can Scissor: %s", lpCtx->bCanScissor ? "Yes" : "No"); - - // Init projection matrix for D3D TnL - D3DXMatrixIdentity(&lpCtx->matProjection); - lpCtx->matModelView = lpCtx->matProjection; -// gld->bUseMesaProjection = TRUE; - -skip_direct3ddevice_create: - - // Create buffers to hold primitives - lpCtx->PB2d.dwFVF = GLD_FVF_2D_VERTEX; - lpCtx->PB2d.dwPool = D3DPOOL_SYSTEMMEM; - lpCtx->PB2d.dwStride = sizeof(GLD_2D_VERTEX); - lpCtx->PB2d.dwUsage = D3DUSAGE_DONOTCLIP | - D3DUSAGE_DYNAMIC | - D3DUSAGE_SOFTWAREPROCESSING | - D3DUSAGE_WRITEONLY; - hResult = _gldCreatePrimitiveBuffer(ctx->glCtx, lpCtx, &lpCtx->PB2d); - if (FAILED(hResult)) - goto return_with_error; - - lpCtx->PB3d.dwFVF = GLD_FVF_3D_VERTEX; - lpCtx->PB3d.dwPool = D3DPOOL_DEFAULT; - lpCtx->PB3d.dwStride = sizeof(GLD_3D_VERTEX); - lpCtx->PB3d.dwUsage = D3DUSAGE_DYNAMIC | -//DaveM D3DUSAGE_SOFTWAREPROCESSING | - D3DUSAGE_WRITEONLY; - hResult = _gldCreatePrimitiveBuffer(ctx->glCtx, lpCtx, &lpCtx->PB3d); - if (FAILED(hResult)) - goto return_with_error; - -/* // NOTE: A FVF code of zero indicates a non-FVF vertex buffer (for vertex shaders) - lpCtx->PBtwosidelight.dwFVF = 0; //GLD_FVF_TWOSIDED_VERTEX; - lpCtx->PBtwosidelight.dwPool = D3DPOOL_DEFAULT; - lpCtx->PBtwosidelight.dwStride = sizeof(GLD_TWOSIDED_VERTEX); - lpCtx->PBtwosidelight.dwUsage = D3DUSAGE_DONOTCLIP | - D3DUSAGE_DYNAMIC | - D3DUSAGE_SOFTWAREPROCESSING | - D3DUSAGE_WRITEONLY; - hResult = _gldCreatePrimitiveBuffer(ctx->glCtx, lpCtx, &lpCtx->PBtwosidelight); - if (FAILED(hResult)) - goto return_with_error;*/ - - // Now try and create the DX9 Vertex Shaders -// _gldCreateVertexShaders(lpCtx); - - // Zero the pipeline usage counters - lpCtx->PipelineUsage.qwMesa.QuadPart = -// lpCtx->PipelineUsage.dwD3D2SVS.QuadPart = - lpCtx->PipelineUsage.qwD3DFVF.QuadPart = 0; - - // Assign drawable to GL private - ctx->glPriv = lpCtx; - return TRUE; - -return_with_error: - // Clean up and bail - -// _gldDestroyVertexShaders(lpCtx); - -// _gldDestroyPrimitiveBuffer(&lpCtx->PBtwosidelight); - _gldDestroyPrimitiveBuffer(&lpCtx->PB3d); - _gldDestroyPrimitiveBuffer(&lpCtx->PB2d); - - SAFE_RELEASE(lpCtx->pDev); - SAFE_RELEASE(lpCtx->pD3D); - return FALSE; -} - -//--------------------------------------------------------------------------- - -BOOL gldResizeDrawable_DX( - DGL_ctx *ctx, - BOOL bDefaultDriver, - BOOL bPersistantInterface, - BOOL bPersistantBuffers) -{ - GLD_driver_dx9 *gld = NULL; - D3DDEVTYPE d3dDevType; - D3DPRESENT_PARAMETERS d3dpp; - D3DDISPLAYMODE d3ddm; - HRESULT hResult; - - // Error if context is NULL. - if (ctx == NULL) - return FALSE; - - gld = ctx->glPriv; - if (gld == NULL) - return FALSE; - - if (ctx->bSceneStarted) { - IDirect3DDevice9_EndScene(gld->pDev); - ctx->bSceneStarted = FALSE; - } - - d3dDevType = (glb.dwDriver == GLDS_DRIVER_HAL) ? D3DDEVTYPE_HAL : D3DDEVTYPE_REF; - if (!bDefaultDriver) - d3dDevType = D3DDEVTYPE_REF; // Force Direct3D Reference Rasterise (software) - - // Get the display mode so we can make a compatible backbuffer - hResult = IDirect3D9_GetAdapterDisplayMode(gld->pD3D, glb.dwAdapter, &d3ddm); - if (FAILED(hResult)) { - nContextError = GLDERR_D3D; -// goto return_with_error; - return FALSE; - } - - // Destroy DX9 Vertex Shaders before Reset() -// _gldDestroyVertexShaders(gld); - - // Release POOL_DEFAULT objects before Reset() - if (gld->PB2d.dwPool == D3DPOOL_DEFAULT) - _gldDestroyPrimitiveBuffer(&gld->PB2d); - if (gld->PB3d.dwPool == D3DPOOL_DEFAULT) - _gldDestroyPrimitiveBuffer(&gld->PB3d); -// if (gld->PBtwosidelight.dwPool == D3DPOOL_DEFAULT) -// _gldDestroyPrimitiveBuffer(&gld->PBtwosidelight); - - // Clear the presentation parameters (sets all members to zero) - ZeroMemory(&d3dpp, sizeof(d3dpp)); - - // Recommended by MS; needed for MultiSample. - // Be careful if altering this for FullScreenBlit - d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD; - - d3dpp.BackBufferFormat = d3ddm.Format; - d3dpp.BackBufferCount = 1; - d3dpp.MultiSampleType = _gldGetDeviceMultiSampleType(gld->pD3D, d3ddm.Format, d3dDevType, !ctx->bFullscreen); - d3dpp.AutoDepthStencilFormat = ctx->lpPF->dwDriverData; - d3dpp.EnableAutoDepthStencil = (d3dpp.AutoDepthStencilFormat == D3DFMT_UNKNOWN) ? FALSE : TRUE; - - // TODO: Sync to refresh - - if (ctx->bFullscreen) { - ddlogWarnOption(FALSE); // Don't popup any messages in fullscreen - d3dpp.Windowed = FALSE; - d3dpp.BackBufferWidth = d3ddm.Width; - d3dpp.BackBufferHeight = d3ddm.Height; - d3dpp.hDeviceWindow = ctx->hWnd; - d3dpp.FullScreen_RefreshRateInHz = D3DPRESENT_RATE_DEFAULT; - d3dpp.PresentationInterval = D3DPRESENT_INTERVAL_DEFAULT; - // Get better benchmark results? KeithH -// d3dpp.FullScreen_RefreshRateInHz = D3DPRESENT_RATE_UNLIMITED; - } else { - ddlogWarnOption(glb.bMessageBoxWarnings); // OK to popup messages - d3dpp.Windowed = TRUE; - d3dpp.BackBufferWidth = ctx->dwWidth; - d3dpp.BackBufferHeight = ctx->dwHeight; - d3dpp.hDeviceWindow = ctx->hWnd; - d3dpp.FullScreen_RefreshRateInHz = 0; - d3dpp.PresentationInterval = D3DPRESENT_INTERVAL_DEFAULT; - } - hResult = IDirect3DDevice9_Reset(gld->pDev, &d3dpp); - if (FAILED(hResult)) { - ddlogError(DDLOG_CRITICAL_OR_WARN, "dglResize: Reset failed", hResult); - return FALSE; - //goto cleanup_and_return_with_error; - } - - // - // Recreate POOL_DEFAULT objects - // - if (gld->PB2d.dwPool == D3DPOOL_DEFAULT) { - _gldCreatePrimitiveBuffer(ctx->glCtx, gld, &gld->PB2d); - } - if (gld->PB3d.dwPool == D3DPOOL_DEFAULT) { - _gldCreatePrimitiveBuffer(ctx->glCtx, gld, &gld->PB3d); - } -// if (gld->PBtwosidelight.dwPool == D3DPOOL_DEFAULT) { -// _gldCreatePrimitiveBuffer(ctx->glCtx, gld, &gld->PB2d); -// } - - // Recreate DX9 Vertex Shaders -// _gldCreateVertexShaders(gld); - - // Signal a complete state update - ctx->glCtx->Driver.UpdateState(ctx->glCtx, _NEW_ALL); - - // Begin a new scene - IDirect3DDevice9_BeginScene(gld->pDev); - ctx->bSceneStarted = TRUE; - - return TRUE; -} - -//--------------------------------------------------------------------------- - -BOOL gldDestroyDrawable_DX( - DGL_ctx *ctx) -{ - GLD_driver_dx9 *lpCtx = NULL; - - // Error if context is NULL. - if (!ctx) - return FALSE; - - // Error if the drawable does not exist. - if (!ctx->glPriv) - return FALSE; - - lpCtx = ctx->glPriv; - -#ifdef _DEBUG - // Dump out stats - ddlogPrintf(DDLOG_SYSTEM, "Usage: M:0x%X%X, D:0x%X%X", - lpCtx->PipelineUsage.qwMesa.HighPart, - lpCtx->PipelineUsage.qwMesa.LowPart, - lpCtx->PipelineUsage.qwD3DFVF.HighPart, - lpCtx->PipelineUsage.qwD3DFVF.LowPart); -#endif - -// _gldDestroyVertexShaders(lpCtx); - -// _gldDestroyPrimitiveBuffer(&lpCtx->PBtwosidelight); - _gldDestroyPrimitiveBuffer(&lpCtx->PB3d); - _gldDestroyPrimitiveBuffer(&lpCtx->PB2d); - - SAFE_RELEASE(lpCtx->pDev); - SAFE_RELEASE(lpCtx->pD3D); - - // Free the private drawable data - free(ctx->glPriv); - ctx->glPriv = NULL; - - return TRUE; -} - -//--------------------------------------------------------------------------- - -BOOL gldCreatePrivateGlobals_DX(void) -{ - ZeroMemory(&dx9Globals, sizeof(dx9Globals)); - - // Load d3d9.dll - dx9Globals.hD3D9DLL = LoadLibrary("D3D9.DLL"); - if (dx9Globals.hD3D9DLL == NULL) - return FALSE; - - // Now try and obtain Direct3DCreate9 - dx9Globals.fnDirect3DCreate9 = (FNDIRECT3DCREATE9)GetProcAddress(dx9Globals.hD3D9DLL, "Direct3DCreate9"); - if (dx9Globals.fnDirect3DCreate9 == NULL) { - FreeLibrary(dx9Globals.hD3D9DLL); - return FALSE; - } - - return TRUE; -} - -//--------------------------------------------------------------------------- - -BOOL gldDestroyPrivateGlobals_DX(void) -{ - if (dx9Globals.bDirect3DDevice) { - SAFE_RELEASE(dx9Globals.pDev); - dx9Globals.bDirect3DDevice = FALSE; - } - if (dx9Globals.bDirect3D) { - SAFE_RELEASE(dx9Globals.pD3D); - dx9Globals.bDirect3D = FALSE; - } - - FreeLibrary(dx9Globals.hD3D9DLL); - dx9Globals.hD3D9DLL = NULL; - dx9Globals.fnDirect3DCreate9 = NULL; - - return TRUE; -} - -//--------------------------------------------------------------------------- - -static void _BitsFromDisplayFormat( - D3DFORMAT fmt, - BYTE *cColorBits, - BYTE *cRedBits, - BYTE *cGreenBits, - BYTE *cBlueBits, - BYTE *cAlphaBits) -{ - switch (fmt) { - case D3DFMT_X1R5G5B5: - *cColorBits = 16; - *cRedBits = 5; - *cGreenBits = 5; - *cBlueBits = 5; - *cAlphaBits = 0; - return; - case D3DFMT_R5G6B5: - *cColorBits = 16; - *cRedBits = 5; - *cGreenBits = 6; - *cBlueBits = 5; - *cAlphaBits = 0; - return; - case D3DFMT_X8R8G8B8: - *cColorBits = 32; - *cRedBits = 8; - *cGreenBits = 8; - *cBlueBits = 8; - *cAlphaBits = 0; - return; - case D3DFMT_A8R8G8B8: - *cColorBits = 32; - *cRedBits = 8; - *cGreenBits = 8; - *cBlueBits = 8; - *cAlphaBits = 8; - return; - } - - // Should not get here! - *cColorBits = 32; - *cRedBits = 8; - *cGreenBits = 8; - *cBlueBits = 8; - *cAlphaBits = 0; -} - -//--------------------------------------------------------------------------- - -static void _BitsFromDepthStencilFormat( - D3DFORMAT fmt, - BYTE *cDepthBits, - BYTE *cStencilBits) -{ - // NOTE: GL expects either 32 or 16 as depth bits. - switch (fmt) { - case D3DFMT_D32: - *cDepthBits = 32; - *cStencilBits = 0; - return; - case D3DFMT_D15S1: - *cDepthBits = 16; - *cStencilBits = 1; - return; - case D3DFMT_D24S8: - *cDepthBits = 32; - *cStencilBits = 8; - return; - case D3DFMT_D16: - *cDepthBits = 16; - *cStencilBits = 0; - return; - case D3DFMT_D24X8: - *cDepthBits = 32; - *cStencilBits = 0; - return; - case D3DFMT_D24X4S4: - *cDepthBits = 32; - *cStencilBits = 4; - return; - } -} - -//--------------------------------------------------------------------------- - -BOOL gldBuildPixelformatList_DX(void) -{ - D3DDISPLAYMODE d3ddm; - D3DFORMAT fmt[6]; - IDirect3D9 *pD3D = NULL; - HRESULT hr; - int nSupportedFormats = 0; - int i; - DGL_pixelFormat *pPF; - BYTE cColorBits, cRedBits, cGreenBits, cBlueBits, cAlphaBits; -// char buf[128]; -// char cat[8]; - - // Direct3D (SW or HW) - // These are arranged so that 'best' pixelformat - // is higher in the list (for ChoosePixelFormat). - const D3DFORMAT DepthStencil[6] = { -// New order: increaing Z, then increasing stencil - D3DFMT_D15S1, - D3DFMT_D16, - D3DFMT_D24X4S4, - D3DFMT_D24X8, - D3DFMT_D24S8, - D3DFMT_D32, - }; - - // Dump DX version - ddlogMessage(GLDLOG_SYSTEM, "DirectX Version : 9.0\n"); - - // Release any existing pixelformat list - if (glb.lpPF) { - free(glb.lpPF); - } - - glb.nPixelFormatCount = 0; - glb.lpPF = NULL; - - // - // Pixelformats for Direct3D (SW or HW) rendering - // - - // Get a Direct3D 9.0 interface - pD3D = dx9Globals.fnDirect3DCreate9(D3D_SDK_VERSION); - if (!pD3D) { - return FALSE; - } - - // We will use the display mode format when finding compliant - // rendertarget/depth-stencil surfaces. - hr = IDirect3D9_GetAdapterDisplayMode(pD3D, glb.dwAdapter, &d3ddm); - if (FAILED(hr)) { - IDirect3D9_Release(pD3D); - return FALSE; - } - - // Run through the possible formats and detect supported formats - for (i=0; i<6; i++) { - hr = IDirect3D9_CheckDeviceFormat( - pD3D, - glb.dwAdapter, - glb.dwDriver==GLDS_DRIVER_HAL ? D3DDEVTYPE_HAL : D3DDEVTYPE_REF, - d3ddm.Format, - D3DUSAGE_DEPTHSTENCIL, - D3DRTYPE_SURFACE, - DepthStencil[i]); - if (FAILED(hr)) - // A failure here is not fatal. - continue; - - // Verify that the depth format is compatible. - hr = IDirect3D9_CheckDepthStencilMatch( - pD3D, - glb.dwAdapter, - glb.dwDriver==GLDS_DRIVER_HAL ? D3DDEVTYPE_HAL : D3DDEVTYPE_REF, - d3ddm.Format, - d3ddm.Format, - DepthStencil[i]); - if (FAILED(hr)) - // A failure here is not fatal, just means depth-stencil - // format is not compatible with this display mode. - continue; - - fmt[nSupportedFormats++] = DepthStencil[i]; - } - - IDirect3D9_Release(pD3D); - - if (nSupportedFormats == 0) - return FALSE; // Bail: no compliant pixelformats - - // Total count of pixelformats is: - // (nSupportedFormats+1)*2 - // UPDATED: nSupportedFormats*2 - glb.lpPF = (DGL_pixelFormat *)calloc(nSupportedFormats*2, sizeof(DGL_pixelFormat)); - glb.nPixelFormatCount = nSupportedFormats*2; - if (glb.lpPF == NULL) { - glb.nPixelFormatCount = 0; - return FALSE; - } - - // Get a copy of pointer that we can alter - pPF = glb.lpPF; - - // Cache colour bits from display format - _BitsFromDisplayFormat(d3ddm.Format, &cColorBits, &cRedBits, &cGreenBits, &cBlueBits, &cAlphaBits); - - // - // Add single-buffer formats - // -/* - // NOTE: No longer returning pixelformats that don't contain depth - // Single-buffer, no depth-stencil buffer - memcpy(pPF, &pfTemplateHW, sizeof(DGL_pixelFormat)); - pPF->pfd.dwFlags &= ~PFD_DOUBLEBUFFER; // Remove doublebuffer flag - pPF->pfd.cColorBits = cColorBits; - pPF->pfd.cRedBits = cRedBits; - pPF->pfd.cGreenBits = cGreenBits; - pPF->pfd.cBlueBits = cBlueBits; - pPF->pfd.cAlphaBits = cAlphaBits; - pPF->pfd.cDepthBits = 0; - pPF->pfd.cStencilBits = 0; - pPF->dwDriverData = D3DFMT_UNKNOWN; - pPF++; -*/ - for (i=0; ipfd.dwFlags &= ~PFD_DOUBLEBUFFER; // Remove doublebuffer flag - pPF->pfd.cColorBits = cColorBits; - pPF->pfd.cRedBits = cRedBits; - pPF->pfd.cGreenBits = cGreenBits; - pPF->pfd.cBlueBits = cBlueBits; - pPF->pfd.cAlphaBits = cAlphaBits; - _BitsFromDepthStencilFormat(fmt[i], &pPF->pfd.cDepthBits, &pPF->pfd.cStencilBits); - pPF->dwDriverData = fmt[i]; - } - - // - // Add double-buffer formats - // - - // NOTE: No longer returning pixelformats that don't contain depth -/* - memcpy(pPF, &pfTemplateHW, sizeof(DGL_pixelFormat)); - pPF->pfd.cColorBits = cColorBits; - pPF->pfd.cRedBits = cRedBits; - pPF->pfd.cGreenBits = cGreenBits; - pPF->pfd.cBlueBits = cBlueBits; - pPF->pfd.cAlphaBits = cAlphaBits; - pPF->pfd.cDepthBits = 0; - pPF->pfd.cStencilBits = 0; - pPF->dwDriverData = D3DFMT_UNKNOWN; - pPF++; -*/ - for (i=0; ipfd.cColorBits = cColorBits; - pPF->pfd.cRedBits = cRedBits; - pPF->pfd.cGreenBits = cGreenBits; - pPF->pfd.cBlueBits = cBlueBits; - pPF->pfd.cAlphaBits = cAlphaBits; - _BitsFromDepthStencilFormat(fmt[i], &pPF->pfd.cDepthBits, &pPF->pfd.cStencilBits); - pPF->dwDriverData = fmt[i]; - } - - // Popup warning message if non RGB color mode - { - // This is a hack. KeithH - HDC hdcDesktop = GetDC(NULL); - DWORD dwDisplayBitDepth = GetDeviceCaps(hdcDesktop, BITSPIXEL); - ReleaseDC(0, hdcDesktop); - if (dwDisplayBitDepth <= 8) { - ddlogPrintf(DDLOG_WARN, "Current Color Depth %d bpp is not supported", dwDisplayBitDepth); - MessageBox(NULL, szColorDepthWarning, "GLDirect", MB_OK | MB_ICONWARNING); - } - } - - // Mark list as 'current' - glb.bPixelformatsDirty = FALSE; - - return TRUE; -} - -//--------------------------------------------------------------------------- - -BOOL gldInitialiseMesa_DX( - DGL_ctx *lpCtx) -{ - GLD_driver_dx9 *gld = NULL; - int MaxTextureSize, TextureLevels; - BOOL bSoftwareTnL; - - if (lpCtx == NULL) - return FALSE; - - gld = lpCtx->glPriv; - if (gld == NULL) - return FALSE; - - if (glb.bMultitexture) { - lpCtx->glCtx->Const.MaxTextureUnits = gld->d3dCaps9.MaxSimultaneousTextures; - // Only support MAX_TEXTURE_UNITS texture units. - // ** If this is altered then the FVF formats must be reviewed **. - if (lpCtx->glCtx->Const.MaxTextureUnits > GLD_MAX_TEXTURE_UNITS_DX9) - lpCtx->glCtx->Const.MaxTextureUnits = GLD_MAX_TEXTURE_UNITS_DX9; - } else { - // Multitexture override - lpCtx->glCtx->Const.MaxTextureUnits = 1; - } - - // max texture size - MaxTextureSize = min(gld->d3dCaps9.MaxTextureHeight, gld->d3dCaps9.MaxTextureWidth); - if (MaxTextureSize == 0) - MaxTextureSize = 256; // Sanity check - - // - // HACK!! - if (MaxTextureSize > 1024) - MaxTextureSize = 1024; // HACK - CLAMP TO 1024 - // HACK!! - // - - // Got to set MAX_TEXTURE_SIZE as max levels. - // Who thought this stupid idea up? ;) - TextureLevels = 0; - // Calculate power-of-two. - while (MaxTextureSize) { - TextureLevels++; - MaxTextureSize >>= 1; - } - lpCtx->glCtx->Const.MaxTextureLevels = (TextureLevels) ? TextureLevels : 8; - - IDirect3DDevice9_SetRenderState(gld->pDev, D3DRS_LIGHTING, FALSE); - IDirect3DDevice9_SetRenderState(gld->pDev, D3DRS_CULLMODE, D3DCULL_NONE); - IDirect3DDevice9_SetRenderState(gld->pDev, D3DRS_DITHERENABLE, TRUE); - IDirect3DDevice9_SetRenderState(gld->pDev, D3DRS_SHADEMODE, D3DSHADE_GOURAUD); - - IDirect3DDevice9_SetRenderState(gld->pDev, D3DRS_ZENABLE, - (lpCtx->lpPF->dwDriverData!=D3DFMT_UNKNOWN) ? D3DZB_TRUE : D3DZB_FALSE); - - // Set the view matrix - { - D3DXMATRIX vm; -#if 1 - D3DXMatrixIdentity(&vm); -#else - D3DXVECTOR3 Eye(0.0f, 0.0f, 0.0f); - D3DXVECTOR3 At(0.0f, 0.0f, -1.0f); - D3DXVECTOR3 Up(0.0f, 1.0f, 0.0f); - D3DXMatrixLookAtRH(&vm, &Eye, &At, &Up); - vm._31 = -vm._31; - vm._32 = -vm._32; - vm._33 = -vm._33; - vm._34 = -vm._34; -#endif - IDirect3DDevice9_SetTransform(gld->pDev, D3DTS_VIEW, &vm); - } - - if (gld->bHasHWTnL) { - if (glb.dwTnL == GLDS_TNL_DEFAULT) - bSoftwareTnL = FALSE; // HW TnL - else { - bSoftwareTnL = ((glb.dwTnL == GLDS_TNL_MESA) || (glb.dwTnL == GLDS_TNL_D3DSW)) ? TRUE : FALSE; - } - } else { - // No HW TnL, so no choice possible - bSoftwareTnL = TRUE; - } -// IDirect3DDevice9_SetRenderState(gld->pDev, D3DRS_SOFTWAREVERTEXPROCESSING, bSoftwareTnL); - IDirect3DDevice9_SetSoftwareVertexProcessing(gld->pDev, bSoftwareTnL); - -// Dump this in a Release build as well, now. -//#ifdef _DEBUG - ddlogPrintf(DDLOG_INFO, "HW TnL: %s", - gld->bHasHWTnL ? (bSoftwareTnL ? "Disabled" : "Enabled") : "Unavailable"); -//#endif - - gldEnableExtensions_DX9(lpCtx->glCtx); - gldInstallPipeline_DX9(lpCtx->glCtx); - gldSetupDriverPointers_DX9(lpCtx->glCtx); - - // Signal a complete state update - lpCtx->glCtx->Driver.UpdateState(lpCtx->glCtx, _NEW_ALL); - - // Start a scene - IDirect3DDevice9_BeginScene(gld->pDev); - lpCtx->bSceneStarted = TRUE; - - return TRUE; -} - -//--------------------------------------------------------------------------- - -BOOL gldSwapBuffers_DX( - DGL_ctx *ctx, - HDC hDC, - HWND hWnd) -{ - HRESULT hr; - GLD_driver_dx9 *gld = NULL; - - if (ctx == NULL) - return FALSE; - - gld = ctx->glPriv; - if (gld == NULL) - return FALSE; - - if (ctx->bSceneStarted) { - IDirect3DDevice9_EndScene(gld->pDev); - ctx->bSceneStarted = FALSE; - } - - // Swap the buffers. hWnd may override the hWnd used for CreateDevice() - hr = IDirect3DDevice9_Present(gld->pDev, NULL, NULL, hWnd, NULL); - -exit_swap: - - IDirect3DDevice9_BeginScene(gld->pDev); - ctx->bSceneStarted = TRUE; - -// Debugging code -#ifdef _DEBUG -// ddlogMessage(GLDLOG_WARN, "SwapBuffers\n"); -#endif - - return (FAILED(hr)) ? FALSE : TRUE; -} - -//--------------------------------------------------------------------------- - -BOOL gldGetDisplayMode_DX( - DGL_ctx *ctx, - GLD_displayMode *glddm) -{ - D3DDISPLAYMODE d3ddm; - HRESULT hr; - GLD_driver_dx9 *lpCtx = NULL; - BYTE cColorBits, cRedBits, cGreenBits, cBlueBits, cAlphaBits; - - if ((glddm == NULL) || (ctx == NULL)) - return FALSE; - - lpCtx = ctx->glPriv; - if (lpCtx == NULL) - return FALSE; - - if (lpCtx->pD3D == NULL) - return FALSE; - - hr = IDirect3D9_GetAdapterDisplayMode(lpCtx->pD3D, glb.dwAdapter, &d3ddm); - if (FAILED(hr)) - return FALSE; - - // Get info from the display format - _BitsFromDisplayFormat(d3ddm.Format, - &cColorBits, &cRedBits, &cGreenBits, &cBlueBits, &cAlphaBits); - - glddm->Width = d3ddm.Width; - glddm->Height = d3ddm.Height; - glddm->BPP = cColorBits; - glddm->Refresh = d3ddm.RefreshRate; - - return TRUE; -} - -//--------------------------------------------------------------------------- - diff --git a/src/mesa/glapi/.gitignore b/src/mesa/glapi/.gitignore deleted file mode 100644 index e706bc23ca..0000000000 --- a/src/mesa/glapi/.gitignore +++ /dev/null @@ -1,11 +0,0 @@ -.cvsignore -glX_proto_common.pyo -glX_proto_common.pyc -typeexpr.pyo -typeexpr.pyc -license.pyo -license.pyc -gl_XML.pyo -gl_XML.pyc -glX_XML.pyo -glX_XML.pyc diff --git a/src/mesa/glapi/next_available_offset.sh b/src/mesa/glapi/next_available_offset.sh old mode 100755 new mode 100644 diff --git a/windows/VC6/mesa/gdi/gdi.dsp b/windows/VC6/mesa/gdi/gdi.dsp deleted file mode 100644 index ef38215216..0000000000 --- a/windows/VC6/mesa/gdi/gdi.dsp +++ /dev/null @@ -1,211 +0,0 @@ -# Microsoft Developer Studio Project File - Name="gdi" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=gdi - Win32 Debug x86 -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "gdi.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "gdi.mak" CFG="gdi - Win32 Debug x86" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "gdi - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "gdi - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "gdi - Win32 Release x86" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "gdi - Win32 Debug x86" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "gdi - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "GDI_EXPORTS" /YX /FD /c -# ADD CPP /nologo /MT /W3 /GX /O2 /I "../../main" /I "../../../../include" /I "../../../../src/mesa" /I "../../../../src/mesa/main" /I "../../../../src/mesa/glapi" /I "../../../../src/mesa/swrast" /I "../../../../src/mesa/shader" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "GDI_EXPORTS" /D "_DLL" /D "BUILD_GL32" /D "MESA_MINWARN" /FD /c -# SUBTRACT CPP /YX -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 -# ADD LINK32 mesa.lib winmm.lib msvcrt.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /nodefaultlib /out:"Release/OPENGL32.DLL" /libpath:"../mesa/Release" -# Begin Special Build Tool -SOURCE="$(InputPath)" -PostBuild_Cmds=if not exist ..\..\..\..\lib md ..\..\..\..\lib copy Release\OPENGL32.LIB ..\..\..\..\lib copy Release\OPENGL32.DLL ..\..\..\..\lib if exist ..\..\..\..\progs\demos copy Release\OPENGL32.DLL ..\..\..\..\progs\demos -# End Special Build Tool - -!ELSEIF "$(CFG)" == "gdi - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "GDI_EXPORTS" /YX /FD /GZ /c -# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /I "../../../../include" /I "../../../../src/mesa" /I "../../../../src/mesa/main" /I "../../../../src/mesa/glapi" /I "../../../../src/mesa/swrast" /I "../../../../src/mesa/shader" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "GDI_EXPORTS" /D "_DLL" /D "BUILD_GL32" /D "MESA_MINWARN" /FR /FD /GZ /c -# SUBTRACT CPP /YX /Yc /Yu -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept -# ADD LINK32 mesa.lib winmm.lib msvcrtd.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /incremental:no /debug /machine:I386 /nodefaultlib /out:"Debug/OPENGL32.DLL" /pdbtype:sept /libpath:"../mesa/Debug" -# Begin Special Build Tool -SOURCE="$(InputPath)" -PostBuild_Cmds=if not exist ..\..\..\..\lib md ..\..\..\..\lib copy Debug\OPENGL32.LIB ..\..\..\..\lib copy Debug\OPENGL32.DLL ..\..\..\..\lib if exist ..\..\..\..\progs\demos copy Debug\OPENGL32.DLL ..\..\..\..\progs\demos -# End Special Build Tool - -!ELSEIF "$(CFG)" == "gdi - Win32 Release x86" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "gdi___Win32_Release_x86" -# PROP BASE Intermediate_Dir "gdi___Win32_Release_x86" -# PROP BASE Ignore_Export_Lib 0 -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release_x86" -# PROP Intermediate_Dir "Release_x86" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "../../main" /I "../../../../include" /I "../../../../src/mesa" /I "../../../../src/mesa/main" /I "../../../../src/mesa/glapi" /I "../../../../src/mesa/swrast" /I "../../../../src/mesa/shader" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "GDI_EXPORTS" /D "_DLL" /D "BUILD_GL32" /D "MESA_MINWARN" /FD /c -# SUBTRACT BASE CPP /YX -# ADD CPP /nologo /MT /W3 /GX /O2 /I "../../main" /I "../../../../include" /I "../../../../src/mesa" /I "../../../../src/mesa/main" /I "../../../../src/mesa/glapi" /I "../../../../src/mesa/swrast" /I "../../../../src/mesa/shader" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "GDI_EXPORTS" /D "_DLL" /D "BUILD_GL32" /D "MESA_MINWARN" /FD /c -# SUBTRACT CPP /YX -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 mesa.lib winmm.lib msvcrt.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /nodefaultlib /out:"Release/OPENGL32.DLL" /libpath:"../mesa/Release" -# ADD LINK32 mesa.lib winmm.lib msvcrt.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /nodefaultlib /out:"Release_x86/OPENGL32.DLL" /libpath:"../mesa/Release_x86" -# Begin Special Build Tool -SOURCE="$(InputPath)" -PostBuild_Cmds=if not exist ..\..\..\..\lib md ..\..\..\..\lib copy Release_x86\OPENGL32.LIB ..\..\..\..\lib copy Release_x86\OPENGL32.DLL ..\..\..\..\lib if exist ..\..\..\..\progs\demos copy Release_x86\OPENGL32.DLL ..\..\..\..\progs\demos copy Release_x86\OPENGL32.DLL "C:\Documents and Settings\mjk\Pulpit\pen\noise-demo" -# End Special Build Tool - -!ELSEIF "$(CFG)" == "gdi - Win32 Debug x86" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "gdi___Win32_Debug_x86" -# PROP BASE Intermediate_Dir "gdi___Win32_Debug_x86" -# PROP BASE Ignore_Export_Lib 0 -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug_x86" -# PROP Intermediate_Dir "Debug_x86" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /I "../../../../include" /I "../../../../src/mesa" /I "../../../../src/mesa/main" /I "../../../../src/mesa/glapi" /I "../../../../src/mesa/swrast" /I "../../../../src/mesa/shader" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "GDI_EXPORTS" /D "_DLL" /D "BUILD_GL32" /D "MESA_MINWARN" /FR /FD /GZ /c -# SUBTRACT BASE CPP /YX /Yc /Yu -# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /I "../../../../include" /I "../../../../src/mesa" /I "../../../../src/mesa/main" /I "../../../../src/mesa/glapi" /I "../../../../src/mesa/swrast" /I "../../../../src/mesa/shader" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "GDI_EXPORTS" /D "_DLL" /D "BUILD_GL32" /D "MESA_MINWARN" /FR /FD /GZ /c -# SUBTRACT CPP /YX /Yc /Yu -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 mesa.lib winmm.lib msvcrtd.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /incremental:no /debug /machine:I386 /nodefaultlib /out:"Debug/OPENGL32.DLL" /pdbtype:sept /libpath:"../mesa/Debug" -# ADD LINK32 mesa.lib winmm.lib msvcrtd.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /incremental:no /debug /machine:I386 /nodefaultlib /out:"Debug_x86/OPENGL32.DLL" /pdbtype:sept /libpath:"../mesa/Debug_x86" -# Begin Special Build Tool -SOURCE="$(InputPath)" -PostBuild_Cmds=if not exist ..\..\..\..\lib md ..\..\..\..\lib copy Debug_x86\OPENGL32.LIB ..\..\..\..\lib copy Debug_x86\OPENGL32.DLL ..\..\..\..\lib if exist ..\..\..\..\progs\demos copy Debug_x86\OPENGL32.DLL ..\..\..\..\progs\demos copy Debug_x86\OPENGL32.DLL "C:\Documents and Settings\mjk\Pulpit\pen\noise-demo" -# End Special Build Tool - -!ENDIF - -# Begin Target - -# Name "gdi - Win32 Release" -# Name "gdi - Win32 Debug" -# Name "gdi - Win32 Release x86" -# Name "gdi - Win32 Debug x86" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\drivers\common\driverfuncs.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\drivers\windows\gdi\mesa.def -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\drivers\windows\gdi\wgl.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\drivers\windows\gdi\wmesa.c -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\drivers\windows\gdi\colors.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\drivers\common\driverfuncs.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\drivers\windows\gdi\wmesadef.h -# End Source File -# End Group -# Begin Group "Resource Files" - -# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" -# End Group -# End Target -# End Project diff --git a/windows/VC6/mesa/glu/compileDebug.txt b/windows/VC6/mesa/glu/compileDebug.txt deleted file mode 100644 index d149302245..0000000000 --- a/windows/VC6/mesa/glu/compileDebug.txt +++ /dev/null @@ -1,82 +0,0 @@ -/nologo /W2 /GX- /Zi /Od /c /TP -/I "../../../../include" -/I "../../../../src/glu/sgi/include" -/I "../../../../src/glu/sgi/libnurbs/interface" -/I "../../../../src/glu/sgi/libnurbs/internals" -/I "../../../../src/glu/sgi/libnurbs/nurbtess" -/D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" -/D "_USRDLL" /D "GLU_EXPORTS" /D "BUILD_GL32" /D "LIBRARYBUILD" -/Fo"Debug/" /Fd"Debug/" /GZ -../../../../src/glu/sgi/libnurbs/interface/bezierEval.cc -../../../../src/glu/sgi/libnurbs/interface/bezierPatch.cc -../../../../src/glu/sgi/libnurbs/interface/bezierPatchMesh.cc -../../../../src/glu/sgi/libnurbs/interface/glcurveval.cc -../../../../src/glu/sgi/libnurbs/interface/glinterface.cc -../../../../src/glu/sgi/libnurbs/interface/glrenderer.cc -../../../../src/glu/sgi/libnurbs/interface/glsurfeval.cc -../../../../src/glu/sgi/libnurbs/interface/incurveeval.cc -../../../../src/glu/sgi/libnurbs/interface/insurfeval.cc -../../../../src/glu/sgi/libnurbs/internals/arc.cc -../../../../src/glu/sgi/libnurbs/internals/arcsorter.cc -../../../../src/glu/sgi/libnurbs/internals/arctess.cc -../../../../src/glu/sgi/libnurbs/internals/backend.cc -../../../../src/glu/sgi/libnurbs/internals/basiccrveval.cc -../../../../src/glu/sgi/libnurbs/internals/basicsurfeval.cc -../../../../src/glu/sgi/libnurbs/internals/bin.cc -../../../../src/glu/sgi/libnurbs/internals/bufpool.cc -../../../../src/glu/sgi/libnurbs/internals/cachingeval.cc -../../../../src/glu/sgi/libnurbs/internals/ccw.cc -../../../../src/glu/sgi/libnurbs/internals/coveandtiler.cc -../../../../src/glu/sgi/libnurbs/internals/curve.cc -../../../../src/glu/sgi/libnurbs/internals/curvelist.cc -../../../../src/glu/sgi/libnurbs/internals/curvesub.cc -../../../../src/glu/sgi/libnurbs/internals/dataTransform.cc -../../../../src/glu/sgi/libnurbs/internals/displaylist.cc -../../../../src/glu/sgi/libnurbs/internals/flist.cc -../../../../src/glu/sgi/libnurbs/internals/flistsorter.cc -../../../../src/glu/sgi/libnurbs/internals/hull.cc -../../../../src/glu/sgi/libnurbs/internals/intersect.cc -../../../../src/glu/sgi/libnurbs/internals/knotvector.cc -../../../../src/glu/sgi/libnurbs/internals/mapdesc.cc -../../../../src/glu/sgi/libnurbs/internals/mapdescv.cc -../../../../src/glu/sgi/libnurbs/internals/maplist.cc -../../../../src/glu/sgi/libnurbs/internals/mesher.cc -../../../../src/glu/sgi/libnurbs/internals/monoTriangulationBackend.cc -../../../../src/glu/sgi/libnurbs/internals/monotonizer.cc -../../../../src/glu/sgi/libnurbs/internals/mycode.cc -../../../../src/glu/sgi/libnurbs/internals/nurbsinterfac.cc -../../../../src/glu/sgi/libnurbs/internals/nurbstess.cc -../../../../src/glu/sgi/libnurbs/internals/patch.cc -../../../../src/glu/sgi/libnurbs/internals/patchlist.cc -../../../../src/glu/sgi/libnurbs/internals/quilt.cc -../../../../src/glu/sgi/libnurbs/internals/reader.cc -../../../../src/glu/sgi/libnurbs/internals/renderhints.cc -../../../../src/glu/sgi/libnurbs/internals/slicer.cc -../../../../src/glu/sgi/libnurbs/internals/sorter.cc -../../../../src/glu/sgi/libnurbs/internals/splitarcs.cc -../../../../src/glu/sgi/libnurbs/internals/subdivider.cc -../../../../src/glu/sgi/libnurbs/internals/tobezier.cc -../../../../src/glu/sgi/libnurbs/internals/trimline.cc -../../../../src/glu/sgi/libnurbs/internals/trimregion.cc -../../../../src/glu/sgi/libnurbs/internals/trimvertpool.cc -../../../../src/glu/sgi/libnurbs/internals/uarray.cc -../../../../src/glu/sgi/libnurbs/internals/varray.cc -../../../../src/glu/sgi/libnurbs/nurbtess/directedLine.cc -../../../../src/glu/sgi/libnurbs/nurbtess/gridWrap.cc -../../../../src/glu/sgi/libnurbs/nurbtess/monoChain.cc -../../../../src/glu/sgi/libnurbs/nurbtess/monoPolyPart.cc -../../../../src/glu/sgi/libnurbs/nurbtess/monoTriangulation.cc -../../../../src/glu/sgi/libnurbs/nurbtess/partitionX.cc -../../../../src/glu/sgi/libnurbs/nurbtess/partitionY.cc -../../../../src/glu/sgi/libnurbs/nurbtess/polyDBG.cc -../../../../src/glu/sgi/libnurbs/nurbtess/polyUtil.cc -../../../../src/glu/sgi/libnurbs/nurbtess/primitiveStream.cc -../../../../src/glu/sgi/libnurbs/nurbtess/quicksort.cc -../../../../src/glu/sgi/libnurbs/nurbtess/rectBlock.cc -../../../../src/glu/sgi/libnurbs/nurbtess/sampleComp.cc -../../../../src/glu/sgi/libnurbs/nurbtess/sampleCompBot.cc -../../../../src/glu/sgi/libnurbs/nurbtess/sampleCompRight.cc -../../../../src/glu/sgi/libnurbs/nurbtess/sampleCompTop.cc -../../../../src/glu/sgi/libnurbs/nurbtess/sampleMonoPoly.cc -../../../../src/glu/sgi/libnurbs/nurbtess/sampledLine.cc -../../../../src/glu/sgi/libnurbs/nurbtess/searchTree.cc diff --git a/windows/VC6/mesa/glu/compileRelease.txt b/windows/VC6/mesa/glu/compileRelease.txt deleted file mode 100644 index 7f41952bd5..0000000000 --- a/windows/VC6/mesa/glu/compileRelease.txt +++ /dev/null @@ -1,82 +0,0 @@ -/nologo /W2 /GX- /O2 /c /TP -/I "../../../../include" -/I "../../../../src/glu/sgi/include" -/I "../../../../src/glu/sgi/libnurbs/interface" -/I "../../../../src/glu/sgi/libnurbs/internals" -/I "../../../../src/glu/sgi/libnurbs/nurbtess" -/D "WIN32" /D "_WINDOWS" /D "_MBCS" -/D "_USRDLL" /D "GLU_EXPORTS" /D "BUILD_GL32" /D "LIBRARYBUILD" -/Fo"Release/" -../../../../src/glu/sgi/libnurbs/interface/bezierEval.cc -../../../../src/glu/sgi/libnurbs/interface/bezierPatch.cc -../../../../src/glu/sgi/libnurbs/interface/bezierPatchMesh.cc -../../../../src/glu/sgi/libnurbs/interface/glcurveval.cc -../../../../src/glu/sgi/libnurbs/interface/glinterface.cc -../../../../src/glu/sgi/libnurbs/interface/glrenderer.cc -../../../../src/glu/sgi/libnurbs/interface/glsurfeval.cc -../../../../src/glu/sgi/libnurbs/interface/incurveeval.cc -../../../../src/glu/sgi/libnurbs/interface/insurfeval.cc -../../../../src/glu/sgi/libnurbs/internals/arc.cc -../../../../src/glu/sgi/libnurbs/internals/arcsorter.cc -../../../../src/glu/sgi/libnurbs/internals/arctess.cc -../../../../src/glu/sgi/libnurbs/internals/backend.cc -../../../../src/glu/sgi/libnurbs/internals/basiccrveval.cc -../../../../src/glu/sgi/libnurbs/internals/basicsurfeval.cc -../../../../src/glu/sgi/libnurbs/internals/bin.cc -../../../../src/glu/sgi/libnurbs/internals/bufpool.cc -../../../../src/glu/sgi/libnurbs/internals/cachingeval.cc -../../../../src/glu/sgi/libnurbs/internals/ccw.cc -../../../../src/glu/sgi/libnurbs/internals/coveandtiler.cc -../../../../src/glu/sgi/libnurbs/internals/curve.cc -../../../../src/glu/sgi/libnurbs/internals/curvelist.cc -../../../../src/glu/sgi/libnurbs/internals/curvesub.cc -../../../../src/glu/sgi/libnurbs/internals/dataTransform.cc -../../../../src/glu/sgi/libnurbs/internals/displaylist.cc -../../../../src/glu/sgi/libnurbs/internals/flist.cc -../../../../src/glu/sgi/libnurbs/internals/flistsorter.cc -../../../../src/glu/sgi/libnurbs/internals/hull.cc -../../../../src/glu/sgi/libnurbs/internals/intersect.cc -../../../../src/glu/sgi/libnurbs/internals/knotvector.cc -../../../../src/glu/sgi/libnurbs/internals/mapdesc.cc -../../../../src/glu/sgi/libnurbs/internals/mapdescv.cc -../../../../src/glu/sgi/libnurbs/internals/maplist.cc -../../../../src/glu/sgi/libnurbs/internals/mesher.cc -../../../../src/glu/sgi/libnurbs/internals/monoTriangulationBackend.cc -../../../../src/glu/sgi/libnurbs/internals/monotonizer.cc -../../../../src/glu/sgi/libnurbs/internals/mycode.cc -../../../../src/glu/sgi/libnurbs/internals/nurbsinterfac.cc -../../../../src/glu/sgi/libnurbs/internals/nurbstess.cc -../../../../src/glu/sgi/libnurbs/internals/patch.cc -../../../../src/glu/sgi/libnurbs/internals/patchlist.cc -../../../../src/glu/sgi/libnurbs/internals/quilt.cc -../../../../src/glu/sgi/libnurbs/internals/reader.cc -../../../../src/glu/sgi/libnurbs/internals/renderhints.cc -../../../../src/glu/sgi/libnurbs/internals/slicer.cc -../../../../src/glu/sgi/libnurbs/internals/sorter.cc -../../../../src/glu/sgi/libnurbs/internals/splitarcs.cc -../../../../src/glu/sgi/libnurbs/internals/subdivider.cc -../../../../src/glu/sgi/libnurbs/internals/tobezier.cc -../../../../src/glu/sgi/libnurbs/internals/trimline.cc -../../../../src/glu/sgi/libnurbs/internals/trimregion.cc -../../../../src/glu/sgi/libnurbs/internals/trimvertpool.cc -../../../../src/glu/sgi/libnurbs/internals/uarray.cc -../../../../src/glu/sgi/libnurbs/internals/varray.cc -../../../../src/glu/sgi/libnurbs/nurbtess/directedLine.cc -../../../../src/glu/sgi/libnurbs/nurbtess/gridWrap.cc -../../../../src/glu/sgi/libnurbs/nurbtess/monoChain.cc -../../../../src/glu/sgi/libnurbs/nurbtess/monoPolyPart.cc -../../../../src/glu/sgi/libnurbs/nurbtess/monoTriangulation.cc -../../../../src/glu/sgi/libnurbs/nurbtess/partitionX.cc -../../../../src/glu/sgi/libnurbs/nurbtess/partitionY.cc -../../../../src/glu/sgi/libnurbs/nurbtess/polyDBG.cc -../../../../src/glu/sgi/libnurbs/nurbtess/polyUtil.cc -../../../../src/glu/sgi/libnurbs/nurbtess/primitiveStream.cc -../../../../src/glu/sgi/libnurbs/nurbtess/quicksort.cc -../../../../src/glu/sgi/libnurbs/nurbtess/rectBlock.cc -../../../../src/glu/sgi/libnurbs/nurbtess/sampleComp.cc -../../../../src/glu/sgi/libnurbs/nurbtess/sampleCompBot.cc -../../../../src/glu/sgi/libnurbs/nurbtess/sampleCompRight.cc -../../../../src/glu/sgi/libnurbs/nurbtess/sampleCompTop.cc -../../../../src/glu/sgi/libnurbs/nurbtess/sampleMonoPoly.cc -../../../../src/glu/sgi/libnurbs/nurbtess/sampledLine.cc -../../../../src/glu/sgi/libnurbs/nurbtess/searchTree.cc diff --git a/windows/VC6/mesa/glu/glu.dsp b/windows/VC6/mesa/glu/glu.dsp deleted file mode 100644 index 5f05a81dcc..0000000000 --- a/windows/VC6/mesa/glu/glu.dsp +++ /dev/null @@ -1,2579 +0,0 @@ -# Microsoft Developer Studio Project File - Name="glu" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=glu - Win32 Debug x86 -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "glu.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "glu.mak" CFG="glu - Win32 Debug x86" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "glu - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "glu - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "glu - Win32 Release x86" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "glu - Win32 Debug x86" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "glu - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "GLU_EXPORTS" /YX /FD /c -# ADD CPP /nologo /MT /W3 /GX /O2 /I "../../../../include" /I "../../../../src/glu/sgi/include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "GLU_EXPORTS" /D "BUILD_GL32" /FD /c -# SUBTRACT CPP /YX -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 -# ADD LINK32 msvcrt.lib winmm.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib opengl32.lib Release/glucc.lib /nologo /dll /machine:I386 /nodefaultlib /out:"Release/GLU32.DLL" /libpath:"../gdi/Release" -# Begin Special Build Tool -SOURCE="$(InputPath)" -PreLink_Desc=C++ Compilations -PreLink_Cmds=cl @compileRelease.txt LIB /OUT:Release/GLUCC.LIB @objectsRelease.txt -PostBuild_Cmds=if not exist ..\..\..\..\lib md ..\..\..\..\lib copy Release\GLU32.LIB ..\..\..\..\lib copy Release\GLU32.DLL ..\..\..\..\lib if exist ..\..\..\..\progs\demos copy Release\GLU32.DLL ..\..\..\..\progs\demos -# End Special Build Tool - -!ELSEIF "$(CFG)" == "glu - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "GLU_EXPORTS" /YX /FD /GZ /c -# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /I "../../../../include" /I "../../../../src/glu/sgi/include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "GLU_EXPORTS" /D "BUILD_GL32" /FD /GZ /c -# SUBTRACT CPP /YX -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept -# ADD LINK32 msvcrtd.lib winmm.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib opengl32.lib Debug/glucc.lib /nologo /dll /incremental:no /debug /machine:I386 /nodefaultlib /out:"Debug/GLU32.DLL" /pdbtype:sept /libpath:"../gdi/Debug" -# Begin Special Build Tool -SOURCE="$(InputPath)" -PreLink_Desc=C++ Compilations -PreLink_Cmds=cl @compileDebug.txt LIB /OUT:Debug/GLUCC.LIB @objectsDebug.txt -PostBuild_Cmds=if not exist ..\..\..\..\lib md ..\..\..\..\lib copy Debug\GLU32.LIB ..\..\..\..\lib copy Debug\GLU32.DLL ..\..\..\..\lib if exist ..\..\..\..\progs\demos copy Debug\GLU32.DLL ..\..\..\..\progs\demos -# End Special Build Tool - -!ELSEIF "$(CFG)" == "glu - Win32 Release x86" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "glu___Win32_Release_x86" -# PROP BASE Intermediate_Dir "glu___Win32_Release_x86" -# PROP BASE Ignore_Export_Lib 0 -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release_x86" -# PROP Intermediate_Dir "Release_x86" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "../../../../include" /I "../../../../src/glu/sgi/include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "GLU_EXPORTS" /D "BUILD_GL32" /FD /c -# SUBTRACT BASE CPP /YX -# ADD CPP /nologo /MT /W3 /GX /O2 /I "../../../../include" /I "../../../../src/glu/sgi/include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "GLU_EXPORTS" /D "BUILD_GL32" /FD /c -# SUBTRACT CPP /YX -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 msvcrt.lib winmm.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib opengl32.lib Release/glucc.lib /nologo /dll /machine:I386 /nodefaultlib /out:"Release/GLU32.DLL" /libpath:"../gdi/Release" -# ADD LINK32 msvcrt.lib winmm.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib opengl32.lib Release/glucc.lib /nologo /dll /machine:I386 /nodefaultlib /out:"Release_x86/GLU32.DLL" /libpath:"../gdi/Release_x86" -# Begin Special Build Tool -SOURCE="$(InputPath)" -PreLink_Desc=C++ Compilations -PreLink_Cmds=cl @compileRelease.txt LIB /OUT:Release/GLUCC.LIB @objectsRelease.txt -PostBuild_Cmds=if not exist ..\..\..\..\lib md ..\..\..\..\lib copy Release_x86\GLU32.LIB ..\..\..\..\lib copy Release_x86\GLU32.DLL ..\..\..\..\lib if exist ..\..\..\..\progs\demos copy Release_x86\GLU32.DLL ..\..\..\..\progs\demos -# End Special Build Tool - -!ELSEIF "$(CFG)" == "glu - Win32 Debug x86" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "glu___Win32_Debug_x86" -# PROP BASE Intermediate_Dir "glu___Win32_Debug_x86" -# PROP BASE Ignore_Export_Lib 0 -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug_x86" -# PROP Intermediate_Dir "Debug_x86" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /I "../../../../include" /I "../../../../src/glu/sgi/include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "GLU_EXPORTS" /D "BUILD_GL32" /FD /GZ /c -# SUBTRACT BASE CPP /YX -# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /I "../../../../include" /I "../../../../src/glu/sgi/include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "GLU_EXPORTS" /D "BUILD_GL32" /FD /GZ /c -# SUBTRACT CPP /YX -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 msvcrtd.lib winmm.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib opengl32.lib Debug/glucc.lib /nologo /dll /incremental:no /debug /machine:I386 /nodefaultlib /out:"Debug/GLU32.DLL" /pdbtype:sept /libpath:"../gdi/Debug" -# ADD LINK32 msvcrtd.lib winmm.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib opengl32.lib Debug/glucc.lib /nologo /dll /incremental:no /debug /machine:I386 /nodefaultlib /out:"Debug_x86/GLU32.DLL" /pdbtype:sept /libpath:"../gdi/Debug_x86" -# Begin Special Build Tool -SOURCE="$(InputPath)" -PreLink_Desc=C++ Compilations -PreLink_Cmds=cl @compileDebug.txt LIB /OUT:Debug/GLUCC.LIB @objectsDebug.txt -PostBuild_Cmds=if not exist ..\..\..\..\lib md ..\..\..\..\lib copy Debug_x86\GLU32.LIB ..\..\..\..\lib copy Debug_x86\GLU32.DLL ..\..\..\..\lib if exist ..\..\..\..\progs\demos copy Debug_x86\GLU32.DLL ..\..\..\..\progs\demos -# End Special Build Tool - -!ENDIF - -# Begin Target - -# Name "glu - Win32 Release" -# Name "glu - Win32 Debug" -# Name "glu - Win32 Release x86" -# Name "glu - Win32 Debug x86" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libtess\dict.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libutil\error.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libtess\geom.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\glu.def -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libutil\glue.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libtess\memalloc.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libtess\mesh.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libutil\mipmap.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libtess\normal.c -# End Source File -# Begin Source File - -SOURCE="..\..\..\..\src\glu\sgi\libtess\priorityq-heap.c" - -!IF "$(CFG)" == "glu - Win32 Release" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Release x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libtess\priorityq.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libutil\project.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libutil\quad.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libutil\registry.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libtess\render.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libtess\sweep.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libtess\tess.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libtess\tessmono.c -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\arc.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\arcsorter.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\arctess.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\backend.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\basiccrveval.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\basicsurfeval.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\bezierarc.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\interface\bezierEval.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\interface\bezierPatch.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\interface\bezierPatchMesh.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\bin.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\bufpool.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\cachingeval.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\coveandtiler.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\curve.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\curvelist.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\dataTransform.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\defines.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\nurbtess\definitions.h -# End Source File -# Begin Source File - -SOURCE="..\..\..\..\src\glu\sgi\libtess\dict-list.h" -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libtess\dict.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\nurbtess\directedLine.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\displaylist.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\displaymode.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\flist.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\flistsorter.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libtess\geom.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\interface\glcurveval.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\interface\glimports.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\nurbtess\glimports.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\interface\glrenderer.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\interface\glsurfeval.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libutil\gluint.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\include\gluos.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\gridline.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\gridtrimvertex.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\gridvertex.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\nurbtess\gridWrap.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\hull.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\jarcloc.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\knotvector.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\mapdesc.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\maplist.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libtess\memalloc.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libtess\mesh.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\mesher.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\nurbtess\monoChain.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\nurbtess\monoPolyPart.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\monotonizer.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\nurbtess\monoTriangulation.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\myassert.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\mymath.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\mysetjmp.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\interface\mystdio.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\nurbtess\mystdio.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\interface\mystdlib.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\nurbtess\mystdlib.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\mystring.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libtess\normal.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\nurbsconsts.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\nurbstess.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\nurbtess\partitionX.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\nurbtess\partitionY.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\patch.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\patchlist.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\nurbtess\polyDBG.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\nurbtess\polyUtil.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\nurbtess\primitiveStream.h -# End Source File -# Begin Source File - -SOURCE="..\..\..\..\src\glu\sgi\libtess\priorityq-heap.h" -# End Source File -# Begin Source File - -SOURCE="..\..\..\..\src\glu\sgi\libtess\priorityq-sort.h" -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libtess\priorityq.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\pwlarc.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\nurbtess\quicksort.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\quilt.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\reader.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\nurbtess\rectBlock.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libtess\render.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\renderhints.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\nurbtess\sampleComp.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\nurbtess\sampleCompBot.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\nurbtess\sampleCompRight.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\nurbtess\sampleCompTop.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\nurbtess\sampledLine.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\nurbtess\sampleMonoPoly.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\nurbtess\searchTree.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\simplemath.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\slicer.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\sorter.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\subdivider.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libtess\sweep.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libtess\tess.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libtess\tessmono.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\trimline.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\trimregion.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\trimvertex.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\trimvertpool.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\types.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\uarray.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\varray.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\nurbtess\zlassert.h -# End Source File -# End Group -# Begin Group "Resource Files" - -# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" -# End Group -# Begin Group "C++ files" - -# PROP Default_Filter ".cc" -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\arc.cc - -!IF "$(CFG)" == "glu - Win32 Release" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Release x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\arcsorter.cc - -!IF "$(CFG)" == "glu - Win32 Release" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Release x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\arctess.cc - -!IF "$(CFG)" == "glu - Win32 Release" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Release x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\backend.cc - -!IF "$(CFG)" == "glu - Win32 Release" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Release x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\basiccrveval.cc - -!IF "$(CFG)" == "glu - Win32 Release" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Release x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\basicsurfeval.cc - -!IF "$(CFG)" == "glu - Win32 Release" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Release x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\interface\bezierEval.cc - -!IF "$(CFG)" == "glu - Win32 Release" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Release x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\interface\bezierPatch.cc - -!IF "$(CFG)" == "glu - Win32 Release" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Release x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\interface\bezierPatchMesh.cc - -!IF "$(CFG)" == "glu - Win32 Release" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Release x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\bin.cc - -!IF "$(CFG)" == "glu - Win32 Release" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Release x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\bufpool.cc - -!IF "$(CFG)" == "glu - Win32 Release" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Release x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\cachingeval.cc - -!IF "$(CFG)" == "glu - Win32 Release" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Release x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\ccw.cc - -!IF "$(CFG)" == "glu - Win32 Release" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Release x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\coveandtiler.cc - -!IF "$(CFG)" == "glu - Win32 Release" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Release x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\curve.cc - -!IF "$(CFG)" == "glu - Win32 Release" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Release x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\curvelist.cc - -!IF "$(CFG)" == "glu - Win32 Release" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Release x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\curvesub.cc - -!IF "$(CFG)" == "glu - Win32 Release" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Release x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\dataTransform.cc - -!IF "$(CFG)" == "glu - Win32 Release" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Release x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\nurbtess\directedLine.cc - -!IF "$(CFG)" == "glu - Win32 Release" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Release x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\displaylist.cc - -!IF "$(CFG)" == "glu - Win32 Release" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Release x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\flist.cc - -!IF "$(CFG)" == "glu - Win32 Release" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Release x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\flistsorter.cc - -!IF "$(CFG)" == "glu - Win32 Release" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Release x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\interface\glcurveval.cc - -!IF "$(CFG)" == "glu - Win32 Release" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Release x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\interface\glinterface.cc - -!IF "$(CFG)" == "glu - Win32 Release" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Release x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\interface\glrenderer.cc - -!IF "$(CFG)" == "glu - Win32 Release" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Release x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\interface\glsurfeval.cc - -!IF "$(CFG)" == "glu - Win32 Release" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Release x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\nurbtess\gridWrap.cc - -!IF "$(CFG)" == "glu - Win32 Release" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Release x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\hull.cc - -!IF "$(CFG)" == "glu - Win32 Release" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Release x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\interface\incurveeval.cc - -!IF "$(CFG)" == "glu - Win32 Release" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Release x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\interface\insurfeval.cc - -!IF "$(CFG)" == "glu - Win32 Release" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Release x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\intersect.cc - -!IF "$(CFG)" == "glu - Win32 Release" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Release x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\knotvector.cc - -!IF "$(CFG)" == "glu - Win32 Release" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Release x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\mapdesc.cc - -!IF "$(CFG)" == "glu - Win32 Release" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Release x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\mapdescv.cc - -!IF "$(CFG)" == "glu - Win32 Release" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Release x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\maplist.cc - -!IF "$(CFG)" == "glu - Win32 Release" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Release x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\mesher.cc - -!IF "$(CFG)" == "glu - Win32 Release" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Release x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\nurbtess\monoChain.cc - -!IF "$(CFG)" == "glu - Win32 Release" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Release x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\nurbtess\monoPolyPart.cc - -!IF "$(CFG)" == "glu - Win32 Release" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Release x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\monotonizer.cc - -!IF "$(CFG)" == "glu - Win32 Release" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Release x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\nurbtess\monoTriangulation.cc - -!IF "$(CFG)" == "glu - Win32 Release" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Release x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\monoTriangulationBackend.cc - -!IF "$(CFG)" == "glu - Win32 Release" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Release x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\mycode.cc - -!IF "$(CFG)" == "glu - Win32 Release" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Release x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\nurbsinterfac.cc - -!IF "$(CFG)" == "glu - Win32 Release" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Release x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\nurbstess.cc - -!IF "$(CFG)" == "glu - Win32 Release" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Release x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\nurbtess\partitionX.cc - -!IF "$(CFG)" == "glu - Win32 Release" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Release x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\nurbtess\partitionY.cc - -!IF "$(CFG)" == "glu - Win32 Release" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Release x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\patch.cc - -!IF "$(CFG)" == "glu - Win32 Release" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Release x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\patchlist.cc - -!IF "$(CFG)" == "glu - Win32 Release" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Release x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\nurbtess\polyDBG.cc - -!IF "$(CFG)" == "glu - Win32 Release" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Release x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\nurbtess\polyUtil.cc - -!IF "$(CFG)" == "glu - Win32 Release" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Release x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\nurbtess\primitiveStream.cc - -!IF "$(CFG)" == "glu - Win32 Release" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Release x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\nurbtess\quicksort.cc - -!IF "$(CFG)" == "glu - Win32 Release" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Release x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\quilt.cc - -!IF "$(CFG)" == "glu - Win32 Release" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Release x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\reader.cc - -!IF "$(CFG)" == "glu - Win32 Release" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Release x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libtess\README - -!IF "$(CFG)" == "glu - Win32 Release" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Release x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\nurbtess\rectBlock.cc - -!IF "$(CFG)" == "glu - Win32 Release" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Release x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\renderhints.cc - -!IF "$(CFG)" == "glu - Win32 Release" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Release x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\nurbtess\sampleComp.cc - -!IF "$(CFG)" == "glu - Win32 Release" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Release x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\nurbtess\sampleCompBot.cc - -!IF "$(CFG)" == "glu - Win32 Release" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Release x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\nurbtess\sampleCompRight.cc - -!IF "$(CFG)" == "glu - Win32 Release" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Release x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\nurbtess\sampleCompTop.cc - -!IF "$(CFG)" == "glu - Win32 Release" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Release x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\nurbtess\sampledLine.cc - -!IF "$(CFG)" == "glu - Win32 Release" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Release x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\nurbtess\sampleMonoPoly.cc - -!IF "$(CFG)" == "glu - Win32 Release" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Release x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\nurbtess\searchTree.cc - -!IF "$(CFG)" == "glu - Win32 Release" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Release x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\slicer.cc - -!IF "$(CFG)" == "glu - Win32 Release" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Release x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\sorter.cc - -!IF "$(CFG)" == "glu - Win32 Release" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Release x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\splitarcs.cc - -!IF "$(CFG)" == "glu - Win32 Release" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Release x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\subdivider.cc - -!IF "$(CFG)" == "glu - Win32 Release" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Release x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\tobezier.cc - -!IF "$(CFG)" == "glu - Win32 Release" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Release x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\trimline.cc - -!IF "$(CFG)" == "glu - Win32 Release" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Release x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\trimregion.cc - -!IF "$(CFG)" == "glu - Win32 Release" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Release x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\trimvertpool.cc - -!IF "$(CFG)" == "glu - Win32 Release" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Release x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\uarray.cc - -!IF "$(CFG)" == "glu - Win32 Release" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Release x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\varray.cc - -!IF "$(CFG)" == "glu - Win32 Release" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Release x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ENDIF - -# End Source File -# End Group -# Begin Source File - -SOURCE="..\..\..\..\src\glu\sgi\libtess\alg-outline" - -!IF "$(CFG)" == "glu - Win32 Release" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Release x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=.\compileDebug.txt -# End Source File -# Begin Source File - -SOURCE=.\compileRelease.txt -# End Source File -# Begin Source File - -SOURCE=.\objectsDebug.txt -# End Source File -# Begin Source File - -SOURCE=.\objectsRelease.txt -# End Source File -# End Target -# End Project diff --git a/windows/VC6/mesa/glu/objectsDebug.txt b/windows/VC6/mesa/glu/objectsDebug.txt deleted file mode 100644 index 9fdce157c4..0000000000 --- a/windows/VC6/mesa/glu/objectsDebug.txt +++ /dev/null @@ -1,73 +0,0 @@ -Debug/bezierEval.obj -Debug/bezierPatch.obj -Debug/bezierPatchMesh.obj -Debug/glcurveval.obj -Debug/glinterface.obj -Debug/glrenderer.obj -Debug/glsurfeval.obj -Debug/incurveeval.obj -Debug/insurfeval.obj -Debug/arc.obj -Debug/arcsorter.obj -Debug/arctess.obj -Debug/backend.obj -Debug/basiccrveval.obj -Debug/basicsurfeval.obj -Debug/bin.obj -Debug/bufpool.obj -Debug/cachingeval.obj -Debug/ccw.obj -Debug/coveandtiler.obj -Debug/curve.obj -Debug/curvelist.obj -Debug/curvesub.obj -Debug/dataTransform.obj -Debug/displaylist.obj -Debug/flist.obj -Debug/flistsorter.obj -Debug/hull.obj -Debug/intersect.obj -Debug/knotvector.obj -Debug/mapdesc.obj -Debug/mapdescv.obj -Debug/maplist.obj -Debug/mesher.obj -Debug/monoTriangulationBackend.obj -Debug/monotonizer.obj -Debug/mycode.obj -Debug/nurbsinterfac.obj -Debug/nurbstess.obj -Debug/patch.obj -Debug/patchlist.obj -Debug/quilt.obj -Debug/reader.obj -Debug/renderhints.obj -Debug/slicer.obj -Debug/sorter.obj -Debug/splitarcs.obj -Debug/subdivider.obj -Debug/tobezier.obj -Debug/trimline.obj -Debug/trimregion.obj -Debug/trimvertpool.obj -Debug/uarray.obj -Debug/varray.obj -Debug/directedLine.obj -Debug/gridWrap.obj -Debug/monoChain.obj -Debug/monoPolyPart.obj -Debug/monoTriangulation.obj -Debug/partitionX.obj -Debug/partitionY.obj -Debug/polyDBG.obj -Debug/polyUtil.obj -Debug/primitiveStream.obj -Debug/quicksort.obj -Debug/rectBlock.obj -Debug/sampleComp.obj -Debug/sampleCompBot.obj -Debug/sampleCompRight.obj -Debug/sampleCompTop.obj -Debug/sampleMonoPoly.obj -Debug/sampledLine.obj -Debug/searchTree.obj diff --git a/windows/VC6/mesa/glu/objectsRelease.txt b/windows/VC6/mesa/glu/objectsRelease.txt deleted file mode 100644 index 2d1b384db8..0000000000 --- a/windows/VC6/mesa/glu/objectsRelease.txt +++ /dev/null @@ -1,73 +0,0 @@ -Release/bezierEval.obj -Release/bezierPatch.obj -Release/bezierPatchMesh.obj -Release/glcurveval.obj -Release/glinterface.obj -Release/glrenderer.obj -Release/glsurfeval.obj -Release/incurveeval.obj -Release/insurfeval.obj -Release/arc.obj -Release/arcsorter.obj -Release/arctess.obj -Release/backend.obj -Release/basiccrveval.obj -Release/basicsurfeval.obj -Release/bin.obj -Release/bufpool.obj -Release/cachingeval.obj -Release/ccw.obj -Release/coveandtiler.obj -Release/curve.obj -Release/curvelist.obj -Release/curvesub.obj -Release/dataTransform.obj -Release/displaylist.obj -Release/flist.obj -Release/flistsorter.obj -Release/hull.obj -Release/intersect.obj -Release/knotvector.obj -Release/mapdesc.obj -Release/mapdescv.obj -Release/maplist.obj -Release/mesher.obj -Release/monoTriangulationBackend.obj -Release/monotonizer.obj -Release/mycode.obj -Release/nurbsinterfac.obj -Release/nurbstess.obj -Release/patch.obj -Release/patchlist.obj -Release/quilt.obj -Release/reader.obj -Release/renderhints.obj -Release/slicer.obj -Release/sorter.obj -Release/splitarcs.obj -Release/subdivider.obj -Release/tobezier.obj -Release/trimline.obj -Release/trimregion.obj -Release/trimvertpool.obj -Release/uarray.obj -Release/varray.obj -Release/directedLine.obj -Release/gridWrap.obj -Release/monoChain.obj -Release/monoPolyPart.obj -Release/monoTriangulation.obj -Release/partitionX.obj -Release/partitionY.obj -Release/polyDBG.obj -Release/polyUtil.obj -Release/primitiveStream.obj -Release/quicksort.obj -Release/rectBlock.obj -Release/sampleComp.obj -Release/sampleCompBot.obj -Release/sampleCompRight.obj -Release/sampleCompTop.obj -Release/sampleMonoPoly.obj -Release/sampledLine.obj -Release/searchTree.obj diff --git a/windows/VC6/mesa/mesa.dsw b/windows/VC6/mesa/mesa.dsw deleted file mode 100644 index a6da850c1c..0000000000 --- a/windows/VC6/mesa/mesa.dsw +++ /dev/null @@ -1,74 +0,0 @@ -Microsoft Developer Studio Workspace File, Format Version 6.00 -# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! - -############################################################################### - -Project: "gdi"=.\gdi\gdi.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ - Begin Project Dependency - Project_Dep_Name mesa - End Project Dependency -}}} - -############################################################################### - -Project: "glu"=.\glu\glu.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ - Begin Project Dependency - Project_Dep_Name gdi - End Project Dependency -}}} - -############################################################################### - -Project: "mesa"=.\mesa\mesa.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Project: "osmesa"=.\osmesa\osmesa.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ - Begin Project Dependency - Project_Dep_Name gdi - End Project Dependency -}}} - -############################################################################### - -Global: - -Package=<5> -{{{ -}}} - -Package=<3> -{{{ -}}} - -############################################################################### - diff --git a/windows/VC6/mesa/mesa/mesa.dsp b/windows/VC6/mesa/mesa/mesa.dsp deleted file mode 100644 index 5a2f724b6a..0000000000 --- a/windows/VC6/mesa/mesa/mesa.dsp +++ /dev/null @@ -1,1582 +0,0 @@ -# Microsoft Developer Studio Project File - Name="mesa" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Static Library" 0x0104 - -CFG=mesa - Win32 Debug x86 -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "mesa.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "mesa.mak" CFG="mesa - Win32 Debug x86" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "mesa - Win32 Release" (based on "Win32 (x86) Static Library") -!MESSAGE "mesa - Win32 Debug" (based on "Win32 (x86) Static Library") -!MESSAGE "mesa - Win32 Release x86" (based on "Win32 (x86) Static Library") -!MESSAGE "mesa - Win32 Debug x86" (based on "Win32 (x86) Static Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "mesa - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c -# ADD CPP /nologo /W3 /GX /O2 /I "../../../../include" /I "../../../../src/mesa" /I "../../../../src/mesa/glapi" /I "../../../../src/mesa/main" /I "../../../../src/mesa/shader" /I "../../../../src/mesa/shader/slang" /I "../../../../src/mesa/shader/grammar" /D "NDEBUG" /D "WIN32" /D "_MBCS" /D "_LIB" /D "_DLL" /D "BUILD_GL32" /D "MESA_MINWARN" /YX /FD /Zm1000 /c -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LIB32=link.exe -lib -# ADD BASE LIB32 /nologo -# ADD LIB32 /nologo - -!ELSEIF "$(CFG)" == "mesa - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c -# ADD CPP /nologo /W3 /Gm /GX /Zi /Od /I "../../../../include" /I "../../../../src/mesa" /I "../../../../src/mesa/glapi" /I "../../../../src/mesa/main" /I "../../../../src/mesa/shader" /I "../../../../src/mesa/shader/slang" /I "../../../../src/mesa/shader/grammar" /D "_DEBUG" /D "WIN32" /D "_MBCS" /D "_LIB" /D "_DLL" /D "BUILD_GL32" /D "MESA_MINWARN" /Fr /FD /GZ /Zm1000 /c -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LIB32=link.exe -lib -# ADD BASE LIB32 /nologo -# ADD LIB32 /nologo - -!ELSEIF "$(CFG)" == "mesa - Win32 Release x86" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "mesa___Win32_Release_x86" -# PROP BASE Intermediate_Dir "mesa___Win32_Release_x86" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release_x86" -# PROP Intermediate_Dir "Release_x86" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /I "../../../../include" /I "../../../../src/mesa" /I "../../../../src/mesa/glapi" /I "../../../../src/mesa/main" /I "../../../../src/mesa/shader" /I "../../../../src/mesa/shader/slang" /I "../../../../src/mesa/shader/grammar" /D "NDEBUG" /D "WIN32" /D "_MBCS" /D "_LIB" /D "_DLL" /D "BUILD_GL32" /D "MESA_MINWARN" /YX /FD /Zm1000 /c -# ADD CPP /nologo /W3 /GX /O2 /I "../../../../include" /I "../../../../src/mesa" /I "../../../../src/mesa/glapi" /I "../../../../src/mesa/main" /I "../../../../src/mesa/shader" /I "../../../../src/mesa/shader/slang" /I "../../../../src/mesa/shader/grammar" /D "NDEBUG" /D "WIN32" /D "_MBCS" /D "_LIB" /D "_DLL" /D "BUILD_GL32" /D "MESA_MINWARN" /D "SLANG_X86" /YX /FD /Zm1000 /c -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LIB32=link.exe -lib -# ADD BASE LIB32 /nologo -# ADD LIB32 /nologo - -!ELSEIF "$(CFG)" == "mesa - Win32 Debug x86" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "mesa___Win32_Debug_x86" -# PROP BASE Intermediate_Dir "mesa___Win32_Debug_x86" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug_x86" -# PROP Intermediate_Dir "Debug_x86" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /I "../../../../include" /I "../../../../src/mesa" /I "../../../../src/mesa/glapi" /I "../../../../src/mesa/main" /I "../../../../src/mesa/shader" /I "../../../../src/mesa/shader/slang" /I "../../../../src/mesa/shader/grammar" /D "_DEBUG" /D "WIN32" /D "_MBCS" /D "_LIB" /D "_DLL" /D "BUILD_GL32" /D "MESA_MINWARN" /Fr /FD /GZ /Zm1000 /c -# ADD CPP /nologo /W3 /Gm /GX /Zi /Od /I "../../../../include" /I "../../../../src/mesa" /I "../../../../src/mesa/glapi" /I "../../../../src/mesa/main" /I "../../../../src/mesa/shader" /I "../../../../src/mesa/shader/slang" /I "../../../../src/mesa/shader/grammar" /D "_DEBUG" /D "WIN32" /D "_MBCS" /D "_LIB" /D "_DLL" /D "BUILD_GL32" /D "MESA_MINWARN" /D "SLANG_X86" /Fr /FD /GZ /Zm1000 /c -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LIB32=link.exe -lib -# ADD BASE LIB32 /nologo -# ADD LIB32 /nologo - -!ENDIF - -# Begin Target - -# Name "mesa - Win32 Release" -# Name "mesa - Win32 Debug" -# Name "mesa - Win32 Release x86" -# Name "mesa - Win32 Debug x86" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\array_cache\ac_context.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\array_cache\ac_import.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\accum.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\api_arrayelt.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\api_loopback.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\api_noop.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\api_validate.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\arrayobj.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\shader\arbprogparse.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\shader\arbprogram.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\shader\atifragshader.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\attrib.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\blend.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\bufferobj.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\buffers.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\clip.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\colortab.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\context.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\convolve.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\debug.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\depth.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\depthstencil.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\dispatch.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\dlist.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\drawpix.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\enable.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\enums.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\eval.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\execmem.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\extensions.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\fbobject.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\feedback.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\fog.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\framebuffer.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\get.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\getstring.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\glapi\glapi.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\glapi\glthread.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\shader\grammar\grammar.c - -!IF "$(CFG)" == "mesa - Win32 Release" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "mesa - Win32 Debug" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "mesa - Win32 Release x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "mesa - Win32 Debug x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\shader\grammar\grammar_mesa.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\hash.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\hint.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\histogram.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\image.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\imports.c - -!IF "$(CFG)" == "mesa - Win32 Release" - -!ELSEIF "$(CFG)" == "mesa - Win32 Debug" - -!ELSEIF "$(CFG)" == "mesa - Win32 Release x86" - -# ADD CPP /YX - -!ELSEIF "$(CFG)" == "mesa - Win32 Debug x86" - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\light.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\lines.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\math\m_debug_clip.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\math\m_debug_norm.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\math\m_debug_xform.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\math\m_eval.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\math\m_matrix.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\math\m_translate.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\math\m_vector.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\math\m_xform.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\matrix.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\mipmap.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\mm.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\shader\nvfragparse.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\shader\nvprogram.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\shader\nvvertexec.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\shader\nvvertparse.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\occlude.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\pixel.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\points.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\polygon.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\shader\program.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\rastpos.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\rbadaptors.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\renderbuffer.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\swrast\s_aaline.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\swrast\s_aatriangle.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\swrast\s_accum.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\swrast\s_alpha.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\swrast\s_arbshader.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\swrast\s_atifragshader.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\swrast\s_bitmap.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\swrast\s_blend.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\swrast\s_blit.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\swrast\s_buffers.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\swrast\s_context.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\swrast\s_copypix.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\swrast\s_depth.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\swrast\s_drawpix.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\swrast\s_feedback.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\swrast\s_fog.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\swrast\s_imaging.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\swrast\s_lines.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\swrast\s_logic.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\swrast\s_masking.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\swrast\s_nvfragprog.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\swrast\s_points.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\swrast\s_readpix.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\swrast\s_span.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\swrast\s_stencil.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\swrast\s_texcombine.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\swrast\s_texfilter.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\swrast\s_texstore.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\swrast\s_triangle.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\swrast\s_zoom.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\shader\shaderobjects.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\shader\shaderobjects_3dlabs.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\shader\slang\slang_analyse.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\shader\slang\slang_assemble.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\shader\slang\slang_assemble_assignment.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\shader\slang\slang_assemble_conditional.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\shader\slang\slang_assemble_constructor.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\shader\slang\slang_assemble_typeinfo.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\shader\slang\slang_compile.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\shader\slang\slang_compile_function.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\shader\slang\slang_compile_operation.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\shader\slang\slang_compile_struct.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\shader\slang\slang_compile_variable.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\shader\slang\slang_execute.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\shader\slang\slang_execute_x86.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\shader\slang\slang_export.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\shader\slang\slang_library_noise.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\shader\slang\slang_library_texsample.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\shader\slang\slang_link.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\shader\slang\slang_preprocess.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\shader\slang\slang_storage.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\shader\slang\slang_utility.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\swrast_setup\ss_context.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\swrast_setup\ss_triangle.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\state.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\stencil.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\tnl\t_array_api.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\tnl\t_array_import.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\tnl\t_context.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\tnl\t_pipeline.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\tnl\t_save_loopback.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\tnl\t_save_playback.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\tnl\t_vb_arbprogram.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\tnl\t_vb_arbshader.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\tnl\t_vb_cull.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\tnl\t_vb_fog.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\tnl\t_vb_light.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\tnl\t_vb_normals.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\tnl\t_vb_points.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\tnl\t_vb_program.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\tnl\t_vb_render.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\tnl\t_vb_texgen.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\tnl\t_vb_texmat.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\tnl\t_vb_vertex.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\tnl\t_vertex.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\tnl\t_vertex_generic.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\tnl\t_vp_build.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\tnl\t_vtx_api.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\tnl\t_vtx_eval.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\tnl\t_vtx_exec.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\tnl\t_vtx_generic.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\texcompress.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\texcompress_fxt1.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\texcompress_s3tc.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\texenvprogram.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\texformat.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\teximage.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\texobj.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\texrender.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\texstate.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\texstore.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\varray.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\vsnprintf.c - -!IF "$(CFG)" == "mesa - Win32 Release" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "mesa - Win32 Debug" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "mesa - Win32 Release x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "mesa - Win32 Debug x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\vtxfmt.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\x86\rtasm\x86sse.c - -!IF "$(CFG)" == "mesa - Win32 Release" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "mesa - Win32 Debug" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "mesa - Win32 Release x86" - -!ELSEIF "$(CFG)" == "mesa - Win32 Debug x86" - -# PROP BASE Exclude_From_Build 1 - -!ENDIF - -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\array_cache\ac_context.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\array_cache\acache.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\accum.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\api_arrayelt.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\api_eval.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\api_loopback.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\api_noop.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\api_validate.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\arrayobj.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\shader\arbprogparse.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\shader\arbprogram.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\shader\arbprogram_syn.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\shader\atifragshader.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\attrib.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\bitset.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\blend.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\bufferobj.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\buffers.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\clip.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\colormac.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\colortab.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\config.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\context.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\convolve.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\dd.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\debug.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\depth.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\depthstencil.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\dlist.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\drawpix.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\enable.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\enums.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\eval.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\extensions.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\fbobject.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\feedback.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\fog.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\framebuffer.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\get.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\glapi\glapi.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\glapi\glapioffsets.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\glapi\glapitable.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\glapi\glapitemp.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\glheader.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\glapi\glprocs.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\glapi\glthread.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\shader\grammar\grammar.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\shader\grammar\grammar_mesa.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\shader\grammar\grammar_syn.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\hash.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\hint.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\histogram.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\image.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\imports.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\light.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\lines.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\math\m_clip_tmp.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\math\m_copy_tmp.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\math\m_debug.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\math\m_debug_util.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\math\m_dotprod_tmp.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\math\m_eval.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\math\m_matrix.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\math\m_norm_tmp.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\math\m_trans_tmp.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\math\m_translate.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\math\m_vector.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\math\m_xform.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\math\m_xform_tmp.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\macros.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\math\mathmod.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\matrix.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\mm.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\mtypes.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\shader\nvfragparse.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\shader\nvfragprog.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\shader\nvprogram.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\shader\nvvertexec.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\shader\nvvertparse.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\shader\nvvertprog.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\occlude.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\pixel.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\points.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\polygon.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\shader\program.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\rastpos.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\rbadaptors.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\renderbuffer.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\swrast\s_aaline.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\swrast\s_aalinetemp.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\swrast\s_aatriangle.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\swrast\s_aatritemp.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\swrast\s_accum.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\swrast\s_alpha.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\swrast\s_arbshader.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\swrast\s_atifragshader.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\swrast\s_blend.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\swrast\s_context.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\swrast\s_depth.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\swrast\s_drawpix.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\swrast\s_feedback.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\swrast\s_fog.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\swrast\s_lines.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\swrast\s_linetemp.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\swrast\s_logic.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\swrast\s_masking.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\swrast\s_nvfragprog.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\swrast\s_points.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\swrast\s_pointtemp.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\swrast\s_span.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\swrast\s_spantemp.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\swrast\s_stencil.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\swrast\s_texcombine.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\swrast\s_texfilter.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\swrast\s_triangle.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\swrast\s_trispan.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\swrast\s_tritemp.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\swrast\s_zoom.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\shader\shaderobjects.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\shader\shaderobjects_3dlabs.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\simple_list.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\shader\slang\slang_analyse.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\shader\slang\slang_assemble.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\shader\slang\slang_assemble_assignment.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\shader\slang\slang_assemble_conditional.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\shader\slang\slang_assemble_constructor.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\shader\slang\slang_assemble_typeinfo.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\shader\slang\slang_compile.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\shader\slang\slang_compile_function.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\shader\slang\slang_compile_operation.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\shader\slang\slang_compile_struct.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\shader\slang\slang_compile_variable.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\shader\slang\slang_execute.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\shader\slang\slang_export.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\shader\slang\slang_library_noise.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\shader\slang\slang_library_texsample.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\shader\slang\slang_link.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\shader\slang\slang_mesa.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\shader\slang\slang_preprocess.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\shader\slang\slang_storage.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\shader\slang\slang_utility.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\swrast_setup\ss_context.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\swrast_setup\ss_triangle.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\swrast_setup\ss_tritmp.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\swrast_setup\ss_vb.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\state.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\stencil.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\swrast\swrast.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\swrast_setup\swrast_setup.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\tnl\t_array_api.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\tnl\t_array_import.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\tnl\t_context.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\tnl\t_pipeline.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\tnl\t_save_api.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\tnl\t_vb_arbprogram.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\tnl\t_vb_cliptmp.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\tnl\t_vb_lighttmp.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\tnl\t_vb_rendertmp.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\tnl\t_vertex.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\tnl\t_vp_build.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\tnl\t_vtx_api.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\texcompress.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\texenvprogram.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\texformat.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\texformat_tmp.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\teximage.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\texobj.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\texrender.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\texstate.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\texstore.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\tnl\tnl.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\shader\slang\traverse_wrap.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\varray.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\version.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\vtxfmt.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\vtxfmt_tmp.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\x86\rtasm\x86sse.h -# End Source File -# End Group -# End Target -# End Project diff --git a/windows/VC6/mesa/osmesa/osmesa.dsp b/windows/VC6/mesa/osmesa/osmesa.dsp deleted file mode 100644 index 0dd5cd4ac7..0000000000 --- a/windows/VC6/mesa/osmesa/osmesa.dsp +++ /dev/null @@ -1,195 +0,0 @@ -# Microsoft Developer Studio Project File - Name="osmesa" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=osmesa - Win32 Debug x86 -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "osmesa.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "osmesa.mak" CFG="osmesa - Win32 Debug x86" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "osmesa - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "osmesa - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "osmesa - Win32 Release x86" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "osmesa - Win32 Debug x86" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "osmesa - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "OSMESA_EXPORTS" /YX /FD /c -# ADD CPP /nologo /MT /W3 /GX /O2 /I "../../../../include" /I "../../../../src/mesa" /I "../../../../src/mesa/main" /I "../../../../src/mesa/glapi" /I "../../../../src/mesa/swrast" /I "../../../../src/mesa/shader" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "OSMESA_EXPORTS" /FD /c -# SUBTRACT CPP /YX -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 -# ADD LINK32 opengl32.lib winmm.lib msvcrt.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /nodefaultlib /out:"Release/OSMESA32.DLL" /libpath:"../gdi/Release" -# Begin Special Build Tool -SOURCE="$(InputPath)" -PostBuild_Cmds=if not exist ..\..\..\..\lib md ..\..\..\..\lib copy Release\OSMESA32.LIB ..\..\..\..\lib copy Release\OSMESA32.DLL ..\..\..\..\lib if exist ..\..\..\..\progs\demos copy Release\OSMESA32.DLL ..\..\..\..\progs\demos -# End Special Build Tool - -!ELSEIF "$(CFG)" == "osmesa - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "OSMESA_EXPORTS" /YX /FD /GZ /c -# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /I "../../../../include" /I "../../../../src/mesa" /I "../../../../src/mesa/main" /I "../../../../src/mesa/glapi" /I "../../../../src/mesa/swrast" /I "../../../../src/mesa/shader" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "OSMESA_EXPORTS" /FD /GZ /c -# SUBTRACT CPP /YX -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept -# ADD LINK32 opengl32.lib winmm.lib msvcrtd.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /incremental:no /debug /machine:I386 /nodefaultlib /out:"Debug/OSMESA32.DLL" /pdbtype:sept /libpath:"../gdi/Debug" -# Begin Special Build Tool -SOURCE="$(InputPath)" -PostBuild_Cmds=if not exist ..\..\..\..\lib md ..\..\..\..\lib copy Debug\OSMESA32.LIB ..\..\..\..\lib copy Debug\OSMESA32.DLL ..\..\..\..\lib if exist ..\..\..\..\progs\demos copy Debug\OSMESA32.DLL ..\..\..\..\progs\demos -# End Special Build Tool - -!ELSEIF "$(CFG)" == "osmesa - Win32 Release x86" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "osmesa___Win32_Release_x86" -# PROP BASE Intermediate_Dir "osmesa___Win32_Release_x86" -# PROP BASE Ignore_Export_Lib 0 -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release_x86" -# PROP Intermediate_Dir "Release_x86" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "../../../../include" /I "../../../../src/mesa" /I "../../../../src/mesa/main" /I "../../../../src/mesa/glapi" /I "../../../../src/mesa/swrast" /I "../../../../src/mesa/shader" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "OSMESA_EXPORTS" /FD /c -# SUBTRACT BASE CPP /YX -# ADD CPP /nologo /MT /W3 /GX /O2 /I "../../../../include" /I "../../../../src/mesa" /I "../../../../src/mesa/main" /I "../../../../src/mesa/glapi" /I "../../../../src/mesa/swrast" /I "../../../../src/mesa/shader" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "OSMESA_EXPORTS" /FD /c -# SUBTRACT CPP /YX -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 opengl32.lib winmm.lib msvcrt.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /nodefaultlib /out:"Release/OSMESA32.DLL" /libpath:"../gdi/Release" -# ADD LINK32 opengl32.lib winmm.lib msvcrt.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /nodefaultlib /out:"Release_x86/OSMESA32.DLL" /libpath:"../gdi/Release_x86" -# Begin Special Build Tool -SOURCE="$(InputPath)" -PostBuild_Cmds=if not exist ..\..\..\..\lib md ..\..\..\..\lib copy Release_x86\OSMESA32.LIB ..\..\..\..\lib copy Release_x86\OSMESA32.DLL ..\..\..\..\lib if exist ..\..\..\..\progs\demos copy Release_x86\OSMESA32.DLL ..\..\..\..\progs\demos -# End Special Build Tool - -!ELSEIF "$(CFG)" == "osmesa - Win32 Debug x86" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "osmesa___Win32_Debug_x86" -# PROP BASE Intermediate_Dir "osmesa___Win32_Debug_x86" -# PROP BASE Ignore_Export_Lib 0 -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug_x86" -# PROP Intermediate_Dir "Debug_x86" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /I "../../../../include" /I "../../../../src/mesa" /I "../../../../src/mesa/main" /I "../../../../src/mesa/glapi" /I "../../../../src/mesa/swrast" /I "../../../../src/mesa/shader" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "OSMESA_EXPORTS" /FD /GZ /c -# SUBTRACT BASE CPP /YX -# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /I "../../../../include" /I "../../../../src/mesa" /I "../../../../src/mesa/main" /I "../../../../src/mesa/glapi" /I "../../../../src/mesa/swrast" /I "../../../../src/mesa/shader" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "OSMESA_EXPORTS" /FD /GZ /c -# SUBTRACT CPP /YX -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 opengl32.lib winmm.lib msvcrtd.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /incremental:no /debug /machine:I386 /nodefaultlib /out:"Debug/OSMESA32.DLL" /pdbtype:sept /libpath:"../gdi/Debug" -# ADD LINK32 opengl32.lib winmm.lib msvcrtd.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /incremental:no /debug /machine:I386 /nodefaultlib /out:"Debug/OSMESA32.DLL" /pdbtype:sept /libpath:"../gdi/Debug_x86" -# Begin Special Build Tool -SOURCE="$(InputPath)" -PostBuild_Cmds=if not exist ..\..\..\..\lib md ..\..\..\..\lib copy Debug_x86\OSMESA32.LIB ..\..\..\..\lib copy Debug_x86\OSMESA32.DLL ..\..\..\..\lib if exist ..\..\..\..\progs\demos copy Debug_x86\OSMESA32.DLL ..\..\..\..\progs\demos -# End Special Build Tool - -!ENDIF - -# Begin Target - -# Name "osmesa - Win32 Release" -# Name "osmesa - Win32 Debug" -# Name "osmesa - Win32 Release x86" -# Name "osmesa - Win32 Debug x86" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\drivers\common\driverfuncs.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\drivers\osmesa\osmesa.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\drivers\osmesa\osmesa.def -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# End Group -# Begin Group "Resource Files" - -# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" -# End Group -# End Target -# End Project diff --git a/windows/VC7/mesa/gdi/gdi.vcproj b/windows/VC7/mesa/gdi/gdi.vcproj deleted file mode 100644 index 0dc7892a4b..0000000000 --- a/windows/VC7/mesa/gdi/gdi.vcproj +++ /dev/null @@ -1,195 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/windows/VC7/mesa/glu/glu.vcproj b/windows/VC7/mesa/glu/glu.vcproj deleted file mode 100644 index 3f057317c0..0000000000 --- a/windows/VC7/mesa/glu/glu.vcproj +++ /dev/null @@ -1,766 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/windows/VC7/mesa/mesa.sln b/windows/VC7/mesa/mesa.sln deleted file mode 100644 index ae47790753..0000000000 --- a/windows/VC7/mesa/mesa.sln +++ /dev/null @@ -1,47 +0,0 @@ -Microsoft Visual Studio Solution File, Format Version 8.00 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gdi", "gdi\gdi.vcproj", "{A1B24907-E196-4826-B6AF-26723629B633}" - ProjectSection(ProjectDependencies) = postProject - {2120C974-2717-4709-B44F-D6E6D0A56448} = {2120C974-2717-4709-B44F-D6E6D0A56448} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "glu", "glu\glu.vcproj", "{2E50FDAF-430B-475B-AE6B-60B68F2875BA}" - ProjectSection(ProjectDependencies) = postProject - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mesa", "mesa\mesa.vcproj", "{2120C974-2717-4709-B44F-D6E6D0A56448}" - ProjectSection(ProjectDependencies) = postProject - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "osmesa", "osmesa\osmesa.vcproj", "{8D6CD423-383B-49E7-81BC-D20C70B07DF5}" - ProjectSection(ProjectDependencies) = postProject - {A1B24907-E196-4826-B6AF-26723629B633} = {A1B24907-E196-4826-B6AF-26723629B633} - EndProjectSection -EndProject -Global - GlobalSection(SolutionConfiguration) = preSolution - Debug = Debug - Release = Release - EndGlobalSection - GlobalSection(ProjectConfiguration) = postSolution - {A1B24907-E196-4826-B6AF-26723629B633}.Debug.ActiveCfg = Debug|Win32 - {A1B24907-E196-4826-B6AF-26723629B633}.Debug.Build.0 = Debug|Win32 - {A1B24907-E196-4826-B6AF-26723629B633}.Release.ActiveCfg = Release|Win32 - {A1B24907-E196-4826-B6AF-26723629B633}.Release.Build.0 = Release|Win32 - {2E50FDAF-430B-475B-AE6B-60B68F2875BA}.Debug.ActiveCfg = Debug|Win32 - {2E50FDAF-430B-475B-AE6B-60B68F2875BA}.Debug.Build.0 = Debug|Win32 - {2E50FDAF-430B-475B-AE6B-60B68F2875BA}.Release.ActiveCfg = Release|Win32 - {2E50FDAF-430B-475B-AE6B-60B68F2875BA}.Release.Build.0 = Release|Win32 - {2120C974-2717-4709-B44F-D6E6D0A56448}.Debug.ActiveCfg = Debug|Win32 - {2120C974-2717-4709-B44F-D6E6D0A56448}.Debug.Build.0 = Debug|Win32 - {2120C974-2717-4709-B44F-D6E6D0A56448}.Release.ActiveCfg = Release|Win32 - {2120C974-2717-4709-B44F-D6E6D0A56448}.Release.Build.0 = Release|Win32 - {8D6CD423-383B-49E7-81BC-D20C70B07DF5}.Debug.ActiveCfg = Debug|Win32 - {8D6CD423-383B-49E7-81BC-D20C70B07DF5}.Debug.Build.0 = Debug|Win32 - {8D6CD423-383B-49E7-81BC-D20C70B07DF5}.Release.ActiveCfg = Release|Win32 - {8D6CD423-383B-49E7-81BC-D20C70B07DF5}.Release.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - EndGlobalSection - GlobalSection(ExtensibilityAddIns) = postSolution - EndGlobalSection -EndGlobal diff --git a/windows/VC7/mesa/mesa/mesa.vcproj b/windows/VC7/mesa/mesa/mesa.vcproj deleted file mode 100644 index 4d5d4c744b..0000000000 --- a/windows/VC7/mesa/mesa/mesa.vcproj +++ /dev/null @@ -1,1227 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/windows/VC7/mesa/osmesa/osmesa.vcproj b/windows/VC7/mesa/osmesa/osmesa.vcproj deleted file mode 100644 index 553dad7e6a..0000000000 --- a/windows/VC7/mesa/osmesa/osmesa.vcproj +++ /dev/null @@ -1,182 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- cgit v1.2.3