Compare commits

...

212 Commits

Author SHA1 Message Date
Brian Paul
b0294cbbfe added Win32 and MacOS files to tar file list 1999-12-14 20:54:24 +00:00
Brian Paul
e2ff9be0b6 disable diagnostic printf 1999-12-14 20:51:33 +00:00
Brian Paul
16283fea40 removed bad call to fxMultipassBlend 1999-12-14 19:47:25 +00:00
Brian Paul
82ba9449e1 print messages with new message() function 1999-12-14 16:23:57 +00:00
Brian Paul
2377ea9c66 added reference to INSTALL file 1999-12-14 15:12:52 +00:00
Brian Paul
ac3593ada5 changes for 3.1 1999-12-14 07:18:57 +00:00
Brian Paul
d6dd996e56 minor 3.1 changes 1999-12-14 07:17:42 +00:00
Brian Paul
cee556daea updates for 3.1 final release 1999-12-14 07:15:38 +00:00
Brian Paul
313f225a2e removed beta from version string 1999-12-13 21:58:42 +00:00
Brian Paul
95d565b64c removed beta designation 1999-12-13 21:56:18 +00:00
Brian Paul
32ea1fdc7e applied Daryll's patches 1999-12-13 21:53:01 +00:00
Keith Whitwell
8d52ee9ae1 Added logicOp driver callback 1999-12-12 18:30:47 +00:00
Brian Paul
9a07202f5e added glXUseXFont() bugfix 1999-12-12 17:55:45 +00:00
Brian Paul
0f953d69e5 removed unneeded code in gluBuild1DMipmaps() 1999-12-12 17:23:33 +00:00
Brian Paul
b3a1034c05 bitmaps were vertically shifted by one pixel 1999-12-12 17:03:07 +00:00
Brian Paul
8956d5131d added default cases to switches to silence compiler warnings 1999-12-12 15:50:44 +00:00
Brian Paul
428cf99956 added GLX_ARB_get_proc_address to extension list 1999-12-11 09:20:03 +00:00
Brian Paul
1e5dab20fd applied patch from Ralph Giles 1999-12-10 15:54:09 +00:00
Brian Paul
aa5251d170 removed GLX_EXT_get_proc_address 1999-12-10 14:55:38 +00:00
Brian Paul
607add71d9 patches from Daryll 1999-12-10 14:21:08 +00:00
Brian Paul
074710629d added GLX_ARB_get_proc_address 1999-12-10 14:10:02 +00:00
Brian Paul
7f0b5dd69c added glXGetProcAddressARB() 1999-12-10 13:45:39 +00:00
Brian Paul
09b83c889b many functions added to gl_get_proc_address() 1999-12-10 13:45:08 +00:00
Brian Paul
9c416c235b added GLX_ARB_get_proc_address 1999-12-10 13:44:31 +00:00
Jouk Jansen
6ce3f22ae9 Committing in .
Updating compilation on VMS

 Modified Files:
  Tag: mesa_3_2_dev
 	Mesa/src-glu/descrip.mms Mesa/src-glu/gluP.h
 ----------------------------------------------------------------------
1999-12-06 05:24:36 +00:00
Gareth Hughes
32093ccc86 Removed axis-aligned plane projection stuff. I received a patch that
did this a while ago and was playing around with it, but I think it's
better to have a robust plane projection mechanism - after all, we can
be given a non-axis-aligned plane normal through gluTessNormal().
1999-12-05 17:01:17 +00:00
Gareth Hughes
d5ff1d782b Fixed contour orientation issues, so clockwise input contours will be
tessellated correctly.  Fixed text3d screensaver bugs associated with
contour orientation.

There is still a bug in the contour stacking calculations, which
causes letters like 'B' to have the inner loops oriented the wrong way
due to them being classified as outside the outer loop.  This should
be relatively straight forward to fix (see O'Rourke 1992).
1999-12-05 02:04:30 +00:00
Brian Paul
2ed8894aca Clearing stencil buffer now observes the stencil write mask
Optimized gl_depth_stencil_span/pixels() functions
1999-12-04 21:15:31 +00:00
Brian Paul
33cd8a5490 minor stencil-related changes 1999-12-04 21:13:44 +00:00
Brian Paul
dd25e9852a added glCopyPixels bug fix 1999-12-03 18:49:05 +00:00
Brian Paul
05df9bb6e0 added WM_SYSKEYDOWN case in __wglMonitor() (Eero Pajarre) 1999-12-02 15:21:04 +00:00
Gareth Hughes
a335bf404f Fixed bug in tessellatin for xlockmore's text3d screensaver. The
external maximums weren't being handled correctly.

Output contours seem to be oriented incorrectly, as they appear as
solidly-filled areas.
1999-12-02 06:18:25 +00:00
Brian Paul
783a67260a gl_BindTexture was broken when target==GL_TEXTURE_3D 1999-12-01 21:07:26 +00:00
Keith Whitwell
e99e126479 check ctx before dereferencing it 1999-12-01 12:45:42 +00:00
Keith Whitwell
98fce32683 Normal, stipple and varray bug fixes 1999-12-01 12:18:47 +00:00
Brian Paul
9493e540f9 fxInitPixelTables() change for Voodoo 1/2 vs 3 1999-12-01 01:10:42 +00:00
Brian Paul
7138d38cc1 print debug info in gl_make_current() if MESA_INFO env var set 1999-11-30 20:31:57 +00:00
Gareth Hughes
9e7f0e1f7c Fixed errors associated with Win32 build warnings. 1999-11-29 18:16:11 +00:00
Brian Paul
52345bfa1e removed Mesa-isms 1999-11-27 01:40:09 +00:00
Brian Paul
93070bceca updated for 3.1 1999-11-27 01:39:50 +00:00
Brian Paul
5b90676fc7 added a few prototypes for BeOS/g++ 1999-11-27 01:37:17 +00:00
Brian Paul
92ad030cb7 added a cast to silence a g++ warning 1999-11-27 01:35:42 +00:00
Brian Paul
9afe0e4278 generate Z values when fog enabled (Andree Borrmann) 1999-11-26 16:28:03 +00:00
Keith Whitwell
3e63be01d1 allow drivers to request fog coordinates 1999-11-25 16:51:24 +00:00
Brian Paul
c73eedbe96 bumped version to 3.1 1999-11-24 18:39:17 +00:00
Brian Paul
8c54c4d9f7 bumped version to 3.1, updated copyright 1999-11-24 18:38:52 +00:00
Keith Whitwell
33817940c4 another typo 1999-11-23 21:13:55 +00:00
Miklos Fazekas
7ec2e161ac Glide3 now uses the same layout as Glide2. 1999-11-23 18:29:53 +00:00
Brian Paul
fc2e8cd0d0 fixed new cut/paste error in FX_grSstWinOpen() call 1999-11-23 13:30:15 +00:00
Brian Paul
a3ea9edfda removed GL_EXT_get_proc_address from ext strings 1999-11-22 22:19:50 +00:00
Brian Paul
7fa9891de2 removed GLU_EXT_get_proc_address from ext string 1999-11-22 22:18:13 +00:00
Brian Paul
ddd9410a67 potential bug fix and clean-up in gl_ShadeModel() 1999-11-22 19:01:39 +00:00
Brian Paul
532dde3e99 fixed shade model bug (A.Borrmann) 1999-11-22 18:26:51 +00:00
Brian Paul
2a6f393fa7 added pragma 4615 (Eero), added copyright 1999-11-22 14:05:15 +00:00
Brian Paul
2d1b9e0402 removed redundant fxCloseHardware() decl 1999-11-22 14:01:35 +00:00
Brian Paul
19c878467f removed reference to GL_EXT_texture_env_add 1999-11-22 13:54:02 +00:00
Miklos Fazekas
1041d573ff Fixed FXMESA_USE_ARGB. 1999-11-21 05:52:10 +00:00
Miklos Fazekas
fda834160b Created the correct pixel table with:FXMESA_USE_ARGB. 1999-11-21 05:38:26 +00:00
Miklos Fazekas
7d35435bb6 Added gl_extension_is_enabled. 1999-11-20 13:13:50 +00:00
Gareth Hughes
5c191a62bc Fixed exterior intersection point insertion. Removed flag from vertex
left over from previous clipping algorithms.  Self-intersecting
contours are now tessellated correctly.
1999-11-20 02:37:20 +00:00
Brian Paul
eca3b6e47e replace encounteed with encountered 1999-11-19 21:22:07 +00:00
Miklos Fazekas
aa0a8624fb Removed #ifdef form inside a macro call. 1999-11-19 15:40:47 +00:00
Miklos Fazekas
f16a627115 Added GL_ADD. 1999-11-19 15:31:05 +00:00
Miklos Fazekas
1d39975c4e Added gl_extension_is_enabled. 1999-11-19 15:29:51 +00:00
Keith Whitwell
62d5f4c73e fixes for andree's drawarrays problems 1999-11-19 00:00:09 +00:00
Brian Paul
d42cd99c66 two fixes in gl_DrawArrays (Andree Borrman) 1999-11-18 23:54:25 +00:00
Brian Paul
03ef882735 fixed FX_grSstControl(), now returns FxBool 1999-11-18 19:31:08 +00:00
Brian Paul
19d0fcafb3 removed unused fxTMNewTMFreeNode decl 1999-11-18 19:30:27 +00:00
Brian Paul
cc6e92ff49 merge from 3.3 branch of Daryll's X server changes 1999-11-18 19:18:44 +00:00
Brian Paul
463c2b6b77 test visinfo, not vishandle in save_glx_visual (Wolfram Gloger) 1999-11-18 15:16:03 +00:00
Brian Paul
09c133e16f fixed some glitches (Eero Pajarre) 1999-11-17 21:21:29 +00:00
Brian Paul
bb1d3c1ad1 new PixelTo[RGB] lookup tables for pixel readback 1999-11-16 19:47:47 +00:00
Brian Paul
cabb6a91cd also remove .lo .la and .libs/ 1999-11-16 15:25:50 +00:00
Gareth Hughes
c76ac6b644 Added combine callback. Converted vertices from ints to floats. 1999-11-16 11:09:09 +00:00
Gareth Hughes
6842075a09 Fixed some vertex insertion bugs. Added boundary intersection
handling, although it is still slightly broken.  Horizontal edges need
to make it into the AET table, I think.  This will fix book/tess at
least, and possibly book/tesswind as well.
1999-11-16 11:07:22 +00:00
Brian Paul
b1da189fe5 removed unused finished: label 1999-11-15 22:21:18 +00:00
Brian Paul
9b635315be fixed several texture state update bugs found with objbug.c program 1999-11-15 22:17:44 +00:00
Gareth Hughes
702baf4cd3 Added scanbeam polygon clipping for intersection handling and boolean
operations.  Lots of other bug fixes and code cleanups.
1999-11-15 21:21:31 +00:00
Gareth Hughes
b27ee886e4 Added new tessellation polygon clipping file tess_clip.c 1999-11-15 21:15:43 +00:00
Josh Vanderhoof
276465cec6 fixed SSE bugs 1999-11-13 02:34:02 +00:00
Brian Paul
5428538d65 added 3.1 final section 1999-11-12 15:45:45 +00:00
Brian Paul
ab5d4d6233 added glxdpyinfo 1999-11-12 15:43:25 +00:00
Brian Paul
2450ce124b initial check-in 1999-11-12 15:43:12 +00:00
Brian Paul
cf22eb77a7 added some braces to silence gcc warnings 1999-11-12 00:13:33 +00:00
Brian Paul
569802cdb1 added missing braces in array initializations 1999-11-11 15:05:27 +00:00
Brian Paul
37ff9433c0 added missing braces in array initializations 1999-11-11 14:37:24 +00:00
sio
3d993b7dee Added missing GLAPIENTRY to glConvolution* and glCopy* 1999-11-11 14:11:16 +00:00
Jouk Jansen
d1aeac8d1d version 3.3 update 1999-11-11 09:57:57 +00:00
Jouk Jansen
86d36643de tess_macro.h included 1999-11-11 09:55:39 +00:00
Kendall Bennett
a73119234c . 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.
1999-11-11 03:21:43 +00:00
Brian Paul
cb5ecb883e initial changes for Mesa 3.3 1999-11-11 01:28:16 +00:00
Brian Paul
fbd8f212c3 first big check-in of new Mesa 3.3 code 1999-11-11 01:22:25 +00:00
Keith Whitwell
06ac59281b fix for colormaterial 1999-11-10 06:29:44 +00:00
Keith Whitwell
6adfc6bd9e use glClientActiveTexture in interleaved setup 1999-11-09 17:26:15 +00:00
Keith Whitwell
6a9f16edae more fixes for glDrawArrays 1999-11-09 17:00:25 +00:00
Keith Whitwell
20f6c10b41 second try at drawarrays fix 1999-11-09 10:12:34 +00:00
Keith Whitwell
e43a3aa293 fix for (some of?) the vertex array problems 1999-11-09 09:18:40 +00:00
Brian Paul
f6a79d045c fixed typo: replaced |= with != in conditional 1999-11-09 07:59:54 +00:00
Brian Paul
0822c1050e replace GLint with GLsizei in a gluScaleImage, gluBuild1/2DMipmaps() 1999-11-09 06:16:59 +00:00
Brian Paul
c00c0b323f header includes clean-up (Daryll) 1999-11-08 15:29:43 +00:00
Brian Paul
99f16d01dd changes to silence MSVC warnings 1999-11-08 15:28:08 +00:00
Brian Paul
19f90e35ff flush pb after each line segment - for conformance 1999-11-08 14:36:32 +00:00
Brian Paul
327c69127c clean-up of header includes (Daryll) 1999-11-08 07:36:43 +00:00
Gareth Hughes
787250cc01 Added filename, line number output for debugging messages. 1999-11-05 20:36:55 +00:00
Ted Jump
f7190d4b1f turned off 'conditional expression is constant' warning for win32 1999-11-05 18:20:31 +00:00
Brian Paul
94acb57278 removed printf's 1999-11-05 08:12:46 +00:00
Brian Paul
17407de73a added xfont demo 1999-11-05 08:01:17 +00:00
Brian Paul
f1b45ca254 new xfont demo 1999-11-05 08:00:49 +00:00
Brian Paul
5b37c32274 clean-up to reduce MSVC warnings 1999-11-05 06:43:10 +00:00
Keith Whitwell
30990a65f8 Fix for glerror on compilation of list containing gldrawelements calls 1999-11-04 19:42:28 +00:00
Gareth Hughes
486e1f982e Major winding rule updates, especially stacked contour support.
Improved debugging output that can be altered with an environment
variable instead of hard coded at compile time.  Fixed bug in vertex
sorting function, so vertices are now indexed correctly (left to right).
1999-11-04 04:07:57 +00:00
Gareth Hughes
eb459c6070 Updated demo for new GLU 1.3 tessellation. Added optimized rendering
by saving the output of the tessellation into display lists.
1999-11-04 04:00:42 +00:00
Gareth Hughes
64e10feb25 Changed ($MAKE) to $(MAKE) to allow real-clean to work correctly. 1999-11-04 03:57:28 +00:00
Miklos Fazekas
6bc96bfebe Added glColorTable, etc. 1999-11-04 00:43:09 +00:00
Brian Paul
5b6677da16 include assert.h with rest of system headers 1999-11-03 19:27:41 +00:00
Josh Vanderhoof
0dd75e2884 swap operand order for Intel style REGOFF 1999-11-03 18:50:44 +00:00
Brian Paul
b09a4cd913 added another fast-path in _mesa_unpack_ubyte_color_spa(), more comments 1999-11-03 18:24:05 +00:00
Brian Paul
c3f0a511a7 new texture image processing 1999-11-03 17:27:05 +00:00
Brian Paul
d51b2c99d5 new texture image, cleaned-up code 1999-11-02 15:09:04 +00:00
Brian Paul
306b3b02b7 added linux-glide-debug config 1999-11-02 10:11:44 +00:00
Brian Paul
03d96a0ce2 fixed a typo in a comment 1999-10-31 08:34:47 +00:00
Ted Jump
38136ec3dd Changed over to maximal warnings on Win32 builds. 1999-10-30 18:39:06 +00:00
Ted Jump
364b56a20e Added checking for FXMESA_USE_ARGB to disable pixel reformatting when not appropriate 1999-10-30 18:34:48 +00:00
Brian Paul
12cc2bfff7 pixel pack/unpack ImageHeight and SkipImages was not initialized 1999-10-30 08:22:45 +00:00
Brian Paul
3c14ec9b55 added a few more scale/bias/lookup functions (for future use) 1999-10-30 08:20:57 +00:00
Brian Paul
8de4a38777 minor changes to Usage() function 1999-10-28 18:23:29 +00:00
Brian Paul
0144a50f04 removed -lm from link command 1999-10-27 10:09:53 +00:00
Brian Paul
be12aecc59 added -lm to XLIBS for all configs 1999-10-27 10:09:27 +00:00
Brian Paul
4a867fcbf5 disabled glXGetProcAddress code 1999-10-27 09:50:10 +00:00
Brian Paul
38a811057d disabled gluGetProcAddressEXT 1999-10-27 09:47:41 +00:00
Brian Paul
d865227d21 removed cvs history logs and old comments 1999-10-27 09:46:07 +00:00
Brian Paul
782ca03d6d removed glXGetProcAddressEXT 1999-10-27 09:44:10 +00:00
Brian Paul
c7af1b0b94 removed gluGetProcAddressEXT() 1999-10-27 09:43:48 +00:00
Brian Paul
9a19ccb578 better texture matrix, better end-cap reflections on cylinder 1999-10-26 17:08:31 +00:00
Brian Paul
98b607b57d fixed stupid error in GL_RGA case in gl_pack_rgba_span() 1999-10-26 09:21:04 +00:00
Brian Paul
20cdbc068e more comments, removed unneeded glDepthFunc call 1999-10-23 08:12:23 +00:00
Brian Paul
83435611c8 added gloss demo 1999-10-22 20:35:17 +00:00
Brian Paul
bb1119fd44 initial rev 1999-10-22 20:34:57 +00:00
Brian Paul
64b7da799f fixed byteswapping bug in gl_pack_rgba_span() 1999-10-22 12:49:52 +00:00
Brian Paul
3428162e27 added optimized GL_RGB, GL_UNSIGNED_BYTE case to gl_pack_rgba_span) 1999-10-22 10:59:15 +00:00
Brian Paul
e261963104 removed revision history info 1999-10-22 10:47:58 +00:00
Brian Paul
a6f09fa880 define GLUAPI, GLAPIENTRY and GLCALLBACK to nothing if not using Mesa's gl.h 1999-10-22 10:47:01 +00:00
Brian Paul
a460e65028 minor clean-up of linux-elf-debug target 1999-10-22 10:46:06 +00:00
Brian Paul
64a79b2f3a applied Jonn Carmack's patch for faster glTexSubImage2D() in Quake 1999-10-22 10:43:35 +00:00
Brian Paul
d13c0a90c7 added f key to toggle front/back drawing 1999-10-21 22:13:58 +00:00
Brian Paul
ac12609099 added -info command line option 1999-10-21 16:39:06 +00:00
Brian Paul
bc937424f1 updated some comments/docs 1999-10-21 12:46:27 +00:00
Brian Paul
5393bb3830 silenced some uninitialized var warnings 1999-10-21 12:45:53 +00:00
Brian Paul
fc811e2bfd silenced ininitialized var warnings 1999-10-21 12:45:03 +00:00
Brian Paul
88737eeedc silenced uninitialized variable warnings 1999-10-21 12:26:21 +00:00
Ted Jump
b19ba7827c Added pragma to disable warning about unk pragmas for MSVC5 1999-10-21 06:04:20 +00:00
Brian Paul
2fb055d891 clean-up of optimized GL_RETURN code 1999-10-20 22:39:16 +00:00
Brian Paul
34c7c1838a fixed divTable precision problem in GL_RETURN case 1999-10-20 22:32:02 +00:00
Brian Paul
2c318aad9d enable lighting even if no light sources are turned on 1999-10-20 22:16:45 +00:00
Holger Waechtler
456935a65e added X86/vertex.S and X86/vertex_3dnow.S to ASM_SOURCES 1999-10-20 11:45:39 +00:00
Ted Jump
3f17dfb8ba Minor patches to cleanup some compiler warnings in MSVC 1999-10-20 06:56:40 +00:00
Brian Paul
d53573daf7 fixed a number of error-test bugs 1999-10-19 20:36:20 +00:00
Brian Paul
bc41b08073 more image type error checking in draw_stencil_pixels() 1999-10-19 20:33:57 +00:00
Brian Paul
f3f9b77324 clean-up in gl_LightModelfv() 1999-10-19 20:32:40 +00:00
Brian Paul
351752caff added more format/type error checking code 1999-10-19 20:31:08 +00:00
Keith Whitwell
d471473b58 Changes to reduce the memory footprint of display lists 1999-10-19 18:37:02 +00:00
Brian Paul
52880f85b5 GL_MAX_ELEMENTS_VERTICES/INDICES enums had wrong values 1999-10-17 23:24:49 +00:00
Brian Paul
91baaa3d5a negative offsets to TexSubImage w/ texture borders caused memory corruption 1999-10-17 23:24:16 +00:00
Brian Paul
1e083c8c17 added glGet cases for vertex array enable state 1999-10-17 22:36:35 +00:00
Brian Paul
c782c911e9 more ARB_imaging colortable functions 1999-10-17 21:42:32 +00:00
Brian Paul
053f2020ca added missing GL_ARB_imaging color table functions 1999-10-17 20:18:15 +00:00
Miklos Fazekas
b9d8c77ca6 Fixed a MacOS specific compile error. 1999-10-16 12:53:37 +00:00
Miklos Fazekas
bc95b2f07e Added glGetMinmax 1999-10-16 12:52:56 +00:00
Brian Paul
d95e2eb1a8 removed GL_EXT_get_proc_address 1999-10-16 11:32:15 +00:00
Brian Paul
b80429e49e removed GL_EXT_get_proc_address 1999-10-16 11:27:02 +00:00
Brian Paul
c6dddaa692 added sco5 config 1999-10-15 22:00:07 +00:00
Brian Paul
251ba69ffc replaced glGetMinMax() with glGetMinmax() 1999-10-15 21:59:23 +00:00
Brian Paul
42f252fc06 fixed an RGB vs CI bug in overlay visual selection 1999-10-14 18:47:37 +00:00
Gareth Hughes
3df50407a3 Added point_contour_test, taken from O'Rourke 1998. 1999-10-14 07:44:41 +00:00
Ted Jump
56a5f8820f Fixed parameter type for notify function pointer parameter to gl_extensions_add 1999-10-13 22:09:09 +00:00
Gareth Hughes
6450917496 Removed CVS logs from files, as they were getting rather large. 1999-10-13 19:12:25 +00:00
Gareth Hughes
206abd9039 Added edge flag callback support. 1999-10-13 19:01:56 +00:00
Brian Paul
80af3614d8 now using MALLOC, CALLOC, FREE, etc macros 1999-10-13 18:49:47 +00:00
Brian Paul
bd5cdaf444 removed GL_ prefix from memory macros 1999-10-13 18:42:49 +00:00
Brian Paul
1a3b8ffe01 use texture objects now 1999-10-13 12:02:13 +00:00
Gareth Hughes
f80d0b2f61 Fixed delete_all_contours memory deallocation. 1999-10-12 21:26:06 +00:00
Gareth Hughes
2e4fce138c Updated memory allocation to allow new macros to be used. 1999-10-12 18:49:28 +00:00
Gareth Hughes
21a257d25b Renamed GLUtesselator user data pointer to avoid confusion. 1999-10-11 17:53:09 +00:00
Gareth Hughes
dbecc01c6e Correctly initialized GLUtesselator user data pointer. 1999-10-11 17:48:53 +00:00
Gareth Hughes
4aaafa6265 Allow debugging output capture under Win32. This seems really
broken to me, but that's Windows for you...
1999-10-11 17:28:05 +00:00
Gareth Hughes
c30627a5af Updated debugging output. I'm going to change it all to something
much more like the GLX project.  This was a set of macros left over
from a research project I'd done, and I like the GLX logging more.
1999-10-11 17:26:48 +00:00
Jouk Jansen
cd555f456b Repaired definition of GL_CALLOC_STRUC 1999-10-11 04:22:57 +00:00
Jouk Jansen
0b6c775f1c #include <stdlib.h> 1999-10-11 04:20:55 +00:00
Jouk Jansen
4fbb2c6279 #include <assert.h> 1999-10-11 04:20:25 +00:00
Jouk Jansen
0279e2bc3a misc -> glmisc 1999-10-11 04:17:50 +00:00
Brian Paul
567a1de666 now using GL_MALLOC, GL_FREE 1999-10-10 13:04:17 +00:00
Brian Paul
60a249d009 now using GL_MALLOC, GL_FREE 1999-10-10 12:51:29 +00:00
Brian Paul
375853e867 fixed dumb typo 1999-10-10 12:49:36 +00:00
Brian Paul
826e66a21f now using GL_MALLOC, GL_FREE 1999-10-10 12:40:54 +00:00
Brian Paul
d77fa30761 added memory macros 1999-10-10 12:39:04 +00:00
Josh Vanderhoof
73d03344f4 no underscore prefix for freebsd >= 3 (Simon Walton) 1999-10-09 23:20:23 +00:00
Brian Paul
6e6d4c66bd texture units now share default texture objects 1999-10-09 20:17:07 +00:00
Brian Paul
7ec8d588ab fixed reference count bug in save_TexImage3DEXT() 1999-10-09 10:01:46 +00:00
Keith Whitwell
f8b3fc5454 fixed voodoo initialization 1999-10-08 11:07:54 +00:00
Keith Whitwell
485f040741 Fixed includes & added a few hooks for the DRI. 1999-10-08 09:27:09 +00:00
Miklos Fazekas
a7313e045d Added PARB support. 1999-10-05 19:51:15 +00:00
Miklos Fazekas
3af541c541 Added gl_ext_multitexture_ADD suport. 1999-10-05 19:50:45 +00:00
Miklos Fazekas
37290c844c Added packed ARGB support. 1999-10-05 19:49:41 +00:00
Miklos Fazekas
1076e7cd21 Packed RGBA support. 1999-10-05 19:26:54 +00:00
Miklos Fazekas
6a659315cd Packed RGB support. 1999-10-05 19:00:11 +00:00
Miklos Fazekas
2ed47d29c6 Added support for GL_ext_texture_add 1999-10-05 18:48:49 +00:00
Miklos Fazekas
d598ca05e1 Minor cleanup. 1999-10-05 18:40:17 +00:00
Jouk Jansen
08a454c7af Added tess_winding.c for compilation 1999-10-04 05:26:46 +00:00
Gareth Hughes
dcf11bdb93 Fixed overflow bug in combineCallback. 1999-10-03 01:00:33 +00:00
Gareth Hughes
63fee8b3be Added tessellation winding rule support. Misc bug fixes. 1999-10-03 00:56:07 +00:00
Gareth Hughes
45b95f048d Added tessellation winding rule files. 1999-10-03 00:53:38 +00:00
Keith Whitwell
69cfdb2fcb more hooks for mga driver, including an immediate fastpath 1999-09-30 11:18:21 +00:00
143 changed files with 21601 additions and 10170 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -1,4 +1,4 @@
# $Id: Makefile.X11,v 1.9 1999/09/20 21:06:57 keithw Exp $
# $Id: Makefile.X11,v 1.12.2.2 1999/12/14 20:54:24 brianp Exp $
# Mesa 3-D graphics library
# Version: 3.1
@@ -104,6 +104,7 @@ default:
@echo " make pgi-mingw32 for mingW32 with Portland Group, Inc. compiler"
@echo " make qnx for QNX V4 systems with Watcom compiler"
@echo " make sco for SCO Unix systems with ODT"
@echo " make sco5 for SCO 5.0.5 OpenServer Unix"
@echo " make solaris-x86 for PCs with Solaris"
@echo " make solaris-x86-gcc for PCs with Solaris using GCC"
@echo " make sunos4 for Suns with SunOS 4.x"
@@ -139,7 +140,7 @@ aix aix-sl amix bsdos bsdos4 dgux freebsd freebsd-386 gcc \
hpux9 hpux9-sl hpux9-gcc hpux9-gcc-sl \
hpux10 hpux10-sl hpux10-gcc hpux10-gcc-sl \
irix4 irix5 irix5-gcc irix5-dso irix6-o32 irix6-o32-dso \
linux linux-debug linux-prof linux-elf linux-elf-debug \
linux linux-debug linux-prof linux-elf linux-elf-debug linux-glide-debug \
linux-glide linux-386-glide linux-386-opt-glide \
linux-386-opt-V2-glide \
linux-386 linux-386-elf \
@@ -151,7 +152,7 @@ linux-sparc \
linux-sparc5-elf \
linux-sparc-ultra \
lynxos machten-2.2 machten-4.0 \
mklinux netbsd osf1 osf1-sl openbsd qnx sco \
mklinux netbsd osf1 osf1-sl openbsd qnx sco sco5 \
solaris-x86 solaris-x86-gcc sunSolaris-CC \
sunos4 sunos4-sl sunos4-gcc sunos4-gcc-sl sunos4-gcc-x11r6-sl \
sunos5 sunos5-sl sunos5-ultra sunos5-ultra-sl sunos5-gcc sunos5-gcc-sl \
@@ -308,108 +309,108 @@ realclean: clean
cd xdemos && $(MAKE) -f Makefile.X11 realclean || true
cd book && $(MAKE) -f Makefile.X11 realclean || true
cd samples && $(MAKE) -f Makefile.X11 realclean || true
cd ggi/demos && ($MAKE) -f Makefile.X11 realclean || true
cd ggi/demos && $(MAKE) -f Makefile.X11 realclean || true
cd src/GGI/default && $(MAKE) -f Makefile.X11 realclean || true
DIRECTORY = Mesa-3.1
LIB_NAME = MesaLib-3.1beta3
DEMO_NAME = MesaDemos-3.1beta3
LIB_NAME = MesaLib-3.1
DEMO_NAME = MesaDemos-3.1
LIB_FILES = \
$(DIRECTORY)/Makefile* \
$(DIRECTORY)/Make-config \
$(DIRECTORY)/acconfig.h \
$(DIRECTORY)/acinclude.m4 \
$(DIRECTORY)/aclocal.m4 \
$(DIRECTORY)/conf.h.in \
$(DIRECTORY)/config.guess \
$(DIRECTORY)/config.sub \
$(DIRECTORY)/configure \
$(DIRECTORY)/configure.in \
$(DIRECTORY)/install-sh \
$(DIRECTORY)/ltconfig \
$(DIRECTORY)/ltmain.sh \
$(DIRECTORY)/missing \
$(DIRECTORY)/mkinstalldirs \
$(DIRECTORY)/stamp-h.in \
$(DIRECTORY)/configure \
$(DIRECTORY)/docs/CONFIG \
$(DIRECTORY)/docs/CONFORM \
$(DIRECTORY)/docs/COPYING \
$(DIRECTORY)/docs/COPYRIGHT \
$(DIRECTORY)/docs/DEVINFO \
$(DIRECTORY)/docs/IAFA-PACKAGE \
$(DIRECTORY)/docs/INSTALL \
$(DIRECTORY)/docs/INSTALL.GNU \
$(DIRECTORY)/docs/README \
$(DIRECTORY)/docs/README.* \
$(DIRECTORY)/docs/RELNOTES \
$(DIRECTORY)/docs/VERSIONS \
$(DIRECTORY)/docs/*.spec \
$(DIRECTORY)/bin/README \
$(DIRECTORY)/bin/mklib* \
$(DIRECTORY)/*.BAT \
$(DIRECTORY)/*.bat \
$(DIRECTORY)/descrip.mms \
$(DIRECTORY)/mms-config \
$(DIRECTORY)/xlib.opt \
$(DIRECTORY)/STARTUP.MK \
$(DIRECTORY)/mesawin32.mak \
$(DIRECTORY)/Names.win \
$(DIRECTORY)/win32-openstep.sh \
$(DIRECTORY)/*.dja \
$(DIRECTORY)/include/GL/Makefile.in \
$(DIRECTORY)/include/GL/Makefile.am \
$(DIRECTORY)/include/GL/dosmesa.h \
$(DIRECTORY)/include/GL/foomesa.h \
$(DIRECTORY)/include/GL/fxmesa.h \
$(DIRECTORY)/include/GL/ggimesa.h \
$(DIRECTORY)/include/GL/gl.h \
$(DIRECTORY)/include/GL/gl_mangle.h \
$(DIRECTORY)/include/GL/glu.h \
$(DIRECTORY)/include/GL/glu_mangle.h \
$(DIRECTORY)/include/GL/glx.h \
$(DIRECTORY)/include/GL/glx_mangle.h \
$(DIRECTORY)/include/GL/mglmesa.h \
$(DIRECTORY)/include/GL/osmesa.h \
$(DIRECTORY)/include/GL/svgamesa.h \
$(DIRECTORY)/include/GL/wmesa.h \
$(DIRECTORY)/include/GL/xmesa.h \
$(DIRECTORY)/include/GL/xmesa_x.h \
$(DIRECTORY)/include/GL/xmesa_xf86.h \
$(DIRECTORY)/include/GLView.h \
$(DIRECTORY)/include/Makefile.in \
$(DIRECTORY)/include/Makefile.am \
$(DIRECTORY)/src/Makefile* \
$(DIRECTORY)/src/descrip.mms \
$(DIRECTORY)/src/mms_depend \
$(DIRECTORY)/src/mesa.conf \
$(DIRECTORY)/src/*.def \
$(DIRECTORY)/src/depend \
$(DIRECTORY)/src/*.[chS] \
$(DIRECTORY)/src/Allegro/*.[ch] \
$(DIRECTORY)/src/BeOS/*.cpp \
$(DIRECTORY)/src/D3D/*.cpp \
$(DIRECTORY)/src/D3D/*.CPP \
$(DIRECTORY)/src/D3D/*.h \
$(DIRECTORY)/src/D3D/*.H \
$(DIRECTORY)/src/D3D/*.c \
$(DIRECTORY)/src/D3D/*.C \
$(DIRECTORY)/src/D3D/MAKEFILE \
$(DIRECTORY)/src/D3D/*bat \
$(DIRECTORY)/src/D3D/*DEF \
$(DIRECTORY)/src/DOS/DEPEND.DOS \
$(DIRECTORY)/src/DOS/*.c \
$(DIRECTORY)/src/FX/Makefile.am \
$(DIRECTORY)/src/FX/Makefile.in \
$(DIRECTORY)/src/FX/*.[ch] \
$(DIRECTORY)/src/FX/*.def \
$(DIRECTORY)/src/FX/X86/Makefile.am \
$(DIRECTORY)/src/FX/X86/Makefile.in \
$(DIRECTORY)/src/FX/X86/*.[Shc] \
$(DIRECTORY)/Makefile* \
$(DIRECTORY)/Make-config \
$(DIRECTORY)/acconfig.h \
$(DIRECTORY)/acinclude.m4 \
$(DIRECTORY)/aclocal.m4 \
$(DIRECTORY)/conf.h.in \
$(DIRECTORY)/config.guess \
$(DIRECTORY)/config.sub \
$(DIRECTORY)/configure \
$(DIRECTORY)/configure.in \
$(DIRECTORY)/install-sh \
$(DIRECTORY)/ltconfig \
$(DIRECTORY)/ltmain.sh \
$(DIRECTORY)/missing \
$(DIRECTORY)/mkinstalldirs \
$(DIRECTORY)/stamp-h.in \
$(DIRECTORY)/configure \
$(DIRECTORY)/docs/CONFIG \
$(DIRECTORY)/docs/CONFORM \
$(DIRECTORY)/docs/COPYING \
$(DIRECTORY)/docs/COPYRIGHT \
$(DIRECTORY)/docs/DEVINFO \
$(DIRECTORY)/docs/IAFA-PACKAGE \
$(DIRECTORY)/docs/INSTALL \
$(DIRECTORY)/docs/INSTALL.GNU \
$(DIRECTORY)/docs/README \
$(DIRECTORY)/docs/README.* \
$(DIRECTORY)/docs/RELNOTES \
$(DIRECTORY)/docs/VERSIONS \
$(DIRECTORY)/docs/*.spec \
$(DIRECTORY)/bin/README \
$(DIRECTORY)/bin/mklib* \
$(DIRECTORY)/*.BAT \
$(DIRECTORY)/*.bat \
$(DIRECTORY)/descrip.mms \
$(DIRECTORY)/mms-config \
$(DIRECTORY)/xlib.opt \
$(DIRECTORY)/STARTUP.MK \
$(DIRECTORY)/mesawin32.mak \
$(DIRECTORY)/Names.win \
$(DIRECTORY)/win32-openstep.sh \
$(DIRECTORY)/*.dja \
$(DIRECTORY)/include/GL/Makefile.in \
$(DIRECTORY)/include/GL/Makefile.am \
$(DIRECTORY)/include/GL/dosmesa.h \
$(DIRECTORY)/include/GL/foomesa.h \
$(DIRECTORY)/include/GL/fxmesa.h \
$(DIRECTORY)/include/GL/ggimesa.h \
$(DIRECTORY)/include/GL/gl.h \
$(DIRECTORY)/include/GL/gl_mangle.h \
$(DIRECTORY)/include/GL/glu.h \
$(DIRECTORY)/include/GL/glu_mangle.h \
$(DIRECTORY)/include/GL/glx.h \
$(DIRECTORY)/include/GL/glx_mangle.h \
$(DIRECTORY)/include/GL/mglmesa.h \
$(DIRECTORY)/include/GL/osmesa.h \
$(DIRECTORY)/include/GL/svgamesa.h \
$(DIRECTORY)/include/GL/wmesa.h \
$(DIRECTORY)/include/GL/xmesa.h \
$(DIRECTORY)/include/GL/xmesa_x.h \
$(DIRECTORY)/include/GL/xmesa_xf86.h \
$(DIRECTORY)/include/GLView.h \
$(DIRECTORY)/include/Makefile.in \
$(DIRECTORY)/include/Makefile.am \
$(DIRECTORY)/src/Makefile* \
$(DIRECTORY)/src/descrip.mms \
$(DIRECTORY)/src/mms_depend \
$(DIRECTORY)/src/mesa.conf \
$(DIRECTORY)/src/*.def \
$(DIRECTORY)/src/depend \
$(DIRECTORY)/src/*.[chS] \
$(DIRECTORY)/src/Allegro/*.[ch] \
$(DIRECTORY)/src/BeOS/*.cpp \
$(DIRECTORY)/src/D3D/*.cpp \
$(DIRECTORY)/src/D3D/*.CPP \
$(DIRECTORY)/src/D3D/*.h \
$(DIRECTORY)/src/D3D/*.H \
$(DIRECTORY)/src/D3D/*.c \
$(DIRECTORY)/src/D3D/*.C \
$(DIRECTORY)/src/D3D/MAKEFILE \
$(DIRECTORY)/src/D3D/*bat \
$(DIRECTORY)/src/D3D/*DEF \
$(DIRECTORY)/src/DOS/DEPEND.DOS \
$(DIRECTORY)/src/DOS/*.c \
$(DIRECTORY)/src/FX/Makefile.am \
$(DIRECTORY)/src/FX/Makefile.in \
$(DIRECTORY)/src/FX/*.[ch] \
$(DIRECTORY)/src/FX/*.def \
$(DIRECTORY)/src/FX/X86/Makefile.am \
$(DIRECTORY)/src/FX/X86/Makefile.in \
$(DIRECTORY)/src/FX/X86/*.[Shc] \
$(DIRECTORY)/src/GGI/Makefile.am \
$(DIRECTORY)/src/GGI/Makefile.in \
$(DIRECTORY)/src/GGI/*.[ch] \
@@ -429,55 +430,67 @@ LIB_FILES = \
$(DIRECTORY)/src/GGI/include/ggi/mesa/Makefile.am \
$(DIRECTORY)/src/GGI/include/ggi/mesa/Makefile.in \
$(DIRECTORY)/src/GGI/include/ggi/mesa/*.h \
$(DIRECTORY)/src/KNOWN_BUGS \
$(DIRECTORY)/src/MGL/*.[ch] \
$(DIRECTORY)/src/MGL/*.txt \
$(DIRECTORY)/src/OSmesa/Makefile.am \
$(DIRECTORY)/src/OSmesa/Makefile.in \
$(DIRECTORY)/src/OSmesa/*.[ch] \
$(DIRECTORY)/src/S3/*.[ch] \
$(DIRECTORY)/src/S3/*.def \
$(DIRECTORY)/src/S3/*.mak \
$(DIRECTORY)/src/S3/*.rc \
$(DIRECTORY)/src/SVGA/Makefile.am \
$(DIRECTORY)/src/SVGA/Makefile.in \
$(DIRECTORY)/src/SVGA/*.[ch] \
$(DIRECTORY)/src/Windows/*.[ch] \
$(DIRECTORY)/src/Windows/*.def \
$(DIRECTORY)/src/X/Makefile.am \
$(DIRECTORY)/src/X/Makefile.in \
$(DIRECTORY)/src/X/*.[ch] \
$(DIRECTORY)/src/X86/*.[ch] \
$(DIRECTORY)/src/X86/Makefile.am \
$(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)/util/README \
$(DIRECTORY)/util/Makefile.am \
$(DIRECTORY)/util/Makefile.in \
$(DIRECTORY)/util/*.[ch] \
$(DIRECTORY)/util/sampleMakefile \
$(DIRECTORY)/BeOS/Makefile \
$(DIRECTORY)/BeOS/*.cpp
# old stuff
# $(DIRECTORY)/Win32 \
# $(DIRECTORY)/win32
# $(DIRECTORY)/OpenStep \
#
#
$(DIRECTORY)/src/KNOWN_BUGS \
$(DIRECTORY)/src/MGL/*.[ch] \
$(DIRECTORY)/src/MGL/*.txt \
$(DIRECTORY)/src/OSmesa/Makefile.am \
$(DIRECTORY)/src/OSmesa/Makefile.in \
$(DIRECTORY)/src/OSmesa/*.[ch] \
$(DIRECTORY)/src/S3/*.[ch] \
$(DIRECTORY)/src/S3/*.def \
$(DIRECTORY)/src/S3/*.mak \
$(DIRECTORY)/src/S3/*.rc \
$(DIRECTORY)/src/SVGA/Makefile.am \
$(DIRECTORY)/src/SVGA/Makefile.in \
$(DIRECTORY)/src/SVGA/*.[ch] \
$(DIRECTORY)/src/Windows/*.[ch] \
$(DIRECTORY)/src/Windows/*.def \
$(DIRECTORY)/src/X/Makefile.am \
$(DIRECTORY)/src/X/Makefile.in \
$(DIRECTORY)/src/X/*.[ch] \
$(DIRECTORY)/src/X86/*.[ch] \
$(DIRECTORY)/src/X86/Makefile.am \
$(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)/util/README \
$(DIRECTORY)/util/Makefile.am \
$(DIRECTORY)/util/Makefile.in \
$(DIRECTORY)/util/*.[ch] \
$(DIRECTORY)/util/sampleMakefile \
$(DIRECTORY)/BeOS/Makefile \
$(DIRECTORY)/BeOS/*.cpp \
$(DIRECTORY)/WIN32/NMAKE.MAK \
$(DIRECTORY)/WIN32/NMAKE.MIF \
$(DIRECTORY)/WIN32/RES/*rc \
$(DIRECTORY)/WIN32/RES/*def \
$(DIRECTORY)/WIN32/RULES/lib.* \
$(DIRECTORY)/WIN32/RULES/progs.* \
$(DIRECTORY)/macos/README \
$(DIRECTORY)/macos/gli_api/*.h \
$(DIRECTORY)/macos/include-mac/*.h \
$(DIRECTORY)/macos/libraries/*.stub \
$(DIRECTORY)/macos/libraries/*Stub \
$(DIRECTORY)/macos/projects/*.mcp \
$(DIRECTORY)/macos/projects/*.exp \
$(DIRECTORY)/macos/projects/*.h \
$(DIRECTORY)/macos/resources/*.c \
$(DIRECTORY)/macos/resources/*.r \
$(DIRECTORY)/macos/resources/*.rsrc \
$(DIRECTORY)/macos/src-agl/*.exp \
$(DIRECTORY)/macos/src-agl/*.[ch] \
$(DIRECTORY)/macos/src-gli/*.[ch]
DEMO_FILES = \

View File

@@ -28,7 +28,7 @@ working. No optimizations have been made at this time.
Compiling
Simply cd to the Mesa-3.x directory and type "make beos-r4".
In the Mesa-3.x directory type "make -f Makefile.X11 beos-r4".
When it finishes the libMesaGL.so and libMesaGLU.so libraries for
BeOS will be in the Mesa-3.x/lib/ directory.
@@ -99,4 +99,4 @@ of February, 1999.
----------------------------------------------------------------------
$Id: README.BEOS,v 1.5 1999/03/03 02:34:04 brianp Exp $
$Id: README.BEOS,v 1.5.6.1 1999/11/27 01:39:50 brianp Exp $

View File

@@ -1,9 +1,7 @@
Mesa 3.0 MITS Information
This software is distributed under the terms of the GNU Library
General Public License, see the LICENSE file for details.
[The MITS code hasn't been update for Mesa 3.1 and may no longer work]
This document is a preliminary introduction to help you get

View File

@@ -1,28 +1,35 @@
Mesa 3.0 Unix/X11 Information
Mesa 3.1 Unix/X11 Information
Installation
============
To compile the library, first type 'make' alone to see the list of system
configurations currently supported. If you see your configuration on the
list, type 'make <config>'. Most popular Unix/X workstations are currently
supported.
There are two ways to compile Mesa on Unix/X11 systems:
1. The old way:
First type 'make' alone to see the list of system
configurations currently supported. If you see your configuration on the
list, type 'make <config>'. Most popular Unix/X workstations are currently
supported.
If your system configuration is not listed by 'make', you'll have to modify
the top-level Makefile and Make-config files. There are instructions in
each file.
2. The new way:
Type './configure' and then 'make'. This uses GNU autoconfig.
See docs/INSTALL for more details.
The top-level makefile will execute the makefiles in a number of sub-
directories. When finished, the Mesa libraries will be in the Mesa-2.6/lib/
directories. When finished, the Mesa libraries will be in the Mesa-3.1/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
in the "xdemos/", "samples/", and "book/" directories for you to try out.
If you only want to compile the contents of one subdirectory you can 'cd'
to that directory and type 'make <config>' there.
If your system configuration is not listed by 'make', you'll have to modify
the top-level Makefile and Make-config files. There are instructions in
each file.
If you have compilation problems you should try to fix them and return the
patches to the author.
@@ -301,4 +308,4 @@ Summary of X-related environment variables:
----------------------------------------------------------------------
$Id: README.X11,v 3.3 1999/09/15 16:39:01 brianp Exp $
$Id: README.X11,v 3.3.2.2 1999/12/14 15:12:52 brianp Exp $

View File

@@ -1,4 +1,4 @@
$Id: VERSIONS,v 1.13 1999/09/19 20:09:00 tanner Exp $
$Id: VERSIONS,v 1.13.2.5 1999/12/14 07:17:42 brianp Exp $
Mesa Version History
@@ -659,3 +659,14 @@ Mesa Version History
- New library numbering: libGL.so.1.2.310
- New subdirectories: docs/ and bin/
- New Makefile-system (autoconf,automake,libtool)
3.1 final December 14, 1999
New:
- added demos/gloss.c
- added xdemos/glxdpyinfo.c
- added GLX_ARB_get_proc_address extension
Bug fixes:
- several vertex array bug fixes
- overlapping glCopyPixels with pixel zooming now works
- glXUseXFont() bitmaps were vertically shifted by one pixel

View File

@@ -1,40 +1,27 @@
/* $Id: fxmesa.h,v 1.1 1999/08/19 00:55:40 jtg Exp $ */
/* $Id: fxmesa.h,v 1.1.1.1.2.1 1999/11/24 18:38:52 brianp Exp $ */
/*
* Mesa 3-D graphics library
* Version: 3.1
* Copyright (C) 1995-1999 Brian Paul
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
* Copyright (C) 1999 Brian Paul All Rights Reserved.
*
* 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.
* 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:
*
* 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.
*/
/*
* $Log: fxmesa.h,v $
* Revision 1.1 1999/08/19 00:55:40 jtg
* Initial revision
*
* Revision 3.2 1999/01/03 02:46:31 brianp
* now using GLAPI and GLAPIENTRY keywords (Ted Jump)
*
* Revision 3.1 1998/04/01 03:00:28 brianp
* updated for v0.24 of 3Dfx/Glide driver
*
* Revision 3.0 1998/02/20 05:04:45 brianp
* initial rev
* 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.
*/
@@ -58,7 +45,7 @@ extern "C" {
#define FXMESA_MAJOR_VERSION 3
#define FXMESA_MINOR_VERSION 0
#define FXMESA_MINOR_VERSION 1
/*

File diff suppressed because it is too large Load Diff

View File

@@ -1,4 +1,4 @@
/* $Id: gl_mangle.h,v 1.1 1999/08/19 00:55:40 jtg Exp $ */
/* $Id: gl_mangle.h,v 1.3 1999/11/04 00:43:09 miklos Exp $ */
/*
* Mesa 3-D graphics library
@@ -344,6 +344,7 @@
#define glGetMapdv mglGetMapdv
#define glGetMapfv mglGetMapfv
#define glGetMapiv mglGetMapiv
#define glGetMinmax mglGetMinmax
#define glEvalCoord1d mglEvalCoord1d
#define glEvalCoord1f mglEvalCoord1f
#define glEvalCoord1dv mglEvalCoord1dv
@@ -394,12 +395,16 @@
#define glTexImage3DEXT mglTexImage3DEXT
#define glTexSubImage3DEXT mglTexSubImage3DEXT
#define glCopyTexSubImage3DEXT mglCopyTexSubImage3DEXT
#define glColorTable mglColorTable
#define glColorSubTable mglColorSubTable
#define glGetColorTable mglGetColorTable
#define glGetColorTableParameteriv mglGetColorTableParameteriv
#define glGetColorTableParameterfv mglGetColorTableParameterfv
#define glColorTableEXT mglColorTableEXT
#define glColorSubTableEXT mglColorSubTableEXT
#define glGetColorTableEXT mglGetColorTableEXT
#define glGetColorTableParameterfvEXT mglGetColorTableParameterfvEXT
#define glGetColorTableParameterivEXT mglGetColorTableParameterivEXT
#define glGetMinMax mglGetMinMax
#define glMultiTexCoord1dSGIS mglMultiTexCoord1dSGIS
#define glMultiTexCoord1dvSGIS mglMultiTexCoord1dvSGIS
#define glMultiTexCoord1fSGIS mglMultiTexCoord1fSGIS
@@ -508,6 +513,7 @@
#define glGetHistogramParameteriv mglGetHistogramParameteriv
#define glMinmax mglMinmax
#define glResetMinmax mglResetMinmax
#define glGetMinmax mglGetMinmax
#define glGetMinmaxParameterfv mglGetMinmaxParameterfv
#define glGetMinmaxParameteriv mglGetMinmaxParameteriv
#define glConvolutionFilter1D mglConvolutionFilter1D

View File

@@ -1,8 +1,9 @@
/* $Id: glu.h,v 1.10 1999/09/19 10:04:01 tjump Exp $ */
/* $Id: glu.h,v 1.16 1999/11/11 03:21:43 kendallb Exp $ */
/*
* Mesa 3-D graphics library
* Version: 3.1
* Version: 3.3
*
* Copyright (C) 1995-1999 Brian Paul
*
* This library is free software; you can redistribute it and/or
@@ -21,61 +22,6 @@
*/
/*
* $Log: glu.h,v $
* Revision 1.10 1999/09/19 10:04:01 tjump
* Changed name 'glGetProcAddressEXT' to 'gluGetProcAddressEXT'
*
* Revision 1.8 1999/09/17 12:21:36 brianp
* glGetProcAddressEXT changes to accomodate Win32 and non-Win32
*
* Revision 1.7 1999/09/17 02:44:19 tjump
* I changed the xxxGetProcAddressEXT function declarations to be more
* MSVC friendly. Brianp - could you verify that they describe and operate
* as intended on Linux/ETC platforms?
*
* Revision 1.6 1999/09/16 16:54:22 brianp
* GLU_EXT_get_proc_address clean-up
*
* Revision 1.5 1999/09/14 03:23:08 gareth
* Fixed GLUtriangulatorObj again (spelling).
*
* Revision 1.4 1999/09/14 01:32:58 gareth
* Fixed definition of GLUtriangluatorObj for 1.3 tessellator.
*
* Revision 1.3 1999/09/11 11:34:21 brianp
* added GLU_EXT_get_proc_address
*
* Revision 1.2 1999/09/10 02:08:18 gareth
* Added GLU 1.3 tessellation (except winding rule code).
*
* Revision 1.1.1.1 1999/08/19 00:55:40 jtg
* Imported sources
*
* Revision 3.6 1999/02/14 03:39:45 brianp
* updated for BeOS R4
*
* Revision 3.5 1999/01/03 03:02:55 brianp
* now using GLAPI and GLAPIENTRY keywords, misc Windows changes (Ted Jump)
*
* Revision 3.4 1998/12/01 02:34:27 brianp
* applied Mark Kilgard's patches from November 30, 1998
*
* Revision 3.3 1998/11/17 01:14:02 brianp
* minor changes for OpenStep compilation (pete@ohm.york.ac.uk)
*
* Revision 3.2 1998/07/26 01:36:27 brianp
* changes for Windows compilation per Ted Jump
*
* Revision 3.1 1998/06/23 00:33:08 brianp
* added some WIN32 APIENTRY, CALLBACK stuff (Eric Lassauge)
*
* Revision 3.0 1998/02/20 05:06:01 brianp
* initial rev
*
*/
#ifndef GLU_H
#define GLU_H
@@ -112,152 +58,162 @@ extern "C" {
#endif
#endif
#ifndef GLUAPI
#define GLUAPI
#endif
#define GLU_VERSION_1_1 1
#define GLU_VERSION_1_2 1
#ifndef GLAPIENTRY
#define GLAPIENTRY
#endif
#ifndef GLCALLBACK
#define GLCALLBACK
#endif
#define GLU_TRUE GL_TRUE
#define GLU_FALSE GL_FALSE
#define GLU_VERSION_1_1 1
#define GLU_VERSION_1_2 1
enum {
/* Normal vectors */
GLU_SMOOTH = 100000,
GLU_FLAT = 100001,
GLU_NONE = 100002,
#define GLU_TRUE 1
#define GLU_FALSE 0
/* Quadric draw styles */
GLU_POINT = 100010,
GLU_LINE = 100011,
GLU_FILL = 100012,
GLU_SILHOUETTE = 100013,
/* Quadric orientation */
GLU_OUTSIDE = 100020,
GLU_INSIDE = 100021,
/* Normal vectors */
#define GLU_SMOOTH 100000
#define GLU_FLAT 100001
#define GLU_NONE 100002
/* 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,
/* Quadric draw styles */
#define GLU_POINT 100010
#define GLU_LINE 100011
#define GLU_FILL 100012
#define GLU_SILHOUETTE 100013
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,
/* Quadric orientation */
#define GLU_OUTSIDE 100020
#define GLU_INSIDE 100021
/* 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,
/* 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
/* Tessellation properties */
GLU_TESS_WINDING_RULE = 100140,
GLU_TESS_BOUNDARY_ONLY = 100141,
GLU_TESS_TOLERANCE = 100142,
#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
/* 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, /* */
/* 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
/* 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,
/* Tessellation properties */
#define GLU_TESS_WINDING_RULE 100140
#define GLU_TESS_BOUNDARY_ONLY 100141
#define GLU_TESS_TOLERANCE 100142
GLU_PATH_LENGTH = 100215,
GLU_PARAMETRIC_ERROR = 100216,
GLU_DOMAIN_DISTANCE = 100217,
/* 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 /* */
GLU_MAP1_TRIM_2 = 100210,
GLU_MAP1_TRIM_3 = 100211,
/* 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
GLU_OUTLINE_POLYGON = 100240,
GLU_OUTLINE_PATCH = 100241,
#define GLU_PATH_LENGTH 100215
#define GLU_PARAMETRIC_ERROR 100216
#define GLU_DOMAIN_DISTANCE 100217
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 */
#define GLU_MAP1_TRIM_2 100210
#define GLU_MAP1_TRIM_3 100211
/* Errors */
GLU_INVALID_ENUM = 100900,
GLU_INVALID_VALUE = 100901,
GLU_OUT_OF_MEMORY = 100902,
GLU_INCOMPATIBLE_GL_VERSION = 100903,
#define GLU_OUTLINE_POLYGON 100240
#define GLU_OUTLINE_PATCH 100241
/* New in GLU 1.1 */
GLU_VERSION = 100800,
GLU_EXTENSIONS = 100801,
#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 1.0 tessellation - obsolete! ***/
/* Errors */
#define GLU_INVALID_ENUM 100900
#define GLU_INVALID_VALUE 100901
#define GLU_OUT_OF_MEMORY 100902
#define GLU_INCOMPATIBLE_GL_VERSION 100903
/* Contour types */
GLU_CW = 100120,
GLU_CCW = 100121,
GLU_INTERIOR = 100122,
GLU_EXTERIOR = 100123,
GLU_UNKNOWN = 100124,
/* New in GLU 1.1 */
#define GLU_VERSION 100800
#define GLU_EXTENSIONS 100801
/* 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
};
/*** 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
/* 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
/*
@@ -290,37 +246,37 @@ enum {
*/
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 *objx, GLdouble *objy,
GLdouble *objz );
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 );
GLUAPI const GLubyte* GLAPIENTRY gluErrorString( GLenum errorCode );
@@ -333,19 +289,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 );
GLint widthin, GLint heightin,
GLenum typein, const void *datain,
GLint widthout, GLint heightout,
GLenum typeout, void *dataout );
GLUAPI GLint GLAPIENTRY gluBuild1DMipmaps( GLenum target, GLint components,
GLint width, GLenum format,
GLenum type, const void *data );
GLint 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 );
GLint width, GLint height,
GLenum format,
GLenum type, const void *data );
@@ -360,37 +316,39 @@ 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 );
@@ -405,46 +363,47 @@ 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)() );
@@ -506,19 +465,6 @@ GLUAPI const GLubyte* GLAPIENTRY gluGetString( GLenum name );
/*
* GLU_EXT_get_proc_address extension
*/
/*
* WARNING: this extension is not finalized yet! Do not release code
* which uses this extension yet! It may change!
*/
#define GLU_EXT_get_proc_address 1
#ifdef GLU_EXT_get_proc_address
GLUAPI void (GLAPIENTRY *gluGetProcAddressEXT(const GLubyte *procName))();
#endif
#if defined(__BEOS__) || defined(__QUICKDRAW__)
#pragma export off
#endif

View File

@@ -153,25 +153,41 @@ typedef unsigned long COLORREF;
# endif /* !UNICODE */
typedef struct tagLAYERPLANEDESCRIPTOR LAYERPLANEDESCRIPTOR, *PLAYERPLANEDESCRIPTOR, *LPLAYERPLANEDESCRIPTOR;
typedef struct _GLYPHMETRICSFLOAT GLYPHMETRICSFLOAT, *PGLYPHMETRICSFLOAT, *LPGLYPHMETRICSFLOAT;
GLUTAPI int GLUTAPIENTRY wglCopyContext(HGLRC, HGLRC, unsigned int);
GLUTAPI HGLRC GLUTAPIENTRY wglCreateContext(HDC);
GLUTAPI HGLRC GLUTAPIENTRY wglCreateLayerContext(HDC, int);
GLUTAPI int GLUTAPIENTRY wglDeleteContext(HGLRC);
GLUTAPI HGLRC GLUTAPIENTRY wglGetCurrentContext(void);
GLUTAPI HDC GLUTAPIENTRY wglGetCurrentDC(void);
GLUTAPI PROC GLUTAPIENTRY wglGetProcAddress(char*);
GLUTAPI int GLUTAPIENTRY wglMakeCurrent(HDC, HGLRC);
GLUTAPI int GLUTAPIENTRY wglShareLists(HGLRC, HGLRC);
GLUTAPI int GLUTAPIENTRY wglUseFontBitmapsA(HDC, unsigned long, unsigned long, unsigned long);
GLUTAPI int GLUTAPIENTRY wglUseFontBitmapsW(HDC, unsigned long, unsigned long, unsigned long);
GLUTAPI int GLUTAPIENTRY wglUseFontOutlinesA(HDC, unsigned long, unsigned long, unsigned long, float,float, int, LPGLYPHMETRICSFLOAT);
GLUTAPI int GLUTAPIENTRY wglUseFontOutlinesW(HDC, unsigned long, unsigned long, unsigned long, float,float, int, LPGLYPHMETRICSFLOAT);
GLUTAPI int GLUTAPIENTRY wglDescribeLayerPlane(HDC, int, int, unsigned int,LPLAYERPLANEDESCRIPTOR);
GLUTAPI int GLUTAPIENTRY wglSetLayerPaletteEntries(HDC, int, int, int,const COLORREF *);
GLUTAPI int GLUTAPIENTRY wglGetLayerPaletteEntries(HDC, int, int, int,COLORREF *);
GLUTAPI int GLUTAPIENTRY wglRealizeLayerPalette(HDC, int, int);
GLUTAPI int GLUTAPIENTRY wglSwapLayerBuffers(HDC, unsigned int);
GLUTAPI int GLUTAPIENTRY SwapBuffers(HDC);
# pragma warning( push )
# pragma warning( disable : 4273 ) /* 'function' : inconsistent DLL linkage. dllexport assumed. */
# define WGLAPI __declspec(dllimport)
WGLAPI int GLAPIENTRY wglDeleteContext(HGLRC);
WGLAPI int GLAPIENTRY wglMakeCurrent(HDC,HGLRC);
WGLAPI int GLAPIENTRY wglSetPixelFormat(HDC, int, const PIXELFORMATDESCRIPTOR *);
WGLAPI int GLAPIENTRY wglSwapBuffers(HDC hdc);
WGLAPI HDC GLAPIENTRY wglGetCurrentDC(void);
WGLAPI HGLRC GLAPIENTRY wglCreateContext(HDC);
WGLAPI HGLRC GLAPIENTRY wglCreateLayerContext(HDC,int);
WGLAPI HGLRC GLAPIENTRY wglGetCurrentContext(void);
WGLAPI PROC GLAPIENTRY wglGetProcAddress(const char*);
WGLAPI int GLAPIENTRY wglChoosePixelFormat(HDC, const PIXELFORMATDESCRIPTOR *);
WGLAPI int GLAPIENTRY wglCopyContext(HGLRC, HGLRC, unsigned int);
WGLAPI int GLAPIENTRY wglDeleteContext(HGLRC);
WGLAPI int GLAPIENTRY wglDescribeLayerPlane(HDC, int, int, unsigned int,LPLAYERPLANEDESCRIPTOR);
WGLAPI int GLAPIENTRY wglDescribePixelFormat(HDC,int, unsigned int, LPPIXELFORMATDESCRIPTOR);
WGLAPI int GLAPIENTRY wglGetLayerPaletteEntries(HDC, int, int, int,COLORREF *);
WGLAPI int GLAPIENTRY wglGetPixelFormat(HDC hdc);
WGLAPI int GLAPIENTRY wglMakeCurrent(HDC, HGLRC);
WGLAPI int GLAPIENTRY wglRealizeLayerPalette(HDC, int, int);
WGLAPI int GLAPIENTRY wglSetLayerPaletteEntries(HDC, int, int, int,const COLORREF *);
WGLAPI int GLAPIENTRY wglShareLists(HGLRC, HGLRC);
WGLAPI int GLAPIENTRY wglSwapLayerBuffers(HDC, unsigned int);
WGLAPI int GLAPIENTRY wglUseFontBitmapsA(HDC, unsigned long, unsigned long, unsigned long);
WGLAPI int GLAPIENTRY wglUseFontBitmapsW(HDC, unsigned long, unsigned long, unsigned long);
WGLAPI int GLAPIENTRY wglUseFontOutlinesA(HDC, unsigned long, unsigned long, unsigned long, float,float, int, LPGLYPHMETRICSFLOAT);
WGLAPI int GLAPIENTRY wglUseFontOutlinesW(HDC, unsigned long, unsigned long, unsigned long, float,float, int, LPGLYPHMETRICSFLOAT);
WGLAPI int GLAPIENTRY SwapBuffers(HDC);
WGLAPI int GLAPIENTRY ChoosePixelFormat(HDC,const PIXELFORMATDESCRIPTOR *);
WGLAPI int GLAPIENTRY DescribePixelFormat(HDC,int,unsigned int,LPPIXELFORMATDESCRIPTOR);
WGLAPI int GLAPIENTRY GetPixelFormat(HDC);
WGLAPI int GLAPIENTRY SetPixelFormat(HDC,int,const PIXELFORMATDESCRIPTOR *);
# undef WGLAPI
# pragma warning( pop )
#endif
#else /* _WIN32 not defined */
@@ -723,7 +739,6 @@ GLUTAPI int GLUTAPIENTRY glutGameModeGet(GLenum mode);
#ifdef __cplusplus
}
#endif
#if 0

View File

@@ -1,4 +1,4 @@
/* $Id: glx.h,v 1.3 1999/09/16 15:52:51 brianp Exp $ */
/* $Id: glx.h,v 1.5.2.2 1999/12/10 14:55:38 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -25,50 +25,11 @@
*/
/*
* $Log: glx.h,v $
* Revision 1.3 1999/09/16 15:52:51 brianp
* added GLX_MESA_set_3dfx_mode. clean-up of glXGetProcAddress
*
* Revision 1.2 1999/09/11 11:33:45 brianp
* added GLX_EXT_get_proc_address
*
* Revision 1.1.1.1 1999/08/19 00:55:40 jtg
* Imported sources
*
* Revision 3.3 1999/02/14 03:39:09 brianp
* new copyright
*
* Revision 3.2 1998/06/18 03:44:00 brianp
* replaced "uint" with "unsigned int"
*
* Revision 3.1 1998/06/01 00:00:17 brianp
* added GLX_SGI_video_sync extension
*
* Revision 3.0 1998/02/20 05:06:01 brianp
* initial rev
*
*/
#ifndef GLX_H
#define GLX_H
/*
* A pseudo-GLX implementation to allow GLX-based OpenGL programs to
* work with Mesa.
*
* Notes:
* 1. If the visual passed to glXGetConfig was not one returned by
* glXChooseVisual then the GLX_RGBA and GLX_DOUBLEBUFFER queries
* will always return True and the GLX_DEPTH_SIZE query will always
* return non-zero.
* 2. The glXIsDirect() function always returns True.
*/
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include "GL/gl.h"
@@ -161,12 +122,12 @@ enum _GLX_CONFIGS {
* Compile-time extension tests
*/
#define GLX_EXT_visual_info 1
#define GLX_EXT_get_proc_address 1
#define GLX_MESA_pixmap_colormap 1
#define GLX_MESA_release_buffers 1
#define GLX_MESA_copy_sub_buffer 1
#define GLX_MESA_set_3dfx_mode 1
#define GLX_SGI_video_sync 1
#define GLX_ARB_get_proc_address 1
@@ -234,13 +195,6 @@ extern const char *glXGetClientString( Display *dpy, int name );
/* GLX_EXT_get_proc_address */
/* WARNING: this extension is not finalized yet! Do not release code
* which uses this extension yet! It may change!
*/
extern void (*glXGetProcAddressEXT(const GLubyte *procName))();
/* GLX_MESA_pixmap_colormap */
extern GLXPixmap glXCreateGLXPixmapMESA( Display *dpy, XVisualInfo *visual,
Pixmap pixmap, Colormap cmap );
@@ -265,6 +219,10 @@ extern int glXWaitVideoSyncSGI(int divisor, int remainder,
unsigned int *count);
/* GLX_ARB_get_proc_address */
extern void (*glXGetProcAddressARB(const GLubyte *procName))();
#ifdef __cplusplus
}

View File

@@ -1,8 +1,48 @@
/* $Id: mesa_wgl.h,v 1.2.2.2 1999/11/22 14:05:15 brianp Exp $ */
/*
* Mesa 3-D graphics library
* Version: 3.1
*
* 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.
*/
/* prototypes for the Mesa WGL functions */
/* relocated here so that I could make GLUT get them properly */
#ifndef GL_H
#ifndef _mesa_wgl_h_
#define _mesa_wgl_h_
#include <gl/gl.h>
#ifdef __cplusplus
extern "C" {
#endif
#ifdef _MSC_VER
# pragma warning( disable : 4615 ) /* pragma warning : unknown user warning type*/
# pragma warning( push )
# pragma warning( disable : 4273 ) /* 'function' : inconsistent DLL linkage. dllexport assumed. */
#endif
WGLAPI int GLAPIENTRY wglDeleteContext(HGLRC);
@@ -14,7 +54,6 @@ WGLAPI HGLRC GLAPIENTRY wglCreateContext(HDC);
WGLAPI HGLRC GLAPIENTRY wglCreateLayerContext(HDC,int);
WGLAPI HGLRC GLAPIENTRY wglGetCurrentContext(void);
WGLAPI PROC GLAPIENTRY wglGetProcAddress(const char*);
WGLAPI int GLAPIENTRY SwapBuffers(HDC);
WGLAPI int GLAPIENTRY wglChoosePixelFormat(HDC, const PIXELFORMATDESCRIPTOR *);
WGLAPI int GLAPIENTRY wglCopyContext(HGLRC, HGLRC, unsigned int);
WGLAPI int GLAPIENTRY wglDeleteContext(HGLRC);
@@ -31,3 +70,19 @@ WGLAPI int GLAPIENTRY wglUseFontBitmapsA(HDC, unsigned long, unsigned long, un
WGLAPI int GLAPIENTRY wglUseFontBitmapsW(HDC, unsigned long, unsigned long, unsigned long);
WGLAPI int GLAPIENTRY wglUseFontOutlinesA(HDC, unsigned long, unsigned long, unsigned long, float,float, int, LPGLYPHMETRICSFLOAT);
WGLAPI int GLAPIENTRY wglUseFontOutlinesW(HDC, unsigned long, unsigned long, unsigned long, float,float, int, LPGLYPHMETRICSFLOAT);
WGLAPI int GLAPIENTRY SwapBuffers(HDC);
WGLAPI int GLAPIENTRY ChoosePixelFormat(HDC,const PIXELFORMATDESCRIPTOR *);
WGLAPI int GLAPIENTRY DescribePixelFormat(HDC,int,unsigned int,LPPIXELFORMATDESCRIPTOR);
WGLAPI int GLAPIENTRY GetPixelFormat(HDC);
WGLAPI int GLAPIENTRY SetPixelFormat(HDC,int,const PIXELFORMATDESCRIPTOR *);
#ifdef _MSC_VER
# pragma warning( pop )
#endif
#ifdef __cplusplus
}
#endif
#endif /* _mesa_wgl_h_ */

View File

@@ -1,4 +1,4 @@
/* $Id: osmesa.h,v 1.1 1999/08/19 00:55:40 jtg Exp $ */
/* $Id: osmesa.h,v 1.1.1.1.2.1 1999/11/24 18:39:17 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -27,8 +27,11 @@
/*
* $Log: osmesa.h,v $
* Revision 1.1 1999/08/19 00:55:40 jtg
* Initial revision
* 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
@@ -86,7 +89,7 @@ extern "C" {
#define OSMESA_MAJOR_VERSION 3
#define OSMESA_MINOR_VERSION 0
#define OSMESA_MINOR_VERSION 1

View File

@@ -1,8 +1,8 @@
/* $Id: svgamesa.h,v 1.1 1999/08/19 00:55:40 jtg Exp $ */
/* $Id: svgamesa.h,v 1.1.1.1.2.1 1999/11/24 18:40:45 brianp Exp $ */
/*
* Mesa 3-D graphics library
* Version: 3.0
* Version: 3.1
* Copyright (C) 1995-1998 Brian Paul
*
* This library is free software; you can redistribute it and/or
@@ -23,8 +23,11 @@
/*
* $Log: svgamesa.h,v $
* Revision 1.1 1999/08/19 00:55:40 jtg
* Initial revision
* 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
@@ -65,7 +68,7 @@
#define SVGAMESA_MAJOR_VERSION 3
#define SVGAMESA_MINOR_VERSION 0
#define SVGAMESA_MINOR_VERSION 1
#ifdef __cplusplus

View File

@@ -1,4 +1,4 @@
/* $Id: xmesa.h,v 1.1 1999/08/19 00:55:40 jtg Exp $ */
/* $Id: xmesa.h,v 1.1.1.1.2.2 1999/12/13 21:54:19 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -27,8 +27,14 @@
/*
* $Log: xmesa.h,v $
* Revision 1.1 1999/08/19 00:55:40 jtg
* Initial revision
* 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
@@ -96,6 +102,9 @@ extern "C" {
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include "xmesa_x.h"
#ifdef GLX_DIRECT_RENDERING
#include "dri_mesa.h"
#endif
#endif
#include "GL/gl.h"
@@ -106,7 +115,7 @@ extern struct Library *XLibBase;
#define XMESA_MAJOR_VERSION 3
#define XMESA_MINOR_VERSION 0
#define XMESA_MINOR_VERSION 1
@@ -131,7 +140,17 @@ typedef struct xmesa_visual *XMesaVisual;
typedef struct xmesa_buffer *XMesaBuffer;
#if defined(GLX_DIRECT_RENDERING) && !defined(XFree86Server)
/*
* Initialize the XMesa driver.
*/
extern GLboolean XMesaInitDriver( __DRIscreenPrivate *driScrnPriv );
/*
* Reset the XMesa driver when the X server resets.
*/
extern void XMesaResetDriver( __DRIscreenPrivate *driScrnPriv );
#endif
/*
@@ -179,7 +198,11 @@ extern void XMesaDestroyVisual( XMesaVisual v );
* Return: an XMesaContext or NULL if error.
*/
extern XMesaContext XMesaCreateContext( XMesaVisual v,
XMesaContext share_list );
XMesaContext share_list
#if defined(GLX_DIRECT_RENDERING) && !defined(XFree86Server)
, __DRIcontextPrivate *driContextPriv
#endif
);
/*
@@ -192,7 +215,12 @@ extern void XMesaDestroyContext( XMesaContext c );
* Create an XMesaBuffer from an X window.
*/
extern XMesaBuffer XMesaCreateWindowBuffer( XMesaVisual v,
XMesaWindow w );
XMesaWindow w
#if defined(GLX_DIRECT_RENDERING) && !defined(XFree86Server)
, __DRIdrawablePrivate *driDrawPriv
#endif
);
/*
@@ -200,7 +228,12 @@ extern XMesaBuffer XMesaCreateWindowBuffer( XMesaVisual v,
*/
extern XMesaBuffer XMesaCreatePixmapBuffer( XMesaVisual v,
XMesaPixmap p,
XMesaColormap cmap );
XMesaColormap cmap
#if defined(GLX_DIRECT_RENDERING) && !defined(XFree86Server)
, __DRIdrawablePrivate *driDrawPriv
#endif
);
/*

View File

@@ -30,7 +30,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
* Authors:
* Kevin E. Martin <kevin@precisioninsight.com>
*
* $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/include/GL/xmesa_xf86.h,v 1.1 1999/08/19 00:55:40 jtg Exp $
* $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/include/GL/xmesa_xf86.h,v 1.1.1.1.2.1 1999/12/13 21:54:19 brianp Exp $
*/
#ifndef _XMESA_XF86_H_
@@ -52,29 +52,29 @@ typedef DDXPointRec XMesaPoint;
typedef xColorItem XMesaColor;
#define XMesaSetGeneric(__d,__gc,__val,__mask) \
{ \
do { \
CARD32 __v[1]; \
(void) __d; \
__v[0] = __val; \
dixChangeGC(NullClient, __gc, __mask, __v, NULL); \
}
} while (0)
#define XMesaSetGenericPtr(__d,__gc,__pval,__mask) \
{ \
do { \
ChangeGCVal __v[1]; \
(void) __d; \
__v[0].ptr = __pval; \
dixChangeGC(NullClient, __gc, __mask, NULL, __v); \
}
} while (0)
#define XMesaSetDashes(__d,__gc,__do,__dl,__n) \
{ \
do { \
(void) __d; \
SetDashes(__gc, __do, __n, (unsigned char *)__dl); \
}
} while (0)
#define XMesaSetLineAttributes(__d,__gc,__lw,__ls,__cs,__js) \
{ \
do { \
CARD32 __v[4]; \
(void) __d; \
__v[0] = __lw; \
@@ -84,7 +84,7 @@ typedef xColorItem XMesaColor;
dixChangeGC(NullClient, __gc, \
GCLineWidth|GCLineStyle|GCCapStyle|GCJoinStyle, \
__v, NULL); \
}
} while (0)
#define XMesaSetForeground(d,gc,v) XMesaSetGeneric(d,gc,v,GCForeground)
#define XMesaSetBackground(d,gc,v) XMesaSetGeneric(d,gc,v,GCBackground)
@@ -96,24 +96,24 @@ typedef xColorItem XMesaColor;
#define XMesaSetStipple(d,gc,v) XMesaSetGenericPtr(d,gc,v,GCStipple)
#define XMesaDrawPoint(__d,__b,__gc,__x,__y) \
{ \
do { \
XMesaPoint __p[1]; \
(void) __d; \
__p[0].x = __x; \
__p[0].y = __y; \
ValidateGC(__b, __gc); \
(*gc->ops->PolyPoint)(__b, __gc, CoordModeOrigin, 1, __p); \
}
} while (0)
#define XMesaDrawPoints(__d,__b,__gc,__p,__n,__m) \
{ \
do { \
(void) __d; \
ValidateGC(__b, __gc); \
(*gc->ops->PolyPoint)(__b, __gc, __m, __n, __p); \
}
} while (0)
#define XMesaDrawLine(__d,__b,__gc,__x0,__y0,__x1,__y1) \
{ \
do { \
XMesaPoint __p[2]; \
(void) __d; \
ValidateGC(__b, __gc); \
@@ -122,10 +122,10 @@ typedef xColorItem XMesaColor;
__p[1].x = __x1; \
__p[1].y = __y1; \
(*__gc->ops->Polylines)(__b, __gc, CoordModeOrigin, 2, __p); \
}
} while (0)
#define XMesaFillRectangle(__d,__b,__gc,__x,__y,__w,__h) \
{ \
do { \
xRectangle __r[1]; \
(void) __d; \
ValidateGC(__b, __gc); \
@@ -134,10 +134,10 @@ typedef xColorItem XMesaColor;
__r[0].width = __w; \
__r[0].height = __h; \
(*__gc->ops->PolyFillRect)(__b, __gc, 1, __r); \
}
} while (0)
#define XMesaPutImage(__d,__b,__gc,__i,__sx,__sy,__x,__y,__w,__h) \
{ \
do { \
/* Assumes: Images are always in ZPixmap format */ \
(void) __d; \
if (__sx || __sy) /* The non-trivial case */ \
@@ -146,22 +146,22 @@ typedef xColorItem XMesaColor;
(*__gc->ops->PutImage)(__b, __gc, ((XMesaDrawable)(__b))->depth, \
__x, __y, __w, __h, 0, ZPixmap, \
((XMesaImage *)(__i))->data); \
}
} while (0)
#define XMesaCopyArea(__d,__sb,__db,__gc,__sx,__sy,__w,__h,__x,__y) \
{ \
do { \
(void) __d; \
ValidateGC(__db, __gc); \
(*__gc->ops->CopyArea)((DrawablePtr)__sb, __db, __gc, \
__sx, __sy, __w, __h, __x, __y); \
}
} while (0)
#define XMesaFillPolygon(__d,__b,__gc,__p,__n,__s,__m) \
{ \
do { \
(void) __d; \
ValidateGC(__b, __gc); \
(*__gc->ops->FillPolygon)(__b, __gc, __s, __m, __n, __p); \
}
} while (0)
/* CreatePixmap returns a PixmapPtr; so, it cannot be inside braces */
#define XMesaCreatePixmap(__d,__b,__w,__h,__depth) \
@@ -170,10 +170,10 @@ typedef xColorItem XMesaColor;
(*__d->DestroyPixmap)(__b)
#define XMesaFreeGC(__d,__gc) \
{ \
do { \
(void) __d; \
FreeScratchGC(__gc); \
}
} while (0)
#define GET_COLORMAP_SIZE(__v) __v->visinfo->ColormapEntries
#define GET_REDMASK(__v) __v->visinfo->redMask

View File

@@ -1,52 +1,13 @@
# $Id: Makefile.BeOS-R4,v 1.2 1999/09/17 00:07:26 brianp Exp $
# $Id: Makefile.BeOS-R4,v 1.3 1999/10/22 20:36:38 brianp Exp $
# Mesa 3-D graphics library
# Version: 3.1
# Copyright (C) 1995-1999 Brian Paul
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public
# License as published by the Free Software Foundation; either
# version 2 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Library General Public License for more details.
#
# You should have received a copy of the GNU Library General Public
# License along with this library; if not, write to the Free
# Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
# Makefile for GLUT-based demo programs for BeOS R4
# $Log: Makefile.BeOS-R4,v $
# Revision 1.2 1999/09/17 00:07:26 brianp
# link with -lGLU -lGL instead of -lMesaGLU -lMesaGL
#
# Revision 1.1.1.1 1999/08/19 00:55:40 jtg
# Imported sources
#
# Revision 1.5 1999/06/22 12:50:11 brianp
# removed multitex demo
#
# Revision 1.4 1999/02/03 03:57:26 brianp
# replace multiext with multiarb
#
# Revision 1.3 1999/02/02 04:47:45 brianp
# removed glutfx from targets
#
# Revision 1.2 1999/02/02 04:46:23 brianp
# removed tessdemo from targets
#
# Revision 1.1 1999/02/02 04:43:27 brianp
# Initial revision
#
##### MACROS #####
INCDIR = ../include
@@ -56,7 +17,7 @@ GL_LIBS = -L$(LIBDIR) -L/boot/home/config/lib -Xlinker -rpath $(LIBDIR) -lbe -lg
LIB_DEP = $(LIBDIR)/$(GL_LIB) $(LIBDIR)/$(GLU_LIB) $(LIBDIR)/$(GLUT_LIB)
PROGS = bounce clearspd drawpix gamma gears glinfo isosurf \
PROGS = bounce clearspd drawpix gamma gears glinfo gloss isosurf \
morph3d multiarb osdemo paltex pointblast reflect \
renormal spectex stex3d texcyl texobj trispd winpos

View File

@@ -1,4 +1,4 @@
# $Id: Makefile.X11,v 1.1 1999/08/19 00:55:40 jtg Exp $
# $Id: Makefile.X11,v 1.3 1999/10/27 10:09:53 brianp Exp $
# Mesa 3-D graphics library
# Version: 3.1
@@ -13,13 +13,13 @@
INCDIR = ../include
LIBDIR = ../lib
GL_LIBS = -L$(LIBDIR) -lglut -lGLU -lGL -lm $(XLIBS)
GL_LIBS = -L$(LIBDIR) -lglut -lGLU -lGL $(XLIBS)
LIB_DEP = $(LIBDIR)/$(GL_LIB) $(LIBDIR)/$(GLU_LIB) $(LIBDIR)/$(GLUT_LIB)
PROGS = bounce clearspd drawpix gamma gears glinfo glutfx isosurf \
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,37 +1,13 @@
# Makefile for demo programs
# Stephane Rehel (rehel@worldnet.fr) April 13 1997
# $Id: Makefile.cygnus,v 1.2 1999/10/22 20:37:23 brianp Exp $
# Mesa 3-D graphics library
# Version: 3.0
# Copyright (C) 1995-1998 Brian Paul
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public
# License as published by the Free Software Foundation; either
# version 2 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Library General Public License for more details.
#
# You should have received a copy of the GNU Library General Public
# License along with this library; if not, write to the Free
# Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
# Version: 3.1
# Copyright (C) 1995-1999 Brian Paul
# $Id: Makefile.cygnus,v 1.1 1999/08/19 00:55:40 jtg Exp $
# Makefile for demo programs for cygnus
# Stephane Rehel (rehel@worldnet.fr) April 13 1997
# $Log: Makefile.cygnus,v $
# Revision 1.1 1999/08/19 00:55:40 jtg
# Initial revision
#
# Revision 3.1 1999/06/22 12:50:29 brianp
# removed multitex demo
#
# Revision 3.0 1998/06/10 02:55:51 brianp
# initial revision
#
##### MACROS #####
@@ -43,7 +19,7 @@ GL_LIBS = -L$(LIBDIR) -lglut -lMesaGLU -lMesaGL -lm $(WLIBS)
LIB_DEP = $(LIBDIR)/$(GL_LIB) $(LIBDIR)/$(GLU_LIB) $(LIBDIR)/$(GLUT_LIB)
PROGS = clearspd drawpix gamma gears glinfo glutfx isosurf \
PROGS = clearspd drawpix gamma gears glinfo glutfx gloss isosurf \
morph3d multiext osdemo paltex pointblast reflect \
renormal spectex stex3d tessdemo texcyl texobj trispd winpos

View File

@@ -1,4 +1,4 @@
/* $Id: drawpix.c,v 1.1 1999/08/19 00:55:40 jtg Exp $ */
/* $Id: drawpix.c,v 1.3 1999/10/28 18:23:29 brianp Exp $ */
/*
* glDrawPixels demo/test/benchmark
@@ -8,8 +8,14 @@
/*
* $Log: drawpix.c,v $
* Revision 1.1 1999/08/19 00:55:40 jtg
* Initial revision
* Revision 1.3 1999/10/28 18:23:29 brianp
* minor changes to Usage() function
*
* Revision 1.2 1999/10/21 22:13:58 brianp
* added f key to toggle front/back drawing
*
* Revision 1.1.1.1 1999/08/19 00:55:40 jtg
* Imported sources
*
* Revision 3.3 1999/03/28 18:18:33 brianp
* minor clean-up
@@ -44,6 +50,7 @@ static int SkipPixels, SkipRows;
static int DrawWidth, DrawHeight;
static int Scissor = 0;
static float Xzoom, Yzoom;
static GLboolean DrawFront = GL_FALSE;
@@ -82,7 +89,8 @@ static void Display( void )
glDisable(GL_SCISSOR_TEST);
glutSwapBuffers();
if (!DrawFront)
glutSwapBuffers();
}
@@ -100,6 +108,11 @@ static void Benchmark( void )
if (Scissor)
glEnable(GL_SCISSOR_TEST);
if (DrawFront)
glDrawBuffer(GL_FRONT);
else
glDrawBuffer(GL_BACK);
/* Run timing test */
draws = 0;
startTime = glutGet(GLUT_ELAPSED_TIME);
@@ -187,6 +200,14 @@ static void Key( unsigned char key, int x, int y )
case 'b':
Benchmark();
break;
case 'f':
DrawFront = !DrawFront;
if (DrawFront)
glDrawBuffer(GL_FRONT);
else
glDrawBuffer(GL_BACK);
printf("glDrawBuffer(%s)\n", DrawFront ? "GL_FRONT" : "GL_BACK");
break;
case 27:
exit(0);
break;
@@ -258,20 +279,27 @@ static void Init( GLboolean ciMode )
static void Usage(void)
{
printf("Keys:\n");
printf(" SPACE Reset\n");
printf(" SPACE Reset Parameters\n");
printf(" Up/Down Move image up/down\n");
printf(" Left/Right Move image left/right\n");
printf(" w Decrease glDrawPixels width\n");
printf(" W Increase glDrawPixels width\n");
printf(" h Decrease glDrawPixels height\n");
printf(" H Increase glDrawPixels height\n");
printf(" p Decrease GL_UNPACK_SKIP_PIXELS\n");
printf(" P Increase GL_UNPACK_SKIP_PIXELS\n");
printf(" r Decrease GL_UNPACK_SKIP_ROWS\n");
printf(" R Increase GL_UNPACK_SKIP_ROWS\n");
printf(" x Decrease X-axis PixelZoom\n");
printf(" X Increase X-axis PixelZoom\n");
printf(" y Decrease Y-axis PixelZoom\n");
printf(" Y Increase Y-axis PixelZoom\n");
printf(" w Decrease glDrawPixels width*\n");
printf(" W Increase glDrawPixels width*\n");
printf(" h Decrease glDrawPixels height*\n");
printf(" H Increase glDrawPixels height*\n");
printf(" p Decrease GL_UNPACK_SKIP_PIXELS*\n");
printf(" P Increase GL_UNPACK_SKIP_PIXELS*\n");
printf(" r Decrease GL_UNPACK_SKIP_ROWS*\n");
printf(" R Increase GL_UNPACK_SKIP_ROWS*\n");
printf(" s Toggle GL_SCISSOR_TEST\n");
printf(" f Toggle front/back buffer drawing\n");
printf(" b Benchmark test\n");
printf(" ESC Exit\n");
printf("* Warning: no limits are imposed on these parameters so it's\n");
printf(" possible to cause a segfault if you go too far.\n");
}

View File

@@ -1,8 +1,12 @@
/* $Id: gears.c,v 1.1 1999/08/19 00:55:40 jtg Exp $ */
/* $Id: gears.c,v 1.2 1999/10/21 16:39:06 brianp Exp $ */
/*
* 3-D gear wheels. This program is in the public domain.
*
* Command line options:
* -info print GL implementation information
*
*
* Brian Paul
*/
@@ -10,8 +14,11 @@
/*
* $Log: gears.c,v $
* Revision 1.1 1999/08/19 00:55:40 jtg
* Initial revision
* Revision 1.2 1999/10/21 16:39:06 brianp
* added -info command line option
*
* Revision 1.1.1.1 1999/08/19 00:55:40 jtg
* Imported sources
*
* Revision 3.2 1999/06/03 17:07:36 brianp
* an extra quad was being drawn in front and back faces
@@ -28,6 +35,7 @@
#include <math.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <GL/glut.h>
#ifndef M_PI
@@ -287,7 +295,7 @@ reshape(int width, int height)
}
static void
init(void)
init(int argc, char *argv[])
{
static GLfloat pos[4] =
{5.0, 5.0, 10.0, 0.0};
@@ -324,6 +332,13 @@ init(void)
glEndList();
glEnable(GL_NORMALIZE);
if (argc > 1 && strcmp(argv[1], "-info")==0) {
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
printf("GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
printf("GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
printf("GL_EXTENSIONS = %s\n", (char *) glGetString(GL_EXTENSIONS));
}
}
void
@@ -343,7 +358,7 @@ int main(int argc, char *argv[])
glutInitWindowPosition(0, 0);
glutInitWindowSize(300, 300);
glutCreateWindow("Gears");
init();
init(argc, argv);
glutDisplayFunc(draw);
glutReshapeFunc(reshape);

373
progs/demos/gloss.c Normal file
View File

@@ -0,0 +1,373 @@
/* $Id: gloss.c,v 1.3 1999/10/26 17:08:31 brianp Exp $ */
/*
* Specular reflection demo. The specular highlight is modulated by
* a sphere-mapped texture. The result is a high-gloss surface.
* NOTE: you really need hardware acceleration for this.
* Also note, this technique can't be implemented with multi-texture
* and separate specular color interpolation because there's no way
* to indicate that the second texture unit (the reflection map)
* should modulate the specular color and not the base color.
* A future multi-texture extension could fix that.
*
* Command line options:
* -info print GL implementation information
*
*
* Brian Paul October 22, 1999 This program is in the public domain.
*/
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <GL/glut.h>
#include "../util/readtex.c" /* I know, this is a hack. */
#define SPECULAR_TEXTURE_FILE "../images/reflect.rgb"
#define BASE_TEXTURE_FILE "../images/tile.rgb"
/* Menu items */
#define DO_SPEC_TEXTURE 1
#define OBJECT 2
#define ANIMATE 3
#define QUIT 100
static GLuint CylinderObj = 0;
static GLuint TeapotObj = 0;
static GLuint Object = 0;
static GLboolean Animate = GL_TRUE;
static GLfloat Xrot = 0.0, Yrot = 0.0, Zrot = 0.0;
static GLfloat DXrot = 1.0, DYrot = 2.5;
static GLfloat Black[4] = { 0, 0, 0, 0 };
static GLfloat White[4] = { 1, 1, 1, 1 };
static GLfloat Diffuse[4] = { .3, .3, 1.0, 1.0 }; /* blue */
static GLfloat Shininess = 15;
static GLuint BaseTexture, SpecularTexture;
static GLboolean DoSpecTexture = GL_TRUE;
/* performance info */
static GLint T0 = 0;
static GLint Frames = 0;
static void Idle( void )
{
if (Animate) {
Xrot += DXrot;
Yrot += DYrot;
glutPostRedisplay();
}
}
static void Display( void )
{
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
glPushMatrix();
glRotatef(Xrot, 1.0, 0.0, 0.0);
glRotatef(Yrot, 0.0, 1.0, 0.0);
glRotatef(Zrot, 0.0, 0.0, 1.0);
/* First pass: diffuse lighting with base texture */
glMaterialfv(GL_FRONT, GL_DIFFUSE, Diffuse);
glMaterialfv(GL_FRONT, GL_SPECULAR, Black);
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, BaseTexture);
glCallList(Object);
/* Second pass: specular lighting with reflection texture */
glBlendFunc(GL_ONE, GL_ONE); /* add */
glEnable(GL_BLEND);
glDepthFunc(GL_LEQUAL);
glMaterialfv(GL_FRONT, GL_DIFFUSE, Black);
glMaterialfv(GL_FRONT, GL_SPECULAR, White);
if (DoSpecTexture) {
glBindTexture(GL_TEXTURE_2D, SpecularTexture);
glEnable(GL_TEXTURE_GEN_S);
glEnable(GL_TEXTURE_GEN_T);
}
else {
glDisable(GL_TEXTURE_2D);
}
glCallList(Object);
glDisable(GL_TEXTURE_GEN_S);
glDisable(GL_TEXTURE_GEN_T);
glDisable(GL_BLEND);
glPopMatrix();
glutSwapBuffers();
if (Animate) {
GLint t = glutGet(GLUT_ELAPSED_TIME);
Frames++;
if (t - T0 >= 5000) {
GLfloat seconds = (t - T0) / 1000.0;
GLfloat fps = Frames / seconds;
printf("%d frames in %g seconds = %g FPS\n", Frames, seconds, fps);
T0 = t;
Frames = 0;
}
}
}
static void Reshape( int width, int height )
{
GLfloat h = 30.0;
GLfloat w = h * width / height;
glViewport( 0, 0, width, height );
glMatrixMode( GL_PROJECTION );
glLoadIdentity();
glFrustum( -w, w, -h, h, 150.0, 500.0 );
glMatrixMode( GL_MODELVIEW );
glLoadIdentity();
glTranslatef( 0.0, 0.0, -380.0 );
}
static void ToggleAnimate(void)
{
Animate = !Animate;
if (Animate) {
glutIdleFunc( Idle );
T0 = glutGet(GLUT_ELAPSED_TIME);
Frames = 0;
}
else {
glutIdleFunc( NULL );
}
}
static void ModeMenu(int entry)
{
if (entry==ANIMATE) {
ToggleAnimate();
}
else if (entry==DO_SPEC_TEXTURE) {
DoSpecTexture = !DoSpecTexture;
}
else if (entry==OBJECT) {
if (Object == TeapotObj)
Object = CylinderObj;
else
Object = TeapotObj;
}
else if (entry==QUIT) {
exit(0);
}
glutPostRedisplay();
}
static void Key( unsigned char key, int x, int y )
{
(void) x;
(void) y;
switch (key) {
case 's':
Shininess--;
if (Shininess < 0.0)
Shininess = 0.0;
glMaterialf(GL_FRONT, GL_SHININESS, Shininess);
printf("Shininess = %g\n", Shininess);
break;
case 'S':
Shininess++;
if (Shininess > 128.0)
Shininess = 128.0;
glMaterialf(GL_FRONT, GL_SHININESS, Shininess);
printf("Shininess = %g\n", Shininess);
break;
case ' ':
ToggleAnimate();
break;
case 27:
exit(0);
break;
}
glutPostRedisplay();
}
static void SpecialKey( int key, int x, int y )
{
float step = 3.0;
(void) x;
(void) y;
switch (key) {
case GLUT_KEY_UP:
Xrot += step;
break;
case GLUT_KEY_DOWN:
Xrot -= step;
break;
case GLUT_KEY_LEFT:
Yrot += step;
break;
case GLUT_KEY_RIGHT:
Yrot -= step;
break;
}
glutPostRedisplay();
}
static void Init( int argc, char *argv[] )
{
/* Cylinder object */
{
static GLfloat height = 100.0;
static GLfloat radius = 40.0;
static GLint slices = 24; /* pie slices around Z axis */
static GLint stacks = 10; /* subdivisions along length of cylinder */
static GLint rings = 4; /* rings in the end disks */
GLUquadricObj *q = gluNewQuadric();
assert(q);
gluQuadricTexture(q, GL_TRUE);
CylinderObj = glGenLists(1);
glNewList(CylinderObj, GL_COMPILE);
glPushMatrix();
glTranslatef(0.0, 0.0, -0.5 * height);
glMatrixMode(GL_TEXTURE);
glLoadIdentity();
glScalef(8.0, 4.0, 2.0);
glMatrixMode(GL_MODELVIEW);
/* cylinder */
gluQuadricNormals(q, GL_SMOOTH);
gluQuadricTexture(q, GL_TRUE);
gluCylinder(q, radius, radius, height, slices, stacks);
/* end cap */
glMatrixMode(GL_TEXTURE);
glLoadIdentity();
glScalef(3.0, 3.0, 1.0);
glMatrixMode(GL_MODELVIEW);
glTranslatef(0.0, 0.0, height);
gluDisk(q, 0.0, radius, slices, rings);
/* other end cap */
glTranslatef(0.0, 0.0, -height);
gluQuadricOrientation(q, GLU_INSIDE);
gluDisk(q, 0.0, radius, slices, rings);
glPopMatrix();
glMatrixMode(GL_TEXTURE);
glLoadIdentity();
glMatrixMode(GL_MODELVIEW);
glEndList();
gluDeleteQuadric(q);
}
/* Teapot */
{
TeapotObj = glGenLists(1);
glNewList(TeapotObj, GL_COMPILE);
glFrontFace(GL_CW);
glutSolidTeapot(40.0);
glFrontFace(GL_CCW);
glEndList();
}
/* show cylinder by default */
Object = CylinderObj;
/* lighting */
glEnable(GL_LIGHTING);
{
GLfloat pos[4] = { 3, 3, 3, 1 };
glLightfv(GL_LIGHT0, GL_AMBIENT, Black);
glLightfv(GL_LIGHT0, GL_DIFFUSE, White);
glLightfv(GL_LIGHT0, GL_SPECULAR, White);
glLightfv(GL_LIGHT0, GL_POSITION, pos);
glEnable(GL_LIGHT0);
glMaterialfv(GL_FRONT, GL_AMBIENT, Black);
glMaterialf(GL_FRONT, GL_SHININESS, Shininess);
glLightModeli(GL_LIGHT_MODEL_LOCAL_VIEWER, 1);
}
/* Base texture */
glGenTextures(1, &BaseTexture);
glBindTexture(GL_TEXTURE_2D, BaseTexture);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
if (!LoadRGBMipmaps(BASE_TEXTURE_FILE, GL_RGB)) {
printf("Error: couldn't load texture image file %s\n", BASE_TEXTURE_FILE);
exit(1);
}
/* Specular texture */
glGenTextures(1, &SpecularTexture);
glBindTexture(GL_TEXTURE_2D, SpecularTexture);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP);
glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP);
if (!LoadRGBMipmaps(SPECULAR_TEXTURE_FILE, GL_RGB)) {
printf("Error: couldn't load texture image file %s\n", SPECULAR_TEXTURE_FILE);
exit(1);
}
/* misc */
glEnable(GL_CULL_FACE);
glEnable(GL_TEXTURE_2D);
glEnable(GL_DEPTH_TEST);
glEnable(GL_NORMALIZE);
if (argc > 1 && strcmp(argv[1], "-info")==0) {
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
printf("GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
printf("GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
printf("GL_EXTENSIONS = %s\n", (char *) glGetString(GL_EXTENSIONS));
}
}
int main( int argc, char *argv[] )
{
glutInit( &argc, argv );
glutInitWindowSize( 500, 500 );
glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH );
glutCreateWindow(argv[0] );
Init(argc, argv);
glutReshapeFunc( Reshape );
glutKeyboardFunc( Key );
glutSpecialFunc( SpecialKey );
glutDisplayFunc( Display );
glutIdleFunc( Idle );
glutCreateMenu(ModeMenu);
glutAddMenuEntry("Toggle Highlight", DO_SPEC_TEXTURE);
glutAddMenuEntry("Toggle Object", OBJECT);
glutAddMenuEntry("Toggle Animate", ANIMATE);
glutAddMenuEntry("Quit", QUIT);
glutAttachMenu(GLUT_RIGHT_BUTTON);
glutMainLoop();
return 0;
}

View File

@@ -1,8 +1,11 @@
/* $Id: isosurf.c,v 1.3 1999/09/08 22:14:31 brianp Exp $ */
/* $Id: isosurf.c,v 1.4 1999/10/21 16:39:06 brianp Exp $ */
/*
* Display an isosurface of 3-D wind speed volume.
*
* Command line options:
* -info print GL implementation information
*
* Brian Paul This file in public domain.
*/
@@ -24,6 +27,9 @@
/*
* $Log: isosurf.c,v $
* Revision 1.4 1999/10/21 16:39:06 brianp
* added -info command line option
*
* Revision 1.3 1999/09/08 22:14:31 brianp
* minor changes. always call compactify_arrays()
*
@@ -49,6 +55,7 @@
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include "GL/glut.h"
@@ -109,6 +116,8 @@ static GLboolean doubleBuffer = GL_TRUE;
static GLdouble plane[4] = {1.0, 0.0, -1.0, 0.0};
static GLuint surf1;
static GLboolean PrintInfo = GL_FALSE;
/* forward decl */
int BuildList( int mode );
@@ -147,7 +156,7 @@ struct data_idx {
#define COMPARE_FUNC( AXIS ) \
int compare_axis_##AXIS( const void *a, const void *b ) \
static int compare_axis_##AXIS( const void *a, const void *b ) \
{ \
float t = ( (*(struct data_idx *)a).data[AXIS] - \
(*(struct data_idx *)b).data[AXIS] ); \
@@ -644,7 +653,7 @@ static void ModeMenu(int m)
static void Init(void)
static void Init(int argc, char *argv[])
{
GLfloat fogColor[4] = {0.5,1.0,0.5,1.0};
@@ -698,6 +707,13 @@ static void Init(void)
NO_MATERIALS|
NO_FOG|
GLVERTEX);
if (PrintInfo) {
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
printf("GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
printf("GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
printf("GL_EXTENSIONS = %s\n", (char *) glGetString(GL_EXTENSIONS));
}
}
@@ -808,6 +824,9 @@ static GLint Args(int argc, char **argv)
else if (strcmp(argv[i], "-db") == 0) {
doubleBuffer = GL_TRUE;
}
else if (strcmp(argv[i], "-info") == 0) {
PrintInfo = GL_TRUE;
}
else {
printf("%s (Bad option).\n", argv[i]);
return QUIT;
@@ -855,7 +874,7 @@ int main(int argc, char **argv)
allowed &= ~COMPILED;
}
Init();
Init(argc, argv);
ModeMenu(arg_mode);
glutCreateMenu(ModeMenu);

View File

@@ -1,14 +1,25 @@
/* $Id: multiarb.c,v 1.1 1999/08/19 00:55:40 jtg Exp $ */
/* $Id: multiarb.c,v 1.3 1999/10/21 16:40:32 brianp Exp $ */
/*
* GL_ARB_multitexture demo
*
* Command line options:
* -info print GL implementation information
*
*
* Brian Paul November 1998 This program is in the public domain.
*/
/*
* $Log: multiarb.c,v $
* Revision 1.1 1999/08/19 00:55:40 jtg
* Initial revision
* Revision 1.3 1999/10/21 16:40:32 brianp
* added -info command line option
*
* Revision 1.2 1999/10/13 12:02:13 brianp
* use texture objects now
*
* Revision 1.1.1.1 1999/08/19 00:55:40 jtg
* Imported sources
*
* Revision 1.3 1999/03/28 18:20:49 brianp
* minor clean-up
@@ -221,18 +232,21 @@ static void SpecialKey( int key, int x, int y )
}
static void Init( void )
static void Init( int argc, char *argv[] )
{
GLuint texObj[2];
const char *exten = (const char *) glGetString(GL_EXTENSIONS);
if (!strstr(exten, "GL_ARB_multitexture")) {
printf("Sorry, GL_ARB_multitexture not supported by this renderer.\n");
exit(1);
}
/* setup texture env 0 */
#ifdef GL_ARB_multitexture
glActiveTextureARB(GL_TEXTURE0_ARB);
#endif
/* allocate two texture objects */
glGenTextures(2, texObj);
/* setup texture obj 0 */
glBindTexture(GL_TEXTURE_2D, texObj[0]);
#ifdef LINEAR_FILTER
/* linear filtering looks much nicer but is much slower for Mesa */
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
@@ -252,10 +266,8 @@ static void Init( void )
}
/* setup texture env 1 */
#ifdef GL_ARB_multitexture
glActiveTextureARB(GL_TEXTURE1_ARB);
#endif
/* setup texture obj 1 */
glBindTexture(GL_TEXTURE_2D, texObj[1]);
#ifdef LINEAR_FILTER
/* linear filtering looks much nicer but is much slower for Mesa */
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
@@ -272,10 +284,26 @@ static void Init( void )
exit(1);
}
/* now bind the texture objects to the respective texture units */
#ifdef GL_ARB_multitexture
glActiveTextureARB(GL_TEXTURE0_ARB);
glBindTexture(GL_TEXTURE_2D, texObj[0]);
glActiveTextureARB(GL_TEXTURE1_ARB);
glBindTexture(GL_TEXTURE_2D, texObj[1]);
#endif
glShadeModel(GL_FLAT);
glClearColor(0.3, 0.3, 0.4, 1.0);
ModeMenu(TEXBOTH);
if (argc > 1 && strcmp(argv[1], "-info")==0) {
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
printf("GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
printf("GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
printf("GL_EXTENSIONS = %s\n", (char *) glGetString(GL_EXTENSIONS));
}
}
@@ -286,7 +314,7 @@ int main( int argc, char *argv[] )
glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE );
glutCreateWindow(argv[0] );
Init();
Init( argc, argv );
glutReshapeFunc( Reshape );
glutKeyboardFunc( Key );

View File

@@ -1,13 +1,17 @@
/* $Id: paltex.c,v 1.1 1999/08/19 00:55:40 jtg Exp $ */
/* $Id: paltex.c,v 1.2 1999/11/02 15:09:04 brianp Exp $ */
/*
* Paletted texture demo. Written by Brian Paul. This file in public domain.
* Paletted texture demo. Written by Brian Paul.
* This program is in the public domain.
*/
/*
* $Log: paltex.c,v $
* Revision 1.1 1999/08/19 00:55:40 jtg
* Initial revision
* Revision 1.2 1999/11/02 15:09:04 brianp
* new texture image, cleaned-up code
*
* Revision 1.1.1.1 1999/08/19 00:55:40 jtg
* Imported sources
*
* Revision 3.1 1999/03/28 18:20:49 brianp
* minor clean-up
@@ -42,10 +46,10 @@ static void Display( void )
glRotatef(Rot, 0, 0, 1);
glBegin(GL_POLYGON);
glTexCoord2f(0, 1); glVertex2f(-1, -1);
glTexCoord2f(1, 1); glVertex2f( 1, -1);
glTexCoord2f(1, 0); glVertex2f( 1, 1);
glTexCoord2f(0, 0); glVertex2f(-1, 1);
glTexCoord2f(0, 1); glVertex2f(-1, -0.5);
glTexCoord2f(1, 1); glVertex2f( 1, -0.5);
glTexCoord2f(1, 0); glVertex2f( 1, 0.5);
glTexCoord2f(0, 0); glVertex2f(-1, 0.5);
glEnd();
glPopMatrix();
@@ -62,7 +66,7 @@ static void Reshape( int width, int height )
glFrustum( -1.0, 1.0, -1.0, 1.0, 5.0, 25.0 );
glMatrixMode( GL_MODELVIEW );
glLoadIdentity();
glTranslatef( 0.0, 0.0, -15.0 );
glTranslatef( 0.0, 0.0, -7.0 );
}
@@ -79,37 +83,20 @@ static void Key( unsigned char key, int x, int y )
}
static void SpecialKey( int key, int x, int y )
{
(void) x;
(void) y;
switch (key) {
case GLUT_KEY_UP:
break;
case GLUT_KEY_DOWN:
break;
case GLUT_KEY_LEFT:
break;
case GLUT_KEY_RIGHT:
break;
}
glutPostRedisplay();
}
static void Init( void )
{
GLubyte texture[8][8] = { /* PT = Paletted Texture! */
{ 0, 0, 0, 0, 0, 0, 0, 0},
{ 0, 100, 100, 100, 0, 180, 180, 180},
{ 0, 100, 0, 100, 0, 0, 180, 0},
{ 0, 100, 0, 100, 0, 0, 180, 0},
{ 0, 100, 100, 100, 0, 0, 180, 0},
{ 0, 100, 0, 0, 0, 0, 180, 0},
{ 0, 100, 0, 0, 0, 0, 180, 0},
{ 0, 100, 255, 0, 0, 0, 180, 250},
};
#define HEIGHT 8
#define WIDTH 32
static char texture[HEIGHT][WIDTH] = {
" ",
" MMM EEEE SSS AAA ",
" M M M E S S A A ",
" M M M EEEE SS A A ",
" M M M E SS AAAAA ",
" M M E S S A A ",
" M M EEEE SSS A A ",
" "
};
GLubyte table[256][4];
int i;
@@ -118,17 +105,31 @@ static void Init( void )
exit(0);
}
/* put some wacky colors into the texture palette */
for (i=0;i<256;i++) {
table[i][0] = i;
table[i][1] = 0;
table[i][2] = 127 + i / 2;
table[i][3] = 255;
}
/* load the color table for each texel-index */
table[' '][0] = 50;
table[' '][1] = 50;
table[' '][2] = 50;
table[' '][3] = 50;
table['M'][0] = 255;
table['M'][1] = 0;
table['M'][2] = 0;
table['M'][3] = 0;
table['E'][0] = 0;
table['E'][1] = 255;
table['E'][2] = 0;
table['E'][3] = 0;
table['S'][0] = 40;
table['S'][1] = 40;
table['S'][2] = 255;
table['S'][3] = 0;
table['A'][0] = 255;
table['A'][1] = 255;
table['A'][2] = 0;
table['A'][3] = 0;
#ifdef GL_EXT_paletted_texture
#if defined(GL_EXT_shared_texture_palette) && defined(SHARED_PALETTE)
#if defined(GL_EXT_shared_texture_palette) && defined(USE_SHARED_PALETTE)
printf("Using shared palette\n");
glColorTableEXT(GL_SHARED_TEXTURE_PALETTE_EXT, /* target */
GL_RGBA, /* internal format */
@@ -149,7 +150,7 @@ static void Init( void )
glTexImage2D(GL_TEXTURE_2D, /* target */
0, /* level */
GL_COLOR_INDEX8_EXT, /* internal format */
8, 8, /* width, height */
WIDTH, HEIGHT, /* width, height */
0, /* border */
GL_COLOR_INDEX, /* texture format */
GL_UNSIGNED_BYTE, /* texture type */
@@ -177,7 +178,6 @@ int main( int argc, char *argv[] )
glutReshapeFunc( Reshape );
glutKeyboardFunc( Key );
glutSpecialFunc( SpecialKey );
glutDisplayFunc( Display );
glutIdleFunc( Idle );

View File

@@ -1,4 +1,4 @@
/* $Id: tessdemo.c,v 1.2 1999/09/19 20:09:00 tanner Exp $ */
/* $Id: tessdemo.c,v 1.3.2.1 1999/11/16 11:09:09 gareth Exp $ */
/*
* A demo of the GLU polygon tesselation functions written by Bogdan Sikorski.
@@ -8,9 +8,19 @@
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
@@ -44,29 +54,9 @@
#include <stdlib.h>
#include <string.h>
#define MAX_POINTS 200
#define MAX_CONTOURS 50
int menu;
typedef enum{ QUIT, TESSELATE, CLEAR } menu_entries;
typedef enum{ DEFINE, TESSELATED } mode_type;
struct
{
GLint p[MAX_POINTS][2];
GLuint point_cnt;
} contours[MAX_CONTOURS];
GLuint contour_cnt;
GLsizei width,height;
mode_type mode;
struct
{
GLsizei no;
GLfloat color[3];
GLint p[3][2];
GLclampf p_color[3][3];
} triangle;
#define MAX_POINTS 256
#define MAX_CONTOURS 32
#define MAX_TRIANGLES 256
#ifndef GLCALLBACK
#ifdef CALLBACK
@@ -76,368 +66,513 @@ struct
#endif
#endif
typedef enum{ QUIT, TESSELATE, CLEAR } menu_entries;
typedef enum{ DEFINE, TESSELATED } mode_type;
void GLCALLBACK my_error(GLenum err)
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
{
int len,i;
char const *str;
GLfloat p[MAX_POINTS][2];
GLuint point_cnt;
} contours[MAX_CONTOURS];
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]);
static struct
{
GLsizei no;
GLfloat p[3][2];
GLclampf color[3][3];
} triangles[MAX_TRIANGLES];
void GLCALLBACK error_callback( GLenum err )
{
int len, i;
char const *str;
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] );
}
}
void GLCALLBACK begin_callback(GLenum mode)
void GLCALLBACK begin_callback( GLenum mode )
{
triangle.no=0;
/* 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)
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;
}
/* 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()
{
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();
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] );
}
glEnd();
}
void GLCALLBACK vertex_callback(void *data)
void GLCALLBACK vertex_callback( void *data )
{
GLsizei no;
GLint *p;
GLsizei no;
GLfloat *p;
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);
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 set_screen_wh(GLsizei w, GLsizei h)
void GLCALLBACK combine_callback( GLdouble coords[3],
GLdouble *vertex_data[4],
GLfloat weight[4], void **data )
{
width=w;
height=h;
GLfloat *vertex;
int i;
vertex = (GLfloat *) malloc( 2 * sizeof(GLfloat) );
vertex[0] = (GLfloat) coords[0];
vertex[1] = (GLfloat) coords[1];
*data = vertex;
}
void tesse(void)
{
GLUtesselator *tobj;
GLdouble data[3];
GLuint i,j,point_cnt;
tobj=gluNewTess();
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]);
data[2]=0.0;
gluTessVertex(tobj,data,contours[j].p[i]);
}
}
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]);
data[2]=0.0;
gluTessVertex(tobj,data,contours[j].p[i]);
}
}
gluEndPolygon(tobj);
gluDeleteTess(tobj);
glutMouseFunc(NULL);
glColor3f (1.0, 1.0, 0.0);
glLineWidth(1.0);
mode=TESSELATED;
}
void set_screen_wh( GLsizei w, GLsizei h )
{
width = w;
height = h;
}
void left_down(int x1,int y1)
void tesse( void )
{
GLint P[2];
GLuint point_cnt;
GLUtesselator *tobj;
GLdouble data[3];
GLuint i, j, 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)
{
glVertex2iv(contours[contour_cnt].p[point_cnt-1]);
glVertex2iv(P);
}
else
{
glVertex2iv(P);
glVertex2iv(P);
}
glEnd();
glFinish();
++(contours[contour_cnt].point_cnt);
list_start = glGenLists( 2 );
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++ )
{
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] );
data[2] = 0.0;
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++ )
{
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] );
data[2] = 0.0;
gluTessVertex( tobj, data, contours[j].p[i] );
}
}
gluEndPolygon( tobj );
glEndList();
gluDeleteTess( tobj );
glutMouseFunc( NULL );
mode = TESSELATED;
}
}
void middle_down(int x1, int y1)
void left_down( int x1, int y1 )
{
GLuint point_cnt;
(void) x1;
(void) y1;
GLfloat P[2];
GLuint point_cnt;
point_cnt=contours[contour_cnt].point_cnt;
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;
}
/* 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 );
}
else
{
glVertex2fv( P );
glVertex2fv( P );
}
glEnd();
glFinish();
contours[contour_cnt].point_cnt++;
}
void mouse_clicked(int button,int state,int x,int y)
void middle_down( int x1, int y1 )
{
x-= x%10;
y-= y%10;
switch(button)
{
case GLUT_LEFT_BUTTON:
if(state==GLUT_DOWN)
left_down(x,y);
break;
case GLUT_MIDDLE_BUTTON:
if(state==GLUT_DOWN)
middle_down(x,y);
break;
}
GLuint point_cnt;
(void) x1;
(void) y1;
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] );
contours[contour_cnt].p[point_cnt][0] = -1;
glEnd();
glFinish();
contour_cnt++;
contours[contour_cnt].point_cnt = 0;
}
}
void display(void)
void mouse_clicked( int button, int state, int x, int y )
{
GLuint i,j;
GLuint point_cnt;
x -= x%10;
y -= y%10;
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 (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)
{
case 0:
break;
case 1:
glVertex2iv(contours[i].p[0]);
glVertex2iv(contours[i].p[0]);
break;
case 2:
glVertex2iv(contours[i].p[0]);
glVertex2iv(contours[i].p[1]);
break;
default:
--point_cnt;
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)
{
glVertex2iv(contours[i].p[0]);
glVertex2iv(contours[i].p[j]);
}
break;
}
glEnd();
}
glFinish();
break;
case TESSELATED:
/* draw lines */
tesse();
break;
}
switch ( button )
{
case GLUT_LEFT_BUTTON:
if ( state == GLUT_DOWN ) {
left_down( x, y );
}
break;
case GLUT_MIDDLE_BUTTON:
if ( state == GLUT_DOWN ) {
middle_down( x, y );
}
break;
}
}
glColor3f (1.0, 1.0, 0.0);
void display( void )
{
GLuint i,j;
GLuint point_cnt;
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( 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 )
{
case 0:
break;
case 1:
glVertex2fv( contours[i].p[0] );
glVertex2fv( contours[i].p[0] );
break;
case 2:
glVertex2fv( contours[i].p[0] );
glVertex2fv( 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] );
}
if ( contours[i].p[j+1][0] == -1 )
{
glVertex2fv( contours[i].p[0] );
glVertex2fv( 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();
break;
}
glColor3f( 1.0, 1.0, 0.0 );
}
void clear( void )
{
contour_cnt=0;
contours[0].point_cnt=0;
glutMouseFunc(mouse_clicked);
mode=DEFINE;
display();
contour_cnt = 0;
contours[0].point_cnt = 0;
triangle_cnt = 0;
glutMouseFunc( mouse_clicked );
mode = DEFINE;
glDeleteLists( list_start, 2 );
list_start = 0;
}
void quit( void )
{
exit(0);
exit( 0 );
}
void menu_selected(int entry)
void menu_selected( int entry )
{
switch(entry)
{
case CLEAR:
clear();
break;
case TESSELATE:
tesse();
break;
case QUIT:
quit();
break;
}
switch ( entry )
{
case CLEAR:
clear();
break;
case TESSELATE:
tesse();
break;
case QUIT:
quit();
break;
}
glutPostRedisplay();
}
void key_pressed(unsigned char key,int x,int y)
void key_pressed( unsigned char key, int x, int y )
{
(void) x;
(void) y;
switch(key)
{
case 't':
case 'T':
tesse();
glFinish();
break;
case 'q':
case 'Q':
quit();
break;
case 'c':
case 'C':
clear();
break;
}
(void) x;
(void) y;
switch ( key )
{
case 'c':
case 'C':
clear();
break;
case 't':
case 'T':
tesse();
break;
case 'q':
case 'Q':
quit();
break;
}
glutPostRedisplay();
}
void myinit (void)
void myinit( void )
{
/* clear background to gray */
glClearColor (0.4, 0.4, 0.4, 0.0);
glShadeModel (GL_FLAT);
/* 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);
contour_cnt=0;
glPolygonMode(GL_FRONT,GL_FILL);
mode=DEFINE;
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;
mode = DEFINE;
}
static void reshape(GLsizei w, GLsizei h)
static void reshape( GLsizei w, GLsizei h )
{
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);
glLoadIdentity();
set_screen_wh(w,h);
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 );
glLoadIdentity();
set_screen_wh( w, h );
}
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,14 +1,22 @@
/* $Id: texcyl.c,v 1.1 1999/08/19 00:55:40 jtg Exp $ */
/* $Id: texcyl.c,v 1.2 1999/10/21 16:39:06 brianp Exp $ */
/*
* Textured cylinder demo: lighting, texturing, reflection mapping.
*
* Command line options:
* -info print GL implementation information
*
*
* Brian Paul May 1997 This program is in the public domain.
*/
/*
* $Log: texcyl.c,v $
* Revision 1.1 1999/08/19 00:55:40 jtg
* Initial revision
* Revision 1.2 1999/10/21 16:39:06 brianp
* added -info command line option
*
* Revision 1.1.1.1 1999/08/19 00:55:40 jtg
* Imported sources
*
* Revision 3.3 1999/03/28 18:24:37 brianp
* minor clean-up
@@ -171,7 +179,7 @@ static void SpecialKey( int key, int x, int y )
}
static void Init( void )
static void Init( int argc, char *argv[] )
{
GLUquadricObj *q = gluNewQuadric();
CylinderObj = glGenLists(1);
@@ -226,6 +234,13 @@ static void Init( void )
glEnable(GL_CULL_FACE); /* don't need Z testing for convex objects */
SetMode(LIT);
if (argc > 1 && strcmp(argv[1], "-info")==0) {
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
printf("GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
printf("GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
printf("GL_EXTENSIONS = %s\n", (char *) glGetString(GL_EXTENSIONS));
}
}
@@ -238,7 +253,7 @@ int main( int argc, char *argv[] )
glutCreateWindow(argv[0] );
Init();
Init(argc, argv);
glutReshapeFunc( Reshape );
glutKeyboardFunc( Key );

View File

@@ -1,4 +1,4 @@
# $Id: Makefile.X11,v 1.1 1999/08/19 00:55:40 jtg Exp $
# $Id: Makefile.X11,v 1.2 1999/10/27 10:09:53 brianp Exp $
# Mesa 3-D graphics library
# Version: 3.1
@@ -12,7 +12,7 @@
INCDIR = ../include
LIBDIR = ../lib
GL_LIBS = -L$(LIBDIR) -lglut -lGLU -lGL -lm $(XLIBS)
GL_LIBS = -L$(LIBDIR) -lglut -lGLU -lGL $(XLIBS)
LIB_DEP = $(LIBDIR)/$(GL_LIB) $(LIBDIR)/$(GLU_LIB) $(LIBDIR)/$(GLUT_LIB)

View File

@@ -1,13 +1,13 @@
/*
* Copyright (c) 1993-1997, Silicon Graphics, Inc.
* ALL RIGHTS RESERVED
* Permission to use, copy, modify, and distribute this software for
* ALL RIGHTS RESERVED
* Permission to use, copy, modify, and distribute this software for
* any purpose and without fee is hereby granted, provided that the above
* copyright notice appear in all copies and that both the copyright notice
* and this permission notice appear in supporting documentation, and that
* and this permission notice appear in supporting documentation, and that
* the name of Silicon Graphics, Inc. not be used in advertising
* or publicity pertaining to distribution of the software without specific,
* written prior permission.
* written prior permission.
*
* THE MATERIAL EMBODIED ON THIS SOFTWARE IS PROVIDED TO YOU "AS-IS"
* AND WITHOUT WARRANTY OF ANY KIND, EXPRESS, IMPLIED OR OTHERWISE,
@@ -21,8 +21,8 @@
* ADVISED OF THE POSSIBILITY OF SUCH LOSS, HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE
* POSSESSION, USE OR PERFORMANCE OF THIS SOFTWARE.
*
* US Government Users Restricted Rights
*
* US Government Users Restricted Rights
* Use, duplication, or disclosure by the Government is subject to
* restrictions set forth in FAR 52.227.19(c)(2) or subparagraph
* (c)(1)(ii) of the Rights in Technical Data and Computer Software
@@ -45,7 +45,7 @@
* Note the exterior rectangle is drawn with its vertices
* in counter-clockwise order, but its interior clockwise.
* Note the combineCallback is needed for the self-intersecting
* star. Also note that removing the TessProperty for the
* star. Also note that removing the TessProperty for the
* star will make the interior unshaded (WINDING_ODD).
*/
#include <GL/glut.h>
@@ -102,7 +102,7 @@ void CALLBACK vertexCallback(GLvoid *vertex)
* but weight[4] may be used to average color, normal, or texture
* coordinate data. In this program, color is weighted.
*/
void CALLBACK combineCallback(GLdouble coords[3],
void CALLBACK combineCallback(GLdouble coords[3],
GLdouble *vertex_data[4],
GLfloat weight[4], GLdouble **dataOut )
{
@@ -114,47 +114,47 @@ void CALLBACK combineCallback(GLdouble coords[3],
vertex[0] = coords[0];
vertex[1] = coords[1];
vertex[2] = coords[2];
for (i = 3; i < 7; i++)
vertex[i] = weight[0] * vertex_data[0][i]
for (i = 3; i < 6; i++)
vertex[i] = weight[0] * vertex_data[0][i]
+ weight[1] * vertex_data[1][i]
+ weight[2] * vertex_data[2][i]
+ weight[2] * vertex_data[2][i]
+ weight[3] * vertex_data[3][i];
*dataOut = vertex;
}
void init (void)
void init (void)
{
GLUtesselator *tobj;
GLdouble rect[4][3] = {50.0, 50.0, 0.0,
200.0, 50.0, 0.0,
200.0, 200.0, 0.0,
50.0, 200.0, 0.0};
GLdouble tri[3][3] = {75.0, 75.0, 0.0,
125.0, 175.0, 0.0,
175.0, 75.0, 0.0};
GLdouble star[5][6] = {250.0, 50.0, 0.0, 1.0, 0.0, 1.0,
325.0, 200.0, 0.0, 1.0, 1.0, 0.0,
400.0, 50.0, 0.0, 0.0, 1.0, 1.0,
250.0, 150.0, 0.0, 1.0, 0.0, 0.0,
400.0, 150.0, 0.0, 0.0, 1.0, 0.0};
GLdouble rect[4][3] = {{50.0, 50.0, 0.0},
{200.0, 50.0, 0.0},
{200.0, 200.0, 0.0},
{50.0, 200.0, 0.0}};
GLdouble tri[3][3] = {{75.0, 75.0, 0.0},
{125.0, 175.0, 0.0},
{175.0, 75.0, 0.0}};
GLdouble star[5][6] = {{250.0, 50.0, 0.0, 1.0, 0.0, 1.0},
{325.0, 200.0, 0.0, 1.0, 1.0, 0.0},
{400.0, 50.0, 0.0, 0.0, 1.0, 1.0},
{250.0, 150.0, 0.0, 1.0, 0.0, 0.0},
{400.0, 150.0, 0.0, 0.0, 1.0, 0.0}};
glClearColor(0.0, 0.0, 0.0, 0.0);
startList = glGenLists(2);
tobj = gluNewTess();
gluTessCallback(tobj, GLU_TESS_VERTEX,
gluTessCallback(tobj, GLU_TESS_VERTEX,
(GLvoid (CALLBACK*) ()) &glVertex3dv);
gluTessCallback(tobj, GLU_TESS_BEGIN,
gluTessCallback(tobj, GLU_TESS_BEGIN,
(GLvoid (CALLBACK*) ()) &beginCallback);
gluTessCallback(tobj, GLU_TESS_END,
gluTessCallback(tobj, GLU_TESS_END,
(GLvoid (CALLBACK*) ()) &endCallback);
gluTessCallback(tobj, GLU_TESS_ERROR,
gluTessCallback(tobj, GLU_TESS_ERROR,
(GLvoid (CALLBACK*) ()) &errorCallback);
/* rectangle with triangular hole inside */
glNewList(startList, GL_COMPILE);
glShadeModel(GL_FLAT);
glShadeModel(GL_FLAT);
gluTessBeginPolygon(tobj, NULL);
gluTessBeginContour(tobj);
gluTessVertex(tobj, rect[0], rect[0]);
@@ -170,20 +170,20 @@ void init (void)
gluTessEndPolygon(tobj);
glEndList();
gluTessCallback(tobj, GLU_TESS_VERTEX,
gluTessCallback(tobj, GLU_TESS_VERTEX,
(GLvoid (CALLBACK*) ()) &vertexCallback);
gluTessCallback(tobj, GLU_TESS_BEGIN,
gluTessCallback(tobj, GLU_TESS_BEGIN,
(GLvoid (CALLBACK*) ()) &beginCallback);
gluTessCallback(tobj, GLU_TESS_END,
gluTessCallback(tobj, GLU_TESS_END,
(GLvoid (CALLBACK*) ()) &endCallback);
gluTessCallback(tobj, GLU_TESS_ERROR,
gluTessCallback(tobj, GLU_TESS_ERROR,
(GLvoid (CALLBACK*) ()) &errorCallback);
gluTessCallback(tobj, GLU_TESS_COMBINE,
gluTessCallback(tobj, GLU_TESS_COMBINE,
(GLvoid (CALLBACK*) ()) &combineCallback);
/* smooth shaded, self-intersecting star */
glNewList(startList + 1, GL_COMPILE);
glShadeModel(GL_SMOOTH);
glShadeModel(GL_SMOOTH);
gluTessProperty(tobj, GLU_TESS_WINDING_RULE,
GLU_TESS_WINDING_POSITIVE);
gluTessBeginPolygon(tobj, NULL);
@@ -228,7 +228,7 @@ int main(int argc, char** argv)
glutReshapeFunc(reshape);
glutKeyboardFunc(keyboard);
glutMainLoop();
return 0;
return 0;
}
#else

View File

@@ -1,4 +1,4 @@
# $Id: Makefile.X11,v 1.1 1999/08/19 00:55:41 jtg Exp $
# $Id: Makefile.X11,v 1.2 1999/10/27 10:09:53 brianp Exp $
# Mesa 3-D graphics library
# Version: 3.1
@@ -14,7 +14,7 @@
INCDIR = ../include
LIBDIR = ../lib
GL_LIBS = -L$(LIBDIR) -lglut -lGLU -lGL -lm $(XLIBS)
GL_LIBS = -L$(LIBDIR) -lglut -lGLU -lGL $(XLIBS)
LIB_DEP = $(LIBDIR)/$(GL_LIB) $(LIBDIR)/$(GLU_LIB) $(LIBDIR)/$(GLUT_LIB)

View File

@@ -1,4 +1,4 @@
# $Id: Makefile.X11,v 1.2 1999/09/16 16:41:03 brianp Exp $
# $Id: Makefile.X11,v 1.4.2.1 1999/11/12 15:43:25 brianp Exp $
# Mesa 3-D graphics library
# Version: 3.1
@@ -12,11 +12,11 @@
INCDIR = ../include
LIBDIR = ../lib
GL_LIBS = -L$(LIBDIR) -lglut -lGLU -lGL -lm $(XLIBS)
GL_LIBS = -L$(LIBDIR) -lglut -lGLU -lGL $(XLIBS)
LIB_DEP = $(LIBDIR)/$(GL_LIB) $(LIBDIR)/$(GLU_LIB) $(LIBDIR)/$(GLUT_LIB)
PROGS = glxdemo glxpixmap offset xdemo glxinfo
PROGS = glxdemo glxpixmap offset xdemo glxinfo xfont glxdpyinfo

1073
progs/xdemos/glxdpyinfo.c Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -1,148 +1,207 @@
/* $Id: xfont.c,v 1.3 1999/11/05 08:12:46 brianp Exp $ */
/*
* (c) Copyright 1993, Silicon Graphics, Inc.
* ALL RIGHTS RESERVED
* Permission to use, copy, modify, and distribute this software for
* any purpose and without fee is hereby granted, provided that the above
* copyright notice appear in all copies and that both the copyright notice
* and this permission notice appear in supporting documentation, and that
* the name of Silicon Graphics, Inc. not be used in advertising
* or publicity pertaining to distribution of the software without specific,
* written prior permission.
*
* THE MATERIAL EMBODIED ON THIS SOFTWARE IS PROVIDED TO YOU "AS-IS"
* AND WITHOUT WARRANTY OF ANY KIND, EXPRESS, IMPLIED OR OTHERWISE,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY OR
* FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
* GRAPHICS, INC. BE LIABLE TO YOU OR ANYONE ELSE FOR ANY DIRECT,
* SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY
* KIND, OR ANY DAMAGES WHATSOEVER, INCLUDING WITHOUT LIMITATION,
* LOSS OF PROFIT, LOSS OF USE, SAVINGS OR REVENUE, OR THE CLAIMS OF
* THIRD PARTIES, WHETHER OR NOT SILICON GRAPHICS, INC. HAS BEEN
* ADVISED OF THE POSSIBILITY OF SUCH LOSS, HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE
* POSSESSION, USE OR PERFORMANCE OF THIS SOFTWARE.
* Mesa 3-D graphics library
*
* US Government Users Restricted Rights
* Use, duplication, or disclosure by the Government is subject to
* restrictions set forth in FAR 52.227.19(c)(2) or subparagraph
* (c)(1)(ii) of the Rights in Technical Data and Computer Software
* clause at DFARS 252.227-7013 and/or in similar or successor
* clauses in the FAR or the DOD or NASA FAR Supplement.
* Unpublished-- rights reserved under the copyright laws of the
* United States. Contractor/manufacturer is Silicon Graphics,
* Inc., 2011 N. Shoreline Blvd., Mountain View, CA 94039-7311.
*
* OpenGL(TM) is a trademark of Silicon Graphics, Inc.
* 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.
*/
/*
* xfont.c
* Draws some text in a bitmapped font. Uses glBitmap()
* and other pixel routines. Also demonstrates use of
* display lists.
* Example of using glXUseXFont().
* 5 November 1999
* Brian Paul
*/
#include <GL/gl.h>
#include <GL/glu.h>
#include <GL/glx.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <stdlib.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "glaux.h"
GLuint base;
void makeRasterFont(void)
static const char *ProgramName = "xfont";
static const char *FontName = "fixed";
static GLuint FontBase = 0;
static void redraw( Display *dpy, Window w )
{
static const char *text = "This is glXUseXFont()";
glClear( GL_COLOR_BUFFER_BIT );
/* triangle */
glColor3f( 0.2, 0.2, 1.0 );
glBegin(GL_TRIANGLES);
glVertex2f( 0, 0.8 );
glVertex2f( -0.8, -0.7 );
glVertex2f( 0.8, -0.7 );
glEnd();
/* text */
glColor3f( 1, 1, 1 );
glRasterPos2f(-0.8, 0);
glListBase(FontBase);
glCallLists(strlen(text), GL_UNSIGNED_BYTE, (GLubyte *) text);
glXSwapBuffers( dpy, w );
}
static void resize( unsigned int width, unsigned int height )
{
glViewport( 0, 0, width, height );
glMatrixMode( GL_PROJECTION );
glLoadIdentity();
glOrtho( -1.0, 1.0, -1.0, 1.0, -1.0, 1.0 );
}
static void setup_font( Display *dpy )
{
XFontStruct *fontInfo;
Font id;
unsigned int first, last;
Display *xdisplay;
xdisplay = auxXDisplay ();
fontInfo = XLoadQueryFont(xdisplay,
"-adobe-helvetica-medium-r-normal--17-120-100-100-p-88-iso8859-1");
if (fontInfo == NULL) {
printf ("no font found\n");
exit (0);
fontInfo = XLoadQueryFont(dpy, FontName);
if (!fontInfo) {
printf("Error: font %s not found\n", FontName);
exit(0);
}
id = fontInfo->fid;
first = fontInfo->min_char_or_byte2;
last = fontInfo->max_char_or_byte2;
base = glGenLists((GLuint) last+1);
if (base == 0) {
printf ("out of display lists\n");
exit (0);
FontBase = glGenLists((GLuint) last + 1);
if (!FontBase) {
printf("Error: unable to allocate display lists\n");
exit(0);
}
glXUseXFont(id, first, last-first+1, base+first);
/* *height = fontInfo->ascent + fontInfo->descent;
*width = fontInfo->max_bounds.width; */
glXUseXFont(id, first, last - first + 1, FontBase + first);
}
void printString(char *s)
static Window make_rgb_db_window( Display *dpy, int xpos, int ypos,
unsigned int width, unsigned int height )
{
glPushAttrib (GL_LIST_BIT);
glListBase(base);
glCallLists(strlen(s), GL_UNSIGNED_BYTE, (GLubyte *)s);
glPopAttrib ();
int attrib[] = { GLX_RGBA,
GLX_RED_SIZE, 1,
GLX_GREEN_SIZE, 1,
GLX_BLUE_SIZE, 1,
GLX_DOUBLEBUFFER,
None };
int scrnum;
XSetWindowAttributes attr;
unsigned long mask;
Window root;
Window win;
GLXContext ctx;
XVisualInfo *visinfo;
scrnum = DefaultScreen( dpy );
root = RootWindow( dpy, scrnum );
visinfo = glXChooseVisual( dpy, scrnum, attrib );
if (!visinfo) {
printf("Error: couldn't get an RGB, Double-buffered visual\n");
exit(1);
}
/* window attributes */
attr.background_pixel = 0;
attr.border_pixel = 0;
attr.colormap = XCreateColormap( dpy, root, visinfo->visual, AllocNone);
attr.event_mask = StructureNotifyMask | ExposureMask | KeyPressMask;
mask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask;
win = XCreateWindow( dpy, root, 0, 0, width, height,
0, visinfo->depth, InputOutput,
visinfo->visual, mask, &attr );
{
XSizeHints sizehints;
sizehints.x = xpos;
sizehints.y = ypos;
sizehints.width = width;
sizehints.height = height;
sizehints.flags = USSize | USPosition;
XSetNormalHints(dpy, win, &sizehints);
XSetStandardProperties(dpy, win, ProgramName, ProgramName,
None, (char **)NULL, 0, &sizehints);
}
ctx = glXCreateContext( dpy, visinfo, NULL, True );
glXMakeCurrent( dpy, win, ctx );
return win;
}
void myinit (void)
static void event_loop( Display *dpy )
{
makeRasterFont ();
glShadeModel (GL_FLAT);
XEvent event;
while (1) {
XNextEvent( dpy, &event );
switch (event.type) {
case Expose:
redraw( dpy, event.xany.window );
break;
case ConfigureNotify:
resize( event.xconfigure.width, event.xconfigure.height );
break;
case KeyPress:
exit(0);
default:
; /* no-op */
}
}
}
void display(void)
int main( int argc, char *argv[] )
{
GLfloat white[3] = { 1.0, 1.0, 1.0 };
int i, j;
char teststring[33];
Display *dpy;
Window win;
glClear(GL_COLOR_BUFFER_BIT);
glColor3fv(white);
for (i = 32; i < 127; i += 32) {
glRasterPos2i(20, 200 - 18*(GLint) i/32);
for (j = 0; j < 32; j++)
teststring[j] = (char) (i+j);
teststring[32] = 0;
printString(teststring);
}
glRasterPos2i(20, 100);
printString("The quick brown fox jumps");
glRasterPos2i(20, 82);
printString("over a lazy dog.");
glFlush ();
dpy = XOpenDisplay(NULL);
win = make_rgb_db_window( dpy, 0, 0, 300, 300 );
setup_font( dpy );
glShadeModel( GL_FLAT );
glClearColor( 0.5, 0.5, 1.0, 1.0 );
XMapWindow( dpy, win );
event_loop( dpy );
return 0;
}
void myReshape(int w, int h)
{
glViewport(0, 0, w, h);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho (0.0, (GLfloat) w, 0.0, (GLfloat) h, -1.0, 1.0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
}
/* Main Loop
* Open window with initial window size, title bar,
* RGBA display mode, and handle input events.
*/
int main(int argc, char** argv)
{
auxInitDisplayMode (AUX_SINGLE | AUX_RGB);
auxInitPosition (0, 0, 500, 500);
if (!auxInitWindow (argv[0]))
auxQuit();
auxReshapeFunc (myReshape);
myinit ();
auxMainLoop(display);
return 0;
}

View File

@@ -29,7 +29,8 @@ 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
project.c quadric.c tess.c tess_fist.c tess_hash.c tess_heap.c \
tess_winding.c tess_clip.c
OBJECTS = $(SOURCES:.c=.o)

View File

@@ -19,9 +19,15 @@
# Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
# $Id: Makefile.BeOS-R4,v 1.4 1999/09/17 00:06:57 brianp Exp $
# $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
#
@@ -55,7 +61,8 @@ 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
project.c quadric.c tess.c tess_fist.c tess_hash.c tess_heap.c \
tess_winding.c tess_clip.c
OBJECTS = $(SOURCES:.c=.o)

View File

@@ -1,4 +1,4 @@
# $Id: Makefile.X11,v 1.5 1999/09/17 12:06:56 brianp Exp $
# $Id: Makefile.X11,v 1.6.2.1 1999/11/15 21:15:43 gareth Exp $
# Mesa 3-D graphics library
# Version: 3.1
@@ -19,7 +19,8 @@ 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
project.c quadric.c tess.c tess_fist.c tess_hash.c tess_heap.c \
tess_winding.c tess_clip.c
OBJECTS = $(SOURCES:.c=.o)

View File

@@ -15,11 +15,12 @@ LIBDIR = [-.lib]
CFLAGS = /include=$(INCDIR)/define=(FBIND=1)
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
project.c quadric.c tess.c tess_fist.c tess_hash.c tess_heap.c \
tess_winding.c tess_clip.c
OBJECTS =glu.obj,mipmap.obj,nurbs.obj,nurbscrv.obj,nurbssrf.obj,nurbsutl.obj,\
project.obj,quadric.obj,tess.obj,tess_fist.obj,tess_hash.obj,\
tess_heap.obj
tess_heap.obj,tess_winding.obj,tess_clip.obj

View File

@@ -1,4 +1,4 @@
/* $Id: glu.c,v 1.15 1999/09/19 02:03:19 tjump Exp $ */
/* $Id: glu.c,v 1.16.2.2 1999/11/22 22:18:13 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -23,6 +23,15 @@
/*
* $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
*
@@ -301,7 +310,7 @@ const GLubyte* GLAPIENTRY gluErrorString( GLenum errorCode )
"unconnected trim curves",
"unknown knot error",
"negative vertex count encountered",
"negative byte-stride encounteed",
"negative byte-stride encountered",
"unknown type descriptor",
"null control array or knot vector",
"duplicate point on pwlcurve"
@@ -364,7 +373,7 @@ const GLubyte* GLAPIENTRY gluErrorString( GLenum errorCode )
const GLubyte* GLAPIENTRY gluGetString( GLenum name )
{
static char *extensions = "GL_EXT_abgr GLU_EXT_get_proc_address";
static char *extensions = "GL_EXT_abgr";
static char *version = "1.2 Mesa 3.1";
switch (name) {
@@ -379,7 +388,7 @@ const GLubyte* GLAPIENTRY gluGetString( GLenum name )
#ifdef GLU_EXT_get_proc_address
#if 0 /* gluGetProcAddressEXT not finalized yet! */
#ifdef __cplusplus
/* for BeOS R4.5 */

View File

@@ -1,4 +1,4 @@
/* $Id: gluP.h,v 1.1 1999/08/19 00:55:42 jtg Exp $ */
/* $Id: gluP.h,v 1.1.1.1.2.1 1999/12/06 05:24:36 joukj Exp $ */
/*
* Mesa 3-D graphics library
@@ -23,8 +23,19 @@
/*
* $Log: gluP.h,v $
* Revision 1.1 1999/08/19 00:55:42 jtg
* Initial revision
* 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)
@@ -55,6 +66,7 @@
#include "GL/gl.h"
#include "GL/glu.h"
#include <string.h>
#ifndef MESA
/* If we're using the real OpenGL header files... */

View File

@@ -1,4 +1,4 @@
/* $Id: mipmap.c,v 1.2 1999/09/14 00:30:28 brianp Exp $ */
/* $Id: mipmap.c,v 1.3.2.1 1999/12/12 17:23:33 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -23,6 +23,12 @@
/*
* $Log: mipmap.c,v $
* Revision 1.3.2.1 1999/12/12 17:23:33 brianp
* removed unneeded code in gluBuild1DMipmaps()
*
* Revision 1.3 1999/11/09 06:16:59 brianp
* replace GLint with GLsizei in a gluScaleImage, gluBuild1/2DMipmaps()
*
* Revision 1.2 1999/09/14 00:30:28 brianp
* fixed pixel packing/unpacking code in gluBuild2DMipmaps()
*
@@ -105,9 +111,9 @@ void dummy(GLuint j, GLuint k){
GLint GLAPIENTRY gluScaleImage( GLenum format,
GLint widthin, GLint heightin,
GLsizei widthin, GLsizei heightin,
GLenum typein, const void *datain,
GLint widthout, GLint heightout,
GLsizei widthout, GLsizei heightout,
GLenum typeout, void *dataout )
{
GLint components, i, j, k;
@@ -633,7 +639,7 @@ static GLint bytes_per_pixel( GLenum format, GLenum type )
* WARNING: This function isn't finished and has never been tested!!!!
*/
GLint GLAPIENTRY gluBuild1DMipmaps( GLenum target, GLint components,
GLint width, GLenum format,
GLsizei width, GLenum format,
GLenum type, const void *data )
{
GLubyte *texture;
@@ -699,19 +705,13 @@ GLint GLAPIENTRY gluBuild1DMipmaps( GLenum target, GLint components,
free( texture );
/* make sure remaining mipmap levels are removed */
for (l=levels;l<max_levels;l++) {
glTexImage1D( GL_TEXTURE_1D, l, components, 0, 0,
format, GL_UNSIGNED_BYTE, NULL );
}
return 0;
}
GLint GLAPIENTRY gluBuild2DMipmaps( GLenum target, GLint components,
GLint width, GLint height, GLenum format,
GLsizei width, GLsizei height, GLenum format,
GLenum type, const void *data )
{
GLint w, h, maxsize;

View File

@@ -1,4 +1,4 @@
/* $Id: nurbs.c,v 1.1 1999/08/19 00:55:42 jtg Exp $ */
/* $Id: nurbs.c,v 1.2 1999/11/11 03:21:43 kendallb Exp $ */
/*
* Mesa 3-D graphics library
@@ -23,8 +23,25 @@
/*
* $Log: nurbs.c,v $
* Revision 1.1 1999/08/19 00:55:42 jtg
* Initial revision
* 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.14 1999/01/03 03:23:15 brianp
* now using GLAPIENTRY and GLCALLBACK keywords (Ted Jump)
@@ -600,12 +617,12 @@ void GLAPIENTRY gluNurbsSurface( GLUnurbsObj *nobj,
void GLAPIENTRY
gluNurbsCallback( GLUnurbsObj *nobj, GLenum which, void (GLCALLBACK *fn)())
gluNurbsCallback( GLUnurbsObj *nobj, GLenum which, void (GLCALLBACKP fn)())
{
#if defined(__CYGWIN32__) || defined(OPENSTEP)
nobj->error_callback = (void(*)(GLenum))fn;
#else
nobj->error_callback = (void(GLCALLBACK*)(GLenum))fn;
nobj->error_callback = (void(GLCALLBACKP)(GLenum))fn;
#endif
if(which!=GLU_ERROR)

View File

@@ -1,4 +1,4 @@
/* $Id: nurbs.h,v 1.1 1999/08/19 00:55:42 jtg Exp $ */
/* $Id: nurbs.h,v 1.2 1999/11/11 03:21:43 kendallb Exp $ */
/*
* Mesa 3-D graphics library
@@ -23,8 +23,25 @@
/*
* $Log: nurbs.h,v $
* Revision 1.1 1999/08/19 00:55:42 jtg
* Initial revision
* 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
@@ -151,7 +168,7 @@ typedef struct
struct GLUnurbs {
GLboolean culling;
GLenum error;
void (GLCALLBACK *error_callback)( GLenum err );
void (GLCALLBACKP error_callback)( GLenum err );
GLenum display_mode;
GLU_nurbs_enum nurbs_type;
GLboolean auto_load_matrix;

View File

@@ -1,4 +1,4 @@
/* $Id: quadric.c,v 1.1 1999/08/19 00:55:42 jtg Exp $ */
/* $Id: quadric.c,v 1.3 1999/11/11 09:55:39 joukj Exp $ */
/*
* Mesa 3-D graphics library
@@ -23,8 +23,29 @@
/*
* $Log: quadric.c,v $
* Revision 1.1 1999/08/19 00:55:42 jtg
* Initial revision
* Revision 1.3 1999/11/11 09:55:39 joukj
*
* tess_macro.h included
*
* 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.19 1999/02/27 13:55:31 brianp
* fixed BeOS-related GLU typedef problems
@@ -101,21 +122,11 @@
#include <stdio.h>
#include <stdlib.h>
#include "gluP.h"
#include "tess_macros.h"
#endif
#ifndef M_PI
# define M_PI (3.1415926)
#endif
/*
* Convert degrees to radians:
*/
#define DEG_TO_RAD(A) ((A)*(M_PI/180.0))
/*
* Sin and Cos for degree angles:
*/
@@ -135,7 +146,7 @@ struct GLUquadric {
GLenum Orientation; /* GLU_INSIDE or GLU_OUTSIDE */
GLboolean TextureFlag; /* Generate texture coords? */
GLenum Normals; /* GLU_NONE, GLU_FLAT, or GLU_SMOOTH */
void (GLCALLBACK *ErrorFunc)(GLenum err); /* Error handler callback function */
void (GLCALLBACKP ErrorFunc)(GLenum err); /* Error handler callback function */
};
@@ -221,7 +232,7 @@ void GLAPIENTRY gluQuadricOrientation( GLUquadricObj *quadObject,
* Set the error handler callback function.
*/
void GLAPIENTRY gluQuadricCallback( GLUquadricObj *qobj,
GLenum which, void (GLCALLBACK *fn)() )
GLenum which, void (GLCALLBACKP fn)() )
{
/*
* UGH, this is a mess! I thought ANSI was a standard.
@@ -232,13 +243,13 @@ void GLAPIENTRY gluQuadricCallback( GLUquadricObj *qobj,
#elif defined(OPENSTEP)
qobj->ErrorFunc = (void(*)(GLenum))fn;
#elif defined(_WIN32)
qobj->ErrorFunc = (void(GLCALLBACK*)(int))fn;
qobj->ErrorFunc = (void(GLCALLBACKP)(int))fn;
#elif defined(__STORM__)
qobj->ErrorFunc = (void(GLCALLBACK*)(GLenum))fn;
qobj->ErrorFunc = (void(GLCALLBACKP)(GLenum))fn;
#elif defined(__BEOS__)
qobj->ErrorFunc = (void(*)(GLenum))fn;
#else
qobj->ErrorFunc = (void(GLCALLBACK*)())fn;
qobj->ErrorFunc = (void(GLCALLBACKP)())fn;
#endif
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,21 +1,21 @@
/* $Id: tess.h,v 1.8 1999/09/17 06:31:02 gareth Exp $ */
/* $Id: tess.h,v 1.15.2.6 1999/12/05 17:01:17 gareth Exp $ */
/*
* Mesa 3-D graphics library
* Version: 3.1
*
*
* 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
@@ -24,28 +24,9 @@
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
/*
* $Log: tess.h,v $
* Revision 1.8 1999/09/17 06:31:02 gareth
* Winding rule updates.
*
* Revision 1.7 1999/09/16 06:42:01 gareth
* Misc winding rule bug fixes.
*
* Revision 1.6 1999/09/15 02:12:16 gareth
* Added debugging pragma message.
*
* Revision 1.5 1999/09/14 22:46:02 gareth
* Added debugging output.
*
* Revision 1.4 1999/09/13 22:20:13 gareth
* Fixed file headers. Tracking down macro bugs.
*
*/
/*****************************************************************************
*
* GLU 1.3 Polygon Tessellation by Gareth Hughes <garethh@lucent.com>
* GLU 1.3 Polygon Tessellation by Gareth Hughes <garethh@bell-labs.com>
*
*****************************************************************************/
@@ -58,6 +39,7 @@
#include "gluP.h"
#include "tess_typedefs.h"
#include "tess_macros.h"
#include "tess_hash.h"
#include "tess_heap.h"
#if 0
@@ -74,55 +56,74 @@ extern "C" {
struct GLUtesselator
{
tess_callbacks_t callbacks;
GLboolean boundary_only;
GLenum winding_rule;
GLboolean boundary_only;
GLdouble tolerance;
tess_plane_t plane;
GLuint contour_count;
GLenum orientation;
void *data;
GLint num_contours;
tess_contour_t *contours, *last_contour;
tess_contour_t *current_contour;
GLdouble mins[2], maxs[2];
GLuint vertex_count;
GLint num_vertices;
tess_vertex_t **sorted_vertices;
#if 0
tess_grid_t *grid; /* Not currently used... */
#endif
heap_t *ears;
hashtable_t *cvc_lists;
GLboolean edge_flag;
GLuint label;
tess_plane_t plane;
GLenum error;
};
/*****************************************************************************
* Tessellation error handler:
* Common tessellation functions:
*****************************************************************************/
extern void tess_error_callback( GLUtesselator *, GLenum, void * );
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 );
/*****************************************************************************
* Debugging output: (to be removed...)
* Debugging output:
*****************************************************************************/
#ifdef DEBUG
extern int tess_debug_level;
int vdebugstr( char *format_str, ... );
extern int tess_dbg_level;
#pragma message( "tess: using DEBUGP for debugging output" )
#define DEBUGP(level, body) \
do { \
if ( tess_debug_level >= level ) { \
vdebugstr( "%11.11s:%-5d ", __FILE__, __LINE__, level ); \
vdebugstr body; \
fflush( stderr ); \
} \
} while ( 0 )
#define DEBUGIF(level) do { if ( tess_debug_level >= level ) {
#define DEBUGENDIF } } while ( 0 )
#define DBG_LEVEL_BASE 1
#define DBG_LEVEL_VERBOSE 10
#define DBG_LEVEL_ENTEREXIT 20
#ifdef _WIN32
#define DBG_STREAM stdout
#else
#define DEBUGP(level, body)
#define DEBUGIF(level) while(0) {
#define DEBUGENDIF }
#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

View File

@@ -1,6 +1,5 @@
## BeOS Generic Makefile v2.0 ##
## Modified by Brian Paul to work with Mesa 3.1
## Fill in this file to specify the project being created, and the referenced
@@ -48,9 +47,8 @@ RSRCS=
# naming scheme you need to specify the path to the library
# and it's name
# library: my_lib.a entry: my_lib.a or path/my_lib.a
#LIBS= MesaGL MesaGLU be
LIBS= GL GLU be
# specify additional paths to directories following the standard
# libXXX.so or libXXX.a naming scheme. You can specify full paths
# or paths relative to the makefile. The paths included may not

View File

@@ -129,26 +129,29 @@ __glutXGetLayerVisualInfo(Display * dpy, long lvinfo_mask,
break;
}
}
if (lvinfo_mask & VisualLayerMask)
if (lvinfo_mask & VisualLayerMask) {
if (overlayInfo == NULL) {
if (lvinfo_template->layer != 0)
continue;
} else if (lvinfo_template->layer != overlayInfo->layer)
continue;
if (lvinfo_mask & VisualTransparentType)
}
if (lvinfo_mask & VisualTransparentType) {
if (overlayInfo == NULL) {
if (lvinfo_template->type != None)
continue;
} else if (lvinfo_template->type !=
overlayInfo->transparent_type)
continue;
if (lvinfo_mask & VisualTransparentValue)
}
if (lvinfo_mask & VisualTransparentValue) {
if (overlayInfo == NULL)
/* Non-overlay visuals have no sense of
TransparentValue. */
continue;
else if (lvinfo_template->value != overlayInfo->value)
continue;
}
layerInfo[count].vinfo = *pVinfo;
if (overlayInfo == NULL) {
layerInfo[count].layer = 0;

View File

@@ -1,4 +1,4 @@
# $Id: Makefile.X11,v 1.5 1999/09/17 12:07:10 brianp Exp $
# $Id: Makefile.X11,v 1.6.2.1 1999/11/16 15:25:50 brianp Exp $
# Mesa 3-D graphics library
# Version: 3.1
@@ -46,6 +46,7 @@ CORE_SOURCES = \
feedback.c \
fog.c \
get.c \
glmisc.c \
hash.c \
image.c \
light.c \
@@ -53,7 +54,6 @@ CORE_SOURCES = \
logic.c \
masking.c \
matrix.c \
misc.c \
mmath.c \
mthreads.c \
pb.c \
@@ -220,7 +220,8 @@ X86/3dnow.o: X86/3dnow.c
# @echo "Specify a target configuration"
clean:
-rm *.o *~ */*.o */*~
-rm *.o *~ */*.o */*~ *.lo *.la
-rm -rf .libs
targets: $(LIBDIR)/$(GL_LIB)

View File

@@ -0,0 +1,8 @@
genkgi.conf
.deps
.libs
Makefile
Makefile.in
*.lo
*.o
*.la

View File

@@ -0,0 +1,8 @@
fbdev.conf
.deps
.libs
Makefile
Makefile.in
*.lo
*.o
*.la

View File

@@ -0,0 +1,7 @@
.deps
.libs
Makefile
Makefile.in
*.lo
*.o
*.la

View File

@@ -0,0 +1,7 @@
.deps
.libs
Makefile
Makefile.in
*.lo
*.o
*.la

View File

@@ -0,0 +1,7 @@
.deps
.libs
Makefile
Makefile.in
*.lo
*.o
*.la

View File

@@ -1,24 +1,52 @@
/* -*- mode: C; tab-width:8; -*-
fxapi.c - 3Dfx VooDoo/Mesa interface
*/
/* -*- mode: C; tab-width:8; -*- */
/*
* 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.
* Mesa 3-D graphics library
* Version: 3.1
*
* 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.
* Copyright (C) 1999 Brian Paul All Rights Reserved.
*
* 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.
* 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.
*
*
* Original Mesa / 3Dfx device driver (C) 1999 David Bucciarelli, by the
* terms stated above.
*
* Thank you for your contribution, David!
*
* Please make note of the above copyright/license statement. If you
* contributed code or bug fixes to this code under the previous (GNU
* Library) license and object to the new license, your code will be
* removed at your request. Please see the Mesa docs/COPYRIGHT file
* for more information.
*
* Additional Mesa/3Dfx driver developers:
* Daryll Strauss <daryll@precisioninsight.com>
* Keith Whitwell <keith@precisioninsight.com>
*
* See fxapi.h for more revision/author details.
*/
/* fxapi.c - 3Dfx VooDoo/Mesa interface */
/********************************************************************
*
* Function names:
* fxMesa.... (The driver API)
@@ -820,336 +848,254 @@ void fxsignals()
/*
* Create a new FX/Mesa context and return a handle to it.
*/
fxMesaContext GLAPIENTRY fxMesaCreateContext(GLuint win,GrScreenResolution_t res,
GrScreenRefresh_t ref,
const GLint attribList[])
fxMesaContext GLAPIENTRY fxMesaCreateContext(GLuint win,
GrScreenResolution_t res,
GrScreenRefresh_t ref,
const GLint attribList[])
{
fxMesaContext fxMesa;
int i,type;
int aux;
GLboolean doubleBuffer=GL_FALSE;
GLboolean alphaBuffer=GL_FALSE;
GLboolean verbose=GL_FALSE;
GLint depthSize=0;
GLint stencilSize=0;
GLint accumSize=0;
GLcontext *shareCtx = NULL;
GLcontext *ctx = 0;
FX_GrContext_t glideContext = 0;
char *errorstr;
fxMesaContext fxMesa = NULL;
int i,type;
int aux;
GLboolean doubleBuffer=GL_FALSE;
GLboolean alphaBuffer=GL_FALSE;
GLboolean verbose=GL_FALSE;
GLint depthSize=0;
GLint stencilSize=0;
GLint accumSize=0;
GLcontext *shareCtx = NULL;
GLcontext *ctx = 0;
/*FX_GrContext_t glideContext = 0;*/
char *errorstr;
if (MESA_VERBOSE&VERBOSE_DRIVER) {
fprintf(stderr,"fxmesa: fxMesaCreateContext() Start\n");
}
if (MESA_VERBOSE&VERBOSE_DRIVER) {
fprintf(stderr,"fxmesa: fxMesaCreateContext() Start\n");
}
if(getenv("MESA_FX_INFO"))
verbose=GL_TRUE;
if(getenv("MESA_FX_INFO"))
verbose=GL_TRUE;
aux=0;
i=0;
while(attribList[i]!=FXMESA_NONE) {
switch (attribList[i]) {
case FXMESA_DOUBLEBUFFER:
doubleBuffer=GL_TRUE;
break;
case FXMESA_ALPHA_SIZE:
i++;
alphaBuffer=attribList[i]>0;
if(alphaBuffer)
aux=1;
break;
case FXMESA_DEPTH_SIZE:
i++;
depthSize=attribList[i];
if(depthSize)
aux=1;
break;
case FXMESA_STENCIL_SIZE:
i++;
stencilSize=attribList[i];
break;
case FXMESA_ACCUM_SIZE:
i++;
accumSize=attribList[i];
break;
/* XXX ugly hack here for sharing display lists */
aux=0;
i=0;
while(attribList[i]!=FXMESA_NONE) {
switch (attribList[i]) {
case FXMESA_DOUBLEBUFFER:
doubleBuffer=GL_TRUE;
break;
case FXMESA_ALPHA_SIZE:
i++;
alphaBuffer=attribList[i]>0;
if(alphaBuffer)
aux=1;
break;
case FXMESA_DEPTH_SIZE:
i++;
depthSize=attribList[i];
if(depthSize)
aux=1;
break;
case FXMESA_STENCIL_SIZE:
i++;
stencilSize=attribList[i];
break;
case FXMESA_ACCUM_SIZE:
i++;
accumSize=attribList[i];
break;
/* XXX ugly hack here for sharing display lists */
#define FXMESA_SHARE_CONTEXT 990099 /* keep in sync with xmesa1.c! */
case FXMESA_SHARE_CONTEXT:
case FXMESA_SHARE_CONTEXT:
i++;
{
const void *vPtr = &attribList[i];
GLcontext **ctx = (GLcontext **) vPtr;
shareCtx = *ctx;
}
break;
default:
if (MESA_VERBOSE&VERBOSE_DRIVER) {
fprintf(stderr,"fxmesa: fxMesaCreateContext() End (defualt)\n");
}
return NULL;
}
i++;
{
const void *vPtr = &attribList[i];
GLcontext **ctx = (GLcontext **) vPtr;
shareCtx = *ctx;
}
break;
default:
if (MESA_VERBOSE&VERBOSE_DRIVER) {
fprintf(stderr,"fxmesa: fxMesaCreateContext() End (defualt)\n");
}
}
/* A workaround for Linux GLQuake */
if(depthSize && alphaBuffer)
alphaBuffer=0;
if(verbose)
fprintf(stderr,"Mesa fx Voodoo Device Driver v0.30\nWritten by David Bucciarelli (davibu@tin.it.it)\n");
if((type=fxQueryHardware()) < 0) {
fprintf(stderr,"fx Driver: ERROR no Voodoo1/2 Graphics or Voodoo Rush !\n");
return NULL;
}
i++;
}
}
/* A workaround for Linux GLQuake */
if(depthSize && alphaBuffer)
alphaBuffer=0;
if(verbose)
fprintf(stderr,"Mesa fx Voodoo Device Driver v0.30\nWritten by David Bucciarelli (davibu@tin.it.it)\n");
if((type=fxQueryHardware()) >= 0) {
if(type==GR_SSTTYPE_VOODOO)
if(type==GR_SSTTYPE_VOODOO)
win=0;
grSstSelect(glbCurrentBoard);
grSstSelect(glbCurrentBoard);
fxMesa=(fxMesaContext)calloc(1,sizeof(struct tfxMesaContext));
if(!fxMesa) {
errorstr = "malloc";
goto errorhandler;
}
if(glbHWConfig.SSTs[glbCurrentBoard].type==GR_SSTTYPE_VOODOO)
fxMesa->haveTwoTMUs=(glbHWConfig.SSTs[glbCurrentBoard].sstBoard.VoodooConfig.nTexelfx > 1);
else if(glbHWConfig.SSTs[glbCurrentBoard].type==GR_SSTTYPE_SST96)
fxMesa->haveTwoTMUs=(glbHWConfig.SSTs[glbCurrentBoard].sstBoard.SST96Config.nTexelfx > 1);
else
fxMesa->haveTwoTMUs=GL_FALSE;
fxMesa->haveDoubleBuffer=doubleBuffer;
fxMesa->haveAlphaBuffer=alphaBuffer;
fxMesa->haveGlobalPaletteTexture=GL_FALSE;
fxMesa->haveZBuffer=depthSize ? 1 : 0;
fxMesa->verbose=verbose;
fxMesa->board=glbCurrentBoard;
#if FXMESA_USE_ARGB
glideContext = FX_grSstWinOpen((FxU32)win,res,ref,
GR_COLORFORMAT_ARGB,GR_ORIGIN_LOWER_LEFT,2,aux);
fxMesa->glideContext = FX_grSstWinOpen((FxU32)win,res,ref,
GR_COLORFORMAT_ARGB,
GR_ORIGIN_LOWER_LEFT,
2,aux);
#else
glideContext = FX_grSstWinOpen((FxU32)win,res,ref,
GR_COLORFORMAT_ABGR,GR_ORIGIN_LOWER_LEFT,2,aux);
fxMesa->glideContext = FX_grSstWinOpen((FxU32)win,res,ref,
GR_COLORFORMAT_ABGR,
GR_ORIGIN_LOWER_LEFT,
2,aux);
#endif
if (!glideContext){
if (!fxMesa->glideContext){
errorstr = "grSstWinOpen";
goto errorhandler;
}
}
/* Pixel tables are use during pixel read-back */
#if FXMESA_USE_ARGB
fxInitPixelTables(GL_FALSE); /* Force RGB pixel order */
#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
* as Voodoo3s have 2 TMUs on board, Banshee has only 1
* Thanks to Joseph Kain for that one
*/
if (glbHWConfig.SSTs[glbCurrentBoard].sstBoard.VoodooConfig.nTexelfx == 2) {
fxInitPixelTables(GL_FALSE); /* use RGB pixel order (Voodoo3) */
}
else {
fxInitPixelTables(GL_TRUE); /* use BGR pixel order on Voodoo1/2 */
}
}
else {
fxInitPixelTables(GL_FALSE); /* use RGB pixel order otherwise */
}
#endif
if(verbose)
fxMesa->width=FX_grSstScreenWidth();
fxMesa->height=FX_grSstScreenHeight();
fxMesa->clipMinX = 0;
fxMesa->clipMaxX = fxMesa->width;
fxMesa->clipMinY = 0;
fxMesa->clipMaxY = fxMesa->height;
fxMesa->screen_width = fxMesa->width;
fxMesa->screen_height = fxMesa->height;
fxMesa->x_offset = 0;
fxMesa->y_offset = 0;
fxMesa->y_delta = 0;
fxMesa->needClip = 0;
if(verbose)
fprintf(stderr,"Glide screen size: %dx%d\n",
(int)FX_grSstScreenWidth(),(int)FX_grSstScreenHeight());
} else {
fprintf(stderr,"fx Driver: ERROR no Voodoo1/2 Graphics or Voodoo Rush !\n");
return NULL;
}
fxMesa=(fxMesaContext)calloc(1,sizeof(struct tfxMesaContext));
if(!fxMesa) {
errorstr = "malloc";
goto errorhandler;
}
FX_setupGrVertexLayout();
fxMesa->glideContext = glideContext;
fxMesa->board=glbCurrentBoard;
fxMesa->width=FX_grSstScreenWidth();
fxMesa->height=FX_grSstScreenHeight();
fxMesa->glVis=gl_create_visual(GL_TRUE, /* RGB mode */
alphaBuffer,
doubleBuffer,
GL_FALSE, /* stereo */
depthSize, /* depth_size */
stencilSize, /* stencil_size */
accumSize, /* accum_size */
0, /* index bits */
5,6,5,0); /* RGBA bits */
if (!fxMesa->glVis) {
errorstr = "gl_create_visual";
goto errorhandler;
}
fxMesa->verbose=verbose;
if(glbHWConfig.SSTs[glbCurrentBoard].type==GR_SSTTYPE_VOODOO)
fxMesa->haveTwoTMUs=(glbHWConfig.SSTs[glbCurrentBoard].sstBoard.VoodooConfig.nTexelfx > 1);
else if(glbHWConfig.SSTs[glbCurrentBoard].type==GR_SSTTYPE_SST96)
fxMesa->haveTwoTMUs=(glbHWConfig.SSTs[glbCurrentBoard].sstBoard.SST96Config.nTexelfx > 1);
else
fxMesa->haveTwoTMUs=GL_FALSE;
if (getenv("FX_EMULATE_SINGLE_TMU")) {
if (MESA_VERBOSE&VERBOSE_DRIVER)
fprintf(stderr, "\n\nEmulating single tmu\n\n");
fxMesa->haveTwoTMUs = GL_FALSE;
}
fxMesa->emulateTwoTMUs = fxMesa->haveTwoTMUs;
if (!getenv("FX_DONT_FAKE_MULTITEX")) {
if (MESA_VERBOSE&VERBOSE_DRIVER) {
if (!fxMesa->haveTwoTMUs)
fprintf(stderr, "\n\nEmulating multitexture\n\n");
}
fxMesa->emulateTwoTMUs = GL_TRUE;
}
fxMesa->haveDoubleBuffer=doubleBuffer;
fxMesa->haveAlphaBuffer=alphaBuffer;
fxMesa->haveGlobalPaletteTexture=GL_FALSE;
if(getenv("FX_GLIDE_SWAPINTERVAL"))
fxMesa->swapInterval=atoi(getenv("FX_GLIDE_SWAPINTERVAL"));
else
fxMesa->swapInterval=1;
if(getenv("MESA_FX_SWAP_PENDING"))
fxMesa->maxPendingSwapBuffers=atoi(getenv("MESA_FX_SWAP_PENDING"));
else
fxMesa->maxPendingSwapBuffers=2;
fxMesa->color=0xffffffff;
fxMesa->clearC=0;
fxMesa->clearA=0;
fxMesa->stats.swapBuffer=0;
fxMesa->stats.reqTexUpload=0;
fxMesa->stats.texUpload=0;
fxMesa->stats.memTexUpload=0;
fxMesa->tmuSrc=FX_TMU_NONE;
fxMesa->lastUnitsMode=FX_UM_NONE;
fxTMInit(fxMesa);
/* FX units setup */
fxMesa->unitsState.alphaTestEnabled=GL_FALSE;
fxMesa->unitsState.alphaTestFunc=GR_CMP_ALWAYS;
fxMesa->unitsState.alphaTestRefValue=0;
fxMesa->unitsState.blendEnabled=GL_FALSE;
fxMesa->unitsState.blendSrcFuncRGB=GR_BLEND_ONE;
fxMesa->unitsState.blendDstFuncRGB=GR_BLEND_ZERO;
fxMesa->unitsState.blendSrcFuncAlpha=GR_BLEND_ONE;
fxMesa->unitsState.blendDstFuncAlpha=GR_BLEND_ZERO;
fxMesa->unitsState.depthTestEnabled =GL_FALSE;
fxMesa->unitsState.depthMask =GL_TRUE;
fxMesa->unitsState.depthTestFunc =GR_CMP_LESS;
grColorMask(FXTRUE,alphaBuffer ? FXTRUE : FXFALSE);
if(doubleBuffer) {
fxMesa->currentFB=GR_BUFFER_BACKBUFFER;
grRenderBuffer(GR_BUFFER_BACKBUFFER);
} else {
fxMesa->currentFB=GR_BUFFER_FRONTBUFFER;
grRenderBuffer(GR_BUFFER_FRONTBUFFER);
}
fxMesa->state = NULL;
fxMesa->fogTable = NULL;
fxMesa->state = malloc(FX_grGetInteger(FX_GLIDE_STATE_SIZE));
fxMesa->fogTable = malloc(FX_grGetInteger(FX_FOG_TABLE_ENTRIES)*sizeof(GrFog_t));
if (!fxMesa->state || !fxMesa->fogTable) {
errorstr = "malloc";
goto errorhandler;
}
if(depthSize)
grDepthBufferMode(GR_DEPTHBUFFER_ZBUFFER);
#if (!FXMESA_USE_ARGB)
grLfbWriteColorFormat(GR_COLORFORMAT_ABGR); /* Not every Glide supports this */
#endif
fxMesa->glVis=gl_create_visual(GL_TRUE, /* RGB mode */
alphaBuffer,
doubleBuffer,
GL_FALSE, /* stereo */
depthSize, /* depth_size */
stencilSize, /* stencil_size */
accumSize, /* accum_size */
0, /* index bits */
5,6,5,0); /* RGBA bits */
if (!fxMesa->glVis) {
errorstr = "gl_create_visual";
goto errorhandler;
}
ctx = fxMesa->glCtx=gl_create_context(fxMesa->glVis,
shareCtx, /* share list context */
(void *) fxMesa, GL_TRUE);
if (!ctx) {
errorstr = "gl_create_context";
goto errorhandler;
}
fxMesa->glBuffer=gl_create_framebuffer(fxMesa->glVis);
if (!fxMesa->glBuffer) {
errorstr = "gl_create_framebuffer";
goto errorhandler;
}
fxMesa->glCtx->Const.MaxTextureLevels=9;
fxMesa->glCtx->Const.MaxTextureSize=256;
fxMesa->glCtx->Const.MaxTextureUnits=fxMesa->emulateTwoTMUs ? 2 : 1;
fxMesa->glCtx->NewState|=NEW_DRVSTATE1;
fxMesa->new_state = NEW_ALL;
fxDDSetupInit();
fxDDCvaInit();
fxDDClipInit();
fxDDTrifuncInit();
fxDDFastPathInit();
fxSetupDDPointers(fxMesa->glCtx);
fxDDRenderInit(fxMesa->glCtx);
fxDDInitExtensions(fxMesa->glCtx);
fxDDSetNearFar(fxMesa->glCtx,1.0,100.0);
grGlideGetState((GrState*)fxMesa->state);
/* XXX Fix me: callback not registered when main VB is created.
*/
if (fxMesa->glCtx->VB)
fxDDRegisterVB( fxMesa->glCtx->VB );
/* XXX Fix me too: need to have the 'struct dd' prepared prior to
* creating the context... The below is broken if you try to insert
* new stages.
*/
if (ctx->NrPipelineStages)
ctx->NrPipelineStages = fxDDRegisterPipelineStages( ctx->PipelineStage,
ctx->PipelineStage,
ctx->NrPipelineStages);
glbTotNumCtx++;
/* Run the config file */
gl_context_initialize( fxMesa->glCtx );
/* install signal handlers */
#if defined(__linux__)
if (fxMesa->glCtx->CatchSignals) {
signal(SIGINT,cleangraphics_handler);
signal(SIGHUP,cleangraphics_handler);
signal(SIGPIPE,cleangraphics_handler);
signal(SIGFPE,cleangraphics_handler);
signal(SIGBUS,cleangraphics_handler);
signal(SIGILL,cleangraphics_handler);
signal(SIGSEGV,cleangraphics_handler);
signal(SIGTERM,cleangraphics_handler);
}
#endif
if (MESA_VERBOSE&VERBOSE_DRIVER) {
fprintf(stderr,"fxmesa: fxMesaCreateContext() End\n");
}
return fxMesa;
errorhandler:
if (fxMesa) {
if (fxMesa->glideContext)
FX_grSstWinClose(fxMesa->glideContext);
fxMesa->glideContext = 0;
if (fxMesa->state)
free(fxMesa->state);
if (fxMesa && fxMesa->fogTable)
free(fxMesa->fogTable);
if (fxMesa->glBuffer)
gl_destroy_framebuffer(fxMesa->glBuffer);
if (fxMesa->glVis)
gl_destroy_visual(fxMesa->glVis);
if (fxMesa->glCtx)
gl_destroy_context(fxMesa->glCtx);
free(fxMesa);
ctx = fxMesa->glCtx=gl_create_context(fxMesa->glVis,
shareCtx, /* share list context */
(void *) fxMesa, GL_TRUE);
if (!ctx) {
errorstr = "gl_create_context";
goto errorhandler;
}
if (!fxDDInitFxMesaContext( fxMesa )) {
errorstr = "fxDDInitFxMesaContext failed";
goto errorhandler;
}
if (MESA_VERBOSE&VERBOSE_DRIVER) {
fxMesa->glBuffer=gl_create_framebuffer(fxMesa->glVis);
if (!fxMesa->glBuffer) {
errorstr = "gl_create_framebuffer";
goto errorhandler;
}
glbTotNumCtx++;
/* install signal handlers */
#if defined(__linux__)
if (fxMesa->glCtx->CatchSignals) {
signal(SIGINT,cleangraphics_handler);
signal(SIGHUP,cleangraphics_handler);
signal(SIGPIPE,cleangraphics_handler);
signal(SIGFPE,cleangraphics_handler);
signal(SIGBUS,cleangraphics_handler);
signal(SIGILL,cleangraphics_handler);
signal(SIGSEGV,cleangraphics_handler);
signal(SIGTERM,cleangraphics_handler);
}
#endif
if (MESA_VERBOSE&VERBOSE_DRIVER) {
fprintf(stderr,"fxmesa: fxMesaCreateContext() End\n");
}
return fxMesa;
errorhandler:
if (fxMesa) {
if (fxMesa->glideContext)
FX_grSstWinClose(fxMesa->glideContext);
fxMesa->glideContext = 0;
if (fxMesa->state)
free(fxMesa->state);
if (fxMesa->fogTable)
free(fxMesa->fogTable);
if (fxMesa->glBuffer)
gl_destroy_framebuffer(fxMesa->glBuffer);
if (fxMesa->glVis)
gl_destroy_visual(fxMesa->glVis);
if (fxMesa->glCtx)
gl_destroy_context(fxMesa->glCtx);
free(fxMesa);
}
if (MESA_VERBOSE&VERBOSE_DRIVER) {
fprintf(stderr,"fxmesa: fxMesaCreateContext() End (%s)\n",errorstr);
}
return NULL;
}
return NULL;
}
@@ -1324,7 +1270,7 @@ int GLAPIENTRY fxQueryHardware(void)
char buf[80];
FX_grGlideGetVersion(buf);
fprintf(stderr,"Using Glide V%s\n",0);
fprintf(stderr,"Using Glide V%s\n","");
fprintf(stderr,"Number of boards: %d\n",glbHWConfig.num_sst);
if(glbHWConfig.SSTs[glbCurrentBoard].type==GR_SSTTYPE_VOODOO) {

View File

@@ -1,38 +1,100 @@
/* -*- mode: C; tab-width:8; -*-
fxdd.c - 3Dfx VooDoo Mesa device driver functions
*/
/* -*- mode: C; tab-width:8; c-basic-offset:2 -*- */
/*
* 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.
* Mesa 3-D graphics library
* Version: 3.1
*
* 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.
* Copyright (C) 1999 Brian Paul All Rights Reserved.
*
* 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.
* 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:
*
* See the file fxapi.c for more informations about authors
* 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.
*
*
* Original Mesa / 3Dfx device driver (C) 1999 David Bucciarelli, by the
* terms stated above.
*
* Thank you for your contribution, David!
*
* Please make note of the above copyright/license statement. If you
* contributed code or bug fixes to this code under the previous (GNU
* Library) license and object to the new license, your code will be
* removed at your request. Please see the Mesa docs/COPYRIGHT file
* for more information.
*
* Additional Mesa/3Dfx driver developers:
* Daryll Strauss <daryll@precisioninsight.com>
* Keith Whitwell <keith@precisioninsight.com>
*
* See fxapi.h for more revision/author details.
*/
/* fxdd.c - 3Dfx VooDoo Mesa device driver functions */
#ifdef HAVE_CONFIG_H
#include "conf.h"
#endif
#if defined(FX)
#include "types.h"
#include "fxdrv.h"
#include "enums.h"
#include "extensions.h"
/* These lookup table are used to extract RGB values in [0,255] from
* 16-bit pixel values.
*/
GLubyte FX_PixelToR[0x10000];
GLubyte FX_PixelToG[0x10000];
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)
{
GLuint pixel;
for (pixel = 0; pixel <= 0xffff; pixel++) {
GLuint r, g, b;
if (bgrOrder) {
r = (pixel & 0x001F) << 3;
g = (pixel & 0x07E0) >> 3;
b = (pixel & 0xF800) >> 8;
}
else {
r = (pixel & 0xF800) >> 8;
g = (pixel & 0x07E0) >> 3;
b = (pixel & 0x001F) << 3;
}
r = r * 255 / 0xF8; /* fill in low-order bits */
g = g * 255 / 0xFC;
b = b * 255 / 0xF8;
FX_PixelToR[pixel] = r;
FX_PixelToG[pixel] = g;
FX_PixelToB[pixel] = b;
}
}
/**********************************************************************/
/***** Miscellaneous functions *****/
/**********************************************************************/
@@ -44,10 +106,11 @@ void fxDDDither(GLcontext *ctx, GLboolean enable)
fprintf(stderr,"fxmesa: fxDDDither()\n");
}
if(enable)
grDitherMode(GR_DITHER_4x4);
else
grDitherMode(GR_DITHER_DISABLE);
if (enable) {
FX_grDitherMode(GR_DITHER_4x4);
} else {
FX_grDitherMode(GR_DITHER_DISABLE);
}
}
@@ -120,14 +183,14 @@ static GLbitfield fxDDClear(GLcontext *ctx, GLbitfield mask, GLboolean all,
/* clear color and depth buffer */
if (ctx->Color.DrawDestMask & BACK_LEFT_BIT) {
grRenderBuffer(GR_BUFFER_BACKBUFFER);
grBufferClear(fxMesa->clearC, fxMesa->clearA,
(FxU16)(ctx->Depth.Clear*0xffff));
FX_grRenderBuffer(GR_BUFFER_BACKBUFFER);
FX_grBufferClear(fxMesa->clearC, fxMesa->clearA,
(FxU16)(ctx->Depth.Clear*0xffff));
}
if (ctx->Color.DrawDestMask & FRONT_LEFT_BIT) {
grRenderBuffer(GR_BUFFER_FRONTBUFFER);
grBufferClear(fxMesa->clearC, fxMesa->clearA,
(FxU16)(ctx->Depth.Clear*0xffff));
FX_grRenderBuffer(GR_BUFFER_FRONTBUFFER);
FX_grBufferClear(fxMesa->clearC, fxMesa->clearA,
(FxU16)(ctx->Depth.Clear*0xffff));
}
newmask=mask & (~(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT));
@@ -136,19 +199,20 @@ static GLbitfield fxDDClear(GLcontext *ctx, GLbitfield mask, GLboolean all,
/* clear color buffer */
if(ctx->Color.ColorMask) {
grDepthMask(FXFALSE);
FX_grDepthMask(FXFALSE);
if (ctx->Color.DrawDestMask & BACK_LEFT_BIT) {
grRenderBuffer(GR_BUFFER_BACKBUFFER);
grBufferClear(fxMesa->clearC, fxMesa->clearA, 0);
FX_grRenderBuffer(GR_BUFFER_BACKBUFFER);
FX_grBufferClear(fxMesa->clearC, fxMesa->clearA, 0);
}
if (ctx->Color.DrawDestMask & FRONT_LEFT_BIT) {
grRenderBuffer(GR_BUFFER_FRONTBUFFER);
grBufferClear(fxMesa->clearC, fxMesa->clearA, 0);
FX_grRenderBuffer(GR_BUFFER_FRONTBUFFER);
FX_grBufferClear(fxMesa->clearC, fxMesa->clearA, 0);
}
if(ctx->Depth.Mask)
grDepthMask(FXTRUE);
if(ctx->Depth.Mask) {
FX_grDepthMask(FXTRUE);
}
}
newmask=mask & (~(GL_COLOR_BUFFER_BIT));
@@ -157,14 +221,14 @@ static GLbitfield fxDDClear(GLcontext *ctx, GLbitfield mask, GLboolean all,
/* clear depth buffer */
if(ctx->Depth.Mask) {
grColorMask(FXFALSE,FXFALSE);
grBufferClear(fxMesa->clearC, fxMesa->clearA,
(FxU16)(ctx->Depth.Clear*0xffff));
FX_grColorMask(FXFALSE,FXFALSE);
FX_grBufferClear(fxMesa->clearC, fxMesa->clearA,
(FxU16)(ctx->Depth.Clear*0xffff));
grColorMask(ctx->Color.ColorMask[RCOMP] ||
ctx->Color.ColorMask[GCOMP] ||
ctx->Color.ColorMask[BCOMP],
ctx->Color.ColorMask[ACOMP] && fxMesa->haveAlphaBuffer);
FX_grColorMask(ctx->Color.ColorMask[RCOMP] ||
ctx->Color.ColorMask[GCOMP] ||
ctx->Color.ColorMask[BCOMP],
ctx->Color.ColorMask[ACOMP] && fxMesa->haveAlphaBuffer);
}
newmask=mask & (~(GL_DEPTH_BUFFER_BIT));
@@ -189,12 +253,12 @@ static GLboolean fxDDSetBuffer(GLcontext *ctx, GLenum mode )
if (mode == GL_FRONT_LEFT) {
fxMesa->currentFB = GR_BUFFER_FRONTBUFFER;
grRenderBuffer(fxMesa->currentFB);
FX_grRenderBuffer(fxMesa->currentFB);
return GL_TRUE;
}
else if (mode == GL_BACK_LEFT) {
fxMesa->currentFB = GR_BUFFER_BACKBUFFER;
grRenderBuffer(fxMesa->currentFB);
FX_grRenderBuffer(fxMesa->currentFB);
return GL_TRUE;
}
else {
@@ -203,6 +267,22 @@ static GLboolean fxDDSetBuffer(GLcontext *ctx, GLenum mode )
}
#ifdef XF86DRI
static GLboolean inClipRects(fxMesaContext fxMesa, int px, int py)
{
int i;
py=fxMesa->height+fxMesa->y_offset-py;
for (i=0; i<fxMesa->numClipRects; i++) {
if ((px>=fxMesa->pClipRects[i].x1) &&
(px<fxMesa->pClipRects[i].x2) &&
(py>=fxMesa->pClipRects[i].y1) &&
(py<fxMesa->pClipRects[i].y2)) return GL_TRUE;
}
return GL_FALSE;
}
#endif
static GLboolean fxDDDrawBitMap(GLcontext *ctx, GLint px, GLint py,
GLsizei width, GLsizei height,
@@ -240,10 +320,16 @@ static GLboolean fxDDDrawBitMap(GLcontext *ctx, GLint px, GLint py,
ymax=fxMesa->height;
}
xmin+=fxMesa->x_offset;
xmax+=fxMesa->x_offset;
#define ISCLIPPED(rx) ( ((rx)<xmin) || ((rx)>=xmax) )
#ifdef XF86DRI
#define ISCLIPPED(rx, ry) ( ((rx)<xmin) || ((rx)>=xmax) || !inClipRects(fxMesa, rx, ry))
#else
#define ISCLIPPED(rx, ry) ( ((rx)<xmin) || ((rx)>=xmax) )
#endif
#define DRAWBIT(i) { \
if(!ISCLIPPED(x+px)) \
if(!ISCLIPPED(x+px, y)) \
if( (*pb) & (1<<(i)) ) \
(*p)=color; \
p++; \
@@ -257,7 +343,7 @@ static GLboolean fxDDDrawBitMap(GLcontext *ctx, GLint px, GLint py,
scrwidth=fxMesa->width;
scrheight=fxMesa->height;
if((px>=scrwidth) || (px+width<=0) || (py>=scrheight) || (py+height<=0))
if ((px>=scrwidth) || (px+width<=0) || (py>=scrheight) || (py+height<=0))
return GL_TRUE;
pb=bitmap;
@@ -268,16 +354,16 @@ static GLboolean fxDDDrawBitMap(GLcontext *ctx, GLint px, GLint py,
py=0;
}
if(py+height>=scrheight)
if (py+height>=scrheight)
height-=(py+height)-scrheight;
info.size=sizeof(info);
if(!grLfbLock(GR_LFB_WRITE_ONLY,
fxMesa->currentFB,
GR_LFBWRITEMODE_565,
GR_ORIGIN_UPPER_LEFT,
FXFALSE,
&info)) {
if(!FX_grLfbLock(GR_LFB_WRITE_ONLY,
fxMesa->currentFB,
GR_LFBWRITEMODE_565,
GR_ORIGIN_UPPER_LEFT,
FXFALSE,
&info)) {
#ifndef FX_SILENT
fprintf(stderr,"fx Driver: error locking the linear frame buffer\n");
#endif
@@ -297,13 +383,13 @@ static GLboolean fxDDDrawBitMap(GLcontext *ctx, GLint px, GLint py,
/* This code is a bit slow... */
for(y=py;y<(py+height);y++) {
if (py>ymin) ymin=py;
if (py+height<ymax) ymax=py+height;
if (y>=ymax)
break;
px+=fxMesa->x_offset;
scrheight=fxMesa->height+fxMesa->y_offset;
if (y<=ymin)
continue;
for(y=ymin; y<ymax; y++) {
p=((FxU16 *)info.lfbPtr)+px+((scrheight-y)*stride);
@@ -314,7 +400,7 @@ static GLboolean fxDDDrawBitMap(GLcontext *ctx, GLint px, GLint py,
}
}
grLfbUnlock(GR_LFB_WRITE_ONLY,fxMesa->currentFB);
FX_grLfbUnlock(GR_LFB_WRITE_ONLY,fxMesa->currentFB);
#undef ISCLIPPED
#undef DRAWBIT
@@ -337,6 +423,7 @@ static GLint fxDDGetParameteri(const GLcontext *ctx, GLint param)
fprintf(stderr,"fx Driver: internal error in fxDDGetParameteri(): %x\n",param);
fxCloseHardware();
exit(-1);
return 0;
}
}
@@ -353,55 +440,181 @@ void fxDDSetNearFar(GLcontext *ctx, GLfloat n, GLfloat f)
*/
static const GLubyte *fxDDGetString(GLcontext *ctx, GLenum name)
{
static char *extensions="GL_EXT_blend_color GL_EXT_blend_minmax GL_EXT_blend_logic_op GL_EXT_blend_subtract GL_EXT_paletted_texture GL_EXT_point_parameters GL_EXT_polygon_offset GL_EXT_vertex_array GL_EXT_texture_object GL_EXT_texture3D GL_MESA_window_pos GL_MESA_resize_buffers GL_EXT_shared_texture_palette GL_EXT_rescale_normal GL_EXT_abgr GL_SGIS_texture_edge_clamp 3DFX_set_global_palette GL_FXMESA_global_texture_lod_bias";
switch (name) {
case GL_RENDERER:
#if defined(GLX_DIRECT_RENDERING)
return "Mesa Glide - DRI VB/V3";
#else
{
static char buf[80];
static char buf[MAX_NUM_SST][64];
if (glbHWConfig.SSTs[glbCurrentBoard].type==GR_SSTTYPE_VOODOO)
{
GrVoodooConfig_t *vc =
&glbHWConfig.SSTs[glbCurrentBoard].sstBoard.VoodooConfig;
fxQueryHardware();
sprintf(buf,
"Mesa Glide v0.30 Voodoo_Graphics %d "
"CARD/%d FB/%d TM/%d TMU/%s",
glbCurrentBoard,
(vc->sliDetect ? (vc->fbRam*2) : vc->fbRam),
(vc->tmuConfig[GR_TMU0].tmuRam +
((vc->nTexelfx>1) ? vc->tmuConfig[GR_TMU1].tmuRam : 0)),
vc->nTexelfx,
(vc->sliDetect ? "SLI" : "NOSLI"));
}
else if (glbHWConfig.SSTs[glbCurrentBoard].type==GR_SSTTYPE_SST96)
{
GrSst96Config_t *sc =
&glbHWConfig.SSTs[glbCurrentBoard].sstBoard.SST96Config;
switch (name) {
case GL_RENDERER:
if(glbHWConfig.SSTs[glbCurrentBoard].type==GR_SSTTYPE_VOODOO) {
sprintf(buf[glbCurrentBoard],"Mesa Glide v0.30 Voodoo_Graphics %d CARD/%d FB/%d TM/%d TMU/%s",
glbCurrentBoard,
sprintf(buf,
"Glide v0.30 Voodoo_Rush %d "
"CARD/%d FB/%d TM/%d TMU/NOSLI",
glbCurrentBoard,
sc->fbRam,
sc->tmuConfig.tmuRam,
sc->nTexelfx);
}
else
{
strcpy(buf, "Glide v0.30 UNKNOWN");
}
(glbHWConfig.SSTs[glbCurrentBoard].sstBoard.VoodooConfig.sliDetect ?
(glbHWConfig.SSTs[glbCurrentBoard].sstBoard.VoodooConfig.fbRam*2) :
glbHWConfig.SSTs[glbCurrentBoard].sstBoard.VoodooConfig.fbRam),
glbHWConfig.SSTs[glbCurrentBoard].sstBoard.VoodooConfig.tmuConfig[GR_TMU0].tmuRam+
((glbHWConfig.SSTs[glbCurrentBoard].sstBoard.VoodooConfig.nTexelfx>1) ?
glbHWConfig.SSTs[glbCurrentBoard].sstBoard.VoodooConfig.tmuConfig[GR_TMU1].tmuRam :
0),
glbHWConfig.SSTs[glbCurrentBoard].sstBoard.VoodooConfig.nTexelfx,
(glbHWConfig.SSTs[glbCurrentBoard].sstBoard.VoodooConfig.sliDetect ? "SLI" : "NOSLI")
);
return (GLubyte *) buf;
}
else {
if(glbHWConfig.SSTs[glbCurrentBoard].type==GR_SSTTYPE_SST96)
sprintf(buf[glbCurrentBoard],"Glide v0.30 Voodoo_Rush %d CARD/%d FB/%d TM/%d TMU/NOSLI",
glbCurrentBoard,
glbHWConfig.SSTs[glbCurrentBoard].sstBoard.SST96Config.fbRam,
glbHWConfig.SSTs[glbCurrentBoard].sstBoard.SST96Config.tmuConfig.tmuRam,
glbHWConfig.SSTs[glbCurrentBoard].sstBoard.SST96Config.nTexelfx
);
else
strcpy(buf[glbCurrentBoard],"Glide v0.30 UNKNOWN");
}
return (GLubyte *) buf[glbCurrentBoard];
case GL_EXTENSIONS:
return (GLubyte *) extensions;
default:
#endif
default:
return NULL;
}
}
}
int fxDDInitFxMesaContext( fxMesaContext fxMesa )
{
FX_setupGrVertexLayout();
if (getenv("FX_EMULATE_SINGLE_TMU"))
fxMesa->haveTwoTMUs = GL_FALSE;
fxMesa->emulateTwoTMUs = fxMesa->haveTwoTMUs;
if (!getenv("FX_DONT_FAKE_MULTITEX"))
fxMesa->emulateTwoTMUs = GL_TRUE;
if(getenv("FX_GLIDE_SWAPINTERVAL"))
fxMesa->swapInterval=atoi(getenv("FX_GLIDE_SWAPINTERVAL"));
else
fxMesa->swapInterval=1;
if(getenv("MESA_FX_SWAP_PENDING"))
fxMesa->maxPendingSwapBuffers=atoi(getenv("MESA_FX_SWAP_PENDING"));
else
fxMesa->maxPendingSwapBuffers=2;
fxMesa->color=0xffffffff;
fxMesa->clearC=0;
fxMesa->clearA=0;
fxMesa->stats.swapBuffer=0;
fxMesa->stats.reqTexUpload=0;
fxMesa->stats.texUpload=0;
fxMesa->stats.memTexUpload=0;
fxMesa->tmuSrc=FX_TMU_NONE;
fxMesa->lastUnitsMode=FX_UM_NONE;
fxTMInit(fxMesa);
/* FX units setup */
fxMesa->unitsState.alphaTestEnabled=GL_FALSE;
fxMesa->unitsState.alphaTestFunc=GR_CMP_ALWAYS;
fxMesa->unitsState.alphaTestRefValue=0;
fxMesa->unitsState.blendEnabled=GL_FALSE;
fxMesa->unitsState.blendSrcFuncRGB=GR_BLEND_ONE;
fxMesa->unitsState.blendDstFuncRGB=GR_BLEND_ZERO;
fxMesa->unitsState.blendSrcFuncAlpha=GR_BLEND_ONE;
fxMesa->unitsState.blendDstFuncAlpha=GR_BLEND_ZERO;
fxMesa->unitsState.depthTestEnabled =GL_FALSE;
fxMesa->unitsState.depthMask =GL_TRUE;
fxMesa->unitsState.depthTestFunc =GR_CMP_LESS;
FX_grColorMask(FXTRUE, fxMesa->haveAlphaBuffer ? FXTRUE : FXFALSE);
if(fxMesa->haveDoubleBuffer) {
fxMesa->currentFB=GR_BUFFER_BACKBUFFER;
FX_grRenderBuffer(GR_BUFFER_BACKBUFFER);
} else {
fxMesa->currentFB=GR_BUFFER_FRONTBUFFER;
FX_grRenderBuffer(GR_BUFFER_FRONTBUFFER);
}
fxMesa->state = NULL;
fxMesa->fogTable = NULL;
fxMesa->state = malloc(FX_grGetInteger(FX_GLIDE_STATE_SIZE));
fxMesa->fogTable = malloc(FX_grGetInteger(FX_FOG_TABLE_ENTRIES)*sizeof(GrFog_t));
if (!fxMesa->state || !fxMesa->fogTable) {
if (fxMesa->state) free(fxMesa->state);
if (fxMesa->fogTable) free(fxMesa->fogTable);
return 0;
}
if(fxMesa->haveZBuffer)
FX_grDepthBufferMode(GR_DEPTHBUFFER_ZBUFFER);
#if (!FXMESA_USE_ARGB)
FX_grLfbWriteColorFormat(GR_COLORFORMAT_ABGR); /* Not every Glide has this */
#endif
fxMesa->glCtx->Const.MaxTextureLevels=9;
fxMesa->glCtx->Const.MaxTextureSize=256;
fxMesa->glCtx->Const.MaxTextureUnits=fxMesa->emulateTwoTMUs ? 2 : 1;
fxMesa->glCtx->NewState|=NEW_DRVSTATE1;
fxMesa->new_state = NEW_ALL;
fxDDSetupInit();
fxDDCvaInit();
fxDDClipInit();
fxDDTrifuncInit();
fxDDFastPathInit();
fxSetupDDPointers(fxMesa->glCtx);
fxDDRenderInit(fxMesa->glCtx);
fxDDInitExtensions(fxMesa->glCtx);
fxDDSetNearFar(fxMesa->glCtx,1.0,100.0);
FX_grGlideGetState((GrState*)fxMesa->state);
/* XXX Fix me: callback not registered when main VB is created.
*/
if (fxMesa->glCtx->VB)
fxDDRegisterVB( fxMesa->glCtx->VB );
/* XXX Fix me too: need to have the 'struct dd' prepared prior to
* creating the context... The below is broken if you try to insert
* new stages.
*/
if (fxMesa->glCtx->NrPipelineStages)
fxMesa->glCtx->NrPipelineStages = fxDDRegisterPipelineStages(
fxMesa->glCtx->PipelineStage,
fxMesa->glCtx->PipelineStage,
fxMesa->glCtx->NrPipelineStages);
/* Run the config file */
gl_context_initialize( fxMesa->glCtx );
return 1;
}
void fxDDInitExtensions( GLcontext *ctx )
{
fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx;
@@ -409,10 +622,19 @@ void fxDDInitExtensions( GLcontext *ctx )
gl_extensions_add( ctx, DEFAULT_ON, "3DFX_set_global_palette", 0 );
gl_extensions_add( ctx, DEFAULT_ON, "GL_FXMESA_global_texture_lod_bias", 0);
if(fxMesa->haveTwoTMUs)
gl_extensions_add( ctx, DEFAULT_ON, "GL_EXT_texture_env_add", 0);
if (!fxMesa->emulateTwoTMUs)
gl_extensions_disable( ctx, "GL_ARB_multitexture" );
}
/*
This driver may need to move the drawing operations to a different sub
window. This modifies the viewport command to add our X,Y offset to all
drawn objects that go through the viewport transformation.
*/
/************************************************************************/
/************************************************************************/
/************************************************************************/
@@ -458,16 +680,19 @@ static GLboolean fxIsInHardware(GLcontext *ctx)
/* Not very well written ... */
((ctx->Enabled & (TEXTURE0_1D | TEXTURE1_1D)) &&
((ctx->Enabled & (TEXTURE0_2D | TEXTURE1_2D))!=(TEXTURE0_2D | TEXTURE1_2D)))
)
) {
return GL_FALSE;
}
if((ctx->Texture.ReallyEnabled & TEXTURE0_2D) &&
(ctx->Texture.Unit[0].EnvMode==GL_BLEND))
(ctx->Texture.Unit[0].EnvMode==GL_BLEND)) {
return GL_FALSE;
}
if((ctx->Texture.ReallyEnabled & TEXTURE1_2D) &&
(ctx->Texture.Unit[1].EnvMode==GL_BLEND))
(ctx->Texture.Unit[1].EnvMode==GL_BLEND)) {
return GL_FALSE;
}
if (MESA_VERBOSE & (VERBOSE_DRIVER|VERBOSE_TEXTURE))
@@ -484,8 +709,9 @@ static GLboolean fxIsInHardware(GLcontext *ctx)
/* Can't use multipass to blend a multitextured triangle - fall
* back to software.
*/
if (!fxMesa->haveTwoTMUs && ctx->Color.BlendEnabled)
if (!fxMesa->haveTwoTMUs && ctx->Color.BlendEnabled) {
return GL_FALSE;
}
if ((ctx->Texture.Unit[0].EnvMode!=ctx->Texture.Unit[1].EnvMode) &&
(ctx->Texture.Unit[0].EnvMode!=GL_MODULATE) &&
@@ -493,7 +719,6 @@ static GLboolean fxIsInHardware(GLcontext *ctx)
{
if (MESA_VERBOSE&VERBOSE_DRIVER)
fprintf(stderr, "fxMesa: unsupported multitex env mode\n");
return GL_FALSE;
}
}
@@ -502,13 +727,15 @@ static GLboolean fxIsInHardware(GLcontext *ctx)
/* Not very well written ... */
((ctx->Enabled & TEXTURE0_1D) &&
(!(ctx->Enabled & TEXTURE0_2D)))
)
) {
return GL_FALSE;
}
if((ctx->Texture.ReallyEnabled & TEXTURE0_2D) &&
(ctx->Texture.Unit[0].EnvMode==GL_BLEND))
(ctx->Texture.Unit[0].EnvMode==GL_BLEND)) {
return GL_FALSE;
}
}
return GL_TRUE;
@@ -547,11 +774,11 @@ static void fxDDUpdateDDPointers(GLcontext *ctx)
ctx->Driver.LineFunc=fxMesa->LineFunc;
ctx->Driver.TriangleFunc=fxMesa->TriangleFunc;
ctx->Driver.QuadFunc=fxMesa->QuadFunc;
} else
} else {
fxMesa->render_index = FX_FALLBACK;
}
}
void fxSetupDDPointers(GLcontext *ctx)
{
if (MESA_VERBOSE&VERBOSE_DRIVER) {
@@ -615,7 +842,6 @@ void fxSetupDDPointers(GLcontext *ctx)
ctx->Driver.CullFace=fxDDCullFace;
ctx->Driver.ShadeModel=fxDDShadeModel;
ctx->Driver.Enable=fxDDEnable;
ctx->Driver.RegisterVB=fxDDRegisterVB;
ctx->Driver.UnregisterVB=fxDDUnregisterVB;
@@ -653,3 +879,4 @@ int gl_fx_dummy_function_dd(void)
}
#endif /* FX */

View File

@@ -1,27 +1,51 @@
/* -*- mode: C; tab-width:8; -*-
fxdd.c - 3Dfx VooDoo Mesa span and pixel functions
*/
/* -*- mode: C; tab-width:8; c-basic-offset:2 -*- */
/*
* 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.
* Mesa 3-D graphics library
* Version: 3.1
*
* 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.
* Copyright (C) 1999 Brian Paul All Rights Reserved.
*
* 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.
* 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:
*
* See the file fxapi.c for more informations about authors
* 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.
*
*
* Original Mesa / 3Dfx device driver (C) 1999 David Bucciarelli, by the
* terms stated above.
*
* Thank you for your contribution, David!
*
* Please make note of the above copyright/license statement. If you
* contributed code or bug fixes to this code under the previous (GNU
* Library) license and object to the new license, your code will be
* removed at your request. Please see the Mesa docs/COPYRIGHT file
* for more information.
*
* Additional Mesa/3Dfx driver developers:
* Daryll Strauss <daryll@precisioninsight.com>
* Keith Whitwell <keith@precisioninsight.com>
*
* See fxapi.h for more revision/author details.
*/
/* fxdd.c - 3Dfx VooDoo Mesa span and pixel functions */
#ifdef HAVE_CONFIG_H
#include "conf.h"
#endif
@@ -42,6 +66,66 @@
#if !defined(FXMESA_USE_ARGB)
#if defined(FX_GLIDE3) && defined(XF86DRI)
static FxBool writeRegionClipped(fxMesaContext fxMesa, GrBuffer_t dst_buffer,
FxU32 dst_x, FxU32 dst_y, GrLfbSrcFmt_t src_format,
FxU32 src_width, FxU32 src_height, FxI32 src_stride,
void *src_data);
FxBool writeRegionClipped(fxMesaContext fxMesa, GrBuffer_t dst_buffer,
FxU32 dst_x, FxU32 dst_y, GrLfbSrcFmt_t src_format,
FxU32 src_width, FxU32 src_height, FxI32 src_stride,
void *src_data)
{
int i, x, w;
void *data;
if (src_width==1 && src_height==1) { /* Easy case writing a point */
for (i=0; i<fxMesa->numClipRects; i++) {
if ((dst_x>=fxMesa->pClipRects[i].x1) &&
(dst_x<fxMesa->pClipRects[i].x2) &&
(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);
return GL_TRUE;
}
}
} else if (src_height==1) { /* Writing a span */
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);
w=src_width-(x-dst_x);
} else {
x=dst_x;
data=src_data;
w=src_width;
}
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,
src_stride, data);
}
}
} else { /* Punt on the case of arbitrary rectangles */
return GL_FALSE;
}
return GL_TRUE;
}
#else
#define writeRegionClipped(fxm,dst_buffer,dst_x,dst_y,src_format,src_width,src_height,src_stride,src_data) \
FX_grLfbWriteRegion(dst_buffer,dst_x,dst_y,src_format,src_width,src_height,src_stride,src_data)
#endif
/* KW: Rearranged the args in the call to grLfbWriteRegion().
*/
#define LFB_WRITE_SPAN_MESA(dst_buffer, \
@@ -50,7 +134,7 @@
src_width, \
src_stride, \
src_data) \
grLfbWriteRegion(dst_buffer, \
writeRegionClipped(fxMesa, dst_buffer, \
dst_x, \
dst_y, \
GR_LFB_SRC_FMT_8888, \
@@ -60,7 +144,11 @@
src_data) \
#else /* defined(FXMESA_USE_RGBA) */
#else /* !defined(FXMESA_USE_RGBA) */
#define writeRegionClipped(fxm,dst_buffer,dst_x,dst_y,src_format,src_width,src_height,src_stride,src_data) \
FX_grLfbWriteRegion(dst_buffer,dst_x,dst_y,src_format,src_width,src_height,src_stride,src_data)
#define MESACOLOR_TO_ARGB(c) ( \
( ((unsigned int)(c[ACOMP]))<<24 ) | \
@@ -68,7 +156,7 @@
( ((unsigned int)(c[GCOMP]))<<8 ) | \
( (unsigned int)(c[BCOMP])) )
void LFB_WRITE_SPAN_MESA(GrBuffer_t dst_buffer,
inline void LFB_WRITE_SPAN_MESA(GrBuffer_t dst_buffer,
FxU32 dst_x,
FxU32 dst_y,
FxU32 src_width,
@@ -84,7 +172,7 @@ void LFB_WRITE_SPAN_MESA(GrBuffer_t dst_buffer,
{
argb[i] = MESACOLOR_TO_ARGB(rgba[i]);
}
FX_grLfbWriteRegion(dst_buffer,
writeRegionClipped( /*fxMesa,*/ NULL, dst_buffer,
dst_x,
dst_y,
GR_LFB_SRC_FMT_8888,
@@ -93,8 +181,9 @@ void LFB_WRITE_SPAN_MESA(GrBuffer_t dst_buffer,
src_stride,
(void*)argb);
}
#endif /* !defined(FXMESA_USE_RGBA) */
#endif
/************************************************************************/
/***** Span functions *****/
@@ -107,12 +196,13 @@ static void fxDDWriteRGBASpan(const GLcontext *ctx,
{
fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx;
GLuint i;
GLint bottom=fxMesa->height-1;
GLint bottom=fxMesa->height+fxMesa->y_offset-1;
if (MESA_VERBOSE&VERBOSE_DRIVER) {
fprintf(stderr,"fxmesa: fxDDWriteRGBASpan(...)\n");
}
x+=fxMesa->x_offset;
if (mask) {
int span=0;
@@ -143,13 +233,14 @@ static void fxDDWriteRGBSpan(const GLcontext *ctx,
{
fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx;
GLuint i;
GLint bottom=fxMesa->height-1;
GLint bottom=fxMesa->height+fxMesa->y_offset-1;
GLubyte rgba[MAX_WIDTH][4];
if (MESA_VERBOSE&VERBOSE_DRIVER) {
fprintf(stderr,"fxmesa: fxDDWriteRGBSpan()\n");
}
x+=fxMesa->x_offset;
if (mask) {
int span=0;
@@ -192,13 +283,14 @@ static void fxDDWriteMonoRGBASpan(const GLcontext *ctx,
{
fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx;
GLuint i;
GLint bottom=fxMesa->height-1;
GLint bottom=fxMesa->height+fxMesa->y_offset-1;
GLuint data[MAX_WIDTH];
if (MESA_VERBOSE&VERBOSE_DRIVER) {
fprintf(stderr,"fxmesa: fxDDWriteMonoRGBASpan(...)\n");
}
x+=fxMesa->x_offset;
if (mask) {
int span=0;
@@ -208,7 +300,7 @@ static void fxDDWriteMonoRGBASpan(const GLcontext *ctx,
++span;
} else {
if (span > 0) {
FX_grLfbWriteRegion( fxMesa->currentFB, x+i-span, bottom-y,
writeRegionClipped(fxMesa, fxMesa->currentFB, x+i-span, bottom-y,
GR_LFB_SRC_FMT_8888, span, 1, 0,
(void *) data );
span = 0;
@@ -217,7 +309,7 @@ static void fxDDWriteMonoRGBASpan(const GLcontext *ctx,
}
if (span > 0)
FX_grLfbWriteRegion( fxMesa->currentFB, x+n-span, bottom-y,
writeRegionClipped(fxMesa, fxMesa->currentFB, x+n-span, bottom-y,
GR_LFB_SRC_FMT_8888, span, 1, 0,
(void *) data );
} else {
@@ -225,7 +317,7 @@ static void fxDDWriteMonoRGBASpan(const GLcontext *ctx,
data[i]=(GLuint) fxMesa->color;
}
FX_grLfbWriteRegion( fxMesa->currentFB, x, bottom-y, GR_LFB_SRC_FMT_8888,
writeRegionClipped(fxMesa, fxMesa->currentFB, x, bottom-y, GR_LFB_SRC_FMT_8888,
n, 1, 0, (void *) data );
}
}
@@ -237,7 +329,7 @@ static void fxDDReadRGBASpan(const GLcontext *ctx,
fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx;
GLushort data[MAX_WIDTH];
GLuint i;
GLint bottom=fxMesa->height-1;
GLint bottom=fxMesa->height+fxMesa->y_offset-1;
if (MESA_VERBOSE&VERBOSE_DRIVER) {
fprintf(stderr,"fxmesa: fxDDReadRGBASpan(...)\n");
@@ -245,20 +337,16 @@ static void fxDDReadRGBASpan(const GLcontext *ctx,
assert(n < MAX_WIDTH);
grLfbReadRegion( fxMesa->currentFB, x, bottom-y, n, 1, 0, data);
for (i=0;i<n;i++) {
#if FXMESA_USE_ARGB
rgba[i][RCOMP]=(data[i] & 0xF800) >> 8;
rgba[i][GCOMP]=(data[i] & 0x07E0) >> 3;
rgba[i][BCOMP]=(data[i] & 0x001F) << 3;
#else
rgba[i][RCOMP]=(data[i] & 0x001f) << 3;
rgba[i][GCOMP]=(data[i] & 0x07e0) >> 3;
rgba[i][BCOMP]=(data[i] & 0xf800) >> 8;
#endif
rgba[i][ACOMP]=255;
}
x+=fxMesa->x_offset;
FX_grLfbReadRegion( fxMesa->currentFB, x, bottom-y, n, 1, 0, data);
for (i=0;i<n;i++) {
GLushort pixel = data[i];
rgba[i][RCOMP] = FX_PixelToR[pixel];
rgba[i][GCOMP] = FX_PixelToG[pixel];
rgba[i][BCOMP] = FX_PixelToB[pixel];
rgba[i][ACOMP] = 255;
}
}
/************************************************************************/
@@ -271,7 +359,7 @@ static void fxDDWriteRGBAPixels(const GLcontext *ctx,
{
fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx;
GLuint i;
GLint bottom=fxMesa->height-1;
GLint bottom=fxMesa->height+fxMesa->y_offset-1;
if (MESA_VERBOSE&VERBOSE_DRIVER) {
fprintf(stderr,"fxmesa: fxDDWriteRGBAPixels(...)\n");
@@ -279,8 +367,8 @@ static void fxDDWriteRGBAPixels(const GLcontext *ctx,
for(i=0;i<n;i++)
if(mask[i])
LFB_WRITE_SPAN_MESA(fxMesa->currentFB,x[i],bottom-y[i],
/*GR_LFB_SRC_FMT_8888,*/1,/*1,*/0,(void *)rgba[i]);
LFB_WRITE_SPAN_MESA(fxMesa->currentFB, x[i]+fxMesa->x_offset, bottom-y[i],
1, 1, (void *)rgba[i]);
}
static void fxDDWriteMonoRGBAPixels(const GLcontext *ctx,
@@ -289,7 +377,7 @@ static void fxDDWriteMonoRGBAPixels(const GLcontext *ctx,
{
fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx;
GLuint i;
GLint bottom=fxMesa->height-1;
GLint bottom=fxMesa->height+fxMesa->y_offset-1;
if (MESA_VERBOSE&VERBOSE_DRIVER) {
fprintf(stderr,"fxmesa: fxDDWriteMonoRGBAPixels(...)\n");
@@ -297,7 +385,7 @@ static void fxDDWriteMonoRGBAPixels(const GLcontext *ctx,
for(i=0;i<n;i++)
if(mask[i])
FX_grLfbWriteRegion(fxMesa->currentFB,x[i],bottom-y[i],
writeRegionClipped(fxMesa, fxMesa->currentFB,x[i]+fxMesa->x_offset,bottom-y[i],
GR_LFB_SRC_FMT_8888,1,1,0,(void *) &fxMesa->color);
}
@@ -307,31 +395,25 @@ static void fxDDReadRGBAPixels(const GLcontext *ctx,
{
fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx;
GLuint i;
GLint bottom=fxMesa->height-1;
GLushort data;
GLint bottom=fxMesa->height+fxMesa->y_offset-1;
if (MESA_VERBOSE&VERBOSE_DRIVER) {
fprintf(stderr,"fxmesa: fxDDReadRGBAPixels(...)\n");
}
for(i=0;i<n;i++)
for(i=0;i<n;i++) {
if(mask[i]) {
grLfbReadRegion(fxMesa->currentFB,x[i],bottom-y[i],1,1,0,&data);
#if FXMESA_USE_ARGB
rgba[i][RCOMP]=(data & 0xF800) >> 8;
rgba[i][GCOMP]=(data & 0x07E0) >> 3;
rgba[i][BCOMP]=(data & 0x001F) >> 8;
#else
rgba[i][RCOMP]=(data & 0x001f) << 3;
rgba[i][GCOMP]=(data & 0x07e0) >> 3;
rgba[i][BCOMP]=(data & 0xf800) >> 8;
#endif
/* the alpha value should be read from the auxiliary buffer when required */
rgba[i][ACOMP]=255;
GLushort pixel;
FX_grLfbReadRegion(fxMesa->currentFB,x[i],bottom-y[i],1,1,0,&pixel);
rgba[i][RCOMP] = FX_PixelToR[pixel];
rgba[i][GCOMP] = FX_PixelToG[pixel];
rgba[i][BCOMP] = FX_PixelToB[pixel];
rgba[i][ACOMP] = 255;
}
}
}
/************************************************************************/
/***** Depth functions *****/
/************************************************************************/
@@ -341,14 +423,15 @@ void fxDDReadDepthSpanFloat(GLcontext *ctx,
{
fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx;
GLuint i;
GLint bottom=fxMesa->height-1;
GLint bottom=fxMesa->height+fxMesa->y_offset-1;
GLushort data[MAX_WIDTH];
if (MESA_VERBOSE&VERBOSE_DRIVER) {
fprintf(stderr,"fxmesa: fxDDReadDepthSpanFloat(...)\n");
}
grLfbReadRegion(GR_BUFFER_AUXBUFFER,x,bottom-y,n,1,0,data);
x+=fxMesa->x_offset;
FX_grLfbReadRegion(GR_BUFFER_AUXBUFFER,x,bottom-y,n,1,0,data);
/*
convert the read values to float values [0.0 .. 1.0].
@@ -361,13 +444,14 @@ void fxDDReadDepthSpanInt(GLcontext *ctx,
GLuint n, GLint x, GLint y, GLdepth depth[])
{
fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx;
GLint bottom=fxMesa->height-1;
GLint bottom=fxMesa->height+fxMesa->y_offset-1;
if (MESA_VERBOSE&VERBOSE_DRIVER) {
fprintf(stderr,"fxmesa: fxDDReadDepthSpanInt(...)\n");
}
grLfbReadRegion(GR_BUFFER_AUXBUFFER,x,bottom-y,n,1,0,depth);
x+=fxMesa->x_offset;
FX_grLfbReadRegion(GR_BUFFER_AUXBUFFER,x,bottom-y,n,1,0,depth);
}
GLuint fxDDDepthTestSpanGeneric(GLcontext *ctx,
@@ -380,13 +464,14 @@ GLuint fxDDDepthTestSpanGeneric(GLcontext *ctx,
GLubyte *m=mask;
GLuint i;
GLuint passed=0;
GLint bottom=fxMesa->height-1;
GLint bottom=fxMesa->height+fxMesa->y_offset-1;
if (MESA_VERBOSE&VERBOSE_DRIVER) {
fprintf(stderr,"fxmesa: fxDDDepthTestSpanGeneric(...)\n");
}
grLfbReadRegion(GR_BUFFER_AUXBUFFER,x,bottom-y,n,1,0,depthdata);
x+=fxMesa->x_offset;
FX_grLfbReadRegion(GR_BUFFER_AUXBUFFER,x,bottom-y,n,1,0,depthdata);
/* switch cases ordered from most frequent to less frequent */
switch (ctx->Depth.Func) {
@@ -578,7 +663,7 @@ GLuint fxDDDepthTestSpanGeneric(GLcontext *ctx,
} /*switch*/
if(passed)
FX_grLfbWriteRegion(GR_BUFFER_AUXBUFFER,x,bottom-y,GR_LFB_SRC_FMT_ZA16,n,1,0,depthdata);
writeRegionClipped(fxMesa, GR_BUFFER_AUXBUFFER,x,bottom-y,GR_LFB_SRC_FMT_ZA16,n,1,0,depthdata);
return passed;
}
@@ -590,7 +675,7 @@ void fxDDDepthTestPixelsGeneric(GLcontext* ctx,
fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx;
GLdepth zval;
GLuint i;
GLint bottom=fxMesa->height-1;
GLint bottom=fxMesa->height+fxMesa->y_offset-1;
if (MESA_VERBOSE&VERBOSE_DRIVER) {
fprintf(stderr,"fxmesa: fxDDDepthTestPixelsGeneric(...)\n");
@@ -603,10 +688,10 @@ void fxDDDepthTestPixelsGeneric(GLcontext* ctx,
/* Update Z buffer */
for (i=0; i<n; i++) {
if (mask[i]) {
grLfbReadRegion(GR_BUFFER_AUXBUFFER,x[i],bottom-y[i],1,1,0,&zval);
FX_grLfbReadRegion(GR_BUFFER_AUXBUFFER,x[i]+fxMesa->x_offset,bottom-y[i],1,1,0,&zval);
if (z[i] < zval) {
/* pass */
FX_grLfbWriteRegion(GR_BUFFER_AUXBUFFER,x[i],bottom-y[i],GR_LFB_SRC_FMT_ZA16,1,1,0,(void*)&z[i]);
writeRegionClipped(fxMesa, GR_BUFFER_AUXBUFFER,x[i]+fxMesa->x_offset,bottom-y[i],GR_LFB_SRC_FMT_ZA16,1,1,0,(void*)&z[i]);
} else {
/* fail */
mask[i] = 0;
@@ -617,7 +702,7 @@ void fxDDDepthTestPixelsGeneric(GLcontext* ctx,
/* Don't update Z buffer */
for (i=0; i<n; i++) {
if (mask[i]) {
grLfbReadRegion(GR_BUFFER_AUXBUFFER,x[i],bottom-y[i],1,1,0,&zval);
FX_grLfbReadRegion(GR_BUFFER_AUXBUFFER,x[i]+fxMesa->x_offset,bottom-y[i],1,1,0,&zval);
if (z[i] < zval) {
/* pass */
}
@@ -634,10 +719,10 @@ void fxDDDepthTestPixelsGeneric(GLcontext* ctx,
/* Update Z buffer */
for (i=0; i<n; i++) {
if (mask[i]) {
grLfbReadRegion(GR_BUFFER_AUXBUFFER,x[i],bottom-y[i],1,1,0,&zval);
FX_grLfbReadRegion(GR_BUFFER_AUXBUFFER,x[i]+fxMesa->x_offset,bottom-y[i],1,1,0,&zval);
if (z[i] <= zval) {
/* pass */
FX_grLfbWriteRegion(GR_BUFFER_AUXBUFFER,x[i],bottom-y[i],GR_LFB_SRC_FMT_ZA16,1,1,0,(void*)&z[i]);
writeRegionClipped(fxMesa, GR_BUFFER_AUXBUFFER,x[i]+fxMesa->x_offset,bottom-y[i],GR_LFB_SRC_FMT_ZA16,1,1,0,(void*)&z[i]);
} else {
/* fail */
mask[i] = 0;
@@ -648,7 +733,7 @@ void fxDDDepthTestPixelsGeneric(GLcontext* ctx,
/* Don't update Z buffer */
for (i=0; i<n; i++) {
if (mask[i]) {
grLfbReadRegion(GR_BUFFER_AUXBUFFER,x[i],bottom-y[i],1,1,0,&zval);
FX_grLfbReadRegion(GR_BUFFER_AUXBUFFER,x[i]+fxMesa->x_offset,bottom-y[i],1,1,0,&zval);
if (z[i] <= zval) {
/* pass */
} else {
@@ -664,10 +749,10 @@ void fxDDDepthTestPixelsGeneric(GLcontext* ctx,
/* Update Z buffer */
for (i=0; i<n; i++) {
if (mask[i]) {
grLfbReadRegion(GR_BUFFER_AUXBUFFER,x[i],bottom-y[i],1,1,0,&zval);
FX_grLfbReadRegion(GR_BUFFER_AUXBUFFER,x[i]+fxMesa->x_offset,bottom-y[i],1,1,0,&zval);
if (z[i] >= zval) {
/* pass */
FX_grLfbWriteRegion(GR_BUFFER_AUXBUFFER,x[i],bottom-y[i],GR_LFB_SRC_FMT_ZA16,1,1,0,(void*)&z[i]);
writeRegionClipped(fxMesa, GR_BUFFER_AUXBUFFER,x[i]+fxMesa->x_offset,bottom-y[i],GR_LFB_SRC_FMT_ZA16,1,1,0,(void*)&z[i]);
} else {
/* fail */
mask[i] = 0;
@@ -678,7 +763,7 @@ void fxDDDepthTestPixelsGeneric(GLcontext* ctx,
/* Don't update Z buffer */
for (i=0; i<n; i++) {
if (mask[i]) {
grLfbReadRegion(GR_BUFFER_AUXBUFFER,x[i],bottom-y[i],1,1,0,&zval);
FX_grLfbReadRegion(GR_BUFFER_AUXBUFFER,x[i]+fxMesa->x_offset,bottom-y[i],1,1,0,&zval);
if (z[i] >= zval) {
/* pass */
} else {
@@ -694,10 +779,10 @@ void fxDDDepthTestPixelsGeneric(GLcontext* ctx,
/* Update Z buffer */
for (i=0; i<n; i++) {
if (mask[i]) {
grLfbReadRegion(GR_BUFFER_AUXBUFFER,x[i],bottom-y[i],1,1,0,&zval);
FX_grLfbReadRegion(GR_BUFFER_AUXBUFFER,x[i]+fxMesa->x_offset,bottom-y[i],1,1,0,&zval);
if (z[i] > zval) {
/* pass */
FX_grLfbWriteRegion(GR_BUFFER_AUXBUFFER,x[i],bottom-y[i],GR_LFB_SRC_FMT_ZA16,1,1,0,(void*)&z[i]);
writeRegionClipped(fxMesa, GR_BUFFER_AUXBUFFER,x[i]+fxMesa->x_offset,bottom-y[i],GR_LFB_SRC_FMT_ZA16,1,1,0,(void*)&z[i]);
} else {
/* fail */
mask[i] = 0;
@@ -708,7 +793,7 @@ void fxDDDepthTestPixelsGeneric(GLcontext* ctx,
/* Don't update Z buffer */
for (i=0; i<n; i++) {
if (mask[i]) {
grLfbReadRegion(GR_BUFFER_AUXBUFFER,x[i],bottom-y[i],1,1,0,&zval);
FX_grLfbReadRegion(GR_BUFFER_AUXBUFFER,x[i]+fxMesa->x_offset,bottom-y[i],1,1,0,&zval);
if (z[i] > zval) {
/* pass */
} else {
@@ -724,10 +809,10 @@ void fxDDDepthTestPixelsGeneric(GLcontext* ctx,
/* Update Z buffer */
for (i=0; i<n; i++) {
if (mask[i]) {
grLfbReadRegion(GR_BUFFER_AUXBUFFER,x[i],bottom-y[i],1,1,0,&zval);
FX_grLfbReadRegion(GR_BUFFER_AUXBUFFER,x[i]+fxMesa->x_offset,bottom-y[i],1,1,0,&zval);
if (z[i] != zval) {
/* pass */
FX_grLfbWriteRegion(GR_BUFFER_AUXBUFFER,x[i],bottom-y[i],GR_LFB_SRC_FMT_ZA16,1,1,0,(void*)&z[i]);
writeRegionClipped(fxMesa, GR_BUFFER_AUXBUFFER,x[i]+fxMesa->x_offset,bottom-y[i],GR_LFB_SRC_FMT_ZA16,1,1,0,(void*)&z[i]);
} else {
/* fail */
mask[i] = 0;
@@ -738,7 +823,7 @@ void fxDDDepthTestPixelsGeneric(GLcontext* ctx,
/* Don't update Z buffer */
for (i=0; i<n; i++) {
if (mask[i]) {
grLfbReadRegion(GR_BUFFER_AUXBUFFER,x[i],bottom-y[i],1,1,0,&zval);
FX_grLfbReadRegion(GR_BUFFER_AUXBUFFER,x[i]+fxMesa->x_offset,bottom-y[i],1,1,0,&zval);
if (z[i] != zval) {
/* pass */
}
@@ -755,10 +840,10 @@ void fxDDDepthTestPixelsGeneric(GLcontext* ctx,
/* Update Z buffer */
for (i=0; i<n; i++) {
if (mask[i]) {
grLfbReadRegion(GR_BUFFER_AUXBUFFER,x[i],bottom-y[i],1,1,0,&zval);
FX_grLfbReadRegion(GR_BUFFER_AUXBUFFER,x[i]+fxMesa->x_offset,bottom-y[i],1,1,0,&zval);
if (z[i] == zval) {
/* pass */
FX_grLfbWriteRegion(GR_BUFFER_AUXBUFFER,x[i],bottom-y[i],GR_LFB_SRC_FMT_ZA16,1,1,0,(void*)&z[i]);
writeRegionClipped(fxMesa, GR_BUFFER_AUXBUFFER,x[i]+fxMesa->x_offset,bottom-y[i],GR_LFB_SRC_FMT_ZA16,1,1,0,(void*)&z[i]);
} else {
/* fail */
mask[i] = 0;
@@ -769,7 +854,7 @@ void fxDDDepthTestPixelsGeneric(GLcontext* ctx,
/* Don't update Z buffer */
for (i=0; i<n; i++) {
if (mask[i]) {
grLfbReadRegion(GR_BUFFER_AUXBUFFER,x[i],bottom-y[i],1,1,0,&zval);
FX_grLfbReadRegion(GR_BUFFER_AUXBUFFER,x[i]+fxMesa->x_offset,bottom-y[i],1,1,0,&zval);
if (z[i] == zval) {
/* pass */
} else {
@@ -785,7 +870,7 @@ void fxDDDepthTestPixelsGeneric(GLcontext* ctx,
/* Update Z buffer */
for (i=0; i<n; i++) {
if (mask[i]) {
FX_grLfbWriteRegion(GR_BUFFER_AUXBUFFER,x[i],bottom-y[i],GR_LFB_SRC_FMT_ZA16,1,1,0,(void*)&z[i]);
writeRegionClipped(fxMesa, GR_BUFFER_AUXBUFFER,x[i]+fxMesa->x_offset,bottom-y[i],GR_LFB_SRC_FMT_ZA16,1,1,0,(void*)&z[i]);
}
}
} else {

View File

@@ -1,27 +1,48 @@
/* -*- mode: C; tab-width:8; -*-
fxddtex.c - 3Dfx VooDoo Texture mapping functions
*/
/* -*- mode: C; tab-width:8; c-basic-offset:2 -*- */
/*
* 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.
* Mesa 3-D graphics library
* Version: 3.1
*
* 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.
* Copyright (C) 1999 Brian Paul All Rights Reserved.
*
* 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.
* 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:
*
* See the file fxapi.c for more informations about authors
* 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.
*
*
* Original Mesa / 3Dfx device driver (C) 1999 David Bucciarelli, by the
* terms stated above.
*
* Thank you for your contribution, David!
*
* Please make note of the above copyright/license statement. If you
* contributed code or bug fixes to this code under the previous (GNU
* Library) license and object to the new license, your code will be
* removed at your request. Please see the Mesa docs/COPYRIGHT file
* for more information.
*
* Additional Mesa/3Dfx driver developers:
* Daryll Strauss <daryll@precisioninsight.com>
* Keith Whitwell <keith@precisioninsight.com>
*
* See fxapi.h for more revision/author details.
*/
#ifdef HAVE_CONFIG_H
#include "conf.h"
#endif
@@ -30,18 +51,49 @@
#include "fxdrv.h"
void fxPrintTextureData(tfxTexInfo *ti)
{
fprintf(stderr, "Texture Data:\n");
if (ti->tObj) {
fprintf(stderr, "\tName: %d\n", ti->tObj->Name);
fprintf(stderr, "\tBaseLevel: %d\n", ti->tObj->BaseLevel);
fprintf(stderr, "\tSize: %d x %d\n",
ti->tObj->Image[ti->tObj->BaseLevel]->Width,
ti->tObj->Image[ti->tObj->BaseLevel]->Height);
} else
fprintf(stderr, "\tName: UNNAMED\n");
fprintf(stderr, "\tLast used: %d\n", ti->lastTimeUsed);
fprintf(stderr, "\tTMU: %d\n", ti->whichTMU);
fprintf(stderr, "\t%s\n", (ti->isInTM)?"In TMU":"Not in TMU");
if (ti->tm[0])
fprintf(stderr, "\tMem0: %x-%x\n", ti->tm[0]->startAddr,
ti->tm[0]->endAddr);
if (ti->tm[1])
fprintf(stderr, "\tMem1: %x-%x\n", ti->tm[1]->startAddr,
ti->tm[1]->endAddr);
fprintf(stderr, "\tMipmaps: %d-%d\n", ti->minLevel, ti->maxLevel);
fprintf(stderr, "\tFilters: min %d min %d\n", ti->minFilt, ti->maxFilt);
fprintf(stderr, "\tClamps: s %d t %d\n", ti->sClamp, ti->tClamp);
fprintf(stderr, "\tScales: s %f t %f\n", ti->sScale, ti->tScale);
fprintf(stderr, "\tInt Scales: s %d t %d\n",
ti->int_sScale/0x800000, ti->int_tScale/0x800000);
fprintf(stderr, "\t%s\n", (ti->fixedPalette)?"Fixed palette":"Non fixed palette");
fprintf(stderr, "\t%s\n", (ti->validated)?"Validated":"Not validated");
}
/************************************************************************/
/*************************** Texture Mapping ****************************/
/************************************************************************/
static void fxTexInvalidate(GLcontext *ctx, struct gl_texture_object *tObj)
void fxTexInvalidate(GLcontext *ctx, struct gl_texture_object *tObj)
{
fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx;
tfxTexInfo *ti;
fxTMMoveOutTM(fxMesa,tObj); /* TO DO: SLOW but easy to write */
ti=(tfxTexInfo *)tObj->DriverData;
ti=fxTMGetTexInfo(tObj);
ti->validated=GL_FALSE;
fxMesa->new_state|=FX_NEW_TEXTURING;
ctx->Driver.RenderStart = fxSetupFXUnits;
@@ -52,19 +104,19 @@ static tfxTexInfo *fxAllocTexObjData(fxMesaContext fxMesa)
tfxTexInfo *ti;
int i;
if(!(ti=malloc(sizeof(tfxTexInfo)))) {
if(!(ti=CALLOC(sizeof(tfxTexInfo)))) {
fprintf(stderr,"fx Driver: out of memory !\n");
fxCloseHardware();
exit(-1);
}
ti->validated=GL_FALSE;
ti->tmi.isInTM=GL_FALSE;
ti->isInTM=GL_FALSE;
ti->tmi.whichTMU=FX_TMU_NONE;
ti->whichTMU=FX_TMU_NONE;
ti->tmi.tm[FX_TMU0]=NULL;
ti->tmi.tm[FX_TMU1]=NULL;
ti->tm[FX_TMU0]=NULL;
ti->tm[FX_TMU1]=NULL;
ti->minFilt=GR_TEXTUREFILTER_POINT_SAMPLED;
ti->maxFilt=GR_TEXTUREFILTER_BILINEAR;
@@ -72,17 +124,12 @@ static tfxTexInfo *fxAllocTexObjData(fxMesaContext fxMesa)
ti->sClamp=GR_TEXTURECLAMP_WRAP;
ti->tClamp=GR_TEXTURECLAMP_WRAP;
if(fxMesa->haveTwoTMUs) {
ti->mmMode=GR_MIPMAP_NEAREST;
ti->LODblend=FXTRUE;
} else {
ti->mmMode=GR_MIPMAP_NEAREST_DITHER;
ti->LODblend=FXFALSE;
}
ti->mmMode=GR_MIPMAP_NEAREST;
ti->LODblend=FXFALSE;
for(i=0;i<MAX_TEXTURE_LEVELS;i++) {
ti->tmi.mipmapLevel[i].used=GL_FALSE;
ti->tmi.mipmapLevel[i].data=NULL;
ti->mipmapLevel[i].used=GL_FALSE;
ti->mipmapLevel[i].data=NULL;
}
return ti;
@@ -100,13 +147,14 @@ void fxDDTexBind(GLcontext *ctx, GLenum target, struct gl_texture_object *tObj)
if(target!=GL_TEXTURE_2D)
return;
if(!tObj->DriverData)
if (!tObj->DriverData) {
tObj->DriverData=fxAllocTexObjData(fxMesa);
}
ti=(tfxTexInfo *)tObj->DriverData;
ti=fxTMGetTexInfo(tObj);
fxMesa->texBindNumber++;
ti->tmi.lastTimeUsed=fxMesa->texBindNumber;
ti->lastTimeUsed=fxMesa->texBindNumber;
fxMesa->new_state|=FX_NEW_TEXTURING;
ctx->Driver.RenderStart = fxSetupFXUnits;
@@ -141,10 +189,10 @@ void fxDDTexParam(GLcontext *ctx, GLenum target, struct gl_texture_object *tObj,
if(target!=GL_TEXTURE_2D)
return;
if(!tObj->DriverData)
if (!tObj->DriverData)
tObj->DriverData=fxAllocTexObjData(fxMesa);
ti=(tfxTexInfo *)tObj->DriverData;
ti=fxTMGetTexInfo(tObj);
switch(pname) {
@@ -265,7 +313,7 @@ void fxDDTexParam(GLcontext *ctx, GLenum target, struct gl_texture_object *tObj,
void fxDDTexDel(GLcontext *ctx, struct gl_texture_object *tObj)
{
fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx;
tfxTexInfo *ti=(tfxTexInfo *)tObj->DriverData;
tfxTexInfo *ti=fxTMGetTexInfo(tObj);
if (MESA_VERBOSE&VERBOSE_DRIVER) {
fprintf(stderr,"fxmesa: fxDDTexDel(%d,%x)\n",tObj->Name,(GLuint)ti);
@@ -276,7 +324,7 @@ void fxDDTexDel(GLcontext *ctx, struct gl_texture_object *tObj)
fxTMFreeTexture(fxMesa,tObj);
free(ti);
FREE(ti);
tObj->DriverData=NULL;
ctx->NewState|=NEW_TEXTURING;
@@ -308,10 +356,10 @@ void fxDDTexPalette(GLcontext *ctx, struct gl_texture_object *tObj)
return;
}
if(!tObj->DriverData)
if (!tObj->DriverData)
tObj->DriverData=fxAllocTexObjData(fxMesa);
ti=(tfxTexInfo *)tObj->DriverData;
ti=fxTMGetTexInfo(tObj);
for(i=0;i<tObj->PaletteSize;i++) {
r=tObj->Palette[i*4];
@@ -373,13 +421,10 @@ void fxDDTexUseGlbPalette(GLcontext *ctx, GLboolean state)
if((ctx->Texture.Unit[0].Current==ctx->Texture.Unit[0].CurrentD[2]) &&
(ctx->Texture.Unit[0].Current!=NULL)) {
struct gl_texture_object *tObj=ctx->Texture.Unit[0].Current;
tfxTexInfo *ti;
if(!tObj->DriverData)
if (!tObj->DriverData)
tObj->DriverData=fxAllocTexObjData(fxMesa);
ti=(tfxTexInfo *)tObj->DriverData;
fxTexInvalidate(ctx,tObj);
}
}
@@ -833,7 +878,7 @@ static void fxTexBuildImageMap(const struct gl_texture_image *image,
(*istranslate)=GL_TRUE;
if(!(*dest)) {
if(!((*dest)=src=(unsigned short *)malloc(sizeof(unsigned char)*w*h))) {
if(!((*dest)=src=(unsigned short *)MALLOC(sizeof(unsigned char)*w*h))) {
fprintf(stderr,"fx Driver: out of memory !\n");
fxCloseHardware();
exit(-1);
@@ -861,7 +906,7 @@ static void fxTexBuildImageMap(const struct gl_texture_image *image,
(*istranslate)=GL_TRUE;
if(!(*dest)) {
if(!((*dest)=src=(unsigned short *)malloc(sizeof(unsigned short)*w*h))) {
if(!((*dest)=src=(unsigned short *)MALLOC(sizeof(unsigned short)*w*h))) {
fprintf(stderr,"fx Driver: out of memory !\n");
fxCloseHardware();
exit(-1);
@@ -871,10 +916,10 @@ static void fxTexBuildImageMap(const struct gl_texture_image *image,
if(wscale==hscale==1) {
int i=0;
int lenght=h*w;
int length=h*w;
unsigned short a,l;
while(i++<lenght) {
while(i++<length) {
l=*data++;
a=*data++;
@@ -905,7 +950,7 @@ static void fxTexBuildImageMap(const struct gl_texture_image *image,
(*istranslate)=GL_TRUE;
if(!(*dest)) {
if(!((*dest)=src=(unsigned short *)malloc(sizeof(unsigned short)*w*h))) {
if(!((*dest)=src=(unsigned short *)MALLOC(sizeof(unsigned short)*w*h))) {
fprintf(stderr,"fx Driver: out of memory !\n");
fxCloseHardware();
exit(-1);
@@ -915,10 +960,10 @@ static void fxTexBuildImageMap(const struct gl_texture_image *image,
if(wscale==hscale==1) {
int i=0;
int lenght=h*w;
int length=h*w;
unsigned short r,g,b;
while(i++<lenght) {
while(i++<length) {
r=*data++;
g=*data++;
b=*data++;
@@ -955,7 +1000,7 @@ static void fxTexBuildImageMap(const struct gl_texture_image *image,
(*istranslate)=GL_TRUE;
if(!(*dest)) {
if(!((*dest)=src=(unsigned short *)malloc(sizeof(unsigned short)*w*h))) {
if(!((*dest)=src=(unsigned short *)MALLOC(sizeof(unsigned short)*w*h))) {
fprintf(stderr,"fx Driver: out of memory !\n");
fxCloseHardware();
exit(-1);
@@ -965,10 +1010,10 @@ static void fxTexBuildImageMap(const struct gl_texture_image *image,
if(wscale==hscale==1) {
int i=0;
int lenght=h*w;
int length=h*w;
unsigned short r,g,b,a;
while(i++<lenght) {
while(i++<length) {
r=*data++;
g=*data++;
b=*data++;
@@ -1013,21 +1058,23 @@ void fxDDTexImg(GLcontext *ctx, GLenum target,
tfxTexInfo *ti;
if (MESA_VERBOSE&VERBOSE_DRIVER) {
fprintf(stderr,"fxmesa: (%d) fxDDTexImg(...,%d,%x,%d,%d...)\n",tObj->Name,
target,internalFormat,image->Width,image->Height);
fprintf(stderr,
"fxmesa: (%d) fxDDTexImg(...,level=%d,target=%d,format=%x,width=%d,height=%d...)\n",
tObj->Name, level, target, internalFormat, image->Width,
image->Height);
}
if(target!=GL_TEXTURE_2D)
return;
if(!tObj->DriverData)
if (!tObj->DriverData)
tObj->DriverData=fxAllocTexObjData(fxMesa);
ti=(tfxTexInfo *)tObj->DriverData;
ti=fxTMGetTexInfo(tObj);
if(fxIsTexSupported(target,internalFormat,image)) {
GrTextureFormat_t gldformat;
tfxMipMapLevel *mml=&ti->tmi.mipmapLevel[level];
tfxMipMapLevel *mml=&ti->mipmapLevel[level];
fxTexGetFormat(internalFormat,&gldformat,NULL);
@@ -1038,7 +1085,7 @@ void fxDDTexImg(GLcontext *ctx, GLenum target,
fxTexBuildImageMap(image,internalFormat,&(mml->data),
&(mml->translated));
if(ti->validated && ti->tmi.isInTM)
if(ti->validated && ti->isInTM)
fxTMReloadMipMapLevel(fxMesa,tObj,level);
else
fxTexInvalidate(ctx,tObj);
@@ -1046,7 +1093,7 @@ void fxDDTexImg(GLcontext *ctx, GLenum target,
return;
} else {
if(mml->translated)
free(mml->data);
FREE(mml->data);
mml->data=NULL;
}
}
@@ -1238,18 +1285,20 @@ void fxDDTexSubImg(GLcontext *ctx, GLenum target,
tfxMipMapLevel *mml;
if (MESA_VERBOSE&VERBOSE_DRIVER) {
fprintf(stderr,"fxmesa: (%d) fxDDTexSubImg(...,%d,%x,%d,%d...)\n",tObj->Name,
target,internalFormat,image->Width,image->Height);
fprintf(stderr,
"fxmesa: (%d) fxDDTexSubImg(level=%d,target=%d,format=%x,width=%d,height=%d)\n",
tObj->Name, level, target, internalFormat, image->Width,
image->Height);
}
if(target!=GL_TEXTURE_2D)
return;
if(!tObj->DriverData)
if (!tObj->DriverData)
return;
ti=(tfxTexInfo *)tObj->DriverData;
mml=&ti->tmi.mipmapLevel[level];
ti=fxTMGetTexInfo(tObj);
mml=&ti->mipmapLevel[level];
fxTexGetFormat(internalFormat,&gldformat,NULL);
@@ -1277,7 +1326,7 @@ void fxDDTexSubImg(GLcontext *ctx, GLenum target,
fxTexBuildSubImageMap(image,internalFormat,xoffset,yoffset,
width,height,mml->data);
if(ti->validated && ti->tmi.isInTM)
if(ti->validated && ti->isInTM)
fxTMReloadSubMipMapLevel(fxMesa,tObj,level,yoffset,height);
else
fxTexInvalidate(ctx,tObj);

View File

@@ -1,27 +1,48 @@
/* -*- mode: C; tab-width:8; -*-
fxdrv.h - 3Dfx VooDoo driver types
*/
/* -*- mode: C; tab-width:8; c-basic-offset:2 -*- */
/*
* 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.
* Mesa 3-D graphics library
* Version: 3.1
*
* 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.
* Copyright (C) 1999 Brian Paul All Rights Reserved.
*
* 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.
* 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:
*
* See the file fxapi.c for more informations about authors
* 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.
*
*
* Original Mesa / 3Dfx device driver (C) 1999 David Bucciarelli, by the
* terms stated above.
*
* Thank you for your contribution, David!
*
* Please make note of the above copyright/license statement. If you
* contributed code or bug fixes to this code under the previous (GNU
* Library) license and object to the new license, your code will be
* removed at your request. Please see the Mesa docs/COPYRIGHT file
* for more information.
*
* Additional Mesa/3Dfx driver developers:
* Daryll Strauss <daryll@precisioninsight.com>
* Keith Whitwell <keith@precisioninsight.com>
*
* See fxapi.h for more revision/author details.
*/
#ifndef FXDRV_H
#define FXDRV_H
@@ -29,11 +50,16 @@
* you turn debugging on/off from the debugger.
*/
#ifndef XFree86Server
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <limits.h>
#include <assert.h>
#else
#include "GL/xf86glx.h"
#endif
#if defined(__linux__)
#include <signal.h>
@@ -49,7 +75,11 @@
#include "clip.h"
#include "vbrender.h"
#ifdef XF86DRI
typedef struct tfxMesaContext *fxMesaContext;
#else
#include "GL/fxmesa.h"
#endif
#include "fxglidew.h"
/* use gl/gl.h GLAPI/GLAPIENTRY/GLCALLBACK in place of WINGDIAPI/APIENTRY/CALLBACK, */
/* these are defined in mesa gl/gl.h - tjump@spgs.com */
@@ -79,6 +109,20 @@ extern void fx_sanity_triangle( GrVertex *, GrVertex *, GrVertex * );
#define S1COORD GR_VERTEX_SOW_TMU1_OFFSET
#define T1COORD GR_VERTEX_TOW_TMU1_OFFSET
#if FX_USE_PARGB
#define CLIP_XCOORD 0 /* normal place */
#define CLIP_YCOROD 1 /* normal place */
#define CLIP_ZCOORD 2 /* normal place */
#define CLIP_WCOORD 3 /* normal place */
#define CLIP_GCOORD 4 /* GR_VERTEX_PARGB_OFFSET */
#define CLIP_BCOORD 5 /* GR_VERTEX_SOW_TMU0_OFFSET */
#define CLIP_RCOORD 6 /* GR_VERTEX_TOW_TMU0_OFFSET */
#define CLIP_ACOORD 7 /* GR_VERTEX_OOW_TMU0_OFFSET */
#else
#define CLIP_XCOORD 0 /* normal place */
#define CLIP_YCOROD 1 /* normal place */
#define CLIP_ZCOORD 2 /* GR_VERTEX_Z_OFFSET */
@@ -89,7 +133,7 @@ extern void fx_sanity_triangle( GrVertex *, GrVertex *, GrVertex * );
#define CLIP_ACOORD 7 /* normal place */
#endif
/* Should have size == 16 * sizeof(float).
*/
@@ -121,17 +165,17 @@ typedef struct {
#endif
#endif
#define FX_VB_COLOR(fxm, color) \
do { \
if (sizeof(GLint) == 4*sizeof(GLubyte)) { \
if (fxm->constColor != *(GLuint*)color) { \
fxm->constColor = *(GLuint*)color; \
grConstantColorValue(FXCOLOR4(color)); \
} \
} else { \
grConstantColorValue(FXCOLOR4(color)); \
} \
} while (0)
#define FX_VB_COLOR(fxm, color) \
do { \
if (sizeof(GLint) == 4*sizeof(GLubyte)) { \
if (fxm->constColor != *(GLuint*)color) { \
fxm->constColor = *(GLuint*)color; \
FX_grConstantColorValue(FXCOLOR4(color)); \
} \
} else { \
FX_grConstantColorValue(FXCOLOR4(color)); \
} \
} while (0)
#define GOURAUD(x) { \
GLubyte *col = VB->ColorPtr->data[(x)]; \
@@ -141,6 +185,12 @@ do { \
gWin[(x)].v.a=UBYTE_COLOR_TO_FLOAT_255_COLOR(col[3]); \
}
#if FX_USE_PARGB
#define GOURAUD2(v, c) { \
GLubyte *col = c; \
v->argb=MESACOLOR2PARGB(col); \
}
#else
#define GOURAUD2(v, c) { \
GLubyte *col = c; \
v->r=UBYTE_COLOR_TO_FLOAT_255_COLOR(col[0]); \
@@ -148,6 +198,7 @@ do { \
v->b=UBYTE_COLOR_TO_FLOAT_255_COLOR(col[2]); \
v->a=UBYTE_COLOR_TO_FLOAT_255_COLOR(col[3]); \
}
#endif
/* Mergable items first
@@ -178,29 +229,31 @@ do { \
#define FX_UM_E0_MODULATE 0x00000002
#define FX_UM_E0_DECAL 0x00000004
#define FX_UM_E0_BLEND 0x00000008
#define FX_UM_E0_ADD 0x00000010
#define FX_UM_E1_REPLACE 0x00000010
#define FX_UM_E1_MODULATE 0x00000020
#define FX_UM_E1_DECAL 0x00000040
#define FX_UM_E1_BLEND 0x00000080
#define FX_UM_E1_REPLACE 0x00000020
#define FX_UM_E1_MODULATE 0x00000040
#define FX_UM_E1_DECAL 0x00000080
#define FX_UM_E1_BLEND 0x00000100
#define FX_UM_E1_ADD 0x00000200
#define FX_UM_E_ENVMODE 0x000000ff
#define FX_UM_E_ENVMODE 0x000003ff
#define FX_UM_E0_ALPHA 0x00000100
#define FX_UM_E0_LUMINANCE 0x00000200
#define FX_UM_E0_LUMINANCE_ALPHA 0x00000400
#define FX_UM_E0_INTENSITY 0x00000800
#define FX_UM_E0_RGB 0x00001000
#define FX_UM_E0_RGBA 0x00002000
#define FX_UM_E0_ALPHA 0x00001000
#define FX_UM_E0_LUMINANCE 0x00002000
#define FX_UM_E0_LUMINANCE_ALPHA 0x00004000
#define FX_UM_E0_INTENSITY 0x00008000
#define FX_UM_E0_RGB 0x00010000
#define FX_UM_E0_RGBA 0x00020000
#define FX_UM_E1_ALPHA 0x00004000
#define FX_UM_E1_LUMINANCE 0x00008000
#define FX_UM_E1_LUMINANCE_ALPHA 0x00010000
#define FX_UM_E1_INTENSITY 0x00020000
#define FX_UM_E1_RGB 0x00040000
#define FX_UM_E1_RGBA 0x00080000
#define FX_UM_E1_ALPHA 0x00040000
#define FX_UM_E1_LUMINANCE 0x00080000
#define FX_UM_E1_LUMINANCE_ALPHA 0x00100000
#define FX_UM_E1_INTENSITY 0x00200000
#define FX_UM_E1_RGB 0x00400000
#define FX_UM_E1_RGBA 0x00800000
#define FX_UM_E_IFMT 0x000fff00
#define FX_UM_E_IFMT 0x00fff000
#define FX_UM_COLOR_ITERATED 0x00100000
#define FX_UM_COLOR_CONSTANT 0x00200000
@@ -209,16 +262,13 @@ do { \
typedef void (*tfxRenderVBFunc)(GLcontext *);
typedef struct tfxTMFreeListNode {
struct tfxTMFreeListNode *next;
FxU32 startAddress, endAddress;
} tfxTMFreeNode;
typedef struct tfxTMAllocListNode {
struct tfxTMAllocListNode *next;
FxU32 startAddress, endAddress;
struct gl_texture_object *tObj;
} tfxTMAllocNode;
/*
Memory range from startAddr to endAddr-1
*/
typedef struct MemRange_t {
struct MemRange_t *next;
FxU32 startAddr, endAddr;
} MemRange;
typedef struct {
GLsizei width, height;
@@ -228,19 +278,17 @@ typedef struct {
GLboolean translated, used;
} tfxMipMapLevel;
typedef struct {
typedef struct tfxTexInfo_t {
struct tfxTexInfo *next;
struct gl_texture_object *tObj;
GLuint lastTimeUsed;
FxU32 whichTMU;
tfxTMAllocNode *tm[FX_NUM_TMU];
GLboolean isInTM;
tfxMipMapLevel mipmapLevel[MAX_TEXTURE_LEVELS];
GLboolean isInTM;
} tfxTMInfo;
typedef struct {
tfxTMInfo tmi;
MemRange *tm[FX_NUM_TMU];
GLint minLevel, maxLevel;
GLint baseLevelInternalFormat;
@@ -355,8 +403,27 @@ struct tfxMesaVertexBuffer {
};
#define FX_DRIVER_DATA(vb) ((struct tfxMesaVertexBuffer *)((vb)->driver_data))
#define FX_CONTEXT(ctx) ((struct tfxMesaContext *)((ctx)->DriverCtx))
#define FX_TEXTURE_DATA(t) ((tfxTexInfo *) ((t)->Current->DriverData))
#define FX_CONTEXT(ctx) ((fxMesaContext)((ctx)->DriverCtx))
#define FX_TEXTURE_DATA(t) fxTMGetTexInfo((t)->Current)
#if defined(XFree86Server) || defined(GLX_DIRECT_RENDERING)
#include "tdfx_init.h"
#else
#define DRI_FX_CONTEXT
#define BEGIN_BOARD_LOCK()
#define END_BOARD_LOCK()
#define BEGIN_CLIP_LOOP()
#define END_CLIP_LOOP()
#endif
/* These lookup table are used to extract RGB values in [0,255] from
* 16-bit pixel values.
*/
extern GLubyte FX_PixelToR[0x10000];
extern GLubyte FX_PixelToG[0x10000];
extern GLubyte FX_PixelToB[0x10000];
struct tfxMesaContext {
GuTexPalette glbPalette;
@@ -378,7 +445,6 @@ struct tfxMesaContext {
tfxUnitsState unitsState;
tfxUnitsState restoreUnitsState; /* saved during multipass */
GLuint tmu_source[FX_NUM_TMU];
GLuint tex_dest[MAX_TEXTURE_UNITS];
GLuint setupindex;
@@ -404,8 +470,8 @@ struct tfxMesaContext {
GLint tmuSrc;
GLuint lastUnitsMode;
GLuint freeTexMem[FX_NUM_TMU];
tfxTMFreeNode *tmFree[FX_NUM_TMU];
tfxTMAllocNode *tmAlloc[FX_NUM_TMU];
MemRange *tmPool;
MemRange *tmFree[FX_NUM_TMU];
GLenum fogTableMode;
GLfloat fogDensity;
@@ -435,12 +501,27 @@ struct tfxMesaContext {
GLboolean haveTwoTMUs; /* True if we really have 2 tmu's */
GLboolean emulateTwoTMUs; /* True if we present 2 tmu's to mesa. */
GLboolean haveAlphaBuffer;
GLboolean haveZBuffer;
GLboolean haveDoubleBuffer;
GLboolean haveGlobalPaletteTexture;
GLint swapInterval;
GLint maxPendingSwapBuffers;
FX_GrContext_t glideContext;
int x_offset;
int y_offset;
int y_delta;
int screen_width;
int screen_height;
int initDone;
int clipMinX;
int clipMaxX;
int clipMinY;
int clipMaxY;
int needClip;
DRI_FX_CONTEXT
};
typedef void (*tfxSetupFunc)(struct vertex_buffer *, GLuint, GLuint);
@@ -452,10 +533,10 @@ extern void fxSetupFXUnits(GLcontext *);
extern void fxSetupDDPointers(GLcontext *);
extern void fxDDSetNearFar(GLcontext *, GLfloat, GLfloat);
extern void fxDDSetupInit();
extern void fxDDCvaInit();
extern void fxDDTrifuncInit();
extern void fxDDFastPathInit();
extern void fxDDSetupInit(void);
extern void fxDDCvaInit(void);
extern void fxDDTrifuncInit(void);
extern void fxDDFastPathInit(void);
extern void fxDDChooseRenderState( GLcontext *ctx );
@@ -475,13 +556,14 @@ extern quad_func fxDDChooseQuadFunction(GLcontext *);
extern render_func **fxDDChooseRenderVBTables(GLcontext *);
extern void fxDDRenderInit(GLcontext *);
extern void fxDDClipInit();
extern void fxDDClipInit(void);
extern void fxUpdateDDSpanPointers(GLcontext *);
extern void fxSetupDDSpanPointers(GLcontext *);
extern void fxDDBufferSize(GLcontext *, GLuint *, GLuint *);
extern void fxPrintTextureData(tfxTexInfo *ti);
extern void fxDDTexEnv(GLcontext *, GLenum, const GLfloat *);
extern void fxDDTexImg(GLcontext *, GLenum, struct gl_texture_object *,
GLint, GLint, const struct gl_texture_image *);
@@ -531,8 +613,9 @@ extern void fxDDRenderVBIndirectDirect( struct vertex_buffer *VB );
extern void fxDDInitExtensions( GLcontext *ctx );
extern void fxTMInit(fxMesaContext);
extern void fxTMClose(fxMesaContext);
#define fxTMGetTexInfo(o) ((tfxTexInfo*)((o)->DriverData))
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 *);
extern void fxTMFreeTexture(fxMesaContext, struct gl_texture_object *);
@@ -580,5 +663,16 @@ extern void fxPrintHintState( const char *msg, GLuint state );
extern void fxDDDoRenderVB( struct vertex_buffer *VB );
extern int fxDDInitFxMesaContext( fxMesaContext fxMesa );
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);
#endif

View File

@@ -1,28 +1,47 @@
/* $Id: fxglidew.c,v 1.2 1999/09/17 03:07:28 tjump Exp $ */
/* -*- mode: C; tab-width:8; c-basic-offset:2 -*- */
/*
* Mesa 3-D graphics library
* Version: 3.1
*
*
* 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.
*
*
* Original Mesa / 3Dfx device driver (C) 1999 David Bucciarelli, by the
* terms stated above.
*
* Thank you for your contribution, David!
*
* Please make note of the above copyright/license statement. If you
* contributed code or bug fixes to this code under the previous (GNU
* Library) license and object to the new license, your code will be
* removed at your request. Please see the Mesa docs/COPYRIGHT file
* for more information.
*
* Additional Mesa/3Dfx driver developers:
* Daryll Strauss <daryll@precisioninsight.com>
* Keith Whitwell <keith@precisioninsight.com>
*
* See fxapi.h for more revision/author details.
*/
#ifdef HAVE_CONFIG_H
#include "conf.h"
@@ -36,8 +55,7 @@
#include <stdlib.h>
#include <string.h>
FxI32 FX_grGetInteger(FxU32 pname)
static FxI32 FX_grGetInteger_NoLock(FxU32 pname)
{
#if !defined(FX_GLIDE3)
switch (pname)
@@ -49,7 +67,7 @@ FxI32 FX_grGetInteger(FxU32 pname)
case FX_LFB_PIXEL_PIPE:
return FXFALSE;
case FX_PENDING_BUFFERSWAPS:
return grBufferNumPending();
return grBufferNumPending();
default:
if (MESA_VERBOSE&VERBOSE_DRIVER) {
fprintf(stderr,"Wrong parameter in FX_grGetInteger!\n");
@@ -74,12 +92,74 @@ FxI32 FX_grGetInteger(FxU32 pname)
}
return -1;
}
grGet(grname,4,&result);
return result;
#endif
}
FxI32 FX_grGetInteger(FxU32 pname)
{
int result;
BEGIN_BOARD_LOCK();
result=FX_grGetInteger_NoLock(pname);
END_BOARD_LOCK();
return result;
}
FxBool FX_grLfbLock(GrLock_t type, GrBuffer_t buffer,
GrLfbWriteMode_t writeMode, GrOriginLocation_t origin,
FxBool pixelPipeline, GrLfbInfo_t *info ) {
FxBool result;
BEGIN_BOARD_LOCK();
result=grLfbLock(type, buffer, writeMode, origin, pixelPipeline, info);
END_BOARD_LOCK();
return result;
}
FxU32 FX_grTexTextureMemRequired(FxU32 evenOdd, GrTexInfo *info) {
FxU32 result;
BEGIN_BOARD_LOCK();
result=grTexTextureMemRequired(evenOdd, info);
END_BOARD_LOCK();
return result;
}
FxU32 FX_grTexMinAddress(GrChipID_t tmu) {
FxU32 result;
BEGIN_BOARD_LOCK();
result=grTexMinAddress(tmu);
END_BOARD_LOCK();
return result;
}
extern FxU32 FX_grTexMaxAddress(GrChipID_t tmu) {
FxU32 result;
BEGIN_BOARD_LOCK();
result=grTexMaxAddress(tmu);
END_BOARD_LOCK();
return result;
}
FxBool FX_grSstControl(FxU32 code)
{
#if defined(FX_GLIDE3)
(void) code;
return 1; /* OK? */
#else
FxU32 result;
BEGIN_BOARD_LOCK();
result = grSstControl(code);
END_BOARD_LOCK();
return result;
#endif
}
#if defined(FX_GLIDE3)
@@ -90,39 +170,33 @@ void FX_grGammaCorrectionValue(float val)
/* ToDo */
}
void FX_grSstControl(int par)
{
(void)par;
/* ToDo */
}
int FX_getFogTableSize(void)
{
int result;
BEGIN_BOARD_LOCK();
grGet(GR_FOG_TABLE_ENTRIES,sizeof(int),(void*)&result);
END_BOARD_LOCK();
return result;
}
int FX_getGrStateSize(void)
{
int result;
BEGIN_BOARD_LOCK();
grGet(GR_GLIDE_STATE_SIZE,sizeof(int),(void*)&result);
END_BOARD_LOCK();
return result;
}
int FX_grBufferNumPending()
{
int result;
grGet(GR_PENDING_BUFFERSWAPS,sizeof(int),(void*)&result);
return result;
}
int FX_grSstScreenWidth()
{
FxI32 result[4];
BEGIN_BOARD_LOCK();
grGet(GR_VIEWPORT,sizeof(FxI32)*4,result);
END_BOARD_LOCK();
return result[2];
}
@@ -130,15 +204,19 @@ int FX_grSstScreenWidth()
int FX_grSstScreenHeight()
{
FxI32 result[4];
BEGIN_BOARD_LOCK();
grGet(GR_VIEWPORT,sizeof(FxI32)*4,result);
END_BOARD_LOCK();
return result[3];
}
void FX_grGlideGetVersion(char *buf)
{
strcpy(buf,grGetString(GR_VERSION));
BEGIN_BOARD_LOCK();
strcpy(buf,grGetString(GR_VERSION));
END_BOARD_LOCK();
}
void FX_grSstPerfStats(GrSstPerfStats_t *st)
@@ -154,57 +232,91 @@ void FX_grSstPerfStats(GrSstPerfStats_t *st)
void FX_grAADrawLine(GrVertex *a,GrVertex *b)
{
/* ToDo */
BEGIN_CLIP_LOOP();
grDrawLine(a,b);
END_CLIP_LOOP();
}
void FX_grAADrawPoint(GrVertex *a)
{
BEGIN_CLIP_LOOP();
grDrawPoint(a);
END_CLIP_LOOP();
}
#if FX_USE_PARGB
void FX_setupGrVertexLayout(void)
{
grReset(GR_VERTEX_PARAMETER);
BEGIN_BOARD_LOCK();
grReset(GR_VERTEX_PARAMETER);
grCoordinateSpace(GR_WINDOW_COORDS);
grVertexLayout(GR_PARAM_XY, GR_VERTEX_X_OFFSET << 2, GR_PARAM_ENABLE);
grVertexLayout(GR_PARAM_RGB, GR_VERTEX_R_OFFSET << 2, GR_PARAM_ENABLE);
/* grVertexLayout(GR_PARAM_Z, GR_VERTEX_Z_OFFSET << 2, GR_PARAM_ENABLE); */
grVertexLayout(GR_PARAM_A, GR_VERTEX_A_OFFSET << 2, GR_PARAM_ENABLE);
grVertexLayout(GR_PARAM_Q, GR_VERTEX_OOW_OFFSET << 2, GR_PARAM_ENABLE);
grVertexLayout(GR_PARAM_Z, GR_VERTEX_OOZ_OFFSET << 2, GR_PARAM_ENABLE);
grVertexLayout(GR_PARAM_ST0, GR_VERTEX_SOW_TMU0_OFFSET << 2, GR_PARAM_ENABLE);
grVertexLayout(GR_PARAM_Q0, GR_VERTEX_OOW_TMU0_OFFSET << 2, GR_PARAM_DISABLE);
grVertexLayout(GR_PARAM_ST1, GR_VERTEX_SOW_TMU1_OFFSET << 2, GR_PARAM_DISABLE);
grVertexLayout(GR_PARAM_Q1, GR_VERTEX_OOW_TMU1_OFFSET << 2, GR_PARAM_DISABLE);
grCoordinateSpace(GR_WINDOW_COORDS);
grVertexLayout(GR_PARAM_XY, GR_VERTEX_X_OFFSET << 2, GR_PARAM_ENABLE);
grVertexLayout(GR_PARAM_PARGB, GR_VERTEX_PARGB_OFFSET << 2, GR_PARAM_ENABLE);
grVertexLayout(GR_PARAM_Q, GR_VERTEX_OOW_OFFSET << 2, GR_PARAM_ENABLE);
grVertexLayout(GR_PARAM_Z, GR_VERTEX_OOZ_OFFSET << 2, GR_PARAM_ENABLE);
grVertexLayout(GR_PARAM_ST0, GR_VERTEX_SOW_TMU0_OFFSET << 2, GR_PARAM_ENABLE);
grVertexLayout(GR_PARAM_Q0, GR_VERTEX_OOW_TMU0_OFFSET << 2, GR_PARAM_DISABLE);
grVertexLayout(GR_PARAM_ST1, GR_VERTEX_SOW_TMU1_OFFSET << 2, GR_PARAM_DISABLE);
grVertexLayout(GR_PARAM_Q1, GR_VERTEX_OOW_TMU1_OFFSET << 2, GR_PARAM_DISABLE);
END_BOARD_LOCK();
}
#else /* FX_USE_PARGB */
void FX_setupGrVertexLayout(void)
{
BEGIN_BOARD_LOCK();
grReset(GR_VERTEX_PARAMETER);
grCoordinateSpace(GR_WINDOW_COORDS);
grVertexLayout(GR_PARAM_XY, GR_VERTEX_X_OFFSET << 2, GR_PARAM_ENABLE);
grVertexLayout(GR_PARAM_RGB, GR_VERTEX_R_OFFSET << 2, GR_PARAM_ENABLE);
grVertexLayout(GR_PARAM_A, GR_VERTEX_A_OFFSET << 2, GR_PARAM_ENABLE);
grVertexLayout(GR_PARAM_Q, GR_VERTEX_OOW_OFFSET << 2, GR_PARAM_ENABLE);
grVertexLayout(GR_PARAM_Z, GR_VERTEX_OOZ_OFFSET << 2, GR_PARAM_ENABLE);
grVertexLayout(GR_PARAM_ST0, GR_VERTEX_SOW_TMU0_OFFSET << 2, GR_PARAM_ENABLE);
grVertexLayout(GR_PARAM_Q0, GR_VERTEX_OOW_TMU0_OFFSET << 2, GR_PARAM_DISABLE);
grVertexLayout(GR_PARAM_ST1, GR_VERTEX_SOW_TMU1_OFFSET << 2, GR_PARAM_DISABLE);
grVertexLayout(GR_PARAM_Q1, GR_VERTEX_OOW_TMU1_OFFSET << 2, GR_PARAM_DISABLE);
END_BOARD_LOCK();
}
#endif
void FX_grHints_NoLock(GrHint_t hintType, FxU32 hintMask)
{
switch(hintType) {
case GR_HINT_STWHINT:
{
if (hintMask & GR_STWHINT_W_DIFF_TMU0)
grVertexLayout(GR_PARAM_Q0, GR_VERTEX_OOW_TMU0_OFFSET << 2, GR_PARAM_ENABLE);
else
grVertexLayout(GR_PARAM_Q0,GR_VERTEX_OOW_TMU0_OFFSET << 2, GR_PARAM_DISABLE);
if (hintMask & GR_STWHINT_ST_DIFF_TMU1)
grVertexLayout(GR_PARAM_ST1,GR_VERTEX_SOW_TMU1_OFFSET << 2, GR_PARAM_ENABLE);
else
grVertexLayout(GR_PARAM_ST1,GR_VERTEX_SOW_TMU1_OFFSET << 2, GR_PARAM_DISABLE);
if (hintMask & GR_STWHINT_W_DIFF_TMU1)
grVertexLayout(GR_PARAM_Q1,GR_VERTEX_OOW_TMU1_OFFSET << 2, GR_PARAM_ENABLE);
else
grVertexLayout(GR_PARAM_Q1,GR_VERTEX_OOW_TMU1_OFFSET << 2, GR_PARAM_DISABLE);
}
}
}
void FX_grHints(GrHint_t hintType, FxU32 hintMask)
{
switch(hintType) {
case GR_HINT_STWHINT:
{
if (hintMask & GR_STWHINT_W_DIFF_TMU0)
grVertexLayout(GR_PARAM_Q0, GR_VERTEX_OOW_TMU0_OFFSET << 2, GR_PARAM_ENABLE);
else
grVertexLayout(GR_PARAM_Q0,GR_VERTEX_OOW_TMU0_OFFSET << 2, GR_PARAM_DISABLE);
if (hintMask & GR_STWHINT_ST_DIFF_TMU1)
grVertexLayout(GR_PARAM_ST1,GR_VERTEX_SOW_TMU1_OFFSET << 2, GR_PARAM_ENABLE);
else
grVertexLayout(GR_PARAM_ST1,GR_VERTEX_SOW_TMU1_OFFSET << 2, GR_PARAM_DISABLE);
if (hintMask & GR_STWHINT_W_DIFF_TMU1)
grVertexLayout(GR_PARAM_Q1,GR_VERTEX_OOW_TMU1_OFFSET << 2, GR_PARAM_ENABLE);
else
grVertexLayout(GR_PARAM_Q1,GR_VERTEX_OOW_TMU1_OFFSET << 2, GR_PARAM_DISABLE);
}
}
void FX_grHints(GrHint_t hintType, FxU32 hintMask) {
BEGIN_BOARD_LOCK();
FX_grHints_NoLock(hintType, hintMask);
END_BOARD_LOCK();
}
int FX_grSstQueryHardware(GrHwConfiguration *config)
{
int i,j;
int numFB;
BEGIN_BOARD_LOCK();
grGet(GR_NUM_BOARDS,4,(void*)&(config->num_sst));
if (config->num_sst == 0)
return 0;
@@ -225,12 +337,80 @@ int FX_grSstQueryHardware(GrHwConfiguration *config)
config->SSTs[i].sstBoard.VoodooConfig.sliDetect = FXFALSE;
for (j = 0; j < config->SSTs[i].sstBoard.VoodooConfig.nTexelfx; j++)
{
grGet(GR_MEMORY_TMU,4,(void*)&(config->SSTs[i].sstBoard.VoodooConfig.tmuConfig[i].tmuRam));
grGet(GR_MEMORY_TMU,4,(void*)&(config->SSTs[i].sstBoard.VoodooConfig.tmuConfig[j].tmuRam));
config->SSTs[i].sstBoard.VoodooConfig.tmuConfig[j].tmuRam /= 1024*1024;
}
}
END_BOARD_LOCK();
return 1;
}
#else
int FX_grSstScreenWidth()
{
int i;
BEGIN_BOARD_LOCK();
i = grSstScreenWidth();
END_BOARD_LOCK();
return i;
}
int FX_grSstScreenHeight()
{
int i;
BEGIN_BOARD_LOCK();
i = grSstScreenHeight();
END_BOARD_LOCK();
return i;
}
int FX_grSstQueryHardware(GrHwConfiguration *c)
{
int i;
BEGIN_BOARD_LOCK();
i = grSstQueryHardware(c);
END_BOARD_LOCK();
return i;
}
FX_GrContext_t FX_grSstWinOpen( FxU32 hWnd,
GrScreenResolution_t screen_resolution,
GrScreenRefresh_t refresh_rate,
GrColorFormat_t color_format,
GrOriginLocation_t origin_location,
int nColBuffers,
int nAuxBuffers)
{
FX_GrContext_t i;
BEGIN_BOARD_LOCK();
i = grSstWinOpen( hWnd,
screen_resolution,
refresh_rate,
color_format,
origin_location,
nColBuffers,
nAuxBuffers );
#if 0
fprintf(stderr,
"grSstWinOpen( win %d res %d ref %d fmt %d\n"
" org %d ncol %d naux %d )\n"
" ==> %d\n",
hWnd,
screen_resolution,
refresh_rate,
color_format,
origin_location,
nColBuffers,
nAuxBuffers,
i);
#endif
END_BOARD_LOCK();
return i;
}
#endif
#else

View File

@@ -1,26 +1,48 @@
/* -*- mode: C; tab-width:8; c-basic-offset:2 -*- */
/*
* Mesa 3-D graphics library
* Version: 3.1
*
*
* 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.
*
*
* Original Mesa / 3Dfx device driver (C) 1999 David Bucciarelli, by the
* terms stated above.
*
* Thank you for your contribution, David!
*
* Please make note of the above copyright/license statement. If you
* contributed code or bug fixes to this code under the previous (GNU
* Library) license and object to the new license, your code will be
* removed at your request. Please see the Mesa docs/COPYRIGHT file
* for more information.
*
* Additional Mesa/3Dfx driver developers:
* Daryll Strauss <daryll@precisioninsight.com>
* Keith Whitwell <keith@precisioninsight.com>
*
* See fxapi.h for more revision/author details.
*/
#ifndef __FX_GLIDE_WARPER__
#define __FX_GLIDE_WARPER__
@@ -155,31 +177,76 @@ typedef struct {
float oow; /* 1/w (used mipmapping - really 0xfff/w) */
} GrTmuVertex;
#if FX_USE_PARGB
typedef struct
{
float x, y; /* X and Y in screen space */
float ooz; /* 65535/Z (used for Z-buffering) */
float oow; /* 1/W (used for W-buffering, texturing) */
float r, g, b, a; /* R, G, B, A [0..255.0] */
FxU32 argb; /* R, G, B, A [0..255.0] */
GrTmuVertex tmuvtx[GLIDE_NUM_TMU];
float z; /* Z is ignored */
GrTmuVertex tmuvtx[GLIDE_NUM_TMU];
} GrVertex;
#define GR_VERTEX_X_OFFSET 0
#define GR_VERTEX_Y_OFFSET 1
#define GR_VERTEX_OOZ_OFFSET 2
#define GR_VERTEX_OOW_OFFSET 3
#define GR_VERTEX_R_OFFSET 4
#define GR_VERTEX_G_OFFSET 5
#define GR_VERTEX_B_OFFSET 6
#define GR_VERTEX_PARGB_OFFSET 4
#define GR_VERTEX_SOW_TMU0_OFFSET 5
#define GR_VERTEX_TOW_TMU0_OFFSET 6
#define GR_VERTEX_OOW_TMU0_OFFSET 7
#define GR_VERTEX_SOW_TMU1_OFFSET 8
#define GR_VERTEX_TOW_TMU1_OFFSET 9
#define GR_VERTEX_OOW_TMU1_OFFSET 10
#define GR_VERTEX_Z_OFFSET 11
#define GET_PARGB(v) ((FxU32*)(v))[GR_VERTEX_PARGB_OFFSET]
/* GET_PA: returns the alpha component */
#if GLIDE_ENDIAN == GLIDE_ENDIAN_BIG
#define GET_PA(v) ((FxU8*)(v))[GR_VERTEX_PARGB_OFFSET*4]
#else
#define GET_PA(v) ((FxU8*)(v))[GR_VERTEX_PARGB_OFFSET*4+3]
#endif
#define MESACOLOR2PARGB(c) (c[ACOMP] << 24 | c[GCOMP] << 16 | c[GCOMP] << 8 | c[BCOMP])
#define PACK_4F_ARGB(dest,a,r,g,b) { \
const GLuint cr = (int)r; \
const GLuint cg = (int)g; \
const GLuint ca = (int)a; \
const GLuint cb = (int)b; \
dest = ca << 24 | cr << 16 | cg << 8 | cb; \
}
#else /* FX_USE_PARGB */
typedef struct
{
float x, y, z; /* X, Y, and Z of scrn space -- Z is ignored */
float r, g, b; /* R, G, B, ([0..255.0]) */
float ooz; /* 65535/Z (used for Z-buffering) */
float a; /* Alpha [0..255.0] */
float oow; /* 1/W (used for W-buffering, texturing) */
GrTmuVertex tmuvtx[GLIDE_NUM_TMU];
} GrVertex;
#define GR_VERTEX_X_OFFSET 0
#define GR_VERTEX_Y_OFFSET 1
#define GR_VERTEX_Z_OFFSET 2
#define GR_VERTEX_R_OFFSET 3
#define GR_VERTEX_G_OFFSET 4
#define GR_VERTEX_B_OFFSET 5
#define GR_VERTEX_OOZ_OFFSET 6
#define GR_VERTEX_A_OFFSET 7
#define GR_VERTEX_Z_OFFSET 8
#define GR_VERTEX_OOW_OFFSET 8
#define GR_VERTEX_SOW_TMU0_OFFSET 9
#define GR_VERTEX_TOW_TMU0_OFFSET 10
#define GR_VERTEX_OOW_TMU0_OFFSET 11
#define GR_VERTEX_SOW_TMU1_OFFSET 12
#define GR_VERTEX_TOW_TMU1_OFFSET 13
#define GR_VERTEX_OOW_TMU1_OFFSET 14
#endif /* FX_USE_PARGB */
#endif
@@ -188,29 +255,89 @@ typedef struct
* Glide2 functions for Glide3
*/
#if defined(FX_GLIDE3)
#define FX_grTexDownloadTable(TMU,type,data) grTexDownloadTable(type,data)
#define FX_grTexDownloadTable(TMU,type,data) \
do { \
BEGIN_BOARD_LOCK(); \
grTexDownloadTable(type,data); \
END_BOARD_LOCK(); \
} while (0);
#define FX_grTexDownloadTable_NoLock(TMU,type,data) \
grTexDownloadTable(type, data)
#else
#define FX_grTexDownloadTable(TMU,type,data) grTexDownloadTable(TMU,type,data)
#define FX_grTexDownloadTable(TMU,type,data) \
do { \
BEGIN_BOARD_LOCK(); \
grTexDownloadTable(TMU,type,data); \
END_BOARD_LOCK(); \
} while (0);
#define FX_grTexDownloadTable_NoLock grTexDownloadTable
#endif
/*
* Flush
*/
#if defined(FX_GLIDE3)
#define FX_grFlush grFlush
#define FX_grFlush() \
do { \
BEGIN_BOARD_LOCK(); \
grFlush(); \
END_BOARD_LOCK(); \
} while (0)
#else
#define FX_grFlush grSstIdle
#define FX_grFlush() \
do { \
BEGIN_BOARD_LOCK(); \
grSstIdle(); \
END_BOARD_LOCK(); \
} while (0)
#endif
#define FX_grFinish() \
do { \
BEGIN_BOARD_LOCK(); \
grFinish(); \
END_BOARD_LOCK(); \
} while (0)
/*
* Write region: ToDo possible exploit the PixelPipe parameter.
*/
#if defined(FX_GLIDE3)
#define FX_grLfbWriteRegion(dst_buffer,dst_x,dst_y,src_format,src_width,src_height,src_stride,src_data) \
grLfbWriteRegion(dst_buffer,dst_x,dst_y,src_format,src_width,src_height,FXFALSE,src_stride,src_data)
#define FX_grLfbWriteRegion(dst_buffer,dst_x,dst_y,src_format,src_width,src_height,src_stride,src_data) \
do { \
BEGIN_BOARD_LOCK(); \
grLfbWriteRegion(dst_buffer,dst_x,dst_y,src_format,src_width,src_height,FXFALSE,src_stride,src_data); \
END_BOARD_LOCK(); \
} while(0)
#else
#define FX_grLfbWriteRegion(dst_buffer,dst_x,dst_y,src_format,src_width,src_height,src_stride,src_data) \
grLfbWriteRegion(dst_buffer,dst_x,dst_y,src_format,src_width,src_height,src_stride,src_data)
#define FX_grLfbWriteRegion(dst_buffer,dst_x,dst_y,src_format,src_width,src_height,src_stride,src_data) \
do { \
BEGIN_BOARD_LOCK(); \
grLfbWriteRegion(dst_buffer,dst_x,dst_y,src_format,src_width,src_height,src_stride,src_data); \
END_BOARD_LOCK(); \
} while (0)
#endif
/*
* Read region
*/
#define FX_grLfbReadRegion(src_buffer,src_x,src_y,src_width,src_height,dst_stride,dst_data) \
do { \
BEGIN_BOARD_LOCK(); \
grLfbReadRegion(src_buffer,src_x,src_y,src_width,src_height,dst_stride,dst_data); \
END_BOARD_LOCK(); \
} while (0);
/*
* Draw triangle
*/
#define FX_grDrawTriangle(a,b,c) \
do { \
BEGIN_CLIP_LOOP(); \
grDrawTriangle(a,b,c); \
END_CLIP_LOOP(); \
} while (0)
/*
* For Lod/LodLog2 conversion.
*/
@@ -243,12 +370,14 @@ typedef struct
#else
#define FX_largeLodValue(info) ((int)(info).largeLod)
#endif
#define FX_largeLodValue_NoLock FX_largeLodValue
#if defined(FX_GLIDE3)
#define FX_smallLodValue(info) ((int)(GR_LOD_256-(info).smallLodLog2))
#else
#define FX_smallLodValue(info) ((int)(info).smallLod)
#endif
#define FX_smallLodValue_NoLock FX_smallLodValue
#if defined(FX_GLIDE3)
#define FX_valueToLod(val) ((GrLOD_t)(GR_LOD_256-val))
@@ -259,13 +388,9 @@ typedef struct
/*
* ScreenWidth/Height stuff.
*/
#if defined(FX_GLIDE3)
extern int FX_grSstScreenWidth();
extern int FX_grSstScreenHeight();
#else
#define FX_grSstScreenWidth() grSstScreenWidth()
#define FX_grSstScreenHeight() grSstScreenHeight()
#endif
extern int FX_grSstScreenWidth(void);
extern int FX_grSstScreenHeight(void);
/*
@@ -274,7 +399,12 @@ typedef struct
#if defined(FX_GLIDE3)
extern void FX_grGlideGetVersion(char *buf);
#else
#define FX_grGlideGetVersion grGlideGetVersion
#define FX_grGlideGetVersion(b) \
do { \
BEGIN_BOARD_LOCK(); \
grGlideGetVersion(b); \
END_BOARD_LOCK(); \
} while (0)
#endif
/*
* Performance statistics
@@ -282,25 +412,33 @@ typedef struct
#if defined(FX_GLIDE3)
extern void FX_grSstPerfStats(GrSstPerfStats_t *st);
#else
#define FX_grSstPerfStats grSstPerfStats
#define FX_grSstPerfStats(s) \
do { \
BEGIN_BOARD_LOCK(); \
grSstPerfStats(s); \
END_BOARD_LOCK(); \
} while (0)
#endif
/*
* Hardware Query
*/
#if defined(FX_GLIDE3)
extern int FX_grSstQueryHardware(GrHwConfiguration *config);
#else
#define FX_grSstQueryHardware grSstQueryHardware
#endif
/*
* GrHints
*/
#if defined(FX_GLIDE3)
extern void FX_grHints_NoLock(GrHint_t hintType, FxU32 hintMask);
extern void FX_grHints(GrHint_t hintType, FxU32 hintMask);
#else
#define FX_grHints grHints
#define FX_grHints(t,m) \
do { \
BEGIN_BOARD_LOCK(); \
grHints(t, m); \
END_BOARD_LOCK(); \
} while(0)
#define FX_grHints_NoLock grHints
#endif
/*
* Antialiashed line+point drawing.
@@ -308,13 +446,23 @@ typedef struct
#if defined(FX_GLIDE3)
extern void FX_grAADrawLine(GrVertex *a,GrVertex *b);
#else
#define FX_grAADrawLine grAADrawLine
#define FX_grAADrawLine(a,b) \
do { \
BEGIN_CLIP_LOOP(); \
grAADrawLine(a,b); \
END_CLIP_LOOP(); \
} while (0)
#endif
#if defined(FX_GLIDE3)
extern void FX_grAADrawPoint(GrVertex *a);
#else
#define FX_grAADrawPoint grAADrawPoint
#define FX_grAADrawPoint(a) \
do { \
BEGIN_CLIP_LOOP(); \
grAADrawPoint(a); \
END_CLIP_LOOP(); \
} while (0)
#endif
/*
@@ -328,31 +476,345 @@ typedef struct
/*
* grSstControl stuff
*/
#if defined(FX_GLIDE3)
extern void FX_grSstControl(int par);
#else
#define FX_grSstControl grSstControl
#endif
extern FxBool FX_grSstControl(FxU32 code);
/*
* grGammaCorrectionValue
*/
#if defined(FX_GLIDE3)
extern void FX_grGammaCorrectionValue(float val);
#else
#define FX_grGammaCorrectionValue grGammaCorrectionValue
#define FX_grGammaCorrectionValue(v) \
do { \
BEGIN_BOARD_LOCK(); \
grGammaCorrectionValue(v) \
END_BOARD_LOCK(); \
} while (0)
#endif
/*
* WinOpen/Close.
*/
#if defined(FX_GLIDE3)
#define FX_grSstWinOpen(hWnd,screen_resolution,refresh_rate,color_format,origin_location,nColBuffers,nAuxBuffers) \
grSstWinOpen(-1,screen_resolution,refresh_rate,color_format,origin_location,nColBuffers,nAuxBuffers)
#define FX_grSstWinClose grSstWinClose
#define FX_grSstWinClose(w) \
do { \
BEGIN_BOARD_LOCK(); \
grSstWinClose(w); \
END_BOARD_LOCK(); \
} while (0)
#else
#define FX_grSstWinOpen grSstWinOpen
#define FX_grSstWinClose(win) grSstWinClose()
#define FX_grSstWinClose(w) \
do { \
BEGIN_BOARD_LOCK(); \
grSstWinClose(); \
END_BOARD_LOCK(); \
} while (0)
#endif
extern FX_GrContext_t FX_grSstWinOpen( FxU32 hWnd,
GrScreenResolution_t screen_resolution,
GrScreenRefresh_t refresh_rate,
GrColorFormat_t color_format,
GrOriginLocation_t origin_location,
int nColBuffers,
int nAuxBuffers);
#define FX_grDrawLine(v1, v2) \
do { \
BEGIN_CLIP_LOOP(); \
grDrawLine(v1, v2); \
END_CLIP_LOOP(); \
} while (0)
#define FX_grDrawPoint(p) \
do { \
BEGIN_CLIP_LOOP(); \
grDrawPoint(p); \
END_CLIP_LOOP(); \
} while (0)
#define FX_grDitherMode(m) \
do { \
BEGIN_BOARD_LOCK(); \
grDitherMode(m); \
END_BOARD_LOCK(); \
} while (0)
#define FX_grRenderBuffer(b) \
do { \
BEGIN_BOARD_LOCK(); \
grRenderBuffer(b); \
END_BOARD_LOCK(); \
} while (0)
#define FX_grBufferClear(c, a, d) \
do { \
BEGIN_CLIP_LOOP(); \
grBufferClear(c, a, d); \
END_CLIP_LOOP(); \
} while (0)
#define FX_grDepthMask(m) \
do { \
BEGIN_BOARD_LOCK(); \
grDepthMask(m); \
END_BOARD_LOCK(); \
} while (0)
#define FX_grColorMask(c, a) \
do { \
BEGIN_BOARD_LOCK(); \
grColorMask(c, a); \
END_BOARD_LOCK(); \
} while (0)
extern FxBool FX_grLfbLock(GrLock_t type, GrBuffer_t buffer,
GrLfbWriteMode_t writeMode,
GrOriginLocation_t origin, FxBool pixelPipeline,
GrLfbInfo_t *info );
#define FX_grLfbUnlock(t, b) \
do { \
BEGIN_BOARD_LOCK(); \
grLfbUnlock(t, b); \
END_BOARD_LOCK(); \
} while (0)
#define FX_grConstantColorValue(v) \
do { \
BEGIN_BOARD_LOCK(); \
grConstantColorValue(v); \
END_BOARD_LOCK(); \
} while (0)
#define FX_grConstantColorValue_NoLock grConstantColorValue
#define FX_grAADrawTriangle(a, b, c, ab, bc, ca) \
do { \
BEGIN_CLIP_LOOP(); \
grAADrawTriangle(a, b, c, ab, bc, ca); \
END_CLIP_LOOP(); \
} while (0)
#define FX_grAlphaBlendFunction(rs, rd, as, ad) \
do { \
BEGIN_BOARD_LOCK(); \
grAlphaBlendFunction(rs, rd, as, ad); \
END_BOARD_LOCK(); \
} while (0)
#define FX_grAlphaCombine(func, fact, loc, oth, inv) \
do { \
BEGIN_BOARD_LOCK(); \
grAlphaCombine(func, fact, loc, oth, inv); \
END_BOARD_LOCK(); \
} while (0)
#define FX_grAlphaCombine_NoLock grAlphaCombine
#define FX_grAlphaTestFunction(f) \
do { \
BEGIN_BOARD_LOCK(); \
grAlphaTestFunction(f); \
END_BOARD_LOCK(); \
} while (0)
#define FX_grAlphaTestReferenceValue(v) \
do { \
BEGIN_BOARD_LOCK(); \
grAlphaTestReferenceValue(v); \
END_BOARD_LOCK(); \
} while (0)
#define FX_grClipWindow(minx, miny, maxx, maxy) \
do { \
BEGIN_BOARD_LOCK(); \
grClipWindow(minx, miny, maxx, maxy); \
END_BOARD_LOCK(); \
} while (0)
#define FX_grClipWindow_NoLock grClipWindow
#define FX_grColorCombine(func, fact, loc, oth, inv) \
do { \
BEGIN_BOARD_LOCK(); \
grColorCombine(func, fact, loc, oth, inv); \
END_BOARD_LOCK(); \
} while (0)
#define FX_grColorCombine_NoLock grColorCombine
#define FX_grCullMode(m) \
do { \
BEGIN_BOARD_LOCK(); \
grCullMode(m); \
END_BOARD_LOCK(); \
} while (0)
#define FX_grDepthBiasLevel(lev) \
do { \
BEGIN_BOARD_LOCK(); \
grDepthBiasLevel(lev); \
END_BOARD_LOCK(); \
} while (0)
#define FX_grDepthBufferFunction(func) \
do { \
BEGIN_BOARD_LOCK(); \
grDepthBufferFunction(func); \
END_BOARD_LOCK(); \
} while (0)
#define FX_grFogColorValue(c) \
do { \
BEGIN_BOARD_LOCK(); \
grFogColorValue(c); \
END_BOARD_LOCK(); \
} while (0)
#define FX_grFogMode(m) \
do { \
BEGIN_BOARD_LOCK(); \
grFogMode(m); \
END_BOARD_LOCK(); \
} while (0)
#define FX_grFogTable(t) \
do { \
BEGIN_BOARD_LOCK(); \
grFogTable(t); \
END_BOARD_LOCK(); \
} while (0)
#define FX_grTexClampMode(t, sc, tc) \
do { \
BEGIN_BOARD_LOCK(); \
grTexClampMode(t, sc, tc); \
END_BOARD_LOCK(); \
} while (0)
#define FX_grTexClampMode_NoLock grTexClampMode
#define FX_grTexCombine(t, rfunc, rfact, afunc, afact, rinv, ainv) \
do { \
BEGIN_BOARD_LOCK(); \
grTexCombine(t, rfunc, rfact, afunc, afact, rinv, ainv); \
END_BOARD_LOCK(); \
} while (0)
#define FX_grTexCombine_NoLock grTexCombine
#define FX_grTexDownloadMipMapLevel(t, sa, tlod, llod, ar, f, eo, d) \
do { \
BEGIN_BOARD_LOCK(); \
grTexDownloadMipMapLevel(t, sa, tlod, llod, ar, f, eo, d); \
END_BOARD_LOCK(); \
} while (0)
#define FX_grTexDownloadMipMapLevel_NoLock grTexDownloadMipMapLevel
#define FX_grTexDownloadMipMapLevelPartial(t, sa, tlod, llod, ar, f, eo, d, s, e); \
do { \
BEGIN_BOARD_LOCK(); \
grTexDownloadMipMapLevelPartial(t, sa, tlod, llod, ar, f, eo, d, s, e); \
END_BOARD_LOCK(); \
} while (0)
#define FX_grTexFilterMode(t, minf, magf) \
do { \
BEGIN_BOARD_LOCK(); \
grTexFilterMode(t, minf, magf); \
END_BOARD_LOCK(); \
} while (0)
#define FX_grTexFilterMode_NoLock grTexFilterMode
extern FxU32 FX_grTexMinAddress(GrChipID_t tmu);
extern FxU32 FX_grTexMaxAddress(GrChipID_t tmu);
#define FX_grTexMipMapMode(t, m, lod) \
do { \
BEGIN_BOARD_LOCK(); \
grTexMipMapMode(t, m, lod); \
END_BOARD_LOCK(); \
} while (0)
#define FX_grTexMipMapMode_NoLock grTexMipMapMode
#define FX_grTexSource(t, sa, eo, i) \
do { \
BEGIN_BOARD_LOCK(); \
grTexSource(t, sa, eo, i); \
END_BOARD_LOCK(); \
} while (0)
#define FX_grTexSource_NoLock grTexSource
extern FxU32 FX_grTexTextureMemRequired(FxU32 evenOdd, GrTexInfo *info);
#define FX_grTexTextureMemRequired_NoLock grTexTextureMemRequired
#define FX_grGlideGetState(s) \
do { \
BEGIN_BOARD_LOCK(); \
grGlideGetState(s); \
END_BOARD_LOCK(); \
} while (0)
#define FX_grDRIBufferSwap(i) \
do { \
BEGIN_BOARD_LOCK(); \
grDRIBufferSwap(i); \
END_BOARD_LOCK(); \
} while (0)
#define FX_grSstSelect(b) \
do { \
BEGIN_BOARD_LOCK(); \
grSstSelect(b); \
END_BOARD_LOCK(); \
} while (0)
#define FX_grSstSelect_NoLock grSstSelect
#define FX_grGlideSetState(s) \
do { \
BEGIN_BOARD_LOCK(); \
grGlideSetState(s); \
END_BOARD_LOCK(); \
} while (0)
#define FX_grDepthBufferMode(m) \
do { \
BEGIN_BOARD_LOCK(); \
grDepthBufferMode(m); \
END_BOARD_LOCK(); \
} while (0)
#define FX_grLfbWriteColorFormat(f) \
do { \
BEGIN_BOARD_LOCK(); \
grLfbWriteColorFormat(f); \
END_BOARD_LOCK(); \
} while (0)
#define FX_grDrawVertexArray(m, c, p) \
do { \
BEGIN_CLIP_LOOP(); \
grDrawVertexArray(m, c, p); \
END_CLIP_LOOP(); \
} while (0)
#define FX_grGlideShutdown() \
do { \
BEGIN_CLIP_LOOP(); \
grGlideShutdown(); \
END_CLIP_LOOP(); \
} while (0)
#define FX_grGlideInit_NoLock grGlideInit
#define FX_grSstWinOpen_NoLock grSstWinOpen
extern int FX_getFogTableSize(void);
extern int FX_getGrStateSize(void);
#endif /* __FX_GLIDE_WARPER__ */

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,25 +1,53 @@
/* -*- mode: C; tab-width:8; c-basic-offset:2 -*- */
/*
* Mesa 3-D graphics library
* Version: 3.1
*
* 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.
*
*
* Original Mesa / 3Dfx device driver (C) 1999 David Bucciarelli, by the
* terms stated above.
*
* Thank you for your contribution, David!
*
* Please make note of the above copyright/license statement. If you
* contributed code or bug fixes to this code under the previous (GNU
* Library) license and object to the new license, your code will be
* removed at your request. Please see the Mesa docs/COPYRIGHT file
* for more information.
*
* Additional Mesa/3Dfx driver developers:
* Daryll Strauss <daryll@precisioninsight.com>
* Keith Whitwell <keith@precisioninsight.com>
*
* See fxapi.h for more revision/author details.
*/
/* fxwgl.c - Microsoft wgl functions emulation for
* 3Dfx VooDoo/Mesa interface
*/
/*
* 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.
*
* See the file fxapi.c for more informations about authors
*
*/
#ifdef __WIN32__
@@ -28,14 +56,14 @@ extern "C" {
#endif
#include <windows.h>
#include <GL/gl.h>
#include "GL/gl.h"
#ifdef __cplusplus
}
#endif
#include <stdio.h>
#include <GL/fxmesa.h>
#include "GL/fxmesa.h"
#include "fxdrv.h"
#define MAX_MESA_ATTRS 20
@@ -243,11 +271,11 @@ LONG GLAPIENTRY __wglMonitor(HWND hwnd,UINT message,UINT wParam,LONG lParam)
static int moving = 0;
if (!moving) {
if(fxQueryHardware()!=GR_SSTTYPE_VOODOO) {
if(!grSstControl(GR_CONTROL_RESIZE)) {
if(!FX_grSstControl(GR_CONTROL_RESIZE)) {
moving = 1;
SetWindowPos(hwnd, 0, 0, 0, 300, 300, SWP_NOMOVE|SWP_NOZORDER);
moving = 0;
if(!grSstControl(GR_CONTROL_RESIZE)) {
if(!FX_grSstControl(GR_CONTROL_RESIZE)) {
/*MessageBox(0,_T("Error changing windowsize"),_T("fxMESA"),MB_OK);*/
PostMessage(hWND,WM_CLOSE,0,0);
}
@@ -255,7 +283,7 @@ LONG GLAPIENTRY __wglMonitor(HWND hwnd,UINT message,UINT wParam,LONG lParam)
}
/* Do the clipping in the glide library */
grClipWindow(0,0,grSstScreenWidth(),grSstScreenHeight());
FX_grClipWindow(0,0,FX_grSstScreenWidth(),FX_grSstScreenHeight());
/* And let the new size set in the context */
fxMesaUpdateScreenSize(ctx);
}
@@ -269,21 +297,22 @@ LONG GLAPIENTRY __wglMonitor(HWND hwnd,UINT message,UINT wParam,LONG lParam)
BOOL fMinimized = (BOOL) HIWORD(wParam);
if((fActive == WA_INACTIVE) || fMinimized)
grSstControl(GR_CONTROL_DEACTIVATE);
FX_grSstControl(GR_CONTROL_DEACTIVATE);
else
grSstControl(GR_CONTROL_ACTIVATE);
FX_grSstControl(GR_CONTROL_ACTIVATE);
}
break;
case WM_SHOWWINDOW:
break;
case WM_SYSKEYDOWN:
case WM_SYSCHAR:
if(gdiWindowHackEna && (VK_RETURN == wParam)) {
if(gdiWindowHack) {
gdiWindowHack = GL_FALSE;
grSstControl(GR_CONTROL_ACTIVATE);
FX_grSstControl(GR_CONTROL_ACTIVATE);
} else {
gdiWindowHack = GL_TRUE;
grSstControl(GR_CONTROL_DEACTIVATE);
FX_grSstControl(GR_CONTROL_DEACTIVATE);
}
}
break;
@@ -351,7 +380,7 @@ HGLRC GLAPIENTRY wglCreateContext(HDC hdc)
hDC = GetDC(dibWnd);
dibBMI = (BITMAPINFO*) malloc( sizeof(BITMAPINFO) + (256*sizeof(RGBQUAD)));
dibBMI = (BITMAPINFO*) MALLOC( sizeof(BITMAPINFO) + (256*sizeof(RGBQUAD)));
memset(dibBMI,0,sizeof(BITMAPINFO) + (256*sizeof(RGBQUAD)));
@@ -382,7 +411,7 @@ HGLRC GLAPIENTRY wglCreateContext(HDC hdc)
gdiWindowHack = GL_FALSE;
else {
gdiWindowHack = GL_TRUE;
grSstControl(GR_CONTROL_DEACTIVATE);
FX_grSstControl(GR_CONTROL_DEACTIVATE);
}
}
} else {
@@ -429,7 +458,7 @@ BOOL GLAPIENTRY wglDeleteContext(HGLRC hglrc)
if(ctx && hglrc == (HGLRC)1) {
if (gdiWindowHackEna) {
DeleteObject(dibHBM);
free(dibBMI);
FREE(dibBMI);
dibSurfacePtr = NULL;
dibBMI = NULL;
@@ -542,7 +571,7 @@ BOOL GLAPIENTRY wglUseFontBitmaps(HDC fontDevice, DWORD firstChar, DWORD numChar
SetTextColor(bitDevice, tempColor);
// Place chars based on base line
VERIFY(SetTextAlign(bitDevice, TA_BASELINE) >= 0);
VERIFY(SetTextAlign(bitDevice, TA_BASELINE) >= 0 ? 1 : 0);
for(i = 0; i < numChars; i++) {
SIZE size;
@@ -584,7 +613,7 @@ BOOL GLAPIENTRY wglUseFontBitmaps(HDC fontDevice, DWORD firstChar, DWORD numChar
// Convert the display dependant representation to a 1 bit deep DIB
numBytes = (bmapWidth * bmapHeight) / 8;
bmap = malloc(numBytes);
bmap = MALLOC(numBytes);
dibInfo->bmiHeader.biWidth = bmapWidth;
dibInfo->bmiHeader.biHeight = bmapHeight;
res = GetDIBits(bitDevice, bitObject, 0, bmapHeight, bmap,
@@ -604,13 +633,13 @@ BOOL GLAPIENTRY wglUseFontBitmaps(HDC fontDevice, DWORD firstChar, DWORD numChar
DeleteObject(bitObject);
// Deallocate the bitmap data
free(bmap);
FREE(bmap);
}
// Destroy the DC
VERIFY(DeleteDC(bitDevice));
free(dibInfo);
FREE(dibInfo);
return TRUE;
#undef VERIFY
@@ -779,7 +808,7 @@ BOOL GLAPIENTRY wglSwapBuffers(HDC hdc)
HDC hdcDIBSection = CreateCompatibleDC(hdcScreen);
HBITMAP holdBitmap = (HBITMAP) SelectObject(hdcDIBSection, dibHBM);
grLfbReadRegion(GR_BUFFER_FRONTBUFFER, 0, 0,
FX_grLfbReadRegion(GR_BUFFER_FRONTBUFFER, 0, 0,
width, height,
width * 2,
dibSurfacePtr);
@@ -799,6 +828,7 @@ BOOL GLAPIENTRY wglSwapBuffers(HDC hdc)
* display. Obviously, it's performance hit will be higher on larger displays and
* less on smaller displays. To support the window-hack display this is probably fine.
*/
#if FXMESA_USE_ARGB
{
unsigned long *pixel = dibSurfacePtr;
unsigned long count = (width * height) / 2;
@@ -811,7 +841,8 @@ BOOL GLAPIENTRY wglSwapBuffers(HDC hdc)
;
}
}
#endif
BitBlt(hdcScreen, 0, 0,
width, height,
hdcDIBSection,

View File

@@ -1,8 +1,8 @@
/* $Id: osmesa.c,v 1.1 1999/08/19 00:55:42 jtg Exp $ */
/* $Id: osmesa.c,v 1.3 1999/11/11 01:28:41 brianp Exp $ */
/*
* Mesa 3-D graphics library
* Version: 3.1
* Version: 3.3
*
* Copyright (C) 1999 Brian Paul All Rights Reserved.
*
@@ -38,7 +38,7 @@
#include "GL/osmesa.h"
#include "context.h"
#include "depth.h"
#include "macros.h"
#include "mem.h"
#include "matrix.h"
#include "types.h"
#include "vb.h"
@@ -212,7 +212,7 @@ OSMesaContext GLAPIENTRY OSMesaCreateContext( GLenum format, OSMesaContext share
}
osmesa = (OSMesaContext) calloc( 1, sizeof(struct osmesa_context) );
osmesa = (OSMesaContext) CALLOC_STRUCT(osmesa_context);
if (osmesa) {
osmesa->gl_visual = gl_create_visual( rgbmode,
swalpha, /* software alpha */
@@ -232,14 +232,14 @@ OSMesaContext GLAPIENTRY OSMesaCreateContext( GLenum format, OSMesaContext share
(void *) osmesa, GL_TRUE );
if (!osmesa->gl_ctx) {
gl_destroy_visual( osmesa->gl_visual );
free(osmesa);
FREE(osmesa);
return NULL;
}
osmesa->gl_buffer = gl_create_framebuffer( osmesa->gl_visual );
if (!osmesa->gl_buffer) {
gl_destroy_visual( osmesa->gl_visual );
gl_destroy_context( osmesa->gl_ctx );
free(osmesa);
FREE(osmesa);
return NULL;
}
osmesa->format = format;
@@ -275,7 +275,7 @@ void GLAPIENTRY OSMesaDestroyContext( OSMesaContext ctx )
gl_destroy_visual( ctx->gl_visual );
gl_destroy_framebuffer( ctx->gl_buffer );
gl_destroy_context( ctx->gl_ctx );
free( ctx );
FREE( ctx );
}
}
@@ -400,7 +400,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 */
gl_Viewport( ctx->gl_ctx, 0, 0, width, height );
_mesa_Viewport( 0, 0, width, height );
ctx->gl_ctx->Scissor.Width = width;
ctx->gl_ctx->Scissor.Height = height;
}

View File

@@ -1,4 +1,4 @@
/* $Id: fakeglx.c,v 1.8 1999/09/16 16:44:37 brianp Exp $ */
/* $Id: fakeglx.c,v 1.12.2.4 1999/12/11 09:20:03 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -267,7 +267,7 @@ save_glx_visual( Display *dpy, XVisualInfo *vinfo,
&& (v->gl_visual->StencilBits >= stencil_size || stencil_size == 0)
&& (v->gl_visual->AccumBits >= accum_size || accum_size == 0)) {
/* now either compare XVisualInfo pointers or visual IDs */
if ((!comparePointers && v->vishandle->visualid == vinfo->visualid)
if ((!comparePointers && v->visinfo->visualid == vinfo->visualid)
|| (comparePointers && v->vishandle == vinfo)) {
return v;
}
@@ -718,6 +718,7 @@ static XVisualInfo *choose_x_visual( Display *dpy, int screen,
* Return: pointer to an XVisualInfo or NULL.
*/
static XVisualInfo *choose_x_overlay_visual( Display *dpy, int scr,
GLboolean rgbFlag,
int level, int trans_type,
int trans_value,
int min_depth,
@@ -809,10 +810,20 @@ static XVisualInfo *choose_x_overlay_visual( Display *dpy, int scr,
continue;
}
/* if RGB was requested, make sure we have True/DirectColor */
if (rgbFlag && vislist->CLASS != TrueColor
&& vislist->CLASS != DirectColor)
continue;
/* if CI was requested, make sure we have a color indexed visual */
if (!rgbFlag
&& (vislist->CLASS == TrueColor || vislist->CLASS == DirectColor))
continue;
if (deepvis==NULL || vislist->depth > deepest) {
/* YES! found a satisfactory visual */
if (deepvis) {
free( deepvis );
XFree( deepvis );
}
deepest = vislist->depth;
deepvis = vislist;
@@ -979,8 +990,21 @@ XVisualInfo *Fake_glXChooseVisual( Display *dpy, int screen, int *list )
}
else {
/* over/underlay planes */
vis = choose_x_overlay_visual( dpy, screen, level, trans_type,
trans_value, min_ci, visual_type );
if (rgb_flag) {
/* rgba overlay */
int min_rgb = min_red + min_green + min_blue;
if (min_rgb>1 && min_rgb<8) {
/* a special case to be sure we can get a monochrome visual */
min_rgb = 1;
}
vis = choose_x_overlay_visual( dpy, screen, rgb_flag, level,
trans_type, trans_value, min_rgb, visual_type );
}
else {
/* color index overlay */
vis = choose_x_overlay_visual( dpy, screen, rgb_flag, level,
trans_type, trans_value, min_ci, visual_type );
}
}
if (vis) {
@@ -1406,10 +1430,10 @@ static const char *get_extensions( void )
#ifdef FX
const char *fx = getenv("MESA_GLX_FX");
if (fx && fx[0] != 'd') {
return "GLX_MESA_pixmap_colormap GLX_EXT_visual_info GLX_MESA_release_buffers GLX_MESA_copy_sub_buffer GLX_SGI_video_sync GLX_EXT_get_proc_address GLX_MESA_set_3dfx_mode";
return "GLX_MESA_pixmap_colormap GLX_EXT_visual_info GLX_MESA_release_buffers GLX_MESA_copy_sub_buffer GLX_SGI_video_sync GLX_MESA_set_3dfx_mode GLX_ARB_get_proc_address";
}
#endif
return "GLX_MESA_pixmap_colormap GLX_EXT_visual_info GLX_MESA_release_buffers GLX_MESA_copy_sub_buffer GLX_SGI_video_sync GL_EXT_get_proc_address";
return "GLX_MESA_pixmap_colormap GLX_EXT_visual_info GLX_MESA_release_buffers GLX_MESA_copy_sub_buffer GLX_SGI_video_sync GLX_ARB_get_proc_address";
}
@@ -1494,30 +1518,62 @@ GLboolean Fake_glXSet3DfxModeMESA( GLint mode )
/*GLfunction Fake_glXGetProcAddress( const GLubyte *procName )*/
void (*Fake_glXGetProcAddress( const GLubyte *procName ))()
{
typedef void (*GLfunction)();
typedef void (*gl_function)();
struct proc {
const char *name;
GLfunction address;
gl_function address;
};
static struct proc procTable[] = {
{ "glXGetProcAddressEXT", (GLfunction) glXGetProcAddressEXT },
{ "glXCreateGLXPixmapMESA", (GLfunction) glXCreateGLXPixmapMESA },
{ "glXReleaseBuffersMESA", (GLfunction) glXReleaseBuffersMESA },
{ "glXCopySubBufferMESA", (GLfunction) glXCopySubBufferMESA },
{ "glXSet3DfxModeMESA", (GLfunction) glXSet3DfxModeMESA },
/* NOTE: GLX_SGI_video_sync not implemented in Mesa */
/* GLX 1.0 functions */
{ "glXChooseVisual", (gl_function) glXChooseVisual },
{ "glXCopyContext", (gl_function) glXCopyContext },
{ "glXCreateContext", (gl_function) glXCreateContext },
{ "glXCreateGLXPixmap", (gl_function) glXCreateGLXPixmap },
{ "glXDestroyContext", (gl_function) glXDestroyContext },
{ "glXDestroyGLXPixmap", (gl_function) glXDestroyGLXPixmap },
{ "glXGetConfig", (gl_function) glXGetConfig },
{ "glXGetCurrentContext", (gl_function) glXGetCurrentContext },
{ "glXGetCurrentDrawable", (gl_function) glXGetCurrentDrawable },
{ "glXIsDirect", (gl_function) glXIsDirect },
{ "glXMakeCurrent", (gl_function) glXMakeCurrent },
{ "glXQueryExtension", (gl_function) glXQueryExtension },
{ "glXQueryVersion", (gl_function) glXQueryVersion },
{ "glXSwapBuffers", (gl_function) glXSwapBuffers },
{ "glXUseXFont", (gl_function) glXUseXFont },
{ "glXWaitGL", (gl_function) glXWaitGL },
{ "glXWaitX", (gl_function) glXWaitX },
/* GLX 1.1 functions */
{ "glXGetClientString", (gl_function) glXGetClientString },
{ "glXQueryExtensionsString", (gl_function) glXQueryExtensionsString },
{ "glXQueryServerString", (gl_function) glXQueryServerString },
/* Extensions */
{ "glXGetProcAddressARB", (gl_function) glXGetProcAddressARB },
{ "glXCreateGLXPixmapMESA", (gl_function) glXCreateGLXPixmapMESA },
{ "glXReleaseBuffersMESA", (gl_function) glXReleaseBuffersMESA },
{ "glXCopySubBufferMESA", (gl_function) glXCopySubBufferMESA },
{ "glXSet3DfxModeMESA", (gl_function) glXSet3DfxModeMESA },
{ "glXGetVideoSyncSGI", (gl_function) glXGetVideoSyncSGI },
{ "glXWaitVideoSyncSGI", (gl_function) glXWaitVideoSyncSGI },
{ NULL, NULL } /* end of list token */
};
GLuint i;
/* First, look for core library functions */
gl_function f = (gl_function) gl_get_proc_address(procName);
if (f)
return f;
/* Second, look for GLX funtion */
for (i = 0; procTable[i].address; i++) {
if (strcmp((const char *) procName, procTable[i].name) == 0)
return (GLfunction) procTable[i].address;
return procTable[i].address;
}
return NULL;
}

View File

@@ -1,4 +1,4 @@
/* $Id: glxapi.c,v 1.3 1999/09/16 15:54:21 brianp Exp $ */
/* $Id: glxapi.c,v 1.4.2.1 1999/12/10 13:45:39 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -419,8 +419,7 @@ GLboolean glXSet3DfxModeMESA( GLint mode )
#ifdef GLX_EXT_get_proc_address
void (*glXGetProcAddressEXT( const GLubyte *procName ))()
void (*glXGetProcAddressARB( const GLubyte *procName ))()
{
#ifdef REALGLX
return NULL;
@@ -428,4 +427,4 @@ void (*glXGetProcAddressEXT( const GLubyte *procName ))()
return Fake_glXGetProcAddress( procName );
#endif
}
#endif

View File

@@ -0,0 +1,71 @@
/* $Id: glxheader.h,v 1.1 1999/11/11 01:29:28 brianp Exp $ */
/*
* Mesa 3-D graphics library
* Version: 3.3
*
* 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.
*/
#ifndef GLX_HEADER_H
#define GLX_HEADER_H
#ifdef HAVE_CONFIG_H
#include "conf.h"
#endif
#include "glheader.h"
#ifdef XFree86Server
# include "resource.h"
# include "windowstr.h"
# include "gcstruct.h"
# include "GL/xf86glx.h"
# include "xf86glx_util.h"
#else
# ifdef GLX_DIRECT_RENDERING
# include "dri_mesaint.h"
# endif
# include <X11/Xlib.h>
# include <X11/Xutil.h>
# ifdef USE_XSHM /* was SHM */
# include <sys/ipc.h>
# include <sys/shm.h>
# include <X11/extensions/XShm.h>
# endif
#endif
/* this silences a compiler warning on several systems */
struct timespec;
struct itimerspec;
#endif /*GLX_HEADER*/

View File

@@ -1,4 +1,4 @@
/* $Id: xfonts.c,v 1.1 1999/08/19 00:55:42 jtg Exp $ */
/* $Id: xfonts.c,v 1.2.2.1 1999/12/12 17:03:07 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -257,7 +257,7 @@ void Fake_glXUseXFont( Font font, int first, int count, int listbase )
max_bm_width = (max_width + 7) / 8;
max_bm_height = max_height;
bm = (GLubyte *) malloc ((max_bm_width * max_bm_height) * sizeof
bm = (GLubyte *) MALLOC((max_bm_width * max_bm_height) * sizeof
(GLubyte));
if (!bm) {
XFreeFontInfo( NULL, fs, 0 );
@@ -338,7 +338,8 @@ void Fake_glXUseXFont( Font font, int first, int count, int listbase )
width = ch->rbearing - ch->lbearing;
height = ch->ascent + ch->descent;
x0 = - ch->lbearing;
y0 = ch->descent - 1;
y0 = ch->descent - 0; /* XXX used to subtract 1 here */
/* but that caused a conformace failure */
dx = ch->width;
dy = 0;

View File

@@ -1,4 +1,4 @@
/* $Id: xmesaP.h,v 1.1 1999/08/19 00:55:42 jtg Exp $ */
/* $Id: xmesaP.h,v 1.2 1999/10/08 09:27:12 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -23,6 +23,9 @@
* 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/X/xmesaP.h,v 1.5 1999/07/06 14:51:28 dawes Exp $ */
#ifndef XMESAP_H
@@ -30,20 +33,33 @@
#ifdef XFree86Server
#include "xf86glx_util.h"
# include "GL/xf86glx.h"
# include "xf86glx_util.h"
#else
#ifdef SHM
#include <X11/extensions/XShm.h>
#endif
# ifdef GLX_DIRECT_RENDERING
# include "dri_mesa.h"
# endif
# ifdef SHM
# include <X11/extensions/XShm.h>
# endif
#endif
#include "GL/xmesa.h"
#include "types.h"
#ifdef FX
#if defined(FX) && !defined(GLX_DIRECT_RENDERING)
#include "GL/fxmesa.h"
#include "../FX/fxdrv.h"
#endif
#if defined(GLX_DIRECT_RENDERING) && !defined(XFree86Server)
# include "xdriP.h"
#else
# define DRI_DRAWABLE_ARG
# define DRI_DRAWABLE_PARM
# define DRI_CTX_ARG
#endif
/* for PF_8R8G8B24 pixel format */
typedef struct {
GLubyte b;
@@ -52,13 +68,17 @@ typedef struct {
} bgr_t;
/*
* "Derived" from gl_visual. Basically corresponds to an XVisualInfo.
*/
struct xmesa_visual {
GLvisual *gl_visual; /* Device independent visual parameters */
XMesaDisplay *display; /* The X11 display */
#ifndef XFree86Server
#ifdef XFree86Server
GLint screen_depth; /* The depth of the screen */
#else
XVisualInfo *vishandle; /* The pointer returned by glXChooseVisual */
#endif
XMesaVisualInfo visinfo; /* X's visual info */
@@ -119,6 +139,13 @@ struct xmesa_context {
GLubyte clearcolor[4]; /* current clearing color */
unsigned long clearpixel; /* current clearing pixel value */
#if defined(GLX_DIRECT_RENDERING) && !defined(XFree86Server)
__DRIcontextPrivate *driContextPriv; /* back pointer to DRI context
* used for locking
*/
void *private; /* device-specific private context */
#endif
};
@@ -194,7 +221,14 @@ struct xmesa_buffer {
int num_alloced;
unsigned long alloced_colors[256];
#ifdef FX
#if defined(GLX_DIRECT_RENDERING) && !defined(XFree86Server)
__DRIdrawablePrivate *driDrawPriv; /* back pointer to DRI drawable
* used for direct access to framebuffer
*/
void *private; /* device-specific private drawable */
#endif
#if defined( FX ) && !defined(GLX_DIRECT_RENDERING)
/* For 3Dfx Glide only */
GLboolean FXisHackUsable; /* Can we render into window? */
GLboolean FXwindowHack; /* Are we rendering into a window? */
@@ -278,6 +312,7 @@ struct xmesa_buffer {
/*
* If pixelformat==PF_DITHER:
*
@@ -287,6 +322,7 @@ struct xmesa_buffer {
#undef _R
#undef _G
#undef _B
#undef _D
#ifdef DITHER666
# define _R 6
# define _G 6
@@ -484,8 +520,9 @@ extern triangle_func xmesa_get_triangle_func( GLcontext *ctx );
/* XXX this is a hack to implement shared display lists with 3Dfx */
extern XMesaBuffer XMesaCreateWindowBuffer2( XMesaVisual v,
XMesaWindow w,
XMesaContext c );
XMesaContext c
DRI_DRAWABLE_ARG
);
/*
* These are the extra routines required for integration with XFree86.

3505
src/mesa/glapi/glapi.c Normal file

File diff suppressed because it is too large Load Diff

591
src/mesa/glapi/glapi.h Normal file
View File

@@ -0,0 +1,591 @@
/* $Id: glapi.h,v 1.1 1999/11/11 01:22:26 brianp Exp $ */
/*
* Mesa 3-D graphics library
* Version: 3.3
*
* 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 file is not specific to Mesa. It defines a dispatch table
* which could be used by any number of OpenGL implementations.
* It's designed to be gl.h-independent as well. That is, it does
* not depend on any particular extensions being defined in the gl.h
* header. We #define extension symbols (like _GLAPI_EXT_blend_color)
* to determine which entry points to compile. Clients of this dispatcher
* (like Mesa) can #ifdef test these symbols to know how to fill in the
* table.
*/
#ifndef _GLAPI_H
#define _GLAPI_H
#include "GL/gl.h"
/* Which OpenGL API revisisions are supported by the table: */
#define _GLAPI_VERSION_1_1 1
#define _GLAPI_VERSION_1_2 1
/* And which extensions: */
#define _GLAPI_ARB_imaging 1
#define _GLAPI_ARB_multitexture 1
#define _GLAPI_EXT_color_table 1
#define _GLAPI_EXT_compiled_vertex_array 1
#define _GLAPI_EXT_point_parameters 1
#define _GLAPI_EXT_polygon_offset 1
#define _GLAPI_EXT_blend_minmax 1
#define _GLAPI_EXT_blend_color 1
#define _GLAPI_EXT_texture3D 1
#define _GLAPI_EXT_texture_object 1
#define _GLAPI_EXT_vertex_array 1
#define _GLAPI_INGR_blend_func_separate 1
#define _GLAPI_MESA_window_pos 1
#define _GLAPI_MESA_resize_buffers 1
/*
* This struct contains pointers for all the GL API entrypoints
* plus some reserved slots for dynamic extensions.
*
*/
struct _glapi_table
{
/*
* OpenGL 1.0
*/
void (*Accum)(GLenum, GLfloat);
void (*AlphaFunc)(GLenum, GLclampf);
void (*Begin)(GLenum);
void (*Bitmap)(GLsizei, GLsizei, GLfloat, GLfloat, GLfloat, GLfloat, const GLubyte *);
void (*BlendFunc)(GLenum, GLenum);
void (*CallList)(GLuint list);
void (*CallLists)(GLsizei, GLenum, const GLvoid *);
void (*Clear)(GLbitfield);
void (*ClearAccum)(GLfloat, GLfloat, GLfloat, GLfloat);
void (*ClearColor)(GLclampf, GLclampf, GLclampf, GLclampf);
void (*ClearDepth)(GLclampd);
void (*ClearIndex)(GLfloat);
void (*ClearStencil)(GLint);
void (*ClipPlane)(GLenum, const GLdouble *);
void (*Color3b)(GLbyte, GLbyte, GLbyte);
void (*Color3bv)(const GLbyte *);
void (*Color3d)(GLdouble, GLdouble, GLdouble);
void (*Color3dv)(const GLdouble *);
void (*Color3f)(GLfloat, GLfloat, GLfloat);
void (*Color3fv)(const GLfloat *);
void (*Color3i)(GLint, GLint, GLint);
void (*Color3iv)(const GLint *);
void (*Color3s)(GLshort, GLshort, GLshort);
void (*Color3sv)(const GLshort *);
void (*Color3ub)(GLubyte, GLubyte, GLubyte);
void (*Color3ubv)(const GLubyte *);
void (*Color3ui)(GLuint, GLuint, GLuint);
void (*Color3uiv)(const GLuint *);
void (*Color3us)(GLushort, GLushort, GLushort);
void (*Color3usv)(const GLushort *);
void (*Color4b)(GLbyte, GLbyte, GLbyte, GLbyte);
void (*Color4bv)(const GLbyte *);
void (*Color4d)(GLdouble, GLdouble, GLdouble, GLdouble);
void (*Color4dv)(const GLdouble *);
void (*Color4f)(GLfloat, GLfloat, GLfloat, GLfloat);
void (*Color4fv)(const GLfloat *);
void (*Color4i)(GLint, GLint, GLint, GLint);
void (*Color4iv)(const GLint *);
void (*Color4s)(GLshort, GLshort, GLshort, GLshort);
void (*Color4sv)(const GLshort *);
void (*Color4ub)(GLubyte, GLubyte, GLubyte, GLubyte);
void (*Color4ubv)(const GLubyte *);
void (*Color4ui)(GLuint, GLuint, GLuint, GLuint);
void (*Color4uiv)(const GLuint *);
void (*Color4us)(GLushort, GLushort, GLushort, GLushort);
void (*Color4usv)(const GLushort *);
void (*ColorMask)(GLboolean, GLboolean, GLboolean, GLboolean);
void (*ColorMaterial)(GLenum, GLenum);
void (*CopyPixels)(GLint, GLint, GLsizei, GLsizei, GLenum);
void (*CullFace)(GLenum);
void (*DeleteLists)(GLuint, GLsizei);
void (*DepthFunc)(GLenum);
void (*DepthMask)(GLboolean);
void (*DepthRange)(GLclampd, GLclampd);
void (*Disable)(GLenum);
void (*DrawBuffer)(GLenum);
void (*DrawPixels)(GLsizei, GLsizei, GLenum, GLenum, const GLvoid *);
void (*EdgeFlag)(GLboolean);
void (*EdgeFlagv)(const GLboolean *);
void (*Enable)(GLenum);
void (*End)(void);
void (*EndList)(void);
void (*EvalCoord1d)(GLdouble);
void (*EvalCoord1dv)(const GLdouble *);
void (*EvalCoord1f)(GLfloat);
void (*EvalCoord1fv)(const GLfloat *);
void (*EvalCoord2d)(GLdouble u, GLdouble);
void (*EvalCoord2dv)(const GLdouble *);
void (*EvalCoord2f)(GLfloat u, GLfloat);
void (*EvalCoord2fv)(const GLfloat *);
void (*EvalMesh1)(GLenum, GLint, GLint);
void (*EvalMesh2)(GLenum, GLint, GLint, GLint, GLint);
void (*EvalPoint1)(GLint);
void (*EvalPoint2)(GLint, GLint);
void (*FeedbackBuffer)(GLsizei, GLenum, GLfloat *);
void (*Finish)(void);
void (*Flush)(void);
void (*Fogf)(GLenum, GLfloat);
void (*Fogfv)(GLenum, const GLfloat *);
void (*Fogi)(GLenum, GLint);
void (*Fogiv)(GLenum, const GLint *);
void (*FrontFace)(GLenum);
void (*Frustum)(GLdouble, GLdouble, GLdouble, GLdouble, GLdouble, GLdouble);
GLuint (*GenLists)(GLsizei);
void (*GetBooleanv)(GLenum, GLboolean *);
void (*GetClipPlane)(GLenum, GLdouble *);
void (*GetDoublev)(GLenum, GLdouble *);
GLenum (*GetError)(void);
void (*GetFloatv)(GLenum, GLfloat *);
void (*GetIntegerv)(GLenum, GLint *);
void (*GetLightfv)(GLenum light, GLenum, GLfloat *);
void (*GetLightiv)(GLenum light, GLenum, GLint *);
void (*GetMapdv)(GLenum, GLenum, GLdouble *);
void (*GetMapfv)(GLenum, GLenum, GLfloat *);
void (*GetMapiv)(GLenum, GLenum, GLint *);
void (*GetMaterialfv)(GLenum, GLenum, GLfloat *);
void (*GetMaterialiv)(GLenum, GLenum, GLint *);
void (*GetPixelMapfv)(GLenum, GLfloat *);
void (*GetPixelMapuiv)(GLenum, GLuint *);
void (*GetPixelMapusv)(GLenum, GLushort *);
void (*GetPolygonStipple)(GLubyte *);
const GLubyte* (*GetString)(GLenum name);
void (*GetTexEnvfv)(GLenum, GLenum, GLfloat *);
void (*GetTexEnviv)(GLenum, GLenum, GLint *);
void (*GetTexGendv)(GLenum coord, GLenum, GLdouble *);
void (*GetTexGenfv)(GLenum coord, GLenum, GLfloat *);
void (*GetTexGeniv)(GLenum coord, GLenum, GLint *);
void (*GetTexImage)(GLenum, GLint level, GLenum, GLenum, GLvoid *);
void (*GetTexLevelParameterfv)(GLenum, GLint, GLenum, GLfloat *);
void (*GetTexLevelParameteriv)(GLenum, GLint, GLenum, GLint *);
void (*GetTexParameterfv)(GLenum, GLenum, GLfloat *);
void (*GetTexParameteriv)(GLenum, GLenum, GLint *);
void (*Hint)(GLenum, GLenum);
void (*IndexMask)(GLuint);
void (*Indexd)(GLdouble);
void (*Indexdv)(const GLdouble *);
void (*Indexf)(GLfloat);
void (*Indexfv)(const GLfloat *);
void (*Indexi)(GLint);
void (*Indexiv)(const GLint *);
void (*Indexs)(GLshort);
void (*Indexsv)(const GLshort *);
void (*InitNames)(void);
GLboolean (*IsEnabled)(GLenum);
GLboolean (*IsList)(GLuint);
void (*LightModelf)(GLenum, GLfloat);
void (*LightModelfv)(GLenum, const GLfloat *);
void (*LightModeli)(GLenum, GLint);
void (*LightModeliv)(GLenum, const GLint *);
void (*Lightf)(GLenum light, GLenum, GLfloat);
void (*Lightfv)(GLenum light, GLenum, const GLfloat *);
void (*Lighti)(GLenum light, GLenum, GLint);
void (*Lightiv)(GLenum light, GLenum, const GLint *);
void (*LineStipple)(GLint factor, GLushort);
void (*LineWidth)(GLfloat);
void (*ListBase)(GLuint);
void (*LoadIdentity)(void);
void (*LoadMatrixd)(const GLdouble *);
void (*LoadMatrixf)(const GLfloat *);
void (*LoadName)(GLuint);
void (*LogicOp)(GLenum);
void (*Map1d)(GLenum, GLdouble, GLdouble, GLint, GLint, const GLdouble *);
void (*Map1f)(GLenum, GLfloat, GLfloat, GLint, GLint, const GLfloat *);
void (*Map2d)(GLenum, GLdouble, GLdouble, GLint, GLint, GLdouble, GLdouble, GLint, GLint, const GLdouble *);
void (*Map2f)(GLenum, GLfloat, GLfloat, GLint, GLint, GLfloat, GLfloat, GLint, GLint, const GLfloat *);
void (*MapGrid1d)(GLint, GLdouble, GLdouble);
void (*MapGrid1f)(GLint, GLfloat, GLfloat);
void (*MapGrid2d)(GLint, GLdouble, GLdouble, GLint, GLdouble, GLdouble);
void (*MapGrid2f)(GLint, GLfloat, GLfloat, GLint, GLfloat, GLfloat);
void (*Materialf)(GLenum, GLenum, GLfloat);
void (*Materialfv)(GLenum, GLenum, const GLfloat *);
void (*Materiali)(GLenum, GLenum, GLint);
void (*Materialiv)(GLenum, GLenum, const GLint *);
void (*MatrixMode)(GLenum);
void (*MultMatrixd)(const GLdouble *);
void (*MultMatrixf)(const GLfloat *);
void (*NewList)(GLuint list, GLenum);
void (*Normal3b)(GLbyte, GLbyte, GLbyte);
void (*Normal3bv)(const GLbyte *);
void (*Normal3d)(GLdouble, GLdouble, GLdouble);
void (*Normal3dv)(const GLdouble *);
void (*Normal3f)(GLfloat, GLfloat, GLfloat);
void (*Normal3fv)(const GLfloat *);
void (*Normal3i)(GLint, GLint, GLint);
void (*Normal3iv)(const GLint *);
void (*Normal3s)(GLshort, GLshort, GLshort);
void (*Normal3sv)(const GLshort *);
void (*Ortho)(GLdouble, GLdouble, GLdouble, GLdouble, GLdouble, GLdouble);
void (*PassThrough)(GLfloat);
void (*PixelMapfv)(GLenum, GLint, const GLfloat *);
void (*PixelMapuiv)(GLenum, GLint, const GLuint *);
void (*PixelMapusv)(GLenum, GLint, const GLushort *);
void (*PixelStoref)(GLenum, GLfloat);
void (*PixelStorei)(GLenum, GLint);
void (*PixelTransferf)(GLenum, GLfloat);
void (*PixelTransferi)(GLenum, GLint);
void (*PixelZoom)(GLfloat, GLfloat);
void (*PointSize)(GLfloat);
void (*PolygonMode)(GLenum, GLenum);
void (*PolygonOffset)(GLfloat, GLfloat);
void (*PolygonStipple)(const GLubyte *);
void (*PopAttrib)(void);
void (*PopMatrix)(void);
void (*PopName)(void);
void (*PushAttrib)(GLbitfield);
void (*PushMatrix)(void);
void (*PushName)(GLuint);
void (*RasterPos2d)(GLdouble, GLdouble);
void (*RasterPos2dv)(const GLdouble *);
void (*RasterPos2f)(GLfloat, GLfloat);
void (*RasterPos2fv)(const GLfloat *);
void (*RasterPos2i)(GLint, GLint);
void (*RasterPos2iv)(const GLint *);
void (*RasterPos2s)(GLshort, GLshort);
void (*RasterPos2sv)(const GLshort *);
void (*RasterPos3d)(GLdouble, GLdouble, GLdouble);
void (*RasterPos3dv)(const GLdouble *);
void (*RasterPos3f)(GLfloat, GLfloat, GLfloat);
void (*RasterPos3fv)(const GLfloat *);
void (*RasterPos3i)(GLint, GLint, GLint);
void (*RasterPos3iv)(const GLint *);
void (*RasterPos3s)(GLshort, GLshort, GLshort);
void (*RasterPos3sv)(const GLshort *);
void (*RasterPos4d)(GLdouble, GLdouble, GLdouble, GLdouble);
void (*RasterPos4dv)(const GLdouble *);
void (*RasterPos4f)(GLfloat, GLfloat, GLfloat, GLfloat);
void (*RasterPos4fv)(const GLfloat *);
void (*RasterPos4i)(GLint, GLint, GLint, GLint);
void (*RasterPos4iv)(const GLint *);
void (*RasterPos4s)(GLshort, GLshort, GLshort, GLshort);
void (*RasterPos4sv)(const GLshort *);
void (*ReadBuffer)(GLenum);
void (*ReadPixels)(GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, GLvoid *);
void (*Rectd)(GLdouble, GLdouble, GLdouble, GLdouble);
void (*Rectdv)(const GLdouble *, const GLdouble *);
void (*Rectf)(GLfloat, GLfloat, GLfloat, GLfloat);
void (*Rectfv)(const GLfloat *, const GLfloat *);
void (*Recti)(GLint, GLint, GLint, GLint);
void (*Rectiv)(const GLint *, const GLint *);
void (*Rects)(GLshort, GLshort, GLshort, GLshort);
void (*Rectsv)(const GLshort *, const GLshort *);
GLint (*RenderMode)(GLenum);
void (*Rotated)(GLdouble, GLdouble, GLdouble, GLdouble);
void (*Rotatef)(GLfloat, GLfloat, GLfloat, GLfloat);
void (*Scaled)(GLdouble, GLdouble, GLdouble);
void (*Scalef)(GLfloat, GLfloat, GLfloat);
void (*Scissor)(GLint, GLint, GLsizei, GLsizei);
void (*SelectBuffer)(GLsizei, GLuint *);
void (*ShadeModel)(GLenum);
void (*StencilFunc)(GLenum, GLint, GLuint);
void (*StencilMask)(GLuint);
void (*StencilOp)(GLenum, GLenum, GLenum);
void (*TexCoord1d)(GLdouble);
void (*TexCoord1dv)(const GLdouble *);
void (*TexCoord1f)(GLfloat);
void (*TexCoord1fv)(const GLfloat *);
void (*TexCoord1i)(GLint);
void (*TexCoord1iv)(const GLint *);
void (*TexCoord1s)(GLshort);
void (*TexCoord1sv)(const GLshort *);
void (*TexCoord2d)(GLdouble, GLdouble);
void (*TexCoord2dv)(const GLdouble *);
void (*TexCoord2f)(GLfloat, GLfloat);
void (*TexCoord2fv)(const GLfloat *);
void (*TexCoord2i)(GLint, GLint);
void (*TexCoord2iv)(const GLint *);
void (*TexCoord2s)(GLshort, GLshort);
void (*TexCoord2sv)(const GLshort *);
void (*TexCoord3d)(GLdouble, GLdouble, GLdouble);
void (*TexCoord3dv)(const GLdouble *);
void (*TexCoord3f)(GLfloat, GLfloat, GLfloat);
void (*TexCoord3fv)(const GLfloat *);
void (*TexCoord3i)(GLint, GLint, GLint);
void (*TexCoord3iv)(const GLint *);
void (*TexCoord3s)(GLshort, GLshort, GLshort);
void (*TexCoord3sv)(const GLshort *);
void (*TexCoord4d)(GLdouble, GLdouble, GLdouble, GLdouble);
void (*TexCoord4dv)(const GLdouble *);
void (*TexCoord4f)(GLfloat, GLfloat, GLfloat, GLfloat);
void (*TexCoord4fv)(const GLfloat *);
void (*TexCoord4i)(GLint, GLint, GLint, GLint);
void (*TexCoord4iv)(const GLint *);
void (*TexCoord4s)(GLshort, GLshort, GLshort, GLshort);
void (*TexCoord4sv)(const GLshort *);
void (*TexEnvf)(GLenum, GLenum, GLfloat);
void (*TexEnvfv)(GLenum, GLenum, const GLfloat *);
void (*TexEnvi)(GLenum, GLenum, GLint);
void (*TexEnviv)(GLenum, GLenum, const GLint *);
void (*TexGend)(GLenum, GLenum, GLdouble);
void (*TexGendv)(GLenum, GLenum, const GLdouble *);
void (*TexGenf)(GLenum, GLenum, GLfloat);
void (*TexGenfv)(GLenum, GLenum, const GLfloat *);
void (*TexGeni)(GLenum, GLenum, GLint);
void (*TexGeniv)(GLenum, GLenum, const GLint *);
void (*TexImage1D)(GLenum, GLint, GLint, GLsizei, GLint, GLenum, GLenum, const GLvoid *);
void (*TexImage2D)(GLenum, GLint, GLint, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid *);
void (*TexParameterf)(GLenum, GLenum, GLfloat);
void (*TexParameterfv)(GLenum, GLenum, const GLfloat *);
void (*TexParameteri)(GLenum, GLenum, GLint);
void (*TexParameteriv)(GLenum, GLenum, const GLint *);
void (*Translated)(GLdouble, GLdouble, GLdouble);
void (*Translatef)(GLfloat, GLfloat, GLfloat);
void (*Vertex2d)(GLdouble, GLdouble);
void (*Vertex2dv)(const GLdouble *);
void (*Vertex2f)(GLfloat, GLfloat);
void (*Vertex2fv)(const GLfloat *);
void (*Vertex2i)(GLint, GLint);
void (*Vertex2iv)(const GLint *);
void (*Vertex2s)(GLshort, GLshort);
void (*Vertex2sv)(const GLshort *);
void (*Vertex3d)(GLdouble, GLdouble, GLdouble);
void (*Vertex3dv)(const GLdouble *);
void (*Vertex3f)(GLfloat, GLfloat, GLfloat);
void (*Vertex3fv)(const GLfloat *);
void (*Vertex3i)(GLint, GLint, GLint);
void (*Vertex3iv)(const GLint *);
void (*Vertex3s)(GLshort, GLshort, GLshort);
void (*Vertex3sv)(const GLshort *);
void (*Vertex4d)(GLdouble, GLdouble, GLdouble, GLdouble);
void (*Vertex4dv)(const GLdouble *);
void (*Vertex4f)(GLfloat, GLfloat, GLfloat, GLfloat);
void (*Vertex4fv)(const GLfloat *);
void (*Vertex4i)(GLint, GLint, GLint, GLint);
void (*Vertex4iv)(const GLint *);
void (*Vertex4s)(GLshort, GLshort, GLshort, GLshort);
void (*Vertex4sv)(const GLshort *);
void (*Viewport)(GLint, GLint, GLsizei, GLsizei);
/*
* OpenGL 1.1
*/
#ifdef _GLAPI_VERSION_1_1
GLboolean (*AreTexturesResident)(GLsizei, const GLuint *, GLboolean *);
void (*ArrayElement)(GLint);
void (*BindTexture)(GLenum, GLuint);
void (*ColorPointer)(GLint, GLenum, GLsizei, const GLvoid *);
void (*CopyTexImage1D)(GLenum, GLint, GLenum, GLint, GLint, GLsizei, GLint);
void (*CopyTexImage2D)(GLenum, GLint, GLenum, GLint, GLint, GLsizei, GLsizei, GLint);
void (*CopyTexSubImage1D)(GLenum, GLint, GLint, GLint, GLint, GLsizei);
void (*CopyTexSubImage2D)(GLenum, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei);
void (*DeleteTextures)(GLsizei, const GLuint *);
void (*DisableClientState)(GLenum);
void (*DrawArrays)(GLenum, GLint, GLsizei);
void (*DrawElements)(GLenum, GLsizei, GLenum, const GLvoid *);
void (*EdgeFlagPointer)(GLsizei, const GLvoid *);
void (*EnableClientState)(GLenum);
void (*GenTextures)(GLsizei, GLuint *);
void (*GetPointerv)(GLenum, GLvoid **);
void (*IndexPointer)(GLenum, GLsizei, const GLvoid *);
void (*Indexub)(GLubyte);
void (*Indexubv)(const GLubyte *);
void (*InterleavedArrays)(GLenum, GLsizei, const GLvoid *);
GLboolean (*IsTexture)(GLuint);
void (*NormalPointer)(GLenum, GLsizei, const GLvoid *);
void (*PopClientAttrib)(void);
void (*PrioritizeTextures)(GLsizei, const GLuint *, const GLclampf *);
void (*PushClientAttrib)(GLbitfield);
void (*TexCoordPointer)(GLint, GLenum, GLsizei, const GLvoid *);
void (*TexSubImage1D)(GLenum, GLint, GLint, GLsizei, GLenum, GLenum, const GLvoid *);
void (*TexSubImage2D)(GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *);
void (*VertexPointer)(GLint, GLenum, GLsizei, const GLvoid *);
#endif
/*
* OpenGL 1.2
*/
#ifdef _GLAPI_VERSION_1_2
void (*CopyTexSubImage3D)(GLenum, GLint, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei);
void (*DrawRangeElements)(GLenum, GLuint, GLuint, GLsizei, GLenum, const GLvoid *);
void (*TexImage3D)(GLenum, GLint, GLint, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid *);
void (*TexSubImage3D)(GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *);
#ifdef _GLAPI_ARB_imaging
void (*BlendColor)(GLclampf, GLclampf, GLclampf, GLclampf);
void (*BlendEquation)(GLenum);
void (*ColorSubTable)(GLenum, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *);
void (*ColorTable)(GLenum, GLenum, GLsizei, GLenum, GLenum, const GLvoid *);
void (*ColorTableParameterfv)(GLenum, GLenum, const GLfloat *);
void (*ColorTableParameteriv)(GLenum, GLenum, const GLint *);
void (*ConvolutionFilter1D)(GLenum, GLenum, GLsizei, GLenum, GLenum, const GLvoid *);
void (*ConvolutionFilter2D)(GLenum, GLenum, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *);
void (*ConvolutionParameterf)(GLenum, GLenum, GLfloat);
void (*ConvolutionParameterfv)(GLenum, GLenum, const GLfloat *);
void (*ConvolutionParameteri)(GLenum, GLenum, GLint);
void (*ConvolutionParameteriv)(GLenum, GLenum, const GLint *);
void (*CopyColorSubTable)(GLenum, GLsizei, GLint, GLint, GLsizei);
void (*CopyColorTable)(GLenum, GLenum, GLint, GLint, GLsizei);
void (*CopyConvolutionFilter1D)(GLenum, GLenum, GLint x, GLint y, GLsizei);
void (*CopyConvolutionFilter2D)(GLenum, GLenum, GLint x, GLint y, GLsizei, GLsizei);
void (*GetColorTable)(GLenum, GLenum, GLenum, GLvoid *);
void (*GetColorTableParameterfv)(GLenum, GLenum, GLfloat *);
void (*GetColorTableParameteriv)(GLenum, GLenum, GLint *);
void (*GetConvolutionFilter)(GLenum, GLenum, GLenum, GLvoid *);
void (*GetConvolutionParameterfv)(GLenum, GLenum, GLfloat *);
void (*GetConvolutionParameteriv)(GLenum, GLenum, GLint *);
void (*GetHistogram)(GLenum, GLboolean, GLenum, GLenum, GLvoid *);
void (*GetHistogramParameterfv)(GLenum, GLenum, GLfloat *);
void (*GetHistogramParameteriv)(GLenum, GLenum, GLint *);
void (*GetMinmax)(GLenum, GLboolean, GLenum, GLenum, GLvoid *);
void (*GetMinmaxParameterfv)(GLenum, GLenum, GLfloat *);
void (*GetMinmaxParameteriv)(GLenum, GLenum, GLint *);
void (*GetSeparableFilter)(GLenum, GLenum, GLenum, GLvoid *, GLvoid *, GLvoid *);
void (*Histogram)(GLenum, GLsizei, GLenum, GLboolean);
void (*Minmax)(GLenum, GLenum, GLboolean);
void (*ResetHistogram)(GLenum);
void (*ResetMinmax)(GLenum);
void (*SeparableFilter2D)(GLenum, GLenum, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *, const GLvoid *);
#endif /*_GLAPI_ARB_imaging*/
#endif /*_GLAPI_VERSION_1_2*/
/*
* Extensions
*/
#ifdef _GLAPI_EXT_color_table
void (*ColorTableEXT)(GLenum, GLenum, GLsizei, GLenum, GLenum, const GLvoid *);
void (*ColorSubTableEXT)(GLenum, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *);
void (*GetColorTableEXT)(GLenum, GLenum, GLenum, GLvoid *);
void (*GetColorTableParameterfvEXT)(GLenum, GLenum, GLfloat *);
void (*GetColorTableParameterivEXT)(GLenum, GLenum, GLint *);
#endif
#ifdef _GLAPI_EXT_compiled_vertex_array
void (*LockArraysEXT)(GLint, GLsizei);
void (*UnlockArraysEXT)(void);
#endif
#ifdef _GLAPI_EXT_point_parameters
void (*PointParameterfEXT)(GLenum, GLfloat);
void (*PointParameterfvEXT)(GLenum, const GLfloat *);
#endif
#ifdef _GLAPI_EXT_polygon_offset
void (*PolygonOffsetEXT)(GLfloat, GLfloat);
#endif
#ifdef _GLAPI_EXT_blend_minmax
void (*BlendEquationEXT)(GLenum);
#endif
#ifdef _GLAPI_EXT_blend_color
void (*BlendColorEXT)(GLclampf, GLclampf, GLclampf, GLclampf);
#endif
#ifdef _GLAPI_ARB_multitexture
void (*ActiveTextureARB)(GLenum);
void (*ClientActiveTextureARB)(GLenum);
void (*MultiTexCoord1dARB)(GLenum, GLdouble);
void (*MultiTexCoord1dvARB)(GLenum, const GLdouble *);
void (*MultiTexCoord1fARB)(GLenum, GLfloat);
void (*MultiTexCoord1fvARB)(GLenum, const GLfloat *);
void (*MultiTexCoord1iARB)(GLenum, GLint);
void (*MultiTexCoord1ivARB)(GLenum, const GLint *);
void (*MultiTexCoord1sARB)(GLenum, GLshort);
void (*MultiTexCoord1svARB)(GLenum, const GLshort *);
void (*MultiTexCoord2dARB)(GLenum, GLdouble, GLdouble);
void (*MultiTexCoord2dvARB)(GLenum, const GLdouble *);
void (*MultiTexCoord2fARB)(GLenum, GLfloat, GLfloat);
void (*MultiTexCoord2fvARB)(GLenum, const GLfloat *);
void (*MultiTexCoord2iARB)(GLenum, GLint, GLint);
void (*MultiTexCoord2ivARB)(GLenum, const GLint *);
void (*MultiTexCoord2sARB)(GLenum, GLshort, GLshort);
void (*MultiTexCoord2svARB)(GLenum, const GLshort *);
void (*MultiTexCoord3dARB)(GLenum, GLdouble, GLdouble, GLdouble);
void (*MultiTexCoord3dvARB)(GLenum, const GLdouble *);
void (*MultiTexCoord3fARB)(GLenum, GLfloat, GLfloat, GLfloat);
void (*MultiTexCoord3fvARB)(GLenum, const GLfloat *);
void (*MultiTexCoord3iARB)(GLenum, GLint, GLint, GLint);
void (*MultiTexCoord3ivARB)(GLenum, const GLint *);
void (*MultiTexCoord3sARB)(GLenum, GLshort, GLshort, GLshort);
void (*MultiTexCoord3svARB)(GLenum, const GLshort *);
void (*MultiTexCoord4dARB)(GLenum, GLdouble, GLdouble, GLdouble, GLdouble);
void (*MultiTexCoord4dvARB)(GLenum, const GLdouble *);
void (*MultiTexCoord4fARB)(GLenum, GLfloat, GLfloat, GLfloat, GLfloat);
void (*MultiTexCoord4fvARB)(GLenum, const GLfloat *);
void (*MultiTexCoord4iARB)(GLenum, GLint, GLint, GLint, GLint);
void (*MultiTexCoord4ivARB)(GLenum, const GLint *);
void (*MultiTexCoord4sARB)(GLenum, GLshort, GLshort, GLshort, GLshort);
void (*MultiTexCoord4svARB)(GLenum, const GLshort *);
#endif
#ifdef _GLAPI_INGR_blend_func_separate
void (*BlendFuncSeparateINGR)(GLenum, GLenum, GLenum, GLenum);
#endif
#ifdef _GLAPI_MESA_window_pos
void (*WindowPos4fMESA)(GLfloat x, GLfloat y, GLfloat z, GLfloat w);
#endif
#ifdef _GLAPI_MESA_resize_buffers
void (*ResizeBuffersMESA)(void);
#endif
};
extern void
_glapi_set_dispatch(struct _glapi_table *dispatch);
extern struct _glapi_table *
_glapi_get_dispatch(void);
extern const char *
_glapi_get_version(void);
extern const char *
_glapi_get_extensions(void);
extern void
_glapi_check_table(const struct _glapi_table *table);
extern GLint
_glapi_alloc_entrypoint(const char *funcName);
extern GLint
_glapi_get_entrypoint(const char *funcName);
extern const GLvoid *
_glapi_get_proc_address(const char *funcName);
#endif

View File

@@ -1,4 +1,4 @@
# $Id: Makefile.DJ,v 1.1 1999/08/19 00:55:41 jtg Exp $
# $Id: Makefile.DJ,v 1.2 1999/10/08 09:27:09 keithw Exp $
# Makefile for core library for MS-DOS using djgpp
@@ -22,8 +22,11 @@
# $Log: Makefile.DJ,v $
# Revision 1.1 1999/08/19 00:55:41 jtg
# Initial revision
# Revision 1.2 1999/10/08 09:27:09 keithw
# Fixed includes & added a few hooks for the DRI.
#
# Revision 1.1.1.1 1999/08/19 00:55:41 jtg
# Imported sources
#
# Revision 1.1 1999/01/01 14:35:09 brianp
# Initial revision
@@ -48,7 +51,7 @@ CORE_SOURCES = accum.c alpha.c alphabuf.c api1.c api2.c apiext.c attrib.c \
bitmap.c blend.c clip.c colortab.c context.c copypix.c depth.c \
dlist.c drawpix.c enable.c eval.c feedback.c fog.c \
get.c hash.c image.c light.c lines.c logic.c masking.c matrix.c \
misc.c mmath.c mthreads.c pb.c pixel.c points.c pointers.c polygon.c \
glmisc.c mmath.c mthreads.c pb.c pixel.c points.c pointers.c polygon.c \
quads.c rastpos.c readpix.c rect.c scissor.c shade.c span.c \
stencil.c teximage.c texobj.c texstate.c texture.c triangle.c \
varray.c winpos.c vb.c vbfill.c vbrender.c vbxform.c xform.c \

View File

@@ -1,4 +1,4 @@
# $Id: Makefile.X11,v 1.5 1999/09/17 12:07:10 brianp Exp $
# $Id: Makefile.X11,v 1.6.2.1 1999/11/16 15:25:50 brianp Exp $
# Mesa 3-D graphics library
# Version: 3.1
@@ -46,6 +46,7 @@ CORE_SOURCES = \
feedback.c \
fog.c \
get.c \
glmisc.c \
hash.c \
image.c \
light.c \
@@ -53,7 +54,6 @@ CORE_SOURCES = \
logic.c \
masking.c \
matrix.c \
misc.c \
mmath.c \
mthreads.c \
pb.c \
@@ -220,7 +220,8 @@ X86/3dnow.o: X86/3dnow.c
# @echo "Specify a target configuration"
clean:
-rm *.o *~ */*.o */*~
-rm *.o *~ */*.o */*~ *.lo *.la
-rm -rf .libs
targets: $(LIBDIR)/$(GL_LIB)

View File

@@ -1,4 +1,4 @@
/* $Id: accum.c,v 1.2 1999/08/19 11:54:28 brianp Exp $ */
/* $Id: accum.c,v 1.10.2.1 1999/11/27 01:35:42 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -25,23 +25,25 @@
*/
/* $XFree86: xc/lib/GL/mesa/src/accum.c,v 1.3 1999/04/04 00:20:17 dawes Exp $ */
#ifdef PC_HEADER
#include "all.h"
#else
#ifndef XFree86Server
#include <assert.h>
#include <limits.h>
#include <stdlib.h>
#include <string.h>
#else
#include "GL/xf86glx.h"
#endif
#include "accum.h"
#include "context.h"
#include "macros.h"
#include "masking.h"
#include "span.h"
#include "types.h"
#ifdef XFree86Server
#include "GL/xf86glx.h"
#endif
#endif
@@ -69,24 +71,31 @@
*/
#define USE_OPTIMIZED_ACCUM /* enable the optimization */
void gl_alloc_accum_buffer( GLcontext *ctx )
{
GLint n;
if (ctx->Buffer->Accum) {
free( ctx->Buffer->Accum );
FREE( ctx->Buffer->Accum );
ctx->Buffer->Accum = NULL;
}
/* allocate accumulation buffer if not already present */
n = ctx->Buffer->Width * ctx->Buffer->Height * 4 * sizeof(GLaccum);
ctx->Buffer->Accum = (GLaccum *) malloc( n );
ctx->Buffer->Accum = (GLaccum *) MALLOC( n );
if (!ctx->Buffer->Accum) {
/* unable to setup accumulation buffer */
gl_error( ctx, GL_OUT_OF_MEMORY, "glAccum" );
}
#ifdef USE_OPTIMIZED_ACCUM
ctx->IntegerAccumMode = GL_TRUE;
#else
ctx->IntegerAccumMode = GL_FALSE;
#endif
ctx->IntegerAccumScaler = 0.0;
}
@@ -113,12 +122,12 @@ void gl_ClearAccum( GLcontext *ctx,
static void rescale_accum( GLcontext *ctx )
{
const GLuint n = ctx->Buffer->Width * ctx->Buffer->Height * 4;
const GLfloat s = ctx->IntegerAccumScaler * (32767.0 / 255.0);
const GLfloat fChanMax = (1 << (sizeof(GLchan) * 8)) - 1;
const GLfloat s = ctx->IntegerAccumScaler * (32767.0 / fChanMax);
GLaccum *accum = ctx->Buffer->Accum;
GLuint i;
assert(ctx->IntegerAccumMode);
assert(sizeof(GLchan) == 1); /* if not true, 255.0 above must be fixed */
assert(accum);
for (i = 0; i < n; i++) {
@@ -135,6 +144,8 @@ void gl_Accum( GLcontext *ctx, GLenum op, GLfloat value )
GLuint xpos, ypos, width, height, width4;
GLfloat acc_scale;
GLubyte rgba[MAX_WIDTH][4];
const GLint iChanMax = (1 << (sizeof(GLchan) * 8)) - 1;
const GLfloat fChanMax = (1 << (sizeof(GLchan) * 8)) - 1;
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glAccum");
@@ -180,7 +191,7 @@ void gl_Accum( GLcontext *ctx, GLenum op, GLfloat value )
{
const GLaccum intVal = (GLaccum) (value * acc_scale);
GLuint j;
/* May have to leave optimized accum buffer mode */
/* Leave optimized accum buffer mode */
if (ctx->IntegerAccumMode)
rescale_accum(ctx);
for (j = 0; j < height; j++) {
@@ -197,7 +208,7 @@ void gl_Accum( GLcontext *ctx, GLenum op, GLfloat value )
case GL_MULT:
{
GLuint j;
/* May have to leave optimized accum buffer mode */
/* Leave optimized accum buffer mode */
if (ctx->IntegerAccumMode)
rescale_accum(ctx);
for (j = 0; j < height; j++) {
@@ -242,10 +253,10 @@ void gl_Accum( GLcontext *ctx, GLenum op, GLfloat value )
}
else {
/* scaled integer accum buffer */
const GLfloat rscale = value * acc_scale / 255.0;
const GLfloat gscale = value * acc_scale / 255.0;
const GLfloat bscale = value * acc_scale / 255.0;
const GLfloat ascale = value * acc_scale / 255.0;
const GLfloat rscale = value * acc_scale / fChanMax;
const GLfloat gscale = value * acc_scale / fChanMax;
const GLfloat bscale = value * acc_scale / fChanMax;
const GLfloat ascale = value * acc_scale / fChanMax;
GLuint j;
for (j=0;j<height;j++) {
GLaccum *acc = ctx->Buffer->Accum + ypos * width4 + xpos * 4;
@@ -268,7 +279,11 @@ void gl_Accum( GLcontext *ctx, GLenum op, GLfloat value )
/* This is a change to go into optimized accum buffer mode */
if (value > 0.0 && value <= 1.0) {
#ifdef USE_OPTIMIZED_ACCUM
ctx->IntegerAccumMode = GL_TRUE;
#else
ctx->IntegerAccumMode = GL_FALSE;
#endif
ctx->IntegerAccumScaler = value;
}
else {
@@ -297,19 +312,20 @@ void gl_Accum( GLcontext *ctx, GLenum op, GLfloat value )
}
else {
/* scaled integer accum buffer */
const GLfloat rscale = value * acc_scale / 255.0;
const GLfloat gscale = value * acc_scale / 255.0;
const GLfloat bscale = value * acc_scale / 255.0;
const GLfloat ascale = value * acc_scale / 255.0;
const GLfloat rscale = value * acc_scale / fChanMax;
const GLfloat gscale = value * acc_scale / fChanMax;
const GLfloat bscale = value * acc_scale / fChanMax;
const GLfloat ascale = value * acc_scale / fChanMax;
const GLfloat d = 3.0 / acc_scale;
GLuint i, j;
for (j = 0; j < height; j++) {
GLaccum *acc = ctx->Buffer->Accum + ypos * width4 + xpos * 4;
gl_read_rgba_span(ctx, width, xpos, ypos, rgba);
for (i=0;i<width;i++) {
*acc++ = (GLaccum) ( (GLfloat) rgba[i][RCOMP] * rscale );
*acc++ = (GLaccum) ( (GLfloat) rgba[i][GCOMP] * gscale );
*acc++ = (GLaccum) ( (GLfloat) rgba[i][BCOMP] * bscale );
*acc++ = (GLaccum) ( (GLfloat) rgba[i][ACOMP] * ascale );
*acc++ = (GLaccum) ((GLfloat) rgba[i][RCOMP] * rscale + d);
*acc++ = (GLaccum) ((GLfloat) rgba[i][GCOMP] * gscale + d);
*acc++ = (GLaccum) ((GLfloat) rgba[i][BCOMP] * bscale + d);
*acc++ = (GLaccum) ((GLfloat) rgba[i][ACOMP] * ascale + d);
}
ypos++;
}
@@ -323,16 +339,17 @@ void gl_Accum( GLcontext *ctx, GLenum op, GLfloat value )
rescale_accum(ctx);
if (ctx->IntegerAccumMode) {
/* build lookup table to avoid integer divides */
GLint divisor = (GLint) ((1.0F / ctx->IntegerAccumScaler) + 0.5F);
static GLubyte divTable[32768];
static GLint prevDivisor = 0.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;
if (divisor != prevDivisor) {
assert(divisor * 256 <= 32768);
for (j = 0; j < divisor * 256; j++)
divTable[j] = j / divisor;
prevDivisor = divisor;
const GLint max = (GLint) (256 / mult);
if (mult != prevMult) {
assert(max <= 32768);
for (j = 0; j < max; j++)
multTable[j] = (GLint) ((GLfloat) j * mult + 0.5F);
prevMult = mult;
}
assert(ctx->IntegerAccumScaler > 0.0);
@@ -341,14 +358,14 @@ void gl_Accum( GLcontext *ctx, GLenum op, GLfloat value )
const GLaccum *acc = ctx->Buffer->Accum + ypos * width4 + xpos*4;
GLuint i, i4;
for (i = i4 = 0; i < width; i++, i4 += 4) {
ASSERT(acc[i4+0] < divisor * 256);
ASSERT(acc[i4+1] < divisor * 256);
ASSERT(acc[i4+2] < divisor * 256);
ASSERT(acc[i4+3] < divisor * 256);
rgba[i][RCOMP] = divTable[acc[i4+0]];
rgba[i][GCOMP] = divTable[acc[i4+1]];
rgba[i][BCOMP] = divTable[acc[i4+2]];
rgba[i][ACOMP] = divTable[acc[i4+3]];
ASSERT(acc[i4+0] < max);
ASSERT(acc[i4+1] < max);
ASSERT(acc[i4+2] < max);
ASSERT(acc[i4+3] < max);
rgba[i][RCOMP] = multTable[acc[i4+0]];
rgba[i][GCOMP] = multTable[acc[i4+1]];
rgba[i][BCOMP] = multTable[acc[i4+2]];
rgba[i][ACOMP] = multTable[acc[i4+3]];
}
if (ctx->Color.SWmasking) {
gl_mask_rgba_span( ctx, width, xpos, ypos, rgba );
@@ -359,10 +376,10 @@ void gl_Accum( GLcontext *ctx, GLenum op, GLfloat value )
}
}
else {
const GLfloat rscale = value / acc_scale * 255.0F;
const GLfloat gscale = value / acc_scale * 255.0F;
const GLfloat bscale = value / acc_scale * 255.0F;
const GLfloat ascale = value / acc_scale * 255.0F;
const GLfloat rscale = value / acc_scale * fChanMax;
const GLfloat gscale = value / acc_scale * fChanMax;
const GLfloat bscale = value / acc_scale * fChanMax;
const GLfloat ascale = value / acc_scale * fChanMax;
GLuint i, j;
for (j=0;j<height;j++) {
const GLaccum *acc = ctx->Buffer->Accum + ypos * width4 + xpos*4;
@@ -372,10 +389,10 @@ void gl_Accum( GLcontext *ctx, GLenum op, GLfloat value )
g = (GLint) ( (GLfloat) (*acc++) * gscale + 0.5F );
b = (GLint) ( (GLfloat) (*acc++) * bscale + 0.5F );
a = (GLint) ( (GLfloat) (*acc++) * ascale + 0.5F );
rgba[i][RCOMP] = CLAMP( r, 0, 255 );
rgba[i][GCOMP] = CLAMP( g, 0, 255 );
rgba[i][BCOMP] = CLAMP( b, 0, 255 );
rgba[i][ACOMP] = CLAMP( a, 0, 255 );
rgba[i][RCOMP] = CLAMP( r, 0, iChanMax );
rgba[i][GCOMP] = CLAMP( g, 0, iChanMax );
rgba[i][BCOMP] = CLAMP( b, 0, iChanMax );
rgba[i][ACOMP] = CLAMP( a, 0, iChanMax );
}
if (ctx->Color.SWmasking) {
gl_mask_rgba_span( ctx, width, xpos, ypos, rgba );
@@ -424,7 +441,7 @@ void gl_clear_accum_buffer( GLcontext *ctx )
if (!ctx->Buffer->Accum) {
/* try to alloc accumulation buffer */
ctx->Buffer->Accum = (GLaccum *)
malloc( buffersize * 4 * sizeof(GLaccum) );
MALLOC( buffersize * 4 * sizeof(GLaccum) );
}
if (ctx->Buffer->Accum) {
@@ -486,7 +503,11 @@ void gl_clear_accum_buffer( GLcontext *ctx )
/* update optimized accum state vars */
if (ctx->Accum.ClearColor[0] == 0.0 && ctx->Accum.ClearColor[1] == 0.0 &&
ctx->Accum.ClearColor[2] == 0.0 && ctx->Accum.ClearColor[3] == 0.0) {
#ifdef USE_OPTIMIZED_ACCUM
ctx->IntegerAccumMode = GL_TRUE;
#else
ctx->IntegerAccumMode = GL_FALSE;
#endif
ctx->IntegerAccumScaler = 0.0; /* denotes empty accum buffer */
}
else {

View File

@@ -1,4 +1,4 @@
/* $Id: accum.h,v 1.1 1999/08/19 00:55:41 jtg Exp $ */
/* $Id: accum.h,v 1.2 1999/11/11 01:22:25 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -38,14 +38,15 @@
extern void gl_alloc_accum_buffer( GLcontext *ctx );
extern void gl_Accum( GLcontext *ctx, GLenum op, GLfloat value );
extern void gl_ClearAccum( GLcontext *ctx, GLfloat red, GLfloat green,
GLfloat blue, GLfloat alpha );
extern void gl_clear_accum_buffer( GLcontext *ctx );
extern void
_mesa_Accum( GLenum op, GLfloat value );
extern void
_mesa_ClearAccum( GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha );
#endif

View File

@@ -1,4 +1,4 @@
/* $Id: attrib.c,v 1.4 1999/09/19 23:43:02 keithw Exp $ */
/* $Id: attrib.c,v 1.10.2.3 1999/12/12 18:30:47 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -26,32 +26,28 @@
#include <stdlib.h>
#ifdef PC_HEADER
#include "all.h"
#else
#include <stdlib.h>
#ifndef XFree86Server
#include <stdio.h>
#include <string.h>
#else
#include "GL/xf86glx.h"
#endif
#include "attrib.h"
#include "context.h"
#include "glmisc.h"
#include "enable.h"
#include "enums.h"
#include "macros.h"
#include "misc.h"
#include "simple_list.h"
#include "texstate.h"
#include "types.h"
#ifdef XFree86Server
#undef MISC_H
#include "GL/xf86glx.h"
#endif
#endif
#define MALLOC_STRUCT(T) (struct T *) malloc( sizeof(struct T) )
/*
@@ -60,9 +56,7 @@
*/
static struct gl_attrib_node *new_attrib_node( GLbitfield kind )
{
struct gl_attrib_node *an;
an = (struct gl_attrib_node *) malloc( sizeof(struct gl_attrib_node) );
struct gl_attrib_node *an = MALLOC_STRUCT(gl_attrib_node);
if (an) {
an->kind = kind;
}
@@ -322,7 +316,7 @@ void gl_PushAttrib( GLcontext* ctx, GLbitfield mask )
if (mask & GL_POLYGON_STIPPLE_BIT) {
GLuint *stipple;
stipple = (GLuint *) malloc( 32*sizeof(GLuint) );
stipple = (GLuint *) MALLOC( 32*sizeof(GLuint) );
MEMCPY( stipple, ctx->PolygonStipple, 32*sizeof(GLuint) );
newnode = new_attrib_node( GL_POLYGON_STIPPLE_BIT );
newnode->data = stipple;
@@ -434,6 +428,7 @@ void gl_PopAttrib( GLcontext* ctx )
GLubyte oldAlphaRef = ctx->Color.AlphaRef;
GLenum oldBlendSrc = ctx->Color.BlendSrcRGB;
GLenum oldBlendDst = ctx->Color.BlendDstRGB;
GLenum oldLogicOp = ctx->Color.LogicOp;
MEMCPY( &ctx->Color, attr->data,
sizeof(struct gl_colorbuffer_attrib) );
if (ctx->Color.DrawBuffer != oldDrawBuffer) {
@@ -449,6 +444,9 @@ void gl_PopAttrib( GLcontext* ctx )
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, ctx->Color.LogicOp );
}
break;
case GL_CURRENT_BIT:
@@ -587,10 +585,10 @@ void gl_PopAttrib( GLcontext* ctx )
break;
case GL_FOG_BIT:
{
GLboolean anyChange = (memcmp( &ctx->Fog, attr->data, sizeof(struct gl_fog_attrib) ) != 0);
GLboolean anyChange = (GLboolean) (memcmp( &ctx->Fog, attr->data, sizeof(struct gl_fog_attrib) ) != 0);
MEMCPY( &ctx->Fog, attr->data, sizeof(struct gl_fog_attrib) );
if (anyChange && ctx->Driver.Fogfv) {
const GLfloat mode = ctx->Fog.Mode;
const GLfloat mode = (GLfloat) ctx->Fog.Mode;
const GLfloat density = ctx->Fog.Density;
const GLfloat start = ctx->Fog.Start;
const GLfloat end = ctx->Fog.End;
@@ -602,7 +600,7 @@ void gl_PopAttrib( GLcontext* ctx )
(*ctx->Driver.Fogfv)( ctx, GL_FOG_INDEX, &index );
(*ctx->Driver.Fogfv)( ctx, GL_FOG_COLOR, ctx->Fog.Color );
}
ctx->Enabled &= ENABLE_FOG;
ctx->Enabled &= ~ENABLE_FOG;
if (ctx->Fog.Enabled) ctx->Enabled |= ENABLE_FOG;
}
break;
@@ -630,7 +628,13 @@ void gl_PopAttrib( GLcontext* ctx )
}
(*ctx->Driver.Enable)( ctx, GL_LIGHTING, ctx->Light.Enabled );
}
ctx->Enabled &= ENABLE_LIGHT;
if (ctx->Light.ShadeModel == GL_FLAT)
ctx->TriangleCaps |= DD_FLATSHADE;
else
ctx->TriangleCaps &= ~DD_FLATSHADE;
if (ctx->Driver.ShadeModel)
(*ctx->Driver.ShadeModel)(ctx, ctx->Light.ShadeModel);
ctx->Enabled &= ~ENABLE_LIGHT;
if (ctx->Light.Enabled && !is_empty_list(&ctx->Light.EnabledList))
ctx->Enabled |= ENABLE_LIGHT;
break;
@@ -758,8 +762,8 @@ void gl_PopAttrib( GLcontext* ctx )
}
next = attr->next;
free( (void *) attr->data );
free( (void *) attr );
FREE( attr->data );
FREE( attr );
attr = next;
}
@@ -855,8 +859,8 @@ void gl_PopClientAttrib( GLcontext *ctx )
}
next = attr->next;
free( (void *) attr->data );
free( (void *) attr );
FREE( attr->data );
FREE( attr );
attr = next;
}

View File

@@ -1,8 +1,8 @@
/* $Id: attrib.h,v 1.1 1999/08/19 00:55:41 jtg Exp $ */
/* $Id: attrib.h,v 1.2 1999/11/11 01:22:25 brianp Exp $ */
/*
* Mesa 3-D graphics library
* Version: 3.1
* Version: 3.3
*
* Copyright (C) 1999 Brian Paul All Rights Reserved.
*
@@ -25,9 +25,6 @@
*/
#ifndef ATTRIB_H
#define ATTRIB_h
@@ -44,4 +41,17 @@ extern void gl_PushClientAttrib( GLcontext *ctx, GLbitfield mask );
extern void gl_PopClientAttrib( GLcontext *ctx );
extern void
_mesa_PushAttrib( GLbitfield mask );
extern void
_mesa_PopAttrib( void );
extern void
_mesa_PushClientAttrib( GLbitfield mask );
extern void
_mesa_PopClientAttrib( void );
#endif

View File

@@ -1,4 +1,4 @@
/* $Id: blend.c,v 1.2 1999/08/19 15:48:01 brianp Exp $ */
/* $Id: blend.c,v 1.8 1999/11/11 01:22:25 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -29,9 +29,7 @@
#ifdef PC_HEADER
#include "all.h"
#else
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include "glheader.h"
#include "alphabuf.h"
#include "blend.h"
#include "context.h"
@@ -40,14 +38,12 @@
#include "pb.h"
#include "span.h"
#include "types.h"
#ifdef XFree86Server
#include "GL/xf86glx.h"
#endif
#endif
void gl_BlendFunc( GLcontext *ctx, GLenum sfactor, GLenum dfactor )
void _mesa_BlendFunc( GLenum sfactor, GLenum dfactor )
{
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glBlendFunc");
if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE))
@@ -107,9 +103,10 @@ void gl_BlendFunc( GLcontext *ctx, GLenum sfactor, GLenum dfactor )
/* GL_INGR_blend_func_separate */
void
gl_BlendFuncSeparate( GLcontext *ctx, GLenum sfactorRGB, GLenum dfactorRGB,
GLenum sfactorA, GLenum dfactorA )
_mesa_BlendFuncSeparateINGR( 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))
@@ -203,13 +200,20 @@ gl_BlendFuncSeparate( GLcontext *ctx, GLenum sfactorRGB, GLenum dfactorRGB,
ctx->Color.BlendFunc = NULL;
ctx->NewState |= NEW_RASTER_OPS;
if (ctx->Driver.BlendFuncSeparate) {
(*ctx->Driver.BlendFuncSeparate)( ctx, sfactorRGB, dfactorRGB,
sfactorA, dfactorA );
}
}
/* This is really an extension function! */
void gl_BlendEquation( GLcontext *ctx, GLenum mode )
void
_mesa_BlendEquationEXT( GLenum mode )
{
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glBlendEquation");
if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE))
@@ -243,17 +247,21 @@ void gl_BlendEquation( GLcontext *ctx, GLenum mode )
ctx->Color.BlendFunc = NULL;
ctx->NewState |= NEW_RASTER_OPS;
if (ctx->Driver.BlendEquation)
ctx->Driver.BlendEquation( ctx, mode );
}
void gl_BlendColor( GLcontext *ctx, GLclampf red, GLclampf green,
GLclampf blue, GLclampf alpha )
void
_mesa_BlendColorEXT( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha )
{
ctx->Color.BlendColor[0] = CLAMP( red, 0.0, 1.0 );
ctx->Color.BlendColor[1] = CLAMP( green, 0.0, 1.0 );
ctx->Color.BlendColor[2] = CLAMP( blue, 0.0, 1.0 );
ctx->Color.BlendColor[3] = CLAMP( alpha, 0.0, 1.0 );
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 );
ctx->Color.BlendColor[3] = CLAMP( alpha, 0.0F, 1.0F );
}
@@ -292,10 +300,10 @@ static void blend_transparency( GLcontext *ctx, GLuint n, const GLubyte mask[],
ASSERT(g <= 255);
ASSERT(b <= 255);
ASSERT(a <= 255);
rgba[i][RCOMP] = r;
rgba[i][GCOMP] = g;
rgba[i][BCOMP] = b;
rgba[i][ACOMP] = a;
rgba[i][RCOMP] = (GLubyte) r;
rgba[i][GCOMP] = (GLubyte) g;
rgba[i][BCOMP] = (GLubyte) b;
rgba[i][ACOMP] = (GLubyte) a;
}
}
}
@@ -321,10 +329,10 @@ static void blend_add( GLcontext *ctx, GLuint n, const GLubyte mask[],
GLint g = rgba[i][GCOMP] + dest[i][GCOMP];
GLint b = rgba[i][BCOMP] + dest[i][BCOMP];
GLint a = rgba[i][ACOMP] + dest[i][ACOMP];
rgba[i][RCOMP] = MIN2( r, 255 );
rgba[i][GCOMP] = MIN2( g, 255 );
rgba[i][BCOMP] = MIN2( b, 255 );
rgba[i][ACOMP] = MIN2( a, 255 );
rgba[i][RCOMP] = (GLubyte) MIN2( r, 255 );
rgba[i][GCOMP] = (GLubyte) MIN2( g, 255 );
rgba[i][BCOMP] = (GLubyte) MIN2( b, 255 );
rgba[i][ACOMP] = (GLubyte) MIN2( a, 255 );
}
}
}
@@ -343,10 +351,10 @@ static void blend_min( GLcontext *ctx, GLuint n, const GLubyte mask[],
for (i=0;i<n;i++) {
if (mask[i]) {
rgba[i][RCOMP] = MIN2( rgba[i][RCOMP], dest[i][RCOMP] );
rgba[i][GCOMP] = MIN2( rgba[i][GCOMP], dest[i][GCOMP] );
rgba[i][BCOMP] = MIN2( rgba[i][BCOMP], dest[i][BCOMP] );
rgba[i][ACOMP] = MIN2( rgba[i][ACOMP], dest[i][ACOMP] );
rgba[i][RCOMP] = (GLubyte) MIN2( rgba[i][RCOMP], dest[i][RCOMP] );
rgba[i][GCOMP] = (GLubyte) MIN2( rgba[i][GCOMP], dest[i][GCOMP] );
rgba[i][BCOMP] = (GLubyte) MIN2( rgba[i][BCOMP], dest[i][BCOMP] );
rgba[i][ACOMP] = (GLubyte) MIN2( rgba[i][ACOMP], dest[i][ACOMP] );
}
}
}
@@ -365,10 +373,10 @@ static void blend_max( GLcontext *ctx, GLuint n, const GLubyte mask[],
for (i=0;i<n;i++) {
if (mask[i]) {
rgba[i][RCOMP] = MAX2( rgba[i][RCOMP], dest[i][RCOMP] );
rgba[i][GCOMP] = MAX2( rgba[i][GCOMP], dest[i][GCOMP] );
rgba[i][BCOMP] = MAX2( rgba[i][BCOMP], dest[i][BCOMP] );
rgba[i][ACOMP] = MAX2( rgba[i][ACOMP], dest[i][ACOMP] );
rgba[i][RCOMP] = (GLubyte) MAX2( rgba[i][RCOMP], dest[i][RCOMP] );
rgba[i][GCOMP] = (GLubyte) MAX2( rgba[i][GCOMP], dest[i][GCOMP] );
rgba[i][BCOMP] = (GLubyte) MAX2( rgba[i][BCOMP], dest[i][BCOMP] );
rgba[i][ACOMP] = (GLubyte) MAX2( rgba[i][ACOMP], dest[i][ACOMP] );
}
}
}
@@ -390,10 +398,10 @@ static void blend_modulate( GLcontext *ctx, GLuint n, const GLubyte mask[],
GLint g = (rgba[i][GCOMP] * dest[i][GCOMP]) >> 8;
GLint b = (rgba[i][BCOMP] * dest[i][BCOMP]) >> 8;
GLint a = (rgba[i][ACOMP] * dest[i][ACOMP]) >> 8;
rgba[i][RCOMP] = r;
rgba[i][GCOMP] = g;
rgba[i][BCOMP] = b;
rgba[i][ACOMP] = a;
rgba[i][RCOMP] = (GLubyte) r;
rgba[i][GCOMP] = (GLubyte) g;
rgba[i][BCOMP] = (GLubyte) b;
rgba[i][ACOMP] = (GLubyte) a;
}
}
}
@@ -539,6 +547,7 @@ static void blend_general( GLcontext *ctx, GLuint n, const GLubyte mask[],
break;
default:
/* this should never happen */
sA = 0.0F;
gl_problem(ctx, "Bad blend source A factor in do_blend");
}
@@ -590,6 +599,7 @@ static void blend_general( GLcontext *ctx, GLuint n, const GLubyte mask[],
break;
default:
/* this should never happen */
dR = dG = dB = 0.0F;
gl_problem(ctx, "Bad blend dest RGB factor in do_blend");
}
@@ -633,6 +643,7 @@ static void blend_general( GLcontext *ctx, GLuint n, const GLubyte mask[],
break;
default:
/* this should never happen */
dA = 0.0F;
gl_problem(ctx, "Bad blend dest A factor in do_blend");
return;
}
@@ -676,12 +687,17 @@ static void blend_general( GLcontext *ctx, GLuint n, const GLubyte mask[],
b = Bd * dB - Bs * sB;
a = Ad * dA - As * sA;
}
else {
/* should never get here */
r = g = b = a = 0.0F; /* silence uninitialized var warning */
gl_problem(ctx, "unexpected BlendEquation in blend_general()");
}
/* final clamping */
rgba[i][RCOMP] = (GLint) CLAMP( r, 0.0F, 255.0F );
rgba[i][GCOMP] = (GLint) CLAMP( g, 0.0F, 255.0F );
rgba[i][BCOMP] = (GLint) CLAMP( b, 0.0F, 255.0F );
rgba[i][ACOMP] = (GLint) CLAMP( a, 0.0F, 255.0F );
rgba[i][RCOMP] = (GLubyte) (GLint) CLAMP( r, 0.0F, 255.0F );
rgba[i][GCOMP] = (GLubyte) (GLint) CLAMP( g, 0.0F, 255.0F );
rgba[i][BCOMP] = (GLubyte) (GLint) CLAMP( b, 0.0F, 255.0F );
rgba[i][ACOMP] = (GLubyte) (GLint) CLAMP( a, 0.0F, 255.0F );
}
}
}

View File

@@ -1,4 +1,4 @@
/* $Id: blend.h,v 1.1 1999/08/19 00:55:41 jtg Exp $ */
/* $Id: blend.h,v 1.2 1999/11/11 01:22:25 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -25,9 +25,6 @@
*/
#ifndef BLEND_H
#define BLEND_H
@@ -48,21 +45,20 @@ gl_blend_pixels( GLcontext *ctx,
extern void
gl_BlendFunc( GLcontext *ctx, GLenum sfactor, GLenum dfactor );
_mesa_BlendFunc( GLenum sfactor, GLenum dfactor );
extern void
gl_BlendFuncSeparate( GLcontext *ctx, GLenum sfactorRGB, GLenum dfactorRGB,
GLenum sfactorA, GLenum dfactorA );
_mesa_BlendFuncSeparateINGR( GLenum sfactorRGB, GLenum dfactorRGB,
GLenum sfactorA, GLenum dfactorA );
extern void
gl_BlendEquation( GLcontext *ctx, GLenum mode );
_mesa_BlendEquationEXT( GLenum mode );
extern void
gl_BlendColor( GLcontext *ctx, GLclampf red, GLclampf green,
GLclampf blue, GLclampf alpha );
_mesa_BlendColorEXT(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
#endif

View File

@@ -1,4 +1,4 @@
/* $Id: clip.c,v 1.2 1999/09/18 20:41:22 keithw Exp $ */
/* $Id: clip.c,v 1.4.2.1 1999/11/25 16:51:24 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -31,9 +31,13 @@
#ifdef PC_HEADER
#include "all.h"
#else
#ifndef XFree86Server
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#else
#include "GL/xf86glx.h"
#endif
#include "clip.h"
#include "context.h"
#include "macros.h"
@@ -42,14 +46,20 @@
#include "types.h"
#include "vb.h"
#include "xform.h"
#ifdef XFree86Server
#include "GL/xf86glx.h"
#endif
#endif
#define CLIP_RGBA0 0x1
#define CLIP_RGBA1 0x2
#define CLIP_TEX0 0x4
#define CLIP_TEX1 0x8
#define CLIP_INDEX0 0x10
#define CLIP_INDEX1 0x20
#define CLIP_FOG_COORD 0x40
/* Linear interpolation between A and B: */
#define LINTERP( T, A, B ) ( (A) + (T) * ( (B) - (A) ) )
@@ -66,16 +76,7 @@ do { \
} while(0)
#define CLIP_RGBA0 0x1
#define CLIP_RGBA1 0x2
#define CLIP_TEX0 0x4
#define CLIP_TEX1 0x8
#define CLIP_INDEX0 0x10
#define CLIP_INDEX1 0x20
static clip_interp_func clip_interp_tab[0x40];
static clip_interp_func clip_interp_tab[0x80];
#define IND 0
#define NAME clip_nil
@@ -121,6 +122,50 @@ static clip_interp_func clip_interp_tab[0x40];
#define NAME clipINDEX0_INDEX1
#include "interp_tmp.h"
#define IND (CLIP_FOG_COORD)
#define NAME clip_FOG
#include "interp_tmp.h"
#define IND (CLIP_RGBA0|CLIP_FOG_COORD)
#define NAME clipRGBA0_FOG
#include "interp_tmp.h"
#define IND (CLIP_RGBA0|CLIP_RGBA1|CLIP_FOG_COORD)
#define NAME clipRGBA0_RGBA1_FOG
#include "interp_tmp.h"
#define IND (CLIP_TEX0|CLIP_RGBA0|CLIP_FOG_COORD)
#define NAME clipTEX0_RGBA0_FOG
#include "interp_tmp.h"
#define IND (CLIP_TEX0|CLIP_RGBA0|CLIP_RGBA1|CLIP_FOG_COORD)
#define NAME clipTEX0_RGBA0_RGBA1_FOG
#include "interp_tmp.h"
#define IND (CLIP_TEX1|CLIP_TEX0|CLIP_RGBA0|CLIP_FOG_COORD)
#define NAME clipTEX1_TEX0_RGBA0_FOG
#include "interp_tmp.h"
#define IND (CLIP_TEX0|CLIP_FOG_COORD)
#define NAME clipTEX0_FOG
#include "interp_tmp.h"
#define IND (CLIP_TEX1|CLIP_TEX0|CLIP_FOG_COORD)
#define NAME clipTEX1_TEX0_FOG
#include "interp_tmp.h"
#define IND (CLIP_TEX1|CLIP_TEX0|CLIP_RGBA0|CLIP_RGBA1|CLIP_FOG_COORD)
#define NAME clipTEX1_TEX0_RGBA0_RGBA1_FOG
#include "interp_tmp.h"
#define IND (CLIP_INDEX0|CLIP_FOG_COORD)
#define NAME clipINDEX0_FOG
#include "interp_tmp.h"
#define IND (CLIP_INDEX0|CLIP_INDEX1|CLIP_FOG_COORD)
#define NAME clipINDEX0_INDEX1_FOG
#include "interp_tmp.h"
@@ -351,6 +396,8 @@ void gl_update_clipmask( GLcontext *ctx )
mask |= CLIP_INDEX1;
}
if (ctx->FogMode == FOG_FRAGMENT && (ctx->TriangleCaps & DD_CLIP_FOG_COORD))
mask |= CLIP_FOG_COORD;
ctx->ClipInterpFunc = clip_interp_tab[mask];
ctx->poly_clip_tab = gl_poly_clip_tab[0];
@@ -446,11 +493,22 @@ void gl_init_clip(void)
clip_interp_tab[CLIP_TEX1|CLIP_TEX0|CLIP_RGBA0] = clipTEX1_TEX0_RGBA0;
clip_interp_tab[CLIP_TEX1|CLIP_TEX0|CLIP_RGBA0|CLIP_RGBA1] =
clipTEX1_TEX0_RGBA0_RGBA1;
clip_interp_tab[CLIP_TEX0] = clipTEX0;
clip_interp_tab[CLIP_TEX1|CLIP_TEX0] = clipTEX1_TEX0;
clip_interp_tab[CLIP_INDEX0] = clipINDEX0;
clip_interp_tab[CLIP_INDEX0|CLIP_INDEX1] = clipINDEX0_INDEX1;
clip_interp_tab[CLIP_FOG_COORD] = clip_FOG;
clip_interp_tab[CLIP_RGBA0|CLIP_FOG_COORD] = clipRGBA0_FOG;
clip_interp_tab[CLIP_RGBA0|CLIP_RGBA1|CLIP_FOG_COORD] = clipRGBA0_RGBA1_FOG;
clip_interp_tab[CLIP_TEX0|CLIP_RGBA0|CLIP_FOG_COORD] = clipTEX0_RGBA0_FOG;
clip_interp_tab[CLIP_TEX0|CLIP_RGBA0|CLIP_RGBA1|CLIP_FOG_COORD] = clipTEX0_RGBA0_RGBA1_FOG;
clip_interp_tab[CLIP_TEX1|CLIP_TEX0|CLIP_RGBA0|CLIP_FOG_COORD] = clipTEX1_TEX0_RGBA0_FOG;
clip_interp_tab[CLIP_TEX1|CLIP_TEX0|CLIP_RGBA0|CLIP_RGBA1|CLIP_FOG_COORD] =
clipTEX1_TEX0_RGBA0_RGBA1_FOG;
clip_interp_tab[CLIP_TEX0|CLIP_FOG_COORD] = clipTEX0_FOG;
clip_interp_tab[CLIP_TEX1|CLIP_TEX0|CLIP_FOG_COORD] = clipTEX1_TEX0_FOG;
clip_interp_tab[CLIP_INDEX0|CLIP_FOG_COORD] = clipINDEX0_FOG;
clip_interp_tab[CLIP_INDEX0|CLIP_INDEX1|CLIP_FOG_COORD] = clipINDEX0_INDEX1_FOG;
}

View File

@@ -1,4 +1,4 @@
/* $Id: clip.h,v 1.2 1999/09/18 20:41:22 keithw Exp $ */
/* $Id: clip.h,v 1.3 1999/11/11 01:22:25 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -63,11 +63,9 @@ extern GLuint gl_userclip_point( GLcontext* ctx, const GLfloat v[] );
extern void gl_user_cliptest( struct vertex_buffer *VB );
extern void gl_ClipPlane( GLcontext* ctx,
GLenum plane, const GLfloat *equation );
extern void _mesa_ClipPlane( GLenum plane, const GLdouble *equation );
extern void gl_GetClipPlane( GLcontext* ctx,
GLenum plane, GLdouble *equation );
extern void _mesa_GetClipPlane( GLenum plane, GLdouble *equation );
/*

View File

@@ -1,4 +1,4 @@
/* $Id: colortab.c,v 1.1 1999/08/19 00:55:41 jtg Exp $ */
/* $Id: colortab.c,v 1.4 1999/11/11 01:22:25 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -25,18 +25,14 @@
*/
#ifdef PC_HEADER
#include "all.h"
#else
#include "glheader.h"
#include "colortab.h"
#include "context.h"
#include "image.h"
#include "macros.h"
#ifdef XFree86Server
#include "GL/xf86glx.h"
#endif
#endif
@@ -44,7 +40,8 @@
/*
* 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++) {
@@ -56,7 +53,8 @@ static GLboolean power_of_two( GLint k )
}
static GLint decode_internal_format( GLint format )
static GLint
decode_internal_format( GLint format )
{
switch (format) {
case GL_ALPHA:
@@ -113,81 +111,95 @@ static GLint decode_internal_format( GLint format )
}
void gl_ColorTable( GLcontext *ctx, GLenum target,
GLenum internalFormat, struct gl_image *table )
void
_mesa_ColorTable( GLenum target, GLenum internalFormat,
GLsizei width, 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;
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;
}
switch (target) {
case GL_TEXTURE_1D:
texObj = texUnit->CurrentD[1];
break;
case GL_TEXTURE_2D:
texObj = texUnit->CurrentD[2];
break;
case GL_TEXTURE_3D_EXT:
texObj = texUnit->CurrentD[3];
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;
break;
default:
gl_error(ctx, GL_INVALID_ENUM, "glColorTableEXT(target)");
return;
}
/* internalformat = just like glTexImage */
if (table->Width < 1 || table->Width > MAX_TEXTURE_PALETTE_SIZE
|| !power_of_two(table->Width)) {
gl_error(ctx, GL_INVALID_VALUE, "glColorTableEXT(width)");
if (width < 1 || width > MAX_TEXTURE_PALETTE_SIZE || !power_of_two(width)) {
gl_error(ctx, GL_INVALID_VALUE, "glColorTable(width)");
if (proxy) {
texObj->PaletteSize = 0;
texObj->PaletteIntFormat = (GLenum) 0;
texObj->PaletteFormat = (GLenum) 0;
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 */
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 );
}
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 );
}
@@ -196,38 +208,172 @@ void gl_ColorTable( GLcontext *ctx, GLenum target,
void gl_ColorSubTable( GLcontext *ctx, GLenum target,
GLsizei start, struct gl_image *data )
void
_mesa_ColorSubTable( GLenum target, GLsizei start,
GLsizei count, GLenum format, GLenum type,
const GLvoid *table )
{
/* XXX TODO */
gl_problem(ctx, "glColorSubTableEXT not implemented");
(void) target;
(void) start;
(void) data;
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:
texObj = texUnit->CurrentD[3];
palette = &texObj->Palette;
break;
case GL_SHARED_TEXTURE_PALETTE_EXT:
texObj = NULL;
palette = &ctx->Texture.Palette;
break;
default:
gl_error(ctx, GL_INVALID_ENUM, "glColorSubTable(target)");
return;
}
assert(palette);
if (!gl_is_legal_format_and_type(format, type)) {
gl_error(ctx, GL_INVALID_ENUM, "glColorSubTable(format or type)");
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 );
}
}
else {
/* shared texture palette */
if (ctx->Driver.UpdateTexturePalette) {
(*ctx->Driver.UpdateTexturePalette)( ctx, NULL );
}
}
}
void gl_GetColorTable( GLcontext *ctx, GLenum target, GLenum format,
GLenum type, GLvoid *table )
void
_mesa_GetColorTable( GLenum target, GLenum format,
GLenum type, GLvoid *table )
{
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;
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_EXT:
case GL_TEXTURE_3D:
palette = &texUnit->CurrentD[3]->Palette;
break;
case GL_SHARED_TEXTURE_PALETTE_EXT:
palette = &ctx->Texture.Palette;
break;
default:
gl_error(ctx, GL_INVALID_ENUM, "glGetColorTableEXT(target)");
gl_error(ctx, GL_INVALID_ENUM, "glGetColorTable(target)");
return;
}
gl_problem(ctx, "glGetColorTableEXT not implemented!");
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!");
(void) format;
(void) type;
(void) table;
@@ -235,37 +381,37 @@ void gl_GetColorTable( GLcontext *ctx, GLenum target, GLenum format,
void gl_GetColorTableParameterfv( GLcontext *ctx, GLenum target,
GLenum pname, GLfloat *params )
void
_mesa_GetColorTableParameterfv( GLenum target, GLenum pname, GLfloat *params )
{
GLint iparams[10];
gl_GetColorTableParameteriv( ctx, target, pname, iparams );
_mesa_GetColorTableParameteriv( target, pname, iparams );
*params = (GLfloat) iparams[0];
}
void gl_GetColorTableParameteriv( GLcontext *ctx, GLenum target,
GLenum pname, GLint *params )
void
_mesa_GetColorTableParameteriv( GLenum target, GLenum pname, GLint *params )
{
GET_CURRENT_CONTEXT(ctx);
struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
struct gl_texture_object *texObj;
struct gl_palette *palette;
ASSERT_OUTSIDE_BEGIN_END(ctx, "glGetColorTableParameter");
switch (target) {
case GL_TEXTURE_1D:
texObj = texUnit->CurrentD[1];
palette = &texUnit->CurrentD[1]->Palette;
break;
case GL_TEXTURE_2D:
texObj = texUnit->CurrentD[2];
palette = &texUnit->CurrentD[2]->Palette;
break;
case GL_TEXTURE_3D_EXT:
texObj = texUnit->CurrentD[3];
case GL_TEXTURE_3D:
palette = &texUnit->CurrentD[3]->Palette;
break;
case GL_SHARED_TEXTURE_PALETTE_EXT:
texObj = NULL;
palette = &ctx->Texture.Palette;
break;
default:
gl_error(ctx, GL_INVALID_ENUM, "glGetColorTableParameter(target)");
@@ -273,34 +419,28 @@ void gl_GetColorTableParameteriv( GLcontext *ctx, GLenum target,
}
switch (pname) {
case GL_COLOR_TABLE_FORMAT_EXT:
if (texObj)
*params = texObj->PaletteIntFormat;
else
*params = ctx->Texture.PaletteIntFormat;
case GL_COLOR_TABLE_FORMAT:
*params = palette->IntFormat;
break;
case GL_COLOR_TABLE_WIDTH_EXT:
if (texObj)
*params = texObj->PaletteSize;
else
*params = ctx->Texture.PaletteSize;
case GL_COLOR_TABLE_WIDTH:
*params = palette->Size;
break;
case GL_COLOR_TABLE_RED_SIZE_EXT:
case GL_COLOR_TABLE_RED_SIZE:
*params = 8;
break;
case GL_COLOR_TABLE_GREEN_SIZE_EXT:
case GL_COLOR_TABLE_GREEN_SIZE:
*params = 8;
break;
case GL_COLOR_TABLE_BLUE_SIZE_EXT:
case GL_COLOR_TABLE_BLUE_SIZE:
*params = 8;
break;
case GL_COLOR_TABLE_ALPHA_SIZE_EXT:
case GL_COLOR_TABLE_ALPHA_SIZE:
*params = 8;
break;
case GL_COLOR_TABLE_LUMINANCE_SIZE_EXT:
case GL_COLOR_TABLE_LUMINANCE_SIZE:
*params = 8;
break;
case GL_COLOR_TABLE_INTENSITY_SIZE_EXT:
case GL_COLOR_TABLE_INTENSITY_SIZE:
*params = 8;
break;
default:

View File

@@ -1,4 +1,4 @@
/* $Id: colortab.h,v 1.1 1999/08/19 00:55:41 jtg Exp $ */
/* $Id: colortab.h,v 1.2 1999/11/11 01:22:25 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -25,9 +25,6 @@
*/
#ifndef COLORTAB_H
#define COLORTAB_H
@@ -35,21 +32,25 @@
#include "types.h"
extern void gl_ColorTable( GLcontext *ctx, GLenum target,
GLenum internalformat,
struct gl_image *table );
extern void
_mesa_ColorTable( GLenum target, GLenum internalformat,
GLsizei width, GLenum format, GLenum type,
const GLvoid *table );
extern void gl_ColorSubTable( GLcontext *ctx, GLenum target,
GLsizei start, struct gl_image *data );
extern void
_mesa_ColorSubTable( GLenum target, GLsizei start,
GLsizei count, GLenum format, GLenum type,
const GLvoid *table );
extern void gl_GetColorTable( GLcontext *ctx, GLenum target, GLenum format,
GLenum type, GLvoid *table );
extern void
_mesa_GetColorTable( GLenum target, GLenum format,
GLenum type, GLvoid *table );
extern void gl_GetColorTableParameterfv( GLcontext *ctx, GLenum target,
GLenum pname, GLfloat *params );
extern void
_mesa_GetColorTableParameterfv( GLenum target, GLenum pname, GLfloat *params );
extern void gl_GetColorTableParameteriv( GLcontext *ctx, GLenum target,
GLenum pname, GLint *params );
extern void
_mesa_GetColorTableParameteriv( GLenum target, GLenum pname, GLint *params );
#endif

View File

@@ -1,8 +1,8 @@
/* $Id: config.h,v 1.1 1999/08/19 00:55:41 jtg Exp $ */
/* $Id: config.h,v 1.2 1999/11/11 01:22:25 brianp Exp $ */
/*
* Mesa 3-D graphics library
* Version: 3.1
* Version: 3.3
*
* Copyright (C) 1999 Brian Paul All Rights Reserved.
*
@@ -25,10 +25,6 @@
*/
/*
* Tunable configuration parameters.
*/
@@ -42,12 +38,10 @@
#include "conf.h"
#endif
/*
*
* OpenGL implementation limits
*
*/
/*
* OpenGL implementation limits
*/
/* Maximum modelview matrix stack depth: */
#define MAX_MODELVIEW_STACK_DEPTH 32
@@ -116,10 +110,9 @@
#define MAX_ARRAY_LOCK_SIZE 3000
/*
*
* Mesa-specific parameters
*
*/
@@ -129,6 +122,9 @@
#define ACCUM_BITS 16
/*
* Bits per depth buffer value: 16 or 32
*/
#ifdef MESAD3D
/* Mesa / Direct3D driver only */
extern float g_DepthScale, g_MaxDepth;
@@ -136,9 +132,6 @@
# 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
@@ -201,19 +194,6 @@
#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,4 +1,4 @@
/* $Id: context.c,v 1.9 1999/09/19 23:43:02 keithw Exp $ */
/* $Id: context.c,v 1.18.2.6 1999/12/04 21:13:44 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -25,6 +25,8 @@
*/
/* $XFree86: xc/lib/GL/mesa/src/context.c,v 1.4 1999/04/04 00:20:21 dawes Exp $ */
/*
* If multi-threading is enabled (-DTHREADS) then each thread has it's
* own rendering context. A thread obtains the pointer to its GLcontext
@@ -38,11 +40,15 @@
#ifdef PC_HEADER
#include "all.h"
#else
#ifndef XFree86Server
#include <assert.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#else
#include "GL/xf86glx.h"
#endif
#include "accum.h"
#include "alphabuf.h"
#include "api.h"
@@ -55,6 +61,7 @@
#include "enums.h"
#include "extensions.h"
#include "fog.h"
#include "get.h"
#include "hash.h"
#include "light.h"
#include "lines.h"
@@ -86,12 +93,43 @@
#include "vbxform.h"
#include "vertices.h"
#include "xform.h"
#ifdef XFree86Server
#include "GL/xf86glx.h"
#endif
#endif
/*
* Memory allocation functions. Called via the MALLOC, CALLOC and
* FREE macros when DEBUG symbol is defined.
* You might want to set breakpoints on these functions or plug in
* other memory allocation functions. The Mesa sources should only
* use the MALLOC and FREE macros (which could also be overriden).
*
* XXX these functions should probably go into a new glmemory.c file.
*/
/*
* Allocate memory (uninitialized)
*/
void *gl_malloc(size_t bytes)
{
return malloc(bytes);
}
/*
* Allocate memory and initialize to zero.
*/
void *gl_calloc(size_t bytes)
{
return calloc(1, bytes);
}
/*
* Free memory
*/
void gl_free(void *ptr)
{
free(ptr);
}
/**********************************************************************/
/***** Context and Thread management *****/
@@ -321,11 +359,11 @@ static void one_time_init( void )
*/
static struct gl_shared_state *alloc_shared_state( void )
{
GLuint i;
GLuint d;
struct gl_shared_state *ss;
GLboolean outOfMemory;
ss = (struct gl_shared_state*) calloc( 1, sizeof(struct gl_shared_state) );
ss = CALLOC_STRUCT(gl_shared_state);
if (!ss)
return NULL;
@@ -335,16 +373,13 @@ static struct gl_shared_state *alloc_shared_state( void )
/* Default Texture objects */
outOfMemory = GL_FALSE;
for (i=0;i<MAX_TEXTURE_UNITS;i++) {
GLuint d;
for (d = 1 ; d <= 3 ; d++) {
ss->DefaultD[d][i] = gl_alloc_texture_object(ss, 0, d);
if (!ss->DefaultD[d][i]) {
outOfMemory = GL_TRUE;
break;
}
ss->DefaultD[d][i]->RefCount++; /* don't free if not in use */
for (d = 1 ; d <= 3 ; d++) {
ss->DefaultD[d] = gl_alloc_texture_object(ss, 0, d);
if (!ss->DefaultD[d]) {
outOfMemory = GL_TRUE;
break;
}
ss->DefaultD[d]->RefCount++; /* don't free if not in use */
}
if (!ss->DisplayList || !ss->TexObjects || outOfMemory) {
@@ -353,15 +388,13 @@ static struct gl_shared_state *alloc_shared_state( void )
DeleteHashTable(ss->DisplayList);
if (ss->TexObjects)
DeleteHashTable(ss->TexObjects);
for (i=0;i<MAX_TEXTURE_UNITS;i++) {
if (ss->DefaultD[1][i])
gl_free_texture_object(ss, ss->DefaultD[1][i]);
if (ss->DefaultD[2][i])
gl_free_texture_object(ss, ss->DefaultD[2][i]);
if (ss->DefaultD[3][i])
gl_free_texture_object(ss, ss->DefaultD[3][i]);
}
free(ss);
if (ss->DefaultD[1])
gl_free_texture_object(ss, ss->DefaultD[1]);
if (ss->DefaultD[2])
gl_free_texture_object(ss, ss->DefaultD[2]);
if (ss->DefaultD[3])
gl_free_texture_object(ss, ss->DefaultD[3]);
FREE(ss);
return NULL;
}
else {
@@ -397,7 +430,7 @@ static void free_shared_state( GLcontext *ctx, struct gl_shared_state *ss )
}
DeleteHashTable(ss->TexObjects);
free(ss);
FREE(ss);
}
@@ -480,9 +513,9 @@ static void init_texture_unit( GLcontext *ctx, GLuint unit )
ASSIGN_4V( texUnit->EyePlaneR, 0.0, 0.0, 0.0, 0.0 );
ASSIGN_4V( texUnit->EyePlaneQ, 0.0, 0.0, 0.0, 0.0 );
texUnit->CurrentD[1] = ctx->Shared->DefaultD[1][unit];
texUnit->CurrentD[2] = ctx->Shared->DefaultD[2][unit];
texUnit->CurrentD[3] = ctx->Shared->DefaultD[3][unit];
texUnit->CurrentD[1] = ctx->Shared->DefaultD[1];
texUnit->CurrentD[2] = ctx->Shared->DefaultD[2];
texUnit->CurrentD[3] = ctx->Shared->DefaultD[3];
}
@@ -540,7 +573,7 @@ static void init_1d_map( struct gl_1d_map *map, int n, const float *initial )
map->Order = 1;
map->u1 = 0.0;
map->u2 = 1.0;
map->Points = (GLfloat *) malloc(n * sizeof(GLfloat));
map->Points = (GLfloat *) MALLOC(n * sizeof(GLfloat));
if (map->Points) {
GLint i;
for (i=0;i<n;i++)
@@ -559,7 +592,7 @@ static void init_2d_map( struct gl_2d_map *map, int n, const float *initial )
map->u2 = 1.0;
map->v1 = 0.0;
map->v2 = 1.0;
map->Points = (GLfloat *) malloc(n * sizeof(GLfloat));
map->Points = (GLfloat *) MALLOC(n * sizeof(GLfloat));
if (map->Points) {
GLint i;
for (i=0;i<n;i++)
@@ -584,7 +617,6 @@ static void initialize_context( GLcontext *ctx )
ctx->Const.MaxTextureUnits = MAX_TEXTURE_UNITS;
ctx->Const.MaxArrayLockSize = MAX_ARRAY_LOCK_SIZE;
/* Modelview matrix */
gl_matrix_ctr( &ctx->ModelView );
gl_matrix_alloc_inv( &ctx->ModelView );
@@ -886,9 +918,9 @@ static void initialize_context( GLcontext *ctx )
ctx->Stencil.ZPassFunc = GL_KEEP;
ctx->Stencil.ZFailFunc = GL_KEEP;
ctx->Stencil.Ref = 0;
ctx->Stencil.ValueMask = 0xff;
ctx->Stencil.ValueMask = STENCIL_MAX;
ctx->Stencil.Clear = 0;
ctx->Stencil.WriteMask = 0xff;
ctx->Stencil.WriteMask = STENCIL_MAX;
/* Texture group */
ctx->Texture.CurrentUnit = 0; /* multitexture */
@@ -977,14 +1009,18 @@ static void initialize_context( GLcontext *ctx )
/* Pixel transfer */
ctx->Pack.Alignment = 4;
ctx->Pack.RowLength = 0;
ctx->Pack.ImageHeight = 0;
ctx->Pack.SkipPixels = 0;
ctx->Pack.SkipRows = 0;
ctx->Pack.SkipImages = 0;
ctx->Pack.SwapBytes = GL_FALSE;
ctx->Pack.LsbFirst = GL_FALSE;
ctx->Unpack.Alignment = 4;
ctx->Unpack.RowLength = 0;
ctx->Unpack.ImageHeight = 0;
ctx->Unpack.SkipPixels = 0;
ctx->Unpack.SkipRows = 0;
ctx->Unpack.SkipImages = 0;
ctx->Unpack.SwapBytes = GL_FALSE;
ctx->Unpack.LsbFirst = GL_FALSE;
@@ -1035,6 +1071,7 @@ static void initialize_context( GLcontext *ctx )
/* For debug/development only */
ctx->NoRaster = getenv("MESA_NO_RASTER") ? GL_TRUE : GL_FALSE;
ctx->FirstTimeCurrent = GL_TRUE;
/* Dither disable */
ctx->NoDither = getenv("MESA_NO_DITHER") ? GL_TRUE : GL_FALSE;
@@ -1092,7 +1129,7 @@ GLvisual *gl_create_visual( GLboolean rgbFlag,
return NULL;
}
vis = (GLvisual *) calloc( 1, sizeof(GLvisual) );
vis = (GLvisual *) CALLOC( sizeof(GLvisual) );
if (!vis) {
return NULL;
}
@@ -1119,7 +1156,7 @@ GLvisual *gl_create_visual( GLboolean rgbFlag,
void gl_destroy_visual( GLvisual *vis )
{
free( vis );
FREE( vis );
}
@@ -1187,8 +1224,6 @@ static GLboolean alloc_proxy_textures( GLcontext *ctx )
#define MALLOC_STRUCT(T) (struct T *) malloc( sizeof(struct T) )
/*
* Allocate and initialize a GLcontext structure.
* Input: visual - a GLvisual pointer
@@ -1217,7 +1252,7 @@ GLcontext *gl_create_context( GLvisual *visual,
/* misc one-time initializations */
one_time_init();
ctx = (GLcontext *) calloc( 1, sizeof(GLcontext) );
ctx = (GLcontext *) CALLOC( sizeof(GLcontext) );
if (!ctx) {
return NULL;
}
@@ -1228,15 +1263,15 @@ GLcontext *gl_create_context( GLvisual *visual,
ctx->VB = gl_vb_create_for_immediate( ctx );
if (!ctx->VB) {
free( ctx );
FREE( ctx );
return NULL;
}
ctx->input = ctx->VB->IM;
ctx->PB = gl_alloc_pb();
if (!ctx->PB) {
free( ctx->VB );
free( ctx );
FREE( ctx->VB );
FREE( ctx );
return NULL;
}
@@ -1248,9 +1283,9 @@ GLcontext *gl_create_context( GLvisual *visual,
/* allocate new group of display lists */
ctx->Shared = alloc_shared_state();
if (!ctx->Shared) {
free(ctx->VB);
free(ctx->PB);
free(ctx);
FREE(ctx->VB);
FREE(ctx->PB);
FREE(ctx);
return NULL;
}
}
@@ -1299,7 +1334,6 @@ GLcontext *gl_create_context( GLvisual *visual,
ctx->Driver.ReadDepthSpanInt = gl_read_depth_span_int;
#ifdef PROFILE
init_timings( ctx );
#endif
@@ -1307,9 +1341,9 @@ GLcontext *gl_create_context( GLvisual *visual,
#ifdef GL_VERSION_1_1
if (!alloc_proxy_textures(ctx)) {
free_shared_state(ctx, ctx->Shared);
free(ctx->VB);
free(ctx->PB);
free(ctx);
FREE(ctx->VB);
FREE(ctx->PB);
FREE(ctx);
return NULL;
}
#endif
@@ -1355,7 +1389,7 @@ void gl_destroy_context( GLcontext *ctx )
gl_matrix_dtr( &ctx->ProjectionStack[i] );
}
free( ctx->PB );
FREE( ctx->PB );
if(ctx->input != ctx->VB->IM)
gl_immediate_free( ctx->input );
@@ -1370,9 +1404,9 @@ void gl_destroy_context( GLcontext *ctx )
}
foreach_s( s, tmps, ctx->ShineTabList ) {
free( s );
FREE( s );
}
free( ctx->ShineTabList );
FREE( ctx->ShineTabList );
/* Free proxy texture objects */
gl_free_texture_object( NULL, ctx->Texture.Proxy1D );
@@ -1381,52 +1415,52 @@ void gl_destroy_context( GLcontext *ctx )
/* Free evaluator data */
if (ctx->EvalMap.Map1Vertex3.Points)
free( ctx->EvalMap.Map1Vertex3.Points );
FREE( ctx->EvalMap.Map1Vertex3.Points );
if (ctx->EvalMap.Map1Vertex4.Points)
free( ctx->EvalMap.Map1Vertex4.Points );
FREE( ctx->EvalMap.Map1Vertex4.Points );
if (ctx->EvalMap.Map1Index.Points)
free( ctx->EvalMap.Map1Index.Points );
FREE( ctx->EvalMap.Map1Index.Points );
if (ctx->EvalMap.Map1Color4.Points)
free( ctx->EvalMap.Map1Color4.Points );
FREE( ctx->EvalMap.Map1Color4.Points );
if (ctx->EvalMap.Map1Normal.Points)
free( ctx->EvalMap.Map1Normal.Points );
FREE( ctx->EvalMap.Map1Normal.Points );
if (ctx->EvalMap.Map1Texture1.Points)
free( ctx->EvalMap.Map1Texture1.Points );
FREE( ctx->EvalMap.Map1Texture1.Points );
if (ctx->EvalMap.Map1Texture2.Points)
free( ctx->EvalMap.Map1Texture2.Points );
FREE( ctx->EvalMap.Map1Texture2.Points );
if (ctx->EvalMap.Map1Texture3.Points)
free( ctx->EvalMap.Map1Texture3.Points );
FREE( ctx->EvalMap.Map1Texture3.Points );
if (ctx->EvalMap.Map1Texture4.Points)
free( ctx->EvalMap.Map1Texture4.Points );
FREE( ctx->EvalMap.Map1Texture4.Points );
if (ctx->EvalMap.Map2Vertex3.Points)
free( ctx->EvalMap.Map2Vertex3.Points );
FREE( ctx->EvalMap.Map2Vertex3.Points );
if (ctx->EvalMap.Map2Vertex4.Points)
free( ctx->EvalMap.Map2Vertex4.Points );
FREE( ctx->EvalMap.Map2Vertex4.Points );
if (ctx->EvalMap.Map2Index.Points)
free( ctx->EvalMap.Map2Index.Points );
FREE( ctx->EvalMap.Map2Index.Points );
if (ctx->EvalMap.Map2Color4.Points)
free( ctx->EvalMap.Map2Color4.Points );
FREE( ctx->EvalMap.Map2Color4.Points );
if (ctx->EvalMap.Map2Normal.Points)
free( ctx->EvalMap.Map2Normal.Points );
FREE( ctx->EvalMap.Map2Normal.Points );
if (ctx->EvalMap.Map2Texture1.Points)
free( ctx->EvalMap.Map2Texture1.Points );
FREE( ctx->EvalMap.Map2Texture1.Points );
if (ctx->EvalMap.Map2Texture2.Points)
free( ctx->EvalMap.Map2Texture2.Points );
FREE( ctx->EvalMap.Map2Texture2.Points );
if (ctx->EvalMap.Map2Texture3.Points)
free( ctx->EvalMap.Map2Texture3.Points );
FREE( ctx->EvalMap.Map2Texture3.Points );
if (ctx->EvalMap.Map2Texture4.Points)
free( ctx->EvalMap.Map2Texture4.Points );
FREE( ctx->EvalMap.Map2Texture4.Points );
/* Free cache of immediate buffers. */
while (ctx->nr_im_queued-- > 0) {
struct immediate * next = ctx->freed_im_queue->next;
free( ctx->freed_im_queue );
FREE( ctx->freed_im_queue );
ctx->freed_im_queue = next;
}
gl_extensions_dtr(ctx);
free( (void *) ctx );
FREE( (void *) ctx );
#ifndef THREADS
if (ctx==CC) {
@@ -1451,7 +1485,7 @@ GLframebuffer *gl_create_framebuffer( GLvisual *visual )
{
GLframebuffer *buffer;
buffer = (GLframebuffer *) calloc( 1, sizeof(GLframebuffer) );
buffer = (GLframebuffer *) CALLOC( sizeof(GLframebuffer) );
if (!buffer) {
return NULL;
}
@@ -1470,27 +1504,27 @@ void gl_destroy_framebuffer( GLframebuffer *buffer )
{
if (buffer) {
if (buffer->Depth) {
free( buffer->Depth );
FREE( buffer->Depth );
}
if (buffer->Accum) {
free( buffer->Accum );
FREE( buffer->Accum );
}
if (buffer->Stencil) {
free( buffer->Stencil );
FREE( buffer->Stencil );
}
if (buffer->FrontLeftAlpha) {
free( buffer->FrontLeftAlpha );
FREE( buffer->FrontLeftAlpha );
}
if (buffer->BackLeftAlpha) {
free( buffer->BackLeftAlpha );
FREE( buffer->BackLeftAlpha );
}
if (buffer->FrontRightAlpha) {
free( buffer->FrontRightAlpha );
FREE( buffer->FrontRightAlpha );
}
if (buffer->BackRightAlpha) {
free( buffer->BackRightAlpha );
FREE( buffer->BackRightAlpha );
}
free(buffer);
FREE(buffer);
}
}
@@ -1531,6 +1565,21 @@ void gl_make_current( GLcontext *ctx, GLframebuffer *buffer )
ctx->NewState = NEW_ALL; /* just to be safe */
gl_update_state( ctx );
}
/* We can use this to help debug user's problems. Tell the to set
* the MESA_INFO env variable before running their app. Then the
* first time each context is made current we'll print some useful
* information.
*/
if (ctx && ctx->FirstTimeCurrent) {
if (getenv("MESA_INFO")) {
fprintf(stderr, "Mesa GL_VERSION = %s\n", (char *) gl_GetString(ctx, GL_VERSION));
fprintf(stderr, "Mesa GL_RENDERER = %s\n", (char *) gl_GetString(ctx, GL_RENDERER));
fprintf(stderr, "Mesa GL_VENDOR = %s\n", (char *) gl_GetString(ctx, GL_VENDOR));
fprintf(stderr, "Mesa GL_EXTENSIONS = %s\n", (char *) gl_GetString(ctx, GL_EXTENSIONS));
}
ctx->FirstTimeCurrent = GL_FALSE;
}
}
@@ -1944,21 +1993,17 @@ static void update_pixel_masking( GLcontext *ctx )
static void update_fog_mode( GLcontext *ctx )
{
int old_mode = ctx->FogMode;
ctx->FogMode = FOG_NONE;
if (ctx->Fog.Enabled) {
if (ctx->Texture.Enabled)
ctx->FogMode = FOG_FRAGMENT;
else if (ctx->Hint.Fog == GL_NICEST)
ctx->FogMode = FOG_FRAGMENT;
else
ctx->FogMode = FOG_VERTEX;
ctx->FogMode = FOG_VERTEX;
if (ctx->Driver.GetParameteri)
if ((ctx->Driver.GetParameteri)( ctx, DD_HAVE_HARDWARE_FOG ))
ctx->FogMode = FOG_FRAGMENT;
}
else {
ctx->FogMode = FOG_NONE;
if (ctx->Texture.Enabled || ctx->Hint.Fog == GL_NICEST)
ctx->FogMode = FOG_FRAGMENT;
if ( ctx->Driver.GetParameteri &&
ctx->Driver.GetParameteri( ctx, DD_HAVE_HARDWARE_FOG ) )
ctx->FogMode = FOG_FRAGMENT;
}
if (old_mode != ctx->FogMode)
@@ -2097,14 +2142,6 @@ void gl_update_state( GLcontext *ctx )
ctx->Texture.Unit[1].LastEnvMode = ctx->Texture.Unit[1].EnvMode;
}
if ((ctx->NewState & ~(NEW_CLIENT_STATE|NEW_TEXTURE_ENABLE)) == 0) {
if (MESA_VERBOSE&VERBOSE_STATE)
fprintf(stderr, "update_state: goto finished\n");
goto finished;
}
if (ctx->NewState & NEW_TEXTURE_MATRIX) {
ctx->Enabled &= ~(ENABLE_TEXMAT0|ENABLE_TEXMAT1);
@@ -2121,7 +2158,7 @@ void gl_update_state( GLcontext *ctx )
}
}
if (ctx->NewState & NEW_TEXTURING) {
if (ctx->NewState & (NEW_TEXTURING | NEW_TEXTURE_ENABLE)) {
ctx->Texture.NeedNormals = GL_FALSE;
gl_update_dirty_texobjs(ctx);
ctx->Enabled &= ~(ENABLE_TEXGEN0|ENABLE_TEXGEN1);
@@ -2283,7 +2320,7 @@ void gl_update_state( GLcontext *ctx )
}
}
if (ctx->NewState & ~(NEW_CLIENT_STATE|NEW_TEXTURE_ENABLE|
if (ctx->NewState & ~(NEW_CLIENT_STATE|
NEW_DRIVER_STATE|NEW_USER_CLIP|
NEW_POLYGON))
gl_update_clipmask(ctx);
@@ -2291,6 +2328,7 @@ void gl_update_state( GLcontext *ctx )
if (ctx->NewState & (NEW_LIGHTING|
NEW_RASTER_OPS|
NEW_TEXTURING|
NEW_TEXTURE_ENABLE|
NEW_TEXTURE_ENV|
NEW_POLYGON|
NEW_DRVSTATE0|
@@ -2386,7 +2424,7 @@ void gl_update_state( GLcontext *ctx )
oldnorm = ctx->NeedEyeNormals;
ctx->NeedNormals = (ctx->Light.Enabled || ctx->Texture.NeedNormals);
ctx->NeedEyeCoords = ((ctx->Fog.Enabled && ctx->Hint.Fog != GL_NICEST) ||
ctx->NeedEyeCoords = (ctx->FogMode == FOG_VERTEX ||
ctx->Point.Attenuated);
ctx->NeedEyeNormals = GL_FALSE;
@@ -2442,7 +2480,6 @@ void gl_update_state( GLcontext *ctx )
gl_update_normal_transform( ctx );
}
finished:
gl_update_pipelines(ctx);
ctx->NewState = 0;
}

View File

@@ -1,8 +1,8 @@
/* $Id: context.h,v 1.1 1999/08/19 00:55:41 jtg Exp $ */
/* $Id: context.h,v 1.2 1999/11/11 01:22:25 brianp Exp $ */
/*
* Mesa 3-D graphics library
* Version: 3.1
* Version: 3.3
*
* Copyright (C) 1999 Brian Paul All Rights Reserved.
*
@@ -25,9 +25,6 @@
*/
#ifndef CONTEXT_H
#define CONTEXT_H
@@ -35,18 +32,35 @@
#include "types.h"
#ifdef THREADS
/*
* A seperate GLcontext for each thread
*/
extern GLcontext *gl_get_thread_context( void );
#define GET_IMMEDIATE struct immediate *IM = (gl_get_thread_context())->input;
#define SET_IMMEDIATE(ctx, im) \
do { \
ctx->input = im; \
} while (0)
#else
/*
* All threads use same pointer to current context.
*/
extern GLcontext *CC;
extern GLcontext *_mesa_current_context;
extern struct immediate *CURRENT_INPUT;
#define GET_CURRENT_CONTEXT(C) GLcontext *C = _mesa_current_context
#define GET_IMMEDIATE struct immediate *IM = CURRENT_INPUT
#define SET_IMMEDIATE(ctx, im) \
do { \
ctx->input = im; \
CURRENT_INPUT = im; \
} while (0)
#endif
@@ -124,14 +138,18 @@ extern GLcontext *gl_get_current_context(void);
extern void gl_copy_context(const GLcontext *src, GLcontext *dst, GLuint mask);
extern void gl_set_api_table( GLcontext *ctx, const struct gl_api_table *api );
extern void
_mesa_swapbuffers(GLcontext *ctx);
extern struct _glapi_table *
_mesa_get_dispatch(GLcontext *ctx);
/*
* GL_MESA_resize_buffers extension
*/
extern void gl_ResizeBuffersMESA( GLcontext *ctx );
extern void _mesa_ResizeBuffersMESA( void );
@@ -146,8 +164,6 @@ extern void gl_warning( const GLcontext *ctx, const char *s );
extern void gl_error( GLcontext *ctx, GLenum error, const char *s );
extern void gl_compile_error( GLcontext *ctx, GLenum error, const char *s );
extern GLenum gl_GetError( GLcontext *ctx );
extern void gl_update_state( GLcontext *ctx );

View File

@@ -1,4 +1,4 @@
/* $Id: dd.h,v 1.2 1999/09/18 20:41:22 keithw Exp $ */
/* $Id: dd.h,v 1.4.2.1 1999/12/12 18:30:47 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -63,10 +63,10 @@ struct gl_pipeline_stage;
* The optional functions provide ways to take advantage of special hardware
* or optimized algorithms.
*
* The function pointers in the dd_function_table struct are first
* initialized in the "MakeCurrent" function. The "MakeCurrent" function
* is a little different in each device driver. See the X/Mesa, GLX, or
* OS/Mesa drivers for examples.
* The function pointers in the dd_function_table struct should first be
* initialized in the driver's "MakeCurrent" function. The "MakeCurrent"
* function is a little different in each device driver. See the X/Mesa,
* GLX, or OS/Mesa drivers for examples.
*
* Later, Mesa may call the dd_function_table's UpdateState() function.
* This function should initialize the dd_function_table's pointers again.
@@ -81,7 +81,8 @@ struct gl_pipeline_stage;
* for an example.
*
* For more information about writing a device driver see the ddsample.c
* file and other device drivers (xmesa[123].c, osmesa.c, etc) for examples.
* file and other device drivers (X/xmesa[1234].c, OSMesa/osmesa.c, etc)
* for examples.
*
*
* Look below in the dd_function_table struct definition for descriptions
@@ -132,8 +133,8 @@ struct dd_function_table {
const char * (*RendererString)(void);
/*
* Return a string which uniquely identifies this device driver.
* The string should contain no whitespace. Examples: "X11" "OffScreen"
* "MSWindows" "SVGA".
* The string should contain no whitespace. Examples: "X11", "OffScreen",
* "MSWindows", "SVGA".
* NOTE: This function will be obsolete in favor of GetString in the future!
*/
@@ -147,14 +148,14 @@ struct dd_function_table {
void (*ClearIndex)( GLcontext *ctx, GLuint index );
/*
* Called whenever glClearIndex() is called. Set the index for clearing
* the color buffer.
* the color buffer when in color index mode.
*/
void (*ClearColor)( GLcontext *ctx, GLubyte red, GLubyte green,
GLubyte blue, GLubyte alpha );
/*
* Called whenever glClearColor() is called. Set the color for clearing
* the color buffer.
* the color buffer when in RGBA mode.
*/
GLbitfield (*Clear)( GLcontext *ctx, GLbitfield mask, GLboolean all,
@@ -169,12 +170,14 @@ struct dd_function_table {
void (*Index)( GLcontext *ctx, GLuint index );
/*
* Sets current color index for drawing flat-shaded primitives.
* This index should also be used in the "mono" drawing functions.
*/
void (*Color)( GLcontext *ctx,
GLubyte red, GLubyte green, GLubyte glue, GLubyte alpha );
/*
* Sets current color for drawing flat-shaded primitives.
* This color should also be used in the "mono" drawing functions.
*/
GLboolean (*SetBuffer)( GLcontext *ctx, GLenum buffer );
@@ -197,8 +200,7 @@ struct dd_function_table {
* GL_NONE - disable buffer write in device driver.
*/
void (*GetBufferSize)( GLcontext *ctx,
GLuint *width, GLuint *height );
void (*GetBufferSize)( GLcontext *ctx, GLuint *width, GLuint *height );
/*
* Returns the width and height of the current color buffer.
*/
@@ -216,11 +218,14 @@ struct dd_function_table {
CONST GLubyte rgb[][3], const GLubyte mask[] );
/* Write a horizontal run of RGB[A] pixels. The later version is only
* used to accelerate GL_RGB, GL_UNSIGNED_BYTE glDrawPixels() calls.
* If mask is NULL, draw all pixels.
* If mask is not null, only draw pixel [i] when mask [i] is true.
*/
void (*WriteMonoRGBASpan)( const GLcontext *ctx, GLuint n, GLint x, GLint y,
const GLubyte mask[] );
/* Write a horizontal run of mono-RGBA pixels.
/* Write a horizontal run of RGBA pixels all with the color last
* specified by the Color function.
*/
void (*WriteRGBAPixels)( const GLcontext *ctx,
@@ -239,12 +244,15 @@ struct dd_function_table {
const GLuint index[], const GLubyte mask[] );
void (*WriteCI8Span)( const GLcontext *ctx, GLuint n, GLint x, GLint y,
const GLubyte index[], const GLubyte mask[] );
/* Write a horizontal run of CI pixels. 32 or 8bpp.
/* Write a horizontal run of CI pixels. One function is for 32bpp
* indexes and the other for 8bpp pixels (the common case). You mus
* implement both for color index mode.
*/
void (*WriteMonoCISpan)( const GLcontext *ctx, GLuint n, GLint x, GLint y,
const GLubyte mask[] );
/* Write a horizontal run of mono-CI pixels.
/* Write a horizontal run of color index pixels using the color index
* last specified by the Index() function.
*/
void (*WriteCI32Pixels)( const GLcontext *ctx,
@@ -257,8 +265,8 @@ struct dd_function_table {
void (*WriteMonoCIPixels)( const GLcontext *ctx,
GLuint n, const GLint x[], const GLint y[],
const GLubyte mask[] );
/*
* Write a random array of mono-CI pixels.
/* Write a random array of color index pixels using the color index
* last specified by the Index() function.
*/
@@ -310,12 +318,12 @@ struct dd_function_table {
void (*Finish)( GLcontext *ctx );
/*
* Called whenever glFinish() is called.
* This is called whenever glFinish() is called.
*/
void (*Flush)( GLcontext *ctx );
/*
* Called whenever glFlush() is called.
* This is called whenever glFlush() is called.
*/
GLboolean (*IndexMask)( GLcontext *ctx, GLuint mask );
@@ -418,16 +426,17 @@ struct dd_function_table {
GLenum format, GLenum type,
const struct gl_pixelstore_attrib *unpack,
const GLvoid *pixels );
/* Device driver hook for optimized glDrawPixels. 'unpack' describes how
* to unpack the source image data.
/* This is called by glDrawPixels.
* 'unpack' describes how to unpack the source image data.
* Return GL_TRUE if the driver succeeds, return GL_FALSE if core Mesa
* must do the job.
*/
GLboolean (*Bitmap)( GLcontext *ctx,
GLint x, GLint y, GLsizei width, GLsizei height,
const struct gl_pixelstore_attrib *unpack,
const GLubyte *bitmap );
/* Device driver hook for optimized glBitmap. 'unpack' describes how
* to unpack the source image data.
/* This is called by glBitmap. Works the same as DrawPixels, above.
*/
void (*RenderStart)( GLcontext *ctx );
@@ -563,6 +572,23 @@ struct dd_function_table {
*/
GLboolean (*IsTextureResident)( GLcontext *ctx,
struct gl_texture_object *t );
/*
* Allows the driver to implement the AreTexturesResident tests without
* knowing about Mesa's internal hash tables for textures.
*/
void (*PrioritizeTexture)( GLcontext *ctx,
struct gl_texture_object *t,
GLclampf priority );
/*
* Notify driver of priority change for a texture.
*/
/***
*** NEW in Mesa 3.x
***/
@@ -616,7 +642,11 @@ struct dd_function_table {
* the driver's UpdateState() function must do.
*/
void (*AlphaFunc)(GLcontext *ctx, GLenum func, GLclampf ref);
void (*BlendEquation)(GLcontext *ctx, GLenum mode);
void (*BlendFunc)(GLcontext *ctx, GLenum sfactor, GLenum dfactor);
void (*BlendFuncSeparate)( GLcontext *ctx, GLenum sfactorRGB,
GLenum dfactorRGB, GLenum sfactorA,
GLenum dfactorA );
void (*ClearDepth)(GLcontext *ctx, GLclampd d);
void (*CullFace)(GLcontext *ctx, GLenum mode);
void (*FrontFace)(GLcontext *ctx, GLenum mode);
@@ -626,6 +656,10 @@ struct dd_function_table {
void (*Enable)(GLcontext* ctx, GLenum cap, GLboolean state);
void (*Fogfv)(GLcontext *ctx, GLenum pname, const GLfloat *params);
void (*Hint)(GLcontext *ctx, GLenum target, GLenum mode);
void (*Lightfv)(GLcontext *ctx, GLenum light,
GLenum pname, const GLfloat *params, GLint nparams );
void (*LightModelfv)(GLcontext *ctx, GLenum pname, const GLfloat *params);
void (*LogicOpcode)(GLcontext *ctx, GLenum opcode);
void (*PolygonMode)(GLcontext *ctx, GLenum face, GLenum mode);
void (*Scissor)(GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h);
void (*ShadeModel)(GLcontext *ctx, GLenum mode);

View File

@@ -1,8 +1,8 @@
/* $Id: depth.c,v 1.3 1999/09/19 23:43:02 keithw Exp $ */
/* $Id: depth.c,v 1.9 1999/11/11 01:22:26 brianp Exp $ */
/*
* Mesa 3-D graphics library
* Version: 3.1
* Version: 3.3
*
* Copyright (C) 1999 Brian Paul All Rights Reserved.
*
@@ -24,26 +24,15 @@
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
/*
* Depth buffer functions
*/
#ifdef PC_HEADER
#include "all.h"
#else
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "glheader.h"
#include "context.h"
#include "enums.h"
#include "depth.h"
#include "macros.h"
#include "mem.h"
#include "types.h"
#ifdef XFree86Server
#include "GL/xf86glx.h"
#endif
#endif
@@ -54,8 +43,10 @@
void gl_ClearDepth( GLcontext* ctx, GLclampd depth )
void
_mesa_ClearDepth( 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)
@@ -64,8 +55,10 @@ void gl_ClearDepth( GLcontext* ctx, GLclampd depth )
void gl_DepthFunc( GLcontext* ctx, GLenum func )
void
_mesa_DepthFunc( GLenum func )
{
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glDepthFunc");
if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE))
@@ -105,8 +98,10 @@ void gl_DepthFunc( GLcontext* ctx, GLenum func )
void gl_DepthMask( GLcontext* ctx, GLboolean flag )
void
_mesa_DepthMask( GLboolean flag )
{
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glDepthMask");
if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE))
@@ -806,12 +801,12 @@ void gl_alloc_depth_buffer( GLcontext* ctx )
{
/* deallocate current depth buffer if present */
if (ctx->Buffer->Depth) {
free(ctx->Buffer->Depth);
FREE(ctx->Buffer->Depth);
ctx->Buffer->Depth = NULL;
}
/* allocate new depth buffer, but don't initialize it */
ctx->Buffer->Depth = (GLdepth *) malloc( ctx->Buffer->Width
ctx->Buffer->Depth = (GLdepth *) MALLOC( ctx->Buffer->Width
* ctx->Buffer->Height
* sizeof(GLdepth) );
if (!ctx->Buffer->Depth) {

View File

@@ -1,8 +1,8 @@
/* $Id: depth.h,v 1.1 1999/08/19 00:55:41 jtg Exp $ */
/* $Id: depth.h,v 1.3 1999/11/11 01:22:26 brianp Exp $ */
/*
* Mesa 3-D graphics library
* Version: 3.1
* Version: 3.3
*
* Copyright (C) 1999 Brian Paul All Rights Reserved.
*
@@ -25,9 +25,6 @@
*/
#ifndef DEPTH_H
#define DEPTH_H
@@ -89,10 +86,16 @@ extern void gl_alloc_depth_buffer( GLcontext* ctx );
extern void gl_clear_depth_buffer( GLcontext* ctx );
extern void gl_ClearDepth( GLcontext* ctx, GLclampd depth );
extern void gl_DepthFunc( GLcontext* ctx, GLenum func );
extern void
_mesa_ClearDepth( GLclampd depth );
extern void
_mesa_DepthFunc( GLenum func );
extern void
_mesa_DepthMask( GLboolean flag );
extern void gl_DepthMask( GLcontext* ctx, GLboolean flag );
#endif

View File

@@ -15,11 +15,13 @@ INCDIR = [-.include]
LIBDIR = [-.lib]
CFLAGS = /include=($(INCDIR),[])/define=(FBIND=1)
CORE_SOURCES = accum.c alpha.c alphabuf.c api1.c api2.c apiext.c attrib.c \
CORE_SOURCES = accum.c alpha.c alphabuf.c attrib.c \
bitmap.c blend.c clip.c colortab.c context.c copypix.c depth.c \
dispatch.c \
dlist.c drawpix.c enable.c eval.c feedback.c fog.c \
get.c hash.c image.c light.c lines.c logic.c masking.c matrix.c \
misc.c mmath.c mthreads.c pb.c pixel.c points.c pointers.c polygon.c \
get.c hash.c image.c imaging.c light.c lines.c logic.c masking.c matrix.c \
mem.c glapi.c glapinoop.c \
glmisc.c mmath.c mthreads.c pb.c pixel.c points.c polygon.c \
quads.c rastpos.c readpix.c rect.c scissor.c shade.c span.c \
stencil.c teximage.c texobj.c texstate.c texture.c translate.c triangle.c \
varray.c winpos.c vb.c vbcull.c vbfill.c vbrender.c vbxform.c xform.c \
@@ -37,13 +39,16 @@ DRIVER_SOURCES = [.x]glxapi.c [.x]fakeglx.c [.x]realglx.c [.x]xfonts.c \
ASM_SOURCES =
OBJECTS =\
accum.obj,alpha.obj,alphabuf.obj,api1.obj,api2.obj,apiext.obj,attrib.obj,\
accum.obj,alpha.obj,alphabuf.obj,attrib.obj,\
bitmap.obj,blend.obj,clip.obj,colortab.obj,context.obj,copypix.obj,depth.obj,\
dlist.obj,drawpix.obj,enable.obj,eval.obj,feedback.obj,fog.obj
OBJECTS3=get.obj,hash.obj,image.obj,light.obj,lines.obj,logic.obj,masking.obj,matrix.obj,\
misc.obj,mmath.obj,mthreads.obj,pb.obj,pixel.obj,points.obj,pointers.obj,polygon.obj,\
OBJECTS3=get.obj,hash.obj,image.obj,light.obj,lines.obj,logic.obj,masking.obj,\
matrix.obj,glapi.obj,glapinoop.obj,dispatch.obj,imaging.obj,mem.obj,\
glmisc.obj,mmath.obj,mthreads.obj,pb.obj,pixel.obj,points.obj
OBJECTS7=polygon.obj,\
quads.obj,rastpos.obj,readpix.obj,rect.obj,scissor.obj,shade.obj,span.obj
@@ -71,7 +76,7 @@ VERSION=Mesa V3.1
##### TARGETS #####
# Make the library
$(LIBDIR)$(GL_LIB) : $(OBJECTS),$(OBJECTS2) $(OBJECTS3) $(OBJECTS4)\
$(OBJECTS5) $(OBJECTS6)
$(OBJECTS5) $(OBJECTS7) $(OBJECTS6)
.ifdef SHARE
@ WRITE_ SYS$OUTPUT " generating mesagl1.opt"
@ OPEN_/WRITE FILE mesagl1.opt
@@ -83,6 +88,7 @@ $(LIBDIR)$(GL_LIB) : $(OBJECTS),$(OBJECTS2) $(OBJECTS3) $(OBJECTS4)\
@ WRITE_ FILE "$(OBJECTS)"
@ WRITE_ FILE "$(OBJECTS3)"
@ WRITE_ FILE "$(OBJECTS4)"
@ WRITE_ FILE "$(OBJECTS7)"
@ WRITE_ FILE "$(OBJECTS6)"
@ WRITE_ FILE "$(OBJECTS2)"
@ WRITE_ FILE "$(OBJECTS5)"
@@ -101,6 +107,7 @@ $(LIBDIR)$(GL_LIB) : $(OBJECTS),$(OBJECTS2) $(OBJECTS3) $(OBJECTS4)\
@ library $(GL_LIB) $(OBJECTS3)
@ library $(GL_LIB) $(OBJECTS4)
@ library $(GL_LIB) $(OBJECTS5)
@ library $(GL_LIB) $(OBJECTS7)
@ library $(GL_LIB) $(OBJECTS6)
.endif
@ rename $(GL_LIB)* $(LIBDIR)

546
src/mesa/main/dispatch.c Normal file
View File

@@ -0,0 +1,546 @@
/* $Id: dispatch.c,v 1.1 1999/11/11 01:22:26 brianp Exp $ */
/*
* Mesa 3-D graphics library
* Version: 3.3
*
* 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.
*/
#ifdef PC_HEADER
#include "all.h"
#else
#include "glheader.h"
#include "accum.h"
#include "alpha.h"
#include "attrib.h"
#include "bitmap.h"
#include "blend.h"
#include "clip.h"
#include "context.h"
#include "colortab.h"
#include "copypix.h"
#include "cva.h"
#include "depth.h"
#include "dlist.h"
#include "drawpix.h"
#include "enable.h"
#include "eval.h"
#include "feedback.h"
#include "fog.h"
#include "get.h"
#include "glmisc.h"
#include "imaging.h"
#include "light.h"
#include "lines.h"
#include "logic.h"
#include "masking.h"
#include "matrix.h"
#include "pixel.h"
#include "points.h"
#include "polygon.h"
#include "rastpos.h"
#include "readpix.h"
#include "rect.h"
#include "scissor.h"
#include "stencil.h"
#include "teximage.h"
#include "texobj.h"
#include "texstate.h"
#include "types.h"
#include "varray.h"
#include "vbfill.h"
#include "winpos.h"
#endif
/*
* Initialize the given dispatch table with pointers to Mesa's
* immediate-mode commands.
*/
void
_mesa_init_exec_table(struct _glapi_table *exec)
{
exec->Accum = _mesa_Accum;
exec->AlphaFunc = _mesa_AlphaFunc;
exec->Begin = _mesa_Begin;
exec->Bitmap = _mesa_Bitmap;
exec->BlendFunc = _mesa_BlendFunc;
exec->CallList = _mesa_CallList;
exec->CallLists = _mesa_CallLists;
exec->Clear = _mesa_Clear;
exec->ClearAccum = _mesa_ClearAccum;
exec->ClearColor = _mesa_ClearColor;
exec->ClearDepth = _mesa_ClearDepth;
exec->ClearIndex = _mesa_ClearIndex;
exec->ClearStencil = _mesa_ClearStencil;
exec->ClipPlane = _mesa_ClipPlane;
exec->Color3b = _mesa_Color3b;
exec->Color3bv = _mesa_Color3bv;
exec->Color3d = _mesa_Color3d;
exec->Color3dv = _mesa_Color3dv;
exec->Color3f = _mesa_Color3f;
exec->Color3fv = _mesa_Color3fv;
exec->Color3i = _mesa_Color3i;
exec->Color3iv = _mesa_Color3iv;
exec->Color3s = _mesa_Color3s;
exec->Color3sv = _mesa_Color3sv;
exec->Color3ub = _mesa_Color3ub;
exec->Color3ubv = _mesa_Color3ubv;
exec->Color3ui = _mesa_Color3ui;
exec->Color3uiv = _mesa_Color3uiv;
exec->Color3us = _mesa_Color3us;
exec->Color3usv = _mesa_Color3usv;
exec->Color4b = _mesa_Color4b;
exec->Color4bv = _mesa_Color4bv;
exec->Color4d = _mesa_Color4d;
exec->Color4dv = _mesa_Color4dv;
exec->Color4f = _mesa_Color4f;
exec->Color4fv = _mesa_Color4fv;
exec->Color4i = _mesa_Color4i;
exec->Color4iv = _mesa_Color4iv;
exec->Color4s = _mesa_Color4s;
exec->Color4sv = _mesa_Color4sv;
exec->Color4ub = _mesa_Color4ub;
exec->Color4ubv = _mesa_Color4ubv;
exec->Color4ui = _mesa_Color4ui;
exec->Color4uiv = _mesa_Color4uiv;
exec->Color4us = _mesa_Color4us;
exec->Color4usv = _mesa_Color4usv;
exec->ColorMask = _mesa_ColorMask;
exec->ColorMaterial = _mesa_ColorMaterial;
exec->CopyPixels = _mesa_CopyPixels;
exec->CullFace = _mesa_CullFace;
exec->DeleteLists = _mesa_DeleteLists;
exec->DepthFunc = _mesa_DepthFunc;
exec->DepthMask = _mesa_DepthMask;
exec->DepthRange = _mesa_DepthRange;
exec->Disable = _mesa_Disable;
exec->DrawBuffer = _mesa_DrawBuffer;
exec->DrawPixels = _mesa_DrawPixels;
exec->EdgeFlag = _mesa_EdgeFlag;
exec->EdgeFlagv = _mesa_EdgeFlagv;
exec->Enable = _mesa_Enable;
exec->End = _mesa_End;
exec->EndList = _mesa_EndList;
exec->EvalCoord1d = _mesa_EvalCoord1d;
exec->EvalCoord1dv = _mesa_EvalCoord1dv;
exec->EvalCoord1f = _mesa_EvalCoord1f;
exec->EvalCoord1fv = _mesa_EvalCoord1fv;
exec->EvalCoord2d = _mesa_EvalCoord2d;
exec->EvalCoord2dv = _mesa_EvalCoord2dv;
exec->EvalCoord2f = _mesa_EvalCoord2f;
exec->EvalCoord2fv = _mesa_EvalCoord2fv;
exec->EvalMesh1 = _mesa_EvalMesh1;
exec->EvalMesh2 = _mesa_EvalMesh2;
exec->EvalPoint1 = _mesa_EvalPoint1;
exec->EvalPoint2 = _mesa_EvalPoint2;
exec->FeedbackBuffer = _mesa_FeedbackBuffer;
exec->Finish = _mesa_Finish;
exec->Flush = _mesa_Flush;
exec->Fogf = _mesa_Fogf;
exec->Fogfv = _mesa_Fogfv;
exec->Fogi = _mesa_Fogi;
exec->Fogiv = _mesa_Fogiv;
exec->FrontFace = _mesa_FrontFace;
exec->Frustum = _mesa_Frustum;
exec->GenLists = _mesa_GenLists;
exec->GetBooleanv = _mesa_GetBooleanv;
exec->GetClipPlane = _mesa_GetClipPlane;
exec->GetDoublev = _mesa_GetDoublev;
exec->GetError = _mesa_GetError;
exec->GetFloatv = _mesa_GetFloatv;
exec->GetIntegerv = _mesa_GetIntegerv;
exec->GetLightfv = _mesa_GetLightfv;
exec->GetLightiv = _mesa_GetLightiv;
exec->GetMapdv = _mesa_GetMapdv;
exec->GetMapfv = _mesa_GetMapfv;
exec->GetMapiv = _mesa_GetMapiv;
exec->GetMaterialfv = _mesa_GetMaterialfv;
exec->GetMaterialiv = _mesa_GetMaterialiv;
exec->GetPixelMapfv = _mesa_GetPixelMapfv;
exec->GetPixelMapuiv = _mesa_GetPixelMapuiv;
exec->GetPixelMapusv = _mesa_GetPixelMapusv;
exec->GetPolygonStipple = _mesa_GetPolygonStipple;
exec->GetString = _mesa_GetString;
exec->GetTexEnvfv = _mesa_GetTexEnvfv;
exec->GetTexEnviv = _mesa_GetTexEnviv;
exec->GetTexGendv = _mesa_GetTexGendv;
exec->GetTexGenfv = _mesa_GetTexGenfv;
exec->GetTexGeniv = _mesa_GetTexGeniv;
exec->GetTexImage = _mesa_GetTexImage;
exec->GetTexLevelParameterfv = _mesa_GetTexLevelParameterfv;
exec->GetTexLevelParameteriv = _mesa_GetTexLevelParameteriv;
exec->GetTexParameterfv = _mesa_GetTexParameterfv;
exec->GetTexParameteriv = _mesa_GetTexParameteriv;
exec->Hint = _mesa_Hint;
exec->IndexMask = _mesa_IndexMask;
exec->Indexd = _mesa_Indexd;
exec->Indexdv = _mesa_Indexdv;
exec->Indexf = _mesa_Indexf;
exec->Indexfv = _mesa_Indexfv;
exec->Indexi = _mesa_Indexi;
exec->Indexiv = _mesa_Indexiv;
exec->Indexs = _mesa_Indexs;
exec->Indexsv = _mesa_Indexsv;
exec->InitNames = _mesa_InitNames;
exec->IsEnabled = _mesa_IsEnabled;
exec->IsList = _mesa_IsList;
exec->LightModelf = _mesa_LightModelf;
exec->LightModelfv = _mesa_LightModelfv;
exec->LightModeli = _mesa_LightModeli;
exec->LightModeliv = _mesa_LightModeliv;
exec->Lightf = _mesa_Lightf;
exec->Lightfv = _mesa_Lightfv;
exec->Lighti = _mesa_Lighti;
exec->Lightiv = _mesa_Lightiv;
exec->LineStipple = _mesa_LineStipple;
exec->LineWidth = _mesa_LineWidth;
exec->ListBase = _mesa_ListBase;
exec->LoadIdentity = _mesa_LoadIdentity;
exec->LoadMatrixd = _mesa_LoadMatrixd;
exec->LoadMatrixf = _mesa_LoadMatrixf;
exec->LoadName = _mesa_LoadName;
exec->LogicOp = _mesa_LogicOp;
exec->Map1d = _mesa_Map1d;
exec->Map1f = _mesa_Map1f;
exec->Map2d = _mesa_Map2d;
exec->Map2f = _mesa_Map2f;
exec->MapGrid1d = _mesa_MapGrid1d;
exec->MapGrid1f = _mesa_MapGrid1f;
exec->MapGrid2d = _mesa_MapGrid2d;
exec->MapGrid2f = _mesa_MapGrid2f;
exec->Materialf = _mesa_Materialf;
exec->Materialfv = _mesa_Materialfv;
exec->Materiali = _mesa_Materiali;
exec->Materialiv = _mesa_Materialiv;
exec->MatrixMode = _mesa_MatrixMode;
exec->MultMatrixd = _mesa_MultMatrixd;
exec->MultMatrixf = _mesa_MultMatrixf;
exec->NewList = _mesa_NewList;
exec->Normal3b = _mesa_Normal3b;
exec->Normal3bv = _mesa_Normal3bv;
exec->Normal3d = _mesa_Normal3d;
exec->Normal3dv = _mesa_Normal3dv;
exec->Normal3f = _mesa_Normal3f;
exec->Normal3fv = _mesa_Normal3fv;
exec->Normal3i = _mesa_Normal3i;
exec->Normal3iv = _mesa_Normal3iv;
exec->Normal3s = _mesa_Normal3s;
exec->Normal3sv = _mesa_Normal3sv;
exec->Ortho = _mesa_Ortho;
exec->PassThrough = _mesa_PassThrough;
exec->PixelMapfv = _mesa_PixelMapfv;
exec->PixelMapuiv = _mesa_PixelMapuiv;
exec->PixelMapusv = _mesa_PixelMapusv;
exec->PixelStoref = _mesa_PixelStoref;
exec->PixelStorei = _mesa_PixelStorei;
exec->PixelTransferf = _mesa_PixelTransferf;
exec->PixelTransferi = _mesa_PixelTransferi;
exec->PixelZoom = _mesa_PixelZoom;
exec->PointSize = _mesa_PointSize;
exec->PolygonMode = _mesa_PolygonMode;
exec->PolygonOffset = _mesa_PolygonOffset;
exec->PolygonStipple = _mesa_PolygonStipple;
exec->PopAttrib = _mesa_PopAttrib;
exec->PopMatrix = _mesa_PopMatrix;
exec->PopName = _mesa_PopName;
exec->PushAttrib = _mesa_PushAttrib;
exec->PushMatrix = _mesa_PushMatrix;
exec->PushName = _mesa_PushName;
exec->RasterPos2d = _mesa_RasterPos2d;
exec->RasterPos2dv = _mesa_RasterPos2dv;
exec->RasterPos2f = _mesa_RasterPos2f;
exec->RasterPos2fv = _mesa_RasterPos2fv;
exec->RasterPos2i = _mesa_RasterPos2i;
exec->RasterPos2iv = _mesa_RasterPos2iv;
exec->RasterPos2s = _mesa_RasterPos2s;
exec->RasterPos2sv = _mesa_RasterPos2sv;
exec->RasterPos3d = _mesa_RasterPos3d;
exec->RasterPos3dv = _mesa_RasterPos3dv;
exec->RasterPos3f = _mesa_RasterPos3f;
exec->RasterPos3fv = _mesa_RasterPos3fv;
exec->RasterPos3i = _mesa_RasterPos3i;
exec->RasterPos3iv = _mesa_RasterPos3iv;
exec->RasterPos3s = _mesa_RasterPos3s;
exec->RasterPos3sv = _mesa_RasterPos3sv;
exec->RasterPos4d = _mesa_RasterPos4d;
exec->RasterPos4dv = _mesa_RasterPos4dv;
exec->RasterPos4f = _mesa_RasterPos4f;
exec->RasterPos4fv = _mesa_RasterPos4fv;
exec->RasterPos4i = _mesa_RasterPos4i;
exec->RasterPos4iv = _mesa_RasterPos4iv;
exec->RasterPos4s = _mesa_RasterPos4s;
exec->RasterPos4sv = _mesa_RasterPos4sv;
exec->ReadBuffer = _mesa_ReadBuffer;
exec->ReadPixels = _mesa_ReadPixels;
exec->Rectd = _mesa_Rectd;
exec->Rectdv = _mesa_Rectdv;
exec->Rectf = _mesa_Rectf;
exec->Rectfv = _mesa_Rectfv;
exec->Recti = _mesa_Recti;
exec->Rectiv = _mesa_Rectiv;
exec->Rects = _mesa_Rects;
exec->Rectsv = _mesa_Rectsv;
exec->RenderMode = _mesa_RenderMode;
exec->Rotated = _mesa_Rotated;
exec->Rotatef = _mesa_Rotatef;
exec->Scaled = _mesa_Scaled;
exec->Scalef = _mesa_Scalef;
exec->Scissor = _mesa_Scissor;
exec->SelectBuffer = _mesa_SelectBuffer;
exec->ShadeModel = _mesa_ShadeModel;
exec->StencilFunc = _mesa_StencilFunc;
exec->StencilMask = _mesa_StencilMask;
exec->StencilOp = _mesa_StencilOp;
exec->TexCoord1d = _mesa_TexCoord1d;
exec->TexCoord1dv = _mesa_TexCoord1dv;
exec->TexCoord1f = _mesa_TexCoord1f;
exec->TexCoord1fv = _mesa_TexCoord1fv;
exec->TexCoord1i = _mesa_TexCoord1i;
exec->TexCoord1iv = _mesa_TexCoord1iv;
exec->TexCoord1s = _mesa_TexCoord1s;
exec->TexCoord1sv = _mesa_TexCoord1sv;
exec->TexCoord2d = _mesa_TexCoord2d;
exec->TexCoord2dv = _mesa_TexCoord2dv;
exec->TexCoord2f = _mesa_TexCoord2f;
exec->TexCoord2fv = _mesa_TexCoord2fv;
exec->TexCoord2i = _mesa_TexCoord2i;
exec->TexCoord2iv = _mesa_TexCoord2iv;
exec->TexCoord2s = _mesa_TexCoord2s;
exec->TexCoord2sv = _mesa_TexCoord2sv;
exec->TexCoord3d = _mesa_TexCoord3d;
exec->TexCoord3dv = _mesa_TexCoord3dv;
exec->TexCoord3f = _mesa_TexCoord3f;
exec->TexCoord3fv = _mesa_TexCoord3fv;
exec->TexCoord3i = _mesa_TexCoord3i;
exec->TexCoord3iv = _mesa_TexCoord3iv;
exec->TexCoord3s = _mesa_TexCoord3s;
exec->TexCoord3sv = _mesa_TexCoord3sv;
exec->TexCoord4d = _mesa_TexCoord4d;
exec->TexCoord4dv = _mesa_TexCoord4dv;
exec->TexCoord4f = _mesa_TexCoord4f;
exec->TexCoord4fv = _mesa_TexCoord4fv;
exec->TexCoord4i = _mesa_TexCoord4i;
exec->TexCoord4iv = _mesa_TexCoord4iv;
exec->TexCoord4s = _mesa_TexCoord4s;
exec->TexCoord4sv = _mesa_TexCoord4sv;
exec->TexEnvf = _mesa_TexEnvf;
exec->TexEnvfv = _mesa_TexEnvfv;
exec->TexEnvi = _mesa_TexEnvi;
exec->TexEnviv = _mesa_TexEnviv;
exec->TexGend = _mesa_TexGend;
exec->TexGendv = _mesa_TexGendv;
exec->TexGenf = _mesa_TexGenf;
exec->TexGenfv = _mesa_TexGenfv;
exec->TexGeni = _mesa_TexGeni;
exec->TexGeniv = _mesa_TexGeniv;
exec->TexImage1D = _mesa_TexImage1D;
exec->TexImage2D = _mesa_TexImage2D;
exec->TexParameterf = _mesa_TexParameterf;
exec->TexParameterfv = _mesa_TexParameterfv;
exec->TexParameteri = _mesa_TexParameteri;
exec->TexParameteriv = _mesa_TexParameteriv;
exec->Translated = _mesa_Translated;
exec->Translatef = _mesa_Translatef;
exec->Vertex2d = _mesa_Vertex2d;
exec->Vertex2dv = _mesa_Vertex2dv;
exec->Vertex2f = _mesa_Vertex2f;
exec->Vertex2fv = _mesa_Vertex2fv;
exec->Vertex2i = _mesa_Vertex2i;
exec->Vertex2iv = _mesa_Vertex2iv;
exec->Vertex2s = _mesa_Vertex2s;
exec->Vertex2sv = _mesa_Vertex2sv;
exec->Vertex3d = _mesa_Vertex3d;
exec->Vertex3dv = _mesa_Vertex3dv;
exec->Vertex3f = _mesa_Vertex3f;
exec->Vertex3fv = _mesa_Vertex3fv;
exec->Vertex3i = _mesa_Vertex3i;
exec->Vertex3iv = _mesa_Vertex3iv;
exec->Vertex3s = _mesa_Vertex3s;
exec->Vertex3sv = _mesa_Vertex3sv;
exec->Vertex4d = _mesa_Vertex4d;
exec->Vertex4dv = _mesa_Vertex4dv;
exec->Vertex4f = _mesa_Vertex4f;
exec->Vertex4fv = _mesa_Vertex4fv;
exec->Vertex4i = _mesa_Vertex4i;
exec->Vertex4iv = _mesa_Vertex4iv;
exec->Vertex4s = _mesa_Vertex4s;
exec->Vertex4sv = _mesa_Vertex4sv;
exec->Viewport = _mesa_Viewport;
#ifdef _GLAPI_VERSION_1_1
exec->AreTexturesResident = _mesa_AreTexturesResident;
exec->ArrayElement = _mesa_ArrayElement;
exec->BindTexture = _mesa_BindTexture;
exec->ColorPointer = _mesa_ColorPointer;
exec->CopyTexImage1D = _mesa_CopyTexImage1D;
exec->CopyTexImage2D = _mesa_CopyTexImage2D;
exec->CopyTexSubImage1D = _mesa_CopyTexSubImage1D;
exec->CopyTexSubImage2D = _mesa_CopyTexSubImage2D;
exec->DeleteTextures = _mesa_DeleteTextures;
exec->DisableClientState = _mesa_DisableClientState;
exec->DrawArrays = _mesa_DrawArrays;
exec->DrawElements = _mesa_DrawElements;
exec->EdgeFlagPointer = _mesa_EdgeFlagPointer;
exec->EnableClientState = _mesa_EnableClientState;
exec->GenTextures = _mesa_GenTextures;
exec->GetPointerv = _mesa_GetPointerv;
exec->IndexPointer = _mesa_IndexPointer;
exec->Indexub = _mesa_Indexub;
exec->Indexubv = _mesa_Indexubv;
exec->InterleavedArrays = _mesa_InterleavedArrays;
exec->IsTexture = _mesa_IsTexture;
exec->NormalPointer = _mesa_NormalPointer;
exec->PopClientAttrib = _mesa_PopClientAttrib;
exec->PrioritizeTextures = _mesa_PrioritizeTextures;
exec->PushClientAttrib = _mesa_PushClientAttrib;
exec->TexCoordPointer = _mesa_TexCoordPointer;
exec->TexSubImage1D = _mesa_TexSubImage1D;
exec->TexSubImage2D = _mesa_TexSubImage2D;
exec->VertexPointer = _mesa_VertexPointer;
#endif
#ifdef _GLAPI_VERSION_1_2
exec->CopyTexSubImage3D = _mesa_CopyTexSubImage3D;
exec->DrawRangeElements = _mesa_DrawRangeElements;
exec->TexImage3D = _mesa_TexImage3D;
exec->TexSubImage3D = _mesa_TexSubImage3D;
#endif
/* OpenGL 1.2 GL_ARB_imaging */
#ifdef _GLAPI_ARB_imaging
exec->BlendColor = _mesa_BlendColor;
exec->BlendEquation = _mesa_BlendEquation;
exec->ColorSubTable = _mesa_ColorSubTable;
exec->ColorTable = _mesa_ColorTable;
exec->ColorTableParameterfv = _mesa_ColorTableParameterfv;
exec->ColorTableParameteriv = _mesa_ColorTableParameteriv;
exec->ConvolutionFilter1D = _mesa_ConvolutionFilter1D;
exec->ConvolutionFilter2D = _mesa_ConvolutionFilter2D;
exec->ConvolutionParameterf = _mesa_ConvolutionParameterf;
exec->ConvolutionParameterfv = _mesa_ConvolutionParameterfv;
exec->ConvolutionParameteri = _mesa_ConvolutionParameteri;
exec->ConvolutionParameteriv = _mesa_ConvolutionParameteriv;
exec->CopyColorSubTable = _mesa_CopyColorSubTable;
exec->CopyColorTable = _mesa_CopyColorTable;
exec->CopyConvolutionFilter1D = _mesa_CopyConvolutionFilter1D;
exec->CopyConvolutionFilter2D = _mesa_CopyConvolutionFilter2D;
exec->GetColorTable = _mesa_GetColorTable;
exec->GetColorTableParameterfv = _mesa_GetColorTableParameterfv;
exec->GetColorTableParameteriv = _mesa_GetColorTableParameteriv;
exec->GetConvolutionFilter = _mesa_GetConvolutionFilter;
exec->GetConvolutionParameterfv = _mesa_GetConvolutionParameterfv;
exec->GetConvolutionParameteriv = _mesa_GetConvolutionParameteriv;
exec->GetHistogram = _mesa_GetHistogram;
exec->GetHistogramParameterfv = _mesa_GetHistogramParameterfv;
exec->GetHistogramParameteriv = _mesa_GetHistogramParameteriv;
exec->GetMinmax = _mesa_GetMinmax;
exec->GetMinmaxParameterfv = _mesa_GetMinmaxParameterfv;
exec->GetMinmaxParameteriv = _mesa_GetMinmaxParameteriv;
exec->GetSeparableFilter = _mesa_GetSeparableFilter;
exec->Histogram = _mesa_Histogram;
exec->Minmax = _mesa_Minmax;
exec->ResetHistogram = _mesa_ResetHistogram;
exec->ResetMinmax = _mesa_ResetMinmax;
exec->SeparableFilter2D = _mesa_SeparableFilter2D;
#endif
#ifdef _GLAPI_EXT_color_table
exec->ColorTableEXT = _mesa_ColorTable;
exec->ColorSubTableEXT = _mesa_ColorSubTable;
exec->GetColorTableEXT = _mesa_GetColorTable;
exec->GetColorTableParameterfvEXT = _mesa_GetColorTableParameterfv;
exec->GetColorTableParameterivEXT = _mesa_GetColorTableParameteriv;
#endif
#ifdef _GLAPI_EXT_compiled_vertex_array
exec->LockArraysEXT = _mesa_LockArraysEXT;
exec->UnlockArraysEXT = _mesa_UnlockArraysEXT;
#endif
#ifdef _GLAPI_EXT_point_parameters
exec->PointParameterfEXT = _mesa_PointParameterfEXT;
exec->PointParameterfvEXT = _mesa_PointParameterfvEXT;
#endif
#ifdef _GLAPI_EXT_polygon_offset
exec->PolygonOffsetEXT = _mesa_PolygonOffsetEXT;
#endif
#ifdef _GLAPI_EXT_blend_minmax
exec->BlendEquationEXT = _mesa_BlendEquationEXT;
#endif
#ifdef _GLAPI_EXT_blend_color
exec->BlendColorEXT = _mesa_BlendColorEXT;
#endif
#ifdef _GLAPI_ARB_multitexture
exec->ActiveTextureARB = _mesa_ActiveTextureARB;
exec->ClientActiveTextureARB = _mesa_ClientActiveTextureARB;
exec->MultiTexCoord1dARB = _mesa_MultiTexCoord1dARB;
exec->MultiTexCoord1dvARB = _mesa_MultiTexCoord1dvARB;
exec->MultiTexCoord1fARB = _mesa_MultiTexCoord1fARB;
exec->MultiTexCoord1fvARB = _mesa_MultiTexCoord1fvARB;
exec->MultiTexCoord1iARB = _mesa_MultiTexCoord1iARB;
exec->MultiTexCoord1ivARB = _mesa_MultiTexCoord1ivARB;
exec->MultiTexCoord1sARB = _mesa_MultiTexCoord1sARB;
exec->MultiTexCoord1svARB = _mesa_MultiTexCoord1svARB;
exec->MultiTexCoord2dARB = _mesa_MultiTexCoord2dARB;
exec->MultiTexCoord2dvARB = _mesa_MultiTexCoord2dvARB;
exec->MultiTexCoord2fARB = _mesa_MultiTexCoord2fARB;
exec->MultiTexCoord2fvARB = _mesa_MultiTexCoord2fvARB;
exec->MultiTexCoord2iARB = _mesa_MultiTexCoord2iARB;
exec->MultiTexCoord2ivARB = _mesa_MultiTexCoord2ivARB;
exec->MultiTexCoord2sARB = _mesa_MultiTexCoord2sARB;
exec->MultiTexCoord2svARB = _mesa_MultiTexCoord2svARB;
exec->MultiTexCoord3dARB = _mesa_MultiTexCoord3dARB;
exec->MultiTexCoord3dvARB = _mesa_MultiTexCoord3dvARB;
exec->MultiTexCoord3fARB = _mesa_MultiTexCoord3fARB;
exec->MultiTexCoord3fvARB = _mesa_MultiTexCoord3fvARB;
exec->MultiTexCoord3iARB = _mesa_MultiTexCoord3iARB;
exec->MultiTexCoord3ivARB = _mesa_MultiTexCoord3ivARB;
exec->MultiTexCoord3sARB = _mesa_MultiTexCoord3sARB;
exec->MultiTexCoord3svARB = _mesa_MultiTexCoord3svARB;
exec->MultiTexCoord4dARB = _mesa_MultiTexCoord4dARB;
exec->MultiTexCoord4dvARB = _mesa_MultiTexCoord4dvARB;
exec->MultiTexCoord4fARB = _mesa_MultiTexCoord4fARB;
exec->MultiTexCoord4fvARB = _mesa_MultiTexCoord4fvARB;
exec->MultiTexCoord4iARB = _mesa_MultiTexCoord4iARB;
exec->MultiTexCoord4ivARB = _mesa_MultiTexCoord4ivARB;
exec->MultiTexCoord4sARB = _mesa_MultiTexCoord4sARB;
exec->MultiTexCoord4svARB = _mesa_MultiTexCoord4svARB;
#endif
#ifdef _GLAPI_INGR_blend_func_separate
exec->BlendFuncSeparateINGR = _mesa_BlendFuncSeparateINGR;
#endif
#ifdef _GLAPI_MESA_window_pos
exec->WindowPos4fMESA = _mesa_WindowPos4fMESA;
#endif
#ifdef _GLAPI_MESA_resize_buffers
exec->ResizeBuffersMESA = _mesa_ResizeBuffersMESA;
#endif
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,4 +1,4 @@
/* $Id: dlist.h,v 1.1 1999/08/19 00:55:41 jtg Exp $ */
/* $Id: dlist.h,v 1.2 1999/11/11 01:22:26 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -51,24 +51,23 @@ extern void gl_init_lists( void );
extern void gl_destroy_list( GLcontext *ctx, GLuint list );
extern void gl_CallList( GLcontext *ctx, GLuint list );
extern void _mesa_CallList( GLuint list );
extern void gl_CallLists( GLcontext *ctx,
GLsizei n, GLenum type, const GLvoid *lists );
extern void _mesa_CallLists( GLsizei n, GLenum type, const GLvoid *lists );
extern void gl_DeleteLists( GLcontext *ctx, GLuint list, GLsizei range );
extern void _mesa_DeleteLists( GLuint list, GLsizei range );
extern void gl_EndList( GLcontext *ctx );
extern void _mesa_EndList( void );
extern GLuint gl_GenLists( GLcontext *ctx, GLsizei range );
extern GLuint _mesa_GenLists( GLsizei range );
extern GLboolean gl_IsList( GLcontext *ctx, GLuint list );
extern GLboolean _mesa_IsList( GLuint list );
extern void gl_ListBase( GLcontext *ctx, GLuint base );
extern void _mesa_ListBase( GLuint base );
extern void gl_NewList( GLcontext *ctx, GLuint list, GLenum mode );
extern void _mesa_NewList( GLuint list, GLenum mode );
extern void gl_init_dlist_pointers( struct gl_api_table *table );
extern void _mesa_init_dlist_table( struct _glapi_table *table );
extern void gl_compile_cassette( GLcontext *ctx );

View File

@@ -1,4 +1,4 @@
/* $Id: drawpix.c,v 1.2 1999/09/18 20:41:22 keithw Exp $ */
/* $Id: drawpix.c,v 1.5.2.1 1999/11/26 16:28:03 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -31,9 +31,13 @@
#ifdef PC_HEADER
#include "all.h"
#else
#ifndef XFree86Server
#include <assert.h>
#include <stdlib.h>
#include <string.h>
#else
#include "GL/xf86glx.h"
#endif
#include "context.h"
#include "drawpix.h"
#include "feedback.h"
@@ -45,9 +49,6 @@
#include "stencil.h"
#include "types.h"
#include "zoom.h"
#ifdef XFree86Server
#include "GL/xf86glx.h"
#endif
#endif
@@ -394,7 +395,7 @@ static void draw_index_pixels( GLcontext *ctx, GLint x, GLint y,
widthInBytes = width;
/* Fragment depth values */
if (ctx->Depth.Test) {
if (ctx->Depth.Test || ctx->Fog.Enabled) {
GLdepth zval = (GLdepth) (ctx->Current.RasterPos[2] * DEPTH_SCALE);
for (i=0;i<width;i++) {
zspan[i] = zval;
@@ -483,6 +484,18 @@ static void draw_stencil_pixels( GLcontext *ctx, GLint x, GLint y,
GLint i;
const GLboolean zoom = ctx->Pixel.ZoomX!=1.0 || ctx->Pixel.ZoomY!=1.0;
if (image->Type != GL_BYTE &&
image->Type != GL_UNSIGNED_BYTE &&
image->Type != GL_SHORT &&
image->Type != GL_UNSIGNED_SHORT &&
image->Type != GL_INT &&
image->Type != GL_UNSIGNED_INT &&
image->Type != GL_FLOAT &&
image->Type != GL_BITMAP) {
gl_error( ctx, GL_INVALID_OPERATION, "glDrawPixels(stencil type)");
return;
}
assert(image);
assert(image->Format == GL_STENCIL_INDEX);
assert(image->Type == GL_UNSIGNED_BYTE || image->Type == GL_BITMAP);
@@ -728,7 +741,7 @@ static void draw_rgba_pixels( GLcontext *ctx, GLint x, GLint y,
height = image->Height;
/* Fragment depth values */
if (ctx->Depth.Test) {
if (ctx->Depth.Test || ctx->Fog.Enabled) {
/* fill in array of z values */
GLdepth z = (GLdepth) (ctx->Current.RasterPos[2] * DEPTH_SCALE);
for (i=0;i<width;i++) {

View File

@@ -1,8 +1,8 @@
/* $Id: drawpix.h,v 1.1 1999/08/19 00:55:41 jtg Exp $ */
/* $Id: drawpix.h,v 1.2 1999/11/11 01:22:26 brianp Exp $ */
/*
* Mesa 3-D graphics library
* Version: 3.1
* Version: 3.3
*
* Copyright (C) 1999 Brian Paul All Rights Reserved.
*
@@ -25,9 +25,6 @@
*/
#ifndef DRAWPIXELS_H
#define DRAWPIXELS_H
@@ -35,20 +32,9 @@
#include "types.h"
extern GLboolean
gl_direct_DrawPixels( GLcontext *ctx,
const struct gl_pixelstore_attrib *unpack,
GLsizei width, GLsizei height,
GLenum format, GLenum type, const GLvoid *pixels );
#if 000
extern void gl_DrawPixels( GLcontext *ctx, GLsizei width, GLsizei height,
GLenum format, GLenum type, const GLvoid *pixels );
#endif
extern void gl_DrawPixels( GLcontext *ctx, struct gl_image *image );
extern void
_mesa_DrawPixels( GLsizei width, GLsizei height,
GLenum format, GLenum type, const GLvoid *pixels );
#endif

View File

@@ -1,8 +1,8 @@
/* $Id: enable.c,v 1.5 1999/09/18 20:41:23 keithw Exp $ */
/* $Id: enable.c,v 1.10 1999/11/11 01:22:26 brianp Exp $ */
/*
* Mesa 3-D graphics library
* Version: 3.1
* Version: 3.3
*
* Copyright (C) 1999 Brian Paul All Rights Reserved.
*
@@ -28,8 +28,7 @@
#ifdef PC_HEADER
#include "all.h"
#else
#include <string.h>
#include <stdio.h>
#include "glheader.h"
#include "context.h"
#include "enable.h"
#include "light.h"
@@ -41,9 +40,6 @@
#include "vbfill.h"
#include "xform.h"
#include "enums.h"
#ifdef XFree86Server
#include "GL/xf86glx.h"
#endif
#endif
@@ -51,7 +47,7 @@
/*
* Perform glEnable and glDisable calls.
*/
void gl_set_enable( GLcontext *ctx, GLenum cap, GLboolean state )
void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state )
{
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH( ctx, "gl_enable/disable" );
@@ -120,6 +116,8 @@ void gl_set_enable( GLcontext *ctx, GLenum cap, GLboolean state )
if (ctx->Light.ColorMaterialEnabled!=state) {
ctx->Light.ColorMaterialEnabled = state;
ctx->NewState |= NEW_LIGHTING;
if (state)
gl_update_color_material( ctx, ctx->Current.ByteColor );
}
break;
case GL_CULL_FACE:
@@ -186,7 +184,7 @@ void gl_set_enable( GLcontext *ctx, GLenum cap, GLboolean state )
if (ctx->Light.Enabled!=state) {
ctx->Light.Enabled = state;
ctx->Enabled &= ~ENABLE_LIGHT;
if (state && !is_empty_list(&ctx->Light.EnabledList))
if (state)
ctx->Enabled |= ENABLE_LIGHT;
ctx->NewState |= NEW_LIGHTING;
}
@@ -473,22 +471,28 @@ void gl_set_enable( GLcontext *ctx, GLenum cap, GLboolean state )
void gl_Enable( GLcontext* ctx, GLenum cap )
void
_mesa_Enable( GLenum cap )
{
gl_set_enable( ctx, cap, GL_TRUE );
GET_CURRENT_CONTEXT(ctx);
_mesa_set_enable( ctx, cap, GL_TRUE );
}
void gl_Disable( GLcontext* ctx, GLenum cap )
void
_mesa_Disable( GLenum cap )
{
gl_set_enable( ctx, cap, GL_FALSE );
GET_CURRENT_CONTEXT(ctx);
_mesa_set_enable( ctx, cap, GL_FALSE );
}
GLboolean gl_IsEnabled( GLcontext* ctx, GLenum cap )
GLboolean
_mesa_IsEnabled( GLenum cap )
{
GET_CURRENT_CONTEXT(ctx);
switch (cap) {
case GL_ALPHA_TEST:
return ctx->Color.AlphaEnabled;
@@ -651,7 +655,8 @@ GLboolean gl_IsEnabled( GLcontext* ctx, GLenum cap )
static void gl_client_state( GLcontext *ctx, GLenum cap, GLboolean state )
static void
client_state( GLcontext *ctx, GLenum cap, GLboolean state )
{
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH( ctx,
(state
@@ -686,15 +691,19 @@ static void gl_client_state( GLcontext *ctx, GLenum cap, GLboolean state )
void gl_EnableClientState( GLcontext *ctx, GLenum cap )
void
_mesa_EnableClientState( GLenum cap )
{
gl_client_state( ctx, cap, GL_TRUE );
GET_CURRENT_CONTEXT(ctx);
client_state( ctx, cap, GL_TRUE );
}
void gl_DisableClientState( GLcontext *ctx, GLenum cap )
void
_mesa_DisableClientState( GLenum cap )
{
gl_client_state( ctx, cap, GL_FALSE );
GET_CURRENT_CONTEXT(ctx);
client_state( ctx, cap, GL_FALSE );
}

View File

@@ -1,8 +1,8 @@
/* $Id: enable.h,v 1.1 1999/08/19 00:55:41 jtg Exp $ */
/* $Id: enable.h,v 1.2 1999/11/11 01:22:26 brianp Exp $ */
/*
* Mesa 3-D graphics library
* Version: 3.1
* Version: 3.3
*
* Copyright (C) 1999 Brian Paul All Rights Reserved.
*
@@ -25,9 +25,6 @@
*/
#ifndef ENABLE_H
#define ENABLE_H
@@ -35,17 +32,23 @@
#include "types.h"
extern void gl_set_enable( GLcontext* ctx, GLenum cap, GLboolean state );
extern void
_mesa_set_enable( GLcontext* ctx, GLenum cap, GLboolean state );
extern void gl_Disable( GLcontext* ctx, GLenum cap );
extern void
_mesa_Disable( GLenum cap );
extern void gl_Enable( GLcontext* ctx, GLenum cap );
extern void
_mesa_Enable( GLenum cap );
extern GLboolean gl_IsEnabled( GLcontext* ctx, GLenum cap );
extern GLboolean
_mesa_IsEnabled( GLenum cap );
extern void gl_EnableClientState( GLcontext *ctx, GLenum cap );
extern void
_mesa_EnableClientState( GLenum cap );
extern void gl_DisableClientState( GLcontext *ctx, GLenum cap );
extern void
_mesa_DisableClientState( GLenum cap );
#endif

View File

@@ -1,8 +1,8 @@
/* $Id: enums.c,v 1.1 1999/08/19 00:55:41 jtg Exp $ */
/* $Id: enums.c,v 1.5 1999/11/11 01:22:26 brianp Exp $ */
/*
* Mesa 3-D graphics library
* Version: 3.1
* Version: 3.3
*
* Copyright (C) 1999 Brian Paul All Rights Reserved.
*
@@ -25,10 +25,13 @@
*/
#include "GL/gl.h"
#ifdef PC_HEADER
#include "all.h"
#else
#include "glheader.h"
#include "enums.h"
#include <stdlib.h>
#include <string.h>
#include "mem.h"
#endif
typedef struct {
@@ -824,7 +827,7 @@ static int compar_nr( const enum_elt **a, const enum_elt **b )
static void sort_enums( void )
{
int i;
index1 = (enum_elt **)malloc( Elements(all_enums) * sizeof(enum_elt *) );
index1 = (enum_elt **)MALLOC( Elements(all_enums) * sizeof(enum_elt *) );
sorted = 1;
qsort( all_enums, Elements(all_enums), sizeof(*all_enums),

File diff suppressed because it is too large Load Diff

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