Compare commits

...

207 Commits

Author SHA1 Message Date
Keith Whitwell
e1aaeb5a45 fix for eval regression 2000-07-20 15:54:06 +00:00
Brian Paul
1ec0bef98e initialize GenBit[STRQ] in init_texture_unit() 2000-07-19 21:00:06 +00:00
Brian Paul
4105daf0b1 restore driver depth test enable/disable state in PopAttrib() 2000-07-19 18:34:03 +00:00
Brian Paul
92986be121 updated version number 2000-07-19 15:15:55 +00:00
Brian Paul
086f5701a4 Mesa 3.3 glxinfo 2000-07-19 15:15:40 +00:00
Brian Paul
f9a0ea5415 added 3.2.1 release date 2000-07-19 15:09:30 +00:00
Brian Paul
91e07e6b27 updated release notes 2000-07-19 14:59:33 +00:00
Brian Paul
abfd41b673 changed version string to 3.2.1 2000-07-18 14:33:21 +00:00
Brian Paul
37d37e8c38 added: touch widgets-sgi/depend 2000-07-18 14:32:08 +00:00
Brian Paul
46a064e6d3 fix aa point sampling offset 2000-07-18 03:50:49 +00:00
Brian Paul
b0c18181e5 clamp max in GL_RETURN setup 2000-07-18 03:50:16 +00:00
Brian Paul
19f87266b1 removed more redundant files from tar archive 2000-07-18 01:30:38 +00:00
Brian Paul
463b3c5665 changed version string to 3.2.1 2000-07-18 01:12:31 +00:00
Brian Paul
b3215842b2 more bug fixes 2000-07-17 19:28:13 +00:00
Brian Paul
4403f5cd30 removed redundant configure file from tar archive, updated version numbers 2000-07-17 19:26:04 +00:00
Keith Whitwell
83456f39d6 Clean up lerping shine table lookup.
Fix for gloss and sgl bugs.
2000-07-17 12:49:56 +00:00
Brian Paul
12c1fef737 updated version and copyright date 2000-07-14 14:56:27 +00:00
Brian Paul
c01feb8653 removed references to fx_regoff.h and fx_gen_regoff.c 2000-07-14 14:55:51 +00:00
Brian Paul
1b8d0fdcde fix divide by zero problem in compute_shine_table() 2000-07-13 19:50:04 +00:00
Brian Paul
761c5b23bb replaced GL_CLIENT_ALL_ATTRIB_BITS with GL_ALL_CLIENT_ATTRIB_BITS 2000-07-13 17:44:20 +00:00
Keith Whitwell
7b0ee9f64b Two new, more accurate methods for computing shine values. 2000-07-13 12:54:07 +00:00
Keith Whitwell
865b03207c Use 3.0 style on-the-fly computation of shine table values. 2000-07-12 12:02:33 +00:00
Brian Paul
39be967b6d allocate 1-larger knot array in explode_knot() (Mesa bug 104881) 2000-07-11 20:38:48 +00:00
Brian Paul
d51009ad5d set MESA_TINY=1 2000-07-11 14:41:44 +00:00
Brian Paul
422b2c887c added tessellator change 2000-07-11 14:15:30 +00:00
Brian Paul
9d5b7e2b71 updated for old tessellator, GLU 1.1 versioning 2000-07-11 03:48:23 +00:00
Brian Paul
7f43532d4c needed for old tessellator 2000-07-11 02:07:52 +00:00
Brian Paul
e99fda30fb updated GLU info 2000-07-11 01:49:01 +00:00
Brian Paul
6ac752afc5 reverted to GLU 1.1 2000-07-11 01:45:56 +00:00
Brian Paul
314bd32cf3 revert to using 1.1 tessellator 2000-07-11 01:45:28 +00:00
Brian Paul
87492f9c67 Restored old polygon tessellator code (GLU 1.1). Ran indent on all files. 2000-07-11 01:39:41 +00:00
Keith Whitwell
3e78a0e555 Special case shine table construction to sample the [0,1) element at zero. 2000-07-10 18:06:19 +00:00
Brian Paul
674509fe95 added more 3.2.1 bug fixes 2000-07-10 14:53:11 +00:00
Keith Whitwell
4020d5b7fc Fix for miscolored rects in display lists 2000-07-10 13:04:53 +00:00
Keith Whitwell
b276a01a3c Initialize shine tables from the center of each table element.
Eliminate checks on 'vertex_size' in the shading functions.
2000-07-07 14:33:49 +00:00
Brian Paul
a1a1b9bf8b changed MAX_WIDTH to 2048 2000-07-06 14:52:01 +00:00
Brian Paul
675835139a added fog / flat shading bug fix 2000-07-05 19:07:24 +00:00
Brian Paul
14652699f3 initial rev 2000-07-05 16:11:25 +00:00
Brian Paul
170d246324 added blend bug fix 2000-07-05 16:06:45 +00:00
Brian Paul
55b536ab30 NeedEyeCoords if non-uniform scale transform 2000-06-30 14:16:37 +00:00
Brian Paul
73d7a8a9a3 fixed GL_ONE_MINUS_CONSTANT_ALPHA bug (geza) 2000-06-29 22:06:24 +00:00
Brian Paul
6e85dacc57 minor update 2000-06-29 14:31:30 +00:00
Brian Paul
b8fc81d266 don't add light's ambient color to BaseColor in gl_update_lighting() 2000-06-29 04:57:45 +00:00
Brian Paul
821312402c added conformance update 2000-06-28 04:42:27 +00:00
Brian Paul
9c1629bd17 added lighting and polygon mode bug fixes 2000-06-27 15:04:39 +00:00
Brian Paul
83670c38ca backport of lighting and material bug fixes from 3.3 2000-06-27 15:04:20 +00:00
Brian Paul
3222cd1397 another patch for win32 joysticks 2000-06-27 13:39:57 +00:00
Keith Whitwell
0c7d87ac2e Bugfixes for colormaterial, polygon clipping in GL_LINE mode 2000-06-24 14:14:29 +00:00
Brian Paul
86eb38b4a0 added glColorMask item 2000-06-23 20:32:55 +00:00
Brian Paul
5aa48b622d fixed ColorMask test in update_rasterflags() 2000-06-23 20:29:15 +00:00
Brian Paul
2e156a37aa applied joystick patch from Michael Champigny 2000-06-23 16:22:45 +00:00
Brian Paul
777ee76f86 added Motif widget fix 2000-06-23 16:05:40 +00:00
Brian Paul
179d2702d3 check for special cases of value = 0 or 1 in glAccum 2000-06-19 00:45:17 +00:00
Brian Paul
c274b95769 added two more 3.2.1 bug fixes 2000-06-18 22:58:43 +00:00
Brian Paul
53a3d5fc8b replaced fxTMReloadSubMipMapLevel() call w/ fxTMReloadMipMapLevel() to work-around subtex bug 2000-06-16 03:58:04 +00:00
Brian Paul
66f13cefec added Motif info message 2000-06-15 18:46:07 +00:00
Brian Paul
9a20b54fb2 removed non-windows exit() prototype 2000-06-15 15:12:18 +00:00
Brian Paul
5537322607 added 3dfx GL selection segfault fix 2000-06-15 05:34:08 +00:00
Brian Paul
8b41f43e5c added GL_EXT_packed_pixels extension, subset of GL 1.2 2000-06-08 22:47:59 +00:00
Brian Paul
83d028f92a updated OSF/1 CFLAGS (Jeremie Petit) 2000-06-08 15:19:44 +00:00
Brian Paul
9a51d84f55 added 3.2.1 section 2000-06-05 16:32:37 +00:00
Brian Paul
96719f0999 added make rules for SVGA driver files 2000-06-05 16:30:43 +00:00
Brian Paul
477299afb1 added missing GL_BGRA case 2000-06-05 16:27:49 +00:00
Brian Paul
a23141fd75 added VMS files to Makefiles 2000-06-05 14:40:09 +00:00
Brian Paul
1b4731700a added ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH() in gl_Fogfv() 2000-06-05 14:33:24 +00:00
Brian Paul
2ec3d124ec changed bug report address in gl_problem() 2000-05-26 18:21:10 +00:00
Brian Paul
c91b2ad8fc update for glide3 2000-05-20 23:17:05 +00:00
Brian Paul
0da42c0c21 a few Alpha tweaks (Michael Champigny) 2000-05-08 18:19:49 +00:00
Brian Paul
f5f3e5d752 added check for tmuRam==4 for Voodoo2 (Bernd) 2000-05-05 22:39:23 +00:00
Brian Paul
b0148e2f5d fixed backslash typo in sunos configs 2000-05-03 15:03:17 +00:00
Brian Paul
b3811b9f4d fixed tar file list of widget files 2000-05-03 15:02:02 +00:00
Brian Paul
5b7fc632ad added dummy entry to known_extensions[] to fix Tru64 compiler problem 2000-05-03 14:16:58 +00:00
Brian Paul
5febd0ce8b disable some features to make work on IRIX 2000-04-24 16:06:05 +00:00
Brian Paul
3d2264b2ce removed extra / 2000-04-24 15:29:02 +00:00
Brian Paul
486565f88a updated for 3.2 final release 2000-04-24 14:47:45 +00:00
Brian Paul
0931339ea8 updated for 3.2 final relase 2000-04-24 14:47:11 +00:00
Brian Paul
7fbad8f406 removed beta from version string 2000-04-24 12:42:37 +00:00
Brian Paul
3382e6e359 removed beta from version string 2000-04-24 12:33:24 +00:00
Brian Paul
96cefd6d02 added Loki smooth/flat tri bug 2000-04-20 00:25:08 +00:00
Keith Whitwell
8033ed691e Always use smooth shaded triangles, emulating flat ones by emitting
vertices with identical color values.
2000-04-19 23:56:08 +00:00
Keith Whitwell
59aa79ea5e fix andreas' clipping problem 2000-04-17 17:35:47 +00:00
Brian Paul
5478ccec45 Loki's RGB/BGR bug fix 2000-04-15 04:54:03 +00:00
Brian Paul
ba31a93ae5 Loki's bug fixes 2000-04-15 04:53:08 +00:00
Brian Paul
3c5265bf69 re-enabled persp_textured_triangle 2000-04-15 04:51:51 +00:00
Brian Paul
9c7494fc0c silenced some warnings 2000-04-15 03:18:44 +00:00
Brian Paul
9e077508f9 applied Bernd's changes to useBGR code 2000-04-14 21:40:46 +00:00
Brian Paul
95b0d3528a applied Keith's fix for the Loki ice bug 2000-04-13 14:53:35 +00:00
Brian Paul
dcd4ea4746 added clipping to depth span read functions 2000-04-11 20:41:31 +00:00
Brian Paul
e01205dd9e added clipping to span reading 2000-04-11 20:40:44 +00:00
Brian Paul
198ed1fe93 added clipping bug fix 2000-04-10 22:13:39 +00:00
Brian Paul
5c2f9bc2de added 24bpp clear bug fix 2000-04-07 14:13:10 +00:00
Holger Waechtler
e4fb0285f2 added CONCAT macro in NASM/MASM section 2000-04-06 21:59:24 +00:00
Brian Paul
573ab9c964 initial check-in 2000-04-06 02:34:31 +00:00
Brian Paul
37f4e1fe40 print fbiRev if MESA_FX_INFO defined 2000-04-06 00:11:11 +00:00
Brian Paul
4f4a6b4a4f pulled in the RGB vs BGR setup code from Mesa 3.3 2000-04-06 00:08:18 +00:00
Brian Paul
884aa6efd8 added version number 2000-04-04 23:28:00 +00:00
Brian Paul
ceb817650f added 3.2 final bug fixes 2000-04-04 16:01:33 +00:00
Brian Paul
19ac63ce20 updated for Mesa 3.2 2000-04-04 15:13:41 +00:00
Brian Paul
1b4c728f77 added 3.2 final info 2000-04-04 00:54:53 +00:00
Brian Paul
140809c588 Ugh! Mesa 3.2, not 3.3 2000-04-04 00:52:28 +00:00
Brian Paul
e6df48f9a6 updated copyright date/version 2000-04-04 00:51:41 +00:00
Brian Paul
31bcf75ce1 use bcopy on FreeBSD 2000-04-04 00:50:28 +00:00
Brian Paul
9818daae60 added gluCheckExtension() 2000-03-31 20:07:56 +00:00
Brian Paul
5ade8ed0b4 added missing glEnd() call (Tim Beckmann) 2000-03-27 15:47:08 +00:00
Brian Paul
1b539ed613 exclude CVS dirs from tar file 2000-03-23 00:14:28 +00:00
Brian Paul
905ad56487 changed version string to Mesa 3.2 beta 1 2000-03-23 00:13:22 +00:00
Brian Paul
a16ebe76c9 added -O2 / -O3 info 2000-03-23 00:12:41 +00:00
Brian Paul
96563ae75f replaced -O2 with -O3 for some gcc configs 2000-03-23 00:12:13 +00:00
Brian Paul
11769b9737 updates for Mesa 3.2 2000-03-22 23:50:13 +00:00
Brian Paul
474363af47 minor tweaks 2000-03-22 23:48:43 +00:00
Brian Paul
99189ad4fb added instructions to build widgets-sgi 2000-03-22 23:48:00 +00:00
Brian Paul
361fc66e36 fixed Cygwin patch typos 2000-03-22 16:01:36 +00:00
Brian Paul
0b616332f7 added list of Keith's bug fixes 2000-03-21 16:39:55 +00:00
Brian Paul
4f030d12ad patched for Cygwin (Sven Panne) 2000-03-20 17:54:44 +00:00
Brian Paul
792837dafd minor Glide tweak 2000-03-18 23:40:53 +00:00
Brian Paul
8c77d45b06 updated for Mesa 3.2 2000-03-18 23:39:58 +00:00
Brian Paul
660f6dec37 colors were computed incorrectly (Hans Nelles) 2000-03-18 01:14:01 +00:00
Brian Paul
14e7ab2c4f removed some printf's 2000-03-11 23:28:37 +00:00
Brian Paul
089f713f0d glPopAttrib() now calls Driver's ClearColor, ClearIndex and ColorMask functions 2000-03-10 22:11:15 +00:00
Brian Paul
53f81339a4 fixed off-by-one errors in matrix stack setup/cleanup 2000-03-06 16:59:26 +00:00
Brian Paul
2cf228e93d minor reformatting 2000-03-01 20:43:41 +00:00
Brian Paul
4e8ee6840a test for GL 1.2 2000-03-01 03:36:35 +00:00
Brian Paul
5144d47c54 added glXCopyContext mask item 2000-02-29 23:01:44 +00:00
Brian Paul
3eaed2527a added proxy texture targets to GetColorTableParameter (Steven Fuller) 2000-02-28 20:40:18 +00:00
Brian Paul
353bd24876 added GL_BGR and GL_BGRA support 2000-02-28 14:51:39 +00:00
Brian Paul
473d64f9cc patched for NetBSD support (Allen Briggs), Watcom stuff added from 3.3 2000-02-27 18:11:47 +00:00
Brian Paul
c21598fb0d added mipmap lambda item 2000-02-27 16:17:12 +00:00
Brian Paul
287abc7aa0 fixed bug when using display lists 2000-02-25 23:24:28 +00:00
Brian Paul
e6e732c64d changed glXCopyContext()'s mask to unsigned long 2000-02-23 23:05:07 +00:00
Brian Paul
61cca3827f test that RenderMode == GL_RENDER in gl_direct_DrawPixels 2000-02-22 18:10:43 +00:00
Brian Paul
88406455f5 initial check-in 2000-02-22 17:56:56 +00:00
Brian Paul
fb67681366 added 24bpp bug fix item 2000-02-22 17:32:53 +00:00
Brian Paul
ead75d4894 fixed 24bpp pixel addressing bug 2000-02-22 17:22:42 +00:00
Brian Paul
bd4ba2b85d disabled an fprintf in FX_grSstQueryHardware() 2000-02-22 01:15:48 +00:00
Brian Paul
998839109e added off-by-one matrix stack size bug 2000-02-21 22:51:57 +00:00
Brian Paul
a23d3cc054 fixed off by one error in matrix stack depths (Eero Pajarre) 2000-02-21 22:49:24 +00:00
Brian Paul
803d5a12ab clean-up in gl_windowpos() 2000-02-21 16:31:55 +00:00
Brian Paul
462144c0f0 added GL_SRC_ALPHA_SATURATE bug fix 2000-02-21 15:00:12 +00:00
Brian Paul
a780e6f228 fixed GL_SRC_ALPHA_SATURATE bug 2000-02-21 14:59:41 +00:00
Brian Paul
7feab37f8a changed MESA_MINOR to 2, updated linux-elf-debug config 2000-02-18 15:48:39 +00:00
Brian Paul
091834064c update fog near/far bug fix 2000-02-16 23:33:08 +00:00
Brian Paul
9275c62963 added bug fix for glDeleteTextures() 2000-02-12 02:00:46 +00:00
Brian Paul
7166ff0412 fixed reference count but in DeleteTextures() 2000-02-12 01:59:10 +00:00
Brian Paul
bf69170dff added MESA_FX_NO_SIGNALS env var (Michael Vance) 2000-02-12 01:42:45 +00:00
Brian Paul
3c6dd8791c updated with MESA_FX_NO_SIGNALS info 2000-02-12 01:35:30 +00:00
Brian Paul
69bc4e01b8 include float.h on alpha 2000-02-11 23:37:01 +00:00
Brian Paul
b2d3b2dbe0 added GLCALLBACKPCAST for Cygnus (Sven Panne) 2000-02-10 17:21:30 +00:00
Brian Paul
c508641aec added OpenStep files to LIB_FILES 2000-02-10 15:57:03 +00:00
Brian Paul
f008070ad5 changed version to 1.2 Mesa 3.2 2000-02-09 18:59:56 +00:00
Brian Paul
c562884268 updated version info to 3.2 2000-02-09 18:53:54 +00:00
Brian Paul
992795f4c9 added a few missing ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH() calls 2000-02-08 01:48:07 +00:00
Brian Paul
d21f13cb05 added missing glGet cases for GL_EXT_compiled_vertex_array 2000-02-06 03:10:45 +00:00
Brian Paul
f1b26953e8 added glDrawRangeElements() bug fix 2000-02-05 02:10:48 +00:00
Brian Paul
216244bed8 disabled locked arrays in glDrawRangeElements() 2000-02-05 02:05:21 +00:00
Brian Paul
b85c3afc01 added GL_EXT_compiled_vertex_array bug fix 2000-02-05 01:54:20 +00:00
Brian Paul
e4ee3cc9d1 GL_ARRAY_ELEMENT_LOCK_FIRST/COUNT_SGI changed to _EXT suffix 2000-02-05 01:52:23 +00:00
Brian Paul
03d7215604 added check for IntegerAccumScaler > 0 in GL_RETURN case 2000-02-02 21:53:59 +00:00
Brian Paul
82e6fe5e36 changed > to >= 2000-02-02 17:32:15 +00:00
Brian Paul
dde5788a44 limit Drift to [0, 1] 2000-02-02 01:08:09 +00:00
tanner
8038f3747d include conf.h 2000-01-31 22:10:39 +00:00
Holger Waechtler
0df95816c5 Added prefetchw. 2000-01-27 20:06:14 +00:00
Brian Paul
3692626805 updated version string to Mesa 3.2 2000-01-27 16:43:00 +00:00
Brian Paul
b31d01d4a7 updated RGB2BGR function 2000-01-25 20:21:10 +00:00
Brian Paul
ba8ef5917e added info about assembly language optimizations 2000-01-25 17:18:46 +00:00
Brian Paul
f5d0252282 updated version info 2000-01-25 17:03:05 +00:00
Brian Paul
83386c0f7b fixed VB->IndexPtr==NULL bug (Richard Guenther) 2000-01-25 16:49:15 +00:00
Brian Paul
5e8aa8e5d9 replaced HashLookup() with _mesa_HashLookup() 2000-01-24 23:49:29 +00:00
Brian Paul
f008ed46d1 prefixed hash functions with _mesa_ 2000-01-24 16:20:17 +00:00
Brian Paul
7b5a65ce28 added #ifdef SVGA, work-around asm code problem 2000-01-23 17:48:12 +00:00
Brian Paul
4f4b93d8ae added new SVGA driver files 2000-01-23 17:47:00 +00:00
Josh Vanderhoof
81f97580cc prevent spaces in fp register names 2000-01-23 05:44:46 +00:00
Josh Vanderhoof
8de719530c no brackets for nasm indirect jumps 2000-01-23 05:07:13 +00:00
Brian Paul
f0040ae8f5 added updated SVGA driver info 2000-01-22 20:10:57 +00:00
Brian Paul
ec2425c3b6 removed unused vars 2000-01-22 20:06:20 +00:00
Brian Paul
aedc01c850 added copyright info, misc clean-up 2000-01-22 20:05:28 +00:00
Brian Paul
93c528a6d5 initial check-in 2000-01-22 20:05:09 +00:00
Brian Paul
443d666b9a updated for Mesa 3.2 2000-01-22 19:57:23 +00:00
Brian Paul
d794378dbc initial check-in 2000-01-22 19:56:20 +00:00
Brian Paul
76dad53903 added front/back glCopyPixels bug fix 2000-01-22 19:48:23 +00:00
Gareth Hughes
e5f8d98410 Fixed internal scanbeam intersection side-effects. When an internal
intersection is found, it essentially reverses the two bounds with
intersecting edges above the point of intersection.  This needs to be
taken into account when inserting vertices from these bounds,
otherwise they will be added to the wrong end of the output contours.
Quite an easy fix, really.

Still cleaning up redundant code in the clipping functions, left over
from the original Vatti/GPC algorithms.  Will do some more thorough
testing of the fix with the programs that have had problems reported,
and finish cleaning up the clipping code.
2000-01-19 04:57:27 +00:00
Brian Paul
7f8fed5711 added missing tokens item to 3.2 bug fixes 2000-01-17 18:17:41 +00:00
Brian Paul
5ed6197b0a added missing POINT/LINE RANGE/GRANULARITY tokens 2000-01-17 18:04:33 +00:00
Brian Paul
609524894a added selection mode bug fix 2000-01-17 15:36:47 +00:00
Brian Paul
553adbb0c2 Z values were wrong in selection mode (Holger Waechtler) 2000-01-17 15:36:06 +00:00
Brian Paul
361afca6a4 synchronized with DRI tree / Daryll's latest changes 2000-01-15 19:17:24 +00:00
Brian Paul
4c6a2f6a33 updated for Mesa 3.2 2000-01-14 16:26:42 +00:00
Brian Paul
717ec19e30 initial check-in 2000-01-14 16:16:40 +00:00
Brian Paul
411fb983f7 updated for Mesa 3.2 2000-01-14 16:15:32 +00:00
Brian Paul
5dbe3d9c98 another fix for gluPartialDisk() in GL_LINE mode 2000-01-11 22:01:49 +00:00
Brian Paul
fea067dce8 added two more bug fixes for 3.2 2000-01-11 17:27:32 +00:00
Brian Paul
1cfc846bf3 fixed missing slice problem in gluPartialDisk() 2000-01-11 17:23:18 +00:00
Brian Paul
dfa45b9f26 added amesa.h to tar file list 2000-01-08 11:13:10 +00:00
Brian Paul
6f602ed44d added glHintPGI note for 3.2 bug fixes 2000-01-07 08:38:08 +00:00
Brian Paul
34bf1dd293 added glHintPGI() 2000-01-07 08:37:34 +00:00
Brian Paul
9a7584b062 minor clean-up in _mesa_unpack_ubyte_color_span() 2000-01-05 09:18:35 +00:00
Brian Paul
d6dfb94059 added 3.2 bug fixes 2000-01-05 06:57:54 +00:00
Brian Paul
b9ee2850cf start search at 1 in HashFindFreeKeyBlock() 2000-01-04 08:15:26 +00:00
Brian Paul
4183bf524d added missing glColorTableParameter defines 2000-01-04 08:08:28 +00:00
Keith Whitwell
1721f447c6 Fixed bug in gl_extension_enable, allow drivers to turn on ext_texenv_add 1999-12-21 17:22:39 +00:00
Keith Whitwell
46ef216f7f patches from daryll 1999-12-19 12:05:54 +00:00
Brian Paul
a171741d65 more tweaking of tar file list 1999-12-16 08:59:57 +00:00
Brian Paul
320c2cdb0f added a cast to malloc call 1999-12-16 08:53:51 +00:00
Brian Paul
9ed70db8ea just include Makefile.X11 1999-12-15 13:05:13 +00:00
Brian Paul
acbb8cb9dd initial check-in 1999-12-15 13:04:55 +00:00
Brian Paul
7889a93ff7 made a few globals static 1999-12-15 13:01:44 +00:00
Brian Paul
970a551795 moved #define to column 0 1999-12-15 13:00:24 +00:00
Brian Paul
d7eae31275 replaced 0 with 0.0 in sin, cos calls 1999-12-15 12:59:29 +00:00
118 changed files with 13928 additions and 12585 deletions

View File

@@ -1,13 +1,13 @@
# $Id: Make-config,v 1.11 1999/11/11 01:28:16 brianp Exp $
# $Id: Make-config,v 1.10.2.7 2000/07/11 14:41:44 brianp Exp $
MESA_MAJOR=3
MESA_MINOR=3
MESA_TINY=0
MESA_MINOR=2
MESA_TINY=1
VERSION=$(MESA_MAJOR).$(MESA_MINOR)
# Mesa 3-D graphics library
#
# Copyright (C) 1999 Brian Paul All Rights Reserved.
# 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"),
@@ -46,7 +46,7 @@ VERSION=$(MESA_MAJOR).$(MESA_MINOR)
# To enable profiling add -DPROFILE to the CFLAGS line. Be sure to set the
# MESA_PROFILE environment variable to enable printing of the profile report.
#
# If your system supports the X Shared Memory extension add -DUSE_XSHM to the
# If your system supports the X Shared Memory extension add -DSHM to the
# CFLAGS line and add -lXext to the XLIBS line.
#
# Some compilers complain about const parameters. Adding -DNO_CONST to the
@@ -183,7 +183,7 @@ freebsd:
"GLUT_LIB = libglut.a" \
"GLW_LIB = libGLw.a" \
"CC = gcc" \
"CFLAGS = -O2 -fPIC -pedantic -I/usr/X11R6/include -DUSE_XSHM -DHZ=100" \
"CFLAGS = -O2 -fPIC -pedantic -I/usr/X11R6/include -DSHM -DHZ=100" \
"MAKELIB = ../bin/mklib.freebsd" \
"XLIBS = -L/usr/X11R6/lib -lXext -lXmu -lXi -lX11 -lm"
@@ -194,7 +194,7 @@ freebsd-386:
"GLUT_LIB = libglut.a" \
"GLW_LIB = libGLw.a" \
"CC = gcc" \
"CFLAGS = -O3 -ffast-math -fPIC -pedantic -I/usr/X11R6/include -DUSE_XSHM -DHZ=100 -DUSE_X86_ASM -DFREEBSD" \
"CFLAGS = -O3 -ffast-math -fPIC -pedantic -I/usr/X11R6/include -DSHM -DHZ=100 -DUSE_X86_ASM -DFREEBSD" \
"MAKELIB = ../bin/mklib.freebsd" \
"XLIBS = -L/usr/X11R6/lib -lXext -lXmu -lXi -lX11 -lm" \
"ASM_SOURCES = X86/x86a.S X86/common_x86asm.S"
@@ -217,7 +217,7 @@ hpux9:
"GLUT_LIB = libglut.a" \
"GLW_LIB = libGLw.a" \
"CC = cc" \
"CFLAGS = +O3 -Aa -D_HPUX_SOURCE -I/usr/include/X11R5 -DUSE_XSHM" \
"CFLAGS = +O3 -Aa -D_HPUX_SOURCE -I/usr/include/X11R5 -DSHM" \
"MAKELIB = ../bin/mklib.ar-ruv" \
"XLIBS = -L/usr/lib/X11R5 -lXext -lXmu -lXi -lX11 -lm"
@@ -228,7 +228,7 @@ hpux9-gcc:
"GLUT_LIB = libglut.a" \
"GLW_LIB = libGLw.a" \
"CC = gcc" \
"CFLAGS = -ansi -O3 -D_HPUX_SOURCE -I/usr/include/X11R5 -DUSE_XSHM" \
"CFLAGS = -ansi -O3 -D_HPUX_SOURCE -I/usr/include/X11R5 -DSHM" \
"MAKELIB = ../bin/mklib.ar-ruv" \
"XLIBS = -L/usr/lib/X11R5 -lXext -lXmu -lXi -lX11 -lm"
@@ -239,7 +239,7 @@ hpux9-sl:
"GLUT_LIB = libglut.sl" \
"GLW_LIB = libGLw.sl" \
"CC = cc" \
"CFLAGS = +z +O3 +Olibcalls +ESlit -Aa +Onolimit -D_HPUX_SOURCE -I/usr/include/X11R5 -DUSE_XSHM" \
"CFLAGS = +z +O3 +Olibcalls +ESlit -Aa +Onolimit -D_HPUX_SOURCE -I/usr/include/X11R5 -DSHM" \
"MAKELIB = ../bin/mklib.hpux" \
"XLIBS = -L/usr/lib/X11R5 -s -Wl,+s,-B,nonfatal,-B,immediate -lXext -lXmu -lXi -lX11 -lm"
@@ -250,7 +250,7 @@ hpux9-gcc-sl:
"GLUT_LIB = libglut.sl" \
"GLW_LIB = libGLw.sl" \
"CC = gcc" \
"CFLAGS = -fPIC -ansi -O3 -D_HPUX_SOURCE -I/usr/include/X11R5 -DUSE_XSHM" \
"CFLAGS = -fPIC -ansi -O3 -D_HPUX_SOURCE -I/usr/include/X11R5 -DSHM" \
"MAKELIB = ../bin/mklib.hpux" \
"XLIBS = -L/usr/lib/X11R5 -lXext -lXmu -lXi -lX11 -lm"
@@ -261,7 +261,7 @@ hpux10:
"GLUT_LIB = libglut.a" \
"GLW_LIB = libGLw.a" \
"CC = cc" \
"CFLAGS = +O3 +DAportable -Aa -D_HPUX_SOURCE -I/usr/include/X11R6 -I/usr/contrib/X11R6/include -DUSE_XSHM" \
"CFLAGS = +O3 +DAportable -Aa -D_HPUX_SOURCE -I/usr/include/X11R6 -I/usr/contrib/X11R6/include -DSHM" \
"MAKELIB = ../bin/mklib.ar-ruv" \
"XLIBS = -L/usr/lib/X11R6 -L/usr/contrib/X11R6/lib -lXext -lXmu -lXi -lX11 -lm"
@@ -272,7 +272,7 @@ hpux10-sl:
"GLUT_LIB = libglut" \
"GLW_LIB = libGLw.a" \
"CC = cc" \
"CFLAGS = +z -Ae +O2 +Onolimit +Oaggressive -D_HPUX_SOURCE -I/usr/include/X11R6 -I/usr/contrib/X11R6/include -DUSE_XSHM" \
"CFLAGS = +z -Ae +O2 +Onolimit +Oaggressive -D_HPUX_SOURCE -I/usr/include/X11R6 -I/usr/contrib/X11R6/include -DSHM" \
"MAKELIB = ../bin/mklib.hpux" \
"XLIBS = -L/usr/lib/X11R6 -L/usr/contrib/X11R6/lib -lXext -lXmu -lXi -lX11 -lm"
@@ -283,7 +283,7 @@ hpux10-gcc:
"GLUT_LIB = libglut.a" \
"GLW_LIB = libGLw.a" \
"CC = gcc" \
"CFLAGS = -ansi -O3 -D_HPUX_SOURCE -I/usr/include/X11R6 -I/usr/contrib/X11R6/include -DUSE_XSHM" \
"CFLAGS = -ansi -O3 -D_HPUX_SOURCE -I/usr/include/X11R6 -I/usr/contrib/X11R6/include -DSHM" \
"MAKELIB = ../bin/mklib.ar-ruv" \
"XLIBS = -L/usr/lib/X11R6 -L/usr/contrib/X11R6/lib -lXext -lXmu -lXi -lX11 -lm"
@@ -294,7 +294,7 @@ hpux10-gcc-sl:
"GLUT_LIB = libglut.sl" \
"GLW_LIB = libGLw.a" \
"CC = gcc" \
"CFLAGS = -fPIC -ansi -O3 -D_HPUX_SOURCE -I/usr/include/X11R6 -I/usr/contrib/X11R6/include -DUSE_XSHM" \
"CFLAGS = -fPIC -ansi -O3 -D_HPUX_SOURCE -I/usr/include/X11R6 -I/usr/contrib/X11R6/include -DSHM" \
"MAKELIB = ../bin/mklib.hpux" \
"XLIBS = -L/usr/lib/X11R6 -L/usr/contrib/X11R6/lib -lXext -lXmu -lXi -lX11 -lm"
@@ -307,7 +307,7 @@ irix4:
"GLUT_LIB = libglut.a" \
"GLW_LIB = libGLw.a" \
"CC = cc" \
"CFLAGS = -O2 -ansi -prototypes -DUSE_XSHM" \
"CFLAGS = -O2 -ansi -prototypes -DSHM" \
"MAKELIB = ../bin/mklib.ar-rcv" \
"XLIBS = -lXext -lXmu -lXi -lX11 -lm"
@@ -319,7 +319,7 @@ irix5:
"GLUT_LIB = libglut.a" \
"GLW_LIB = libGLw.a" \
"CC = cc" \
"CFLAGS = -O2 -ansi -fullwarn -DUSE_XSHM -DNO_CONST" \
"CFLAGS = -O2 -ansi -fullwarn -DSHM -DNO_CONST" \
"MAKELIB = ../bin/mklib.ar-rcv" \
"XLIBS = -lX11 -lXext -lXmu -lXi -lm"
@@ -331,7 +331,7 @@ irix5-gcc:
"GLUT_LIB = libglut.a" \
"GLW_LIB = libGLw.a" \
"CC = gcc" \
"CFLAGS = -O2 -pedantic -DUSE_XSHM" \
"CFLAGS = -O2 -pedantic -DSHM" \
"MAKELIB = ../bin/mklib.ar-rcv" \
"XLIBS = -lX11 -lXext -lXmu -lXi -lm"
@@ -343,7 +343,7 @@ irix5-dso:
"GLUT_LIB = libglut.so" \
"GLW_LIB = libGLw.so" \
"CC = cc" \
"CFLAGS = -O2 -ansi -fullwarn -DUSE_XSHM -DNO_CONST" \
"CFLAGS = -O2 -ansi -fullwarn -DSHM -DNO_CONST" \
"MAKELIB = ../bin/mklib.irix5" \
"XLIBS = -rpath ../lib -lX11 -lXmu -lXi -lm"
@@ -354,7 +354,7 @@ irix6-o32:
"GLUT_LIB = libglut.a" \
"GLW_LIB = libGLw.a" \
"CC = cc" \
"CFLAGS = -32 -mips2 -O2 -ansi -DUSE_XSHM -DNO_CONST" \
"CFLAGS = -32 -mips2 -O2 -ansi -DSHM -DNO_CONST" \
"MAKELIB = ../bin/mklib.ar-rcv" \
"XLIBS = -lX11 -lXext -lXmu -lXi -lm"
@@ -365,7 +365,7 @@ irix6-o32-dso:
"GLUT_LIB = libglut.so" \
"GLW_LIB = libGLw.so" \
"CC = cc" \
"CFLAGS = -32 -mips2 -O2 -ansi -DUSE_XSHM -DNO_CONST" \
"CFLAGS = -32 -mips2 -O2 -ansi -DSHM -DNO_CONST" \
"MAKELIB = ../bin/mklib.irix6-32" \
"XLIBS = -rpath ../lib -lX11 -lXext -lXmu -lXi -lm"
@@ -391,7 +391,7 @@ irix6-n32-dso:
"GLW_LIB = libGLw.a" \
"LIBDIR = ../lib32" \
"CC = cc" \
"CFLAGS = -n32 -mips3 -O3 -ansi -DUSE_XSHM -woff 1185,1521" \
"CFLAGS = -n32 -mips3 -O3 -ansi -DSHM -woff 1185,1521" \
"MAKELIB = ../bin/mklib.irix6-n32" \
"XLIBS = -rpath ../lib32 -lX11 -lXmu -lXi -lfpe -lm"
@@ -403,7 +403,7 @@ irix6-gcc-n32-sl:
"GLW_LIB = libGLw.so" \
"LIBDIR = ../lib32" \
"CC = gcc" \
"CFLAGS = -mabi=n32 -mips3 -O3 -DUSE_XSHM" \
"CFLAGS = -mabi=n32 -mips3 -O3 -DSHM" \
"MAKELIB = ../bin/mklib.irix6-n32" \
"XLIBS = -rpath ../lib32 -lX11 -lXmu -lXi -lm"
@@ -423,7 +423,7 @@ irix6-64:
"GLW_LIB = libGLw.a" \
"LIBDIR = ../lib64" \
"CC = cc" \
"CFLAGS = -64 -O3 -ansi -woff 1068,1069,1174,1185,1209,1474,1552 -DUSE_XSHM" \
"CFLAGS = -64 -O3 -ansi -woff 1068,1069,1174,1185,1209,1474,1552 -DSHM" \
"MAKELIB = ../bin/mklib.ar-rcv" \
"XLIBS = -lX11 -lXext -lXmu -lXi -lm"
@@ -435,12 +435,12 @@ irix6-64-dso:
"GLW_LIB = libGLw.so" \
"LIBDIR = ../lib64" \
"CC = cc" \
"CFLAGS = -64 -O3 -ansi -woff 1068,1069,1174,1185,1209,1474,1552 -DUSE_XSHM" \
"CFLAGS = -64 -O3 -ansi -woff 1068,1069,1174,1185,1209,1474,1552 -DSHM" \
"MAKELIB = ../bin/mklib.irix6-64" \
"XLIBS = -rpath ../lib64 -lX11 -lXmu -lXi -lm"
# May want to try these CFLAGS for better performance under Linux and GCC:
# -fPIC -O2 -ansi -pedantic -mieee-fp -DUSE_XSHM -funroll-loops
# -fPIC -O2 -ansi -pedantic -mieee-fp -DSHM -funroll-loops
# -fexpensive-optimizations -fomit-frame-pointer -ffast-math
# and -malign-loops=2 -malign-jumps=2 -malign-functions=2 for Pentium
@@ -451,7 +451,7 @@ linux:
"GLUT_LIB = libglut.a" \
"GLW_LIB = libGLw.a" \
"CC = gcc" \
"CFLAGS = -O2 -funroll-loops -ansi -pedantic -ffast-math -D_SVID_SOURCE -D_BSD_SOURCE -DUSE_XSHM -I/usr/X11R6/include" \
"CFLAGS = -O3 -funroll-loops -ansi -pedantic -ffast-math -D_SVID_SOURCE -D_BSD_SOURCE -DSHM -I/usr/X11R6/include" \
"MAKELIB = ../bin/mklib.ar-ruv" \
"XLIBS = -L/usr/X11R6/lib -lX11 -lXext -lXmu -lXt -lXi -lSM -lICE -lm"
@@ -465,7 +465,7 @@ linux-elf:
"GLUT_LIB = libglut.so" \
"GLW_LIB = libGLw.so" \
"CC = gcc" \
"CFLAGS = -O3 -ansi -pedantic -fPIC -ffast-math -D_SVID_SOURCE -D_BSD_SOURCE -DUSE_XSHM -I/usr/X11R6/include" \
"CFLAGS = -O3 -ansi -pedantic -fPIC -ffast-math -D_SVID_SOURCE -D_BSD_SOURCE -DSHM -I/usr/X11R6/include" \
"MAKELIB = ../bin/mklib.linux" \
"XLIBS = -L/usr/X11R6/lib -lX11 -lXext -lXmu -lXt -lXi -lSM -lICE -lm"
@@ -476,7 +476,7 @@ linux-glide:
"GLUT_LIB = libglut.so" \
"GLW_LIB = libGLw.so" \
"CC = gcc" \
"CFLAGS = -O3 -ansi -pedantic -fPIC -ffast-math -D_SVID_SOURCE -D_BSD_SOURCE -DUSE_XSHM -DFX -I/usr/X11R6/include -I/usr/include/glide -I/usr/local/glide/include" \
"CFLAGS = -O3 -ansi -pedantic -fPIC -ffast-math -D_SVID_SOURCE -D_BSD_SOURCE -DSHM -DFX -I/usr/X11R6/include -I/usr/include/glide -I/usr/local/glide/include" \
"MAKELIB = ../bin/mklib.linux" \
"XLIBS = -L/usr/X11R6/lib -lX11 -lXext -lXmu -lXt -lXi -lSM -lICE -L/usr/local/glide/lib -lglide2x -lm"
@@ -488,7 +488,7 @@ linux-386:
"GLUT_LIB = libglut.a" \
"GLW_LIB = libGLw.a" \
"CC = gcc" \
"CFLAGS = -O2 -funroll-loops -ansi -pedantic -ffast-math -D_SVID_SOURCE -D_BSD_SOURCE -DUSE_XSHM -DUSE_X86_ASM -I/usr/X11R6/include" \
"CFLAGS = -O3 -funroll-loops -ansi -pedantic -ffast-math -D_SVID_SOURCE -D_BSD_SOURCE -DSHM -DUSE_X86_ASM -I/usr/X11R6/include" \
"MAKELIB = ../bin/mklib.ar-ruv" \
"XLIBS = -L/usr/X11R6/lib -lX11 -lXext -lXmu -lXt -lXi -lSM -lICE -lm" \
"ASM_SOURCES = X86/x86a.S X86/common_x86asm.S X86/vertex.S"
@@ -500,7 +500,7 @@ linux-386-elf:
"GLUT_LIB = libglut.so" \
"GLW_LIB = libGLw.so" \
"CC = gcc" \
"CFLAGS = -O3 -ansi -pedantic -fPIC -ffast-math -D_SVID_SOURCE -D_BSD_SOURCE -DUSE_XSHM -DUSE_X86_ASM -I/usr/X11R6/include" \
"CFLAGS = -O3 -ansi -pedantic -fPIC -ffast-math -D_SVID_SOURCE -D_BSD_SOURCE -DSHM -DUSE_X86_ASM -I/usr/X11R6/include" \
"MAKELIB = ../bin/mklib.linux" \
"XLIBS = -L/usr/X11R6/lib -lX11 -lXext -lXmu -lXt -lXi -lSM -lICE -lm" \
"ASM_SOURCES = X86/x86a.S X86/common_x86asm.S X86/vertex.S"
@@ -512,7 +512,7 @@ linux-386-glide:
"GLUT_LIB = libglut.so" \
"GLW_LIB = libGLw.so" \
"CC = gcc" \
"CFLAGS = -O3 -ansi -pedantic -fPIC -ffast-math -D_SVID_SOURCE -D_BSD_SOURCE -DUSE_X86_ASM -DUSE_XSHM -DFX -I/usr/X11R6/include -I/usr/include/glide -I/usr/local/glide/include" \
"CFLAGS = -O3 -ansi -pedantic -fPIC -ffast-math -D_SVID_SOURCE -D_BSD_SOURCE -DUSE_X86_ASM -DSHM -DFX -I/usr/X11R6/include -I/usr/include/glide -I/usr/local/glide/include" \
"MAKELIB = ../bin/mklib.linux" \
"XLIBS = -L/usr/X11R6/lib -lX11 -lXext -lXmu -lXt -lXi -lSM -lICE -L/usr/local/glide/lib -lglide2x -lm" \
"ASM_SOURCES = X86/x86a.S X86/common_x86asm.S X86/vertex.S"
@@ -524,7 +524,7 @@ linux-386-glide-mits:
"GLUT_LIB = libglut.so" \
"GLW_LIB = libGLw.so" \
"CC = gcc" \
"CFLAGS = -O3 -ansi -pedantic -fPIC -ffast-math -D_SVID_SOURCE -D_BSD_SOURCE -DUSE_XSHM -DFX -D_REENTRANT -DMITS -DUSE_X86_ASM -I/usr/X11R6/include -I/usr/include/glide -I/usr/local/glide/include" \
"CFLAGS = -O3 -ansi -pedantic -fPIC -ffast-math -D_SVID_SOURCE -D_BSD_SOURCE -DSHM -DFX -D_REENTRANT -DMITS -DUSE_X86_ASM -I/usr/X11R6/include -I/usr/include/glide -I/usr/local/glide/include" \
"MAKELIB = ../bin/mklib.linux" \
"XLIBS = -L/usr/X11R6/lib -lX11 -lXext -lXmu -lXt -lXi -lSM -lICE -L/usr/local/glide/lib -lglide2x -lm -lpthread" \
"ASM_SOURCES = X86/x86a.S X86/common_x86asm.S X86/vertex.S"
@@ -536,7 +536,7 @@ linux-386-opt-V2-glide:
"GLUT_LIB = libglut.so" \
"GLW_LIB = libGLw.so" \
"CC = gcc" \
"CFLAGS = -O3 -m486 -fomit-frame-pointer -pipe -ansi -pedantic -ffast-math -fexpensive-optimizations -malign-loops=2 -malign-jumps=2 -malign-functions=2 -D_SVID_SOURCE -D_BSD_SOURCE -DUSE_XSHM -DFX -DFX_V2 -DUSE_X86_ASM -I/usr/X11R6/include -I/usr/include/glide -I/usr/local/glide/include"\
"CFLAGS = -O3 -m486 -fomit-frame-pointer -pipe -ansi -pedantic -ffast-math -fexpensive-optimizations -malign-loops=2 -malign-jumps=2 -malign-functions=2 -D_SVID_SOURCE -D_BSD_SOURCE -DSHM -DFX -DFX_V2 -DUSE_X86_ASM -I/usr/X11R6/include -I/usr/include/glide -I/usr/local/glide/include"\
"MAKELIB = ../bin/mklib.linux" \
"XLIBS = -L/usr/X11R6/lib -lX11 -lXext -lXmu -lXt -lXi -lSM -lICE -L/usr/local/glide/lib -lglide2x -lm -lpthread" \
"ASM_SOURCES = X86/x86a.S X86/common_x86asm.S X86/vertex.S"
@@ -548,7 +548,7 @@ linux-386-opt-glide:
"GLUT_LIB = libglut.so" \
"GLW_LIB = libGLw.so" \
"CC = gcc" \
"CFLAGS = -O3 -m486 -fomit-frame-pointer -pipe -ansi -pedantic -ffast-math -fexpensive-optimizations -malign-loops=2 -malign-jumps=2 -malign-functions=2 -D_SVID_SOURCE -D_BSD_SOURCE -DUSE_XSHM -DFX -DUSE_X86_ASM -I/usr/X11R6/include -I/usr/include/glide -I/usr/local/glide/include" \
"CFLAGS = -O3 -m486 -fomit-frame-pointer -pipe -ansi -pedantic -ffast-math -fexpensive-optimizations -malign-loops=2 -malign-jumps=2 -malign-functions=2 -D_SVID_SOURCE -D_BSD_SOURCE -DSHM -DFX -DUSE_X86_ASM -I/usr/X11R6/include -I/usr/include/glide -I/usr/local/glide/include" \
"MAKELIB = ../bin/mklib.linux" \
"XLIBS = -L/usr/X11R6/lib -lX11 -lXext -lXmu -lXt -lXi -lSM -lICE -L/usr/local/glide/lib -lglide2x -lm" \
"ASM_SOURCES = X86/x86a.S X86/common_x86asm.S X86/vertex.S"
@@ -560,7 +560,7 @@ linux-3dnow:
"GLUT_LIB = libglut.so" \
"GLW_LIB = libGLw.so" \
"CC = gcc -malign-loops=2 -malign-jumps=2 -malign-functions=2" \
"CFLAGS = -Wall -O3 -ansi -pedantic -fPIC -ffast-math -funroll-loops -fomit-frame-pointer -D_SVID_SOURCE -D_BSD_SOURCE -DUSE_XSHM -DUSE_X86_ASM -DUSE_MMX_ASM -DUSE_3DNOW_ASM -I/usr/X11R6/include" \
"CFLAGS = -Wall -O3 -ansi -pedantic -fPIC -ffast-math -funroll-loops -fomit-frame-pointer -D_SVID_SOURCE -D_BSD_SOURCE -DSHM -DUSE_X86_ASM -DUSE_MMX_ASM -DUSE_3DNOW_ASM -I/usr/X11R6/include" \
"MAKELIB = ../bin/mklib.linux" \
"XLIBS = -L/usr/X11R6/lib -lX11 -lXext -lXmu -lXt -lXi -lSM -lICE -lm" \
"ASM_SOURCES = X86/x86a.S X86/common_x86asm.S \
@@ -578,7 +578,7 @@ linux-3dnow-glide:
"GLUT_LIB = libglut.so" \
"GLW_LIB = libGLw.so" \
"CC = gcc -malign-loops=2 -malign-jumps=2 -malign-functions=2" \
"CFLAGS = -O3 -ansi -pedantic -fPIC -ffast-math -funroll-loops -fomit-frame-pointer -D_SVID_SOURCE -D_BSD_SOURCE -DUSE_X86_ASM -DUSE_MMX_ASM -DUSE_3DNOW_ASM -DUSE_XSHM -DFX -I/usr/X11R6/include -I/usr/include/glide -I/usr/local/glide/include -I/usr/src/mesa-glx/src/FX/X86" \
"CFLAGS = -O3 -ansi -pedantic -fPIC -ffast-math -funroll-loops -fomit-frame-pointer -D_SVID_SOURCE -D_BSD_SOURCE -DUSE_X86_ASM -DUSE_MMX_ASM -DUSE_3DNOW_ASM -DSHM -DFX -I/usr/X11R6/include -I/usr/include/glide -I/usr/local/glide/include -I/usr/src/mesa-glx/src/FX/X86" \
"MAKELIB = ../bin/mklib.linux" \
"XLIBS = -L/usr/X11R6/lib -lX11 -lXext -lXmu -lXt -lXi -lSM -lICE -L/usr/local/glide/lib -lglide2x -lm" \
"ASM_SOURCES = X86/x86a.S X86/common_x86asm.S \
@@ -598,7 +598,7 @@ linux-386-pthread-shared-glide:
"GLU_LIB = libGLU.so" \
"GLUT_LIB = libglut.so" \
"CC = gcc" \
"CFLAGS = -O3 -fPIC -funroll-loops -ansi -pedantic -ffast-math -D_SVID_SOURCE -D_BSD_SOURCE -I/usr/X11R6/include -DUSE_XSHM -DUSE_X86_ASM -D_REENTRANT -DTHREADS -DPTHREADS -DFX -I/usr/include/glide -I/usr/local/glide/include" \
"CFLAGS = -O3 -fPIC -funroll-loops -ansi -pedantic -ffast-math -D_SVID_SOURCE -D_BSD_SOURCE -I/usr/X11R6/include -DSHM -DUSE_X86_ASM -D_REENTRANT -DTHREADS -DPTHREADS -DFX -I/usr/include/glide -I/usr/local/glide/include" \
"MAKELIB = ../mklib.glide" \
"XLIBS = -L/usr/X11/lib -L/usr/X11R6/lib -lX11 -lXext -lXmu -lXt -lXi -lSM -lICE -lpthread -lm" \
"ASM_SOURCES = X86/x86a.S X86/common_x86asm.S \
@@ -612,7 +612,7 @@ linux-ggi:
"GLUT_LIB = libglut.so" \
"GLW_LIB = libGLw.a" \
"CC = gcc" \
"CFLAGS = -O3 -fPIC -ffast-math -D_SVID_SOURCE -D_BSD_SOURCE -I/usr/X11R6/include -DUSE_XSHM -DGGI -DCDECL=" \
"CFLAGS = -O3 -fPIC -ffast-math -D_SVID_SOURCE -D_BSD_SOURCE -I/usr/X11R6/include -DSHM -DGGI -DCDECL=" \
"MAKELIB = ../bin/mklib.ggi" \
"XLIBS = -L/usr/X11R6/lib -lX11 -lXext -lXmu -lXt -lXi -lSM -lICE -lggi -lm"
@@ -624,7 +624,7 @@ linux-386-ggi:
"GLUT_LIB = libglut.so" \
"GLW_LIB = libGLw.so" \
"CC = gcc" \
"CFLAGS = -O3 -fPIC -ffast-math -D_SVID_SOURCE -D_BSD_SOURCE -I/usr/X11R6/include -DUSE_XSHM -DUSE_X86_ASM -DGGI -DCDECL=" \
"CFLAGS = -O3 -fPIC -ffast-math -D_SVID_SOURCE -D_BSD_SOURCE -I/usr/X11R6/include -DSHM -DUSE_X86_ASM -DGGI -DCDECL=" \
"MAKELIB = ../bin/mklib.ggi" \
"XLIBS = -L/usr/X11R6/lib -lX11 -lXext -lXmu -lXt -lXi -lSM -lICE -lggi -lm" \
"ASM_SOURCES = X86/x86a.S X86/common_x86asm.S X86/vertex.S"
@@ -634,10 +634,10 @@ linux-alpha:
$(MAKE) $(MFLAGS) -f Makefile.X11 targets \
"GL_LIB = libGL.a" \
"GLU_LIB = libGLU.a" \
"GLUT_LIB = libglut.so" \
"GLUT_LIB = libglut.a" \
"GLW_LIB = libGLw.a" \
"CC = gcc" \
"CFLAGS = -O2 -mieee -pedantic -L/usr/X11R6/lib -D_XOPEN_SOURCE -DUSE_XSHM" \
"CFLAGS = -O3 -mcpu=ev5 -ansi -mieee -pedantic -L/usr/X11R6/lib -D_XOPEN_SOURCE -DSHM" \
"MAKELIB = ../bin/mklib.ar-ruv" \
"XLIBS = -L/usr/X11R6/lib -lX11 -lm"
@@ -648,7 +648,7 @@ linux-alpha-elf:
"GLUT_LIB = libglut.so" \
"GLW_LIB = libGLw.so" \
"CC = gcc" \
"CFLAGS = -ansi -mieee -pedantic -fPIC -D_XOPEN_SOURCE -DUSE_XSHM" \
"CFLAGS = -O3 -mcpu=ev5 -ansi -mieee -pedantic -fPIC -D_XOPEN_SOURCE -DSHM" \
"MAKELIB = ../bin/mklib.linux" \
"XLIBS = -L/usr/X11R6/lib -lX11 -lXext -lXmu -lXi -lm"
@@ -664,7 +664,7 @@ linux-ppc:
"GLUT_LIB = libglut.a" \
"GLW_LIB = libGLw.a" \
"CC = gcc" \
"CFLAGS = -O3 -mcpu=603 -ansi -pedantic -fsigned-char -ffast-math -funroll-loops -D_SVID_SOURCE -D_BSD_SOURCE -I/usr/X11R6/include -DUSE_XSHM" \
"CFLAGS = -O3 -mcpu=603 -ansi -pedantic -fsigned-char -ffast-math -funroll-loops -D_SVID_SOURCE -D_BSD_SOURCE -I/usr/X11R6/include -DSHM" \
"MAKELIB = ../bin/mklib.ar-ruv" \
"XLIBS = -L/usr/X11R6/lib -lX11 -lXext -lXmu -lXt -lXi -lSM -lICE -lm"
@@ -676,7 +676,7 @@ linux-ppc-so:
"GLUT_LIB = libglut.so" \
"GLW_LIB = libGLw.so" \
"CC = gcc" \
"CFLAGS = -O3 -mcpu=603 -ansi -pedantic -fPIC -fsigned-char -ffast-math -funroll-loops -D_SVID_SOURCE -D_BSD_SOURCE -I/usr/X11R6/include -DUSE_XSHM" \
"CFLAGS = -O3 -mcpu=603 -ansi -pedantic -fPIC -fsigned-char -ffast-math -funroll-loops -D_SVID_SOURCE -D_BSD_SOURCE -I/usr/X11R6/include -DSHM" \
"MAKELIB = ../bin/mklib.linux" \
"XLIBS = -L/usr/X11R6/lib -lX11 -lXext -lXmu -lXt -lXi -lSM -lICE -lm"
@@ -687,7 +687,7 @@ linux-386-pthread:
"GLU_LIB = libGLU.a" \
"GLUT_LIB = libglut.a" \
"CC = gcc" \
"CFLAGS = -O2 -funroll-loops -ansi -pedantic -ffast-math -D_SVID_SOURCE -D_BSD_SOURCE -I/usr/X11R\6/include -DUSE_XSHM -DUSE_X86_ASM -D_REENTRANT -DTHREADS -DPTHREADS" \
"CFLAGS = -O3 -funroll-loops -ansi -pedantic -ffast-math -D_SVID_SOURCE -D_BSD_SOURCE -I/usr/X11R\6/include -DSHM -DUSE_X86_ASM -D_REENTRANT -DTHREADS -DPTHREADS" \
"MAKELIB = ../bin/mklib.ar-ruv" \
"XLIBS = -L/usr/X11R6/lib -lX11 -lXext -lXmu -lXt -lXi -lSM -lICE -lpthread -lm" \
"ASM_SOURCES = X86/x86a.S X86/common_x86asm.S X86/vertex.S"
@@ -699,7 +699,7 @@ linux-386-pthread-shared:
"GLU_LIB = libGLU.so" \
"GLUT_LIB = libglut.so" \
"CC = gcc" \
"CFLAGS = -O3 -fPIC -funroll-loops -ansi -pedantic -ffast-math -D_SVID_SOURCE -D_BSD_SOURCE -I/us\r/X11R6/include -DUSE_XSHM -DUSE_X86_ASM -D_REENTRANT -DTHREADS -DPTHREADS" \
"CFLAGS = -O3 -fPIC -funroll-loops -ansi -pedantic -ffast-math -D_SVID_SOURCE -D_BSD_SOURCE -I/us\r/X11R6/include -DSHM -DUSE_X86_ASM -D_REENTRANT -DTHREADS -DPTHREADS" \
"MAKELIB = ../bin/mklib.linux" \
"XLIBS = -L/usr/X11R6/lib -lX11 -lXext -lXmu -lXt -lXi -lSM -lICE -lpthread -lm" \
"ASM_SOURCES = X86/x86a.S X86/common_x86asm.S X86/vertex.S"
@@ -711,7 +711,7 @@ linux-sparc:
"GLUT_LIB = libglut.a" \
"GLW_LIB = libGLw.a" \
"CC = gcc" \
"CFLAGS = -pedantic -funroll-loops -O3 -DUSE_XSHM" \
"CFLAGS = -pedantic -funroll-loops -O3 -DSHM" \
"MAKELIB = ../bin/mklib.ar-ruv" \
"XLIBS = -L/usr/X11R6/lib -lX11 -lXext -lXt -lSM -lICE -lXmu -lXi -lm"
@@ -723,7 +723,7 @@ linux-sparc5-elf:
"GLUT_LIB = libglut.so" \
"GLW_LIB = libGLw.so" \
"CC = gcc" \
"CFLAGS = -mv8 -O2 -ffast-math -ansi -pedantic -fPIC -D_SVID_SOURCE -D_BSD_SOURCE -I/usr/X11R6/include -DUSE_XSHM" \
"CFLAGS = -mv8 -O3 -ffast-math -ansi -pedantic -fPIC -D_SVID_SOURCE -D_BSD_SOURCE -I/usr/X11R6/include -DSHM" \
"MAKELIB = ../bin/mklib.linux" \
"XLIBS = -L/usr/X11R6/lib -lX11 -lXext -lXmu -lXt -lXi -lSM -lICE -lm"
@@ -735,12 +735,12 @@ linux-sparc-ultra:
"GLUT_LIB = libglut.so" \
"GLW_LIB = libGLw.so" \
"CC = gcc" \
"CFLAGS = -mv8 -O2 -mtune=ultrasparc -ansi -pedantic -fPIC -D_SVID_SOURCE -D_BSD_SOURCE -I/usr/X11R6/include -DUSE_XSHM" \
"CFLAGS = -mv8 -O3 -mtune=ultrasparc -ansi -pedantic -fPIC -D_SVID_SOURCE -D_BSD_SOURCE -I/usr/X11R6/include -DSHM" \
"MAKELIB = ../bin/mklib.linux" \
"XLIBS = -L/usr/X11R6/lib -lX11 -lXext -lXmu -lXt -lXi -lSM -lICE -lm"
# May want to add these CFLAGS for better performance under LynxOS and GCC:
# -fPIC -O2 -ansi -pedantic -mieee-fp -DUSE_XSHM -funroll-loops
# -fPIC -O2 -ansi -pedantic -mieee-fp -DSHM -funroll-loops
# -fexpensive-optimizations -fomit-frame-pointer -ffast-math
# and -malign-loops=2 -malign-jumps=2 -malign-functions=2 for Pentium
@@ -751,7 +751,7 @@ lynxos:
"GLUT_LIB = libglut.a" \
"GLW_LIB = libGLw.a" \
"CC = gcc" \
"CFLAGS = -O2 -ansi -pedantic -funroll-loops -ffast-math -DUSE_XSHM" \
"CFLAGS = -O2 -ansi -pedantic -funroll-loops -ffast-math -DSHM" \
"MAKELIB = ../bin/mklib.ar-ruv" \
"XLIBS = -L/usr/X11/lib -lXext -lXi -lXmu -lX11 -lbsd -lm"
@@ -795,7 +795,7 @@ netbsd:
"GLUT_LIB = libglut.so" \
"GLW_LIB = libGLw.so" \
"CC = gcc" \
"CFLAGS = -O2 -fPIC -DUSE_XSHM -I/usr/X11R6/include -DHZ=100" \
"CFLAGS = -O3 -fPIC -DSHM -I/usr/X11R6/include -DHZ=100" \
"MAKELIB = ../bin/mklib.netbsd" \
"XLIBS = -L/usr/X11R6/lib -lXext -lXmu -lXi -lX11 -lm"
@@ -815,7 +815,7 @@ openbsd:
"GLUT_LIB = libglut.so" \
"GLW_LIB = libGLw.so" \
"CC = cc" \
"CFLAGS = -O2 -fPIC -I/usr/X11R6/include -DUSE_XSHM -DHZ=100" \
"CFLAGS = -O2 -fPIC -I/usr/X11R6/include -DSHM -DHZ=100" \
"MAKELIB = ../bin/mklib.openbsd" \
"XLIBS = -L/usr/X11R6/lib -lX11 -lXext -lXmu -lXi -lm"
@@ -856,7 +856,7 @@ osf1:
"GLUT_LIB = libglut.a" \
"GLW_LIB = libGLw.a" \
"CC = cc" \
"CFLAGS = -O2 -std1 -ieee_with_no_inexact -DUSE_XSHM -DNO_CONST" \
"CFLAGS = -O0 -std1 -ieee_with_no_inexact -DSHM" \
"MAKELIB = ../bin/mklib.ar-ruv" \
"XLIBS = -lX11 -lXext -lXmu -lXi -lm"
@@ -867,7 +867,7 @@ osf1-sl:
"GLUT_LIB = libglut.so" \
"GLW_LIB = libGLw.so" \
"CC = cc" \
"CFLAGS = -O2 -std1 -ieee_with_no_inexact -DUSE_XSHM -DNO_CONST" \
"CFLAGS = -O0 -std1 -ieee_with_no_inexact -DSHM" \
"MAKELIB = ../bin/mklib.osf1" \
"XLIBS = -lX11 -lXext -lXmu -lXi -lm"
@@ -934,7 +934,7 @@ solaris-x86:
"GLUT_LIB = libglut.a" \
"GLW_LIB = libGLw.a" \
"CC = cc" \
"CFLAGS = -Xa -xO3 -xpentium -KPIC -I/usr/openwin/include -DUSE_XSHM" \
"CFLAGS = -Xa -xO3 -xpentium -KPIC -I/usr/openwin/include -DSHM" \
"MAKELIB = ../bin/mklib.solaris" \
"XLIBS = -L/usr/openwin/lib -R/usr/openwin/lib -lX11 -lXext -lXmu -lXi -lm"
@@ -945,7 +945,7 @@ solaris-x86-gcc:
"GLUT_LIB = libglut.a" \
"GLW_LIB = libGLw.a" \
"CC = gcc" \
"CFLAGS = -O3 -m486 -fPIC -I/usr/openwin/include -DUSE_XSHM" \
"CFLAGS = -O3 -m486 -fPIC -I/usr/openwin/include -DSHM" \
"MAKELIB = ../bin/mklib.solaris" \
"XLIBS = -L/usr/openwin/lib -R/usr/openwin/lib -lX11 -lXext -lXmu -lXi -lm"
@@ -956,7 +956,7 @@ sunos4:
"GLUT_LIB = libglut.a" \
"GLW_LIB = libGLw.a" \
"CC = acc" \
"CFLAGS = -O -DUSE_XSHM -DSUNOS4" \
"CFLAGS = -O -DSHM -DSUNOS4" \
"MAKELIB = ../bin/mklib.ar-ruv" \
"XLIBS = -lX11 -lXext -lXmu -lXi -lm"
@@ -967,7 +967,7 @@ sunos4-sl:
"GLUT_LIB = libglut.so" \
"GLW_LIB = libGLw.so" \
"CC = acc" \
"CFLAGS = -Kpic -O -I/usr/include/X11R5 -DUSE_XSHM -DSUNOS4" \
"CFLAGS = -Kpic -O -I/usr/include/X11R5 -DSHM -DSUNOS4" \
"MAKELIB = ld -assert pure-text -o" \
"XLIBS = -L/usr/lib/X11R5 -lX11 -lXext -lXmu -lXi -lm"
@@ -978,7 +978,7 @@ sunos4-gcc:
"GLUT_LIB = libglut.a" \
"GLW_LIB = libGLw.a" \
"CC = gcc" \
"CFLAGS = -O3 -DUSE_XSHM -DSUNOS4 -I/usr/openwin/include" \
"CFLAGS = -O3 -DSHM -DSUNOS4 -I/usr/openwin/include" \
"MAKELIB = ../bin/mklib.ar-ruv" \
"XLIBS = -L/usr/openwin/lib -lX11 -lXext -lXmu -lXi -lm"
@@ -989,7 +989,7 @@ sunos4-gcc-sl:
"GLUT_LIB = libglut.so" \
"GLW_LIB = libGLw.so" \
"CC = gcc" \
"CFLAGS = -fPIC -O3 -I/usr/openwin/include -I/usr/include/X11R5 -I/usr/include/X11R5 -DUSE_XSHM -DSUNOS4 -DSOLARIS_2_4_BUG" \
"CFLAGS = -fPIC -O3 -I/usr/openwin/include -I/usr/include/X11R5 -I/usr/include/X11R5 -DSHM -DSUNOS4 -DSOLARIS_2_4_BUG" \
"MAKELIB = ../bin/mklib.sunos4" \
"XLIBS = -L/usr/openwin/lib -lX11 -lXext -lXmu -lXi -lm"
@@ -1000,7 +1000,7 @@ sunos4-gcc-x11r6-sl:
"GLUT_LIB = libglut.so" \
"GLW_LIB = libGLw.so" \
"CC = gcc" \
"CFLAGS = -fPIC -O3 -I/usr/X11R6.3/include -DUSE_XSHM -DSUNOS4 -DSOLARIS_2_4_BUG" \
"CFLAGS = -fPIC -O3 -I/usr/X11R6.3/include -DSHM -DSUNOS4 -DSOLARIS_2_4_BUG" \
"MAKELIB = ../bin/mklib.sunos4" \
"XLIBS = -L/usr/X11R6.3/lib/X11 -lX11 -lXext -lXmu -lXi -lm"
@@ -1011,7 +1011,7 @@ sunos5:
"GLUT_LIB = libglut.a" \
"GLW_LIB = libGLw.a" \
"CC = cc" \
"CFLAGS = -Xa -fast -xO4 -native -I/usr/openwin/include -I/usr/dt/include -DUSE_XSHM -DSOLARIS_2_4_BUG" \
"CFLAGS = -Xa -fast -xO4 -native -I/usr/openwin/include -I/usr/dt/include -DSHM -DSOLARIS_2_4_BUG" \
"MAKELIB = ../bin/mklib.ar-ruv" \
"XLIBS = -L/usr/openwin/lib -L/usr/dt/lib -R/usr/openwin/lib -lX11 -lXext -lXmu -lXi -lm"
@@ -1022,7 +1022,7 @@ sunos5-sl:
"GLUT_LIB = libglut.so" \
"GLW_LIB = libGLw.so" \
"CC = cc" \
"CFLAGS = -KPIC -Xa -O -I/usr/openwin/include -I/usr/dt/include -DUSE_XSHM -DSOLARIS_2_4_BUG" \
"CFLAGS = -KPIC -Xa -O -I/usr/openwin/include -I/usr/dt/include -DSHM -DSOLARIS_2_4_BUG" \
"MAKELIB = ../bin/mklib.sunos5" \
"XLIBS = -L/usr/openwin/lib -L/usr/dt/lib -R/usr/openwin/lib -lX11 -lXext -lXmu -lXi -lm"
@@ -1033,7 +1033,7 @@ sunos5-ultra:
"GLUT_LIB = libglut.a" \
"GLW_LIB = libGLw.a" \
"CC = cc" \
"CFLAGS = -Xa -fast -xO5 -xtarget=ultra -I/usr/openwin/include -I/usr/dt/include -DUSE_XSHM -DSOLARIS_2_4_BUG" \
"CFLAGS = -Xa -fast -xO5 -xtarget=ultra -I/usr/openwin/include -I/usr/dt/include -DSHM -DSOLARIS_2_4_BUG" \
"MAKELIB = ../bin/mklib.ar-ruv" \
"XLIBS = -L/usr/openwin/lib -L/usr/dt/lib -R/usr/openwin/lib -lX11 -lXext -lXmu -lXi -lm"
@@ -1044,7 +1044,7 @@ sunos5-ultra-sl:
"GLUT_LIB = libglut.so" \
"GLW_LIB = libGLw.so" \
"CC = cc" \
"CFLAGS = -KPIC -Xa -fast -xO5 -xtarget=ultra -I/usr/openwin/include -I/usr/dt/include -DUSE_XSHM -DSOLARIS_2_4_BUG" \
"CFLAGS = -KPIC -Xa -fast -xO5 -xtarget=ultra -I/usr/openwin/include -I/usr/dt/include -DSHM -DSOLARIS_2_4_BUG" \
"MAKELIB = ../bin/mklib.sunos5" \
"XLIBS = -L/usr/openwin/lib -L/usr/dt/lib -R/usr/openwin/lib -lX11 -lXext -lXmu -lXi -lm"
@@ -1055,7 +1055,7 @@ sunos5-gcc:
"GLUT_LIB = libglut.a" \
"GLW_LIB = libGLw.a" \
"CC = gcc" \
"CFLAGS = -O3 -I/usr/openwin/include -DUSE_XSHM -DSOLARIS_2_4_BUG" \
"CFLAGS = -O3 -I/usr/openwin/include -DSHM -DSOLARIS_2_4_BUG" \
"MAKELIB = ../bin/mklib.ar-ruv" \
"XLIBS = -L/usr/openwin/lib -lX11 -lXext -lXmu -lXi -lm"
@@ -1066,7 +1066,7 @@ sunos5-gcc-sl:
"GLUT_LIB = libglut.so" \
"GLW_LIB = libGLw.so" \
"CC = gcc" \
"CFLAGS = -fPIC -O3 -I/usr/openwin/include -DUSE_XSHM -DSOLARIS_2_4_BUG" \
"CFLAGS = -fPIC -O3 -I/usr/openwin/include -DSHM -DSOLARIS_2_4_BUG" \
"MAKELIB = ../bin/mklib.sunos5" \
"XLIBS = -L/usr/openwin/lib -R/usr/openwin/lib -lX11 -lXext -lXmu -lXi -lm"
@@ -1077,7 +1077,7 @@ sunos5-x11r6-gcc-sl:
"GLUT_LIB = libglut.so" \
"GLW_LIB = libGLw.so" \
"CC = gcc" \
"CFLAGS = -fPIC -O3 -DUSE_XSHM -DSOLARIS_2_4_BUG" \
"CFLAGS = -fPIC -O3 -DSHM -DSOLARIS_2_4_BUG" \
"MAKELIB = ../bin/mklib.sunos5" \
"XLIBS = -lSM -lICE -lX11 -lXext -lXmu -lXi -lnsl -lsocket -lm"
@@ -1088,7 +1088,7 @@ sunos5-pthread:
"GLU_LIB = libGLU.a" \
"GLUT_LIB = libglut.a" \
"CC = cc" \
"CFLAGS = -mt -Xa -fast -xO4 -native -I/usr/openwin/include -I/usr/dt/include -DUSE_XSHM -DSOLARIS_2_4\_BUG -DTHREADS -DPTHREADS" \
"CFLAGS = -mt -Xa -fast -xO4 -native -I/usr/openwin/include -I/usr/dt/include -DSHM -DSOLARIS_2_4_BUG -DTHREADS -DPTHREADS" \
"MAKELIB = ../bin/mklib.ar-ruv" \
"XLIBS = -L/usr/openwin/lib -L/usr/dt/lib -R/usr/openwin/lib -lX11 -lXext -lXmu -lXi -lpthread -lm"
@@ -1099,7 +1099,7 @@ sunos5-thread:
"GLU_LIB = libGLU.a" \
"GLUT_LIB = libglut.a" \
"CC = cc" \
"CFLAGS = -mt -Xa -fast -xO4 -native -I/usr/openwin/include -I/usr/dt/include -DUSE_XSHM -DSOLARIS_2_4\_BUG -DTHREADS -DSOLARIS_THREADS" \
"CFLAGS = -mt -Xa -fast -xO4 -native -I/usr/openwin/include -I/usr/dt/include -DSHM -DSOLARIS_2_4_BUG -DTHREADS -DSOLARIS_THREADS" \
"MAKELIB = ../bin/mklib.ar-ruv" \
"XLIBS = -L/usr/openwin/lib -L/usr/dt/lib -R/usr/openwin/lib -lX11 -lXext -lXmu -lXi -lthread -lm"
@@ -1110,7 +1110,7 @@ sunos5-gcc-thread:
"GLU_LIB = libGLU.a" \
"GLUT_LIB = libglut.a" \
"CC = gcc" \
"CFLAGS = -O3 -I/usr/openwin/include -DUSE_XSHM -DSOLARIS_2_4_BUG -D_REENTRANT -DTHREADS -DSOLARIS_THREADS" \
"CFLAGS = -O3 -I/usr/openwin/include -DSHM -DSOLARIS_2_4_BUG -D_REENTRANT -DTHREADS -DSOLARIS_THR\EADS" \
"MAKELIB = ../bin/mklib.ar-ruv" \
"XLIBS = -L/usr/openwin/lib -lX11 -lXext -lXmu -lXi -lthread -lm"
@@ -1121,7 +1121,7 @@ sunos5-gcc-pthread:
"GLU_LIB = libGLU.a" \
"GLUT_LIB = libglut.a" \
"CC = gcc" \
"CFLAGS = -O3 -I/usr/openwin/include -DUSE_XSHM -DSOLARIS_2_4_BUG -D_REENTRANT -DTHREADS -DPTHREADS" \
"CFLAGS = -O3 -I/usr/openwin/include -DSHM -DSOLARIS_2_4_BUG -D_REENTRANT -DTHREADS -DPTHREADS" \
"MAKELIB = ../bin/mklib.ar-ruv" \
"XLIBS = -L/usr/openwin/lib -lX11 -lXext -lXmu -lXi -lpthread -lm"
@@ -1133,7 +1133,7 @@ sunSolaris-CC:
"GLUT_LIB = libglut.a" \
"GLW_LIB = libGLw.a" \
"CC = CC" \
"CFLAGS = -O -I/usr/openwin/include -DUSE_XSHM -DSOLARIS_2_4_BUG" \
"CFLAGS = -O -I/usr/openwin/include -DSHM -DSOLARIS_2_4_BUG" \
"MAKELIB = ../bin/mklib.ar-ruv" \
"XLIBS = -L/usr/openwin/lib -R/usr/openwin/lib -lX11 -lXext -lXmu -lXi -lm"
@@ -1179,7 +1179,7 @@ unixware:
"GLUT_LIB = libglut.a" \
"GLW_LIB = libGLw.a" \
"CC = cc" \
"CFLAGS = -O -I/usr/X/include -DUSE_XSHM" \
"CFLAGS = -O -I/usr/X/include -DSHM" \
"MAKELIB = ../bin/mklib.ar-ruv" \
"XLIBS = -lX11 -lXext -lXmu -lXi -lsocket -lnsl -lm"
@@ -1190,7 +1190,7 @@ unixware-shared:
"GLUT_LIB = libglut" \
"GLW_LIB = libGLw" \
"CC = cc" \
"CFLAGS = -O -I/usr/X/include -KPIC,inline -DUSE_XSHM" \
"CFLAGS = -O -I/usr/X/include -KPIC,inline -DSHM" \
"MAKELIB = ../bin/mklib.solaris" \
"XLIBS = -lX11 -lXext -lXmu -lXi -lsocket -lnsl -lm"
@@ -1230,7 +1230,7 @@ irix-debug:
"GLW_LIB = libGLw.a" \
"LIBDIR = ../lib32" \
"CC = cc" \
"CFLAGS = -g -n32 -ansi -fullwarn -DUSE_XSHM -DDEBUG -woff 1209,1210,1506,1521,3496" \
"CFLAGS = -g -n32 -ansi -fullwarn -DSHM -DDEBUG -woff 1209,1210,1506,1521,3496" \
"MAKELIB = ../bin/mklib.ar-rcv" \
"XLIBS = -rpath ../lib32 -lX11 -lXext -lXmu -lXi -lfpe -lXext -lXmu -lXi -lm"
@@ -1241,7 +1241,7 @@ DEBUG:
"GLUT_LIB = libglut.a" \
"GLW_LIB = libGLw.a" \
"CC = cc" \
"CFLAGS = -g -ansi -prototypes -fullwarn -DUSE_XSHM -DDEBUG" \
"CFLAGS = -g -ansi -prototypes -fullwarn -DSHM -DDEBUG" \
"MAKELIB = ../bin/mklib.ar-rcv" \
"XLIBS = -lX11 -lXext -lXmu -lXi -lfpe -lm"
@@ -1253,7 +1253,7 @@ linux-debug:
"GLUT_LIB = libglut.a" \
"GLW_LIB = libGLw.a" \
"CC = gcc" \
"CFLAGS = -g -ansi -pedantic -Wall -DUSE_XSHM -DDEBUG -DSVGA -DFX -D_SVID_SOURCE -D_BSD_SOURCE -DUSE_X86_ASM_not -I/usr/include/glide -I/usr/local/glide/include" \
"CFLAGS = -g -ansi -pedantic -Wall -DSHM -DDEBUG -DSVGA -DFX -D_SVID_SOURCE -D_BSD_SOURCE -DUSE_X86_ASM_not -I/usr/include/glide -I/usr/local/glide/include" \
"MAKELIB = ../bin/mklib.ar-ruv" \
"XLIBS = -L/usr/local/glide/lib -lglide2x -ltexus -L/usr/X11R6/lib -lX11 -lXext -lXmu -lXt -lXi -lSM -lICE -lvga -lm" \
"ASM_SOURCES = X86/x86a.S X86/common_x86asm.S X86/vertex.S"
@@ -1265,9 +1265,9 @@ linux-elf-debug:
"GLUT_LIB = libglut.so" \
"GLW_LIB = libGLw.so" \
"CC = gcc" \
"CFLAGS = -g -ansi -pedantic -Wall -fPIC -ffast-math -D_SVID_SOURCE -D_BSD_SOURCE -I/usr/X11R6/include -DUSE_XSHM -DDEBUG" \
"CFLAGS = -g -ansi -pedantic -Wall -fPIC -ffast-math -D_SVID_SOURCE -D_BSD_SOURCE -DSHM -DDEBUG -DSVGA -DFX -I/usr/X11R6/include -I/usr/include/glide" \
"MAKELIB = ../bin/mklib.linux" \
"XLIBS = -L/usr/X11R6/lib -lX11 -lXext -lXmu -lXt -lXi -lSM -lICE -lvga -lm" \
"XLIBS = -L/usr/X11R6/lib -lX11 -lXext -lXmu -lXt -lXi -lSM -lICE -lvga -lm -lvga -L/usr/local/lib -L/usr/local/glide/lib -lglide2x" \
"ASM_SOURCES = X86/x86a.S X86/common_x86asm.S X86/vertex.S"
linux-glide-debug:
@@ -1277,7 +1277,7 @@ linux-glide-debug:
"GLUT_LIB = libglut.so" \
"GLW_LIB = libGLw.so" \
"CC = gcc" \
"CFLAGS = -g -ansi -pedantic -Wall -fPIC -ffast-math -D_SVID_SOURCE -D_BSD_SOURCE -I/usr/X11R6/include -DUSE_XSHM -DFX -DDEBUG -I/usr/local/glide/include -I/usr/include/glide" \
"CFLAGS = -g -ansi -pedantic -Wall -fPIC -ffast-math -D_SVID_SOURCE -D_BSD_SOURCE -I/usr/X11R6/include -DSHM -DFX -DDEBUG -I/usr/local/glide/include -I/usr/include/glide" \
"MAKELIB = ../bin/mklib.linux" \
"XLIBS = -L/usr/local/glide/lib -lglide2x -L/usr/X11R6/lib -lX11 -lXext -lXmu -lXt -lXi -lSM -lICE -lvga -lm" \
"ASM_SOURCES = X86/x86a.S X86/common_x86asm.S X86/vertex.S"
@@ -1290,7 +1290,7 @@ linux-prof:
"GLUT_LIB = libglut.a" \
"GLW_LIB = libGLw.a" \
"CC = gcc" \
"CFLAGS = -O2 -pg -ansi -pedantic -Wall -DUSE_XSHM -D_SVID_SOURCE -D_BSD_SOURCE -DUSE_X86_ASM -DUSE_MMX_ASM -DUSE_3DNOW_ASM -I/usr/include/glide -I/usr/local/glide/include" \
"CFLAGS = -O2 -pg -ansi -pedantic -Wall -DSHM -D_SVID_SOURCE -D_BSD_SOURCE -DUSE_X86_ASM -DUSE_MMX_ASM -DUSE_3DNOW_ASM -I/usr/include/glide -I/usr/local/glide/include" \
"MAKELIB = ../bin/mklib.ar-ruv" \
"XLIBS = -L/usr/local/glide/lib -lglide2x -L/usr/X11/lib -lX11 -lXext -lXmu -lXt -lXi -lSM -lICE -lm" \
"ASM_SOURCES = X86/x86a.S X86/common_x86asm.S \

View File

@@ -1,9 +1,9 @@
# $Id: Makefile.X11,v 1.12.2.2 1999/12/14 20:54:24 brianp Exp $
# $Id: Makefile.X11,v 1.12.2.14 2000/07/18 14:32:08 brianp Exp $
# Mesa 3-D graphics library
# Version: 3.1
# Version: 3.2.1
#
# Copyright (C) 1999 Brian Paul All Rights Reserved.
# 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"),
@@ -161,6 +161,7 @@ sunos5-x11r6-gcc-sl ultrix-gcc unicos unixware uwin vistra:
-mkdir lib
touch src/depend
touch src-glu/depend
touch widgets-sgi/depend
if [ -d src-glut ] ; then touch src-glut/depend ; fi
cd src ; $(MAKE) -f Makefile.X11 $@
cd src-glu ; $(MAKE) -f Makefile.X11 $@
@@ -169,12 +170,14 @@ sunos5-x11r6-gcc-sl ultrix-gcc unicos unixware uwin vistra:
if [ -d xdemos ] ; then cd xdemos ; $(MAKE) -f Makefile.X11 $@ ; fi
if [ -d samples ] ; then cd samples ; $(MAKE) -f Makefile.X11 $@ ; fi
if [ -d book ] ; then cd book ; $(MAKE) -f Makefile.X11 $@ ; fi
if [ -d widgets-sgi ] ; then cd widgets-sgi; $(MAKE) -f Makefile.X11 $@ ; fi
irix6-n32 irix6-n32-dso irix6-gcc-n32-sl irix-debug:
-mkdir lib32
touch src/depend
touch src-glu/depend
touch widgets-sgi/depend
if [ -d src-glut ] ; then touch src-glut/depend ; fi
cd src ; $(MAKE) -f Makefile.X11 $@
cd src-glu ; $(MAKE) -f Makefile.X11 $@
@@ -183,12 +186,14 @@ irix6-n32 irix6-n32-dso irix6-gcc-n32-sl irix-debug:
if [ -d xdemos ] ; then cd xdemos ; $(MAKE) -f Makefile.X11 $@ ; fi
if [ -d samples ] ; then cd samples ; $(MAKE) -f Makefile.X11 $@ ; fi
if [ -d book ] ; then cd book ; $(MAKE) -f Makefile.X11 $@ ; fi
if [ -d widgets-sgi ] ; then cd widgets-sgi; $(MAKE) -f Makefile.X11 $@ ; fi
irix6-64 irix6-64-dso:
-mkdir lib64
touch src/depend
touch src-glu/depend
touch widgets-sgi/depend
if [ -d src-glut ] ; then touch src-glut/depend ; fi
cd src ; $(MAKE) -f Makefile.X11 $@
cd src-glu ; $(MAKE) -f Makefile.X11 $@
@@ -197,6 +202,7 @@ irix6-64 irix6-64-dso:
if [ -d xdemos ] ; then cd xdemos ; $(MAKE) -f Makefile.X11 $@ ; fi
if [ -d samples ] ; then cd samples ; $(MAKE) -f Makefile.X11 $@ ; fi
if [ -d book ] ; then cd book ; $(MAKE) -f Makefile.X11 $@ ; fi
if [ -d widgets-sgi ] ; then cd widgets-sgi; $(MAKE) -f Makefile.X11 $@ ; fi
amiwin:
@@ -223,11 +229,13 @@ cygnus cygnus-linux:
-mkdir lib
touch src/depend
touch src-glu/depend
touch widgets-sgi/depend
cd src ; $(MAKE) -f Makefile.X11 $@
cd src-glu ; $(MAKE) -f Makefile.X11 $@
cd src-glut ; $(MAKE) -f Makefile.X11 $@
cd demos ; $(MAKE) -f Makefile.X11 $@
if [ -d src-glut ] ; then cd src-glut ; $(MAKE) -f Makefile.X11 $@ ; fi
if [ -d demos ] ; then cd demos ; $(MAKE) -f Makefile.X11 $@ ; fi
if [ -d xdemos ] ; then cd xdemos ; $(MAKE) -f Makefile.X11 $@ ; fi
if [ -d widgets-sgi ] ; then cd widgets-sgi; $(MAKE) -f Makefile.X11 $@ ; fi
macintosh:
@echo "See the README file for Macintosh intallation information"
@@ -259,6 +267,7 @@ linux-ggi linux-386-ggi:
-mkdir lib
touch src/depend
touch src-glu/depend
touch widgets-sgi/depend
if [ -d src-glut ] ; then touch src-glut/depend ; fi
if [ -d ggi ] ; then touch ggi/depend ; fi
cd src ; $(MAKE) -f Makefile.X11 $@
@@ -272,6 +281,7 @@ linux-ggi linux-386-ggi:
if [ -d xdemos ] ; then cd xdemos ; $(MAKE) -f Makefile.X11 $@ ; fi
if [ -d samples ] ; then cd samples ; $(MAKE) -f Makefile.X11 $@ ; fi
if [ -d book ] ; then cd book ; $(MAKE) -f Makefile.X11 $@ ; fi
if [ -d widgets-sgi ] ; then cd widgets-sgi; $(MAKE) -f Makefile.X11 $@ ; fi
# if you change GGI_DEST please change it in ggimesa.conf, too.
DESTDIR=/usr/local
@@ -301,6 +311,8 @@ clean:
-rm -f xdemos/*.o xdemos/*~
-rm -f samples/*.o samples/*~
-rm -f ggi/*.o ggi/demos/*.o ggi/*.a
-rm -f widgets-sgi/*.o
-rm -f widgets-mesa/*/*.o
# Remove everything that can be remade
realclean: clean
@@ -314,9 +326,9 @@ realclean: clean
DIRECTORY = Mesa-3.1
LIB_NAME = MesaLib-3.1
DEMO_NAME = MesaDemos-3.1
DIRECTORY = Mesa-3.2.1
LIB_NAME = MesaLib-3.2.1
DEMO_NAME = MesaDemos-3.2.1
LIB_FILES = \
@@ -336,7 +348,6 @@ LIB_FILES = \
$(DIRECTORY)/missing \
$(DIRECTORY)/mkinstalldirs \
$(DIRECTORY)/stamp-h.in \
$(DIRECTORY)/configure \
$(DIRECTORY)/docs/CONFIG \
$(DIRECTORY)/docs/CONFORM \
$(DIRECTORY)/docs/COPYING \
@@ -347,7 +358,7 @@ LIB_FILES = \
$(DIRECTORY)/docs/INSTALL.GNU \
$(DIRECTORY)/docs/README \
$(DIRECTORY)/docs/README.* \
$(DIRECTORY)/docs/RELNOTES \
$(DIRECTORY)/docs/RELNOTES* \
$(DIRECTORY)/docs/VERSIONS \
$(DIRECTORY)/docs/*.spec \
$(DIRECTORY)/bin/README \
@@ -361,9 +372,10 @@ LIB_FILES = \
$(DIRECTORY)/mesawin32.mak \
$(DIRECTORY)/Names.win \
$(DIRECTORY)/win32-openstep.sh \
$(DIRECTORY)/*.dja \
$(DIRECTORY)/common.dja \
$(DIRECTORY)/include/GL/Makefile.in \
$(DIRECTORY)/include/GL/Makefile.am \
$(DIRECTORY)/include/GL/amesa.h \
$(DIRECTORY)/include/GL/dosmesa.h \
$(DIRECTORY)/include/GL/foomesa.h \
$(DIRECTORY)/include/GL/fxmesa.h \
@@ -374,6 +386,7 @@ LIB_FILES = \
$(DIRECTORY)/include/GL/glu_mangle.h \
$(DIRECTORY)/include/GL/glx.h \
$(DIRECTORY)/include/GL/glx_mangle.h \
$(DIRECTORY)/include/GL/mesa_wgl.h \
$(DIRECTORY)/include/GL/mglmesa.h \
$(DIRECTORY)/include/GL/osmesa.h \
$(DIRECTORY)/include/GL/svgamesa.h \
@@ -453,22 +466,45 @@ LIB_FILES = \
$(DIRECTORY)/src/X86/Makefile.in \
$(DIRECTORY)/src/X86/*.m4 \
$(DIRECTORY)/src/X86/*.S \
$(DIRECTORY)/src/*.dja \
$(DIRECTORY)/src-glu/README[12] \
$(DIRECTORY)/src-glu/Makefile* \
$(DIRECTORY)/src-glu/descrip.mms \
$(DIRECTORY)/src-glu/mms_depend \
$(DIRECTORY)/src-glu/*.def \
$(DIRECTORY)/src-glu/*.dja \
$(DIRECTORY)/src-glu/depend \
$(DIRECTORY)/src-glu/*.[ch] \
$(DIRECTORY)/widgets-mesa \
$(DIRECTORY)/widgets-sgi \
$(DIRECTORY)/widgets-mesa/ChangeLog \
$(DIRECTORY)/widgets-mesa/INSTALL \
$(DIRECTORY)/widgets-mesa/README \
$(DIRECTORY)/widgets-mesa/TODO \
$(DIRECTORY)/widgets-mesa/configure \
$(DIRECTORY)/widgets-mesa/demos/ChangeLog \
$(DIRECTORY)/widgets-mesa/demos/Cube \
$(DIRECTORY)/widgets-mesa/demos/Ed \
$(DIRECTORY)/widgets-mesa/demos/Makefile.in \
$(DIRECTORY)/widgets-mesa/demos/Mcube \
$(DIRECTORY)/widgets-mesa/demos/Tea \
$(DIRECTORY)/widgets-mesa/demos/*.[ch] \
$(DIRECTORY)/widgets-mesa/demos/events \
$(DIRECTORY)/widgets-mesa/include/GL/ChangeLog \
$(DIRECTORY)/widgets-mesa/include/GL/*.h \
$(DIRECTORY)/widgets-mesa/include/GL/Makefile.in \
$(DIRECTORY)/widgets-mesa/man/ChangeLog \
$(DIRECTORY)/widgets-mesa/man/GL* \
$(DIRECTORY)/widgets-mesa/man/Makefile.in \
$(DIRECTORY)/widgets-mesa/man/Mesa* \
$(DIRECTORY)/widgets-mesa/src/ChangeLog \
$(DIRECTORY)/widgets-sgi/*.[ch] \
$(DIRECTORY)/widgets-sgi/Makefile* \
$(DIRECTORY)/widgets-sgi/README \
$(DIRECTORY)/util/README \
$(DIRECTORY)/util/Makefile.am \
$(DIRECTORY)/util/Makefile.in \
$(DIRECTORY)/util/*.[ch] \
$(DIRECTORY)/util/sampleMakefile \
$(DIRECTORY)/vms/analyze_map.com \
$(DIRECTORY)/vms/xlib.opt \
$(DIRECTORY)/vms/xlib_share.opt \
$(DIRECTORY)/BeOS/Makefile \
$(DIRECTORY)/BeOS/*.cpp \
$(DIRECTORY)/WIN32/NMAKE.MAK \
@@ -490,7 +526,8 @@ LIB_FILES = \
$(DIRECTORY)/macos/resources/*.rsrc \
$(DIRECTORY)/macos/src-agl/*.exp \
$(DIRECTORY)/macos/src-agl/*.[ch] \
$(DIRECTORY)/macos/src-gli/*.[ch]
$(DIRECTORY)/macos/src-gli/*.[ch] \
$(DIRECTORY)/OpenStep \
DEMO_FILES = \
@@ -521,21 +558,21 @@ DEMO_FILES = \
$(DIRECTORY)/samples/Makefile* \
$(DIRECTORY)/samples/README \
$(DIRECTORY)/samples/*.c \
$(DIRECTORY)/samples/*.dja \
$(DIRECTORY)/3Dfx \
$(DIRECTORY)/mtdemos \
$(DIRECTORY)/ggi
lib_tar:
cp Makefile.X11 Makefile ; \
cd .. ; \
tar -cvf $(LIB_NAME).tar $(LIB_FILES) ; \
tar --exclude CVS -c -v -f $(LIB_NAME).tar $(LIB_FILES) ; \
gzip $(LIB_NAME).tar ; \
mv $(LIB_NAME).tar.gz $(DIRECTORY)
demo_tar:
cd .. ; \
tar -cvf $(DEMO_NAME).tar $(DEMO_FILES) ; \
tar --exclude CVS -c -v -f $(DEMO_NAME).tar $(DEMO_FILES) ; \
gzip $(DEMO_NAME).tar ; \
mv $(DEMO_NAME).tar.gz $(DIRECTORY)

View File

@@ -16,11 +16,11 @@ Status
Version
$Id: MESA_resize_buffers.spec,v 1.1 1999/07/20 00:30:41 brianp Exp $
$Id: MESA_resize_buffers.spec,v 1.1.2.1 2000/04/04 23:28:00 brianp Exp $
Number
XXX none assigned
196
Dependencies

View File

@@ -16,11 +16,11 @@ Status
Version
$Id: MESA_window_pos.spec,v 1.1 1999/07/20 00:30:41 brianp Exp $
$Id: MESA_window_pos.spec,v 1.1.2.1 2000/04/04 23:28:00 brianp Exp $
Number
XXX non assigned
197
Dependencies

View File

@@ -1,13 +1,8 @@
3Dfx Glide device driver for Mesa 3.1
3Dfx Glide device driver for Mesa 3.2
(see below for FAQ)
This software is distributed under the terms of the GNU Library
General Public License, see the LICENSE file for details.
What do you need ?
------------------
@@ -189,9 +184,9 @@ Doing more with Mesa & Linux Glide:
quality. However you can use any visual depth supported by X.
2. Set the following environment variables:
export MESA_GLX_FX="window" // to enable window rendering
export SST_VGA_PASS=1 // to stop video signal switching
export SST_NOSHUTDOWN=1 // to stop video signal switching
export MESA_GLX_FX="window" # to enable window rendering
export SST_VGA_PASS=1 # to stop video signal switching
export SST_NOSHUTDOWN=1 # to stop video signal switching
OR
setenv MESA_GLX_FX window
setenv SST_VGA_PASS 1
@@ -327,6 +322,11 @@ The Mesa/Voodoo Environment Variables:
export MESA_FX_INFO=1
you will get some useful statistic.
- If you define the env. var. MESA_FX_NO_SIGNALS:
export MESA_FX_NO_SIGNALS=1
Mesa/FX will not install atexit() or signal() handlers.
Know BUGS and Problems:
-----------------------
@@ -541,9 +541,7 @@ No because the Linux Glide doesn't (yet) support the Voodoo Rush.
a binary copy of the Mesa in order to make the software
working out of the box ?
Yes, you have simply to include some informations about authors
and where the library sources are available (check the LICENSE
file for more informations about the GNU GPL).
Yes.
11. Which is the best make target for compiling the Mesa for

View File

@@ -1,120 +1,50 @@
August 30, 1998 -- Paul Garceau (pgarceau@teleport.com)
August 30, 1998 -- Paul Garceau
Updated January 13, 2000 -- Paul Garceau (pgarceau@teleport.com)
DISCLAIMER: I make this extension to the Mesa 3-D Graphics Library as a service
DISCLAIMER: I make this port of the Mesa 3-D Graphics Library as a service
to the general public. I can, in no way support or make any guarantee that the
EGCS-Mingw32 build or any Gnu-Win32 build will work for your system. The
associated packages and batch files I have included as part of the EGCS-Mingw32
extension are provided "As-is" with out any guarantee of support or functionality
from the author of this EGCS-Mingw32 native windows port of the Mesa 3-D Graphics
Library.
build will work for your system.
The associated packages and batch files I have included as part of the GCC-2.95.2/Mingw32 extension are provided "As-is" with out any guarantee of support or functionality from this author.
Feel free to modify or change things as you see fit, just remember that
I can't support any modifications you might want to make to the files which I
have included OR the lgpl protected Mesa 3-D Graphics Library.
I recommend using GCC-2.95.2/Mingw32 which is available at Mumit Khans' ftp site:
EGCS-Mingw32 Beta 3.08 Archive Manifest:
mingw32.bat
src/makefile.nt4
src/wmesa.c
src-glu/makefile.nt4
(ftp://ftp.xraylith.wisc.edu/pub/khan/gnu-win32/mingw32/)
###############
This build has been tested under WinNT4/SP6. Win9x and WinNT5 remain untested by me. I have not tested any of the demos included with Mesa3d.
Greetings,
I recommend using the GCC-2.95.2/Mingw32.
In order to build the Mingw32 set of Mesa 3-D Graphics Library for Beta3.08
it will be necessary for you to use the Dos or Command Prompt that is available
on most of the i86 based MS Windows machines. Also, I believe that this build
will run on Win95, Win98, WinNT4 and WinNT5.
I haven't tested Win95/98 or WinNT5. This build was generated under
WinNT4 with SP3 installed.
This has not been tested under any systems outside of
a WinNT4 Workstation with EGCS-Mingw32 toolchain, v.1.0.2 installed.
EGCS-Mingw32 uses a variation of gcc to handle its build. The Mesa 3-D
Graphics Library build that I have generated is based, in small part, on the
Cygwin32 build and associated makefiles that Stephane Rehel (rehel@worldnet.fr)
defined back in 1997. The EGCS-Mingw32 toolchain is capable of generating
native windows code and, as of the date of this readme, can be obtained from:
http://www.xraylith.wisc.edu/~khan/software/gnu-win32/egcs-mingw32-102.html
ftp://ftp.xraylith.wisc.edu/pub/khan/gnu-win32/mingw32/gcc-2.95.2
Much thanks to the combined efforts of Mumit Khan, Jan-Jaap Vanderhagen
and Colin Peters for making it possible for the EGCS-Mingw32 toolchain to exist.
and Colin Peters for making it possible for the Mingw32 toolchain to exist. Also, thanks go out to Stephane Rehel for the work that was completed on the Cygwin build.
Installing EGCS-Mingw32 Build Revisions:
Installing GCC-2.95.2/Mingw32 Build:
To install the makefile and source revisions incorporated with this build
of the Mesa 3-D Graphics Library, you'll have to use a version of winzip. I am
in the process of finding a suitable Win32 compatible tar executable so that if
you don't have winzip, you can still decompress the files into their respective
folders/directories.
a) Open the file archive (either tar.gz or .zip extensions)
a) Move the mingw32.zip file to the top level of the hard drive on your
system.
b) Decide the directory you want to move the archived files to.
b) Copy all of the Beta 3.08 src/windows files to the src/ directory.
d) Extract the files from the archive.
e) Edit the mingw32.bat file to accomodate your choice of directory structure.
b) Open the Winzip file
c) Verify that the files will be properly extracted.
d) Extract the files with the Winzip "Overwrite" and "Use Folder Names"
options enabled.
The zip file directory structure extraction defaults to the top level of
the hard drive where the mingw32.zip file exists unless otherwise instructed by
you.
The version of wmesa.c included with the mingw32 archive needs to replace
the current version of the Beta 3.08 wmesa.c file in order for the egcs-mingw32
build to work. This is because the original Win32 stuff assumes that the glut
utilities are to be installed. The Glut utilities are not part of the
egcs-mingw32 build for Beta 3.08.
Build Considerations:
In order to get the build to work, I needed to create a special makefile
for each library which the Mesa 3-D Graphics Library requires since there is no
comparable make-config/config on a native windows platform.
Since I was only creating a few of the possible libraries for
Mesa (gl, glu), I only created the new make files in their respective libraries
src, src-glu). For libMesaaux.a. you will find a makefile for it in the
src-aux directory. libMesatk.a and libglut.a were not ported.
The build itself is a .bat based build and uses Gnu Make,Version 3.76.1 to
process the makefiles noted above. The build must be run from the directory
where the mingw32.bat file is. You can get the binary version of Make 3.76.1
from Jan-Jaap van der Heijden's site in Germany:
http://agnes.dida.physik.uni-essen.de/~janjaap/mingw32/download.html
It was necessary to modify some source code, specifically the source code
in the src-glu directory. I needed to modify nurbs.c, quadric.c and tess.c in
order to get them to work using the EGCS-Mingw32 toolchain.
The original EGCS-Mingw32 Toolchain, is available from:
http://www.xraylith.wisc.edu/~khan/software/gnu-win32/egcs-mingw32-102.html
%mesaroot%: This is your root directory (Mesa-3.2)
%mesasrc%: This is the Mesa-3.2 src directory (Mesa-3.2\src)
%mesalib%: This is where the build will put libGL.a and libGLU.a
Running the Build:
Ok, now that we've got the basics out of the way, follows is all you need
to do in order to build the EGCS-Mingw32 version of libMesaGL.a and libMesaGLU.a:
Open your Command Prompt/Dos prompt.
Go to your Mesa-3.0 beta 'root' directory.
This is the same directory that the Mesa mingw32.zip file was
originally stored in if you've installed the Mesa-3.0 beta 3-D
Graphics Library source as outlined in the "readme" file included
with the Mesa-3.0 beta distribution.
Open your Command Prompt or MS-DOS prompt.
Go to your Mesa-3.2 'root' directory
At the command line type: mingw32
mingw32 is the .bat file that actually does the build.
That's all there is to it.
Enjoy!

View File

@@ -1,5 +1,5 @@
Mesa 3.1 Unix/X11 Information
Mesa 3.2 Unix/X11 Information
@@ -25,7 +25,7 @@ There are two ways to compile Mesa on Unix/X11 systems:
The top-level makefile will execute the makefiles in a number of sub-
directories. When finished, the Mesa libraries will be in the Mesa-3.1/lib/
directories. When finished, the Mesa libraries will be in the Mesa-3.2/lib/
directory. A few GLUT demos in the demos/ directory should be ready to run.
If you also downloaded and unpacked the demos there should be executables
@@ -35,6 +35,20 @@ If you have compilation problems you should try to fix them and return the
patches to the author.
Notes on assembly language optimizations:
When using the old-style Makefiles, you can specify a configuration
that uses X86 assembly language optimizations (linux-3dnow for example).
The detection of MMX, 3DNow!, PIII/SSE, etc capability is done at
runtime. That means you can compile Mesa for 3DNow! optimizations
even if you don't have an AMD CPU.
However, your Linux binutils and assembler must understand the
special instructions in order to compile them. If you have
compilation problems, try upgrading your binutils.
Header and library files:
After you've compiled Mesa and tried the demos I recommend the following
procedure for "installing" Mesa.
@@ -127,7 +141,7 @@ Xt/Motif Widgets:
Togl:
Togl is an OpenGL/Mesa widget for Tcl/Tk.
See http://www.ssec.wisc.edu/~brianp/Togl.html for more information.
See http://togl.sourceforge.net for more information.
@@ -246,6 +260,7 @@ Extensions:
The following OpenGL GLX extensions are currently implemented:
GLX_EXT_visual_info - GLX visual and transparent pixel extension
GLX_EXT_visual_rating - GLX visual caveats
For detailed information about the extensions see www.opengl.org
@@ -308,4 +323,4 @@ Summary of X-related environment variables:
----------------------------------------------------------------------
$Id: README.X11,v 3.3.2.2 1999/12/14 15:12:52 brianp Exp $
$Id: README.X11,v 3.3.2.4 2000/04/04 15:13:41 brianp Exp $

146
docs/RELNOTES-3.1 Normal file
View File

@@ -0,0 +1,146 @@
Mesa 3.1 release notes
PLEASE READ!!!!
New copyright
-------------
Mesa 3.1 will be distributed under an XFree86-style copyright instead
of the GNU LGPL.
New directories
---------------
All documentation files are now in the docs/ directory.
All shell scripts are now in the bin/ directory.
New library names
-----------------
Formerly, the main Mesa library was named libMesaGL.so (or libMesaGL.a)
and the GLU library was named libMesaGLU.so (or libMesaGLU.a).
Now, the main library is named libGL.so (or libGL.a) and the GLU library
is named libGLU.so (or libGLU.a).
The change allows Mesa to be more easily substituted for OpenGL.
Specifically, the linker/loader on some Unix-like systems won't
allow libMesaGL.so to be used instead of libGL.so if the application
was linked with the former.
Warning: if you have another OpenGL implementation installed on your
system (i.e. you have another OpenGL libGL.so) you'll have to be
carefull about which library (OpenGL or Mesa) you link against. Be
aware of -L linker flags and the value of the LD_LIBRARY_PATH environment
variable.
New library versioning
----------------------
Previously, the Mesa GL library was named libMesaGL.so.3.0
To better support Linux/OpenGL standards, the Mesa GL library is now
named libGL.so.1.2.030100 This indicates version 1.2 of the OpenGL spec
and Mesa implementation 3.1.0
In the long term this will allow better interoperability with other
OpenGL implementations, especially on Linux. In the short term,
OpenGL apps may have to be relinked to use the new library naming.
New makefiles
-------------
The old Makefiles found in the various directories have been renamed
to Makefile.X11 in order to prevent filename collisions with autoconfig-
generated Makefiles.
The top-level Makefile simply includes Makefile.X11
If your top-level Makefile get's overwritten/destroyed you can restore
it by copying Makefile.X11 to Makefile
New extensions
--------------
GL_EXT_stencil_wrap
Implements two new stencil operations: GL_INCR_WRAP_EXT and
GL_DECR_WRAP_EXT which allow stencil increment and decrement
without clamping.
GL_INGR_blend_func_separate
Allows specification of blend factors for RGB and Alpha independently.
(INGR = Intergraph)
GL_ARB_multitexture
Multiple simultaneous textures. (ARB = Architecture Review Board)
GL_NV_texgen_reflection
nVidia texgen extension for better reflection mapping.
GL_PGI_misc_hints
Assorted transformation hints.
GL_EXT_compiled_vertex_array
Compiled vertex arrays.
GL_EXT_clip_volume_hint
Allows one to disable clip volume (frustum) testing.
Extensions removed
------------------
GL_EXT_multitexture - obsolete in favor of GL_ARB_multitexture
Config file
-----------
By default, /etc/mesa.conf will be read when Mesa starts. This
file controls default hints, enable/disable of extensions, and
more. See the CONFIG file for documentation.
Optimizations
-------------
Keith Whitwell has contributed significant optimizations to Mesa's
vertex transformation code. Basically, the whole transformation
stage of Mesa has been rewritten.
It's impossible to give a speedup factor. You'll just have to
try your app and see how it performs.
Device Driver changes
---------------------
A bunch of new device driver functions have been added. See src/dd.h
Keith Harrison contributed many of them. I've been planning on adding
a bunch of functions like these to make writing hardware drivers easier.
More such function will probably be added in the near future.
Miscellaneous
-------------
util/glstate.c has some handy functions for debugging. Basically, it
offers a simple function for printing GL state variables. It's not
finished yet. There's a LOT more GLenum records to be added (see the
code). Anyone want to help?
----------------------------------------------------------------------
$Id: RELNOTES-3.1,v 1.1.2.1 2000/02/22 17:56:56 brianp Exp $

12
docs/RELNOTES-3.2 Normal file
View File

@@ -0,0 +1,12 @@
Mesa 3.2 release notes
PLEASE READ!!!!
Mesa 3.2 is a stabilization of the Mesa 3.1 release. No new features
have been added. For a list of bug fixes please read the VERSIONS file.
----------------------------------------------------------------------
$Id: RELNOTES-3.2,v 1.1.2.1 2000/04/06 02:34:31 brianp Exp $

32
docs/RELNOTES-3.2.1 Normal file
View File

@@ -0,0 +1,32 @@
Mesa 3.2.1 release notes
PLEASE READ!!!!
The Mesa 3.2.1 release mainly just fixes bugs since the 3.2 release.
See the VERSIONS file for the exact list.
GLU Polygon Tessellator
-----------------------
The GLU tessellator has been reverted back to the version included
with Mesa 3.0 since it's more stable. The Mesa 3.1/3.2 tessellator
implemented the GLU 1.3 specification but suffered from a number of
bugs.
Mesa implements GLU 1.1.
Ideally, people should use the GLU 1.3 library included in SGI's
OpenGL Sample Implementation (SI) available from
http://oss.sgi.com/projects/ogl-sample/
People are working to make easy-to-install Linux RPMs of the
GLU library.
----------------------------------------------------------------------
$Id: RELNOTES-3.2.1,v 1.1.2.3 2000/07/19 14:59:33 brianp Exp $

View File

@@ -1,4 +1,4 @@
$Id: VERSIONS,v 1.13.2.5 1999/12/14 07:17:42 brianp Exp $
$Id: VERSIONS,v 1.13.2.47 2000/07/19 15:09:30 brianp Exp $
Mesa Version History
@@ -670,3 +670,79 @@ Mesa Version History
- several vertex array bug fixes
- overlapping glCopyPixels with pixel zooming now works
- glXUseXFont() bitmaps were vertically shifted by one pixel
3.2 beta 1 March 23, 2000
Bug fixes:
- mixed drawing of lines and bitmaps sometimes had wrong colors
- added missing glHintPGI() function
- fixed a polygon culling bug
- fixed bugs in gluPartialDisk()
- Z values in selection mode were wrong
- added missing tokens:
GL_SMOOTH_POINT_SIZE_RANGE
GL_SMOOTH_POINT_SIZE_GRANULARITY
GL_SMOOTH_LINE_WIDTH_RANGE
GL_SMOOTH_LINE_WIDTH_GRANULARITY
GL_ALIASED_POINT_SIZE_RANGE
GL_ALIASED_LINE_WIDTH_RANGE
- fixed glCopyPixels when copying from back to front buffer
- GL_EXT_compiled_vertex_array tokens had _SGI suffix instead of _EXT
- glDrawRangeElements(GL_LINES, 0, 1, 2, type, indices) was broken
- glDeleteTextures() didn't decrement reference count correctly
- GL_SRCA_ALPHA_SATURATE blend mode didn't work correctly
- Actual depth of transformation matrix stacks was off by one
- 24bpp visuals didn't address pixels correctly
- mipmap level of detail (lambda) calculation simplified, more accurate
- 101691 - Polygon clipping and GL_LINE
- 101928 - Polygon clipping and GL_LINE (same fix as above)
- 101808 - Non-glVertexArrays tristrip bug
- 101971 - find_last_3f on Dec OSF (worked around)
- 102369 - segv on dec osf (possibly a duplicate of the above)
- 102893 - orientations of modelview cause segfault
New:
- updated SVGA Linux driver
- added the MESA_FX_NO_SIGNALS env var, see docs/README.3DFX
- build libGLw.a (Xt/OpenGL drawing area widget) library by default
- changed -O2 to -O3 for a number of gcc configs
Changes:
- glXCopyContext's mask parameter is now unsigned long, per GLX spec
3.2 final April 24, 2000
Bug fixes:
- fixed memcpy bugs in span.c
- fixed missing glEnd problem in demos/tessdemo.c
- fixed bug when clearing 24bpp Ximages
- fixed clipping problem found in Unreal Tournament
- fixed Loki's "ice bug" and "crazy triangles" seen in Heretic2
- fixed Loki's 3dfx RGB vs BGR bug
- fixed Loki's 3dfx smooth/flat shading bug in SoF
Changes:
- updated docs/README file
- use bcopy() optimizations on FreeBSD
- re-enabled the optimized persp_textured_triangle() function
3.2.1 July 19, 2000
Bug fixes:
- gluBuild2DMipmaps() didn't accept GL_BGRA
- Fixed compile/makefile problems on IRIX
- fixed segfault in 3dfx driver when using GL selection/feedback
- no longer cull very, very tiny triangles
- blending w/ drawbuffer==GL_FRONT_BACK caused segfault (sw rendering)
- fixed Motif detection code in widgets-mesa/configure.in
- glColorMaterial and glMaterial updates to emissive and ambient
didn't always work right
- Specular highlights weren't always in the right place
- clipped GL_LINE mode polygons had interior lines appear
- several OpenGL conformace test fixes
- blend term GL_ONE_MINUS_CONSTANT_ALPHA was broken
- GL_NICEST fog didn't always work with flat shading
- glRect commands in display lists were sometimes miscolored
- Line Z offset didn't always work
- fixed texgen normal vector problem (gloss's teapot)
- numerous GL conformance bugs fixed
Changes:
- glColorMask(false, false, false, false) handled better/faster
- reverted to old GLU polygon tessellator, GLU 1.1
- updated Win32 build files

View File

@@ -1,10 +1,10 @@
/* $Id: amesa.h,v 1.1 1999/08/19 00:55:40 jtg Exp $ */
/* $Id: amesa.h,v 1.1.1.1.2.1 2000/02/09 18:53:54 brianp Exp $ */
/*
* Mesa 3-D graphics library
* Version: 3.1
* Version: 3.2
*
* Copyright (C) 1999 Brian Paul All Rights Reserved.
* 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"),
@@ -25,25 +25,17 @@
*/
/*
* $Log: amesa.h,v $
* Revision 1.1 1999/08/19 00:55:40 jtg
* Initial revision
*
* Revision 1.1 1999/03/16 01:24:13 brianp
* initial check-in
*
*/
/* 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 2
typedef struct amesa_visual *AMesaVisual;
typedef struct amesa_buffer *AMesaBuffer;
typedef struct amesa_context *AMesaContext;

View File

@@ -1,10 +1,10 @@
/* $Id: fxmesa.h,v 1.1.1.1.2.1 1999/11/24 18:38:52 brianp Exp $ */
/* $Id: fxmesa.h,v 1.1.1.1.2.2 2000/02/09 18:53:55 brianp Exp $ */
/*
* Mesa 3-D graphics library
* Version: 3.1
* Version: 3.2
*
* Copyright (C) 1999 Brian Paul All Rights Reserved.
* 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"),
@@ -45,7 +45,7 @@ extern "C" {
#define FXMESA_MAJOR_VERSION 3
#define FXMESA_MINOR_VERSION 1
#define FXMESA_MINOR_VERSION 2
/*

View File

@@ -1,8 +1,8 @@
/* $Id: ggimesa.h,v 1.2 1999/08/23 22:34:08 jtaylor Exp $ */
/* $Id: ggimesa.h,v 1.2.2.1 2000/02/09 18:53:55 brianp Exp $ */
/*
* Mesa 3-D graphics library
* Version: 3.1
* Version: 3.2
* Copyright (C) 1995-1998 Brian Paul
* Copyright (C) 1998 Uwe Maurer
*
@@ -22,23 +22,14 @@
*/
/*
* $Log: ggimesa.h,v $
* Revision 1.2 1999/08/23 22:34:08 jtaylor
* Misc small cleanups
*
* Revision 1.1.1.1 1999/08/19 00:55:40 jtg
* Imported sources
*
* Revision 1.2 1998/09/29 01:46:40 brianp
* applied Emmanuel Marty's patches for latest GGI
*
*/
#ifndef GGIMESA_H
#define GGIMESA_H
#define GGIMESA_MAJOR_VERSION 3
#define GGIMESA_MINOR_VERSION 2
#ifdef __cplusplus
extern "C" {
#endif

File diff suppressed because it is too large Load Diff

View File

@@ -1,8 +1,8 @@
/* $Id: gl_mangle.h,v 1.3 1999/11/04 00:43:09 miklos Exp $ */
/* $Id: gl_mangle.h,v 1.3.2.1 2000/01/04 08:08:28 brianp Exp $ */
/*
* Mesa 3-D graphics library
* Version: 3.1
* Version: 3.2
*
* Copyright (C) 1999 Brian Paul All Rights Reserved.
*
@@ -396,6 +396,8 @@
#define glTexSubImage3DEXT mglTexSubImage3DEXT
#define glCopyTexSubImage3DEXT mglCopyTexSubImage3DEXT
#define glColorTable mglColorTable
#define glColorTableParameteriv mglColorTableParameteriv
#define glColorTableParameterfv mglColorTableParameterfv
#define glColorSubTable mglColorSubTable
#define glGetColorTable mglGetColorTable
#define glGetColorTableParameteriv mglGetColorTableParameteriv

View File

@@ -1,10 +1,9 @@
/* $Id: glu.h,v 1.16 1999/11/11 03:21:43 kendallb Exp $ */
/* $Id: glu.h,v 1.14.2.2 2000/07/11 01:45:56 brianp Exp $ */
/*
* Mesa 3-D graphics library
* Version: 3.3
*
* Copyright (C) 1995-1999 Brian Paul
* Version: 3.2.1
* 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
@@ -71,165 +70,172 @@ extern "C" {
#endif
#define GLU_VERSION_1_1 1
#define GLU_VERSION_1_2 1
#define GLU_VERSION_1_1 1
#define GLU_TRUE 1
#define GLU_FALSE 0
#define GLU_TRUE GL_TRUE
#define GLU_FALSE GL_FALSE
/* Normal vectors */
#define GLU_SMOOTH 100000
#define GLU_FLAT 100001
#define GLU_NONE 100002
enum {
/* Normal vectors */
GLU_SMOOTH = 100000,
GLU_FLAT = 100001,
GLU_NONE = 100002,
/* Quadric draw styles */
#define GLU_POINT 100010
#define GLU_LINE 100011
#define GLU_FILL 100012
#define GLU_SILHOUETTE 100013
/* Quadric draw styles */
GLU_POINT = 100010,
GLU_LINE = 100011,
GLU_FILL = 100012,
GLU_SILHOUETTE = 100013,
/* Quadric orientation */
#define GLU_OUTSIDE 100020
#define GLU_INSIDE 100021
/* Quadric orientation */
GLU_OUTSIDE = 100020,
GLU_INSIDE = 100021,
/* Tessellator */
#define GLU_TESS_BEGIN 100100
#define GLU_TESS_VERTEX 100101
#define GLU_TESS_END 100102
#define GLU_TESS_ERROR 100103
#define GLU_TESS_EDGE_FLAG 100104
#define GLU_TESS_COMBINE 100105
/* Tessellator */
GLU_TESS_BEGIN = 100100,
GLU_TESS_VERTEX = 100101,
GLU_TESS_END = 100102,
GLU_TESS_ERROR = 100103,
GLU_TESS_EDGE_FLAG = 100104,
GLU_TESS_COMBINE = 100105,
#define GLU_TESS_BEGIN_DATA 100106
#define GLU_TESS_VERTEX_DATA 100107
#define GLU_TESS_END_DATA 100108
#define GLU_TESS_ERROR_DATA 100109
#define GLU_TESS_EDGE_FLAG_DATA 100110
#define GLU_TESS_COMBINE_DATA 100111
GLU_TESS_BEGIN_DATA = 100106,
GLU_TESS_VERTEX_DATA = 100107,
GLU_TESS_END_DATA = 100108,
GLU_TESS_ERROR_DATA = 100109,
GLU_TESS_EDGE_FLAG_DATA = 100110,
GLU_TESS_COMBINE_DATA = 100111,
/* Winding rules */
#define GLU_TESS_WINDING_ODD 100130
#define GLU_TESS_WINDING_NONZERO 100131
#define GLU_TESS_WINDING_POSITIVE 100132
#define GLU_TESS_WINDING_NEGATIVE 100133
#define GLU_TESS_WINDING_ABS_GEQ_TWO 100134
/* Winding rules */
GLU_TESS_WINDING_ODD = 100130,
GLU_TESS_WINDING_NONZERO = 100131,
GLU_TESS_WINDING_POSITIVE = 100132,
GLU_TESS_WINDING_NEGATIVE = 100133,
GLU_TESS_WINDING_ABS_GEQ_TWO = 100134,
/* Tessellation properties */
#define GLU_TESS_WINDING_RULE 100140
#define GLU_TESS_BOUNDARY_ONLY 100141
#define GLU_TESS_TOLERANCE 100142
/* Tessellation properties */
GLU_TESS_WINDING_RULE = 100140,
GLU_TESS_BOUNDARY_ONLY = 100141,
GLU_TESS_TOLERANCE = 100142,
/* Tessellation errors */
#define GLU_TESS_ERROR1 100151 /* Missing gluBeginPolygon */
#define GLU_TESS_ERROR2 100152 /* Missing gluBeginContour */
#define GLU_TESS_ERROR3 100153 /* Missing gluEndPolygon */
#define GLU_TESS_ERROR4 100154 /* Missing gluEndContour */
#define GLU_TESS_ERROR5 100155 /* */
#define GLU_TESS_ERROR6 100156 /* */
#define GLU_TESS_ERROR7 100157 /* */
#define GLU_TESS_ERROR8 100158 /* */
/* Tessellation errors */
GLU_TESS_ERROR1 = 100151, /* Missing gluBeginPolygon */
GLU_TESS_ERROR2 = 100152, /* Missing gluBeginContour */
GLU_TESS_ERROR3 = 100153, /* Missing gluEndPolygon */
GLU_TESS_ERROR4 = 100154, /* Missing gluEndContour */
GLU_TESS_ERROR5 = 100155, /* */
GLU_TESS_ERROR6 = 100156, /* */
GLU_TESS_ERROR7 = 100157, /* */
GLU_TESS_ERROR8 = 100158, /* */
GLU_TESS_ERROR9 = 100159, /* not coplanar contours */
/* NURBS */
#define GLU_AUTO_LOAD_MATRIX 100200
#define GLU_CULLING 100201
#define GLU_PARAMETRIC_TOLERANCE 100202
#define GLU_SAMPLING_TOLERANCE 100203
#define GLU_DISPLAY_MODE 100204
#define GLU_SAMPLING_METHOD 100205
#define GLU_U_STEP 100206
#define GLU_V_STEP 100207
/* NURBS */
GLU_AUTO_LOAD_MATRIX = 100200,
GLU_CULLING = 100201,
GLU_PARAMETRIC_TOLERANCE= 100202,
GLU_SAMPLING_TOLERANCE = 100203,
GLU_DISPLAY_MODE = 100204,
GLU_SAMPLING_METHOD = 100205,
GLU_U_STEP = 100206,
GLU_V_STEP = 100207,
#define GLU_PATH_LENGTH 100215
#define GLU_PARAMETRIC_ERROR 100216
#define GLU_DOMAIN_DISTANCE 100217
GLU_PATH_LENGTH = 100215,
GLU_PARAMETRIC_ERROR = 100216,
GLU_DOMAIN_DISTANCE = 100217,
#define GLU_MAP1_TRIM_2 100210
#define GLU_MAP1_TRIM_3 100211
GLU_MAP1_TRIM_2 = 100210,
GLU_MAP1_TRIM_3 = 100211,
#define GLU_OUTLINE_POLYGON 100240
#define GLU_OUTLINE_PATCH 100241
GLU_OUTLINE_POLYGON = 100240,
GLU_OUTLINE_PATCH = 100241,
#define GLU_NURBS_ERROR1 100251 /* spline order un-supported */
#define GLU_NURBS_ERROR2 100252 /* too few knots */
#define GLU_NURBS_ERROR3 100253 /* valid knot range is empty */
#define GLU_NURBS_ERROR4 100254 /* decreasing knot sequence */
#define GLU_NURBS_ERROR5 100255 /* knot multiplicity > spline order */
#define GLU_NURBS_ERROR6 100256 /* endcurve() must follow bgncurve() */
#define GLU_NURBS_ERROR7 100257 /* bgncurve() must precede endcurve() */
#define GLU_NURBS_ERROR8 100258 /* ctrlarray or knot vector is NULL */
#define GLU_NURBS_ERROR9 100259 /* can't draw pwlcurves */
#define GLU_NURBS_ERROR10 100260 /* missing gluNurbsCurve() */
#define GLU_NURBS_ERROR11 100261 /* missing gluNurbsSurface() */
#define GLU_NURBS_ERROR12 100262 /* endtrim() must precede endsurface() */
#define GLU_NURBS_ERROR13 100263 /* bgnsurface() must precede endsurface() */
#define GLU_NURBS_ERROR14 100264 /* curve of improper type passed as trim curve */
#define GLU_NURBS_ERROR15 100265 /* bgnsurface() must precede bgntrim() */
#define GLU_NURBS_ERROR16 100266 /* endtrim() must follow bgntrim() */
#define GLU_NURBS_ERROR17 100267 /* bgntrim() must precede endtrim()*/
#define GLU_NURBS_ERROR18 100268 /* invalid or missing trim curve*/
#define GLU_NURBS_ERROR19 100269 /* bgntrim() must precede pwlcurve() */
#define GLU_NURBS_ERROR20 100270 /* pwlcurve referenced twice*/
#define GLU_NURBS_ERROR21 100271 /* pwlcurve and nurbscurve mixed */
#define GLU_NURBS_ERROR22 100272 /* improper usage of trim data type */
#define GLU_NURBS_ERROR23 100273 /* nurbscurve referenced twice */
#define GLU_NURBS_ERROR24 100274 /* nurbscurve and pwlcurve mixed */
#define GLU_NURBS_ERROR25 100275 /* nurbssurface referenced twice */
#define GLU_NURBS_ERROR26 100276 /* invalid property */
#define GLU_NURBS_ERROR27 100277 /* endsurface() must follow bgnsurface() */
#define GLU_NURBS_ERROR28 100278 /* intersecting or misoriented trim curves */
#define GLU_NURBS_ERROR29 100279 /* intersecting trim curves */
#define GLU_NURBS_ERROR30 100280 /* UNUSED */
#define GLU_NURBS_ERROR31 100281 /* unconnected trim curves */
#define GLU_NURBS_ERROR32 100282 /* unknown knot error */
#define GLU_NURBS_ERROR33 100283 /* negative vertex count encountered */
#define GLU_NURBS_ERROR34 100284 /* negative byte-stride */
#define GLU_NURBS_ERROR35 100285 /* unknown type descriptor */
#define GLU_NURBS_ERROR36 100286 /* null control point reference */
#define GLU_NURBS_ERROR37 100287 /* duplicate point on pwlcurve */
GLU_NURBS_ERROR1 = 100251, /* spline order un-supported */
GLU_NURBS_ERROR2 = 100252, /* too few knots */
GLU_NURBS_ERROR3 = 100253, /* valid knot range is empty */
GLU_NURBS_ERROR4 = 100254, /* decreasing knot sequence */
GLU_NURBS_ERROR5 = 100255, /* knot multiplicity > spline order */
GLU_NURBS_ERROR6 = 100256, /* endcurve() must follow bgncurve() */
GLU_NURBS_ERROR7 = 100257, /* bgncurve() must precede endcurve() */
GLU_NURBS_ERROR8 = 100258, /* ctrlarray or knot vector is NULL */
GLU_NURBS_ERROR9 = 100259, /* can't draw pwlcurves */
GLU_NURBS_ERROR10 = 100260, /* missing gluNurbsCurve() */
GLU_NURBS_ERROR11 = 100261, /* missing gluNurbsSurface() */
GLU_NURBS_ERROR12 = 100262, /* endtrim() must precede endsurface() */
GLU_NURBS_ERROR13 = 100263, /* bgnsurface() must precede endsurface() */
GLU_NURBS_ERROR14 = 100264, /* curve of improper type passed as trim curve */
GLU_NURBS_ERROR15 = 100265, /* bgnsurface() must precede bgntrim() */
GLU_NURBS_ERROR16 = 100266, /* endtrim() must follow bgntrim() */
GLU_NURBS_ERROR17 = 100267, /* bgntrim() must precede endtrim()*/
GLU_NURBS_ERROR18 = 100268, /* invalid or missing trim curve*/
GLU_NURBS_ERROR19 = 100269, /* bgntrim() must precede pwlcurve() */
GLU_NURBS_ERROR20 = 100270, /* pwlcurve referenced twice*/
GLU_NURBS_ERROR21 = 100271, /* pwlcurve and nurbscurve mixed */
GLU_NURBS_ERROR22 = 100272, /* improper usage of trim data type */
GLU_NURBS_ERROR23 = 100273, /* nurbscurve referenced twice */
GLU_NURBS_ERROR24 = 100274, /* nurbscurve and pwlcurve mixed */
GLU_NURBS_ERROR25 = 100275, /* nurbssurface referenced twice */
GLU_NURBS_ERROR26 = 100276, /* invalid property */
GLU_NURBS_ERROR27 = 100277, /* endsurface() must follow bgnsurface() */
GLU_NURBS_ERROR28 = 100278, /* intersecting or misoriented trim curves */
GLU_NURBS_ERROR29 = 100279, /* intersecting trim curves */
GLU_NURBS_ERROR30 = 100280, /* UNUSED */
GLU_NURBS_ERROR31 = 100281, /* unconnected trim curves */
GLU_NURBS_ERROR32 = 100282, /* unknown knot error */
GLU_NURBS_ERROR33 = 100283, /* negative vertex count encountered */
GLU_NURBS_ERROR34 = 100284, /* negative byte-stride */
GLU_NURBS_ERROR35 = 100285, /* unknown type descriptor */
GLU_NURBS_ERROR36 = 100286, /* null control point reference */
GLU_NURBS_ERROR37 = 100287, /* duplicate point on pwlcurve */
/* Errors */
#define GLU_INVALID_ENUM 100900
#define GLU_INVALID_VALUE 100901
#define GLU_OUT_OF_MEMORY 100902
#define GLU_INCOMPATIBLE_GL_VERSION 100903
/* Errors */
GLU_INVALID_ENUM = 100900,
GLU_INVALID_VALUE = 100901,
GLU_OUT_OF_MEMORY = 100902,
GLU_INCOMPATIBLE_GL_VERSION = 100903,
/* New in GLU 1.1 */
#define GLU_VERSION 100800
#define GLU_EXTENSIONS 100801
/* New in GLU 1.1 */
GLU_VERSION = 100800,
GLU_EXTENSIONS = 100801,
/*** GLU 1.0 tessellation - obsolete! ***/
/*** GLU 1.0 tessellation - obsolete! ***/
/* Contour types */
#define GLU_CW 100120
#define GLU_CCW 100121
#define GLU_INTERIOR 100122
#define GLU_EXTERIOR 100123
#define GLU_UNKNOWN 100124
/* Contour types */
GLU_CW = 100120,
GLU_CCW = 100121,
GLU_INTERIOR = 100122,
GLU_EXTERIOR = 100123,
GLU_UNKNOWN = 100124,
/* Tessellator */
#define GLU_BEGIN GLU_TESS_BEGIN
#define GLU_VERTEX GLU_TESS_VERTEX
#define GLU_END GLU_TESS_END
#define GLU_ERROR GLU_TESS_ERROR
#define GLU_EDGE_FLAG GLU_TESS_EDGE_FLAG
/* Tessellator */
GLU_BEGIN = GLU_TESS_BEGIN,
GLU_VERTEX = GLU_TESS_VERTEX,
GLU_END = GLU_TESS_END,
GLU_ERROR = GLU_TESS_ERROR,
GLU_EDGE_FLAG = GLU_TESS_EDGE_FLAG
};
/*
* These are the GLU 1.1 typedefs. GLU 1.3 has different ones!
*/
#if defined(__BEOS__)
/* The BeOS does something funky and makes these typedefs in one
* of its system headers.
*/
#else
#if defined GLU_VERSION_1_2
typedef struct GLUquadric GLUquadricObj;
typedef struct GLUnurbs GLUnurbsObj;
/* FIXME: We need to implement the other 1.3 typedefs - GH */
typedef struct GLUtesselator GLUtesselator;
typedef GLUtesselator GLUtriangulatorObj;
#else
/* GLU 1.1 and older */
typedef struct GLUquadric GLUquadricObj;
typedef struct GLUtriangulatorObj GLUtriangulatorObj;
typedef struct GLUnurbs GLUnurbsObj;
#endif
#endif
@@ -246,37 +252,37 @@ extern "C" {
*/
GLUAPI void GLAPIENTRY gluLookAt( GLdouble eyex, GLdouble eyey, GLdouble eyez,
GLdouble centerx, GLdouble centery,
GLdouble centerz,
GLdouble upx, GLdouble upy, GLdouble upz );
GLdouble centerx, GLdouble centery,
GLdouble centerz,
GLdouble upx, GLdouble upy, GLdouble upz );
GLUAPI void GLAPIENTRY gluOrtho2D( GLdouble left, GLdouble right,
GLdouble bottom, GLdouble top );
GLdouble bottom, GLdouble top );
GLUAPI void GLAPIENTRY gluPerspective( GLdouble fovy, GLdouble aspect,
GLdouble zNear, GLdouble zFar );
GLdouble zNear, GLdouble zFar );
GLUAPI void GLAPIENTRY gluPickMatrix( GLdouble x, GLdouble y,
GLdouble width, GLdouble height,
const GLint viewport[4] );
GLdouble width, GLdouble height,
const GLint viewport[4] );
GLUAPI GLint GLAPIENTRY gluProject( GLdouble objx, GLdouble objy, GLdouble objz,
const GLdouble modelMatrix[16],
const GLdouble projMatrix[16],
const GLint viewport[4],
GLdouble *winx, GLdouble *winy,
GLdouble *winz );
GLUAPI GLint GLAPIENTRY gluUnProject( GLdouble winx, GLdouble winy,
GLdouble winz,
const GLdouble modelMatrix[16],
const GLdouble projMatrix[16],
const GLint viewport[4],
GLdouble *winx, GLdouble *winy,
GLdouble *winz );
GLUAPI GLint GLAPIENTRY gluUnProject( GLdouble winx, GLdouble winy,
GLdouble winz,
const GLdouble modelMatrix[16],
const GLdouble projMatrix[16],
const GLint viewport[4],
GLdouble *objx, GLdouble *objy,
GLdouble *objz );
GLdouble *objx, GLdouble *objy,
GLdouble *objz );
GLUAPI const GLubyte* GLAPIENTRY gluErrorString( GLenum errorCode );
@@ -289,19 +295,19 @@ GLUAPI const GLubyte* GLAPIENTRY gluErrorString( GLenum errorCode );
*/
GLUAPI GLint GLAPIENTRY gluScaleImage( GLenum format,
GLint widthin, GLint heightin,
GLenum typein, const void *datain,
GLint widthout, GLint heightout,
GLenum typeout, void *dataout );
GLsizei widthin, GLsizei heightin,
GLenum typein, const void *datain,
GLsizei widthout, GLsizei heightout,
GLenum typeout, void *dataout );
GLUAPI GLint GLAPIENTRY gluBuild1DMipmaps( GLenum target, GLint components,
GLint width, GLenum format,
GLenum type, const void *data );
GLsizei width, GLenum format,
GLenum type, const void *data );
GLUAPI GLint GLAPIENTRY gluBuild2DMipmaps( GLenum target, GLint components,
GLint width, GLint height,
GLenum format,
GLenum type, const void *data );
GLsizei width, GLsizei height,
GLenum format,
GLenum type, const void *data );
@@ -316,39 +322,37 @@ GLUAPI GLUquadricObj* GLAPIENTRY gluNewQuadric( void );
GLUAPI void GLAPIENTRY gluDeleteQuadric( GLUquadricObj *state );
GLUAPI void GLAPIENTRY gluQuadricDrawStyle( GLUquadricObj *quadObject,
GLenum drawStyle );
GLenum drawStyle );
GLUAPI void GLAPIENTRY gluQuadricOrientation( GLUquadricObj *quadObject,
GLenum orientation );
GLenum orientation );
GLUAPI void GLAPIENTRY gluQuadricNormals( GLUquadricObj *quadObject,
GLenum normals );
GLenum normals );
GLUAPI void GLAPIENTRY gluQuadricTexture( GLUquadricObj *quadObject,
GLboolean textureCoords );
GLboolean textureCoords );
GLUAPI void GLAPIENTRY gluQuadricCallback( GLUquadricObj *qobj,
GLenum which,
void (GLCALLBACK *fn)() );
GLenum which, void (GLCALLBACK *fn)() );
GLUAPI void GLAPIENTRY gluCylinder( GLUquadricObj *qobj,
GLdouble baseRadius,
GLdouble topRadius,
GLdouble height,
GLint slices, GLint stacks );
GLdouble baseRadius,
GLdouble topRadius,
GLdouble height,
GLint slices, GLint stacks );
GLUAPI void GLAPIENTRY gluSphere( GLUquadricObj *qobj,
GLdouble radius, GLint slices,
GLint stacks );
GLdouble radius, GLint slices, GLint stacks );
GLUAPI void GLAPIENTRY gluDisk( GLUquadricObj *qobj,
GLdouble innerRadius, GLdouble outerRadius,
GLint slices, GLint loops );
GLdouble innerRadius, GLdouble outerRadius,
GLint slices, GLint loops );
GLUAPI void GLAPIENTRY gluPartialDisk( GLUquadricObj *qobj, GLdouble innerRadius,
GLdouble outerRadius, GLint slices,
GLint loops, GLdouble startAngle,
GLdouble sweepAngle );
GLdouble outerRadius, GLint slices,
GLint loops, GLdouble startAngle,
GLdouble sweepAngle );
@@ -363,47 +367,46 @@ GLUAPI GLUnurbsObj* GLAPIENTRY gluNewNurbsRenderer( void );
GLUAPI void GLAPIENTRY gluDeleteNurbsRenderer( GLUnurbsObj *nobj );
GLUAPI void GLAPIENTRY gluLoadSamplingMatrices( GLUnurbsObj *nobj,
const GLfloat modelMatrix[16],
const GLfloat projMatrix[16],
const GLint viewport[4] );
const GLfloat modelMatrix[16],
const GLfloat projMatrix[16],
const GLint viewport[4] );
GLUAPI void GLAPIENTRY gluNurbsProperty( GLUnurbsObj *nobj, GLenum property,
GLfloat value );
GLfloat value );
GLUAPI void GLAPIENTRY gluGetNurbsProperty( GLUnurbsObj *nobj, GLenum property,
GLfloat *value );
GLfloat *value );
GLUAPI void GLAPIENTRY gluBeginCurve( GLUnurbsObj *nobj );
GLUAPI void GLAPIENTRY gluEndCurve( GLUnurbsObj * nobj );
GLUAPI void GLAPIENTRY gluNurbsCurve( GLUnurbsObj *nobj, GLint nknots,
GLfloat *knot, GLint stride,
GLfloat *ctlarray, GLint order,
GLenum type );
GLfloat *knot, GLint stride,
GLfloat *ctlarray, GLint order,
GLenum type );
GLUAPI void GLAPIENTRY gluBeginSurface( GLUnurbsObj *nobj );
GLUAPI void GLAPIENTRY gluEndSurface( GLUnurbsObj * nobj );
GLUAPI void GLAPIENTRY gluNurbsSurface( GLUnurbsObj *nobj,
GLint sknot_count, GLfloat *sknot,
GLint tknot_count, GLfloat *tknot,
GLint s_stride, GLint t_stride,
GLfloat *ctlarray,
GLint sorder, GLint torder,
GLenum type );
GLint sknot_count, GLfloat *sknot,
GLint tknot_count, GLfloat *tknot,
GLint s_stride, GLint t_stride,
GLfloat *ctlarray,
GLint sorder, GLint torder,
GLenum type );
GLUAPI void GLAPIENTRY gluBeginTrim( GLUnurbsObj *nobj );
GLUAPI void GLAPIENTRY gluEndTrim( GLUnurbsObj *nobj );
GLUAPI void GLAPIENTRY gluPwlCurve( GLUnurbsObj *nobj, GLint count,
GLfloat *array, GLint stride,
GLenum type );
GLfloat *array, GLint stride, GLenum type );
GLUAPI void GLAPIENTRY gluNurbsCallback( GLUnurbsObj *nobj, GLenum which,
void (GLCALLBACK *fn)() );
void (GLCALLBACK *fn)() );
@@ -413,6 +416,8 @@ GLUAPI void GLAPIENTRY gluNurbsCallback( GLUnurbsObj *nobj, GLenum which,
*
*/
#ifdef GLU_VERSION_1_2
GLUAPI GLUtesselator* GLAPIENTRY gluNewTess( void );
GLUAPI void GLAPIENTRY gluDeleteTess( GLUtesselator *tobj );
@@ -441,17 +446,26 @@ GLUAPI void GLAPIENTRY gluTessCallback( GLUtesselator *tobj, GLenum which,
GLUAPI void GLAPIENTRY gluGetTessProperty( GLUtesselator *tobj, GLenum which,
GLdouble *value );
/*
*
* Obsolete 1.0 tessellation functions
*
*/
#else
GLUAPI void GLAPIENTRY gluBeginPolygon( GLUtesselator *tobj );
GLUAPI GLUtriangulatorObj* GLAPIENTRY gluNewTess( void );
GLUAPI void GLAPIENTRY gluNextContour( GLUtesselator *tobj, GLenum type );
GLUAPI void GLAPIENTRY gluTessCallback( GLUtriangulatorObj *tobj, GLenum which,
void (GLCALLBACK *fn)() );
GLUAPI void GLAPIENTRY gluDeleteTess( GLUtriangulatorObj *tobj );
GLUAPI void GLAPIENTRY gluBeginPolygon( GLUtriangulatorObj *tobj );
GLUAPI void GLAPIENTRY gluEndPolygon( GLUtriangulatorObj *tobj );
GLUAPI void GLAPIENTRY gluNextContour( GLUtriangulatorObj *tobj, GLenum type );
GLUAPI void GLAPIENTRY gluTessVertex( GLUtriangulatorObj *tobj, GLdouble v[3],
void *data );
#endif
GLUAPI void GLAPIENTRY gluEndPolygon( GLUtesselator *tobj );
@@ -465,6 +479,21 @@ GLUAPI const GLubyte* GLAPIENTRY gluGetString( GLenum name );
/*
*
* GLU 1.3 functions
*
*/
#ifdef GLU_VERSION_1_3
GLUAPI GLboolean GLAPIENTRY
gluCheckExtension( const char *extName, const GLubyte *extString );
#endif
#if defined(__BEOS__) || defined(__QUICKDRAW__)
#pragma export off
#endif

View File

@@ -108,7 +108,7 @@ extern _CRTIMP void __cdecl exit(int);
and redifinition of Windows system defs, also removes requirement of
pretty much any standard windows header from this file */
#if (_MSC_VER >= 800) || defined(_STDCALL_SUPPORTED)
#if (_MSC_VER >= 800) || defined(_STDCALL_SUPPORTED) || defined(__CYGWIN32__)
# define GLUTAPIENTRY __stdcall
#else
# define GLUTAPIENTRY
@@ -199,7 +199,7 @@ WGLAPI int GLAPIENTRY SetPixelFormat(HDC,int,const PIXELFORMATDESCRIPTOR *);
# define GLUTCALLBACK
# define GLUTAPI extern
/* Prototype exit for the non-Win32 case (see above). */
extern void exit(int);
/*extern void exit(int); this screws up gcc -ansi -pedantic! */
#endif

View File

@@ -1,10 +1,10 @@
/* $Id: glx.h,v 1.5.2.2 1999/12/10 14:55:38 brianp Exp $ */
/* $Id: glx.h,v 1.5.2.3 2000/02/23 23:05:07 brianp Exp $ */
/*
* Mesa 3-D graphics library
* Version: 3.1
* Version: 3.2
*
* Copyright (C) 1999 Brian Paul All Rights Reserved.
* 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"),
@@ -156,7 +156,7 @@ extern Bool glXMakeCurrent( Display *dpy, GLXDrawable drawable,
GLXContext ctx);
extern void glXCopyContext( Display *dpy, GLXContext src, GLXContext dst,
GLuint mask );
unsigned long mask );
extern void glXSwapBuffers( Display *dpy, GLXDrawable drawable );

View File

@@ -1,10 +1,10 @@
/* $Id: osmesa.h,v 1.1.1.1.2.1 1999/11/24 18:39:17 brianp Exp $ */
/* $Id: osmesa.h,v 1.1.1.1.2.2 2000/02/09 18:53:55 brianp Exp $ */
/*
* Mesa 3-D graphics library
* Version: 3.1
* Version: 3.2
*
* Copyright (C) 1999 Brian Paul All Rights Reserved.
* 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"),
@@ -25,29 +25,6 @@
*/
/*
* $Log: osmesa.h,v $
* Revision 1.1.1.1.2.1 1999/11/24 18:39:17 brianp
* bumped version to 3.1
*
* Revision 1.1.1.1 1999/08/19 00:55:40 jtg
* Imported sources
*
* Revision 1.4 1999/02/14 03:39:09 brianp
* new copyright
*
* Revision 1.3 1999/01/03 02:52:30 brianp
* now using GLAPI and GLAPIENTRY keywords (Ted Jump)
*
* Revision 1.2 1998/07/26 01:33:51 brianp
* added WINGDIAPI and APIENTRY keywords per Ted Jump
*
* Revision 1.1 1998/02/13 03:17:50 brianp
* Initial revision
*
*/
/*
* Mesa Off-Screen rendering interface.
*
@@ -89,7 +66,7 @@ extern "C" {
#define OSMESA_MAJOR_VERSION 3
#define OSMESA_MINOR_VERSION 1
#define OSMESA_MINOR_VERSION 2

View File

@@ -1,9 +1,9 @@
/* $Id: svgamesa.h,v 1.1.1.1.2.1 1999/11/24 18:40:45 brianp Exp $ */
/* $Id: svgamesa.h,v 1.1.1.1.2.2 2000/01/22 19:58:02 brianp Exp $ */
/*
* Mesa 3-D graphics library
* Version: 3.1
* Copyright (C) 1995-1998 Brian Paul
* Version: 3.2
* 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
@@ -21,21 +21,6 @@
*/
/*
* $Log: svgamesa.h,v $
* Revision 1.1.1.1.2.1 1999/11/24 18:40:45 brianp
* bumped version to 3.1
*
* Revision 1.1.1.1 1999/08/19 00:55:40 jtg
* Imported sources
*
* Revision 3.0 1998/02/20 05:07:24 brianp
* initial rev
*
*/
/*
* SVGA/Mesa interface for Linux.
*/
@@ -68,7 +53,7 @@
#define SVGAMESA_MAJOR_VERSION 3
#define SVGAMESA_MINOR_VERSION 1
#define SVGAMESA_MINOR_VERSION 2
#ifdef __cplusplus
@@ -90,16 +75,21 @@ typedef struct svgamesa_context *SVGAMesaContext;
/*
* doubleBuffer flag new in version 2.4
*/
extern int SVGAMesaInit( int GraphMode );
extern int SVGAMesaClose( void );
extern SVGAMesaContext SVGAMesaCreateContext( GLboolean doubleBuffer );
extern void SVGAMesaDestroyContext( SVGAMesaContext ctx );
extern void SVGAMesaMakeCurrent( SVGAMesaContext ctx );
extern SVGAMesaContext SVGAMesaGetCurrentContext( void );
extern void SVGAMesaSwapBuffers( void );
extern void SVGAMesaSetCI(int ndx, GLubyte red, GLubyte green, GLubyte blue);
extern SVGAMesaContext SVGAMesaGetCurrentContext( void );
#ifdef __cplusplus
}

View File

@@ -1,10 +1,10 @@
/* $Id: xmesa.h,v 1.1.1.1.2.2 1999/12/13 21:54:19 brianp Exp $ */
/* $Id: xmesa.h,v 1.1.1.1.2.3 2000/02/09 18:53:55 brianp Exp $ */
/*
* Mesa 3-D graphics library
* Version: 3.1
* Version: 3.2
*
* Copyright (C) 1999 Brian Paul All Rights Reserved.
* 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"),
@@ -25,29 +25,6 @@
*/
/*
* $Log: xmesa.h,v $
* Revision 1.1.1.1.2.2 1999/12/13 21:54:19 brianp
* applied Daryll's patches
*
* Revision 1.1.1.1.2.1 1999/11/24 18:41:37 brianp
* bumped version to 3.1
*
* Revision 1.1.1.1 1999/08/19 00:55:40 jtg
* Imported sources
*
* Revision 1.3 1999/02/24 22:43:27 jens
* Name changes to get XMesa to compile standalone inside XFree86
*
* Revision 1.2 1999/02/14 03:39:09 brianp
* new copyright
*
* Revision 1.1 1998/02/13 03:17:32 brianp
* Initial revision
*
*/
/*
* Mesa/X11 interface. This header file serves as the documentation for
* the Mesa/X11 interface functions.
@@ -115,7 +92,7 @@ extern struct Library *XLibBase;
#define XMESA_MAJOR_VERSION 3
#define XMESA_MINOR_VERSION 1
#define XMESA_MINOR_VERSION 2

View File

@@ -1,8 +1,8 @@
# $Id: Makefile.X11,v 1.3 1999/10/27 10:09:53 brianp Exp $
# $Id: Makefile.X11,v 1.3.2.1 2000/04/24 15:29:02 brianp Exp $
# Mesa 3-D graphics library
# Version: 3.1
# Copyright (C) 1995-1998 Brian Paul
# Version: 3.2
# Copyright (C) 1995-2000 Brian Paul
# Makefile for GLUT-based demo programs for Unix/X11
@@ -19,7 +19,7 @@ LIB_DEP = $(LIBDIR)/$(GL_LIB) $(LIBDIR)/$(GLU_LIB) $(LIBDIR)/$(GLUT_LIB)
PROGS = bounce clearspd drawpix gamma gears glinfo gloss glutfx isosurf \
morph3d multiarb osdemo paltex pointblast reflect \
renormal spectex stex3d tessdemo texcyl texobj trispd winpos \
renormal spectex stex3d tessdemo texcyl texobj trispd winpos
##### RULES #####

View File

@@ -1,5 +1,5 @@
/* $Id: gamma.c,v 1.1 1999/08/19 00:55:40 jtg Exp $ */
/* $Id: gamma.c,v 1.1.1.1.2.1 2000/03/18 01:14:01 brianp Exp $ */
/* Draw test patterns to help determine correct gamma value for a display.
When the intensities of the inner squares nearly match the intensities
@@ -25,8 +25,14 @@
/*
* $Log: gamma.c,v $
* Revision 1.1 1999/08/19 00:55:40 jtg
* Initial revision
* Revision 1.1.1.1.2.1 2000/03/18 01:14:01 brianp
* colors were computed incorrectly (Hans Nelles)
*
* Revision 1.2 2000/03/18 01:13:29 brianp
* colors were computed incorrectly (Hans Nelles)
*
* Revision 1.1.1.1 1999/08/19 00:55:40 jtg
* Imported sources
*
* Revision 3.1 1999/06/19 01:35:38 brianp
* merged in Kai Schuetz's RGB changes
@@ -130,8 +136,9 @@ gamma_ramp(GLfloat yoffs, GLfloat r, GLfloat g, GLfloat b)
for(d = 1; d < 4; d++) { /* increasing density from 25% to 75% */
GLfloat xcoord = (-1.0 + d*0.4);
GLfloat t = d * 0.25;
glColor3f(r*d / 5.0, g*d / 5.0, b*d / 5.0); /* draw outer rect */
glColor3f(r*t, g*t, b*t); /* draw outer rect */
glRectf(xcoord, yoffs, xcoord+0.4, yoffs + 0.5);
glColor3f(0.0, 0.0, 0.0); /* "clear" inner rect */

View File

@@ -1,7 +1,10 @@
/* $Id: morph3d.c,v 1.2 1999/09/17 12:27:01 brianp Exp $ */
/* $Id: morph3d.c,v 1.2.2.1 1999/12/15 13:00:24 brianp Exp $ */
/*
* $Log: morph3d.c,v $
* Revision 1.2.2.1 1999/12/15 13:00:24 brianp
* moved #define to column 0
*
* Revision 1.2 1999/09/17 12:27:01 brianp
* silenced some warnings
*
@@ -498,7 +501,7 @@ static void draw_dodeca( void )
{
GLuint list;
#define TAU ((SQRT5+1)/2)
#define TAU ((SQRT5+1)/2)
list = glGenLists( 1 );
glNewList( list, GL_COMPILE );

View File

@@ -1,4 +1,4 @@
/* $Id: multiarb.c,v 1.3 1999/10/21 16:40:32 brianp Exp $ */
/* $Id: multiarb.c,v 1.3.2.2 2000/02/02 17:32:15 brianp Exp $ */
/*
* GL_ARB_multitexture demo
@@ -12,6 +12,12 @@
/*
* $Log: multiarb.c,v $
* Revision 1.3.2.2 2000/02/02 17:32:15 brianp
* changed > to >=
*
* Revision 1.3.2.1 2000/02/02 01:08:09 brianp
* limit Drift to [0, 1]
*
* Revision 1.3 1999/10/21 16:40:32 brianp
* added -info command line option
*
@@ -61,6 +67,8 @@ static void Idle( void )
{
if (Animate) {
Drift += 0.05;
if (Drift >= 1.0)
Drift = 0.0;
#ifdef GL_ARB_multitexture
glActiveTextureARB(GL_TEXTURE0_ARB);

View File

@@ -1,4 +1,4 @@
/* $Id: stex3d.c,v 1.2 1999/09/17 12:27:01 brianp Exp $ */
/* $Id: stex3d.c,v 1.2.2.1 1999/12/16 08:53:51 brianp Exp $ */
/*-----------------------------
* stex3d.c GL example of the mesa 3d-texture extention to simulate procedural
@@ -17,6 +17,9 @@
/*
* $Log: stex3d.c,v $
* Revision 1.2.2.1 1999/12/16 08:53:51 brianp
* added a cast to malloc call
*
* Revision 1.2 1999/09/17 12:27:01 brianp
* silenced some warnings
*
@@ -230,7 +233,7 @@ void create3Dtexture()
int tmp;
printf("creating 3d textures...\n");
voxels = (unsigned char *) malloc((4*tex_width*tex_height*tex_depth));
voxels = (unsigned char *) malloc((size_t) (4*tex_width*tex_height*tex_depth));
vp=voxels;
for (i=0;i<tex_width;i++){
vec[0]=i;

View File

@@ -1,51 +1,7 @@
/* $Id: tessdemo.c,v 1.3.2.1 1999/11/16 11:09:09 gareth Exp $ */
/* $Id: tessdemo.c,v 1.3.2.3 2000/07/11 01:45:28 brianp Exp $ */
/*
* A demo of the GLU polygon tesselation functions written by Bogdan Sikorski.
* This demo isn't built by the Makefile because it needs GLUT. After you've
* installed GLUT you can try this demo.
* Here's the command for IRIX, for example:
cc -g -ansi -prototypes -fullwarn -float -I../include -DSHM tess_demo.c -L../lib -lglut -lMesaGLU -lMesaGL -lm -lX11 -lXext -lXmu -lfpe -lXext -o tess_demo
*/
/*
* Updated for GLU 1.3 tessellation by Gareth Hughes <garethh@bell-labs.com>
*/
/*
* $Log: tessdemo.c,v $
* Revision 1.3.2.1 1999/11/16 11:09:09 gareth
* Added combine callback. Converted vertices from ints to floats.
*
* Revision 1.3 1999/11/04 04:00:42 gareth
* Updated demo for new GLU 1.3 tessellation. Added optimized rendering
* by saving the output of the tessellation into display lists.
*
* Revision 1.2 1999/09/19 20:09:00 tanner
*
* lots of autoconf updates
*
* Revision 1.1.1.1 1999/08/19 00:55:40 jtg
* Imported sources
*
* Revision 3.5 1999/03/28 18:24:37 brianp
* minor clean-up
*
* Revision 3.4 1999/02/14 03:37:07 brianp
* fixed callback problem
*
* Revision 3.3 1998/07/26 01:25:26 brianp
* removed include of gl.h and glu.h
*
* Revision 3.2 1998/06/29 02:37:30 brianp
* minor changes for Windows (Ted Jump)
*
* Revision 3.1 1998/06/09 01:53:49 brianp
* main() should return an int
*
* Revision 3.0 1998/02/14 18:42:29 brianp
* initial rev
*
*/
@@ -54,422 +10,322 @@
#include <stdlib.h>
#include <string.h>
#define MAX_POINTS 256
#define MAX_CONTOURS 32
#define MAX_TRIANGLES 256
#define MAX_POINTS 200
#define MAX_CONTOURS 50
#ifndef GLCALLBACK
#ifdef CALLBACK
#define GLCALLBACK CALLBACK
#else
#define GLCALLBACK
#endif
#endif
static int menu;
typedef enum
{ QUIT, TESSELATE, CLEAR }
menu_entries;
typedef enum{ QUIT, TESSELATE, CLEAR } menu_entries;
typedef enum{ DEFINE, TESSELATED } mode_type;
typedef enum
{ DEFINE, TESSELATED }
mode_type;
static GLsizei width, height;
static GLuint contour_cnt;
static GLuint triangle_cnt;
static mode_type mode;
static int menu;
static GLuint list_start;
static GLfloat edge_color[3];
static struct
struct
{
GLfloat p[MAX_POINTS][2];
GLuint point_cnt;
} contours[MAX_CONTOURS];
GLint p[MAX_POINTS][2];
GLuint point_cnt;
}
contours[MAX_CONTOURS];
static struct
static GLuint contour_cnt;
static GLsizei width, height;
static mode_type mode;
struct
{
GLsizei no;
GLfloat p[3][2];
GLclampf color[3][3];
} triangles[MAX_TRIANGLES];
GLsizei no;
GLfloat color[3];
GLint p[3][2];
GLclampf p_color[3][3];
}
triangle;
void GLCALLBACK error_callback( GLenum err )
static void GLCALLBACK
my_error(GLenum err)
{
int len, i;
char const *str;
int len, i;
char const *str;
glColor3f( 0.9, 0.9, 0.9 );
glRasterPos2i( 5, 5 );
glColor3f(0.9, 0.9, 0.9);
glRasterPos2i(5, 5);
str = (const char *) gluErrorString(err);
len = strlen(str);
for (i = 0; i < len; i++)
glutBitmapCharacter(GLUT_BITMAP_9_BY_15, str[i]);
}
str = (const char *) gluErrorString( err );
len = strlen( str );
for ( i = 0 ; i < len ; i++ ) {
glutBitmapCharacter( GLUT_BITMAP_9_BY_15, str[i] );
static void GLCALLBACK
begin_callback(GLenum mode)
{
triangle.no = 0;
}
static void GLCALLBACK
edge_callback(GLenum flag)
{
if (flag == GL_TRUE) {
triangle.color[0] = 1.0;
triangle.color[1] = 1.0;
triangle.color[2] = 0.5;
}
else {
triangle.color[0] = 1.0;
triangle.color[1] = 0.0;
triangle.color[2] = 0.0;
}
}
void GLCALLBACK begin_callback( GLenum mode )
static void GLCALLBACK
end_callback()
{
/* Allow multiple triangles to be output inside the begin/end pair. */
triangle_cnt = 0;
triangles[triangle_cnt].no = 0;
}
void GLCALLBACK edge_callback( GLenum flag )
{
/* Persist the edge flag across triangles. */
if ( flag == GL_TRUE )
{
edge_color[0] = 1.0;
edge_color[1] = 1.0;
edge_color[2] = 0.5;
}
else
{
edge_color[0] = 1.0;
edge_color[1] = 0.0;
edge_color[2] = 0.0;
}
}
void GLCALLBACK end_callback()
{
GLint i;
glBegin( GL_LINES );
/* Output the three edges of each triangle as lines colored
according to their edge flag. */
for ( i = 0 ; i < triangle_cnt ; i++ )
{
glColor3f( triangles[i].color[0][0],
triangles[i].color[0][1],
triangles[i].color[0][2] );
glVertex2f( triangles[i].p[0][0], triangles[i].p[0][1] );
glVertex2f( triangles[i].p[1][0], triangles[i].p[1][1] );
glColor3f( triangles[i].color[1][0],
triangles[i].color[1][1],
triangles[i].color[1][2] );
glVertex2f( triangles[i].p[1][0], triangles[i].p[1][1] );
glVertex2f( triangles[i].p[2][0], triangles[i].p[2][1] );
glColor3f( triangles[i].color[2][0],
triangles[i].color[2][1],
triangles[i].color[2][2] );
glVertex2f( triangles[i].p[2][0], triangles[i].p[2][1] );
glVertex2f( triangles[i].p[0][0], triangles[i].p[0][1] );
}
glBegin(GL_LINES);
glColor3f(triangle.p_color[0][0], triangle.p_color[0][1],
triangle.p_color[0][2]);
glVertex2i(triangle.p[0][0], triangle.p[0][1]);
glVertex2i(triangle.p[1][0], triangle.p[1][1]);
glColor3f(triangle.p_color[1][0], triangle.p_color[1][1],
triangle.p_color[1][2]);
glVertex2i(triangle.p[1][0], triangle.p[1][1]);
glVertex2i(triangle.p[2][0], triangle.p[2][1]);
glColor3f(triangle.p_color[2][0], triangle.p_color[2][1],
triangle.p_color[2][2]);
glVertex2i(triangle.p[2][0], triangle.p[2][1]);
glVertex2i(triangle.p[0][0], triangle.p[0][1]);
glEnd();
}
void GLCALLBACK vertex_callback( void *data )
static void GLCALLBACK
vertex_callback(void *data)
{
GLsizei no;
GLfloat *p;
GLsizei no;
GLint *p;
p = (GLfloat *) data;
no = triangles[triangle_cnt].no;
triangles[triangle_cnt].p[no][0] = p[0];
triangles[triangle_cnt].p[no][1] = p[1];
triangles[triangle_cnt].color[no][0] = edge_color[0];
triangles[triangle_cnt].color[no][1] = edge_color[1];
triangles[triangle_cnt].color[no][2] = edge_color[2];
/* After every three vertices, initialize the next triangle. */
if ( ++(triangles[triangle_cnt].no) == 3 )
{
triangle_cnt++;
triangles[triangle_cnt].no = 0;
}
}
void GLCALLBACK combine_callback( GLdouble coords[3],
GLdouble *vertex_data[4],
GLfloat weight[4], void **data )
{
GLfloat *vertex;
int i;
vertex = (GLfloat *) malloc( 2 * sizeof(GLfloat) );
vertex[0] = (GLfloat) coords[0];
vertex[1] = (GLfloat) coords[1];
*data = vertex;
p = (GLint *) data;
no = triangle.no;
triangle.p[no][0] = p[0];
triangle.p[no][1] = p[1];
triangle.p_color[no][0] = triangle.color[0];
triangle.p_color[no][1] = triangle.color[1];
triangle.p_color[no][2] = triangle.color[2];
++(triangle.no);
}
void set_screen_wh( GLsizei w, GLsizei h )
static void
set_screen_wh(GLsizei w, GLsizei h)
{
width = w;
height = h;
}
void tesse( void )
{
GLUtesselator *tobj;
GLdouble data[3];
GLuint i, j, point_cnt;
list_start = glGenLists( 2 );
static void
tesse(void)
{
GLUtriangulatorObj *tobj;
GLdouble data[3];
GLuint i, j, point_cnt;
tobj = gluNewTess();
if ( tobj != NULL )
{
gluTessCallback( tobj, GLU_TESS_BEGIN, glBegin );
gluTessCallback( tobj, GLU_TESS_VERTEX, glVertex2fv );
gluTessCallback( tobj, GLU_TESS_END, glEnd );
gluTessCallback( tobj, GLU_TESS_ERROR, error_callback );
gluTessCallback( tobj, GLU_TESS_COMBINE, combine_callback );
glNewList( list_start, GL_COMPILE );
gluBeginPolygon( tobj );
for ( j = 0 ; j <= contour_cnt ; j++ )
{
if (tobj != NULL) {
glClear(GL_COLOR_BUFFER_BIT);
glColor3f(0.7, 0.7, 0.0);
gluTessCallback(tobj, GLU_BEGIN, glBegin);
gluTessCallback(tobj, GLU_END, glEnd);
gluTessCallback(tobj, GLU_ERROR, my_error);
gluTessCallback(tobj, GLU_VERTEX, glVertex2iv);
gluBeginPolygon(tobj);
for (j = 0; j <= contour_cnt; j++) {
point_cnt = contours[j].point_cnt;
gluNextContour( tobj, GLU_UNKNOWN );
for ( i = 0 ; i < point_cnt ; i++ )
{
data[0] = (GLdouble)( contours[j].p[i][0] );
data[1] = (GLdouble)( contours[j].p[i][1] );
gluNextContour(tobj, GLU_UNKNOWN);
for (i = 0; i < point_cnt; i++) {
data[0] = (GLdouble) (contours[j].p[i][0]);
data[1] = (GLdouble) (contours[j].p[i][1]);
data[2] = 0.0;
gluTessVertex( tobj, data, contours[j].p[i] );
gluTessVertex(tobj, data, contours[j].p[i]);
}
}
gluEndPolygon( tobj );
glEndList();
gluTessCallback( tobj, GLU_TESS_BEGIN, begin_callback );
gluTessCallback( tobj, GLU_TESS_VERTEX, vertex_callback );
gluTessCallback( tobj, GLU_TESS_END, end_callback );
gluTessCallback( tobj, GLU_TESS_EDGE_FLAG, edge_callback );
glNewList( list_start + 1, GL_COMPILE );
gluBeginPolygon( tobj );
for ( j = 0 ; j <= contour_cnt ; j++ )
{
gluEndPolygon(tobj);
glLineWidth(2.0);
gluTessCallback(tobj, GLU_BEGIN, begin_callback);
gluTessCallback(tobj, GLU_END, end_callback);
gluTessCallback(tobj, GLU_VERTEX, vertex_callback);
gluTessCallback(tobj, GLU_EDGE_FLAG, edge_callback);
gluBeginPolygon(tobj);
for (j = 0; j <= contour_cnt; j++) {
point_cnt = contours[j].point_cnt;
gluNextContour( tobj, GLU_UNKNOWN );
for ( i = 0 ; i < point_cnt ; i++ )
{
data[0] = (GLdouble)( contours[j].p[i][0] );
data[1] = (GLdouble)( contours[j].p[i][1] );
gluNextContour(tobj, GLU_UNKNOWN);
for (i = 0; i < point_cnt; i++) {
data[0] = (GLdouble) (contours[j].p[i][0]);
data[1] = (GLdouble) (contours[j].p[i][1]);
data[2] = 0.0;
gluTessVertex( tobj, data, contours[j].p[i] );
gluTessVertex(tobj, data, contours[j].p[i]);
}
}
gluEndPolygon( tobj );
glEndList();
gluDeleteTess( tobj );
glutMouseFunc( NULL );
gluEndPolygon(tobj);
gluDeleteTess(tobj);
glutMouseFunc(NULL);
glColor3f(1.0, 1.0, 0.0);
glLineWidth(1.0);
mode = TESSELATED;
}
}
void left_down( int x1, int y1 )
static void
left_down(int x1, int y1)
{
GLfloat P[2];
GLuint point_cnt;
GLint P[2];
GLuint point_cnt;
/* translate GLUT into GL coordinates */
P[0] = x1;
P[1] = height - y1;
point_cnt = contours[contour_cnt].point_cnt;
contours[contour_cnt].p[point_cnt][0] = P[0];
contours[contour_cnt].p[point_cnt][1] = P[1];
glBegin( GL_LINES );
if ( point_cnt )
{
glVertex2fv( contours[contour_cnt].p[point_cnt-1] );
glVertex2fv( P );
glBegin(GL_LINES);
if (point_cnt) {
glVertex2iv(contours[contour_cnt].p[point_cnt - 1]);
glVertex2iv(P);
}
else
{
glVertex2fv( P );
glVertex2fv( P );
else {
glVertex2iv(P);
glVertex2iv(P);
}
glEnd();
glFinish();
contours[contour_cnt].point_cnt++;
++(contours[contour_cnt].point_cnt);
}
void middle_down( int x1, int y1 )
static void
middle_down(int x1, int y1)
{
GLuint point_cnt;
(void) x1;
(void) y1;
GLuint point_cnt;
point_cnt = contours[contour_cnt].point_cnt;
if ( point_cnt > 2 )
{
glBegin( GL_LINES );
glVertex2fv( contours[contour_cnt].p[0] );
glVertex2fv( contours[contour_cnt].p[point_cnt-1] );
if (point_cnt > 2) {
glBegin(GL_LINES);
glVertex2iv(contours[contour_cnt].p[0]);
glVertex2iv(contours[contour_cnt].p[point_cnt - 1]);
contours[contour_cnt].p[point_cnt][0] = -1;
glEnd();
glFinish();
contour_cnt++;
contours[contour_cnt].point_cnt = 0;
}
}
void mouse_clicked( int button, int state, int x, int y )
{
x -= x%10;
y -= y%10;
switch ( button )
{
static void
mouse_clicked(int button, int state, int x, int y)
{
x -= x % 10;
y -= y % 10;
switch (button) {
case GLUT_LEFT_BUTTON:
if ( state == GLUT_DOWN ) {
left_down( x, y );
}
if (state == GLUT_DOWN)
left_down(x, y);
break;
case GLUT_MIDDLE_BUTTON:
if ( state == GLUT_DOWN ) {
middle_down( x, y );
}
if (state == GLUT_DOWN)
middle_down(x, y);
break;
}
}
void display( void )
static void
display(void)
{
GLuint i,j;
GLuint i, j;
GLuint point_cnt;
glClear( GL_COLOR_BUFFER_BIT );
switch ( mode )
{
glClear(GL_COLOR_BUFFER_BIT);
switch (mode) {
case DEFINE:
/* draw grid */
glColor3f( 0.6, 0.5, 0.5 );
glBegin( GL_LINES );
for ( i = 0 ; i < width ; i += 10 )
{
for ( j = 0 ; j < height ; j += 10 )
{
glVertex2i( 0, j );
glVertex2i( width, j );
glVertex2i( i, height );
glVertex2i( i, 0 );
glColor3f(0.6, 0.5, 0.5);
glBegin(GL_LINES);
for (i = 0; i < width; i += 10)
for (j = 0; j < height; j += 10) {
glVertex2i(0, j);
glVertex2i(width, j);
glVertex2i(i, height);
glVertex2i(i, 0);
}
}
glColor3f( 1.0, 1.0, 0.0 );
for ( i = 0 ; i <= contour_cnt ; i++ )
{
glEnd();
glColor3f(1.0, 1.0, 0.0);
for (i = 0; i <= contour_cnt; i++) {
point_cnt = contours[i].point_cnt;
glBegin( GL_LINES );
switch ( point_cnt )
{
glBegin(GL_LINES);
switch (point_cnt) {
case 0:
break;
case 1:
glVertex2fv( contours[i].p[0] );
glVertex2fv( contours[i].p[0] );
glVertex2iv(contours[i].p[0]);
glVertex2iv(contours[i].p[0]);
break;
case 2:
glVertex2fv( contours[i].p[0] );
glVertex2fv( contours[i].p[1] );
glVertex2iv(contours[i].p[0]);
glVertex2iv(contours[i].p[1]);
break;
default:
--point_cnt;
for ( j = 0 ; j < point_cnt ; j++ )
{
glVertex2fv( contours[i].p[j] );
glVertex2fv( contours[i].p[j+1] );
for (j = 0; j < point_cnt; j++) {
glVertex2iv(contours[i].p[j]);
glVertex2iv(contours[i].p[j + 1]);
}
if ( contours[i].p[j+1][0] == -1 )
{
glVertex2fv( contours[i].p[0] );
glVertex2fv( contours[i].p[j] );
if (contours[i].p[j + 1][0] == -1) {
glVertex2iv(contours[i].p[0]);
glVertex2iv(contours[i].p[j]);
}
break;
}
glEnd();
}
glFinish();
break;
case TESSELATED:
/* draw triangles */
glColor3f( 0.7, 0.7, 0.0 );
glCallList( list_start );
glLineWidth( 2.0 );
glCallList( list_start + 1 );
glLineWidth( 1.0 );
glFlush();
/* draw lines */
tesse();
break;
}
glColor3f( 1.0, 1.0, 0.0 );
glColor3f(1.0, 1.0, 0.0);
}
void clear( void )
static void
clear(void)
{
contour_cnt = 0;
contours[0].point_cnt = 0;
triangle_cnt = 0;
glutMouseFunc( mouse_clicked );
glutMouseFunc(mouse_clicked);
mode = DEFINE;
glDeleteLists( list_start, 2 );
list_start = 0;
display();
}
void quit( void )
static void
quit(void)
{
exit( 0 );
exit(0);
}
void menu_selected( int entry )
static void
menu_selected(int entry)
{
switch ( entry )
{
switch (entry) {
case CLEAR:
clear();
break;
@@ -480,99 +336,87 @@ void menu_selected( int entry )
quit();
break;
}
glutPostRedisplay();
}
void key_pressed( unsigned char key, int x, int y )
{
(void) x;
(void) y;
switch ( key )
{
case 'c':
case 'C':
clear();
break;
static void
key_pressed(unsigned char key, int x, int y)
{
switch (key) {
case 't':
case 'T':
tesse();
glFinish();
break;
case 'q':
case 'Q':
quit();
break;
case 'c':
case 'C':
clear();
break;
}
glutPostRedisplay();
}
void myinit( void )
static void
myinit(void)
{
/* clear background to gray */
glClearColor( 0.4, 0.4, 0.4, 0.0 );
glShadeModel( GL_FLAT );
glPolygonMode( GL_FRONT, GL_FILL );
menu = glutCreateMenu( menu_selected );
glutAddMenuEntry( "clear", CLEAR );
glutAddMenuEntry( "tesselate", TESSELATE );
glutAddMenuEntry( "quit", QUIT );
glutAttachMenu( GLUT_RIGHT_BUTTON );
glutMouseFunc( mouse_clicked );
glutKeyboardFunc( key_pressed );
/* clear background to gray */
glClearColor(0.4, 0.4, 0.4, 0.0);
glShadeModel(GL_FLAT);
menu = glutCreateMenu(menu_selected);
glutAddMenuEntry("clear", CLEAR);
glutAddMenuEntry("tesselate", TESSELATE);
glutAddMenuEntry("quit", QUIT);
glutAttachMenu(GLUT_RIGHT_BUTTON);
glutMouseFunc(mouse_clicked);
glutKeyboardFunc(key_pressed);
contour_cnt = 0;
glPolygonMode(GL_FRONT, GL_FILL);
mode = DEFINE;
}
static void reshape( GLsizei w, GLsizei h )
static void
reshape(GLsizei w, GLsizei h)
{
glViewport( 0, 0, w, h );
glMatrixMode( GL_PROJECTION );
glViewport(0, 0, w, h);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho( 0.0, (GLdouble)w, 0.0, (GLdouble)h, -1.0, 1.0 );
glMatrixMode( GL_MODELVIEW );
glOrtho(0.0, (GLdouble) w, 0.0, (GLdouble) h, -1.0, 1.0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
set_screen_wh( w, h );
set_screen_wh(w, h);
}
static void usage( void )
static void
usage(void)
{
printf( "Use left mouse button to place vertices.\n" );
printf( "Press middle mouse button when done.\n" );
printf( "Select tesselate from the pop-up menu.\n" );
printf("Use left mouse button to place vertices.\n");
printf("Press middle mouse button when done.\n");
printf("Select tesselate from the pop-up menu.\n");
}
/*
* Main Loop
* Open window with initial window size, title bar,
* RGBA display mode, and handle input events.
/* Main Loop
* Open window with initial window size, title bar,
* RGBA display mode, and handle input events.
*/
int main( int argc, char **argv )
int
main(int argc, char **argv)
{
usage();
glutInit( &argc, argv );
glutInitDisplayMode( GLUT_SINGLE | GLUT_RGB );
glutInitWindowSize( 400, 400 );
glutCreateWindow( argv[0] );
myinit();
glutDisplayFunc( display );
glutReshapeFunc( reshape );
glutMainLoop();
return 0;
usage();
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
glutInitWindowSize(400, 400);
glutCreateWindow(argv[0]);
myinit();
glutDisplayFunc(display);
glutReshapeFunc(reshape);
glutMainLoop();
return 0;
}

View File

@@ -1,4 +1,4 @@
/* $Id: texobj.c,v 1.1 1999/08/19 00:55:40 jtg Exp $ */
/* $Id: texobj.c,v 1.1.1.1.2.2 2000/03/01 03:36:35 brianp Exp $ */
/*
* Example of using the 1.1 texture object functions.
@@ -10,8 +10,14 @@
/*
* $Log: texobj.c,v $
* Revision 1.1 1999/08/19 00:55:40 jtg
* Initial revision
* Revision 1.1.1.1.2.2 2000/03/01 03:36:35 brianp
* test for GL 1.2
*
* Revision 1.1.1.1.2.1 2000/02/25 23:24:28 brianp
* fixed bug when using display lists
*
* Revision 1.1.1.1 1999/08/19 00:55:40 jtg
* Imported sources
*
* Revision 3.1 1999/03/28 18:24:37 brianp
* minor clean-up
@@ -34,7 +40,7 @@ static GLfloat Angle = 0.0f;
static GLboolean HaveTexObj = GL_FALSE;
#if defined(GL_VERSION_1_1)
#if defined(GL_VERSION_1_1) || defined(GL_VERSION_1_2)
# define TEXTURE_OBJECT 1
#elif defined(GL_EXT_texture_object)
# define TEXTURE_OBJECT 1
@@ -84,7 +90,7 @@ static void draw( void )
#endif
}
else {
glCallList( TexObj[0] );
glCallList( TexObj[1] );
}
glBegin( GL_POLYGON );
glTexCoord2f( 0.0, 0.0 ); glVertex2f( -1.0, -1.0 );
@@ -272,7 +278,8 @@ int main( int argc, char *argv[] )
char *exten = (char *) glGetString( GL_EXTENSIONS );
char *version = (char *) glGetString( GL_VERSION );
if ( strstr( exten, "GL_EXT_texture_object" )
|| strncmp( version, "1.1", 3 )==0 ) {
|| strncmp( version, "1.1", 3 )==0
|| strncmp( version, "1.2", 3 )==0 ) {
HaveTexObj = GL_TRUE;
}
}

View File

@@ -1,4 +1,4 @@
/* $Id: logo.c,v 1.1 1999/08/19 00:55:41 jtg Exp $ */
/* $Id: logo.c,v 1.1.1.1.2.1 1999/12/15 13:01:44 brianp Exp $ */
/*
* Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc.
@@ -108,16 +108,16 @@ GLubyte *image = checkImage;
GLint imageHeight = CHECKIMAGEHEIGHT;
GLint imageWidth = CHECKIMAGEWIDTH;
float decal[] = {
static float decal[] = {
GL_DECAL,
};
float modulate[] = {
static float modulate[] = {
GL_MODULATE,
};
float repeat[] = {
static float repeat[] = {
GL_REPEAT,
};
float nearest[] = {
static float nearest[] = {
GL_NEAREST,
};

View File

@@ -37,7 +37,9 @@ in this Software without prior written authorization from The Open Group.
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/Xproto.h> /* for CARD32 */
#ifdef HAVE_MULTIBUF
#include <X11/extensions/multibuf.h>
#endif
#ifdef HAVE_XIE
#include <X11/extensions/XIElib.h>
#endif /* HAVE_XIE */
@@ -45,7 +47,9 @@ in this Software without prior written authorization from The Open Group.
#include <X11/extensions/XTest.h>
#endif /* HAVE_XTEST */
#include <X11/extensions/sync.h>
#ifdef HAVE_DBE
#include <X11/extensions/Xdbe.h>
#endif
#ifdef HAVE_XRECORD
#include <X11/extensions/record.h>
#endif /* HAVE_XRECORD */
@@ -675,6 +679,7 @@ print_standard_extension_info(dpy, extname, majorrev, minorrev)
printf("\n");
}
#ifdef HAVE_MULTIBUF
int
print_multibuf_info(dpy, extname)
Display *dpy;
@@ -717,6 +722,7 @@ print_multibuf_info(dpy, extname)
}
return 1;
} /* end print_multibuf_info */
#endif
/* XIE stuff */
@@ -805,6 +811,7 @@ print_xtest_info(dpy, extname)
}
#endif /* HAVE_XTEST */
#ifdef HAVE_SYNC
int
print_sync_info(dpy, extname)
Display *dpy;
@@ -830,7 +837,10 @@ print_sync_info(dpy, extname)
XSyncFreeSystemCounterList(syscounters);
return 1;
}
#endif
#ifdef HAVE_SHAPE
int
print_shape_info(dpy, extname)
Display *dpy;
@@ -843,6 +853,7 @@ print_shape_info(dpy, extname)
print_standard_extension_info(dpy, extname, majorrev, minorrev);
return 1;
}
#endif
#ifdef MITSHM
int
@@ -870,6 +881,7 @@ print_mitshm_info(dpy, extname)
}
#endif /* MITSHM */
#ifdef HAVE_DBE
int
print_dbe_info(dpy, extname)
Display *dpy;
@@ -899,6 +911,7 @@ print_dbe_info(dpy, extname)
XdbeFreeVisualInfo(svi);
return 1;
}
#endif
#ifdef HAVE_XRECORD
int
@@ -935,24 +948,33 @@ ExtensionPrintInfo known_extensions[] =
#ifdef MITSHM
{"MIT-SHM", print_mitshm_info, False},
#endif /* MITSHM */
#ifdef HAVE_MULTIBUF
{MULTIBUFFER_PROTOCOL_NAME, print_multibuf_info, False},
#endif
#ifdef HAVE_SHAPE
{"SHAPE", print_shape_info, False},
#endif
#ifdef HAVE_SYNC
{SYNC_NAME, print_sync_info, False},
#endif
#ifdef HAVE_XIE
{xieExtName, print_xie_info, False},
#endif /* HAVE_XIE */
#ifdef HAVE_XTEST
{XTestExtensionName, print_xtest_info, False},
#endif /* HAVE_XTEST */
#ifdef HAVE_DBE
{"DOUBLE-BUFFER", print_dbe_info, False},
#endif
#ifdef HAVE_XRECORD
{"RECORD", print_record_info, False}
#endif /* HAVE_XRECORD */
/* add new extensions here */
/* wish list: PEX XKB LBX */
{"", NULL, False} /* dummy, incase none of above are defined */
};
int num_known_extensions = sizeof known_extensions / sizeof known_extensions[0];
int num_known_extensions = sizeof known_extensions / sizeof known_extensions[0] - 1;
void
print_known_extensions(f)
@@ -961,7 +983,7 @@ print_known_extensions(f)
int i;
for (i = 0; i < num_known_extensions; i++)
{
fprintf(f, "%s ", known_extensions[i].extname);
fprintf(f, "%s ", known_extensions[i].extname);
}
}

View File

@@ -1,57 +1,153 @@
/* $Id: glxinfo.c,v 1.1 1999/09/16 16:40:46 brianp Exp $ */
/* $Id: glxinfo.c,v 1.1.2.1 2000/07/19 15:15:40 brianp Exp $ */
/*
* Query GLX extensions, version, vendor, etc.
* This program is in the public domain.
* brian_paul@mesa3d.org
* 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.
*/
/*
* This program is a work-alike of the IRIX glxinfo program.
* Command line options:
* -t print wide table
* -v print verbose information
* -display DisplayName specify the X display to interogate
*
* Brian Paul 26 January 2000
*/
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <GL/gl.h>
#include <GL/glx.h>
#include <GL/glu.h>
#include <GL/glx.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
static void
query_glx( Display *dpy, int scr )
typedef enum
{
printf("GL_VERSION: %s\n", (char *) glGetString(GL_VERSION));
printf("GL_EXTENSIONS: %s\n", (char *) glGetString(GL_EXTENSIONS));
printf("GL_RENDERER: %s\n", (char *) glGetString(GL_RENDERER));
printf("GL_VENDOR: %s\n", (char *) glGetString(GL_VENDOR));
printf("GLU_VERSION: %s\n", (char *) gluGetString(GLU_VERSION));
printf("GLU_EXTENSIONS: %s\n", (char *) gluGetString(GLU_EXTENSIONS));
Normal,
Wide,
Verbose
} InfoMode;
printf("server GLX_VENDOR: %s\n", (char *) glXQueryServerString( dpy, scr, GLX_VENDOR));
printf("server GLX_VERSION: %s\n", (char *) glXQueryServerString( dpy, scr, GLX_VERSION));
printf("server GLX_EXTENSIONS: %s\n", (char *) glXQueryServerString( dpy, scr, GLX_EXTENSIONS));
printf("client GLX_VENDOR: %s\n", (char *) glXGetClientString( dpy, GLX_VENDOR));
printf("client GLX_VERSION: %s\n", (char *) glXGetClientString( dpy, GLX_VERSION));
printf("client GLX_EXTENSIONS: %s\n", (char *) glXGetClientString( dpy, GLX_EXTENSIONS));
struct visual_attribs
{
/* X visual attribs */
int id;
int klass;
int depth;
int redMask, greenMask, blueMask;
int colormapSize;
int bitsPerRGB;
printf("GLX extensions: %s\n", (char *) glXQueryExtensionsString(dpy, scr));
/* GL visual attribs */
int supportsGL;
int transparent;
int bufferSize;
int level;
int rgba;
int doubleBuffer;
int stereo;
int auxBuffers;
int redSize, greenSize, blueSize, alphaSize;
int depthSize;
int stencilSize;
int accumRedSize, accumGreenSize, accumBlueSize, accumAlphaSize;
int numSamples, numMultisample;
int visualCaveat;
};
/*
* Print a list of extensions, with word-wrapping.
*/
static void
print_extension_list(const char *ext)
{
const char *indentString = " ";
const int indent = 4;
const int max = 79;
int width, i, j;
if (!ext || !ext[0])
return;
width = indent;
printf(indentString);
i = j = 0;
while (1) {
if (ext[j] == ' ' || ext[j] == 0) {
/* found end of an extension name */
const int len = j - i;
if (width + len > max) {
/* start a new line */
printf("\n");
width = indent;
printf(indentString);
}
/* print the extension name between ext[i] and ext[j] */
while (i < j) {
printf("%c", ext[i]);
i++;
}
/* either we're all done, or we'll continue with next extension */
width += len + 1;
if (ext[j] == 0) {
break;
}
else {
i++;
j++;
if (ext[j] == 0)
break;
printf(", ");
width += 2;
}
}
j++;
}
printf("\n");
}
int
main( int argc, char *argv[] )
static void
print_screen_info(Display *dpy, int scrnum)
{
Display *dpy;
Window win;
int attrib[] = { GLX_RGBA,
GLX_RED_SIZE, 1,
GLX_GREEN_SIZE, 1,
GLX_BLUE_SIZE, 1,
None };
int scrnum;
int attribSingle[] = {
GLX_RGBA,
GLX_RED_SIZE, 1,
GLX_GREEN_SIZE, 1,
GLX_BLUE_SIZE, 1,
None };
int attribDouble[] = {
GLX_RGBA,
GLX_RED_SIZE, 1,
GLX_GREEN_SIZE, 1,
GLX_BLUE_SIZE, 1,
GLX_DOUBLEBUFFER,
None };
XSetWindowAttributes attr;
unsigned long mask;
Window root;
@@ -59,40 +155,377 @@ main( int argc, char *argv[] )
XVisualInfo *visinfo;
int width = 100, height = 100;
dpy = XOpenDisplay(NULL);
if (!dpy) {
fprintf(stderr, "Unable to open default display!\n");
return 1;
}
root = RootWindow(dpy, scrnum);
scrnum = DefaultScreen( dpy );
root = RootWindow( dpy, scrnum );
visinfo = glXChooseVisual( dpy, scrnum, attrib );
visinfo = glXChooseVisual(dpy, scrnum, attribSingle);
if (!visinfo) {
fprintf(stderr, "Error: couldn't find RGB GLX visual!\n");
return 1;
visinfo = glXChooseVisual(dpy, scrnum, attribDouble);
if (!visinfo) {
fprintf(stderr, "Error: couldn't find RGB GLX visual\n");
return;
}
}
/* window attributes */
attr.background_pixel = 0;
attr.border_pixel = 0;
attr.colormap = XCreateColormap( dpy, root, visinfo->visual, AllocNone);
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 );
win = XCreateWindow(dpy, root, 0, 0, width, height,
0, visinfo->depth, InputOutput,
visinfo->visual, mask, &attr);
ctx = glXCreateContext( dpy, visinfo, NULL, True );
if (!ctx) {
fprintf(stderr, "Error: glXCreateContext failed\n");
XDestroyWindow(dpy, win);
return;
}
glXMakeCurrent( dpy, win, ctx );
query_glx(dpy, scrnum);
if (glXMakeCurrent(dpy, win, ctx)) {
const char *serverVendor = glXQueryServerString(dpy, scrnum, GLX_VENDOR);
const char *serverVersion = glXQueryServerString(dpy, scrnum, GLX_VERSION);
const char *serverExtensions = glXQueryServerString(dpy, scrnum, GLX_EXTENSIONS);
const char *clientVendor = glXGetClientString(dpy, GLX_VENDOR);
const char *clientVersion = glXGetClientString(dpy, GLX_VERSION);
const char *clientExtensions = glXGetClientString(dpy, GLX_EXTENSIONS);
const char *glxExtensions = glXQueryExtensionsString(dpy, scrnum);
const char *glVendor = (const char *) glGetString(GL_VENDOR);
const char *glRenderer = (const char *) glGetString(GL_RENDERER);
const char *glVersion = (const char *) glGetString(GL_VERSION);
const char *glExtensions = (const char *) glGetString(GL_EXTENSIONS);
const char *gluVersion = (const char *) gluGetString(GLU_VERSION);
const char *gluExtensions = (const char *) gluGetString(GLU_EXTENSIONS);
printf("display: %s screen:%d\n", DisplayString(dpy), scrnum);
printf("direct rendering: %s\n", glXIsDirect(dpy, ctx) ? "Yes" : "No");
printf("server glx vendor string: %s\n", serverVendor);
printf("server glx version string: %s\n", serverVersion);
printf("server glx extensions:\n");
print_extension_list(serverExtensions);
printf("client glx vendor string: %s\n", clientVendor);
printf("client glx version string: %s\n", clientVersion);
printf("client glx extensions:\n");
print_extension_list(clientExtensions);
printf("GLX extensions:\n");
print_extension_list(glxExtensions);
printf("OpenGL vendor string: %s\n", glVendor);
printf("OpenGL renderer string: %s\n", glRenderer);
printf("OpenGL version string: %s\n", glVersion);
printf("OpenGL extensions:\n");
print_extension_list(glExtensions);
printf("glu version: %s\n", gluVersion);
printf("glu extensions:\n");
print_extension_list(gluExtensions);
}
else {
fprintf(stderr, "Error: glXMakeCurrent failed\n");
}
glXDestroyContext(dpy, ctx);
XDestroyWindow(dpy, win);
}
static const char *
visual_class_name(int cls)
{
switch (cls) {
case StaticColor:
return "StaticColor";
case PseudoColor:
return "PseudoColor";
case StaticGray:
return "StaticGray";
case GrayScale:
return "GrayScale";
case TrueColor:
return "TrueColor";
case DirectColor:
return "DirectColor";
default:
return "";
}
}
static const char *
visual_class_abbrev(int cls)
{
switch (cls) {
case StaticColor:
return "sc";
case PseudoColor:
return "pc";
case StaticGray:
return "sg";
case GrayScale:
return "gs";
case TrueColor:
return "tc";
case DirectColor:
return "dc";
default:
return "";
}
}
static void
get_visual_attribs(Display *dpy, XVisualInfo *vInfo,
struct visual_attribs *attribs)
{
const char *ext = glXQueryExtensionsString(dpy, vInfo->screen);
memset(attribs, 0, sizeof(struct visual_attribs));
attribs->id = vInfo->visualid;
#if defined(__cplusplus) || defined(c_plusplus)
attribs->klass = vInfo->c_class;
#else
attribs->klass = vInfo->class;
#endif
attribs->depth = vInfo->depth;
attribs->redMask = vInfo->red_mask;
attribs->greenMask = vInfo->green_mask;
attribs->blueMask = vInfo->blue_mask;
attribs->colormapSize = vInfo->colormap_size;
attribs->bitsPerRGB = vInfo->bits_per_rgb;
if (glXGetConfig(dpy, vInfo, GLX_USE_GL, &attribs->supportsGL) != 0)
return;
glXGetConfig(dpy, vInfo, GLX_BUFFER_SIZE, &attribs->bufferSize);
glXGetConfig(dpy, vInfo, GLX_LEVEL, &attribs->level);
glXGetConfig(dpy, vInfo, GLX_RGBA, &attribs->rgba);
glXGetConfig(dpy, vInfo, GLX_DOUBLEBUFFER, &attribs->doubleBuffer);
glXGetConfig(dpy, vInfo, GLX_STEREO, &attribs->stereo);
glXGetConfig(dpy, vInfo, GLX_AUX_BUFFERS, &attribs->auxBuffers);
glXGetConfig(dpy, vInfo, GLX_RED_SIZE, &attribs->redSize);
glXGetConfig(dpy, vInfo, GLX_GREEN_SIZE, &attribs->greenSize);
glXGetConfig(dpy, vInfo, GLX_BLUE_SIZE, &attribs->blueSize);
glXGetConfig(dpy, vInfo, GLX_ALPHA_SIZE, &attribs->alphaSize);
glXGetConfig(dpy, vInfo, GLX_DEPTH_SIZE, &attribs->depthSize);
glXGetConfig(dpy, vInfo, GLX_STENCIL_SIZE, &attribs->stencilSize);
glXGetConfig(dpy, vInfo, GLX_ACCUM_RED_SIZE, &attribs->accumRedSize);
glXGetConfig(dpy, vInfo, GLX_ACCUM_GREEN_SIZE, &attribs->accumGreenSize);
glXGetConfig(dpy, vInfo, GLX_ACCUM_BLUE_SIZE, &attribs->accumBlueSize);
glXGetConfig(dpy, vInfo, GLX_ACCUM_ALPHA_SIZE, &attribs->accumAlphaSize);
/* transparent pixel value not implemented yet */
attribs->transparent = 0;
/* multisample tests not implemented yet */
attribs->numSamples = 0;
attribs->numMultisample = 0;
#if defined(GLX_EXT_visual_rating)
if (ext && strstr(ext, "GLX_EXT_visual_rating")) {
glXGetConfig(dpy, vInfo, GLX_VISUAL_CAVEAT_EXT, &attribs->visualCaveat);
}
else {
attribs->visualCaveat = GLX_NONE_EXT;
}
#else
attribs->visualCaveat = 0;
#endif
}
static void
print_visual_attribs_verbose(const struct visual_attribs *attribs)
{
printf("Visual ID: %x depth=%d class=%s\n",
attribs->id, attribs->depth, visual_class_name(attribs->klass));
printf(" bufferSize=%d level=%d renderType=%s doubleBuffer=%d stereo=%d\n",
attribs->bufferSize, attribs->level, attribs->rgba ? "rgba" : "ci",
attribs->doubleBuffer, attribs->stereo);
printf(" rgba: redSize=%d greenSize=%d blueSize=%d alphaSize=%d\n",
attribs->redSize, attribs->greenSize,
attribs->blueSize, attribs->alphaSize);
printf(" auxBuffers=%d depthSize=%d stencilSize=%d\n",
attribs->auxBuffers, attribs->depthSize, attribs->stencilSize);
printf(" accum: redSize=%d greenSize=%d blueSize=%d alphaSize=%d\n",
attribs->accumRedSize, attribs->accumGreenSize,
attribs->accumBlueSize, attribs->accumAlphaSize);
printf(" multiSample=%d multiSampleBuffers=%d\n",
attribs->numSamples, attribs->numMultisample);
#ifdef GLX_EXT_visual_rating
if (attribs->visualCaveat == GLX_NONE_EXT || attribs->visualCaveat == 0)
printf(" visualCaveat=None\n");
else if (attribs->visualCaveat == GLX_SLOW_VISUAL_EXT)
printf(" visualCaveat=Slow\n");
else if (attribs->visualCaveat == GLX_NON_CONFORMANT_VISUAL_EXT)
printf(" visualCaveat=Nonconformant\n");
#endif
printf(" %s\n", attribs->transparent ? "Transparent." : "Opaque.");
}
static void
print_visual_attribs_short_header(void)
{
printf(" visual x bf lv rg d st colorbuffer ax dp st accumbuffer ms cav\n");
printf(" id dep cl sp sz l ci b ro r g b a bf th cl r g b a ns b eat\n");
printf("----------------------------------------------------------------------\n");
}
static void
print_visual_attribs_short(const struct visual_attribs *attribs)
{
char *caveat;
#ifdef GLX_EXT_visual_rating
if (attribs->visualCaveat == GLX_NONE_EXT || attribs->visualCaveat == 0)
caveat = "None";
else if (attribs->visualCaveat == GLX_SLOW_VISUAL_EXT)
caveat = "Slow";
else if (attribs->visualCaveat == GLX_NON_CONFORMANT_VISUAL_EXT)
caveat = "Ncon";
#else
caveat = "None";
#endif
printf("0x%2x %2d %2s %2d %2d %2d %1s %2s %2s %2d %2d %2d %2d %2d %2d %2d",
attribs->id,
attribs->depth,
visual_class_abbrev(attribs->klass),
attribs->transparent,
attribs->bufferSize,
attribs->level,
attribs->rgba ? "r" : "c",
attribs->doubleBuffer ? "y" : ".",
attribs->stereo ? "y" : ".",
attribs->redSize, attribs->greenSize,
attribs->blueSize, attribs->alphaSize,
attribs->auxBuffers,
attribs->depthSize,
attribs->stencilSize
);
printf(" %2d %2d %2d %2d %2d %1d %s\n",
attribs->accumRedSize, attribs->accumGreenSize,
attribs->accumBlueSize, attribs->accumAlphaSize,
attribs->numSamples, attribs->numMultisample,
caveat
);
}
static void
print_visual_attribs_long_header(void)
{
printf("Vis Vis Visual Trans buff lev render DB ste r g b a aux dep ste accum buffers MS MS\n");
printf(" ID Depth Type parent size el type reo sz sz sz sz buf th ncl r g b a num bufs\n");
printf("----------------------------------------------------------------------------------------------------\n");
}
static void
print_visual_attribs_long(const struct visual_attribs *attribs)
{
printf("0x%2x %2d %-11s %2d %2d %2d %4s %3d %3d %3d %3d %3d %3d",
attribs->id,
attribs->depth,
visual_class_name(attribs->klass),
attribs->transparent,
attribs->bufferSize,
attribs->level,
attribs->rgba ? "rgba" : "ci ",
attribs->doubleBuffer,
attribs->stereo,
attribs->redSize, attribs->greenSize,
attribs->blueSize, attribs->alphaSize
);
printf(" %3d %4d %2d %3d %3d %3d %3d %2d %2d\n",
attribs->auxBuffers,
attribs->depthSize,
attribs->stencilSize,
attribs->accumRedSize, attribs->accumGreenSize,
attribs->accumBlueSize, attribs->accumAlphaSize,
attribs->numSamples, attribs->numMultisample
);
}
static void
print_visual_info(Display *dpy, int scrnum, InfoMode mode)
{
XVisualInfo template;
XVisualInfo *visuals;
int numVisuals;
long mask;
int i;
/* get list of all visuals on this screen */
template.screen = scrnum;
mask = VisualScreenMask;
visuals = XGetVisualInfo(dpy, mask, &template, &numVisuals);
if (mode == Verbose) {
for (i = 0; i < numVisuals; i++) {
struct visual_attribs attribs;
get_visual_attribs(dpy, &visuals[i], &attribs);
print_visual_attribs_verbose(&attribs);
}
}
else if (mode == Normal) {
print_visual_attribs_short_header();
for (i = 0; i < numVisuals; i++) {
struct visual_attribs attribs;
get_visual_attribs(dpy, &visuals[i], &attribs);
print_visual_attribs_short(&attribs);
}
}
else if (mode == Wide) {
print_visual_attribs_long_header();
for (i = 0; i < numVisuals; i++) {
struct visual_attribs attribs;
get_visual_attribs(dpy, &visuals[i], &attribs);
print_visual_attribs_long(&attribs);
}
}
XFree(visuals);
}
int
main(int argc, char *argv[])
{
char *displayName = ":0";
Display *dpy;
int numScreens, scrnum;
InfoMode mode = Normal;
int i;
for (i = 1; i < argc; i++) {
if (strcmp(argv[i], "-display") == 0 && i + 1 < argc) {
displayName = argv[i + 1];
i++;
}
else if (strcmp(argv[i], "-t") == 0) {
mode = Wide;
}
else if (strcmp(argv[i], "-v") == 0) {
mode = Verbose;
}
}
dpy = XOpenDisplay(displayName);
if (!dpy) {
fprintf(stderr, "Error: unable to open display %s\n", displayName);
return -1;
}
numScreens = ScreenCount(dpy);
for (scrnum = 0; scrnum < numScreens; scrnum++) {
print_screen_info(dpy, scrnum);
printf("\n");
print_visual_info(dpy, scrnum, mode);
if (scrnum + 1 < numScreens)
printf("\n\n");
}
XCloseDisplay(dpy);
return 0;

View File

@@ -2,8 +2,8 @@
# Tinic Uro <5uro@informatik.uni-hamburg.de>
# Mesa 3-D graphics library
# Version: 2.6
# Copyright (C) 1995-1997 Brian Paul
# Version: 3.2.1
# 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
@@ -29,8 +29,7 @@ INCDIR = ../include
LIBDIR = ../lib
SOURCES = glu.c mipmap.c nurbs.c nurbscrv.c nurbssrf.c nurbsutl.c \
project.c quadric.c tess.c tess_fist.c tess_hash.c tess_heap.c \
tess_winding.c tess_clip.c
polytest.c project.c quadric.c tess.c tesselat.c
OBJECTS = $(SOURCES:.c=.o)

View File

@@ -1,8 +1,8 @@
# Makefile for GLU for BeOS R4
# Mesa 3-D graphics library
# Version: 3.1
# Copyright (C) 1995-1999 Brian Paul
# Version: 3.2.1
# 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
@@ -19,40 +19,11 @@
# Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
# $Id: Makefile.BeOS-R4,v 1.5.2.1 1999/11/15 21:15:43 gareth Exp $
# $Log: Makefile.BeOS-R4,v $
# Revision 1.5.2.1 1999/11/15 21:15:43 gareth
# Added new tessellation polygon clipping file tess_clip.c
#
# Revision 1.5 1999/10/03 00:53:38 gareth
# Added tessellation winding rule files.
#
# Revision 1.4 1999/09/17 00:06:57 brianp
# version symbol changes
#
# Revision 1.3 1999/09/15 15:11:01 brianp
# added third, tiny version number to mklib scripts
#
# Revision 1.2 1999/09/10 02:03:31 gareth
# Added GLU 1.3 tessellation (except winding rule code).
#
# Revision 1.1.1.1 1999/08/19 00:55:42 jtg
# Imported sources
#
# Revision 1.2 1999/02/02 04:44:40 brianp
# fixed some problems
#
# Revision 1.1 1999/01/19 04:10:02 brianp
# Initial revision
#
##### MACROS #####
GLU_MAJOR = 1
GLU_MINOR = 2
GLU_MINOR = 1
GLU_TINY = $(MESA_MAJOR)$(MESA_MINOR)$(MESA_TINY)
VPATH = RCS
@@ -61,8 +32,7 @@ INCDIR = ../include
LIBDIR = ../lib
SOURCES = glu.c mipmap.c nurbs.c nurbscrv.c nurbssrf.c nurbsutl.c \
project.c quadric.c tess.c tess_fist.c tess_hash.c tess_heap.c \
tess_winding.c tess_clip.c
polytest.c project.c quadric.c tess.c tesselat.c
OBJECTS = $(SOURCES:.c=.o)

View File

@@ -1,8 +1,8 @@
# $Id: Makefile.X11,v 1.6.2.1 1999/11/15 21:15:43 gareth Exp $
# $Id: Makefile.X11,v 1.6.2.3 2000/07/11 03:48:23 brianp Exp $
# Mesa 3-D graphics library
# Version: 3.1
# Copyright (C) 1995-1999 Brian Paul
# Version: 3.2.1
# Copyright (C) 1995-2000 Brian Paul
# Makefile for GLU library
@@ -10,7 +10,7 @@
##### MACROS #####
GLU_MAJOR = 1
GLU_MINOR = 2
GLU_MINOR = 1
GLU_TINY = 0$(MESA_MAJOR)0$(MESA_MINOR)0$(MESA_TINY)
VPATH = RCS
@@ -19,8 +19,7 @@ INCDIR = ../include
LIBDIR = ../lib
SOURCES = glu.c mipmap.c nurbs.c nurbscrv.c nurbssrf.c nurbsutl.c \
project.c quadric.c tess.c tess_fist.c tess_hash.c tess_heap.c \
tess_winding.c tess_clip.c
polytest.c project.c quadric.c tess.c tesselat.c
OBJECTS = $(SOURCES:.c=.o)

63
src/glu/mesa/Makefile.m32 Normal file
View File

@@ -0,0 +1,63 @@
# Makefile for GLU for GCC-2.95.2/Mingw32 contributed by
# Paul Garceau <pgarceau@teleport.com>
# Mesa 3-D graphics library
# Version: 3.2.1
# 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.
MESA_MAJOR=3
MESA_MINOR=2
MESA_TINY=1
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)

View File

@@ -1,9 +1,9 @@
/* $Id: all.h,v 1.1 1999/08/19 00:55:42 jtg Exp $ */
/* $Id: all.h,v 1.1.1.1.2.1 2000/07/11 01:39:41 brianp Exp $ */
/*
* Mesa 3-D graphics library
* Version: 2.3
* Copyright (C) 1995-1997 Brian Paul
* Version: 3.2.1
* 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
@@ -21,20 +21,6 @@
*/
/*
* $Log: all.h,v $
* Revision 1.1 1999/08/19 00:55:42 jtg
* Initial revision
*
* Revision 1.2 1997/11/20 00:28:20 brianp
* changed PCH to PC_HEADER
*
* Revision 1.1 1997/05/28 02:29:14 brianp
* Initial revision
*
*/
/*
* This file includes all .h files needed for the GLU source code for
* the purpose of precompiled headers.
@@ -50,10 +36,8 @@
#ifndef PC_HEADER
This is an error. all.h should be included only if PCH is defined.
This is an error.all.h should be included only if PCH is defined.
#endif
#include <assert.h>
#include <math.h>
#include <stdio.h>
@@ -64,6 +48,4 @@
#include "gluP.h"
#include "nurbs.h"
#include "tess.h"
#endif /*GLU_ALL_H*/
#endif /*GLU_ALL_H */

View File

@@ -1,9 +1,9 @@
/* $Id: glu.c,v 1.16.2.2 1999/11/22 22:18:13 brianp Exp $ */
/* $Id: glu.c,v 1.16.2.6 2000/07/11 01:39:41 brianp Exp $ */
/*
* Mesa 3-D graphics library
* Version: 3.1
* Copyright (C) 1995-1999 Brian Paul
* Version: 3.2.1
* 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
@@ -21,105 +21,6 @@
*/
/*
* $Log: glu.c,v $
* Revision 1.16.2.2 1999/11/22 22:18:13 brianp
* removed GLU_EXT_get_proc_address from ext string
*
* Revision 1.16.2.1 1999/11/19 21:22:07 brianp
* replace encounteed with encountered
*
* Revision 1.16 1999/10/27 09:47:41 brianp
* disabled gluGetProcAddressEXT
*
* Revision 1.15 1999/09/19 02:03:19 tjump
* More Win32 build compliance fixups
*
* Revision 1.14 1999/09/17 12:21:53 brianp
* glGetProcAddressEXT changes to accomodate Win32 and non-Win32
*
* Revision 1.13 1999/09/17 03:17:18 tjump
* Patch error fixup
*
* Revision 1.12 1999/09/17 03:07:28 tjump
* Win32 build req't updates
*
* Revision 1.11 1999/09/17 01:00:38 brianp
* fixed typo
*
* Revision 1.10 1999/09/17 00:06:14 brianp
* gluGetProcAddressEXT change for C++ / BeOS
*
* Revision 1.9 1999/09/16 22:37:56 brianp
* added some casts in gluGetProcAddressEXT()
*
* Revision 1.8 1999/09/16 16:53:28 brianp
* clean-up of GLU_EXT_get_proc_address
*
* Revision 1.7 1999/09/14 00:11:40 brianp
* added gluCheckExtension()
*
* Revision 1.6 1999/09/13 14:31:32 joukj
*
* strcmp needs the string.h
*
* Revision 1.5 1999/09/11 12:04:54 brianp
* added 1.2 function to gluGetProcAddressEXT()
*
* Revision 1.4 1999/09/11 11:36:26 brianp
* added GLU_EXT_get_proc_address
*
* Revision 1.3 1999/09/10 04:32:10 gareth
* Fixed triangle output, recovery process termination.
*
* Revision 1.2 1999/09/10 02:03:31 gareth
* Added GLU 1.3 tessellation (except winding rule code).
*
* Revision 1.1.1.1 1999/08/19 00:55:42 jtg
* Imported sources
*
* Revision 1.13 1999/03/31 19:07:28 brianp
* added GL_EXT_abgr to extensions
*
* Revision 1.12 1999/02/06 06:12:41 brianp
* updated version string to 3.1
*
* Revision 1.11 1999/01/03 03:23:15 brianp
* now using GLAPIENTRY and GLCALLBACK keywords (Ted Jump)
*
* Revision 1.10 1998/04/22 00:35:50 brianp
* changed version to 3.0
*
* Revision 1.9 1997/12/09 03:03:32 brianp
* changed version to 2.6
*
* Revision 1.8 1997/10/04 01:30:20 brianp
* changed version to 2.5
*
* Revision 1.7 1997/08/13 01:25:21 brianp
* changed version string to 2.4
*
* Revision 1.6 1997/07/24 01:28:44 brianp
* changed precompiled header symbol from PCH to PC_HEADER
*
* Revision 1.5 1997/07/13 22:59:11 brianp
* added const to viewport parameter of gluPickMatrix()
*
* Revision 1.4 1997/05/28 02:29:38 brianp
* added support for precompiled headers (PCH), inserted APIENTRY keyword
*
* Revision 1.3 1997/04/12 16:19:02 brianp
* changed version to 2.3
*
* Revision 1.2 1997/03/11 00:58:34 brianp
* changed version to 2.2
*
* Revision 1.1 1996/09/27 01:19:39 brianp
* Initial revision
*
*/
#ifdef PC_HEADER
#include "all.h"
#else
@@ -145,9 +46,10 @@
void GLAPIENTRY gluLookAt( GLdouble eyex, GLdouble eyey, GLdouble eyez,
GLdouble centerx, GLdouble centery, GLdouble centerz,
GLdouble upx, GLdouble upy, GLdouble upz )
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];
@@ -159,8 +61,8 @@ void GLAPIENTRY gluLookAt( GLdouble eyex, GLdouble eyey, GLdouble eyez,
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 */
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;
@@ -172,28 +74,28 @@ void GLAPIENTRY gluLookAt( GLdouble eyex, GLdouble eyey, GLdouble eyez,
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];
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];
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] );
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] );
mag = sqrt(y[0] * y[0] + y[1] * y[1] + y[2] * y[2]);
if (mag) {
y[0] /= mag;
y[1] /= mag;
@@ -201,47 +103,59 @@ void GLAPIENTRY gluLookAt( GLdouble eyex, GLdouble eyey, GLdouble eyez,
}
#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;
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 );
glMultMatrixd(m);
/* Translate Eye to Origin */
glTranslated( -eyex, -eyey, -eyez );
glTranslated(-eyex, -eyey, -eyez);
}
void GLAPIENTRY gluOrtho2D( GLdouble left, GLdouble right,
GLdouble bottom, GLdouble top )
void GLAPIENTRY
gluOrtho2D(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top)
{
glOrtho( left, right, bottom, top, -1.0, 1.0 );
glOrtho(left, right, bottom, top, -1.0, 1.0);
}
void GLAPIENTRY gluPerspective( GLdouble fovy, GLdouble aspect,
GLdouble zNear, GLdouble zFar )
void GLAPIENTRY
gluPerspective(GLdouble fovy, GLdouble aspect, GLdouble zNear, GLdouble zFar)
{
GLdouble xmin, xmax, ymin, ymax;
ymax = zNear * tan( fovy * M_PI / 360.0 );
ymax = zNear * tan(fovy * M_PI / 360.0);
ymin = -ymax;
xmin = ymin * aspect;
xmax = ymax * aspect;
glFrustum( xmin, xmax, ymin, ymax, zNear, zFar );
glFrustum(xmin, xmax, ymin, ymax, zNear, zFar);
}
void GLAPIENTRY gluPickMatrix( GLdouble x, GLdouble y,
GLdouble width, GLdouble height,
const GLint viewport[4] )
void GLAPIENTRY
gluPickMatrix(GLdouble x, GLdouble y,
GLdouble width, GLdouble height, const GLint viewport[4])
{
GLfloat m[16];
GLfloat sx, sy;
@@ -253,18 +167,31 @@ void GLAPIENTRY gluPickMatrix( GLdouble x, GLdouble y,
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;
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 );
glMultMatrixf(m);
}
const GLubyte* GLAPIENTRY gluErrorString( GLenum errorCode )
const GLubyte *GLAPIENTRY
gluErrorString(GLenum errorCode)
{
static char *tess_error[] = {
"missing gluBeginPolygon",
@@ -317,48 +244,48 @@ const GLubyte* GLAPIENTRY gluErrorString( GLenum errorCode )
};
/* GL Errors */
if (errorCode==GL_NO_ERROR) {
if (errorCode == GL_NO_ERROR) {
return (GLubyte *) "no error";
}
else if (errorCode==GL_INVALID_VALUE) {
else if (errorCode == GL_INVALID_VALUE) {
return (GLubyte *) "invalid value";
}
else if (errorCode==GL_INVALID_ENUM) {
else if (errorCode == GL_INVALID_ENUM) {
return (GLubyte *) "invalid enum";
}
else if (errorCode==GL_INVALID_OPERATION) {
else if (errorCode == GL_INVALID_OPERATION) {
return (GLubyte *) "invalid operation";
}
else if (errorCode==GL_STACK_OVERFLOW) {
else if (errorCode == GL_STACK_OVERFLOW) {
return (GLubyte *) "stack overflow";
}
else if (errorCode==GL_STACK_UNDERFLOW) {
else if (errorCode == GL_STACK_UNDERFLOW) {
return (GLubyte *) "stack underflow";
}
else if (errorCode==GL_OUT_OF_MEMORY) {
else if (errorCode == GL_OUT_OF_MEMORY) {
return (GLubyte *) "out of memory";
}
/* GLU Errors */
else if (errorCode==GLU_NO_ERROR) {
else if (errorCode == GLU_NO_ERROR) {
return (GLubyte *) "no error";
}
else if (errorCode==GLU_INVALID_ENUM) {
else if (errorCode == GLU_INVALID_ENUM) {
return (GLubyte *) "invalid enum";
}
else if (errorCode==GLU_INVALID_VALUE) {
else if (errorCode == GLU_INVALID_VALUE) {
return (GLubyte *) "invalid value";
}
else if (errorCode==GLU_OUT_OF_MEMORY) {
else if (errorCode == GLU_OUT_OF_MEMORY) {
return (GLubyte *) "out of memory";
}
else if (errorCode==GLU_INCOMPATIBLE_GL_VERSION) {
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_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 if (errorCode >= GLU_NURBS_ERROR1 && errorCode <= GLU_NURBS_ERROR37) {
return (GLubyte *) nurbs_error[errorCode - GLU_NURBS_ERROR1];
}
else {
return NULL;
@@ -371,58 +298,60 @@ const GLubyte* GLAPIENTRY gluErrorString( GLenum errorCode )
* New in GLU 1.1
*/
const GLubyte* GLAPIENTRY gluGetString( GLenum name )
const GLubyte *GLAPIENTRY
gluGetString(GLenum name)
{
static char *extensions = "GL_EXT_abgr";
static char *version = "1.2 Mesa 3.1";
static char *version = "1.1 Mesa 3.2.1";
switch (name) {
case GLU_EXTENSIONS:
return (GLubyte *) extensions;
case GLU_VERSION:
return (GLubyte *) version;
default:
return NULL;
case GLU_EXTENSIONS:
return (GLubyte *) extensions;
case GLU_VERSION:
return (GLubyte *) version;
default:
return NULL;
}
}
#if 0 /* gluGetProcAddressEXT not finalized yet! */
#if 0 /* gluGetProcAddressEXT not finalized yet! */
#ifdef __cplusplus
/* for BeOS R4.5 */
void GLAPIENTRY (*gluGetProcAddressEXT(const GLubyte *procName))(...)
void GLAPIENTRY(*gluGetProcAddressEXT(const GLubyte * procName)) (...)
#else
void (GLAPIENTRY *gluGetProcAddressEXT(const GLubyte *procName))()
void (GLAPIENTRY * gluGetProcAddressEXT(const GLubyte * procName)) ()
#endif
{
struct proc {
struct proc
{
const char *name;
void *address;
};
static struct proc procTable[] = {
{ "gluGetProcAddressEXT", (void *) gluGetProcAddressEXT }, /* me! */
{"gluGetProcAddressEXT", (void *) gluGetProcAddressEXT}, /* me! */
/* new 1.1 functions */
{ "gluGetString", (void *) gluGetString },
{"gluGetString", (void *) gluGetString},
/* new 1.2 functions */
{ "gluTessBeginPolygon", (void *) gluTessBeginPolygon },
{ "gluTessBeginContour", (void *) gluTessBeginContour },
{ "gluTessEndContour", (void *) gluTessEndContour },
{ "gluTessEndPolygon", (void *) gluTessEndPolygon },
{ "gluGetTessProperty", (void *) gluGetTessProperty },
{"gluTessBeginPolygon", (void *) gluTessBeginPolygon},
{"gluTessBeginContour", (void *) gluTessBeginContour},
{"gluTessEndContour", (void *) gluTessEndContour},
{"gluTessEndPolygon", (void *) gluTessEndPolygon},
{"gluGetTessProperty", (void *) gluGetTessProperty},
/* new 1.3 functions */
{ NULL, NULL }
{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 (void (GLAPIENTRY *) ()) procTable[i].address;
}
return NULL;
@@ -436,7 +365,7 @@ const GLubyte* GLAPIENTRY gluGetString( GLenum name )
* New in GLU 1.3
*/
GLboolean GLAPIENTRY
gluCheckExtension( const char *extName, const GLubyte *extString )
gluCheckExtension(const char *extName, const GLubyte * extString)
{
assert(extName);
assert(extString);
@@ -445,14 +374,14 @@ gluCheckExtension( const char *extName, const GLubyte *extString )
const char *start = (const char *) extString;
while (1) {
const char *c = strstr( start, extName );
if (!c)
return GL_FALSE;
const char *c = strstr(start, extName);
if (!c)
return GL_FALSE;
if ((c == start || c[-1] == ' ') && (c[len] == ' ' || c[len] == 0))
return GL_TRUE;
if ((c == start || c[-1] == ' ') && (c[len] == ' ' || c[len] == 0))
return GL_TRUE;
start = c + len;
start = c + len;
}
}
}

View File

@@ -1,9 +1,9 @@
/* $Id: gluP.h,v 1.1.1.1.2.1 1999/12/06 05:24:36 joukj Exp $ */
/* $Id: gluP.h,v 1.1.1.1.2.2 2000/07/11 01:39:41 brianp Exp $ */
/*
* Mesa 3-D graphics library
* Version: 3.1
* Copyright (C) 1995-1999 Brian Paul
* Version: 3.2.1
* 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
@@ -21,38 +21,6 @@
*/
/*
* $Log: gluP.h,v $
* Revision 1.1.1.1.2.1 1999/12/06 05:24:36 joukj
*
* Committing in .
*
* Updating compilation on VMS
*
* Modified Files:
* Tag: mesa_3_2_dev
* Mesa/src-glu/descrip.mms Mesa/src-glu/gluP.h
* ----------------------------------------------------------------------
*
* Revision 1.1.1.1 1999/08/19 00:55:42 jtg
* Imported sources
*
* Revision 1.4 1999/01/03 03:23:15 brianp
* now using GLAPIENTRY and GLCALLBACK keywords (Ted Jump)
*
* Revision 1.3 1997/08/01 22:25:27 brianp
* check for Cygnus Win32 (Stephen Rehel)
*
* Revision 1.2 1997/05/27 02:59:46 brianp
* added defines for APIENTRY and CALLBACK if not compiling on Win32
*
* Revision 1.1 1996/09/27 01:19:39 brianp
* Initial revision
*
*/
/*
* This file allows the GLU code to be compiled either with the Mesa
* headers or with the real OpenGL headers.

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,9 +1,9 @@
/* $Id: nurbs.h,v 1.2 1999/11/11 03:21:43 kendallb Exp $ */
/* $Id: nurbs.h,v 1.1.1.1.2.1 2000/07/11 01:39:41 brianp Exp $ */
/*
* Mesa 3-D graphics library
* Version: 3.1
* Copyright (C) 1995-1999 Brian Paul
* Version: 3.2.1
* 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
@@ -21,46 +21,6 @@
*/
/*
* $Log: nurbs.h,v $
* Revision 1.2 1999/11/11 03:21:43 kendallb
*
* . Updated GL/gl.h with GLCALLACKP and GLAPIENTRYP macros for compatibility
* with the IBM VisualAge C++ compiler. Eventually some more code will be
* needed in the headers to enable the reversal of (__stdcall*) to (*__stdcall)
* for the IBM compilers, however we currently build using our own header files
* that already handle this.
*
* . Changed instances of (GLCALLBACK*) to GLCALLBACKP for compatibility
* with the IBM VisualAge C++ compiler in src-glu.
*
* . Misc cleanups for warnings generated with Watcom C++ in src-glu. Compiles
* with 0 warnings now.
*
* . tess_hash.c: line 244 - Why is this function stubbed out? I removed the
* code with a #if 0 to avoid a compiler warning, but it looks dangerous.
*
* Revision 1.1.1.1 1999/08/19 00:55:42 jtg
* Imported sources
*
* Revision 1.5 1999/02/27 13:55:31 brianp
* fixed BeOS-related GLU typedef problems
*
* Revision 1.4 1999/01/03 03:23:15 brianp
* now using GLAPIENTRY and GLCALLBACK keywords (Ted Jump)
*
* Revision 1.3 1997/05/27 03:18:23 brianp
* minor clean-up
*
* Revision 1.2 1997/05/27 03:00:16 brianp
* incorporated Bogdan's new NURBS code
*
* Revision 1.1 1996/09/27 01:19:39 brianp
* Initial revision
*
*/
/*
* NURBS implementation written by Bogdan Sikorski (bogdan@cira.it)
* See README2 for more info.
@@ -71,198 +31,222 @@
#define NURBS_H
#define EPSILON 1e-06 /* epsilon for double precision compares */
#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;
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;
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;
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;
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;
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;
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;
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;
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;
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;
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;
GLfloat model[16], proj[16], viewport[4];
}
culling_and_sampling_str;
struct GLUnurbs {
GLboolean culling;
GLenum error;
void (GLCALLBACKP 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;
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;
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;
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 void call_user_error(GLUnurbsObj * nobj, GLenum error);
extern GLenum test_knot(GLint nknots, GLfloat *knot, GLint order);
extern GLenum test_knot(GLint nknots, GLfloat * knot, GLint order);
extern GLenum explode_knot(knot_str_type *the_knot);
extern GLenum explode_knot(knot_str_type * the_knot);
extern GLenum calc_alphas(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 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_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_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_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 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_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 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_curve(GLUnurbsObj * nobj);
extern void do_nurbs_surface( 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 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 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 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);
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);

View File

@@ -1,9 +1,9 @@
/* $Id: nurbscrv.c,v 1.1 1999/08/19 00:55:42 jtg Exp $ */
/* $Id: nurbscrv.c,v 1.1.1.1.2.1 2000/07/11 01:39:41 brianp Exp $ */
/*
* Mesa 3-D graphics library
* Version: 2.4
* Copyright (C) 1995-1997 Brian Paul
* Version: 3.2.1
* 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
@@ -21,32 +21,6 @@
*/
/*
* $Log: nurbscrv.c,v $
* Revision 1.1 1999/08/19 00:55:42 jtg
* Initial revision
*
* Revision 1.6 1997/07/24 01:28:44 brianp
* changed precompiled header symbol from PCH to PC_HEADER
*
* Revision 1.5 1997/05/28 02:29:38 brianp
* added support for precompiled headers (PCH), inserted APIENTRY keyword
*
* Revision 1.4 1997/05/27 03:21:22 brianp
* minor clean-up
*
* Revision 1.3 1997/05/27 03:00:16 brianp
* incorporated Bogdan's new NURBS code
*
* Revision 1.2 1996/09/27 23:12:22 brianp
* added return 0 to get_surface_dim() to silence warning
*
* Revision 1.1 1996/09/27 01:19:39 brianp
* Initial revision
*
*/
/*
* NURBS implementation written by Bogdan Sikorski (bogdan@cira.it)
* See README2 for more info.
@@ -66,435 +40,406 @@
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*/
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)
test_nurbs_curve(GLUnurbsObj * nobj, curve_attribs * attribs)
{
GLenum err;
GLint tmp_int;
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;
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_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;
/* 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)
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;
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;
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)
convert_curve(knot_str_type * the_knot, curve_attribs * attrib,
GLfloat ** new_ctrl, GLint * ncontrol)
{
GLenum err;
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;
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)
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;
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;
*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;
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;
/* 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)
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,*color_ctrl,*normal_ctrl,*texture_ctrl;
GLint *factors;
GLint i,j;
GLint geom_dim,color_dim=0,normal_dim=0,texture_dim=0;
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, *color_ctrl, *normal_ctrl, *texture_ctrl;
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;
/* 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;
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;
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);
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);
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

938
src/glu/mesa/polytest.c Normal file
View File

@@ -0,0 +1,938 @@
/* $Id: polytest.c,v 1.2.2.1 2000/07/11 02:07:52 brianp Exp $ */
/*
* Mesa 3-D graphics library
* Version: 3.2.1
* 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 <math.h>
#include <stdlib.h>
#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;
/* 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;
}

View File

@@ -1,9 +1,9 @@
/* $Id: project.c,v 1.2 1999/09/14 00:10:31 brianp Exp $ */
/* $Id: project.c,v 1.2.2.1 2000/07/11 01:39:41 brianp Exp $ */
/*
* Mesa 3-D graphics library
* Version: 3.1
* Copyright (C) 1995-1999 Brian Paul
* Version: 3.2.1
* 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
@@ -21,38 +21,6 @@
*/
/*
* $Log: project.c,v $
* Revision 1.2 1999/09/14 00:10:31 brianp
* added gluUnProject4()
*
* Revision 1.1.1.1 1999/08/19 00:55:42 jtg
* Imported sources
*
* Revision 1.7 1999/01/03 03:23:15 brianp
* now using GLAPIENTRY and GLCALLBACK keywords (Ted Jump)
*
* Revision 1.6 1998/07/08 01:43:43 brianp
* new version of invert_matrix() (also in src/matrix.c)
*
* Revision 1.5 1997/07/24 01:28:44 brianp
* changed precompiled header symbol from PCH to PC_HEADER
*
* Revision 1.4 1997/05/28 02:29:38 brianp
* added support for precompiled headers (PCH), inserted APIENTRY keyword
*
* Revision 1.3 1997/04/11 23:22:42 brianp
* added divide by zero checks to gluProject() and gluUnproject()
*
* Revision 1.2 1997/01/29 19:05:29 brianp
* faster invert_matrix() function from Stephane Rehel
*
* Revision 1.1 1996/09/27 01:19:39 brianp
* Initial revision
*
*/
#ifdef PC_HEADER
#include "all.h"
#else
@@ -81,14 +49,18 @@
* 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] )
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];
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
}
@@ -100,7 +72,8 @@ static void transform_point( GLdouble out[4], const GLdouble m[16],
* Input: a, b - matrices to multiply
* Output: product - product of a and b
*/
static void matmul( GLdouble *product, const GLdouble *a, const GLdouble *b )
static void
matmul(GLdouble * product, const GLdouble * a, const GLdouble * b)
{
/* This matmul was contributed by Thomas Malik */
GLdouble temp[16];
@@ -111,18 +84,29 @@ static void matmul( GLdouble *product, const GLdouble *a, const GLdouble *b )
#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);
}
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) );
MEMCPY(product, temp, 16 * sizeof(GLdouble));
}
@@ -132,118 +116,175 @@ static void matmul( GLdouble *product, const GLdouble *a, const GLdouble *b )
* 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 )
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;
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 = 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,
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;
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,
/* 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;
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,
/* 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;
}
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[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;
/* 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 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;
}
/* 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[2]) > fabs(r2[2]))
SWAP_ROWS(r3, r2);
if (0.0 == r2[2])
return GL_FALSE;
/* 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 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];
/* 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; }
/* last check */
if (0.0 == r3[3])
return GL_FALSE;
/* choose pivot - or die */
if (fabs(r3[2])>fabs(r2[2])) SWAP_ROWS(r3, r2);
if (0.0 == r2[2]) 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;
/* 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];
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;
/* last check */
if (0.0 == r3[3]) return GL_FALSE;
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;
s = 1.0/r3[3]; /* now back substitute row 3 */
r3[4] *= s; r3[5] *= s; r3[6] *= s; r3[7] *= s;
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);
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;
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];
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;
return GL_TRUE;
#undef MAT
#undef SWAP_ROWS
@@ -252,63 +293,70 @@ static GLboolean invert_matrix( const GLdouble *m, GLdouble *out )
/* 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)
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];
/* 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);
/* 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;
/* 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];
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;
/* 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)
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];
/* 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;
/* 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);
invert_matrix(A,m);
/* calcul transformation inverse */
matmul(A, proj, model);
invert_matrix(A, m);
/* 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;
/* 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;
}
@@ -317,35 +365,36 @@ GLint GLAPIENTRY gluUnProject(GLdouble winx,GLdouble winy,GLdouble winz,
* This is like gluUnProject but also takes near and far DepthRange values.
*/
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 )
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);
/* 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;
/* 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);
invert_matrix(A,m);
/* calcul transformation inverse */
matmul(A, projMatrix, modelMatrix);
invert_matrix(A, m);
/* 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;
/* 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;
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,131 +1,103 @@
/* $Id: tess.h,v 1.15.2.6 1999/12/05 17:01:17 gareth Exp $ */
/* $Id: tess.h,v 1.15.2.7 2000/07/11 01:39:41 brianp Exp $ */
/*
* Mesa 3-D graphics library
* Version: 3.1
* Version: 3.2.1
* Copyright (C) 1995-2000 Brian Paul
*
* Copyright (C) 1999 Brian Paul All Rights Reserved.
* 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.
*
* 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:
* 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.
*
* 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.
* 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.
*/
/*****************************************************************************
*
* GLU 1.3 Polygon Tessellation by Gareth Hughes <garethh@bell-labs.com>
*
*****************************************************************************/
#ifndef __GLU_TESS_H__
#define __GLU_TESS_H__
/*
* This file is part of the polygon tesselation code contributed by
* Bogdan Sikorski
*/
#ifndef TESS_H
#define TESS_H
#include <stdarg.h>
#include <stdio.h>
#include "gluP.h"
#include "tess_typedefs.h"
#include "tess_macros.h"
#include "tess_hash.h"
#include "tess_heap.h"
#if 0
#include "tess_grid.h"
#endif
#define EPSILON 1e-06 /* epsilon for double precision compares */
#ifdef __cplusplus
extern "C" {
#endif
/*****************************************************************************
* The GLUtesselator structure:
*****************************************************************************/
struct GLUtesselator
typedef enum
{
tess_callbacks_t callbacks;
GLenum winding_rule;
GLboolean boundary_only;
GLdouble tolerance;
GLenum orientation;
void *data;
GLint num_contours;
tess_contour_t *contours, *last_contour;
tess_contour_t *current_contour;
GLdouble mins[2], maxs[2];
GLint num_vertices;
tess_vertex_t **sorted_vertices;
#if 0
tess_grid_t *grid; /* Not currently used... */
#endif
heap_t *ears;
GLboolean edge_flag;
GLuint label;
tess_plane_t plane;
GLenum error;
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 GLUtriangulatorObj
{
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;
};
/*****************************************************************************
* Common tessellation functions:
*****************************************************************************/
extern void tess_error_callback( GLUtesselator *, GLenum );
extern GLdouble twice_contour_area( tess_contour_t *contour );
extern void reverse_contour( tess_contour_t *contour );
extern void delete_contour( tess_contour_t **contour );
extern void contour_dump( tess_contour_t *contour );
extern void tess_call_user_error(GLUtriangulatorObj *, GLenum);
/*****************************************************************************
* Debugging output:
*****************************************************************************/
#ifdef DEBUG
extern int tess_dbg_level;
#define DBG_LEVEL_BASE 1
#define DBG_LEVEL_VERBOSE 10
#define DBG_LEVEL_ENTEREXIT 20
#ifdef _WIN32
#define DBG_STREAM stdout
#else
#define DBG_STREAM stderr
#endif
#ifdef __GNUC__
#define MSG( level, format, args... ) \
if ( level <= tess_dbg_level ) { \
fprintf( DBG_STREAM, "%9.9s:%d:\t ", __FILE__, __LINE__ ); \
fprintf( DBG_STREAM, format, ## args ); \
fflush( DBG_STREAM ); \
}
#else
#define MSG tess_msg
#endif /* __GNUC__ */
#else
#define MSG tess_msg
#endif /* DEBUG */
extern INLINE void tess_msg( GLint level, char *format, ... );
extern INLINE void tess_info( char *file, GLint line );
#ifdef __cplusplus
}
#endif
#endif /* __GLU_TESS_H__ */

407
src/glu/mesa/tesselat.c Normal file
View File

@@ -0,0 +1,407 @@
/* $Id: tesselat.c,v 1.2.2.1 2000/07/11 02:09:22 brianp Exp $ */
/*
* Mesa 3-D graphics library
* Version: 3.2.1
* 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 <stdlib.h>
#include <math.h>
#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) ();
}

View File

@@ -303,8 +303,7 @@ interruptibleXNextEvent(Display * dpy, XEvent * event)
}
FD_ZERO(&fds);
FD_SET(__glutConnectionFD, &fds);
rc = select(__glutConnectionFD + 1, &fds,
NULL, NULL, NULL);
rc = select(__glutConnectionFD + 1, &fds, NULL, NULL, NULL);
if (rc < 0) {
if (errno == EINTR) {
return 0;
@@ -897,8 +896,7 @@ waitForSomething(void)
waittime = zerotime;
}
#if !defined(_WIN32)
rc = select(__glutConnectionFD + 1, &fds,
NULL, NULL, &waittime);
rc = select(__glutConnectionFD + 1, &fds, NULL, NULL, &waittime);
if (rc < 0 && errno != EINTR)
__glutFatalError("select error.");
#else

View File

@@ -20,7 +20,9 @@
#include <X11/Xutil.h>
#else
#include <windows.h>
#ifndef __CYGWIN32__
#include <mmsystem.h> /* Win32 Multimedia API header. */
#endif
#endif /* !_WIN32 */
#include "glutint.h"
@@ -157,7 +159,7 @@ tabletPosChange(GLUTwindow * window, int first, int count, int *data)
}
#endif /* !_WIN32 */
int
static int
__glutProcessDeviceEvents(XEvent * event)
{
#if !defined(_WIN32)
@@ -262,18 +264,21 @@ __glutProcessDeviceEvents(XEvent * event)
#else
{
JOYINFOEX info;
int njoyId = 0;
int nConnected = 0;
MMRESULT result;
JOYCAPS joyCaps;
/* Loop through all possible joystick IDs until we get the error
JOYERR_PARMS. Count the number of times we get JOYERR_NOERROR
indicating an installed joystick driver with a joystick currently
attached to the port. */
while ((result = joyGetPosEx(njoyId++,&info)) != JOYERR_PARMS) {
if (result == JOYERR_NOERROR) {
++nConnected; /* The count of connected joysticks. */
}
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 */

View File

@@ -7,8 +7,10 @@
#ifdef _WIN32
#include <windows.h>
#ifndef __CYGWIN32__
#include <mmsystem.h> /* Win32 Multimedia API header. */
#endif
#endif
#include "glutint.h"

View File

@@ -24,7 +24,7 @@
#define GLUT_BUILDING_LIB /* Building the GLUT library itself. */
#include <GL/glut.h>
#if defined( MESA ) && defined( _WIN32 )
#if defined(MESA) && defined(_WIN32) && !defined(__CYGWIN32__)
#include <gl/mesa_wgl.h>
#endif
@@ -71,7 +71,7 @@ extern int sys$gettim(struct timeval *);
#endif
#else
#include <sys/types.h>
#if !defined(_WIN32)
#if !defined(_WIN32) || defined(__CYGWIN32__)
#include <sys/time.h>
#else
#include <winsock.h>

View File

@@ -40,9 +40,57 @@
#define XA_STRING 0
/* Private routines from win32_util.c */
#ifndef __CYGWIN32__
extern int gettimeofday(struct timeval* tp, void* tzp);
#endif
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);
/* Cygwin B20.1 misses the following definitions */
#ifdef __CYGWIN32__
/* from winuser.h */
#define CDS_FULLSCREEN 4
/* from mmsystem.h */
#define WINMMAPI __declspec(dllimport)
typedef UINT MMRESULT;
#define MM_JOY1MOVE 0x3A0
#define MM_JOY1ZMOVE 0x3A2
#define MM_JOY1BUTTONDOWN 0x3B5
#define MM_JOY1BUTTONUP 0x3B7
#define JOYERR_NOERROR 0
#define JOYERR_PARMS 165
#define JOY_RETURNALL 0x000000ffl
#define JOYSTICKID1 0
typedef struct joyinfoex_tag {
DWORD dwSize; /* size of structure */
DWORD dwFlags; /* flags to indicate what to return */
DWORD dwXpos; /* x position */
DWORD dwYpos; /* y position */
DWORD dwZpos; /* z position */
DWORD dwRpos; /* rudder/4th axis position */
DWORD dwUpos; /* 5th axis position */
DWORD dwVpos; /* 6th axis position */
DWORD dwButtons; /* button states */
DWORD dwButtonNumber; /* current button number pressed */
DWORD dwPOV; /* point of view state */
DWORD dwReserved1; /* reserved for communication between winmm & driver */
DWORD dwReserved2; /* reserved for future expansion */
} JOYINFOEX, *PJOYINFOEX, /* NEAR */ *NPJOYINFOEX, /* FAR */ *LPJOYINFOEX;
WINMMAPI MMRESULT WINAPI joyGetPosEx( UINT uJoyID, LPJOYINFOEX pji);
WINMMAPI MMRESULT WINAPI joyReleaseCapture( UINT uJoyID);
WINMMAPI MMRESULT WINAPI joySetCapture( HWND hwnd, UINT uJoyID, UINT uPeriod, BOOL fChanged);
WINMMAPI MMRESULT WINAPI joySetThreshold( UINT uJoyID, UINT uThreshold);
#endif
#endif /* __glutwin32_h__ */

View File

@@ -11,11 +11,7 @@
#include "glutint.h"
#include "glutstroke.h"
#include "glutbitmap.h"
#if defined(__CYGWIN32__)
typedef MINMAXINFO* LPMINMAXINFO;
#else
#include <sys/timeb.h>
#endif
/* The following added by Paul Garceau <pgarceau@teleport.com> */
#if defined(__MINGW32__)
@@ -27,6 +23,7 @@ struct timeval;
extern StrokeFontRec glutStrokeRoman, glutStrokeMonoRoman;
extern BitmapFontRec glutBitmap8By13, glutBitmap9By15, glutBitmapTimesRoman10, glutBitmapTimesRoman24, glutBitmapHelvetica10, glutBitmapHelvetica12, glutBitmapHelvetica18;
#ifndef __CYGWIN32__
int
gettimeofday(struct timeval* tp, void* tzp)
{
@@ -39,6 +36,7 @@ gettimeofday(struct timeval* tp, void* tzp)
/* 0 indicates that the call succeeded. */
return 0;
}
#endif
/* To get around the fact that Microsoft DLLs only allow functions
to be exported and now data addresses (as Unix DSOs support), the

View File

@@ -8,13 +8,9 @@
#include "glutint.h"
#if defined(__CYGWIN32__)
typedef MINMAXINFO* LPMINMAXINFO;
#else
#include <sys/timeb.h>
#endif
#ifdef _WIN32
#if defined(_WIN32) && !defined(__CYGWIN32__)
#include <mmsystem.h> /* Win32 Multimedia API header. */
#endif

View File

@@ -1,59 +1 @@
# Makefile for OpenGL widgets
# NOTE: widget code is from SGI. See any of the .c or .h files for the
# complete copyright. Mesa's GNU copyright DOES NOT apply to this widget
# code.
##### MACROS #####
VPATH = RCS
INCDIRS = -I../include -I/usr/include/Motif1.2 -I/usr/X11R6/include
LIBDIR = ../lib
SOURCES = GLwDrawA.c GLwMDrawA.c
OBJECTS = $(SOURCES:.c=.o)
##### RULES #####
.c.o:
$(CC) -c $(INCDIRS) $(CFLAGS) $<
##### TARGETS #####
default:
@echo "Specify a target configuration"
clean:
-rm *.o *~
# The name of the library file comes from Make-config
#XXX GLW_LIB = libGLw.a
targets: $(LIBDIR)/$(GLW_LIB)
# Make the library
$(LIBDIR)/$(GLW_LIB): $(OBJECTS)
$(MAKELIB) $(GLW_LIB) $(MAJOR) $(MINOR) $(OBJECTS)
mv $(GLW_LIB)* $(LIBDIR)
include ../Make-config
include depend
#
# Run 'make depend' to update the dependencies if you change what's included
# by any source file.
#
dep: $(SOURCES)
makedepend -fdepend -Y -I../include $(SOURCES)
include Makefile.X11

73
src/glw/Makefile.X11 Normal file
View File

@@ -0,0 +1,73 @@
# Makefile for OpenGL widgets
# NOTE: widget code is from SGI. See any of the .c or .h files for the
# complete copyright. Mesa's GNU copyright DOES NOT apply to this widget
# code.
##### MACROS #####
MAJOR = 1
MINOR = 0
TINY = 0
VPATH = RCS
INCDIRS = -I../include -I/usr/include/Motif1.2 -I/usr/X11R6/include
LIBDIR = ../lib
# Compile GLwMDrawA.c only if you have Motif headers!
#SOURCES = GLwDrawA.c GLwMDrawA.c
SOURCES = GLwDrawA.c
OBJECTS = $(SOURCES:.c=.o)
##### RULES #####
.c.o:
$(CC) -c $(INCDIRS) $(CFLAGS) $<
##### TARGETS #####
default:
@echo "Specify a target configuration"
clean:
-rm *.o *~
targets: $(LIBDIR)/$(GLW_LIB) message
# Make the library
$(LIBDIR)/$(GLW_LIB): $(OBJECTS)
$(MAKELIB) $(GLW_LIB) $(MAJOR) $(MINOR) $(TINY) $(OBJECTS)
ls -l $(GLW_LIB)
mv $(GLW_LIB)* $(LIBDIR)
-mv *.a $(LIBDIR)
message:
@echo
@echo "************************************************************************"
@echo "*** Edit widgets-sgi/Makefile.X11 to enable Motif support, if needed ***"
@echo "************************************************************************"
@echo
include ../Make-config
include depend
#
# Run 'make depend' to update the dependencies if you change what's included
# by any source file.
#
dep: $(SOURCES)
makedepend -fdepend -Y -I../include $(SOURCES)

View File

@@ -1,8 +1,8 @@
# $Id: Makefile.X11,v 1.6.2.1 1999/11/16 15:25:50 brianp Exp $
# $Id: Makefile.X11,v 1.6.2.5 2000/07/14 14:56:27 brianp Exp $
# Mesa 3-D graphics library
# Version: 3.1
# Copyright (C) 1995-1999 Brian Paul
# Version: 3.2.1
# Copyright (C) 1995-2000 Brian Paul
# Makefile for core library
@@ -104,6 +104,11 @@ DRIVER_SOURCES = \
X/xmesa4.c \
OSmesa/osmesa.c \
SVGA/svgamesa.c \
SVGA/svgamesa8.c \
SVGA/svgamesa15.c \
SVGA/svgamesa16.c \
SVGA/svgamesa24.c \
SVGA/svgamesa32.c \
FX/fxapi.c \
FX/fxclip.c \
FX/fxcva.c \
@@ -167,6 +172,16 @@ X/xmesa4.o: X/xmesa4.c
$(CC) -c -I. -I$(INCDIR) $(CFLAGS) $< -o $@
SVGA/svgamesa.o: SVGA/svgamesa.c
$(CC) -c -I. -I$(INCDIR) $(CFLAGS) $< -o $@
SVGA/svgamesa8.o: SVGA/svgamesa8.c
$(CC) -c -I. -I$(INCDIR) $(CFLAGS) $< -o $@
SVGA/svgamesa15.o: SVGA/svgamesa15.c
$(CC) -c -I. -I$(INCDIR) $(CFLAGS) $< -o $@
SVGA/svgamesa16.o: SVGA/svgamesa16.c
$(CC) -c -I. -I$(INCDIR) $(CFLAGS) $< -o $@
SVGA/svgamesa24.o: SVGA/svgamesa24.c
$(CC) -c -I. -I$(INCDIR) $(CFLAGS) $< -o $@
SVGA/svgamesa32.o: SVGA/svgamesa32.c
$(CC) -c -I. -I$(INCDIR) $(CFLAGS) $< -o $@
OSmesa/osmesa.o: OSmesa/osmesa.c
$(CC) -c -I. -I$(INCDIR) $(CFLAGS) $< -o $@
FX/fxapi.o: FX/fxapi.c
@@ -199,11 +214,7 @@ FX/fxvsetup.o: FX/fxvsetup.c
$(CC) -c -I. -I$(INCDIR) $(CFLAGS) $< -o $@
FX/fxglidew.o: FX/fxglidew.c
$(CC) -c -I. -I$(INCDIR) $(CFLAGS) $< -o $@
FX/X86/fx_3dnow_fastpath.o: FX/X86/fx_3dnow_fastpath.S FX/X86/fx_regoff.h
FX/X86/fx_regoff.h: FX/X86/fx_gen_regoff
$< > $@
FX/X86/fx_gen_regoff : FX/X86/fx_gen_regoff.c
$(CC) -I. -I$(INCDIR) $(CFLAGS) $< -o $@
FX/X86/fx_3dnow_fastpath.o: FX/X86/fx_3dnow_fastpath.S
GGI/ggimesa.o: GGI/ggimesa.c
$(CC) -c -I. -I$(INCDIR) $(CFLAGS) $< -o $@
X86/x86.o: X86/x86.c

View File

@@ -866,6 +866,8 @@ fxMesaContext GLAPIENTRY fxMesaCreateContext(GLuint win,
GLcontext *ctx = 0;
/*FX_GrContext_t glideContext = 0;*/
char *errorstr;
GLboolean useBGR;
char *system = NULL;
if (MESA_VERBOSE&VERBOSE_DRIVER) {
fprintf(stderr,"fxmesa: fxMesaCreateContext() Start\n");
@@ -973,28 +975,83 @@ fxMesaContext GLAPIENTRY fxMesaCreateContext(GLuint win,
goto errorhandler;
}
/* Pixel tables are use during pixel read-back */
/*
* Pixel tables are use during pixel read-back
* Either initialize them for RGB or BGR order.
*/
#if FXMESA_USE_ARGB
fxInitPixelTables(GL_FALSE); /* Force RGB pixel order */
useBGR = GL_FALSE; /* Force RGB pixel order */
system = "FXMESA_USE_ARGB";
#else
if (glbHWConfig.SSTs[glbCurrentBoard].type == GR_SSTTYPE_VOODOO) {
/* jk991130 - GROSS HACK!!! - Voodoo 3s don't use BGR!!
* the only way to tell if it's a Voodoo 3 at this stage of the
* ballgame (no Glide 3.x for linux *yet*) is to query the # of TMUs
/* jk991130 - Voodoo 3s don't use BGR. Query the # of TMUs
* as Voodoo3s have 2 TMUs on board, Banshee has only 1
* Thanks to Joseph Kain for that one
* bk000413 - another suggestion from Joseph Kain is using
* VendorID 0x121a for all 3dfx boards
* DeviceID VG 1/V2 2/VB 3/V3 5
* For now we cehck for known BGR devices, and presume
* everything else to be a V3/RGB.
*/
if (glbHWConfig.SSTs[glbCurrentBoard].sstBoard.VoodooConfig.nTexelfx == 2) {
fxInitPixelTables(GL_FALSE); /* use RGB pixel order (Voodoo3) */
GrVoodooConfig_t *voodoo;
voodoo = &glbHWConfig.SSTs[glbCurrentBoard].sstBoard.VoodooConfig;
if (voodoo->nTexelfx == 1) {
/* Voodoo1 or Banshee */
useBGR = GL_TRUE;
system = "Voodoo1";
}
else {
fxInitPixelTables(GL_TRUE); /* use BGR pixel order on Voodoo1/2 */
else if (voodoo->nTexelfx == 2 &&
voodoo->fbiRev == 260 &&
voodoo->tmuConfig[0].tmuRev == 4 &&
(voodoo->tmuConfig[0].tmuRam == 2 ||
voodoo->tmuConfig[0].tmuRam == 4)) {
/* Voodoo 2 */
useBGR = GL_TRUE;
system = "Voodoo2";
}
else if (voodoo->nTexelfx == 2 &&
voodoo->fbiRev == 2 &&
voodoo->tmuConfig[0].tmuRev == 1 &&
voodoo->tmuConfig[0].tmuRam == 4) {
/* Quantum3D Obsidian 50/100 */
useBGR = GL_TRUE;
system = "Quantum3D Obsidian";
}
else
/* Brian
* (voodoo->nTexelfx == 2 &&
* voodoo->fbiRev == 0 &&
* voodoo->tmuConfig[0].tmuRev == 148441048 &&
* voodoo->tmuConfig[0].tmuRam == 3)
* Bernd
* (voodoo->nTexelfx == 2 &&
* voodoo->fbiRev == 69634 &&
* voodoo->tmuConfig[0].tmuRev == 69634 &&
* voodoo->tmuConfig[0].tmuRam == 2 )
*/
{
/* Presumed Voodoo3 */
useBGR = GL_FALSE;
system = "Voodoo3";
}
if (getenv("MESA_FX_INFO")) {
printf("Voodoo: Texelfx: %d / FBI Rev.: %d / TMU Rev.: %d / TMU RAM: %d\n",
voodoo->nTexelfx,
voodoo->fbiRev,
voodoo->tmuConfig[0].tmuRev,
voodoo->tmuConfig[0].tmuRam );
}
}
else {
fxInitPixelTables(GL_FALSE); /* use RGB pixel order otherwise */
useBGR = GL_FALSE; /* use RGB pixel order otherwise */
system = "non-voodoo";
}
#endif
#endif /*FXMESA_USE_ARGB*/
if (getenv("MESA_FX_INFO"))
printf("Voodoo pixel order: %s (%s)\n", useBGR ? "BGR" : "RGB", system);
fxInitPixelTables(fxMesa, useBGR);
fxMesa->width=FX_grSstScreenWidth();
fxMesa->height=FX_grSstScreenHeight();
@@ -1055,7 +1112,8 @@ fxMesaContext GLAPIENTRY fxMesaCreateContext(GLuint win,
/* install signal handlers */
#if defined(__linux__)
if (fxMesa->glCtx->CatchSignals) {
/* Only install if environment var. is not set. */
if (fxMesa->glCtx->CatchSignals && !getenv("MESA_FX_NO_SIGNALS")) {
signal(SIGINT,cleangraphics_handler);
signal(SIGHUP,cleangraphics_handler);
signal(SIGPIPE,cleangraphics_handler);
@@ -1280,6 +1338,8 @@ int GLAPIENTRY fxQueryHardware(void)
glbHWConfig.SSTs[glbCurrentBoard].sstBoard.VoodooConfig.fbRam);
fprintf(stderr,"Number of TMUs: %d\n",
glbHWConfig.SSTs[glbCurrentBoard].sstBoard.VoodooConfig.nTexelfx);
fprintf(stderr,"fbiRev: %d\n",
glbHWConfig.SSTs[glbCurrentBoard].sstBoard.VoodooConfig.fbiRev);
fprintf(stderr,"SLI detected: %d\n",
glbHWConfig.SSTs[glbCurrentBoard].sstBoard.VoodooConfig.sliDetect);
} else if(glbHWConfig.SSTs[glbCurrentBoard].type==GR_SSTTYPE_SST96) {
@@ -1298,7 +1358,10 @@ int GLAPIENTRY fxQueryHardware(void)
#if defined(__WIN32__)
onexit((_onexit_t)cleangraphics);
#elif defined(__linux__)
atexit(cleangraphics);
/* Only register handler if environment variable is not defined. */
if (!getenv("MESA_FX_NO_SIGNALS")) {
atexit(cleangraphics);
}
#endif
}

View File

@@ -70,9 +70,11 @@ GLubyte FX_PixelToB[0x10000];
* Initialize the FX_PixelTo{RGB} arrays.
* Input: bgrOrder - if TRUE, pixels are in BGR order, else RGB order.
*/
void fxInitPixelTables(GLboolean bgrOrder)
void fxInitPixelTables(fxMesaContext fxMesa, GLboolean bgrOrder)
{
GLuint pixel;
fxMesa->bgrOrder=bgrOrder;
for (pixel = 0; pixel <= 0xffff; pixel++) {
GLuint r, g, b;
if (bgrOrder) {
@@ -374,10 +376,16 @@ static GLboolean fxDDDrawBitMap(GLcontext *ctx, GLint px, GLint py,
g=(GLint)(ctx->Current.RasterColor[1]*255.0f);
b=(GLint)(ctx->Current.RasterColor[2]*255.0f);
a=(GLint)(ctx->Current.RasterColor[3]*255.0f);
color=(FxU16)
( ((FxU16)0xf8 & b) <<(11-3)) |
( ((FxU16)0xfc & g) <<(5-3+1)) |
( ((FxU16)0xf8 & r) >> 3);
if (fxMesa->bgrOrder)
color=(FxU16)
( ((FxU16)0xf8 & b) <<(11-3)) |
( ((FxU16)0xfc & g) <<(5-3+1)) |
( ((FxU16)0xf8 & r) >> 3);
else
color=(FxU16)
( ((FxU16)0xf8 & r) <<(11-3)) |
( ((FxU16)0xfc & g) <<(5-3+1)) |
( ((FxU16)0xf8 & b) >> 3);
stride=info.strideInBytes>>1;

View File

@@ -79,7 +79,7 @@ FxBool writeRegionClipped(fxMesaContext fxMesa, GrBuffer_t dst_buffer,
FxU32 src_width, FxU32 src_height, FxI32 src_stride,
void *src_data)
{
int i, x, w;
int i, x, w, srcElt;
void *data;
if (src_width==1 && src_height==1) { /* Easy case writing a point */
@@ -89,16 +89,22 @@ FxBool writeRegionClipped(fxMesaContext fxMesa, GrBuffer_t dst_buffer,
(dst_y>=fxMesa->pClipRects[i].y1) &&
(dst_y<fxMesa->pClipRects[i].y2)) {
FX_grLfbWriteRegion(dst_buffer, dst_x, dst_y, src_format,
src_width, src_height, src_stride, src_data);
1, 1, src_stride, src_data);
return GL_TRUE;
}
}
} else if (src_height==1) { /* Writing a span */
if (src_format==GR_LFB_SRC_FMT_8888) srcElt=4;
else if (src_format==GR_LFB_SRC_FMT_ZA16) srcElt=2;
else {
fprintf(stderr, "Unknown src_format passed to writeRegionClipped\n");
return GL_FALSE;
}
for (i=0; i<fxMesa->numClipRects; i++) {
if (dst_y>=fxMesa->pClipRects[i].y1 && dst_y<fxMesa->pClipRects[i].y2) {
if (dst_x<fxMesa->pClipRects[i].x1) {
x=fxMesa->pClipRects[i].x1;
data=((char*)src_data)+2*(dst_x-x);
data=((char*)src_data)+srcElt*(dst_x-x);
w=src_width-(x-dst_x);
} else {
x=dst_x;
@@ -108,7 +114,7 @@ FxBool writeRegionClipped(fxMesaContext fxMesa, GrBuffer_t dst_buffer,
if (x+w>fxMesa->pClipRects[i].x2) {
w=fxMesa->pClipRects[i].x2-x;
}
FX_grLfbWriteRegion(dst_buffer, x, dst_y, src_format, w, src_height,
FX_grLfbWriteRegion(dst_buffer, x, dst_y, src_format, w, 1,
src_stride, data);
}
}
@@ -422,14 +428,40 @@ void fxDDReadDepthSpanFloat(GLcontext *ctx,
GLuint n, GLint x, GLint y, GLfloat depth[])
{
fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx;
GLuint i;
GLint i;
GLint bottom=fxMesa->height+fxMesa->y_offset-1;
GLushort data[MAX_WIDTH];
GLint count = (GLint) n;
if (MESA_VERBOSE&VERBOSE_DRIVER) {
fprintf(stderr,"fxmesa: fxDDReadDepthSpanFloat(...)\n");
}
if (y < 0 || y >= ctx->Buffer->Height ||
x >= ctx->Buffer->Width || x + count < 0) {
/* completely outside frame buffer */
for (i = 0; i < count; i++)
depth[i] = 0;
return;
}
if (x < 0) {
GLint dx = -x;
for (i = 0; i < dx; i++)
depth[i] = 0;
x = 0;
depth += dx;
count -= dx;
}
if (x + count > ctx->Buffer->Width) {
GLint dx = x + count - ctx->Buffer->Width;
for (i = 0; i < dx; i++)
depth[count - dx - 1] = 0;
count -= dx;
}
if (count <= 0)
return;
x+=fxMesa->x_offset;
FX_grLfbReadRegion(GR_BUFFER_AUXBUFFER,x,bottom-y,n,1,0,data);
@@ -445,11 +477,38 @@ void fxDDReadDepthSpanInt(GLcontext *ctx,
{
fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx;
GLint bottom=fxMesa->height+fxMesa->y_offset-1;
GLint count = (GLint) n;
GLint i;
if (MESA_VERBOSE&VERBOSE_DRIVER) {
fprintf(stderr,"fxmesa: fxDDReadDepthSpanInt(...)\n");
}
if (y < 0 || y >= ctx->Buffer->Height ||
x >= ctx->Buffer->Width || x + count < 0) {
/* completely outside frame buffer */
for (i = 0; i < count; i++)
depth[i] = 0;
return;
}
if (x < 0) {
GLint dx = -x;
for (i = 0; i < dx; i++)
depth[i] = 0;
x = 0;
depth += dx;
count -= dx;
}
if (x + count > ctx->Buffer->Width) {
GLint dx = x + count - ctx->Buffer->Width;
for (i = 0; i < dx; i++)
depth[count - dx - 1] = 0;
count -= dx;
}
if (count <= 0)
return;
x+=fxMesa->x_offset;
FX_grLfbReadRegion(GR_BUFFER_AUXBUFFER,x,bottom-y,n,1,0,depth);
}

View File

@@ -1327,7 +1327,7 @@ void fxDDTexSubImg(GLcontext *ctx, GLenum target,
width,height,mml->data);
if(ti->validated && ti->isInTM)
fxTMReloadSubMipMapLevel(fxMesa,tObj,level,yoffset,height);
fxTMReloadMipMapLevel(fxMesa,tObj,level);
else
fxTexInvalidate(ctx,tObj);
}

View File

@@ -255,10 +255,10 @@ typedef struct {
#define FX_UM_E_IFMT 0x00fff000
#define FX_UM_COLOR_ITERATED 0x00100000
#define FX_UM_COLOR_CONSTANT 0x00200000
#define FX_UM_ALPHA_ITERATED 0x00400000
#define FX_UM_ALPHA_CONSTANT 0x00800000
#define FX_UM_COLOR_ITERATED 0x01000000
#define FX_UM_COLOR_CONSTANT 0x02000000
#define FX_UM_ALPHA_ITERATED 0x04000000
#define FX_UM_ALPHA_CONSTANT 0x08000000
typedef void (*tfxRenderVBFunc)(GLcontext *);
@@ -437,6 +437,7 @@ struct tfxMesaContext {
GrBuffer_t currentFB;
GLboolean bgrOrder;
GrColor_t color;
GrColor_t clearC;
GrAlpha_t clearA;
@@ -475,6 +476,7 @@ struct tfxMesaContext {
GLenum fogTableMode;
GLfloat fogDensity;
GLfloat fogStart, fogEnd;
GrFog_t *fogTable;
/* Acc. functions */
@@ -618,6 +620,7 @@ extern void fxTMInit(fxMesaContext ctx);
extern void fxTMClose(fxMesaContext ctx);
extern void fxTMMoveInTM(fxMesaContext, struct gl_texture_object *, GLint);
extern void fxTMMoveOutTM(fxMesaContext, struct gl_texture_object *);
#define fxTMMoveOutTM_NoLock fxTMMoveOutTM
extern void fxTMFreeTexture(fxMesaContext, struct gl_texture_object *);
extern void fxTMReloadMipMapLevel(fxMesaContext, struct gl_texture_object *, GLint);
extern void fxTMReloadSubMipMapLevel(fxMesaContext, struct gl_texture_object *,
@@ -670,9 +673,6 @@ extern void fxSetScissorValues(GLcontext *ctx);
extern void fxTMMoveInTM_NoLock(fxMesaContext fxMesa,
struct gl_texture_object *tObj,
GLint where);
extern void fxSetupTexture_NoLock(GLcontext *ctx);
extern void fxSetupTexture(GLcontext *ctx);
extern void fxInitPixelTables(GLboolean bgrOrder);
extern void fxInitPixelTables(fxMesaContext fxMesa, GLboolean bgrOrder);
#endif

View File

@@ -150,7 +150,17 @@ extern FxU32 FX_grTexMaxAddress(GrChipID_t tmu) {
FxBool FX_grSstControl(FxU32 code)
{
#if defined(FX_GLIDE3)
(void) code;
/* The glide 3 sources call for grEnable/grDisable to be called in exchange
* for grSstControl. */
switch(code) {
case GR_CONTROL_ACTIVATE:
grEnable(GR_PASSTHRU);
break;
case GR_CONTROL_DEACTIVATE:
grDisable(GR_PASSTHRU);
break;
}
/* Appearently GR_CONTROL_RESIZE can be ignored. */
return 1; /* OK? */
#else
FxU32 result;
@@ -374,6 +384,10 @@ int FX_grSstQueryHardware(GrHwConfiguration *c)
return i;
}
#endif /* FX_GLIDE3 */
/* It appears to me that this function is needed either way. */
FX_GrContext_t FX_grSstWinOpen( FxU32 hWnd,
GrScreenResolution_t screen_resolution,
GrScreenRefresh_t refresh_rate,
@@ -392,7 +406,7 @@ FX_GrContext_t FX_grSstWinOpen( FxU32 hWnd,
nColBuffers,
nAuxBuffers );
#if 0
/*
fprintf(stderr,
"grSstWinOpen( win %d res %d ref %d fmt %d\n"
" org %d ncol %d naux %d )\n"
@@ -405,14 +419,13 @@ FX_GrContext_t FX_grSstWinOpen( FxU32 hWnd,
nColBuffers,
nAuxBuffers,
i);
#endif
*/
END_BOARD_LOCK();
return i;
}
#endif
#else
/*

View File

@@ -59,18 +59,17 @@ static GLuint fxGetTexSetConfiguration(GLcontext *ctx,
struct gl_texture_object *tObj0,
struct gl_texture_object *tObj1);
static void fxSetupTextureSingleTMU_NoLock(GLcontext *ctx, GLuint textureset);
static void fxSetupTextureSingleTMU(GLcontext *ctx, GLuint textureset);
static void fxSetupDoubleTMU_NoLock(fxMesaContext fxMesa,
struct gl_texture_object *tObj0,
struct gl_texture_object *tObj1);
static void fxSetupTexture_NoLock(GLcontext *ctx);
static void fxSetupTexture(GLcontext *ctx);
static void fxSetupBlend(GLcontext *ctx);
static void fxSetupDepthTest(GLcontext *ctx);
static void fxFogTableGenerate(GLcontext *ctx);
static void fxSetupFog(GLcontext *ctx, GLboolean forceTableRebuild);
static void fxSetupScissor(GLcontext *ctx);
static void fxSetupCull(GLcontext *ctx);
static void gl_print_fx_state_flags( const char *msg, GLuint flags);
/*static GLboolean fxMultipassBlend(struct vertex_buffer *, GLuint);*/
/* static GLboolean fxMultipassBlend(struct vertex_buffer *, GLuint); */
static GLboolean fxMultipassTexture( struct vertex_buffer *, GLuint );
static void fxTexValidate(GLcontext *ctx, struct gl_texture_object *tObj)
@@ -120,7 +119,7 @@ static void fxTexValidate(GLcontext *ctx, struct gl_texture_object *tObj)
ti->sClamp=0;
break;
default:
;
; /* silence compiler warning */
}
switch (tObj->WrapT) {
case GL_CLAMP_TO_EDGE:
@@ -132,7 +131,7 @@ static void fxTexValidate(GLcontext *ctx, struct gl_texture_object *tObj)
ti->tClamp=0;
break;
default:
;
; /* silence compiler warning */
}
ti->validated=GL_TRUE;
@@ -184,7 +183,7 @@ static GLuint fxGetTexSetConfiguration(GLcontext *ctx,
GLuint envmode=0;
GLuint ifmt=0;
if((ctx->Light.ShadeModel==GL_SMOOTH) ||
if((ctx->Light.ShadeModel==GL_SMOOTH) || 1 ||
(ctx->Point.SmoothFlag) ||
(ctx->Line.SmoothFlag) ||
(ctx->Polygon.SmoothFlag))
@@ -192,11 +191,17 @@ static GLuint fxGetTexSetConfiguration(GLcontext *ctx,
else
unitsmode|=FX_UM_ALPHA_CONSTANT;
if(ctx->Light.ShadeModel==GL_SMOOTH)
if(ctx->Light.ShadeModel==GL_SMOOTH || 1)
unitsmode|=FX_UM_COLOR_ITERATED;
else
unitsmode|=FX_UM_COLOR_CONSTANT;
/*
OpenGL Feeds Texture 0 into Texture 1
Glide Feeds Texture 1 into Texture 0
*/
if(tObj0) {
tfxTexInfo *ti0=fxTMGetTexInfo(tObj0);
@@ -294,7 +299,7 @@ static GLuint fxGetTexSetConfiguration(GLcontext *ctx,
unitsmode|=(ifmt | envmode);
if (MESA_VERBOSE & (VERBOSE_DRIVER|VERBOSE_TEXTURE))
if (MESA_VERBOSE & (VERBOSE_DRIVER|VERBOSE_TEXTURE))
fxPrintUnitsMode("unitsmode", unitsmode);
return unitsmode;
@@ -309,18 +314,25 @@ static GLuint fxGetTexSetConfiguration(GLcontext *ctx,
static void fxSetupSingleTMU_NoLock(fxMesaContext fxMesa, struct gl_texture_object *tObj)
{
tfxTexInfo *ti=fxTMGetTexInfo(tObj);
int tmu;
/* Make sure we're not loaded incorrectly */
if (ti->isInTM) {
if (ti->LODblend) {
if (ti->whichTMU!=FX_TMU_SPLIT)
fxTMMoveOutTM(fxMesa, tObj);
} else {
if (ti->whichTMU==FX_TMU_SPLIT)
fxTMMoveOutTM(fxMesa, tObj);
}
}
/* Make sure we're loaded correctly */
if (!ti->isInTM) {
if (ti->LODblend)
fxTMMoveInTM_NoLock(fxMesa,tObj,FX_TMU_SPLIT);
else {
if (fxMesa->haveTwoTMUs) {
#if 0
/* This path is disabled because we're not correctly setting up
the second TMU as the only texture unit. It is arguable if this
fallback is ever really a win, because when we use the second
TMU we have to do setup for both TMU0 and TMU1 which is extra
work. We could just flush a texture from TMU0 instead. */
if (fxMesa->freeTexMem[FX_TMU0] >
FX_grTexTextureMemRequired_NoLock(GR_MIPMAPLEVELMASK_BOTH,
&(ti->info))) {
@@ -328,9 +340,6 @@ static void fxSetupSingleTMU_NoLock(fxMesaContext fxMesa, struct gl_texture_obje
} else {
fxTMMoveInTM_NoLock(fxMesa,tObj, FX_TMU1);
}
#else
fxTMMoveInTM_NoLock(fxMesa, tObj, FX_TMU0);
#endif
} else
fxTMMoveInTM_NoLock(fxMesa,tObj,FX_TMU0);
}
@@ -357,11 +366,14 @@ static void fxSetupSingleTMU_NoLock(fxMesaContext fxMesa, struct gl_texture_obje
FX_grTexSource_NoLock(GR_TMU1,ti->tm[FX_TMU1]->startAddr,
GR_MIPMAPLEVELMASK_EVEN,&(ti->info));
} else {
if (ti->whichTMU==FX_TMU_BOTH) tmu=FX_TMU0;
else tmu=ti->whichTMU;
if((ti->info.format==GR_TEXFMT_P_8) && (!fxMesa->haveGlobalPaletteTexture)) {
if (MESA_VERBOSE&VERBOSE_DRIVER) {
fprintf(stderr,"fxmesa: uploading texture palette\n");
}
FX_grTexDownloadTable_NoLock(ti->whichTMU,GR_TEXTABLE_PALETTE,&(ti->palette));
FX_grTexDownloadTable_NoLock(tmu, GR_TEXTABLE_PALETTE, &(ti->palette));
}
/* KW: The alternative is to do the download to the other tmu. If
@@ -371,22 +383,15 @@ static void fxSetupSingleTMU_NoLock(fxMesaContext fxMesa, struct gl_texture_obje
if (ti->LODblend && (MESA_VERBOSE&VERBOSE_DRIVER))
fprintf(stderr, "fxmesa: not blending texture - only on one tmu\n");
FX_grTexClampMode_NoLock(ti->whichTMU,ti->sClamp,ti->tClamp);
FX_grTexFilterMode_NoLock(ti->whichTMU,ti->minFilt,ti->maxFilt);
FX_grTexMipMapMode_NoLock(ti->whichTMU,ti->mmMode,FXFALSE);
FX_grTexClampMode_NoLock(tmu, ti->sClamp, ti->tClamp);
FX_grTexFilterMode_NoLock(tmu, ti->minFilt, ti->maxFilt);
FX_grTexMipMapMode_NoLock(tmu, ti->mmMode, FXFALSE);
FX_grTexSource_NoLock(ti->whichTMU,
ti->tm[ti->whichTMU]->startAddr,
GR_MIPMAPLEVELMASK_BOTH,&(ti->info));
FX_grTexSource_NoLock(tmu, ti->tm[tmu]->startAddr,
GR_MIPMAPLEVELMASK_BOTH, &(ti->info));
}
}
static void fxSetupSingleTMU(fxMesaContext fxMesa, struct gl_texture_object *tObj) {
BEGIN_BOARD_LOCK();
fxSetupSingleTMU_NoLock(fxMesa, tObj);
END_BOARD_LOCK();
}
static void fxSelectSingleTMUSrc_NoLock(fxMesaContext fxMesa, GLint tmu,
FxBool LODblend)
{
@@ -408,11 +413,15 @@ static void fxSelectSingleTMUSrc_NoLock(fxMesaContext fxMesa, GLint tmu,
FXFALSE,FXFALSE);
fxMesa->tmuSrc=FX_TMU_SPLIT;
} else {
if(tmu==FX_TMU0) {
if (tmu!=FX_TMU1) {
FX_grTexCombine_NoLock(GR_TMU0,
GR_COMBINE_FUNCTION_LOCAL,GR_COMBINE_FACTOR_NONE,
GR_COMBINE_FUNCTION_LOCAL,GR_COMBINE_FACTOR_NONE,
FXFALSE,FXFALSE);
FX_grTexCombine_NoLock(GR_TMU1,
GR_COMBINE_FUNCTION_ZERO, GR_COMBINE_FACTOR_NONE,
GR_COMBINE_FUNCTION_ZERO, GR_COMBINE_FACTOR_NONE,
FXFALSE,FXFALSE);
fxMesa->tmuSrc=FX_TMU0;
} else {
FX_grTexCombine_NoLock(GR_TMU1,
@@ -442,6 +451,7 @@ static void fxSetupTextureSingleTMU_NoLock(GLcontext *ctx, GLuint textureset)
GLint ifmt;
tfxTexInfo *ti;
struct gl_texture_object *tObj=ctx->Texture.Unit[textureset].CurrentD[2];
int tmu;
if (MESA_VERBOSE&VERBOSE_DRIVER) {
fprintf(stderr,"fxmesa: fxSetupTextureSingleTMU(...) Start\n");
@@ -453,16 +463,18 @@ static void fxSetupTextureSingleTMU_NoLock(GLcontext *ctx, GLuint textureset)
fxSetupSingleTMU_NoLock(fxMesa,tObj);
if(fxMesa->tmuSrc!=ti->whichTMU)
fxSelectSingleTMUSrc_NoLock(fxMesa,ti->whichTMU,ti->LODblend);
if (ti->whichTMU==FX_TMU_BOTH) tmu=FX_TMU0;
else tmu=ti->whichTMU;
if (fxMesa->tmuSrc!=tmu)
fxSelectSingleTMUSrc_NoLock(fxMesa, tmu, ti->LODblend);
if(textureset==0 || !fxMesa->haveTwoTMUs)
unitsmode=fxGetTexSetConfiguration(ctx,tObj,NULL);
else
unitsmode=fxGetTexSetConfiguration(ctx,NULL,tObj);
if(fxMesa->lastUnitsMode==unitsmode)
return;
/* if(fxMesa->lastUnitsMode==unitsmode) */
/* return; */
fxMesa->lastUnitsMode=unitsmode;
@@ -520,6 +532,7 @@ static void fxSetupTextureSingleTMU_NoLock(GLcontext *ctx, GLuint textureset)
FXFALSE);
break;
case GL_BLEND:
#if 0
FX_grAlphaCombine_NoLock(GR_COMBINE_FUNCTION_SCALE_OTHER,
GR_COMBINE_FACTOR_LOCAL,
locala,
@@ -537,7 +550,11 @@ static void fxSetupTextureSingleTMU_NoLock(GLcontext *ctx, GLuint textureset)
localc,
GR_COMBINE_OTHER_TEXTURE,
FXTRUE);
/*ctx->Driver.MultipassFunc = fxMultipassBlend;*/
ctx->Driver.MultipassFunc = fxMultipassBlend;
#else
if (MESA_VERBOSE&VERBOSE_DRIVER)
fprintf(stderr,"fx Driver: GL_BLEND not yet supported\n");
#endif
break;
case GL_REPLACE:
if((ifmt==GL_RGB) || (ifmt==GL_LUMINANCE))
@@ -567,9 +584,9 @@ static void fxSetupTextureSingleTMU_NoLock(GLcontext *ctx, GLuint textureset)
FXFALSE);
break;
default:
#ifndef FX_SILENT
fprintf(stderr,"fx Driver: %x Texture.EnvMode not yet supported\n",ctx->Texture.Unit[textureset].EnvMode);
#endif
if (MESA_VERBOSE&VERBOSE_DRIVER)
fprintf(stderr, "fx Driver: %x Texture.EnvMode not yet supported\n",
ctx->Texture.Unit[textureset].EnvMode);
break;
}
@@ -600,87 +617,87 @@ static void fxSetupDoubleTMU_NoLock(fxMesaContext fxMesa,
tfxTexInfo *ti0=fxTMGetTexInfo(tObj0);
tfxTexInfo *ti1=fxTMGetTexInfo(tObj1);
GLuint tstate=0;
int tmu0=0, tmu1=1;
if (MESA_VERBOSE&VERBOSE_DRIVER) {
fprintf(stderr,"fxmesa: fxSetupDoubleTMU(...)\n");
}
if(ti0->isInTM) {
if(ti0->whichTMU==FX_TMU0)
tstate|=T0_IN_TMU0;
else if(ti0->whichTMU==FX_TMU1)
tstate|=T0_IN_TMU1;
else {
fxTMMoveOutTM(fxMesa,tObj0);
tstate|=T0_NOT_IN_TMU;
}
} else
tstate|=T0_NOT_IN_TMU;
/* We shouldn't need to do this. There is something wrong with
mutlitexturing when the TMUs are swapped. So, we're forcing
them to always be loaded correctly. !!! */
if (ti0->whichTMU==FX_TMU1)
fxTMMoveOutTM_NoLock(fxMesa, tObj0);
if (ti1->whichTMU==FX_TMU0)
fxTMMoveOutTM_NoLock(fxMesa, tObj1);
if(ti1->isInTM) {
if(ti1->whichTMU==FX_TMU0)
tstate|=T1_IN_TMU0;
else if(ti1->whichTMU==FX_TMU1)
tstate|=T1_IN_TMU1;
else {
fxTMMoveOutTM(fxMesa,tObj1);
tstate|=T1_NOT_IN_TMU;
if (ti0->isInTM) {
switch (ti0->whichTMU) {
case FX_TMU0:
tstate|=T0_IN_TMU0;
break;
case FX_TMU1:
tstate|=T0_IN_TMU1;
break;
case FX_TMU_BOTH:
tstate|=T0_IN_TMU0|T0_IN_TMU1;
break;
case FX_TMU_SPLIT:
tstate|=T0_NOT_IN_TMU;
break;
}
} else
tstate|=T1_NOT_IN_TMU;
} else tstate|=T0_NOT_IN_TMU;
if (ti1->isInTM) {
switch (ti1->whichTMU) {
case FX_TMU0:
tstate|=T1_IN_TMU0;
break;
case FX_TMU1:
tstate|=T1_IN_TMU1;
break;
case FX_TMU_BOTH:
tstate|=T1_IN_TMU0|T1_IN_TMU1;
break;
case FX_TMU_SPLIT:
tstate|=T1_NOT_IN_TMU;
break;
}
} else tstate|=T1_NOT_IN_TMU;
ti0->lastTimeUsed=fxMesa->texBindNumber;
ti1->lastTimeUsed=fxMesa->texBindNumber;
/* Move texture maps in TMUs */
/* Move texture maps into TMUs */
switch(tstate) {
case (T0_IN_TMU0 | T1_IN_TMU0):
fxTMMoveOutTM(fxMesa,tObj1);
fxTMMoveInTM_NoLock(fxMesa,tObj1,FX_TMU1);
break;
case (T0_IN_TMU1 | T1_IN_TMU1):
fxTMMoveOutTM(fxMesa,tObj0);
fxTMMoveInTM_NoLock(fxMesa,tObj0,FX_TMU0);
break;
case (T0_NOT_IN_TMU | T1_NOT_IN_TMU):
fxTMMoveInTM_NoLock(fxMesa,tObj0,FX_TMU0);
fxTMMoveInTM_NoLock(fxMesa,tObj1,FX_TMU1);
break;
/*** T0/T1 ***/
case (T0_NOT_IN_TMU | T1_IN_TMU0):
fxTMMoveInTM_NoLock(fxMesa,tObj0,FX_TMU1);
break;
case (T0_NOT_IN_TMU | T1_IN_TMU1):
fxTMMoveInTM_NoLock(fxMesa,tObj0,FX_TMU0);
break;
case (T0_IN_TMU0 | T1_NOT_IN_TMU):
fxTMMoveInTM_NoLock(fxMesa,tObj1,FX_TMU1);
break;
case (T0_IN_TMU1 | T1_NOT_IN_TMU):
fxTMMoveInTM_NoLock(fxMesa,tObj1,FX_TMU0);
break;
/*** Best Case ***/
case (T0_IN_TMU1 | T1_IN_TMU0):
case (T0_IN_TMU0 | T1_IN_TMU1):
break;
default:
fprintf(stderr,"fx Driver: internal error in fxSetupDoubleTMU()\n");
fxCloseHardware();
exit(-1);
break;
if (!(((tstate&T0_IN_TMU0) && (tstate&T1_IN_TMU1)) ||
((tstate&T0_IN_TMU1) && (tstate&T1_IN_TMU0)))) {
if (tObj0==tObj1) fxTMMoveInTM_NoLock(fxMesa, tObj1, FX_TMU_BOTH);
else {
/* Find the minimal way to correct the situation */
if ((tstate&T0_IN_TMU0) || (tstate&T1_IN_TMU1)) {
/* We have one in the standard order, setup the other */
if (tstate&T0_IN_TMU0) { /* T0 is in TMU0, put T1 in TMU1 */
fxTMMoveInTM_NoLock(fxMesa, tObj1, FX_TMU1);
} else {
fxTMMoveInTM_NoLock(fxMesa, tObj0, FX_TMU0);
}
/* tmu0 and tmu1 are setup */
} else if ((tstate&T0_IN_TMU1) || (tstate&T1_IN_TMU0)) {
/* we have one in the reverse order, setup the other */
if (tstate&T1_IN_TMU0) { /* T1 is in TMU0, put T0 in TMU1 */
fxTMMoveInTM_NoLock(fxMesa, tObj0, FX_TMU1);
} else {
fxTMMoveInTM_NoLock(fxMesa, tObj1, FX_TMU0);
}
tmu0=1;
tmu1=0;
} else { /* Nothing is loaded */
fxTMMoveInTM_NoLock(fxMesa, tObj0, FX_TMU0);
fxTMMoveInTM_NoLock(fxMesa, tObj1, FX_TMU1);
/* tmu0 and tmu1 are setup */
}
}
}
if (!fxMesa->haveGlobalPaletteTexture) {
@@ -688,30 +705,28 @@ static void fxSetupDoubleTMU_NoLock(fxMesaContext fxMesa,
if (MESA_VERBOSE&VERBOSE_DRIVER) {
fprintf(stderr,"fxmesa: uploading texture palette TMU0\n");
}
FX_grTexDownloadTable_NoLock(ti0->whichTMU,GR_TEXTABLE_PALETTE,&(ti0->palette));
FX_grTexDownloadTable_NoLock(tmu0, GR_TEXTABLE_PALETTE, &(ti0->palette));
}
if (ti1->info.format==GR_TEXFMT_P_8) {
if (MESA_VERBOSE&VERBOSE_DRIVER) {
fprintf(stderr,"fxmesa: uploading texture palette TMU1\n");
}
FX_grTexDownloadTable_NoLock(ti1->whichTMU, GR_TEXTABLE_PALETTE,&(ti1->palette));
FX_grTexDownloadTable_NoLock(tmu1, GR_TEXTABLE_PALETTE, &(ti1->palette));
}
}
FX_grTexSource_NoLock(ti0->whichTMU,
ti0->tm[ti0->whichTMU]->startAddr,
GR_MIPMAPLEVELMASK_BOTH,&(ti0->info));
FX_grTexClampMode_NoLock(ti0->whichTMU,ti0->sClamp,ti0->tClamp);
FX_grTexFilterMode_NoLock(ti0->whichTMU,ti0->minFilt,ti0->maxFilt);
FX_grTexMipMapMode_NoLock(ti0->whichTMU,ti0->mmMode,FXFALSE);
FX_grTexSource_NoLock(tmu0, ti0->tm[tmu0]->startAddr,
GR_MIPMAPLEVELMASK_BOTH, &(ti0->info));
FX_grTexClampMode_NoLock(tmu0, ti0->sClamp, ti0->tClamp);
FX_grTexFilterMode_NoLock(tmu0, ti0->minFilt, ti0->maxFilt);
FX_grTexMipMapMode_NoLock(tmu0, ti0->mmMode, FXFALSE);
FX_grTexSource_NoLock(ti1->whichTMU,
ti1->tm[ti1->whichTMU]->startAddr,
GR_MIPMAPLEVELMASK_BOTH,&(ti1->info));
FX_grTexClampMode_NoLock(ti1->whichTMU,ti1->sClamp,ti1->tClamp);
FX_grTexFilterMode_NoLock(ti1->whichTMU,ti1->minFilt,ti1->maxFilt);
FX_grTexMipMapMode_NoLock(ti1->whichTMU,ti1->mmMode,FXFALSE);
FX_grTexSource_NoLock(tmu1, ti1->tm[tmu1]->startAddr,
GR_MIPMAPLEVELMASK_BOTH, &(ti1->info));
FX_grTexClampMode_NoLock(tmu1, ti1->sClamp, ti1->tClamp);
FX_grTexFilterMode_NoLock(tmu1, ti1->minFilt, ti1->maxFilt);
FX_grTexMipMapMode_NoLock(tmu1, ti1->mmMode, FXFALSE);
#undef T0_NOT_IN_TMU
#undef T1_NOT_IN_TMU
@@ -729,6 +744,7 @@ static void fxSetupTextureDoubleTMU_NoLock(GLcontext *ctx)
struct gl_texture_object *tObj0=ctx->Texture.Unit[0].CurrentD[2];
struct gl_texture_object *tObj1=ctx->Texture.Unit[1].CurrentD[2];
GLuint envmode,ifmt,unitsmode;
int tmu0=0, tmu1=1;
if (MESA_VERBOSE&VERBOSE_DRIVER) {
fprintf(stderr,"fxmesa: fxSetupTextureDoubleTMU(...) Start\n");
@@ -744,8 +760,8 @@ static void fxSetupTextureDoubleTMU_NoLock(GLcontext *ctx)
unitsmode=fxGetTexSetConfiguration(ctx,tObj0,tObj1);
if(fxMesa->lastUnitsMode==unitsmode)
return;
/* if(fxMesa->lastUnitsMode==unitsmode) */
/* return; */
fxMesa->lastUnitsMode=unitsmode;
@@ -772,6 +788,10 @@ static void fxSetupTextureDoubleTMU_NoLock(GLcontext *ctx)
gl_lookup_enum_by_nr(ctx->Texture.Unit[1].EnvMode));
if ((ti0->whichTMU==FX_TMU1) || (ti1->whichTMU==FX_TMU0)) {
tmu0=1;
tmu1=0;
}
fxMesa->tmuSrc=FX_TMU_BOTH;
switch(envmode) {
case (FX_UM_E0_MODULATE | FX_UM_E1_MODULATE):
@@ -779,14 +799,14 @@ static void fxSetupTextureDoubleTMU_NoLock(GLcontext *ctx)
GLboolean isalpha[FX_NUM_TMU];
if(ti0->baseLevelInternalFormat==GL_ALPHA)
isalpha[ti0->whichTMU]=GL_TRUE;
isalpha[tmu0]=GL_TRUE;
else
isalpha[ti0->whichTMU]=GL_FALSE;
isalpha[tmu0]=GL_FALSE;
if(ti1->baseLevelInternalFormat==GL_ALPHA)
isalpha[ti1->whichTMU]=GL_TRUE;
isalpha[tmu1]=GL_TRUE;
else
isalpha[ti1->whichTMU]=GL_FALSE;
isalpha[tmu1]=GL_FALSE;
if(isalpha[FX_TMU1])
FX_grTexCombine_NoLock(GR_TMU1,
@@ -832,7 +852,7 @@ static void fxSetupTextureDoubleTMU_NoLock(GLcontext *ctx)
break;
}
case (FX_UM_E0_REPLACE | FX_UM_E1_BLEND): /* Only for GLQuake */
if(ti1->whichTMU==FX_TMU1) {
if (tmu1==FX_TMU1) {
FX_grTexCombine_NoLock(GR_TMU1,
GR_COMBINE_FUNCTION_LOCAL,
GR_COMBINE_FACTOR_NONE,
@@ -875,7 +895,7 @@ static void fxSetupTextureDoubleTMU_NoLock(GLcontext *ctx)
FXFALSE);
break;
case (FX_UM_E0_REPLACE | FX_UM_E1_MODULATE): /* Quake 2 and 3 */
if(ti1->whichTMU==FX_TMU1) {
if (tmu1==FX_TMU1) {
FX_grTexCombine_NoLock(GR_TMU1,
GR_COMBINE_FUNCTION_LOCAL,
GR_COMBINE_FACTOR_NONE,
@@ -933,14 +953,14 @@ static void fxSetupTextureDoubleTMU_NoLock(GLcontext *ctx)
GLboolean isalpha[FX_NUM_TMU];
if(ti0->baseLevelInternalFormat==GL_ALPHA)
isalpha[ti0->whichTMU]=GL_TRUE;
isalpha[tmu0]=GL_TRUE;
else
isalpha[ti0->whichTMU]=GL_FALSE;
isalpha[tmu0]=GL_FALSE;
if(ti1->baseLevelInternalFormat==GL_ALPHA)
isalpha[ti1->whichTMU]=GL_TRUE;
isalpha[tmu1]=GL_TRUE;
else
isalpha[ti1->whichTMU]=GL_FALSE;
isalpha[tmu1]=GL_FALSE;
if(isalpha[FX_TMU1])
FX_grTexCombine_NoLock(GR_TMU1,
@@ -985,7 +1005,9 @@ static void fxSetupTextureDoubleTMU_NoLock(GLcontext *ctx)
FXFALSE);
break;
}
default:
fprintf(stderr, "Unexpected dual texture mode encountered\n");
break;
}
if (MESA_VERBOSE&VERBOSE_DRIVER) {
@@ -1004,7 +1026,7 @@ static void fxSetupTextureNone_NoLock(GLcontext *ctx)
fprintf(stderr,"fxmesa: fxSetupTextureNone(...)\n");
}
if((ctx->Light.ShadeModel==GL_SMOOTH) ||
if((ctx->Light.ShadeModel==GL_SMOOTH) || 1 ||
(ctx->Point.SmoothFlag) ||
(ctx->Line.SmoothFlag) ||
(ctx->Polygon.SmoothFlag))
@@ -1012,7 +1034,7 @@ static void fxSetupTextureNone_NoLock(GLcontext *ctx)
else
locala=GR_COMBINE_LOCAL_CONSTANT;
if(ctx->Light.ShadeModel==GL_SMOOTH)
if(ctx->Light.ShadeModel==GL_SMOOTH || 1)
localc=GR_COMBINE_LOCAL_ITERATED;
else
localc=GR_COMBINE_LOCAL_CONSTANT;
@@ -1036,7 +1058,7 @@ static void fxSetupTextureNone_NoLock(GLcontext *ctx)
/************************** Texture Mode SetUp **************************/
/************************************************************************/
void fxSetupTexture_NoLock(GLcontext *ctx)
static void fxSetupTexture_NoLock(GLcontext *ctx)
{
fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx;
GLuint tex2Denabled;
@@ -1080,7 +1102,7 @@ void fxSetupTexture_NoLock(GLcontext *ctx)
}
}
void fxSetupTexture(GLcontext *ctx) {
static void fxSetupTexture(GLcontext *ctx) {
BEGIN_BOARD_LOCK();
fxSetupTexture_NoLock(ctx);
END_BOARD_LOCK();
@@ -1180,11 +1202,15 @@ void fxDDBlendFunc(GLcontext *ctx, GLenum sfactor, GLenum dfactor)
adfact=GR_BLEND_ZERO;
break;
case GL_DST_ALPHA:
dfact=GR_BLEND_DST_ALPHA;
/* dfact=GR_BLEND_DST_ALPHA; */
/* We can't do DST_ALPHA */
dfact=GR_BLEND_ONE;
adfact=GR_BLEND_ZERO;
break;
case GL_ONE_MINUS_DST_ALPHA:
dfact=GR_BLEND_ONE_MINUS_DST_ALPHA;
/* dfact=GR_BLEND_ONE_MINUS_DST_ALPHA; */
/* We can't do DST_ALPHA */
dfact=GR_BLEND_ZERO;
adfact=GR_BLEND_ZERO;
break;
case GL_SRC_ALPHA_SATURATE:
@@ -1392,67 +1418,58 @@ static void fxSetupColorMask(GLcontext *ctx)
/**************************** Fog Mode SetUp ****************************/
/************************************************************************/
static void fxFogTableGenerate(GLcontext *ctx)
/*
* This is called during state update in order to update the Glide fog state.
*/
static void fxSetupFog(GLcontext *ctx)
{
int i;
float f,eyez;
fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx;
if (ctx->Fog.Enabled && ctx->FogMode==FOG_FRAGMENT) {
fxMesaContext fxMesa = FX_CONTEXT(ctx);
for(i=0;i<FX_grGetInteger(FX_FOG_TABLE_ENTRIES);i++) {
eyez=guFogTableIndexToW(i);
switch(ctx->Fog.Mode) {
case GL_LINEAR:
f=(ctx->Fog.End-eyez)/(ctx->Fog.End-ctx->Fog.Start);
break;
case GL_EXP:
f=exp(-ctx->Fog.Density*eyez);
break;
case GL_EXP2:
f=exp(-ctx->Fog.Density*ctx->Fog.Density*eyez*eyez);
break;
default: /* That should never happen */
f=0.0f;
break;
}
fxMesa->fogTable[i]=(GrFog_t)((1.0f-CLAMP(f,0.0f,1.0f))*255.0f);
}
}
static void fxSetupFog(GLcontext *ctx, GLboolean forceTableRebuild)
{
fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx;
if(ctx->Fog.Enabled && ctx->FogMode==FOG_FRAGMENT) {
/* update fog color */
GLubyte col[4];
FX_grFogMode(GR_FOG_WITH_TABLE);
col[0]=(unsigned int)(255*ctx->Fog.Color[0]);
col[1]=(unsigned int)(255*ctx->Fog.Color[1]);
col[2]=(unsigned int)(255*ctx->Fog.Color[2]);
col[3]=(unsigned int)(255*ctx->Fog.Color[3]);
FX_grFogColorValue(FXCOLOR4(col));
if(forceTableRebuild ||
(fxMesa->fogTableMode!=ctx->Fog.Mode) ||
(fxMesa->fogDensity!=ctx->Fog.Density)) {
fxFogTableGenerate(ctx);
fxMesa->fogTableMode=ctx->Fog.Mode;
fxMesa->fogDensity=ctx->Fog.Density;
if(fxMesa->fogTableMode != ctx->Fog.Mode ||
fxMesa->fogDensity != ctx->Fog.Density ||
fxMesa->fogStart != ctx->Fog.Start ||
fxMesa->fogEnd != ctx->Fog.End) {
/* reload the fog table */
switch (ctx->Fog.Mode) {
case GL_LINEAR:
guFogGenerateLinear(fxMesa->fogTable, ctx->Fog.Start, ctx->Fog.End);
break;
case GL_EXP:
guFogGenerateExp(fxMesa->fogTable, ctx->Fog.Density);
break;
case GL_EXP2:
guFogGenerateExp2(fxMesa->fogTable, ctx->Fog.Density);
break;
default:
;
}
fxMesa->fogTableMode = ctx->Fog.Mode;
fxMesa->fogDensity = ctx->Fog.Density;
fxMesa->fogStart = ctx->Fog.Start;
fxMesa->fogEnd = ctx->Fog.End;
}
FX_grFogTable(fxMesa->fogTable);
} else
FX_grFogMode(GR_FOG_WITH_TABLE);
}
else {
FX_grFogMode(GR_FOG_DISABLE);
}
}
void fxDDFogfv( GLcontext *ctx, GLenum pname, const GLfloat *params )
{
FX_CONTEXT(ctx)->new_state |= FX_NEW_FOG;
ctx->Driver.RenderStart = fxSetupFXUnits;
ctx->Driver.RenderStart = fxSetupFXUnits; /* XXX why is this here? */
}
/************************************************************************/
@@ -1610,7 +1627,7 @@ void fxDDEnable(GLcontext *ctx, GLenum cap, GLboolean state)
ctx->Driver.RenderStart = fxSetupFXUnits;
break;
default:
; /* XXX no-op? */
; /* XXX no-op??? */
}
}
@@ -1643,10 +1660,10 @@ static GLboolean fxMultipassBlend(struct vertex_buffer *VB, GLuint pass)
fxDDDepthMask(ctx, FALSE);
}
/* Enable Cc*Ct mode */
/* ? Set the Constant Color ? */
/* ??? Set the Constant Color ??? */
fxDDEnable(ctx, GL_BLEND, GL_TRUE);
fxDDBlendFunc(ctx, ?, ?);
fxSetupTextureSingleTMU(ctx, ?);
fxDDBlendFunc(ctx, ???, ???);
fxSetupTextureSingleTMU(ctx, ???);
fxSetupBlend(ctx);
fxSetupDepthTest(ctx);
break;
@@ -1654,8 +1671,8 @@ static GLboolean fxMultipassBlend(struct vertex_buffer *VB, GLuint pass)
case 2:
/* Reset everything back to normal */
fxMesa->unitsState = fxMesa->restoreUnitsState;
fxMesa->setupdone &= ?;
fxSetupTextureSingleTMU(ctx, ?);
fxMesa->setupdone &= ???;
fxSetupTextureSingleTMU(ctx, ???);
fxSetupBlend(ctx);
fxSetupDepthTest(ctx);
break;
@@ -1791,7 +1808,7 @@ void fxSetupFXUnits( GLcontext *ctx )
fxSetupDepthTest(ctx);
if (newstate & FX_NEW_FOG)
fxSetupFog(ctx,GL_FALSE);
fxSetupFog(ctx);
if (newstate & FX_NEW_SCISSOR)
fxSetupScissor(ctx);

View File

@@ -54,6 +54,8 @@
#include "fxdrv.h"
int texSwaps=0;
#define FX_2MB_SPLIT 0x200000
static struct gl_texture_object *fxTMFindOldestObject(fxMesaContext fxMesa,
@@ -208,6 +210,7 @@ static int fxTMFindStartAddr(fxMesaContext fxMesa, GLint tmu, int size)
return -1;
}
fxTMMoveOutTM(fxMesa, obj);
texSwaps++;
}
}
@@ -269,8 +272,8 @@ static struct gl_texture_object *fxTMFindOldestObject(fxMesaContext fxMesa,
info=fxTMGetTexInfo(tmp);
if (info && info->isInTM &&
(info->whichTMU==tmu || info->whichTMU==FX_TMU_BOTH ||
info->whichTMU==FX_TMU_SPLIT)) {
((info->whichTMU==tmu) || (info->whichTMU==FX_TMU_BOTH) ||
(info->whichTMU==FX_TMU_SPLIT))) {
lasttime=info->lastTimeUsed;
if (lasttime>bindnumber)
@@ -321,7 +324,15 @@ void fxTMMoveInTM_NoLock(fxMesaContext fxMesa, struct gl_texture_object *tObj, G
exit(-1);
}
if (ti->isInTM) return;
if (ti->isInTM) {
if (ti->whichTMU==where) return;
if (where==FX_TMU_SPLIT || ti->whichTMU==FX_TMU_SPLIT)
fxTMMoveOutTM_NoLock(fxMesa, tObj);
else {
if (ti->whichTMU==FX_TMU_BOTH) return;
where=FX_TMU_BOTH;
}
}
if (MESA_VERBOSE&(VERBOSE_DRIVER|VERBOSE_TEXTURE)) {
fprintf(stderr,"fxmesa: downloading %x (%d) in texture memory in %d\n",(GLuint)tObj,tObj->Name,where);
@@ -349,7 +360,7 @@ void fxTMMoveInTM_NoLock(fxMesaContext fxMesa, struct gl_texture_object *tObj, G
GR_MIPMAPLEVELMASK_BOTH,
ti->mipmapLevel[l].data);
break;
case FX_TMU_SPLIT: /* TO DO: alternate even/odd TMU0/TMU1 */
case FX_TMU_SPLIT:
texmemsize=(int)FX_grTexTextureMemRequired_NoLock(GR_MIPMAPLEVELMASK_ODD,
&(ti->info));
ti->tm[FX_TMU0]=fxTMAddObj(fxMesa, tObj, FX_TMU0, texmemsize);
@@ -382,6 +393,39 @@ void fxTMMoveInTM_NoLock(fxMesaContext fxMesa, struct gl_texture_object *tObj, G
ti->mipmapLevel[l].data);
}
break;
case FX_TMU_BOTH:
texmemsize=(int)FX_grTexTextureMemRequired_NoLock(GR_MIPMAPLEVELMASK_BOTH,
&(ti->info));
ti->tm[FX_TMU0]=fxTMAddObj(fxMesa, tObj, FX_TMU0, texmemsize);
fxMesa->stats.memTexUpload+=texmemsize;
texmemsize=(int)FX_grTexTextureMemRequired_NoLock(GR_MIPMAPLEVELMASK_BOTH,
&(ti->info));
ti->tm[FX_TMU1]=fxTMAddObj(fxMesa, tObj, FX_TMU1, texmemsize);
fxMesa->stats.memTexUpload+=texmemsize;
for (i=FX_largeLodValue(ti->info),l=ti->minLevel;
i<=FX_smallLodValue(ti->info);
i++,l++) {
FX_grTexDownloadMipMapLevel_NoLock(GR_TMU0,
ti->tm[FX_TMU0]->startAddr,
FX_valueToLod(i),
FX_largeLodLog2(ti->info),
FX_aspectRatioLog2(ti->info),
ti->info.format,
GR_MIPMAPLEVELMASK_BOTH,
ti->mipmapLevel[l].data);
FX_grTexDownloadMipMapLevel_NoLock(GR_TMU1,
ti->tm[FX_TMU1]->startAddr,
FX_valueToLod(i),
FX_largeLodLog2(ti->info),
FX_aspectRatioLog2(ti->info),
ti->info.format,
GR_MIPMAPLEVELMASK_BOTH,
ti->mipmapLevel[l].data);
}
break;
default:
fprintf(stderr,"fx Driver: internal error in fxTMMoveInTM() -> wrong tmu (%d)\n",where);
fxCloseHardware();
@@ -417,22 +461,27 @@ void fxTMReloadMipMapLevel(fxMesaContext fxMesa, struct gl_texture_object *tObj,
fxTexGetInfo(ti->mipmapLevel[0].width,ti->mipmapLevel[0].height,
&lodlevel, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
#ifdef FX_GLIDE3
lodlevel-=level;
#else
lodlevel+=level;
#endif
switch(tmu) {
case FX_TMU0:
case FX_TMU1:
FX_grTexDownloadMipMapLevel(tmu,
ti->tm[tmu]->startAddr,
FX_valueToLod(FX_lodToValue(lodlevel)+level),
FX_valueToLod(FX_lodToValue(lodlevel)),
FX_largeLodLog2(ti->info),
FX_aspectRatioLog2(ti->info),
ti->info.format,
GR_MIPMAPLEVELMASK_BOTH,
ti->mipmapLevel[level].data);
break;
case FX_TMU_SPLIT: /* TO DO: alternate even/odd TMU0/TMU1 */
case FX_TMU_SPLIT:
FX_grTexDownloadMipMapLevel(GR_TMU0,
ti->tm[GR_TMU0]->startAddr,
FX_valueToLod(FX_lodToValue(lodlevel)+level),
FX_valueToLod(FX_lodToValue(lodlevel)),
FX_largeLodLog2(ti->info),
FX_aspectRatioLog2(ti->info),
ti->info.format,
@@ -441,13 +490,33 @@ void fxTMReloadMipMapLevel(fxMesaContext fxMesa, struct gl_texture_object *tObj,
FX_grTexDownloadMipMapLevel(GR_TMU1,
ti->tm[GR_TMU1]->startAddr,
FX_valueToLod(FX_lodToValue(lodlevel)+level),
FX_valueToLod(FX_lodToValue(lodlevel)),
FX_largeLodLog2(ti->info),
FX_aspectRatioLog2(ti->info),
ti->info.format,
GR_MIPMAPLEVELMASK_EVEN,
ti->mipmapLevel[level].data);
break;
case FX_TMU_BOTH:
FX_grTexDownloadMipMapLevel(GR_TMU0,
ti->tm[GR_TMU0]->startAddr,
FX_valueToLod(FX_lodToValue(lodlevel)),
FX_largeLodLog2(ti->info),
FX_aspectRatioLog2(ti->info),
ti->info.format,
GR_MIPMAPLEVELMASK_BOTH,
ti->mipmapLevel[level].data);
FX_grTexDownloadMipMapLevel(GR_TMU1,
ti->tm[GR_TMU1]->startAddr,
FX_valueToLod(FX_lodToValue(lodlevel)),
FX_largeLodLog2(ti->info),
FX_aspectRatioLog2(ti->info),
ti->info.format,
GR_MIPMAPLEVELMASK_BOTH,
ti->mipmapLevel[level].data);
break;
default:
fprintf(stderr,"fx Driver: internal error in fxTMReloadMipMapLevel() -> wrong tmu (%d)\n",tmu);
fxCloseHardware();
@@ -496,7 +565,7 @@ void fxTMReloadSubMipMapLevel(fxMesaContext fxMesa,
data,
yoffset,yoffset+height-1);
break;
case FX_TMU_SPLIT: /* TO DO: alternate even/odd TMU0/TMU1 */
case FX_TMU_SPLIT:
FX_grTexDownloadMipMapLevelPartial(GR_TMU0,
ti->tm[FX_TMU0]->startAddr,
FX_valueToLod(FX_lodToValue(lodlevel)+level),
@@ -517,6 +586,27 @@ void fxTMReloadSubMipMapLevel(fxMesaContext fxMesa,
data,
yoffset,yoffset+height-1);
break;
case FX_TMU_BOTH:
FX_grTexDownloadMipMapLevelPartial(GR_TMU0,
ti->tm[FX_TMU0]->startAddr,
FX_valueToLod(FX_lodToValue(lodlevel)+level),
FX_largeLodLog2(ti->info),
FX_aspectRatioLog2(ti->info),
ti->info.format,
GR_MIPMAPLEVELMASK_BOTH,
data,
yoffset,yoffset+height-1);
FX_grTexDownloadMipMapLevelPartial(GR_TMU1,
ti->tm[FX_TMU1]->startAddr,
FX_valueToLod(FX_lodToValue(lodlevel)+level),
FX_largeLodLog2(ti->info),
FX_aspectRatioLog2(ti->info),
ti->info.format,
GR_MIPMAPLEVELMASK_BOTH,
data,
yoffset,yoffset+height-1);
break;
default:
fprintf(stderr,"fx Driver: internal error in fxTMReloadSubMipMapLevel() -> wrong tmu (%d)\n",tmu);
fxCloseHardware();
@@ -540,6 +630,7 @@ void fxTMMoveOutTM(fxMesaContext fxMesa, struct gl_texture_object *tObj)
fxTMRemoveRange(fxMesa, (int)ti->whichTMU, ti->tm[ti->whichTMU]);
break;
case FX_TMU_SPLIT:
case FX_TMU_BOTH:
fxTMRemoveRange(fxMesa, FX_TMU0, ti->tm[FX_TMU0]);
fxTMRemoveRange(fxMesa, FX_TMU1, ti->tm[FX_TMU1]);
break;
@@ -617,80 +708,11 @@ void fxTMClose(fxMesaContext fxMesa)
}
}
void fxTMRestore_NoLock(fxMesaContext fxMesa, struct gl_texture_object *tObj)
{
tfxTexInfo *ti=fxTMGetTexInfo(tObj);
int i,l, where;
if (MESA_VERBOSE&VERBOSE_DRIVER) {
fprintf(stderr,"fxmesa: fxRestore(%d)\n",tObj->Name);
}
if (!ti->validated) {
fprintf(stderr,"fxDriver: internal error in fxRestore -> not validated\n");
fxCloseHardware();
exit(-1);
}
where=ti->whichTMU;
if (MESA_VERBOSE&(VERBOSE_DRIVER|VERBOSE_TEXTURE)) {
fprintf(stderr,"fxmesa: reloading %x (%d) in texture memory in %d\n",
(GLuint)tObj, tObj->Name, where);
}
switch(where) {
case FX_TMU0:
case FX_TMU1:
for (i=FX_largeLodValue_NoLock(ti->info), l=ti->minLevel;
i<=FX_smallLodValue_NoLock(ti->info);
i++,l++)
if (ti->mipmapLevel[l].data)
FX_grTexDownloadMipMapLevel_NoLock(where,
ti->tm[where]->startAddr,
FX_valueToLod(i),
FX_largeLodLog2(ti->info),
FX_aspectRatioLog2(ti->info),
ti->info.format,
GR_MIPMAPLEVELMASK_BOTH,
ti->mipmapLevel[l].data);
break;
case FX_TMU_SPLIT: /* TO DO: alternate even/odd TMU0/TMU1 */
for (i=FX_largeLodValue_NoLock(ti->info),l=ti->minLevel;
i<=FX_smallLodValue_NoLock(ti->info);
i++,l++) {
if (ti->mipmapLevel[l].data) {
FX_grTexDownloadMipMapLevel_NoLock(GR_TMU0,
ti->tm[FX_TMU0]->startAddr,
FX_valueToLod(i),
FX_largeLodLog2(ti->info),
FX_aspectRatioLog2(ti->info),
ti->info.format,
GR_MIPMAPLEVELMASK_ODD,
ti->mipmapLevel[l].data);
FX_grTexDownloadMipMapLevel_NoLock(GR_TMU1,
ti->tm[FX_TMU1]->startAddr,
FX_valueToLod(i),
FX_largeLodLog2(ti->info),
FX_aspectRatioLog2(ti->info),
ti->info.format,
GR_MIPMAPLEVELMASK_EVEN,
ti->mipmapLevel[l].data);
}
}
break;
default:
fprintf(stderr,"fxDriver: internal error in fxRestore -> bad tmu (%d)\n",
where);
fxCloseHardware();
exit(-1);
}
}
void
fxTMRestoreTextures(fxMesaContext ctx) {
fxTMRestoreTextures_NoLock(fxMesaContext ctx) {
tfxTexInfo *ti;
struct gl_texture_object *tObj;
int i;
int i, where;
tObj=ctx->glCtx->Shared->TexObjectList;
while (tObj) {
@@ -699,11 +721,13 @@ fxTMRestoreTextures(fxMesaContext ctx) {
for (i=0; i<MAX_TEXTURE_UNITS; i++)
if (ctx->glCtx->Texture.Unit[i].Current==tObj) {
/* Force the texture onto the board, as it could be in use */
fxTMRestore_NoLock(ctx, tObj);
where=ti->whichTMU;
ti->whichTMU=FX_TMU_NONE;
fxTMMoveInTM_NoLock(ctx, tObj, where);
break;
}
if (i==MAX_TEXTURE_UNITS) /* Mark the texture as off the board */
fxTMMoveOutTM(ctx, tObj);
fxTMMoveOutTM_NoLock(ctx, tObj);
}
tObj=tObj->Next;
}

View File

@@ -1,10 +1,10 @@
/* $Id: osmesa.c,v 1.3 1999/11/11 01:28:41 brianp Exp $ */
/* $Id: osmesa.c,v 1.2.2.3 2000/04/04 00:52:28 brianp Exp $ */
/*
* Mesa 3-D graphics library
* Version: 3.3
* Version: 3.2
*
* Copyright (C) 1999 Brian Paul All Rights Reserved.
* 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"),
@@ -38,7 +38,7 @@
#include "GL/osmesa.h"
#include "context.h"
#include "depth.h"
#include "mem.h"
#include "macros.h"
#include "matrix.h"
#include "types.h"
#include "vb.h"
@@ -224,6 +224,7 @@ OSMesaContext GLAPIENTRY OSMesaCreateContext( GLenum format, OSMesaContext share
indexBits,
8, 8, 8, alphaBits );
if (!osmesa->gl_visual) {
FREE(osmesa);
return NULL;
}
@@ -400,7 +401,7 @@ GLboolean GLAPIENTRY OSMesaMakeCurrent( OSMesaContext ctx, void *buffer, GLenum
/* init viewport */
if (ctx->gl_ctx->Viewport.Width==0) {
/* initialize viewport and scissor box to buffer size */
_mesa_Viewport( 0, 0, width, height );
gl_Viewport( ctx->gl_ctx, 0, 0, width, height );
ctx->gl_ctx->Scissor.Width = width;
ctx->gl_ctx->Scissor.Height = height;
}
@@ -631,8 +632,13 @@ static GLbitfield clear( GLcontext *ctx, GLbitfield mask, GLboolean all,
GLuint i, n, *ptr4;
n = osmesa->rowlength * osmesa->height;
ptr4 = (GLuint *) osmesa->buffer;
for (i=0;i<n;i++) {
*ptr4++ = osmesa->clearpixel;
if (osmesa->clearpixel) {
for (i=0;i<n;i++) {
*ptr4++ = osmesa->clearpixel;
}
}
else {
BZERO(ptr4, n * sizeof(GLuint));
}
}
else {

View File

@@ -1,9 +1,9 @@
/* $Id: svgamesa.c,v 1.1 1999/08/19 00:55:42 jtg Exp $ */
/* $Id: svgamesa.c,v 1.1.1.1.2.3 2000/01/22 20:06:20 brianp Exp $ */
/*
* Mesa 3-D graphics library
* Version: 3.0
* Copyright (C) 1995-1998 Brian Paul
* Version: 3.2
* 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
@@ -21,23 +21,19 @@
*/
/*
* Linux SVGA/Mesa interface.
*
* This interface is not finished! Still have to implement pixel
* reading functions and double buffering. Then, look into accelerated
* line and polygon rendering. And, clean up a bunch of other stuff.
* Any volunteers?
* SVGA driver for Mesa.
* Original author: Brian Paul
* Additional authors: Slawomir Szczyrba <steev@hot.pl> (Mesa 3.2)
*/
#ifdef HAVE_CONFIG_H
#include "conf.h"
#endif
#ifdef SVGA
#ifdef PC_HEADER
#include "all.h"
#else
@@ -48,35 +44,164 @@
#include "context.h"
#include "matrix.h"
#include "types.h"
#include <string.h>
#endif
#include "svgapix.h"
#include "svgamesa8.h"
#include "svgamesa15.h"
#include "svgamesa16.h"
#include "svgamesa24.h"
#include "svgamesa32.h"
struct svgamesa_context {
GLcontext *gl_ctx; /* the core Mesa context */
GLvisual *gl_vis; /* describes the color buffer */
GLframebuffer *gl_buffer; /* the ancillary buffers */
GLuint index; /* current color index */
GLint red, green, blue; /* current rgb color */
GLint width, height; /* size of color buffer */
GLint depth; /* bits per pixel (8,16,24 or 32) */
};
struct svga_buffer SVGABuffer;
vga_modeinfo * SVGAInfo;
SVGAMesaContext SVGAMesa; /* the current context */
#ifdef SVGA_DEBUG
static SVGAMesaContext SVGAMesa = NULL; /* the current context */
#include <sys/types.h>
#include <signal.h>
FILE * logfile;
char cbuf[1024]={0};
void SVGAlog(char * what)
{
logfile=fopen("svgamesa.log","a");
if (!logfile) return;
fprintf(logfile,"%s\n",what);
fclose(logfile);
}
#endif
/*
* Convert Mesa window Y coordinate to VGA screen Y coordinate:
*/
#define FLIP(Y) (SVGAMesa->height-(Y)-1)
/**********************************************************************/
/***** Init stuff... *****/
/**********************************************************************/
int SVGAMesaInit( int GraphMode )
{
vga_init();
if (!vga_hasmode(GraphMode))
{
fprintf(stderr,"GraphMode %d unavailable...",GraphMode);
#ifdef SVGA_DEBUG
SVGAlog("SVGAMesaInit: invalid GraphMode (doesn't exist)");
#endif
return(1);
}
SVGAInfo=vga_getmodeinfo(GraphMode);
if (SVGAInfo->flags & IS_MODEX)
{
fprintf(stderr,"ModeX not implemented...");
#ifdef SVGA_DEBUG
SVGAlog("SVGAMesaInit: invalid GraphMode (ModeX)");
#endif
return(2);
}
if (!SVGAInfo->bytesperpixel)
{
fprintf(stderr,"1 / 4 bit color not implemented...");
#ifdef SVGA_DEBUG
SVGAlog("SVGAMesaInit: invalid GraphMode (1 or 4 bit)");
#endif
return(3);
}
switch (SVGAInfo->colors) {
case 256: SVGABuffer.Depth = 8; break;
case 32768: SVGABuffer.Depth = 15; break;
case 65536: SVGABuffer.Depth = 16; break;
default: SVGABuffer.Depth = SVGAInfo->bytesperpixel<<3; break;
}
SVGABuffer.BufferSize=SVGAInfo->linewidth*SVGAInfo->height;
#ifdef SVGA_DEBUG
sprintf(cbuf,"SVGAMesaInit: double buffer info.\n" \
" depth : %d\n" \
" mode : %d\n" \
" width : %d\n" \
" height : %d\n" \
" bufsize: %d\n", \
SVGABuffer.Depth,GraphMode,SVGAInfo->linewidth, \
SVGAInfo->height,SVGABuffer.BufferSize);
SVGAlog(cbuf);
#endif
SVGABuffer.FrontBuffer=(void*)malloc(SVGABuffer.BufferSize + 4);
if (!SVGABuffer.FrontBuffer) {
{
fprintf(stderr,"Not enough RAM for FRONT_LEFT_BUFFER...");
#ifdef SVGA_DEBUG
SVGAlog("SVGAMesaInit: Not enough RAM (front buffer)");
#endif
return(4);
}
}
#ifdef SVGA_DEBUG
sprintf(cbuf,"SVGAMesaInit: FrontBuffer - %p",SVGABuffer.FrontBuffer);
SVGAlog(cbuf);
#endif
SVGABuffer.BackBuffer=(void*)malloc(SVGABuffer.BufferSize + 4);
if (!SVGABuffer.BackBuffer) {
{
free(SVGABuffer.FrontBuffer);
fprintf(stderr,"Not enough RAM for BACK_LEFT_BUFFER...");
#ifdef SVGA_DEBUG
SVGAlog("SVGAMesaInit: Not enough RAM (back buffer)");
#endif
return(5);
}
}
#ifdef SVGA_DEBUG
sprintf(cbuf,"SVGAMesaInit: BackBuffer - %p",SVGABuffer.BackBuffer);
SVGAlog(cbuf);
#endif
vga_setmode(GraphMode);
SVGABuffer.VideoRam=vga_getgraphmem();
#ifdef SVGA_DEBUG
sprintf(cbuf,"SVGAMesaInit: VRAM - %p",SVGABuffer.VideoRam);
SVGAlog(cbuf);
sprintf(cbuf,"SVGAMesaInit: done. (Mode %d)",GraphMode);
SVGAlog(cbuf);
#endif
return 0;
}
int SVGAMesaClose( void )
{
vga_setmode(TEXT);
free(SVGABuffer.FrontBuffer);
free(SVGABuffer.BackBuffer);
return 0;
}
void SVGAMesaSetCI(int ndx, GLubyte red, GLubyte green, GLubyte blue)
{
if (ndx<256) vga_setpalette(ndx, red>>2, green>>2, blue>>2);
}
/**********************************************************************/
/***** Miscellaneous functions *****/
/**********************************************************************/
static void copy_buffer( GLubyte * buffer) {
int size = SVGABuffer.BufferSize, page = 0;
#ifdef SVGA_DEBUG
sprintf(cbuf,"copy_buffer: copy %p to %p",buffer,SVGABuffer.VideoRam);
SVGAlog(cbuf);
#endif
while(size>0) {
vga_setpage(page++);
if (size>>16) {
memcpy(SVGABuffer.VideoRam,buffer,0x10000);
buffer+=0x10000;
}else{
memcpy(SVGABuffer.VideoRam,buffer,size & 0xffff);
}
size-=0xffff;
}
}
static void get_buffer_size( GLcontext *ctx, GLuint *width, GLuint *height )
{
@@ -84,279 +209,33 @@ static void get_buffer_size( GLcontext *ctx, GLuint *width, GLuint *height )
*height = SVGAMesa->height = vga_getydim();
}
/* Set current color index */
static void set_index( GLcontext *ctx, GLuint index )
{
SVGAMesa->index = index;
vga_setcolor( index );
}
/* Set current drawing color */
static void set_color( GLcontext *ctx,
GLubyte red, GLubyte green,
GLubyte blue, GLubyte alpha )
{
SVGAMesa->red = red;
SVGAMesa->green = green;
SVGAMesa->blue = blue;
vga_setrgbcolor( red, green, blue );
}
static void clear_index( GLcontext *ctx, GLuint index )
{
/* TODO: Implements glClearIndex() */
}
static void clear_color( GLcontext *ctx,
GLubyte red, GLubyte green,
GLubyte blue, GLubyte alpha )
{
/* TODO: Implements glClearColor() */
}
static GLbitfield clear( GLcontext *ctx, GLbitfield mask, GLboolean all,
GLint x, GLint y, GLint width, GLint height )
{
if (mask & GL_COLOR_BUFFER_BIT) {
vga_clear();
}
return mask & (~GL_COLOR_BUFFER_BIT);
}
static GLboolean set_buffer( GLcontext *ctx, GLenum buffer )
{
/* TODO: implement double buffering and use this function to select */
/* between front and back buffers. */
void * tmpptr;
if (buffer == GL_FRONT_LEFT)
return GL_TRUE;
{
/* vga_waitretrace(); */
copy_buffer(SVGABuffer.FrontBuffer);
tmpptr=SVGABuffer.BackBuffer;
SVGABuffer.BackBuffer=SVGABuffer.FrontBuffer;
SVGABuffer.FrontBuffer=tmpptr;
return GL_TRUE;
}
else if (buffer == GL_BACK_LEFT)
return GL_TRUE;
{
/* vga_waitretrace(); */
copy_buffer(SVGABuffer.BackBuffer);
return GL_TRUE;
}
else
return GL_FALSE;
}
/**********************************************************************/
/***** Write spans of pixels *****/
/***** *****/
/**********************************************************************/
static void write_ci32_span( const GLcontext *ctx, GLuint n, GLint x, GLint y,
const GLuint index[], const GLubyte mask[] )
{
int i;
y = FLIP(y);
for (i=0;i<n;i++,x++) {
if (mask[i]) {
vga_setcolor( index[i] );
vga_drawpixel( x, y );
}
}
}
static void write_ci8_span( const GLcontext *ctx, GLuint n, GLint x, GLint y,
const GLubyte index[], const GLubyte mask[] )
{
int i;
y = FLIP(y);
for (i=0;i<n;i++,x++) {
if (mask[i]) {
vga_setcolor( index[i] );
vga_drawpixel( x, y );
}
}
}
static void write_mono_ci_span( const GLcontext *ctx, GLuint n,
GLint x, GLint y, const GLubyte mask[] )
{
int i;
y = FLIP(y);
/* use current color index */
vga_setcolor( SVGAMesa->index );
for (i=0;i<n;i++,x++) {
if (mask[i]) {
vga_drawpixel( x, y );
}
}
}
static void write_rgba_span( const GLcontext *ctx, GLuint n, GLint x, GLint y,
const GLubyte rgba[][4], const GLubyte mask[] )
{
int i;
y=FLIP(y);
if (mask) {
/* draw some pixels */
for (i=0; i<n; i++, x++) {
if (mask[i]) {
vga_setrgbcolor( rgba[i][RCOMP], rgba[i][GCOMP], rgba[i][BCOMP] );
vga_drawpixel( x, y );
}
}
}
else {
/* draw all pixels */
for (i=0; i<n; i++, x++) {
vga_setrgbcolor( rgba[i][RCOMP], rgba[i][GCOMP], rgba[i][BCOMP] );
vga_drawpixel( x, y );
}
}
}
static void write_mono_rgba_span( const GLcontext *ctx,
GLuint n, GLint x, GLint y,
const GLubyte mask[])
{
int i;
y=FLIP(y);
/* use current rgb color */
vga_setrgbcolor( SVGAMesa->red, SVGAMesa->green, SVGAMesa->blue );
for (i=0; i<n; i++, x++) {
if (mask[i]) {
vga_drawpixel( x, y );
}
}
}
/**********************************************************************/
/***** Read spans of pixels *****/
/**********************************************************************/
static void read_ci32_span( const GLcontext *ctx,
GLuint n, GLint x, GLint y, GLuint index[])
{
int i;
y = FLIP(y);
for (i=0; i<n; i++,x++) {
index[i] = vga_getpixel( x, y );
}
}
static void read_rgba_span( const GLcontext *ctx, GLuint n, GLint x, GLint y,
GLubyte rgba[][4] )
{
int i;
for (i=0; i<n; i++, x++) {
/* TODO */
}
}
/**********************************************************************/
/***** Write arrays of pixels *****/
/**********************************************************************/
static void write_ci32_pixels( const GLcontext *ctx,
GLuint n, const GLint x[], const GLint y[],
const GLuint index[], const GLubyte mask[] )
{
int i;
for (i=0; i<n; i++) {
if (mask[i]) {
vga_setcolor( index[i] );
vga_drawpixel( x[i], FLIP(y[i]) );
}
}
}
static void write_mono_ci_pixels( const GLcontext *ctx, GLuint n,
const GLint x[], const GLint y[],
const GLubyte mask[] )
{
int i;
/* use current color index */
vga_setcolor( SVGAMesa->index );
for (i=0; i<n; i++) {
if (mask[i]) {
vga_drawpixel( x[i], FLIP(y[i]) );
}
}
}
static void write_rgba_pixels( const GLcontext *ctx,
GLuint n, const GLint x[], const GLint y[],
const GLubyte rgba[][4], const GLubyte mask[] )
{
int i;
for (i=0; i<n; i++) {
if (mask[i]) {
vga_setrgbcolor( rgba[i][RCOMP], rgba[i][GCOMP], rgba[i][BCOMP] );
vga_drawpixel( x[i], FLIP(y[i]) );
}
}
}
static void write_mono_rgba_pixels( const GLcontext *ctx,
GLuint n,
const GLint x[], const GLint y[],
const GLubyte mask[] )
{
int i;
/* use current rgb color */
vga_setrgbcolor( SVGAMesa->red, SVGAMesa->green, SVGAMesa->blue );
for (i=0; i<n; i++) {
if (mask[i]) {
vga_drawpixel( x[i], FLIP(y[i]) );
}
}
}
/**********************************************************************/
/***** Read arrays of pixels *****/
/**********************************************************************/
/* Read an array of color index pixels. */
static void read_ci32_pixels( const GLcontext *ctx,
GLuint n, const GLint x[], const GLint y[],
GLuint index[], const GLubyte mask[] )
{
int i;
for (i=0; i<n; i++,x++) {
index[i] = vga_getpixel( x[i], FLIP(y[i]) );
}
}
static void read_rgba_pixels( const GLcontext *ctx,
GLuint n, const GLint x[], const GLint y[],
GLubyte rgba[][4], const GLubyte mask[] )
{
/* TODO */
}
static void svgamesa_update_state( GLcontext *ctx )
{
/* Initialize all the pointers in the DD struct. Do this whenever */
@@ -364,13 +243,6 @@ static void svgamesa_update_state( GLcontext *ctx )
ctx->Driver.UpdateState = svgamesa_update_state;
ctx->Driver.ClearIndex = clear_index;
ctx->Driver.ClearColor = clear_color;
ctx->Driver.Clear = clear;
ctx->Driver.Index = set_index;
ctx->Driver.Color = set_color;
ctx->Driver.SetBuffer = set_buffer;
ctx->Driver.GetBufferSize = get_buffer_size;
@@ -378,59 +250,119 @@ static void svgamesa_update_state( GLcontext *ctx )
ctx->Driver.LineFunc = NULL;
ctx->Driver.TriangleFunc = NULL;
/* Pixel/span writing functions: */
/* TODO: use different funcs for 8, 16, 32-bit depths */
ctx->Driver.WriteRGBASpan = write_rgba_span;
ctx->Driver.WriteMonoRGBASpan = write_mono_rgba_span;
ctx->Driver.WriteRGBAPixels = write_rgba_pixels;
ctx->Driver.WriteMonoRGBAPixels = write_mono_rgba_pixels;
ctx->Driver.WriteCI32Span = write_ci32_span;
ctx->Driver.WriteCI8Span = write_ci8_span;
ctx->Driver.WriteMonoCISpan = write_mono_ci_span;
ctx->Driver.WriteCI32Pixels = write_ci32_pixels;
ctx->Driver.WriteMonoCIPixels = write_mono_ci_pixels;
switch (SVGABuffer.Depth) {
case 8: ctx->Driver.ClearIndex = __clear_index8;
ctx->Driver.Clear = __clear8;
ctx->Driver.Index = __set_index8;
/* Pixel/span reading functions: */
/* TODO: use different funcs for 8, 16, 32-bit depths */
ctx->Driver.ReadCI32Span = read_ci32_span;
ctx->Driver.ReadRGBASpan = read_rgba_span;
ctx->Driver.ReadCI32Pixels = read_ci32_pixels;
ctx->Driver.ReadRGBAPixels = read_rgba_pixels;
ctx->Driver.ReadCI32Span = __read_ci32_span8;
ctx->Driver.ReadCI32Pixels = __read_ci32_pixels8;
ctx->Driver.WriteCI8Span = __write_ci8_span8;
ctx->Driver.WriteCI32Span = __write_ci32_span8;
ctx->Driver.WriteCI32Pixels = __write_ci32_pixels8;
ctx->Driver.WriteMonoCISpan = __write_mono_ci_span8;
ctx->Driver.WriteMonoCIPixels = __write_mono_ci_pixels8;
#ifdef SVGA_DEBUG
SVGAlog("SVGAUpdateState: 8 bit mode.");
#endif
break;
case 15: ctx->Driver.ClearColor = __clear_color15;
ctx->Driver.Clear = __clear15;
ctx->Driver.Color = __set_color15;
ctx->Driver.ReadRGBASpan = __read_rgba_span15;
ctx->Driver.ReadRGBAPixels = __read_rgba_pixels15;
ctx->Driver.WriteRGBASpan = __write_rgba_span15;
ctx->Driver.WriteRGBAPixels = __write_rgba_pixels15;
ctx->Driver.WriteMonoRGBASpan = __write_mono_rgba_span15;
ctx->Driver.WriteMonoRGBAPixels = __write_mono_rgba_pixels15;
#ifdef SVGA_DEBUG
SVGAlog("SVGAUpdateState: 15 bit mode.");
#endif
break;
case 16: ctx->Driver.ClearColor = __clear_color16;
ctx->Driver.Clear = __clear16;
ctx->Driver.Color = __set_color16;
ctx->Driver.ReadRGBASpan = __read_rgba_span16;
ctx->Driver.ReadRGBAPixels = __read_rgba_pixels16;
ctx->Driver.WriteRGBASpan = __write_rgba_span16;
ctx->Driver.WriteRGBAPixels = __write_rgba_pixels16;
ctx->Driver.WriteMonoRGBASpan = __write_mono_rgba_span16;
ctx->Driver.WriteMonoRGBAPixels = __write_mono_rgba_pixels16;
break;
#ifdef SVGA_DEBUG
SVGAlog("SVGAUpdateState: 16 bit mode.");
#endif
case 24: ctx->Driver.ClearColor = __clear_color24;
ctx->Driver.Clear = __clear24;
ctx->Driver.Color = __set_color24;
ctx->Driver.ReadRGBASpan = __read_rgba_span24;
ctx->Driver.ReadRGBAPixels = __read_rgba_pixels24;
ctx->Driver.WriteRGBASpan = __write_rgba_span24;
ctx->Driver.WriteRGBAPixels = __write_rgba_pixels24;
ctx->Driver.WriteMonoRGBASpan = __write_mono_rgba_span24;
ctx->Driver.WriteMonoRGBAPixels = __write_mono_rgba_pixels24;
break;
#ifdef SVGA_DEBUG
SVGAlog("SVGAUpdateState: 32 bit mode.");
#endif
case 32: ctx->Driver.ClearColor = __clear_color32;
ctx->Driver.Clear = __clear32;
ctx->Driver.Color = __set_color32;
ctx->Driver.ReadRGBASpan = __read_rgba_span32;
ctx->Driver.ReadRGBAPixels = __read_rgba_pixels32;
ctx->Driver.WriteRGBASpan = __write_rgba_span32;
ctx->Driver.WriteRGBAPixels = __write_rgba_pixels32;
ctx->Driver.WriteMonoRGBASpan = __write_mono_rgba_span32;
ctx->Driver.WriteMonoRGBAPixels = __write_mono_rgba_pixels32;
}
}
/*
* Create a new VGA/Mesa context and return a handle to it.
*/
SVGAMesaContext SVGAMesaCreateContext( GLboolean doubleBuffer )
{
SVGAMesaContext ctx;
#ifndef DEV
GLboolean rgb_flag;
GLfloat redscale, greenscale, bluescale, alphascale;
GLboolean alpha_flag = GL_FALSE;
int colors;
GLint index_bits;
GLint redbits, greenbits, bluebits, alphabits;
/* determine if we're in RGB or color index mode */
colors = vga_getcolors();
if (colors==32768) {
if ((SVGABuffer.Depth==32) || (SVGABuffer.Depth==24)) {
rgb_flag = GL_TRUE;
redscale = greenscale = bluescale = alphascale = 255.0;
redbits = greenbits = bluebits = 8;
alphabits = 0;
index_bits = 0;
}
else if (colors==256) {
else if (SVGABuffer.Depth==8) {
rgb_flag = GL_FALSE;
redscale = greenscale = bluescale = alphascale = 0.0;
redbits = greenbits = bluebits = alphabits = 0;
index_bits = 8;
}
else {
printf(">16 bit color not implemented yet!\n");
return NULL;
else if (SVGABuffer.Depth==15) {
rgb_flag = GL_TRUE;
redscale = greenscale = bluescale = alphascale = 31.0;
redbits = greenbits = bluebits = 5;
alphabits = 0;
index_bits = 0;
}
else if (SVGABuffer.Depth==16) {
rgb_flag = GL_TRUE;
redscale = bluescale = alphascale = 31.0;
greenscale = 63.0;
redbits = bluebits = 5;
greenbits = 6;
alphabits = 0;
index_bits = 0;
}
ctx = (SVGAMesaContext) calloc( 1, sizeof(struct svgamesa_context) );
@@ -459,18 +391,16 @@ SVGAMesaContext SVGAMesaCreateContext( GLboolean doubleBuffer )
ctx->red = ctx->green = ctx->blue = 255;
ctx->width = ctx->height = 0; /* temporary until first "make-current" */
#endif
return ctx;
}
/*
* Destroy the given VGA/Mesa context.
*/
void SVGAMesaDestroyContext( SVGAMesaContext ctx )
{
#ifndef DEV
if (ctx) {
gl_destroy_visual( ctx->gl_vis );
gl_destroy_context( ctx->gl_ctx );
@@ -480,15 +410,15 @@ void SVGAMesaDestroyContext( SVGAMesaContext ctx )
SVGAMesa = NULL;
}
}
#endif
}
/*
* Make the specified VGA/Mesa context the current one.
*/
void SVGAMesaMakeCurrent( SVGAMesaContext ctx )
{
#ifndef DEV
SVGAMesa = ctx;
svgamesa_update_state( ctx->gl_ctx );
gl_make_current( ctx->gl_ctx, ctx->gl_buffer );
@@ -499,10 +429,9 @@ void SVGAMesaMakeCurrent( SVGAMesaContext ctx )
ctx->height = vga_getydim();
gl_Viewport( ctx->gl_ctx, 0, 0, ctx->width, ctx->height );
}
#endif
}
/*
* Return a handle to the current VGA/Mesa context.
*/
@@ -511,20 +440,38 @@ SVGAMesaContext SVGAMesaGetCurrentContext( void )
return SVGAMesa;
}
/*
* Swap front/back buffers for current context if double buffered.
*/
void SVGAMesaSwapBuffers( void )
{
void * tmpptr;
/* vga_waitretrace(); */
copy_buffer(SVGABuffer.BackBuffer);
#ifndef DEV
FLUSH_VB( SVGAMesa->gl_ctx, "swap buffers" );
if (SVGAMesa->gl_vis->DBflag) {
vga_flip();
}
if (SVGAMesa->gl_vis->DBflag)
#endif /* DEV */
{
#ifdef SVGA_DEBUG
sprintf(cbuf,"SVGAMesaSwapBuffers : Swapping...");
SVGAlog(cbuf);
#endif /* SVGA_DEBUG */
tmpptr=SVGABuffer.BackBuffer;
SVGABuffer.BackBuffer=SVGABuffer.FrontBuffer;
SVGABuffer.FrontBuffer=tmpptr;
#ifdef SVGA_DEBUG
sprintf(cbuf,"SVGAMesaSwapBuffers : WriteBuffer : %p\n"
" Readbuffer : %p", \
SVGABuffer.BackBuffer, SVGABuffer.FrontBuffer );
SVGAlog(cbuf);
#endif /* SVGA_DEBUG */
}
}
#else
#else /*SVGA*/
/*
* Need this to provide at least one external definition when SVGA is

View File

@@ -0,0 +1,185 @@
/* $Id: svgamesa15.c,v 1.1.2.4 2000/01/31 22:10:39 tanner Exp $ */
/*
* Mesa 3-D graphics library
* Version: 3.2
* 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.
*/
/*
* SVGA driver for Mesa.
* Original author: Brian Paul
* Additional authors: Slawomir Szczyrba <steev@hot.pl> (Mesa 3.2)
*/
#ifdef HAVE_CONFIG_H
#include "conf.h"
#endif
#ifdef SVGA
#include "svgapix.h"
GLshort * shortBuffer;
int __svga_drawpixel15(int x, int y, unsigned long c)
{
unsigned long offset;
shortBuffer=(void *)SVGABuffer.BackBuffer;
y = SVGAInfo->height-y-1;
offset = y * SVGAInfo->width + x;
shortBuffer[offset]=c;
return 0;
}
unsigned long __svga_getpixel15(int x, int y)
{
unsigned long offset;
shortBuffer=(void *)SVGABuffer.BackBuffer;
y = SVGAInfo->height-y-1;
offset = y * SVGAInfo->width + x;
return shortBuffer[offset];
}
void __set_color15( GLcontext *ctx,
GLubyte red, GLubyte green,
GLubyte blue, GLubyte alpha )
{
SVGAMesa->hicolor=(red>>3)<<10 | (green>>3)<<5 | (blue>>3);
/* SVGAMesa->hicolor=(red)<<10 | (green)<<5 | (blue); */
}
void __clear_color15( GLcontext *ctx,
GLubyte red, GLubyte green,
GLubyte blue, GLubyte alpha )
{
SVGAMesa->clear_hicolor=(red>>3)<<10 | (green>>3)<<5 | (blue>>3);
/* SVGAMesa->clear_hicolor=(red)<<10 | (green)<<5 | (blue);*/
}
GLbitfield __clear15( GLcontext *ctx, GLbitfield mask, GLboolean all,
GLint x, GLint y, GLint width, GLint height )
{
int i,j;
if (mask & GL_COLOR_BUFFER_BIT) {
shortBuffer=(void *)SVGABuffer.BackBuffer;
if (all) {
for (i=0;i<SVGABuffer.BufferSize / 2;i++) shortBuffer[i]=SVGAMesa->clear_hicolor;
} else {
for (i=x;i<width;i++)
for (j=y;j<height;j++)
__svga_drawpixel15(i,j,SVGAMesa->clear_hicolor);
}
}
return mask & (~GL_COLOR_BUFFER_BIT);
}
void __write_rgba_span15( const GLcontext *ctx, GLuint n, GLint x, GLint y,
const GLubyte rgba[][4], const GLubyte mask[] )
{
int i;
if (mask) {
/* draw some pixels */
for (i=0; i<n; i++, x++) {
if (mask[i]) {
__svga_drawpixel15( x, y, (rgba[i][RCOMP]>>3)<<10 | \
(rgba[i][GCOMP]>>3)<<5 | \
(rgba[i][BCOMP]>>3));
}
}
}
else {
/* draw all pixels */
for (i=0; i<n; i++, x++) {
__svga_drawpixel15( x, y, (rgba[i][RCOMP]>>3)<<10 | \
(rgba[i][GCOMP]>>3)<<5 | \
(rgba[i][BCOMP]>>3));
}
}
}
void __write_mono_rgba_span15( const GLcontext *ctx,
GLuint n, GLint x, GLint y,
const GLubyte mask[])
{
int i;
for (i=0; i<n; i++, x++) {
if (mask[i]) {
__svga_drawpixel15( x, y, SVGAMesa->hicolor);
}
}
}
void __read_rgba_span15( const GLcontext *ctx, GLuint n, GLint x, GLint y,
GLubyte rgba[][4] )
{
int i,pix;
for (i=0; i<n; i++, x++) {
pix = __svga_getpixel15( x, y);
rgba[i][RCOMP] = ((pix>>10)<<3) & 0xff;
rgba[i][GCOMP] = ((pix>> 5)<<3) & 0xff;
rgba[i][BCOMP] = ((pix )<<3) & 0xff;
}
}
void __write_rgba_pixels15( const GLcontext *ctx,
GLuint n, const GLint x[], const GLint y[],
const GLubyte rgba[][4], const GLubyte mask[] )
{
int i;
for (i=0; i<n; i++) {
if (mask[i]) {
__svga_drawpixel15( x[i], y[i], (rgba[i][RCOMP]>>3)<<10 | \
(rgba[i][GCOMP]>>3)<<5 | \
(rgba[i][BCOMP]>>3));
}
}
}
void __write_mono_rgba_pixels15( const GLcontext *ctx,
GLuint n,
const GLint x[], const GLint y[],
const GLubyte mask[] )
{
int i;
/* use current rgb color */
for (i=0; i<n; i++) {
if (mask[i]) {
__svga_drawpixel15( x[i], y[i], SVGAMesa->hicolor );
}
}
}
void __read_rgba_pixels15( const GLcontext *ctx,
GLuint n, const GLint x[], const GLint y[],
GLubyte rgba[][4], const GLubyte mask[] )
{
int i,pix;
for (i=0; i<n; i++,x++) {
pix = __svga_getpixel15( x[i], y[i] );
rgba[i][RCOMP] = ((pix>>10)<<3) & 0xff;
rgba[i][GCOMP] = ((pix>> 5)<<3) & 0xff;
rgba[i][BCOMP] = ((pix )<<3) & 0xff;
}
}
#endif

View File

@@ -0,0 +1,44 @@
/* $Id: svgamesa15.h,v 1.1.2.2 2000/01/22 20:05:28 brianp Exp $ */
/*
* Mesa 3-D graphics library
* Version: 3.2
* 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.
*/
/*
* SVGA driver for Mesa.
* Original author: Brian Paul
* Additional authors: Slawomir Szczyrba <steev@hot.pl> (Mesa 3.2)
*/
#ifndef SVGA_MESA_15_H
#define SVGA_MESA_15_H
extern void __set_color15( GLcontext *ctx, GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha );
extern void __clear_color15( GLcontext *ctx, GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha );
extern GLbitfield __clear15( GLcontext *ctx, GLbitfield mask, GLboolean all, GLint x, GLint y, GLint width, GLint height );
extern void __write_rgba_span15( const GLcontext *ctx, GLuint n, GLint x, GLint y, const GLubyte rgba[][4], const GLubyte mask[] );
extern void __write_mono_rgba_span15( const GLcontext *ctx, GLuint n, GLint x, GLint y, const GLubyte mask[]);
extern void __read_rgba_span15( const GLcontext *ctx, GLuint n, GLint x, GLint y, GLubyte rgba[][4] );
extern void __write_rgba_pixels15( const GLcontext *ctx, GLuint n, const GLint x[], const GLint y[], const GLubyte rgba[][4], const GLubyte mask[] );
extern void __write_mono_rgba_pixels15( const GLcontext *ctx, GLuint n, const GLint x[], const GLint y[], const GLubyte mask[] );
extern void __read_rgba_pixels15( const GLcontext *ctx, GLuint n, const GLint x[], const GLint y[], GLubyte rgba[][4], const GLubyte mask[] );
#endif /* SVGA_MESA_15_H */

View File

@@ -0,0 +1,185 @@
/* $Id: svgamesa16.c,v 1.1.2.4 2000/01/31 22:10:39 tanner Exp $ */
/*
* Mesa 3-D graphics library
* Version: 3.2
* 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.
*/
/*
* SVGA driver for Mesa.
* Original author: Brian Paul
* Additional authors: Slawomir Szczyrba <steev@hot.pl> (Mesa 3.2)
*/
#ifdef HAVE_CONFIG_H
#include "conf.h"
#endif
#ifdef SVGA
#include "svgapix.h"
GLshort * shortBuffer;
int __svga_drawpixel16(int x, int y, unsigned long c)
{
unsigned long offset;
shortBuffer=(void *)SVGABuffer.BackBuffer;
y = SVGAInfo->height-y-1;
offset = y * SVGAInfo->width + x;
shortBuffer[offset]=c;
return 0;
}
unsigned long __svga_getpixel16(int x, int y)
{
unsigned long offset;
shortBuffer=(void *)SVGABuffer.BackBuffer;
y = SVGAInfo->height-y-1;
offset = y * SVGAInfo->width + x;
return shortBuffer[offset];
}
void __set_color16( GLcontext *ctx,
GLubyte red, GLubyte green,
GLubyte blue, GLubyte alpha )
{
SVGAMesa->hicolor=(red>>3)<<11 | (green>>2)<<5 | (blue>>3);
/* SVGAMesa->hicolor=(red)<<11 | (green)<<5 | (blue); */
}
void __clear_color16( GLcontext *ctx,
GLubyte red, GLubyte green,
GLubyte blue, GLubyte alpha )
{
SVGAMesa->clear_hicolor=(red>>3)<<11 | (green>>2)<<5 | (blue>>3);
/* SVGAMesa->clear_hicolor=(red)<<11 | (green)<<5 | (blue); */
}
GLbitfield __clear16( GLcontext *ctx, GLbitfield mask, GLboolean all,
GLint x, GLint y, GLint width, GLint height )
{
int i,j;
if (mask & GL_COLOR_BUFFER_BIT) {
if (all) {
shortBuffer=(void *)SVGABuffer.BackBuffer;
for (i=0;i<SVGABuffer.BufferSize / 2;i++) shortBuffer[i]=SVGAMesa->clear_hicolor;
} else {
for (i=x;i<width;i++)
for (j=y;j<height;j++)
__svga_drawpixel16(i,j,SVGAMesa->clear_hicolor);
}
}
return mask & (~GL_COLOR_BUFFER_BIT);
}
void __write_rgba_span16( const GLcontext *ctx, GLuint n, GLint x, GLint y,
const GLubyte rgba[][4], const GLubyte mask[] )
{
int i;
if (mask) {
/* draw some pixels */
for (i=0; i<n; i++, x++) {
if (mask[i]) {
__svga_drawpixel16( x, y, (rgba[i][RCOMP]>>3)<<11 | \
(rgba[i][GCOMP]>>2)<<5 | \
(rgba[i][BCOMP]>>3));
}
}
}
else {
/* draw all pixels */
for (i=0; i<n; i++, x++) {
__svga_drawpixel16( x, y, (rgba[i][RCOMP]>>3)<<11 | \
(rgba[i][GCOMP]>>2)<<5 | \
(rgba[i][BCOMP]>>3));
}
}
}
void __write_mono_rgba_span16( const GLcontext *ctx,
GLuint n, GLint x, GLint y,
const GLubyte mask[])
{
int i;
for (i=0; i<n; i++, x++) {
if (mask[i]) {
__svga_drawpixel16( x, y, SVGAMesa->hicolor);
}
}
}
void __read_rgba_span16( const GLcontext *ctx, GLuint n, GLint x, GLint y,
GLubyte rgba[][4] )
{
int i,pix;
for (i=0; i<n; i++, x++) {
pix = __svga_getpixel16( x, y );
rgba[i][RCOMP] = ((pix>>11)<<3) & 0xff;
rgba[i][GCOMP] = ((pix>> 5)<<2) & 0xff;
rgba[i][BCOMP] = ((pix )<<3) & 0xff;
}
}
void __write_rgba_pixels16( const GLcontext *ctx,
GLuint n, const GLint x[], const GLint y[],
const GLubyte rgba[][4], const GLubyte mask[] )
{
int i;
for (i=0; i<n; i++) {
if (mask[i]) {
__svga_drawpixel16( x[i], y[i], (rgba[i][RCOMP]>>3)<<11 | \
(rgba[i][GCOMP]>>2)<<5 | \
(rgba[i][BCOMP]>>3));
}
}
}
void __write_mono_rgba_pixels16( const GLcontext *ctx,
GLuint n,
const GLint x[], const GLint y[],
const GLubyte mask[] )
{
int i;
/* use current rgb color */
for (i=0; i<n; i++) {
if (mask[i]) {
__svga_drawpixel16( x[i], y[i], SVGAMesa->hicolor );
}
}
}
void __read_rgba_pixels16( const GLcontext *ctx,
GLuint n, const GLint x[], const GLint y[],
GLubyte rgba[][4], const GLubyte mask[] )
{
int i,pix;
for (i=0; i<n; i++,x++) {
pix = __svga_getpixel16( x[i], y[i] );
rgba[i][RCOMP] = ((pix>>11)<<3) & 0xff;
rgba[i][GCOMP] = ((pix>> 5)<<2) & 0xff;
rgba[i][BCOMP] = ((pix )<<3) & 0xff;
}
}
#endif

View File

@@ -0,0 +1,45 @@
/* $Id: svgamesa16.h,v 1.1.2.2 2000/01/22 20:05:28 brianp Exp $ */
/*
* Mesa 3-D graphics library
* Version: 3.2
* 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.
*/
/*
* SVGA driver for Mesa.
* Original author: Brian Paul
* Additional authors: Slawomir Szczyrba <steev@hot.pl> (Mesa 3.2)
*/
#ifndef SVGA_MESA_16_H
#define SVGA_MESA_16_H
extern void __set_color16( GLcontext *ctx, GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha );
extern void __clear_color16( GLcontext *ctx, GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha );
extern GLbitfield __clear16( GLcontext *ctx, GLbitfield mask, GLboolean all, GLint x, GLint y, GLint width, GLint height );
extern void __write_rgba_span16( const GLcontext *ctx, GLuint n, GLint x, GLint y, const GLubyte rgba[][4], const GLubyte mask[] );
extern void __write_mono_rgba_span16( const GLcontext *ctx, GLuint n, GLint x, GLint y, const GLubyte mask[]);
extern void __read_rgba_span16( const GLcontext *ctx, GLuint n, GLint x, GLint y, GLubyte rgba[][4] );
extern void __write_rgba_pixels16( const GLcontext *ctx, GLuint n, const GLint x[], const GLint y[], const GLubyte rgba[][4], const GLubyte mask[] );
extern void __write_mono_rgba_pixels16( const GLcontext *ctx, GLuint n, const GLint x[], const GLint y[], const GLubyte mask[] );
extern void __read_rgba_pixels16( const GLcontext *ctx, GLuint n, const GLint x[], const GLint y[], GLubyte rgba[][4], const GLubyte mask[] );
#endif /* SVGA_MESA_16_H */

View File

@@ -0,0 +1,215 @@
/* $Id: svgamesa24.c,v 1.1.2.5 2000/01/31 22:10:39 tanner Exp $ */
/*
* Mesa 3-D graphics library
* Version: 3.2
* 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.
*/
/*
* SVGA driver for Mesa.
* Original author: Brian Paul
* Additional authors: Slawomir Szczyrba <steev@hot.pl> (Mesa 3.2)
*/
#ifdef HAVE_CONFIG_H
#include "conf.h"
#endif
#ifdef SVGA
#include "svgapix.h"
_RGB * rgbBuffer;
#if 0
/* this doesn't compile with GCC on RedHat 6.1 */
inline int RGB2BGR24(int c)
{
asm("rorw $8, %0\n"
"rorl $16, %0\n"
"rorw $8, %0\n"
"shrl $8, %0\n"
: "=q"(c):"0"(c));
return c;
}
#else
static unsigned long RGB2BGR24(unsigned long color)
{
return (color & 0xff00)|(color>>16)|((color & 0xff)<<16);
}
#endif
int __svga_drawpixel24(int x, int y, GLubyte r, GLubyte g, GLubyte b)
{
unsigned long offset;
rgbBuffer=(void *)SVGABuffer.BackBuffer;
y = SVGAInfo->height-y-1;
offset = y * SVGAInfo->width + x;
rgbBuffer[offset].r=r;
rgbBuffer[offset].g=g;
rgbBuffer[offset].b=b;
return 0;
}
unsigned long __svga_getpixel24(int x, int y)
{
unsigned long offset;
rgbBuffer=(void *)SVGABuffer.BackBuffer;
y = SVGAInfo->height-y-1;
offset = y * SVGAInfo->width + x;
return rgbBuffer[offset].r<<16 | rgbBuffer[offset].g<<8 | rgbBuffer[offset].b;
}
void __set_color24( GLcontext *ctx,
GLubyte red, GLubyte green,
GLubyte blue, GLubyte alpha )
{
SVGAMesa->red = red;
SVGAMesa->green = green;
SVGAMesa->blue = blue;
/* SVGAMesa->truecolor = red<<16 | green<<8 | blue; */
}
void __clear_color24( GLcontext *ctx,
GLubyte red, GLubyte green,
GLubyte blue, GLubyte alpha )
{
SVGAMesa->clear_red = red;
SVGAMesa->clear_green = green;
SVGAMesa->clear_blue = blue;
/* SVGAMesa->clear_truecolor = red<<16 | green<<8 | blue; */
}
GLbitfield __clear24( GLcontext *ctx, GLbitfield mask, GLboolean all,
GLint x, GLint y, GLint width, GLint height )
{
int i,j;
if (mask & GL_COLOR_BUFFER_BIT) {
if (all) {
rgbBuffer=(void *)SVGABuffer.BackBuffer;
for (i=0;i<SVGABuffer.BufferSize / 3;i++)
{
rgbBuffer[i].r=SVGAMesa->clear_red;
rgbBuffer[i].g=SVGAMesa->clear_green;
rgbBuffer[i].b=SVGAMesa->clear_blue;
}
} else {
for (i=x;i<width;i++)
for (j=y;j<height;j++)
__svga_drawpixel24( i, j, SVGAMesa->clear_red,
SVGAMesa->clear_green,
SVGAMesa->clear_blue);
}
}
return mask & (~GL_COLOR_BUFFER_BIT);
}
void __write_rgba_span24( const GLcontext *ctx, GLuint n, GLint x, GLint y,
const GLubyte rgba[][4], const GLubyte mask[] )
{
int i;
if (mask) {
/* draw some pixels */
for (i=0; i<n; i++, x++) {
if (mask[i]) {
__svga_drawpixel24( x, y, rgba[i][RCOMP],
rgba[i][GCOMP],
rgba[i][BCOMP]);
}
}
}
else {
/* draw all pixels */
for (i=0; i<n; i++, x++) {
__svga_drawpixel24( x, y, rgba[i][RCOMP],
rgba[i][GCOMP],
rgba[i][BCOMP]);
}
}
}
void __write_mono_rgba_span24( const GLcontext *ctx,
GLuint n, GLint x, GLint y,
const GLubyte mask[])
{
int i;
for (i=0; i<n; i++, x++) {
if (mask[i]) {
__svga_drawpixel24( x, y, SVGAMesa->red,
SVGAMesa->green,
SVGAMesa->blue);
}
}
}
void __read_rgba_span24( const GLcontext *ctx, GLuint n, GLint x, GLint y,
GLubyte rgba[][4] )
{
int i;
for (i=0; i<n; i++, x++) {
*((GLint*)rgba[i]) = RGB2BGR24(__svga_getpixel24( x, y));
}
}
void __write_rgba_pixels24( const GLcontext *ctx,
GLuint n, const GLint x[], const GLint y[],
const GLubyte rgba[][4], const GLubyte mask[] )
{
int i;
for (i=0; i<n; i++) {
if (mask[i]) {
__svga_drawpixel24( x[i], y[i], rgba[i][RCOMP],
rgba[i][GCOMP],
rgba[i][BCOMP]);
}
}
}
void __write_mono_rgba_pixels24( const GLcontext *ctx,
GLuint n,
const GLint x[], const GLint y[],
const GLubyte mask[] )
{
int i;
/* use current rgb color */
for (i=0; i<n; i++) {
if (mask[i]) {
__svga_drawpixel24( x[i], y[i], SVGAMesa->red,
SVGAMesa->green,
SVGAMesa->blue);
}
}
}
void __read_rgba_pixels24( const GLcontext *ctx,
GLuint n, const GLint x[], const GLint y[],
GLubyte rgba[][4], const GLubyte mask[] )
{
int i;
for (i=0; i<n; i++,x++) {
*((GLint*)rgba[i]) = RGB2BGR24(__svga_getpixel24( x[i], y[i]));
}
}
#endif

View File

@@ -0,0 +1,45 @@
/* $Id: svgamesa24.h,v 1.1.2.2 2000/01/22 20:05:28 brianp Exp $ */
/*
* Mesa 3-D graphics library
* Version: 3.2
* 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.
*/
/*
* SVGA driver for Mesa.
* Original author: Brian Paul
* Additional authors: Slawomir Szczyrba <steev@hot.pl> (Mesa 3.2)
*/
#ifndef SVGA_MESA_24_H
#define SVGA_MESA_24_H
extern void __set_color24( GLcontext *ctx, GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha );
extern void __clear_color24( GLcontext *ctx, GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha );
extern GLbitfield __clear24( GLcontext *ctx, GLbitfield mask, GLboolean all, GLint x, GLint y, GLint width, GLint height );
extern void __write_rgba_span24( const GLcontext *ctx, GLuint n, GLint x, GLint y, const GLubyte rgba[][4], const GLubyte mask[] );
extern void __write_mono_rgba_span24( const GLcontext *ctx, GLuint n, GLint x, GLint y, const GLubyte mask[]);
extern void __read_rgba_span24( const GLcontext *ctx, GLuint n, GLint x, GLint y, GLubyte rgba[][4] );
extern void __write_rgba_pixels24( const GLcontext *ctx, GLuint n, const GLint x[], const GLint y[], const GLubyte rgba[][4], const GLubyte mask[] );
extern void __write_mono_rgba_pixels24( const GLcontext *ctx, GLuint n, const GLint x[], const GLint y[], const GLubyte mask[] );
extern void __read_rgba_pixels24( const GLcontext *ctx, GLuint n, const GLint x[], const GLint y[], GLubyte rgba[][4], const GLubyte mask[] );
#endif /* SVGA_MESA_24_H */

View File

@@ -0,0 +1,192 @@
/* $Id: svgamesa32.c,v 1.1.2.5 2000/01/31 22:10:39 tanner Exp $ */
/*
* Mesa 3-D graphics library
* Version: 3.2
* 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.
*/
/*
* SVGA driver for Mesa.
* Original author: Brian Paul
* Additional authors: Slawomir Szczyrba <steev@hot.pl> (Mesa 3.2)
*/
#ifdef HAVE_CONFIG_H
#include "conf.h"
#endif
#ifdef SVGA
#include "svgapix.h"
GLint * intBuffer;
#if 0
/* this doesn't compile with GCC on RedHat 6.1 */
inline int RGB2BGR32(int c)
{
asm("rorw $8, %0\n"
"rorl $16, %0\n"
"rorw $8, %0\n"
"shrl $8, %0\n"
: "=q"(c):"0"(c));
return c;
}
#else
static unsigned long RGB2BGR32(unsigned long color)
{
return (color & 0xff00)|(color>>16)|((color & 0xff)<<16);
}
#endif
int __svga_drawpixel32(int x, int y, unsigned long c)
{
unsigned long offset;
intBuffer=(void *)SVGABuffer.BackBuffer;
y = SVGAInfo->height-y-1;
offset = y * SVGAInfo->width + x;
intBuffer[offset]=c;
return 0;
}
unsigned long __svga_getpixel32(int x, int y)
{
unsigned long offset;
intBuffer=(void *)SVGABuffer.BackBuffer;
y = SVGAInfo->height-y-1;
offset = y * SVGAInfo->width + x;
return intBuffer[offset];
}
void __set_color32( GLcontext *ctx,
GLubyte red, GLubyte green,
GLubyte blue, GLubyte alpha )
{
SVGAMesa->red = red;
SVGAMesa->green = green;
SVGAMesa->blue = blue;
SVGAMesa->truecolor = red<<16 | green<<8 | blue;
}
void __clear_color32( GLcontext *ctx,
GLubyte red, GLubyte green,
GLubyte blue, GLubyte alpha )
{
SVGAMesa->clear_truecolor = red<<16 | green<<8 | blue;
}
GLbitfield __clear32( GLcontext *ctx, GLbitfield mask, GLboolean all,
GLint x, GLint y, GLint width, GLint height )
{
int i,j;
if (mask & GL_COLOR_BUFFER_BIT) {
if (all) {
intBuffer=(void *)SVGABuffer.BackBuffer;
for (i=0;i<SVGABuffer.BufferSize / 4;i++) intBuffer[i]=SVGAMesa->clear_truecolor;
} else {
for (i=x;i<width;i++)
for (j=y;j<height;j++)
__svga_drawpixel32(i,j,SVGAMesa->clear_truecolor);
}
}
return mask & (~GL_COLOR_BUFFER_BIT);
}
void __write_rgba_span32( const GLcontext *ctx, GLuint n, GLint x, GLint y,
const GLubyte rgba[][4], const GLubyte mask[] )
{
int i;
if (mask) {
/* draw some pixels */
for (i=0; i<n; i++, x++) {
if (mask[i]) {
__svga_drawpixel32( x, y, RGB2BGR32(*((GLint*)rgba[i])));
}
}
}
else {
/* draw all pixels */
for (i=0; i<n; i++, x++) {
__svga_drawpixel32( x, y, RGB2BGR32(*((GLint*)rgba[i])));
}
}
}
void __write_mono_rgba_span32( const GLcontext *ctx,
GLuint n, GLint x, GLint y,
const GLubyte mask[])
{
int i;
for (i=0; i<n; i++, x++) {
if (mask[i]) {
__svga_drawpixel32( x, y, SVGAMesa->truecolor);
}
}
}
void __read_rgba_span32( const GLcontext *ctx, GLuint n, GLint x, GLint y,
GLubyte rgba[][4] )
{
int i;
for (i=0; i<n; i++, x++) {
*((GLint*)rgba[i]) = RGB2BGR32(__svga_getpixel32( x, y ));
}
}
void __write_rgba_pixels32( const GLcontext *ctx,
GLuint n, const GLint x[], const GLint y[],
const GLubyte rgba[][4], const GLubyte mask[] )
{
int i;
for (i=0; i<n; i++) {
if (mask[i]) {
__svga_drawpixel32( x[i], y[i], RGB2BGR32(*((GLint*)rgba[i])));
}
}
}
void __write_mono_rgba_pixels32( const GLcontext *ctx,
GLuint n,
const GLint x[], const GLint y[],
const GLubyte mask[] )
{
int i;
/* use current rgb color */
for (i=0; i<n; i++) {
if (mask[i]) {
__svga_drawpixel32( x[i], y[i], SVGAMesa->truecolor );
}
}
}
void __read_rgba_pixels32( const GLcontext *ctx,
GLuint n, const GLint x[], const GLint y[],
GLubyte rgba[][4], const GLubyte mask[] )
{
int i;
for (i=0; i<n; i++,x++) {
*((GLint*)rgba[i]) = RGB2BGR32(__svga_getpixel32( x[i], y[i] ));
}
}
#endif

View File

@@ -0,0 +1,45 @@
/* $Id: svgamesa32.h,v 1.1.2.2 2000/01/22 20:05:28 brianp Exp $ */
/*
* Mesa 3-D graphics library
* Version: 3.2
* 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.
*/
/*
* SVGA driver for Mesa.
* Original author: Brian Paul
* Additional authors: Slawomir Szczyrba <steev@hot.pl> (Mesa 3.2)
*/
#ifndef SVGA_MESA_32_H
#define SVGA_MESA_32_H
extern void __set_color32( GLcontext *ctx, GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha );
extern void __clear_color32( GLcontext *ctx, GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha );
extern GLbitfield __clear32( GLcontext *ctx, GLbitfield mask, GLboolean all, GLint x, GLint y, GLint width, GLint height );
extern void __write_rgba_span32( const GLcontext *ctx, GLuint n, GLint x, GLint y, const GLubyte rgba[][4], const GLubyte mask[] );
extern void __write_mono_rgba_span32( const GLcontext *ctx, GLuint n, GLint x, GLint y, const GLubyte mask[]);
extern void __read_rgba_span32( const GLcontext *ctx, GLuint n, GLint x, GLint y, GLubyte rgba[][4] );
extern void __write_rgba_pixels32( const GLcontext *ctx, GLuint n, const GLint x[], const GLint y[], const GLubyte rgba[][4], const GLubyte mask[] );
extern void __write_mono_rgba_pixels32( const GLcontext *ctx, GLuint n, const GLint x[], const GLint y[], const GLubyte mask[] );
extern void __read_rgba_pixels32( const GLcontext *ctx, GLuint n, const GLint x[], const GLint y[], GLubyte rgba[][4], const GLubyte mask[] );
#endif /* SVGA_MESA_32_H */

View File

@@ -0,0 +1,167 @@
/* $Id: svgamesa8.c,v 1.1.2.3 2000/01/31 22:10:39 tanner Exp $ */
/*
* Mesa 3-D graphics library
* Version: 3.2
* 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.
*/
/*
* SVGA driver for Mesa.
* Original author: Brian Paul
* Additional authors: Slawomir Szczyrba <steev@hot.pl> (Mesa 3.2)
*/
#ifdef HAVE_CONFIG_H
#include "conf.h"
#endif
#ifdef SVGA
#include "svgapix.h"
int __svga_drawpixel8(int x, int y, unsigned long c)
{
unsigned long offset;
y = SVGAInfo->height-y-1;
offset = y * SVGAInfo->linewidth + x;
SVGABuffer.BackBuffer[offset]=c;
return 0;
}
unsigned long __svga_getpixel8(int x, int y)
{
unsigned long offset;
y = SVGAInfo->height-y-1;
offset = y * SVGAInfo->linewidth + x;
return SVGABuffer.BackBuffer[offset];
}
void __set_index8( GLcontext *ctx, GLuint index )
{
SVGAMesa->index = index;
}
void __clear_index8( GLcontext *ctx, GLuint index )
{
SVGAMesa->clear_index = index;
}
GLbitfield __clear8( GLcontext *ctx, GLbitfield mask, GLboolean all,
GLint x, GLint y, GLint width, GLint height )
{
int i,j;
if (mask & GL_COLOR_BUFFER_BIT) {
if (all)
{
memset(SVGABuffer.BackBuffer,SVGAMesa->clear_index,SVGABuffer.BufferSize);
} else {
for (i=x;i<width;i++)
for (j=y;j<height;j++)
__svga_drawpixel8(i,j,SVGAMesa->clear_index);
}
}
return mask & (~GL_COLOR_BUFFER_BIT);
}
void __write_ci32_span8( const GLcontext *ctx, GLuint n, GLint x, GLint y,
const GLuint index[], const GLubyte mask[] )
{
int i;
for (i=0;i<n;i++,x++) {
if (mask[i]) {
__svga_drawpixel8( x, y, index[i]);
}
}
}
void __write_ci8_span8( const GLcontext *ctx, GLuint n, GLint x, GLint y,
const GLubyte index[], const GLubyte mask[] )
{
int i;
for (i=0;i<n;i++,x++) {
if (mask[i]) {
__svga_drawpixel8( x, y, index[i]);
}
}
}
void __write_mono_ci_span8( const GLcontext *ctx, GLuint n,
GLint x, GLint y, const GLubyte mask[] )
{
int i;
for (i=0;i<n;i++,x++) {
if (mask[i]) {
__svga_drawpixel8( x, y, SVGAMesa->index);
}
}
}
void __read_ci32_span8( const GLcontext *ctx,
GLuint n, GLint x, GLint y, GLuint index[])
{
int i;
for (i=0; i<n; i++,x++) {
index[i] = __svga_getpixel8( x, y);
}
}
void __write_ci32_pixels8( const GLcontext *ctx,
GLuint n, const GLint x[], const GLint y[],
const GLuint index[], const GLubyte mask[] )
{
int i;
for (i=0; i<n; i++) {
if (mask[i]) {
__svga_drawpixel8( x[i], y[i], index[i]);
}
}
}
void __write_mono_ci_pixels8( const GLcontext *ctx, GLuint n,
const GLint x[], const GLint y[],
const GLubyte mask[] )
{
int i;
for (i=0; i<n; i++) {
if (mask[i]) {
__svga_drawpixel8( x[i], y[i], SVGAMesa->index);
}
}
}
void __read_ci32_pixels8( const GLcontext *ctx,
GLuint n, const GLint x[], const GLint y[],
GLuint index[], const GLubyte mask[] )
{
int i;
for (i=0; i<n; i++,x++) {
index[i] = __svga_getpixel8( x[i], y[i]);
}
}
#endif

View File

@@ -0,0 +1,45 @@
/* $Id: svgamesa8.h,v 1.1.2.1 2000/01/22 20:05:09 brianp Exp $ */
/*
* Mesa 3-D graphics library
* Version: 3.2
* 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.
*/
/*
* SVGA driver for Mesa.
* Original author: Brian Paul
* Additional authors: Slawomir Szczyrba <steev@hot.pl> (Mesa 3.2)
*/
#ifndef SVGA_MESA_8_H
#define SVGA_MESA_8_H
extern void __set_index8( GLcontext *ctx, GLuint index );
extern void __clear_index8( GLcontext *ctx, GLuint index );
extern GLbitfield __clear8( GLcontext *ctx, GLbitfield mask, GLboolean all, GLint x, GLint y, GLint width, GLint height );
extern void __write_ci32_span8( const GLcontext *ctx, GLuint n, GLint x, GLint y, const GLuint index[], const GLubyte mask[] );
extern void __write_ci8_span8( const GLcontext *ctx, GLuint n, GLint x, GLint y, const GLubyte index[], const GLubyte mask[] );
extern void __write_mono_ci_span8( const GLcontext *ctx, GLuint n, GLint x, GLint y, const GLubyte mask[] );
extern void __read_ci32_span8( const GLcontext *ctx, GLuint n, GLint x, GLint y, GLuint index[]);
extern void __write_ci32_pixels8( const GLcontext *ctx, GLuint n, const GLint x[], const GLint y[], const GLuint index[], const GLubyte mask[] );
extern void __write_mono_ci_pixels8( const GLcontext *ctx, GLuint n, const GLint x[], const GLint y[], const GLubyte mask[] );
extern void __read_ci32_pixels8( const GLcontext *ctx, GLuint n, const GLint x[], const GLint y[], GLuint index[], const GLubyte mask[] );
#endif /* SVGA_MESA_15_H */

View File

@@ -0,0 +1,71 @@
/* $Id: svgapix.h,v 1.1.2.2 2000/01/22 20:05:28 brianp Exp $ */
/*
* Mesa 3-D graphics library
* Version: 3.2
* 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.
*/
/*
* SVGA driver for Mesa.
* Original author: Brian Paul
* Additional authors: Slawomir Szczyrba <steev@hot.pl> (Mesa 3.2)
*/
#ifndef SVGAPIX_H
#define SVGAPIX_H
#include "GL/gl.h"
#include "GL/svgamesa.h"
#include "context.h"
#include "vga.h"
struct svgamesa_context {
GLcontext *gl_ctx; /* the core Mesa context */
GLvisual *gl_vis; /* describes the color buffer */
GLframebuffer *gl_buffer; /* the ancillary buffers */
GLuint index; /* current color index */
GLuint clear_index; /* current clear index */
GLint red, green, blue; /* current rgb color */
GLuint truecolor; /* current rgb color */
GLint clear_red,
clear_green,
clear_blue; /* current clear rgb color */
GLuint clear_truecolor; /* current clear rgb color */
GLushort hicolor; /* current hicolor */
GLushort clear_hicolor; /* current clear hicolor */
GLint width, height; /* size of color buffer */
GLint depth; /* bits per pixel (8,16,24 or 32) */
};
typedef struct { GLubyte b,g,r; } _RGB;
struct svga_buffer {
GLint Depth;
GLint BufferSize;
GLubyte * FrontBuffer;
GLubyte * BackBuffer;
GLubyte * VideoRam;
};
extern struct svga_buffer SVGABuffer;
extern vga_modeinfo * SVGAInfo;
extern SVGAMesaContext SVGAMesa; /* the current context */
#endif /* SVGAPIX_H */

View File

@@ -1,10 +1,10 @@
/* $Id: fakeglx.c,v 1.12.2.4 1999/12/11 09:20:03 brianp Exp $ */
/* $Id: fakeglx.c,v 1.12.2.10 2000/07/19 15:15:55 brianp Exp $ */
/*
* Mesa 3-D graphics library
* Version: 3.1
* Version: 3.2.1
*
* Copyright (C) 1999 Brian Paul All Rights Reserved.
* 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"),
@@ -1157,12 +1157,12 @@ void Fake_glXDestroyGLXPixmap( Display *dpy, GLXPixmap pixmap )
void Fake_glXCopyContext( Display *dpy, GLXContext src, GLXContext dst,
GLuint mask )
unsigned long mask )
{
XMesaContext xm_src = (XMesaContext) src;
XMesaContext xm_dst = (XMesaContext) dst;
(void) dpy;
gl_copy_context( xm_src->gl_ctx, xm_dst->gl_ctx, mask );
gl_copy_context( xm_src->gl_ctx, xm_dst->gl_ctx, (GLuint) mask );
}
@@ -1452,7 +1452,7 @@ const char *Fake_glXQueryExtensionsString( Display *dpy, int screen )
const char *Fake_glXQueryServerString( Display *dpy, int screen, int name )
{
static char *vendor = "Brian Paul";
static char *version = "1.1 Mesa 3.1";
static char *version = "1.1 Mesa 3.2.1";
(void) dpy;
(void) screen;
@@ -1475,7 +1475,7 @@ const char *Fake_glXQueryServerString( Display *dpy, int screen, int name )
const char *Fake_glXGetClientString( Display *dpy, int name )
{
static char *vendor = "Brian Paul";
static char *version = "1.1 Mesa 3.1";
static char *version = "1.1 Mesa 3.2.1";
(void) dpy;

View File

@@ -1,4 +1,4 @@
/* $Id: glxapi.c,v 1.4.2.1 1999/12/10 13:45:39 brianp Exp $ */
/* $Id: glxapi.c,v 1.4.2.2 2000/02/23 23:06:55 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -126,7 +126,7 @@ void glXDestroyContext( Display *dpy, GLXContext ctx )
void glXCopyContext( Display *dpy, GLXContext src, GLXContext dst,
GLuint mask )
unsigned long mask )
{
#ifdef REALGLX
if (display_has_glx(dpy))

View File

@@ -1,4 +1,4 @@
/* $Id: realglx.c,v 1.1 1999/08/19 00:55:42 jtg Exp $ */
/* $Id: realglx.c,v 1.1.1.1.2.1 2000/02/23 23:06:55 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -89,7 +89,7 @@ void Real_glXDestroyContext( Display *dpy, GLXContext ctx )
void Real_glXCopyContext( Display *dpy, GLXContext src, GLXContext dst,
GLuint mask )
unsigned long mask )
{
(void) dpy;
(void) src;

View File

@@ -1,4 +1,4 @@
/* $Id: realglx.h,v 1.1 1999/08/19 00:55:42 jtg Exp $ */
/* $Id: realglx.h,v 1.1.1.1.2.1 2000/02/23 23:06:55 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -54,7 +54,7 @@ extern void Real_glXDestroyContext( Display *dpy, GLXContext ctx );
extern void Real_glXCopyContext( Display *dpy, GLXContext src, GLXContext dst,
GLuint mask );
unsigned long mask );
extern Bool Real_glXMakeCurrent( Display *dpy, GLXDrawable drawable,

View File

@@ -1,4 +1,4 @@
/* $Id: xmesaP.h,v 1.2 1999/10/08 09:27:12 keithw Exp $ */
/* $Id: xmesaP.h,v 1.2.2.1 2000/02/22 17:22:42 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -193,7 +193,7 @@ struct xmesa_buffer {
GLint ximage_width1;
GLushort *ximage_origin2; /* used for PIXELADDR2 macro */
GLint ximage_width2;
bgr_t *ximage_origin3; /* used for PIXELADDR3 macro */
GLubyte *ximage_origin3; /* used for PIXELADDR3 macro */
GLint ximage_width3;
GLuint *ximage_origin4; /* used for PIXELADDR4 macro */
GLint ximage_width4;
@@ -492,7 +492,7 @@ static int const kernel1[16] = {
( xmesa->xm_buffer->ximage_origin2 - (Y) * xmesa->xm_buffer->ximage_width2 + (X) )
#define PIXELADDR3( X, Y ) \
( xmesa->xm_buffer->ximage_origin3 - (Y) * xmesa->xm_buffer->ximage_width3 + (X) )
((bgr_t *) ( xmesa->xm_buffer->ximage_origin3 - (Y) * xmesa->xm_buffer->ximage_width3 + 3 * (X) ))
#define PIXELADDR4( X, Y ) \
( xmesa->xm_buffer->ximage_origin4 - (Y) * xmesa->xm_buffer->ximage_width4 + (X) )

View File

@@ -1,8 +1,8 @@
# $Id: Makefile.X11,v 1.6.2.1 1999/11/16 15:25:50 brianp Exp $
# $Id: Makefile.X11,v 1.6.2.5 2000/07/14 14:56:27 brianp Exp $
# Mesa 3-D graphics library
# Version: 3.1
# Copyright (C) 1995-1999 Brian Paul
# Version: 3.2.1
# Copyright (C) 1995-2000 Brian Paul
# Makefile for core library
@@ -104,6 +104,11 @@ DRIVER_SOURCES = \
X/xmesa4.c \
OSmesa/osmesa.c \
SVGA/svgamesa.c \
SVGA/svgamesa8.c \
SVGA/svgamesa15.c \
SVGA/svgamesa16.c \
SVGA/svgamesa24.c \
SVGA/svgamesa32.c \
FX/fxapi.c \
FX/fxclip.c \
FX/fxcva.c \
@@ -167,6 +172,16 @@ X/xmesa4.o: X/xmesa4.c
$(CC) -c -I. -I$(INCDIR) $(CFLAGS) $< -o $@
SVGA/svgamesa.o: SVGA/svgamesa.c
$(CC) -c -I. -I$(INCDIR) $(CFLAGS) $< -o $@
SVGA/svgamesa8.o: SVGA/svgamesa8.c
$(CC) -c -I. -I$(INCDIR) $(CFLAGS) $< -o $@
SVGA/svgamesa15.o: SVGA/svgamesa15.c
$(CC) -c -I. -I$(INCDIR) $(CFLAGS) $< -o $@
SVGA/svgamesa16.o: SVGA/svgamesa16.c
$(CC) -c -I. -I$(INCDIR) $(CFLAGS) $< -o $@
SVGA/svgamesa24.o: SVGA/svgamesa24.c
$(CC) -c -I. -I$(INCDIR) $(CFLAGS) $< -o $@
SVGA/svgamesa32.o: SVGA/svgamesa32.c
$(CC) -c -I. -I$(INCDIR) $(CFLAGS) $< -o $@
OSmesa/osmesa.o: OSmesa/osmesa.c
$(CC) -c -I. -I$(INCDIR) $(CFLAGS) $< -o $@
FX/fxapi.o: FX/fxapi.c
@@ -199,11 +214,7 @@ FX/fxvsetup.o: FX/fxvsetup.c
$(CC) -c -I. -I$(INCDIR) $(CFLAGS) $< -o $@
FX/fxglidew.o: FX/fxglidew.c
$(CC) -c -I. -I$(INCDIR) $(CFLAGS) $< -o $@
FX/X86/fx_3dnow_fastpath.o: FX/X86/fx_3dnow_fastpath.S FX/X86/fx_regoff.h
FX/X86/fx_regoff.h: FX/X86/fx_gen_regoff
$< > $@
FX/X86/fx_gen_regoff : FX/X86/fx_gen_regoff.c
$(CC) -I. -I$(INCDIR) $(CFLAGS) $< -o $@
FX/X86/fx_3dnow_fastpath.o: FX/X86/fx_3dnow_fastpath.S
GGI/ggimesa.o: GGI/ggimesa.c
$(CC) -c -I. -I$(INCDIR) $(CFLAGS) $< -o $@
X86/x86.o: X86/x86.c

View File

@@ -1,10 +1,10 @@
/* $Id: accum.c,v 1.10.2.1 1999/11/27 01:35:42 brianp Exp $ */
/* $Id: accum.c,v 1.10.2.4 2000/07/18 03:50:16 brianp Exp $ */
/*
* Mesa 3-D graphics library
* Version: 3.1
* Version: 3.2.1
*
* Copyright (C) 1999 Brian Paul All Rights Reserved.
* 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"),
@@ -188,7 +188,7 @@ void gl_Accum( GLcontext *ctx, GLenum op, GLfloat value )
switch (op) {
case GL_ADD:
{
if (value != 0.0F) {
const GLaccum intVal = (GLaccum) (value * acc_scale);
GLuint j;
/* Leave optimized accum buffer mode */
@@ -206,7 +206,7 @@ void gl_Accum( GLcontext *ctx, GLenum op, GLfloat value )
break;
case GL_MULT:
{
if (value != 1.0F) {
GLuint j;
/* Leave optimized accum buffer mode */
if (ctx->IntegerAccumMode)
@@ -223,6 +223,9 @@ void gl_Accum( GLcontext *ctx, GLenum op, GLfloat value )
break;
case GL_ACCUM:
if (value == 0.0F)
return;
(void) (*ctx->Driver.SetBuffer)( ctx, ctx->Pixel.DriverReadBuffer );
/* May have to leave optimized accum buffer mode */
@@ -338,15 +341,14 @@ void gl_Accum( GLcontext *ctx, GLenum op, GLfloat value )
if (ctx->IntegerAccumMode && value != 1.0)
rescale_accum(ctx);
if (ctx->IntegerAccumMode) {
if (ctx->IntegerAccumMode && ctx->IntegerAccumScaler > 0) {
/* build lookup table to avoid many floating point multiplies */
const GLfloat mult = ctx->IntegerAccumScaler;
static GLchan multTable[32768];
static GLfloat prevMult = 0.0;
GLuint j;
const GLint max = (GLint) (256 / mult);
const GLint max = MIN2((GLint) (256 / mult), 32767);
if (mult != prevMult) {
assert(max <= 32768);
for (j = 0; j < max; j++)
multTable[j] = (GLint) ((GLfloat) j * mult + 0.5F);
prevMult = mult;

View File

@@ -1,10 +1,10 @@
/* $Id: attrib.c,v 1.10.2.3 1999/12/12 18:30:47 keithw Exp $ */
/* $Id: attrib.c,v 1.10.2.5 2000/07/19 18:34:03 brianp Exp $ */
/*
* Mesa 3-D graphics library
* Version: 3.1
* Version: 3.2.1
*
* Copyright (C) 1999 Brian Paul All Rights Reserved.
* 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"),
@@ -434,19 +434,37 @@ void gl_PopAttrib( GLcontext* ctx )
if (ctx->Color.DrawBuffer != oldDrawBuffer) {
gl_DrawBuffer(ctx, ctx->Color.DrawBuffer);
}
if ((ctx->Color.AlphaFunc != oldAlphaFunc ||
ctx->Color.AlphaRef != oldAlphaRef) &&
ctx->Driver.AlphaFunc)
(*ctx->Driver.AlphaFunc)( ctx, ctx->Color.AlphaFunc,
ctx->Color.AlphaRef / 255.0F);
if ((ctx->Color.BlendSrcRGB != oldBlendSrc ||
ctx->Color.BlendSrcRGB != oldBlendDst) &&
ctx->Color.BlendDstRGB != oldBlendDst) &&
ctx->Driver.BlendFunc)
(*ctx->Driver.BlendFunc)( ctx, ctx->Color.BlendSrcRGB,
ctx->Color.BlendDstRGB);
if (ctx->Color.LogicOp != oldLogicOp &&
ctx->Driver.LogicOpcode)
ctx->Driver.LogicOpcode) {
ctx->Driver.LogicOpcode( ctx, ctx->Color.LogicOp );
}
if (ctx->Visual->RGBAflag) {
GLubyte r = (GLint) (ctx->Color.ClearColor[0] * 255.0F);
GLubyte g = (GLint) (ctx->Color.ClearColor[1] * 255.0F);
GLubyte b = (GLint) (ctx->Color.ClearColor[2] * 255.0F);
GLubyte a = (GLint) (ctx->Color.ClearColor[3] * 255.0F);
(*ctx->Driver.ClearColor)( ctx, r, g, b, a );
if ((ctx->Color.AlphaFunc != oldAlphaFunc ||
ctx->Color.AlphaRef != oldAlphaRef) &&
ctx->Driver.AlphaFunc)
(*ctx->Driver.AlphaFunc)( ctx, ctx->Color.AlphaFunc,
ctx->Color.AlphaRef / 255.0F);
if (ctx->Driver.ColorMask) {
(*ctx->Driver.ColorMask)(ctx,
ctx->Color.ColorMask[0],
ctx->Color.ColorMask[1],
ctx->Color.ColorMask[2],
ctx->Color.ColorMask[3]);
}
}
else {
(*ctx->Driver.ClearIndex)( ctx, ctx->Color.ClearIndex);
}
}
break;
case GL_CURRENT_BIT:
@@ -455,11 +473,14 @@ void gl_PopAttrib( GLcontext* ctx )
break;
case GL_DEPTH_BUFFER_BIT:
{
GLboolean oldDepthTest = ctx->Depth.Test;
GLenum oldDepthFunc = ctx->Depth.Func;
GLboolean oldDepthMask = ctx->Depth.Mask;
GLfloat oldDepthClear = ctx->Depth.Clear;
MEMCPY( &ctx->Depth, attr->data,
sizeof(struct gl_depthbuffer_attrib) );
if (ctx->Depth.Test != oldDepthTest && ctx->Driver.Enable)
(*ctx->Driver.Enable)( ctx, GL_DEPTH_TEST, ctx->Depth.Test);
if (ctx->Depth.Func != oldDepthFunc && ctx->Driver.DepthFunc)
(*ctx->Driver.DepthFunc)( ctx, ctx->Depth.Func );
if (ctx->Depth.Mask != oldDepthMask && ctx->Driver.DepthMask)

View File

@@ -1,10 +1,10 @@
/* $Id: blend.c,v 1.8 1999/11/11 01:22:25 brianp Exp $ */
/* $Id: blend.c,v 1.7.2.2 2000/06/29 22:06:24 brianp Exp $ */
/*
* Mesa 3-D graphics library
* Version: 3.1
* Version: 3.2
*
* Copyright (C) 1999 Brian Paul All Rights Reserved.
* 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"),
@@ -29,7 +29,13 @@
#ifdef PC_HEADER
#include "all.h"
#else
#include "glheader.h"
#ifndef XFree86Server
#include <stdio.h>
#include <assert.h>
#include <stdlib.h>
#else
#include "GL/xf86glx.h"
#endif
#include "alphabuf.h"
#include "blend.h"
#include "context.h"
@@ -41,9 +47,8 @@
#endif
void _mesa_BlendFunc( GLenum sfactor, GLenum dfactor )
void gl_BlendFunc( GLcontext *ctx, GLenum sfactor, GLenum dfactor )
{
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glBlendFunc");
if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE))
@@ -103,10 +108,9 @@ void _mesa_BlendFunc( GLenum sfactor, GLenum dfactor )
/* GL_INGR_blend_func_separate */
void
_mesa_BlendFuncSeparateINGR( GLenum sfactorRGB, GLenum dfactorRGB,
GLenum sfactorA, GLenum dfactorA )
gl_BlendFuncSeparate( GLcontext *ctx, GLenum sfactorRGB, GLenum dfactorRGB,
GLenum sfactorA, GLenum dfactorA )
{
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glBlendFuncSeparate");
if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE))
@@ -210,10 +214,8 @@ _mesa_BlendFuncSeparateINGR( GLenum sfactorRGB, GLenum dfactorRGB,
/* This is really an extension function! */
void
_mesa_BlendEquationEXT( GLenum mode )
void gl_BlendEquation( GLcontext *ctx, GLenum mode )
{
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glBlendEquation");
if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE))
@@ -254,10 +256,9 @@ _mesa_BlendEquationEXT( GLenum mode )
void
_mesa_BlendColorEXT( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha )
void gl_BlendColor( GLcontext *ctx, GLclampf red, GLclampf green,
GLclampf blue, GLclampf alpha )
{
GET_CURRENT_CONTEXT(ctx);
ctx->Color.BlendColor[0] = CLAMP( red, 0.0F, 1.0F );
ctx->Color.BlendColor[1] = CLAMP( green, 0.0F, 1.0F );
ctx->Color.BlendColor[2] = CLAMP( blue, 0.0F, 1.0F );
@@ -475,7 +476,7 @@ static void blend_general( GLcontext *ctx, GLuint n, const GLubyte mask[],
sR = sG = sB = 1.0F - (GLfloat) Ad * ascale;
break;
case GL_SRC_ALPHA_SATURATE:
if (As < 1.0F - (GLfloat) Ad * ascale) {
if (As * ascale < 1.0F - (GLfloat) Ad * ascale) {
sR = sG = sB = (GLfloat) As * ascale;
}
else {
@@ -595,7 +596,7 @@ static void blend_general( GLcontext *ctx, GLuint n, const GLubyte mask[],
dR = dG = dB = ctx->Color.BlendColor[3];
break;
case GL_ONE_MINUS_CONSTANT_ALPHA:
dR = dG = dB = 1.0F - ctx->Color.BlendColor[3] * ascale;
dR = dG = dB = 1.0F - ctx->Color.BlendColor[3];
break;
default:
/* this should never happen */
@@ -639,7 +640,7 @@ static void blend_general( GLcontext *ctx, GLuint n, const GLubyte mask[],
dA = ctx->Color.BlendColor[3];
break;
case GL_ONE_MINUS_CONSTANT_ALPHA:
dA = 1.0F - ctx->Color.BlendColor[3] * ascale;
dA = 1.0F - ctx->Color.BlendColor[3];
break;
default:
/* this should never happen */

View File

@@ -1,4 +1,4 @@
/* $Id: clip.c,v 1.4.2.1 1999/11/25 16:51:24 keithw Exp $ */
/* $Id: clip.c,v 1.4.2.3 2000/04/17 17:35:47 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -301,10 +301,12 @@ GLuint gl_userclip_point( GLcontext* ctx, const GLfloat v[] )
#if defined(__i386__)
#if 0
#define NEGATIVE(x) ((*(int *)&x)<0)
#define DIFFERENT_SIGNS(a,b) ((a*b) < 0)
#else
#define NEGATIVE(x) (x < 0)
#define DIFFERENT_SIGNS(a,b) ((a*b) < 0)
#endif
@@ -374,13 +376,10 @@ void gl_update_clipmask( GLcontext *ctx )
if (ctx->Visual->RGBAflag)
{
if (ctx->Light.ShadeModel==GL_SMOOTH)
{
mask |= CLIP_RGBA0;
mask |= CLIP_RGBA0;
if (ctx->TriangleCaps & (DD_TRI_LIGHT_TWOSIDE|DD_SEPERATE_SPECULAR))
mask |= CLIP_RGBA1;
}
if (ctx->TriangleCaps & (DD_TRI_LIGHT_TWOSIDE|DD_SEPERATE_SPECULAR))
mask |= CLIP_RGBA1;
if (ctx->Texture.ReallyEnabled & 0xf0)
mask |= CLIP_TEX1|CLIP_TEX0;

View File

@@ -1,4 +1,4 @@
/* $Id: colortab.c,v 1.4 1999/11/11 01:22:25 brianp Exp $ */
/* $Id: colortab.c,v 1.3.2.1 2000/02/28 20:40:18 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -23,15 +23,20 @@
* 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.
*/
/* $XFree86: xc/lib/GL/mesa/src/colortab.c,v 1.2 1999/04/04 00:20:21 dawes Exp $ */
#ifdef PC_HEADER
#include "all.h"
#else
#include "glheader.h"
#ifdef XFree86Server
#include "GL/xf86glx.h"
#endif
#include "colortab.h"
#include "context.h"
#include "image.h"
#include "macros.h"
#endif
@@ -40,8 +45,7 @@
/*
* Return GL_TRUE if k is a power of two, else return GL_FALSE.
*/
static GLboolean
power_of_two( GLint k )
static GLboolean power_of_two( GLint k )
{
GLint i, m = 1;
for (i=0; i<32; i++) {
@@ -53,8 +57,7 @@ power_of_two( GLint k )
}
static GLint
decode_internal_format( GLint format )
static GLint decode_internal_format( GLint format )
{
switch (format) {
case GL_ALPHA:
@@ -111,171 +114,81 @@ decode_internal_format( GLint format )
}
void
_mesa_ColorTable( GLenum target, GLenum internalFormat,
GLsizei width, GLenum format, GLenum type,
const GLvoid *table )
void gl_ColorTable( GLcontext *ctx, GLenum target,
GLenum internalFormat, struct gl_image *table )
{
GET_CURRENT_CONTEXT(ctx);
struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
struct gl_texture_object *texObj;
struct gl_palette *palette;
GLboolean proxy = GL_FALSE;
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glColorTable");
switch (target) {
case GL_TEXTURE_1D:
texObj = texUnit->CurrentD[1];
palette = &texObj->Palette;
break;
case GL_TEXTURE_2D:
texObj = texUnit->CurrentD[2];
palette = &texObj->Palette;
break;
case GL_TEXTURE_3D:
texObj = texUnit->CurrentD[3];
palette = &texObj->Palette;
break;
case GL_PROXY_TEXTURE_1D:
texObj = ctx->Texture.Proxy1D;
palette = &texObj->Palette;
proxy = GL_TRUE;
break;
case GL_PROXY_TEXTURE_2D:
texObj = ctx->Texture.Proxy2D;
palette = &texObj->Palette;
proxy = GL_TRUE;
break;
case GL_PROXY_TEXTURE_3D:
texObj = ctx->Texture.Proxy3D;
palette = &texObj->Palette;
proxy = GL_TRUE;
break;
case GL_SHARED_TEXTURE_PALETTE_EXT:
texObj = NULL;
palette = &ctx->Texture.Palette;
break;
default:
gl_error(ctx, GL_INVALID_ENUM, "glColorTable(target)");
return;
}
assert(palette);
if (!gl_is_legal_format_and_type(format, type)) {
gl_error(ctx, GL_INVALID_ENUM, "glColorTable(format or type)");
return;
}
if (decode_internal_format(internalFormat) < 0) {
gl_error( ctx, GL_INVALID_ENUM, "glColorTable(internalFormat)" );
return;
}
if (width < 1 || width > MAX_TEXTURE_PALETTE_SIZE || !power_of_two(width)) {
gl_error(ctx, GL_INVALID_VALUE, "glColorTable(width)");
if (proxy) {
palette->Size = 0;
palette->IntFormat = (GLenum) 0;
palette->Format = (GLenum) 0;
}
return;
}
palette->Size = width;
palette->IntFormat = internalFormat;
palette->Format = (GLenum) decode_internal_format(internalFormat);
if (!proxy) {
_mesa_unpack_ubyte_color_span(ctx, width, palette->Format,
palette->Table, /* dest */
format, type, table,
&ctx->Unpack, GL_FALSE);
}
if (texObj) {
/* per-texture object palette */
if (ctx->Driver.UpdateTexturePalette) {
(*ctx->Driver.UpdateTexturePalette)( ctx, texObj );
}
}
else {
/* shared texture palette */
if (ctx->Driver.UpdateTexturePalette) {
(*ctx->Driver.UpdateTexturePalette)( ctx, NULL );
}
}
}
void
_mesa_ColorSubTable( GLenum target, GLsizei start,
GLsizei count, GLenum format, GLenum type,
const GLvoid *table )
{
GET_CURRENT_CONTEXT(ctx);
struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
struct gl_texture_object *texObj;
struct gl_palette *palette;
GLint comps;
GLubyte *dest;
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glColorSubTable");
switch (target) {
case GL_TEXTURE_1D:
texObj = texUnit->CurrentD[1];
palette = &texObj->Palette;
break;
case GL_TEXTURE_2D:
texObj = texUnit->CurrentD[2];
palette = &texObj->Palette;
break;
case GL_TEXTURE_3D:
case GL_TEXTURE_3D_EXT:
texObj = texUnit->CurrentD[3];
palette = &texObj->Palette;
break;
case GL_PROXY_TEXTURE_1D:
texObj = ctx->Texture.Proxy1D;
proxy = GL_TRUE;
break;
case GL_PROXY_TEXTURE_2D:
texObj = ctx->Texture.Proxy2D;
proxy = GL_TRUE;
break;
case GL_PROXY_TEXTURE_3D_EXT:
texObj = ctx->Texture.Proxy3D;
proxy = GL_TRUE;
break;
case GL_SHARED_TEXTURE_PALETTE_EXT:
texObj = NULL;
palette = &ctx->Texture.Palette;
break;
default:
gl_error(ctx, GL_INVALID_ENUM, "glColorSubTable(target)");
gl_error(ctx, GL_INVALID_ENUM, "glColorTableEXT(target)");
return;
}
assert(palette);
/* internalformat = just like glTexImage */
if (!gl_is_legal_format_and_type(format, type)) {
gl_error(ctx, GL_INVALID_ENUM, "glColorSubTable(format or type)");
if (table->Width < 1 || table->Width > MAX_TEXTURE_PALETTE_SIZE
|| !power_of_two(table->Width)) {
gl_error(ctx, GL_INVALID_VALUE, "glColorTableEXT(width)");
if (proxy) {
texObj->PaletteSize = 0;
texObj->PaletteIntFormat = (GLenum) 0;
texObj->PaletteFormat = (GLenum) 0;
}
return;
}
if (count < 1) {
gl_error(ctx, GL_INVALID_VALUE, "glColorSubTable(count)");
return;
}
comps = gl_components_in_format(format);
assert(comps > 0); /* error should be caught sooner */
if (start + count > palette->Size) {
gl_error(ctx, GL_INVALID_VALUE, "glColorSubTable(count)");
return;
}
dest = palette->Table + start * comps * sizeof(GLubyte);
_mesa_unpack_ubyte_color_span(ctx, count, palette->Format, dest,
format, type, table,
&ctx->Unpack, GL_FALSE);
if (texObj) {
/* per-texture object palette */
if (ctx->Driver.UpdateTexturePalette) {
(*ctx->Driver.UpdateTexturePalette)( ctx, texObj );
texObj->PaletteSize = table->Width;
texObj->PaletteIntFormat = internalFormat;
texObj->PaletteFormat = (GLenum) decode_internal_format(internalFormat);
if (!proxy) {
MEMCPY(texObj->Palette, table->Data, table->Width*table->Components);
if (ctx->Driver.UpdateTexturePalette) {
(*ctx->Driver.UpdateTexturePalette)( ctx, texObj );
}
}
}
else {
/* shared texture palette */
ctx->Texture.PaletteSize = table->Width;
ctx->Texture.PaletteIntFormat = internalFormat;
ctx->Texture.PaletteFormat = (GLenum) decode_internal_format(internalFormat);
MEMCPY(ctx->Texture.Palette, table->Data, table->Width*table->Components);
if (ctx->Driver.UpdateTexturePalette) {
(*ctx->Driver.UpdateTexturePalette)( ctx, NULL );
}
@@ -284,96 +197,38 @@ _mesa_ColorSubTable( GLenum target, GLsizei start,
void
_mesa_GetColorTable( GLenum target, GLenum format,
GLenum type, GLvoid *table )
void gl_ColorSubTable( GLcontext *ctx, GLenum target,
GLsizei start, struct gl_image *data )
{
GET_CURRENT_CONTEXT(ctx);
struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
struct gl_palette *palette;
GLubyte rgba[MAX_TEXTURE_PALETTE_SIZE][4];
GLint i;
/* XXX TODO */
gl_problem(ctx, "glColorSubTableEXT not implemented");
(void) target;
(void) start;
(void) data;
}
void gl_GetColorTable( GLcontext *ctx, GLenum target, GLenum format,
GLenum type, GLvoid *table )
{
ASSERT_OUTSIDE_BEGIN_END(ctx, "glGetBooleanv");
switch (target) {
case GL_TEXTURE_1D:
palette = &texUnit->CurrentD[1]->Palette;
break;
case GL_TEXTURE_2D:
palette = &texUnit->CurrentD[2]->Palette;
break;
case GL_TEXTURE_3D:
palette = &texUnit->CurrentD[3]->Palette;
case GL_TEXTURE_3D_EXT:
break;
case GL_SHARED_TEXTURE_PALETTE_EXT:
palette = &ctx->Texture.Palette;
break;
default:
gl_error(ctx, GL_INVALID_ENUM, "glGetColorTable(target)");
gl_error(ctx, GL_INVALID_ENUM, "glGetColorTableEXT(target)");
return;
}
assert(palette);
switch (palette->Format) {
case GL_ALPHA:
for (i = 0; i < palette->Size; i++) {
rgba[i][RCOMP] = 0;
rgba[i][GCOMP] = 0;
rgba[i][BCOMP] = 0;
rgba[i][ACOMP] = palette->Table[i];
}
break;
case GL_LUMINANCE:
for (i = 0; i < palette->Size; i++) {
rgba[i][RCOMP] = palette->Table[i];
rgba[i][GCOMP] = palette->Table[i];
rgba[i][BCOMP] = palette->Table[i];
rgba[i][ACOMP] = 255;
}
break;
case GL_LUMINANCE_ALPHA:
for (i = 0; i < palette->Size; i++) {
rgba[i][RCOMP] = palette->Table[i*2+0];
rgba[i][GCOMP] = palette->Table[i*2+0];
rgba[i][BCOMP] = palette->Table[i*2+0];
rgba[i][ACOMP] = palette->Table[i*2+1];
}
break;
case GL_INTENSITY:
for (i = 0; i < palette->Size; i++) {
rgba[i][RCOMP] = palette->Table[i];
rgba[i][GCOMP] = palette->Table[i];
rgba[i][BCOMP] = palette->Table[i];
rgba[i][ACOMP] = 255;
}
break;
case GL_RGB:
for (i = 0; i < palette->Size; i++) {
rgba[i][RCOMP] = palette->Table[i*3+0];
rgba[i][GCOMP] = palette->Table[i*3+1];
rgba[i][BCOMP] = palette->Table[i*3+2];
rgba[i][ACOMP] = 255;
}
break;
case GL_RGBA:
for (i = 0; i < palette->Size; i++) {
rgba[i][RCOMP] = palette->Table[i*4+0];
rgba[i][GCOMP] = palette->Table[i*4+1];
rgba[i][BCOMP] = palette->Table[i*4+2];
rgba[i][ACOMP] = palette->Table[i*4+3];
}
break;
default:
gl_problem(ctx, "bad palette format in glGetColorTable");
return;
}
gl_pack_rgba_span(ctx, palette->Size, (const GLubyte (*)[]) rgba,
format, type, table, &ctx->Pack, GL_FALSE);
gl_problem(ctx, "glGetColorTable not implemented!");
gl_problem(ctx, "glGetColorTableEXT not implemented!");
(void) format;
(void) type;
(void) table;
@@ -381,37 +236,46 @@ _mesa_GetColorTable( GLenum target, GLenum format,
void
_mesa_GetColorTableParameterfv( GLenum target, GLenum pname, GLfloat *params )
void gl_GetColorTableParameterfv( GLcontext *ctx, GLenum target,
GLenum pname, GLfloat *params )
{
GLint iparams[10];
_mesa_GetColorTableParameteriv( target, pname, iparams );
gl_GetColorTableParameteriv( ctx, target, pname, iparams );
*params = (GLfloat) iparams[0];
}
void
_mesa_GetColorTableParameteriv( GLenum target, GLenum pname, GLint *params )
void gl_GetColorTableParameteriv( GLcontext *ctx, GLenum target,
GLenum pname, GLint *params )
{
GET_CURRENT_CONTEXT(ctx);
struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
struct gl_palette *palette;
struct gl_texture_object *texObj;
ASSERT_OUTSIDE_BEGIN_END(ctx, "glGetColorTableParameter");
switch (target) {
case GL_TEXTURE_1D:
palette = &texUnit->CurrentD[1]->Palette;
texObj = texUnit->CurrentD[1];
break;
case GL_TEXTURE_2D:
palette = &texUnit->CurrentD[2]->Palette;
texObj = texUnit->CurrentD[2];
break;
case GL_TEXTURE_3D:
palette = &texUnit->CurrentD[3]->Palette;
case GL_TEXTURE_3D_EXT:
texObj = texUnit->CurrentD[3];
break;
case GL_PROXY_TEXTURE_1D:
texObj = ctx->Texture.Proxy1D;
break;
case GL_PROXY_TEXTURE_2D:
texObj = ctx->Texture.Proxy2D;
break;
case GL_PROXY_TEXTURE_3D:
texObj = ctx->Texture.Proxy3D;
break;
case GL_SHARED_TEXTURE_PALETTE_EXT:
palette = &ctx->Texture.Palette;
texObj = NULL;
break;
default:
gl_error(ctx, GL_INVALID_ENUM, "glGetColorTableParameter(target)");
@@ -419,28 +283,34 @@ _mesa_GetColorTableParameteriv( GLenum target, GLenum pname, GLint *params )
}
switch (pname) {
case GL_COLOR_TABLE_FORMAT:
*params = palette->IntFormat;
case GL_COLOR_TABLE_FORMAT_EXT:
if (texObj)
*params = texObj->PaletteIntFormat;
else
*params = ctx->Texture.PaletteIntFormat;
break;
case GL_COLOR_TABLE_WIDTH:
*params = palette->Size;
case GL_COLOR_TABLE_WIDTH_EXT:
if (texObj)
*params = texObj->PaletteSize;
else
*params = ctx->Texture.PaletteSize;
break;
case GL_COLOR_TABLE_RED_SIZE:
case GL_COLOR_TABLE_RED_SIZE_EXT:
*params = 8;
break;
case GL_COLOR_TABLE_GREEN_SIZE:
case GL_COLOR_TABLE_GREEN_SIZE_EXT:
*params = 8;
break;
case GL_COLOR_TABLE_BLUE_SIZE:
case GL_COLOR_TABLE_BLUE_SIZE_EXT:
*params = 8;
break;
case GL_COLOR_TABLE_ALPHA_SIZE:
case GL_COLOR_TABLE_ALPHA_SIZE_EXT:
*params = 8;
break;
case GL_COLOR_TABLE_LUMINANCE_SIZE:
case GL_COLOR_TABLE_LUMINANCE_SIZE_EXT:
*params = 8;
break;
case GL_COLOR_TABLE_INTENSITY_SIZE:
case GL_COLOR_TABLE_INTENSITY_SIZE_EXT:
*params = 8;
break;
default:

View File

@@ -1,10 +1,10 @@
/* $Id: config.h,v 1.2 1999/11/11 01:22:25 brianp Exp $ */
/* $Id: config.h,v 1.1.1.1.2.1 2000/07/06 14:52:01 brianp Exp $ */
/*
* Mesa 3-D graphics library
* Version: 3.3
* Version: 3.2.1
*
* Copyright (C) 1999 Brian Paul All Rights Reserved.
* 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"),
@@ -25,12 +25,6 @@
*/
/*
* Tunable configuration parameters.
*/
#ifndef CONFIG_H
#define CONFIG_H
@@ -40,7 +34,9 @@
/*
*
* OpenGL implementation limits
*
*/
/* Maximum modelview matrix stack depth: */
@@ -103,16 +99,17 @@
#define MAX_TEXTURE_UNITS 2
/* Maximum viewport size: */
#define MAX_WIDTH 1600
#define MAX_WIDTH 2048
#define MAX_HEIGHT 1200
/* Maxmimum size for CVA. May be overridden by the drivers. */
#define MAX_ARRAY_LOCK_SIZE 3000
/*
*
* Mesa-specific parameters
*
*/
@@ -122,9 +119,6 @@
#define ACCUM_BITS 16
/*
* Bits per depth buffer value: 16 or 32
*/
#ifdef MESAD3D
/* Mesa / Direct3D driver only */
extern float g_DepthScale, g_MaxDepth;
@@ -132,6 +126,9 @@
# define DEPTH_SCALE g_DepthScale
# define MAX_DEPTH g_MaxDepth
#else
/*
* Bits per depth buffer value: 16 or 32
*/
# define DEPTH_BITS 16
# if DEPTH_BITS==16
# define MAX_DEPTH 0xffff
@@ -194,6 +191,19 @@
#define VB_SIZE (VB_MAX + VB_MAX_CLIPPED_VERTS)
/*
*
* For X11 driver only:
*
*/
/*
* When defined, use 6x6x6 dithering instead of 5x9x5.
* 5x9x5 better for general colors, 6x6x6 better for grayscale.
*/
/*#define DITHER666*/
typedef struct gl_context GLcontext;

View File

@@ -1,10 +1,10 @@
/* $Id: context.c,v 1.18.2.6 1999/12/04 21:13:44 brianp Exp $ */
/* $Id: context.c,v 1.18.2.14 2000/07/19 21:00:06 brianp Exp $ */
/*
* Mesa 3-D graphics library
* Version: 3.1
* Version: 3.2
*
* Copyright (C) 1999 Brian Paul All Rights Reserved.
* 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"),
@@ -367,9 +367,9 @@ static struct gl_shared_state *alloc_shared_state( void )
if (!ss)
return NULL;
ss->DisplayList = NewHashTable();
ss->DisplayList = _mesa_NewHashTable();
ss->TexObjects = NewHashTable();
ss->TexObjects = _mesa_NewHashTable();
/* Default Texture objects */
outOfMemory = GL_FALSE;
@@ -385,9 +385,9 @@ static struct gl_shared_state *alloc_shared_state( void )
if (!ss->DisplayList || !ss->TexObjects || outOfMemory) {
/* Ran out of memory at some point. Free everything and return NULL */
if (ss->DisplayList)
DeleteHashTable(ss->DisplayList);
_mesa_DeleteHashTable(ss->DisplayList);
if (ss->TexObjects)
DeleteHashTable(ss->TexObjects);
_mesa_DeleteHashTable(ss->TexObjects);
if (ss->DefaultD[1])
gl_free_texture_object(ss, ss->DefaultD[1]);
if (ss->DefaultD[2])
@@ -410,7 +410,7 @@ static void free_shared_state( GLcontext *ctx, struct gl_shared_state *ss )
{
/* Free display lists */
while (1) {
GLuint list = HashFirstEntry(ss->DisplayList);
GLuint list = _mesa_HashFirstEntry(ss->DisplayList);
if (list) {
gl_destroy_list(ctx, list);
}
@@ -418,7 +418,7 @@ static void free_shared_state( GLcontext *ctx, struct gl_shared_state *ss )
break;
}
}
DeleteHashTable(ss->DisplayList);
_mesa_DeleteHashTable(ss->DisplayList);
/* Free texture objects */
while (ss->TexObjectList)
@@ -428,7 +428,7 @@ static void free_shared_state( GLcontext *ctx, struct gl_shared_state *ss )
/* this function removes from linked list too! */
gl_free_texture_object(ss, ss->TexObjectList);
}
DeleteHashTable(ss->TexObjects);
_mesa_DeleteHashTable(ss->TexObjects);
FREE(ss);
}
@@ -503,6 +503,11 @@ static void init_texture_unit( GLcontext *ctx, GLuint unit )
texUnit->GenModeT = GL_EYE_LINEAR;
texUnit->GenModeR = GL_EYE_LINEAR;
texUnit->GenModeQ = GL_EYE_LINEAR;
texUnit->GenBitS = TEXGEN_EYE_LINEAR;
texUnit->GenBitT = TEXGEN_EYE_LINEAR;
texUnit->GenBitR = TEXGEN_EYE_LINEAR;
texUnit->GenBitQ = TEXGEN_EYE_LINEAR;
/* Yes, these plane coefficients are correct! */
ASSIGN_4V( texUnit->ObjectPlaneS, 1.0, 0.0, 0.0, 0.0 );
ASSIGN_4V( texUnit->ObjectPlaneT, 0.0, 1.0, 0.0, 0.0 );
@@ -622,7 +627,7 @@ static void initialize_context( GLcontext *ctx )
gl_matrix_alloc_inv( &ctx->ModelView );
ctx->ModelViewStackDepth = 0;
for (i = 0 ; i < MAX_MODELVIEW_STACK_DEPTH ; i++) {
for (i = 0; i < MAX_MODELVIEW_STACK_DEPTH - 1; i++) {
gl_matrix_ctr( &ctx->ModelViewStack[i] );
gl_matrix_alloc_inv( &ctx->ModelViewStack[i] );
}
@@ -639,16 +644,16 @@ static void initialize_context( GLcontext *ctx )
ctx->NearFarStack[0][0] = 1.0; /* These values seem weird by make */
ctx->NearFarStack[0][1] = 0.0; /* sense mathematically. */
for (i = 0 ; i < MAX_PROJECTION_STACK_DEPTH ; i++) {
for (i = 0; i < MAX_PROJECTION_STACK_DEPTH - 1; i++) {
gl_matrix_ctr( &ctx->ProjectionStack[i] );
gl_matrix_alloc_inv( &ctx->ProjectionStack[i] );
}
/* Texture matrix */
for (i=0; i<MAX_TEXTURE_UNITS; i++) {
for (i = 0; i < MAX_TEXTURE_UNITS; i++) {
gl_matrix_ctr( &ctx->TextureMatrix[i] );
ctx->TextureStackDepth[i] = 0;
for (j = 0 ; j < MAX_TEXTURE_STACK_DEPTH ; j++) {
for (j = 0; j < MAX_TEXTURE_STACK_DEPTH - 1; j++) {
ctx->TextureStack[i][j].inv = 0;
}
}
@@ -1307,10 +1312,13 @@ GLcontext *gl_create_context( GLvisual *visual,
}
for (i = 0 ; i < 4 ; i++) {
ctx->ShineTable[i] = ctx->ShineTabList->prev;
ctx->ShineTable[i] = ctx->ShineTabList->next;
ctx->ShineTable[i]->refcount++;
}
for (i = 0 ; i < 4 ; i++)
gl_compute_shine_table( ctx, i, 0.0 );
if (visual->DBflag) {
ctx->Color.DrawBuffer = GL_BACK;
ctx->Color.DriverDrawBuffer = GL_BACK_LEFT;
@@ -1370,9 +1378,8 @@ void gl_context_initialize( GLcontext *ctx )
void gl_destroy_context( GLcontext *ctx )
{
if (ctx) {
GLuint i;
struct gl_shine_tab *s, *tmps;
GLuint i, j;
#ifdef PROFILE
if (getenv("MESA_PROFILE")) {
@@ -1381,13 +1388,19 @@ void gl_destroy_context( GLcontext *ctx )
#endif
gl_matrix_dtr( &ctx->ModelView );
for (i = 0 ; i < MAX_MODELVIEW_STACK_DEPTH ; i++) {
for (i = 0 ; i < MAX_MODELVIEW_STACK_DEPTH - 1; i++) {
gl_matrix_dtr( &ctx->ModelViewStack[i] );
}
gl_matrix_dtr( &ctx->ProjectionMatrix );
for (i = 0 ; i < MAX_PROJECTION_STACK_DEPTH ; i++) {
for (i = 0 ; i < MAX_PROJECTION_STACK_DEPTH - 1; i++) {
gl_matrix_dtr( &ctx->ProjectionStack[i] );
}
for (i = 0; i < MAX_TEXTURE_UNITS; i++) {
gl_matrix_dtr( &ctx->TextureMatrix[i] );
for (j = 0; j < MAX_TEXTURE_STACK_DEPTH - 1; j++) {
gl_matrix_dtr( &ctx->TextureStack[i][j] );
}
}
FREE( ctx->PB );
@@ -1708,7 +1721,7 @@ void gl_set_api_table( GLcontext *ctx, const struct gl_api_table *api )
void gl_problem( const GLcontext *ctx, const char *s )
{
fprintf( stderr, "Mesa implementation error: %s\n", s );
fprintf( stderr, "Report to mesa-bugs@mesa3d.org\n" );
fprintf( stderr, "Report to Mesa bug database at www.mesa3d.org\n" );
(void) ctx;
}
@@ -2054,7 +2067,7 @@ static void update_rasterflags( GLcontext *ctx )
ctx->RasterMask |= MULTI_DRAW_BIT;
ctx->TriangleCaps |= DD_MULTIDRAW;
}
else if (ctx->Visual->RGBAflag && ctx->Color.ColorMask==0) {
else if (ctx->Visual->RGBAflag && *((GLuint *) ctx->Color.ColorMask) == 0) {
/* all RGBA channels disabled */
ctx->RasterMask |= MULTI_DRAW_BIT;
ctx->TriangleCaps |= DD_MULTIDRAW;
@@ -2429,14 +2442,13 @@ void gl_update_state( GLcontext *ctx )
ctx->NeedEyeNormals = GL_FALSE;
if (ctx->Light.Enabled) {
if (ctx->Light.Flags & LIGHT_POSITIONAL) {
/* Need length for attenuation */
if (!TEST_MAT_FLAGS( &ctx->ModelView, MAT_FLAGS_LENGTH_PRESERVING))
ctx->NeedEyeCoords = GL_TRUE;
} else if (ctx->Light.NeedVertices) {
/* Need angle for spot calculations */
if (!TEST_MAT_FLAGS( &ctx->ModelView, MAT_FLAGS_ANGLE_PRESERVING))
ctx->NeedEyeCoords = GL_TRUE;
if ((ctx->Light.Flags & LIGHT_POSITIONAL) ||
ctx->Light.NeedVertices ||
!TEST_MAT_FLAGS( &ctx->ModelView, MAT_FLAGS_LENGTH_PRESERVING)) {
/* Need length for attenuation or need angle for spotlights
* or non-uniform scale matrix
*/
ctx->NeedEyeCoords = GL_TRUE;
}
ctx->NeedEyeNormals = ctx->NeedEyeCoords;
}

View File

@@ -1,10 +1,10 @@
/* $Id: depth.c,v 1.9 1999/11/11 01:22:26 brianp Exp $ */
/* $Id: depth.c,v 1.8.2.4 2000/04/11 20:40:44 brianp Exp $ */
/*
* Mesa 3-D graphics library
* Version: 3.3
* Version: 3.2
*
* Copyright (C) 1999 Brian Paul All Rights Reserved.
* 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"),
@@ -24,14 +24,28 @@
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
/* $XFree86: xc/lib/GL/mesa/src/depth.c,v 1.3 1999/04/04 00:20:22 dawes Exp $ */
/*
* Depth buffer functions
*/
#include <stdlib.h>
#ifdef PC_HEADER
#include "all.h"
#else
#include "glheader.h"
#ifndef XFree86Server
#include <stdio.h>
#include <string.h>
#else
#include "GL/xf86glx.h"
#endif
#include "context.h"
#include "enums.h"
#include "depth.h"
#include "mem.h"
#include "macros.h"
#include "types.h"
#endif
@@ -43,10 +57,8 @@
void
_mesa_ClearDepth( GLclampd depth )
void gl_ClearDepth( GLcontext* ctx, GLclampd depth )
{
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glClearDepth");
ctx->Depth.Clear = (GLfloat) CLAMP( depth, 0.0, 1.0 );
if (ctx->Driver.ClearDepth)
@@ -55,10 +67,8 @@ _mesa_ClearDepth( GLclampd depth )
void
_mesa_DepthFunc( GLenum func )
void gl_DepthFunc( GLcontext* ctx, GLenum func )
{
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glDepthFunc");
if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE))
@@ -98,10 +108,8 @@ _mesa_DepthFunc( GLenum func )
void
_mesa_DepthMask( GLboolean flag )
void gl_DepthMask( GLcontext* ctx, GLboolean flag )
{
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glDepthMask");
if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE))
@@ -741,21 +749,48 @@ void gl_depth_test_pixels_greater( GLcontext* ctx,
void gl_read_depth_span_float( GLcontext* ctx,
GLuint n, GLint x, GLint y, GLfloat depth[] )
{
GLdepth *zptr;
GLfloat scale;
GLuint i;
scale = 1.0F / DEPTH_SCALE;
if (ctx->Buffer->Depth) {
zptr = Z_ADDRESS( ctx, x, y );
if (!ctx->Buffer->Depth) {
GLint i;
for (i=0;i<n;i++) {
depth[i] = (GLfloat) zptr[i] * scale;
depth[i] = 0.0F;
}
}
else {
for (i=0;i<n;i++) {
depth[i] = 0.0F;
const GLfloat scale = 1.0F / DEPTH_SCALE;
GLint count = (GLint) n;
GLint i;
GLdepth *zptr;
if (y < 0 || y >= ctx->Buffer->Height ||
x >= ctx->Buffer->Width || x + count < 0) {
/* completely outside frame buffer */
for (i = 0; i < count; i++)
depth[i] = 0.0F;
return;
}
if (x < 0) {
GLint dx = -x;
for (i = 0; i < dx; i++)
depth[i] = 0.0F;
x = 0;
depth += dx;
count -= dx;
}
if (x + count > ctx->Buffer->Width) {
GLint dx = x + count - ctx->Buffer->Width;
for (i = 0; i < dx; i++)
depth[count - dx - 1] = 0;
count -= dx;
}
if (count <= 0)
return;
zptr = Z_ADDRESS( ctx, x, y );
for (i=0;i<count;i++) {
depth[i] = (GLfloat) zptr[i] * scale;
}
}
}
@@ -772,16 +807,45 @@ void gl_read_depth_span_float( GLcontext* ctx,
void gl_read_depth_span_int( GLcontext* ctx,
GLuint n, GLint x, GLint y, GLdepth depth[] )
{
if (ctx->Buffer->Depth) {
GLdepth *zptr = Z_ADDRESS( ctx, x, y );
MEMCPY( depth, zptr, n * sizeof(GLdepth) );
}
else {
if (!ctx->Buffer->Depth) {
GLuint i;
for (i=0;i<n;i++) {
depth[i] = 0;
}
}
else {
GLint count = (GLint) n;
GLdepth *zptr;
GLint i;
if (y < 0 || y >= ctx->Buffer->Height ||
x >= ctx->Buffer->Width || x + count < 0) {
/* completely outside frame buffer */
for (i = 0; i < count; i++)
depth[i] = 0;
return;
}
if (x < 0) {
GLint dx = -x;
for (i = 0; i < dx; i++)
depth[i] = 0;
x = 0;
depth += dx;
count -= dx;
}
if (x + count > ctx->Buffer->Width) {
GLint dx = x + count - ctx->Buffer->Width;
for (i = 0; i < dx; i++)
depth[count - dx - 1] = 0;
count -= dx;
}
if (count <= 0)
return;
zptr = Z_ADDRESS( ctx, x, y );
MEMCPY( depth, zptr, count * sizeof(GLdepth) );
}
}
@@ -853,9 +917,14 @@ void gl_clear_depth_buffer( GLcontext* ctx )
else {
/* clear whole buffer */
if (sizeof(GLdepth)==2 && (clear_value&0xff)==(clear_value>>8)) {
/* lower and upper bytes of clear_value are same, use MEMSET */
MEMSET( ctx->Buffer->Depth, clear_value&0xff,
2*ctx->Buffer->Width*ctx->Buffer->Height);
if (clear_value == 0) {
BZERO(ctx->Buffer->Depth, 2*ctx->Buffer->Width*ctx->Buffer->Height);
}
else {
/* lower and upper bytes of clear_value are same, use MEMSET */
MEMSET( ctx->Buffer->Depth, clear_value&0xff,
2*ctx->Buffer->Width*ctx->Buffer->Height);
}
}
else {
GLdepth *d = ctx->Buffer->Depth;

File diff suppressed because it is too large Load Diff

View File

@@ -1,4 +1,4 @@
/* $Id: drawpix.c,v 1.5.2.1 1999/11/26 16:28:03 brianp Exp $ */
/* $Id: drawpix.c,v 1.5.2.3 2000/04/15 03:18:44 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -77,6 +77,9 @@ GLboolean gl_direct_DrawPixels( GLcontext *ctx,
GL_FALSE);
if (ctx->RenderMode != GL_RENDER)
return GL_FALSE;
if (!ctx->Current.RasterPosValid) {
/* no-op */
return GL_TRUE;
@@ -114,7 +117,7 @@ GLboolean gl_direct_DrawPixels( GLcontext *ctx,
GLint skipRows = unpack->SkipRows;
GLint rowLength;
GLdepth zSpan[MAX_WIDTH]; /* only used when zooming */
GLint zoomY0;
GLint zoomY0 = 0;
if (unpack->RowLength > 0)
rowLength = unpack->RowLength;

View File

@@ -1,8 +1,8 @@
/* $Id: enums.c,v 1.5 1999/11/11 01:22:26 brianp Exp $ */
/* $Id: enums.c,v 1.4.2.1 2000/02/05 01:52:23 brianp Exp $ */
/*
* Mesa 3-D graphics library
* Version: 3.3
* Version: 3.1
*
* Copyright (C) 1999 Brian Paul All Rights Reserved.
*
@@ -24,15 +24,17 @@
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifdef PC_HEADER
#include "all.h"
#ifndef XFree86Server
#include <stdlib.h>
#include <string.h>
#else
#include "glheader.h"
#include "enums.h"
#include "mem.h"
#include "GL/xf86glx.h"
#endif
#include "GL/gl.h"
#include "enums.h"
#include "macros.h"
typedef struct {
const char *c;
@@ -795,8 +797,8 @@ enum_elt all_enums[] =
{ "GL_NATIVE_GRAPHICS_HANDLE_PGI", 107010 },
/* GL_EXT_compiled_vertex_array */
{ "GL_ARRAY_ELEMENT_LOCK_FIRST_SGI", 0x81A8},
{ "GL_ARRAY_ELEMENT_LOCK_COUNT_SGI", 0x81A9},
{ "GL_ARRAY_ELEMENT_LOCK_FIRST_EXT", 0x81A8},
{ "GL_ARRAY_ELEMENT_LOCK_COUNT_EXT", 0x81A9},
/* GL_EXT_clip_volume_hint */
{ "GL_CLIP_VOLUME_CLIPPING_HINT_EXT", 0x80F0}

View File

@@ -1,8 +1,8 @@
/* $Id: eval.c,v 1.7 1999/11/11 01:22:26 brianp Exp $ */
/* $Id: eval.c,v 1.6.2.2 2000/07/20 15:54:06 keithw Exp $ */
/*
* Mesa 3-D graphics library
* Version: 3.3
* Version: 3.1
*
* Copyright (C) 1999 Brian Paul All Rights Reserved.
*
@@ -41,11 +41,16 @@
#ifdef PC_HEADER
#include "all.h"
#else
#include "glheader.h"
#ifndef XFree86Server
#include <math.h>
#include <stdlib.h>
#include <string.h>
#else
#include "GL/xf86glx.h"
#endif
#include "context.h"
#include "eval.h"
#include "macros.h"
#include "mem.h"
#include "mmath.h"
#include "types.h"
#include "vbcull.h"
@@ -523,9 +528,9 @@ de_casteljau_surf(GLfloat *cn, GLfloat *out, GLfloat *du, GLfloat *dv,
/*
* Return the number of components per control point for any type of
* evaluator. Return 0 if bad target.
* See table 5.1 in the OpenGL 1.2 spec.
*/
GLuint _mesa_evaluator_components( GLenum target )
static GLint components( GLenum target )
{
switch (target) {
case GL_MAP1_VERTEX_3: return 3;
@@ -563,11 +568,12 @@ GLuint _mesa_evaluator_components( GLenum target )
* Return: pointer to buffer of contiguous control points or NULL if out
* of memory.
*/
GLfloat *gl_copy_map_points1f( GLenum target, GLint ustride, GLint uorder,
GLfloat *gl_copy_map_points1f( GLenum target,
GLint ustride, GLint uorder,
const GLfloat *points )
{
GLfloat *buffer, *p;
GLint i, k, size = _mesa_evaluator_components(target);
GLint i, k, size = components(target);
if (!points || size==0) {
return NULL;
@@ -588,11 +594,12 @@ GLfloat *gl_copy_map_points1f( GLenum target, GLint ustride, GLint uorder,
/*
* Same as above but convert doubles to floats.
*/
GLfloat *gl_copy_map_points1d( GLenum target, GLint ustride, GLint uorder,
const GLdouble *points )
GLfloat *gl_copy_map_points1d( GLenum target,
GLint ustride, GLint uorder,
const GLdouble *points )
{
GLfloat *buffer, *p;
GLint i, k, size = _mesa_evaluator_components(target);
GLint i, k, size = components(target);
if (!points || size==0) {
return NULL;
@@ -621,15 +628,15 @@ GLfloat *gl_copy_map_points1d( GLenum target, GLint ustride, GLint uorder,
* of memory.
*/
GLfloat *gl_copy_map_points2f( GLenum target,
GLint ustride, GLint uorder,
GLint vstride, GLint vorder,
const GLfloat *points )
GLint ustride, GLint uorder,
GLint vstride, GLint vorder,
const GLfloat *points )
{
GLfloat *buffer, *p;
GLint i, j, k, size, dsize, hsize;
GLint uinc;
size = _mesa_evaluator_components(target);
size = components(target);
if (!points || size==0) {
return NULL;
@@ -672,7 +679,7 @@ GLfloat *gl_copy_map_points2d(GLenum target,
GLint i, j, k, size, hsize, dsize;
GLint uinc;
size = _mesa_evaluator_components(target);
size = components(target);
if (!points || size==0) {
return NULL;
@@ -702,7 +709,6 @@ GLfloat *gl_copy_map_points2d(GLenum target,
}
#if 00
/*
* This function is called by the display list deallocator function to
* specify that a given set of control points are no longer needed.
@@ -798,7 +804,6 @@ void gl_free_control_points( GLcontext* ctx, GLenum target, GLfloat *data )
}
}
#endif
@@ -808,130 +813,154 @@ void gl_free_control_points( GLcontext* ctx, GLenum target, GLfloat *data )
/*
* This does the work of glMap1[fd].
* Note that the array of control points must be 'unpacked' at this time.
* Input: retain - if TRUE, this control point data is also in a display
* list and can't be freed until the list is freed.
*/
static void
map1(GLenum target, GLfloat u1, GLfloat u2, GLint ustride,
GLint uorder, const GLvoid *points, GLenum type )
void gl_Map1f( GLcontext* ctx, GLenum target,
GLfloat u1, GLfloat u2, GLint stride,
GLint order, const GLfloat *points, GLboolean retain )
{
GET_CURRENT_CONTEXT(ctx);
GLint k;
GLfloat *pnts;
if (!points) {
gl_error( ctx, GL_OUT_OF_MEMORY, "glMap1f" );
return;
}
/* may be a new stride after copying control points */
stride = components( target );
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glMap1");
assert(type == GL_FLOAT || type == GL_DOUBLE);
if (u1 == u2) {
if (u1==u2) {
gl_error( ctx, GL_INVALID_VALUE, "glMap1(u1,u2)" );
return;
}
if (uorder < 1 || uorder > MAX_EVAL_ORDER) {
if (order<1 || order>MAX_EVAL_ORDER) {
gl_error( ctx, GL_INVALID_VALUE, "glMap1(order)" );
return;
}
if (!points) {
gl_error( ctx, GL_INVALID_VALUE, "glMap1(points)" );
return;
}
k = _mesa_evaluator_components( target );
if (k == 0) {
k = components( target );
if (k==0) {
gl_error( ctx, GL_INVALID_ENUM, "glMap1(target)" );
}
if (ustride < k) {
if (stride < k) {
gl_error( ctx, GL_INVALID_VALUE, "glMap1(stride)" );
return;
}
/* make copy of the control points */
if (type == GL_FLOAT)
pnts = gl_copy_map_points1f(target, ustride, uorder, (GLfloat*) points);
else
pnts = gl_copy_map_points1d(target, ustride, uorder, (GLdouble*) points);
switch (target) {
case GL_MAP1_VERTEX_3:
ctx->EvalMap.Map1Vertex3.Order = uorder;
ctx->EvalMap.Map1Vertex3.Order = order;
ctx->EvalMap.Map1Vertex3.u1 = u1;
ctx->EvalMap.Map1Vertex3.u2 = u2;
ctx->EvalMap.Map1Vertex3.du = 1.0 / (u2 - u1);
if (ctx->EvalMap.Map1Vertex3.Points)
if (ctx->EvalMap.Map1Vertex3.Points
&& !ctx->EvalMap.Map1Vertex3.Retain) {
FREE( ctx->EvalMap.Map1Vertex3.Points );
ctx->EvalMap.Map1Vertex3.Points = pnts;
}
ctx->EvalMap.Map1Vertex3.Points = (GLfloat *) points;
ctx->EvalMap.Map1Vertex3.Retain = retain;
break;
case GL_MAP1_VERTEX_4:
ctx->EvalMap.Map1Vertex4.Order = uorder;
ctx->EvalMap.Map1Vertex4.Order = order;
ctx->EvalMap.Map1Vertex4.u1 = u1;
ctx->EvalMap.Map1Vertex4.u2 = u2;
ctx->EvalMap.Map1Vertex4.du = 1.0 / (u2 - u1);
if (ctx->EvalMap.Map1Vertex4.Points)
if (ctx->EvalMap.Map1Vertex4.Points
&& !ctx->EvalMap.Map1Vertex4.Retain) {
FREE( ctx->EvalMap.Map1Vertex4.Points );
ctx->EvalMap.Map1Vertex4.Points = pnts;
}
ctx->EvalMap.Map1Vertex4.Points = (GLfloat *) points;
ctx->EvalMap.Map1Vertex4.Retain = retain;
break;
case GL_MAP1_INDEX:
ctx->EvalMap.Map1Index.Order = uorder;
ctx->EvalMap.Map1Index.Order = order;
ctx->EvalMap.Map1Index.u1 = u1;
ctx->EvalMap.Map1Index.u2 = u2;
ctx->EvalMap.Map1Index.du = 1.0 / (u2 - u1);
if (ctx->EvalMap.Map1Index.Points)
if (ctx->EvalMap.Map1Index.Points
&& !ctx->EvalMap.Map1Index.Retain) {
FREE( ctx->EvalMap.Map1Index.Points );
ctx->EvalMap.Map1Index.Points = pnts;
}
ctx->EvalMap.Map1Index.Points = (GLfloat *) points;
ctx->EvalMap.Map1Index.Retain = retain;
break;
case GL_MAP1_COLOR_4:
ctx->EvalMap.Map1Color4.Order = uorder;
ctx->EvalMap.Map1Color4.Order = order;
ctx->EvalMap.Map1Color4.u1 = u1;
ctx->EvalMap.Map1Color4.u2 = u2;
ctx->EvalMap.Map1Color4.du = 1.0 / (u2 - u1);
if (ctx->EvalMap.Map1Color4.Points)
if (ctx->EvalMap.Map1Color4.Points
&& !ctx->EvalMap.Map1Color4.Retain) {
FREE( ctx->EvalMap.Map1Color4.Points );
ctx->EvalMap.Map1Color4.Points = pnts;
}
ctx->EvalMap.Map1Color4.Points = (GLfloat *) points;
ctx->EvalMap.Map1Color4.Retain = retain;
break;
case GL_MAP1_NORMAL:
ctx->EvalMap.Map1Normal.Order = uorder;
ctx->EvalMap.Map1Normal.Order = order;
ctx->EvalMap.Map1Normal.u1 = u1;
ctx->EvalMap.Map1Normal.u2 = u2;
ctx->EvalMap.Map1Normal.du = 1.0 / (u2 - u1);
if (ctx->EvalMap.Map1Normal.Points)
if (ctx->EvalMap.Map1Normal.Points
&& !ctx->EvalMap.Map1Normal.Retain) {
FREE( ctx->EvalMap.Map1Normal.Points );
ctx->EvalMap.Map1Normal.Points = pnts;
}
ctx->EvalMap.Map1Normal.Points = (GLfloat *) points;
ctx->EvalMap.Map1Normal.Retain = retain;
break;
case GL_MAP1_TEXTURE_COORD_1:
ctx->EvalMap.Map1Texture1.Order = uorder;
ctx->EvalMap.Map1Texture1.Order = order;
ctx->EvalMap.Map1Texture1.u1 = u1;
ctx->EvalMap.Map1Texture1.u2 = u2;
ctx->EvalMap.Map1Texture1.du = 1.0 / (u2 - u1);
if (ctx->EvalMap.Map1Texture1.Points)
if (ctx->EvalMap.Map1Texture1.Points
&& !ctx->EvalMap.Map1Texture1.Retain) {
FREE( ctx->EvalMap.Map1Texture1.Points );
ctx->EvalMap.Map1Texture1.Points = pnts;
}
ctx->EvalMap.Map1Texture1.Points = (GLfloat *) points;
ctx->EvalMap.Map1Texture1.Retain = retain;
break;
case GL_MAP1_TEXTURE_COORD_2:
ctx->EvalMap.Map1Texture2.Order = uorder;
ctx->EvalMap.Map1Texture2.Order = order;
ctx->EvalMap.Map1Texture2.u1 = u1;
ctx->EvalMap.Map1Texture2.u2 = u2;
ctx->EvalMap.Map1Texture2.du = 1.0 / (u2 - u1);
if (ctx->EvalMap.Map1Texture2.Points)
if (ctx->EvalMap.Map1Texture2.Points
&& !ctx->EvalMap.Map1Texture2.Retain) {
FREE( ctx->EvalMap.Map1Texture2.Points );
ctx->EvalMap.Map1Texture2.Points = pnts;
}
ctx->EvalMap.Map1Texture2.Points = (GLfloat *) points;
ctx->EvalMap.Map1Texture2.Retain = retain;
break;
case GL_MAP1_TEXTURE_COORD_3:
ctx->EvalMap.Map1Texture3.Order = uorder;
ctx->EvalMap.Map1Texture3.Order = order;
ctx->EvalMap.Map1Texture3.u1 = u1;
ctx->EvalMap.Map1Texture3.u2 = u2;
ctx->EvalMap.Map1Texture3.du = 1.0 / (u2 - u1);
if (ctx->EvalMap.Map1Texture3.Points)
if (ctx->EvalMap.Map1Texture3.Points
&& !ctx->EvalMap.Map1Texture3.Retain) {
FREE( ctx->EvalMap.Map1Texture3.Points );
ctx->EvalMap.Map1Texture3.Points = pnts;
}
ctx->EvalMap.Map1Texture3.Points = (GLfloat *) points;
ctx->EvalMap.Map1Texture3.Retain = retain;
break;
case GL_MAP1_TEXTURE_COORD_4:
ctx->EvalMap.Map1Texture4.Order = uorder;
ctx->EvalMap.Map1Texture4.Order = order;
ctx->EvalMap.Map1Texture4.u1 = u1;
ctx->EvalMap.Map1Texture4.u2 = u2;
ctx->EvalMap.Map1Texture4.du = 1.0 / (u2 - u1);
if (ctx->EvalMap.Map1Texture4.Points)
if (ctx->EvalMap.Map1Texture4.Points
&& !ctx->EvalMap.Map1Texture4.Retain) {
FREE( ctx->EvalMap.Map1Texture4.Points );
ctx->EvalMap.Map1Texture4.Points = pnts;
}
ctx->EvalMap.Map1Texture4.Points = (GLfloat *) points;
ctx->EvalMap.Map1Texture4.Retain = retain;
break;
default:
gl_error( ctx, GL_INVALID_ENUM, "glMap1(target)" );
@@ -940,30 +969,18 @@ map1(GLenum target, GLfloat u1, GLfloat u2, GLint ustride,
void
_mesa_Map1f( GLenum target, GLfloat u1, GLfloat u2, GLint stride,
GLint order, const GLfloat *points )
/*
* Note that the array of control points must be 'unpacked' at this time.
* Input: retain - if TRUE, this control point data is also in a display
* list and can't be freed until the list is freed.
*/
void gl_Map2f( GLcontext* ctx, GLenum target,
GLfloat u1, GLfloat u2, GLint ustride, GLint uorder,
GLfloat v1, GLfloat v2, GLint vstride, GLint vorder,
const GLfloat *points, GLboolean retain )
{
map1(target, u1, u2, stride, order, points, GL_FLOAT);
}
void
_mesa_Map1d( GLenum target, GLdouble u1, GLdouble u2, GLint stride,
GLint order, const GLdouble *points )
{
map1(target, u1, u2, stride, order, points, GL_DOUBLE);
}
static void
map2( GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder,
GLfloat v1, GLfloat v2, GLint vstride, GLint vorder,
const GLvoid *points, GLenum type )
{
GET_CURRENT_CONTEXT(ctx);
GLint k;
GLfloat *pnts;
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glMap2");
@@ -987,7 +1004,7 @@ map2( GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder,
return;
}
k = _mesa_evaluator_components( target );
k = components( target );
if (k==0) {
gl_error( ctx, GL_INVALID_ENUM, "glMap2(target)" );
}
@@ -1001,14 +1018,6 @@ map2( GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder,
return;
}
/* make copy of the control points */
if (type == GL_FLOAT)
pnts = gl_copy_map_points2f(target, ustride, uorder,
vstride, vorder, (GLfloat*) points);
else
pnts = gl_copy_map_points2d(target, ustride, uorder,
vstride, vorder, (GLdouble*) points);
switch (target) {
case GL_MAP2_VERTEX_3:
ctx->EvalMap.Map2Vertex3.Uorder = uorder;
@@ -1019,9 +1028,12 @@ map2( GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder,
ctx->EvalMap.Map2Vertex3.v1 = v1;
ctx->EvalMap.Map2Vertex3.v2 = v2;
ctx->EvalMap.Map2Vertex3.dv = 1.0 / (v2 - v1);
if (ctx->EvalMap.Map2Vertex3.Points)
if (ctx->EvalMap.Map2Vertex3.Points
&& !ctx->EvalMap.Map2Vertex3.Retain) {
FREE( ctx->EvalMap.Map2Vertex3.Points );
ctx->EvalMap.Map2Vertex3.Points = pnts;
}
ctx->EvalMap.Map2Vertex3.Retain = retain;
ctx->EvalMap.Map2Vertex3.Points = (GLfloat *) points;
break;
case GL_MAP2_VERTEX_4:
ctx->EvalMap.Map2Vertex4.Uorder = uorder;
@@ -1032,9 +1044,12 @@ map2( GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder,
ctx->EvalMap.Map2Vertex4.v1 = v1;
ctx->EvalMap.Map2Vertex4.v2 = v2;
ctx->EvalMap.Map2Vertex4.dv = 1.0 / (v2 - v1);
if (ctx->EvalMap.Map2Vertex4.Points)
if (ctx->EvalMap.Map2Vertex4.Points
&& !ctx->EvalMap.Map2Vertex4.Retain) {
FREE( ctx->EvalMap.Map2Vertex4.Points );
ctx->EvalMap.Map2Vertex4.Points = pnts;
}
ctx->EvalMap.Map2Vertex4.Points = (GLfloat *) points;
ctx->EvalMap.Map2Vertex4.Retain = retain;
break;
case GL_MAP2_INDEX:
ctx->EvalMap.Map2Index.Uorder = uorder;
@@ -1045,9 +1060,12 @@ map2( GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder,
ctx->EvalMap.Map2Index.v1 = v1;
ctx->EvalMap.Map2Index.v2 = v2;
ctx->EvalMap.Map2Index.dv = 1.0 / (v2 - v1);
if (ctx->EvalMap.Map2Index.Points)
if (ctx->EvalMap.Map2Index.Points
&& !ctx->EvalMap.Map2Index.Retain) {
FREE( ctx->EvalMap.Map2Index.Points );
ctx->EvalMap.Map2Index.Points = pnts;
}
ctx->EvalMap.Map2Index.Retain = retain;
ctx->EvalMap.Map2Index.Points = (GLfloat *) points;
break;
case GL_MAP2_COLOR_4:
ctx->EvalMap.Map2Color4.Uorder = uorder;
@@ -1058,9 +1076,12 @@ map2( GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder,
ctx->EvalMap.Map2Color4.v1 = v1;
ctx->EvalMap.Map2Color4.v2 = v2;
ctx->EvalMap.Map2Color4.dv = 1.0 / (v2 - v1);
if (ctx->EvalMap.Map2Color4.Points)
if (ctx->EvalMap.Map2Color4.Points
&& !ctx->EvalMap.Map2Color4.Retain) {
FREE( ctx->EvalMap.Map2Color4.Points );
ctx->EvalMap.Map2Color4.Points = pnts;
}
ctx->EvalMap.Map2Color4.Retain = retain;
ctx->EvalMap.Map2Color4.Points = (GLfloat *) points;
break;
case GL_MAP2_NORMAL:
ctx->EvalMap.Map2Normal.Uorder = uorder;
@@ -1071,9 +1092,12 @@ map2( GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder,
ctx->EvalMap.Map2Normal.v1 = v1;
ctx->EvalMap.Map2Normal.v2 = v2;
ctx->EvalMap.Map2Normal.dv = 1.0 / (v2 - v1);
if (ctx->EvalMap.Map2Normal.Points)
if (ctx->EvalMap.Map2Normal.Points
&& !ctx->EvalMap.Map2Normal.Retain) {
FREE( ctx->EvalMap.Map2Normal.Points );
ctx->EvalMap.Map2Normal.Points = pnts;
}
ctx->EvalMap.Map2Normal.Retain = retain;
ctx->EvalMap.Map2Normal.Points = (GLfloat *) points;
break;
case GL_MAP2_TEXTURE_COORD_1:
ctx->EvalMap.Map2Texture1.Uorder = uorder;
@@ -1084,9 +1108,12 @@ map2( GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder,
ctx->EvalMap.Map2Texture1.v1 = v1;
ctx->EvalMap.Map2Texture1.v2 = v2;
ctx->EvalMap.Map2Texture1.dv = 1.0 / (v2 - v1);
if (ctx->EvalMap.Map2Texture1.Points)
if (ctx->EvalMap.Map2Texture1.Points
&& !ctx->EvalMap.Map2Texture1.Retain) {
FREE( ctx->EvalMap.Map2Texture1.Points );
ctx->EvalMap.Map2Texture1.Points = pnts;
}
ctx->EvalMap.Map2Texture1.Retain = retain;
ctx->EvalMap.Map2Texture1.Points = (GLfloat *) points;
break;
case GL_MAP2_TEXTURE_COORD_2:
ctx->EvalMap.Map2Texture2.Uorder = uorder;
@@ -1097,9 +1124,12 @@ map2( GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder,
ctx->EvalMap.Map2Texture2.v1 = v1;
ctx->EvalMap.Map2Texture2.v2 = v2;
ctx->EvalMap.Map2Texture2.dv = 1.0 / (v2 - v1);
if (ctx->EvalMap.Map2Texture2.Points)
if (ctx->EvalMap.Map2Texture2.Points
&& !ctx->EvalMap.Map2Texture2.Retain) {
FREE( ctx->EvalMap.Map2Texture2.Points );
ctx->EvalMap.Map2Texture2.Points = pnts;
}
ctx->EvalMap.Map2Texture2.Retain = retain;
ctx->EvalMap.Map2Texture2.Points = (GLfloat *) points;
break;
case GL_MAP2_TEXTURE_COORD_3:
ctx->EvalMap.Map2Texture3.Uorder = uorder;
@@ -1110,9 +1140,12 @@ map2( GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder,
ctx->EvalMap.Map2Texture3.v1 = v1;
ctx->EvalMap.Map2Texture3.v2 = v2;
ctx->EvalMap.Map2Texture3.dv = 1.0 / (v2 - v1);
if (ctx->EvalMap.Map2Texture3.Points)
if (ctx->EvalMap.Map2Texture3.Points
&& !ctx->EvalMap.Map2Texture3.Retain) {
FREE( ctx->EvalMap.Map2Texture3.Points );
ctx->EvalMap.Map2Texture3.Points = pnts;
}
ctx->EvalMap.Map2Texture3.Retain = retain;
ctx->EvalMap.Map2Texture3.Points = (GLfloat *) points;
break;
case GL_MAP2_TEXTURE_COORD_4:
ctx->EvalMap.Map2Texture4.Uorder = uorder;
@@ -1123,9 +1156,12 @@ map2( GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder,
ctx->EvalMap.Map2Texture4.v1 = v1;
ctx->EvalMap.Map2Texture4.v2 = v2;
ctx->EvalMap.Map2Texture4.dv = 1.0 / (v2 - v1);
if (ctx->EvalMap.Map2Texture4.Points)
if (ctx->EvalMap.Map2Texture4.Points
&& !ctx->EvalMap.Map2Texture4.Retain) {
FREE( ctx->EvalMap.Map2Texture4.Points );
ctx->EvalMap.Map2Texture4.Points = pnts;
}
ctx->EvalMap.Map2Texture4.Retain = retain;
ctx->EvalMap.Map2Texture4.Points = (GLfloat *) points;
break;
default:
gl_error( ctx, GL_INVALID_ENUM, "glMap2(target)" );
@@ -1133,33 +1169,11 @@ map2( GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder,
}
void
_mesa_Map2f( GLenum target,
GLfloat u1, GLfloat u2, GLint ustride, GLint uorder,
GLfloat v1, GLfloat v2, GLint vstride, GLint vorder,
const GLfloat *points)
{
map2(target, u1, u2, ustride, uorder, v1, v2, vstride, vorder,
points, GL_FLOAT);
}
void
_mesa_Map2d( GLenum target,
GLdouble u1, GLdouble u2, GLint ustride, GLint uorder,
GLdouble v1, GLdouble v2, GLint vstride, GLint vorder,
const GLdouble *points )
{
map2(target, u1, u2, ustride, uorder, v1, v2, vstride, vorder,
points, GL_DOUBLE);
}
void
_mesa_GetMapdv( GLenum target, GLenum query, GLdouble *v )
void gl_GetMapdv( GLcontext* ctx, GLenum target, GLenum query, GLdouble *v )
{
GET_CURRENT_CONTEXT(ctx);
GLint i, n;
GLfloat *data;
@@ -1429,10 +1443,8 @@ _mesa_GetMapdv( GLenum target, GLenum query, GLdouble *v )
}
void
_mesa_GetMapfv( GLenum target, GLenum query, GLfloat *v )
void gl_GetMapfv( GLcontext* ctx, GLenum target, GLenum query, GLfloat *v )
{
GET_CURRENT_CONTEXT(ctx);
GLint i, n;
GLfloat *data;
@@ -1702,10 +1714,8 @@ _mesa_GetMapfv( GLenum target, GLenum query, GLfloat *v )
}
void
_mesa_GetMapiv( GLenum target, GLenum query, GLint *v )
void gl_GetMapiv( GLcontext* ctx, GLenum target, GLenum query, GLint *v )
{
GET_CURRENT_CONTEXT(ctx);
GLuint i, n;
GLfloat *data;
@@ -2482,8 +2492,8 @@ void gl_eval_vb( struct vertex_buffer *VB )
VB->NormalPtr = eval2_norm( out_normal, coord, flags, IM->Start,
&ctx->EvalMap.Map2Normal );
new_flags |= VERT_NORM;
if (VB->NormalPtr != in_normal) {
new_flags |= VERT_NORM;
if (!all_eval)
VB->NormalPtr = copy_3f( out_normal, in_normal, flags, IM->Start );
}
@@ -2551,26 +2561,43 @@ void gl_eval_vb( struct vertex_buffer *VB )
}
if (any_eval2) {
GLvector3f *in_normal = VB->NormalPtr;
GLvector3f *out_normal = &IM->v.Normal;
if (ctx->Eval.Map2Vertex4)
{
if (ctx->Eval.AutoNormal && (req & VERT_NORM))
obj = eval2_obj_norm( out, VB->NormalPtr, coord, flags, IM->Start,
4, &ctx->EvalMap.Map2Vertex4 );
if (ctx->Eval.AutoNormal && (req & VERT_NORM)) {
obj = eval2_obj_norm( out, out_normal, coord, flags,
IM->Start, 4, &ctx->EvalMap.Map2Vertex4 );
VB->NormalPtr = out_normal;
new_flags |= VERT_NORM;
}
else
obj = eval2_4f( out, coord, flags, IM->Start,
4, &ctx->EvalMap.Map2Vertex4);
4, &ctx->EvalMap.Map2Vertex4 );
}
else if (ctx->Eval.Map2Vertex3)
{
if (ctx->Eval.AutoNormal && (req & VERT_NORM))
obj = eval2_obj_norm( out, VB->NormalPtr, coord, flags, IM->Start,
3, &ctx->EvalMap.Map2Vertex3 );
if (ctx->Eval.AutoNormal && (req & VERT_NORM)) {
obj = eval2_obj_norm( out, out_normal, coord, flags,
IM->Start, 3, &ctx->EvalMap.Map2Vertex3 );
VB->NormalPtr = out_normal;
new_flags |= VERT_NORM;
}
else
obj = eval2_4f( out, coord, flags, IM->Start,
3, &ctx->EvalMap.Map2Vertex3 );
}
}
if (VB->NormalPtr != in_normal) {
if (!all_eval)
VB->NormalPtr = copy_3f( out_normal, in_normal, flags,
IM->Start );
}
}
if (obj != in && !all_eval)
obj = copy_4f( out, in, flags, IM->Start );
@@ -2582,6 +2609,7 @@ void gl_eval_vb( struct vertex_buffer *VB )
GLuint *flags = VB->Flag = VB->EvaluatedFlags;
GLuint i;
GLuint count = VB->Count;
GLuint andflag = VB->IM->AndFlag;
if (!flags) {
VB->EvaluatedFlags = (GLuint *) MALLOC(VB->Size * sizeof(GLuint));
@@ -2589,24 +2617,27 @@ void gl_eval_vb( struct vertex_buffer *VB )
}
if (all_eval) {
for (i = 0 ; i < count ; i++)
for (i = 0 ; i <= count ; i++)
flags[i] = oldflags[i] | new_flags;
andflag |= new_flags;
} else {
GLuint andflag = ~0;
for (i = 0 ; i < count ; i++) {
if (oldflags[i] & VERT_EVAL_ANY)
flags[i] = oldflags[i] | new_flags;
andflag = ~0;
for (i = 0 ; i <= count ; i++) {
flags[i] = oldflags[i];
if (flags[i] & VERT_EVAL_ANY)
flags[i] |= new_flags;
andflag &= flags[i];
}
}
VB->OrFlag |= new_flags;
VB->CullMode = (GLubyte) ((andflag & VERT_NORM) ? 0 : COMPACTED_NORMALS);
}
}
void
_mesa_MapGrid1f( GLint un, GLfloat u1, GLfloat u2 )
void gl_MapGrid1f( GLcontext* ctx, GLint un, GLfloat u1, GLfloat u2 )
{
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glMapGrid1f");
if (un<1) {
@@ -2620,18 +2651,9 @@ _mesa_MapGrid1f( GLint un, GLfloat u1, GLfloat u2 )
}
void
_mesa_MapGrid1d( GLint un, GLdouble u1, GLdouble u2 )
void gl_MapGrid2f( GLcontext* ctx, GLint un, GLfloat u1, GLfloat u2,
GLint vn, GLfloat v1, GLfloat v2 )
{
_mesa_MapGrid1f( un, u1, u2 );
}
void
_mesa_MapGrid2f( GLint un, GLfloat u1, GLfloat u2,
GLint vn, GLfloat v1, GLfloat v2 )
{
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glMapGrid2f");
if (un<1) {
gl_error( ctx, GL_INVALID_VALUE, "glMapGrid2f(un)" );
@@ -2652,185 +2674,9 @@ _mesa_MapGrid2f( GLint un, GLfloat u1, GLfloat u2,
}
void
_mesa_MapGrid2d( GLint un, GLdouble u1, GLdouble u2,
GLint vn, GLdouble v1, GLdouble v2 )
void gl_EvalMesh1( GLcontext* ctx, GLenum mode, GLint i1, GLint i2 )
{
_mesa_MapGrid2f( un, u1, u2, vn, v1, v2 );
}
/* KW: If are compiling, we don't know whether eval will produce a
* vertex when it is run in the future. If this is pure immediate
* mode, eval is a noop if neither vertex map is enabled.
*
* Thus we need to have a check in the display list code or
* elsewhere for eval(1,2) vertices in the case where
* map(1,2)_vertex is disabled, and to purge those vertices from
* the vb. This is currently done
* via modifications to the cull_vb and render_vb operations, and
* by using the existing cullmask mechanism for all other operations.
*/
/* KW: Because the eval values don't become 'current', fixup will flow
* through these vertices, and then evaluation will write on top
* of the fixup results.
*
* This is a little inefficient, but at least it is correct. This
* could be short-circuited in the case where all vertices are
* eval-vertices, or more generally by a cullmask in fixup.
*
* Note: using Obj to hold eval coord data. This data is actually
* transformed if eval is disabled. But disabling eval & sending
* eval coords is stupid, right?
*/
#define EVALCOORD1(IM, x) \
{ \
GLuint count = IM->Count++; \
IM->Flag[count] |= VERT_EVAL_C1; \
ASSIGN_4V(IM->Obj[count], x, 0, 0, 1); \
if (count == VB_MAX-1) \
IM->maybe_transform_vb( IM ); \
}
#define EVALCOORD2(IM, x, y) \
{ \
GLuint count = IM->Count++; \
IM->Flag[count] |= VERT_EVAL_C2; \
ASSIGN_4V(IM->Obj[count], x, y, 0, 1); \
if (count == VB_MAX-1) \
IM->maybe_transform_vb( IM ); \
}
#define EVALPOINT1(IM, x) \
{ \
GLuint count = IM->Count++; \
IM->Flag[count] |= VERT_EVAL_P1; \
ASSIGN_4V(IM->Obj[count], x, 0, 0, 1); \
if (count == VB_MAX-1) \
IM->maybe_transform_vb( IM ); \
}
#define EVALPOINT2(IM, x, y) \
{ \
GLuint count = IM->Count++; \
IM->Flag[count] |= VERT_EVAL_P2; \
ASSIGN_4V(IM->Obj[count], x, y, 0, 1); \
if (count == VB_MAX-1) \
IM->maybe_transform_vb( IM ); \
}
/* Lame internal function:
*/
void gl_EvalCoord1f( GLcontext *CC, GLfloat u )
{
struct immediate *i = CC->input;
EVALCOORD1( i, u );
}
void
_mesa_EvalCoord1d( GLdouble u )
{
GET_IMMEDIATE;
EVALCOORD1( IM, (GLfloat) u );
}
void
_mesa_EvalCoord1f( GLfloat u )
{
GET_IMMEDIATE;
EVALCOORD1( IM, u );
}
void
_mesa_EvalCoord1dv( const GLdouble *u )
{
GET_IMMEDIATE;
EVALCOORD1( IM, (GLfloat) *u );
}
void
_mesa_EvalCoord1fv( const GLfloat *u )
{
GET_IMMEDIATE;
EVALCOORD1( IM, (GLfloat) *u );
}
void
_mesa_EvalCoord2d( GLdouble u, GLdouble v )
{
GET_IMMEDIATE;
EVALCOORD2( IM, (GLfloat) u, (GLfloat) v );
}
void
_mesa_EvalCoord2f( GLfloat u, GLfloat v )
{
GET_IMMEDIATE;
EVALCOORD2( IM, u, v );
}
/* Lame internal function:
*/
void gl_EvalCoord2f( GLcontext *CC, GLfloat u, GLfloat v )
{
struct immediate *i = CC->input;
EVALCOORD2( i, u, v );
}
void
_mesa_EvalCoord2dv( const GLdouble *u )
{
GET_IMMEDIATE;
EVALCOORD2( IM, (GLfloat) u[0], (GLfloat) u[1] );
}
void
_mesa_EvalCoord2fv( const GLfloat *u )
{
GET_IMMEDIATE;
EVALCOORD2( IM, u[0], u[1] );
}
void
_mesa_EvalPoint1( GLint i )
{
GET_IMMEDIATE;
EVALPOINT1( IM, i );
}
void
_mesa_EvalPoint2( GLint i, GLint j )
{
GET_IMMEDIATE;
EVALPOINT2( IM, i, j );
}
void
_mesa_EvalMesh1( GLenum mode, GLint i1, GLint i2 )
{
GET_CURRENT_CONTEXT(ctx);
GLint i;
GLfloat u, du;
GLenum prim;
@@ -2870,10 +2716,11 @@ _mesa_EvalMesh1( GLenum mode, GLint i1, GLint i2 )
void
_mesa_EvalMesh2( GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2 )
void gl_EvalMesh2( GLcontext* ctx,
GLenum mode,
GLint i1, GLint i2,
GLint j1, GLint j2 )
{
GET_CURRENT_CONTEXT(ctx);
GLint i, j;
GLfloat u, du, v, dv, v1, u1;
@@ -2934,6 +2781,3 @@ _mesa_EvalMesh2( GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2 )
return;
}
}

Some files were not shown because too many files have changed in this diff Show More