Compare commits

...

1149 Commits

Author SHA1 Message Date
Brian Paul
e5c8261f76 added Glide/Quake bug fix item 2000-11-03 02:39:00 +00:00
Brian Paul
57db1be417 fixed glXChooseVisual to return NULL if using Glide and user requests too deep of visual parameters 2000-11-03 02:35:54 +00:00
Brian Paul
ebeb5da82c fixed Glide link problem 2000-11-03 01:58:06 +00:00
Brian Paul
bd1b6ef5af added some missing backslashes 2000-11-03 01:35:30 +00:00
Brian Paul
672da3532f bumped version numbers to 3.4 2000-11-02 18:05:34 +00:00
Brian Paul
554cd6ba8c bumped version to 3.4 2000-11-02 17:59:43 +00:00
Brian Paul
585b358204 added vertex fog bug fix 2000-11-01 20:58:35 +00:00
Brian Paul
1a87813f14 added GLUT projtex demo bug fix 2000-10-31 20:01:16 +00:00
Brian Paul
fab2936ea2 sync with DRI texgen and texture matrix bug fixes 2000-10-31 19:57:39 +00:00
Gareth Hughes
510d86231d Change animated apps to double-buffered visuals by default. 2000-10-27 02:53:29 +00:00
Brian Paul
183e09ee42 added gluBuild[12]DMipmaps GL_BGR fix 2000-10-26 21:57:29 +00:00
Brian Paul
feb83f991e added GL_BGR case to bytes_per_pixel() 2000-10-26 21:48:37 +00:00
Brian Paul
5c4f8bdfc7 removed X86/*.m4 files from tar archive 2000-10-26 19:35:53 +00:00
Brian Paul
16deaa9c49 fixed value for GLU_NURBS_MODE 2000-10-26 15:32:46 +00:00
Brian Paul
12dbb90d4a added a glFinish() call 2000-10-26 15:26:27 +00:00
Brian Paul
0bf5284850 added incomplete() debug function/macro 2000-10-24 02:52:36 +00:00
Brian Paul
e3650179c6 signal NEW_TEXTURING if there's a Driver.BindTexture() function 2000-10-24 01:14:16 +00:00
Brian Paul
c089afb55b sync with Mesa 3.5 2000-10-23 20:07:57 +00:00
Brian Paul
bfaab253d1 fixed 386/x86 mismatches, reordered a few configs 2000-10-23 19:38:26 +00:00
Gareth Hughes
4c782b7470 Major audit of all Mesa's x86 assembly code. This round is basically
general cleanups - more to come.

Added P6 architecture timing to debug_xform routines.  Still need to add
test_all_vertex_functions test for the v16 asm.  Dynamic reconfiguration
of counter overhead for more accurate benchmarking.
2000-10-22 23:10:48 +00:00
Brian Paul
fceecc5bc1 fixed a texture enable bug 2000-10-21 01:22:13 +00:00
Brian Paul
cb5d29cd17 use 1.1 glPolygonOffset instead of glPolygonOffsetEXT 2000-10-20 17:27:16 +00:00
Gareth Hughes
807544498a - General cleanups, fix version numbers.
- Fix INV_MATRIX in katmai_norm_raw.S
- Change MOVUPS to MOVAPS where appropriate
2000-10-20 04:29:15 +00:00
Brian Paul
17f2610d03 Added glXGetProcAddressARB() bug fix 2000-10-19 20:17:13 +00:00
Brian Paul
00935d9eab Rewrote get_static_proc_address(). It made mistakes in some situations 2000-10-19 20:14:57 +00:00
Brian Paul
c8c04359dd added glPixelStore bug fix 2000-10-19 20:10:49 +00:00
Brian Paul
534bc2e2a9 glPixelStore(GL_PACK/UNPACK_SKIP_IMAGES) wasn't handled correctly 2000-10-19 20:09:29 +00:00
Brian Paul
82960fbf69 call Driver.SetReadBuffer() in clear_color_buffers() to fix colormasked clear bug 2000-10-19 18:14:58 +00:00
Brian Paul
b0c8df81ab added blend accuracy item 2000-10-19 18:10:13 +00:00
Brian Paul
ceab228540 improved blending accuracy to fix Glean test failures 2000-10-19 18:09:01 +00:00
Brian Paul
03614d2f33 sync with DRI tdfx3 branch 2000-10-17 00:24:11 +00:00
Brian Paul
e17c1d2202 added _mesa_get_teximages_from_driver() 2000-10-16 23:37:16 +00:00
Brian Paul
e27b783426 added per-fragment bug fix 2000-10-09 22:47:55 +00:00
Brian Paul
18ef8e7c98 if depthBits == 0, set DepthMask = 2^16 to fix per-fragment fog problems 2000-10-09 22:44:01 +00:00
Brian Paul
b34a9dab57 update TriangleCaps in GL_POINT/POLYGON_SMOOTH cases 2000-10-05 23:10:35 +00:00
Brian Paul
7a13c83663 better handling of GLX_DEPTH_SIZE in glXChooseVisual() 2000-10-05 17:38:03 +00:00
Brian Paul
d4e84664a5 added glDrawPixels fast-path item 2000-10-05 17:01:23 +00:00
Brian Paul
29f19424ab fixed fast-path for GL_COLOR_INDEX, GL_UNSIGNED_BYTE drawpixels 2000-10-05 16:47:23 +00:00
Brian Paul
813e8585a6 added glDrawPixels GL_COLOR_INDEX bug item 2000-10-05 16:24:18 +00:00
Brian Paul
88337d5109 drawing color-index image to RGB window was broken 2000-10-05 16:23:18 +00:00
Brian Paul
77a5bab1a3 added glPush/PopAttrib(GL_ENABLE_BIT) item 2000-09-28 22:45:55 +00:00
Brian Paul
de63653835 removed ctx->Texture.Enabled, use ctx->Texture.ReallyEnabled instead 2000-09-28 22:39:41 +00:00
Brian Paul
2f095b9b09 new params for SpecificCompressedTexFormat() (Bill White) 2000-09-28 18:25:00 +00:00
Brian Paul
94b61f99c4 added texture env combine bugfix item 2000-09-25 16:05:53 +00:00
Gareth Hughes
44b450728d Added SSE streaming store instructions, external symbol directives. 2000-09-18 22:48:44 +00:00
Gareth Hughes
bc2b379ad0 Added SSE prefetching instructions. General cleanups. 2000-09-18 16:56:30 +00:00
Gareth Hughes
f35a545d4f General cleanups. Disable gl_katmai_project_vertices and
gl_katmai_project_clipped_vertices for now as they are broken.
2000-09-17 21:23:11 +00:00
Brian Paul
0248965561 use cpml.h on Alpha (AlanH) 2000-09-15 15:42:51 +00:00
Brian Paul
29fb6b3525 replaced GL_RGBA with GL_BGRA for GL_UNSIGNED_SHORT_1_5_5_5_REV datatype 2000-09-13 22:06:36 +00:00
Brian Paul
93bff74a02 added glReadPixels bug fix 2000-09-12 21:11:25 +00:00
Brian Paul
211c30cbc9 packing of GLushort packed types was broken 2000-09-12 21:10:36 +00:00
Brian Paul
1ef3d8407b added format/type error check to draw_rgba_pixels() 2000-09-12 21:09:48 +00:00
Brian Paul
b64ede6f45 init mutex 2000-09-12 21:08:11 +00:00
Brian Paul
a11f829108 Win32 updates (Chris Morley) 2000-09-12 15:46:39 +00:00
Brian Paul
5715ee5d5d Win32 update (Chris Morley) 2000-09-12 15:41:13 +00:00
Brian Paul
08056a38ee added device driver function for texture proxy testing 2000-09-07 15:30:48 +00:00
Brian Paul
2591e8f1db added compressed texture item 2000-09-06 17:48:31 +00:00
Brian Paul
b92036499d bumped version number to 3.4 2000-09-06 17:47:47 +00:00
Brian Paul
60a0b0d7c6 silence compiler warning (zoomY0) 2000-09-06 17:47:26 +00:00
Brian Paul
c68f4fb958 test for __bsdi__ for XFree86 2000-09-06 17:34:29 +00:00
Brian Paul
b9a3c2b3ce replaced ## with CONCAT macro 2000-09-06 17:33:32 +00:00
Brian Paul
2cddd4cd79 use clear_proxy_teximage() instead of MEMSET() 2000-09-05 22:09:03 +00:00
Brian Paul
052512e2ec added more resolutions (Andy Sloane) 2000-08-31 22:09:20 +00:00
Brian Paul
dc1e96acdc removed bogus gl_problem() call 2000-08-30 18:23:51 +00:00
Brian Paul
0eb94349b6 removed some debugging code 2000-08-29 23:10:23 +00:00
Brian Paul
846101fe60 finished compressed texture support (Bill White) 2000-08-29 22:58:57 +00:00
Brian Paul
9af68b1222 added MESA_FF_R8_G8_B8 (alpha filled to 0xff) format 2000-08-29 22:58:33 +00:00
Brian Paul
5c4431cc0a changed default Shininess to 6 2000-08-29 21:17:25 +00:00
Brian Paul
308b5f2e0d added glDrawPixels optimization item 2000-08-29 21:16:50 +00:00
Brian Paul
013a664712 don't free ctx inside _mesa_initialize_context() if error, caller does that. 2000-08-29 19:01:18 +00:00
Brian Paul
52eee51001 changed quad vertex colors to be tessellation invariant 2000-08-21 21:10:35 +00:00
Brian Paul
5d62414004 print UNDEFINED MODE over samples that are undefined in the GL spec 2000-08-21 20:06:44 +00:00
Brian Paul
5917ec0983 optimized glDrawPixels for glPixelZoom(1,-1) (Andrew Gee) 2000-08-16 20:51:23 +00:00
Brian Paul
06e32f455f added missing radius multiplication factor to sphere code 2000-08-16 20:36:32 +00:00
Brian Paul
0ead11e448 fixed typo which disabled simple_DrawPixels 2000-08-16 17:32:13 +00:00
Brian Paul
3edbaf7de6 fixed some warnings (Alan H.) 2000-08-16 17:25:40 +00:00
Brian Paul
e6d349d8e4 added glXUseXFont bug fix 2000-08-13 03:59:04 +00:00
Brian Paul
c25a8f9317 removed all dependencies on XMesa 2000-08-13 03:54:04 +00:00
Brian Paul
9f5ddba23f fixed segfault problem when using MESA_GLX_FX 2000-08-13 03:42:38 +00:00
Brian Paul
f5de04549e fixed depth mask bug in fxddClear(DD_DEPTH_BIT) 2000-08-09 17:56:34 +00:00
Brian Paul
fb027ada34 changed version to 3.4 2000-08-08 16:19:32 +00:00
Brian Paul
e990e8c166 bumped MESA_MINOR to 4 2000-08-08 16:16:04 +00:00
Brian Paul
394ecbde83 added GetInteger/Float/Double/Boolean/Pointer device driver functions 2000-08-08 16:02:09 +00:00
Brian Paul
7ea41a18a5 added NULL parameter checking to API functions 2000-08-03 13:59:28 +00:00
Brian Paul
262112dafa added some bug fix items 2000-08-02 20:33:21 +00:00
Brian Paul
e0fd3762ce updates from mesa3d@billbaxter.com 2000-08-02 20:28:19 +00:00
Brian Paul
1274afbe0b fixed return val bug in glAreTexturesResident() 2000-08-02 20:16:06 +00:00
Brian Paul
5f9760b572 added include/GL/mesa_wgl.h to tar file list 2000-08-02 20:14:25 +00:00
Brian Paul
107c1a4d40 updated by Alessandro Pisani 2000-08-02 20:07:16 +00:00
Brian Paul
809c5a7fc7 removed GLU 1.2 symbols 2000-08-02 14:08:35 +00:00
Brian Paul
aaab86427a define GL_GLEXT_PROTOTYPES before including mesa_wgl.h 2000-08-02 00:42:52 +00:00
Brian Paul
5e2c92b8b6 initialize texture priorities to 1.0, clean-up of _mesa_PrioritizeTextures() 2000-08-02 00:38:23 +00:00
Brian Paul
84e8b8ea5a glGetTexParameter(GL_TEXTURE_RESIDENT) didn't query device driver 2000-08-01 17:33:51 +00:00
Brian Paul
051690168a test against an epsilon magnitude in gl_rotation_matrix() 2000-07-31 15:31:17 +00:00
Brian Paul
652f3b41c1 install glext.h too 2000-07-31 15:26:48 +00:00
Brian Paul
c5e6547a95 3.4 release notes 2000-07-31 13:50:02 +00:00
Brian Paul
bc8257a729 updated Phil's email address 2000-07-31 13:47:21 +00:00
Brian Paul
b353233325 added missing widgets-mesa src files to tar list, updated version numbers 2000-07-31 13:46:27 +00:00
Brian Paul
5d5b09cf79 fixed glitches in zip file rules 2000-07-21 16:36:35 +00:00
Brian Paul
14adbf467d imported from 3.2.1 release 2000-07-21 16:32:33 +00:00
Brian Paul
ebc22c032a lots of updates for 3.3 2000-07-21 16:26:41 +00:00
Brian Paul
d9772291ee removed beta occurances 2000-07-21 16:26:28 +00:00
Brian Paul
8b4738ca47 added 3.2.1 info and final 3.3 info 2000-07-21 15:41:59 +00:00
Brian Paul
f7d503376f removed beta from version string 2000-07-21 15:41:08 +00:00
Brian Paul
c7d1444f9c added GLX multi-thread demo 2000-07-20 20:12:17 +00:00
Keith Whitwell
cc70e78d65 fix for eval regression 2000-07-20 15:53:17 +00:00
Brian Paul
cf89b89be8 call glutInit() 2000-07-19 23:57:24 +00:00
Brian Paul
206bd46e2b a bunch of thread-safety changes 2000-07-19 23:26:35 +00:00
Brian Paul
26f3b05fe5 initialize GenBit[STRQ] in init_texture_unit() 2000-07-19 20:58:59 +00:00
Brian Paul
d283df605e restore driver depth test enable/disable state in PopAttrib() 2000-07-19 18:34:00 +00:00
Brian Paul
912ed380fe removed two bugs 2000-07-19 15:08:55 +00:00
Brian Paul
a0faa7f0ec Fixed off-by-one error in compute_shine_table(). Minor code clean-up 2000-07-18 16:55:56 +00:00
Brian Paul
33e13e78e9 added: touch widgets-sgi/depend 2000-07-18 14:31:59 +00:00
Brian Paul
936d240718 removed more redundant files from tar archive 2000-07-18 01:30:36 +00:00
Brian Paul
1e8b5f539e removed redundant configure file from tar list 2000-07-18 01:14:38 +00:00
Brian Paul
fb0c3fccc0 changed version string to 3.2.1 2000-07-18 01:13:28 +00:00
Keith Whitwell
a62875d20e Fix for gloss and sgl eval bugs. 2000-07-17 12:53:33 +00:00
Brian Paul
d126c7f8d8 another tweak to optimized GL_RETURN code 2000-07-15 03:14:25 +00:00
Brian Paul
6fae9eb4b4 fixed AA sampling problem, misc clean-up 2000-07-15 03:13:43 +00:00
Brian Paul
3284b5ddba removed references to fx_regoff.h and fx_gen_regoff.c 2000-07-14 14:55:04 +00:00
Brian Paul
f19cba049d Fixed pixel color problem in general_flat_rgba_line(). Added debug code 2000-07-14 14:04:07 +00:00
Brian Paul
f8246e2fda added extra check to optimized GL_RETURN case 2000-07-14 04:15:37 +00:00
Brian Paul
7eb0603574 test for MESA_DEBUG = silent in gl_error(), misc clean-up 2000-07-14 04:13:40 +00:00
Brian Paul
4bb651306c replaced GL_CLIENT_ALL_ATTRIB_BITS with GL_ALL_CLIENT_ATTRIB_BITS 2000-07-13 17:45:13 +00:00
Brian Paul
cc8e37ffb3 first bits of convolution code 2000-07-12 13:00:09 +00:00
Brian Paul
96943544ba allocate 1-larger knot array in explode_knot() (Mesa bug 104881) 2000-07-11 20:39:00 +00:00
Brian Paul
fb88eeee9f use indirect context, added error checking 2000-07-11 16:05:29 +00:00
Brian Paul
c4266ac71e reverted to old tessellator 2000-07-11 14:11:58 +00:00
Brian Paul
f88602394d reverted to old tessellator (GLU 1.1) 2000-07-11 14:11:04 +00:00
Keith Whitwell
f545e2aedd Fix for miscolored rects in display lists.
Forward-port stipple bugfix.
2000-07-10 13:22:01 +00:00
Keith Whitwell
bdce2d3a19 test 2000-07-07 15:10:35 +00:00
Keith Whitwell
a6ec029247 test 2000-07-07 15:02:18 +00:00
Keith Whitwell
ad2ef3347f test 2000-07-07 14:59:32 +00:00
Keith Whitwell
56c760668a test 2000-07-07 14:57:47 +00:00
Keith Whitwell
baf8bbe918 test 2000-07-07 14:56:22 +00:00
Keith Whitwell
9fbedc8773 test 2000-07-07 14:54:17 +00:00
Keith Whitwell
1de8f11705 test 2000-07-07 14:50:20 +00:00
Keith Whitwell
a9c909df5b test 2000-07-07 14:46:31 +00:00
Keith Whitwell
dd0b2b7f71 test 2000-07-07 14:44:38 +00:00
Keith Whitwell
7c7de76f82 test 2000-07-07 14:43:01 +00:00
Brian Paul
a38e117fe6 changed MAX_WIDTH to 2048 to handle 2K textures 2000-07-05 22:40:30 +00:00
Brian Paul
6479a175e4 added texture cube map state save/restore 2000-07-05 22:26:43 +00:00
Brian Paul
08b082ae1a Holger's fixes for GL_EXT_texture_env_combine 2000-07-05 16:14:24 +00:00
Brian Paul
ae01d0837d added GL_ARB_texture_cube_mapping and GL_EXT_texture_env_combine 2000-07-05 16:05:44 +00:00
Brian Paul
595fce04f6 added histogram sink test 2000-06-30 22:19:41 +00:00
Brian Paul
6c50e16b3d initialize some color table scale/bias factors 2000-06-30 22:11:04 +00:00
Brian Paul
c29714dccb enabled GL_POST_CONVOLUTION_COLOR_TABLE 2000-06-30 22:09:47 +00:00
Brian Paul
20df8f5f92 NeedEyeCoords if non-uniform scale transform 2000-06-30 14:14:37 +00:00
Brian Paul
fd9f740045 fixed GL_ONE_MINUS_CONSTANT_ALPHA bug (geza) 2000-06-29 22:06:22 +00:00
Brian Paul
86586aa6f9 added GL_TABLE_TOO_LARGE to gl_error() 2000-06-29 18:55:52 +00:00
Brian Paul
0dc5edf3ae several colortable fixes 2000-06-29 18:54:29 +00:00
Brian Paul
f174cda80c minor update 2000-06-29 14:31:31 +00:00
Brian Paul
c535ba5a10 don't add light's ambient color to BaseColor in gl_update_lighting() 2000-06-29 04:56:30 +00:00
Brian Paul
ae41a955fb add separate specular color support in multitextured_rgba_points() 2000-06-28 23:11:10 +00:00
Brian Paul
36b303f15d added flat_multitextured_line() 2000-06-28 23:09:36 +00:00
Brian Paul
73b5e3766f fixed two proxy texture typos 2000-06-28 15:48:32 +00:00
Brian Paul
c079d690da added GL_EXT_texture_env_combine 2000-06-28 14:34:30 +00:00
Brian Paul
3c6ffb53f7 minor updates 2000-06-28 04:43:50 +00:00
Brian Paul
77d61af876 added code to initialize shininess tables 2000-06-28 04:20:21 +00:00
Brian Paul
904ecb2355 initialize TextureStack matrices 2000-06-27 23:38:45 +00:00
Brian Paul
2d8db39301 added aligned memory allocations (Gareth Hughes) 2000-06-27 22:10:00 +00:00
Brian Paul
24507ff6ab added GL_EXT_texture_env_combine (Holger Waechtler) 2000-06-27 21:42:13 +00:00
Brian Paul
92009554ce added LoadRGBMipmaps2() 2000-06-27 17:54:44 +00:00
Brian Paul
dbd52e50ff updated demos/ info 2000-06-27 17:53:21 +00:00
Brian Paul
08df6e0a83 removed 3Dfx directory 2000-06-27 17:37:17 +00:00
Brian Paul
f7688171c4 minor tweaks 2000-06-27 17:12:10 +00:00
Brian Paul
d88f8e9cac initial check-in 2000-06-27 17:11:24 +00:00
Brian Paul
02e8a03593 fixed compiler warnings 2000-06-27 17:04:43 +00:00
Brian Paul
9e7f9b3e99 initial check-in 2000-06-27 17:04:21 +00:00
Brian Paul
0674c22e01 added 3dfx demos 2000-06-27 16:54:18 +00:00
Brian Paul
5b0a7f3971 initial check-in 2000-06-27 16:52:38 +00:00
Brian Paul
e4b40b0211 added texenv demo 2000-06-27 15:56:46 +00:00
Brian Paul
f13a330e44 initial check-in 2000-06-27 15:55:47 +00:00
Brian Paul
2a1f50aee4 fixed GL_INTENSITY error checking bug 2000-06-27 15:47:59 +00:00
Brian Paul
498c09040e print GL_RENDERER upon startup 2000-06-27 15:34:35 +00:00
Brian Paul
6a06707f59 draw a solid cube too 2000-06-27 15:33:44 +00:00
Brian Paul
37283bb248 another patch for win32 joysticks 2000-06-27 13:39:55 +00:00
Brian Paul
86a2de4f1f removed bad DrawDestMask assignments 2000-06-27 04:33:59 +00:00
Brian Paul
308a7152b2 fixed type checking error 2000-06-27 04:32:16 +00:00
Brian Paul
5f1eb35ee2 fixed an assertion and minor bug 2000-06-27 04:31:29 +00:00
Brian Paul
a25f7e1d90 init Point.UserSize 2000-06-27 04:29:22 +00:00
Brian Paul
fd3df4b0f7 disabled some ctx->NeedEyeCoords shortcuts 2000-06-26 23:38:18 +00:00
Brian Paul
de82d063d4 updating mat ambient/emissive was broke. always compute ctx->EyeZDir 2000-06-26 23:37:46 +00:00
Keith Whitwell
daf3778e86 Performance fix for unfilled triangles on mga and i810 hardware. 2000-06-24 11:57:35 +00:00
Brian Paul
39103d2e20 fixed ColorMask test in update_rasterflags() 2000-06-23 20:28:30 +00:00
Brian Paul
401fc936f1 added extension numbers for Mesa extensions 2000-06-23 17:39:18 +00:00
Brian Paul
dd18a4f335 updated with version numbers, edits from Jon Leech 2000-06-23 17:34:47 +00:00
Brian Paul
4ec13a48b1 applied joystick patch from Michael Champigny 2000-06-23 16:21:55 +00:00
Brian Paul
3c8299c779 Added FREE(depth) in error clause before return 2000-06-22 21:26:51 +00:00
Keith Whitwell
2af2c2b556 fix GL_BACK color material bug 2000-06-19 14:35:17 +00:00
Brian Paul
e4b65b6e59 check for special cases of value = 0 or 1 in glAccum 2000-06-19 00:42:24 +00:00
Brian Paul
b92471b74c replaced fxTMReloadSubMipMapLevel() call w/ fxTMReloadMipMapLevel() to work-around subtex bug 2000-06-16 03:55:37 +00:00
Brian Paul
7dac13272a revamped glCopyTexSubImage1/2/3D() to be more like glCopyTexImage1/2/3D() 2000-06-15 19:57:14 +00:00
Brian Paul
4cc11a4fb3 added Motif info message 2000-06-15 18:46:09 +00:00
Brian Paul
9f60fd2154 removed non-windows exit() prototype 2000-06-15 15:11:40 +00:00
Brian Paul
479fab6a34 call glutInit() in main() 2000-06-15 14:25:48 +00:00
Jouk Jansen
55336ae09d ----------------------------------------------------------------------
Committing in .

  VMS : >31 character-external problem

 Modified Files:
 	Mesa/include/GL/glext.h
 ----------------------------------------------------------------------
2000-06-15 07:33:48 +00:00
Keith Whitwell
a179cbf0dd Re-enable the keyboard functionality.
Add a -db option for doublebuffering.
Add a 'benchmark' keystroke like isosurf.
2000-06-14 23:24:50 +00:00
Brian Paul
5b2a619fb2 moved #define of LLBL into assyntax.h file
removed spaces from all uses of LLBL macro, for FreeBSD
2000-06-14 23:11:11 +00:00
Brian Paul
c3501b01d1 added dummy function to silence compiler warning 2000-06-14 21:55:11 +00:00
Brian Paul
9b08f27000 added glxheads, manywin 2000-06-13 19:42:05 +00:00
Brian Paul
0852d0b95e initial check-in 2000-06-13 19:41:30 +00:00
Brian Paul
d27e256f49 use GL_CLAMP_TO_EDGE 2000-06-13 18:45:54 +00:00
Brian Paul
e7268d8341 now using SGI's glext.h instead of original Mesa file 2000-06-13 00:36:58 +00:00
Brian Paul
63ec423823 GL_TEXTURE_BASE_LEVEL wasn't working correctly 2000-06-12 16:09:49 +00:00
Brian Paul
9fb1279b71 define GL_GLEXT_PROTOTYPES for glext.h 2000-06-12 15:40:47 +00:00
Brian Paul
b3a58bbf1d changed dispatch of GL_EXT_vertex_array functions 2000-06-12 15:38:43 +00:00
Brian Paul
614ff87923 added EXT version of vertex array functions 2000-06-12 15:37:18 +00:00
Brian Paul
1f0e213bf8 added EXT version of vertex array functions 2000-06-12 15:30:51 +00:00
Jon Taylor
ffd561e4b5 Lots of small updates to GGIMesa, tracking LibGGI internals changes 2000-06-11 20:11:55 +00:00
Brian Paul
7b2c0f9148 initial check-in 2000-06-09 00:22:02 +00:00
Brian Paul
4c07bd5709 variety of updates to better conform to real GLX 2000-06-08 22:50:28 +00:00
Brian Paul
07b220ad46 clean-up in anticipation of glxext.h 2000-06-08 22:50:24 +00:00
Brian Paul
77ee5aad27 added GL_EXT_packed_pixels extension, subset of GL 1.2 2000-06-08 22:47:24 +00:00
Brian Paul
0c03647f08 updated OSF/1 CFLAGS (Jeremie Petit) 2000-06-08 15:19:12 +00:00
Brian Paul
9540a1dbcf more work on GL_ARB_texture_compression 2000-06-06 17:03:38 +00:00
Brian Paul
c470d86633 fixed bugs in fxSetupDepthTest() 2000-06-05 23:53:06 +00:00
Brian Paul
97529e8e1a updated 3.2 section, added 3.2.1 section 2000-06-05 16:33:09 +00:00
Brian Paul
aa19f80f40 added missing GL_BGRA case 2000-06-05 16:27:41 +00:00
Brian Paul
c45e83e787 added VMS files to Makefiles 2000-06-05 14:40:11 +00:00
Brian Paul
bf996dace4 added ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH() in _mesa_Fogfv() 2000-06-05 14:33:06 +00:00
Jouk Jansen
7d84f5dc5b Committing in .
VMS max 31 character external problem.

 Modified Files:
 	Mesa/src/teximage.h
 ----------------------------------------------------------------------
2000-06-05 07:28:49 +00:00
Brian Paul
ad68f17a06 initial work for GL_NV_blend_square extension 2000-05-30 02:28:03 +00:00
Brian Paul
aea03c424d added cubemap demo 2000-05-30 01:19:49 +00:00
Brian Paul
d04d20974e initial check-in 2000-05-30 01:18:29 +00:00
Brian Paul
ad817704fa more work on GL_ARB_texture_cube_map 2000-05-30 00:27:24 +00:00
Brian Paul
eed6f69199 include glheader.h instead of system headers 2000-05-26 16:17:00 +00:00
Brian Paul
1e0163272b applied Eero Pajarre's patch for Windows 2000-05-26 15:52:06 +00:00
Brian Paul
16541de30e Added GL_ARB_texture_cube_map 2000-05-26 14:45:25 +00:00
Brian Paul
413d6a21f8 more work on GL_ARB_texture_cube_map 2000-05-26 14:44:59 +00:00
Brian Paul
2c3a620133 replaced assertion with a conditional in _glapi_add_entrypoint() 2000-05-24 17:53:30 +00:00
Brian Paul
5fb84d263b changed allocation/initialization of API dispatch tables 2000-05-24 15:04:45 +00:00
Brian Paul
f658ab0e2e always define GL_ARB_multitexture (OpenGL 1.2.1 feature) 2000-05-24 15:04:01 +00:00
Brian Paul
aea66b135e more work on GL_ARB_texture_compression 2000-05-24 14:04:06 +00:00
Brian Paul
98b88b3e70 replaced _mesa_base_tex_format() with base_colortab_format() 2000-05-24 14:03:04 +00:00
Brian Paul
478beace47 enable and clean-up of paletted texture code 2000-05-23 23:26:30 +00:00
Brian Paul
f59afc9aad register recent GL extensions for libGL compatibility 2000-05-23 23:23:00 +00:00
Brian Paul
4d5984444e set default window pos 2000-05-23 23:21:00 +00:00
Brian Paul
90fbef490e changed glext.h include 2000-05-23 22:41:51 +00:00
Brian Paul
1207bf057a initial work for GL_ARB_texture_compression 2000-05-23 20:10:49 +00:00
Brian Paul
35d5301a54 more texture cube work, misc code clean-up 2000-05-23 17:14:49 +00:00
Brian Paul
fc4b44399a more work on GL_ARB_texture_cube_map 2000-05-23 15:17:12 +00:00
Brian Paul
df54463363 replaced __CYGWIN32__ with __CYGWIN__, misc clean-up 2000-05-22 19:41:34 +00:00
Brian Paul
8da58f3184 replaced __CYGWIN32__ with __CYGWIN__ 2000-05-22 19:40:43 +00:00
Brian Paul
f2fc19d785 added GL_EXT_blend_func_separate 2000-05-22 18:46:52 +00:00
Brian Paul
86fc370d39 initial code for GL_ARB_texture_cube_map 2000-05-22 16:33:20 +00:00
Brian Paul
87a7897d38 added Window-isms previously in gl.h 2000-05-22 16:30:47 +00:00
Brian Paul
4951c0e0a8 defined APIENTRY if undefined 2000-05-22 16:26:52 +00:00
Brian Paul
57a055c82f added some Window-isms formerly in gl.h 2000-05-22 16:25:37 +00:00
Brian Paul
af7ad8dded update for Glide3 2000-05-22 16:25:03 +00:00
Brian Paul
0890ed3148 include glext.h if GL_GLEXT_LEGACY not defined 2000-05-22 16:22:47 +00:00
Brian Paul
08f0374bfa moved a lot of Window-isms out of gl.h into other files 2000-05-22 16:21:27 +00:00
Brian Paul
dec7e16cc0 minor tweaks for GLU and GLUT tar files 2000-05-20 23:16:14 +00:00
Brian Paul
fbbac25ad3 fixed alignment bug in _mesa_image_row_stride() 2000-05-19 22:35:44 +00:00
Brian Paul
cc2b08ddf0 changed internalFormat to GLenum in TexImage4DSGI and all compressed textimage calls 2000-05-19 16:08:11 +00:00
Brian Paul
b1bc367ab3 protect PFNGLCOLORSUBTABLEEXTPROC from multi-defined 2000-05-19 15:41:09 +00:00
Brian Paul
58f71ace50 added a bunch of imaging functions 2000-05-19 13:12:29 +00:00
Brian Paul
2765e6848a added const to compressed tex image functions 2000-05-19 13:11:38 +00:00
Brian Paul
43ddff4549 Pass pixel format to xmesa_color_to_pixel(). Compute clearpixel without dither 2000-05-19 13:08:01 +00:00
Brian Paul
e160138d13 added glTbufferMask3DFX(), enabled texture compression functions 2000-05-18 22:02:24 +00:00
Brian Paul
f77064e9e2 DeleteTexturesEXT was missing 2000-05-18 22:01:13 +00:00
Brian Paul
70a9328de3 changed ATTRIBLIST_SIZE to 32 2000-05-18 18:34:23 +00:00
Brian Paul
65300223fb now generated from bin/glx86asm.py script 2000-05-18 18:15:16 +00:00
Brian Paul
4420246955 bunch of updates to static_functions[] 2000-05-18 18:14:22 +00:00
Brian Paul
21301cdc06 added tbuffer and compressed teximage extension functions 2000-05-18 18:13:15 +00:00
Brian Paul
3a94f5c0ac added Kevin's 32bpp Z buffer fix 2000-05-18 18:12:36 +00:00
Brian Paul
0c74657fe0 replaced components with internalFormat 2000-05-18 18:11:35 +00:00
Brian Paul
0914fbaec1 updated to version 10 2000-05-18 18:10:42 +00:00
Brian Paul
e2f66e40df added glPointParameterf[v]SGIS() 2000-05-18 18:09:38 +00:00
Brian Paul
5a8a6d9ac5 generate X86 dispatch code 2000-05-11 23:14:57 +00:00
Brian Paul
ecfdd8814e recover from offset=? condition, code clean-up 2000-05-11 17:45:20 +00:00
Brian Paul
3ee628f83a recover from offset=? condition 2000-05-11 17:44:42 +00:00
Brian Paul
da99cded26 fixed PB bugs, removed MutablePixels, MonoPixels from GLcontext 2000-05-10 22:36:05 +00:00
Brian Paul
7a39d2f833 more GL_EXT_convolution work 2000-05-10 14:39:53 +00:00
Brian Paul
102860a459 removed printf 2000-05-09 23:54:09 +00:00
Brian Paul
0fc001210d a few Alpha tweaks (Michael Champigny) 2000-05-08 18:20:13 +00:00
Brian Paul
e691ee2753 fixed bug in loop over screens 2000-05-08 14:53:57 +00:00
Brian Paul
0665d482d2 Added point UserSize, cleaned up point drawing code 2000-05-07 23:18:54 +00:00
Brian Paul
6698b2294f Err, initial code for GL_EXT_convolution, not histogram 2000-05-07 20:41:30 +00:00
Brian Paul
82b02f0ef2 initial code for GL_EXT_histogram extension 2000-05-07 20:37:40 +00:00
Brian Paul
9cff558064 more error reporting 2000-05-07 18:07:23 +00:00
Brian Paul
293cee7669 fixed glDrawBuffer(GL_NONE) bug 2000-05-05 23:54:08 +00:00
Brian Paul
cf576500dc replaced buggy fxDDReadRGBAPixels() with read_R5G6B5_pixels() 2000-05-05 23:42:23 +00:00
Brian Paul
1afd946ce8 toggle DD_LINE_SMOOTH in GL_LINE_SMOOTH case 2000-05-05 23:41:52 +00:00
Brian Paul
cafc3b35c7 added check for tmuRam==4 for Voodoo2 (Bernd) 2000-05-05 22:38:37 +00:00
Brian Paul
9635376e44 fixed the nested extern warning 2000-05-05 17:02:33 +00:00
Brian Paul
9f0289dfac EnvMode GL_BLEND and tex invalidate changes from Daryll 2000-05-04 16:15:33 +00:00
Brian Paul
a14d28c2bd removed GL_HAS_GLEXT 2000-05-04 14:12:28 +00:00
Brian Paul
474e2f4dbb added a bunch of missing token values 2000-05-04 14:12:02 +00:00
Brian Paul
d78acfa365 removed software alpha flag from GLvisual struct 2000-05-04 14:09:41 +00:00
Brian Paul
065607e884 conditionally include some fields in the context struct for DRI / non-DRI 2000-05-04 13:55:52 +00:00
Brian Paul
0b5566a9d6 made fxMesaCurrentCtx static 2000-05-04 13:55:24 +00:00
Brian Paul
e70c623cf0 removed software alpha flag from GLvisual struct 2000-05-04 13:53:55 +00:00
Brian Paul
ad08108616 added GL_EXT_histogram 2000-05-04 13:50:33 +00:00
Brian Paul
1a1cf7ed75 implemented GL_EXT_histogram extension 2000-05-04 13:48:49 +00:00
Brian Paul
f882577812 fixed backslash typo in sunos configs 2000-05-03 15:03:27 +00:00
Brian Paul
b0ef7454f4 fixed tar file list of widget files 2000-05-03 15:01:08 +00:00
Brian Paul
07ec12f745 removed glxdpyinfo 2000-05-03 14:18:25 +00:00
Brian Paul
f3b3ab924f Removed. Use glxinfo instead. 2000-05-03 14:17:50 +00:00
Brian Paul
ede979fcb5 removed all DRI-isms 2000-05-02 02:30:01 +00:00
Brian Paul
8c7889d99f removed extra / 2000-04-24 15:29:11 +00:00
Brian Paul
34fb5db643 more error checking. Query GLX client vendor string 2000-04-22 20:31:23 +00:00
Brian Paul
df81387dfa call _mesa_initialize_context() 2000-04-22 01:05:40 +00:00
Brian Paul
178a1c5a25 added _mesa_initialize_buffer/visual() 2000-04-22 01:05:00 +00:00
Brian Paul
9ad2ce070e removed old profiling code 2000-04-22 01:03:22 +00:00
Brian Paul
96461a25c3 updated RENDERER version 2000-04-20 01:56:09 +00:00
Brian Paul
ca4a891bb3 minor clean-up 2000-04-20 01:54:52 +00:00
Keith Whitwell
0f32948dab Use smooth shaded triangles always. Fix SoF bug. 2000-04-19 23:58:31 +00:00
Brian Paul
71dea349d2 minor clean-up 2000-04-19 01:44:01 +00:00
Brian Paul
353479fa8a added GLX_EXT_import_context, 1.3 misc clean-up 2000-04-19 01:40:00 +00:00
Brian Paul
c397a6b283 more color table and imaging work 2000-04-18 14:32:10 +00:00
Keith Whitwell
7b5f09c7de New clipping to avoid division by zero bug. 2000-04-17 18:18:00 +00:00
Brian Paul
4bdcfe50f8 dynamically allocate color table data, uses less memory 2000-04-17 17:57:04 +00:00
Brian Paul
0bb0c7cc85 GL_SGI_color_table info 2000-04-17 15:14:33 +00:00
Brian Paul
a5f4cae20a work on GL_SGI_color_table 2000-04-17 15:13:53 +00:00
Brian Paul
0c12733fb7 added a comment about FP overflows 2000-04-15 23:19:05 +00:00
Brian Paul
83aeeb0967 cleaned up whitespace 2000-04-15 23:05:39 +00:00
Brian Paul
0501b25d69 minor updates 2000-04-15 23:04:54 +00:00
Brian Paul
bc95b628fe wrapper for grTexLodBiasValue() 2000-04-15 23:04:11 +00:00
Brian Paul
825fb31e58 added GL_NV_texgen_emboss 2000-04-15 19:50:44 +00:00
Brian Paul
e9cd76e239 added some missing NV token values 2000-04-15 19:44:47 +00:00
Brian Paul
eae28ca68c more clean-up 2000-04-15 19:24:18 +00:00
Brian Paul
76713fb0b0 version 8, added GL_EXT_texture_cube_map 2000-04-15 19:18:06 +00:00
Brian Paul
2511ba7c92 applied Bernd's changes to useBGR code 2000-04-14 21:40:56 +00:00
Jouk Jansen
ddf9b3aa48 Committing in .
VMS support for pixeltex.c

 Modified Files:
 	Mesa/src/descrip.mms Mesa/src/pixeltex.h
 ----------------------------------------------------------------------
2000-04-14 07:42:46 +00:00
Brian Paul
ad2f32155f applied Keith's fix for the Loki ice bug 2000-04-13 14:53:25 +00:00
Brian Paul
179870a5b8 more work on GL_SGI_color_table, pixel transfer code clean-up 2000-04-12 18:54:48 +00:00
Brian Paul
7a6bb1bb82 lots of clean-up, added d/s keys 2000-04-12 01:08:30 +00:00
Brian Paul
13811376c9 more GL_SGI_color_table extension work 2000-04-12 00:27:37 +00:00
Brian Paul
5223c4d33f renamed alpha buffer functions 2000-04-11 21:36:29 +00:00
Brian Paul
716be93686 renamed stencil functions 2000-04-11 21:26:57 +00:00
Brian Paul
67c01f5f67 fixed duplicate variable problem 2000-04-11 20:54:49 +00:00
Brian Paul
ce8e1a4f13 silenced warnings in FX_grSstPerfStats() 2000-04-11 20:43:58 +00:00
Brian Paul
b5410da76e fixed bug in XF86 writeRegionClipped() 2000-04-11 20:43:12 +00:00
Brian Paul
d0130a989a clip depth/stencil spans to window bounds 2000-04-11 20:42:22 +00:00
Brian Paul
4fe34b27f6 initial work on GL_SGI_color_table extension 2000-04-11 15:07:48 +00:00
Brian Paul
ff3e00320e fixed stride problem in read_R5G6B5_span 2000-04-11 03:06:07 +00:00
Brian Paul
43d8e2123f added some more functions 2000-04-10 23:13:51 +00:00
Brian Paul
5605798e56 added glXGetFBConfigs(), fixed glXChooseFBConfig() 2000-04-10 21:13:19 +00:00
Brian Paul
a28a4f7820 removed bogus GL_ALLOW_DRAW_SPN_HINT_PGI token 2000-04-10 21:12:37 +00:00
Brian Paul
47e719fa44 added missing 1.3 token values, added glXGetFBConfigs(), fixed glXChooseFBConfig() 2000-04-10 21:12:20 +00:00
Brian Paul
a8ede6b076 fixed visual selection and reporting results 2000-04-10 16:25:15 +00:00
Brian Paul
8cce314c32 fixed GL_PGI_misc_hints identifiers 2000-04-10 15:52:25 +00:00
Brian Paul
ada5f1cd06 removed a printf 2000-04-09 17:08:09 +00:00
Brian Paul
39350966ad added GL_EXT_color_matrix extension 2000-04-08 18:58:05 +00:00
Brian Paul
250069dbb4 added GL_SGI_color_matrix extension 2000-04-08 18:57:45 +00:00
Brian Paul
a518b47e5b initial check-in 2000-04-07 17:07:32 +00:00
Brian Paul
767e2cf251 added GL_SGIX/SGIS_pixel_texture 2000-04-07 16:45:26 +00:00
Brian Paul
853fb984de added pixel texture extension info 2000-04-07 16:32:21 +00:00
Brian Paul
d697289746 added pixeltex demo 2000-04-07 16:30:46 +00:00
Brian Paul
5cedb32f6b initial check-in 2000-04-07 16:29:08 +00:00
Brian Paul
b0362de32b added pixeltex.c 2000-04-07 16:28:37 +00:00
Brian Paul
2b2e925ea4 added GL_SGIX/SGIS_pixel_texture extension 2000-04-07 16:27:26 +00:00
Brian Paul
ede4887b16 fixed a typo 2000-04-07 16:22:37 +00:00
Brian Paul
985d6b2987 version 7 check-in 2000-04-07 16:21:16 +00:00
Brian Paul
4e0445550d silenced a warning 2000-04-07 00:30:02 +00:00
Brian Paul
15724afd62 new read_R5G5B5_span() function 2000-04-07 00:29:01 +00:00
Brian Paul
0771d159d5 initial histogram and min/max work 2000-04-07 00:19:41 +00:00
Holger Waechtler
3eae261da9 added CONCAT(x,y) macro in NASM/MASM section 2000-04-06 11:51:24 +00:00
Brian Paul
3cd7738c9b silenced warnings 2000-04-06 02:22:59 +00:00
Brian Paul
32afff3fe3 silenced a bunch of warnings 2000-04-06 02:22:23 +00:00
Brian Paul
c8735e8f82 new arguments to XMesaCreateVisual() 2000-04-05 22:09:58 +00:00
Brian Paul
d4a736d52c added some casts 2000-04-05 22:09:10 +00:00
Brian Paul
d708c74ed5 added extern for gl_fog_coord_stage 2000-04-05 22:08:54 +00:00
Brian Paul
c69208451e removed unused vars 2000-04-05 21:36:31 +00:00
Brian Paul
9d0bc1d633 fixed compiler warnigns 2000-04-05 21:36:03 +00:00
Brian Paul
8fbd189d81 added missing braces in initializers 2000-04-05 21:35:46 +00:00
Brian Paul
db5c274851 updated to version 6 2000-04-05 15:33:44 +00:00
Brian Paul
9c4f016d21 minor clean-ups, renaming 2000-04-05 14:40:04 +00:00
Brian Paul
2f8b4c9d2f added version number 2000-04-04 23:29:32 +00:00
Brian Paul
ed388938a1 changed a comment 2000-04-04 15:20:20 +00:00
Brian Paul
a74394c3a8 added copyright info 2000-04-04 15:20:17 +00:00
Brian Paul
87a6230d59 updated for Mesa 3.3 2000-04-04 15:14:48 +00:00
Brian Paul
7e67fb41fb more GL_HP_occlusion_test work 2000-04-04 15:14:10 +00:00
Brian Paul
941dcc797e use BCOPY macro on FreeBSD 2000-04-04 00:54:23 +00:00
Brian Paul
a9c53fa9ee minor clean-ups 2000-04-03 15:45:34 +00:00
Brian Paul
98a8662f65 added GL_HP_occlusion_test items 2000-04-01 06:01:17 +00:00
Brian Paul
bb128de744 added occlude demo 2000-04-01 05:57:41 +00:00
Brian Paul
16b647d8b2 initial check-in 2000-04-01 05:53:31 +00:00
Brian Paul
199d039bc3 changes for GL_HP_occlusion_test 2000-04-01 05:42:06 +00:00
Brian Paul
25673f0cba added support for GLX_EXT_visual_rating 2000-03-31 18:17:51 +00:00
Brian Paul
962f426915 fixed mistake in glXGetConfig(GLX_VISUAL_CAVEAT_EXT) 2000-03-31 18:17:01 +00:00
Brian Paul
aa51bb083b mask/disable stencil/accum clears in fxDDClear() 2000-03-31 17:07:10 +00:00
Brian Paul
3da3b9e84c added glu_tar and glut_tar targets, misc clean-up 2000-03-31 16:20:47 +00:00
Brian Paul
37d34bc12f fixed typo in GLX_SLOW_VISUAL_EXT 2000-03-31 14:48:28 +00:00
Brian Paul
c140020182 clean-up of info messages 2000-03-31 05:49:45 +00:00
Brian Paul
7909019a3e fixed Voodoo1/2/ stride problem in fxDDReadPixels() 2000-03-31 05:49:08 +00:00
Brian Paul
3bbbfbf202 misc clean-up 2000-03-31 05:48:14 +00:00
Brian Paul
4a3ccfee80 added more debugging code 2000-03-31 05:09:55 +00:00
Brian Paul
59bcfe3b3b added GLX_EXT_visual_rating 2000-03-31 01:18:54 +00:00
Brian Paul
e1210b1769 added rest of GLX_EXT_visual_rating extension 2000-03-31 01:17:52 +00:00
Brian Paul
fc68be6b11 minor tweak to GLX_VISUAL_CAVEAT_EXT query 2000-03-31 01:12:40 +00:00
Brian Paul
b2e4600183 updates for separate R/G/B/A accum buffer sizes 2000-03-31 01:07:13 +00:00
Brian Paul
b371e0da2b added _mesa_create/destroy_visual() 2000-03-31 01:05:51 +00:00
Brian Paul
f2123080b5 separate R/G/B/A accum buffer size fields 2000-03-31 01:04:52 +00:00
Brian Paul
a5724069f1 added XMesaCreateVisual2() 2000-03-31 01:04:07 +00:00
Brian Paul
bd2055cf7e added GLX_EXT_visual_rating 2000-03-31 01:03:41 +00:00
Brian Paul
d3d72804b0 tweaks to allow different read formats/types 2000-03-31 01:01:31 +00:00
Brian Paul
047fdf06cc optimized glReadPixels() 2000-03-30 18:39:18 +00:00
Brian Paul
e5d68a2b7d improved PrintTexture debug function 2000-03-30 18:37:51 +00:00
Brian Paul
aed8a96ef2 fixed typos in generate_lookup_tables() 2000-03-30 18:37:32 +00:00
Keith Whitwell
03b7aee438 Added stipple mode 2000-03-30 17:58:56 +00:00
Brian Paul
5ca0d13823 fixed subtexture address calculation bug 2000-03-30 17:24:02 +00:00
Brian Paul
1e35590f14 removed GL_HP_occlustion_test code, added -exit option 2000-03-29 23:57:20 +00:00
Brian Paul
fffb809777 renamed mesaStrDup() to str_dup() 2000-03-29 18:46:11 +00:00
Brian Paul
57e7108b75 new texture image download code 2000-03-29 18:14:32 +00:00
Brian Paul
845bf3c2b1 lots of new work 2000-03-29 18:14:08 +00:00
Brian Paul
4827179cc0 changes for single-copy textures 2000-03-29 18:13:59 +00:00
Brian Paul
8fd9fcbc2d hit space bar to rerun benchmark 2000-03-29 18:02:52 +00:00
Brian Paul
5a564056f5 added error checking on file open 2000-03-29 17:56:02 +00:00
Brian Paul
070b2644c6 added missing GL_INTENSITY case in _mesa_components_in_format() 2000-03-29 15:56:53 +00:00
Brian Paul
a14ee6b081 fixed some buffer clear bugs 2000-03-29 15:48:43 +00:00
Brian Paul
7d69e9e93f lots of changes 2000-03-29 15:47:48 +00:00
Brian Paul
a1cfd0f7a1 version 5: added texture compression extension 2000-03-29 15:46:53 +00:00
Randy Frank
23ee049401 Implemented support for the HP occlusion test extension (osmesa and X) 2000-03-28 16:59:39 +00:00
Brian Paul
9d4d855208 added optimized read/drawpixels for 16bpp TrueColor 2000-03-28 16:10:43 +00:00
Randy Frank
d7361e1717 Updated to compile under Irix 6.5 2000-03-27 21:13:58 +00:00
Brian Paul
ba3d9d0ce9 removed tfxMipMapLevel's used and translate fields, initial teximage clean-up 2000-03-27 19:08:40 +00:00
Brian Paul
de5c19d139 added _mesa_unconvert_teximage() 2000-03-27 18:56:26 +00:00
Brian Paul
021a525616 put _mesa prefix on some functions 2000-03-27 17:54:17 +00:00
Brian Paul
d25df35154 added missing glEnd() call (Tim Beckmann) 2000-03-27 15:46:12 +00:00
Jon Taylor
56edca9f62 Minor fixups 2000-03-27 04:31:15 +00:00
Brian Paul
9fd2b0a698 fixed a Driver.TexImage call typo, misc clean-up 2000-03-24 23:59:06 +00:00
Brian Paul
d03dc25477 added texutil.c source 2000-03-24 20:56:50 +00:00
Brian Paul
7553e3027c initial check-in 2000-03-24 20:54:21 +00:00
Brian Paul
afb8c93470 version 4, all extensions up to 197, added some missing enum values 2000-03-24 19:16:19 +00:00
Brian Paul
4f6d60e9cf added benchmarking 2000-03-23 19:47:25 +00:00
Brian Paul
9891bf086d changed some Linux -O2 flags to -O3 2000-03-23 17:00:35 +00:00
Brian Paul
d6998a714c added new texture image functions, minor clean-up 2000-03-23 16:58:24 +00:00
Brian Paul
45c7e2abe7 added some comments and new texture image functions 2000-03-23 16:57:56 +00:00
Brian Paul
0d24f7b50e replaced HaveTexObj with UseTexObj 2000-03-23 16:57:14 +00:00
Brian Paul
bed91a3fcd added 3.3 To Do items 2000-03-23 16:55:13 +00:00
Brian Paul
0862721958 removed some unpopular extensions (now in glext.h) 2000-03-23 16:54:50 +00:00
Brian Paul
b132e8da5e replaced decode_internal_format() with _mesa_base_tex_format() 2000-03-23 16:23:14 +00:00
Brian Paul
f87c5e229f more clean-up and rearranging 2000-03-23 16:22:36 +00:00
Brian Paul
bd3355bbcd added instructions to build widgets-sgi 2000-03-22 23:48:16 +00:00
Brian Paul
9dd2747e5f minor tweaks 2000-03-22 23:43:53 +00:00
Brian Paul
ca1f44b401 added Daryll's patches for texture alignment 2000-03-22 23:21:27 +00:00
Brian Paul
780c4e057b added code to die on FP exceptions if DEBEG env var set to FP 2000-03-22 23:20:12 +00:00
Brian Paul
3769b3fed4 changed TDA to [4] for glMaterialfv() calls 2000-03-22 23:14:54 +00:00
Brian Paul
49dcae8c80 converted from GL_EXT_texture3D to GL 1.2 2000-03-22 19:48:57 +00:00
Brian Paul
d21cdb6d84 tweaked the animation rate 2000-03-22 18:38:47 +00:00
Brian Paul
29d39d52a0 updated renderer string version to 20000322 2000-03-22 17:39:15 +00:00
Brian Paul
0293878846 lots of changes for single-copy texture image DD interface 2000-03-22 17:38:11 +00:00
Brian Paul
42ad53f67e fixed Cygwin patch typos 2000-03-22 16:01:21 +00:00
Brian Paul
9b8094a663 removed a few const keywords because of mutex calls 2000-03-21 22:20:42 +00:00
Brian Paul
832179c50e added more locking 2000-03-21 17:42:27 +00:00
Brian Paul
fd2e6dbbc8 removed retainInternalCopy from TexSubImage functions 2000-03-21 16:10:22 +00:00
Brian Paul
279d9e3ea7 made _mesa_native_packing const 2000-03-21 16:09:37 +00:00
Brian Paul
b7d076fc96 changed imaging functions to _mesa_ prefix 2000-03-21 01:03:40 +00:00
Brian Paul
43911c8ef0 clean-up of texture image construction 2000-03-21 00:49:33 +00:00
Brian Paul
ae40595b69 added _mesa_image_row_stride() 2000-03-21 00:48:53 +00:00
Brian Paul
8a4014c6fb more reorganization and clean-up 2000-03-20 23:54:54 +00:00
Brian Paul
633e1dcb2b rearranged order of some functions 2000-03-20 23:45:59 +00:00
Brian Paul
2090b97998 added new TexImage and TexSubImage functions 2000-03-20 23:40:57 +00:00
Brian Paul
77ce6da028 added new_texture_image() 2000-03-20 23:40:12 +00:00
Brian Paul
a937128030 added lodbias demo 2000-03-20 22:02:11 +00:00
Brian Paul
aa80e29386 initial check-in 2000-03-20 22:00:22 +00:00
Brian Paul
d7c4f043fe added more extensions, now at version 3 2000-03-20 21:31:29 +00:00
Brian Paul
d94aa337bf removed test for MESA symbol 2000-03-20 21:31:15 +00:00
Brian Paul
1ea2d444fa Cygwin changes, removed two ARB extensions, now in glext.h 2000-03-20 19:26:51 +00:00
Brian Paul
66ae25078e patched for Cygwin (Sven Panne) 2000-03-20 19:26:01 +00:00
Brian Paul
f7b5707d66 added device driver functions for CopyTexImage, CopyTexSubImage, GetTexImage 2000-03-20 14:37:52 +00:00
Brian Paul
8a90cabf81 added aa triangles 2000-03-20 00:29:24 +00:00
Brian Paul
0555a98926 removed GL_FXMESA_global_texture_lod_bias extension 2000-03-19 23:44:24 +00:00
Brian Paul
e7eb459d27 removed debug printf 2000-03-19 23:35:42 +00:00
Brian Paul
4ce2d87cf6 updated for Mesa 3.3 2000-03-19 01:13:13 +00:00
Brian Paul
959f802dab fixed compiler warnings on BeOS R4 2000-03-19 01:10:11 +00:00
Brian Paul
a742e9bccd added glext.h to tar file list 2000-03-19 00:16:41 +00:00
Brian Paul
7621c4d66b removed MGL files 2000-03-18 23:40:37 +00:00
Brian Paul
586b4f66a8 colors were computed incorrectly (Hans Nelles) 2000-03-18 01:13:29 +00:00
Brian Paul
e7b16b74bf silence some warnings 2000-03-17 15:33:09 +00:00
Brian Paul
39c8977802 added missing error checks 2000-03-17 15:32:04 +00:00
Brian Paul
650cb74bcb removed old Depth buffer pointer var 2000-03-17 15:31:52 +00:00
Keith Whitwell
46f717f949 fix for tristrip bug and unfilled quad/polygon bug 2000-03-16 07:36:33 +00:00
Brian Paul
27b2e83805 removed old comment 2000-03-13 18:32:37 +00:00
Brian Paul
7c652d7722 fixed polygon stipple packing/unpacking 2000-03-13 18:31:51 +00:00
Brian Paul
3cb1121299 added final GL_HP_occlusion_test values 2000-03-13 15:48:51 +00:00
Jouk Jansen
ab07ef4093 Committing in .
VMS compile support-update (AATRIANGLE.C)

 Modified Files:
 	Mesa/src/descrip.mms
 ----------------------------------------------------------------------
2000-03-13 10:31:57 +00:00
Brian Paul
9aafc4fd5d gave temp values to GL_HP_occlusion_test tokens 2000-03-11 23:24:01 +00:00
Brian Paul
1b2ff69f46 initial implementation of GL_HP_occlusion_test extension 2000-03-11 23:23:26 +00:00
Brian Paul
516b8363bb glPopAttrib() now calls Driver's ClearColor, ClearIndex and ColorMask functions 2000-03-10 22:12:22 +00:00
Brian Paul
fca17350b6 removed Driver.UseGlobalTexturePalette() 2000-03-07 18:24:49 +00:00
Brian Paul
7a7ca3f345 minor clean-up 2000-03-07 18:24:14 +00:00
Brian Paul
56b99de2fa implemented FX_grSstPerfStats() 2000-03-07 18:23:20 +00:00
Brian Paul
9360a4450d added GL_EXT_texture_lod_bias 2000-03-07 17:59:54 +00:00
Brian Paul
64eef48741 added GL_HP_occlusion_test, GL_EXT_texture_lod_bias 2000-03-07 17:55:40 +00:00
Brian Paul
aabf086a03 added GL_EXT_texture_lod_bias extension (Michael Vance) 2000-03-07 17:54:58 +00:00
Brian Paul
4f92969899 made gl_make_fog_coords() static 2000-03-07 17:40:34 +00:00
Brian Paul
b3f16c4350 added target parameter to Driver.TexEnv() 2000-03-07 17:11:29 +00:00
Brian Paul
e02ffc1226 now save Targa image. misc clean-up 2000-03-06 23:56:21 +00:00
Brian Paul
463d15add9 added demos/geartrain 2000-03-06 23:35:51 +00:00
Brian Paul
b50d03e5bc added geartrain 2000-03-06 23:35:06 +00:00
Brian Paul
392a7008d1 initial check-in 2000-03-06 23:34:42 +00:00
Brian Paul
7fc29c5fa7 fixed off-by-one errors in matrix stack setup/cleanup 2000-03-06 17:03:03 +00:00
Jouk Jansen
3f600e47cf Committing in .
VMS : C++ & Xlib.h problems.

 Modified Files:
 	Mesa/include/GL/glx.h
 ----------------------------------------------------------------------
2000-03-06 12:59:24 +00:00
Brian Paul
0223baaf57 removed obsolete logicop function 2000-03-03 23:21:57 +00:00
Brian Paul
1b6592aae7 added LineWidth device driver function 2000-03-03 18:55:45 +00:00
Brian Paul
4f980f4ebb depth buffer change, BGR/RGB setup change 2000-03-03 17:53:26 +00:00
Brian Paul
b440dfeee6 clean-up warnings 2000-03-03 17:51:35 +00:00
Brian Paul
ed30dfa126 runtime selectable depth buffer depth 2000-03-03 17:47:39 +00:00
Brian Paul
8df3d8ae6c save ColorTable and ColorSubTable commands 2000-03-03 17:45:21 +00:00
Brian Paul
4ee75bdab5 moved device driver DrawPixels call 2000-03-03 15:39:13 +00:00
Brian Paul
c232ecbfdf added device driver ReadPixels and CopyPixels functions 2000-03-03 15:38:57 +00:00
Brian Paul
54ec0cbfa9 removed GLX_VERSION_1_3 for now 2000-03-03 15:35:51 +00:00
Brian Paul
4c7e3c29f7 changes to _WIN32 test and APIENTRY test 2000-03-03 15:00:14 +00:00
Brian Paul
f9b9cd71d6 minor clean-up 2000-03-02 18:34:34 +00:00
Brian Paul
9d823a3513 simplification of GLNAME macro setup (David Dawes) 2000-03-01 23:34:03 +00:00
Brian Paul
65d54604c3 inserted static const in make_null_texture() 2000-03-01 23:28:20 +00:00
Brian Paul
3bc58af79d minor reformatting 2000-03-01 20:43:30 +00:00
Brian Paul
15da01e16b added readpix program 2000-03-01 16:24:29 +00:00
Brian Paul
eca1bc983d test glDraw/Read/CopyPixels() 2000-03-01 16:23:14 +00:00
Brian Paul
6b729d41f0 added GL_GLEXT_VERSION_EXT 2000-03-01 03:44:10 +00:00
Brian Paul
058a3ab4cb test for GL 1.2 2000-03-01 03:36:40 +00:00
Brian Paul
aae9db03e4 added proxy texture targets to GetColorTableParameter (Steven Fuller) 2000-02-28 20:38:37 +00:00
Brian Paul
26a89579e4 added GL_BGR and GL_BGRA support 2000-02-28 14:51:43 +00:00
Keith Whitwell
e5ed37fa4e add callbacks for stipple 2000-02-27 20:38:15 +00:00
Brian Paul
3994b77bab changed glXCopyContext() mask to unsigned long, per GLX spec 2000-02-27 18:26:54 +00:00
Brian Paul
0f21a5d36b added a bit of GLAPIENTRY, APIENTRY setup 2000-02-27 18:12:41 +00:00
Brian Paul
7f88ac198c patched for NetBSD support (Allen Briggs) 2000-02-27 18:04:59 +00:00
Brian Paul
4c5fb70380 added all the PFNGL...PROC typedefs 2000-02-26 00:48:02 +00:00
Brian Paul
4ceb5616e6 fixed bug when using display lists 2000-02-25 23:24:06 +00:00
Brian Paul
f5d36aefd1 added GL_HAS_GLEXT 2000-02-25 21:01:41 +00:00
Brian Paul
45cec8167d inserted a tab 2000-02-25 20:36:03 +00:00
Brian Paul
9f9de170f2 removed the GET_BITS_PER_PIXEL macro 2000-02-25 20:31:11 +00:00
Brian Paul
f9db0039b1 added XMesaUnbindContext (for DRI) 2000-02-25 20:30:23 +00:00
Brian Paul
c1aa1218ef changed glXCopyContext mask back to GLuint 2000-02-25 17:04:42 +00:00
Brian Paul
9ec28c03c0 changed glXCopyContext's mask to unsigned long 2000-02-25 16:46:01 +00:00
Brian Paul
bb7e2e846c fixed front/back buffer stride problem for XF86DRI 2000-02-25 14:59:46 +00:00
Jouk Jansen
eaba005f18 Committing in .
VMS & type-mismatch problems

 Modified Files:
 	Mesa/include/GL/glext.h Mesa/include/GL/glx.h
 ----------------------------------------------------------------------
2000-02-25 12:35:57 +00:00
Brian Paul
f183a0fc01 added note about double buffering for in-window rendering 2000-02-25 04:42:58 +00:00
Brian Paul
b11b0954a2 new fxDDClear(), fxDDDrawBitmp(), example extension registration code 2000-02-25 04:16:50 +00:00
Keith Whitwell
e828bc8f61 Fog coordinate stage which drivers may use to replace standard fogging
mechanism.

LogicOp state change callback
2000-02-25 03:55:39 +00:00
Brian Paul
8ceb5c34dd now using SGI-specified dispatch order 2000-02-24 22:14:04 +00:00
Brian Paul
7c2225373e now generated with Python script 2000-02-24 22:11:32 +00:00
Brian Paul
f1a03a3709 added more entrypoints 2000-02-24 22:08:02 +00:00
Brian Paul
ead285a926 bunch of dispatch and extension-related changes 2000-02-24 22:04:03 +00:00
Brian Paul
8814124f35 bunch of extension clean-up 2000-02-24 22:03:21 +00:00
Brian Paul
b5d049f15e added some error checking 2000-02-24 18:36:32 +00:00
Brian Paul
87ae69c45d use quotes for gl.h and glext.h includes 2000-02-24 15:12:05 +00:00
Brian Paul
97c33f3ede added missing backslash on line 483 2000-02-24 00:52:23 +00:00
Brian Paul
b629b0743c added more extension entrypoints 2000-02-24 00:23:32 +00:00
Brian Paul
f3232bcaf1 changed glXCopyContext()'s mask to unsigned long 2000-02-23 23:04:27 +00:00
Brian Paul
7ac435066a fixed problem in print_extension_list() when ext ended in a space 2000-02-23 22:50:35 +00:00
Brian Paul
feb06c8d9a GL_EXT_blend_color is now DEFAULT_ON 2000-02-23 22:31:35 +00:00
Brian Paul
bfa012d985 changed a GLuint to GLint 2000-02-23 16:01:40 +00:00
Brian Paul
ecfa382144 fixed a few glitches 2000-02-23 01:52:42 +00:00
Brian Paul
7d4d54cf94 fixed a typo in GL_MESA_resize_buffers 2000-02-23 01:38:29 +00:00
Brian Paul
50877fb096 include GL/glext.h 2000-02-23 01:36:44 +00:00
Brian Paul
4278ec184d added a bunch of extensions 2000-02-23 01:36:17 +00:00
Brian Paul
3b9a5e912f added glext.h header item 2000-02-23 01:14:11 +00:00
Brian Paul
67333973b6 added some missing tokens, fixed some errors 2000-02-23 01:13:33 +00:00
Brian Paul
cec5f6f00d initial revision 2000-02-23 00:55:38 +00:00
Brian Paul
a511609501 sort the offsets by number 2000-02-22 23:59:25 +00:00
Brian Paul
feaf04a27b initial check-in 2000-02-22 22:45:20 +00:00
Brian Paul
7c8cfc6977 fixed bug in 24bpp ximage pixel addressing 2000-02-22 17:14:02 +00:00
Brian Paul
02da4625b8 disabled an fprintf in FX_grSstQueryHardware() 2000-02-22 01:12:39 +00:00
Brian Paul
8b590c0ad3 added aatriangle.c source 2000-02-21 23:24:02 +00:00
Brian Paul
34c6d687ca fixed off by one error in matrix stack depths (Eero Pajarre) 2000-02-21 23:00:51 +00:00
Brian Paul
df6a28d105 fixed minor bug in copytexsubimage_error_check() 2000-02-21 16:34:21 +00:00
Brian Paul
a5f618a291 fixed bug in GL_UNSIGNED_INT_10_10_10_2 unpacking 2000-02-21 16:33:20 +00:00
Brian Paul
0e3342ea29 fixed GL_SRC_ALPHA_SATURATE bug, lots clean-up 2000-02-21 14:50:31 +00:00
Brian Paul
5df6816e2c added CHAN_MAX, CHAN_MAXF 2000-02-21 14:46:28 +00:00
Brian Paul
21ab258821 removed driver RendererString() and ExtensionString() funcs 2000-02-17 20:53:48 +00:00
Brian Paul
b6273023a2 replaced gl_ggiRendererString() with gl_ggiGetString() 2000-02-17 20:52:49 +00:00
Brian Paul
27b4b2f003 replaced renderer_string() with get_string() func 2000-02-17 20:52:02 +00:00
Brian Paul
5bd2987840 update fog near/far bug fix 2000-02-16 23:15:01 +00:00
Brian Paul
7a0f9dbb94 updated with changes from DRI project CVS 2000-02-16 23:06:12 +00:00
Brian Paul
27be87cdff new library dependency vars 2000-02-16 01:09:06 +00:00
Brian Paul
6610c2b084 initialize fxMesa->verbose with MESA_FX_INFO env var 2000-02-13 00:36:08 +00:00
Brian Paul
2c9bf83b90 always include thread.h 2000-02-12 21:08:00 +00:00
Brian Paul
85db3d7563 added more error checking to _glapi_add_entrypoint() 2000-02-12 17:31:40 +00:00
Brian Paul
3ab6bbe613 now using dynamically allocated api dispatch tables 2000-02-12 17:26:15 +00:00
Brian Paul
ef5d084d3c clean-up 2000-02-12 16:44:24 +00:00
Brian Paul
e39ed58116 always include <float.h> 2000-02-12 15:55:34 +00:00
Brian Paul
59d6da5365 fixed reference count but in DeleteTextures() 2000-02-12 01:59:19 +00:00
Brian Paul
bd986282f3 added MESA_FX_NO_SIGNALS env var (Michael Vance) 2000-02-12 01:36:40 +00:00
Brian Paul
15b40dfe75 updated with MESA_FX_NO_SIGNALS info 2000-02-12 01:35:24 +00:00
Brian Paul
fa937f611a fixed WIN32_THREADS error 2000-02-11 21:38:33 +00:00
Brian Paul
af763d5e43 added code for all GL_MESA_window_pos functions 2000-02-11 21:14:27 +00:00
Brian Paul
ae773f612c clean-up 2000-02-11 20:44:22 +00:00
Brian Paul
7527a1844d enable thread safety on Linux configs, removed -DTHREADS flag 2000-02-11 20:44:00 +00:00
Brian Paul
8df7c673ec added tess_clip.c 2000-02-11 16:15:28 +00:00
Jouk Jansen
ab656ba642 Committing in .
New compile support for FX on VMS

 Modified Files:
 	Mesa/src/descrip.mms
 ----------------------------------------------------------------------
2000-02-11 07:25:48 +00:00
Brian Paul
a360ab2a33 THREADS now defined by glthread.h, added more prototypes 2000-02-10 21:54:06 +00:00
Brian Paul
3c27be3738 changed thread TSD initialization 2000-02-10 21:27:48 +00:00
Brian Paul
a9601f1b4c added support for XFree86 threads. misc clean-up 2000-02-10 21:27:25 +00:00
Brian Paul
577c67e860 added GLCALLBACKPCAST for Cygnus (Sven Panne) 2000-02-10 17:45:52 +00:00
Brian Paul
46a5936f54 include readtex.h 2000-02-10 17:44:58 +00:00
Brian Paul
80ef05c9d5 initial checkin 2000-02-10 17:44:50 +00:00
Brian Paul
3d41d5ade7 added GLCALLBACKPCAST for Cygnus (Sven Panne) 2000-02-10 17:27:55 +00:00
Brian Paul
9f037fdc72 added OpenStep to LIB_FILES 2000-02-10 16:00:36 +00:00
Brian Paul
ee5baf2747 udpated version/copyright info 2000-02-09 19:13:07 +00:00
Brian Paul
aff45fde80 removed fxDDBufferSize proto 2000-02-09 19:12:25 +00:00
Brian Paul
e78dd0243c updated fxDDGetString() for DRI 2000-02-09 19:12:02 +00:00
Brian Paul
668ac873a0 updated version info 2000-02-09 19:03:28 +00:00
Brian Paul
bab8f790ae glDrawPixels w/ format=GL_COLOR_INDEX was broken 2000-02-08 23:42:14 +00:00
Jouk Jansen
99e89283d6 Committing in .
Modified Files:
 	Mesa/src/descrip.mms
 ----------------------------------------------------------------------
2000-02-08 07:29:12 +00:00
Brian Paul
73e6952ad7 added a few missing ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH() calls 2000-02-08 01:45:22 +00:00
Brian Paul
397c9dd375 in fxSelectSingleTMUSrc_NoLock(), added check for haveTwoTMUs (Neal Tringham) 2000-02-06 20:01:36 +00:00
Brian Paul
b79d289bde clearing depth buffer failed when clearing front color buffer 2000-02-06 19:29:48 +00:00
Brian Paul
d4ce76275d updated with new info 2000-02-06 17:04:56 +00:00
Brian Paul
0b6fec7a6f added missing glGet cases for GL_EXT_compiled_vertex_array 2000-02-06 03:03:02 +00:00
Brian Paul
df37c6bd65 disabled locked arrays in glDrawRangeElements() 2000-02-05 02:05:14 +00:00
Brian Paul
e69f1f54f9 GL_ARRAY_ELEMENT_LOCK_FIRST/COUNT_SGI changed to _EXT suffix 2000-02-05 01:51:54 +00:00
Brian Paul
38a683816b added support for GL_RGB5_A1 internal texture format (Eero Pajarre) 2000-02-04 16:23:47 +00:00
Brian Paul
b13fd0bc9e pass IntFormat, not Format to fxTexGetFormat 2000-02-04 16:22:58 +00:00
Brian Paul
65cd4d80c4 added SUB_PIXEL_BITS 2000-02-03 19:40:35 +00:00
Brian Paul
539cce5248 added point/line size limits to gl_constants struct 2000-02-03 19:40:07 +00:00
Brian Paul
1816ec4500 added Const.SubPixelBits 2000-02-03 15:33:29 +00:00
Jouk Jansen
cd8e492c55 Committing in .
Updates effective and needed for VMS only

 Modified Files:
 	Mesa/src/descrip.mms Mesa/src/glapitable.h
 ----------------------------------------------------------------------
2000-02-03 09:35:17 +00:00
Brian Paul
ab8de7b678 minor clean-ups 2000-02-02 22:22:59 +00:00
Brian Paul
5829f0c960 changed _gl prefix to _mesa_ on fog functions 2000-02-02 22:21:39 +00:00
Brian Paul
4bad6744d2 replaced gl_ prefix with _mesa_ prefix on depth funcs 2000-02-02 22:16:04 +00:00
Brian Paul
b34024bc62 replaced gl_ prefix with _mesa_ prefix on blend funcs 2000-02-02 22:08:26 +00:00
Brian Paul
42fcf03e3a replaced gl_ prefix with _mesa_ prefix 2000-02-02 22:03:31 +00:00
Brian Paul
bd409f4143 added check for IntegerAccumScaler > 0 in GL_RETURN case 2000-02-02 21:53:11 +00:00
Brian Paul
8427d93449 changed prefix to _mesa_ for a few accum functions 2000-02-02 21:52:26 +00:00
Brian Paul
8460cc9bf9 try both single and double-buffered visuals 2000-02-02 20:57:51 +00:00
Brian Paul
831f8ada7b don't include dispatch.h 2000-02-02 19:50:26 +00:00
Brian Paul
a02fb6afc8 added comments 2000-02-02 19:34:08 +00:00
Brian Paul
3face37ca4 include buffers.h 2000-02-02 19:28:27 +00:00
Brian Paul
fab9712714 updated source files 2000-02-02 19:19:30 +00:00
Brian Paul
784d76024c moved exec dispatch init to state.c 2000-02-02 19:18:19 +00:00
Brian Paul
ea39f042c3 updated includes for source file reorg 2000-02-02 19:17:57 +00:00
Brian Paul
fa9df40e8a moved state functions to state.c 2000-02-02 19:16:46 +00:00
Brian Paul
23903a2338 removed glmisc.c, added buffers.c, hint.c, state.c 2000-02-02 19:15:53 +00:00
Brian Paul
d0a3ea051a functions from context.c 2000-02-02 19:15:19 +00:00
Brian Paul
f2dce72167 functions from old glmisc.c file 2000-02-02 19:14:56 +00:00
Brian Paul
b086b95fed replace offset with functionOffset in generate_entrypoint() 2000-02-02 18:50:07 +00:00
Brian Paul
b45c71aeff changed > to >= 2000-02-02 17:31:45 +00:00
Brian Paul
d2702f0022 limit Drift to [0, 1] 2000-02-02 01:07:21 +00:00
Brian Paul
6b8cced81a patch for XFree86 building 2000-02-01 23:57:03 +00:00
Brian Paul
f224b12a5b added normal, vertex, viewport message strings 2000-02-01 01:19:07 +00:00
Brian Paul
59668e3eb3 added more message strings 2000-02-01 01:10:27 +00:00
Brian Paul
075398b879 defined FLT_MIN if undefined 2000-01-31 23:33:53 +00:00
Brian Paul
9560f05def added mutexes for thread safety 2000-01-31 23:11:39 +00:00
Brian Paul
bc794059d8 added Mutex macros 2000-01-31 23:10:47 +00:00
Brian Paul
663049a719 added _mesa_TexImage3DEXT() 2000-01-31 23:10:16 +00:00
Brian Paul
2b1c416e21 added save_TexImage3DEXT() 2000-01-31 23:09:51 +00:00
Brian Paul
e0a87f9087 removed unneeded \n chars 2000-01-31 23:06:07 +00:00
Brian Paul
3a6eeddb8a changed message format, added GL_EXT_texture3d 2000-01-31 22:54:41 +00:00
Brian Paul
976dba2965 added more function templates, changed message format 2000-01-31 22:54:06 +00:00
Brian Paul
8fddcf3343 fixed protos for glTexImage3DEXT and GetDetailTexFuncSGIS 2000-01-31 22:52:50 +00:00
Brian Paul
4428a3f359 added Josh's dynamic display assembly generator 2000-01-31 22:51:44 +00:00
tanner
4df415b190 include conf.h 2000-01-31 22:10:06 +00:00
Brian Paul
a749f75826 include glapioffset.h instead of ../glapioffsets.h 2000-01-28 22:18:48 +00:00
Brian Paul
bfd2bd2b3a added -I. to .S.o rule 2000-01-28 22:18:03 +00:00
Brian Paul
f9b97d95f9 renamed _glapi_CurrentContext to _glapi_Context 2000-01-28 20:17:42 +00:00
Brian Paul
9f94399cf3 removed actual GL entrypoints (glapitemp.h) 2000-01-28 19:03:33 +00:00
Brian Paul
01c071340d moved entrypoints here from glapi.c 2000-01-28 19:02:57 +00:00
Brian Paul
68ee4bc7ca enable/disable no-context warnings depending on MESA_DEBUG 2000-01-28 19:02:22 +00:00
Brian Paul
3228421f69 added default template macros 2000-01-28 19:01:45 +00:00
Brian Paul
8d365ab204 updated comments 2000-01-28 18:57:56 +00:00
Brian Paul
d73af1122a added texdown info 2000-01-28 16:28:51 +00:00
Brian Paul
062ebf45c5 added texdown program 2000-01-28 16:27:27 +00:00
Brian Paul
215ff22651 initial check-in 2000-01-28 16:25:44 +00:00
Brian Paul
998955f54f added improved glxinfo item 2000-01-27 21:20:59 +00:00
Holger Waechtler
83f1d317c2 added prefetchw 2000-01-27 20:01:57 +00:00
Brian Paul
e06c7f32cf minor changes regarding transparency and multisample 2000-01-27 16:53:55 +00:00
Brian Paul
262f9e52d6 updated version string to Mesa 3.3 2000-01-27 16:45:50 +00:00
Brian Paul
76bc4403fd all new version of glxinfo 2000-01-27 16:43:56 +00:00
Brian Paul
e9fa7908d1 include conf.h if HAVE_CONFIG_H defined 2000-01-27 00:26:03 +00:00
Brian Paul
b39e3bad1d added WIN32 and macos files to tar archive 2000-01-27 00:11:49 +00:00
Brian Paul
04f1248ef9 updated RGB2BGR function 2000-01-25 20:21:19 +00:00
Brian Paul
0fed6a1bde added info about assembly language optimizations 2000-01-25 17:18:52 +00:00
Brian Paul
d8aec9b55b only print info if MESA_DEBUG is set 2000-01-25 17:04:47 +00:00
Brian Paul
3781b7bfa5 fixed VB->IndexPtr==NULL bug (Richard Guenther) 2000-01-25 16:49:20 +00:00
Brian Paul
ebd5feab9a updated for Mesa 3.3 2000-01-25 00:03:01 +00:00
Gareth Hughes
2454429915 Removed '#if 0' from second pass. 2000-01-24 22:54:05 +00:00
Brian Paul
d13bfbf7c6 changed VB_MAX, no longer dependant on FX symbol 2000-01-24 20:54:18 +00:00
Brian Paul
c79fab4aa6 replaced HashLookup() with _mesa_HashLookup() 2000-01-24 20:53:32 +00:00
Brian Paul
bb79790662 prefixed hash functions with _mesa_ 2000-01-24 16:19:54 +00:00
Gareth Hughes
3b7a75a0ce Merged 3.2 updates, namely combine callback for intersecting
contours.
2000-01-23 21:25:39 +00:00
Brian Paul
35a2227547 added #ifdef SVGA, work-around asm code problem 2000-01-23 17:49:54 +00:00
Brian Paul
28cf3043b6 added new SVGA driver files 2000-01-23 17:48:16 +00:00
Josh Vanderhoof
fccc9298b8 prevent spaces in fp register names 2000-01-23 05:47:14 +00:00
Josh Vanderhoof
ade76cd4ab no brackets for nasm indirect jumps 2000-01-23 05:08:51 +00:00
Brian Paul
50a46abdd9 updated for Mesa 3.2 2000-01-22 20:09:30 +00:00
Brian Paul
069965f170 updated SVGA sources from Mesa 3.2 2000-01-22 20:08:36 +00:00
Gareth Hughes
99dd0d4092 Merged in fixes from 3.2 branch. Fixed clipping bug, segfault in
vertex sorting function.

Debug is now enabled with MESA_TESS_DBG_LEVEL environment variable.
2000-01-20 21:52:01 +00:00
Brian Paul
e257733d03 updated with latest DRI tree changes 2000-01-18 17:56:05 +00:00
Brian Paul
d15422a951 replaced some spaces with a tab 2000-01-18 17:40:05 +00:00
Brian Paul
ffebe69866 generic_noop() now returns 0 2000-01-18 17:38:40 +00:00
Brian Paul
5666c63693 renamed CURRENT_INPUT to _mesa_CurrentInput 2000-01-18 17:36:16 +00:00
Brian Paul
187bce0724 minor clean-up 2000-01-18 17:29:18 +00:00
Brian Paul
c902f7d05a added do /while to multi-line macros 2000-01-17 23:22:57 +00:00
Brian Paul
5428705eee added X86-optimized message for MESA_INFO 2000-01-17 20:00:15 +00:00
Brian Paul
003caf24bb disabled X86-optimized dispatch when using XF86DRI (temporary) 2000-01-17 19:45:37 +00:00
Brian Paul
328bb7f40f added _glapi_Dispatch 2000-01-17 19:28:43 +00:00
Brian Paul
c2319b4315 renamed _mesa_Dispatch to _glapi_Dispatch, misc clean-up 2000-01-17 19:28:31 +00:00
Brian Paul
3ae56c6cc4 removed X86 files from linux debug configs 2000-01-17 19:00:52 +00:00
Brian Paul
e23b16012f added copyright info 2000-01-17 18:09:11 +00:00
Brian Paul
3db088f7d7 added missing POINT/LINE RANGE/GRANULARITY tokens 2000-01-17 18:05:24 +00:00
Brian Paul
3be135f000 Z values were wrong in selection mode (Holger Waechtler), misc clean-up 2000-01-17 15:40:43 +00:00
Brian Paul
d0edf6ad30 use nplanes instead of bitsPerRGBValue in GET_BITS_PER_PIXEL macro 2000-01-16 18:35:25 +00:00
Josh Vanderhoof
efe03ae1af x86 assembly dispatch 2000-01-16 07:26:35 +00:00
Randy Frank
c26d81842a Added occlusion test code. Follows the HP proposed occlusion test extension. 2000-01-15 06:13:26 +00:00
Randy Frank
0deb3737c4 Added entry point and define for the occlusion test. 2000-01-15 06:12:18 +00:00
Randy Frank
ed236aa0d0 Added test for the occlusion test code. 2000-01-15 06:11:33 +00:00
Brian Paul
acb6297e14 minor change for DEBUG builds 2000-01-14 16:35:25 +00:00
Brian Paul
4f68a7f5c7 first check-in 2000-01-14 16:25:56 +00:00
Brian Paul
95ff9aaa0d updated for Mesa 3.3 2000-01-14 16:24:56 +00:00
Brian Paul
304357dcd4 GLcontext is now nested in OSMesaContext 2000-01-14 04:55:44 +00:00
Brian Paul
4d053ddae8 added gl_initialize_context_data(), gl_free_context_data(). code clean-up 2000-01-14 04:45:47 +00:00
Brian Paul
113edcc755 added fxMesaContext arg to fxInitPixelTables() 2000-01-13 17:58:41 +00:00
Brian Paul
4049cd35d8 applied Daryll's patches for GLX_DIRECT_RENDERING 2000-01-13 17:40:12 +00:00
Brian Paul
7c1f6e4110 added -Wmissing-prototypes and enabled pthreads for linux debug configs 2000-01-13 00:44:37 +00:00
Brian Paul
80c6243e8b added _mesa_ArrayElement() proto 2000-01-13 00:35:09 +00:00
Brian Paul
62c184258b added gl_register_config_var() proto 2000-01-13 00:34:45 +00:00
Brian Paul
a0020435f5 init a few vars to silence compiler warnings 2000-01-13 00:32:12 +00:00
Brian Paul
4fc91a1427 include dispatch.h 2000-01-13 00:31:10 +00:00
Brian Paul
c7a5dbe3b3 clean up of eval_coord1/2f() 2000-01-13 00:30:41 +00:00
Brian Paul
16a9efe3ab commented out gl_reinit_light_attrib() 2000-01-13 00:29:02 +00:00
Brian Paul
fd75e6d4e5 commented out unused function 2000-01-13 00:27:05 +00:00
Brian Paul
4463a24909 minor clean-up 2000-01-13 00:25:22 +00:00
Brian Paul
780806f4d4 made some functions static 2000-01-13 00:24:48 +00:00
Brian Paul
2037663200 another fix for gluPartialDisk() in GL_LINE mode 2000-01-11 22:01:08 +00:00
Brian Paul
5e5f462701 fixed missing slice problem in gluPartialDisk() 2000-01-11 17:21:14 +00:00
Brian Paul
0219d32505 added printf-message to dispatch templates 2000-01-10 04:29:09 +00:00
Brian Paul
45691208ff added amesa.h to tar file list 2000-01-08 11:14:01 +00:00
Brian Paul
b3674092f2 removed DISPATCH_SETUP, added RETURN_DISPATCH 2000-01-08 11:01:24 +00:00
Brian Paul
e8dad9dbe4 fixed prototype typo in glHintPGI ( ) 2000-01-08 10:51:20 +00:00
Brian Paul
6132833b51 minor updates 2000-01-07 08:47:15 +00:00
Jon Taylor
c6c06c92b2 * Fixups to the GGIMesa code to reflect the recent DD API changes
* Added a new GGIMesa debugging-print subsystem
2000-01-07 08:34:43 +00:00
Brian Paul
3c3533c5c8 added missing glHintPGI() function 2000-01-07 07:42:33 +00:00
Brian Paul
77aa8b9c86 improved robustness of extension handling in static_functions[] array 2000-01-07 07:30:13 +00:00
Brian Paul
1e4ded3bc3 added glHintPGI template 2000-01-07 07:28:22 +00:00
Brian Paul
c2bd8197e1 added BitsPerPixel to XMesaVisual struct 2000-01-07 07:24:50 +00:00
Brian Paul
0d7846fe15 updated version string 2000-01-07 07:22:48 +00:00
Brian Paul
0eb3b021ee removed cpp conditionals from _mesa_init_exec_table() 2000-01-07 07:16:34 +00:00
Brian Paul
b44c86d67c fixed GetString template, added GL_SGI_color_table templates 2000-01-07 06:09:05 +00:00
Brian Paul
0a654a5d5a assigned official GL_ARB_transpose_matrix enums 2000-01-07 05:35:37 +00:00
Jouk Jansen
a3bcbfaeb1 Committing in .
Work around for bug in VMS7.2

 Modified Files:
 	Mesa/src-glut/glut_event.c
 ----------------------------------------------------------------------
2000-01-07 01:42:06 +00:00
Brian Paul
075f184b74 return GL_FALSE in fxDDColorMask 2000-01-06 09:30:37 +00:00
Brian Paul
dd020f13a6 updated Clear function for new mask bits 2000-01-06 09:28:38 +00:00
Brian Paul
d3c145b98a new Clear function mask 2000-01-06 09:28:07 +00:00
Brian Paul
276988ec96 minor clean-up in _mesa_unpack_ubyte_color_span() 2000-01-05 09:21:32 +00:00
Brian Paul
316b75ecc2 misc updates 2000-01-05 07:02:15 +00:00
Brian Paul
0aa0e556a1 clean-up of Linux target configs 2000-01-05 06:33:17 +00:00
Brian Paul
26e14d2ea1 removed _glapi_ThreadSafe 2000-01-05 04:36:17 +00:00
Brian Paul
90d9e02f3a start search at 1 in HashFindFreeKeyBlock() 2000-01-04 08:14:36 +00:00
Brian Paul
2d2e9c0c0a added missing glColorTableParameter defines 2000-01-04 08:07:09 +00:00
Brian Paul
53a36fc0da optimized GET_IMMEDIATE for thread safety 1999-12-17 17:01:31 +00:00
Brian Paul
09cb14872e print thread safety info if MESA_INFO set 1999-12-17 17:00:32 +00:00
Brian Paul
26651d0519 updated for new thread support in Mesa 3.3 1999-12-17 15:25:14 +00:00
Brian Paul
a02b03afa4 updated with latest source files 1999-12-17 15:15:46 +00:00
Brian Paul
ef46f450ee replaced mthreads.c with glthread.c 1999-12-17 15:03:52 +00:00
Brian Paul
0003778847 further simplification of thread-related code, misc clean-up 1999-12-17 14:52:35 +00:00
Brian Paul
8f91fb630c added current context functions, made ThreadSafe public 1999-12-17 14:51:28 +00:00
Brian Paul
d3c070ca6a removed old thread code 1999-12-17 12:23:25 +00:00
Brian Paul
c633693a28 fixed thread problems 1999-12-17 12:21:38 +00:00
Brian Paul
590d34726d more tweaking of thread support 1999-12-17 12:20:23 +00:00
Brian Paul
e2b10e72a6 don't free thread data in pthread_key_create() 1999-12-17 11:13:54 +00:00
Brian Paul
6ef84acfec minor clean-up 1999-12-16 17:33:43 +00:00
Brian Paul
bb72d326a0 thread support now works 1999-12-16 17:31:59 +00:00
Brian Paul
c11371a4e5 initial rev 1999-12-16 17:31:06 +00:00
Brian Paul
3aecc51805 minor change 1999-12-16 12:38:54 +00:00
Brian Paul
0c239fc6c5 new threading, more functions added 1999-12-16 12:38:11 +00:00
Brian Paul
e3a49d0cef added more functions 1999-12-16 12:36:54 +00:00
Brian Paul
fd5d305a9f added more extension functions 1999-12-16 12:36:30 +00:00
Brian Paul
24e50d4dea initial rev 1999-12-16 12:35:18 +00:00
Brian Paul
c02db13e00 added a cast to malloc call 1999-12-16 08:54:22 +00:00
Brian Paul
acd181021d added _glapi_get_proc_name() 1999-12-15 15:03:16 +00:00
Brian Paul
0f710258c2 new thread code 1999-12-15 15:02:30 +00:00
Brian Paul
77e898629e initial rev 1999-12-15 13:14:54 +00:00
Brian Paul
95b305cc97 just include Makefile.X11 1999-12-15 13:14:22 +00:00
Brian Paul
381e5555a5 made a few globals static 1999-12-15 13:02:09 +00:00
Brian Paul
7e401c1546 moved #define to column 0 1999-12-15 13:00:45 +00:00
Brian Paul
6625fc53e0 replaced 0 with 0.0 in sin, cos calls 1999-12-15 12:59:52 +00:00
Brian Paul
73ee3ef749 removed _GLAPI_ extension testing 1999-12-15 12:55:54 +00:00
Brian Paul
67661b04f2 added many more extension entry points 1999-12-15 12:52:31 +00:00
Jouk Jansen
945d18a5e2 Committing in .
Update for VMS only

 Modified Files:
 	Mesa/src/stencil.h
 ----------------------------------------------------------------------
1999-12-13 04:08:27 +00:00
Brian Paul
19a2ebd02f removed unneeded code in gluBuild1DMipmaps() 1999-12-12 17:24:18 +00:00
Brian Paul
6fc61407a3 bitmaps were vertically shifted by one pixel 1999-12-12 17:04:50 +00:00
Brian Paul
ff06c837b5 added GLX_ARB_get_proc_address 1999-12-11 09:54:33 +00:00
Brian Paul
97febca0f3 added GLX_ARB_get_proc_address to extension list 1999-12-11 09:20:53 +00:00
Brian Paul
cd96388857 implemented GL_ARB_tranpose_matrix 1999-12-10 20:01:06 +00:00
Brian Paul
0056c5e40d added GL_ARB_transpose_matrix 1999-12-10 19:54:50 +00:00
Brian Paul
1478647932 new depth buffer functions 1999-12-10 19:13:42 +00:00
Brian Paul
4c7fd2cfce pass new args to gl_create_framebuffer 1999-12-10 19:13:14 +00:00
Brian Paul
d91fb9f592 applied Daryll's patches 1999-12-10 19:11:23 +00:00
Brian Paul
4c44d63f01 pass new args to gl_create_framebuffer() 1999-12-10 19:09:59 +00:00
Brian Paul
5c3bee5039 changes in hardware depth buffer support 1999-12-10 19:09:21 +00:00
Brian Paul
f5abeebf49 applied Daryll's patches 1999-12-10 18:56:48 +00:00
Brian Paul
5ee41bda2c updated for hardware stencil support 1999-12-10 16:15:04 +00:00
Brian Paul
86d518ec5b added stencil buffer functions 1999-12-10 16:14:40 +00:00
Brian Paul
ab9f21e68e code clean-up 1999-12-10 15:38:08 +00:00
Brian Paul
e7d9d97471 added glXGetProcAddressARB() 1999-12-10 15:16:49 +00:00
Brian Paul
aaeea91bd0 removed gl_get_proc_address() 1999-12-10 15:13:57 +00:00
Andre Werthmann
7c68acc32e added the katmai_transform_points4_* functions 1999-12-08 11:52:29 +00:00
Jouk Jansen
fce01a5a16 Committing in .
Make supportupdate for VMS

 Modified Files:
 	Mesa/src-glu/descrip.mms Mesa/src-glu/gluP.h
 ----------------------------------------------------------------------
1999-12-07 09:02:12 +00:00
Gareth Hughes
ff5ce773b2 Merging in work from 3.1/3.2 branch. Tessellator is essentially fully
functional now.
1999-12-06 09:39:34 +00:00
Brian Paul
a1216fe3a2 Clearing stencil buffer now observes the stencil write mask
Optimized gl_depth_stencil_span/pixels() functions
1999-12-04 21:23:55 +00:00
Brian Paul
c63a8693bb minor stencil-related changes 1999-12-04 21:23:17 +00:00
Brian Paul
b22ac10c1a added glCopyPixels bug fix 1999-12-03 18:50:48 +00:00
Brian Paul
32c3255e06 test for null newCtx before newCtx->FirstTimeCurrent 1999-12-02 20:33:06 +00:00
Brian Paul
7b0903557a added WM_SYSKEYDOWN case in __wglMonitor() (Eero Pajarre) 1999-12-02 15:21:26 +00:00
Brian Paul
420ef64f18 gl_BindTexture was broken when target==GL_TEXTURE_3D 1999-12-01 21:10:08 +00:00
Brian Paul
eb6e3d3613 fxInitPixelTables() change for Voodoo 1/2 vs 3 1999-12-01 01:22:20 +00:00
Brian Paul
b7a4304f70 print debug info in gl_make_current() if MESA_INFO env var set 1999-11-30 20:34:51 +00:00
Jouk Jansen
2ed15898c4 Committing in .
Update makefiles for VMS due to obsolete files

 Modified Files:
 	Mesa/src/descrip.mms Mesa/src/mms_depend
 ----------------------------------------------------------------------
1999-11-29 08:43:31 +00:00
Brian Paul
e93842b6aa added missing functions in GLX_functions[] array 1999-11-28 20:18:50 +00:00
Brian Paul
36cfa38760 updated comments, removed obsolete functions 1999-11-28 20:15:04 +00:00
Brian Paul
cac5cdd6f7 removed include fakeglx.h 1999-11-28 20:11:56 +00:00
Brian Paul
621a05d12f removed realglx.c 1999-11-28 20:10:24 +00:00
Brian Paul
71600f0ce6 obsolete 1999-11-28 20:09:46 +00:00
Brian Paul
426cb9f58f changes for new GLX dispatcher 1999-11-28 20:08:02 +00:00
Brian Paul
e17ba7120f all new dispatch system 1999-11-28 20:07:33 +00:00
Brian Paul
6f2311270c initial rev 1999-11-28 20:07:19 +00:00
Brian Paul
cdc62309b4 move dispatch table size check into _mesa_init_no_op_table() 1999-11-27 21:42:12 +00:00
Brian Paul
f25e1ac31f added call to _mesa_init_no_op_table() 1999-11-27 21:40:42 +00:00
Brian Paul
59577b577d added _mesa_init_no_op_table() 1999-11-27 21:40:28 +00:00
Brian Paul
91bcefaa49 lots of work on extension management 1999-11-27 21:30:40 +00:00
Brian Paul
4329fd5e47 added _GLAPI_EXTRA_SLOTS symbol 1999-11-27 21:30:10 +00:00
Brian Paul
d850fc3e54 removed Mesa-isms 1999-11-27 01:41:01 +00:00
Brian Paul
a89dccf8f8 updates for 3.1 and later 1999-11-27 01:40:40 +00:00
Brian Paul
7110c37d5e generate Z values when fog enabled (Andree Borrmann) 1999-11-26 16:27:05 +00:00
Brian Paul
88590fb342 include glapitable.h 1999-11-25 18:17:14 +00:00
Brian Paul
7e1161bd2d now using glapitemp.h to generate entrypoints 1999-11-25 18:17:04 +00:00
Brian Paul
1210b0d9f3 initial rev 1999-11-25 18:16:13 +00:00
Brian Paul
21217695d3 include glapi.h 1999-11-25 18:15:23 +00:00
Brian Paul
bd1db5d6b5 added wincopy demo 1999-11-25 17:42:01 +00:00
Brian Paul
b5e4a16e4a initial rev 1999-11-25 17:41:51 +00:00
Brian Paul
c42c33e2a1 bunch of changes for separate read buffer feature 1999-11-25 17:38:12 +00:00
Brian Paul
086a151f94 implemented glXMakeContextCurrent() and glXGetCurrentReadDrawable() 1999-11-25 17:37:49 +00:00
Brian Paul
cea0e8e670 replaced Driver.SetBuffer() with SetDrawBuffer() and SetReadBuffer() 1999-11-25 17:36:48 +00:00
Brian Paul
b6709c8472 updated for Mesa 3.3 1999-11-24 21:17:32 +00:00
Brian Paul
3901be83dd updated with Mesa 3.3 info 1999-11-24 21:13:18 +00:00
Brian Paul
3f02f90f94 added support for separate read/draw buffers per context 1999-11-24 18:48:30 +00:00
Brian Paul
5bf7f47083 removed version logging 1999-11-24 18:45:44 +00:00
Brian Paul
b16103c466 bumped version to 3.3 1999-11-24 18:43:19 +00:00
Brian Paul
2257a12013 added XMesaMakeCurrent2(), XMesaGetCurrentReadBuffer(), bumped version to 3.3 1999-11-24 18:36:14 +00:00
Brian Paul
b314d1d3af added a few more GLX 1.3 tokens 1999-11-24 17:04:46 +00:00
Brian Paul
5fff37ecd4 renamed near and far arguments to gluUnProject4() 1999-11-24 13:06:48 +00:00
Brian Paul
9331b6702c added GLU 1.3 functions 1999-11-23 22:41:10 +00:00
Keith Whitwell
04c43deb54 another typo 1999-11-23 21:15:37 +00:00
Brian Paul
664a1f88f2 added GLX 1.3 tokens and functions 1999-11-23 19:54:53 +00:00
Brian Paul
ad6fd8ed4d added GLX 1.3 functions 1999-11-23 19:54:27 +00:00
Brian Paul
4e176ff358 added _mesa_clip_pixelrect() 1999-11-22 22:21:38 +00:00
Brian Paul
78fc78e0f6 clean up of version handling, removed GLX_EXT_get_proc_address string 1999-11-22 22:17:06 +00:00
Brian Paul
4f145468f4 removed GLU_EXT_get_proc_address from ext strings 1999-11-22 22:15:50 +00:00
Brian Paul
bdbd2e04c8 changed comment for WriteRGBSpan() 1999-11-22 21:54:14 +00:00
Brian Paul
b82d993b03 added glXGetCurrentDisplay() for GLX 1.2 1999-11-22 21:52:23 +00:00
Brian Paul
bf3f9bdaae bumped GLX version to 1.2, added glXGetCurrentDisplay() 1999-11-22 21:51:53 +00:00
Brian Paul
8acb3a1238 fixed potential bug in _mesa_ShadeModel() 1999-11-22 18:58:53 +00:00
Brian Paul
414b6e7c00 added SET/CLEAR/TEST_BITS macros, misc clean-up 1999-11-22 18:57:56 +00:00
Brian Paul
f2db7ed71e fixed shade model bug (A.Borrmann) 1999-11-22 18:28:39 +00:00
Brian Paul
47cdadc626 added pragma 4615 (Eero), added copyright 1999-11-22 14:05:44 +00:00
Brian Paul
ca1ea0ac09 removed redundant fxCloseHardware() decl 1999-11-22 14:02:12 +00:00
Andre Werthmann
172d6c0d44 added more ASM_SRCS 1999-11-22 01:24:25 +00:00
Brian Paul
f0dee6578a renamed struct gl_palette as struct gl_color_table 1999-11-19 22:51:29 +00:00
Brian Paul
7fb54ae3b3 updates for thread safety 1999-11-19 22:33:50 +00:00
Brian Paul
0498682406 updates for Mesa 3.3 1999-11-19 22:26:52 +00:00
Brian Paul
9fd022a905 replace encounteed with encountered 1999-11-19 21:23:37 +00:00
Keith Whitwell
784657c379 fixes for andree's drawarrays problems 1999-11-19 00:03:27 +00:00
Brian Paul
653c83b9b4 two fixes in gl_DrawArrays (Andree Borrman) 1999-11-18 23:56:04 +00:00
Brian Paul
a65efe4b75 reordered the extensions and numbered them 1999-11-18 20:23:31 +00:00
Brian Paul
e160f9419c fixed FX_grSstControl(), now returns FxBool 1999-11-18 19:42:09 +00:00
Brian Paul
e95cc0dce3 removed unused fxTMNewTMFreeNode decl 1999-11-18 19:42:00 +00:00
Brian Paul
4b7526d001 silence an uninitialized var warning 1999-11-18 15:44:37 +00:00
Brian Paul
d0247f53ae test visinfo, not vishandle in save_glx_visual (Wolfram Gloger) 1999-11-18 15:17:01 +00:00
Andre Werthmann
6630e2be01 checked in the first new PIII vertex-transformation code 1999-11-18 09:20:50 +00:00
Brian Paul
36d8d7ae81 fixed some glitches (Eero Pajarre) 1999-11-17 21:19:48 +00:00
Brian Paul
80e872df2b make clean removes .lo .la and .libs/ 1999-11-16 15:49:12 +00:00
Brian Paul
ece75acd6b fixed several texture state bugs found with objbug.c program 1999-11-15 22:21:47 +00:00
Brian Paul
9779220286 texture palette update 1999-11-15 18:18:15 +00:00
Brian Paul
de3c9791b0 include mem.h 1999-11-15 18:17:55 +00:00
Brian Paul
9b006e00ab fixed mistake in merge regarding texture palettes 1999-11-15 18:08:15 +00:00
Brian Paul
5a95679e58 update/merge with Daryll's X server changes 1999-11-15 18:05:00 +00:00
Brian Paul
e23e2759fc changed multi-include guard symbol 1999-11-15 14:26:07 +00:00
Josh Vanderhoof
a2ee2fe360 fixed SSE bugs 1999-11-13 02:25:17 +00:00
Brian Paul
b4334b2b87 replaced EXT_color_table with EXT_paletted_texture 1999-11-12 23:38:42 +00:00
Brian Paul
4586d8769b replaced _GLAPI_EXT_color_table with _GLAPI_EXT_paletted_texture 1999-11-12 18:57:50 +00:00
Brian Paul
789cf43f18 reordered some functions 1999-11-12 18:27:27 +00:00
Brian Paul
2da507defd moved assembly-related macros from types.h to glheader.h 1999-11-12 18:23:47 +00:00
Brian Paul
93b76c048f restored the gl_Viewport function 1999-11-12 18:10:47 +00:00
Kendall Bennett
be599f845f . More Watcom C++ warnings fixed in Mesa. 1999-11-12 16:46:56 +00:00
Kendall Bennett
f945672623 . More fixed to 1999-11-12 16:38:23 +00:00
Brian Paul
8f8d152b2e added glxdpyinfo 1999-11-12 15:47:38 +00:00
Brian Paul
c3ef5952f5 initial check-in 1999-11-12 15:47:28 +00:00
Jouk Jansen
5b974ed6a1 Workaround for the VMS 32 character maximum limit. 1999-11-12 08:32:37 +00:00
Kendall Bennett
e312cf26ea . Updates to get X86, MXX and 3DNow assembler code working with Watcom
C++ and NASM. This includes lots of _ASMAPI macros to ensure that
   assembler functions are prototyped as __cdecl, as Watcom C++ uses
   register calling conventions by default.
 . Misc fixes to files to remove warnings generated by Watcom C++.
1999-11-12 04:56:54 +00:00
Brian Paul
b95d252c34 added GL_EXT_texture_env_add extension 1999-11-12 02:07:56 +00:00
Brian Paul
a087e348ab added gl_extension_is_enabled() 1999-11-12 02:05:46 +00:00
Brian Paul
ea895e6839 added some braces to silence gcc warnings 1999-11-12 00:14:06 +00:00
Brian Paul
d23f90726a minor clean-ups 1999-11-12 00:06:07 +00:00
Brian Paul
1d5971db24 changed a warning string 1999-11-11 17:53:14 +00:00
Brian Paul
845117bd05 ColorTableEXT clean-up 1999-11-11 17:50:04 +00:00
Brian Paul
9ad72cd9b1 removed redundant extension prototypes 1999-11-11 17:48:32 +00:00
Brian Paul
b99db9ea7b updated for new texture color palette struct 1999-11-11 17:11:49 +00:00
Brian Paul
eb1f282b73 don't include strings.h or stdio.h 1999-11-11 15:26:45 +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
Jon Taylor
0b6ae412d3 Disable genkgi sublib handling until we have some sublibs to handle 1999-09-21 00:46:26 +00:00
Keith Whitwell
7d1071526d added mesa.conf 1999-09-20 21:06:57 +00:00
Keith Whitwell
14f8b8b5c3 Bugfix for ctx->backface_sign calculation 1999-09-20 14:30:22 +00:00
Keith Whitwell
5a437d5889 Cleaning up 1999-09-19 23:43:02 +00:00
Keith Whitwell
c656951110 RasterMask was set incorrectly 1999-09-19 23:06:40 +00:00
tanner
bc34adfc54 lots of autoconf updates 1999-09-19 20:09:00 +00:00
Ted Jump
01db31b678 Changed name 'glGetProcAddressEXT' to 'gluGetProcAddressEXT' 1999-09-19 10:04:01 +00:00
Ted Jump
ea8e0b2156 Fixed LIBNAME entry 1999-09-19 10:03:19 +00:00
Ted Jump
a63baa3e8d Removed use of GLU.H - prevents compiler warning wrt:gluGetProcAddressEXT 1999-09-19 09:59:12 +00:00
Ted Jump
32b20284b8 Added NASM support 1999-09-19 09:55:37 +00:00
Ted Jump
725ec81ae8 More Win32 build compliance fixups 1999-09-19 02:03:18 +00:00
Keith Whitwell
1bf9dfaf5d Large patch:
- FX bug fixes.
        - Polygon mode and edgeflag work properly.
	- Clipping works with edgeflag.
	- Driver.ReducedPrimitiveChange() callback so drivers
          that implement lines & points as triangles can turn culling off
	  before rendering groups of these primitives.
        - Cleaned up feedback & select primitives.
1999-09-18 20:41:22 +00:00
Brian Paul
56b58668e8 disabled GL_EXT_get_proc_address for the time being 1999-09-18 01:06:52 +00:00
Brian Paul
e23bb9ff36 added a bunch of missing files to LIB_FILES 1999-09-17 18:08:32 +00:00
Keith Whitwell
39d29fe7fe Fix for write-rgba-span and others 1999-09-17 15:14:02 +00:00
Brian Paul
ecaf1a0865 silenced some warnings 1999-09-17 12:27:01 +00:00
Brian Paul
1bf28c46c2 glGetProcAddressEXT changes to accomodate Win32 and non-Win32 1999-09-17 12:21:36 +00:00
Brian Paul
9b563507cb pad GL_TINY to 6 digits 1999-09-17 12:07:10 +00:00
Brian Paul
d2a57c9b2b pad GLU_TINY to 6 digits 1999-09-17 12:06:56 +00:00
Gareth Hughes
b32966fc80 Winding rule updates. 1999-09-17 06:31:02 +00:00
Jouk Jansen
727f35a518 mesa_wgl.h should only be included when _WIN32 is defined 1999-09-17 05:56:43 +00:00
Ted Jump
477da9eff1 Modified to build better with Mesa wgl functions 1999-09-17 04:27:02 +00:00
Ted Jump
6799ecb675 Relocated wgl function prototypes to separate .h for easier work with fxwgl & glut 1999-09-17 04:25:56 +00:00
Ted Jump
5eea3d068f wgl function prototypes moved out to better work with fxwgl 1999-09-17 04:25:10 +00:00
Ted Jump
d29b1c2ea6 Patch error fixup 1999-09-17 03:17:18 +00:00
Ted Jump
1f256fd6b3 Win32 build req't updates 1999-09-17 03:07:28 +00:00
Ted Jump
3849b44d66 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?
1999-09-17 02:44:19 +00:00
Ted Jump
d043adc890 Cleaned up exit from main to prevent MSVC warnings 1999-09-17 02:41:38 +00:00
Ted Jump
83c02efa52 Added ESC key handling 1999-09-17 02:40:51 +00:00
Ted Jump
74783e9936 Update for beta3 1999-09-17 02:37:14 +00:00
Brian Paul
67e9bd246b fixed typo 1999-09-17 01:00:38 +00:00
Brian Paul
6efd0fb9b5 link with -lGL instead of -lMesaGL 1999-09-17 00:55:21 +00:00
Brian Paul
1300ce1e14 added src-glut.beos back in demo files 1999-09-17 00:54:27 +00:00
Brian Paul
738e977580 link with -lGLU -lGL instead of -lMesaGLU -lMesaGL 1999-09-17 00:07:26 +00:00
Brian Paul
f33e6b1e83 version symbol changes 1999-09-17 00:06:57 +00:00
Brian Paul
20298685c3 gluGetProcAddressEXT change for C++ / BeOS 1999-09-17 00:06:14 +00:00
Brian Paul
3d7e15533f updated for GL instead of MesaGL 1999-09-17 00:03:47 +00:00
Brian Paul
4811b7c7e0 initial check-in 1999-09-16 22:45:24 +00:00
Brian Paul
b9e8741c8f added some casts in gluGetProcAddressEXT() 1999-09-16 22:37:56 +00:00
Brian Paul
1447677fa4 GLU_EXT_get_proc_address clean-up 1999-09-16 16:54:22 +00:00
Brian Paul
978b089aee clean-up of GLU_EXT_get_proc_address 1999-09-16 16:53:28 +00:00
Brian Paul
dd4f708894 GL_EXT_get_proc_address clean-up 1999-09-16 16:47:35 +00:00
Brian Paul
9df2b25af1 added GL_EXT_get_proc_address 1999-09-16 16:44:37 +00:00
Brian Paul
4ed71ebbb9 changed archive filenames to beta3 1999-09-16 16:43:38 +00:00
Brian Paul
92460c25a3 added glxinfo 1999-09-16 16:41:03 +00:00
Brian Paul
d2bfe1ee29 initial check-in 1999-09-16 16:40:46 +00:00
Brian Paul
43c9c2cfae added GLX_MESA_set_3dfx_mode. clean-up of glXGetProcAddress 1999-09-16 15:52:51 +00:00
Brian Paul
17f0efb896 changed version string to return 1.2 1999-09-16 15:46:05 +00:00
Keith Whitwell
e3f37862d2 Do pop for GL_VIEWPORT_BIT via. the api 1999-09-16 11:54:56 +00:00
Gareth Hughes
0099981b1c Misc winding rule bug fixes. 1999-09-16 06:41:42 +00:00
Brian Paul
69b78057d1 bumped version strings to Mesa 3.1 1999-09-15 20:04:04 +00:00
Brian Paul
b7064bcf33 misc changes to tar file list 1999-09-15 19:38:28 +00:00
Brian Paul
7bc00c9ca8 minor library name changes 1999-09-15 17:02:06 +00:00
Brian Paul
c8c391d584 removed mention of libMesaGL 1999-09-15 16:39:01 +00:00
Brian Paul
e42048f937 3.1 beta 3 info 1999-09-15 16:34:43 +00:00
Brian Paul
e300ab8b2b new MESA_ version number symbols 1999-09-15 16:32:48 +00:00
Brian Paul
212e625c24 new version number symbols 1999-09-15 16:31:31 +00:00
Brian Paul
cd65179540 added a few more files to the tar list 1999-09-15 15:20:50 +00:00
Brian Paul
2f49a40a07 added third, tiny version number to mklib scripts 1999-09-15 15:11:01 +00:00
Brian Paul
d9bb106726 added third, tiny version number to arguments 1999-09-15 15:10:20 +00:00
Brian Paul
210ef19797 added TINY version symbol 1999-09-15 15:09:00 +00:00
Brian Paul
af19f37b79 removed unused GLcontext arg from a few functions 1999-09-15 13:56:44 +00:00
Gareth Hughes
a852e8fc0f Added debugging pragma message. 1999-09-15 02:12:16 +00:00
Gareth Hughes
d7c9c1e5c0 Fixed vector macro calls, specifically COPY_3V params. 1999-09-15 02:11:10 +00:00
Gareth Hughes
2b2746fedd Added debugging output. 1999-09-14 22:46:02 +00:00
Brian Paul
bbe0c46722 added linux-386-pthread-shared-glide 1999-09-14 12:20:17 +00:00
Gareth Hughes
d21c43cd15 Win32 fix by Eero Pajarre. 1999-09-14 06:23:40 +00:00
Gareth Hughes
77dcf82d81 Fixed legacy gluNextContour impact on gluTessEndContour. 1999-09-14 05:37:58 +00:00
Gareth Hughes
49e0bc42e2 Fixed GLUtriangulatorObj again (spelling). 1999-09-14 03:23:08 +00:00
Gareth Hughes
32c658b057 Fixed definition of GLUtriangluatorObj for 1.3 tessellator. 1999-09-14 01:32:58 +00:00
Brian Paul
de37ce3e22 fixed pixel packing/unpacking code in gluBuild2DMipmaps() 1999-09-14 00:30:28 +00:00
Brian Paul
a96e8ad978 added gluCheckExtension() 1999-09-14 00:11:40 +00:00
Brian Paul
daa0b0f656 added gluUnProject4() 1999-09-14 00:10:31 +00:00
Gareth Hughes
d1603d4a46 Fixed file headers. Tracking down macro bugs. 1999-09-13 22:20:13 +00:00
Jouk Jansen
70cf58648a strcmp needs the string.h 1999-09-13 14:31:32 +00:00
Brian Paul
eada67136a added Eero's multitexture function patch 1999-09-13 14:09:23 +00:00
Jon Taylor
9c097c0f11 Re-added missing GGIMesa context bufsize structure member 1999-09-13 01:08:37 +00:00
Brian Paul
0f9aed04d8 fixed typo in GetProcAddress 1999-09-12 12:04:13 +00:00
Brian Paul
d8ede96148 clean-up of glXGetProcAddressEXT() 1999-09-11 20:13:21 +00:00
Keith Whitwell
6fd3b96822 bugix from raul for fxddbitmap 1999-09-11 16:01:26 +00:00
Brian Paul
84ffacb978 added 1.2 function to gluGetProcAddressEXT() 1999-09-11 12:04:54 +00:00
Brian Paul
c5d7d70be8 GL_EXT_get_proc_address clean-up 1999-09-11 11:48:11 +00:00
Brian Paul
c0e2871718 include extensions.h 1999-09-11 11:47:15 +00:00
Brian Paul
f893f032fa added GLU_EXT_get_proc_address 1999-09-11 11:34:21 +00:00
Brian Paul
89a42b7e73 added GLX_EXT_get_proc_address 1999-09-11 11:33:45 +00:00
Brian Paul
585a68c82b added GL_EXT_get_proc_address 1999-09-11 11:31:34 +00:00
Brian Paul
ed3453350a added GL_EXT_get_proc_address 1999-09-11 11:26:34 +00:00
Keith Whitwell
6c8657fa5f new DD_Z_NEVER flag 1999-09-10 14:24:35 +00:00
Gareth Hughes
f0f3815e4f Fixed triangle output, recovery process termination. 1999-09-10 04:32:10 +00:00
Brian Paul
95740b2c11 changed C++ comments to C style 1999-09-10 03:05:04 +00:00
Gareth Hughes
2856b53e03 Added GLU 1.3 tessellation (except winding rule code). 1999-09-10 02:03:31 +00:00
Brian Paul
2ba7c1cbe4 moved gl_GetPointerv() into get.h 1999-09-09 23:48:02 +00:00
Brian Paul
00dd504c72 moved gl_GetString() into get.c 1999-09-09 23:47:09 +00:00
Miklos Fazekas
e4c15c12d8 More compliant error check. 1999-09-09 18:49:36 +00:00
Brian Paul
36ca6bd82a minor changes. always call compactify_arrays() 1999-09-08 22:14:31 +00:00
Brian Paul
45224face0 removed TexCoordUnit from GLcontext, use Array.ActiveTexture instead 1999-09-07 22:31:30 +00:00
Brian Paul
2ca99ca2e7 added vertices.c 1999-09-07 21:32:30 +00:00
Keith Whitwell
9b7c843671 fixes for the mga driver 1999-09-05 19:59:33 +00:00
Keith Whitwell
324beb95f3 fix for mga depthbuffer resize 1999-09-04 14:40:49 +00:00
Keith Whitwell
da54ffc852 more bugfixes 1999-09-03 15:48:54 +00:00
Keith Whitwell
44c73933e9 Fog, displaylist and zoom operations 1999-09-03 14:56:40 +00:00
Keith Whitwell
8d8e248ab2 fix for GL_COMPILE_AND_EXECUTE bug 1999-09-03 11:53:33 +00:00
Keith Whitwell
b6e6937287 fixed GL_FRONT_AND_BACK cull bug 1999-09-02 13:16:17 +00:00
Jouk Jansen
a4bb2ef30e Added vertices.c to compile list 1999-08-30 07:13:55 +00:00
Keith Whitwell
d858a651d8 removed bogus call 1999-08-29 16:18:23 +00:00
Keith Whitwell
50149b085e more fixes on the fast path 1999-08-29 14:06:02 +00:00
Keith Whitwell
3875679607 new files to support vertex-based geometry 1999-08-29 10:26:31 +00:00
Josh Vanderhoof
4f738b4c10 features weren 1999-08-28 01:38:54 +00:00
Jon Taylor
a43cfd71da Fixed double buffering bug when running in X 1999-08-27 21:06:30 +00:00
Jouk Jansen
443dd9fd4d This time the correct file 1999-08-27 11:02:57 +00:00
Keith Whitwell
2be79c1aa2 various pipeline bugs 1999-08-26 14:50:49 +00:00
Jouk Jansen
0552b30633 Update after disk crash 1999-08-24 12:34:50 +00:00
Jouk Jansen
49160c9a81 Update after disk crash 1999-08-24 12:34:20 +00:00
Jon Taylor
668b4ab2fa *** empty log message *** 1999-08-24 02:03:34 +00:00
Jon Taylor
6583efcfe9 Misc small cleanups 1999-08-23 22:34:08 +00:00
Jon Taylor
e76342e688 Updated to reflect GGIMesa 3.1 changes 1999-08-23 22:22:31 +00:00
Jon Taylor
7b9c36d568 *** empty log message *** 1999-08-23 21:13:19 +00:00
Jon Taylor
72fc9a527d *** empty log message *** 1999-08-22 08:56:50 +00:00
Jon Taylor
14c53fe1d5 *** empty log message *** 1999-08-21 22:46:13 +00:00
Jon Taylor
035e8d0143 *** empty log message *** 1999-08-21 22:36:52 +00:00
Jon Taylor
b35b28e4d9 *** empty log message *** 1999-08-21 08:53:27 +00:00
Jon Taylor
035e96ec3c *** empty log message *** 1999-08-21 06:27:37 +00:00
Jon Taylor
95dcb43951 *** empty log message *** 1999-08-21 05:57:17 +00:00
Brian Paul
212ce73b08 added a few more bug fixes 1999-08-20 01:19:36 +00:00
Brian Paul
b30e70436c fixed alpha channel problem in gl_blend_pixels() 1999-08-19 15:48:01 +00:00
Brian Paul
a4dcdcf0ff initial check-in (post crash) 1999-08-19 13:57:42 +00:00
Brian Paul
2d550f6ff1 initial check-in (post-crash) 1999-08-19 13:52:56 +00:00
Brian Paul
5a41d02502 minor change for irix-debug 1999-08-19 13:26:16 +00:00
Brian Paul
65b5e1e3fd glIsEnabled(GL_TEXTURE_3D) was wrong 1999-08-19 13:24:27 +00:00
Brian Paul
cddc583aeb testing 1999-08-19 11:54:28 +00:00
473 changed files with 143220 additions and 28129 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -1,20 +1,20 @@
# $Id: Makefile.X11,v 1.1 1999/08/19 00:55:39 jtg Exp $
# $Id: Makefile.X11,v 1.32.2.5 2000/10/26 19:35:53 brianp Exp $
# Mesa 3-D graphics library
# Version: 3.1
#
# Copyright (C) 1999 Brian Paul All Rights Reserved.
#
# Version: 3.4
#
# Copyright (C) 1999-2000 Brian Paul All Rights Reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
# and/or sell copies of the Software, and to permit persons to whom the
# Software is furnished to do so, subject to the following conditions:
#
#
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.
#
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
@@ -66,24 +66,21 @@ default:
@echo " make irix6-64 for SGI systems with IRIX 6.x, make 64-bit libs"
@echo " make irix6-64-dso for SGI systems with IRIX 6.x, make 64-bit DSOs"
@echo " make linux for Linux systems, make static .a libs"
@echo " make linux-elf for Linux systems, make ELF shared libs"
@echo " make linux-386 for Linux w/ Intel assembly"
@echo " make linux-386-elf for Linux w/ Intel assembly, make ELF shared libs"
@echo " make linux for Linux systems, make shared .so libs"
@echo " make linux-static for Linux systems, make static .a libs"
@echo " make linux-x86 for Linux on Intel, make shared .so libs"
@echo " make linux-x86-static for Linux on Intel, make static .a libs"
@echo " make linux-ggi for Linux systems with libggi"
@echo " make linux-386-ggi for Linux systems with libggi w/ Intel assembly"
@echo " make linux-alpha for Linux on Alpha systems"
@echo " make linux-alpha-elf for Linux on Alpha systems, make ELF shared libs"
@echo " make linux-ppc for Linux on PowerPC systems"
@echo " make linux-ppc-so for Linux on PowerPC systems, make shared libs"
@echo " make linux-glide for Linux w/ 3Dfx Glide driver"
@echo " make linux-386-glide for Linux w/ 3Dfx Glide driver, Intel assembly"
@echo " make linux-386-opt-glide for Linux with 3Dfx Voodoo1 for GLQuake"
@echo " make linux-386-opt-V2-glide for Linux with 3Dfx Voodoo2 for GLQuake"
@echo " make linux-3dnow for Linux on AMD w/ 3DNow!"
@echo " make linux-3dnow-glide for Linux on AMD w/ 3DNow! for Glide"
@echo " make linux-386-pthread for Linux w/ Intel assembly and linuxthreads"
@echo " make linux-386-pthread-shared for Linux w/ Intel assembly and linuxthreads"
@echo " make linux-x86-glide for Linux w/ all x86 asm for Glide"
@echo " make linux-alpha for Linux on Alpha systems"
@echo " make linux-alpha-static for Linux on Alpha systems, static libs"
@echo " make linux-ppc for Linux on PowerPC systems"
@echo " make linux-ppc-static for Linux on PowerPC systems, static libs"
@echo " make linux-sparc for Linux on Sparc systems"
@echo " make linux-sparc5-elf for Sparc5 systems, make ELF shared libs"
@echo " make linux-sparc-ultra for UltraSparc systems, make ELF shared libs"
@@ -103,6 +100,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"
@@ -137,50 +135,52 @@ default:
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 \
irix-debug irix4 irix5 irix5-gcc irix5-dso irix6-o32 irix6-o32-dso \
linux linux-debug linux-prof linux-elf linux-elf-debug \
irix4 irix5 irix5-gcc irix5-dso irix6-o32 irix6-o32-dso \
linux linux-static linux-debug linux-static-debug linux-prof \
linux-x86 linux-x86-static linux-x86-debug \
linux-glide linux-386-glide linux-386-opt-glide \
linux-386-opt-V2-glide \
linux-386 linux-386-elf \
linux-3dnow linux-3dnow-glide \
linux-alpha linux-alpha-elf \
linux-ppc linux-ppc-so \
linux-386-pthread linux-386-pthread-shared \
linux-386-opt-V2-glide linux-x86-glide linux-glide-debug linux-glide-prof \
linux-alpha-static linux-alpha \
linux-ppc-static linux-ppc \
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 \
sunos5-thread sunos5-pthread sunos5-gcc-thread sunos5-gcc-pthread \
sunos5-x11r6-gcc-sl ultrix-gcc unicos unixware uwin vistra:
-mkdir lib
touch src/depend
touch src-glu/depend
if [ -d src ] ; then touch src/depend ; fi
if [ -d src-glu ] ; then touch src-glu/depend ; fi
if [ -d src-glut ] ; then touch src-glut/depend ; fi
cd src ; $(MAKE) -f Makefile.X11 $@
cd src-glu ; $(MAKE) -f Makefile.X11 $@
if [ -d widgets-sgi ] ; then touch widgets-sgi/depend ; fi
if [ -d src ] ; then cd src ; $(MAKE) -f Makefile.X11 $@ ; fi
if [ -d src-glu ] ; then cd src-glu ; $(MAKE) -f Makefile.X11 $@ ; fi
if [ -d src-glut ] ; then cd src-glut ; $(MAKE) -f Makefile.X11 $@ ; fi
if [ -d demos ] ; then cd demos ; $(MAKE) -f Makefile.X11 $@ ; fi
if [ -d xdemos ] ; then cd xdemos ; $(MAKE) -f Makefile.X11 $@ ; fi
if [ -d samples ] ; then cd samples ; $(MAKE) -f Makefile.X11 $@ ; fi
if [ -d book ] ; then cd book ; $(MAKE) -f Makefile.X11 $@ ; fi
if [ -d demos ] ; then cd demos ; $(MAKE) -f Makefile.X11 $@ ; fi
if [ -d xdemos ] ; then cd xdemos ; $(MAKE) -f Makefile.X11 $@ ; fi
if [ -d samples ] ; then cd samples ; $(MAKE) -f Makefile.X11 $@ ; fi
if [ -d book ] ; then cd book ; $(MAKE) -f Makefile.X11 $@ ; fi
if [ -d widgets-sgi ] ; then cd widgets-sgi; $(MAKE) -f Makefile.X11 $@ ; fi
irix6-n32 irix6-n32-dso irix6-gcc-n32-sl:
irix6-n32 irix6-n32-dso irix6-gcc-n32-sl irix-debug:
-mkdir lib32
touch src/depend
touch src-glu/depend
if [ -d src ] ; then touch src/depend ; fi
if [ -d src-glu ] ; then touch src-glu/depend ; fi
if [ -d src-glut ] ; then touch src-glut/depend ; fi
cd src ; $(MAKE) -f Makefile.X11 $@
cd src-glu ; $(MAKE) -f Makefile.X11 $@
if [ -d src-glut ] ; then touch src-glut/depend ; fi
if [ -d widgets-sgi ] ; then touch widgets-sgi/depend ; fi
if [ -d src ] ; then cd src ; $(MAKE) -f Makefile.X11 $@ ; fi
if [ -d src-glu ] ; then cd src-glu ; $(MAKE) -f Makefile.X11 $@ ; fi
if [ -d src-glut ] ; then cd src-glut ; $(MAKE) -f Makefile.X11 $@ ; fi
if [ -d demos ] ; then cd demos ; $(MAKE) -f Makefile.X11 $@ ; fi
if [ -d xdemos ] ; then cd xdemos ; $(MAKE) -f Makefile.X11 $@ ; fi
if [ -d samples ] ; then cd samples ; $(MAKE) -f Makefile.X11 $@ ; fi
if [ -d book ] ; then cd book ; $(MAKE) -f Makefile.X11 $@ ; fi
if [ -d demos ] ; then cd demos ; $(MAKE) -f Makefile.X11 $@ ; fi
if [ -d xdemos ] ; then cd xdemos ; $(MAKE) -f Makefile.X11 $@ ; fi
if [ -d samples ] ; then cd samples ; $(MAKE) -f Makefile.X11 $@ ; fi
if [ -d book ] ; then cd book ; $(MAKE) -f Makefile.X11 $@ ; fi
if [ -d widgets-sgi ] ; then cd widgets-sgi; $(MAKE) -f Makefile.X11 $@ ; fi
irix6-64 irix6-64-dso:
@@ -188,13 +188,15 @@ irix6-64 irix6-64-dso:
touch src/depend
touch src-glu/depend
if [ -d src-glut ] ; then touch src-glut/depend ; fi
cd src ; $(MAKE) -f Makefile.X11 $@
cd src-glu ; $(MAKE) -f Makefile.X11 $@
if [ -d widgets-sgi ] ; then touch widgets-sgi/depend ; fi
if [ -d src ] ; then cd src ; $(MAKE) -f Makefile.X11 $@ ; fi
if [ -d src-glu ] ; then cd src-glu ; $(MAKE) -f Makefile.X11 $@ ; fi
if [ -d src-glut ] ; then cd src-glut ; $(MAKE) -f Makefile.X11 $@ ; fi
if [ -d demos ] ; then cd demos ; $(MAKE) -f Makefile.X11 $@ ; fi
if [ -d xdemos ] ; then cd xdemos ; $(MAKE) -f Makefile.X11 $@ ; fi
if [ -d samples ] ; then cd samples ; $(MAKE) -f Makefile.X11 $@ ; fi
if [ -d book ] ; then cd book ; $(MAKE) -f Makefile.X11 $@ ; fi
if [ -d demos ] ; then cd demos ; $(MAKE) -f Makefile.X11 $@ ; fi
if [ -d xdemos ] ; then cd xdemos ; $(MAKE) -f Makefile.X11 $@ ; fi
if [ -d samples ] ; then cd samples ; $(MAKE) -f Makefile.X11 $@ ; fi
if [ -d book ] ; then cd book ; $(MAKE) -f Makefile.X11 $@ ; fi
if [ -d widgets-sgi ] ; then cd widgets-sgi; $(MAKE) -f Makefile.X11 $@ ; fi
amiwin:
@@ -207,25 +209,27 @@ beos-r4:
touch src/depend
-rm src-glu/depend
touch src-glu/depend
cd src ; $(MAKE) -f Makefile.BeOS-R4 $@
cd src-glu ; $(MAKE) -f Makefile.BeOS-R4 $@
if [ -d BeOS ] ; then cd BeOS ; $(MAKE) ; fi
if [ -d src-glut.beos ] ; then cd src-glut.beos ; $(MAKE) ; fi
if [ -d src ] ; then cd src ; $(MAKE) -f Makefile.BeOS-R4 $@ ; fi
if [ -d src-glu ] ; then cd src-glu ; $(MAKE) -f Makefile.BeOS-R4 $@ ; fi
if [ -d BeOS ] ; then cd BeOS ; $(MAKE) ; fi
if [ -d src-glut.beos ] ; then cd src-glut.beos ; $(MAKE) ; fi
if [ -d src-glut.beos ] ; then cp src-glut.beos/obj*/libglut.so lib ; fi
if [ -d demos ] ; then cd demos ; $(MAKE) -f Makefile.BeOS-R4 $@ ; fi
if [ -d demos ] ; then cd demos ; $(MAKE) -f Makefile.BeOS-R4 $@ ; fi
if [ -d samples ] ; then cd samples ; $(MAKE) -f Makefile.BeOS-R4 $@ ; fi
if [ -d book ] ; then cd book ; $(MAKE) -f Makefile.BeOS-R4 $@ ; fi
if [ -d book ] ; then cd book ; $(MAKE) -f Makefile.BeOS-R4 $@ ; fi
pgi-cygnus pgi-mingw32 \
cygnus cygnus-linux:
-mkdir lib
touch src/depend
touch src-glu/depend
cd src ; $(MAKE) -f Makefile.X11 $@
cd src-glu ; $(MAKE) -f Makefile.X11 $@
cd src-glut ; $(MAKE) -f Makefile.X11 $@
cd demos ; $(MAKE) -f Makefile.X11 $@
if [ -d xdemos ] ; then cd xdemos ; $(MAKE) -f Makefile.X11 $@ ; fi
if [ -d widgets-sgi ] ; then touch widgets-sgi/depend ; fi
if [ -d src ] ; then cd src ; $(MAKE) -f Makefile.X11 $@ ; fi
if [ -d src-glu ] ; then cd src-glu ; $(MAKE) -f Makefile.X11 $@ ; fi
if [ -d src-glut ] ; then cd src-glut ; $(MAKE) -f Makefile.X11 $@ ; fi
if [ -d demos ] ; then cd demos ; $(MAKE) -f Makefile.X11 $@ ; fi
if [ -d xdemos ] ; then cd xdemos ; $(MAKE) -f Makefile.X11 $@ ; fi
if [ -d widgets-sgi ] ; then cd widgets-sgi; $(MAKE) -f Makefile.X11 $@ ; fi
macintosh:
@echo "See the README file for Macintosh intallation information"
@@ -257,19 +261,21 @@ linux-ggi linux-386-ggi:
-mkdir lib
touch src/depend
touch src-glu/depend
if [ -d src-glut ] ; then touch src-glut/depend ; fi
if [ -d ggi ] ; then touch ggi/depend ; fi
cd src ; $(MAKE) -f Makefile.X11 $@
cd src/GGI/default ; $(MAKE)
cd src/GGI/display ; $(MAKE)
cd src-glu ; $(MAKE) -f Makefile.X11 $@
if [ -d src-glut ] ; then touch src-glut/depend ; fi
if [ -d widgets-sgi ] ; then touch widgets-sgi/depend ; fi
if [ -d ggi ] ; then touch ggi/depend ; fi
if [ -d src ] ; then cd src ; $(MAKE) -f Makefile.X11 $@ ; fi
if [ -d src/GGI/default ] ; then cd src/GGI/default ; $(MAKE) ; fi
if [ -d src/GGI/display ] ; then cd src/GGI/display ; $(MAKE) ; fi
if [ -d src-glut ] ; then cd src-glu ; $(MAKE) -f Makefile.X11 $@ ; fi
# if [ -d src-glut ] ; then cd src-glut ; $(MAKE) -f Makefile.X11 $@ ; fi
if [ -d ggi ] ; then cd ggi ; $(MAKE) -f Makefile.X11 $@ ; fi
if [ -d ggi ] ; then cd ggi/demos; $(MAKE) ; fi
if [ -d ggi ] ; then cd ggi/demos; $(MAKE) ; fi
if [ -d demos ] ; then cd demos ; $(MAKE) -f Makefile.X11 $@ ; fi
if [ -d xdemos ] ; then cd xdemos ; $(MAKE) -f Makefile.X11 $@ ; fi
if [ -d samples ] ; then cd samples ; $(MAKE) -f Makefile.X11 $@ ; fi
if [ -d book ] ; then cd book ; $(MAKE) -f Makefile.X11 $@ ; fi
if [ -d widgets-sgi ] ; then cd widgets-sgi; $(MAKE) -f Makefile.X11 $@ ; fi
# if you change GGI_DEST please change it in ggimesa.conf, too.
DESTDIR=/usr/local
@@ -299,6 +305,8 @@ clean:
-rm -f xdemos/*.o xdemos/*~
-rm -f samples/*.o samples/*~
-rm -f ggi/*.o ggi/demos/*.o ggi/*.a
-rm -f widgets-sgi/*.o
-rm -f widgets-mesa/*/*.o
# Remove everything that can be remade
realclean: clean
@@ -307,14 +315,16 @@ 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.1beta2
DEMO_NAME = MesaDemos-3.1beta2
DIRECTORY = Mesa-3.4
LIB_NAME = MesaLib-3.4
DEMO_NAME = MesaDemos-3.4
GLU_NAME = MesaGLU-3.4
GLUT_NAME = GLUT-3.7
LIB_FILES = \
@@ -334,18 +344,20 @@ LIB_FILES = \
$(DIRECTORY)/missing \
$(DIRECTORY)/mkinstalldirs \
$(DIRECTORY)/stamp-h.in \
$(DIRECTORY)/INSTALL \
$(DIRECTORY)/INSTALL.GNU \
$(DIRECTORY)/configure \
$(DIRECTORY)/docs/CONFIG \
$(DIRECTORY)/docs/CONFORM \
$(DIRECTORY)/docs/COPYING \
$(DIRECTORY)/docs/COPYRIGHT \
$(DIRECTORY)/docs/DEVINFO \
$(DIRECTORY)/docs/IAFA-PACKAGE \
$(DIRECTORY)/docs/LICENSE \
$(DIRECTORY)/docs/INSTALL \
$(DIRECTORY)/docs/INSTALL.GNU \
$(DIRECTORY)/docs/README \
$(DIRECTORY)/docs/README.* \
$(DIRECTORY)/docs/RELNOTES \
$(DIRECTORY)/docs/RELNOTES* \
$(DIRECTORY)/docs/VERSIONS \
$(DIRECTORY)/docs/*.spec \
$(DIRECTORY)/bin/README \
$(DIRECTORY)/bin/mklib* \
$(DIRECTORY)/*.BAT \
$(DIRECTORY)/*.bat \
@@ -356,17 +368,21 @@ LIB_FILES = \
$(DIRECTORY)/mesawin32.mak \
$(DIRECTORY)/Names.win \
$(DIRECTORY)/win32-openstep.sh \
$(DIRECTORY)/*.dja \
$(DIRECTORY)/common.dja \
$(DIRECTORY)/include/GL/Makefile.in \
$(DIRECTORY)/include/GL/Makefile.am \
$(DIRECTORY)/include/GL/dosmesa.h \
$(DIRECTORY)/include/GL/foomesa.h \
$(DIRECTORY)/include/GL/amesa.h \
$(DIRECTORY)/include/GL/fxmesa.h \
$(DIRECTORY)/include/GL/ggimesa.h \
$(DIRECTORY)/include/GL/gl.h \
$(DIRECTORY)/include/GL/glext.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/mesa_wgl.h \
$(DIRECTORY)/include/GL/mglmesa.h \
$(DIRECTORY)/include/GL/osmesa.h \
$(DIRECTORY)/include/GL/svgamesa.h \
@@ -375,9 +391,12 @@ LIB_FILES = \
$(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] \
@@ -394,55 +413,118 @@ LIB_FILES = \
$(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/GGI/*.[ch] \
$(DIRECTORY)/src/GGI/ggimesa.conf \
$(DIRECTORY)/src/GGI/default/*.c \
$(DIRECTORY)/src/GGI/default/Makefile \
$(DIRECTORY)/src/GGI/display/*.c \
$(DIRECTORY)/src/GGI/display/Makefile \
$(DIRECTORY)/src/KNOWN_BUGS \
$(DIRECTORY)/src/MGL/*.[ch] \
$(DIRECTORY)/src/MGL/*.txt \
$(DIRECTORY)/src/OSmesa/*.[ch] \
$(DIRECTORY)/src/S3/*.[ch] \
$(DIRECTORY)/src/S3/*.def \
$(DIRECTORY)/src/S3/*.mak \
$(DIRECTORY)/src/S3/*.rc \
$(DIRECTORY)/src/SVGA/*.[ch] \
$(DIRECTORY)/src/Windows/*.[ch] \
$(DIRECTORY)/src/Windows/*.def \
$(DIRECTORY)/src/X/*.[ch] \
$(DIRECTORY)/src/X86/*.[ch] \
$(DIRECTORY)/src/X86/Makefile \
$(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/*.[ch] \
$(DIRECTORY)/util/sampleMakefile \
$(DIRECTORY)/BeOS/Makefile \
$(DIRECTORY)/BeOS/*.cpp
# old stuff
# $(DIRECTORY)/Win32 \
# $(DIRECTORY)/win32
# $(DIRECTORY)/OpenStep \
#
#
$(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] \
$(DIRECTORY)/src/GGI/ggimesa.conf.in \
$(DIRECTORY)/src/GGI/default/*.c \
$(DIRECTORY)/src/GGI/default/Makefile.am \
$(DIRECTORY)/src/GGI/default/Makefile.in \
$(DIRECTORY)/src/GGI/default/genkgi.conf.in \
$(DIRECTORY)/src/GGI/display/*.c \
$(DIRECTORY)/src/GGI/display/Makefile.am \
$(DIRECTORY)/src/GGI/display/Makefile.in \
$(DIRECTORY)/src/GGI/display/fbdev.conf.in \
$(DIRECTORY)/src/GGI/include/Makefile.am \
$(DIRECTORY)/src/GGI/include/Makefile.in \
$(DIRECTORY)/src/GGI/include/ggi/Makefile.am \
$(DIRECTORY)/src/GGI/include/ggi/Makefile.in \
$(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/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/*.S \
$(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/depend \
$(DIRECTORY)/src-glu/*.[ch] \
$(DIRECTORY)/widgets-mesa/ChangeLog \
$(DIRECTORY)/widgets-mesa/INSTALL \
$(DIRECTORY)/widgets-mesa/Makefile.in \
$(DIRECTORY)/widgets-mesa/README \
$(DIRECTORY)/widgets-mesa/TODO \
$(DIRECTORY)/widgets-mesa/configure \
$(DIRECTORY)/widgets-mesa/demos/ChangeLog \
$(DIRECTORY)/widgets-mesa/demos/Cube \
$(DIRECTORY)/widgets-mesa/demos/Ed \
$(DIRECTORY)/widgets-mesa/demos/Makefile.in \
$(DIRECTORY)/widgets-mesa/demos/Mcube \
$(DIRECTORY)/widgets-mesa/demos/Tea \
$(DIRECTORY)/widgets-mesa/demos/*.[ch] \
$(DIRECTORY)/widgets-mesa/demos/events \
$(DIRECTORY)/widgets-mesa/include/GL/ChangeLog \
$(DIRECTORY)/widgets-mesa/include/GL/*.h \
$(DIRECTORY)/widgets-mesa/include/GL/Makefile.in \
$(DIRECTORY)/widgets-mesa/man/ChangeLog \
$(DIRECTORY)/widgets-mesa/man/GL* \
$(DIRECTORY)/widgets-mesa/man/Makefile.in \
$(DIRECTORY)/widgets-mesa/man/Mesa* \
$(DIRECTORY)/widgets-mesa/src/ChangeLog \
$(DIRECTORY)/widgets-mesa/src/*.c \
$(DIRECTORY)/widgets-mesa/src/Makefile.in \
$(DIRECTORY)/widgets-sgi/*.[ch] \
$(DIRECTORY)/widgets-sgi/Makefile* \
$(DIRECTORY)/widgets-sgi/README \
$(DIRECTORY)/util/README \
$(DIRECTORY)/util/Makefile.am \
$(DIRECTORY)/util/Makefile.in \
$(DIRECTORY)/util/*.[ch] \
$(DIRECTORY)/util/sampleMakefile \
$(DIRECTORY)/vms/analyze_map.com \
$(DIRECTORY)/vms/xlib.opt \
$(DIRECTORY)/vms/xlib_share.opt \
$(DIRECTORY)/BeOS/Makefile \
$(DIRECTORY)/BeOS/*.cpp \
$(DIRECTORY)/WIN32/NMAKE.MAK \
$(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/cglpane/CGLPane.* \
$(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] \
$(DIRECTORY)/OpenStep
DEMO_FILES = \
$(DIRECTORY)/include/GL/glut.h \
@@ -462,7 +544,9 @@ DEMO_FILES = \
$(DIRECTORY)/demos/Makefile* \
$(DIRECTORY)/demos/descrip.mms \
$(DIRECTORY)/demos/*.[ch] \
$(DIRECTORY)/demos/*.cxx \
$(DIRECTORY)/demos/*.dat \
$(DIRECTORY)/demos/README \
$(DIRECTORY)/xdemos/Makefile* \
$(DIRECTORY)/xdemos/descrip.mms \
$(DIRECTORY)/xdemos/*.[cf] \
@@ -472,13 +556,52 @@ DEMO_FILES = \
$(DIRECTORY)/samples/Makefile* \
$(DIRECTORY)/samples/README \
$(DIRECTORY)/samples/*.c \
$(DIRECTORY)/samples/*.dja \
$(DIRECTORY)/3Dfx \
$(DIRECTORY)/mtdemos \
$(DIRECTORY)/ggi
GLU_FILES = \
$(DIRECTORY)/Makefile* \
$(DIRECTORY)/Make-config \
$(DIRECTORY)/bin/mklib* \
$(DIRECTORY)/include/GL/gl.h \
$(DIRECTORY)/include/GL/gl_mangle.h \
$(DIRECTORY)/include/GL/glext.h \
$(DIRECTORY)/include/GL/glu.h \
$(DIRECTORY)/include/GL/glu_mangle.h \
$(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/depend \
$(DIRECTORY)/src-glu/*.[ch]
GLUT_FILES = \
$(DIRECTORY)/Makefile* \
$(DIRECTORY)/Make-config \
$(DIRECTORY)/bin/mklib* \
$(DIRECTORY)/include/GL/gl.h \
$(DIRECTORY)/include/GL/gl_mangle.h \
$(DIRECTORY)/include/GL/glext.h \
$(DIRECTORY)/include/GL/glu.h \
$(DIRECTORY)/include/GL/glu_mangle.h \
$(DIRECTORY)/include/GL/glut.h \
$(DIRECTORY)/include/GL/glutf90.h \
$(DIRECTORY)/include/GL/glut_h.dja \
$(DIRECTORY)/src-glut/Makefile* \
$(DIRECTORY)/src-glut/depend \
$(DIRECTORY)/src-glut/*def \
$(DIRECTORY)/src-glut/descrip.mms \
$(DIRECTORY)/src-glut/mms_depend \
$(DIRECTORY)/src-glut/*.[ch] \
$(DIRECTORY)/src-glut.dja/* \
$(DIRECTORY)/src-glut.beos/Makefile \
$(DIRECTORY)/src-glut.beos/*.cpp \
$(DIRECTORY)/src-glut.beos/*.h
lib_tar:
cp Makefile.X11 Makefile ; \
cd .. ; \
tar -cvf $(LIB_NAME).tar $(LIB_FILES) ; \
gzip $(LIB_NAME).tar ; \
@@ -490,14 +613,30 @@ demo_tar:
gzip $(DEMO_NAME).tar ; \
mv $(DEMO_NAME).tar.gz $(DIRECTORY)
glu_tar:
cp Makefile.X11 Makefile ; \
cd .. ; \
tar -cvf $(GLU_NAME).tar $(GLU_FILES) ; \
gzip $(GLU_NAME).tar ; \
mv $(GLU_NAME).tar.gz $(DIRECTORY)
glut_tar:
cp Makefile.X11 Makefile ; \
cd .. ; \
tar -cvf $(GLUT_NAME).tar $(GLUT_FILES) ; \
gzip $(GLUT_NAME).tar ; \
mv $(GLUT_NAME).tar.gz $(DIRECTORY)
lib_zip:
-rm $(LIB_NAME).zip
-rm $(LIB_NAME).zip ; \
cp Makefile.X11 Makefile ; \
cd .. ; \
zip -r $(LIB_NAME).zip $(LIB_FILES) ; \
mv $(LIB_NAME).zip $(DIRECTORY)
demo_zip:
-rm $(DEMO_NAME).zip
-rm $(DEMO_NAME).zip ; \
cd .. ; \
zip -r $(DEMO_NAME).zip $(DEMO_FILES) ; \
mv $(DEMO_NAME).zip $(DIRECTORY)

153
bin/mklib.aix Executable file
View File

@@ -0,0 +1,153 @@
#!/bin/ksh
# Make an AIX shared library (tricky!!!)
# Based on a script from Athanasios G. Gaitatzes (gaitat@vnet.ibm.com)
# Improved by Greg Thompson <gregt@visix.com> -gt
#--identification------------------------------------------------------
# $Id: mklib.aix,v 1.2 1999/09/15 15:10:20 brianp Exp $
# $Log: mklib.aix,v $
# Revision 1.2 1999/09/15 15:10:20 brianp
# added third, tiny version number to arguments
#
# Revision 1.1 1999/08/19 13:52:56 brianp
# initial check-in (post-crash)
#
#--common--------------------------------------------------------------
LIBRARY=$1
shift 1
MAJOR=$1
shift 1
MINOR=$1
shift 1
TINY=$1
shift 1
OBJECTS=$*
#--platform------------------------------------------------------------
# BASENAME = LIBRARY without .a suffix
BASENAME=`echo ${LIBRARY} | sed "s/\.a//g"`
# Name of exports file
EXPFILE=${BASENAME}.exp
# Name of temporary shared lib file
OFILE=shr.o
####OFILE=${BASENAME}.o
# Remove any old files from previous make
rm -f ${LIBRARY} ${EXPFILE} ${OFILE}
# Pick a way to use nm -gt
NM=${NM-/bin/nm -eC}
# Determine which version of AIX this is
AIXVERSION=`uname -v`
# Pick a way to tell the linker there's no entrypoint -gt
case ${AIXVERSION}
{
3*)
ENTRY='-e _nostart'
;;
4*)
ENTRY=-bnoentry
;;
*)
echo "Error in mklib.aix!"
exit 1
;;
}
# Other libraries which we may be dependent on. Since we make the libraries
# in the order libGL.a, libaGLU.a, libglut.a just depends on its predecessor.
# modified to make otherlibs in the form of -lfoo -gt
OTHERLIBS=`ls ../lib/*.a | sed "s/..\/lib\/lib/-l/g" | sed "s/\.a//g"`
##echo OTHERLIBS are ${OTHERLIBS}
# Make exports (.exp) file header
echo "#! ${LIBRARY}" > ${EXPFILE}
# Append list of exported symbols to exports file -gt
case ${AIXVERSION}
{
3*)
${NM} ${OBJECTS} | awk -F'|' '{
if ($3 != "extern" || substr($7,1,1) == " ") continue
sub (" *", "", $1); sub (" *", "", $7)
if ( (($7 == ".text") || ($7 == ".data") || ($7 == ".bss")) \
&& ( substr($1,1,1) != ".")) {
if (substr ($1, 1, 7) != "__sinit" &&
substr ($1, 1, 7) != "__sterm") {
if (substr ($1, 1, 5) == "__tf1")
print (substr ($1, 7))
else if (substr ($1, 1, 5) == "__tf9")
print (substr ($1, 15))
else
print $1
}
}
}' | sort -u >> ${EXPFILE}
;;
4*)
${NM} ${OBJECTS} | awk '{
if ((($2 == "T") || ($2 == "D") || ($2 == "B")) \
&& ( substr($1,1,1) != ".")) {
if (substr ($1, 1, 7) != "__sinit" &&
substr ($1, 1, 7) != "__sterm") {
if (substr ($1, 1, 5) == "__tf1")
print (substr ($1, 7))
else if (substr ($1, 1, 5) == "__tf9")
print (substr ($1, 15))
else
print $1
}
}
}' | sort -u >> ${EXPFILE}
;;
}
# This next line is a hack to allow full compatibility with IBM's OpenGL
# libraries. IBM mistakenly exports glLoadIdentity from the libGLU.a
# library. We have to do the same thing. Problem reported by Yemi Adesanya
# (adesanya@afsmail.cern.ch) and Patrick Brown (pbrown@austin.ibm.com)
if [ "${BASENAME}" = libGLU ] ; then
echo "glLoadIdentity" >> ${EXPFILE}
fi
# Make the shared lib file
cc -o ${OFILE} ${OBJECTS} -L../lib ${OTHERLIBS} -lX11 -lXext -lXmu -lXi -lm -lc -bE:${EXPFILE} -bM:SRE ${ENTRY}
# Make the .a file
ar ruv ${LIBRARY} ${OFILE}
# Put exports file in Mesa lib directory
mv ${EXPFILE} ../lib
# Remove OFILE
rm -f ${OFILE}
#NOTES
# AIX 4.x /usr/bin/nm -B patch from ssclift@mach.me.queensu.ca (Simon Clift)
# Robustified symbol extraction for AIX 3 and 4
# Greg Thompson <gregt@visix.com>

38
bin/mklib.ar-ruv Executable file
View File

@@ -0,0 +1,38 @@
#!/bin/sh
# Make a standard Unix .a library file with 'ar ruv'
#--identification------------------------------------------------------
# $Id: mklib.ar-ruv,v 1.2 1999/09/15 15:10:20 brianp Exp $
# $Log: mklib.ar-ruv,v $
# Revision 1.2 1999/09/15 15:10:20 brianp
# added third, tiny version number to arguments
#
# Revision 1.1 1999/08/19 13:52:57 brianp
# initial check-in (post-crash)
#
#--common--------------------------------------------------------------
LIBRARY=$1
shift 1
MAJOR=$1
shift 1
MINOR=$1
shift 1
TINY=$1
shift 1
OBJECTS=$*
#--platform-------------------------------------------------------------
#ar ruv $LIBRARY $OBJECTS
ar ru $LIBRARY $OBJECTS

52
bin/mklib.solaris Normal file
View File

@@ -0,0 +1,52 @@
#!/bin/sh
# Make a Solaris shared library
# contributed by Arno Hahma (arno@nitro.pp.utu.fi)
#--identification------------------------------------------------------
# $Id: mklib.solaris,v 1.2 1999/09/15 15:10:20 brianp Exp $
# $Log: mklib.solaris,v $
# Revision 1.2 1999/09/15 15:10:20 brianp
# added third, tiny version number to arguments
#
# Revision 1.1 1999/08/19 13:53:06 brianp
# initial check-in (post-crash)
#
#--common--------------------------------------------------------------
LIBRARY=$1
shift 1
MAJOR=$1
shift 1
MINOR=$1
shift 1
TINY=$1
shift 1
OBJECTS=$*
#--platform-------------------------------------------------------------
set -x
LIBRARY=`basename $LIBRARY .a`
VERSION=$MAJOR.$MINOR
echo "Building shared object $LIBRARY.so.$VERSION and the archive library $LIBRARY.a"
rm -f ${LIBRARY}.a ${LIBRARY}.so.${VERSION}
ar ruv ${LIBRARY}.a ${OBJECTS}
ld -G -o ${LIBRARY}.so.${VERSION} ${OBJECTS}
cp ${LIBRARY}.a ${LIBRARY}.so.${VERSION} ../lib
cd ../lib
ln -s ${LIBRARY}.so.${VERSION} ${LIBRARY}.so

View File

@@ -0,0 +1,88 @@
Name
MESA_copy_sub_buffer
Name Strings
GLX_MESA_copy_sub_buffer
Contact
Brian Paul (brian 'at' mesa3d.org)
Status
Shipping since Mesa 2.6 in February, 1998.
Version
Last Modified Date: 8 June 2000
Number
215
Dependencies
OpenGL 1.0 or later is required.
GLX 1.0 or later is required.
Overview
The glxCopySubBufferMESA() function copies a rectangular region
of the back color buffer to the front color buffer. This can be
used to quickly repaint 3D windows in response to expose events
when the back color buffer cannot be damaged by other windows.
IP Status
Open-source; freely implementable.
Issues
None.
New Procedures and Functions
void glXCopySubBufferMESA( Display *dpy, GLXDrawable drawable,
int x, int y, int width, int height );
New Tokens
None.
Additions to Chapter 3 of the GLX 1.3 Specification (Functions and Errors)
Add to section 3.3.10 Double Buffering:
The function
void glXCopySubBufferMESA( Display *dpy, GLXDrawable drawable,
int x, int y, int width, int height );
may be used to copy a rectangular region of the back color buffer to
the front color buffer. This can be used to quickly repaint 3D windows
in response to expose events when the back color buffer cannot be
damaged by other windows.
<x> and <y> indicates the lower-left corner of the region to copy and
<width> and <height> indicate the size in pixels. Coordinate (0,0)
corresponds to the lower-left pixel of the window, like glReadPixels.
GLX Protocol
None at this time. The extension is implemented in terms of ordinary
Xlib protocol inside of Mesa.
Errors
None.
New State
None.
Revision History
8 June 2000 - initial specification

View File

@@ -0,0 +1,90 @@
Name
MESA_pixmap_colormap
Name Strings
GLX_MESA_pixmap_colormap
Contact
Brian Paul (brian 'at' mesa3d.org)
Status
Shipping since Mesa 1.2.8 in May, 1996.
Version
Last Modified Date: 8 June 2000
Number
216
Dependencies
OpenGL 1.0 or later is required.
GLX 1.0 or later is required.
Overview
Since Mesa allows RGB rendering into drawables with PseudoColor,
StaticColor, GrayScale and StaticGray visuals, Mesa needs a colormap
in order to compute pixel values during rendering.
The colormap associated with a window can be queried with normal
Xlib functions but there is no colormap associated with pixmaps.
The glXCreateGLXPixmapMESA function is an alternative to glXCreateGLXPixmap
which allows specification of a colormap.
IP Status
Open-source; freely implementable.
Issues
None.
New Procedures and Functions
GLXPixmap glXCreateGLXPixmapMESA( Display *dpy, XVisualInfo *visual,
Pixmap pixmap, Colormap cmap );
New Tokens
None.
Additions to Chapter 3 of the GLX 1.3 Specification (Functions and Errors)
Add to section 3.4.2 Off Screen Rendering
The Mesa implementation of GLX allows RGB rendering into X windows and
pixmaps of any visual class, not just TrueColor or DirectColor. In order
to compute pixel values from RGB values Mesa requires a colormap.
The function
GLXPixmap glXCreateGLXPixmapMESA( Display *dpy, XVisualInfo *visual,
Pixmap pixmap, Colormap cmap );
allows one to create a GLXPixmap with a specific colormap. The image
rendered into the pixmap may then be copied to a window (which uses the
same colormap and visual) with the expected results.
GLX Protocol
None since this is a client-side extension.
Errors
None.
New State
None.
Revision History
8 June 2000 - initial specification

View File

@@ -0,0 +1,85 @@
Name
MESA_release_buffers
Name Strings
GLX_MESA_release_buffers
Contact
Brian Paul (brian 'at' mesa3d.org)
Status
Shipping since Mesa 2.0 in October, 1996.
Version
Last Modified Date: 8 June 2000
Number
217
Dependencies
OpenGL 1.0 or later is required.
GLX 1.0 or later is required.
Overview
Mesa's implementation of GLX is entirely implemented on the client side.
Therefore, Mesa cannot immediately detect when an X window or pixmap is
destroyed in order to free any ancilliary data associated with the window
or pixmap.
The glxMesaReleaseBuffers() function can be used to explicitly indicate
when the back color buffer, depth buffer, stencil buffer, and/or accum-
ulation buffer associated with a drawable can be freed.
IP Status
Open-source; freely implementable.
Issues
None.
New Procedures and Functions
Bool glXReleaseBuffersMESA( Display *dpy, GLXDrawable d );
New Tokens
None.
Additions to Chapter 3 of the GLX 1.3 Specification (Functions and Errors)
The function
Bool glXReleaseBuffersMESA( Display *dpy, GLXDrawable d );
causes all software ancilliary buffers (back buffer, depth, stencil,
accum, etc) associated with the named drawable to be immediately
deallocated. True is returned if <d> is a valid Mesa GLX drawable,
else False is returned. After calling glXReleaseBuffersMESA, the
drawable should no longer be used for GL rendering. Results of
attempting to do so are undefined.
GLX Protocol
None, since this is a client-side operation.
Errors
None.
New State
None.
Revision History
8 June 2000 - initial specification

View File

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

View File

@@ -0,0 +1,85 @@
Name
MESA_set_3dfx_mode
Name Strings
GLX_MESA_set_3dfx_mode
Contact
Brian Paul (brian 'at' mesa3d.org)
Status
Shipping since Mesa 2.6 in February, 1998.
Version
Last Modified Date: 8 June 2000
Number
218
Dependencies
OpenGL 1.0 or later is required.
GLX 1.0 or later is required.
Overview
The Mesa Glide driver allows full-screen rendering or rendering into
an X window. The glXSet3DfxModeMESA() function allows an application
to switch between full-screen and windowed rendering.
IP Status
Open-source; freely implementable.
Issues
None.
New Procedures and Functions
GLboolean glXSet3DfxModeMESA( GLint mode );
New Tokens
GLX_3DFX_WINDOW_MODE_MESA 0x1
GLX_3DFX_FULLSCREEN_MODE_MESA 0x2
Additions to Chapter 3 of the GLX 1.3 Specification (Functions and Errors)
The Mesa Glide device driver allows either rendering in full-screen
mode or rendering into an X window. An application can switch between
full-screen and window rendering with the command:
GLboolean glXSet3DfxModeMESA( GLint mode );
<mode> may either be GLX_3DFX_WINDOW_MODE_MESA to indicate window
rendering or GLX_3DFX_FULLSCREEN_MODE_MESA to indicate full-screen mode.
GL_TRUE is returned if <mode> is valid and the operation completed
normally. GL_FALSE is returned if <mode> is invalid or if the Glide
driver is not being used.
Note that only one drawable and context can be created at any given
time with the Mesa Glide driver.
GLX Protocol
None since this is a client-side extension.
Errors
None.
New State
None.
Revision History
8 June 2000 - initial specification

View File

@@ -16,11 +16,11 @@ Status
Version
$Id: MESA_window_pos.spec,v 1.1 1999/07/20 00:30:41 brianp Exp $
$Id: MESA_window_pos.spec,v 1.3 2000/04/04 23:29:32 brianp Exp $
Number
XXX non assigned
197
Dependencies
@@ -33,7 +33,7 @@ Overview
coordinate with the RasterPos command, the modelview matrix, projection
matrix and viewport must be set very carefully. Furthermore, if the
desired window coordinate is outside of the window's bounds one must
rely a subtle side-effect of the Bitmap command in order to circumvent
rely on a subtle side-effect of the Bitmap command in order to circumvent
frustum clipping.
This extension provides a set of functions to directly set the
@@ -51,6 +51,26 @@ New Procedures and Functions
void WindowPos2fMESA(float x, float y)
void WindowPos2iMESA(int x, int y)
void WindowPos2sMESA(short x, short y)
void WindowPos2ivMESA(const int *p)
void WindowPos2svMESA(const short *p)
void WindowPos2fvMESA(const float *p)
void WindowPos2dvMESA(const double *p)
void WindowPos3iMESA(int x, int y, int z)
void WindowPos3sMESA(short x, short y, short z)
void WindowPos3fMESA(float x, float y, float z)
void WindowPos3dMESA(double x, double y, double z)
void WindowPos3ivMESA(const int *p)
void WindowPos3svMESA(const short *p)
void WindowPos3fvMESA(const float *p)
void WindowPos3dvMESA(const double *p)
void WindowPos4iMESA(int x, int y, int z, int w)
void WindowPos4sMESA(short x, short y, short z, short w)
void WindowPos4fMESA(float x, float y, float z, float w)
void WindowPos4dMESA(double x, double y, double z, double )
void WindowPos4ivMESA(const int *p)
void WindowPos4svMESA(const short *p)
void WindowPos4fvMESA(const float *p)
void WindowPos4dvMESA(const double *p)
New Tokens
@@ -64,7 +84,7 @@ Additions to Chapter 2 of the OpenGL 1.2 Specification (OpenGL Operation)
WindowPosMESA commands:
void WindowPos{234}{sidf}MESA( T coords );
void Window Pos{234}{sidf}vMESA( T coords );
void WindowPos{234}{sidf}vMESA( T coords );
WindosPos4MESA takes four values indicating x, y, z, and w.
WindowPos3MESA (or WindowPos2MESA) is analaguos, but sets only
@@ -78,14 +98,6 @@ Additions to Chapter 2 of the OpenGL 1.2 Specification (OpenGL Operation)
color, color index and texture coordinate update the current raster
position's associated data.
The current raster distance ??? XXX ???
Additions to the AGL/GLX/WGL Specifications
None
@@ -100,7 +112,6 @@ Errors
INVALID_OPERATION is generated if WindowPosMESA is called betweeen
Begin and End.
New State
None.
@@ -112,3 +123,5 @@ New Implementation Dependent State
Revision History
* Revision 1.0 - Initial specification
* Revision 1.1 - Minor clean-up (7 Jan 2000, Brian Paul)

View File

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

View File

@@ -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.6 1999/11/27 01:40:40 brianp Exp $

View File

@@ -1,172 +1,26 @@
LibGGI driver for Mesa-3.0
by Uwe Maurer (uwe_maurer@t-online.de)
GGIMesa for LibGGI 2.x
Requirements:
-------------
LibGGI 2.0 or greater
Introduction
============
[from libggi.txt by Steve Cheng and Hartmut Niemann]
Installation:
-------------
To install GGIMesa, follow the instructions in INSTALL.GNU. If you
wish to install GGIGLUT as well, first install GGIMesa and then run
"LibGGI, the dynamic GGI (General Graphics Interface) library is a
flexible drawing library.
make
make install (must be root)
It provides an opaque interface to the display's acceleration
functions. It was originally intended to allow user programs to
interface with KGI, the kernel side of the GGI code, but other display
types can be easily used by loading the appropriate "display target"
(e.g. X, memory).
in ggi/ggiglut.
LibGGI consists of a main library (libggi.so) and a multitude of
dynamic drivers. The library then loads the necessary "drivers" for
the requested mode, taking hints from the graphics device if
necessary. LibGGI can also load extension libraries, e.g. to provide
enhanced 2D and 3D functions.
Notes:
------
It has been designed after having a look at several existing
libraries, and so far we have found porting to be quite simple from
and to most of them."
* Set the environment variables GGIMESA_DEBUG and/or GGIGLUT_DEBUG
to 255 to see lots of debugging output.
----------------------------------------------------------------------------
More information about the GGI project and LibGGI can be
obtained from the GGI website:
www.ggi-project.org
----------------------------------------------------------------------------
Installation
============
- Install LibGGI
- Unpack the Mesa archives
- In the Mesa directory type:
make linux-ggi
su
make linux-ggi-install
exit
- Now you can try some demos.
If they don't work, you can set the GGIMESA_DEBUG
variable to 255 and you will see some information from the
LibGGI-driver.
export GGIMESA_DEBUG=255
GLUT
====
You can change these default values in ggi/ggiglut.c:
#define WIDTH 640
#define HEIGHT 400
#define GRAPHTYPE_RGB GT_16BIT
#define GRAPHTYPE_INDEX GT_8BIT
Options:
-bpp x Set graphic mode with x bits per pixel
-size x y Screen (or window) is x*y pixels
Example:
demos/gears -size 320 200 -bpp 24
Updates
=======
You can find the latest LibGGI-driver and ggiglut on my
homepage:
http://home.t-online.de/home/uwe_maurer/ggimesa.htm
Uwe Maurer - uwe_maurer@t-online.de
LibGGI driver for Mesa-3.0
by Uwe Maurer (uwe_maurer@t-online.de)
Introduction
============
[from libggi.txt by Steve Cheng and Hartmut Niemann]
"LibGGI, the dynamic GGI (General Graphics Interface) library is a
flexible drawing library.
It provides an opaque interface to the display's acceleration
functions. It was originally intended to allow user programs to
interface with KGI, the kernel side of the GGI code, but other display
types can be easily used by loading the appropriate "display target"
(e.g. X, memory).
LibGGI consists of a main library (libggi.so) and a multitude of
dynamic drivers. The library then loads the necessary "drivers" for
the requested mode, taking hints from the graphics device if
necessary. LibGGI can also load extension libraries, e.g. to provide
enhanced 2D and 3D functions.
It has been designed after having a look at several existing
libraries, and so far we have found porting to be quite simple from
and to most of them."
----------------------------------------------------------------------------
More information about the GGI project and LibGGI can be
obtained from the GGI website:
www.ggi-project.org
----------------------------------------------------------------------------
Installation
============
- Install LibGGI
- Unpack the Mesa archives
- In the Mesa directory type:
make linux-ggi
su
make linux-ggi-install
exit
- Now you can try some demos.
If they don't work, you can set the GGIMESA_DEBUG
variable to 255 and you will see some information from the
LibGGI-driver.
export GGIMESA_DEBUG=255
GLUT
====
You can change these default values in ggi/ggiglut.c:
#define WIDTH 640
#define HEIGHT 400
#define GRAPHTYPE_RGB GT_16BIT
#define GRAPHTYPE_INDEX GT_8BIT
Options:
-bpp x Set graphic mode with x bits per pixel
-size x y Screen (or window) is x*y pixels
Example:
demos/gears -size 320 200 -bpp 24
Updates
=======
You can find the latest LibGGI-driver and ggiglut on my
homepage:
http://home.t-online.de/home/uwe_maurer/ggimesa.htm
Uwe Maurer - uwe_maurer@t-online.de
* GGIGLUT contains support for all of the GLUT 3.6 API except for the
high-level primitive drawing functions, but many of the functions (in
particular the menu drawing functions) are just stubs.

View File

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

View File

@@ -1,45 +1,33 @@
NOTE: this information is obsolete for Mesa 3.1. Due to the big
changes in the Mesa code, the threads support is out of date.
Someone will have to review/update it.
Mesa Threads README
-------------------
Mesa 2.6 is the starting point for an effort to make Mesa
safe in multithreaded applications. The files src/mthreads.c and
src/mthreads.h provide a platform independent threads API which Mesa
uses internally to provide thread-safe operation. At present the mthreads
code supports three thread APIS:
Thread safety was introduced in Mesa 2.6 by John Stone and
Christoph Poliwoda.
It was redesigned in Mesa 3.3 so that thread safety is
supported by default (on systems which support threads,
that is). There is no measurable penalty on single
threaded applications.
NOTE that the only _driver_ which is thread safe at this time
is the OS/Mesa driver!
At present the mthreads code supports three thread APIS:
1) POSIX threads (aka pthreads).
2) Solaris / Unix International threads.
3) Win32 threads (Win 95/NT).
Here's the current list of targets which enable multithreaded handling
in Mesa:
Support for other thread libraries can be added src/glthread.[ch]
linux-386-pthread for Linux w/ Intel assembly and linuxthreads
sunos5-thread for Suns with SunOS 5.x, using Solaris threads
sunos5-pthread for Suns with SunOS 5.[56] using POSIX threads
sunos5-gcc-thread for Suns with SunOS 5.x and GCC, using Solaris threads
sunos5-gcc-pthread for Suns with SunOS 5.[56] and GCC, using POSIX threads
In order to use Mesa with a multithreaded application, Mesa must be compiled
using one of the thread-enabled configurations. In cases where a platform
supports multiple APIs which are acceptable to Mesa, Mesa must be built
with the same threads API as the application in order for things to work
properly. For example, Solaris >= 2.5 support both POSIX threads and
Sun's own threads API. In order to guarantee proper operation, it is
In order to guarantee proper operation, it is
necessary for both Mesa and application code to use the same threads API.
So, if your application uses Sun's thread API, then you should build Mesa
using one of the targets for Sun threads.
Since this effort is still very much a work in progress, not all
aspects of Mesa are thread safe. As of this release (Mesa 2.6) only the
osmesa drivers have been made MT-safe. As work continues, other drivers
such as the X11 drivers will also incorporate MT-safe features.
The mtdemos directory contains some example programs which use
multiple threads to render to osmesa rendering context(s).
@@ -50,17 +38,15 @@ only one that really supports multiprocessor machines (AFAIK). See
http://pauillac.inria.fr/~xleroy/linuxthreads/README for further
information about the usage of linuxthreads.
If you are interested in helping develop MT-safe Mesa, please send email
to j.stone@acm.org and poliwoda@volumegraphics.com who are the two most
directly involved in this effort currently. Similarly, if you have problems
using the MT-safe builds of Mesa, please send us comments/bugs etc.
If you are interested in helping with thread safety work in Mesa
join the Mesa developers mailing list and post your proposal.
Future versions of Mesa will include more extensive documentation related
to multithreading. This is the first release of our work, so please bear
with us.
Regards,
John Stone -- j.stone@acm.org johns@cs.umr.edu
Christoph Poliwoda -- poliwoda@volumegraphics.com
Version info:
Mesa 2.6 - initial thread support.
Mesa 3.3 - thread support mostly rewritten (Brian Paul)

View File

@@ -1,15 +1,32 @@
Mesa/Readme.win32
Last Updated: Friday, July 9th, 1999 - tjump@tertius.com
Last Updated: Sunday, September 19th, 1999 - tjump@tertius.com
*** What's New
- Updated for Mesa 3.1beta2/CVS.
- Updated for Mesa 3.1beta3/CVS. Debug and Release command-line builds of
Mesa, fxMesa, GLU, GLUT and all sample programs DLL-based. Manual
executions tests with minimum requisite results (aka: things looked like
I expected them to).
What did you expect, complete regression testing maybe?
- NASM build support. Any file in the project coded as a .S file will
automatically be recognized and built as a NASM-source assember file.
To enable building using NASM, set the environment variable NASM to
indicate that command to execute to run nasm on a file. If NASM is in
your command search path then all this needs be set to is 'nasmw' -
otherwise you will need to include the complete drive and directory path.
NASM may be retrieved here: http://www.web-sites.co.uk/nasm/
- DevStudio projects suspended for compatability reasons: projects modified
by DevStudio 6 are not compatible with DevStudio 5.
These will slowly be rebuilt and put into CVS as I can.
- Build environment change: The Glide SDK is no longer assumed to be in
the global INCLUDE/LIB environment vars, it is required that you set the
value 'GLIDE2X' as either an environment variable pointing to your Glide

View File

@@ -1,33 +1,54 @@
Mesa 3.0 Unix/X11 Information
Mesa 3.4 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.3/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.
Notes on assembly language optimizations:
When using the old-style Makefiles, you can specify a configuration
that uses X86 assembly language optimizations (linux-3dnow for example).
The detection of MMX, 3DNow!, PIII/SSE, etc capability is done at
runtime. That means you can compile Mesa for 3DNow! optimizations
even if you don't have an AMD CPU.
However, your Linux binutils and assembler must understand the
special instructions in order to compile them. If you have
compilation problems, try upgrading your binutils.
Header and library files:
After you've compiled Mesa and tried the demos I recommend the following
procedure for "installing" Mesa.
@@ -40,16 +61,6 @@ Header and library files:
(actually, use "cp -d" on Linux to preserve symbolic links)
Create a few symbolic links so that compiling OpenGL applications is easy:
cd /usr/local/lib
IF USING STATIC (lib*.a) FILES THEN
ln -s libMesaGL.a libGL.a
ln -s libMesaGLU.a libGLU.a
ELSE
ln -s libMesaGL.so libGL.so
ln -s libMesaGLU.so libGLU.so
ENDIF
Xt/Motif widgets:
If you want to use Mesa or OpenGL in your Xt/Motif program you can build
@@ -108,8 +119,6 @@ Remote display of OpenGL/GLX programs:
in /usr/local/Mesa and using the C-shell:
% cd /usr/local/Mesa
% make irix5-dso
% cd lib
% ln -s libMesaGL.so libGL.so
% setenv _RLD_LIST "/usr/local/Mesa/lib/libGL.so:DEFAULT"
% /usr/demos/bin/ideas_ogl // this is a test
@@ -132,7 +141,7 @@ Xt/Motif Widgets:
Togl:
Togl is an OpenGL/Mesa widget for Tcl/Tk.
See http://www.ssec.wisc.edu/~brianp/Togl.html for more information.
See http://togl.sourceforge.net for more information.
@@ -251,6 +260,7 @@ Extensions:
The following OpenGL GLX extensions are currently implemented:
GLX_EXT_visual_info - GLX visual and transparent pixel extension
GLX_EXT_visual_rating - GLX visual caveats
For detailed information about the extensions see www.opengl.org
@@ -313,4 +323,4 @@ Summary of X-related environment variables:
----------------------------------------------------------------------
$Id: README.X11,v 3.2 1998/10/03 12:48:50 brianp Exp $
$Id: README.X11,v 3.5.4.1 2000/11/02 18:05:34 brianp Exp $

146
docs/RELNOTES-3.1 Normal file
View File

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

12
docs/RELNOTES-3.2 Normal file
View File

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

32
docs/RELNOTES-3.2.1 Normal file
View File

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

271
docs/RELNOTES-3.3 Normal file
View File

@@ -0,0 +1,271 @@
Mesa 3.3 release notes
July 21, 2000
PLEASE READ!!!!
Introduction
------------
Mesa uses an even/odd version number scheme like the Linux kernel.
Odd numbered versions (such as 3.3) designate new developmental releases.
Even numbered versions (such as 3.2.1) designate stable releases.
Mesa 3.3 has a undergone many internal changes since version 3.2
and features a lot of new extensions. 3.3 is expected to be pretty
stable, but perhaps not as stable as 3.2 which has been used by
thousands of users over the past months.
Everyone is encouraged to try Mesa 3.3. Bugs should be reported to
the Mesa bug database on www.sourceforge.net.
Header file / GLenum changes
----------------------------
The gl.h and glu.h headers now use #defines to define all GL_* tokens
instead of C-language enums. This change improves Mesa/OpenGL
interoperability.
New API dispatch code
---------------------
The core Mesa gl* functions are now implemented with a new dispatch
(jump table) which will allow simultaneous direct/indirect rendering.
The code is found in the glapi*.[ch] files.
Of interest: the actual "glFooBar" functions are generated with
templatized code defined in glapitemp.h and included by glapi.c
The glapitemp.h template should be reusable for all sorts of OpenGL
projects.
The new dispatch code has also optimized with x86 assembly code.
This optimization eliminates copying the function arguments during
dispatch.
New thread support
------------------
Thread support in Mesa has been rewritten. The glthread.[ch] files
replace mthreads.[ch]. Thread safety is always enabled (on platforms
which support threads, that is). There is virtually no performance
penalty for typical single-thread applications. See the glapi.c
file for details.
The Xlib driver (XMesa) is now thread-safe as well. Be sure to
call XInitThreads() in your app first. See the xdemos/glthreads.c
demo for an example.
Make configuration changes
--------------------------
If you use the old-style (non GNU automake) method to build Mesa note
that several of the configuration names have changed:
Old name New name
------------- ----------------
linux-elf linux
linux linux-static
linux-386-elf linux-386
linux-386 linux-386-static
etc.
New extensions
--------------
GL_ARB_transpose_matrix
Adds glLoadTransposeMatrixARB() and glMultTransposeMatrixARB()
functions.
GL_ARB_texture_cube_map
For cube-based reflection mapping.
GL_EXT_texture_add_env
Adds GL_ADD texture environment mode.
See http://www.berkelium.com/OpenGL/EXT/texture_env_add.txt
GL_EXT_texture_lod_bias
Allows mipmapped texture blurring and sharpening.
GLX_EXT_visual_rating extension
This extension has no effect in stand-alone Mesa (used for DRI).
GL_HP_occlusion_test
Used for bounding box occlusion testing (see demos/occlude.c).
GL_SGIX_pixel_texture / GL_SGIS_pixel_texture
Lets glDraw/CopyPixels draw a texture coordinate image.
GL_SGI_color_matrix
Adds a color matrix and another set of scale and bias parameters
to the glDraw/CopyPixels paths.
GL_SGI_color_table
Adds additional color tables to the glDraw/Read/CopyPixels paths.
GL_EXT_histogram
Compute histograms for glDraw/Read/CopyPixels.
GL_EXT_blend_func_separate
This is the same as GL_INGR_blend_func_separate.
GL_ARB_texture_cube_mapping
6-face cube mapping, nicer than sphere mapping
GL_EXT_texture_env_combine
For advanced texture environment effects.
Documentation for all these functions can be found at
http://oss.sgi.com/projects/ogl-sample/registry/
GLX_SGI_make_current_read functionality
---------------------------------------
The functionality of this extension is needed for GLX 1.3 (and required
for the Linux/OpenGL standards base).
Implementing this function required a **DEVICE DRIVER CHANGE**.
The old SetBuffer() function has been replaced by SetReadBuffer() and
SetDrawBuffer(). All device drivers will have to be updated because
of this change.
The new function, glXMakeContextCurrent(), in GLX 1.3 now works in Mesa.
The xdemos/wincopy.c program demonstrates it.
Image-related code changes
--------------------------
The imaging path code used by glDrawPixels, glTexImage[123]D,
glTexSubImage[123], etc has been rewritten. It's now faster,
uses less memory and has several bug fixes. This work was
actually started in Mesa 3.1 with the glTexImage paths but has now
been carried over to glDrawPixels as well.
Device driver interface changes
-------------------------------
Added new functions for hardware stencil buffer support:
WriteStencilSpan
ReadStencilSpan
WriteStencilPixels
ReadStencilPixels
Removed old depth buffer functions:
AllocDepthBuffer
DepthTestSpan
DepthTestPixels
ReadDepthSpanFloat
ReadDepthSpanInt
Added new depth buffer functions:
WriteDepthSpan
ReadDepthSpan
WriteDepthPixels
ReadDepthPixels
These functions always read/write 32-bit GLuints. This will allow
drivers to have anywhere from 0 to 32-bit Z buffers without
recompiling for 16 vs 32 bits as was previously needed.
New texture image functions
The entire interface for texture image specification has been updated.
With the new functions, it's optional for Mesa to keep an internal copy
of all textures. Texture download should be a lot faster when the extra
copy isn't made.
Misc changes
TexEnv now takes a target argument
Removed UseGlobalTexturePalette (use Enable function instead)
Also added
ReadPixels
CopyPixels
The SetBufffer function has been replaced by SetDrawBuffer and
SetReadBuffer functions. This lets core Mesa independently
specify which buffer is to be used for reading and which for
drawing.
The Clear function's mask parameter has changed. Instead of
mask being the flags specified by the user to glClear, the
mask is now a bitmask of the DD_*_BIT flags in dd.h. Now
multiple color buffers can be specified for clearing (ala
glDrawBuffers). The driver's Clear function must also
check the glColorMask glIndexMask, and glStencilMask settings
and do the right thing. See the X/Mesa, OS/Mesa, or FX/Mesa
drivers for examples.
The depth buffer changes shouldn't be hard to make for existing
drivers. In fact, it should simply the code. Be careful with
the depthBits value passed to gl_create_context(). 1 is a bad
value! It should normally be 0, 16, 24, or 32.
gl_create_framebuffer() takes new arguments which explicitly tell
core Mesa which ancillary buffers (depth, stencil, accum, alpha)
should be implemented in software. Mesa hardware drivers should
carefully set these flags depending on which buffers are in the
graphics card.
Internal constants
------------------
Point and line size range and granularity limits are now stored
in the gl_constants struct, which is the Const member of GLcontext.
The limits are initialized from values in config.h but may be
overridden by device drivers to reflect the limits of that driver's
hardware.
Also added constants for NumAuxBuffers and SubPixelBits.
OpenGL Conformance
------------------
Mesa now passes all the OpenGL 1.1 conformance tests, except for
antialiased lines. AA lines fail on some, but not all, the tests.
In order to fix the remaining failures, a new AA line algorithm will
be needed (which computes coverage values for end-point fragments).
This will be done for Mesa 3.5/3.6.
OpenGL 1.2 GL_ARB_imaging subset
--------------------------------
Mesa 3.3 implements all the features of GL_ARB_imaging except for
image convolution. This will (hopefully) be done for Mesa 3.5/3.6.
----------------------------------------------------------------------
$Id: RELNOTES-3.3,v 1.8 2000/07/21 16:26:41 brianp Exp $

22
docs/RELNOTES-3.4 Normal file
View File

@@ -0,0 +1,22 @@
Mesa 3.4 release notes
November 3, 2000
PLEASE READ!!!!
Introduction
------------
Mesa uses an even/odd version number scheme like the Linux kernel.
Odd numbered versions (such as 3.3) designate new developmental releases.
Even numbered versions (such as 3.4) designate stable releases.
Mesa 3.4 simply fixes bugs found in the Mesa 3.3 release. For details,
see the VERSIONS file.
----------------------------------------------------------------------
$Id: RELNOTES-3.4,v 1.1.2.2 2000/11/02 18:05:34 brianp Exp $

View File

@@ -1,4 +1,4 @@
$Id: VERSIONS,v 1.10 1999/07/30 18:58:30 brianp Exp $
$Id: VERSIONS,v 1.38.2.18 2000/11/03 02:39:00 brianp Exp $
Mesa Version History
@@ -644,12 +644,134 @@ Mesa Version History
- new copyright on core Mesa code
3.1 beta 3 August ??, 1999
3.1 beta 3 September 17, 1999
New:
- optimized glAccum function
- optimized 24bpp rendering in XMesa driver
- GLU 1.2 polygon tessellator
Bug Fixes:
- glGetTexLevelParameter wasn't fully implemented
- glXUseXFont now handles multi-byte fonts
- glIsEnabled(GL_TEXTURE_2D / 3D) returned wrong result
- alpha channel of blending points, lines was sometimes incorrect
Changes:
- New library names: libGL.so and libGLU.so
- New library names: "libGL" instead of "libMesaGL"
- 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
- rewritten glTexImage code paths (faster, less memory, bug fixes)
Bug Fixes:
- several vertex array bug fixes
- overlapping glCopyPixels with pixel zooming now works
- glXUseXFont() bitmaps were vertically shifted by one pixel
- glCopyPixels with pixel zooming now works
3.2 final April 24, 2000
Bug fixes:
- fixed memcpy bugs in span.c
- fixed missing glEnd problem in demos/tessdemo.c
- fixed bug when clearing 24bpp Ximages
- fixed clipping problem found in Unreal Tournament
- fixed Loki's "ice bug" and "crazy triangles" seen in Heretic2
- fixed Loki's 3dfx RGB vs BGR bug
- fixed Loki's 3dfx smooth/flat shading bug in SoF
Changes:
- updated docs/README file
- use bcopy() optimizations on FreeBSD
- re-enabled the optimized persp_textured_triangle() function
3.2.1 July 19, 2000
Bug fixes:
- gluBuild2DMipmaps() didn't accept GL_BGRA
- Fixed compile/makefile problems on IRIX
- fixed segfault in 3dfx driver when using GL selection/feedback
- no longer cull very, very tiny triangles
- blending w/ drawbuffer==GL_FRONT_BACK caused segfault (sw rendering)
- fixed Motif detection code in widgets-mesa/configure.in
- glColorMaterial and glMaterial updates to emissive and ambient
didn't always work right
- Specular highlights weren't always in the right place
- clipped GL_LINE mode polygons had interior lines appear
- blend term GL_ONE_MINUS_CONSTANT_ALPHA was broken
- GL_NICEST fog didn't always work with flat shading
- glRect commands in display lists were sometimes miscolored
- Line Z offset didn't always work
- fixed texgen normal vector problem (gloss's teapot)
- numerous GL conformance bugs fixed
Changes:
- glColorMask(false, false, false, false) handled better/faster
- reverted to old GLU polygon tessellator, GLU 1.1
- updated Win32 build files
3.3 July 21, 2000
New:
- antialiased triangles now implemented
- GL_EXT_texture_env_add texture mode extension
- GLX 1.3 API
- support for separate draw/read buffers (ie GL_SGI_make_current_read)
- thread-safe API dispath
- improved glxinfo program
- demos/texdown program to measure texture download performance
- glext.h header file
- demos/geartrain program
- GL_EXT_texture_lod_bias extension
- demos/lodbias program
- further optimized glRead/DrawPixels for 16-bit TrueColor X visuals
- GLX_EXT_visual_rating extension (a no-op, however)
- GL_HP_occlusion_test extension (for X and OS/Mesa drivers)
- demos/occlude program
- GL_SGIS_pixel_texture and GL_SGIX_pixel_texture extensions
- demos/pixeltex program
- GL_SGI_color_matrix extension
- GL_SGI_color_table extension
- GL_EXT_histogram extension
- GL_ARB_texture_cube_map extension
- added xdemos/glxheads and xdemos/manywin
- demos/texenv.c demo
- GL_EXT_texture_env_combine extension (by Holger Waechtler)
- Xlib driver is now thread-safe (see xdemos/glthreads)
Bug Fixes:
- various GL conformance failures fixed since 3.2.1
Changes:
- gl.h now uses #defines instead of C enums for all tokens
- glu.h now uses #defines instead of C enums for all tokens
- moved programs from 3Dfx/demos/ into demos/ directory
3.4 November 3, 2000
New:
- optimized glDrawPixels for glPixelZoom(1,-1)
Bug Fixes:
- widgets-mesa/src/*.c files were missing from 3.3 distro
- include/GL/mesa_wgl.h file was missing from 3.3 distro
- fixed some Win32 compile problems
- texture object priorities weren't getting initialized to 1.0
- glAreTexturesResident return value was wrong when using hardware
- glXUseXFont segfaulted when using 3dfx driver (via MESA_GLX_FX)
- glReadPixels with GLushort packed types was broken
- fixed a few bugs in the GL_EXT_texture_env_combine texture code
- glPush/PopAttrib(GL_ENABLE_BIT) mishandled multi-texture enables
- fixed some typos/bugs in the VB code
- glDrawPixels(GL_COLOR_INDEX) to RGB window didn't work
- optimized glDrawPixels paths weren't being used
- per-fragment fog calculation didn't work without a Z buffer
- improved blending accuracy, fixes Glean blendFunc test failures
- glPixelStore(GL_PACK/UNPACK_SKIP_IMAGES) wasn't handled correctly
- glXGetProcAddressARB() didn't always return the right address
- gluBuild[12]DMipmaps() didn't grok the GL_BGR pixel format
- texture matrix changes weren't always detected (GLUT projtex demo)
- fixed random color problem in vertex fog code
- fixed Glide-related bug that let Quake get a 24-bit Z buffer
Changes:
- finished internal support for compressed textures for DRI

View File

@@ -22,9 +22,13 @@ if HAVE_X11
INC_X11 = glx.h glx_mangle.h xmesa.h xmesa_x.h xmesa_xf86.h
endif
if NEED_GLUT
INC_GLUT = glut.h
endif
EXTRA_DIST = fxmesa.h ggimesa.h osmesa.h svgamesa.h \
glx.h glx_mangle.h xmesa.h xmesa_x.h xmesa_xf86.h
GLinclude_HEADERS = gl.h gl_mangle.h glu.h glu_mangle.h \
$(INC_FX) $(INC_GGI) $(INC_OSMESA) $(INC_SVGA) $(INC_X11)
GLinclude_HEADERS = gl.h glext.h gl_mangle.h glu.h glu_mangle.h \
$(INC_FX) $(INC_GGI) $(INC_OSMESA) $(INC_SVGA) $(INC_X11) $(INC_GLUT)

View File

@@ -1,10 +1,10 @@
/* $Id: amesa.h,v 1.1 1999/08/19 00:55:40 jtg Exp $ */
/* $Id: amesa.h,v 1.2 2000/02/09 19:03:28 brianp Exp $ */
/*
* Mesa 3-D graphics library
* Version: 3.1
* Version: 3.3
*
* Copyright (C) 1999 Brian Paul All Rights Reserved.
* Copyright (C) 1999-2000 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -25,25 +25,17 @@
*/
/*
* $Log: amesa.h,v $
* Revision 1.1 1999/08/19 00:55:40 jtg
* Initial revision
*
* Revision 1.1 1999/03/16 01:24:13 brianp
* initial check-in
*
*/
/* Allegro (DJGPP) driver by Bernhard Tschirren (bernie-t@geocities.com) */
#ifndef AMESA_H
#define AMESA_H
#define AMESA_MAJOR_VERSION 3
#define AMESA_MINOR_VERSION 3
typedef struct amesa_visual *AMesaVisual;
typedef struct amesa_buffer *AMesaBuffer;
typedef struct amesa_context *AMesaContext;

View File

@@ -1,8 +1,8 @@
/* $Id: fxmesa.h,v 1.1 1999/08/19 00:55:40 jtg Exp $ */
/* $Id: fxmesa.h,v 1.2 1999/11/24 18:44:53 brianp 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,23 +21,6 @@
*/
/*
* $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
*
*/
/*
* FXMesa - 3Dfx Glide driver for Mesa. Contributed by David Bucciarelli
*
@@ -58,7 +41,7 @@ extern "C" {
#define FXMESA_MAJOR_VERSION 3
#define FXMESA_MINOR_VERSION 0
#define FXMESA_MINOR_VERSION 3
/*

View File

@@ -1,9 +1,9 @@
/* $Id: ggimesa.h,v 1.1 1999/08/19 00:55:40 jtg Exp $ */
/* $Id: ggimesa.h,v 1.3 2000/02/09 19:03:28 brianp Exp $ */
/*
* Mesa 3-D graphics library
* Version: 3.1
* Copyright (C) 1995-1998 Brian Paul
* Version: 3.3
* Copyright (C) 1995-2000 Brian Paul
* Copyright (C) 1998 Uwe Maurer
*
* This library is free software; you can redistribute it and/or
@@ -22,20 +22,14 @@
*/
/*
* $Log: ggimesa.h,v $
* Revision 1.1 1999/08/19 00:55:40 jtg
* Initial revision
*
* Revision 1.2 1998/09/29 01:46:40 brianp
* applied Emmanuel Marty's patches for latest GGI
*
*/
#ifndef GGIMESA_H
#define GGIMESA_H
#define GGIMESA_MAJOR_VERSION 3
#define GGIMESA_MINOR_VERSION 3
#ifdef __cplusplus
extern "C" {
#endif
@@ -49,16 +43,16 @@ typedef struct ggi_mesa_context *GGIMesaContext;
extern GGIMesaContext GGIMesaCreateContext(void);
extern void GGIMesaDestroyContext( GGIMesaContext ctx );
extern void GGIMesaDestroyContext(GGIMesaContext ctx);
extern void GGIMesaMakeCurrent(GGIMesaContext ctx );
extern void GGIMesaMakeCurrent(GGIMesaContext ctx);
extern GGIMesaContext GGIMesaGetCurrentContext( void );
extern GGIMesaContext GGIMesaGetCurrentContext(void);
extern void GGIMesaSwapBuffers( void );
extern void GGIMesaSwapBuffers(void);
extern int GGIMesaSetVisual(GGIMesaContext ctx,ggi_visual_t vis,
GLboolean rgb_flag,GLboolean db_flag);
extern int GGIMesaSetVisual(GGIMesaContext ctx, ggi_visual_t vis,
GLboolean rgb_flag, GLboolean db_flag);
#ifdef __cplusplus
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,8 +1,8 @@
/* $Id: gl_mangle.h,v 1.1 1999/08/19 00:55:40 jtg Exp $ */
/* $Id: gl_mangle.h,v 1.4 2000/01/04 08:07:09 brianp Exp $ */
/*
* Mesa 3-D graphics library
* Version: 3.1
* Version: 3.3
*
* Copyright (C) 1999 Brian Paul All Rights Reserved.
*
@@ -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,18 @@
#define glTexImage3DEXT mglTexImage3DEXT
#define glTexSubImage3DEXT mglTexSubImage3DEXT
#define glCopyTexSubImage3DEXT mglCopyTexSubImage3DEXT
#define glColorTable mglColorTable
#define glColorTableParameteriv mglColorTableParameteriv
#define glColorTableParameterfv mglColorTableParameterfv
#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 +515,7 @@
#define glGetHistogramParameteriv mglGetHistogramParameteriv
#define glMinmax mglMinmax
#define glResetMinmax mglResetMinmax
#define glGetMinmax mglGetMinmax
#define glGetMinmaxParameterfv mglGetMinmaxParameterfv
#define glGetMinmaxParameteriv mglGetMinmaxParameteriv
#define glConvolutionFilter1D mglConvolutionFilter1D

2926
include/GL/glext.h Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -1,9 +1,9 @@
/* $Id: glu.h,v 1.1 1999/08/19 00:55:40 jtg Exp $ */
/* $Id: glu.h,v 1.22.4.1 2000/10/26 15:32:46 brianp Exp $ */
/*
* Mesa 3-D graphics library
* Version: 3.1
* Copyright (C) 1995-1999 Brian Paul
* Version: 3.3
* Copyright (C) 1995-2000 Brian Paul
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -21,35 +21,6 @@
*/
/*
* $Log: glu.h,v $
* Revision 1.1 1999/08/19 00:55:40 jtg
* Initial revision
*
* 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
@@ -64,10 +35,11 @@ extern "C" {
#endif
#include "GL/gl.h"
#include <GL/gl.h>
/* to facilitate clean DLL building ... */
#if !defined(OPENSTEP) && (defined(__WIN32__) || defined(__CYGWIN32__))
#if !defined(OPENSTEP) && (defined(__WIN32__) || defined(__CYGWIN__))
# if defined(_MSC_VER) && defined(BUILD_GLU32) /* tag specify we're building mesa as a DLL */
# define GLUAPI __declspec(dllexport)
# elif defined(_MSC_VER) && defined(_DLL) /* tag specifying we're building for DLL runtime support */
@@ -75,9 +47,19 @@ extern "C" {
# else /* for use with static link lib build of Win32 edition only */
# define GLUAPI extern
# endif /* _STATIC_MESA support */
# define GLCALLBACK __stdcall
# define GLCALLBACKP __stdcall *
#else
# define GLUAPI extern
#endif /* WIN32 / CYGWIN32 bracket */
# define GLCALLBACK
# define GLCALLBACKP *
#endif /* WIN32 / CYGWIN bracket */
/* compatability guard so we don't need to change client code */
#if defined(_WIN32) && !defined(_WINDEF_) && !defined(_GNU_H_WINDOWS32_BASE) && !defined(OPENSTEP)
# define CALLBACK GLCALLBACK
#endif
#ifdef macintosh
#pragma enumsalwaysint on
@@ -86,136 +68,189 @@ extern "C" {
#endif
#endif
#ifndef GLUAPI
#define GLUAPI
#endif
#define GLU_VERSION_1_1 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
enum {
/* Normal vectors */
GLU_SMOOTH = 100000,
GLU_FLAT = 100001,
GLU_NONE = 100002,
/* Quadric draw styles */
GLU_POINT = 100010,
GLU_LINE = 100011,
GLU_FILL = 100012,
GLU_SILHOUETTE = 100013,
/* Quadric orientation */
GLU_OUTSIDE = 100020,
GLU_INSIDE = 100021,
/* Tesselator */
GLU_BEGIN = 100100,
GLU_VERTEX = 100101,
GLU_END = 100102,
GLU_ERROR = 100103,
GLU_EDGE_FLAG = 100104,
/* Contour types */
GLU_CW = 100120,
GLU_CCW = 100121,
GLU_INTERIOR = 100122,
GLU_EXTERIOR = 100123,
GLU_UNKNOWN = 100124,
/* Tesselation errors */
GLU_TESS_ERROR1 = 100151, /* missing gluEndPolygon */
GLU_TESS_ERROR2 = 100152, /* missing gluBeginPolygon */
GLU_TESS_ERROR3 = 100153, /* misoriented contour */
GLU_TESS_ERROR4 = 100154, /* vertex/edge intersection */
GLU_TESS_ERROR5 = 100155, /* misoriented or self-intersecting loops */
GLU_TESS_ERROR6 = 100156, /* coincident vertices */
GLU_TESS_ERROR7 = 100157, /* all vertices collinear */
GLU_TESS_ERROR8 = 100158, /* intersecting edges */
GLU_TESS_ERROR9 = 100159, /* not coplanar contours */
/* 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,
GLU_PATH_LENGTH = 100215,
GLU_PARAMETRIC_ERROR = 100216,
GLU_DOMAIN_DISTANCE = 100217,
GLU_MAP1_TRIM_2 = 100210,
GLU_MAP1_TRIM_3 = 100211,
GLU_OUTLINE_POLYGON = 100240,
GLU_OUTLINE_PATCH = 100241,
GLU_NURBS_ERROR1 = 100251, /* spline order un-supported */
GLU_NURBS_ERROR2 = 100252, /* too few knots */
GLU_NURBS_ERROR3 = 100253, /* valid knot range is empty */
GLU_NURBS_ERROR4 = 100254, /* decreasing knot sequence */
GLU_NURBS_ERROR5 = 100255, /* knot multiplicity > spline order */
GLU_NURBS_ERROR6 = 100256, /* endcurve() must follow bgncurve() */
GLU_NURBS_ERROR7 = 100257, /* bgncurve() must precede endcurve() */
GLU_NURBS_ERROR8 = 100258, /* ctrlarray or knot vector is NULL */
GLU_NURBS_ERROR9 = 100259, /* can't draw pwlcurves */
GLU_NURBS_ERROR10 = 100260, /* missing gluNurbsCurve() */
GLU_NURBS_ERROR11 = 100261, /* missing gluNurbsSurface() */
GLU_NURBS_ERROR12 = 100262, /* endtrim() must precede endsurface() */
GLU_NURBS_ERROR13 = 100263, /* bgnsurface() must precede endsurface() */
GLU_NURBS_ERROR14 = 100264, /* curve of improper type passed as trim curve */
GLU_NURBS_ERROR15 = 100265, /* bgnsurface() must precede bgntrim() */
GLU_NURBS_ERROR16 = 100266, /* endtrim() must follow bgntrim() */
GLU_NURBS_ERROR17 = 100267, /* bgntrim() must precede endtrim()*/
GLU_NURBS_ERROR18 = 100268, /* invalid or missing trim curve*/
GLU_NURBS_ERROR19 = 100269, /* bgntrim() must precede pwlcurve() */
GLU_NURBS_ERROR20 = 100270, /* pwlcurve referenced twice*/
GLU_NURBS_ERROR21 = 100271, /* pwlcurve and nurbscurve mixed */
GLU_NURBS_ERROR22 = 100272, /* improper usage of trim data type */
GLU_NURBS_ERROR23 = 100273, /* nurbscurve referenced twice */
GLU_NURBS_ERROR24 = 100274, /* nurbscurve and pwlcurve mixed */
GLU_NURBS_ERROR25 = 100275, /* nurbssurface referenced twice */
GLU_NURBS_ERROR26 = 100276, /* invalid property */
GLU_NURBS_ERROR27 = 100277, /* endsurface() must follow bgnsurface() */
GLU_NURBS_ERROR28 = 100278, /* intersecting or misoriented trim curves */
GLU_NURBS_ERROR29 = 100279, /* intersecting trim curves */
GLU_NURBS_ERROR30 = 100280, /* UNUSED */
GLU_NURBS_ERROR31 = 100281, /* unconnected trim curves */
GLU_NURBS_ERROR32 = 100282, /* unknown knot error */
GLU_NURBS_ERROR33 = 100283, /* negative vertex count encountered */
GLU_NURBS_ERROR34 = 100284, /* negative byte-stride */
GLU_NURBS_ERROR35 = 100285, /* unknown type descriptor */
GLU_NURBS_ERROR36 = 100286, /* null control point reference */
GLU_NURBS_ERROR37 = 100287, /* duplicate point on pwlcurve */
/* Errors */
GLU_INVALID_ENUM = 100900,
GLU_INVALID_VALUE = 100901,
GLU_OUT_OF_MEMORY = 100902,
GLU_INCOMPATIBLE_GL_VERSION = 100903,
/* New in GLU 1.1 */
GLU_VERSION = 100800,
GLU_EXTENSIONS = 100801
};
#define GLU_TRUE 1
#define GLU_FALSE 0
/* Normal vectors */
#define GLU_SMOOTH 100000
#define GLU_FLAT 100001
#define GLU_NONE 100002
/* Quadric draw styles */
#define GLU_POINT 100010
#define GLU_LINE 100011
#define GLU_FILL 100012
#define GLU_SILHOUETTE 100013
/* Quadric orientation */
#define GLU_OUTSIDE 100020
#define GLU_INSIDE 100021
/* Tessellator */
#define GLU_TESS_BEGIN 100100
#define GLU_TESS_VERTEX 100101
#define GLU_TESS_END 100102
#define GLU_TESS_ERROR 100103
#define GLU_TESS_EDGE_FLAG 100104
#define GLU_TESS_COMBINE 100105
#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
/* 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
/* Tessellation properties */
#define GLU_TESS_WINDING_RULE 100140
#define GLU_TESS_BOUNDARY_ONLY 100141
#define GLU_TESS_TOLERANCE 100142
/* Tessellation errors */
#define GLU_TESS_ERROR1 100151 /* Missing gluBeginPolygon */
#define GLU_TESS_ERROR2 100152 /* Missing gluBeginContour */
#define GLU_TESS_ERROR3 100153 /* Missing gluEndPolygon */
#define GLU_TESS_ERROR4 100154 /* Missing gluEndContour */
#define GLU_TESS_ERROR5 100155 /* */
#define GLU_TESS_ERROR6 100156 /* */
#define GLU_TESS_ERROR7 100157 /* */
#define GLU_TESS_ERROR8 100158 /* */
/* 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
#define GLU_PATH_LENGTH 100215
#define GLU_PARAMETRIC_ERROR 100216
#define GLU_DOMAIN_DISTANCE 100217
#define GLU_MAP1_TRIM_2 100210
#define GLU_MAP1_TRIM_3 100211
#define GLU_OUTLINE_POLYGON 100240
#define GLU_OUTLINE_PATCH 100241
#define GLU_NURBS_ERROR1 100251 /* spline order un-supported */
#define GLU_NURBS_ERROR2 100252 /* too few knots */
#define GLU_NURBS_ERROR3 100253 /* valid knot range is empty */
#define GLU_NURBS_ERROR4 100254 /* decreasing knot sequence */
#define GLU_NURBS_ERROR5 100255 /* knot multiplicity > spline order */
#define GLU_NURBS_ERROR6 100256 /* endcurve() must follow bgncurve() */
#define GLU_NURBS_ERROR7 100257 /* bgncurve() must precede endcurve() */
#define GLU_NURBS_ERROR8 100258 /* ctrlarray or knot vector is NULL */
#define GLU_NURBS_ERROR9 100259 /* can't draw pwlcurves */
#define GLU_NURBS_ERROR10 100260 /* missing gluNurbsCurve() */
#define GLU_NURBS_ERROR11 100261 /* missing gluNurbsSurface() */
#define GLU_NURBS_ERROR12 100262 /* endtrim() must precede endsurface() */
#define GLU_NURBS_ERROR13 100263 /* bgnsurface() must precede endsurface() */
#define GLU_NURBS_ERROR14 100264 /* curve of improper type passed as trim curve */
#define GLU_NURBS_ERROR15 100265 /* bgnsurface() must precede bgntrim() */
#define GLU_NURBS_ERROR16 100266 /* endtrim() must follow bgntrim() */
#define GLU_NURBS_ERROR17 100267 /* bgntrim() must precede endtrim()*/
#define GLU_NURBS_ERROR18 100268 /* invalid or missing trim curve*/
#define GLU_NURBS_ERROR19 100269 /* bgntrim() must precede pwlcurve() */
#define GLU_NURBS_ERROR20 100270 /* pwlcurve referenced twice*/
#define GLU_NURBS_ERROR21 100271 /* pwlcurve and nurbscurve mixed */
#define GLU_NURBS_ERROR22 100272 /* improper usage of trim data type */
#define GLU_NURBS_ERROR23 100273 /* nurbscurve referenced twice */
#define GLU_NURBS_ERROR24 100274 /* nurbscurve and pwlcurve mixed */
#define GLU_NURBS_ERROR25 100275 /* nurbssurface referenced twice */
#define GLU_NURBS_ERROR26 100276 /* invalid property */
#define GLU_NURBS_ERROR27 100277 /* endsurface() must follow bgnsurface() */
#define GLU_NURBS_ERROR28 100278 /* intersecting or misoriented trim curves */
#define GLU_NURBS_ERROR29 100279 /* intersecting trim curves */
#define GLU_NURBS_ERROR30 100280 /* UNUSED */
#define GLU_NURBS_ERROR31 100281 /* unconnected trim curves */
#define GLU_NURBS_ERROR32 100282 /* unknown knot error */
#define GLU_NURBS_ERROR33 100283 /* negative vertex count encountered */
#define GLU_NURBS_ERROR34 100284 /* negative byte-stride */
#define GLU_NURBS_ERROR35 100285 /* unknown type descriptor */
#define GLU_NURBS_ERROR36 100286 /* null control point reference */
#define GLU_NURBS_ERROR37 100287 /* duplicate point on pwlcurve */
/* GLU 1.3 and later */
#define GLU_NURBS_MODE 100160
/* Errors */
#define GLU_INVALID_ENUM 100900
#define GLU_INVALID_VALUE 100901
#define GLU_OUT_OF_MEMORY 100902
#define GLU_INCOMPATIBLE_GL_VERSION 100903
/* GLU 1.1 and later */
#define GLU_VERSION 100800
#define GLU_EXTENSIONS 100801
/*** GLU 1.0 tessellation ***/
/* 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
/*
* These are the GLU 1.1 typedefs. GLU 1.2 has different ones!
*/
#if defined(__BEOS__)
/* The BeOS does something funky and makes these typedefs in one
* of its system headers.
*/
/* The BeOS does something funky and makes these typedefs in one
* of its system headers.
*/
#else
typedef struct GLUquadric GLUquadricObj;
typedef struct GLUtesselator GLUtriangulatorObj;
typedef struct GLUnurbs GLUnurbsObj;
#if defined GLU_VERSION_1_2
typedef struct GLUquadric GLUquadricObj;
typedef struct GLUnurbs GLUnurbsObj;
/* FIXME: We need to implement the other 1.3 typedefs - GH */
typedef struct GLUtesselator GLUtesselator;
typedef GLUtesselator GLUtriangulatorObj;
#else
/* GLU 1.1 and older */
typedef struct GLUquadric GLUquadricObj;
typedef struct GLUtriangulatorObj GLUtriangulatorObj;
typedef struct GLUnurbs GLUnurbsObj;
#endif
#endif
@@ -232,37 +267,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 );
@@ -275,19 +310,19 @@ GLUAPI const GLubyte* GLAPIENTRY gluErrorString( GLenum errorCode );
*/
GLUAPI GLint GLAPIENTRY gluScaleImage( GLenum format,
GLint widthin, GLint heightin,
GLenum typein, const void *datain,
GLint widthout, GLint heightout,
GLenum typeout, void *dataout );
GLsizei widthin, GLsizei heightin,
GLenum typein, const void *datain,
GLsizei widthout, GLsizei heightout,
GLenum typeout, void *dataout );
GLUAPI GLint GLAPIENTRY gluBuild1DMipmaps( GLenum target, GLint components,
GLint width, GLenum format,
GLenum type, const void *data );
GLsizei width, GLenum format,
GLenum type, const void *data );
GLUAPI GLint GLAPIENTRY gluBuild2DMipmaps( GLenum target, GLint components,
GLint width, GLint height,
GLenum format,
GLenum type, const void *data );
GLsizei width, GLsizei height,
GLenum format,
GLenum type, const void *data );
@@ -302,37 +337,40 @@ 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 );
GLUAPI void GLAPIENTRY gluPartialDisk( GLUquadricObj *qobj,
GLdouble innerRadius,
GLdouble outerRadius, GLint slices,
GLint loops, GLdouble startAngle,
GLdouble sweepAngle );
@@ -347,59 +385,92 @@ 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)() );
/*
*
* Polygon tesselation
* Polygon tessellation
*
*/
#ifdef GLU_VERSION_1_2
GLUAPI GLUtesselator* GLAPIENTRY gluNewTess( void );
GLUAPI void GLAPIENTRY gluDeleteTess( GLUtesselator *tobj );
GLUAPI void GLAPIENTRY gluTessBeginPolygon( GLUtesselator *tobj,
void *polygon_data );
GLUAPI void GLAPIENTRY gluTessBeginContour( GLUtesselator *tobj );
GLUAPI void GLAPIENTRY gluTessVertex( GLUtesselator *tobj, GLdouble coords[3],
void *vertex_data );
GLUAPI void GLAPIENTRY gluTessEndContour( GLUtesselator *tobj );
GLUAPI void GLAPIENTRY gluTessEndPolygon( GLUtesselator *tobj );
GLUAPI void GLAPIENTRY gluTessProperty( GLUtesselator *tobj, GLenum which,
GLdouble value );
GLUAPI void GLAPIENTRY gluTessNormal( GLUtesselator *tobj, GLdouble x,
GLdouble y, GLdouble z );
GLUAPI void GLAPIENTRY gluTessCallback( GLUtesselator *tobj, GLenum which,
void (GLCALLBACK *fn)() );
GLUAPI void GLAPIENTRY gluGetTessProperty( GLUtesselator *tobj, GLenum which,
GLdouble *value );
#else
GLUAPI GLUtriangulatorObj* GLAPIENTRY gluNewTess( void );
GLUAPI void GLAPIENTRY gluTessCallback( GLUtriangulatorObj *tobj, GLenum which,
void (GLCALLBACK *fn)() );
void (GLCALLBACK *fn)() );
GLUAPI void GLAPIENTRY gluDeleteTess( GLUtriangulatorObj *tobj );
@@ -410,7 +481,10 @@ GLUAPI void GLAPIENTRY gluEndPolygon( GLUtriangulatorObj *tobj );
GLUAPI void GLAPIENTRY gluNextContour( GLUtriangulatorObj *tobj, GLenum type );
GLUAPI void GLAPIENTRY gluTessVertex( GLUtriangulatorObj *tobj, GLdouble v[3],
void *data );
void *data );
#endif
@@ -423,6 +497,22 @@ GLUAPI void GLAPIENTRY gluTessVertex( GLUtriangulatorObj *tobj, GLdouble v[3],
GLUAPI const GLubyte* GLAPIENTRY gluGetString( GLenum name );
/*
*
* GLU 1.3 functions
*
*/
#ifdef GLU_VERSION_1_3
GLUAPI GLboolean GLAPIENTRY
gluCheckExtension( const char *extName, const GLubyte *extString );
#endif
#if defined(__BEOS__) || defined(__QUICKDRAW__)
#pragma export off
#endif

View File

@@ -1,4 +1,4 @@
/* $Id: glu_mangle.h,v 1.1 1999/08/19 00:55:40 jtg Exp $ */
/* $Id: glu_mangle.h,v 1.2 1999/09/10 02:08:19 gareth Exp $ */
/*
* Mesa 3-D graphics library
@@ -23,8 +23,11 @@
/*
* $Log: glu_mangle.h,v $
* Revision 1.1 1999/08/19 00:55:40 jtg
* Initial revision
* Revision 1.2 1999/09/10 02:08:19 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.1 1999/06/21 22:00:42 brianp
* added #ifndef GLU_MANGLE_H stuff
@@ -75,12 +78,19 @@
#define gluPwlCurve mgluPwlCurve
#define gluNurbsCallback mgluNurbsCallback
#define gluNewTess mgluNewTess
#define gluTessCallback mgluTessCallback
#define gluDeleteTess mgluDeleteTess
#define gluBeginPolygon mgluBeginPolygon
#define gluEndPolygon mgluEndPolygon
#define gluNextContour mgluNextContour
#define gluTessBeginPolygon mgluTessBeginPolygon
#define gluTessBeginContour mgluTessBeginContour
#define gluTessVertex mgluTessVertex
#define gluTessEndPolygon mgluTessEndPolygon
#define gluTessEndContour mgluTessEndContour
#define gluTessProperty mgluTessProperty
#define gluTessNormal mgluTessNormal
#define gluTessCallback mgluTessCallback
#define gluGetTessProperty mgluGetTessProperty
#define gluBeginPolygon mgluBeginPolygon
#define gluNextContour mgluNextContour
#define gluEndPolygon mgluEndPolygon
#define gluGetString mgluGetString
#endif

View File

@@ -108,7 +108,7 @@ extern _CRTIMP void __cdecl exit(int);
and redifinition of Windows system defs, also removes requirement of
pretty much any standard windows header from this file */
#if (_MSC_VER >= 800) || defined(_STDCALL_SUPPORTED)
#if (_MSC_VER >= 800) || defined(_STDCALL_SUPPORTED) || defined(__CYGWIN32__)
# define GLUTAPIENTRY __stdcall
#else
# define GLUTAPIENTRY
@@ -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 */
@@ -183,7 +199,7 @@ GLUTAPI int GLUTAPIENTRY SwapBuffers(HDC);
# define GLUTCALLBACK
# define GLUTAPI extern
/* Prototype exit for the non-Win32 case (see above). */
extern void exit(int);
/*extern void exit(int); this screws up gcc -ansi -pedantic! */
#endif
@@ -723,7 +739,6 @@ GLUTAPI int GLUTAPIENTRY glutGameModeGet(GLenum mode);
#ifdef __cplusplus
}
#endif
#if 0

View File

@@ -1,10 +1,10 @@
/* $Id: glx.h,v 1.1 1999/08/19 00:55:40 jtg Exp $ */
/* $Id: glx.h,v 1.22 2000/06/23 17:39:18 brianp Exp $ */
/*
* Mesa 3-D graphics library
* Version: 3.1
* Version: 3.3
*
* Copyright (C) 1999 Brian Paul All Rights Reserved.
* Copyright (C) 1999-2000 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -25,50 +25,25 @@
*/
/*
* $Log: glx.h,v $
* Revision 1.1 1999/08/19 00:55:40 jtg
* Initial revision
*
* 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.
*/
#ifdef __VMS
# ifdef __cplusplus
/* VMS Xlib.h gives problems with C++.
* this avoids a bunch of trivial warnings */
#pragma message disable nosimpint
#endif
#endif
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include "GL/gl.h"
#ifdef MESA
#include "GL/xmesa.h"
#ifdef __VMS
# ifdef __cplusplus
#pragma message enable nosimpint
#endif
#endif
#include "GL/gl.h"
#if defined(USE_MGL_NAMESPACE)
@@ -82,39 +57,33 @@ extern "C" {
#define GLX_VERSION_1_1 1
#define GLX_VERSION_1_2 1
#define GLX_VERSION_1_3 1
#define GLX_EXTENSION_NAME "GLX"
/*
* Tokens for glXChooseVisual and glXGetConfig:
*/
enum _GLX_CONFIGS {
GLX_USE_GL = 1,
GLX_BUFFER_SIZE = 2,
GLX_LEVEL = 3,
GLX_RGBA = 4,
GLX_DOUBLEBUFFER = 5,
GLX_STEREO = 6,
GLX_AUX_BUFFERS = 7,
GLX_RED_SIZE = 8,
GLX_GREEN_SIZE = 9,
GLX_BLUE_SIZE = 10,
GLX_ALPHA_SIZE = 11,
GLX_DEPTH_SIZE = 12,
GLX_STENCIL_SIZE = 13,
GLX_ACCUM_RED_SIZE = 14,
GLX_ACCUM_GREEN_SIZE = 15,
GLX_ACCUM_BLUE_SIZE = 16,
GLX_ACCUM_ALPHA_SIZE = 17,
/* GLX_EXT_visual_info extension */
GLX_X_VISUAL_TYPE_EXT = 0x22,
GLX_TRANSPARENT_TYPE_EXT = 0x23,
GLX_TRANSPARENT_INDEX_VALUE_EXT = 0x24,
GLX_TRANSPARENT_RED_VALUE_EXT = 0x25,
GLX_TRANSPARENT_GREEN_VALUE_EXT = 0x26,
GLX_TRANSPARENT_BLUE_VALUE_EXT = 0x27,
GLX_TRANSPARENT_ALPHA_VALUE_EXT = 0x28
};
#define GLX_USE_GL 1
#define GLX_BUFFER_SIZE 2
#define GLX_LEVEL 3
#define GLX_RGBA 4
#define GLX_DOUBLEBUFFER 5
#define GLX_STEREO 6
#define GLX_AUX_BUFFERS 7
#define GLX_RED_SIZE 8
#define GLX_GREEN_SIZE 9
#define GLX_BLUE_SIZE 10
#define GLX_ALPHA_SIZE 11
#define GLX_DEPTH_SIZE 12
#define GLX_STENCIL_SIZE 13
#define GLX_ACCUM_RED_SIZE 14
#define GLX_ACCUM_GREEN_SIZE 15
#define GLX_ACCUM_BLUE_SIZE 16
#define GLX_ACCUM_ALPHA_SIZE 17
/*
@@ -138,42 +107,70 @@ enum _GLX_CONFIGS {
/*
* GLX_visual_info extension
* GLX 1.3 and later:
*/
#define GLX_TRUE_COLOR_EXT 0x8002
#define GLX_DIRECT_COLOR_EXT 0x8003
#define GLX_PSEUDO_COLOR_EXT 0x8004
#define GLX_STATIC_COLOR_EXT 0x8005
#define GLX_GRAY_SCALE_EXT 0x8006
#define GLX_STATIC_GRAY_EXT 0x8007
#define GLX_NONE_EXT 0x8000
#define GLX_TRANSPARENT_RGB_EXT 0x8008
#define GLX_TRANSPARENT_INDEX_EXT 0x8009
/*
* Compile-time extension tests
*/
#ifdef MESA
#define GLX_EXT_visual_info 1
#define GLX_MESA_pixmap_colormap 1
#define GLX_MESA_release_buffers 1
#define GLX_MESA_copy_sub_buffer 1
#define GLX_SGI_video_sync 1
#endif
#define GLX_CONFIG_CAVEAT 0x20
#define GLX_DONT_CARE 0xFFFFFFFF
#define GLX_SLOW_CONFIG 0x8001
#define GLX_NON_CONFORMANT_CONFIG 0x800D
#define GLX_X_VISUAL_TYPE 0x22
#define GLX_TRANSPARENT_TYPE 0x23
#define GLX_TRANSPARENT_INDEX_VALUE 0x24
#define GLX_TRANSPARENT_RED_VALUE 0x25
#define GLX_TRANSPARENT_GREEN_VALUE 0x26
#define GLX_TRANSPARENT_BLUE_VALUE 0x27
#define GLX_TRANSPARENT_ALPHA_VALUE 0x28
#define GLX_MAX_PBUFFER_WIDTH 0x8016
#define GLX_MAX_PBUFFER_HEIGHT 0x8017
#define GLX_MAX_PBUFFER_PIXELS 0x8018
#define GLX_PRESERVED_CONTENTS 0x801B
#define GLX_LARGEST_BUFFER 0x801C
#define GLX_DRAWABLE_TYPE 0x8010
#define GLX_FBCONFIG_ID 0x8013
#define GLX_VISUAL_ID 0x800B
#define GLX_WINDOW_BIT 0x00000001
#define GLX_PIXMAP_BIT 0x00000002
#define GLX_PBUFFER_BIT 0x00000004
#define GLX_AUX_BUFFERS_BIT 0x00000010
#define GLX_FRONT_LEFT_BUFFER_BIT 0x00000001
#define GLX_FRONT_RIGHT_BUFFER_BIT 0x00000002
#define GLX_BACK_LEFT_BUFFER_BIT 0x00000004
#define GLX_BACK_RIGHT_BUFFER_BIT 0x00000008
#define GLX_AUX_BUFFERS_BIT 0x00000010
#define GLX_DEPTH_BUFFER_BIT 0x00000020
#define GLX_STENCIL_BUFFER_BIT 0x00000040
#define GLX_ACCUM_BUFFER_BIT 0x00000080
#define GLX_DRAWABLE_TYPE 0x8010
#define GLX_RENDER_TYPE 0x8011
#define GLX_X_RENDERABLE 0x8012
#define GLX_NONE 0x8000
#define GLX_TRUE_COLOR 0x8002
#define GLX_DIRECT_COLOR 0x8003
#define GLX_PSEUDO_COLOR 0x8004
#define GLX_STATIC_COLOR 0x8005
#define GLX_GRAY_SCALE 0x8006
#define GLX_STATIC_GRAY 0x8007
#define GLX_TRANSPARENT_INDEX 0x8009
#define GLX_COLOR_INDEX_TYPE 0x8015
#define GLX_COLOR_INDEX_BIT 0x00000002
#define GLX_SCREEN 0x800C
#define GLX_PBUFFER_CLOBBER_MASK 0x08000000
#define GLX_DAMAGED 0x8020
#define GLX_SAVED 0x8021
#define GLX_WINDOW 0x8022
#define GLX_PBUFFER 0x8033
#ifdef MESA
typedef XMesaContext GLXContext;
typedef Pixmap GLXPixmap;
typedef Drawable GLXDrawable;
#else
typedef void * GLXContext;
typedef XID GLXPixmap;
typedef XID GLXDrawable;
#endif
typedef void * GLXContext;
typedef XID GLXPixmap;
typedef XID GLXDrawable;
/* GLX 1.3 and later */
typedef void * GLXFBConfig;
typedef XID GLXFBConfigID;
typedef XID GLXContextID;
typedef XID GLXWindow;
typedef XID GLXPbuffer;
@@ -189,7 +186,7 @@ extern Bool glXMakeCurrent( Display *dpy, GLXDrawable drawable,
GLXContext ctx);
extern void glXCopyContext( Display *dpy, GLXContext src, GLXContext dst,
GLuint mask );
unsigned long mask );
extern void glXSwapBuffers( Display *dpy, GLXDrawable drawable );
@@ -227,30 +224,214 @@ extern const char *glXQueryServerString( Display *dpy, int screen, int name );
extern const char *glXGetClientString( Display *dpy, int name );
/* GLX 1.2 and later */
extern Display *glXGetCurrentDisplay( void );
/* GLX 1.3 and later */
extern GLXFBConfig *glXChooseFBConfig( Display *dpy, int screen,
const int *attribList, int *nitems );
extern int glXGetFBConfigAttrib( Display *dpy, GLXFBConfig config,
int attribute, int *value );
extern GLXFBConfig *glXGetFBConfigs( Display *dpy, int screen,
int *nelements );
extern XVisualInfo *glXGetVisualFromFBConfig( Display *dpy,
GLXFBConfig config );
extern GLXWindow glXCreateWindow( Display *dpy, GLXFBConfig config,
Window win, const int *attribList );
extern void glXDestroyWindow( Display *dpy, GLXWindow window );
extern GLXPixmap glXCreatePixmap( Display *dpy, GLXFBConfig config,
Pixmap pixmap, const int *attribList );
extern void glXDestroyPixmap( Display *dpy, GLXPixmap pixmap );
extern GLXPbuffer glXCreatePbuffer( Display *dpy, GLXFBConfig config,
const int *attribList );
extern void glXDestroyPbuffer( Display *dpy, GLXPbuffer pbuf );
extern void glXQueryDrawable( Display *dpy, GLXDrawable draw, int attribute,
unsigned int *value );
extern GLXContext glXCreateNewContext( Display *dpy, GLXFBConfig config,
int renderType, GLXContext shareList,
Bool direct );
extern Bool glXMakeContextCurrent( Display *dpy, GLXDrawable draw,
GLXDrawable read, GLXContext ctx );
extern GLXDrawable glXGetCurrentReadDrawable( void );
extern int glXQueryContext( Display *dpy, GLXContext ctx, int attribute,
int *value );
extern void glXSelectEvent( Display *dpy, GLXDrawable drawable,
unsigned long mask );
extern void glXGetSelectedEvent( Display *dpy, GLXDrawable drawable,
unsigned long *mask );
/*#ifndef GLX_GLXEXT_LEGACY*/
/*#include <GL/glxext.h>*/
/*#else*/
/*
* Mesa GLX Extensions
* 28. GLX_EXT_visual_info extension
*/
#ifndef GLX_EXT_visual_info
#define GLX_EXT_visual_info 1
#ifdef GLX_MESA_pixmap_colormap
extern GLXPixmap glXCreateGLXPixmapMESA( Display *dpy, XVisualInfo *visual,
Pixmap pixmap, Colormap cmap );
#endif
#define GLX_X_VISUAL_TYPE_EXT 0x22
#define GLX_TRANSPARENT_TYPE_EXT 0x23
#define GLX_TRANSPARENT_INDEX_VALUE_EXT 0x24
#define GLX_TRANSPARENT_RED_VALUE_EXT 0x25
#define GLX_TRANSPARENT_GREEN_VALUE_EXT 0x26
#define GLX_TRANSPARENT_BLUE_VALUE_EXT 0x27
#define GLX_TRANSPARENT_ALPHA_VALUE_EXT 0x28
#define GLX_TRUE_COLOR_EXT 0x8002
#define GLX_DIRECT_COLOR_EXT 0x8003
#define GLX_PSEUDO_COLOR_EXT 0x8004
#define GLX_STATIC_COLOR_EXT 0x8005
#define GLX_GRAY_SCALE_EXT 0x8006
#define GLX_STATIC_GRAY_EXT 0x8007
#define GLX_NONE_EXT 0x8000
#define GLX_TRANSPARENT_RGB_EXT 0x8008
#define GLX_TRANSPARENT_INDEX_EXT 0x8009
#ifdef GLX_MESA_release_buffers
extern Bool glXReleaseBuffersMESA( Display *dpy, GLXDrawable d );
#endif
#endif /* 28. GLX_EXT_visual_info extension */
/*
* 41. GLX_SGI_video_sync
*/
#ifndef GLX_SGI_video_sync
#define GLX_SGI_video_sync 1
extern int glXGetVideoSyncSGI(unsigned int *count);
extern int glXWaitVideoSyncSGI(int divisor, int remainder, unsigned int *count);
#endif /* GLX_SGI_video_sync */
/*
* 42. GLX_EXT_visual_rating
*/
#ifndef GLX_EXT_visual_rating
#define GLX_EXT_visual_rating 1
#define GLX_VISUAL_CAVEAT_EXT 0x20
/*#define GLX_NONE_EXT 0x8000*/
#define GLX_SLOW_VISUAL_EXT 0x8001
#define GLX_NON_CONFORMANT_VISUAL_EXT 0x800D
#endif /* GLX_EXT_visual_rating */
/*
* 47. GLX_EXT_import_context
*/
#ifndef GLX_EXT_import_context
#define GLX_EXT_import_context 1
#define GLX_SHARE_CONTEXT_EXT 0x800A
#define GLX_VISUAL_ID_EXT 0x800B
#define GLX_SCREEN_EXT 0x800C
extern void glXFreeContextEXT(Display *dpy, GLXContext context);
extern GLXContextID glXGetContextIDEXT(const GLXContext context);
extern Display *glXGetCurrentDisplayEXT(void);
extern GLXContext glXImportContextEXT(Display *dpy, GLXContextID contextID);
extern int glXQueryContextInfoEXT(Display *dpy, GLXContext context,
int attribute,int *value);
#endif /* GLX_EXT_import_context */
/*
* 215. GLX_MESA_copy_sub_buffer
*/
#ifndef GLX_MESA_copy_sub_buffer
#define GLX_MESA_copy_sub_buffer 1
#ifdef GLX_MESA_copy_sub_buffer
extern void glXCopySubBufferMESA( Display *dpy, GLXDrawable drawable,
int x, int y, int width, int height );
#endif
#ifdef GLX_SGI_video_sync
extern int glXGetVideoSyncSGI(unsigned int *count);
extern int glXWaitVideoSyncSGI(int divisor, int remainder,
unsigned int *count);
#endif
/*
* 216. GLX_MESA_pixmap_colormap
*/
#ifndef GLX_MESA_pixmap_colormap
#define GLX_MESA_pixmap_colormap 1
extern GLXPixmap glXCreateGLXPixmapMESA( Display *dpy, XVisualInfo *visual,
Pixmap pixmap, Colormap cmap );
#endif /* GLX_MESA_pixmap_colormap */
/*
* 217. GLX_MESA_release_buffers
*/
#ifndef GLX_MESA_release_buffers
#define GLX_MESA_release_buffers 1
extern Bool glXReleaseBuffersMESA( Display *dpy, GLXDrawable d );
#endif /* GLX_MESA_release_buffers */
/*
* 218. GLX_MESA_set_3dfx_mode
*/
#ifndef GLX_MESA_set_3dfx_mode
#define GLX_MESA_set_3dfx_mode 1
#define GLX_3DFX_WINDOW_MODE_MESA 0x1
#define GLX_3DFX_FULLSCREEN_MODE_MESA 0x2
extern GLboolean glXSet3DfxModeMESA( GLint mode );
#endif /* GLX_MESA_set_3dfx_mode */
/*
* ARB 2. GLX_ARB_get_proc_address
*/
#ifndef GLX_ARB_get_proc_address
#define GLX_ARB_get_proc_address 1
extern void (*glXGetProcAddressARB(const GLubyte *procName))();
#endif /* GLX_ARB_get_proc_address */
/*#endif*/ /* GLX_GLXEXT_LEGACY */

123
include/GL/mesa_wgl.h Normal file
View File

@@ -0,0 +1,123 @@
/* $Id: mesa_wgl.h,v 1.5 2000/05/22 16:21:27 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 _mesa_wgl_h_
#define _mesa_wgl_h_
#include <gl/gl.h>
#ifdef __cplusplus
extern "C" {
#endif
#if !defined(OPENSTEP) && (defined(__WIN32__) || defined(__CYGWIN32__))
# if defined(_MSC_VER) && defined(BUILD_GL32) /* tag specify we're building mesa as a DLL */
# define GLAPI __declspec(dllexport)
# define WGLAPI __declspec(dllexport)
# elif defined(_MSC_VER) && defined(_DLL) /* tag specifying we're building for DLL runtime support */
# define GLAPI __declspec(dllimport)
# define WGLAPI __declspec(dllimport)
# else /* for use with static link lib build of Win32 edition only */
# define GLAPI extern
# define WGLAPI __declspec(dllimport)
# endif /* _STATIC_MESA support */
# define GLAPIENTRY __stdcall
#else
/* non-Windows compilation */
# define GLAPI extern
# define GLAPIENTRY
#endif /* WIN32 / CYGWIN32 bracket */
#if defined(_WIN32) && !defined(_WINGDI_) && !defined(_GNU_H_WINDOWS32_DEFINES) && !defined(OPENSTEP)
#ifndef _GNU_H_WINDOWS32_FUNCTIONS
# ifdef UNICODE
# define wglUseFontBitmaps wglUseFontBitmapsW
# define wglUseFontOutlines wglUseFontOutlinesW
# else
# define wglUseFontBitmaps wglUseFontBitmapsA
# define wglUseFontOutlines wglUseFontOutlinesA
# endif /* !UNICODE */
#endif /* _GNU_H_WINDOWS32_FUNCTIONS */
typedef struct tagLAYERPLANEDESCRIPTOR LAYERPLANEDESCRIPTOR, *PLAYERPLANEDESCRIPTOR, *LPLAYERPLANEDESCRIPTOR;
typedef struct _GLYPHMETRICSFLOAT GLYPHMETRICSFLOAT, *PGLYPHMETRICSFLOAT, *LPGLYPHMETRICSFLOAT;
typedef struct tagPIXELFORMATDESCRIPTOR PIXELFORMATDESCRIPTOR, *PPIXELFORMATDESCRIPTOR, *LPPIXELFORMATDESCRIPTOR;
#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);
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 *);
#ifdef _MSC_VER
# pragma warning( pop )
#endif
#ifdef __cplusplus
}
#endif
#endif /* _mesa_wgl_h_ */

View File

@@ -1,10 +1,10 @@
/* $Id: osmesa.h,v 1.1 1999/08/19 00:55:40 jtg Exp $ */
/* $Id: osmesa.h,v 1.5 2000/03/28 16:59:39 rjfrank Exp $ */
/*
* Mesa 3-D graphics library
* Version: 3.1
* Version: 3.3
*
* Copyright (C) 1999 Brian Paul All Rights Reserved.
* Copyright (C) 1999-2000 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -25,26 +25,6 @@
*/
/*
* $Log: osmesa.h,v $
* Revision 1.1 1999/08/19 00:55:40 jtg
* Initial revision
*
* Revision 1.4 1999/02/14 03:39:09 brianp
* new copyright
*
* Revision 1.3 1999/01/03 02:52:30 brianp
* now using GLAPI and GLAPIENTRY keywords (Ted Jump)
*
* Revision 1.2 1998/07/26 01:33:51 brianp
* added WINGDIAPI and APIENTRY keywords per Ted Jump
*
* Revision 1.1 1998/02/13 03:17:50 brianp
* Initial revision
*
*/
/*
* Mesa Off-Screen rendering interface.
*
@@ -70,12 +50,10 @@
*/
#ifndef OSMESA_H
#define OSMESA_H
#ifdef __cplusplus
extern "C" {
#endif
@@ -84,9 +62,8 @@ extern "C" {
#include "GL/gl.h"
#define OSMESA_MAJOR_VERSION 3
#define OSMESA_MINOR_VERSION 0
#define OSMESA_MINOR_VERSION 3
@@ -119,7 +96,6 @@ extern "C" {
#define OSMESA_TYPE 0x23
typedef struct osmesa_context *OSMesaContext;
@@ -139,7 +115,7 @@ typedef struct osmesa_context *OSMesaContext;
* Return: an OSMesaContext or 0 if error
*/
GLAPI OSMesaContext GLAPIENTRY OSMesaCreateContext( GLenum format,
OSMesaContext sharelist );
OSMesaContext sharelist );
@@ -181,8 +157,8 @@ GLAPI void GLAPIENTRY OSMesaDestroyContext( OSMesaContext ctx );
* width>internal limit or height>internal limit.
*/
GLAPI GLboolean GLAPIENTRY OSMesaMakeCurrent( OSMesaContext ctx,
void *buffer, GLenum type,
GLsizei width, GLsizei height );
void *buffer, GLenum type,
GLsizei width, GLsizei height );
@@ -212,7 +188,7 @@ GLAPI void GLAPIENTRY OSMesaPixelStore( GLint pname, GLint value );
/*
* Return context info. This is like glGetIntegerv.
* Return an integer value like glGetIntegerv.
* Input: pname -
* OSMESA_WIDTH return current image width
* OSMESA_HEIGHT return current image height
@@ -237,10 +213,25 @@ GLAPI void GLAPIENTRY OSMesaGetIntegerv( GLint pname, GLint *value );
* New in Mesa 2.4.
*/
GLAPI GLboolean GLAPIENTRY OSMesaGetDepthBuffer( OSMesaContext c,
GLint *width, GLint *height,
GLint *bytesPerValue, void **buffer );
GLint *width, GLint *height,
GLint *bytesPerValue,
void **buffer );
/*
* Return the color buffer associated with an OSMesa context.
* Input: c - the OSMesa context
* Output: width, height - size of buffer in pixels
* format - buffer format (OSMESA_FORMAT)
* buffer - pointer to depth buffer values
* Return: GL_TRUE or GL_FALSE to indicate success or failure.
*
* New in Mesa 3.3.
*/
GLAPI GLboolean GLAPIENTRY OSMesaGetColorBuffer( OSMesaContext c,
GLint *width, GLint *height,
GLint *format,
void **buffer );
#if defined(__BEOS__) || defined(__QUICKDRAW__)

View File

@@ -1,9 +1,9 @@
/* $Id: svgamesa.h,v 1.1 1999/08/19 00:55:40 jtg Exp $ */
/* $Id: svgamesa.h,v 1.4 2000/02/09 19:03:28 brianp Exp $ */
/*
* Mesa 3-D graphics library
* Version: 3.0
* Copyright (C) 1995-1998 Brian Paul
* Version: 3.3
* Copyright (C) 1995-2000 Brian Paul
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -21,18 +21,6 @@
*/
/*
* $Log: svgamesa.h,v $
* Revision 1.1 1999/08/19 00:55:40 jtg
* Initial revision
*
* Revision 3.0 1998/02/20 05:07:24 brianp
* initial rev
*
*/
/*
* SVGA/Mesa interface for Linux.
*/
@@ -65,7 +53,7 @@
#define SVGAMESA_MAJOR_VERSION 3
#define SVGAMESA_MINOR_VERSION 0
#define SVGAMESA_MINOR_VERSION 3
#ifdef __cplusplus
@@ -87,16 +75,21 @@ typedef struct svgamesa_context *SVGAMesaContext;
/*
* doubleBuffer flag new in version 2.4
*/
extern int SVGAMesaInit( int GraphMode );
extern int SVGAMesaClose( void );
extern SVGAMesaContext SVGAMesaCreateContext( GLboolean doubleBuffer );
extern void SVGAMesaDestroyContext( SVGAMesaContext ctx );
extern void SVGAMesaMakeCurrent( SVGAMesaContext ctx );
extern SVGAMesaContext SVGAMesaGetCurrentContext( void );
extern void SVGAMesaSwapBuffers( void );
extern void SVGAMesaSetCI(int ndx, GLubyte red, GLubyte green, GLubyte blue);
extern SVGAMesaContext SVGAMesaGetCurrentContext( void );
#ifdef __cplusplus
}

View File

@@ -1,10 +1,10 @@
/* $Id: xmesa.h,v 1.1 1999/08/19 00:55:40 jtg Exp $ */
/* $Id: xmesa.h,v 1.8.4.1 2000/11/02 18:08:28 brianp Exp $ */
/*
* Mesa 3-D graphics library
* Version: 3.1
* Version: 3.3
*
* Copyright (C) 1999 Brian Paul All Rights Reserved.
* Copyright (C) 1999-2000 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -25,23 +25,6 @@
*/
/*
* $Log: xmesa.h,v $
* Revision 1.1 1999/08/19 00:55:40 jtg
* Initial revision
*
* Revision 1.3 1999/02/24 22:43:27 jens
* Name changes to get XMesa to compile standalone inside XFree86
*
* Revision 1.2 1999/02/14 03:39:09 brianp
* new copyright
*
* Revision 1.1 1998/02/13 03:17:32 brianp
* Initial revision
*
*/
/*
* Mesa/X11 interface. This header file serves as the documentation for
* the Mesa/X11 interface functions.
@@ -106,7 +89,7 @@ extern struct Library *XLibBase;
#define XMESA_MAJOR_VERSION 3
#define XMESA_MINOR_VERSION 0
#define XMESA_MINOR_VERSION 4
@@ -133,7 +116,6 @@ typedef struct xmesa_buffer *XMesaBuffer;
/*
* Create a new X/Mesa visual.
* Input: display - X11 display
@@ -144,24 +126,35 @@ typedef struct xmesa_buffer *XMesaBuffer;
* db_flag - GL_TRUE = double-buffered,
* GL_FALSE = single buffered
* stereo_flag - stereo visual?
* depth_size - requested bits/depth values, or zero
* stencil_size - requested bits/stencil values, or zero
* accum_size - requested bits/component values, or zero
* ximage_flag - GL_TRUE = use an XImage for back buffer,
* GL_FALSE = use an off-screen pixmap for back buffer
* depth_size - requested bits/depth values, or zero
* stencil_size - requested bits/stencil values, or zero
* accum_red_size - requested bits/red accum values, or zero
* accum_green_size - requested bits/green accum values, or zero
* accum_blue_size - requested bits/blue accum values, or zero
* accum_alpha_size - requested bits/alpha accum values, or zero
* num_samples - number of samples/pixel if multisampling, or zero
* level - visual level, usually 0
* visualCaveat - ala the GLX extension, usually GLX_NONE_EXT
* Return; a new XMesaVisual or 0 if error.
*/
extern XMesaVisual XMesaCreateVisual( XMesaDisplay *display,
XMesaVisualInfo visinfo,
GLboolean rgb_flag,
GLboolean alpha_flag,
GLboolean db_flag,
GLboolean stereo_flag,
GLboolean ximage_flag,
GLint depth_size,
GLint stencil_size,
GLint accum_size,
GLint level );
XMesaVisualInfo visinfo,
GLboolean rgb_flag,
GLboolean alpha_flag,
GLboolean db_flag,
GLboolean stereo_flag,
GLboolean ximage_flag,
GLint depth_size,
GLint stencil_size,
GLint accum_red_size,
GLint accum_green_size,
GLint accum_blue_size,
GLint accum_alpha_size,
GLint num_samples,
GLint level,
GLint visualCaveat );
/*
* Destroy an XMesaVisual, but not the associated XVisualInfo.
@@ -191,8 +184,7 @@ extern void XMesaDestroyContext( XMesaContext c );
/*
* Create an XMesaBuffer from an X window.
*/
extern XMesaBuffer XMesaCreateWindowBuffer( XMesaVisual v,
XMesaWindow w );
extern XMesaBuffer XMesaCreateWindowBuffer( XMesaVisual v, XMesaWindow w );
/*
@@ -226,6 +218,22 @@ extern GLboolean XMesaMakeCurrent( XMesaContext c,
XMesaBuffer b );
/*
* Bind two buffers (read and draw) to a context and make the
* context the current one.
* New in Mesa 3.3
*/
extern GLboolean XMesaMakeCurrent2( XMesaContext c,
XMesaBuffer drawBuffer,
XMesaBuffer readBuffer );
/*
* Unbind the current context from its buffer.
*/
extern GLboolean XMesaUnbindContext( XMesaContext c );
/*
* Return a handle to the current context.
*/
@@ -233,11 +241,18 @@ extern XMesaContext XMesaGetCurrentContext( void );
/*
* Return handle to the current buffer.
* Return handle to the current (draw) buffer.
*/
extern XMesaBuffer XMesaGetCurrentBuffer( void );
/*
* Return handle to the current read buffer.
* New in Mesa 3.3
*/
extern XMesaBuffer XMesaGetCurrentReadBuffer( void );
/*
* Swap the front and back buffers for the given buffer. No action is
* taken if the buffer is not double buffered.

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_x.h,v 1.1 1999/08/19 00:55:40 jtg Exp $
* $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/include/GL/xmesa_x.h,v 1.2 2000/02/25 20:31:11 brianp Exp $
*/
#ifndef _XMESA_X_H_
@@ -78,7 +78,6 @@ typedef XColor XMesaColor;
#define GET_REDMASK(__v) __v->visinfo->red_mask
#define GET_GREENMASK(__v) __v->visinfo->green_mask
#define GET_BLUEMASK(__v) __v->visinfo->blue_mask
#define GET_BITS_PER_PIXEL(__v) bits_per_pixel(__v->display, __v->visinfo)
#if defined(__cplusplus) || defined(c_plusplus)
#define GET_VISUAL_CLASS(__v) __v->visinfo->c_class
#else

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.5 2000/04/05 22:09:10 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,22 +122,22 @@ 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); \
ValidateGC((DrawablePtr)__b, __gc); \
__r[0].x = __x; \
__r[0].y = __y; \
__r[0].width = __w; \
__r[0].height = __h; \
(*__gc->ops->PolyFillRect)(__b, __gc, 1, __r); \
}
(*__gc->ops->PolyFillRect)((DrawablePtr)__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,16 +170,15 @@ 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
#define GET_GREENMASK(__v) __v->visinfo->greenMask
#define GET_BLUEMASK(__v) __v->visinfo->blueMask
#define GET_BITS_PER_PIXEL(__v) __v->visinfo->bitsPerRGBValue
#define GET_VISUAL_CLASS(__v) __v->visinfo->class
#define GET_VISUAL_DEPTH(__v) __v->visinfo->nplanes
#define GET_BLACK_PIXEL(__v) __v->display->blackPixel

View File

@@ -1,4 +1,4 @@
# $Id: Makefile,v 1.1 1999/08/19 00:55:40 jtg Exp $
# $Id: Makefile,v 1.2 1999/09/17 00:55:21 brianp Exp $
# Makefile for BeOS demos
@@ -11,7 +11,7 @@ CC = g++
# Use Mesa:
CFLAGS = -I../include -c -g
LFLAGS = -L../lib -Xlinker -rpath ../lib -lbe -lMesaGL
LFLAGS = -L../lib -Xlinker -rpath ../lib -lbe -lGL
# Use BeOS OpenGL:
#CFLAGS = -I/boot/develop/headers/be/opengl -c -g

View File

@@ -1,61 +1,61 @@
# $Id: Makefile.BeOS-R4,v 1.1 1999/08/19 00:55:40 jtg Exp $
# $Id: Makefile.BeOS-R4,v 1.12 2000/06/27 16:54:18 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.
# Version: 3.3
# Copyright (C) 1995-2000 Brian Paul
# Makefile for GLUT-based demo programs for BeOS R4
# $Log: Makefile.BeOS-R4,v $
# Revision 1.1 1999/08/19 00:55:40 jtg
# Initial revision
#
# 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
LIBDIR = ../lib
GL_LIBS = -L$(LIBDIR) -L/boot/home/config/lib -Xlinker -rpath $(LIBDIR) -lbe -lglut -lMesaGLU -lMesaGL $(XLIBS)
GL_LIBS = -L$(LIBDIR) -L/boot/home/config/lib -Xlinker -rpath $(LIBDIR) -lbe -lglut -lGLU -lGL $(XLIBS)
LIB_DEP = $(LIBDIR)/$(GL_LIB) $(LIBDIR)/$(GLU_LIB) $(LIBDIR)/$(GLUT_LIB)
PROGS = bounce clearspd drawpix gamma gears glinfo isosurf \
morph3d multiarb osdemo paltex pointblast reflect \
renormal spectex stex3d texcyl texobj trispd winpos
PROGS = bounce \
clearspd \
cubemap \
drawpix \
fire \
gamma \
gears \
geartrain \
glinfo \
gloss \
gltestperf \
glutfx \
isosurf \
ipers \
lodbias \
morph3d \
multiarb \
occlude \
osdemo \
paltex \
pixeltex \
pointblast \
ray \
readpix \
reflect \
renormal \
spectex \
stex3d \
teapot \
terrain \
tessdemo \
texcyl \
texdown \
texenv \
texobj \
trispd \
tunnel \
tunnel2 \
winpos
##### RULES #####

View File

@@ -1,9 +1,8 @@
# $Id: Makefile.X11,v 1.1 1999/08/19 00:55:40 jtg Exp $
# $Id: Makefile.X11,v 1.14 2000/06/27 16:54:18 brianp Exp $
# Mesa 3-D graphics library
# Version: 3.1
# Copyright (C) 1995-1998 Brian Paul
# Version: 3.3
# Copyright (C) 1995-2000 Brian Paul
# Makefile for GLUT-based demo programs for Unix/X11
@@ -13,13 +12,49 @@
INCDIR = ../include
LIBDIR = ../lib
GL_LIBS = -L$(LIBDIR) -lglut -lGLU -lGL -lm $(XLIBS)
GL_LIBS = -L$(LIBDIR) -lglut -lGLU -lGL $(APP_LIB_DEPS)
LIB_DEP = $(LIBDIR)/$(GL_LIB) $(LIBDIR)/$(GLU_LIB) $(LIBDIR)/$(GLUT_LIB)
PROGS = bounce clearspd drawpix gamma gears glinfo glutfx isosurf \
morph3d multiarb osdemo paltex pointblast reflect \
renormal spectex stex3d tessdemo texcyl texobj trispd winpos
PROGS = bounce \
clearspd \
cubemap \
drawpix \
fire \
gamma \
gears \
geartrain \
glinfo \
gloss \
gltestperf \
glutfx \
isosurf \
ipers \
lodbias \
morph3d \
multiarb \
occlude \
osdemo \
paltex \
pixeltex \
pointblast \
ray \
readpix \
reflect \
renormal \
spectex \
stex3d \
teapot \
terrain \
tessdemo \
texcyl \
texdown \
texenv \
texobj \
trispd \
tunnel \
tunnel2 \
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.11 2000/06/27 16:54:18 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.3
# Copyright (C) 1995-2000 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,9 +19,45 @@ 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 \
morph3d multiext osdemo paltex pointblast reflect \
renormal spectex stex3d tessdemo texcyl texobj trispd winpos
PROGS = bounce \
clearspd \
cubemap \
drawpix \
fire \
gamma \
gears \
geartrain \
glinfo \
gloss \
gltestperf \
glutfx \
isosurf \
ipers \
lodbias \
morph3d \
multiarb \
occlude \
osdemo \
paltex \
pixeltex \
pointblast \
ray \
readpix \
reflect \
renormal \
spectex \
stex3d \
teapot \
terrain \
tessdemo \
texcyl \
texdown \
texenv \
texobj \
trispd \
tunnel \
tunnel2 \
winpos
##### RULES #####

230
progs/demos/README Normal file
View File

@@ -0,0 +1,230 @@
INTRODUCTION
------------
This directory is usually included in the Mesa demos distribution or
in the GLUT distribution.
I have written the demos included in this directory mainly for showing
the capabilities of the Mesa library when using the Voodoo driver.
However all the demos are written using the GLUT and OpenGL so they
work with any GLUT/OpenGL platform (tested: Linux+Mesa+Voodoo driver,
Linux+Mesa+X11 driver, Win95+Mesa+Voodoo driver and SGI Onyx IR thanks
to Mark Kilgard).
All the demos make an heavy use of texture mapping, blending, etc. so
you _need_ some kind of hardware support for the OpenGL otherwise they
will run at ~1fps. You need also a OpenGL 1.1 compliant library.
You can find some screenshot of these demos at
http://www-hmw.caribel.pisa.it/fxmesa/fxdemos.hmtl
Write me if you find some bug in the demos.
David Bucciarelli (tech.hmw@plus.it)
Humanware s.r.l.
Via XXIV Maggio 62
Pisa, Italy
Tel./Fax +39-50-554108
email: info.hmw@plus.it
www: www-hmw.caribel.pisa.it
A BRIEF DESCRIPTION OF THE DEMOS
--------------------------------
IPERS
-----
Sources: ipers.c image.c
A nice spinning fractal object.
RAY
---
Sources: ray.c
I'm using ray tracing to dynamically generate texture maps with
specular, diffuse, shadows, and mirror colors. Each frame the texture
maps of the plane and of the sphere are partially updated. With this
technique you can obtain true mirrors, shadows, specular highlights,
bump mapping, etc. in realtime. This demo is really CPU intensive
(~25fps on a PentiumII@300MHz with a Pure3D). Support on-the-fly
switching between fullscreen and in-window rendering under Linux/Mesa
(start your X server in 16 bpp mode and press the spacebar).
TUNNEL
------
Sources: tunnel.c image.c sources.c
Data: bw.rgb tile.rgb
The model was designed and prelighted with Alias|Wavefront
PowerAnimator V8. Triangle strips were built with a tool written by me
and then statically included in the sources. This demo doesn't
require the ZBuffer and use antialiased polygons. Support on-the-fly
switching between fullscreen and in-window rendering under Linux/Mesa
(start your X server in 16 bpp mode and press the spacebar).
TUNNEL2
------
Sources: tunnel2.c image.c sources.c
Data: bw.rgb tile.rgb
The some tunnel demo but with two output channels. A nice
example of the Mesa/Voodoo support for multiple boards in
the some PC.
TEAPOT
------
Sources: teapot.c image.c dteapot.c shadow.c
Data: bw.rgb tile.rgb
The shadow is drawn projecting the teapot geometry over the plane. All
other light effects are drawn using the standard OpenGL capabilities.
Support on-the-fly switching between fullscreen and in-window
rendering under Linux/Mesa (start your X server in 16 bpp mode and
press the spacebar).
FIRE
----
Sources: fire.c image.c
Data: s128.rgb tree2.rgb
The demo use a small particle system to draw some nice visual effect.
You can interactively change many parameters of the particle system
and you can choose the number of particles at the startup ('fire
4000'). This demo should be called fountain. Support on-the-fly
switching between fullscreen and in-window rendering under Linux/Mesa
(start your X server in 16 bpp mode and press the spacebar).
TERRAIN
-------
Sources: mesaland.c
This demo is base on another demo written by Mikael SkiZoWalker. I
have added the capabilities to freely fly around, view culling and
some nice color. Support on-the-fly switching between fullscreen and
in-window rendering under Linux/Mesa (start your X server in 16 bpp
mode and press the spacebar).
GLTEST
------
Sources: gltest.c
This is a simple benchmark suite that I'm using in the development of
the Mesa/Voodoo driver. Type 'gltest >my.res' and you will get some
data about the performances of your OpenGL. Follow the results with my
PC (Linux+Mesa-2.6+PentiumII@300MHz+Pure3D):
Simple Points
587900.080674 Pnts/sec
Smooth Lines
SIZE=480 => 39007.426183 Lins/sec
SIZE=250 => 74575.016485 Lins/sec
SIZE=100 => 179734.882409 Lins/sec
SIZE=050 => 183987.795297 Lins/sec
SIZE=025 => 183820.086309 Lins/sec
ZSmooth Triangles
SIZE=480 => 784.954997 Tris/sec
SIZE=250 => 2862.325889 Tris/sec
SIZE=100 => 17779.492938 Tris/sec
SIZE=050 => 159339.829844 Tris/sec
SIZE=025 => 428602.984008 Tris/sec
ZSmooth Tex Blend Triangles
SIZE=480 => 784.473931 Tris/sec
SIZE=250 => 2853.781513 Tris/sec
SIZE=100 => 17598.252146 Tris/sec
SIZE=050 => 152632.578337 Tris/sec
SIZE=025 => 377584.760048 Tris/sec
ZSmooth Tex Blend TMesh Triangles
SIZE=400 => 563.900695 Tris/sec, MPixel Fill/sec: 45.112056
SIZE=250 => 1449.777225 Tris/sec, MPixel Fill/sec: 45.305538
SIZE=100 => 8702.869121 Tris/sec, MPixel Fill/sec: 43.514346
SIZE=050 => 31896.867466 Tris/sec, MPixel Fill/sec: 39.871084
SIZE=025 => 114037.262894 Tris/sec, MPixel Fill/sec: 35.636645
SIZE=010 => 220494.235839 Tris/sec, MPixel Fill/sec: 11.024712
SIZE=005 => 225615.506651 Tris/sec, MPixel Fill/sec: 2.820194
SIZE=002 => 225607.681439 Tris/sec, MPixel Fill/sec: 0.451215
Color/Depth Buffer Clears
295.042474 Clrs/sec, MPixel Fill/sec: 90.553256
Follow the results with my
PC (Linux+Mesa-3.0beta5+PentiumII@300MHz+Voodoo2):
Simple Points
1620113.525130 Pnts/sec
Smooth Lines
SIZE=480 => 73841.166065 Lins/sec
SIZE=250 => 140794.035316 Lins/sec
SIZE=100 => 344185.242157 Lins/sec
SIZE=050 => 420399.008289 Lins/sec
SIZE=025 => 420261.389773 Lins/sec
ZSmooth Triangles
SIZE=480 => 1434.668506 Tris/sec
SIZE=250 => 5228.449614 Tris/sec
SIZE=100 => 46603.815842 Tris/sec
SIZE=050 => 325757.045961 Tris/sec
SIZE=025 => 589022.403336 Tris/sec
ZSmooth Tex Blend Triangles
SIZE=480 => 1414.900041 Tris/sec
SIZE=250 => 5006.055235 Tris/sec
SIZE=100 => 43602.252031 Tris/sec
SIZE=050 => 303497.092692 Tris/sec
SIZE=025 => 517087.428669 Tris/sec
ZSmooth Tex Blend TMesh Triangles
SIZE=400 => 1023.273112 Tris/sec, MPixel Fill/sec: 81.861849
SIZE=250 => 2595.692121 Tris/sec, MPixel Fill/sec: 81.115379
SIZE=100 => 15788.198912 Tris/sec, MPixel Fill/sec: 78.940995
SIZE=050 => 58784.121300 Tris/sec, MPixel Fill/sec: 73.480152
SIZE=025 => 244233.873481 Tris/sec, MPixel Fill/sec: 76.323085
SIZE=010 => 474995.004191 Tris/sec, MPixel Fill/sec: 23.749750
SIZE=005 => 475124.354163 Tris/sec, MPixel Fill/sec: 5.939054
SIZE=002 => 474959.089503 Tris/sec, MPixel Fill/sec: 0.949918
Color/Depth Buffer Clears
478.654830 Clrs/sec, MPixel Fill/sec: 146.906826
PALTEX and GLBPALTX
-------------------
Sources: paltex.c and glbpaltx.c
The PALTEX example was written by Brian Paul and it shows the
capabilities of the GL_EXT_paletted_texture extension. I have written
the other example in order to show the capabilities of the
gl3DfxSetPaletteEXT() (it used only by GLQuake and Quake2).

View File

@@ -1,33 +1,13 @@
/* $Id: bounce.c,v 1.1 1999/08/19 00:55:40 jtg Exp $ */
/* $Id: bounce.c,v 1.2.4.1 2000/08/16 20:36:32 brianp Exp $ */
/*
* Bouncing ball demo. Color index mode only!
* Bouncing ball demo.
*
* This program is in the public domain
*
* Brian Paul
*/
/* Conversion to GLUT by Mark J. Kilgard */
/*
* $Log: bounce.c,v $
* Revision 1.1 1999/08/19 00:55:40 jtg
* Initial revision
*
* Revision 3.3 1999/03/18 08:16:14 joukj
*
* cmpstr needs string.h to included to avoid warnings
*
* Revision 3.2 1998/11/28 01:13:02 brianp
* now sets an initial window position and size
*
* Revision 3.1 1998/11/28 01:06:57 brianp
* now works in RGB mode by default
*
* Revision 3.0 1998/02/14 18:42:29 brianp
* initial rev
*
* Conversion to GLUT by Mark J. Kilgard
*/
@@ -81,9 +61,9 @@ make_ball(void)
glColor3f(1, 1, 1);
}
x = COS(b) * COS(a);
y = SIN(b) * COS(a);
z = SIN(a);
x = radius * COS(b) * COS(a);
y = radius * SIN(b) * COS(a);
z = radius * SIN(a);
glVertex3f(x, y, z);
x = radius * COS(b) * COS(a + da);
@@ -195,7 +175,7 @@ idle(void)
glutPostRedisplay();
}
void
static void
visible(int vis)
{
if (vis == GLUT_VISIBLE)

View File

@@ -1,4 +1,4 @@
/* $Id: clearspd.c,v 1.1 1999/08/19 00:55:40 jtg Exp $ */
/* $Id: clearspd.c,v 1.2 2000/04/10 16:25:15 brianp Exp $ */
/*
* Simple GLUT program to measure glClear() and glutSwapBuffers() speed.
@@ -7,8 +7,11 @@
/*
* $Log: clearspd.c,v $
* Revision 1.1 1999/08/19 00:55:40 jtg
* Initial revision
* Revision 1.2 2000/04/10 16:25:15 brianp
* fixed visual selection and reporting results
*
* 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
@@ -74,6 +77,7 @@ static void Display( void )
t0 = glutGet(GLUT_ELAPSED_TIME) * 0.001;
for (i=0;i<Loops;i++) {
glClear( BufferMask );
glFlush();
}
t1 = glutGet(GLUT_ELAPSED_TIME) * 0.001;
glutSwapBuffers();
@@ -88,12 +92,12 @@ static void Display( void )
clearRate = Loops / (t1-t0);
pixelRate = clearRate * Width * Height;
if (SwapFlag) {
printf("Rate: %d clears+swaps in %gs = %g clears+swaps/s %d pixels/s\n",
Loops, t1-t0, clearRate, (int)pixelRate );
printf("Rate: %d clears+swaps in %gs = %g clears+swaps/s %g pixels/s\n",
Loops, t1-t0, clearRate, pixelRate );
}
else {
printf("Rate: %d clears in %gs = %g clears/s %d pixels/s\n",
Loops, t1-t0, clearRate, (int)pixelRate);
printf("Rate: %d clears in %gs = %g clears/s %g pixels/s\n",
Loops, t1-t0, clearRate, pixelRate);
}
}
@@ -194,6 +198,8 @@ static void Help( const char *program )
int main( int argc, char *argv[] )
{
GLint mode;
printf("For options: %s -help\n", argv[0]);
Init( argc, argv );
@@ -202,7 +208,15 @@ int main( int argc, char *argv[] )
glutInitWindowSize( (int) Width, (int) Height );
glutInitWindowPosition( 0, 0 );
glutInitDisplayMode( ColorMode | GLUT_DOUBLE | GLUT_DEPTH | GLUT_STENCIL | GLUT_ACCUM );
mode = ColorMode | GLUT_DOUBLE;
if (BufferMask & GL_STENCIL_BUFFER_BIT)
mode |= GLUT_STENCIL;
if (BufferMask & GL_ACCUM_BUFFER_BIT)
mode |= GLUT_ACCUM;
if (BufferMask & GL_DEPTH_BUFFER_BIT)
mode |= GLUT_DEPTH;
glutInitDisplayMode(mode);
glutCreateWindow( argv[0] );

250
progs/demos/cubemap.c Normal file
View File

@@ -0,0 +1,250 @@
/* $Id: cubemap.c,v 1.3 2000/06/27 17:04:43 brianp Exp $ */
/*
* GL_ARB_texture_cube_map demo
*
* Brian Paul
* May 2000
*
*
* Copyright (C) 2000 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
/*
* This is a pretty minimalistic demo for now. Eventually, use some
* interesting cube map textures and 3D objects.
* For now, we use 6 checkerboard "walls" and a sphere (good for
* verification purposes).
*/
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "GL/glut.h"
static GLfloat Xrot = 0, Yrot = 0;
static void draw( void )
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glMatrixMode(GL_TEXTURE);
glLoadIdentity();
glRotatef(Xrot, 1, 0, 0);
glRotatef(Yrot, 0, 1, 0);
glutSolidSphere(2.0, 20, 20);
glMatrixMode(GL_MODELVIEW);
glutSwapBuffers();
}
static void idle(void)
{
Yrot += 5.0;
glutPostRedisplay();
}
static void set_mode(GLuint mode)
{
if (mode == 0) {
glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_REFLECTION_MAP_ARB);
glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_REFLECTION_MAP_ARB);
glTexGeni(GL_R, GL_TEXTURE_GEN_MODE, GL_REFLECTION_MAP_ARB);
printf("GL_REFLECTION_MAP_ARB mode\n");
}
else if (mode == 1) {
glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_NORMAL_MAP_ARB);
glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_NORMAL_MAP_ARB);
glTexGeni(GL_R, GL_TEXTURE_GEN_MODE, GL_NORMAL_MAP_ARB);
printf("GL_NORMAL_MAP_ARB mode\n");
}
glEnable(GL_TEXTURE_GEN_S);
glEnable(GL_TEXTURE_GEN_T);
glEnable(GL_TEXTURE_GEN_R);
}
static void key(unsigned char k, int x, int y)
{
static GLboolean anim = GL_TRUE;
static GLuint mode = 0;
(void) x;
(void) y;
switch (k) {
case ' ':
anim = !anim;
if (anim)
glutIdleFunc(idle);
else
glutIdleFunc(NULL);
break;
case 'm':
mode = !mode;
set_mode(mode);
break;
case 27:
exit(0);
}
glutPostRedisplay();
}
static void specialkey(int key, int x, int y)
{
GLfloat step = 10;
(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();
}
/* new window size or exposure */
static void reshape(int width, int height)
{
glViewport(0, 0, (GLint)width, (GLint)height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glFrustum( -2.0, 2.0, -2.0, 2.0, 6.0, 20.0 );
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glTranslatef( 0.0, 0.0, -8.0 );
}
static void init( void )
{
#define CUBE_TEX_SIZE 64
GLubyte image[CUBE_TEX_SIZE][CUBE_TEX_SIZE][3];
static const GLubyte colors[6][3] = {
{ 255, 0, 0 },
{ 0, 255, 255 },
{ 0, 255, 0 },
{ 255, 0, 255 },
{ 0, 0, 255 },
{ 255, 255, 0 }
};
static const GLenum targets[6] = {
GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB,
GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB,
GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB,
GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB,
GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB,
GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB
};
GLint i, j, f;
/* check for extension */
{
char *exten = (char *) glGetString(GL_EXTENSIONS);
if (!strstr(exten, "GL_ARB_texture_cube_map")) {
printf("Sorry, this demo requires GL_ARB_texture_cube_map\n");
exit(0);
}
}
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
/* make colored checkerboard cube faces */
for (f = 0; f < 6; f++) {
for (i = 0; i < CUBE_TEX_SIZE; i++) {
for (j = 0; j < CUBE_TEX_SIZE; j++) {
if ((i/4 + j/4) & 1) {
image[i][j][0] = colors[f][0];
image[i][j][1] = colors[f][1];
image[i][j][2] = colors[f][2];
}
else {
image[i][j][0] = 255;
image[i][j][1] = 255;
image[i][j][2] = 255;
}
}
}
glTexImage2D(targets[f], 0, GL_RGB, CUBE_TEX_SIZE, CUBE_TEX_SIZE, 0,
GL_RGB, GL_UNSIGNED_BYTE, image);
}
#if 1
glTexParameteri(GL_TEXTURE_CUBE_MAP_ARB, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_CUBE_MAP_ARB, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
#else
glTexParameteri(GL_TEXTURE_CUBE_MAP_ARB, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_CUBE_MAP_ARB, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
#endif
glTexParameteri(GL_TEXTURE_CUBE_MAP_ARB, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_CUBE_MAP_ARB, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glEnable(GL_TEXTURE_CUBE_MAP_ARB);
glClearColor(.3, .3, .3, 0);
glColor3f( 1.0, 1.0, 1.0 );
set_mode(0);
}
static void usage(void)
{
printf("keys:\n");
printf(" SPACE - toggle animation\n");
printf(" CURSOR KEYS - rotation\n");
printf(" m - toggle texgen reflection mode\n");
}
int main( int argc, char *argv[] )
{
glutInitWindowPosition(0, 0);
glutInitWindowSize(300, 300);
glutInitDisplayMode( GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE );
glutCreateWindow("Texture Cube Maping");
init();
glutReshapeFunc( reshape );
glutKeyboardFunc( key );
glutSpecialFunc( specialkey );
glutIdleFunc( idle );
glutDisplayFunc( draw );
usage();
glutMainLoop();
return 0;
}

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");
}

738
progs/demos/fire.c Normal file
View File

@@ -0,0 +1,738 @@
/*
* This program is under the GNU GPL.
* Use at your own risk.
*
* written by David Bucciarelli (tech.hmw@plus.it)
* Humanware s.r.l.
*/
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <time.h>
#ifdef WIN32
#include <windows.h>
#include <mmsystem.h>
#endif
#include <GL/glut.h>
#include "../util/readtex.c"
#ifdef XMESA
#include "GL/xmesa.h"
static int fullscreen = 1;
#endif
#ifndef M_PI
#define M_PI 3.1415926535
#endif
#define vinit(a,i,j,k) {\
(a)[0]=i;\
(a)[1]=j;\
(a)[2]=k;\
}
#define vinit4(a,i,j,k,w) {\
(a)[0]=i;\
(a)[1]=j;\
(a)[2]=k;\
(a)[3]=w;\
}
#define vadds(a,dt,b) {\
(a)[0]+=(dt)*(b)[0];\
(a)[1]+=(dt)*(b)[1];\
(a)[2]+=(dt)*(b)[2];\
}
#define vequ(a,b) {\
(a)[0]=(b)[0];\
(a)[1]=(b)[1];\
(a)[2]=(b)[2];\
}
#define vinter(a,dt,b,c) {\
(a)[0]=(dt)*(b)[0]+(1.0-dt)*(c)[0];\
(a)[1]=(dt)*(b)[1]+(1.0-dt)*(c)[1];\
(a)[2]=(dt)*(b)[2]+(1.0-dt)*(c)[2];\
}
#define clamp(a) ((a) < 0.0 ? 0.0 : ((a) < 1.0 ? (a) : 1.0))
#define vclamp(v) {\
(v)[0]=clamp((v)[0]);\
(v)[1]=clamp((v)[1]);\
(v)[2]=clamp((v)[2]);\
}
static int WIDTH = 640;
static int HEIGHT = 480;
#define FRAME 50
#define DIMP 20.0
#define DIMTP 16.0
#define RIDCOL 0.4
#define NUMTREE 50
#define TREEINR 2.5
#define TREEOUTR 8.0
#define AGRAV -9.8
typedef struct
{
int age;
float p[3][3];
float v[3];
float c[3][4];
}
part;
static float treepos[NUMTREE][3];
static float black[3] = { 0.0, 0.0, 0.0 };
static float blu[3] = { 0.0, 0.2, 1.0 };
static float blu2[3] = { 0.0, 1.0, 1.0 };
static float fogcolor[4] = { 1.0, 1.0, 1.0, 1.0 };
static float q[4][3] = {
{-DIMP, 0.0, -DIMP},
{DIMP, 0.0, -DIMP},
{DIMP, 0.0, DIMP},
{-DIMP, 0.0, DIMP}
};
static float qt[4][2] = {
{-DIMTP, -DIMTP},
{DIMTP, -DIMTP},
{DIMTP, DIMTP},
{-DIMTP, DIMTP}
};
static int win = 0;
static int np;
static float eject_r, dt, maxage, eject_vy, eject_vl;
static short shadows;
static float ridtri;
static int fog = 1;
static int help = 1;
static int joyavailable = 0;
static int joyactive = 0;
static part *p;
static GLuint groundid;
static GLuint treeid;
static float obs[3] = { 2.0, 1.0, 0.0 };
static float dir[3];
static float v = 0.0;
static float alpha = -90.0;
static float beta = 90.0;
static float
gettime(void)
{
static clock_t told = 0;
clock_t tnew, ris;
tnew = clock();
ris = tnew - told;
told = tnew;
return (ris / (float) CLOCKS_PER_SEC);
}
static float
vrnd(void)
{
return (((float) rand()) / RAND_MAX);
}
static void
setnewpart(part * p)
{
float a, v[3], *c;
p->age = 0;
a = vrnd() * 3.14159265359 * 2.0;
vinit(v, sin(a) * eject_r * vrnd(), 0.15, cos(a) * eject_r * vrnd());
vinit(p->p[0], v[0] + vrnd() * ridtri, v[1] + vrnd() * ridtri,
v[2] + vrnd() * ridtri);
vinit(p->p[1], v[0] + vrnd() * ridtri, v[1] + vrnd() * ridtri,
v[2] + vrnd() * ridtri);
vinit(p->p[2], v[0] + vrnd() * ridtri, v[1] + vrnd() * ridtri,
v[2] + vrnd() * ridtri);
vinit(p->v, v[0] * eject_vl / (eject_r / 2),
vrnd() * eject_vy + eject_vy / 2, v[2] * eject_vl / (eject_r / 2));
c = blu;
vinit4(p->c[0], c[0] * ((1.0 - RIDCOL) + vrnd() * RIDCOL),
c[1] * ((1.0 - RIDCOL) + vrnd() * RIDCOL),
c[2] * ((1.0 - RIDCOL) + vrnd() * RIDCOL), 1.0);
vinit4(p->c[1], c[0] * ((1.0 - RIDCOL) + vrnd() * RIDCOL),
c[1] * ((1.0 - RIDCOL) + vrnd() * RIDCOL),
c[2] * ((1.0 - RIDCOL) + vrnd() * RIDCOL), 1.0);
vinit4(p->c[2], c[0] * ((1.0 - RIDCOL) + vrnd() * RIDCOL),
c[1] * ((1.0 - RIDCOL) + vrnd() * RIDCOL),
c[2] * ((1.0 - RIDCOL) + vrnd() * RIDCOL), 1.0);
}
static void
setpart(part * p)
{
float fact;
if (p->p[0][1] < 0.1) {
setnewpart(p);
return;
}
p->v[1] += AGRAV * dt;
vadds(p->p[0], dt, p->v);
vadds(p->p[1], dt, p->v);
vadds(p->p[2], dt, p->v);
p->age++;
if ((p->age) > maxage) {
vequ(p->c[0], blu2);
vequ(p->c[1], blu2);
vequ(p->c[2], blu2);
}
else {
fact = 1.0 / maxage;
vadds(p->c[0], fact, blu2);
vclamp(p->c[0]);
p->c[0][3] = fact * (maxage - p->age);
vadds(p->c[1], fact, blu2);
vclamp(p->c[1]);
p->c[1][3] = fact * (maxage - p->age);
vadds(p->c[2], fact, blu2);
vclamp(p->c[2]);
p->c[2][3] = fact * (maxage - p->age);
}
}
static void
drawtree(float x, float y, float z)
{
glBegin(GL_QUADS);
glTexCoord2f(0.0, 0.0);
glVertex3f(x - 1.5, y + 0.0, z);
glTexCoord2f(1.0, 0.0);
glVertex3f(x + 1.5, y + 0.0, z);
glTexCoord2f(1.0, 1.0);
glVertex3f(x + 1.5, y + 3.0, z);
glTexCoord2f(0.0, 1.0);
glVertex3f(x - 1.5, y + 3.0, z);
glTexCoord2f(0.0, 0.0);
glVertex3f(x, y + 0.0, z - 1.5);
glTexCoord2f(1.0, 0.0);
glVertex3f(x, y + 0.0, z + 1.5);
glTexCoord2f(1.0, 1.0);
glVertex3f(x, y + 3.0, z + 1.5);
glTexCoord2f(0.0, 1.0);
glVertex3f(x, y + 3.0, z - 1.5);
glEnd();
}
static void
calcposobs(void)
{
dir[0] = sin(alpha * M_PI / 180.0);
dir[2] = cos(alpha * M_PI / 180.0) * sin(beta * M_PI / 180.0);
dir[1] = cos(beta * M_PI / 180.0);
obs[0] += v * dir[0];
obs[1] += v * dir[1];
obs[2] += v * dir[2];
}
static void
printstring(void *font, char *string)
{
int len, i;
len = (int) strlen(string);
for (i = 0; i < len; i++)
glutBitmapCharacter(font, string[i]);
}
static void
reshape(int width, int height)
{
WIDTH = width;
HEIGHT = height;
glViewport(0, 0, (GLint) width, (GLint) height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(70.0, width / (float) height, 0.1, 30.0);
glMatrixMode(GL_MODELVIEW);
}
static void
printhelp(void)
{
glColor4f(0.0, 0.0, 0.0, 0.5);
glRecti(40, 40, 600, 440);
glColor3f(1.0, 0.0, 0.0);
glRasterPos2i(300, 420);
printstring(GLUT_BITMAP_TIMES_ROMAN_24, "Help");
glRasterPos2i(60, 390);
printstring(GLUT_BITMAP_TIMES_ROMAN_24, "h - Togle Help");
glRasterPos2i(60, 360);
printstring(GLUT_BITMAP_TIMES_ROMAN_24, "t - Increase particle size");
glRasterPos2i(60, 330);
printstring(GLUT_BITMAP_TIMES_ROMAN_24, "T - Decrease particle size");
glRasterPos2i(60, 300);
printstring(GLUT_BITMAP_TIMES_ROMAN_24, "r - Increase emission radius");
glRasterPos2i(60, 270);
printstring(GLUT_BITMAP_TIMES_ROMAN_24, "R - Decrease emission radius");
glRasterPos2i(60, 240);
printstring(GLUT_BITMAP_TIMES_ROMAN_24, "f - Togle Fog");
glRasterPos2i(60, 210);
printstring(GLUT_BITMAP_TIMES_ROMAN_24, "s - Togle shadows");
glRasterPos2i(60, 180);
printstring(GLUT_BITMAP_TIMES_ROMAN_24, "Arrow Keys - Rotate");
glRasterPos2i(60, 150);
printstring(GLUT_BITMAP_TIMES_ROMAN_24, "a - Increase velocity");
glRasterPos2i(60, 120);
printstring(GLUT_BITMAP_TIMES_ROMAN_24, "z - Decrease velocity");
glRasterPos2i(60, 90);
if (joyavailable)
printstring(GLUT_BITMAP_TIMES_ROMAN_24,
"j - Togle jostick control (Joystick control available)");
else
printstring(GLUT_BITMAP_TIMES_ROMAN_24,
"(No Joystick control available)");
}
static void
dojoy(void)
{
#ifdef WIN32
static UINT max[2] = { 0, 0 };
static UINT min[2] = { 0xffffffff, 0xffffffff }, center[2];
MMRESULT res;
JOYINFO joy;
res = joyGetPos(JOYSTICKID1, &joy);
if (res == JOYERR_NOERROR) {
joyavailable = 1;
if (max[0] < joy.wXpos)
max[0] = joy.wXpos;
if (min[0] > joy.wXpos)
min[0] = joy.wXpos;
center[0] = (max[0] + min[0]) / 2;
if (max[1] < joy.wYpos)
max[1] = joy.wYpos;
if (min[1] > joy.wYpos)
min[1] = joy.wYpos;
center[1] = (max[1] + min[1]) / 2;
if (joyactive) {
if (fabs(center[0] - (float) joy.wXpos) > 0.1 * (max[0] - min[0]))
alpha +=
2.5 * (center[0] - (float) joy.wXpos) / (max[0] - min[0]);
if (fabs(center[1] - (float) joy.wYpos) > 0.1 * (max[1] - min[1]))
beta += 2.5 * (center[1] - (float) joy.wYpos) / (max[1] - min[1]);
if (joy.wButtons & JOY_BUTTON1)
v += 0.01;
if (joy.wButtons & JOY_BUTTON2)
v -= 0.01;
}
}
else
joyavailable = 0;
#endif
}
static void
drawfire(void)
{
static int count = 0;
static char frbuf[80];
int j;
float fr;
dojoy();
glEnable(GL_DEPTH_TEST);
if (fog)
glEnable(GL_FOG);
else
glDisable(GL_FOG);
glDepthMask(GL_TRUE);
glClearColor(1.0, 1.0, 1.0, 1.0);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glPushMatrix();
calcposobs();
gluLookAt(obs[0], obs[1], obs[2],
obs[0] + dir[0], obs[1] + dir[1], obs[2] + dir[2],
0.0, 1.0, 0.0);
glColor4f(1.0, 1.0, 1.0, 1.0);
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, groundid);
glBegin(GL_QUADS);
glTexCoord2fv(qt[0]);
glVertex3fv(q[0]);
glTexCoord2fv(qt[1]);
glVertex3fv(q[1]);
glTexCoord2fv(qt[2]);
glVertex3fv(q[2]);
glTexCoord2fv(qt[3]);
glVertex3fv(q[3]);
glEnd();
glEnable(GL_ALPHA_TEST);
glAlphaFunc(GL_GEQUAL, 0.9);
glBindTexture(GL_TEXTURE_2D, treeid);
for (j = 0; j < NUMTREE; j++)
drawtree(treepos[j][0], treepos[j][1], treepos[j][2]);
glDisable(GL_TEXTURE_2D);
glDepthMask(GL_FALSE);
glDisable(GL_ALPHA_TEST);
if (shadows) {
glBegin(GL_TRIANGLES);
for (j = 0; j < np; j++) {
glColor4f(black[0], black[1], black[2], p[j].c[0][3]);
glVertex3f(p[j].p[0][0], 0.1, p[j].p[0][2]);
glColor4f(black[0], black[1], black[2], p[j].c[1][3]);
glVertex3f(p[j].p[1][0], 0.1, p[j].p[1][2]);
glColor4f(black[0], black[1], black[2], p[j].c[2][3]);
glVertex3f(p[j].p[2][0], 0.1, p[j].p[2][2]);
}
glEnd();
}
glBegin(GL_TRIANGLES);
for (j = 0; j < np; j++) {
glColor4fv(p[j].c[0]);
glVertex3fv(p[j].p[0]);
glColor4fv(p[j].c[1]);
glVertex3fv(p[j].p[1]);
glColor4fv(p[j].c[2]);
glVertex3fv(p[j].p[2]);
setpart(&p[j]);
}
glEnd();
if ((count % FRAME) == 0) {
fr = gettime();
sprintf(frbuf, "Frame rate: %f", FRAME / fr);
}
glDisable(GL_TEXTURE_2D);
glDisable(GL_ALPHA_TEST);
glDisable(GL_DEPTH_TEST);
glDisable(GL_FOG);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(-0.5, 639.5, -0.5, 479.5, -1.0, 1.0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glColor3f(1.0, 0.0, 0.0);
glRasterPos2i(10, 10);
printstring(GLUT_BITMAP_HELVETICA_18, frbuf);
glRasterPos2i(370, 470);
printstring(GLUT_BITMAP_HELVETICA_10,
"Fire V1.5 Written by David Bucciarelli (tech.hmw@plus.it)");
if (help)
printhelp();
reshape(WIDTH, HEIGHT);
glPopMatrix();
glutSwapBuffers();
count++;
}
static void
special(int key, int x, int y)
{
switch (key) {
case GLUT_KEY_LEFT:
alpha += 2.0;
break;
case GLUT_KEY_RIGHT:
alpha -= 2.0;
break;
case GLUT_KEY_DOWN:
beta -= 2.0;
break;
case GLUT_KEY_UP:
beta += 2.0;
break;
}
}
static void
key(unsigned char key, int x, int y)
{
switch (key) {
case 27:
exit(0);
break;
case 'a':
v += 0.01;
break;
case 'z':
v -= 0.01;
break;
case 'j':
joyactive = (!joyactive);
break;
case 'h':
help = (!help);
break;
case 'f':
fog = (!fog);
break;
case 's':
shadows = !shadows;
break;
case 'R':
eject_r -= 0.03;
break;
case 'r':
eject_r += 0.03;
break;
case 't':
ridtri += 0.005;
break;
case 'T':
ridtri -= 0.005;
break;
#ifdef XMESA
case ' ':
XMesaSetFXmode(fullscreen ? XMESA_FX_FULLSCREEN : XMESA_FX_WINDOW);
fullscreen = (!fullscreen);
break;
#endif
}
}
static void
inittextures(void)
{
GLenum gluerr;
GLubyte tex[128][128][4];
glGenTextures(1, &groundid);
glBindTexture(GL_TEXTURE_2D, groundid);
glPixelStorei(GL_UNPACK_ALIGNMENT, 4);
if (!LoadRGBMipmaps("../images/s128.rgb", GL_RGB)) {
fprintf(stderr, "Error reading a texture.\n");
exit(-1);
}
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,
GL_LINEAR_MIPMAP_LINEAR);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL);
glGenTextures(1, &treeid);
glBindTexture(GL_TEXTURE_2D, treeid);
if (1)
{
int w, h;
GLenum format;
int x, y;
GLubyte *image = LoadRGBImage("../images/tree3.rgb", &w, &h, &format);
if (!image) {
fprintf(stderr, "Error reading a texture.\n");
exit(-1);
}
for (y = 0; y < 128; y++)
for (x = 0; x < 128; x++) {
tex[x][y][0] = image[(y + x * 128) * 3];
tex[x][y][1] = image[(y + x * 128) * 3 + 1];
tex[x][y][2] = image[(y + x * 128) * 3 + 2];
if ((tex[x][y][0] == tex[x][y][1]) &&
(tex[x][y][1] == tex[x][y][2]) && (tex[x][y][2] == 255))
tex[x][y][3] = 0;
else
tex[x][y][3] = 255;
}
if ((gluerr = gluBuild2DMipmaps(GL_TEXTURE_2D, 4, 128, 128, GL_RGBA,
GL_UNSIGNED_BYTE, (GLvoid *) (tex)))) {
fprintf(stderr, "GLULib%s\n", gluErrorString(gluerr));
exit(-1);
}
}
else {
if (!LoadRGBMipmaps("../images/tree2.rgba", GL_RGBA)) {
fprintf(stderr, "Error reading a texture.\n");
exit(-1);
}
}
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,
GL_LINEAR_MIPMAP_LINEAR);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
}
static void
inittree(void)
{
int i;
float dist;
for (i = 0; i < NUMTREE; i++)
do {
treepos[i][0] = vrnd() * TREEOUTR * 2.0 - TREEOUTR;
treepos[i][1] = 0.0;
treepos[i][2] = vrnd() * TREEOUTR * 2.0 - TREEOUTR;
dist =
sqrt(treepos[i][0] * treepos[i][0] +
treepos[i][2] * treepos[i][2]);
} while ((dist < TREEINR) || (dist > TREEOUTR));
}
int
main(int ac, char **av)
{
int i;
fprintf(stderr,
"Fire V1.5\nWritten by David Bucciarelli (tech.hmw@plus.it)\n");
/* Default settings */
WIDTH = 640;
HEIGHT = 480;
np = 800;
eject_r = 0.1;
dt = 0.015;
eject_vy = 4;
eject_vl = 1;
shadows = 1;
ridtri = 0.1;
maxage = 1.0 / dt;
if (ac == 2)
np = atoi(av[1]);
if (ac == 4) {
WIDTH = atoi(av[2]);
HEIGHT = atoi(av[3]);
}
glutInitWindowPosition(0, 0);
glutInitWindowSize(WIDTH, HEIGHT);
glutInit(&ac, av);
glutInitDisplayMode(GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE);
if (!(win = glutCreateWindow("Fire"))) {
fprintf(stderr, "Error opening a window.\n");
exit(-1);
}
reshape(WIDTH, HEIGHT);
inittextures();
glShadeModel(GL_FLAT);
glEnable(GL_DEPTH_TEST);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_FOG);
glFogi(GL_FOG_MODE, GL_EXP);
glFogfv(GL_FOG_COLOR, fogcolor);
glFogf(GL_FOG_DENSITY, 0.1);
#ifdef FX
glHint(GL_FOG_HINT, GL_NICEST);
#endif
p = malloc(sizeof(part) * np);
for (i = 0; i < np; i++)
setnewpart(&p[i]);
inittree();
glutKeyboardFunc(key);
glutSpecialFunc(special);
glutDisplayFunc(drawfire);
glutIdleFunc(drawfire);
glutReshapeFunc(reshape);
glutMainLoop();
return (0);
}

View File

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

View File

@@ -1,33 +1,24 @@
/* $Id: gears.c,v 1.1 1999/08/19 00:55:40 jtg Exp $ */
/* $Id: gears.c,v 1.6 2000/04/06 02:22:59 brianp Exp $ */
/*
* 3-D gear wheels. This program is in the public domain.
*
* Command line options:
* -info print GL implementation information
* -exit automatically exit after 30 seconds
*
*
* Brian Paul
*/
/* Conversion to GLUT by Mark J. Kilgard */
/*
* $Log: gears.c,v $
* Revision 1.1 1999/08/19 00:55:40 jtg
* Initial revision
*
* Revision 3.2 1999/06/03 17:07:36 brianp
* an extra quad was being drawn in front and back faces
*
* Revision 3.1 1998/11/03 02:49:10 brianp
* added fps output
*
* Revision 3.0 1998/02/14 18:42:29 brianp
* initial rev
*
*/
#include <math.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <GL/glut.h>
#ifndef M_PI
@@ -36,7 +27,7 @@
static GLint T0 = 0;
static GLint Frames = 0;
static GLint autoexit = 0;
/**
@@ -179,41 +170,44 @@ draw(void)
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glPushMatrix();
glRotatef(view_rotx, 1.0, 0.0, 0.0);
glRotatef(view_roty, 0.0, 1.0, 0.0);
glRotatef(view_rotz, 0.0, 0.0, 1.0);
glRotatef(view_rotx, 1.0, 0.0, 0.0);
glRotatef(view_roty, 0.0, 1.0, 0.0);
glRotatef(view_rotz, 0.0, 0.0, 1.0);
glPushMatrix();
glTranslatef(-3.0, -2.0, 0.0);
glRotatef(angle, 0.0, 0.0, 1.0);
glCallList(gear1);
glPopMatrix();
glPushMatrix();
glTranslatef(-3.0, -2.0, 0.0);
glRotatef(angle, 0.0, 0.0, 1.0);
glCallList(gear1);
glPopMatrix();
glPushMatrix();
glTranslatef(3.1, -2.0, 0.0);
glRotatef(-2.0 * angle - 9.0, 0.0, 0.0, 1.0);
glCallList(gear2);
glPopMatrix();
glPushMatrix();
glTranslatef(3.1, -2.0, 0.0);
glRotatef(-2.0 * angle - 9.0, 0.0, 0.0, 1.0);
glCallList(gear2);
glPopMatrix();
glPushMatrix();
glTranslatef(-3.1, 4.2, 0.0);
glRotatef(-2.0 * angle - 25.0, 0.0, 0.0, 1.0);
glCallList(gear3);
glPopMatrix();
glPushMatrix();
glTranslatef(-3.1, 4.2, 0.0);
glRotatef(-2.0 * angle - 25.0, 0.0, 0.0, 1.0);
glCallList(gear3);
glPopMatrix();
glPopMatrix();
glutSwapBuffers();
Frames++;
{
GLint t = glutGet(GLUT_ELAPSED_TIME);
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);
printf("%d frames in %6.3f seconds = %6.3f FPS\n", Frames, seconds, fps);
T0 = t;
Frames = 0;
if ((t >= 999.0 * autoexit) && (autoexit))
exit(0);
}
}
}
@@ -287,16 +281,13 @@ 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};
static GLfloat red[4] =
{0.8, 0.1, 0.0, 1.0};
static GLfloat green[4] =
{0.0, 0.8, 0.2, 1.0};
static GLfloat blue[4] =
{0.2, 0.2, 1.0, 1.0};
static GLfloat pos[4] = {5.0, 5.0, 10.0, 0.0};
static GLfloat red[4] = {0.8, 0.1, 0.0, 1.0};
static GLfloat green[4] = {0.0, 0.8, 0.2, 1.0};
static GLfloat blue[4] = {0.2, 0.2, 1.0, 1.0};
GLint i;
glLightfv(GL_LIGHT0, GL_POSITION, pos);
glEnable(GL_CULL_FACE);
@@ -324,9 +315,22 @@ init(void)
glEndList();
glEnable(GL_NORMALIZE);
for ( i=1; i<argc; i++ ) {
if (strcmp(argv[i], "-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));
}
else if ( strcmp(argv[i], "-exit")==0) {
autoexit = 30;
printf("Auto Exit after %i seconds.\n", autoexit );
}
}
}
void
static void
visible(int vis)
{
if (vis == GLUT_VISIBLE)
@@ -343,7 +347,7 @@ int main(int argc, char *argv[])
glutInitWindowPosition(0, 0);
glutInitWindowSize(300, 300);
glutCreateWindow("Gears");
init();
init(argc, argv);
glutDisplayFunc(draw);
glutReshapeFunc(reshape);

1052
progs/demos/geartrain.c Normal file

File diff suppressed because it is too large Load Diff

119
progs/demos/geartrain.dat Normal file
View File

@@ -0,0 +1,119 @@
BACKGROUND = 0.000 0.500 0.700
ANAME = AXLE1
ARADIUS = 1.000
AAXIS = 2
APOSITION = -7.000 0.000 0.000
ACOLOR = 0.800 0.500 0.200
ALENGTH = 6.000
AMOTORED = 1
AANGULARVELOCITY = 2.000
ADIRECTION = 1
ANAME = AXLE2
ARADIUS = 1.000
AAXIS = 2
APOSITION = -3.000 0.000 0.000
ACOLOR = 0.800 0.500 0.200
ALENGTH = 12.000
AMOTORED = 0
ANAME = AXLE3
ARADIUS = 1.000
AAXIS = 2
APOSITION = 1.000 0.000 0.000
ACOLOR = 0.800 0.500 0.200
ALENGTH = 6.000
AMOTORED = 0
ANAME = AXLE4
ARADIUS = 1.000
AAXIS = 2
APOSITION = 8.000 0.000 0.000
ACOLOR = 0.800 0.500 0.200
ALENGTH = 18.000
AMOTORED = 0
ANAME = AXLE5
ARADIUS = 1.000
AAXIS = 1
APOSITION = 8.000 -8.200 -7.400
ACOLOR = 0.800 0.500 0.200
ALENGTH = 12.000
AMOTORED = 0
GNAME = GEAR1
GTYPE = NORMAL
GRADIUS = 2.200
GWIDTH = 3.000
GTEETH = 40
GTOOTHDEPTH = 0.500
GCOLOR = 0.500 0.500 0.500
GAXLE = AXLE1
GPOSITION = 0.000
GNAME = GEAR2
GTYPE = NORMAL
GRADIUS = 2.200
GWIDTH = 3.000
GTEETH = 30
GTOOTHDEPTH = 0.500
GCOLOR = 0.500 0.500 0.500
GAXLE = AXLE2
GPOSITION = 0.000
GNAME = GEAR3
GTYPE = NORMAL
GRADIUS = 2.200
GWIDTH = 3.000
GTEETH = 20
GTOOTHDEPTH = 0.500
GCOLOR = 0.500 0.500 0.500
GAXLE = AXLE3
GPOSITION = 0.000
GNAME = GEAR4
GTYPE = NORMAL
GRADIUS = 1.700
GWIDTH = 1.000
GTEETH = 20
GTOOTHDEPTH = 0.500
GCOLOR = 0.500 0.500 0.500
GAXLE = AXLE2
GPOSITION = 5.000
GNAME = GEAR5
GTYPE = NORMAL
GRADIUS = 3.000
GWIDTH = 1.000
GTEETH = 20
GTOOTHDEPTH = 0.500
GCOLOR = 0.500 0.500 0.500
GAXLE = AXLE4
GPOSITION = 5.000
GNAME = GEAR6
GTYPE = BEVEL
GFACE = 0
GRADIUS = 4.000
GWIDTH = 1.000
GTEETH = 20
GTOOTHDEPTH = 1.700
GCOLOR = 0.500 0.500 0.500
GAXLE = AXLE4
GPOSITION = -4.000
GNAME = GEAR7
GTYPE = BEVEL
GFACE = 0
GRADIUS = 4.000
GWIDTH = 1.000
GTEETH = 20
GTOOTHDEPTH = 1.700
GCOLOR = 0.500 0.500 0.500
GAXLE = AXLE5
GPOSITION = 5.000
BELTNAME = BELT1
GEAR1NAME = GEAR5
GEAR2NAME = GEAR4

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

@@ -0,0 +1,379 @@
/* $Id: gloss.c,v 1.4.4.1 2000/08/29 21:17:25 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 = 6;
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);
#if 1
glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP);
glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP);
#else
glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_NORMAL_MAP_NV);
glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_NORMAL_MAP_NV);
glTexGeni(GL_R, GL_TEXTURE_GEN_MODE, GL_NORMAL_MAP_NV);
#endif
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;
}

580
progs/demos/gltestperf.c Normal file
View File

@@ -0,0 +1,580 @@
/*
* This program is under the GNU GPL.
* Use at your own risk.
*
* written by David Bucciarelli (tech.hmw@plus.it)
* Humanware s.r.l.
*/
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <GL/glut.h>
typedef struct
{
char *name;
char *unit;
void (*init) (void);
int (*run) (int, int);
int type;
int numsize;
int size[10];
}
benchmark;
static int frontbuffer = 1;
/***************************************************************************/
static void
init_test01(void)
{
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluOrtho2D(-0.5, 639.5, -0.5, 479.5);
glMatrixMode(GL_MODELVIEW);
glShadeModel(GL_FLAT);
glDisable(GL_DEPTH_TEST);
glClearColor(0.0, 0.1, 1.0, 0.0);
glClear(GL_COLOR_BUFFER_BIT);
glColor3f(1.0, 0.0, 0.0);
}
static int
test01(int size, int num)
{
int x, y;
glBegin(GL_POINTS);
for (y = 0; y < num; y++)
for (x = 0; x < 480; x++)
glVertex2i(x, x);
glEnd();
return 480 * num;
}
/***************************************************************************/
static void
init_test02(void)
{
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluOrtho2D(-0.5, 639.5, -0.5, 479.5);
glMatrixMode(GL_MODELVIEW);
glShadeModel(GL_SMOOTH);
glDisable(GL_DEPTH_TEST);
glClearColor(0.0, 0.1, 1.0, 0.0);
glClear(GL_COLOR_BUFFER_BIT);
}
static int
test02(int size, int num)
{
int x, y;
glBegin(GL_LINES);
for (y = 0; y < num; y++)
for (x = 0; x < size; x++) {
glColor3f(0.0, 1.0, y / (float) num);
glVertex2i(0, size - 1);
glColor3f(1.0, 0.0, x / (float) size);
glVertex2i(x, x);
}
glEnd();
return num * size;
}
/***************************************************************************/
static void
init_test03(void)
{
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(-0.5, 639.5, -0.5, 479.5, 1.0, -1000.0 * 480.0);
glMatrixMode(GL_MODELVIEW);
glShadeModel(GL_SMOOTH);
glEnable(GL_DEPTH_TEST);
glClearColor(0.0, 0.1, 1.0, 0.0);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
}
static int
test03(int size, int num)
{
int x, y, z;
glBegin(GL_TRIANGLES);
for (y = 0; y < num; y++)
for (x = 0; x < size; x += 5) {
z = num * size - (y * size + x);
glColor3f(0.0, 1.0, 0.0);
glVertex3i(0, x, z);
glColor3f(1.0, 0.0, x / (float) size);
glVertex3i(size - 1 - x, 0, z);
glColor3f(1.0, x / (float) size, 0.0);
glVertex3i(x, size - 1 - x, z);
}
glEnd();
return size * num / 5;
}
/***************************************************************************/
static void
init_test04(void)
{
int x, y;
GLubyte tex[128 * 128 * 3];
GLenum gluerr;
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(-0.5, 639.5, -0.5, 479.5, 1.0, -1000.0 * 480.0);
glMatrixMode(GL_MODELVIEW);
glShadeModel(GL_SMOOTH);
glEnable(GL_DEPTH_TEST);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
for (y = 0; y < 128; y++)
for (x = 0; x < 128; x++) {
tex[(x + y * 128) * 3 + 0] = ((x % (128 / 4)) < (128 / 8)) ? 255 : 0;
tex[(x + y * 128) * 3 + 1] = ((y % (128 / 4)) < (128 / 8)) ? 255 : 0;
tex[(x + y * 128) * 3 + 2] = x;
}
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
if ((gluerr = gluBuild2DMipmaps(GL_TEXTURE_2D, 3, 128, 128, GL_RGB,
GL_UNSIGNED_BYTE, (GLvoid *) (&tex[0])))) {
fprintf(stderr, "GLULib%s\n", gluErrorString(gluerr));
exit(-1);
}
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,
GL_LINEAR_MIPMAP_NEAREST);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
glEnable(GL_TEXTURE_2D);
glClearColor(0.0, 0.1, 1.0, 0.0);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
}
static int
test04(int size, int num)
{
int x, y, z;
glBegin(GL_TRIANGLES);
for (y = 0; y < num; y++)
for (x = 0; x < size; x += 5) {
z = num * size - (y * size + x);
glTexCoord2f(1.0, 1.0);
glColor3f(1.0, 0.0, 0.0);
glVertex3i(0, x, z);
glTexCoord2f(0.0, 1.0);
glColor3f(0.0, 1.0, 0.0);
glVertex3i(size - 1 - x, 0, z);
glTexCoord2f(1.0, 0.0);
glColor3f(0.0, 0.0, 1.0);
glVertex3i(x, size - 1 - x, z);
}
glEnd();
return num * size / 5;
}
/***************************************************************************/
static void
init_test05(void)
{
int x, y;
GLubyte tex[128 * 128 * 3];
GLenum gluerr;
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(-0.5, 639.5, -0.5, 479.5, -1.0, 1.0);
glMatrixMode(GL_MODELVIEW);
glShadeModel(GL_SMOOTH);
glEnable(GL_DEPTH_TEST);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
for (y = 0; y < 128; y++)
for (x = 0; x < 128; x++) {
tex[(x + y * 128) * 3 + 0] = ((x % (128 / 4)) < (128 / 8)) ? 255 : 0;
tex[(x + y * 128) * 3 + 1] = ((y % (128 / 4)) < (128 / 8)) ? 255 : 0;
tex[(x + y * 128) * 3 + 2] = x;
}
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
if ((gluerr = gluBuild2DMipmaps(GL_TEXTURE_2D, 3, 128, 128, GL_RGB,
GL_UNSIGNED_BYTE, (GLvoid *) (&tex[0])))) {
fprintf(stderr, "GLULib%s\n", gluErrorString(gluerr));
exit(-1);
}
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,
GL_LINEAR_MIPMAP_NEAREST);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
glEnable(GL_TEXTURE_2D);
glDepthFunc(GL_ALWAYS);
glClearColor(0.0, 0.1, 1.0, 0.0);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
}
static int
test05(int size, int num)
{
int y;
float v0[3], v1[3], v2[3], v3[3];
float cv0[3], cv1[3], cv2[3], cv3[3];
float tv0[3], tv1[3], tv2[3], tv3[3];
v0[0] = 320 - size / 2;
v0[1] = 240 - size / 2;
v0[2] = 0.0;
v1[0] = 320 + size / 2;
v1[1] = 240 - size / 2;
v1[2] = 0.0;
v2[0] = 320 - size / 2;
v2[1] = 240 + size / 2;
v2[2] = 0.0;
v3[0] = 320 + size / 2;
v3[1] = 240 + size / 2;
v3[2] = 0.0;
cv0[0] = 1.0;
cv0[1] = 0.0;
cv0[2] = 0.0;
cv1[0] = 1.0;
cv1[1] = 1.0;
cv1[2] = 0.0;
cv2[0] = 1.0;
cv2[1] = 0.0;
cv2[2] = 1.0;
cv3[0] = 1.0;
cv3[1] = 1.0;
cv3[2] = 1.0;
tv0[0] = 0.0;
tv0[1] = 0.0;
tv0[2] = 0.0;
tv1[0] = 1.0;
tv1[1] = 0.0;
tv1[2] = 0.0;
tv2[0] = 0.0;
tv2[1] = 1.0;
tv2[2] = 0.0;
tv3[0] = 1.0;
tv3[1] = 1.0;
tv3[2] = 0.0;
glBegin(GL_TRIANGLE_STRIP);
for (y = 0; y < num; y++) {
glColor3fv(cv0);
glTexCoord2fv(tv0);
glVertex3fv(v0);
glColor3fv(cv1);
glTexCoord2fv(tv1);
glVertex3fv(v1);
glColor3fv(cv2);
glTexCoord2fv(tv2);
glVertex3fv(v2);
glColor3fv(cv3);
glTexCoord2fv(tv3);
glVertex3fv(v3);
}
glEnd();
return 4 * num - 2;
}
/***************************************************************************/
static void
init_test06(void)
{
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluOrtho2D(-0.5, 639.5, -0.5, 479.5);
glMatrixMode(GL_MODELVIEW);
glShadeModel(GL_SMOOTH);
glEnable(GL_DEPTH_TEST);
glClearColor(0.0, 0.1, 1.0, 0.0);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
}
static int
test06(int size, int num)
{
int y;
for (y = 0; y < num; y++) {
glClearColor(y / (float) num, 0.1, 1.0, 0.0);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
}
return num;
}
/***************************************************************************/
#define BMARKS_TIME 5.0
#define NUM_BMARKS 6
/* 554 ~= sqrt(640*480) */
static benchmark bmarks[NUM_BMARKS] = {
{"Simple Points", "Pnts", init_test01, test01, 0, 0,
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0}},
{"Smooth Lines", "Lins", init_test02, test02, 1, 5,
{480, 250, 100, 50, 25, 0, 0, 0, 0, 0}},
{"ZSmooth Triangles", "Tris", init_test03, test03, 1, 5,
{480, 250, 100, 50, 25, 0, 0, 0, 0, 0}},
{"ZSmooth Tex Blend Triangles", "Tris", init_test04, test04, 1, 5,
{480, 250, 100, 50, 25, 0, 0, 0, 0, 0}},
{"ZSmooth Tex Blend TMesh Triangles", "Tris", init_test05, test05, 2, 8,
{400, 250, 100, 50, 25, 10, 5, 2, 0, 0}},
{"Color/Depth Buffer Clears", "Clrs", init_test06, test06, 3, 0,
{554, 0, 0, 0, 0, 0, 0, 0, 0, 0}}
};
/***************************************************************************/
static void
dotest0param(benchmark * bmark)
{
float stime, etime, dtime, tottime, maxtime, mintime;
int num, numelem, calibnum, j;
glPushAttrib(GL_ALL_ATTRIB_BITS);
bmark->init();
stime = glutGet(GLUT_ELAPSED_TIME);
dtime = 0.0;
calibnum = 0;
while (dtime < 2.0) {
bmark->run(0, 1);
glFinish();
etime = glutGet(GLUT_ELAPSED_TIME);
dtime = (etime - stime) / 1000.0;
calibnum++;
}
glPopAttrib();
fprintf(stderr, "Elapsed time for the calibration test (%d): %f\n",
calibnum, dtime);
num = (int) ((BMARKS_TIME / dtime) * calibnum);
if (num < 1)
num = 1;
fprintf(stderr, "Selected number of benchmark iterations: %d\n", num);
mintime = HUGE_VAL;
maxtime = -HUGE_VAL;
for (tottime = 0.0, j = 0; j < 5; j++) {
glPushAttrib(GL_ALL_ATTRIB_BITS);
bmark->init();
stime = glutGet(GLUT_ELAPSED_TIME);
numelem = bmark->run(0, num);
glFinish();
etime = glutGet(GLUT_ELAPSED_TIME);
glPopAttrib();
dtime = (etime - stime) / 1000.0;
tottime += dtime;
fprintf(stderr, "Elapsed time for run %d: %f\n", j, dtime);
if (dtime < mintime)
mintime = dtime;
if (dtime > maxtime)
maxtime = dtime;
}
tottime -= mintime + maxtime;
fprintf(stdout, "%s\n%f %s/sec", bmark->name, numelem / (tottime / 3.0),
bmark->unit);
if (bmark->type == 3)
fprintf(stdout, ", MPixel Fill/sec: %f\n\n",
(numelem * bmark->size[0] * (float) bmark->size[0]) /
(1000000.0 * tottime / 3.0));
else
fprintf(stdout, "\n\n");
}
/***************************************************************************/
static void
dotest1param(benchmark * bmark)
{
float stime, etime, dtime, tottime, maxtime, mintime;
int num, numelem, calibnum, j, k;
fprintf(stdout, "%s\n", bmark->name);
for (j = 0; j < bmark->numsize; j++) {
fprintf(stderr, "Current size: %d\n", bmark->size[j]);
glPushAttrib(GL_ALL_ATTRIB_BITS);
bmark->init();
stime = glutGet(GLUT_ELAPSED_TIME);
dtime = 0.0;
calibnum = 0;
while (dtime < 2.0) {
bmark->run(bmark->size[j], 1);
glFinish();
etime = glutGet(GLUT_ELAPSED_TIME);
dtime = (etime - stime) / 1000.0;
calibnum++;
}
glPopAttrib();
fprintf(stderr, "Elapsed time for the calibration test (%d): %f\n",
calibnum, dtime);
num = (int) ((BMARKS_TIME / dtime) * calibnum);
if (num < 1)
num = 1;
fprintf(stderr, "Selected number of benchmark iterations: %d\n", num);
mintime = HUGE_VAL;
maxtime = -HUGE_VAL;
for (numelem = 1, tottime = 0.0, k = 0; k < 5; k++) {
glPushAttrib(GL_ALL_ATTRIB_BITS);
bmark->init();
stime = glutGet(GLUT_ELAPSED_TIME);
numelem = bmark->run(bmark->size[j], num);
glFinish();
etime = glutGet(GLUT_ELAPSED_TIME);
glPopAttrib();
dtime = (etime - stime) / 1000.0;
tottime += dtime;
fprintf(stderr, "Elapsed time for run %d: %f\n", k, dtime);
if (dtime < mintime)
mintime = dtime;
if (dtime > maxtime)
maxtime = dtime;
}
tottime -= mintime + maxtime;
fprintf(stdout, "SIZE=%03d => %f %s/sec", bmark->size[j],
numelem / (tottime / 3.0), bmark->unit);
if (bmark->type == 2)
fprintf(stdout, ", MPixel Fill/sec: %f\n",
(numelem * bmark->size[j] * bmark->size[j] / 2) /
(1000000.0 * tottime / 3.0));
else
fprintf(stdout, "\n");
}
fprintf(stdout, "\n\n");
}
/***************************************************************************/
static void
display(void)
{
int i;
if (frontbuffer)
glDrawBuffer(GL_FRONT);
else
glDrawBuffer(GL_BACK);
for (i = 0; i < NUM_BMARKS; i++) {
fprintf(stderr, "Benchmark: %d\n", i);
switch (bmarks[i].type) {
case 0:
case 3:
dotest0param(&bmarks[i]);
break;
case 1:
case 2:
dotest1param(&bmarks[i]);
break;
}
}
exit(0);
}
int
main(int ac, char **av)
{
fprintf(stderr, "GLTest v1.0\nWritten by David Bucciarelli\n");
if (ac == 2)
frontbuffer = 0;
glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);
glutInitWindowPosition(0, 0);
glutInitWindowSize(640, 480);
glutCreateWindow("OpenGL/Mesa Performances");
glutDisplayFunc(display);
glutMainLoop();
return 0;
}

View File

@@ -1,4 +1,4 @@
/* $Id: glutfx.c,v 1.1 1999/08/19 00:55:40 jtg Exp $ */
/* $Id: glutfx.c,v 1.2 2000/06/27 17:04:43 brianp Exp $ */
/*
* Example of how one might use GLUT with the 3Dfx driver in full-screen mode.
@@ -16,8 +16,11 @@
/*
* $Log: glutfx.c,v $
* Revision 1.1 1999/08/19 00:55:40 jtg
* Initial revision
* Revision 1.2 2000/06/27 17:04:43 brianp
* fixed compiler warnings
*
* Revision 1.1.1.1 1999/08/19 00:55:40 jtg
* Imported sources
*
* Revision 3.2 1999/03/28 18:18:33 brianp
* minor clean-up
@@ -164,7 +167,6 @@ int main( int argc, char *argv[] )
printf("NOTE: if you've got 3Dfx VooDoo hardware you must run this");
printf(" program as root.\n\n");
printf("Move the mouse. Press ESC to exit.\n\n");
sleep(2);
#endif
/* Tell Mesa GLX to use 3Dfx driver in fullscreen mode. */

704
progs/demos/ipers.c Normal file
View File

@@ -0,0 +1,704 @@
/*
* This program is under the GNU GPL.
* Use at your own risk.
*
* written by David Bucciarelli (tech.hmw@plus.it)
* Humanware s.r.l.
*/
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <time.h>
#ifdef WIN32
#include <windows.h>
#include <mmsystem.h>
#endif
#include <GL/glut.h>
#include "../util/readtex.c"
#ifdef XMESA
#include "GL/xmesa.h"
static int fullscreen = 1;
#endif
static int WIDTH = 640;
static int HEIGHT = 480;
#define MAX_LOD 9
#define TEX_SKY_WIDTH 256
#define TEX_SKY_HEIGHT TEX_SKY_WIDTH
#ifndef M_PI
#define M_PI 3.1415926535
#endif
#define FROM_NONE 0
#define FROM_DOWN 1
#define FROM_UP 2
#define FROM_LEFT 3
#define FROM_RIGHT 4
#define FROM_FRONT 5
#define FROM_BACK 6
static int win = 0;
static float obs[3] = { 3.8, 0.0, 0.0 };
static float dir[3];
static float v = 0.0;
static float alpha = -90.0;
static float beta = 90.0;
static int fog = 1;
static int bfcull = 1;
static int usetex = 1;
static int help = 1;
static int poutline = 0;
static int normext = 1;
static int joyavailable = 0;
static int joyactive = 0;
static int LODbias = 3;
static int maxdepth = MAX_LOD;
static unsigned int totpoly = 0;
static GLuint t1id, t2id;
static GLuint skydlist, LODdlist[MAX_LOD], LODnumpoly[MAX_LOD];
static void
initlight(void)
{
GLfloat lspec[4] = { 1.0, 1.0, 1.0, 1.0 };
static GLfloat lightpos[4] = { 30, 15.0, 30.0, 1.0 };
glLightfv(GL_LIGHT0, GL_POSITION, lightpos);
glLightfv(GL_LIGHT0, GL_SPECULAR, lspec);
glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, 32.0);
glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, lspec);
}
static void
initdlists(void)
{
static int slicetable[MAX_LOD][2] = {
{21, 10},
{18, 9},
{15, 8},
{12, 7},
{9, 6},
{7, 5},
{5, 4},
{4, 3},
{3, 2}
};
GLUquadricObj *obj;
int i, xslices, yslices;
obj = gluNewQuadric();
skydlist = glGenLists(1);
glNewList(skydlist, GL_COMPILE);
glBindTexture(GL_TEXTURE_2D, t2id);
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
glColor3f(1.0f, 1.0f, 1.0f);
gluQuadricDrawStyle(obj, GLU_FILL);
gluQuadricNormals(obj, GLU_NONE);
gluQuadricTexture(obj, GL_TRUE);
gluQuadricOrientation(obj, GLU_INSIDE);
gluSphere(obj, 40.0f, 18, 9);
glEndList();
for (i = 0; i < MAX_LOD; i++) {
LODdlist[i] = glGenLists(1);
glNewList(LODdlist[i], GL_COMPILE);
gluQuadricDrawStyle(obj, GLU_FILL);
gluQuadricNormals(obj, GLU_SMOOTH);
gluQuadricTexture(obj, GL_TRUE);
gluQuadricOrientation(obj, GLU_OUTSIDE);
xslices = slicetable[i][0];
yslices = slicetable[i][1];
gluSphere(obj, 1.0f, xslices, yslices);
LODnumpoly[i] = xslices * (yslices - 2) + 2 * (xslices - 1);
glEndList();
}
}
static void
inittextures(void)
{
GLubyte tsky[TEX_SKY_HEIGHT][TEX_SKY_WIDTH][3];
GLuint x, y;
GLfloat fact;
GLenum gluerr;
/* Brick */
glGenTextures(1, &t1id);
glBindTexture(GL_TEXTURE_2D, t1id);
if (!LoadRGBMipmaps("../images/bw.rgb", 3)) {
fprintf(stderr, "Error reading a texture.\n");
exit(-1);
}
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,
GL_LINEAR_MIPMAP_LINEAR);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
/* Sky */
glGenTextures(1, &t2id);
glBindTexture(GL_TEXTURE_2D, t2id);
for (y = 0; y < TEX_SKY_HEIGHT; y++)
for (x = 0; x < TEX_SKY_WIDTH; x++)
if (y < TEX_SKY_HEIGHT / 2) {
fact = y / (GLfloat) (TEX_SKY_HEIGHT / 2);
tsky[y][x][0] =
(GLubyte) (255.0f * (0.1f * fact + 0.3f * (1.0f - fact)));
tsky[y][x][1] =
(GLubyte) (255.0f * (0.2f * fact + 1.0f * (1.0f - fact)));
tsky[y][x][2] = 255;
}
else {
tsky[y][x][0] = tsky[TEX_SKY_HEIGHT - y - 1][x][0];
tsky[y][x][1] = tsky[TEX_SKY_HEIGHT - y - 1][x][1];
tsky[y][x][2] = 255;
}
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
if (
(gluerr =
gluBuild2DMipmaps(GL_TEXTURE_2D, 3, TEX_SKY_WIDTH, TEX_SKY_HEIGHT,
GL_RGB, GL_UNSIGNED_BYTE, (GLvoid *) (tsky)))) {
fprintf(stderr, "GLULib%s\n", gluErrorString(gluerr));
exit(-1);
}
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,
GL_LINEAR_MIPMAP_LINEAR);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
}
static float
gettime(void)
{
static clock_t told = 0;
clock_t tnew, ris;
tnew = clock();
ris = tnew - told;
told = tnew;
return (ris / (float) CLOCKS_PER_SEC);
}
static void
calcposobs(void)
{
dir[0] = sin(alpha * M_PI / 180.0);
dir[1] = cos(alpha * M_PI / 180.0) * sin(beta * M_PI / 180.0);
dir[2] = cos(beta * M_PI / 180.0);
obs[0] += v * dir[0];
obs[1] += v * dir[1];
obs[2] += v * dir[2];
}
static void
special(int k, int x, int y)
{
switch (k) {
case GLUT_KEY_LEFT:
alpha -= 2.0;
break;
case GLUT_KEY_RIGHT:
alpha += 2.0;
break;
case GLUT_KEY_DOWN:
beta -= 2.0;
break;
case GLUT_KEY_UP:
beta += 2.0;
break;
}
}
static void
key(unsigned char k, int x, int y)
{
switch (k) {
case 27:
exit(0);
break;
case 'a':
v += 0.01;
break;
case 'z':
v -= 0.01;
break;
#ifdef XMESA
case ' ':
fullscreen = (!fullscreen);
XMesaSetFXmode(fullscreen ? XMESA_FX_FULLSCREEN : XMESA_FX_WINDOW);
break;
#endif
case '+':
LODbias--;
break;
case '-':
LODbias++;
break;
case 'j':
joyactive = (!joyactive);
break;
case 'h':
help = (!help);
break;
case 'f':
fog = (!fog);
break;
case 't':
usetex = (!usetex);
break;
case 'n':
normext = (!normext);
break;
case 'b':
if (bfcull) {
glDisable(GL_CULL_FACE);
bfcull = 0;
}
else {
glEnable(GL_CULL_FACE);
bfcull = 1;
}
break;
case 'p':
if (poutline) {
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
poutline = 0;
usetex = 1;
}
else {
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
poutline = 1;
usetex = 0;
}
break;
}
}
static void
reshape(int w, int h)
{
WIDTH = w;
HEIGHT = h;
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(90.0, w / (float) h, 0.8, 100.0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glViewport(0, 0, w, h);
}
static void
printstring(void *font, char *string)
{
int len, i;
len = (int) strlen(string);
for (i = 0; i < len; i++)
glutBitmapCharacter(font, string[i]);
}
static void
printhelp(void)
{
glEnable(GL_BLEND);
glColor4f(0.5, 0.5, 0.5, 0.5);
glRecti(40, 40, 600, 440);
glDisable(GL_BLEND);
glColor3f(1.0, 0.0, 0.0);
glRasterPos2i(300, 420);
printstring(GLUT_BITMAP_TIMES_ROMAN_24, "Help");
glRasterPos2i(60, 390);
printstring(GLUT_BITMAP_TIMES_ROMAN_24, "h - Toggle Help");
glRasterPos2i(60, 360);
printstring(GLUT_BITMAP_TIMES_ROMAN_24, "t - Toggle Textures");
glRasterPos2i(60, 330);
printstring(GLUT_BITMAP_TIMES_ROMAN_24, "f - Toggle Fog");
glRasterPos2i(60, 300);
printstring(GLUT_BITMAP_TIMES_ROMAN_24, "b - Toggle Back face culling");
glRasterPos2i(60, 270);
printstring(GLUT_BITMAP_TIMES_ROMAN_24, "Arrow Keys - Rotate");
glRasterPos2i(60, 240);
printstring(GLUT_BITMAP_TIMES_ROMAN_24, "a - Increase velocity");
glRasterPos2i(60, 210);
printstring(GLUT_BITMAP_TIMES_ROMAN_24, "z - Decrease velocity");
glRasterPos2i(60, 180);
printstring(GLUT_BITMAP_TIMES_ROMAN_24, "p - Toggle Wire frame");
glRasterPos2i(60, 150);
printstring(GLUT_BITMAP_TIMES_ROMAN_24,
"b - Toggle GL_EXT_rescale_normal extension");
glRasterPos2i(60, 120);
printstring(GLUT_BITMAP_TIMES_ROMAN_24,
"+/- - Increase/decrease the Object maximum LOD");
glRasterPos2i(60, 90);
if (joyavailable)
printstring(GLUT_BITMAP_TIMES_ROMAN_24,
"j - Toggle jostick control (Joystick control available)");
else
printstring(GLUT_BITMAP_TIMES_ROMAN_24,
"(No Joystick control available)");
}
static void
dojoy(void)
{
#ifdef _WIN32
static UINT max[2] = { 0, 0 };
static UINT min[2] = { 0xffffffff, 0xffffffff }, center[2];
MMRESULT res;
JOYINFO joy;
res = joyGetPos(JOYSTICKID1, &joy);
if (res == JOYERR_NOERROR) {
joyavailable = 1;
if (max[0] < joy.wXpos)
max[0] = joy.wXpos;
if (min[0] > joy.wXpos)
min[0] = joy.wXpos;
center[0] = (max[0] + min[0]) / 2;
if (max[1] < joy.wYpos)
max[1] = joy.wYpos;
if (min[1] > joy.wYpos)
min[1] = joy.wYpos;
center[1] = (max[1] + min[1]) / 2;
if (joyactive) {
if (fabs(center[0] - (float) joy.wXpos) > 0.1 * (max[0] - min[0]))
alpha -=
2.0 * (center[0] - (float) joy.wXpos) / (max[0] - min[0]);
if (fabs(center[1] - (float) joy.wYpos) > 0.1 * (max[1] - min[1]))
beta += 2.0 * (center[1] - (float) joy.wYpos) / (max[1] - min[1]);
if (joy.wButtons & JOY_BUTTON1)
v += 0.01;
if (joy.wButtons & JOY_BUTTON2)
v -= 0.01;
}
}
else
joyavailable = 0;
#endif
}
static void
drawipers(int depth, int from)
{
int lod;
if (depth == maxdepth)
return;
lod = depth + LODbias;
if (lod < 0)
lod = 0;
if (lod >= MAX_LOD)
return;
switch (from) {
case FROM_NONE:
glCallList(LODdlist[lod]);
depth++;
drawipers(depth, FROM_DOWN);
drawipers(depth, FROM_UP);
drawipers(depth, FROM_FRONT);
drawipers(depth, FROM_BACK);
drawipers(depth, FROM_LEFT);
drawipers(depth, FROM_RIGHT);
break;
case FROM_FRONT:
glPushMatrix();
glTranslatef(0.0f, -1.5f, 0.0f);
glScalef(0.5f, 0.5f, 0.5f);
glCallList(LODdlist[lod]);
depth++;
drawipers(depth, FROM_DOWN);
drawipers(depth, FROM_UP);
drawipers(depth, FROM_FRONT);
drawipers(depth, FROM_LEFT);
drawipers(depth, FROM_RIGHT);
glPopMatrix();
break;
case FROM_BACK:
glPushMatrix();
glTranslatef(0.0f, 1.5f, 0.0f);
glScalef(0.5f, 0.5f, 0.5f);
glCallList(LODdlist[lod]);
depth++;
drawipers(depth, FROM_DOWN);
drawipers(depth, FROM_UP);
drawipers(depth, FROM_BACK);
drawipers(depth, FROM_LEFT);
drawipers(depth, FROM_RIGHT);
glPopMatrix();
break;
case FROM_LEFT:
glPushMatrix();
glTranslatef(-1.5f, 0.0f, 0.0f);
glScalef(0.5f, 0.5f, 0.5f);
glCallList(LODdlist[lod]);
depth++;
drawipers(depth, FROM_DOWN);
drawipers(depth, FROM_UP);
drawipers(depth, FROM_FRONT);
drawipers(depth, FROM_BACK);
drawipers(depth, FROM_LEFT);
glPopMatrix();
break;
case FROM_RIGHT:
glPushMatrix();
glTranslatef(1.5f, 0.0f, 0.0f);
glScalef(0.5f, 0.5f, 0.5f);
glCallList(LODdlist[lod]);
depth++;
drawipers(depth, FROM_DOWN);
drawipers(depth, FROM_UP);
drawipers(depth, FROM_FRONT);
drawipers(depth, FROM_BACK);
drawipers(depth, FROM_RIGHT);
glPopMatrix();
break;
case FROM_DOWN:
glPushMatrix();
glTranslatef(0.0f, 0.0f, 1.5f);
glScalef(0.5f, 0.5f, 0.5f);
glCallList(LODdlist[lod]);
depth++;
drawipers(depth, FROM_DOWN);
drawipers(depth, FROM_FRONT);
drawipers(depth, FROM_BACK);
drawipers(depth, FROM_LEFT);
drawipers(depth, FROM_RIGHT);
glPopMatrix();
break;
case FROM_UP:
glPushMatrix();
glTranslatef(0.0f, 0.0f, -1.5f);
glScalef(0.5f, 0.5f, 0.5f);
glCallList(LODdlist[lod]);
depth++;
drawipers(depth, FROM_UP);
drawipers(depth, FROM_FRONT);
drawipers(depth, FROM_BACK);
drawipers(depth, FROM_LEFT);
drawipers(depth, FROM_RIGHT);
glPopMatrix();
break;
}
totpoly += LODnumpoly[lod];
}
static void
draw(void)
{
static int count = 0;
static char frbuf[80];
static GLfloat alpha = 0.0f;
static GLfloat beta = 0.0f;
float fr;
dojoy();
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
if (usetex)
glEnable(GL_TEXTURE_2D);
else
glDisable(GL_TEXTURE_2D);
if (fog)
glEnable(GL_FOG);
else
glDisable(GL_FOG);
glPushMatrix();
calcposobs();
gluLookAt(obs[0], obs[1], obs[2],
obs[0] + dir[0], obs[1] + dir[1], obs[2] + dir[2],
0.0, 0.0, 1.0);
/* Scene */
glEnable(GL_DEPTH_TEST);
glShadeModel(GL_SMOOTH);
glBindTexture(GL_TEXTURE_2D, t1id);
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
glColor3f(1.0f, 1.0f, 1.0f);
glEnable(GL_LIGHT0);
glEnable(GL_LIGHTING);
if (normext)
glEnable(GL_RESCALE_NORMAL_EXT);
else
glEnable(GL_NORMALIZE);
glPushMatrix();
glRotatef(alpha, 0.0f, 0.0f, 1.0f);
glRotatef(beta, 1.0f, 0.0f, 0.0f);
totpoly = 0;
drawipers(0, FROM_NONE);
glPopMatrix();
alpha += 0.5f;
beta += 0.3f;
glDisable(GL_LIGHTING);
glDisable(GL_LIGHT0);
glShadeModel(GL_FLAT);
if (normext)
glDisable(GL_RESCALE_NORMAL_EXT);
else
glDisable(GL_NORMALIZE);
glCallList(skydlist);
glPopMatrix();
/* Help Screen */
fr = gettime();
sprintf(frbuf,
"Frame rate: %0.2f LOD: %d Tot. poly.: %d Poly/sec: %.1f",
1.0 / fr, LODbias, totpoly, totpoly / fr);
glDisable(GL_TEXTURE_2D);
glDisable(GL_FOG);
glShadeModel(GL_FLAT);
glDisable(GL_DEPTH_TEST);
glMatrixMode(GL_PROJECTION);
glPushMatrix();
glLoadIdentity();
glOrtho(-0.5, 639.5, -0.5, 479.5, -1.0, 1.0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glColor3f(1.0, 0.0, 0.0);
glRasterPos2i(10, 10);
printstring(GLUT_BITMAP_HELVETICA_18, frbuf);
glRasterPos2i(350, 470);
printstring(GLUT_BITMAP_HELVETICA_10,
"IperS V1.0 Written by David Bucciarelli (tech.hmw@plus.it)");
if (help)
printhelp();
glMatrixMode(GL_PROJECTION);
glPopMatrix();
glMatrixMode(GL_MODELVIEW);
glutSwapBuffers();
count++;
}
int
main(int ac, char **av)
{
float fogcolor[4] = { 0.7, 0.7, 0.7, 1.0 };
fprintf(stderr,
"IperS V1.0\nWritten by David Bucciarelli (tech.hmw@plus.it)\n");
glutInitWindowPosition(0, 0);
glutInitWindowSize(WIDTH, HEIGHT);
glutInit(&ac, av);
glutInitDisplayMode(GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE);
if (!(win = glutCreateWindow("IperS"))) {
fprintf(stderr, "Error, couldn't open window\n");
exit(-1);
}
reshape(WIDTH, HEIGHT);
glShadeModel(GL_SMOOTH);
glEnable(GL_DEPTH_TEST);
glEnable(GL_CULL_FACE);
glEnable(GL_TEXTURE_2D);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_FOG);
glFogi(GL_FOG_MODE, GL_EXP2);
glFogfv(GL_FOG_COLOR, fogcolor);
glFogf(GL_FOG_DENSITY, 0.006);
glHint(GL_FOG_HINT, GL_NICEST);
inittextures();
initdlists();
initlight();
glClearColor(fogcolor[0], fogcolor[1], fogcolor[2], fogcolor[3]);
glClear(GL_COLOR_BUFFER_BIT);
calcposobs();
glutReshapeFunc(reshape);
glutDisplayFunc(draw);
glutKeyboardFunc(key);
glutSpecialFunc(special);
glutIdleFunc(draw);
glutMainLoop();
return 0;
}

View File

@@ -1,36 +1,36 @@
/* $Id: isosurf.c,v 1.1 1999/08/19 00:55:40 jtg Exp $ */
/* $Id: isosurf.c,v 1.6 2000/06/27 17:04:43 brianp Exp $ */
/*
* Display an isosurface of 3-D wind speed volume. Use arrow keys to
* rotate, S toggles smooth shading, L toggles lighting
* Display an isosurface of 3-D wind speed volume.
*
* Command line options:
* -info print GL implementation information
*
* Brian Paul This file in public domain.
*/
/*
* $Log: isosurf.c,v $
* Revision 1.1 1999/08/19 00:55:40 jtg
* Initial revision
/* Keys:
* =====
*
* Revision 3.4 1999/04/24 01:10:47 keithw
* clip planes, materials
*
* Revision 3.3 1999/03/31 19:42:14 keithw
* support for cva
*
* Revision 3.1 1998/11/01 20:30:20 brianp
* added benchmark feature (b key)
*
* Revision 3.0 1998/02/14 18:42:29 brianp
* initial rev
* - Arrow keys to rotate
* - 's' toggles smooth shading
* - 'l' toggles lighting
* - 'f' toggles fog
* - 'I' and 'i' zoom in and out
* - 'c' toggles a user clip plane
* - 'm' toggles colorful materials in GL_TRIANGLES modes.
* - '+' and '-' move the user clip plane
*
* Other options are available via the popup menu.
*/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#define GL_GLEXT_LEGACY
#include "GL/glut.h"
#include "../util/readtex.c" /* I know, this is a hack. KW: me too. */
@@ -44,11 +44,11 @@
#define NO_REFLECT 0x20
#define POINT_FILTER 0x40
#define LINEAR_FILTER 0x80
#define IMMEDIATE 0x100
#define GLVERTEX 0x100
#define DRAW_ARRAYS 0x200 /* or draw_elts, if compiled */
#define ARRAY_ELT 0x400
#define COMPILED 0x800
#define NOT_COMPILED 0x1000
#define IMMEDIATE 0x1000
#define SHADE_SMOOTH 0x2000
#define SHADE_FLAT 0x4000
#define TRIANGLES 0x8000
@@ -57,18 +57,26 @@
#define NO_USER_CLIP 0x40000
#define MATERIALS 0x80000
#define NO_MATERIALS 0x100000
#define FOG 0x200000
#define NO_FOG 0x400000
#define QUIT 0x800000
#define DISPLAYLIST 0x1000000
#define GLINFO 0x2000000
#define STIPPLE 0x4000000
#define NO_STIPPLE 0x8000000
#define LIGHT_MASK (LIT|UNLIT)
#define TEXTURE_MASK (TEXTURE|NO_TEXTURE)
#define REFLECT_MASK (REFLECT|NO_REFLECT)
#define FILTER_MASK (POINT_FILTER|LINEAR_FILTER)
#define RENDER_STYLE_MASK (IMMEDIATE|DRAW_ARRAYS|ARRAY_ELT)
#define COMPILED_MASK (COMPILED|NOT_COMPILED)
#define RENDER_STYLE_MASK (GLVERTEX|DRAW_ARRAYS|ARRAY_ELT)
#define COMPILED_MASK (COMPILED|IMMEDIATE|DISPLAYLIST)
#define MATERIAL_MASK (MATERIALS|NO_MATERIALS)
#define PRIMITIVE_MASK (TRIANGLES|STRIPS)
#define CLIP_MASK (USER_CLIP|NO_USER_CLIP)
#define SHADE_MASK (SHADE_SMOOTH|SHADE_FLAT)
#define FOG_MASK (FOG|NO_FOG)
#define STIPPLE_MASK (STIPPLE|NO_STIPPLE)
#define MAXVERTS 10000
static float data[MAXVERTS][6];
@@ -80,9 +88,30 @@ static GLint numverts, num_tri_verts, numuniq;
static GLfloat xrot;
static GLfloat yrot;
static GLfloat dist = -6;
static GLint state, allowed = ~0;
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;
static GLubyte halftone[] = {
0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55, 0xAA, 0xAA, 0xAA, 0xAA,
0x55, 0x55, 0x55, 0x55, 0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55,
0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55, 0xAA, 0xAA, 0xAA, 0xAA,
0x55, 0x55, 0x55, 0x55, 0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55,
0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55, 0xAA, 0xAA, 0xAA, 0xAA,
0x55, 0x55, 0x55, 0x55, 0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55,
0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55, 0xAA, 0xAA, 0xAA, 0xAA,
0x55, 0x55, 0x55, 0x55, 0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55,
0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55, 0xAA, 0xAA, 0xAA, 0xAA,
0x55, 0x55, 0x55, 0x55, 0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55,
0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55};
/* forward decl */
int BuildList( int mode );
static void read_surface( char *filename )
@@ -119,7 +148,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] ); \
@@ -225,7 +254,7 @@ static void extract_indices1( const struct data_idx *in, unsigned int *out,
}
static void compactify_arrays()
static void compactify_arrays(void)
{
int i;
struct data_idx *ind;
@@ -290,11 +319,11 @@ static void make_tri_indices( void )
#define MIN(x,y) (x < y) ? x : y
static void draw_surface( void )
static void draw_surface( int with_state )
{
GLuint i, j;
switch (state & (COMPILED_MASK|RENDER_STYLE_MASK|PRIMITIVE_MASK)) {
switch (with_state & (COMPILED_MASK|RENDER_STYLE_MASK|PRIMITIVE_MASK)) {
#ifdef GL_EXT_vertex_array
case (COMPILED|DRAW_ARRAYS|STRIPS):
@@ -310,8 +339,8 @@ static void draw_surface( void )
break;
case (COMPILED|DRAW_ARRAYS|TRIANGLES):
case (NOT_COMPILED|DRAW_ARRAYS|TRIANGLES):
if (state & MATERIALS) {
case (IMMEDIATE|DRAW_ARRAYS|TRIANGLES):
if (with_state & MATERIALS) {
for (j = i = 0 ; i < num_tri_verts ; i += 600, j++) {
GLuint nr = MIN(num_tri_verts-i, 600);
glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, col[j]);
@@ -327,22 +356,22 @@ static void draw_surface( void )
/* Uses the original arrays (including duplicate elements):
*/
case (NOT_COMPILED|DRAW_ARRAYS|STRIPS):
case (IMMEDIATE|DRAW_ARRAYS|STRIPS):
glDrawArraysEXT( GL_TRIANGLE_STRIP, 0, numverts );
break;
/* Uses the original arrays (including duplicate elements):
*/
case (NOT_COMPILED|ARRAY_ELT|STRIPS):
case (IMMEDIATE|ARRAY_ELT|STRIPS):
glBegin( GL_TRIANGLE_STRIP );
for (i = 0 ; i < numverts ; i++)
glArrayElement( i );
glEnd();
break;
case (NOT_COMPILED|ARRAY_ELT|TRIANGLES):
case (IMMEDIATE|ARRAY_ELT|TRIANGLES):
case (COMPILED|ARRAY_ELT|TRIANGLES):
if (state & MATERIALS) {
if (with_state & MATERIALS) {
for (j = i = 0 ; i < num_tri_verts ; i += 600, j++) {
GLuint nr = MIN(num_tri_verts-i, 600);
GLuint k;
@@ -357,12 +386,13 @@ static void draw_surface( void )
glBegin( GL_TRIANGLES );
for (i = 0 ; i < num_tri_verts ; i++)
glArrayElement( tri_indices[i] );
glEnd();
}
break;
case (NOT_COMPILED|IMMEDIATE|TRIANGLES):
if (state & MATERIALS) {
case (IMMEDIATE|GLVERTEX|TRIANGLES):
if (with_state & MATERIALS) {
for (j = i = 0 ; i < num_tri_verts ; i += 600, j++) {
GLuint nr = MIN(num_tri_verts-i, 600);
GLuint k;
@@ -385,6 +415,13 @@ static void draw_surface( void )
}
break;
case (DISPLAYLIST|GLVERTEX|STRIPS):
if (!surf1)
surf1 = BuildList( GL_COMPILE_AND_EXECUTE );
else
glCallList(surf1);
break;
#endif
/* Uses the original arrays (including duplicate elements):
@@ -404,18 +441,27 @@ static void draw_surface( void )
static void Display(void)
{
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
draw_surface();
draw_surface( state );
glFlush();
if (doubleBuffer) glutSwapBuffers();
}
int BuildList( int mode )
{
int rv = glGenLists(1);
glNewList(rv, mode );
draw_surface( IMMEDIATE|GLVERTEX|STRIPS );
glEndList();
return rv;
}
/* KW: only do this when necessary, so CVA can re-use results.
*/
static void set_matrix( void )
{
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glTranslatef( 0.0, 0.0, -6.0 );
glTranslatef( 0.0, 0.0, dist );
glRotatef( yrot, 0.0, 1.0, 0.0 );
glRotatef( xrot, 1.0, 0.0, 0.0 );
}
@@ -481,6 +527,8 @@ static void InitMaterials(void)
glMaterialfv(GL_FRONT_AND_BACK, GL_SHININESS, front_mat_shininess);
glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, front_mat_specular);
glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, front_mat_diffuse);
glPolygonStipple (halftone);
}
@@ -498,6 +546,13 @@ static void ModeMenu(int m)
if (m==QUIT)
exit(0);
if (m==GLINFO) {
printf("GL_VERSION: %s\n", (char *) glGetString(GL_VERSION));
printf("GL_EXTENSIONS: %s\n", (char *) glGetString(GL_EXTENSIONS));
printf("GL_RENDERER: %s\n", (char *) glGetString(GL_RENDERER));
return;
}
if (CHANGED(state, m, FILTER_MASK)) {
if (m & LINEAR_FILTER) {
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
@@ -548,10 +603,36 @@ static void ModeMenu(int m)
}
}
if (CHANGED(state, m, FOG_MASK)) {
if (m & FOG)
{
glEnable(GL_FOG);
printf("FOG enable\n");
}
else
{
glDisable(GL_FOG);
printf("FOG disable\n");
}
}
if (CHANGED(state, m, STIPPLE_MASK)) {
if (m & STIPPLE)
{
glEnable(GL_POLYGON_STIPPLE);
printf("STIPPLE enable\n");
}
else
{
glDisable(GL_POLYGON_STIPPLE);
printf("STIPPLE disable\n");
}
}
#ifdef GL_EXT_vertex_array
if (CHANGED(state, m, (COMPILED_MASK|RENDER_STYLE_MASK|PRIMITIVE_MASK)))
{
if ((m & (COMPILED_MASK|PRIMITIVE_MASK)) == (NOT_COMPILED|STRIPS))
if ((m & (COMPILED_MASK|PRIMITIVE_MASK)) == (IMMEDIATE|STRIPS))
{
glVertexPointerEXT( 3, GL_FLOAT, sizeof(data[0]), numverts, data );
glNormalPointerEXT( GL_FLOAT, sizeof(data[0]), numverts, &data[0][3]);
@@ -564,10 +645,12 @@ static void ModeMenu(int m)
&compressed_data[0][3]);
}
#ifdef GL_EXT_compiled_vertex_array
if (m & COMPILED) {
glLockArraysEXT( 0, numuniq );
} else {
glUnlockArraysEXT();
if (allowed & COMPILED) {
if (m & COMPILED) {
glLockArraysEXT( 0, numuniq );
} else {
glUnlockArraysEXT();
}
}
#endif
}
@@ -586,9 +669,11 @@ static void ModeMenu(int m)
static void Init(void)
static void Init(int argc, char *argv[])
{
glClearColor(0.0, 0.0, 0.0, 0.0);
GLfloat fogColor[4] = {0.5,1.0,0.5,1.0};
glClearColor(0.0, 0.0, 1.0, 0.0);
glEnable( GL_DEPTH_TEST );
glEnable( GL_VERTEX_ARRAY_EXT );
glEnable( GL_NORMAL_ARRAY_EXT );
@@ -605,7 +690,7 @@ static void Init(void)
set_matrix();
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_FASTEST);
glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP);
@@ -616,20 +701,36 @@ static void Init(void)
exit(1);
}
if (allowed & COMPILED) {
compactify_arrays();
make_tri_indices();
}
/* Green fog is easy to see */
glFogi(GL_FOG_MODE,GL_EXP2);
glFogfv(GL_FOG_COLOR,fogColor);
glFogf(GL_FOG_DENSITY,0.15);
glHint(GL_FOG_HINT,GL_DONT_CARE);
compactify_arrays();
make_tri_indices();
surf1 = BuildList( GL_COMPILE );
ModeMenu(SHADE_SMOOTH|
LIT|
NO_TEXTURE|
NO_REFLECT|
POINT_FILTER|
NOT_COMPILED|
IMMEDIATE|
NO_USER_CLIP|
NO_MATERIALS|
IMMEDIATE);
NO_FOG|
NO_STIPPLE|
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));
}
}
@@ -643,45 +744,70 @@ static void Reshape(int width, int height)
static void Key( unsigned char key, int x, int y )
{
(void) x;
(void) y;
switch (key) {
case 27:
exit(0);
case 's':
ModeMenu((state ^ SHADE_MASK) & SHADE_MASK);
break;
case 'l':
ModeMenu((state ^ LIGHT_MASK) & LIGHT_MASK);
break;
case 'm':
ModeMenu((state ^ MATERIAL_MASK) & MATERIAL_MASK);
break;
case 'c':
ModeMenu((state ^ CLIP_MASK) & CLIP_MASK);
break;
case 'b':
Benchmark(5.0, 0);
break;
case 'B':
Benchmark(0, 5.0);
break;
case '-':
case '_':
plane[3] += 2.0;
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glClipPlane(GL_CLIP_PLANE0, plane);
set_matrix();
glutPostRedisplay();
break;
case '+':
case '=':
plane[3] -= 2.0;
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glClipPlane(GL_CLIP_PLANE0, plane);
set_matrix();
glutPostRedisplay();
break;
case 27:
exit(0);
case 'f':
ModeMenu((state ^ FOG_MASK) & FOG_MASK);
break;
case 's':
ModeMenu((state ^ SHADE_MASK) & SHADE_MASK);
break;
case 't':
ModeMenu((state ^ STIPPLE_MASK) & STIPPLE_MASK);
break;
case 'l':
ModeMenu((state ^ LIGHT_MASK) & LIGHT_MASK);
break;
case 'm':
ModeMenu((state ^ MATERIAL_MASK) & MATERIAL_MASK);
break;
case 'c':
ModeMenu((state ^ CLIP_MASK) & CLIP_MASK);
break;
case 'v':
if (allowed&COMPILED)
ModeMenu(COMPILED|DRAW_ARRAYS|TRIANGLES);
break;
case 'V':
ModeMenu(IMMEDIATE|GLVERTEX|STRIPS);
break;
case 'b':
Benchmark(5.0, 0);
break;
case 'B':
Benchmark(0, 5.0);
break;
case 'i':
dist += .25;
set_matrix();
glutPostRedisplay();
break;
case 'I':
dist -= .25;
set_matrix();
glutPostRedisplay();
break;
case '-':
case '_':
plane[3] += 2.0;
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glClipPlane(GL_CLIP_PLANE0, plane);
set_matrix();
glutPostRedisplay();
break;
case '+':
case '=':
plane[3] -= 2.0;
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glClipPlane(GL_CLIP_PLANE0, plane);
set_matrix();
glutPostRedisplay();
break;
}
}
@@ -689,6 +815,8 @@ 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_LEFT:
yrot -= 15.0;
@@ -723,6 +851,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;
@@ -770,10 +901,12 @@ int main(int argc, char **argv)
allowed &= ~COMPILED;
}
Init();
Init(argc, argv);
ModeMenu(arg_mode);
glutCreateMenu(ModeMenu);
glutAddMenuEntry("GL info", GLINFO);
glutAddMenuEntry("", 0);
glutAddMenuEntry("Lit", LIT|NO_TEXTURE|NO_REFLECT);
glutAddMenuEntry("Unlit", UNLIT|NO_TEXTURE|NO_REFLECT);
/* glutAddMenuEntry("Textured", TEXTURE); */
@@ -782,21 +915,30 @@ int main(int argc, char **argv)
glutAddMenuEntry("Smooth", SHADE_SMOOTH);
glutAddMenuEntry("Flat", SHADE_FLAT);
glutAddMenuEntry("", 0);
glutAddMenuEntry("Fog", FOG);
glutAddMenuEntry("No Fog", NO_FOG);
glutAddMenuEntry("", 0);
glutAddMenuEntry("Stipple", STIPPLE);
glutAddMenuEntry("No Stipple", NO_STIPPLE);
glutAddMenuEntry("", 0);
glutAddMenuEntry("Point Filtered", POINT_FILTER);
glutAddMenuEntry("Linear Filtered", LINEAR_FILTER);
glutAddMenuEntry("", 0);
glutAddMenuEntry("Immediate (STRIPS)", NOT_COMPILED|IMMEDIATE|STRIPS);
glutAddMenuEntry("Immediate (TRIANGLES)", NOT_COMPILED|IMMEDIATE|TRIANGLES);
glutAddMenuEntry("glVertex (STRIPS)", IMMEDIATE|GLVERTEX|STRIPS);
glutAddMenuEntry("glVertex (TRIANGLES)", IMMEDIATE|GLVERTEX|TRIANGLES);
glutAddMenuEntry("", 0);
glutAddMenuEntry("glVertex display list (STRIPS)",
DISPLAYLIST|GLVERTEX|STRIPS);
glutAddMenuEntry("", 0);
if (allowed & DRAW_ARRAYS) {
glutAddMenuEntry("DrawArrays (STRIPS)",
NOT_COMPILED|DRAW_ARRAYS|STRIPS);
IMMEDIATE|DRAW_ARRAYS|STRIPS);
glutAddMenuEntry("ArrayElement (STRIPS)",
NOT_COMPILED|ARRAY_ELT|STRIPS);
IMMEDIATE|ARRAY_ELT|STRIPS);
glutAddMenuEntry("DrawElements (TRIANGLES)",
NOT_COMPILED|DRAW_ARRAYS|TRIANGLES);
IMMEDIATE|DRAW_ARRAYS|TRIANGLES);
glutAddMenuEntry("ArrayElement (TRIANGLES)",
NOT_COMPILED|ARRAY_ELT|TRIANGLES);
IMMEDIATE|ARRAY_ELT|TRIANGLES);
glutAddMenuEntry("", 0);
}
@@ -805,7 +947,9 @@ int main(int argc, char **argv)
COMPILED|DRAW_ARRAYS|TRIANGLES);
glutAddMenuEntry("Compiled DrawElements (STRIPS)",
COMPILED|DRAW_ARRAYS|STRIPS);
glutAddMenuEntry("Compiled ArrayElement",
glutAddMenuEntry("Compiled ArrayElement (TRIANGLES)",
COMPILED|ARRAY_ELT|TRIANGLES);
glutAddMenuEntry("Compiled ArrayElement (STRIPS)",
COMPILED|ARRAY_ELT|STRIPS);
glutAddMenuEntry("", 0);
}
@@ -816,6 +960,7 @@ int main(int argc, char **argv)
glutKeyboardFunc(Key);
glutSpecialFunc(SpecialKey);
glutDisplayFunc(Display);
glutMainLoop();
return 0;
}

229
progs/demos/lodbias.c Normal file
View File

@@ -0,0 +1,229 @@
/*
* GL_EXT_texture_lod_bias demo
*
* Thanks to Michael Vance for implementing this extension in Mesa.
*
* Brian Paul
* 20 March 2000
*
* Copyright (C) 2000 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <GL/glut.h>
#include <GL/glext.h>
#include "../util/readtex.c" /* I know, this is a hack. */
#define TEXTURE_FILE "../images/girl.rgb"
static GLfloat Xrot = 0, Yrot = -30, Zrot = 0;
static GLboolean Anim = GL_TRUE;
static GLint Bias = 0, BiasStepSign = +1; /* ints avoid fp precision problem */
static GLint BiasMin = -200, BiasMax = 500;
static void
PrintString(const char *s)
{
while (*s) {
glutBitmapCharacter(GLUT_BITMAP_8_BY_13, (int) *s);
s++;
}
}
static void Idle( void )
{
static int lastTime = 0;
int time = glutGet(GLUT_ELAPSED_TIME);
int step;
if (lastTime == 0)
lastTime = time;
else if (time - lastTime < 10)
return;
step = (time - lastTime) / 10 * BiasStepSign;
lastTime = time;
Bias += step;
if (Bias < BiasMin) {
Bias = BiasMin;
BiasStepSign = +1;
}
else if (Bias > BiasMax) {
Bias = BiasMax;
BiasStepSign = -1;
}
glutPostRedisplay();
}
static void Display( void )
{
char str[100];
glClear( GL_COLOR_BUFFER_BIT );
glMatrixMode( GL_PROJECTION );
glLoadIdentity();
glOrtho(-1, 1, -1, 1, -1, 1);
glMatrixMode( GL_MODELVIEW );
glLoadIdentity();
glDisable(GL_TEXTURE_2D);
glColor3f(1,1,1);
glRasterPos3f(-0.9, -0.9, 0.0);
sprintf(str, "Texture LOD Bias = %4.1f", Bias * 0.01);
PrintString(str);
glMatrixMode( GL_PROJECTION );
glLoadIdentity();
glFrustum( -1.0, 1.0, -1.0, 1.0, 5.0, 25.0 );
glMatrixMode( GL_MODELVIEW );
glLoadIdentity();
glTranslatef( 0.0, 0.0, -8.0 );
glPushMatrix();
glRotatef(Xrot, 1, 0, 0);
glRotatef(Yrot, 0, 1, 0);
glRotatef(Zrot, 0, 0, 1);
glEnable(GL_TEXTURE_2D);
glTexEnvf(GL_TEXTURE_FILTER_CONTROL_EXT, GL_TEXTURE_LOD_BIAS_EXT, 0.01 * Bias);
glBegin(GL_POLYGON);
glTexCoord2f(0, 0); glVertex2f(-1, -1);
glTexCoord2f(2, 0); glVertex2f( 1, -1);
glTexCoord2f(2, 2); glVertex2f( 1, 1);
glTexCoord2f(0, 2); glVertex2f(-1, 1);
glEnd();
glPopMatrix();
glutSwapBuffers();
}
static void Reshape( int width, int height )
{
glViewport( 0, 0, width, height );
}
static void Key( unsigned char key, int x, int y )
{
const GLfloat step = 3.0;
(void) x;
(void) y;
switch (key) {
case 'a':
Anim = !Anim;
if (Anim)
glutIdleFunc(Idle);
else
glutIdleFunc(NULL);
break;
case 'z':
Zrot -= step;
break;
case 'Z':
Zrot += step;
break;
case 'b':
Bias -= 10;
break;
case 'B':
Bias += 10;
break;
case 27:
exit(0);
break;
}
glutPostRedisplay();
}
static void SpecialKey( int key, int x, int y )
{
const GLfloat step = 3.0;
(void) x;
(void) y;
switch (key) {
case GLUT_KEY_UP:
Xrot -= step;
break;
case GLUT_KEY_DOWN:
Xrot += step;
break;
case GLUT_KEY_LEFT:
Yrot -= step;
break;
case GLUT_KEY_RIGHT:
Yrot += step;
break;
}
glutPostRedisplay();
}
static void Init( void )
{
const char *exten = (const char *) glGetString(GL_EXTENSIONS);
if (!strstr(exten, "GL_EXT_texture_lod_bias")) {
printf("Sorry, GL_EXT_texture_lod_bias not supported by this renderer.\n");
exit(1);
}
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
if (!LoadRGBMipmaps(TEXTURE_FILE, GL_RGB)) {
printf("Error: could not load texture image %s\n", TEXTURE_FILE);
exit(1);
}
/* mipmapping required for this extension */
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
}
int main( int argc, char *argv[] )
{
glutInit( &argc, argv );
glutInitWindowPosition( 0, 0 );
glutInitWindowSize( 350, 350 );
glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE );
glutCreateWindow(argv[0]);
glutReshapeFunc( Reshape );
glutKeyboardFunc( Key );
glutSpecialFunc( SpecialKey );
glutDisplayFunc( Display );
if (Anim)
glutIdleFunc(Idle);
Init();
glutMainLoop();
return 0;
}

View File

@@ -1,9 +1,18 @@
/* $Id: morph3d.c,v 1.1 1999/08/19 00:55:40 jtg Exp $ */
/* $Id: morph3d.c,v 1.4 2000/06/27 17:04:43 brianp Exp $ */
/*
* $Log: morph3d.c,v $
* Revision 1.1 1999/08/19 00:55:40 jtg
* Initial revision
* Revision 1.4 2000/06/27 17:04:43 brianp
* fixed compiler warnings
*
* Revision 1.3 1999/12/15 13:00:45 brianp
* moved #define to column 0
*
* Revision 1.2 1999/09/17 12:27:01 brianp
* silenced some warnings
*
* Revision 1.1.1.1 1999/08/19 00:55:40 jtg
* Imported sources
*
* Revision 3.1 1998/06/29 02:37:30 brianp
* minor changes for Windows (Ted Jump)
@@ -495,7 +504,7 @@ static void draw_dodeca( void )
{
GLuint list;
#define TAU ((SQRT5+1)/2)
#define TAU ((SQRT5+1)/2)
list = glGenLists( 1 );
glNewList( list, GL_COMPILE );
@@ -717,6 +726,8 @@ static void pinit(void);
static void key( unsigned char k, int x, int y )
{
(void) x;
(void) y;
switch (k) {
case '1': object=1; break;
case '2': object=2; break;
@@ -822,7 +833,7 @@ static void pinit(void)
}
void INIT(void)
static void INIT(void)
{
printf("Morph 3D - Shows morphing platonic polyhedra\n");
printf("Author: Marcelo Fernandes Vianna (vianna@cat.cbpf.br)\n\n");

View File

@@ -1,14 +1,34 @@
/* $Id: multiarb.c,v 1.1 1999/08/19 00:55:40 jtg Exp $ */
/* $Id: multiarb.c,v 1.6 2000/05/23 23:21:00 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.6 2000/05/23 23:21:00 brianp
* set default window pos
*
* Revision 1.5 2000/02/02 17:31:45 brianp
* changed > to >=
*
* Revision 1.4 2000/02/02 01:07:21 brianp
* limit Drift to [0, 1]
*
* 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
@@ -50,6 +70,8 @@ static void Idle( void )
{
if (Animate) {
Drift += 0.05;
if (Drift >= 1.0)
Drift = 0.0;
#ifdef GL_ARB_multitexture
glActiveTextureARB(GL_TEXTURE0_ARB);
@@ -221,18 +243,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 +277,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 +295,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));
}
}
@@ -283,10 +322,11 @@ int main( int argc, char *argv[] )
{
glutInit( &argc, argv );
glutInitWindowSize( 300, 300 );
glutInitWindowPosition( 0, 0 );
glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE );
glutCreateWindow(argv[0] );
Init();
Init( argc, argv );
glutReshapeFunc( Reshape );
glutKeyboardFunc( Key );

226
progs/demos/occlude.c Normal file
View File

@@ -0,0 +1,226 @@
/*
* GL_HP_occlustion_test demo
*
* Brian Paul
* 31 March 2000
*
* Copyright (C) 2000 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <GL/glut.h>
#include <GL/glext.h>
static GLfloat Xpos = 0;
static void
PrintString(const char *s)
{
while (*s) {
glutBitmapCharacter(GLUT_BITMAP_8_BY_13, (int) *s);
s++;
}
}
static void Idle(void)
{
static int lastTime = 0;
static int sign = +1;
int time = glutGet(GLUT_ELAPSED_TIME);
float step;
if (lastTime == 0)
lastTime = time;
else if (time - lastTime < 20) /* 50Hz update */
return;
step = (time - lastTime) / 1000.0 * sign;
lastTime = time;
Xpos += step;
if (Xpos > 2.5) {
Xpos = 2.5;
sign = -1;
}
else if (Xpos < -2.5) {
Xpos = -2.5;
sign = +1;
}
glutPostRedisplay();
}
static void Display( void )
{
GLboolean result;
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
glMatrixMode( GL_PROJECTION );
glLoadIdentity();
glFrustum( -1.0, 1.0, -1.0, 1.0, 5.0, 25.0 );
glMatrixMode( GL_MODELVIEW );
glLoadIdentity();
glTranslatef( 0.0, 0.0, -15.0 );
/* draw the occluding polygons */
glColor3f(0, 0.6, 0.8);
glBegin(GL_QUADS);
glVertex2f(-1.6, -1.5);
glVertex2f(-0.4, -1.5);
glVertex2f(-0.4, 1.5);
glVertex2f(-1.6, 1.5);
glVertex2f( 0.4, -1.5);
glVertex2f( 1.6, -1.5);
glVertex2f( 1.6, 1.5);
glVertex2f( 0.4, 1.5);
glEnd();
/* draw the test polygon with occlusion testing */
glPushMatrix();
glTranslatef(Xpos, 0, -0.5);
glScalef(0.3, 0.3, 1.0);
glRotatef(-90.0 * Xpos, 0, 0, 1);
glEnable(GL_OCCLUSION_TEST_HP); /* NOTE: enabling the occlusion test */
/* doesn't clear the result flag! */
glColorMask(0, 0, 0, 0);
glDepthMask(GL_FALSE);
/* this call clear's the result flag. Not really needed for this demo. */
glGetBooleanv(GL_OCCLUSION_TEST_RESULT_HP, &result);
glBegin(GL_POLYGON);
glVertex3f(-1, -1, 0);
glVertex3f( 1, -1, 0);
glVertex3f( 1, 1, 0);
glVertex3f(-1, 1, 0);
glEnd();
glGetBooleanv(GL_OCCLUSION_TEST_RESULT_HP, &result);
/* turn off occlusion testing */
glDisable(GL_OCCLUSION_TEST_HP);
glColorMask(1, 1, 1, 1);
glDepthMask(GL_TRUE);
/* draw the green rect, so we can see what's going on */
glColor3f(0.8, 0.5, 0);
glBegin(GL_POLYGON);
glVertex3f(-1, -1, 0);
glVertex3f( 1, -1, 0);
glVertex3f( 1, 1, 0);
glVertex3f(-1, 1, 0);
glEnd();
glPopMatrix();
/* Print result message */
glMatrixMode( GL_PROJECTION );
glLoadIdentity();
glOrtho( -1.0, 1.0, -1.0, 1.0, -1.0, 1.0 );
glMatrixMode( GL_MODELVIEW );
glLoadIdentity();
glColor3f(1, 1, 1);
glRasterPos3f(-0.25, -0.7, 0);
if (result)
PrintString(" Visible");
else
PrintString("Fully Occluded");
glutSwapBuffers();
}
static void Reshape( int width, int height )
{
glViewport( 0, 0, width, height );
}
static void Key( unsigned char key, int x, int y )
{
(void) x;
(void) y;
switch (key) {
case 27:
exit(0);
break;
}
glutPostRedisplay();
}
static void SpecialKey( int key, int x, int y )
{
const GLfloat step = 0.1;
(void) x;
(void) y;
switch (key) {
case GLUT_KEY_LEFT:
Xpos -= step;
break;
case GLUT_KEY_RIGHT:
Xpos += step;
break;
}
glutPostRedisplay();
}
static void Init( void )
{
const char *ext = (const char *) glGetString(GL_EXTENSIONS);
if (!strstr(ext, "GL_HP_occlusion_test")) {
printf("Sorry, this demo requires the GL_HP_occlusion_test extension\n");
exit(-1);
}
glEnable(GL_DEPTH_TEST);
}
int main( int argc, char *argv[] )
{
glutInit( &argc, argv );
glutInitWindowPosition( 0, 0 );
glutInitWindowSize( 400, 400 );
glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH );
glutCreateWindow(argv[0]);
glutReshapeFunc( Reshape );
glutKeyboardFunc( Key );
glutSpecialFunc( SpecialKey );
glutIdleFunc( Idle );
glutDisplayFunc( Display );
Init();
glutMainLoop();
return 0;
}

View File

@@ -1,4 +1,4 @@
/* $Id: osdemo.c,v 1.1 1999/08/19 00:55:40 jtg Exp $ */
/* $Id: osdemo.c,v 1.4 2000/03/28 16:59:39 rjfrank Exp $ */
/*
* Demo of off-screen Mesa rendering
@@ -17,24 +17,14 @@
*/
/*
* $Log: osdemo.c,v $
* Revision 1.1 1999/08/19 00:55:40 jtg
* Initial revision
*
* Revision 3.0 1998/02/14 18:42:29 brianp
* initial rev
*
*/
#include <stdio.h>
#include <stdlib.h>
#include "GL/osmesa.h"
#include "GL/glut.h"
#define SAVE_TARGA
#define WIDTH 400
#define HEIGHT 400
@@ -85,27 +75,159 @@ static void render_image( void )
glutSolidCone(1.0, 2.0, 16, 1);
glPopMatrix();
#ifdef GL_HP_occlusion_test
{
GLboolean bRet;
glDepthMask(GL_FALSE);
glColorMask(GL_FALSE,GL_FALSE,GL_FALSE,GL_FALSE);
glEnable(GL_OCCLUSION_TEST_HP);
glGetBooleanv(GL_OCCLUSION_TEST_RESULT_HP,&bRet);
glPushMatrix();
glTranslatef(0.75, 0.0, -1.0);
glMaterialfv( GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, blue_mat );
glutSolidSphere(1.0, 20, 20);
glPopMatrix();
glGetBooleanv(GL_OCCLUSION_TEST_RESULT_HP,&bRet);
printf("Occlusion test 1 (result should be 1): %d\n",bRet);
glDepthMask(GL_TRUE);
glColorMask(GL_TRUE,GL_TRUE,GL_TRUE,GL_TRUE);
glDisable(GL_OCCLUSION_TEST_HP);
}
#endif
glPushMatrix();
glTranslatef(0.75, 0.0, -1.0);
glMaterialfv( GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, blue_mat );
glutSolidSphere(1.0, 20, 20);
glPopMatrix();
#ifdef GL_HP_occlusion_test
{
GLboolean bRet;
glDepthMask(GL_FALSE);
glColorMask(GL_FALSE,GL_FALSE,GL_FALSE,GL_FALSE);
glEnable(GL_OCCLUSION_TEST_HP);
glGetBooleanv(GL_OCCLUSION_TEST_RESULT_HP,&bRet);
/* draw a sphere inside the previous sphere */
glPushMatrix();
glTranslatef(0.75, 0.0, -1.0);
glMaterialfv( GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, blue_mat );
glutSolidSphere(0.5, 20, 20);
glPopMatrix();
glGetBooleanv(GL_OCCLUSION_TEST_RESULT_HP,&bRet);
printf("Occlusion test 2 (result should be 0): %d\n",bRet);
glDepthMask(GL_TRUE);
glColorMask(GL_TRUE,GL_TRUE,GL_TRUE,GL_TRUE);
glDisable(GL_OCCLUSION_TEST_HP);
}
#endif
glPopMatrix();
}
static void
write_targa(const char *filename, const GLubyte *buffer, int width, int height)
{
FILE *f = fopen( filename, "w" );
if (f) {
int i, x, y;
const GLubyte *ptr = buffer;
printf ("osdemo, writing tga file \n");
fputc (0x00, f); /* ID Length, 0 => No ID */
fputc (0x00, f); /* Color Map Type, 0 => No color map included */
fputc (0x02, f); /* Image Type, 2 => Uncompressed, True-color Image */
fputc (0x00, f); /* Next five bytes are about the color map entries */
fputc (0x00, f); /* 2 bytes Index, 2 bytes length, 1 byte size */
fputc (0x00, f);
fputc (0x00, f);
fputc (0x00, f);
fputc (0x00, f); /* X-origin of Image */
fputc (0x00, f);
fputc (0x00, f); /* Y-origin of Image */
fputc (0x00, f);
fputc (WIDTH & 0xff, f); /* Image Width */
fputc ((WIDTH>>8) & 0xff, f);
fputc (HEIGHT & 0xff, f); /* Image Height */
fputc ((HEIGHT>>8) & 0xff, f);
fputc (0x18, f); /* Pixel Depth, 0x18 => 24 Bits */
fputc (0x20, f); /* Image Descriptor */
fclose(f);
f = fopen( filename, "ab" ); /* reopen in binary append mode */
for (y=height-1; y>=0; y--) {
for (x=0; x<width; x++) {
i = (y*width + x) * 4;
fputc(ptr[i+2], f); /* write blue */
fputc(ptr[i+1], f); /* write green */
fputc(ptr[i], f); /* write red */
}
}
}
}
static void
write_ppm(const char *filename, const GLubyte *buffer, int width, int height)
{
const int binary = 0;
FILE *f = fopen( filename, "w" );
if (f) {
int i, x, y;
const GLubyte *ptr = buffer;
if (binary) {
fprintf(f,"P6\n");
fprintf(f,"# ppm-file created by osdemo.c\n");
fprintf(f,"%i %i\n", width,height);
fprintf(f,"255\n");
fclose(f);
f = fopen( filename, "ab" ); /* reopen in binary append mode */
for (y=height-1; y>=0; y--) {
for (x=0; x<width; x++) {
i = (y*width + x) * 4;
fputc(ptr[i], f); /* write red */
fputc(ptr[i+1], f); /* write green */
fputc(ptr[i+2], f); /* write blue */
}
}
}
else {
/*ASCII*/
int counter = 0;
fprintf(f,"P3\n");
fprintf(f,"# ascii ppm file created by osdemo.c\n");
fprintf(f,"%i %i\n", width, height);
fprintf(f,"255\n");
for (y=height-1; y>=0; y--) {
for (x=0; x<width; x++) {
i = (y*width + x) * 4;
fprintf(f, " %3d %3d %3d", ptr[i], ptr[i+1], ptr[i+2]);
counter++;
if (counter % 5 == 0)
fprintf(f, "\n");
}
}
}
fclose(f);
}
}
int main( int argc, char *argv[] )
{
OSMesaContext ctx;
void *buffer;
/* Create an RGBA-mode context */
ctx = OSMesaCreateContext( GL_RGBA, NULL );
OSMesaContext ctx = OSMesaCreateContext( GL_RGBA, NULL );
/* Allocate the image buffer */
buffer = malloc( WIDTH * HEIGHT * 4 );
void *buffer = malloc( WIDTH * HEIGHT * 4 );
/* Bind the buffer to the context and make it current */
OSMesaMakeCurrent( ctx, buffer, GL_UNSIGNED_BYTE, WIDTH, HEIGHT );
@@ -113,48 +235,14 @@ int main( int argc, char *argv[] )
render_image();
if (argc>1) {
/* write PPM file */
FILE *f = fopen( argv[1], "w" );
if (f) {
int i, x, y;
GLubyte *ptr = (GLubyte *) buffer;
#define BINARY 0
#if BINARY
fprintf(f,"P6\n");
fprintf(f,"# ppm-file created by %s\n", argv[0]);
fprintf(f,"%i %i\n", WIDTH,HEIGHT);
fprintf(f,"255\n");
fclose(f);
f = fopen( argv[1], "ab" ); /* reopen in binary append mode */
for (y=HEIGHT-1; y>=0; y--) {
for (x=0; x<WIDTH; x++) {
i = (y*WIDTH + x) * 4;
fputc(ptr[i], f); /* write red */
fputc(ptr[i+1], f); /* write green */
fputc(ptr[i+2], f); /* write blue */
}
}
#else /*ASCII*/
int counter = 0;
fprintf(f,"P3\n");
fprintf(f,"# ascii ppm file created by %s\n", argv[0]);
fprintf(f,"%i %i\n", WIDTH, HEIGHT);
fprintf(f,"255\n");
for (y=HEIGHT-1; y>=0; y--) {
for (x=0; x<WIDTH; x++) {
i = (y*WIDTH + x) * 4;
fprintf(f, " %3d %3d %3d", ptr[i], ptr[i+1], ptr[i+2]);
counter++;
if (counter % 5 == 0)
fprintf(f, "\n");
}
}
#ifdef SAVE_TARGA
write_targa(argv[1], buffer, WIDTH, HEIGHT);
#else
write_ppm(argv[1], buffer, WIDTH, HEIGHT);
#endif
fclose(f);
}
}
else {
printf("Specify a filename if you want to make a ppm file\n");
printf("Specify a filename if you want to make an image file\n");
}
printf("all done\n");

View File

@@ -1,26 +1,14 @@
/* $Id: paltex.c,v 1.1 1999/08/19 00:55:40 jtg Exp $ */
/* $Id: paltex.c,v 1.4 2000/06/27 17:12:10 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 3.1 1999/03/28 18:20:49 brianp
* minor clean-up
*
* Revision 3.0 1998/02/14 18:42:29 brianp
* initial rev
*
*/
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#define GL_GLEXT_LEGACY
#include <GL/glut.h>
@@ -42,10 +30,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 +50,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,56 +67,52 @@ 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;
if (!glutExtensionSupported("GL_EXT_paletted_texture")) {
printf("Sorry, GL_EXT_paletted_texture not supported\n");
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 +133,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 +161,6 @@ int main( int argc, char *argv[] )
glutReshapeFunc( Reshape );
glutKeyboardFunc( Key );
glutSpecialFunc( SpecialKey );
glutDisplayFunc( Display );
glutIdleFunc( Idle );

219
progs/demos/particles.cxx Normal file
View File

@@ -0,0 +1,219 @@
/*
* This program is under the GNU GPL.
* Use at your own risk.
*
* written by David Bucciarelli (humanware@plus.it)
* Humanware s.r.l.
*/
#include <stdlib.h>
#include "particles.h"
#define vinit(a,i,j,k) {\
(a)[0]=i;\
(a)[1]=j;\
(a)[2]=k;\
}
#define vadds(a,dt,b) {\
(a)[0]+=(dt)*(b)[0];\
(a)[1]+=(dt)*(b)[1];\
(a)[2]+=(dt)*(b)[2];\
}
#define vequ(a,b) {\
(a)[0]=(b)[0];\
(a)[1]=(b)[1];\
(a)[2]=(b)[2];\
}
#define vinter(a,dt,b,c) {\
(a)[0]=(dt)*(b)[0]+(1.0-dt)*(c)[0];\
(a)[1]=(dt)*(b)[1]+(1.0-dt)*(c)[1];\
(a)[2]=(dt)*(b)[2]+(1.0-dt)*(c)[2];\
}
#define clamp(a) ((a) < 0.0 ? 0.0 : ((a) < 1.0 ? (a) : 1.0))
#define vclamp(v) {\
(v)[0]=clamp((v)[0]);\
(v)[1]=clamp((v)[1]);\
(v)[2]=clamp((v)[2]);\
}
float rainParticle::min[3];
float rainParticle::max[3];
float rainParticle::partLength=0.2f;
static float vrnd(void)
{
return(((float)rand())/RAND_MAX);
}
particle::particle()
{
age=0.0f;
vinit(acc,0.0f,0.0f,0.0f);
vinit(vel,0.0f,0.0f,0.0f);
vinit(pos,0.0f,0.0f,0.0f);
}
void particle::elapsedTime(float dt)
{
age+=dt;
vadds(vel,dt,acc);
vadds(pos,dt,vel);
}
/////////////////////////////////////////
// Particle System
/////////////////////////////////////////
particleSystem::particleSystem()
{
t=0.0f;
part=NULL;
particleNum=0;
}
particleSystem::~particleSystem()
{
if(part)
free(part);
}
void particleSystem::addParticle(particle *p)
{
if(!part) {
part=(particle **)calloc(1,sizeof(particle *));
part[0]=p;
particleNum=1;
} else {
particleNum++;
part=(particle **)realloc(part,sizeof(particle *)*particleNum);
part[particleNum-1]=p;
}
}
void particleSystem::reset(void)
{
if(part)
free(part);
t=0.0f;
part=NULL;
particleNum=0;
}
void particleSystem::draw(void)
{
if(!part)
return;
part[0]->beginDraw();
for(unsigned int i=0;i<particleNum;i++)
part[i]->draw();
part[0]->endDraw();
}
void particleSystem::addTime(float dt)
{
if(!part)
return;
for(unsigned int i=0;i<particleNum;i++) {
part[i]->elapsedTime(dt);
part[i]->checkAge();
}
}
/////////////////////////////////////////
// Rain
/////////////////////////////////////////
void rainParticle::init(void)
{
age=0.0f;
acc[0]=0.0f;
acc[1]=-0.98f;
acc[2]=0.0f;
vel[0]=0.0f;
vel[1]=0.0f;
vel[2]=0.0f;
oldpos[0]=pos[0]=min[0]+(max[0]-min[0])*vrnd();
oldpos[1]=pos[1]=max[1]+0.2f*max[1]*vrnd();
oldpos[2]=pos[2]=min[2]+(max[2]-min[2])*vrnd();
vadds(oldpos,-partLength,vel);
}
rainParticle::rainParticle()
{
init();
}
void rainParticle::setRainingArea(float minx, float miny, float minz,
float maxx, float maxy, float maxz)
{
vinit(min,minx,miny,minz);
vinit(max,maxx,maxy,maxz);
}
void rainParticle::setLength(float l)
{
partLength=l;
}
void rainParticle::draw(void)
{
glColor4f(0.7f,0.95f,1.0f,0.0f);
glVertex3fv(oldpos);
glColor4f(0.3f,0.7f,1.0f,1.0f);
glVertex3fv(pos);
}
void rainParticle::checkAge(void)
{
if(pos[1]<min[1])
init();
}
void rainParticle::elapsedTime(float dt)
{
particle::elapsedTime(dt);
if(pos[0]<min[0])
pos[0]=max[0]-(min[0]-pos[0]);
if(pos[2]<min[2])
pos[2]=max[2]-(min[2]-pos[2]);
if(pos[0]>max[0])
pos[0]=min[0]+(pos[0]-max[0]);
if(pos[2]>max[2])
pos[2]=min[2]+(pos[2]-max[2]);
vequ(oldpos,pos);
vadds(oldpos,-partLength,vel);
}
void rainParticle::randomHeight(void)
{
pos[1]=(max[1]-min[1])*vrnd()+min[1];
oldpos[1]=pos[1]-partLength*vel[1];
}

81
progs/demos/particles.h Normal file
View File

@@ -0,0 +1,81 @@
/*
* This program is under the GNU GPL.
* Use at your own risk.
*
* written by David Bucciarelli (humanware@plus.it)
* Humanware s.r.l.
*/
#ifndef PARTICLES_H
#define PARTICLES_H
#include <GL/gl.h>
class particle {
protected:
float age; // in seconds
float acc[3];
float vel[3];
float pos[3];
public:
particle();
virtual ~particle() {};
virtual void beginDraw(void) {};
virtual void draw(void)=0;
virtual void endDraw(void) {};
virtual void elapsedTime(float);
virtual void checkAge(void) {};
};
class particleSystem {
protected:
particle **part;
float t;
unsigned long particleNum;
public:
particleSystem();
~particleSystem();
void addParticle(particle *);
void reset(void);
void draw(void);
void addTime(float);
};
class rainParticle : public particle {
protected:
static float min[3];
static float max[3];
static float partLength;
float oldpos[3];
void init(void);
public:
rainParticle();
static void setRainingArea(float, float, float,
float, float, float);
static void setLength(float);
static float getLength(void) { return partLength; };
void beginDraw(void) { glBegin(GL_LINES); };
void draw(void);
void endDraw(void) { glEnd(); };
void elapsedTime(float);
void checkAge(void);
void randomHeight(void);
};
#endif

210
progs/demos/pixeltex.c Normal file
View File

@@ -0,0 +1,210 @@
/*
* GL_SGIS_pixel_texture demo
*
* Brian Paul
* 6 Apr 2000
*
* Copyright (C) 2000 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
/*
* How this works:
* 1. We load the image into a 2D texture.
* 2. We generate a sequence of RGB images in which the R component
* is really the S texture coordinate and the G component is really
* the T texture coordinate.
* By warping the mapping from R to S and G to T we can get non-linear
* distortions.
* 3. Draw the warped image (a 2-D warping function) with pixel texgen
* enabled.
* 4. Loop over the warped images to animate.
*
* The pixel texgen extension can also be used to do color-space
* conversions. For example, we could convert YCR to RGB with a
* 3D texture map which takes YCR as the S,T,R texture coordinate and
* returns RGB texel values.
*
* You can use this extension in (at least) two ways:
* 1. glDrawPixels w/ color space conversion/warping
* 2. glDrawPixels to spatially warp another image in texture memory
*
* We're basically using glDrawPixels to draw a texture coordinate image.
*/
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <GL/glut.h>
#include <GL/glext.h>
#include "../util/readtex.c" /* I know, this is a hack. */
#define TEXTURE_FILE "../images/girl.rgb"
static int ImgWidth = 300, ImgHeight = 300;
#define FRAMES 20
static GLubyte *ImgData[FRAMES];
static GLint Frame = 0;
static GLboolean TextureFlag = GL_TRUE;
static void Display( void )
{
glClear( GL_COLOR_BUFFER_BIT );
if (TextureFlag) {
glEnable(GL_PIXEL_TEXTURE_SGIS);
glEnable(GL_TEXTURE_2D);
}
else {
glDisable(GL_PIXEL_TEXTURE_SGIS);
glDisable(GL_TEXTURE_2D);
}
glColor3f(1, 1, 1);
glRasterPos2f(10, 10);
glDrawPixels(ImgWidth, ImgHeight, GL_RGB, GL_UNSIGNED_BYTE, ImgData[Frame]);
glutSwapBuffers();
}
static void Reshape( int width, int height )
{
glViewport( 0, 0, width, height );
glMatrixMode( GL_PROJECTION );
glLoadIdentity();
glOrtho(0, width, 0, height, -1, 1);
glMatrixMode( GL_MODELVIEW );
glLoadIdentity();
}
static void Key( unsigned char key, int x, int y )
{
(void) x;
(void) y;
switch (key) {
case ' ':
TextureFlag = !TextureFlag;
break;
case 27:
exit(0);
break;
}
glutPostRedisplay();
}
static void Idle(void)
{
Frame++;
if (Frame >= FRAMES)
Frame = 0;
glutPostRedisplay();
}
static GLubyte warp(GLfloat s, int frame)
{
static const GLfloat PI = 3.14159265;
static int halfFrame = FRAMES / 2;
GLfloat y, weight, v;
if (frame >= halfFrame)
frame = halfFrame - (frame - halfFrame);
y = sin(s * PI);
weight = (float) frame / (FRAMES-1);
v = y * (0.8 * weight + 0.2);
return (GLint) (v * 255.0F);
}
static void InitImage(void)
{
int i, j, frame;
for (frame = 0; frame < FRAMES; frame++) {
ImgData[frame] = (GLubyte *) malloc(ImgWidth * ImgHeight * 3);
for (i = 0; i < ImgHeight; i++) {
for (j = 0; j < ImgWidth; j++) {
GLubyte *pixel = ImgData[frame] + (i * ImgWidth + j) * 3;
pixel[0] = warp((float) j / (ImgWidth - 0), frame);
pixel[1] = warp((float) i / (ImgHeight - 0), frame);
pixel[2] = 0.0;
}
}
}
}
static void Init( int argc, char *argv[] )
{
const char *exten = (const char *) glGetString(GL_EXTENSIONS);
if (!strstr(exten, "GL_SGIS_pixel_texture")) {
printf("Sorry, GL_SGIS_pixel_texture not supported by this renderer.\n");
exit(1);
}
/* linear filtering looks nicer, but it's slower, since it's in software */
#if 1
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
#else
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
#endif
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
if (!LoadRGBMipmaps(TEXTURE_FILE, GL_RGB)) {
printf("Error: couldn't load texture image\n");
exit(1);
}
glClearColor(0.3, 0.3, 0.4, 1.0);
InitImage();
printf("Hit SPACE to toggle pixel texgen\n");
}
int main( int argc, char *argv[] )
{
glutInit( &argc, argv );
glutInitWindowSize( 330, 330 );
glutInitWindowPosition( 0, 0 );
glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE );
glutCreateWindow(argv[0] );
Init( argc, argv );
glutKeyboardFunc( Key );
glutReshapeFunc( Reshape );
glutDisplayFunc( Display );
glutIdleFunc( Idle );
glutMainLoop();
return 0;
}

View File

@@ -13,8 +13,11 @@
/*
* $Log: pointblast.c,v $
* Revision 1.1 1999/08/19 00:55:40 jtg
* Initial revision
* Revision 1.2 2000/06/27 17:04:43 brianp
* fixed compiler warnings
*
* Revision 1.1.1.1 1999/08/19 00:55:40 jtg
* Imported sources
*
* Revision 3.3 1998/07/26 01:24:27 brianp
* removed include of gl.h
@@ -35,6 +38,7 @@
#include <stdlib.h>
#include <string.h>
#include <math.h> /* for cos(), sin(), and sqrt() */
#define GL_GLEXT_LEGACY
#include <GL/glut.h>
/* Some <math.h> files do not define M_PI... */
@@ -100,7 +104,7 @@ static float float_rand(void) { return rand() / (float) RAND_MAX; }
/* Modeling units of ground extent in each X and Z direction. */
#define EDGE 12
void
static void
makePointList(void)
{
float angle, velocity, direction;
@@ -124,7 +128,7 @@ makePointList(void)
theTime = 0.0;
}
void
static void
updatePointList(void)
{
float distance;
@@ -167,7 +171,7 @@ updatePointList(void)
}
}
void
static void
idle(void)
{
updatePointList();
@@ -178,7 +182,7 @@ idle(void)
glutPostRedisplay();
}
void
static void
visible(int vis)
{
if (vis == GLUT_VISIBLE) {
@@ -190,7 +194,7 @@ visible(int vis)
}
}
void
static void
recalcModelView(void)
{
glPopMatrix();
@@ -199,7 +203,7 @@ recalcModelView(void)
newModel = 0;
}
void
static void
redraw(void)
{
int i;
@@ -247,7 +251,7 @@ redraw(void)
}
/* ARGSUSED2 */
void
static void
mouse(int button, int state, int x, int y)
{
/* Scene can be spun around Y axis using left
@@ -262,7 +266,7 @@ mouse(int button, int state, int x, int y)
}
/* ARGSUSED1 */
void
static void
mouseMotion(int x, int y)
{
if (moving) {
@@ -273,7 +277,7 @@ mouseMotion(int x, int y)
}
}
void
static void
menu(int option)
{
switch (option) {
@@ -347,7 +351,7 @@ menu(int option)
}
/* ARGSUSED1 */
void
static void
key(unsigned char c, int x, int y)
{
switch (c) {

388
progs/demos/rain.cxx Normal file
View File

@@ -0,0 +1,388 @@
/*
* This program is under the GNU GPL.
* Use at your own risk.
*
* written by David Bucciarelli (humanware@plus.it)
* Humanware s.r.l.
*/
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <time.h>
#include <GL/glut.h>
#include "particles.h"
extern "C" {
#include "image.h"
}
#ifdef WIN32
#include <windows.h>
#include <mmsystem.h>
#endif
#ifdef XMESA
#include "GL/xmesa.h"
static int fullscreen=1;
#endif
static int WIDTH=640;
static int HEIGHT=480;
static int NUMPART=7500;
#define FRAME 50
static float fogcolor[4]={1.0,1.0,1.0,1.0};
#define DIMP 40.0
#define DIMTP 32.0
static float q[4][3]={
{-DIMP,0.0,-DIMP},
{DIMP,0.0,-DIMP},
{DIMP,0.0,DIMP},
{-DIMP,0.0,DIMP}
};
static float qt[4][2]={
{-DIMTP,-DIMTP},
{DIMTP,-DIMTP},
{DIMTP,DIMTP},
{-DIMTP,DIMTP}
};
static int win=0;
static int fog=1;
static int help=1;
static GLuint groundid;
static float obs[3]={2.0,1.0,0.0};
static float dir[3];
static float v=0.0;
static float alpha=-90.0;
static float beta=90.0;
static particleSystem *ps;
static float gettime()
{
static clock_t told=0;
clock_t tnew,ris;
tnew=clock();
ris=tnew-told;
told=tnew;
return(ris/(float)CLOCKS_PER_SEC);
}
static float gettimerain()
{
static clock_t told=0;
clock_t tnew,ris;
tnew=clock();
ris=tnew-told;
told=tnew;
return(ris/(float)CLOCKS_PER_SEC);
}
static void calcposobs(void)
{
dir[0]=sin(alpha*M_PI/180.0);
dir[2]=cos(alpha*M_PI/180.0)*sin(beta*M_PI/180.0);
dir[1]=cos(beta*M_PI/180.0);
obs[0]+=v*dir[0];
obs[1]+=v*dir[1];
obs[2]+=v*dir[2];
rainParticle::setRainingArea(obs[0]-7.0f,-0.2f,obs[2]-7.0f,obs[0]+7.0f,8.0f,obs[2]+7.0f);
}
static void printstring(void *font, char *string)
{
int len,i;
len=(int)strlen(string);
for(i=0;i<len;i++)
glutBitmapCharacter(font,string[i]);
}
static void reshape(int width, int height)
{
WIDTH=width;
HEIGHT=height;
glViewport(0,0,(GLint)width,(GLint)height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(70.0,width/(float)height,0.1,30.0);
glMatrixMode(GL_MODELVIEW);
}
static void printhelp(void)
{
glEnable(GL_BLEND);
glColor4f(0.0,0.0,0.0,0.5);
glRecti(40,40,600,440);
glDisable(GL_BLEND);
glColor3f(1.0,0.0,0.0);
glRasterPos2i(300,420);
printstring(GLUT_BITMAP_TIMES_ROMAN_24,"Help");
glRasterPos2i(60,390);
printstring(GLUT_BITMAP_TIMES_ROMAN_24,"h - Togle Help");
glRasterPos2i(60,360);
printstring(GLUT_BITMAP_TIMES_ROMAN_24,"f - Togle Fog");
glRasterPos2i(60,330);
printstring(GLUT_BITMAP_TIMES_ROMAN_24,"Arrow Keys - Rotate");
glRasterPos2i(60,300);
printstring(GLUT_BITMAP_TIMES_ROMAN_24,"a - Increase velocity");
glRasterPos2i(60,270);
printstring(GLUT_BITMAP_TIMES_ROMAN_24,"z - Decrease velocity");
glRasterPos2i(60,240);
printstring(GLUT_BITMAP_TIMES_ROMAN_24,"l - Increase rain length");
glRasterPos2i(60,210);
printstring(GLUT_BITMAP_TIMES_ROMAN_24,"k - Increase rain length");
}
static void drawrain(void)
{
static int count=0;
static char frbuf[80];
float fr;
glEnable(GL_DEPTH_TEST);
if(fog)
glEnable(GL_FOG);
else
glDisable(GL_FOG);
glDepthMask(GL_TRUE);
glClearColor(1.0,1.0,1.0,1.0);
glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
glPushMatrix();
calcposobs();
gluLookAt(obs[0],obs[1],obs[2],
obs[0]+dir[0],obs[1]+dir[1],obs[2]+dir[2],
0.0,1.0,0.0);
glColor4f(1.0,1.0,1.0,1.0);
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D,groundid);
glBegin(GL_QUADS);
glTexCoord2fv(qt[0]);
glVertex3fv(q[0]);
glTexCoord2fv(qt[1]);
glVertex3fv(q[1]);
glTexCoord2fv(qt[2]);
glVertex3fv(q[2]);
glTexCoord2fv(qt[3]);
glVertex3fv(q[3]);
glEnd();
// Particle System
glDisable(GL_TEXTURE_2D);
glShadeModel(GL_SMOOTH);
glEnable(GL_BLEND);
ps->draw();
ps->addTime(gettimerain());
glShadeModel(GL_FLAT);
if((count % FRAME)==0) {
fr=gettime();
sprintf(frbuf,"Frame rate: %f",FRAME/fr);
}
glDisable(GL_TEXTURE_2D);
glDisable(GL_DEPTH_TEST);
glDisable(GL_FOG);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(-0.5,639.5,-0.5,479.5,-1.0,1.0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glColor3f(1.0,0.0,0.0);
glRasterPos2i(10,10);
printstring(GLUT_BITMAP_HELVETICA_18,frbuf);
glRasterPos2i(350,470);
printstring(GLUT_BITMAP_HELVETICA_10,"Rain V1.0 Written by David Bucciarelli (humanware@plus.it)");
if(help)
printhelp();
reshape(WIDTH,HEIGHT);
glPopMatrix();
glutSwapBuffers();
count++;
}
static void special(int key, int x, int y)
{
switch (key) {
case GLUT_KEY_LEFT:
alpha+=2.0;
break;
case GLUT_KEY_RIGHT:
alpha-=2.0;
break;
case GLUT_KEY_DOWN:
beta-=2.0;
break;
case GLUT_KEY_UP:
beta+=2.0;
break;
}
}
static void key(unsigned char key, int x, int y)
{
switch (key) {
case 27:
exit(0);
break;
case 'a':
v+=0.01;
break;
case 'z':
v-=0.01;
break;
case 'l':
rainParticle::setLength(rainParticle::getLength()+0.025f);
break;
case 'k':
rainParticle::setLength(rainParticle::getLength()-0.025f);
break;
case 'h':
help=(!help);
break;
case 'f':
fog=(!fog);
break;
#ifdef XMESA
case ' ':
XMesaSetFXmode(fullscreen ? XMESA_FX_FULLSCREEN : XMESA_FX_WINDOW);
fullscreen=(!fullscreen);
break;
#endif
}
}
static void inittextures(void)
{
IMAGE *img;
GLenum gluerr;
glGenTextures(1,&groundid);
glBindTexture(GL_TEXTURE_2D,groundid);
if(!(img=ImageLoad("s128.rgb"))) {
fprintf(stderr,"Error reading a texture.\n");
exit(-1);
}
glPixelStorei(GL_UNPACK_ALIGNMENT,4);
if((gluerr=(GLenum)gluBuild2DMipmaps(GL_TEXTURE_2D, 3, img->sizeX, img->sizeY, GL_RGB,
GL_UNSIGNED_BYTE, (GLvoid *)(img->data)))) {
fprintf(stderr,"GLULib%s\n",gluErrorString(gluerr));
exit(-1);
}
glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,GL_REPEAT);
glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,GL_REPEAT);
glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR_MIPMAP_LINEAR);
glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);
glTexEnvf(GL_TEXTURE_ENV,GL_TEXTURE_ENV_MODE,GL_DECAL);
}
static void initparticle(void)
{
ps=new particleSystem;
rainParticle::setRainingArea(-7.0f,-0.2f,-7.0f,7.0f,8.0f,7.0f);
for(int i=0;i<NUMPART;i++) {
rainParticle *p=new rainParticle;
p->randomHeight();
ps->addParticle((particle *)p);
}
}
int main(int ac,char **av)
{
fprintf(stderr,"Rain V1.0\nWritten by David Bucciarelli (humanware@plus.it)\n");
/* Default settings */
WIDTH=640;
HEIGHT=480;
glutInitWindowPosition(0,0);
glutInitWindowSize(WIDTH,HEIGHT);
glutInit(&ac,av);
glutInitDisplayMode(GLUT_RGB|GLUT_DEPTH|GLUT_DOUBLE);
if(!(win=glutCreateWindow("Rain"))) {
fprintf(stderr,"Error opening a window.\n");
exit(-1);
}
reshape(WIDTH,HEIGHT);
inittextures();
glShadeModel(GL_FLAT);
glEnable(GL_DEPTH_TEST);
glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_FOG);
glFogi(GL_FOG_MODE,GL_EXP);
glFogfv(GL_FOG_COLOR,fogcolor);
glFogf(GL_FOG_DENSITY,0.1);
#ifdef FX
glHint(GL_FOG_HINT,GL_NICEST);
#endif
initparticle();
glutKeyboardFunc(key);
glutSpecialFunc(special);
glutDisplayFunc(drawrain);
glutIdleFunc(drawrain);
glutReshapeFunc(reshape);
glutMainLoop();
return(0);
}

908
progs/demos/ray.c Normal file
View File

@@ -0,0 +1,908 @@
/*
* This program is under the GNU GPL.
* Use at your own risk.
*
* written by David Bucciarelli (tech.hmw@plus.it)
* Humanware s.r.l.
*/
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#ifdef WIN32
#include <windows.h>
#endif
#include <GL/glut.h>
#ifdef XMESA
#include "GL/xmesa.h"
static int fullscreen = 1;
#endif
static int WIDTH = 640;
static int HEIGHT = 480;
#define FRAME 50
#define BASESIZE 7.5f
#define SPHERE_RADIUS 0.75f
#define TEX_CHECK_WIDTH 256
#define TEX_CHECK_HEIGHT 256
#define TEX_CHECK_SLOT_SIZE (TEX_CHECK_HEIGHT/16)
#define TEX_CHECK_NUMSLOT (TEX_CHECK_HEIGHT/TEX_CHECK_SLOT_SIZE)
#define TEX_REFLECT_WIDTH 256
#define TEX_REFLECT_HEIGHT 256
#define TEX_REFLECT_SLOT_SIZE (TEX_REFLECT_HEIGHT/16)
#define TEX_REFLECT_NUMSLOT (TEX_REFLECT_HEIGHT/TEX_REFLECT_SLOT_SIZE)
#ifndef M_PI
#define M_PI 3.1415926535
#endif
#define EPSILON 0.0001
#define clamp255(a) ( (a)<(0.0f) ? (0.0f) : ((a)>(255.0f) ? (255.0f) : (a)) )
#define fabs(x) ((x)<0.0f?-(x):(x))
#define vequ(a,b) { (a)[0]=(b)[0]; (a)[1]=(b)[1]; (a)[2]=(b)[2]; }
#define vsub(a,b,c) { (a)[0]=(b)[0]-(c)[0]; (a)[1]=(b)[1]-(c)[1]; (a)[2]=(b)[2]-(c)[2]; }
#define dprod(a,b) ((a)[0]*(b)[0]+(a)[1]*(b)[1]+(a)[2]*(b)[2])
#define vnormalize(a,b) { \
register float m_norm; \
m_norm=sqrt((double)dprod((a),(a))); \
(a)[0] /=m_norm; \
(a)[1] /=m_norm; \
(a)[2] /=m_norm; }
static GLubyte checkmap[TEX_CHECK_HEIGHT][TEX_CHECK_WIDTH][3];
static GLuint checkid;
static int checkmap_currentslot = 0;
static GLubyte reflectmap[TEX_REFLECT_HEIGHT][TEX_REFLECT_WIDTH][3];
static GLuint reflectid;
static int reflectmap_currentslot = 0;
static GLuint lightdlist;
static GLuint objdlist;
static float lightpos[3] = { 2.1, 2.1, 2.8 };
static float objpos[3] = { 0.0, 0.0, 1.0 };
static float sphere_pos[TEX_CHECK_HEIGHT][TEX_REFLECT_WIDTH][3];
static int win = 0;
static float fogcolor[4] = { 0.05, 0.05, 0.05, 1.0 };
static float obs[3] = { 7.0, 0.0, 2.0 };
static float dir[3];
static float v = 0.0;
static float alpha = -90.0;
static float beta = 90.0;
static int fog = 1;
static int bfcull = 1;
static int poutline = 0;
static int help = 1;
static int showcheckmap = 1;
static int showreflectmap = 1;
static int joyavailable = 0;
static int joyactive = 0;
static float
gettime(void)
{
static float told = 0.0f;
float tnew, ris;
tnew = glutGet(GLUT_ELAPSED_TIME);
ris = tnew - told;
told = tnew;
return ris / 1000.0;
}
static void
calcposobs(void)
{
dir[0] = sin(alpha * M_PI / 180.0);
dir[1] = cos(alpha * M_PI / 180.0) * sin(beta * M_PI / 180.0);
dir[2] = cos(beta * M_PI / 180.0);
obs[0] += v * dir[0];
obs[1] += v * dir[1];
obs[2] += v * dir[2];
}
static void
special(int k, int x, int y)
{
switch (k) {
case GLUT_KEY_LEFT:
alpha -= 2.0;
break;
case GLUT_KEY_RIGHT:
alpha += 2.0;
break;
case GLUT_KEY_DOWN:
beta -= 2.0;
break;
case GLUT_KEY_UP:
beta += 2.0;
break;
}
}
static void
key(unsigned char k, int x, int y)
{
switch (k) {
case 27:
exit(0);
break;
case 's':
lightpos[1] -= 0.1;
break;
case 'd':
lightpos[1] += 0.1;
break;
case 'e':
lightpos[0] -= 0.1;
break;
case 'x':
lightpos[0] += 0.1;
break;
case 'w':
lightpos[2] -= 0.1;
break;
case 'r':
lightpos[2] += 0.1;
break;
case 'j':
objpos[1] -= 0.1;
break;
case 'k':
objpos[1] += 0.1;
break;
case 'i':
objpos[0] -= 0.1;
break;
case 'm':
objpos[0] += 0.1;
break;
case 'u':
objpos[2] -= 0.1;
break;
case 'o':
objpos[2] += 0.1;
break;
case 'a':
v += 0.005;
break;
case 'z':
v -= 0.005;
break;
case 'g':
joyactive = (!joyactive);
break;
case 'h':
help = (!help);
break;
case 'f':
fog = (!fog);
break;
case '1':
showcheckmap = (!showcheckmap);
break;
case '2':
showreflectmap = (!showreflectmap);
break;
case 'b':
if (bfcull) {
glDisable(GL_CULL_FACE);
bfcull = 0;
}
else {
glEnable(GL_CULL_FACE);
bfcull = 1;
}
break;
case 'p':
if (poutline) {
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
poutline = 0;
}
else {
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
poutline = 1;
}
break;
#ifdef XMESA
case ' ':
XMesaSetFXmode(fullscreen ? XMESA_FX_FULLSCREEN : XMESA_FX_WINDOW);
fullscreen = (!fullscreen);
break;
#endif
}
}
static void
reshape(int w, int h)
{
WIDTH = w;
HEIGHT = h;
glViewport(0, 0, w, h);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(45.0, w / (float) h, 0.8, 40.0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
}
static void
printstring(void *font, char *string)
{
int len, i;
len = (int) strlen(string);
for (i = 0; i < len; i++)
glutBitmapCharacter(font, string[i]);
}
static void
printhelp(void)
{
glEnable(GL_BLEND);
glColor4f(0.5, 0.5, 0.5, 0.5);
glRecti(40, 40, 600, 440);
glDisable(GL_BLEND);
glColor3f(0.0, 0.0, 1.0);
glRasterPos2i(300, 420);
printstring(GLUT_BITMAP_HELVETICA_18, "Help");
glRasterPos2i(60, 390);
printstring(GLUT_BITMAP_HELVETICA_12, "h - Togle Help");
glRasterPos2i(60, 370);
printstring(GLUT_BITMAP_HELVETICA_12, "f - Togle Fog");
glRasterPos2i(60, 350);
printstring(GLUT_BITMAP_HELVETICA_12, "b - Togle Back face culling");
glRasterPos2i(60, 330);
printstring(GLUT_BITMAP_HELVETICA_12, "p - Togle Wire frame");
glRasterPos2i(60, 310);
printstring(GLUT_BITMAP_HELVETICA_12, "Arrow Keys - Rotate");
glRasterPos2i(60, 290);
printstring(GLUT_BITMAP_HELVETICA_12, "a - Increase velocity");
glRasterPos2i(60, 270);
printstring(GLUT_BITMAP_HELVETICA_12, "z - Decrease velocity");
glRasterPos2i(60, 250);
if (joyavailable)
printstring(GLUT_BITMAP_HELVETICA_12,
"j - Togle jostick control (Joystick control available)");
else
printstring(GLUT_BITMAP_HELVETICA_12,
"(No Joystick control available)");
glRasterPos2i(60, 230);
printstring(GLUT_BITMAP_HELVETICA_12,
"To move the light source: s - left, d - right, e - far, x - near, w - down r - up");
glRasterPos2i(60, 210);
printstring(GLUT_BITMAP_HELVETICA_12,
"To move the mirror sphere: j - left, k - right, i - far, m - near, u - down o - up");
glRasterPos2i(60, 190);
printstring(GLUT_BITMAP_HELVETICA_12,
"1 - Togle the plane texture map window");
glRasterPos2i(60, 170);
printstring(GLUT_BITMAP_HELVETICA_12,
"2 - Togle the sphere texture map window");
}
static GLboolean
seelight(float p[3], float dir[3])
{
float c[3], b, a, d, t, dist[3];
vsub(c, p, objpos);
b = -dprod(c, dir);
a = dprod(c, c) - SPHERE_RADIUS * SPHERE_RADIUS;
if ((d = b * b - a) < 0.0 || (b < 0.0 && a > 0.0))
return GL_FALSE;
d = sqrt(d);
t = b - d;
if (t < EPSILON) {
t = b + d;
if (t < EPSILON)
return GL_FALSE;
}
vsub(dist, lightpos, p);
if (dprod(dist, dist) < t * t)
return GL_FALSE;
return GL_TRUE;
}
static int
colorcheckmap(float ppos[3], float c[3])
{
static float norm[3] = { 0.0f, 0.0f, 1.0f };
float ldir[3], vdir[3], h[3], dfact, kfact, r, g, b;
int x, y;
x = (int) ((ppos[0] + BASESIZE / 2) * (10.0f / BASESIZE));
if ((x < 0) || (x > 10))
return GL_FALSE;
y = (int) ((ppos[1] + BASESIZE / 2) * (10.0f / BASESIZE));
if ((y < 0) || (y > 10))
return GL_FALSE;
r = 255.0f;
if (y & 1) {
if (x & 1)
g = 255.0f;
else
g = 0.0f;
}
else {
if (x & 1)
g = 0.0f;
else
g = 255.0f;
}
b = 0.0f;
vsub(ldir, lightpos, ppos);
vnormalize(ldir, ldir);
if (seelight(ppos, ldir)) {
c[0] = r * 0.05f;
c[1] = g * 0.05f;
c[2] = b * 0.05f;
return GL_TRUE;
}
dfact = dprod(ldir, norm);
if (dfact < 0.0f)
dfact = 0.0f;
vsub(vdir, obs, ppos);
vnormalize(vdir, vdir);
h[0] = 0.5f * (vdir[0] + ldir[0]);
h[1] = 0.5f * (vdir[1] + ldir[1]);
h[2] = 0.5f * (vdir[2] + ldir[2]);
kfact = dprod(h, norm);
kfact =
kfact * kfact * kfact * kfact * kfact * kfact * kfact * 7.0f * 255.0f;
r = r * dfact + kfact;
g = g * dfact + kfact;
b = b * dfact + kfact;
c[0] = clamp255(r);
c[1] = clamp255(g);
c[2] = clamp255(b);
return GL_TRUE;
}
static void
updatecheckmap(int slot)
{
float c[3], ppos[3];
int x, y;
glBindTexture(GL_TEXTURE_2D, checkid);
ppos[2] = 0.0f;
for (y = slot * TEX_CHECK_SLOT_SIZE; y < (slot + 1) * TEX_CHECK_SLOT_SIZE;
y++) {
ppos[1] = (y / (float) TEX_CHECK_HEIGHT) * BASESIZE - BASESIZE / 2;
for (x = 0; x < TEX_CHECK_WIDTH; x++) {
ppos[0] = (x / (float) TEX_CHECK_WIDTH) * BASESIZE - BASESIZE / 2;
colorcheckmap(ppos, c);
checkmap[y][x][0] = (GLubyte) c[0];
checkmap[y][x][1] = (GLubyte) c[1];
checkmap[y][x][2] = (GLubyte) c[2];
}
}
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, slot * TEX_CHECK_SLOT_SIZE,
TEX_CHECK_WIDTH, TEX_CHECK_SLOT_SIZE, GL_RGB,
GL_UNSIGNED_BYTE,
&checkmap[slot * TEX_CHECK_SLOT_SIZE][0][0]);
}
static void
updatereflectmap(int slot)
{
float rf, r, g, b, t, dfact, kfact, rdir[3];
float rcol[3], ppos[3], norm[3], ldir[3], h[3], vdir[3], planepos[3];
int x, y;
glBindTexture(GL_TEXTURE_2D, reflectid);
for (y = slot * TEX_REFLECT_SLOT_SIZE;
y < (slot + 1) * TEX_REFLECT_SLOT_SIZE; y++)
for (x = 0; x < TEX_REFLECT_WIDTH; x++) {
ppos[0] = sphere_pos[y][x][0] + objpos[0];
ppos[1] = sphere_pos[y][x][1] + objpos[1];
ppos[2] = sphere_pos[y][x][2] + objpos[2];
vsub(norm, ppos, objpos);
vnormalize(norm, norm);
vsub(ldir, lightpos, ppos);
vnormalize(ldir, ldir);
vsub(vdir, obs, ppos);
vnormalize(vdir, vdir);
rf = 2.0f * dprod(norm, vdir);
if (rf > EPSILON) {
rdir[0] = rf * norm[0] - vdir[0];
rdir[1] = rf * norm[1] - vdir[1];
rdir[2] = rf * norm[2] - vdir[2];
t = -objpos[2] / rdir[2];
if (t > EPSILON) {
planepos[0] = objpos[0] + t * rdir[0];
planepos[1] = objpos[1] + t * rdir[1];
planepos[2] = 0.0f;
if (!colorcheckmap(planepos, rcol))
rcol[0] = rcol[1] = rcol[2] = 0.0f;
}
else
rcol[0] = rcol[1] = rcol[2] = 0.0f;
}
else
rcol[0] = rcol[1] = rcol[2] = 0.0f;
dfact = 0.1f * dprod(ldir, norm);
if (dfact < 0.0f) {
dfact = 0.0f;
kfact = 0.0f;
}
else {
h[0] = 0.5f * (vdir[0] + ldir[0]);
h[1] = 0.5f * (vdir[1] + ldir[1]);
h[2] = 0.5f * (vdir[2] + ldir[2]);
kfact = dprod(h, norm);
kfact *= kfact;
kfact *= kfact;
kfact *= kfact;
kfact *= kfact;
kfact *= 10.0f;
}
r = dfact + kfact;
g = dfact + kfact;
b = dfact + kfact;
r *= 255.0f;
g *= 255.0f;
b *= 255.0f;
r += rcol[0];
g += rcol[1];
b += rcol[2];
r = clamp255(r);
g = clamp255(g);
b = clamp255(b);
reflectmap[y][x][0] = (GLubyte) r;
reflectmap[y][x][1] = (GLubyte) g;
reflectmap[y][x][2] = (GLubyte) b;
}
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, slot * TEX_REFLECT_SLOT_SIZE,
TEX_REFLECT_WIDTH, TEX_REFLECT_SLOT_SIZE, GL_RGB,
GL_UNSIGNED_BYTE,
&reflectmap[slot * TEX_REFLECT_SLOT_SIZE][0][0]);
}
static void
drawbase(void)
{
glColor3f(0.0, 0.0, 0.0);
glBindTexture(GL_TEXTURE_2D, checkid);
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
glBegin(GL_QUADS);
glTexCoord2f(0.0f, 0.0f);
glVertex3f(-BASESIZE / 2.0f, -BASESIZE / 2.0f, 0.0f);
glTexCoord2f(1.0f, 0.0f);
glVertex3f(BASESIZE / 2.0f, -BASESIZE / 2.0f, 0.0f);
glTexCoord2f(1.0f, 1.0f);
glVertex3f(BASESIZE / 2.0f, BASESIZE / 2.0f, 0.0f);
glTexCoord2f(0.0f, 1.0f);
glVertex3f(-BASESIZE / 2.0f, BASESIZE / 2.0f, 0.0f);
glEnd();
}
static void
drawobj(void)
{
glColor3f(0.0, 0.0, 0.0);
glBindTexture(GL_TEXTURE_2D, reflectid);
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
glPushMatrix();
glTranslatef(objpos[0], objpos[1], objpos[2]);
glCallList(objdlist);
glPopMatrix();
}
static void
dojoy(void)
{
#ifdef WIN32
static UINT max[2] = { 0, 0 };
static UINT min[2] = { 0xffffffff, 0xffffffff }, center[2];
MMRESULT res;
JOYINFO joy;
res = joyGetPos(JOYSTICKID1, &joy);
if (res == JOYERR_NOERROR) {
joyavailable = 1;
if (max[0] < joy.wXpos)
max[0] = joy.wXpos;
if (min[0] > joy.wXpos)
min[0] = joy.wXpos;
center[0] = (max[0] + min[0]) / 2;
if (max[1] < joy.wYpos)
max[1] = joy.wYpos;
if (min[1] > joy.wYpos)
min[1] = joy.wYpos;
center[1] = (max[1] + min[1]) / 2;
if (joyactive) {
if (fabs(center[0] - (float) joy.wXpos) > 0.1 * (max[0] - min[0]))
alpha -=
2.5 * (center[0] - (float) joy.wXpos) / (max[0] - min[0]);
if (fabs(center[1] - (float) joy.wYpos) > 0.1 * (max[1] - min[1]))
beta += 2.5 * (center[1] - (float) joy.wYpos) / (max[1] - min[1]);
if (joy.wButtons & JOY_BUTTON1)
v += 0.005;
if (joy.wButtons & JOY_BUTTON2)
v -= 0.005;
}
}
else
joyavailable = 0;
#endif
}
static void
updatemaps(void)
{
updatecheckmap(checkmap_currentslot);
checkmap_currentslot = (checkmap_currentslot + 1) % TEX_CHECK_NUMSLOT;
updatereflectmap(reflectmap_currentslot);
reflectmap_currentslot =
(reflectmap_currentslot + 1) % TEX_REFLECT_NUMSLOT;
}
static void
draw(void)
{
static int count = 0;
static char frbuf[80];
float fr;
dojoy();
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glEnable(GL_TEXTURE_2D);
glEnable(GL_DEPTH_TEST);
if (fog)
glEnable(GL_FOG);
else
glDisable(GL_FOG);
glPushMatrix();
calcposobs();
gluLookAt(obs[0], obs[1], obs[2],
obs[0] + dir[0], obs[1] + dir[1], obs[2] + dir[2],
0.0, 0.0, 1.0);
drawbase();
drawobj();
glColor3f(1.0, 1.0, 1.0);
glDisable(GL_TEXTURE_2D);
glPushMatrix();
glTranslatef(lightpos[0], lightpos[1], lightpos[2]);
glCallList(lightdlist);
glPopMatrix();
glPopMatrix();
if ((count % FRAME) == 0) {
fr = gettime();
sprintf(frbuf, "Frame rate: %f", FRAME / fr);
}
glDisable(GL_DEPTH_TEST);
glDisable(GL_FOG);
glMatrixMode(GL_PROJECTION);
glPushMatrix();
glLoadIdentity();
glOrtho(-0.5, 639.5, -0.5, 479.5, -1.0, 1.0);
glMatrixMode(GL_MODELVIEW);
glColor3f(0.0f, 0.3f, 1.0f);
if (showcheckmap) {
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, checkid);
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
glBegin(GL_QUADS);
glTexCoord2f(1.0f, 0.0f);
glVertex2i(10, 30);
glTexCoord2f(1.0f, 1.0f);
glVertex2i(10 + 90, 30);
glTexCoord2f(0.0f, 1.0f);
glVertex2i(10 + 90, 30 + 90);
glTexCoord2f(0.0f, 0.0f);
glVertex2i(10, 30 + 90);
glEnd();
glDisable(GL_TEXTURE_2D);
glBegin(GL_LINE_LOOP);
glVertex2i(10, 30);
glVertex2i(10 + 90, 30);
glVertex2i(10 + 90, 30 + 90);
glVertex2i(10, 30 + 90);
glEnd();
glRasterPos2i(105, 65);
printstring(GLUT_BITMAP_HELVETICA_18, "Plane Texture Map");
}
if (showreflectmap) {
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, reflectid);
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
glBegin(GL_QUADS);
glTexCoord2f(1.0f, 0.0f);
glVertex2i(540, 30);
glTexCoord2f(1.0f, 1.0f);
glVertex2i(540 + 90, 30);
glTexCoord2f(0.0f, 1.0f);
glVertex2i(540 + 90, 30 + 90);
glTexCoord2f(0.0f, 0.0f);
glVertex2i(540, 30 + 90);
glEnd();
glDisable(GL_TEXTURE_2D);
glBegin(GL_LINE_LOOP);
glVertex2i(540, 30);
glVertex2i(540 + 90, 30);
glVertex2i(540 + 90, 30 + 90);
glVertex2i(540, 30 + 90);
glEnd();
glRasterPos2i(360, 65);
printstring(GLUT_BITMAP_HELVETICA_18, "Sphere Texture Map");
}
glDisable(GL_TEXTURE_2D);
glRasterPos2i(10, 10);
printstring(GLUT_BITMAP_HELVETICA_18, frbuf);
glRasterPos2i(360, 470);
printstring(GLUT_BITMAP_HELVETICA_10,
"Ray V1.0 Written by David Bucciarelli (tech.hmw@plus.it)");
if (help)
printhelp();
glMatrixMode(GL_PROJECTION);
glPopMatrix();
glMatrixMode(GL_MODELVIEW);
updatemaps();
glutSwapBuffers();
count++;
}
static void
inittextures(void)
{
int y;
glGenTextures(1, &checkid);
glBindTexture(GL_TEXTURE_2D, checkid);
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
glTexImage2D(GL_TEXTURE_2D, 0, 3, TEX_CHECK_WIDTH, TEX_CHECK_HEIGHT,
0, GL_RGB, GL_UNSIGNED_BYTE, checkmap);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
for (y = 0; y < TEX_CHECK_NUMSLOT; y++)
updatecheckmap(y);
glGenTextures(1, &reflectid);
glBindTexture(GL_TEXTURE_2D, reflectid);
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
glTexImage2D(GL_TEXTURE_2D, 0, 3, TEX_REFLECT_WIDTH, TEX_REFLECT_HEIGHT,
0, GL_RGB, GL_UNSIGNED_BYTE, reflectmap);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
for (y = 0; y < TEX_REFLECT_NUMSLOT; y++)
updatereflectmap(y);
}
static void
initspherepos(void)
{
float alpha, beta, sa, ca, sb, cb;
int x, y;
for (y = 0; y < TEX_REFLECT_HEIGHT; y++) {
beta = M_PI - y * (M_PI / TEX_REFLECT_HEIGHT);
for (x = 0; x < TEX_REFLECT_WIDTH; x++) {
alpha = -x * (2.0f * M_PI / TEX_REFLECT_WIDTH);
sa = sin(alpha);
ca = cos(alpha);
sb = sin(beta);
cb = cos(beta);
sphere_pos[y][x][0] = SPHERE_RADIUS * sa * sb;
sphere_pos[y][x][1] = SPHERE_RADIUS * ca * sb;
sphere_pos[y][x][2] = SPHERE_RADIUS * cb;
}
}
}
static void
initdlists(void)
{
GLUquadricObj *obj;
obj = gluNewQuadric();
lightdlist = glGenLists(1);
glNewList(lightdlist, GL_COMPILE);
gluQuadricDrawStyle(obj, GLU_FILL);
gluQuadricNormals(obj, GLU_NONE);
gluQuadricTexture(obj, GL_TRUE);
gluSphere(obj, 0.25f, 6, 6);
glEndList();
objdlist = glGenLists(1);
glNewList(objdlist, GL_COMPILE);
gluQuadricDrawStyle(obj, GLU_FILL);
gluQuadricNormals(obj, GLU_NONE);
gluQuadricTexture(obj, GL_TRUE);
gluSphere(obj, SPHERE_RADIUS, 16, 16);
glEndList();
}
int
main(int ac, char **av)
{
fprintf(stderr,
"Ray V1.0\nWritten by David Bucciarelli (tech.hmw@plus.it)\n");
/*
if(!SetPriorityClass(GetCurrentProcess(),REALTIME_PRIORITY_CLASS)) {
fprintf(stderr,"Error setting the process class.\n");
return 0;
}
if(!SetThreadPriority(GetCurrentThread(),THREAD_PRIORITY_TIME_CRITICAL)) {
fprintf(stderr,"Error setting the process priority.\n");
return 0;
}
*/
glutInitWindowPosition(0, 0);
glutInitWindowSize(WIDTH, HEIGHT);
glutInit(&ac, av);
glutInitDisplayMode(GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE);
if (!(win = glutCreateWindow("Ray"))) {
fprintf(stderr, "Error, couldn't open window\n");
return -1;
}
reshape(WIDTH, HEIGHT);
glShadeModel(GL_FLAT);
glEnable(GL_DEPTH_TEST);
glDepthFunc(GL_LEQUAL);
glEnable(GL_CULL_FACE);
glEnable(GL_TEXTURE_2D);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_FOG);
glFogi(GL_FOG_MODE, GL_EXP2);
glFogfv(GL_FOG_COLOR, fogcolor);
glFogf(GL_FOG_DENSITY, 0.01);
#ifdef FX
glHint(GL_FOG_HINT, GL_NICEST);
#endif
calcposobs();
initspherepos();
inittextures();
initdlists();
glClearColor(fogcolor[0], fogcolor[1], fogcolor[2], fogcolor[3]);
glutReshapeFunc(reshape);
glutDisplayFunc(draw);
glutKeyboardFunc(key);
glutSpecialFunc(special);
glutIdleFunc(draw);
glutMainLoop();
return 0;
}

270
progs/demos/readpix.c Normal file
View File

@@ -0,0 +1,270 @@
/* $Id: readpix.c,v 1.3 2000/03/31 01:01:31 brianp Exp $ */
/*
* glReadPixels and glCopyPixels test
*
* Brian Paul March 1, 2000 This file is in the public domain.
*/
/*
* $Log: readpix.c,v $
* Revision 1.3 2000/03/31 01:01:31 brianp
* tweaks to allow different read formats/types
*
* Revision 1.2 2000/03/23 19:47:25 brianp
* added benchmarking
*
* Revision 1.1 2000/03/01 16:23:14 brianp
* test glDraw/Read/CopyPixels()
*
*/
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <GL/glut.h>
#include "../util/readtex.c" /* a hack, I know */
#define IMAGE_FILE "../images/girl.rgb"
static int ImgWidth, ImgHeight;
static GLenum ImgFormat;
static GLubyte *Image = NULL;
static int APosX, APosY; /* simple drawpixels */
static int BPosX, BPosY; /* read/draw pixels */
static int CPosX, CPosY; /* copypixels */
static GLboolean DrawFront = GL_FALSE;
static GLboolean ScaleAndBias = GL_FALSE;
static GLboolean Benchmark = GL_FALSE;
static GLubyte *TempImage = NULL;
#if 1
#define ReadFormat ImgFormat
#define ReadType GL_UNSIGNED_BYTE
#endif
#if 0
static GLenum ReadFormat = GL_RGBA;
static GLenum ReadType = GL_UNSIGNED_BYTE;
#endif
#if 0
static GLenum ReadFormat = GL_RGB;
static GLenum ReadType = GL_UNSIGNED_SHORT_5_6_5;
#endif
static void
Reset( void )
{
APosX = 5; APosY = 20;
BPosX = APosX + ImgWidth + 5; BPosY = 20;
CPosX = BPosX + ImgWidth + 5; CPosY = 20;
}
static void
PrintString(const char *s)
{
while (*s) {
glutBitmapCharacter(GLUT_BITMAP_8_BY_13, (int) *s);
s++;
}
}
static void
SetupPixelTransfer(GLboolean invert)
{
if (invert) {
glPixelTransferf(GL_RED_SCALE, -1.0);
glPixelTransferf(GL_RED_BIAS, 1.0);
glPixelTransferf(GL_GREEN_SCALE, -1.0);
glPixelTransferf(GL_GREEN_BIAS, 1.0);
glPixelTransferf(GL_BLUE_SCALE, -1.0);
glPixelTransferf(GL_BLUE_BIAS, 1.0);
}
else {
glPixelTransferf(GL_RED_SCALE, 1.0);
glPixelTransferf(GL_RED_BIAS, 0.0);
glPixelTransferf(GL_GREEN_SCALE, 1.0);
glPixelTransferf(GL_GREEN_BIAS, 0.0);
glPixelTransferf(GL_BLUE_SCALE, 1.0);
glPixelTransferf(GL_BLUE_BIAS, 0.0);
}
}
static void
Display( void )
{
glClear( GL_COLOR_BUFFER_BIT );
glRasterPos2i(5, ImgHeight+25);
PrintString("f = toggle front/back s = toggle scale/bias b = benchmark");
/* draw original image */
glRasterPos2i(APosX, 5);
PrintString("Original");
glRasterPos2i(APosX, APosY);
glEnable(GL_DITHER);
SetupPixelTransfer(GL_FALSE);
glDrawPixels(ImgWidth, ImgHeight, ImgFormat, GL_UNSIGNED_BYTE, Image);
/* do readpixels, drawpixels */
glRasterPos2i(BPosX, 5);
PrintString("Read/DrawPixels");
SetupPixelTransfer(ScaleAndBias);
if (Benchmark) {
GLint reads = 0;
GLint endTime;
GLint startTime = glutGet(GLUT_ELAPSED_TIME);
GLdouble seconds, pixelsPerSecond;
printf("Benchmarking...\n");
do {
glReadPixels(APosX, APosY, ImgWidth, ImgHeight,
ReadFormat, ReadType, TempImage);
reads++;
endTime = glutGet(GLUT_ELAPSED_TIME);
} while (endTime - startTime < 4000); /* 4 seconds */
seconds = (double) (endTime - startTime) / 1000.0;
pixelsPerSecond = reads * ImgWidth * ImgHeight / seconds;
printf("Result: %d reads in %f seconds = %f pixels/sec\n",
reads, seconds, pixelsPerSecond);
Benchmark = GL_FALSE;
}
else {
glReadPixels(APosX, APosY, ImgWidth, ImgHeight,
ReadFormat, ReadType, TempImage);
}
glRasterPos2i(BPosX, BPosY);
glDisable(GL_DITHER);
SetupPixelTransfer(GL_FALSE);
glDrawPixels(ImgWidth, ImgHeight, ReadFormat, ReadType, TempImage);
/* do copypixels */
glRasterPos2i(CPosX, 5);
PrintString("CopyPixels");
glRasterPos2i(CPosX, CPosY);
glDisable(GL_DITHER);
SetupPixelTransfer(ScaleAndBias);
glCopyPixels(APosX, APosY, ImgWidth, ImgHeight, GL_COLOR);
if (!DrawFront)
glutSwapBuffers();
}
static void
Reshape( int width, int height )
{
glViewport( 0, 0, width, height );
glMatrixMode( GL_PROJECTION );
glLoadIdentity();
glOrtho( 0.0, width, 0.0, height, -1.0, 1.0 );
glMatrixMode( GL_MODELVIEW );
glLoadIdentity();
}
static void
Key( unsigned char key, int x, int y )
{
(void) x;
(void) y;
switch (key) {
case 'b':
Benchmark = GL_TRUE;
break;
case 's':
ScaleAndBias = !ScaleAndBias;
break;
case 'f':
DrawFront = !DrawFront;
if (DrawFront) {
glDrawBuffer(GL_FRONT);
glReadBuffer(GL_FRONT);
}
else {
glDrawBuffer(GL_BACK);
glReadBuffer(GL_BACK);
}
printf("glDrawBuffer(%s)\n", DrawFront ? "GL_FRONT" : "GL_BACK");
break;
case 27:
exit(0);
break;
}
glutPostRedisplay();
}
static void
Init( GLboolean ciMode )
{
printf("GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
Image = LoadRGBImage( IMAGE_FILE, &ImgWidth, &ImgHeight, &ImgFormat );
if (!Image) {
printf("Couldn't read %s\n", IMAGE_FILE);
exit(0);
}
if (ciMode) {
/* Convert RGB image to grayscale */
GLubyte *indexImage = malloc( ImgWidth * ImgHeight );
GLint i;
for (i=0; i<ImgWidth*ImgHeight; i++) {
int gray = Image[i*3] + Image[i*3+1] + Image[i*3+2];
indexImage[i] = gray / 3;
}
free(Image);
Image = indexImage;
ImgFormat = GL_COLOR_INDEX;
for (i=0;i<255;i++) {
float g = i / 255.0;
glutSetColor(i, g, g, g);
}
}
printf("Loaded %d by %d image\n", ImgWidth, ImgHeight );
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
glPixelStorei(GL_UNPACK_ROW_LENGTH, ImgWidth);
glPixelStorei(GL_PACK_ALIGNMENT, 1);
glPixelStorei(GL_PACK_ROW_LENGTH, ImgWidth);
Reset();
TempImage = (GLubyte *) malloc(ImgWidth * ImgHeight * 4 * sizeof(GLubyte));
assert(TempImage);
}
int
main( int argc, char *argv[] )
{
GLboolean ciMode = GL_FALSE;
if (argc > 1 && strcmp(argv[1], "-ci")==0) {
ciMode = GL_TRUE;
}
glutInit( &argc, argv );
glutInitWindowPosition( 0, 0 );
glutInitWindowSize( 750, 250 );
if (ciMode)
glutInitDisplayMode( GLUT_INDEX | GLUT_DOUBLE );
else
glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE );
glutCreateWindow(argv[0]);
Init(ciMode);
glutReshapeFunc( Reshape );
glutKeyboardFunc( Key );
glutDisplayFunc( Display );
glutMainLoop();
return 0;
}

View File

@@ -1,4 +1,4 @@
/* $Id: reflect.c,v 1.1 1999/08/19 00:55:40 jtg Exp $ */
/* $Id: reflect.c,v 1.3 2000/06/15 14:25:48 brianp Exp $ */
/*
* Demo of a reflective, texture-mapped surface with OpenGL.
@@ -20,70 +20,40 @@
*/
/*
* Dirk Reiners (reiners@igd.fhg.de) made some modifications to this code.
*
* August 1996 - A few optimizations by Brian
* Authors:
* Brian Paul
* Dirk Reiners (reiners@igd.fhg.de) made some modifications to this code.
* Mark Kilgard (April 1997)
* Brian Paul (April 2000 - added keyboard d/s options)
*/
/*
* April, 1997 - Added Mark Kilgard's changes.
*/
/*
* $Log: reflect.c,v $
* Revision 1.1 1999/08/19 00:55:40 jtg
* Initial revision
*
* Revision 3.4 1999/03/28 18:22:05 brianp
* minor clean-up
*
* Revision 3.3 1998/11/22 02:54:29 brianp
* only draw one stack for gluCylinders
*
* Revision 3.2 1998/11/19 02:53:48 brianp
* changed texture image and background color
*
* Revision 3.1 1998/11/05 04:34:04 brianp
* moved image files to ../images/ directory
*
* Revision 3.0 1998/02/14 18:42:29 brianp
* initial rev
*
*/
#define USE_ZBUFFER
/* OK, without hardware support this is overkill. */
#define USE_TEXTURE
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include "GL/glut.h"
#include "../util/readtex.c" /* a hack, I know */
#include "../util/showbuffer.c"
#include "../util/readtex.c"
#define DEG2RAD (3.14159/180.0)
#define TABLE_TEXTURE "../images/tile.rgb"
static int ImgWidth, ImgHeight;
static GLint ImgWidth, ImgHeight;
static GLenum ImgFormat;
static GLubyte *Image = NULL;
#define MAX_OBJECTS 2
static GLint table_list;
static GLint objects_list[MAX_OBJECTS];
static GLfloat xrot, yrot;
static GLfloat spin;
static GLint Width = 400, Height = 300;
static GLenum ShowBuffer = GL_NONE;
static void make_table( void )
@@ -146,16 +116,11 @@ static void make_objects( void )
}
static GLfloat light_pos[] = { 0.0, 20.0, 0.0, 1.0 };
static void init( void )
{
make_table();
make_objects();
/* Setup texture */
#ifdef USE_TEXTURE
Image = LoadRGBImage( TABLE_TEXTURE, &ImgWidth, &ImgHeight, &ImgFormat );
if (!Image) {
printf("Couldn't read %s\n", TABLE_TEXTURE);
@@ -169,17 +134,11 @@ static void init( void )
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT );
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST );
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST );
#endif
xrot = 30.0;
yrot = 50.0;
spin = 0.0;
#ifndef USE_ZBUFFER
glEnable( GL_CULL_FACE );
#endif
glShadeModel( GL_FLAT );
glEnable( GL_LIGHT0 );
@@ -194,12 +153,14 @@ static void init( void )
static void reshape(int w, int h)
{
GLfloat aspect = (float) w / (float) h;
GLfloat yAspect = 2.5;
GLfloat xAspect = yAspect * (float) w / (float) h;
Width = w;
Height = h;
glViewport(0, 0, w, h);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glFrustum( -aspect, aspect, -1.0, 1.0, 4.0, 300.0 );
glFrustum( -xAspect, xAspect, -yAspect, yAspect, 10.0, 30.0 );
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
}
@@ -212,8 +173,7 @@ static void draw_objects( GLfloat eyex, GLfloat eyey, GLfloat eyez )
(void) eyey;
(void) eyez;
#ifndef USE_ZBUFFER
if (eyex<0.5)
{
if (eyex<0.5) {
#endif
glPushMatrix();
glTranslatef( 1.0, 1.5, 0.0 );
@@ -230,9 +190,8 @@ static void draw_objects( GLfloat eyex, GLfloat eyey, GLfloat eyez )
glCallList( objects_list[1] );
glPopMatrix();
#ifndef USE_ZBUFFER
}
else
{
}
else {
glPushMatrix();
glTranslatef( -1.0, 0.85+3.0*fabs( cos(0.01*spin) ), 0.0 );
glRotatef( 0.5*spin, 0.0, 0.5, 1.0 );
@@ -247,7 +206,7 @@ static void draw_objects( GLfloat eyex, GLfloat eyey, GLfloat eyez )
glRotatef( 0.5*spin, 0.0, 0.5, 1.0 );
glCallList( objects_list[0] );
glPopMatrix();
}
}
#endif
}
@@ -262,6 +221,7 @@ static void draw_table( void )
static void draw_scene( void )
{
static GLfloat light_pos[] = { 0.0, 20.0, 0.0, 1.0 };
GLfloat dist = 20.0;
GLfloat eyex, eyey, eyez;
@@ -279,20 +239,15 @@ static void draw_scene( void )
glLightfv( GL_LIGHT0, GL_POSITION, light_pos );
/* draw table into stencil planes */
glEnable( GL_STENCIL_TEST );
#ifdef USE_ZBUFFER
glDisable( GL_DEPTH_TEST );
#endif
glEnable( GL_STENCIL_TEST );
glStencilFunc( GL_ALWAYS, 1, 0xffffffff );
glStencilOp( GL_REPLACE, GL_REPLACE, GL_REPLACE );
glColorMask( GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE );
draw_table();
glColorMask( GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE );
#ifdef USE_ZBUFFER
glEnable( GL_DEPTH_TEST );
#endif
/* render view from below (reflected viewport) */
/* only draw where stencil==1 */
@@ -318,9 +273,7 @@ static void draw_scene( void )
glEnable( GL_BLEND );
glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
#ifdef USE_TEXTURE
glEnable( GL_TEXTURE_2D );
#endif
draw_table();
glDisable( GL_TEXTURE_2D );
glDisable( GL_BLEND );
@@ -334,43 +287,34 @@ static void draw_scene( void )
glPopMatrix();
glutSwapBuffers();
}
#if 0
void draw_scene(void)
{
GLfloat dist = 20.0;
GLfloat eyex, eyey, eyez;
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
eyex = dist * cos(yrot*DEG2RAD) * cos(xrot*DEG2RAD);
eyez = dist * sin(yrot*DEG2RAD) * cos(xrot*DEG2RAD);
eyey = dist * sin(xrot*DEG2RAD);
/* view from top */
glPushMatrix();
gluLookAt( eyex, eyey, eyez, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0 );
draw_table();
glPopMatrix();
if (ShowBuffer == GL_DEPTH) {
ShowDepthBuffer(Width, Height, 1.0, 0.0);
}
else if (ShowBuffer == GL_STENCIL) {
ShowStencilBuffer(Width, Height, 255.0, 0.0);
}
glutSwapBuffers();
}
#endif
static void Key( unsigned char key, int x, int y )
{
(void) x;
(void) y;
if (key==27)
if (key == 'd') {
ShowBuffer = GL_DEPTH;
}
else if (key == 's') {
ShowBuffer = GL_STENCIL;
}
else if (key==27) {
exit(0);
}
else {
ShowBuffer = GL_NONE;
}
glutPostRedisplay();
}
@@ -381,15 +325,13 @@ static void SpecialKey( int key, int x, int y )
switch (key) {
case GLUT_KEY_UP:
xrot += 3.0;
#ifndef USE_ZBUFFER
if ( xrot > 180 ) xrot = 180;
#endif
if ( xrot > 85 )
xrot = 85;
break;
case GLUT_KEY_DOWN:
xrot -= 3.0;
#ifndef USE_ZBUFFER
if ( xrot < 0 ) xrot = 0;
#endif
if ( xrot < 5 )
xrot = 5;
break;
case GLUT_KEY_LEFT:
yrot += 3.0;
@@ -414,22 +356,17 @@ static void idle( void )
int main( int argc, char *argv[] )
{
glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB
#ifdef USE_ZBUFFER
| GLUT_DEPTH
#endif
| GLUT_STENCIL);
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH | GLUT_STENCIL);
glutInitWindowPosition( 0, 0 );
glutInitWindowSize(400, 300 );
glutInitWindowSize( Width, Height );
glutCreateWindow(argv[0]);
glutReshapeFunc(reshape);
glutDisplayFunc(draw_scene);
glutKeyboardFunc(Key);
glutSpecialFunc(SpecialKey);
glutIdleFunc(idle);
init();
glutMainLoop();
return 0;
}

View File

@@ -1,4 +1,4 @@
/* $Id: renormal.c,v 1.1 1999/08/19 00:55:40 jtg Exp $ */
/* $Id: renormal.c,v 1.3 1999/09/17 12:27:01 brianp Exp $ */
/*
* Test GL_EXT_rescale_normal extension
@@ -6,7 +6,7 @@
*/
/*
* $Id: renormal.c,v 1.1 1999/08/19 00:55:40 jtg Exp $
* $Id: renormal.c,v 1.3 1999/09/17 12:27:01 brianp Exp $
*/
@@ -95,6 +95,20 @@ static void ModeMenu(int entry)
glutPostRedisplay();
}
static void
key(unsigned char k, int x, int y)
{
(void) x;
(void) y;
switch (k) {
case 27: /* Escape */
exit(0);
break;
default:
return;
}
glutPostRedisplay();
}
int main( int argc, char *argv[] )
{
@@ -110,6 +124,7 @@ int main( int argc, char *argv[] )
glutIdleFunc( Idle );
glutReshapeFunc( Reshape );
glutDisplayFunc( Display );
glutKeyboardFunc(key);
glutCreateMenu(ModeMenu);
glutAddMenuEntry("Unscaled", UNSCALED);

119
progs/demos/shadow.c Normal file
View File

@@ -0,0 +1,119 @@
/**
(c) Copyright 1993, Silicon Graphics, Inc.
ALL RIGHTS RESERVED
Permission to use, copy, modify, and distribute this software
for any purpose and without fee is hereby granted, provided
that the above copyright notice appear in all copies and that
both the copyright notice and this permission notice appear in
supporting documentation, and that the name of Silicon
Graphics, Inc. not be used in advertising or publicity
pertaining to distribution of the software without specific,
written prior permission.
THE MATERIAL EMBODIED ON THIS SOFTWARE IS PROVIDED TO YOU
"AS-IS" AND WITHOUT WARRANTY OF ANY KIND, EXPRESS, IMPLIED OR
OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF
MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. IN NO
EVENT SHALL SILICON GRAPHICS, INC. BE LIABLE TO YOU OR ANYONE
ELSE FOR ANY DIRECT, SPECIAL, INCIDENTAL, INDIRECT OR
CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER,
INCLUDING WITHOUT LIMITATION, LOSS OF PROFIT, LOSS OF USE,
SAVINGS OR REVENUE, OR THE CLAIMS OF THIRD PARTIES, WHETHER OR
NOT SILICON GRAPHICS, INC. HAS BEEN ADVISED OF THE POSSIBILITY
OF SUCH LOSS, HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
ARISING OUT OF OR IN CONNECTION WITH THE POSSESSION, USE OR
PERFORMANCE OF THIS SOFTWARE.
US Government Users Restricted Rights
Use, duplication, or disclosure by the Government is subject to
restrictions set forth in FAR 52.227.19(c)(2) or subparagraph
(c)(1)(ii) of the Rights in Technical Data and Computer
Software clause at DFARS 252.227-7013 and/or in similar or
successor clauses in the FAR or the DOD or NASA FAR
Supplement. Unpublished-- rights reserved under the copyright
laws of the United States. Contractor/manufacturer is Silicon
Graphics, Inc., 2011 N. Shoreline Blvd., Mountain View, CA
94039-7311.
OpenGL(TM) is a trademark of Silicon Graphics, Inc.
*/
/* Taken from the projshadow.c - by Tom McReynolds, SGI */
/* Modified by David Bucciarelli */
/* Rendering shadows using projective shadows. */
#include <GL/glut.h>
#include "shadow.h"
enum {
X, Y, Z, W
};
enum {
A, B, C, D
};
/* create a matrix that will project the desired shadow */
void
shadowmatrix(GLfloat shadowMat[4][4],
GLfloat groundplane[4],
GLfloat lightpos[4])
{
GLfloat dot;
/* find dot product between light position vector and ground plane normal */
dot = groundplane[X] * lightpos[X] +
groundplane[Y] * lightpos[Y] +
groundplane[Z] * lightpos[Z] +
groundplane[W] * lightpos[W];
shadowMat[0][0] = dot - lightpos[X] * groundplane[X];
shadowMat[1][0] = 0.f - lightpos[X] * groundplane[Y];
shadowMat[2][0] = 0.f - lightpos[X] * groundplane[Z];
shadowMat[3][0] = 0.f - lightpos[X] * groundplane[W];
shadowMat[X][1] = 0.f - lightpos[Y] * groundplane[X];
shadowMat[1][1] = dot - lightpos[Y] * groundplane[Y];
shadowMat[2][1] = 0.f - lightpos[Y] * groundplane[Z];
shadowMat[3][1] = 0.f - lightpos[Y] * groundplane[W];
shadowMat[X][2] = 0.f - lightpos[Z] * groundplane[X];
shadowMat[1][2] = 0.f - lightpos[Z] * groundplane[Y];
shadowMat[2][2] = dot - lightpos[Z] * groundplane[Z];
shadowMat[3][2] = 0.f - lightpos[Z] * groundplane[W];
shadowMat[X][3] = 0.f - lightpos[W] * groundplane[X];
shadowMat[1][3] = 0.f - lightpos[W] * groundplane[Y];
shadowMat[2][3] = 0.f - lightpos[W] * groundplane[Z];
shadowMat[3][3] = dot - lightpos[W] * groundplane[W];
}
/* find the plane equation given 3 points */
void
findplane(GLfloat plane[4],
GLfloat v0[3], GLfloat v1[3], GLfloat v2[3])
{
GLfloat vec0[3], vec1[3];
/* need 2 vectors to find cross product */
vec0[X] = v1[X] - v0[X];
vec0[Y] = v1[Y] - v0[Y];
vec0[Z] = v1[Z] - v0[Z];
vec1[X] = v2[X] - v0[X];
vec1[Y] = v2[Y] - v0[Y];
vec1[Z] = v2[Z] - v0[Z];
/* find cross product to get A, B, and C of plane equation */
plane[A] = vec0[Y] * vec1[Z] - vec0[Z] * vec1[Y];
plane[B] = -(vec0[X] * vec1[Z] - vec0[Z] * vec1[X]);
plane[C] = vec0[X] * vec1[Y] - vec0[Y] * vec1[X];
plane[D] = -(plane[A] * v0[X] + plane[B] * v0[Y] + plane[C] * v0[Z]);
}

18
progs/demos/shadow.h Normal file
View File

@@ -0,0 +1,18 @@
#ifndef SHADOW_H
#define SHADOW_H
extern void
shadowmatrix(GLfloat shadowMat[4][4],
GLfloat groundplane[4],
GLfloat lightpos[4]);
extern void
findplane(GLfloat plane[4],
GLfloat v0[3], GLfloat v1[3], GLfloat v2[3]);
#endif

View File

@@ -1,4 +1,4 @@
/* $Id: stex3d.c,v 1.1 1999/08/19 00:55:40 jtg Exp $ */
/* $Id: stex3d.c,v 1.5 2000/06/27 17:04:43 brianp Exp $ */
/*-----------------------------
* stex3d.c GL example of the mesa 3d-texture extention to simulate procedural
@@ -17,8 +17,20 @@
/*
* $Log: stex3d.c,v $
* Revision 1.1 1999/08/19 00:55:40 jtg
* Initial revision
* Revision 1.5 2000/06/27 17:04:43 brianp
* fixed compiler warnings
*
* Revision 1.4 2000/03/22 19:48:57 brianp
* converted from GL_EXT_texture3D to GL 1.2
*
* Revision 1.3 1999/12/16 08:54:22 brianp
* added a cast to malloc call
*
* Revision 1.2 1999/09/17 12:27:01 brianp
* silenced some warnings
*
* Revision 1.1.1.1 1999/08/19 00:55:40 jtg
* Imported sources
*
* Revision 3.1 1998/06/09 01:53:49 brianp
* main() should return an int
@@ -50,7 +62,6 @@ void init(void),
initNoise(void);
float turbulence(float point[3], float lofreq, float hifreq);
int isExtSupported(char *ext);
void KeyHandler( unsigned char key, int x, int y );
GLenum parseCmdLine(int argc, char **argv);
float noise3(float vec[3]);
@@ -118,17 +129,20 @@ void init()
/* start the noise function variables */
initNoise();
/* see if the texture 3d extention is supported */
if (!isExtSupported("GL_EXT_texture3D")) {
printf("Sorry this GL implementation (%s) does not support 3d texture extentions\n",
(char *)(glGetString(GL_RENDERER)));
/* tkQuit();*/
/* see if we have OpenGL 1.2 or later, for 3D texturing */
{
const char *version = (const char *) glGetString(GL_VERSION);
if (strncmp(version, "1.0", 3) == 0 ||
strncmp(version, "1.1", 3) == 0) {
printf("Sorry, OpenGL 1.2 or later is required\n");
exit(1);
}
}
/* if texture is supported then generate the texture */
create3Dtexture();
glEnable(GL_TEXTURE_3D_EXT);
glEnable(GL_TEXTURE_3D);
/*
glBlendFunc(GL_SRC_COLOR, GL_SRC_ALPHA);
glEnable(GL_BLEND);
@@ -227,7 +241,7 @@ void create3Dtexture()
int tmp;
printf("creating 3d textures...\n");
voxels = (unsigned char *) malloc((4*tex_width*tex_height*tex_depth));
voxels = (unsigned char *) malloc((size_t)(4*tex_width*tex_height*tex_depth));
vp=voxels;
for (i=0;i<tex_width;i++){
vec[0]=i;
@@ -246,39 +260,20 @@ void create3Dtexture()
printf("setting up 3d texture...\n");
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
glTexParameteri(GL_TEXTURE_3D_EXT, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_3D_EXT, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_3D_EXT, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri(GL_TEXTURE_3D_EXT, GL_TEXTURE_WRAP_T, GL_REPEAT);
glTexParameteri(GL_TEXTURE_3D_EXT, GL_TEXTURE_WRAP_R_EXT, GL_REPEAT);
glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_T, GL_REPEAT);
glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_R, GL_REPEAT);
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL);
glTexImage3DEXT(GL_TEXTURE_3D_EXT, 0, GL_RGBA,
tex_width, tex_height, tex_depth,
0, GL_RGBA, GL_UNSIGNED_BYTE, voxels);
glTexImage3D(GL_TEXTURE_3D, 0, GL_RGBA,
tex_width, tex_height, tex_depth,
0, GL_RGBA, GL_UNSIGNED_BYTE, voxels);
printf("finished setting up 3d texture image...\n");
}
int isExtSupported(char *ext)
{
/* routine to find whether a specified OpenGL extension is supported */
char *c;
int len;
char *allext = (char *)(glGetString(GL_EXTENSIONS));
len = strlen(ext);
if (len <= 0) return 0;
c = allext;
while (c) {
if (!strncmp(c,ext,len)) return 1;
c = strchr(c+1,'G');
}
return 0;
}
void printHelp()
{
printf("\nUsage: stex3d <cmd line options>\n");
@@ -393,7 +388,7 @@ void resize(int w, int h)
glTranslatef(0,0,-5);
}
void cleanEverything(void)
static void cleanEverything(void)
{
/* free(voxels); */
}
@@ -401,6 +396,8 @@ void cleanEverything(void)
void KeyHandler( unsigned char key, int x, int y )
{
(void) x;
(void) y;
switch(key) {
case 27:
case 'q':
@@ -427,10 +424,10 @@ void KeyHandler( unsigned char key, int x, int y )
angz-=10;
break;
case 't':
glEnable(GL_TEXTURE_3D_EXT);
glEnable(GL_TEXTURE_3D);
break;
case 'T':
glDisable(GL_TEXTURE_3D_EXT);
glDisable(GL_TEXTURE_3D);
break;
case 's':
glShadeModel(GL_SMOOTH);

573
progs/demos/teapot.c Normal file
View File

@@ -0,0 +1,573 @@
/*
* This program is under the GNU GPL.
* Use at your own risk.
*
* written by David Bucciarelli (tech.hmw@plus.it)
* Humanware s.r.l.
*/
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <time.h>
#ifdef WIN32
#include <windows.h>
#endif
#include <GL/glut.h>
#include "../util/readtex.c"
#include "shadow.c"
#ifdef XMESA
#include "GL/xmesa.h"
static int fullscreen=1;
#endif
static int WIDTH=640;
static int HEIGHT=480;
#define FRAME 50
#define BASESIZE 10.0
#define BASERES 12
#define TEAPOTRES 3
#ifndef M_PI
#define M_PI 3.1415926535
#endif
extern void shadowmatrix(GLfloat [4][4], GLfloat [4], GLfloat [4]);
extern void findplane(GLfloat [4], GLfloat [3], GLfloat [3], GLfloat [3]);
static int win=0;
static float obs[3]={5.0,0.0,1.0};
static float dir[3];
static float v=0.0;
static float alpha=-90.0;
static float beta=90.0;
static GLfloat baseshadow[4][4];
static GLfloat lightpos[4]={2.3,0.0,3.0,1.0};
static GLfloat lightdir[3]={-2.3,0.0,-3.0};
static GLfloat lightalpha=0.0;
static int fog=1;
static int bfcull=1;
static int usetex=1;
static int help=1;
static int joyavailable=0;
static int joyactive=0;
static GLuint t1id,t2id;
static GLuint teapotdlist,basedlist,lightdlist;
static float gettime(void)
{
static clock_t told=0;
clock_t tnew,ris;
tnew=clock();
ris=tnew-told;
told=tnew;
return(ris/(float)CLOCKS_PER_SEC);
}
static void calcposobs(void)
{
dir[0]=sin(alpha*M_PI/180.0);
dir[1]=cos(alpha*M_PI/180.0)*sin(beta*M_PI/180.0);
dir[2]=cos(beta*M_PI/180.0);
obs[0]+=v*dir[0];
obs[1]+=v*dir[1];
obs[2]+=v*dir[2];
}
static void special(int k, int x, int y)
{
switch(k) {
case GLUT_KEY_LEFT:
alpha-=2.0;
break;
case GLUT_KEY_RIGHT:
alpha+=2.0;
break;
case GLUT_KEY_DOWN:
beta-=2.0;
break;
case GLUT_KEY_UP:
beta+=2.0;
break;
}
}
static void key(unsigned char k, int x, int y)
{
switch(k) {
case 27:
exit(0);
break;
case 'a':
v+=0.005;
break;
case 'z':
v-=0.005;
break;
case 'j':
joyactive=(!joyactive);
break;
case 'h':
help=(!help);
break;
case 'f':
fog=(!fog);
break;
case 't':
usetex=(!usetex);
break;
case 'b':
if(bfcull) {
glDisable(GL_CULL_FACE);
bfcull=0;
} else {
glEnable(GL_CULL_FACE);
bfcull=1;
}
break;
#ifdef XMESA
case ' ':
XMesaSetFXmode(fullscreen ? XMESA_FX_FULLSCREEN : XMESA_FX_WINDOW);
fullscreen=(!fullscreen);
break;
#endif
}
}
static void reshape(int w, int h)
{
WIDTH=w;
HEIGHT=h;
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(45.0,w/(float)h,0.2,40.0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glViewport(0,0,w,h);
}
static void printstring(void *font, char *string)
{
int len,i;
len=(int)strlen(string);
for(i=0;i<len;i++)
glutBitmapCharacter(font,string[i]);
}
static void printhelp(void)
{
glEnable(GL_BLEND);
glColor4f(0.5,0.5,0.5,0.5);
glRecti(40,40,600,440);
glDisable(GL_BLEND);
glColor3f(1.0,0.0,0.0);
glRasterPos2i(300,420);
printstring(GLUT_BITMAP_TIMES_ROMAN_24,"Help");
glRasterPos2i(60,390);
printstring(GLUT_BITMAP_TIMES_ROMAN_24,"h - Togle Help");
glRasterPos2i(60,360);
printstring(GLUT_BITMAP_TIMES_ROMAN_24,"t - Togle Textures");
glRasterPos2i(60,330);
printstring(GLUT_BITMAP_TIMES_ROMAN_24,"f - Togle Fog");
glRasterPos2i(60,300);
printstring(GLUT_BITMAP_TIMES_ROMAN_24,"b - Togle Back face culling");
glRasterPos2i(60,270);
printstring(GLUT_BITMAP_TIMES_ROMAN_24,"Arrow Keys - Rotate");
glRasterPos2i(60,240);
printstring(GLUT_BITMAP_TIMES_ROMAN_24,"a - Increase velocity");
glRasterPos2i(60,210);
printstring(GLUT_BITMAP_TIMES_ROMAN_24,"z - Decrease velocity");
glRasterPos2i(60,180);
if(joyavailable)
printstring(GLUT_BITMAP_TIMES_ROMAN_24,"j - Togle jostick control (Joystick control available)");
else
printstring(GLUT_BITMAP_TIMES_ROMAN_24,"(No Joystick control available)");
}
static void drawbase(void)
{
int i,j;
float x,y,dx,dy;
glBindTexture(GL_TEXTURE_2D,t1id);
dx=BASESIZE/BASERES;
dy=-BASESIZE/BASERES;
for(y=BASESIZE/2.0,j=0;j<BASERES;y+=dy,j++) {
glBegin(GL_QUAD_STRIP);
glColor3f(1.0,1.0,1.0);
glNormal3f(0.0,0.0,1.0);
for(x=-BASESIZE/2.0,i=0;i<BASERES;x+=dx,i++) {
glTexCoord2f(x,y);
glVertex3f(x,y,0.0);
glTexCoord2f(x,y+dy);
glVertex3f(x,y+dy,0.0);
}
glEnd();
}
}
static void drawteapot(void)
{
static float xrot=0.0;
static float zrot=0.0;
glPushMatrix();
glRotatef(lightalpha,0.0,0.0,1.0);
glMultMatrixf((GLfloat *)baseshadow);
glRotatef(-lightalpha,0.0,0.0,1.0);
glTranslatef(0.0,0.0,1.0);
glRotatef(xrot,1.0,0.0,0.0);
glRotatef(zrot,0.0,0.0,1.0);
glDisable(GL_TEXTURE_2D);
glDisable(GL_DEPTH_TEST);
glDisable(GL_LIGHTING);
glColor3f(0.0,0.0,0.0);
glCallList(teapotdlist);
glEnable(GL_DEPTH_TEST);
glEnable(GL_LIGHTING);
if(usetex)
glEnable(GL_TEXTURE_2D);
glPopMatrix();
glPushMatrix();
glTranslatef(0.0,0.0,1.0);
glRotatef(xrot,1.0,0.0,0.0);
glRotatef(zrot,0.0,0.0,1.0);
glCallList(teapotdlist);
glPopMatrix();
xrot+=2.0;
zrot+=1.0;
}
static void drawlight1(void)
{
glPushMatrix();
glRotatef(lightalpha,0.0,0.0,1.0);
glLightfv(GL_LIGHT0,GL_POSITION,lightpos);
glLightfv(GL_LIGHT0,GL_SPOT_DIRECTION,lightdir);
glPopMatrix();
}
static void drawlight2(void)
{
glPushMatrix();
glRotatef(lightalpha,0.0,0.0,1.0);
glTranslatef(lightpos[0],lightpos[1],lightpos[2]);
glDisable(GL_TEXTURE_2D);
glCallList(lightdlist);
if(usetex)
glEnable(GL_TEXTURE_2D);
glPopMatrix();
lightalpha+=1.0;
}
static void dojoy(void)
{
#ifdef WIN32
static UINT max[2]={0,0};
static UINT min[2]={0xffffffff,0xffffffff},center[2];
MMRESULT res;
JOYINFO joy;
res=joyGetPos(JOYSTICKID1,&joy);
if(res==JOYERR_NOERROR) {
joyavailable=1;
if(max[0]<joy.wXpos)
max[0]=joy.wXpos;
if(min[0]>joy.wXpos)
min[0]=joy.wXpos;
center[0]=(max[0]+min[0])/2;
if(max[1]<joy.wYpos)
max[1]=joy.wYpos;
if(min[1]>joy.wYpos)
min[1]=joy.wYpos;
center[1]=(max[1]+min[1])/2;
if(joyactive) {
if(fabs(center[0]-(float)joy.wXpos)>0.1*(max[0]-min[0]))
alpha-=2.5*(center[0]-(float)joy.wXpos)/(max[0]-min[0]);
if(fabs(center[1]-(float)joy.wYpos)>0.1*(max[1]-min[1]))
beta+=2.5*(center[1]-(float)joy.wYpos)/(max[1]-min[1]);
if(joy.wButtons & JOY_BUTTON1)
v+=0.005;
if(joy.wButtons & JOY_BUTTON2)
v-=0.005;
}
} else
joyavailable=0;
#endif
}
static void draw(void)
{
static int count=0;
static char frbuf[80];
float fr;
dojoy();
glEnable(GL_DEPTH_TEST);
glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
if(usetex)
glEnable(GL_TEXTURE_2D);
else
glDisable(GL_TEXTURE_2D);
if(fog)
glEnable(GL_FOG);
else
glDisable(GL_FOG);
glEnable(GL_LIGHTING);
glShadeModel(GL_SMOOTH);
glPushMatrix();
calcposobs();
gluLookAt(obs[0],obs[1],obs[2],
obs[0]+dir[0],obs[1]+dir[1],obs[2]+dir[2],
0.0,0.0,1.0);
drawlight1();
glCallList(basedlist);
drawteapot();
drawlight2();
glPopMatrix();
if((count % FRAME)==0) {
fr=gettime();
sprintf(frbuf,"Frame rate: %f",FRAME/fr);
}
glDisable(GL_LIGHTING);
glDisable(GL_TEXTURE_2D);
glDisable(GL_DEPTH_TEST);
glDisable(GL_FOG);
glShadeModel(GL_FLAT);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(-0.5,639.5,-0.5,479.5,-1.0,1.0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glColor3f(1.0,0.0,0.0);
glRasterPos2i(10,10);
printstring(GLUT_BITMAP_HELVETICA_18,frbuf);
glRasterPos2i(350,470);
printstring(GLUT_BITMAP_HELVETICA_10,"Teapot V1.2 Written by David Bucciarelli (tech.hmw@plus.it)");
if(help)
printhelp();
reshape(WIDTH,HEIGHT);
glutSwapBuffers();
count++;
}
static void inittextures(void)
{
glGenTextures(1,&t1id);
glBindTexture(GL_TEXTURE_2D,t1id);
glPixelStorei(GL_UNPACK_ALIGNMENT,4);
if (!LoadRGBMipmaps("../images/tile.rgb", GL_RGB)) {
fprintf(stderr,"Error reading a texture.\n");
exit(-1);
}
glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,GL_REPEAT);
glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,GL_REPEAT);
glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR_MIPMAP_LINEAR);
glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);
glTexEnvf(GL_TEXTURE_ENV,GL_TEXTURE_ENV_MODE,GL_MODULATE);
glGenTextures(1,&t2id);
glBindTexture(GL_TEXTURE_2D,t2id);
if (!LoadRGBMipmaps("../images/bw.rgb", GL_RGB)) {
fprintf(stderr,"Error reading a texture.\n");
exit(-1);
}
glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,GL_REPEAT);
glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,GL_REPEAT);
glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR_MIPMAP_LINEAR);
glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);
glTexEnvf(GL_TEXTURE_ENV,GL_TEXTURE_ENV_MODE,GL_MODULATE);
}
static void initlight(void)
{
float lamb[4]={0.2,0.2,0.2,1.0};
float lspec[4]={1.0,1.0,1.0,1.0};
glLightf(GL_LIGHT0,GL_SPOT_CUTOFF,70.0);
glLightf(GL_LIGHT0,GL_SPOT_EXPONENT,20.0);
glLightfv(GL_LIGHT0,GL_AMBIENT,lamb);
glLightfv(GL_LIGHT0,GL_SPECULAR,lspec);
glMaterialf(GL_FRONT_AND_BACK,GL_SHININESS,20.0);
glMaterialfv(GL_FRONT_AND_BACK,GL_SPECULAR,lspec);
glEnable(GL_LIGHT0);
}
static void initdlists(void)
{
GLUquadricObj *lcone,*lbase;
GLfloat plane[4];
GLfloat v0[3]={0.0,0.0,0.0};
GLfloat v1[3]={1.0,0.0,0.0};
GLfloat v2[3]={0.0,1.0,0.0};
findplane(plane,v0,v1,v2);
shadowmatrix(baseshadow,plane,lightpos);
teapotdlist=glGenLists(1);
glNewList(teapotdlist,GL_COMPILE);
glRotatef(90.0,1.0,0.0,0.0);
glCullFace(GL_FRONT);
glBindTexture(GL_TEXTURE_2D,t2id);
glutSolidTeapot(0.75);
glCullFace(GL_BACK);
glEndList();
basedlist=glGenLists(1);
glNewList(basedlist,GL_COMPILE);
drawbase();
glEndList();
lightdlist=glGenLists(1);
glNewList(lightdlist,GL_COMPILE);
glDisable(GL_LIGHTING);
lcone=gluNewQuadric();
lbase=gluNewQuadric();
glRotatef(45.0,0.0,1.0,0.0);
glColor3f(1.0,1.0,1.0);
glCullFace(GL_FRONT);
gluDisk(lbase,0.0,0.2,12.0,1.0);
glCullFace(GL_BACK);
glColor3f(0.5,0.0,0.0);
gluCylinder(lcone,0.2,0.0,0.5,12,1);
gluDeleteQuadric(lcone);
gluDeleteQuadric(lbase);
glEnable(GL_LIGHTING);
glEndList();
}
int main(int ac, char **av)
{
float fogcolor[4]={0.025,0.025,0.025,1.0};
fprintf(stderr,"Teapot V1.2\nWritten by David Bucciarelli (tech.hmw@plus.it)\n");
/*
if(!SetPriorityClass(GetCurrentProcess(),REALTIME_PRIORITY_CLASS)) {
fprintf(stderr,"Error setting the process class.\n");
return 0;
}
if(!SetThreadPriority(GetCurrentThread(),THREAD_PRIORITY_TIME_CRITICAL)) {
fprintf(stderr,"Error setting the process priority.\n");
return 0;
}
*/
glutInitWindowPosition(0,0);
glutInitWindowSize(WIDTH,HEIGHT);
glutInit(&ac,av);
glutInitDisplayMode(GLUT_RGB|GLUT_DEPTH|GLUT_DOUBLE);
if(!(win=glutCreateWindow("Teapot"))) {
fprintf(stderr,"Error, couldn't open window\n");
return -1;
}
reshape(WIDTH,HEIGHT);
glShadeModel(GL_SMOOTH);
glEnable(GL_DEPTH_TEST);
glEnable(GL_CULL_FACE);
glEnable(GL_TEXTURE_2D);
glEnable(GL_FOG);
glFogi(GL_FOG_MODE,GL_EXP2);
glFogfv(GL_FOG_COLOR,fogcolor);
glFogf(GL_FOG_DENSITY,0.04);
glHint(GL_FOG_HINT,GL_NICEST);
glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
calcposobs();
inittextures();
initlight();
initdlists();
glClearColor(fogcolor[0],fogcolor[1],fogcolor[2],fogcolor[3]);
glutReshapeFunc(reshape);
glutDisplayFunc(draw);
glutKeyboardFunc(key);
glutSpecialFunc(special);
glutIdleFunc(draw);
glutMainLoop();
return 0;
}

653
progs/demos/terrain.c Normal file
View File

@@ -0,0 +1,653 @@
/*
* This program is under the GNU GPL.
* Use at your own risk.
*
* written by David Bucciarelli (tech.hmw@plus.it)
* Humanware s.r.l.
*
* based on a Mikael SkiZoWalker's (MoDEL) / France (Skizo@Hol.Fr) demo
*/
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <time.h>
#ifdef WIN32
#include <windows.h>
#endif
#include <GL/glut.h>
#ifdef XMESA
#include "GL/xmesa.h"
static int fullscreen = 1;
#endif
#ifndef M_PI
#define M_PI 3.14159265
#endif
#define heightMnt 450
#define lenghtXmnt 62
#define lenghtYmnt 62
#define stepXmnt 96.0
#define stepYmnt 96.0
#define WIDTH 640
#define HEIGHT 480
#define TSCALE 4
#define FRAME 50
#define FOV 85
static GLfloat terrain[256 * 256];
static GLfloat terraincolor[256 * 256][3];
static int win = 0;
static int fog = 1;
static int bfcull = 1;
static int usetex = 1;
static int poutline = 0;
static int help = 1;
static int joyavailable = 0;
static int joyactive = 0;
static float ModZMnt;
static long GlobalMnt = 0;
static int scrwidth = WIDTH;
static int scrheight = HEIGHT;
#define OBSSTARTX 992.0
#define OBSSTARTY 103.0
static float obs[3] = { OBSSTARTX, heightMnt * 1.3, OBSSTARTY };
static float dir[3], v1[2], v2[2];
static float v = 15.0;
static float alpha = 75.0;
static float beta = 90.0;
static float
gettime(void)
{
static clock_t told = 0;
clock_t tnew, ris;
tnew = clock();
ris = tnew - told;
told = tnew;
return (ris / (float) CLOCKS_PER_SEC);
}
static void
calcposobs(void)
{
float alpha1, alpha2;
dir[0] = sin(alpha * M_PI / 180.0);
dir[2] = cos(alpha * M_PI / 180.0) * sin(beta * M_PI / 180.0);
dir[1] = cos(beta * M_PI / 180.0);
alpha1 = alpha + FOV / 2.0;
v1[0] = sin(alpha1 * M_PI / 180.0);
v1[1] = cos(alpha1 * M_PI / 180.0);
alpha2 = alpha - FOV / 2.0;
v2[0] = sin(alpha2 * M_PI / 180.0);
v2[1] = cos(alpha2 * M_PI / 180.0);
obs[0] += v * dir[0];
obs[1] += v * dir[1];
obs[2] += v * dir[2];
if (obs[1] < 0.0)
obs[1] = 0.0;
}
static void
reshape(int width, int height)
{
scrwidth = width;
scrheight = height;
glViewport(0, 0, (GLint) width, (GLint) height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(50.0, ((GLfloat) width / (GLfloat) height),
lenghtXmnt * stepYmnt * 0.01, lenghtXmnt * stepYmnt * 0.7);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
}
static int
clipstrip(float y, float *start, float *end)
{
float x1, x2, t1, t2, tmp;
if (v1[1] == 0.0) {
t1 = 0.0;
x1 = -HUGE_VAL;
}
else {
t1 = y / v1[1];
x1 = t1 * v1[0];
}
if (v2[1] == 0.0) {
t2 = 0.0;
x2 = HUGE_VAL;
}
else {
t2 = y / v2[1];
x2 = t2 * v2[0];
}
if (((x1 < -(lenghtXmnt * stepXmnt) / 2) && (t2 <= 0.0)) ||
((t1 <= 0.0) && (x2 > (lenghtXmnt * stepXmnt) / 2)) ||
((t1 < 0.0) && (t2 < 0.0)))
return 0;
if ((t1 == 0.0) && (t2 == 0.0)) {
if ((v1[0] < 0.0) && (v1[1] > 0.0) && (v2[0] < 0.0) && (v2[1] < 0.0)) {
*start = -(lenghtXmnt * stepXmnt) / 2;
*end = stepXmnt;
return 1;
}
else {
if ((v1[0] > 0.0) && (v1[1] < 0.0) && (v2[0] > 0.0) && (v2[1] > 0.0)) {
*start = -stepXmnt;
*end = (lenghtXmnt * stepXmnt) / 2;
return 1;
}
else
return 0;
}
}
else {
if (t2 < 0.0) {
if (x1 < 0.0)
x2 = -(lenghtXmnt * stepXmnt) / 2;
else
x2 = (lenghtXmnt * stepXmnt) / 2;
}
if (t1 < 0.0) {
if (x2 < 0.0)
x1 = -(lenghtXmnt * stepXmnt) / 2;
else
x1 = (lenghtXmnt * stepXmnt) / 2;
}
}
if (x1 > x2) {
tmp = x1;
x1 = x2;
x2 = tmp;
}
x1 -= stepXmnt;
if (x1 < -(lenghtXmnt * stepXmnt) / 2)
x1 = -(lenghtXmnt * stepXmnt) / 2;
x2 += stepXmnt;
if (x2 > (lenghtXmnt * stepXmnt) / 2)
x2 = (lenghtXmnt * stepXmnt) / 2;
*start = ((int) (x1 / stepXmnt)) * stepXmnt;
*end = ((int) (x2 / stepXmnt)) * stepXmnt;
return 1;
}
static void
printstring(void *font, char *string)
{
int len, i;
len = (int) strlen(string);
for (i = 0; i < len; i++)
glutBitmapCharacter(font, string[i]);
}
static void
printhelp(void)
{
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glColor4f(0.0, 0.0, 0.0, 0.5);
glRecti(40, 40, 600, 440);
glDisable(GL_BLEND);
glColor3f(1.0, 0.0, 0.0);
glRasterPos2i(300, 420);
printstring(GLUT_BITMAP_TIMES_ROMAN_24, "Help");
glRasterPos2i(60, 390);
printstring(GLUT_BITMAP_TIMES_ROMAN_24, "h - Togle Help");
glRasterPos2i(60, 360);
printstring(GLUT_BITMAP_TIMES_ROMAN_24, "t - Togle Textures");
glRasterPos2i(60, 330);
printstring(GLUT_BITMAP_TIMES_ROMAN_24, "f - Togle Fog");
glRasterPos2i(60, 300);
printstring(GLUT_BITMAP_TIMES_ROMAN_24, "p - Wire frame");
glRasterPos2i(60, 270);
printstring(GLUT_BITMAP_TIMES_ROMAN_24, "b - Togle Back face culling");
glRasterPos2i(60, 240);
printstring(GLUT_BITMAP_TIMES_ROMAN_24, "Arrow Keys - Rotate");
glRasterPos2i(60, 210);
printstring(GLUT_BITMAP_TIMES_ROMAN_24, "a - Increase velocity");
glRasterPos2i(60, 180);
printstring(GLUT_BITMAP_TIMES_ROMAN_24, "z - Decrease velocity");
glRasterPos2i(60, 150);
if (joyavailable)
printstring(GLUT_BITMAP_TIMES_ROMAN_24,
"j - Togle jostick control (Joystick control available)");
else
printstring(GLUT_BITMAP_TIMES_ROMAN_24,
"(No Joystick control available)");
}
static void
drawterrain(void)
{
int h, i, idx, ox, oy;
float j, k, start, end;
ox = (int) (obs[0] / stepXmnt);
oy = (int) (obs[2] / stepYmnt);
GlobalMnt = ((ox * TSCALE) & 255) + ((oy * TSCALE) & 255) * 256;
glPushMatrix();
glTranslatef((float) ox * stepXmnt, 0, (float) oy * stepYmnt);
for (h = 0, k = -(lenghtYmnt * stepYmnt) / 2; h < lenghtYmnt;
k += stepYmnt, h++) {
if (!clipstrip(k, &start, &end))
continue;
glBegin(GL_TRIANGLE_STRIP); /* I hope that the optimizer will be able to improve this code */
for (i = (int) (lenghtXmnt / 2 + start / stepXmnt), j = start; j <= end;
j += stepXmnt, i++) {
idx = (i * TSCALE + h * 256 * TSCALE + GlobalMnt) & 65535;
glColor3fv(terraincolor[idx]);
glTexCoord2f((ox + i) / 8.0, (oy + h) / 8.0);
glVertex3f(j, terrain[idx], k);
idx =
(i * TSCALE + h * 256 * TSCALE + 256 * TSCALE +
GlobalMnt) & 65535;
glColor3fv(terraincolor[idx]);
glTexCoord2f((ox + i) / 8.0, (oy + h + 1) / 8.0);
glVertex3f(j, terrain[idx], k + stepYmnt);
}
glEnd();
}
glDisable(GL_CULL_FACE);
glDisable(GL_TEXTURE_2D);
glEnable(GL_BLEND);
glBegin(GL_QUADS);
glColor4f(0.1, 0.7, 1.0, 0.4);
glVertex3f(-(lenghtXmnt * stepXmnt) / 2.0, heightMnt * 0.6,
-(lenghtYmnt * stepYmnt) / 2.0);
glVertex3f(-(lenghtXmnt * stepXmnt) / 2.0, heightMnt * 0.6,
(lenghtYmnt * stepYmnt) / 2.0);
glVertex3f((lenghtXmnt * stepXmnt) / 2.0, heightMnt * 0.6,
(lenghtYmnt * stepYmnt) / 2.0);
glVertex3f((lenghtXmnt * stepXmnt) / 2.0, heightMnt * 0.6,
-(lenghtYmnt * stepYmnt) / 2.0);
glEnd();
glDisable(GL_BLEND);
if (bfcull)
glEnable(GL_CULL_FACE);
glEnable(GL_TEXTURE_2D);
glPopMatrix();
}
static void
dojoy(void)
{
#ifdef WIN32
static UINT max[2] = { 0, 0 };
static UINT min[2] = { 0xffffffff, 0xffffffff }, center[2];
MMRESULT res;
JOYINFO joy;
res = joyGetPos(JOYSTICKID1, &joy);
if (res == JOYERR_NOERROR) {
joyavailable = 1;
if (max[0] < joy.wXpos)
max[0] = joy.wXpos;
if (min[0] > joy.wXpos)
min[0] = joy.wXpos;
center[0] = (max[0] + min[0]) / 2;
if (max[1] < joy.wYpos)
max[1] = joy.wYpos;
if (min[1] > joy.wYpos)
min[1] = joy.wYpos;
center[1] = (max[1] + min[1]) / 2;
if (joyactive) {
if (fabs(center[0] - (float) joy.wXpos) > 0.1 * (max[0] - min[0]))
alpha +=
2.5 * (center[0] - (float) joy.wXpos) / (max[0] - min[0]);
if (fabs(center[1] - (float) joy.wYpos) > 0.1 * (max[1] - min[1]))
beta += 2.5 * (center[1] - (float) joy.wYpos) / (max[1] - min[1]);
if (joy.wButtons & JOY_BUTTON1)
v += 0.5;
if (joy.wButtons & JOY_BUTTON2)
v -= 0.5;
}
}
else
joyavailable = 0;
#endif
}
static void
drawscene(void)
{
static int count = 0;
static char frbuf[80];
float fr;
dojoy();
glShadeModel(GL_SMOOTH);
glEnable(GL_DEPTH_TEST);
if (usetex)
glEnable(GL_TEXTURE_2D);
else
glDisable(GL_TEXTURE_2D);
if (fog)
glEnable(GL_FOG);
else
glDisable(GL_FOG);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glPushMatrix();
calcposobs();
gluLookAt(obs[0], obs[1], obs[2],
obs[0] + dir[0], obs[1] + dir[1], obs[2] + dir[2],
0.0, 1.0, 0.0);
drawterrain();
glPopMatrix();
if ((count % FRAME) == 0) {
fr = gettime();
sprintf(frbuf, "Frame rate: %.3f", FRAME / fr);
}
glDisable(GL_TEXTURE_2D);
glDisable(GL_DEPTH_TEST);
glDisable(GL_FOG);
glShadeModel(GL_FLAT);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(-0.5, 639.5, -0.5, 479.5, -1.0, 1.0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glColor3f(1.0, 0.0, 0.0);
glRasterPos2i(10, 10);
printstring(GLUT_BITMAP_HELVETICA_18, frbuf);
glRasterPos2i(350, 470);
printstring(GLUT_BITMAP_HELVETICA_10,
"Terrain V1.2 Written by David Bucciarelli (tech.hmw@plus.it)");
glRasterPos2i(434, 457);
printstring(GLUT_BITMAP_HELVETICA_10,
"Based on a Mickael's demo (Skizo@Hol.Fr)");
if (help)
printhelp();
reshape(scrwidth, scrheight);
glutSwapBuffers();
count++;
}
static void
key(unsigned char k, int x, int y)
{
switch (k) {
case 27:
exit(0);
break;
case 'a':
v += 0.5;
break;
case 'z':
v -= 0.5;
break;
case 'p':
if (poutline) {
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
poutline = 0;
}
else {
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
poutline = 1;
}
break;
case 'j':
joyactive = (!joyactive);
break;
case 'h':
help = (!help);
break;
case 'f':
fog = (!fog);
break;
case 't':
usetex = (!usetex);
break;
case 'b':
if (bfcull) {
glDisable(GL_CULL_FACE);
bfcull = 0;
}
else {
glEnable(GL_CULL_FACE);
bfcull = 1;
}
break;
#ifdef XMESA
case ' ':
XMesaSetFXmode(fullscreen ? XMESA_FX_FULLSCREEN : XMESA_FX_WINDOW);
fullscreen = (!fullscreen);
break;
#endif
}
}
static void
special(int k, int x, int y)
{
switch (k) {
case GLUT_KEY_LEFT:
alpha += 2.0;
break;
case GLUT_KEY_RIGHT:
alpha -= 2.0;
break;
case GLUT_KEY_DOWN:
beta -= 2.0;
break;
case GLUT_KEY_UP:
beta += 2.0;
break;
}
}
static void
calccolor(GLfloat height, GLfloat c[3])
{
GLfloat color[4][3] = {
{1.0, 1.0, 1.0},
{0.0, 0.8, 0.0},
{1.0, 1.0, 0.3},
{0.0, 0.0, 0.8}
};
GLfloat fact;
height = height * (1.0 / 255.0);
if (height >= 0.9) {
c[0] = color[0][0];
c[1] = color[0][1];
c[2] = color[0][2];
return;
}
if ((height < 0.9) && (height >= 0.7)) {
fact = (height - 0.7) * 5.0;
c[0] = fact * color[0][0] + (1.0 - fact) * color[1][0];
c[1] = fact * color[0][1] + (1.0 - fact) * color[1][1];
c[2] = fact * color[0][2] + (1.0 - fact) * color[1][2];
return;
}
if ((height < 0.7) && (height >= 0.6)) {
fact = (height - 0.6) * 10.0;
c[0] = fact * color[1][0] + (1.0 - fact) * color[2][0];
c[1] = fact * color[1][1] + (1.0 - fact) * color[2][1];
c[2] = fact * color[1][2] + (1.0 - fact) * color[2][2];
return;
}
if ((height < 0.6) && (height >= 0.5)) {
fact = (height - 0.5) * 10.0;
c[0] = fact * color[2][0] + (1.0 - fact) * color[3][0];
c[1] = fact * color[2][1] + (1.0 - fact) * color[3][1];
c[2] = fact * color[2][2] + (1.0 - fact) * color[3][2];
return;
}
c[0] = color[3][0];
c[1] = color[3][1];
c[2] = color[3][2];
}
static void
loadpic(void)
{
GLubyte bufferter[256 * 256], terrainpic[256 * 256];
FILE *FilePic;
int i, tmp;
GLenum gluerr;
if ((FilePic = fopen("terrain.dat", "r")) == NULL) {
fprintf(stderr, "Error loading Mnt.bin\n");
exit(-1);
}
fread(bufferter, 256 * 256, 1, FilePic);
fclose(FilePic);
for (i = 0; i < (256 * 256); i++) {
terrain[i] = (bufferter[i] * (heightMnt / 255.0f));
calccolor((GLfloat) bufferter[i], terraincolor[i]);
tmp = (((int) bufferter[i]) + 96);
terrainpic[i] = (tmp > 255) ? 255 : tmp;
}
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
if ((gluerr = gluBuild2DMipmaps(GL_TEXTURE_2D, 1, 256, 256, GL_LUMINANCE,
GL_UNSIGNED_BYTE,
(GLvoid *) (&terrainpic[0])))) {
fprintf(stderr, "GLULib%s\n", gluErrorString(gluerr));
exit(-1);
}
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,
GL_LINEAR_MIPMAP_LINEAR);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
glEnable(GL_TEXTURE_2D);
}
static void
init(void)
{
float fogcolor[4] = { 0.6, 0.7, 0.7, 1.0 };
glClearColor(fogcolor[0], fogcolor[1], fogcolor[2], fogcolor[3]);
glClearDepth(1.0);
glDepthFunc(GL_LEQUAL);
glShadeModel(GL_SMOOTH);
glEnable(GL_DEPTH_TEST);
glEnable(GL_CULL_FACE);
glDisable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_FOG);
glFogi(GL_FOG_MODE, GL_EXP2);
glFogfv(GL_FOG_COLOR, fogcolor);
glFogf(GL_FOG_DENSITY, 0.0007);
#ifdef FX
glHint(GL_FOG_HINT, GL_NICEST);
#endif
reshape(scrwidth, scrheight);
}
int
main(int ac, char **av)
{
glutInitWindowPosition(0, 0);
glutInitWindowSize(WIDTH, HEIGHT);
glutInit(&ac, av);
glutInitDisplayMode(GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE);
if (!(win = glutCreateWindow("Terrain"))) {
fprintf(stderr, "Error, couldn't open window\n");
return -1;
}
ModZMnt = 0.0f;
loadpic();
init();
#ifndef FX
glDisable(GL_TEXTURE_2D);
usetex = 0;
#endif
glutReshapeFunc(reshape);
glutDisplayFunc(drawscene);
glutKeyboardFunc(key);
glutSpecialFunc(special);
glutIdleFunc(drawscene);
glutMainLoop();
return 0;
}

View File

@@ -1,37 +1,7 @@
/* $Id: tessdemo.c,v 1.1 1999/08/19 00:55:40 jtg Exp $ */
/* $Id: tessdemo.c,v 1.8 2000/07/11 14:11:58 brianp Exp $ */
/*
* A demo of the GLU polygon tesselation functions written by Bogdan Sikorski.
* This demo isn't built by the Makefile because it needs GLUT. After you've
* installed GLUT you can try this demo.
* Here's the command for IRIX, for example:
cc -g -ansi -prototypes -fullwarn -float -I../include -DSHM tess_demo.c -L../lib -lglut -lMesaGLU -lMesaGL -lm -lX11 -lXext -lXmu -lfpe -lXext -o tess_demo
*/
/*
* $Log: tessdemo.c,v $
* Revision 1.1 1999/08/19 00:55:40 jtg
* Initial revision
*
* Revision 3.5 1999/03/28 18:24:37 brianp
* minor clean-up
*
* Revision 3.4 1999/02/14 03:37:07 brianp
* fixed callback problem
*
* Revision 3.3 1998/07/26 01:25:26 brianp
* removed include of gl.h and glu.h
*
* Revision 3.2 1998/06/29 02:37:30 brianp
* minor changes for Windows (Ted Jump)
*
* Revision 3.1 1998/06/09 01:53:49 brianp
* main() should return an int
*
* Revision 3.0 1998/02/14 18:42:29 brianp
* initial rev
*
*/
@@ -43,376 +13,388 @@
#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;
static int menu;
typedef enum
{ QUIT, TESSELATE, CLEAR }
menu_entries;
typedef enum
{ DEFINE, TESSELATED }
mode_type;
struct
{
GLsizei no;
GLfloat color[3];
GLint p[3][2];
GLclampf p_color[3][3];
} triangle;
GLint p[MAX_POINTS][2];
GLuint point_cnt;
}
contours[MAX_CONTOURS];
static GLuint contour_cnt;
static GLsizei width, height;
static mode_type mode;
#ifndef GLCALLBACK
#ifdef CALLBACK
#define GLCALLBACK CALLBACK
#else
#define GLCALLBACK
#endif
#endif
void GLCALLBACK my_error(GLenum err)
struct
{
int len,i;
char const *str;
GLsizei no;
GLfloat color[3];
GLint p[3][2];
GLclampf p_color[3][3];
}
triangle;
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 void GLCALLBACK
my_error(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)
static void GLCALLBACK
begin_callback(GLenum mode)
{
triangle.no=0;
triangle.no = 0;
}
void GLCALLBACK edge_callback(GLenum flag)
static void GLCALLBACK
edge_callback(GLenum flag)
{
if(flag==GL_TRUE)
{
triangle.color[0]=1.0;
triangle.color[1]=1.0;
triangle.color[2]=0.5;
}
else
{
triangle.color[0]=1.0;
triangle.color[1]=0.0;
triangle.color[2]=0.0;
}
if (flag == GL_TRUE) {
triangle.color[0] = 1.0;
triangle.color[1] = 1.0;
triangle.color[2] = 0.5;
}
else {
triangle.color[0] = 1.0;
triangle.color[1] = 0.0;
triangle.color[2] = 0.0;
}
}
void GLCALLBACK end_callback()
static 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();
glBegin(GL_LINES);
glColor3f(triangle.p_color[0][0], triangle.p_color[0][1],
triangle.p_color[0][2]);
glVertex2i(triangle.p[0][0], triangle.p[0][1]);
glVertex2i(triangle.p[1][0], triangle.p[1][1]);
glColor3f(triangle.p_color[1][0], triangle.p_color[1][1],
triangle.p_color[1][2]);
glVertex2i(triangle.p[1][0], triangle.p[1][1]);
glVertex2i(triangle.p[2][0], triangle.p[2][1]);
glColor3f(triangle.p_color[2][0], triangle.p_color[2][1],
triangle.p_color[2][2]);
glVertex2i(triangle.p[2][0], triangle.p[2][1]);
glVertex2i(triangle.p[0][0], triangle.p[0][1]);
glEnd();
}
void GLCALLBACK vertex_callback(void *data)
{
GLsizei no;
GLint *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);
static void GLCALLBACK
vertex_callback(void *data)
{
GLsizei no;
GLint *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);
}
void set_screen_wh(GLsizei w, GLsizei h)
static void
set_screen_wh(GLsizei w, GLsizei h)
{
width=w;
height=h;
width = w;
height = h;
}
void tesse(void)
{
GLUtriangulatorObj *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;
}
static void
tesse(void)
{
GLUtriangulatorObj *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 left_down(int x1,int y1)
{
GLint P[2];
GLuint point_cnt;
/* translate GLUT into GL coordinates */
P[0]=x1;
P[1]=height-y1;
point_cnt=contours[contour_cnt].point_cnt;
contours[contour_cnt].p[point_cnt][0]=P[0];
contours[contour_cnt].p[point_cnt][1]=P[1];
glBegin(GL_LINES);
if(point_cnt)
{
glVertex2iv(contours[contour_cnt].p[point_cnt-1]);
glVertex2iv(P);
}
else
{
glVertex2iv(P);
glVertex2iv(P);
}
glEnd();
glFinish();
++(contours[contour_cnt].point_cnt);
static void
left_down(int x1, int y1)
{
GLint P[2];
GLuint point_cnt;
/* translate GLUT into GL coordinates */
P[0] = x1;
P[1] = height - y1;
point_cnt = contours[contour_cnt].point_cnt;
contours[contour_cnt].p[point_cnt][0] = P[0];
contours[contour_cnt].p[point_cnt][1] = P[1];
glBegin(GL_LINES);
if (point_cnt) {
glVertex2iv(contours[contour_cnt].p[point_cnt - 1]);
glVertex2iv(P);
}
else {
glVertex2iv(P);
glVertex2iv(P);
}
glEnd();
glFinish();
++(contours[contour_cnt].point_cnt);
}
void middle_down(int x1, int y1)
{
GLuint point_cnt;
(void) x1;
(void) y1;
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;
}
static void
middle_down(int x1, int y1)
{
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;
}
}
void mouse_clicked(int button,int state,int x,int y)
static void
mouse_clicked(int button, int state, int x, int y)
{
x-= x%10;
y-= y%10;
switch(button)
{
case GLUT_LEFT_BUTTON:
if(state==GLUT_DOWN)
left_down(x,y);
break;
case GLUT_MIDDLE_BUTTON:
if(state==GLUT_DOWN)
middle_down(x,y);
break;
}
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;
}
}
void display(void)
static void
display(void)
{
GLuint i,j;
GLuint point_cnt;
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:
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;
}
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);
}
glEnd();
glColor3f(1.0, 1.0, 0.0);
for (i = 0; i <= contour_cnt; i++) {
point_cnt = contours[i].point_cnt;
glBegin(GL_LINES);
switch (point_cnt) {
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;
}
glColor3f (1.0, 1.0, 0.0);
glColor3f(1.0, 1.0, 0.0);
}
void clear( void )
static void
clear(void)
{
contour_cnt=0;
contours[0].point_cnt=0;
glutMouseFunc(mouse_clicked);
mode=DEFINE;
display();
contour_cnt = 0;
contours[0].point_cnt = 0;
glutMouseFunc(mouse_clicked);
mode = DEFINE;
display();
}
void quit( void )
static void
quit(void)
{
exit(0);
exit(0);
}
void menu_selected(int entry)
static void
menu_selected(int entry)
{
switch(entry)
{
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;
}
}
void key_pressed(unsigned char key,int x,int y)
static 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;
}
switch (key) {
case 't':
case 'T':
tesse();
glFinish();
break;
case 'q':
case 'Q':
quit();
break;
case 'c':
case 'C':
clear();
break;
}
}
void myinit (void)
static void
myinit(void)
{
/* clear background to gray */
glClearColor (0.4, 0.4, 0.4, 0.0);
glShadeModel (GL_FLAT);
glClearColor(0.4, 0.4, 0.4, 0.0);
glShadeModel(GL_FLAT);
menu=glutCreateMenu(menu_selected);
glutAddMenuEntry("clear",CLEAR);
glutAddMenuEntry("tesselate",TESSELATE);
glutAddMenuEntry("quit",QUIT);
glutAttachMenu(GLUT_RIGHT_BUTTON);
glutMouseFunc(mouse_clicked);
glutKeyboardFunc(key_pressed);
contour_cnt=0;
glPolygonMode(GL_FRONT,GL_FILL);
mode=DEFINE;
menu = glutCreateMenu(menu_selected);
glutAddMenuEntry("clear", CLEAR);
glutAddMenuEntry("tesselate", TESSELATE);
glutAddMenuEntry("quit", QUIT);
glutAttachMenu(GLUT_RIGHT_BUTTON);
glutMouseFunc(mouse_clicked);
glutKeyboardFunc(key_pressed);
contour_cnt = 0;
glPolygonMode(GL_FRONT, GL_FILL);
mode = DEFINE;
}
static void reshape(GLsizei w, GLsizei h)
static void
reshape(GLsizei w, GLsizei h)
{
glViewport(0, 0, w, h);
glMatrixMode(GL_PROJECTION);
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 )
static void
usage(void)
{
printf("Use left mouse button to place vertices.\n");
printf("Press middle mouse button when done.\n");
@@ -424,14 +406,15 @@ static void usage( void )
* 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 ();
glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
glutInitWindowSize(400, 400);
glutCreateWindow(argv[0]);
myinit();
glutDisplayFunc(display);
glutReshapeFunc(reshape);
glutMainLoop();

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 );

387
progs/demos/texdown.c Normal file
View File

@@ -0,0 +1,387 @@
/* $Id: texdown.c,v 1.3 2000/03/29 18:02:52 brianp Exp $ */
/*
* 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.
*/
/*
* texdown
*
* Measure texture download speed.
* Use keyboard to change texture size, format, datatype, scale/bias,
* subimageload, etc.
*
* Brian Paul 28 January 2000
*/
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <GL/glut.h>
static GLsizei MaxSize = 1024;
static GLsizei TexWidth = 256, TexHeight = 256, TexBorder = 0;
static GLboolean ScaleAndBias = GL_FALSE;
static GLboolean SubImage = GL_FALSE;
static GLdouble DownloadRate = 0.0; /* texels/sec */
static GLuint Mode = 0;
#define NUM_FORMATS 4
struct FormatRec {
GLenum Format;
GLenum Type;
GLenum IntFormat;
GLint TexelSize;
};
static const struct FormatRec FormatTable[NUM_FORMATS] = {
/* Format Type IntFormat TexelSize */
{ GL_RGB, GL_UNSIGNED_BYTE, GL_RGB, 3 },
{ GL_RGBA, GL_UNSIGNED_BYTE, GL_RGBA, 4 },
{ GL_RGBA, GL_UNSIGNED_BYTE, GL_RGB, 4 },
{ GL_RGB, GL_UNSIGNED_SHORT_5_6_5, GL_RGB, 2 },
};
static GLint Format;
static int
BytesPerTexel(GLint format)
{
return FormatTable[format].TexelSize;
}
static const char *
FormatStr(GLenum format)
{
switch (format) {
case GL_RGB:
return "GL_RGB";
case GL_RGBA:
return "GL_RGBA";
default:
return "";
}
}
static const char *
TypeStr(GLenum type)
{
switch (type) {
case GL_UNSIGNED_BYTE:
return "GL_UNSIGNED_BYTE";
case GL_UNSIGNED_SHORT:
return "GL_UNSIGNED_SHORT";
case GL_UNSIGNED_SHORT_5_6_5:
return "GL_UNSIGNED_SHORT_5_6_5";
case GL_UNSIGNED_SHORT_5_6_5_REV:
return "GL_UNSIGNED_SHORT_5_6_5_REV";
default:
return "";
}
}
static void
MeasureDownloadRate(void)
{
const int w = TexWidth + 2 * TexBorder;
const int h = TexHeight + 2 * TexBorder;
const int bytes = w * h * BytesPerTexel(Format);
GLubyte *texImage, *getImage;
GLdouble t0, t1, time;
int count;
int i;
texImage = (GLubyte *) malloc(bytes);
getImage = (GLubyte *) malloc(bytes);
if (!texImage || !getImage) {
DownloadRate = 0.0;
return;
}
for (i = 0; i < bytes; i++) {
texImage[i] = i & 0xff;
}
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
glPixelStorei(GL_PACK_ALIGNMENT, 1);
if (ScaleAndBias) {
glPixelTransferf(GL_RED_SCALE, 0.5);
glPixelTransferf(GL_GREEN_SCALE, 0.5);
glPixelTransferf(GL_BLUE_SCALE, 0.5);
glPixelTransferf(GL_RED_BIAS, 0.5);
glPixelTransferf(GL_GREEN_BIAS, 0.5);
glPixelTransferf(GL_BLUE_BIAS, 0.5);
}
else {
glPixelTransferf(GL_RED_SCALE, 1.0);
glPixelTransferf(GL_GREEN_SCALE, 1.0);
glPixelTransferf(GL_BLUE_SCALE, 1.0);
glPixelTransferf(GL_RED_BIAS, 0.0);
glPixelTransferf(GL_GREEN_BIAS, 0.0);
glPixelTransferf(GL_BLUE_BIAS, 0.0);
}
count = 0;
t0 = glutGet(GLUT_ELAPSED_TIME) * 0.001;
do {
if (SubImage && count > 0) {
glTexSubImage2D(GL_TEXTURE_2D, 0, -TexBorder, -TexBorder, w, h,
FormatTable[Format].Format,
FormatTable[Format].Type, texImage);
}
else {
glTexImage2D(GL_TEXTURE_2D, 0,
FormatTable[Format].IntFormat, w, h, TexBorder,
FormatTable[Format].Format,
FormatTable[Format].Type, texImage);
}
if (count == 0) {
/* draw a tiny polygon to force texture into texram */
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glEnable(GL_TEXTURE_2D);
glBegin(GL_TRIANGLES);
glTexCoord2f(0, 0); glVertex2f(1, 1);
glTexCoord2f(1, 0); glVertex2f(3, 1);
glTexCoord2f(0.5, 1); glVertex2f(2, 3);
glEnd();
glDisable(GL_TEXTURE_2D);
}
t1 = glutGet(GLUT_ELAPSED_TIME) * 0.001;
time = t1 - t0;
count++;
} while (time < 3.0);
printf("w*h=%d count=%d time=%f\n", w*h, count, time);
DownloadRate = w * h * count / time;
#if 0
if (!ScaleAndBias) {
/* verify texture readback */
glGetTexImage(GL_TEXTURE_2D, 0,
FormatTable[Format].Format,
FormatTable[Format].Type, getImage);
for (i = 0; i < w * h; i++) {
if (texImage[i] != getImage[i]) {
printf("[%d] %d != %d\n", i, texImage[i], getImage[i]);
}
}
}
#endif
free(texImage);
free(getImage);
{
GLint err = glGetError();
if (err)
printf("GL error %d\n", err);
}
}
static void
PrintString(const char *s)
{
while (*s) {
glutBitmapCharacter(GLUT_BITMAP_8_BY_13, (int) *s);
s++;
}
}
static void
Display(void)
{
const int w = TexWidth + 2 * TexBorder;
const int h = TexHeight + 2 * TexBorder;
char s[1000];
glClear(GL_COLOR_BUFFER_BIT);
glRasterPos2i(10, 80);
sprintf(s, "Texture size[cursor]: %d x %d Border[b]: %d", w, h, TexBorder);
PrintString(s);
glRasterPos2i(10, 65);
sprintf(s, "Format[f]: %s Type: %s IntFormat: %s",
FormatStr(FormatTable[Format].Format),
TypeStr( FormatTable[Format].Type),
FormatStr(FormatTable[Format].IntFormat));
PrintString(s);
glRasterPos2i(10, 50);
sprintf(s, "Pixel Scale&Bias[p]: %s TexSubImage[s]: %s",
ScaleAndBias ? "Yes" : "No",
SubImage ? "Yes" : "No");
PrintString(s);
if (Mode == 0) {
glRasterPos2i(200, 10);
sprintf(s, "...Measuring...");
PrintString(s);
glutSwapBuffers();
glutPostRedisplay();
Mode++;
}
else if (Mode == 1) {
MeasureDownloadRate();
glutPostRedisplay();
Mode++;
}
else {
/* show results */
glRasterPos2i(10, 10);
sprintf(s, "Download rate: %g Mtexels/second %g MB/second",
DownloadRate / 1000000.0,
DownloadRate * BytesPerTexel(Format) / 1000000.0);
PrintString(s);
{
GLint r, g, b, a, l, i;
glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_RED_SIZE, &r);
glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_GREEN_SIZE, &g);
glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_BLUE_SIZE, &b);
glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_ALPHA_SIZE, &a);
glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_LUMINANCE_SIZE, &l);
glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_INTENSITY_SIZE, &i);
sprintf(s, "TexelBits: R=%d G=%d B=%d A=%d L=%d I=%d", r, g, b, a, l, i);
glRasterPos2i(10, 25);
PrintString(s);
}
glutSwapBuffers();
}
}
static void
Reshape(int width, int height)
{
glViewport( 0, 0, width, height );
glMatrixMode( GL_PROJECTION );
glLoadIdentity();
glOrtho(0, width, 0, height, -1, 1);
glMatrixMode( GL_MODELVIEW );
glLoadIdentity();
}
static void
Key(unsigned char key, int x, int y)
{
(void) x;
(void) y;
switch (key) {
case ' ':
Mode = 0;
break;
case 'b':
/* toggle border */
TexBorder = 1 - TexBorder;
Mode = 0;
break;
case 'f':
/* change format */
Format = (Format + 1) % NUM_FORMATS;
Mode = 0;
break;
case 'p':
/* toggle border */
ScaleAndBias = !ScaleAndBias;
Mode = 0;
break;
case 's':
SubImage = !SubImage;
Mode = 0;
break;
case 27:
exit(0);
break;
}
glutPostRedisplay();
}
static void
SpecialKey(int key, int x, int y)
{
(void) x;
(void) y;
switch (key) {
case GLUT_KEY_UP:
if (TexHeight < MaxSize)
TexHeight *= 2;
break;
case GLUT_KEY_DOWN:
if (TexHeight > 1)
TexHeight /= 2;
break;
case GLUT_KEY_LEFT:
if (TexWidth > 1)
TexWidth /= 2;
break;
case GLUT_KEY_RIGHT:
if (TexWidth < MaxSize)
TexWidth *= 2;
break;
}
Mode = 0;
glutPostRedisplay();
}
static void
Init(void)
{
printf("GL_VENDOR = %s\n", (const char *) glGetString(GL_VENDOR));
printf("GL_VERSION = %s\n", (const char *) glGetString(GL_VERSION));
printf("GL_RENDERER = %s\n", (const char *) glGetString(GL_RENDERER));
}
int
main(int argc, char *argv[])
{
glutInit( &argc, argv );
glutInitWindowPosition( 0, 0 );
glutInitWindowSize( 600, 100 );
glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH );
glutCreateWindow(argv[0]);
glutReshapeFunc( Reshape );
glutKeyboardFunc( Key );
glutSpecialFunc( SpecialKey );
glutDisplayFunc( Display );
Init();
glutMainLoop();
return 0;
}

774
progs/demos/texenv.c Normal file
View File

@@ -0,0 +1,774 @@
/* Copyright (c) Mark J. Kilgard, 1994. */
/**
* (c) Copyright 1993, Silicon Graphics, Inc.
* ALL RIGHTS RESERVED
* Permission to use, copy, modify, and distribute this software for
* any purpose and without fee is hereby granted, provided that the above
* copyright notice appear in all copies and that both the copyright notice
* and this permission notice appear in supporting documentation, and that
* the name of Silicon Graphics, Inc. not be used in advertising
* or publicity pertaining to distribution of the software without specific,
* written prior permission.
*
* THE MATERIAL EMBODIED ON THIS SOFTWARE IS PROVIDED TO YOU "AS-IS"
* AND WITHOUT WARRANTY OF ANY KIND, EXPRESS, IMPLIED OR OTHERWISE,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY OR
* FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
* GRAPHICS, INC. BE LIABLE TO YOU OR ANYONE ELSE FOR ANY DIRECT,
* SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY
* KIND, OR ANY DAMAGES WHATSOEVER, INCLUDING WITHOUT LIMITATION,
* LOSS OF PROFIT, LOSS OF USE, SAVINGS OR REVENUE, OR THE CLAIMS OF
* THIRD PARTIES, WHETHER OR NOT SILICON GRAPHICS, INC. HAS BEEN
* ADVISED OF THE POSSIBILITY OF SUCH LOSS, HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE
* POSSESSION, USE OR PERFORMANCE OF THIS SOFTWARE.
*
* US Government Users Restricted Rights
* Use, duplication, or disclosure by the Government is subject to
* restrictions set forth in FAR 52.227.19(c)(2) or subparagraph
* (c)(1)(ii) of the Rights in Technical Data and Computer Software
* clause at DFARS 252.227-7013 and/or in similar or successor
* clauses in the FAR or the DOD or NASA FAR Supplement.
* Unpublished-- rights reserved under the copyright laws of the
* United States. Contractor/manufacturer is Silicon Graphics,
* Inc., 2011 N. Shoreline Blvd., Mountain View, CA 94039-7311.
*
* OpenGL(TM) is a trademark of Silicon Graphics, Inc.
*/
/*
* Demonstrates texture environment modes and internal image formats.
*/
/*
* Hacked on, updated by Gareth Hughes <gareth@valinux.com>
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <GL/glut.h>
#undef max
#undef min
#define max( a, b ) ((a) >= (b) ? (a) : (b))
#define min( a, b ) ((a) <= (b) ? (a) : (b))
GLfloat lightCheck[4] = { 0.7, 0.7, 0.7, 1.0 };
GLfloat darkCheck[4] = { 0.3, 0.3, 0.3, 1.0 };
GLfloat labelColor0[4] = { 1.0, 1.0, 1.0, 1.0 };
GLfloat labelColor1[4] = { 1.0, 1.0, 0.4, 1.0 };
GLfloat *labelInfoColor = labelColor0;
GLfloat labelLevelColor0[4] = { 0.8, 0.8, 0.1, 1.0 };
GLfloat labelLevelColor1[4] = { 0.0, 0.0, 0.0, 1.0 };
GLboolean doubleBuffered = GL_FALSE;
GLboolean drawBackground = GL_FALSE;
GLboolean drawBlended = GL_TRUE;
GLboolean drawSmooth = GL_FALSE;
GLboolean drawTextured = GL_TRUE;
GLboolean displayLevelInfo = GL_FALSE;
int textureWidth = 64;
int textureHeight = 64;
int winWidth = 580, winHeight = 720;
struct formatInfo {
GLenum baseFormat;
GLenum internalFormat;
char *name;
};
#define NUM_LUMINANCE_FORMATS (sizeof(luminanceFormats) / sizeof(luminanceFormats[0]))
struct formatInfo luminanceFormats[] =
{
{ GL_LUMINANCE, GL_LUMINANCE, "LUMINANCE" },
{ GL_LUMINANCE, GL_LUMINANCE4, "LUMINANCE4" },
{ GL_LUMINANCE, GL_LUMINANCE8, "LUMINANCE8" },
{ GL_LUMINANCE, GL_LUMINANCE12, "LUMINANCE12" },
{ GL_LUMINANCE, GL_LUMINANCE16, "LUMINANCE16" },
};
#define NUM_ALPHA_FORMATS (sizeof(alphaFormats) / sizeof(alphaFormats[0]))
struct formatInfo alphaFormats[] =
{
{ GL_ALPHA, GL_ALPHA, "ALPHA" },
{ GL_ALPHA, GL_ALPHA4, "ALPHA4" },
{ GL_ALPHA, GL_ALPHA8, "ALPHA8" },
{ GL_ALPHA, GL_ALPHA12, "ALPHA12" },
{ GL_ALPHA, GL_ALPHA16, "ALPHA16" },
};
#define NUM_INTENSITY_FORMATS (sizeof(intensityFormats) / sizeof(intensityFormats[0]))
struct formatInfo intensityFormats[] =
{
{ GL_INTENSITY, GL_INTENSITY, "INTENSITY" },
{ GL_INTENSITY, GL_INTENSITY4, "INTENSITY4" },
{ GL_INTENSITY, GL_INTENSITY8, "INTENSITY8" },
{ GL_INTENSITY, GL_INTENSITY12, "INTENSITY12" },
{ GL_INTENSITY, GL_INTENSITY16, "INTENSITY16" },
};
#define NUM_LUMINANCE_ALPHA_FORMATS (sizeof(luminanceAlphaFormats) / sizeof(luminanceAlphaFormats[0]))
struct formatInfo luminanceAlphaFormats[] =
{
{ GL_LUMINANCE_ALPHA, GL_LUMINANCE_ALPHA, "LUMINANCE_ALPHA" },
{ GL_LUMINANCE_ALPHA, GL_LUMINANCE4_ALPHA4, "LUMINANCE4_ALPHA4" },
{ GL_LUMINANCE_ALPHA, GL_LUMINANCE6_ALPHA2, "LUMINANCE6_ALPHA2" },
{ GL_LUMINANCE_ALPHA, GL_LUMINANCE8_ALPHA8, "LUMINANCE8_ALPHA8" },
{ GL_LUMINANCE_ALPHA, GL_LUMINANCE12_ALPHA4, "LUMINANCE12_ALPHA4" },
{ GL_LUMINANCE_ALPHA, GL_LUMINANCE12_ALPHA12, "LUMINANCE12_ALPHA12" },
{ GL_LUMINANCE_ALPHA, GL_LUMINANCE16_ALPHA16, "LUMINANCE16_ALPHA16" },
};
#define NUM_RGB_FORMATS (sizeof(rgbFormats) / sizeof(rgbFormats[0]))
struct formatInfo rgbFormats[] =
{
{ GL_RGB, GL_RGB, "RGB" },
{ GL_RGB, GL_R3_G3_B2, "R3_G3_B2" },
{ GL_RGB, GL_RGB4, "RGB4" },
{ GL_RGB, GL_RGB5, "RGB5" },
{ GL_RGB, GL_RGB8, "RGB8" },
{ GL_RGB, GL_RGB10, "RGB10" },
{ GL_RGB, GL_RGB12, "RGB12" },
{ GL_RGB, GL_RGB16, "RGB16" },
};
#define NUM_RGBA_FORMATS (sizeof(rgbaFormats) / sizeof(rgbaFormats[0]))
struct formatInfo rgbaFormats[] =
{
{ GL_RGBA, 4, "RGBA" },
{ GL_RGBA, GL_RGBA2, "RGBA2" },
{ GL_RGBA, GL_RGBA4, "RGBA4" },
{ GL_RGBA, GL_RGB5_A1, "RGB5_A1" },
{ GL_RGBA, GL_RGBA8, "RGBA8" },
{ GL_RGBA, GL_RGB10_A2, "RGB10_A2" },
{ GL_RGBA, GL_RGBA12, "RGBA12" },
{ GL_RGBA, GL_RGBA16, "RGBA16" },
};
struct baseFormatInfo {
struct formatInfo *format;
int current, number;
};
#define NUM_BASE_FORMATS (sizeof(baseFormats) / sizeof(baseFormats[0]))
int baseFormat;
struct baseFormatInfo baseFormats[] =
{
{ luminanceFormats, 0, NUM_LUMINANCE_FORMATS },
{ alphaFormats, 0, NUM_ALPHA_FORMATS },
{ intensityFormats, 0, NUM_INTENSITY_FORMATS },
{ luminanceAlphaFormats, 0, NUM_LUMINANCE_ALPHA_FORMATS },
{ rgbFormats, 0, NUM_RGB_FORMATS },
{ rgbaFormats, 0, NUM_RGBA_FORMATS },
};
#define NUM_ENV_COLORS (sizeof(envColors) / sizeof(envColors[0]))
int envColor;
GLfloat envColors[][4] =
{
{ 0.0, 0.0, 0.0, 1.0 },
{ 1.0, 0.0, 0.0, 1.0 },
{ 0.0, 1.0, 0.0, 1.0 },
{ 0.0, 0.0, 1.0, 1.0 },
{ 1.0, 1.0, 1.0, 1.0 },
};
struct envModeInfo {
GLenum mode;
char *name;
};
/* allow for run-time check for GL_EXT_texture_env_add */
int NUM_ENV_MODES = 5;
struct envModeInfo envModes[] =
{
{ GL_REPLACE, "REPLACE" },
{ GL_MODULATE, "MODULATE" },
{ GL_BLEND, "BLEND" },
{ GL_DECAL, "DECAL" },
#if GL_EXT_texture_env_add
{ GL_ADD, "ADD" },
#endif
};
static void checkErrors( void )
{
GLenum error;
return;
while ( (error = glGetError()) != GL_NO_ERROR ) {
fprintf( stderr, "Error: %s\n", (char *) gluErrorString( error ) );
}
}
static void drawString( char *string, GLfloat x, GLfloat y, GLfloat color[4] )
{
glColor4fv( color );
glRasterPos2f( x, y );
while ( *string ) {
glutBitmapCharacter( GLUT_BITMAP_TIMES_ROMAN_10, *string );
string++;
}
}
static void drawStringOutline( char *string, GLfloat x, GLfloat y,
GLfloat color[4], GLfloat outline[4] )
{
drawString( string, x - 1, y, outline );
drawString( string, x + 1, y, outline );
drawString( string, x, y - 1, outline );
drawString( string, x, y + 1, outline );
drawString( string, x, y, color );
}
static void begin2D( int width, int height )
{
glMatrixMode( GL_PROJECTION );
glPushMatrix();
glLoadIdentity();
glOrtho( 0, width, 0, height, -1, 1 );
glMatrixMode( GL_MODELVIEW );
glPushMatrix();
glLoadIdentity();
}
static void end2D( void )
{
glMatrixMode( GL_PROJECTION );
glPopMatrix();
glMatrixMode( GL_MODELVIEW );
glPopMatrix();
}
static void initialize( void )
{
glMatrixMode( GL_PROJECTION );
glLoadIdentity();
glOrtho( -1.5, 1.5, -1.5, 1.5, -1.5, 1.5 );
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glShadeModel( GL_FLAT );
}
/* ARGSUSED1 */
static void keyboard( unsigned char c, int x, int y )
{
switch ( c ) {
case 'c':
envColor = ++envColor % (int) NUM_ENV_COLORS;
break;
case 'g':
drawBackground = !drawBackground;
break;
case 'b':
drawBlended = !drawBlended;
break;
case 's':
drawSmooth = !drawSmooth;
break;
case 't':
drawTextured = !drawTextured;
break;
case 'i':
displayLevelInfo = !displayLevelInfo;
break;
case 27: /* Escape key should force exit. */
exit(0);
break;
default:
break;
}
glutPostRedisplay();
}
/* ARGSUSED1 */
static void special( int key, int x, int y )
{
switch ( key ) {
case GLUT_KEY_DOWN:
if ( ++baseFormat > NUM_BASE_FORMATS - 1 ) {
baseFormat = 0;
}
break;
case GLUT_KEY_UP:
if ( --baseFormat < 0 ) {
baseFormat = NUM_BASE_FORMATS - 1;
}
break;
case GLUT_KEY_LEFT:
--baseFormats[baseFormat].current;
if ( baseFormats[baseFormat].current < 0 ) {
baseFormats[baseFormat].current = baseFormats[baseFormat].number - 1;
}
break;
case GLUT_KEY_RIGHT:
++baseFormats[baseFormat].current;
if ( baseFormats[baseFormat].current > baseFormats[baseFormat].number - 1 ) {
baseFormats[baseFormat].current = 0;
}
break;
default:
break;
}
glutPostRedisplay();
}
static void
reshape( int w, int h )
{
winWidth = w;
winHeight = h;
/* No need to call glViewPort here since "draw" calls it! */
}
static void loadTexture( int width, int height, struct formatInfo *format )
{
int luminanceSize = 0;
int alphaSize = 0;
int rgbSize = 0;
GLenum textureFormat;
GLubyte *texImage, *p;
int elementsPerGroup, elementSize, groupSize, rowSize;
int i, j;
switch ( format->baseFormat ) {
case GL_LUMINANCE:
luminanceSize = 1;
textureFormat = GL_LUMINANCE;
break;
case GL_INTENSITY:
luminanceSize = 1;
textureFormat = GL_INTENSITY;
break;
case GL_ALPHA:
alphaSize = 1;
textureFormat = GL_ALPHA;
break;
case GL_LUMINANCE_ALPHA:
luminanceSize = 1;
alphaSize = 1;
textureFormat = GL_LUMINANCE_ALPHA;
break;
case GL_RGB:
rgbSize = 3;
textureFormat = GL_RGB;
break;
case GL_RGBA:
rgbSize = 3;
alphaSize = 1;
textureFormat = GL_RGBA;
break;
default:
fprintf(stderr, "bad internal format info\n");
return;
}
elementsPerGroup = luminanceSize + alphaSize + rgbSize;
elementSize = sizeof(GLubyte);
groupSize = elementsPerGroup * elementSize;
rowSize = width * groupSize;
if ( (texImage = (GLubyte *) malloc( height * rowSize ) ) == NULL ) {
fprintf( stderr, "texture malloc failed\n" );
return;
}
for ( i = 0 ; i < height ; i++ )
{
p = texImage + i * rowSize;
for ( j = 0 ; j < width ; j++ )
{
if ( luminanceSize > 0 )
{
/**
** +-----+-----+
** | | |
** | W | LG |
** | | |
** +-----+-----+
** | | |
** | DG | B |
** | | |
** +-----+-----+
**/
if ( i > height / 2 ) {
if ( j < width / 2 ) {
p[0] = 0xff;
} else {
p[0] = 0xaa;
}
} else {
if ( j < width / 2 ) {
p[0] = 0x55;
} else {
p[0] = 0x00;
}
}
p += elementSize;
}
if ( rgbSize > 0 )
{
/**
** +-----+-----+
** | | |
** | R | G |
** | | |
** +-----+-----+
** | | |
** | Y | B |
** | | |
** +-----+-----+
**/
if ( i > height / 2 ) {
if ( j < width / 2 ) {
p[0] = 0xff;
p[1] = 0x00;
p[2] = 0x00;
} else {
p[0] = 0x00;
p[1] = 0xff;
p[2] = 0x00;
}
} else {
if ( j < width / 2 ) {
p[0] = 0xff;
p[1] = 0xff;
p[2] = 0x00;
} else {
p[0] = 0x00;
p[1] = 0x00;
p[2] = 0xff;
}
}
p += 3 * elementSize;
}
if ( alphaSize > 0 )
{
/**
** +-----------+
** | W |
** | +-----+ |
** | | | |
** | | B | |
** | | | |
** | +-----+ |
** | |
** +-----------+
**/
int i2 = i - height / 2;
int j2 = j - width / 2;
int h8 = height / 8;
int w8 = width / 8;
if ( -h8 <= i2 && i2 <= h8 && -w8 <= j2 && j2 <= w8 ) {
p[0] = 0x00;
} else if ( -2 * h8 <= i2 && i2 <= 2 * h8 && -2 * w8 <= j2 && j2 <= 2 * w8 ) {
p[0] = 0x55;
} else if ( -3 * h8 <= i2 && i2 <= 3 * h8 && -3 * w8 <= j2 && j2 <= 3 * w8 ) {
p[0] = 0xaa;
} else {
p[0] = 0xff;
}
p += elementSize;
}
}
}
glTexImage2D( GL_TEXTURE_2D, 0,
format->internalFormat, width, height, 0,
textureFormat, GL_UNSIGNED_BYTE, texImage );
free( texImage );
}
static void drawCheck( int w, int h, GLfloat lightCheck[4], GLfloat darkCheck[4] )
{
float dw = 2.0 / w;
float dh = 2.0 / h;
int i, j;
for ( i = 0 ; i < w ; i++ ) {
GLfloat x0 = -1.0 + i * dw;
GLfloat x1 = x0 + dw;
glBegin( GL_QUAD_STRIP );
for ( j = 0 ; j <= h ; j++ ) {
GLfloat y = -1.0 + j * dh;
if ( (i ^ j) & 1 ) {
glColor4fv( lightCheck );
} else {
glColor4fv( darkCheck );
}
glVertex2f( x0, y );
glVertex2f( x1, y );
}
glEnd();
}
}
static void drawSample( int x, int y, int w, int h,
struct formatInfo *format, struct envModeInfo *envMode )
{
glViewport( x, y, w, h );
glScissor( x, y, w, h );
glClearColor( 0.1, 0.1, 0.1, 1.0 );
glClear( GL_COLOR_BUFFER_BIT );
begin2D( w, h );
drawString( format->name, 10, h - 15, labelInfoColor );
drawString( envMode->name, 10, 5, labelInfoColor );
end2D();
glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, envMode->mode );
glTexEnvfv( GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, envColors[envColor] );
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP );
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP );
loadTexture( textureWidth, textureHeight, format );
if ( drawBackground ) {
drawCheck( 15, 15, lightCheck, darkCheck );
}
if ( drawBlended ) {
glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
glEnable( GL_BLEND );
}
if ( drawSmooth ) {
glShadeModel( GL_SMOOTH );
}
else {
glShadeModel( GL_FLAT );
glColor4f(1, 1, 1, 1);
}
if ( drawTextured ) {
glEnable( GL_TEXTURE_2D );
}
glBegin( GL_QUADS );
if ( drawSmooth ) glColor4f( 1.0, 0.0, 1.0, 1.0 );
glTexCoord2f( 0.0, 0.0 );
glVertex2f( -0.8, -0.8 );
if ( drawSmooth ) glColor4f( 1.0, 0.0, 1.0, 1.0 );
glTexCoord2f( 1.0, 0.0 );
glVertex2f( 0.8, -0.8 );
if ( drawSmooth ) glColor4f( 0.0, 1.0, 0.0, 1.0 );
glTexCoord2f( 1.0, 1.0 );
glVertex2f( 0.8, 0.8 );
if ( drawSmooth ) glColor4f( 0.0, 1.0, 0.0, 1.0 );
glTexCoord2f( 0.0, 1.0 );
glVertex2f( -0.8, 0.8 );
glEnd();
glDisable( GL_BLEND );
glShadeModel( GL_FLAT );
glDisable( GL_TEXTURE_2D );
if ( envMode->mode == GL_DECAL &&
(format->baseFormat == GL_ALPHA ||
format->baseFormat == GL_LUMINANCE ||
format->baseFormat == GL_LUMINANCE_ALPHA ||
format->baseFormat == GL_INTENSITY)) {
/* undefined format/mode combination */
begin2D( w, h );
drawStringOutline( "UNDEFINED MODE", 15, h / 2,
labelLevelColor0, labelLevelColor1 );
end2D();
}
else if ( displayLevelInfo ) {
GLint width, height, border, components;
GLint redSize, greenSize, blueSize, alphaSize;
GLint luminanceSize, intensitySize;
char buf[255];
glGetTexLevelParameteriv( GL_TEXTURE_2D, 0, GL_TEXTURE_WIDTH, &width );
glGetTexLevelParameteriv( GL_TEXTURE_2D, 0, GL_TEXTURE_HEIGHT, &height );
glGetTexLevelParameteriv( GL_TEXTURE_2D, 0, GL_TEXTURE_BORDER, &border );
glGetTexLevelParameteriv( GL_TEXTURE_2D, 0, GL_TEXTURE_COMPONENTS, &components );
glGetTexLevelParameteriv( GL_TEXTURE_2D, 0, GL_TEXTURE_RED_SIZE, &redSize );
glGetTexLevelParameteriv( GL_TEXTURE_2D, 0, GL_TEXTURE_GREEN_SIZE, &greenSize );
glGetTexLevelParameteriv( GL_TEXTURE_2D, 0, GL_TEXTURE_BLUE_SIZE, &blueSize );
glGetTexLevelParameteriv( GL_TEXTURE_2D, 0, GL_TEXTURE_ALPHA_SIZE, &alphaSize );
glGetTexLevelParameteriv( GL_TEXTURE_2D, 0, GL_TEXTURE_LUMINANCE_SIZE, &luminanceSize );
glGetTexLevelParameteriv( GL_TEXTURE_2D, 0, GL_TEXTURE_INTENSITY_SIZE, &intensitySize );
begin2D( w, h );
sprintf( buf, "dimensions: %d x %d", width, height );
drawStringOutline( buf, 15, h / 2 + 20, labelLevelColor0, labelLevelColor1 );
sprintf( buf, "border: %d", border );
drawStringOutline( buf, 15, h / 2 + 10, labelLevelColor0, labelLevelColor1 );
sprintf( buf, "components: 0x%04X", components );
drawStringOutline( buf, 15, h / 2, labelLevelColor0, labelLevelColor1 );
sprintf( buf, "sizes:" );
drawStringOutline( buf, 15, h / 2 - 10, labelLevelColor0, labelLevelColor1 );
sprintf( buf, " %d / %d / %d / %d / %d / %d",
redSize, greenSize, blueSize, alphaSize,
luminanceSize, intensitySize );
drawStringOutline( buf, 15, h / 2 - 20, labelLevelColor0, labelLevelColor1 );
end2D();
}
}
static void display( void )
{
int numX = NUM_ENV_MODES, numY = NUM_BASE_FORMATS;
float xBase = (float) winWidth * 0.01;
float xOffset = (winWidth - xBase) / numX;
float xSize = max( xOffset - xBase, 1 );
float yBase = (float) winHeight * 0.01;
float yOffset = (winHeight - yBase) / numY;
float ySize = max( yOffset - yBase, 1 );
float x, y;
int i, j;
glViewport( 0, 0, winWidth, winHeight );
glDisable( GL_SCISSOR_TEST );
glClearColor( 0.0, 0.0, 0.0, 0.0 );
glClear( GL_COLOR_BUFFER_BIT );
glEnable( GL_SCISSOR_TEST );
x = xBase;
y = (winHeight - 1) - yOffset;
for ( i = 0 ; i < NUM_BASE_FORMATS ; i++ )
{
struct formatInfo *format;
if ( i == baseFormat ) {
labelInfoColor = labelColor1;
} else {
labelInfoColor = labelColor0;
}
format = &baseFormats[i].format[baseFormats[i].current];
for ( j = 0 ; j < NUM_ENV_MODES ; j++ ) {
struct envModeInfo *envMode;
envMode = &envModes[j];
drawSample( x, y, xSize, ySize, format, envMode );
x += xOffset;
}
x = xBase;
y -= yOffset;
}
if ( doubleBuffered ) {
glutSwapBuffers();
} else {
glFlush();
}
checkErrors();
}
static void usage( char *name )
{
fprintf( stderr, "usage: %s [ options ]\n", name );
fprintf( stderr, "\n" );
fprintf( stderr, "options:\n" );
fprintf( stderr, " -sb single buffered\n" );
fprintf( stderr, " -db double buffered\n" );
fprintf( stderr, " -info print OpenGL driver info\n" );
}
static void instructions( void )
{
fprintf( stderr, "texenv - texture environment and internal format test\n" );
fprintf( stderr, "\n" );
fprintf( stderr, " [c] - cycle through background colors\n" );
fprintf( stderr, " [g] - toggle background\n" );
fprintf( stderr, " [b] - toggle blend\n" );
fprintf( stderr, " [s] - toggle smooth shading\n" );
fprintf( stderr, " [t] - toggle texturing\n" );
fprintf( stderr, " [i] - toggle information display\n" );
}
int main( int argc, char *argv[] )
{
GLboolean info = GL_FALSE;
int i;
glutInit( &argc, argv );
for ( i = 1 ; i < argc ; i++ ) {
if ( !strcmp( "-sb", argv[i] ) ) {
doubleBuffered = GL_FALSE;
} else if ( !strcmp( "-db", argv[i] ) ) {
doubleBuffered = GL_TRUE;
} else if ( !strcmp( "-info", argv[i] ) ) {
info = GL_TRUE;
} else {
usage( argv[0] );
exit( 1 );
}
}
if ( doubleBuffered ) {
glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE );
} else {
glutInitDisplayMode( GLUT_RGB | GLUT_SINGLE );
}
glutInitWindowSize( winWidth, winHeight );
glutCreateWindow( "Texture Environment Test" );
initialize();
instructions();
if ( info ) {
printf( "\n" );
printf( "GL_RENDERER = %s\n", (char *) glGetString( GL_RENDERER ) );
printf( "GL_VERSION = %s\n", (char *) glGetString( GL_VERSION ) );
printf( "GL_VENDOR = %s\n", (char *) glGetString( GL_VENDOR ) ) ;
printf( "GL_EXTENSIONS = %s\n", (char *) glGetString( GL_EXTENSIONS ) );
}
#if GL_EXT_texture_env_add
if ( !glutExtensionSupported( "GL_EXT_texture_env_add" ) ) {
fprintf( stderr, "missing extension: GL_EXT_texture_env_add\n" );
NUM_ENV_MODES--;
}
#endif
glutDisplayFunc( display );
glutReshapeFunc( reshape );
glutKeyboardFunc( keyboard );
glutSpecialFunc( special );
glutMainLoop();
return 0;
}

View File

@@ -1,4 +1,4 @@
/* $Id: texobj.c,v 1.1 1999/08/19 00:55:40 jtg Exp $ */
/* $Id: texobj.c,v 1.5 2000/07/19 23:57:24 brianp Exp $ */
/*
* Example of using the 1.1 texture object functions.
@@ -7,21 +7,6 @@
* Brian Paul June 1996 This file is in the public domain.
*/
/*
* $Log: texobj.c,v $
* Revision 1.1 1999/08/19 00:55:40 jtg
* Initial revision
*
* Revision 3.1 1999/03/28 18:24:37 brianp
* minor clean-up
*
* Revision 3.0 1998/02/14 18:42:29 brianp
* initial rev
*
*/
#include <math.h>
#include <stdlib.h>
#include <string.h>
@@ -31,10 +16,10 @@ static GLuint Window = 0;
static GLuint TexObj[2];
static GLfloat Angle = 0.0f;
static GLboolean HaveTexObj = GL_FALSE;
static GLboolean UseObj = GL_FALSE;
#if defined(GL_VERSION_1_1)
#if defined(GL_VERSION_1_1) || defined(GL_VERSION_1_2)
# define TEXTURE_OBJECT 1
#elif defined(GL_EXT_texture_object)
# define TEXTURE_OBJECT 1
@@ -58,7 +43,7 @@ static void draw( void )
glPushMatrix();
glTranslatef( -1.0, 0.0, 0.0 );
glRotatef( Angle, 0.0, 0.0, 1.0 );
if (HaveTexObj) {
if (UseObj) {
#ifdef TEXTURE_OBJECT
glBindTexture( GL_TEXTURE_2D, TexObj[0] );
#endif
@@ -78,13 +63,13 @@ static void draw( void )
glPushMatrix();
glTranslatef( 1.0, 0.0, 0.0 );
glRotatef( Angle-90.0, 0.0, 1.0, 0.0 );
if (HaveTexObj) {
if (UseObj) {
#ifdef TEXTURE_OBJECT
glBindTexture( GL_TEXTURE_2D, TexObj[1] );
#endif
}
else {
glCallList( TexObj[0] );
glCallList( TexObj[1] );
}
glBegin( GL_POLYGON );
glTexCoord2f( 0.0, 0.0 ); glVertex2f( -1.0, -1.0 );
@@ -174,7 +159,7 @@ static void init( void )
/* generate texture object IDs */
if (HaveTexObj) {
if (UseObj) {
#ifdef TEXTURE_OBJECT
glGenTextures( 2, TexObj );
#endif
@@ -185,7 +170,7 @@ static void init( void )
}
/* setup first texture object */
if (HaveTexObj) {
if (UseObj) {
#ifdef TEXTURE_OBJECT
glBindTexture( GL_TEXTURE_2D, TexObj[0] );
#endif
@@ -212,13 +197,13 @@ static void init( void )
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST );
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT );
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT );
if (!HaveTexObj) {
if (!UseObj) {
glEndList();
}
/* end of texture object */
/* setup second texture object */
if (HaveTexObj) {
if (UseObj) {
#ifdef TEXTURE_OBJECT
glBindTexture( GL_TEXTURE_2D, TexObj[1] );
#endif
@@ -244,7 +229,7 @@ static void init( void )
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST );
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT );
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT );
if (!HaveTexObj) {
if (!UseObj) {
glEndList();
}
/* end texture object */
@@ -255,6 +240,7 @@ static void init( void )
int main( int argc, char *argv[] )
{
glutInit(&argc, argv);
glutInitWindowPosition(0, 0);
glutInitWindowSize(300, 300);
glutInitDisplayMode( GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE );
@@ -272,8 +258,9 @@ int main( int argc, char *argv[] )
char *exten = (char *) glGetString( GL_EXTENSIONS );
char *version = (char *) glGetString( GL_VERSION );
if ( strstr( exten, "GL_EXT_texture_object" )
|| strncmp( version, "1.1", 3 )==0 ) {
HaveTexObj = GL_TRUE;
|| strncmp( version, "1.1", 3 )==0
|| strncmp( version, "1.2", 3 )==0 ) {
UseObj = GL_TRUE;
}
}
#endif

View File

@@ -1,4 +1,4 @@
/* $Id: trispd.c,v 1.1 1999/08/19 00:55:40 jtg Exp $ */
/* $Id: trispd.c,v 1.1.1.1.6.1 2000/10/26 15:26:27 brianp Exp $ */
/*
* Simple GLUT program to measure triangle strip rendering speed.
@@ -7,8 +7,11 @@
/*
* $Log: trispd.c,v $
* Revision 1.1 1999/08/19 00:55:40 jtg
* Initial revision
* Revision 1.1.1.1.6.1 2000/10/26 15:26:27 brianp
* added a glFinish() call
*
* Revision 1.1.1.1 1999/08/19 00:55:40 jtg
* Imported sources
*
* Revision 3.4 1999/03/28 18:24:37 brianp
* minor clean-up
@@ -107,6 +110,7 @@ static void Display( void )
}
}
}
glFinish();
t1 = glutGet(GLUT_ELAPSED_TIME) * 0.001;
if (t1-t0 < MinPeriod) {

510
progs/demos/tunnel.c Normal file
View File

@@ -0,0 +1,510 @@
/*
* This program is under the GNU GPL.
* Use at your own risk.
*
* written by David Bucciarelli (tech.hmw@plus.it)
* Humanware s.r.l.
*/
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <time.h>
#ifdef WIN32
#include <windows.h>
#endif
#include <GL/glut.h>
#include "../util/readtex.c"
#include "tunneldat.c"
#ifdef XMESA
#include "GL/xmesa.h"
static int fullscreen = 1;
#endif
static int WIDTH = 640;
static int HEIGHT = 480;
static GLint T0 = 0;
static GLint Frames = 0;
#define NUMBLOC 5
#ifndef M_PI
#define M_PI 3.1415926535
#endif
extern int striplength_skin_13[];
extern float stripdata_skin_13[];
extern int striplength_skin_12[];
extern float stripdata_skin_12[];
extern int striplength_skin_11[];
extern float stripdata_skin_11[];
extern int striplength_skin_9[];
extern float stripdata_skin_9[];
static int win = 0;
static float obs[3] = { 1000.0, 0.0, 2.0 };
static float dir[3];
static float v = 0.5;
static float alpha = 90.0;
static float beta = 90.0;
static int fog = 1;
static int bfcull = 1;
static int usetex = 1;
static int cstrip = 0;
static int help = 1;
static int joyavailable = 0;
static int joyactive = 0;
static GLuint t1id, t2id;
static void
inittextures(void)
{
glGenTextures(1, &t1id);
glBindTexture(GL_TEXTURE_2D, t1id);
if (!LoadRGBMipmaps("../images/tile.rgb", GL_RGB)) {
fprintf(stderr, "Error reading a texture.\n");
exit(-1);
}
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,
GL_LINEAR_MIPMAP_LINEAR);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glGenTextures(1, &t2id);
glBindTexture(GL_TEXTURE_2D, t2id);
if (!LoadRGBMipmaps("../images/bw.rgb", GL_RGB)) {
fprintf(stderr, "Error reading a texture.\n");
exit(-1);
}
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,
GL_LINEAR_MIPMAP_LINEAR);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
}
static void
drawobjs(int *l, float *f)
{
int mend, j;
if (cstrip) {
float r = 0.33, g = 0.33, b = 0.33;
for (; (*l) != 0;) {
mend = *l++;
r += 0.33;
if (r > 1.0) {
r = 0.33;
g += 0.33;
if (g > 1.0) {
g = 0.33;
b += 0.33;
if (b > 1.0)
b = 0.33;
}
}
glColor3f(r, g, b);
glBegin(GL_TRIANGLE_STRIP);
for (j = 0; j < mend; j++) {
f += 4;
glTexCoord2fv(f);
f += 2;
glVertex3fv(f);
f += 3;
}
glEnd();
}
}
else
for (; (*l) != 0;) {
mend = *l++;
glBegin(GL_TRIANGLE_STRIP);
for (j = 0; j < mend; j++) {
glColor4fv(f);
f += 4;
glTexCoord2fv(f);
f += 2;
glVertex3fv(f);
f += 3;
}
glEnd();
}
}
static void
calcposobs(void)
{
dir[0] = sin(alpha * M_PI / 180.0);
dir[1] = cos(alpha * M_PI / 180.0) * sin(beta * M_PI / 180.0);
dir[2] = cos(beta * M_PI / 180.0);
obs[0] += v * dir[0];
obs[1] += v * dir[1];
obs[2] += v * dir[2];
}
static void
special(int k, int x, int y)
{
switch (k) {
case GLUT_KEY_LEFT:
alpha -= 2.0;
break;
case GLUT_KEY_RIGHT:
alpha += 2.0;
break;
case GLUT_KEY_DOWN:
beta -= 2.0;
break;
case GLUT_KEY_UP:
beta += 2.0;
break;
}
}
static void
key(unsigned char k, int x, int y)
{
switch (k) {
case 27:
exit(0);
break;
case 'a':
v += 0.01;
break;
case 'z':
v -= 0.01;
break;
#ifdef XMESA
case ' ':
fullscreen = (!fullscreen);
XMesaSetFXmode(fullscreen ? XMESA_FX_FULLSCREEN : XMESA_FX_WINDOW);
break;
#endif
case 'j':
joyactive = (!joyactive);
break;
case 'h':
help = (!help);
break;
case 'f':
fog = (!fog);
break;
case 't':
usetex = (!usetex);
break;
case 'b':
if (bfcull) {
glDisable(GL_CULL_FACE);
bfcull = 0;
}
else {
glEnable(GL_CULL_FACE);
bfcull = 1;
}
break;
case 'm':
cstrip = (!cstrip);
break;
case 'd':
fprintf(stderr, "Deleting textures...\n");
glDeleteTextures(1, &t1id);
glDeleteTextures(1, &t2id);
fprintf(stderr, "Loading textures...\n");
inittextures();
fprintf(stderr, "Done.\n");
break;
}
glutPostRedisplay();
}
static void
reshape(int w, int h)
{
WIDTH = w;
HEIGHT = h;
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(80.0, w / (float) h, 1.0, 50.0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glViewport(0, 0, w, h);
}
static void
printstring(void *font, char *string)
{
int len, i;
len = (int) strlen(string);
for (i = 0; i < len; i++)
glutBitmapCharacter(font, string[i]);
}
static void
printhelp(void)
{
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glColor4f(0.0, 0.0, 0.0, 0.5);
glRecti(40, 40, 600, 440);
glColor3f(1.0, 0.0, 0.0);
glRasterPos2i(300, 420);
printstring(GLUT_BITMAP_TIMES_ROMAN_24, "Help");
glRasterPos2i(60, 390);
printstring(GLUT_BITMAP_TIMES_ROMAN_24, "h - Togle Help");
glRasterPos2i(60, 360);
printstring(GLUT_BITMAP_TIMES_ROMAN_24, "t - Togle Textures");
glRasterPos2i(60, 330);
printstring(GLUT_BITMAP_TIMES_ROMAN_24, "f - Togle Fog");
glRasterPos2i(60, 300);
printstring(GLUT_BITMAP_TIMES_ROMAN_24, "m - Togle strips");
glRasterPos2i(60, 270);
printstring(GLUT_BITMAP_TIMES_ROMAN_24, "b - Togle Back face culling");
glRasterPos2i(60, 240);
printstring(GLUT_BITMAP_TIMES_ROMAN_24, "Arrow Keys - Rotate");
glRasterPos2i(60, 210);
printstring(GLUT_BITMAP_TIMES_ROMAN_24, "a - Increase velocity");
glRasterPos2i(60, 180);
printstring(GLUT_BITMAP_TIMES_ROMAN_24, "z - Decrease velocity");
glRasterPos2i(60, 150);
if (joyavailable)
printstring(GLUT_BITMAP_TIMES_ROMAN_24,
"j - Togle jostick control (Joystick control available)");
else
printstring(GLUT_BITMAP_TIMES_ROMAN_24,
"(No Joystick control available)");
}
static void
dojoy(void)
{
#ifdef WIN32
static UINT max[2] = { 0, 0 };
static UINT min[2] = { 0xffffffff, 0xffffffff }, center[2];
MMRESULT res;
JOYINFO joy;
res = joyGetPos(JOYSTICKID1, &joy);
if (res == JOYERR_NOERROR) {
joyavailable = 1;
if (max[0] < joy.wXpos)
max[0] = joy.wXpos;
if (min[0] > joy.wXpos)
min[0] = joy.wXpos;
center[0] = (max[0] + min[0]) / 2;
if (max[1] < joy.wYpos)
max[1] = joy.wYpos;
if (min[1] > joy.wYpos)
min[1] = joy.wYpos;
center[1] = (max[1] + min[1]) / 2;
if (joyactive) {
if (fabs(center[0] - (float) joy.wXpos) > 0.1 * (max[0] - min[0]))
alpha -=
2.0 * (center[0] - (float) joy.wXpos) / (max[0] - min[0]);
if (fabs(center[1] - (float) joy.wYpos) > 0.1 * (max[1] - min[1]))
beta += 2.0 * (center[1] - (float) joy.wYpos) / (max[1] - min[1]);
if (joy.wButtons & JOY_BUTTON1)
v += 0.01;
if (joy.wButtons & JOY_BUTTON2)
v -= 0.01;
}
}
else
joyavailable = 0;
#endif
}
static void
draw(void)
{
static char frbuf[80] = "";
int i;
float base, offset;
dojoy();
glClear(GL_COLOR_BUFFER_BIT);
if (usetex)
glEnable(GL_TEXTURE_2D);
else
glDisable(GL_TEXTURE_2D);
if (fog)
glEnable(GL_FOG);
else
glDisable(GL_FOG);
glShadeModel(GL_SMOOTH);
glPushMatrix();
calcposobs();
gluLookAt(obs[0], obs[1], obs[2],
obs[0] + dir[0], obs[1] + dir[1], obs[2] + dir[2],
0.0, 0.0, 1.0);
if (dir[0] > 0) {
offset = 8.0;
base = obs[0] - fmod(obs[0], 8.0);
}
else {
offset = -8.0;
base = obs[0] + (8.0 - fmod(obs[0], 8.0));
}
glPushMatrix();
glTranslatef(base - offset / 2.0, 0.0, 0.0);
for (i = 0; i < NUMBLOC; i++) {
glTranslatef(offset, 0.0, 0.0);
glBindTexture(GL_TEXTURE_2D, t1id);
drawobjs(striplength_skin_11, stripdata_skin_11);
glBindTexture(GL_TEXTURE_2D, t2id);
drawobjs(striplength_skin_12, stripdata_skin_12);
drawobjs(striplength_skin_9, stripdata_skin_9);
drawobjs(striplength_skin_13, stripdata_skin_13);
}
glPopMatrix();
glPopMatrix();
glDisable(GL_TEXTURE_2D);
glDisable(GL_FOG);
glShadeModel(GL_FLAT);
glMatrixMode(GL_PROJECTION);
glPushMatrix();
glLoadIdentity();
glOrtho(-0.5, 639.5, -0.5, 479.5, -1.0, 1.0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glColor3f(1.0, 0.0, 0.0);
glRasterPos2i(10, 10);
printstring(GLUT_BITMAP_HELVETICA_18, frbuf);
glRasterPos2i(350, 470);
printstring(GLUT_BITMAP_HELVETICA_10,
"Tunnel V1.5 Written by David Bucciarelli (tech.hmw@plus.it)");
if (help)
printhelp();
glMatrixMode(GL_PROJECTION);
glPopMatrix();
glMatrixMode(GL_MODELVIEW);
glutSwapBuffers();
Frames++;
{
GLint t = glutGet(GLUT_ELAPSED_TIME);
if (t - T0 >= 2000) {
GLfloat seconds = (t - T0) / 1000.0;
GLfloat fps = Frames / seconds;
sprintf(frbuf, "Frame rate: %f", fps);
T0 = t;
Frames = 0;
}
}
}
static void
idle(void)
{
glutPostRedisplay();
}
int
main(int ac, char **av)
{
float fogcolor[4] = { 0.7, 0.7, 0.7, 1.0 };
fprintf(stderr,
"Tunnel V1.5\nWritten by David Bucciarelli (tech.hmw@plus.it)\n");
glutInitWindowPosition(0, 0);
glutInitWindowSize(WIDTH, HEIGHT);
glutInit(&ac, av);
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE);
if (!(win = glutCreateWindow("Tunnel"))) {
fprintf(stderr, "Error, couldn't open window\n");
return -1;
}
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(80.0, WIDTH / (float) HEIGHT, 1.0, 50.0);
glMatrixMode(GL_MODELVIEW);
glShadeModel(GL_SMOOTH);
glDisable(GL_DEPTH_TEST);
glEnable(GL_CULL_FACE);
glEnable(GL_TEXTURE_2D);
glEnable(GL_FOG);
glFogi(GL_FOG_MODE, GL_EXP2);
glFogfv(GL_FOG_COLOR, fogcolor);
glFogf(GL_FOG_DENSITY, 0.06);
glHint(GL_FOG_HINT, GL_NICEST);
inittextures();
glClearColor(fogcolor[0], fogcolor[1], fogcolor[2], fogcolor[3]);
glClear(GL_COLOR_BUFFER_BIT);
calcposobs();
glutReshapeFunc(reshape);
glutDisplayFunc(draw);
glutKeyboardFunc(key);
glutSpecialFunc(special);
glutIdleFunc(idle);
glEnable(GL_BLEND);
/*glBlendFunc(GL_SRC_ALPHA_SATURATE,GL_ONE); */
/*glEnable(GL_POLYGON_SMOOTH); */
glutMainLoop();
return 0;
}

616
progs/demos/tunnel2.c Normal file
View File

@@ -0,0 +1,616 @@
/*
* This program is under the GNU GPL.
* Use at your own risk.
*
* You need TWO Voodoo Graphics boards in order to run
* this demo !
*
* written by David Bucciarelli (tech.hmw@plus.it)
* Humanware s.r.l.
*/
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <time.h>
#ifdef WIN32
#include <windows.h>
#endif
#include <GL/glut.h>
#include "../util/readtex.c"
#include "tunneldat.c"
#ifdef FX
#endif
#ifdef XMESA
#include "GL/xmesa.h"
static int fullscreen = 1;
#endif
#ifdef FX
GLboolean fxMesaSelectCurrentBoard(int);
#endif
static int WIDTHC0 = 640;
static int HEIGHTC0 = 480;
static int WIDTHC1 = 640;
static int HEIGHTC1 = 480;
#define FRAME 50
#define NUMBLOC 5
#ifndef M_PI
#define M_PI 3.1415926535
#endif
extern int striplength_skin_13[];
extern float stripdata_skin_13[];
extern int striplength_skin_12[];
extern float stripdata_skin_12[];
extern int striplength_skin_11[];
extern float stripdata_skin_11[];
extern int striplength_skin_9[];
extern float stripdata_skin_9[];
static float obs[3] = { 1000.0, 0.0, 2.0 };
static float dir[3];
static float v = 0.5;
static float alpha = 90.0;
static float beta = 90.0;
static int fog = 0;
static int bfcull = 1;
static int usetex = 1;
static int cstrip = 0;
static int help = 1;
static int joyavailable = 0;
static int joyactive = 0;
static int channel[2];
static GLuint t1id, t2id;
static void
inittextures(void)
{
glGenTextures(1, &t1id);
glBindTexture(GL_TEXTURE_2D, t1id);
if (!LoadRGBMipmaps("../images/tile.rgb", GL_RGB)) {
fprintf(stderr, "Error reading a texture.\n");
exit(-1);
}
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,
GL_LINEAR_MIPMAP_NEAREST);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glGenTextures(1, &t2id);
glBindTexture(GL_TEXTURE_2D, t2id);
if (!LoadRGBMipmaps("../images/bw.rgb", GL_RGB)) {
fprintf(stderr, "Error reading a texture.\n");
exit(-1);
}
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,
GL_LINEAR_MIPMAP_NEAREST);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
}
static void
drawobjs(int *l, float *f)
{
int mend, j;
if (cstrip) {
float r = 0.33, g = 0.33, b = 0.33;
for (; (*l) != 0;) {
mend = *l++;
r += 0.33;
if (r > 1.0) {
r = 0.33;
g += 0.33;
if (g > 1.0) {
g = 0.33;
b += 0.33;
if (b > 1.0)
b = 0.33;
}
}
glColor3f(r, g, b);
glBegin(GL_TRIANGLE_STRIP);
for (j = 0; j < mend; j++) {
f += 4;
glTexCoord2fv(f);
f += 2;
glVertex3fv(f);
f += 3;
}
glEnd();
}
}
else
for (; (*l) != 0;) {
mend = *l++;
glBegin(GL_TRIANGLE_STRIP);
for (j = 0; j < mend; j++) {
glColor4fv(f);
f += 4;
glTexCoord2fv(f);
f += 2;
glVertex3fv(f);
f += 3;
}
glEnd();
}
}
static float
gettime(void)
{
static clock_t told = 0;
clock_t tnew, ris;
tnew = clock();
ris = tnew - told;
told = tnew;
return (ris / (float) CLOCKS_PER_SEC);
}
static void
calcposobs(void)
{
dir[0] = sin(alpha * M_PI / 180.0);
dir[1] = cos(alpha * M_PI / 180.0) * sin(beta * M_PI / 180.0);
dir[2] = cos(beta * M_PI / 180.0);
obs[0] += v * dir[0];
obs[1] += v * dir[1];
obs[2] += v * dir[2];
}
static void
special(int k, int x, int y)
{
switch (k) {
case GLUT_KEY_LEFT:
alpha -= 2.0;
break;
case GLUT_KEY_RIGHT:
alpha += 2.0;
break;
case GLUT_KEY_DOWN:
beta -= 2.0;
break;
case GLUT_KEY_UP:
beta += 2.0;
break;
}
}
static void
key(unsigned char k, int x, int y)
{
switch (k) {
case 27:
exit(0);
break;
case 'a':
v += 0.01;
break;
case 'z':
v -= 0.01;
break;
#ifdef XMESA
case ' ':
fullscreen = (!fullscreen);
glutSetWindow(channel[0]);
XMesaSetFXmode(fullscreen ? XMESA_FX_FULLSCREEN : XMESA_FX_WINDOW);
glutSetWindow(channel[1]);
XMesaSetFXmode(fullscreen ? XMESA_FX_FULLSCREEN : XMESA_FX_WINDOW);
break;
#endif
case 'j':
joyactive = (!joyactive);
break;
case 'h':
help = (!help);
break;
case 'f':
fog = (!fog);
break;
case 't':
usetex = (!usetex);
break;
case 'b':
if (bfcull) {
glDisable(GL_CULL_FACE);
bfcull = 0;
}
else {
glEnable(GL_CULL_FACE);
bfcull = 1;
}
break;
case 'm':
cstrip = (!cstrip);
break;
case 'd':
fprintf(stderr, "Deleting textures...\n");
glDeleteTextures(1, &t1id);
glDeleteTextures(1, &t2id);
fprintf(stderr, "Loading textures...\n");
inittextures();
fprintf(stderr, "Done.\n");
break;
}
}
static void
reshapechannel0(int w, int h)
{
float ratio;
WIDTHC0 = w;
HEIGHTC0 = h;
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
ratio = 0.5f * w / (float) h;
glFrustum(-2.0, 0.0, -1.0 * ratio, 1.0 * ratio, 1.0, 60.0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glViewport(0, 0, w, h);
}
static void
reshapechannel1(int w, int h)
{
float ratio;
WIDTHC1 = w;
HEIGHTC1 = h;
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
ratio = 0.5f * w / (float) h;
glFrustum(0.0, 2.0, -1.0 * ratio, 1.0 * ratio, 1.0, 60.0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glViewport(0, 0, w, h);
}
static void
printstring(void *font, char *string)
{
int len, i;
len = (int) strlen(string);
for (i = 0; i < len; i++)
glutBitmapCharacter(font, string[i]);
}
static void
printhelp(void)
{
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glColor4f(0.0, 0.0, 0.0, 0.5);
glRecti(40, 40, 600, 440);
glColor3f(1.0, 0.0, 0.0);
glRasterPos2i(300, 420);
printstring(GLUT_BITMAP_TIMES_ROMAN_24, "Help");
glRasterPos2i(60, 390);
printstring(GLUT_BITMAP_TIMES_ROMAN_24, "h - Togle Help");
glRasterPos2i(60, 360);
printstring(GLUT_BITMAP_TIMES_ROMAN_24, "t - Togle Textures");
glRasterPos2i(60, 330);
printstring(GLUT_BITMAP_TIMES_ROMAN_24, "f - Togle Fog");
glRasterPos2i(60, 300);
printstring(GLUT_BITMAP_TIMES_ROMAN_24, "m - Togle strips");
glRasterPos2i(60, 270);
printstring(GLUT_BITMAP_TIMES_ROMAN_24, "b - Togle Back face culling");
glRasterPos2i(60, 240);
printstring(GLUT_BITMAP_TIMES_ROMAN_24, "Arrow Keys - Rotate");
glRasterPos2i(60, 210);
printstring(GLUT_BITMAP_TIMES_ROMAN_24, "a - Increase velocity");
glRasterPos2i(60, 180);
printstring(GLUT_BITMAP_TIMES_ROMAN_24, "z - Decrease velocity");
glRasterPos2i(60, 150);
if (joyavailable)
printstring(GLUT_BITMAP_TIMES_ROMAN_24,
"j - Togle jostick control (Joystick control available)");
else
printstring(GLUT_BITMAP_TIMES_ROMAN_24,
"(No Joystick control available)");
}
static void
dojoy(void)
{
#ifdef WIN32
static UINT max[2] = { 0, 0 };
static UINT min[2] = { 0xffffffff, 0xffffffff }, center[2];
MMRESULT res;
JOYINFO joy;
res = joyGetPos(JOYSTICKID1, &joy);
if (res == JOYERR_NOERROR) {
joyavailable = 1;
if (max[0] < joy.wXpos)
max[0] = joy.wXpos;
if (min[0] > joy.wXpos)
min[0] = joy.wXpos;
center[0] = (max[0] + min[0]) / 2;
if (max[1] < joy.wYpos)
max[1] = joy.wYpos;
if (min[1] > joy.wYpos)
min[1] = joy.wYpos;
center[1] = (max[1] + min[1]) / 2;
if (joyactive) {
if (fabs(center[0] - (float) joy.wXpos) > 0.1 * (max[0] - min[0]))
alpha -=
2.0 * (center[0] - (float) joy.wXpos) / (max[0] - min[0]);
if (fabs(center[1] - (float) joy.wYpos) > 0.1 * (max[1] - min[1]))
beta += 2.0 * (center[1] - (float) joy.wYpos) / (max[1] - min[1]);
if (joy.wButtons & JOY_BUTTON1)
v += 0.01;
if (joy.wButtons & JOY_BUTTON2)
v -= 0.01;
}
}
else
joyavailable = 0;
#endif
}
static void
draw(void)
{
static int count = 0;
static char frbuf[80];
int i;
float fr, base, offset;
dojoy();
glClear(GL_COLOR_BUFFER_BIT);
glClear(GL_COLOR_BUFFER_BIT);
if (usetex)
glEnable(GL_TEXTURE_2D);
else
glDisable(GL_TEXTURE_2D);
if (fog)
glEnable(GL_FOG);
else
glDisable(GL_FOG);
glShadeModel(GL_SMOOTH);
glPushMatrix();
calcposobs();
gluLookAt(obs[0], obs[1], obs[2],
obs[0] + dir[0], obs[1] + dir[1], obs[2] + dir[2],
0.0, 0.0, 1.0);
if (dir[0] > 0) {
offset = 8.0;
base = obs[0] - fmod(obs[0], 8.0);
}
else {
offset = -8.0;
base = obs[0] + (8.0 - fmod(obs[0], 8.0));
}
glPushMatrix();
glTranslatef(base - offset / 2.0, 0.0, 0.0);
for (i = 0; i < NUMBLOC; i++) {
glTranslatef(offset, 0.0, 0.0);
glBindTexture(GL_TEXTURE_2D, t1id);
drawobjs(striplength_skin_11, stripdata_skin_11);
glBindTexture(GL_TEXTURE_2D, t2id);
drawobjs(striplength_skin_12, stripdata_skin_12);
drawobjs(striplength_skin_9, stripdata_skin_9);
drawobjs(striplength_skin_13, stripdata_skin_13);
}
glPopMatrix();
glPopMatrix();
if ((count % FRAME) == 0) {
fr = gettime();
sprintf(frbuf, "Frame rate: %f", FRAME / fr);
}
glDisable(GL_TEXTURE_2D);
glDisable(GL_FOG);
glShadeModel(GL_FLAT);
glMatrixMode(GL_PROJECTION);
glPushMatrix();
glLoadIdentity();
glOrtho(-0.5, 639.5, -0.5, 479.5, -1.0, 1.0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glColor3f(1.0, 0.0, 0.0);
glRasterPos2i(10, 10);
printstring(GLUT_BITMAP_HELVETICA_18, frbuf);
glRasterPos2i(350, 470);
printstring(GLUT_BITMAP_HELVETICA_10,
"Tunnel2 V1.0 Written by David Bucciarelli (tech.hmw@plus.it)");
if (help)
printhelp();
glMatrixMode(GL_PROJECTION);
glPopMatrix();
glMatrixMode(GL_MODELVIEW);
count++;
}
static void
drawchannel0(void)
{
glutSetWindow(channel[0]);
draw();
glutSwapBuffers();
}
static void
drawchannel1(void)
{
glutSetWindow(channel[1]);
draw();
glutSwapBuffers();
}
static void
drawall(void)
{
glutSetWindow(channel[0]);
draw();
glutSetWindow(channel[1]);
draw();
glutSetWindow(channel[0]);
glutSwapBuffers();
glutSetWindow(channel[1]);
glutSwapBuffers();
}
static void
init(void)
{
float fogcolor[4] = { 0.7, 0.7, 0.7, 1.0 };
glShadeModel(GL_SMOOTH);
glDisable(GL_DEPTH_TEST);
glEnable(GL_CULL_FACE);
glEnable(GL_TEXTURE_2D);
glEnable(GL_FOG);
glFogi(GL_FOG_MODE, GL_EXP2);
glFogfv(GL_FOG_COLOR, fogcolor);
glFogf(GL_FOG_DENSITY, 0.06);
glHint(GL_FOG_HINT, GL_NICEST);
glEnable(GL_BLEND);
/*
glBlendFunc(GL_SRC_ALPHA_SATURATE, GL_ONE);
glEnable(GL_POLYGON_SMOOTH);
*/
glClearColor(fogcolor[0], fogcolor[1], fogcolor[2], fogcolor[3]);
glClear(GL_COLOR_BUFFER_BIT);
}
int
main(int ac, char **av)
{
fprintf(stderr,
"Tunnel2 V1.0\nWritten by David Bucciarelli (tech.hmw@plus.it)\n");
fprintf(stderr,
"You need TWO Voodoo Graphics boards in order to run this demo !\n");
glutInitWindowPosition(0, 0);
glutInitWindowSize(WIDTHC0, HEIGHTC0);
glutInit(&ac, av);
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_ALPHA);
#ifdef FX
if (!fxMesaSelectCurrentBoard(0)) {
fprintf(stderr, "The first Voodoo Graphics board is missing !?!?\n");
return -1;
}
#endif
if (!(channel[0] = glutCreateWindow("Channel 0"))) {
fprintf(stderr, "Error, couldn't open window\n");
return -1;
}
reshapechannel0(WIDTHC0, HEIGHTC0);
init();
inittextures();
glutDisplayFunc(drawchannel0);
glutReshapeFunc(reshapechannel0);
glutKeyboardFunc(key);
glutSpecialFunc(special);
#ifdef FX
if (!fxMesaSelectCurrentBoard(1)) {
fprintf(stderr, "The second Voodoo Graphics board is missing !\n");
exit(-1);
}
#endif
glutInitWindowPosition(WIDTHC0, 0);
glutInitWindowSize(WIDTHC1, HEIGHTC1);
if (!(channel[1] = glutCreateWindow("Channel 1"))) {
fprintf(stderr, "Error, couldn't open window\n");
exit(-1);
}
reshapechannel1(WIDTHC1, HEIGHTC1);
init();
inittextures();
glutDisplayFunc(drawchannel1);
glutReshapeFunc(reshapechannel1);
glutKeyboardFunc(key);
glutSpecialFunc(special);
glutIdleFunc(drawall);
calcposobs();
glutMainLoop();
return 0;
}

83
progs/demos/tunneldat.c Normal file
View File

@@ -0,0 +1,83 @@
/* Object: skin_13 */
#if defined(_MSC_VER) && defined(_WIN32)
#pragma warning( disable : 4305 ) /* 'initializing' : truncation from 'const double' to 'float' */
#endif
int striplength_skin_13[]={
10,7,3,5,5,4,4,4,4,5,3,4,5,4,4,4,4,4,4,6,
6,3,6,3,3,3,3,0};
float stripdata_skin_13[]={
0.415686,0.415686,0.415686,1.000000,0.000000,1.500000,2.000000,4.000000,0.000000,0.341176,0.341176,0.341176,1.000000,-0.500000,1.500000,4.000000,4.000000,0.000000,0.545098,0.545098,0.545098,1.000000,0.000000,1.000000,2.000000,4.000000,2.000000,0.435294,0.435294,0.435294,1.000000,-0.500000,1.000000,4.000000,4.000000,2.000000,0.517647,0.517647,0.517647,1.000000,0.000000,0.500000,2.000000,4.000000,4.000000,0.450980,0.450980,0.450980,1.000000,-0.500000,0.500000,4.000000,4.000000,4.000000,0.427451,0.427451,0.427451,1.000000,0.000000,0.000000,2.000000,4.000000,6.000000,0.388235,0.388235,0.388235,1.000000,-0.500000,0.000000,4.000000,4.000000,6.000000,0.356863,0.356863,0.356863,1.000000,0.000000,-0.500000,2.000000,4.000000,8.000000,0.333333,0.333333,0.333333,1.000000,-0.500000,-0.500000,4.000000,4.000000,8.000000,
0.435294,0.435294,0.435294,1.000000,1.500000,1.000000,-4.000000,4.000000,2.000000,0.415686,0.415686,0.415686,1.000000,1.000000,1.500000,-2.000000,4.000000,0.000000,0.545098,0.545098,0.545098,1.000000,1.000000,1.000000,-2.000000,4.000000,2.000000,0.450980,0.450980,0.450980,1.000000,0.500000,1.500000,0.000000,4.000000,0.000000,0.600000,0.600000,0.600000,1.000000,0.500000,1.000000,0.000000,4.000000,2.000000,0.415686,0.415686,0.415686,1.000000,0.000000,1.500000,2.000000,4.000000,0.000000,0.545098,0.545098,0.545098,1.000000,0.000000,1.000000,2.000000,4.000000,2.000000,
0.435294,0.435294,0.435294,1.000000,1.500000,1.000000,-4.000000,4.000000,2.000000,0.341176,0.341176,0.341176,1.000000,1.500000,1.500000,-4.000000,4.000000,0.000000,0.415686,0.415686,0.415686,1.000000,1.000000,1.500000,-2.000000,4.000000,0.000000,
0.356863,0.356863,0.356863,1.000000,0.000000,-0.500000,2.000000,4.000000,8.000000,0.364706,0.364706,0.364706,1.000000,0.500000,-0.500000,0.000000,4.000000,8.000000,0.427451,0.427451,0.427451,1.000000,0.000000,0.000000,2.000000,4.000000,6.000000,0.415686,0.415686,0.415686,1.000000,0.395020,-0.133318,0.420032,4.000000,6.533272,0.423529,0.423529,0.423529,1.000000,0.388550,-0.103582,0.445932,4.000000,6.414327,
0.423529,0.423529,0.423529,1.000000,0.388550,-0.103582,0.445932,4.000000,6.414327,0.427451,0.427451,0.427451,1.000000,0.383423,-0.069344,0.466541,4.000000,6.277375,0.427451,0.427451,0.427451,1.000000,0.000000,0.000000,2.000000,4.000000,6.000000,0.435294,0.435294,0.435294,1.000000,0.380371,-0.034595,0.478689,4.000000,6.138380,0.439216,0.439216,0.439216,1.000000,0.379272,0.000000,0.482673,4.000000,6.000000,
0.407843,0.407843,0.407843,1.000000,0.414673,-0.191394,0.341301,4.000000,6.765576,0.411765,0.411765,0.411765,1.000000,0.403687,-0.162957,0.385368,4.000000,6.651829,0.364706,0.364706,0.364706,1.000000,0.500000,-0.500000,0.000000,4.000000,8.000000,0.415686,0.415686,0.415686,1.000000,0.395020,-0.133318,0.420032,4.000000,6.533272,
0.400000,0.400000,0.400000,1.000000,0.438232,-0.232438,0.247284,4.000000,6.929754,0.403922,0.403922,0.403922,1.000000,0.425171,-0.212276,0.299425,4.000000,6.849104,0.364706,0.364706,0.364706,1.000000,0.500000,-0.500000,0.000000,4.000000,8.000000,0.407843,0.407843,0.407843,1.000000,0.414673,-0.191394,0.341301,4.000000,6.765576,
0.396078,0.396078,0.396078,1.000000,0.467285,-0.260554,0.130636,4.000000,7.042214,0.400000,0.400000,0.400000,1.000000,0.453857,-0.250068,0.184711,4.000000,7.000273,0.364706,0.364706,0.364706,1.000000,0.500000,-0.500000,0.000000,4.000000,8.000000,0.400000,0.400000,0.400000,1.000000,0.438232,-0.232438,0.247284,4.000000,6.929754,
0.396078,0.396078,0.396078,1.000000,0.500000,-0.270672,0.000000,4.000000,7.082688,0.396078,0.396078,0.396078,1.000000,0.482788,-0.267902,0.068730,4.000000,7.071609,0.364706,0.364706,0.364706,1.000000,0.500000,-0.500000,0.000000,4.000000,8.000000,0.396078,0.396078,0.396078,1.000000,0.467285,-0.260554,0.130636,4.000000,7.042214,
0.439216,0.439216,0.439216,1.000000,0.379272,0.000000,0.482673,4.000000,6.000000,0.474510,0.474510,0.474510,1.000000,0.379272,0.180448,0.482673,4.000000,5.278208,0.517647,0.517647,0.517647,1.000000,0.000000,0.500000,2.000000,4.000000,4.000000,0.513726,0.513726,0.513726,1.000000,0.379272,0.360896,0.482673,4.000000,4.556417,0.545098,0.545098,0.545098,1.000000,0.379272,0.500000,0.482673,4.000000,4.000000,
0.545098,0.545098,0.545098,1.000000,0.379272,0.500000,0.482673,4.000000,4.000000,0.545098,0.545098,0.545098,1.000000,0.000000,1.000000,2.000000,4.000000,2.000000,0.517647,0.517647,0.517647,1.000000,0.000000,0.500000,2.000000,4.000000,4.000000,
0.600000,0.600000,0.600000,1.000000,0.500000,1.000000,0.000000,4.000000,2.000000,0.545098,0.545098,0.545098,1.000000,0.000000,1.000000,2.000000,4.000000,2.000000,0.552941,0.552941,0.552941,1.000000,0.379272,0.541344,0.482673,4.000000,3.834625,0.545098,0.545098,0.545098,1.000000,0.379272,0.500000,0.482673,4.000000,4.000000,
0.552941,0.552941,0.552941,1.000000,0.379272,0.541344,0.482673,4.000000,3.834625,0.556863,0.556863,0.556863,1.000000,0.459717,0.541344,0.160891,4.000000,3.834625,0.600000,0.600000,0.600000,1.000000,0.500000,1.000000,0.000000,4.000000,2.000000,0.556863,0.556863,0.556863,1.000000,0.500000,0.541344,0.000000,4.000000,3.834625,0.556863,0.556863,0.556863,1.000000,0.540283,0.541344,-0.160891,4.000000,3.834625,
0.396078,0.396078,0.396078,1.000000,0.517212,-0.267902,-0.068730,4.000000,7.071609,0.396078,0.396078,0.396078,1.000000,0.500000,-0.270672,0.000000,4.000000,7.082688,0.356863,0.356863,0.356863,1.000000,1.000000,-0.500000,-2.000000,4.000000,8.000000,0.364706,0.364706,0.364706,1.000000,0.500000,-0.500000,0.000000,4.000000,8.000000,
0.400000,0.400000,0.400000,1.000000,0.546143,-0.250068,-0.184711,4.000000,7.000273,0.396078,0.396078,0.396078,1.000000,0.532715,-0.260554,-0.130636,4.000000,7.042214,0.356863,0.356863,0.356863,1.000000,1.000000,-0.500000,-2.000000,4.000000,8.000000,0.396078,0.396078,0.396078,1.000000,0.517212,-0.267902,-0.068730,4.000000,7.071609,
0.403922,0.403922,0.403922,1.000000,0.574829,-0.212276,-0.299425,4.000000,6.849104,0.400000,0.400000,0.400000,1.000000,0.561768,-0.232438,-0.247284,4.000000,6.929754,0.356863,0.356863,0.356863,1.000000,1.000000,-0.500000,-2.000000,4.000000,8.000000,0.400000,0.400000,0.400000,1.000000,0.546143,-0.250068,-0.184711,4.000000,7.000273,
0.411765,0.411765,0.411765,1.000000,0.596313,-0.162957,-0.385368,4.000000,6.651829,0.407843,0.407843,0.407843,1.000000,0.585327,-0.191394,-0.341301,4.000000,6.765576,0.356863,0.356863,0.356863,1.000000,1.000000,-0.500000,-2.000000,4.000000,8.000000,0.403922,0.403922,0.403922,1.000000,0.574829,-0.212276,-0.299425,4.000000,6.849104,
0.423529,0.423529,0.423529,1.000000,0.611450,-0.103582,-0.445931,4.000000,6.414327,0.415686,0.415686,0.415686,1.000000,0.604980,-0.133318,-0.420033,4.000000,6.533272,0.356863,0.356863,0.356863,1.000000,1.000000,-0.500000,-2.000000,4.000000,8.000000,0.411765,0.411765,0.411765,1.000000,0.596313,-0.162957,-0.385368,4.000000,6.651829,
0.435294,0.435294,0.435294,1.000000,0.619629,-0.034595,-0.478689,4.000000,6.138380,0.427451,0.427451,0.427451,1.000000,0.616577,-0.069344,-0.466541,4.000000,6.277375,0.356863,0.356863,0.356863,1.000000,1.000000,-0.500000,-2.000000,4.000000,8.000000,0.423529,0.423529,0.423529,1.000000,0.611450,-0.103582,-0.445931,4.000000,6.414327,
0.513726,0.513726,0.513726,1.000000,0.620728,0.360896,-0.482673,4.000000,4.556417,0.474510,0.474510,0.474510,1.000000,0.620728,0.180448,-0.482673,4.000000,5.278208,0.427451,0.427451,0.427451,1.000000,1.000000,0.000000,-2.000000,4.000000,6.000000,0.439216,0.439216,0.439216,1.000000,0.620728,0.000000,-0.482673,4.000000,6.000000,0.356863,0.356863,0.356863,1.000000,1.000000,-0.500000,-2.000000,4.000000,8.000000,0.435294,0.435294,0.435294,1.000000,0.619629,-0.034595,-0.478689,4.000000,6.138380,
0.333333,0.333333,0.333333,1.000000,1.500000,-0.500000,-4.000000,4.000000,8.000000,0.388235,0.388235,0.388235,1.000000,1.500000,0.000000,-4.000000,4.000000,6.000000,0.427451,0.427451,0.427451,1.000000,1.000000,0.000000,-2.000000,4.000000,6.000000,0.517647,0.517647,0.517647,1.000000,1.000000,0.500000,-2.000000,4.000000,4.000000,0.513726,0.513726,0.513726,1.000000,0.620728,0.360896,-0.482673,4.000000,4.556417,0.545098,0.545098,0.545098,1.000000,0.620728,0.500000,-0.482673,4.000000,4.000000,
0.333333,0.333333,0.333333,1.000000,1.500000,-0.500000,-4.000000,4.000000,8.000000,0.427451,0.427451,0.427451,1.000000,1.000000,0.000000,-2.000000,4.000000,6.000000,0.356863,0.356863,0.356863,1.000000,1.000000,-0.500000,-2.000000,4.000000,8.000000,
0.556863,0.556863,0.556863,1.000000,0.540283,0.541344,-0.160891,4.000000,3.834625,0.552941,0.552941,0.552941,1.000000,0.620728,0.541344,-0.482673,4.000000,3.834625,0.545098,0.545098,0.545098,1.000000,1.000000,1.000000,-2.000000,4.000000,2.000000,0.517647,0.517647,0.517647,1.000000,1.000000,0.500000,-2.000000,4.000000,4.000000,0.450980,0.450980,0.450980,1.000000,1.500000,0.500000,-4.000000,4.000000,4.000000,0.388235,0.388235,0.388235,1.000000,1.500000,0.000000,-4.000000,4.000000,6.000000,
0.517647,0.517647,0.517647,1.000000,1.000000,0.500000,-2.000000,4.000000,4.000000,0.552941,0.552941,0.552941,1.000000,0.620728,0.541344,-0.482673,4.000000,3.834625,0.545098,0.545098,0.545098,1.000000,0.620728,0.500000,-0.482673,4.000000,4.000000,
0.450980,0.450980,0.450980,1.000000,1.500000,0.500000,-4.000000,4.000000,4.000000,0.435294,0.435294,0.435294,1.000000,1.500000,1.000000,-4.000000,4.000000,2.000000,0.545098,0.545098,0.545098,1.000000,1.000000,1.000000,-2.000000,4.000000,2.000000,
0.439216,0.439216,0.439216,1.000000,0.379272,0.000000,0.482673,4.000000,6.000000,0.517647,0.517647,0.517647,1.000000,0.000000,0.500000,2.000000,4.000000,4.000000,0.427451,0.427451,0.427451,1.000000,0.000000,0.000000,2.000000,4.000000,6.000000,
0.556863,0.556863,0.556863,1.000000,0.540283,0.541344,-0.160891,4.000000,3.834625,0.545098,0.545098,0.545098,1.000000,1.000000,1.000000,-2.000000,4.000000,2.000000,0.600000,0.600000,0.600000,1.000000,0.500000,1.000000,0.000000,4.000000,2.000000
};
/* Object: skin_12 */
int striplength_skin_12[]={
12,12,12,12,12,0};
float stripdata_skin_12[]={
0.498039,0.498039,0.498039,1.000000,-0.099976,1.500000,-2.400000,-4.000000,-0.000002,0.337255,0.337255,0.337255,1.000000,-0.500000,1.500000,-4.000000,-4.000000,-0.000002,0.568627,0.568627,0.568627,1.000000,-0.099976,1.100000,-2.400000,-4.000000,1.599999,0.341176,0.341176,0.341176,1.000000,-0.500000,1.100000,-4.000000,-4.000000,1.599999,0.498039,0.498039,0.498039,1.000000,-0.099976,0.700000,-2.400000,-4.000000,3.200000,0.325490,0.325490,0.325490,1.000000,-0.500000,0.700000,-4.000000,-4.000000,3.199999,0.352941,0.352941,0.352941,1.000000,-0.099976,0.300000,-2.400000,-4.000000,4.800000,0.282353,0.282353,0.282353,1.000000,-0.500000,0.300000,-4.000000,-4.000000,4.800000,0.282353,0.282353,0.282353,1.000000,-0.099976,-0.100000,-2.400000,-4.000000,6.400001,0.254902,0.254902,0.254902,1.000000,-0.500000,-0.100000,-4.000000,-4.000000,6.400000,0.239216,0.239216,0.239216,1.000000,-0.099976,-0.500000,-2.400000,-4.000000,8.000000,0.227451,0.227451,0.227451,1.000000,-0.500000,-0.500000,-4.000000,-4.000000,8.000000,
0.239216,0.239216,0.239216,1.000000,1.099976,-0.500000,2.400001,-4.000000,8.000000,0.227451,0.227451,0.227451,1.000000,1.500000,-0.500000,4.000002,-4.000000,8.000000,0.282353,0.282353,0.282353,1.000000,1.099976,-0.100000,2.400001,-4.000000,6.400001,0.254902,0.254902,0.254902,1.000000,1.500000,-0.100000,4.000002,-4.000000,6.400001,0.352941,0.352941,0.352941,1.000000,1.099976,0.300000,2.400002,-4.000000,4.800001,0.282353,0.282353,0.282353,1.000000,1.500000,0.300000,4.000002,-4.000000,4.800001,0.498039,0.498039,0.498039,1.000000,1.099976,0.700000,2.400002,-4.000000,3.200000,0.321569,0.321569,0.321569,1.000000,1.500000,0.700000,4.000003,-4.000000,3.200000,0.568627,0.568627,0.568627,1.000000,1.099976,1.100000,2.400002,-4.000000,1.599999,0.341176,0.341176,0.341176,1.000000,1.500000,1.100000,4.000003,-4.000000,1.599999,0.494118,0.494118,0.494118,1.000000,1.099976,1.500000,2.400003,-4.000000,-0.000002,0.337255,0.337255,0.337255,1.000000,1.500000,1.500000,4.000004,-4.000000,-0.000002,
0.639216,0.639216,0.639216,1.000000,0.300049,1.500000,-0.799999,-4.000000,-0.000002,0.498039,0.498039,0.498039,1.000000,-0.099976,1.500000,-2.400000,-4.000000,-0.000002,0.858824,0.858824,0.858824,1.000000,0.300049,1.100000,-0.799999,-4.000000,1.599999,0.568627,0.568627,0.568627,1.000000,-0.099976,1.100000,-2.400000,-4.000000,1.599999,0.686275,0.686275,0.686275,1.000000,0.300049,0.700000,-0.799999,-4.000000,3.200000,0.498039,0.498039,0.498039,1.000000,-0.099976,0.700000,-2.400000,-4.000000,3.200000,0.419608,0.419608,0.419608,1.000000,0.300049,0.300000,-0.800000,-4.000000,4.800000,0.352941,0.352941,0.352941,1.000000,-0.099976,0.300000,-2.400000,-4.000000,4.800000,0.298039,0.298039,0.298039,1.000000,0.300049,-0.100000,-0.800000,-4.000000,6.400001,0.282353,0.282353,0.282353,1.000000,-0.099976,-0.100000,-2.400000,-4.000000,6.400001,0.247059,0.247059,0.247059,1.000000,0.300049,-0.500000,-0.800000,-4.000000,8.000000,0.239216,0.239216,0.239216,1.000000,-0.099976,-0.500000,-2.400000,-4.000000,8.000000,
0.639216,0.639216,0.639216,1.000000,0.699951,1.500000,0.800002,-4.000000,-0.000002,0.639216,0.639216,0.639216,1.000000,0.300049,1.500000,-0.799999,-4.000000,-0.000002,0.858824,0.858824,0.858824,1.000000,0.699951,1.100000,0.800001,-4.000000,1.599999,0.858824,0.858824,0.858824,1.000000,0.300049,1.100000,-0.799999,-4.000000,1.599999,0.686275,0.686275,0.686275,1.000000,0.699951,0.700000,0.800001,-4.000000,3.200000,0.686275,0.686275,0.686275,1.000000,0.300049,0.700000,-0.799999,-4.000000,3.200000,0.419608,0.419608,0.419608,1.000000,0.699951,0.300000,0.800001,-4.000000,4.800001,0.419608,0.419608,0.419608,1.000000,0.300049,0.300000,-0.800000,-4.000000,4.800000,0.298039,0.298039,0.298039,1.000000,0.699951,-0.100000,0.800001,-4.000000,6.400001,0.298039,0.298039,0.298039,1.000000,0.300049,-0.100000,-0.800000,-4.000000,6.400001,0.247059,0.247059,0.247059,1.000000,0.699951,-0.500000,0.800000,-4.000000,8.000000,0.247059,0.247059,0.247059,1.000000,0.300049,-0.500000,-0.800000,-4.000000,8.000000,
0.494118,0.494118,0.494118,1.000000,1.099976,1.500000,2.400003,-4.000000,-0.000002,0.639216,0.639216,0.639216,1.000000,0.699951,1.500000,0.800002,-4.000000,-0.000002,0.568627,0.568627,0.568627,1.000000,1.099976,1.100000,2.400002,-4.000000,1.599999,0.858824,0.858824,0.858824,1.000000,0.699951,1.100000,0.800001,-4.000000,1.599999,0.498039,0.498039,0.498039,1.000000,1.099976,0.700000,2.400002,-4.000000,3.200000,0.686275,0.686275,0.686275,1.000000,0.699951,0.700000,0.800001,-4.000000,3.200000,0.352941,0.352941,0.352941,1.000000,1.099976,0.300000,2.400002,-4.000000,4.800001,0.419608,0.419608,0.419608,1.000000,0.699951,0.300000,0.800001,-4.000000,4.800001,0.282353,0.282353,0.282353,1.000000,1.099976,-0.100000,2.400001,-4.000000,6.400001,0.298039,0.298039,0.298039,1.000000,0.699951,-0.100000,0.800001,-4.000000,6.400001,0.239216,0.239216,0.239216,1.000000,1.099976,-0.500000,2.400001,-4.000000,8.000000,0.247059,0.247059,0.247059,1.000000,0.699951,-0.500000,0.800000,-4.000000,8.000000
};
/* Object: skin_11 */
int striplength_skin_11[]={
12,12,12,12,12,0};
float stripdata_skin_11[]={
0.145098,0.145098,0.145098,1.000000,-0.099976,1.500000,-2.400000,4.000002,0.000000,0.141176,0.141176,0.141176,1.000000,-0.500000,1.500000,-4.000000,4.000002,0.000000,0.176471,0.176471,0.176471,1.000000,-0.099976,1.100000,-2.400000,2.400001,0.000000,0.145098,0.145098,0.145098,1.000000,-0.500000,1.100000,-4.000000,2.400001,0.000000,0.341176,0.341176,0.341176,1.000000,-0.099976,0.700000,-2.400000,0.800000,0.000000,0.188235,0.188235,0.188235,1.000000,-0.500000,0.700000,-4.000000,0.800000,0.000000,0.450980,0.450980,0.450980,1.000000,-0.099976,0.300000,-2.400000,-0.800000,0.000000,0.247059,0.247059,0.247059,1.000000,-0.500000,0.300000,-4.000000,-0.800000,0.000000,0.439216,0.439216,0.439216,1.000000,-0.099976,-0.100000,-2.400000,-2.400000,0.000000,0.270588,0.270588,0.270588,1.000000,-0.500000,-0.100000,-4.000000,-2.400000,0.000000,0.364706,0.364706,0.364706,1.000000,-0.099976,-0.500000,-2.400000,-4.000000,0.000000,0.258824,0.258824,0.258824,1.000000,-0.500000,-0.500000,-4.000000,-4.000000,0.000000,
0.364706,0.364706,0.364706,1.000000,1.099976,-0.500000,2.400001,-4.000000,0.000000,0.258824,0.258824,0.258824,1.000000,1.500000,-0.500000,4.000002,-4.000000,0.000000,0.439216,0.439216,0.439216,1.000000,1.099976,-0.100000,2.400001,-2.400001,0.000000,0.270588,0.270588,0.270588,1.000000,1.500000,-0.100000,4.000002,-2.400001,0.000000,0.454902,0.454902,0.454902,1.000000,1.099976,0.300000,2.400002,-0.800000,0.000000,0.247059,0.247059,0.247059,1.000000,1.500000,0.300000,4.000002,-0.800000,0.000000,0.341176,0.341176,0.341176,1.000000,1.099976,0.700000,2.400002,0.800000,0.000000,0.184314,0.184314,0.184314,1.000000,1.500000,0.700000,4.000003,0.800000,0.000000,0.176471,0.176471,0.176471,1.000000,1.099976,1.100000,2.400002,2.400001,0.000000,0.145098,0.145098,0.145098,1.000000,1.500000,1.100000,4.000003,2.400001,0.000000,0.145098,0.145098,0.145098,1.000000,1.099976,1.500000,2.400003,4.000003,0.000000,0.141176,0.141176,0.141176,1.000000,1.500000,1.500000,4.000004,4.000002,0.000000,
0.145098,0.145098,0.145098,1.000000,0.300049,1.500000,-0.799999,4.000002,0.000000,0.145098,0.145098,0.145098,1.000000,-0.099976,1.500000,-2.400000,4.000002,0.000000,0.262745,0.262745,0.262745,1.000000,0.300049,1.100000,-0.799999,2.400001,0.000000,0.176471,0.176471,0.176471,1.000000,-0.099976,1.100000,-2.400000,2.400001,0.000000,0.580392,0.580392,0.580392,1.000000,0.300049,0.700000,-0.799999,0.800000,0.000000,0.341176,0.341176,0.341176,1.000000,-0.099976,0.700000,-2.400000,0.800000,0.000000,0.709804,0.709804,0.709804,1.000000,0.300049,0.300000,-0.800000,-0.800000,0.000000,0.450980,0.450980,0.450980,1.000000,-0.099976,0.300000,-2.400000,-0.800000,0.000000,0.627451,0.627451,0.627451,1.000000,0.300049,-0.100000,-0.800000,-2.400001,0.000000,0.439216,0.439216,0.439216,1.000000,-0.099976,-0.100000,-2.400000,-2.400000,0.000000,0.458824,0.458824,0.458824,1.000000,0.300049,-0.500000,-0.800000,-4.000000,0.000000,0.364706,0.364706,0.364706,1.000000,-0.099976,-0.500000,-2.400000,-4.000000,0.000000,
0.145098,0.145098,0.145098,1.000000,0.699951,1.500000,0.800002,4.000002,0.000000,0.145098,0.145098,0.145098,1.000000,0.300049,1.500000,-0.799999,4.000002,0.000000,0.262745,0.262745,0.262745,1.000000,0.699951,1.100000,0.800001,2.400001,0.000000,0.262745,0.262745,0.262745,1.000000,0.300049,1.100000,-0.799999,2.400001,0.000000,0.580392,0.580392,0.580392,1.000000,0.699951,0.700000,0.800001,0.800000,0.000000,0.580392,0.580392,0.580392,1.000000,0.300049,0.700000,-0.799999,0.800000,0.000000,0.713726,0.713726,0.713726,1.000000,0.699951,0.300000,0.800001,-0.800000,0.000000,0.709804,0.709804,0.709804,1.000000,0.300049,0.300000,-0.800000,-0.800000,0.000000,0.631373,0.631373,0.631373,1.000000,0.699951,-0.100000,0.800001,-2.400001,0.000000,0.627451,0.627451,0.627451,1.000000,0.300049,-0.100000,-0.800000,-2.400001,0.000000,0.458824,0.458824,0.458824,1.000000,0.699951,-0.500000,0.800000,-4.000000,0.000000,0.458824,0.458824,0.458824,1.000000,0.300049,-0.500000,-0.800000,-4.000000,0.000000,
0.145098,0.145098,0.145098,1.000000,1.099976,1.500000,2.400003,4.000003,0.000000,0.145098,0.145098,0.145098,1.000000,0.699951,1.500000,0.800002,4.000002,0.000000,0.176471,0.176471,0.176471,1.000000,1.099976,1.100000,2.400002,2.400001,0.000000,0.262745,0.262745,0.262745,1.000000,0.699951,1.100000,0.800001,2.400001,0.000000,0.341176,0.341176,0.341176,1.000000,1.099976,0.700000,2.400002,0.800000,0.000000,0.580392,0.580392,0.580392,1.000000,0.699951,0.700000,0.800001,0.800000,0.000000,0.454902,0.454902,0.454902,1.000000,1.099976,0.300000,2.400002,-0.800000,0.000000,0.713726,0.713726,0.713726,1.000000,0.699951,0.300000,0.800001,-0.800000,0.000000,0.439216,0.439216,0.439216,1.000000,1.099976,-0.100000,2.400001,-2.400001,0.000000,0.631373,0.631373,0.631373,1.000000,0.699951,-0.100000,0.800001,-2.400001,0.000000,0.364706,0.364706,0.364706,1.000000,1.099976,-0.500000,2.400001,-4.000000,0.000000,0.458824,0.458824,0.458824,1.000000,0.699951,-0.500000,0.800000,-4.000000,0.000000
};
/* Object: skin_9 */
int striplength_skin_9[]={
18,0};
float stripdata_skin_9[]={
0.384314,0.384314,0.384314,1.000000,-0.500000,1.500000,-4.000000,4.000000,8.000000,0.384314,0.384314,0.384314,1.000000,1.500000,1.500000,4.000000,4.000000,8.000000,0.376471,0.376471,0.376471,1.000000,-0.500000,1.250000,-4.000000,3.695518,9.530733,0.403922,0.403922,0.403922,1.000000,1.500000,1.250000,4.000000,3.695518,9.530733,0.415686,0.415686,0.415686,1.000000,-0.500000,1.000000,-4.000000,2.828427,10.828427,0.431373,0.431373,0.431373,1.000000,1.500000,1.000000,4.000000,2.828427,10.828427,0.435294,0.435294,0.435294,1.000000,-0.500000,0.750000,-4.000000,1.530734,11.695518,0.443137,0.443137,0.443137,1.000000,1.500000,0.750000,4.000000,1.530734,11.695518,0.439216,0.439216,0.439216,1.000000,-0.500000,0.500000,-4.000000,0.000000,12.000000,0.435294,0.435294,0.435294,1.000000,1.500000,0.500000,4.000000,0.000000,12.000000,0.427451,0.427451,0.427451,1.000000,-0.500000,0.250000,-4.000000,-1.530734,11.695518,0.411765,0.411765,0.411765,1.000000,1.500000,0.250000,4.000000,-1.530734,11.695518,0.396078,0.396078,0.396078,1.000000,-0.500000,0.000000,-4.000000,-2.828427,10.828427,0.368627,0.368627,0.368627,1.000000,1.500000,0.000000,4.000000,-2.828427,10.828427,0.341176,0.341176,0.341176,1.000000,-0.500000,-0.250000,-4.000000,-3.695518,9.530733,0.301961,0.301961,0.301961,1.000000,1.500000,-0.250000,4.000000,-3.695518,9.530733,0.294118,0.294118,0.294118,1.000000,-0.500000,-0.500000,-4.000000,-4.000000,8.000000,0.294118,0.294118,0.294118,1.000000,1.500000,-0.500000,4.000000,-4.000000,8.000000
};

View File

@@ -1,4 +1,4 @@
/* $Id: winpos.c,v 1.1 1999/08/19 00:55:40 jtg Exp $ */
/* $Id: winpos.c,v 1.2 2000/06/27 17:04:43 brianp Exp $ */
/*
* Example of how to use the GL_MESA_window_pos extension.
@@ -8,8 +8,11 @@
/*
* $Log: winpos.c,v $
* Revision 1.1 1999/08/19 00:55:40 jtg
* Initial revision
* Revision 1.2 2000/06/27 17:04:43 brianp
* fixed compiler warnings
*
* 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
@@ -30,6 +33,7 @@
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#define GL_GLEXT_LEGACY
#include "GL/glut.h"
#include "../util/readtex.c" /* a hack, I know */

377
progs/ggi/asc-view.c Normal file
View File

@@ -0,0 +1,377 @@
/*
test program for the ggi-mesa driver
Copyright (C) 1997,1998 Uwe Maurer - uwe_maurer@t-online.de
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <sys/time.h>
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <GL/gl.h>
#include <GL/ggimesa.h>
#include <ggi/ggi.h>
#include <stdlib.h>
ggi_visual_t vis,vis_mem;
GGIMesaContext ctx;
int screen_x=GGI_AUTO,screen_y=GGI_AUTO;
ggi_graphtype bpp=GT_AUTO;
//#define ZBUFFER
//#define SMOOTH_NORMALS
void Init()
{
GLfloat h=(GLfloat)3/4;
GLfloat pos[4]={5,5,-20,0};
GLfloat specular[4]={.4,.4,.4,1};
GLfloat diffuse[4]={.3,.3,.3,1};
GLfloat ambient[4]={.2,.2,.2,1};
int err;
if (ggiInit()<0)
{
printf("ggiInit() failed\n");
exit(1);
}
ctx=GGIMesaCreateContext();
if (ctx==NULL)
{
printf("Can't create Context!\n");
exit(1);
}
vis=ggiOpen(NULL);
vis_mem=ggiOpen("display-memory",NULL);
if (vis==NULL || vis_mem==NULL)
{
printf("Can't open ggi_visuals!\n");
exit(1);
}
err=ggiSetGraphMode(vis,screen_x,screen_y,screen_x,screen_y,bpp);
err+=ggiSetGraphMode(vis_mem,screen_x,screen_y,screen_x,screen_y,bpp);
if (err)
{
printf("Can't set %ix%i\n",screen_x,screen_y);
exit(1);
}
if (GGIMesaSetVisual(ctx,vis_mem,GL_TRUE,GL_FALSE)<0)
{
printf("GGIMesaSetVisual() failed!\n");
exit(1);
}
GGIMesaMakeCurrent(ctx);
glViewport(0,0,screen_x,screen_y);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glFrustum(-1,1,-h,h,1,50);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glTranslatef(0,0,-9);
glShadeModel(GL_FLAT);
glFrontFace(GL_CW);
glEnable(GL_CULL_FACE);
glEnable(GL_LIGHTING);
glEnable(GL_LIGHT0);
glLightfv(GL_LIGHT0,GL_POSITION,pos);
glLightfv(GL_LIGHT0,GL_DIFFUSE,diffuse);
glLightfv(GL_LIGHT0,GL_AMBIENT,ambient);
glLightfv(GL_LIGHT0,GL_SPECULAR,specular);
#ifdef ZBUFFER
glEnable(GL_DEPTH_TEST);
#endif
}
#define MAX_VERTS 1000
#define MAX_TRIS 2000
#define MAX_LEN 1024
#define MAX_F 100000000
void LoadAsc(GLuint *list,char *file)
{
FILE *fp;
GLfloat p[MAX_VERTS][3];
GLfloat normal[MAX_VERTS][3];
float ncount[MAX_VERTS];
int v[MAX_TRIS][3];
char line[MAX_LEN];
char *s;
int i,j;
int verts,faces;
GLuint v0,v1,v2;
GLfloat n[3];
GLfloat len,k;
GLfloat min[3]={MAX_F,MAX_F,MAX_F};
GLfloat max[3]={-MAX_F,-MAX_F,-MAX_F};
char *coord_str[]={"X","Z","Y"};
fp=fopen(file,"r");
if (!fp)
{
printf("Can't open %s!\n",file);
exit(1);
}
while (strncmp(fgets(line,MAX_LEN,fp),"Tri-mesh",8)) ;
s=strstr(line,":")+1;
verts=atoi(s);
s=strstr(s,":")+1;
faces=atoi(s);
if (verts>MAX_VERTS)
{
printf("Too many vertices..\n");
exit(1);
}
while (strncmp(fgets(line,MAX_LEN,fp),"Vertex list",11)) ;
for (i=0;i<verts;i++)
{
while (strncmp(fgets(line,MAX_LEN,fp),"Vertex",6)) ;
for (j=0;j<3;j++)
{
s=strstr(line,coord_str[j])+2;
k=atoi(s);
if (k>max[j]) max[j]=k;
if (k<min[j]) min[j]=k;
p[i][j]=k;
}
}
len=0;
for (i=0;i<3;i++)
{
k=max[i]-min[i];
if (k>len) {len=k;j=i;}
n[i]=(max[i]+min[i])/2;
}
len/=2;
for (i=0;i<verts;i++)
{
for (j=0;j<3;j++)
{
p[i][j]-=n[j];
p[i][j]/=len;
}
}
*list=glGenLists(1);
glNewList(*list,GL_COMPILE);
glBegin(GL_TRIANGLES);
memset(ncount,0,sizeof(ncount));
memset(normal,0,sizeof(normal));
while (strncmp(fgets(line,MAX_LEN,fp),"Face list",9)) ;
for (i=0;i<faces;i++)
{
while (strncmp(fgets(line,MAX_LEN,fp),"Face",4)) ;
s=strstr(line,"A")+2;
v0=v[i][0]=atoi(s);
s=strstr(line,"B")+2;
v1=v[i][1]=atoi(s);
s=strstr(line,"C")+2;
v2=v[i][2]=atoi(s);
n[0]=((p[v1][1]-p[v0][1])*(p[v2][2]-p[v0][2])
- (p[v1][2]-p[v0][2])*(p[v2][1]-p[v0][1]));
n[1]=((p[v1][2]-p[v0][2])*(p[v2][0]-p[v0][0])
- (p[v1][0]-p[v0][0])*(p[v2][2]-p[v0][2]));
n[2]=((p[v1][0]-p[v0][0])*(p[v2][1]-p[v0][1])
- (p[v1][1]-p[v0][1])*(p[v2][0]-p[v0][0]));
len=n[0]*n[0]+n[1]*n[1]+n[2]*n[2];
len=sqrt(len);
n[0]/=len;
n[1]/=len;
n[2]/=len;
#ifdef SMOOTH_NORMALS
for (j=0;j<3;j++){
normal[v[i][j]][0]+=n[0];
normal[v[i][j]][1]+=n[1];
normal[v[i][j]][2]+=n[2];
ncount[v[i][j]]++;
}
#else
glNormal3fv(n);
for (j=0;j<3;j++)
glVertex3fv(p[v[i][j]]);
#endif
}
#ifdef SMOOTH_NORMALS
for (i=0;i<verts;i++) {
for (j=0;j<3;j++) {
normal[i][j]/=ncount[i];
}
}
for (i=0;i<faces;i++) {
for (j=0;j<3;j++) {
glNormal3f(normal[v[i][j]][0],
normal[v[i][j]][1],
normal[v[i][j]][2]);
glVertex3fv(p[v[i][j]]);
}
}
#endif
glEnd();
glEndList();
fclose(fp);
}
double Display(GLuint l,int *maxframes)
{
int x,y;
GLfloat col[]={.25,0,.25,1};
int frames=0;
struct timeval start,stop;
double len;
GLfloat rotate=0;
gettimeofday(&start,NULL);
while(1)
{
glClearColor(0,0,0,0);
glClearIndex(0);
#ifdef ZBUFFER
glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
#else
glClear(GL_COLOR_BUFFER_BIT);
#endif
glPushMatrix();
glRotatef(30,1,0,0);
glRotatef(rotate/10,0,0,1);
glTranslatef(-6,-4,0);
for (y=0;y<3;y++)
{
glPushMatrix();
for (x=0;x<5;x++)
{
glPushMatrix();
glRotatef(rotate,y+1,-x-1,0);
col[0]=(GLfloat)(x+1)/4;
col[1]=0;
col[2]=(GLfloat)(y+1)/2;
glMaterialfv(GL_FRONT,GL_AMBIENT,col);
glCallList(l);
glPopMatrix();
glTranslatef(3,0,0);
}
glPopMatrix();
glTranslatef(0,4,0);
}
glPopMatrix();
glFinish();
ggiPutBox(vis,0,0,screen_x,screen_y,ggiDBGetBuffer(vis,0)->read);
rotate+=10;
frames++;
if (frames==(*maxframes)) break;
if (ggiKbhit(vis))
{
*maxframes=frames;
break;
}
}
gettimeofday(&stop,NULL);
len=(double)(stop.tv_sec-start.tv_sec)+
(double)(stop.tv_usec-start.tv_usec)/1e6;
return len;
}
void visible(int vis)
{
if (vis == GLUT_VISIBLE)
glutIdleFunc(idle);
else
glutIdleFunc(NULL);
}
int main(int argc, char *argv[])
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE);
glutInitWindowPosition(0, 0);
glutInitWindowSize(300, 300);
glutCreateWindow("asc-view");
init();
glutDisplayFunc(draw);
glutReshapeFunc(reshape);
glutKeyboardFunc(key);
glutSpecialFunc(special);
glutVisibilityFunc(visible);
glutMainLoop();
#if 0
GLuint l;
char *file;
int maxframes=0;
double len;
Init();
file=(argc>1) ? argv[1] : "asc/box.asc";
if (argc>2) maxframes=atoi(argv[2]);
if (argc==1)
{
printf("usage: %s filename.asc\n",argv[0]);
}
LoadAsc(&l,file);
len=Display(l,&maxframes);
printf("\ttime: %.3f sec\n",len);
printf("\tframes: %i\n",maxframes);
printf("\tfps: %.3f \n",(double)maxframes/len);
GGIMesaDestroyContext(ctx);
ggiClose(vis);
ggiClose(vis_mem);
ggiExit();
#endif
return 0;
}

2
progs/ggi/blah Normal file
View File

@@ -0,0 +1,2 @@
Terminating on signal 11

7
progs/ggi/blat Normal file
View File

@@ -0,0 +1,7 @@
#!/bin/sh
function foobar() {
echo "foo!"
}
foobar

66
progs/ggi/box.asc Normal file
View File

@@ -0,0 +1,66 @@
Ambient light color: Red=0.039216 Green=0.039216 Blue=0.039216
Named object: "Object01"
Tri-mesh, Vertices: 8 Faces: 12
Vertex list:
Vertex 0: X: -20 Y: -19.999998 Z: 20.000002
Vertex 1: X: 20 Y: -19.999998 Z: 20.000002
Vertex 2: X: 20 Y: 20.000002 Z: 19.999998
Vertex 3: X: -20 Y: 20.000002 Z: 19.999998
Vertex 4: X: -20 Y: -20.000002 Z: -19.999998
Vertex 5: X: 20 Y: -20.000002 Z: -19.999998
Vertex 6: X: 20 Y: 19.999998 Z: -20.000002
Vertex 7: X: -20 Y: 19.999998 Z: -20.000002
Face list:
Face 0: A:0 B:1 C:2 AB:1 BC:1 CA:0
Smoothing: 1
Face 1: A:0 B:2 C:3 AB:0 BC:1 CA:1
Smoothing: 1
Face 2: A:0 B:4 C:5 AB:1 BC:1 CA:0
Smoothing: 2
Face 3: A:0 B:5 C:1 AB:0 BC:1 CA:1
Smoothing: 2
Face 4: A:1 B:5 C:6 AB:1 BC:1 CA:0
Smoothing: 3
Face 5: A:1 B:6 C:2 AB:0 BC:1 CA:1
Smoothing: 3
Face 6: A:2 B:6 C:7 AB:1 BC:1 CA:0
Smoothing: 4
Face 7: A:2 B:7 C:3 AB:0 BC:1 CA:1
Smoothing: 4
Face 8: A:3 B:7 C:4 AB:1 BC:1 CA:0
Smoothing: 5
Face 9: A:3 B:4 C:0 AB:0 BC:1 CA:1
Smoothing: 5
Face 10: A:4 B:7 C:6 AB:1 BC:1 CA:0
Smoothing: 6
Face 11: A:4 B:6 C:5 AB:0 BC:1 CA:1
Smoothing: 6
Page 1

198
progs/ggi/cone.asc Normal file
View File

@@ -0,0 +1,198 @@
Ambient light color: Red=0.039216 Green=0.039216 Blue=0.039216
Named object: "Object01"
Tri-mesh, Vertices: 34 Faces: 64
Vertex list:
Vertex 0: X: 60.167416 Y: -87.419525 Z: -53.3088
Vertex 1: X: 76.70787 Y: -87.419518 Z: -29.84565
Vertex 2: X: 83.0103 Y: -87.419518 Z: -1.838764
Vertex 3: X: 78.115204 Y: -87.419518 Z: 26.448057
Vertex 4: X: 62.767834 Y: -87.41951 Z: 50.708401
Vertex 5: X: 39.304672 Y: -87.41951 Z: 67.248848
Vertex 6: X: 11.297782 Y: -87.41951 Z: 73.551254
Vertex 7: X: -16.989004 Y: -87.41951 Z: 68.656158
Vertex 8: X: -41.249344 Y: -87.41951 Z: 53.308777
Vertex 9: X: -57.789783 Y: -87.419518 Z: 29.845612
Vertex 10: X: -64.092194 Y: -87.419518 Z: 1.838721
Vertex 11: X: -59.197079 Y: -87.419518 Z: -26.448097
Vertex 12: X: -43.849678 Y: -87.419525 Z: -50.708427
Vertex 13: X: -20.386503 Y: -87.419525 Z: -67.248856
Vertex 14: X: 7.62039 Y: -87.419525 Z: -73.551239
Vertex 15: X: 35.907204 Y: -87.419525 Z: -68.656105
Vertex 16: X: 101.684875 Y: 94.590591 Z: -96.955391
Vertex 17: X: 131.767838 Y: 94.590591 Z: -54.281792
Vertex 18: X: 143.230377 Y: 94.590599 Z: -3.344275
Vertex 19: X: 134.327423 Y: 94.590607 Z: 48.102379
Vertex 20: X: 106.414383 Y: 94.590607 Z: 92.225876
Vertex 21: X: 63.740765 Y: 94.590607 Z: 122.3088
Vertex 22: X: 12.803238 Y: 94.590614 Z: 133.771301
Vertex 23: X: -38.643349 Y: 94.590607 Z: 124.868355
Vertex 24: X: -82.766846 Y: 94.590607 Z: 96.955307
Vertex 25: X: -112.849762 Y: 94.590607 Z: 54.281677
Vertex 26: X: -124.312256 Y: 94.590599 Z: 3.344152
Vertex 27: X: -115.409271 Y: 94.590591 Z: -48.102493
Vertex 28: X: -87.496201 Y: 94.590591 Z: -92.225967
Vertex 29: X: -44.822552 Y: 94.590591 Z: -122.308861
Vertex 30: X: 6.114983 Y: 94.590584 Z: -133.771332
Vertex 31: X: 57.561623 Y: 94.590591 Z: -124.868301
Vertex 32: X: 9.459057 Y: -87.419518 Z: 0.000008
Vertex 33: X: 9.459057 Y: 94.590599 Z: -0.000008
Face list:
Face 0: A:0 B:1 C:32 AB:1 BC:0 CA:0
Smoothing: 1
Face 1: A:1 B:2 C:32 AB:1 BC:0 CA:0
Smoothing: 1
Face 2: A:2 B:3 C:32 AB:1 BC:0 CA:0
Smoothing: 1
Face 3: A:3 B:4 C:32 AB:1 BC:0 CA:0
Smoothing: 1
Face 4: A:4 B:5 C:32 AB:1 BC:0 CA:0
Smoothing: 1
Face 5: A:5 B:6 C:32 AB:1 BC:0 CA:0
Smoothing: 1
Face 6: A:6 B:7 C:32 AB:1 BC:0 CA:0
Smoothing: 1
Face 7: A:7 B:8 C:32 AB:1 BC:0 CA:0
Smoothing: 1
Face 8: A:8 B:9 C:32 AB:1 BC:0 CA:0
Smoothing: 1
Face 9: A:9 B:10 C:32 AB:1 BC:0 CA:0
Smoothing: 1
Face 10: A:10 B:11 C:32 AB:1 BC:0 CA:0
Page 1
Smoothing: 1
Face 11: A:11 B:12 C:32 AB:1 BC:0 CA:0
Smoothing: 1
Face 12: A:12 B:13 C:32 AB:1 BC:0 CA:0
Smoothing: 1
Face 13: A:13 B:14 C:32 AB:1 BC:0 CA:0
Smoothing: 1
Face 14: A:14 B:15 C:32 AB:1 BC:0 CA:0
Smoothing: 1
Face 15: A:15 B:0 C:32 AB:1 BC:0 CA:0
Smoothing: 1
Face 16: A:0 B:16 C:17 AB:1 BC:1 CA:0
Smoothing: 2
Face 17: A:0 B:17 C:1 AB:0 BC:1 CA:1
Smoothing: 2
Face 18: A:1 B:17 C:18 AB:1 BC:1 CA:0
Smoothing: 3
Face 19: A:1 B:18 C:2 AB:0 BC:1 CA:1
Smoothing: 3
Face 20: A:2 B:18 C:19 AB:1 BC:1 CA:0
Smoothing: 4
Face 21: A:2 B:19 C:3 AB:0 BC:1 CA:1
Smoothing: 4
Face 22: A:3 B:19 C:20 AB:1 BC:1 CA:0
Smoothing: 5
Face 23: A:3 B:20 C:4 AB:0 BC:1 CA:1
Smoothing: 5
Face 24: A:4 B:20 C:21 AB:1 BC:1 CA:0
Smoothing: 6
Face 25: A:4 B:21 C:5 AB:0 BC:1 CA:1
Smoothing: 6
Face 26: A:5 B:21 C:22 AB:1 BC:1 CA:0
Smoothing: 7
Face 27: A:5 B:22 C:6 AB:0 BC:1 CA:1
Smoothing: 7
Face 28: A:6 B:22 C:23 AB:1 BC:1 CA:0
Smoothing: 8
Face 29: A:6 B:23 C:7 AB:0 BC:1 CA:1
Smoothing: 8
Face 30: A:7 B:23 C:24 AB:1 BC:1 CA:0
Smoothing: 9
Face 31: A:7 B:24 C:8 AB:0 BC:1 CA:1
Smoothing: 9
Face 32: A:8 B:24 C:25 AB:1 BC:1 CA:0
Smoothing: 10
Face 33: A:8 B:25 C:9 AB:0 BC:1 CA:1
Smoothing: 10
Face 34: A:9 B:25 C:26 AB:1 BC:1 CA:0
Smoothing: 11
Face 35: A:9 B:26 C:10 AB:0 BC:1 CA:1
Smoothing: 11
Face 36: A:10 B:26 C:27 AB:1 BC:1 CA:0
Smoothing: 12
Face 37: A:10 B:27 C:11 AB:0 BC:1 CA:1
Smoothing: 12
Face 38: A:11 B:27 C:28 AB:1 BC:1 CA:0
Smoothing: 13
Face 39: A:11 B:28 C:12 AB:0 BC:1 CA:1
Smoothing: 13
Face 40: A:12 B:28 C:29 AB:1 BC:1 CA:0
Smoothing: 14
Page 2
Face 41: A:12 B:29 C:13 AB:0 BC:1 CA:1
Smoothing: 14
Face 42: A:13 B:29 C:30 AB:1 BC:1 CA:0
Smoothing: 15
Face 43: A:13 B:30 C:14 AB:0 BC:1 CA:1
Smoothing: 15
Face 44: A:14 B:30 C:31 AB:1 BC:1 CA:0
Smoothing: 16
Face 45: A:14 B:31 C:15 AB:0 BC:1 CA:1
Smoothing: 16
Face 46: A:15 B:31 C:16 AB:1 BC:1 CA:0
Smoothing: 17
Face 47: A:15 B:16 C:0 AB:0 BC:1 CA:1
Smoothing: 17
Face 48: A:16 B:33 C:17 AB:0 BC:0 CA:1
Smoothing: 18
Face 49: A:17 B:33 C:18 AB:0 BC:0 CA:1
Smoothing: 18
Face 50: A:18 B:33 C:19 AB:0 BC:0 CA:1
Smoothing: 18
Face 51: A:19 B:33 C:20 AB:0 BC:0 CA:1
Smoothing: 18
Face 52: A:20 B:33 C:21 AB:0 BC:0 CA:1
Smoothing: 18
Face 53: A:21 B:33 C:22 AB:0 BC:0 CA:1
Smoothing: 18
Face 54: A:22 B:33 C:23 AB:0 BC:0 CA:1
Smoothing: 18
Face 55: A:23 B:33 C:24 AB:0 BC:0 CA:1
Smoothing: 18
Face 56: A:24 B:33 C:25 AB:0 BC:0 CA:1
Smoothing: 18
Face 57: A:25 B:33 C:26 AB:0 BC:0 CA:1
Smoothing: 18
Face 58: A:26 B:33 C:27 AB:0 BC:0 CA:1
Smoothing: 18
Face 59: A:27 B:33 C:28 AB:0 BC:0 CA:1
Smoothing: 18
Face 60: A:28 B:33 C:29 AB:0 BC:0 CA:1
Smoothing: 18
Face 61: A:29 B:33 C:30 AB:0 BC:0 CA:1
Smoothing: 18
Face 62: A:30 B:33 C:31 AB:0 BC:0 CA:1
Smoothing: 18
Face 63: A:31 B:33 C:16 AB:0 BC:0 CA:1
Smoothing: 18
Page 3

340
progs/ggi/gears.c Normal file
View File

@@ -0,0 +1,340 @@
/* $Id: gears.c,v 1.3 1999/08/22 08:56:50 jtaylor Exp $ */
/*
* 3-D gear wheels. This program is in the public domain.
*
* Brian Paul
*/
/* Conversion to GLUT by Mark J. Kilgard */
#include <math.h>
#include <stdlib.h>
#include <stdio.h>
#include <GL/glut.h>
#ifndef M_PI
#define M_PI 3.14159265
#endif
static GLint T0 = 0;
static GLint Frames = 0;
/**
Draw a gear wheel. You'll probably want to call this function when
building a display list since we do a lot of trig here.
Input: inner_radius - radius of hole at center
outer_radius - radius at center of teeth
width - width of gear
teeth - number of teeth
tooth_depth - depth of tooth
**/
static void
gear(GLfloat inner_radius, GLfloat outer_radius, GLfloat width,
GLint teeth, GLfloat tooth_depth)
{
GLint i;
GLfloat r0, r1, r2;
GLfloat angle, da;
GLfloat u, v, len;
r0 = inner_radius;
r1 = outer_radius - tooth_depth / 2.0;
r2 = outer_radius + tooth_depth / 2.0;
da = 2.0 * M_PI / teeth / 4.0;
glShadeModel(GL_FLAT);
glNormal3f(0.0, 0.0, 1.0);
/* draw front face */
glBegin(GL_QUAD_STRIP);
for (i = 0; i <= teeth; i++) {
angle = i * 2.0 * M_PI / teeth;
glVertex3f(r0 * cos(angle), r0 * sin(angle), width * 0.5);
glVertex3f(r1 * cos(angle), r1 * sin(angle), width * 0.5);
if (i < teeth) {
glVertex3f(r0 * cos(angle), r0 * sin(angle), width * 0.5);
glVertex3f(r1 * cos(angle + 3 * da), r1 * sin(angle + 3 * da), width * 0.5);
}
}
glEnd();
/* draw front sides of teeth */
glBegin(GL_QUADS);
da = 2.0 * M_PI / teeth / 4.0;
for (i = 0; i < teeth; i++) {
angle = i * 2.0 * M_PI / teeth;
glVertex3f(r1 * cos(angle), r1 * sin(angle), width * 0.5);
glVertex3f(r2 * cos(angle + da), r2 * sin(angle + da), width * 0.5);
glVertex3f(r2 * cos(angle + 2 * da), r2 * sin(angle + 2 * da), width * 0.5);
glVertex3f(r1 * cos(angle + 3 * da), r1 * sin(angle + 3 * da), width * 0.5);
}
glEnd();
glNormal3f(0.0, 0.0, -1.0);
/* draw back face */
glBegin(GL_QUAD_STRIP);
for (i = 0; i <= teeth; i++) {
angle = i * 2.0 * M_PI / teeth;
glVertex3f(r1 * cos(angle), r1 * sin(angle), -width * 0.5);
glVertex3f(r0 * cos(angle), r0 * sin(angle), -width * 0.5);
if (i < teeth) {
glVertex3f(r1 * cos(angle + 3 * da), r1 * sin(angle + 3 * da), -width * 0.5);
glVertex3f(r0 * cos(angle), r0 * sin(angle), -width * 0.5);
}
}
glEnd();
/* draw back sides of teeth */
glBegin(GL_QUADS);
da = 2.0 * M_PI / teeth / 4.0;
for (i = 0; i < teeth; i++) {
angle = i * 2.0 * M_PI / teeth;
glVertex3f(r1 * cos(angle + 3 * da), r1 * sin(angle + 3 * da), -width * 0.5);
glVertex3f(r2 * cos(angle + 2 * da), r2 * sin(angle + 2 * da), -width * 0.5);
glVertex3f(r2 * cos(angle + da), r2 * sin(angle + da), -width * 0.5);
glVertex3f(r1 * cos(angle), r1 * sin(angle), -width * 0.5);
}
glEnd();
/* draw outward faces of teeth */
glBegin(GL_QUAD_STRIP);
for (i = 0; i < teeth; i++) {
angle = i * 2.0 * M_PI / teeth;
glVertex3f(r1 * cos(angle), r1 * sin(angle), width * 0.5);
glVertex3f(r1 * cos(angle), r1 * sin(angle), -width * 0.5);
u = r2 * cos(angle + da) - r1 * cos(angle);
v = r2 * sin(angle + da) - r1 * sin(angle);
len = sqrt(u * u + v * v);
u /= len;
v /= len;
glNormal3f(v, -u, 0.0);
glVertex3f(r2 * cos(angle + da), r2 * sin(angle + da), width * 0.5);
glVertex3f(r2 * cos(angle + da), r2 * sin(angle + da), -width * 0.5);
glNormal3f(cos(angle), sin(angle), 0.0);
glVertex3f(r2 * cos(angle + 2 * da), r2 * sin(angle + 2 * da), width * 0.5);
glVertex3f(r2 * cos(angle + 2 * da), r2 * sin(angle + 2 * da), -width * 0.5);
u = r1 * cos(angle + 3 * da) - r2 * cos(angle + 2 * da);
v = r1 * sin(angle + 3 * da) - r2 * sin(angle + 2 * da);
glNormal3f(v, -u, 0.0);
glVertex3f(r1 * cos(angle + 3 * da), r1 * sin(angle + 3 * da), width * 0.5);
glVertex3f(r1 * cos(angle + 3 * da), r1 * sin(angle + 3 * da), -width * 0.5);
glNormal3f(cos(angle), sin(angle), 0.0);
}
glVertex3f(r1 * cos(0), r1 * sin(0), width * 0.5);
glVertex3f(r1 * cos(0), r1 * sin(0), -width * 0.5);
glEnd();
glShadeModel(GL_SMOOTH);
/* draw inside radius cylinder */
glBegin(GL_QUAD_STRIP);
for (i = 0; i <= teeth; i++) {
angle = i * 2.0 * M_PI / teeth;
glNormal3f(-cos(angle), -sin(angle), 0.0);
glVertex3f(r0 * cos(angle), r0 * sin(angle), -width * 0.5);
glVertex3f(r0 * cos(angle), r0 * sin(angle), width * 0.5);
}
glEnd();
}
static GLfloat view_rotx = 20.0, view_roty = 30.0, view_rotz = 0.0;
static GLint gear1, gear2, gear3;
static GLfloat angle = 0.0;
static void
draw(void)
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glPushMatrix();
glRotatef(view_rotx, 1.0, 0.0, 0.0);
glRotatef(view_roty, 0.0, 1.0, 0.0);
glRotatef(view_rotz, 0.0, 0.0, 1.0);
glPushMatrix();
glTranslatef(-3.0, -2.0, 0.0);
glRotatef(angle, 0.0, 0.0, 1.0);
glCallList(gear1);
glPopMatrix();
glPushMatrix();
glTranslatef(3.1, -2.0, 0.0);
glRotatef(-2.0 * angle - 9.0, 0.0, 0.0, 1.0);
glCallList(gear2);
glPopMatrix();
glPushMatrix();
glTranslatef(-3.1, 4.2, 0.0);
glRotatef(-2.0 * angle - 25.0, 0.0, 0.0, 1.0);
glCallList(gear3);
glPopMatrix();
glPopMatrix();
glutSwapBuffers();
Frames++;
{
GLint t = glutGet(GLUT_ELAPSED_TIME);
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
idle(void)
{
angle += 2.0;
glutPostRedisplay();
}
/* change view angle, exit upon ESC */
/* ARGSUSED1 */
static void
key(unsigned char k, int x, int y)
{
switch (k) {
case 'z':
view_rotz += 5.0;
break;
case 'Z':
view_rotz -= 5.0;
break;
case 27: /* Escape */
exit(0); /* FIXME: Shutdown and free resources cleanly in ggiglut */
break;
default:
return;
}
glutPostRedisplay();
}
/* change view angle */
/* ARGSUSED1 */
static void
special(int k, int x, int y)
{
switch (k) {
case GLUT_KEY_UP:
view_rotx += 5.0;
break;
case GLUT_KEY_DOWN:
view_rotx -= 5.0;
break;
case GLUT_KEY_LEFT:
view_roty += 5.0;
break;
case GLUT_KEY_RIGHT:
view_roty -= 5.0;
break;
default:
return;
}
glutPostRedisplay();
}
/* new window size or exposure */
static void
reshape(int width, int height)
{
GLfloat h = (GLfloat) height / (GLfloat) width;
glViewport(0, 0, (GLint) width, (GLint) height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glFrustum(-1.0, 1.0, -h, h, 5.0, 60.0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glTranslatef(0.0, 0.0, -40.0);
}
static void
init(void)
{
static GLfloat pos[4] =
{5.0, 5.0, 10.0, 0.0};
static GLfloat red[4] =
{0.8, 0.1, 0.0, 1.0};
static GLfloat green[4] =
{0.0, 0.8, 0.2, 1.0};
static GLfloat blue[4] =
{0.2, 0.2, 1.0, 1.0};
glLightfv(GL_LIGHT0, GL_POSITION, pos);
glEnable(GL_CULL_FACE);
glEnable(GL_LIGHTING);
glEnable(GL_LIGHT0);
glEnable(GL_DEPTH_TEST);
/* make the gears */
gear1 = glGenLists(1);
glNewList(gear1, GL_COMPILE);
glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, red);
gear(1.0, 4.0, 1.0, 20, 0.7);
glEndList();
gear2 = glGenLists(1);
glNewList(gear2, GL_COMPILE);
glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, green);
gear(0.5, 2.0, 2.0, 10, 0.7);
glEndList();
gear3 = glGenLists(1);
glNewList(gear3, GL_COMPILE);
glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, blue);
gear(1.3, 2.0, 0.5, 10, 0.7);
glEndList();
glEnable(GL_NORMALIZE);
}
void
visible(int vis)
{
if (vis == GLUT_VISIBLE)
glutIdleFunc(idle);
else
glutIdleFunc(NULL);
}
int main(int argc, char *argv[])
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE);
// glutInitWindowPosition(0, 0);
// glutInitWindowSize(300, 300);
glutCreateWindow("Gears");
init();
glutDisplayFunc(draw);
glutReshapeFunc(reshape);
glutKeyboardFunc(key);
glutSpecialFunc(special);
glutVisibilityFunc(visible);
glutMainLoop();
return 0;
}

359
progs/ggi/gears2.c Normal file
View File

@@ -0,0 +1,359 @@
/* gears.c */
/*
* 3-D gear wheels. This program is in the public domain.
*
* Brian Paul
* modified by Uwe Maurer (uwe_maurer@t-online.de)
*/
#include <string.h>
#include <math.h>
#include <stdlib.h>
#include <ggi/ggi.h>
#include <GL/ggimesa.h>
#ifndef M_PI
# define M_PI 3.14159265
#endif
ggi_visual_t vis;
char text[100];
/*
* Draw a gear wheel. You'll probably want to call this function when
* building a display list since we do a lot of trig here.
*
* Input: inner_radius - radius of hole at center
* outer_radius - radius at center of teeth
* width - width of gear
* teeth - number of teeth
* tooth_depth - depth of tooth
*/
static void gear( GLfloat inner_radius, GLfloat outer_radius, GLfloat width,
GLint teeth, GLfloat tooth_depth )
{
GLint i;
GLfloat r0, r1, r2;
GLfloat angle, da;
GLfloat u, v, len;
r0 = inner_radius;
r1 = outer_radius - tooth_depth/2.0;
r2 = outer_radius + tooth_depth/2.0;
da = 2.0*M_PI / teeth / 4.0;
glShadeModel( GL_FLAT );
glNormal3f( 0.0, 0.0, 1.0 );
/* draw front face */
glBegin( GL_QUAD_STRIP );
for (i=0;i<=teeth;i++) {
angle = i * 2.0*M_PI / teeth;
glVertex3f( r0*cos(angle), r0*sin(angle), width*0.5 );
glVertex3f( r1*cos(angle), r1*sin(angle), width*0.5 );
glVertex3f( r0*cos(angle), r0*sin(angle), width*0.5 );
glVertex3f( r1*cos(angle+3*da), r1*sin(angle+3*da), width*0.5 );
}
glEnd();
/* draw front sides of teeth */
glBegin( GL_QUADS );
da = 2.0*M_PI / teeth / 4.0;
for (i=0;i<teeth;i++) {
angle = i * 2.0*M_PI / teeth;
glVertex3f( r1*cos(angle), r1*sin(angle), width*0.5 );
glVertex3f( r2*cos(angle+da), r2*sin(angle+da), width*0.5 );
glVertex3f( r2*cos(angle+2*da), r2*sin(angle+2*da), width*0.5 );
glVertex3f( r1*cos(angle+3*da), r1*sin(angle+3*da), width*0.5 );
}
glEnd();
glNormal3f( 0.0, 0.0, -1.0 );
/* draw back face */
glBegin( GL_QUAD_STRIP );
for (i=0;i<=teeth;i++) {
angle = i * 2.0*M_PI / teeth;
glVertex3f( r1*cos(angle), r1*sin(angle), -width*0.5 );
glVertex3f( r0*cos(angle), r0*sin(angle), -width*0.5 );
glVertex3f( r1*cos(angle+3*da), r1*sin(angle+3*da), -width*0.5 );
glVertex3f( r0*cos(angle), r0*sin(angle), -width*0.5 );
}
glEnd();
/* draw back sides of teeth */
glBegin( GL_QUADS );
da = 2.0*M_PI / teeth / 4.0;
for (i=0;i<teeth;i++) {
angle = i * 2.0*M_PI / teeth;
glVertex3f( r1*cos(angle+3*da), r1*sin(angle+3*da), -width*0.5 );
glVertex3f( r2*cos(angle+2*da), r2*sin(angle+2*da), -width*0.5 );
glVertex3f( r2*cos(angle+da), r2*sin(angle+da), -width*0.5 );
glVertex3f( r1*cos(angle), r1*sin(angle), -width*0.5 );
}
glEnd();
/* draw outward faces of teeth */
glBegin( GL_QUAD_STRIP );
for (i=0;i<teeth;i++) {
angle = i * 2.0*M_PI / teeth;
glVertex3f( r1*cos(angle), r1*sin(angle), width*0.5 );
glVertex3f( r1*cos(angle), r1*sin(angle), -width*0.5 );
u = r2*cos(angle+da) - r1*cos(angle);
v = r2*sin(angle+da) - r1*sin(angle);
len = sqrt( u*u + v*v );
u /= len;
v /= len;
glNormal3f( v, -u, 0.0 );
glVertex3f( r2*cos(angle+da), r2*sin(angle+da), width*0.5 );
glVertex3f( r2*cos(angle+da), r2*sin(angle+da), -width*0.5 );
glNormal3f( cos(angle), sin(angle), 0.0 );
glVertex3f( r2*cos(angle+2*da), r2*sin(angle+2*da), width*0.5 );
glVertex3f( r2*cos(angle+2*da), r2*sin(angle+2*da), -width*0.5 );
u = r1*cos(angle+3*da) - r2*cos(angle+2*da);
v = r1*sin(angle+3*da) - r2*sin(angle+2*da);
glNormal3f( v, -u, 0.0 );
glVertex3f( r1*cos(angle+3*da), r1*sin(angle+3*da), width*0.5 );
glVertex3f( r1*cos(angle+3*da), r1*sin(angle+3*da), -width*0.5 );
glNormal3f( cos(angle), sin(angle), 0.0 );
}
glVertex3f( r1*cos(0), r1*sin(0), width*0.5 );
glVertex3f( r1*cos(0), r1*sin(0), -width*0.5 );
glEnd();
glShadeModel( GL_SMOOTH );
/* draw inside radius cylinder */
glBegin( GL_QUAD_STRIP );
for (i=0;i<=teeth;i++) {
angle = i * 2.0*M_PI / teeth;
glNormal3f( -cos(angle), -sin(angle), 0.0 );
glVertex3f( r0*cos(angle), r0*sin(angle), -width*0.5 );
glVertex3f( r0*cos(angle), r0*sin(angle), width*0.5 );
}
glEnd();
}
static GLfloat view_rotx=20.0, view_roty=30.0, view_rotz=0.0;
static GLint gear1, gear2, gear3;
static GLfloat angle = 0.0;
static GLuint limit;
static GLuint count = 1;
static void draw( void )
{
glClearColor(0,0,0,0);
glClearIndex(0);
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
glPushMatrix();
glRotatef( view_rotx, 1.0, 0.0, 0.0 );
glRotatef( view_roty, 0.0, 1.0, 0.0 );
glRotatef( view_rotz, 0.0, 0.0, 1.0 );
glPushMatrix();
glTranslatef( -3.0, -2.0, 0.0 );
glRotatef( angle, 0.0, 0.0, 1.0 );
glCallList(gear1);
glPopMatrix();
glPushMatrix();
glTranslatef( 3.1, -2.0, 0.0 );
glRotatef( -2.0*angle-9.0, 0.0, 0.0, 1.0 );
glCallList(gear2);
glPopMatrix();
glPushMatrix();
glTranslatef( -3.1, 4.2, 0.0 );
glRotatef( -2.0*angle-25.0, 0.0, 0.0, 1.0 );
glCallList(gear3);
glPopMatrix();
glPopMatrix();
glFlush();
glFinish();
#if 0
ggiSetGCForeground(vis,255);
ggiPuts(vis,0,0,"Mesa -> GGI");
ggiPuts(vis,0,ggiGetInfo(vis)->mode->visible.y," Mesa -> GGI");
ggiPuts(vis,0,16,text);
ggiPuts(vis,0,ggiGetInfo(vis)->mode->visible.y+16,text);
#endif
GGIMesaSwapBuffers();
count++;
if (count==limit) {
exit(1);
}
}
static void idle( void )
{
angle += 2.0;
draw();
}
/* new window size or exposure */
static void reshape( int width, int height )
{
GLfloat h = (GLfloat) height / (GLfloat) width;
glViewport(0, 0, (GLint)width, (GLint)height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glFrustum( -1.0, 1.0, -h, h, 5.0, 60.0 );
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glTranslatef( 0.0, 0.0, -40.0 );
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
}
static void init( void )
{
static GLfloat pos[4] = {5.0, 5.0, 10.0, 0.0 };
static GLfloat red[4] = {0.8, 0.1, 0.0, 1.0 };
static GLfloat green[4] = {0.0, 0.8, 0.2, 1.0 };
static GLfloat blue[4] = {0.2, 0.2, 1.0, 1.0 };
glLightfv( GL_LIGHT0, GL_POSITION, pos );
glEnable( GL_CULL_FACE );
glEnable( GL_LIGHTING );
glEnable( GL_LIGHT0 );
glEnable( GL_DEPTH_TEST );
/* make the gears */
gear1 = glGenLists(1);
glNewList(gear1, GL_COMPILE);
glMaterialfv( GL_FRONT, GL_AMBIENT_AND_DIFFUSE, red );
glIndexi(1);
gear( 1.0, 4.0, 1.0, 20, 0.7 );
glEndList();
gear2 = glGenLists(1);
glNewList(gear2, GL_COMPILE);
glMaterialfv( GL_FRONT, GL_AMBIENT_AND_DIFFUSE, green );
glIndexi(2);
gear( 0.5, 2.0, 2.0, 10, 0.7 );
glEndList();
gear3 = glGenLists(1);
glNewList(gear3, GL_COMPILE);
glMaterialfv( GL_FRONT, GL_AMBIENT_AND_DIFFUSE, blue );
glIndexi(3);
gear( 1.3, 2.0, 0.5, 10, 0.7 );
glEndList();
glEnable( GL_NORMALIZE );
}
static void usage(char *s)
{
printf("%s visible_x visible_y virtual_x virtual_y bpp db_flag\n",s);
printf("example:\n");
printf("%s 320 200 320 400 8 1\n",s);
exit(1);
}
int main( int argc, char *argv[] )
{
GGIMesaContext ctx;
int vis_x,vis_y,vir_x,vir_y,bpp,db_flag,gt;
ggi_mode mode;
limit=0;
if (argc<7) usage(argv[0]);
vis_x=atoi(argv[1]);
vis_y=atoi(argv[2]);
vir_x=atoi(argv[3]);
vir_y=atoi(argv[4]);
bpp=atoi(argv[5]);
db_flag=atoi(argv[6]);
switch(bpp)
{
case 4: gt=GT_4BIT;break;
case 8: gt=GT_8BIT;break;
case 15:gt=GT_15BIT;break;
case 16:gt=GT_16BIT;break;
case 24:gt=GT_24BIT;break;
case 32:gt=GT_32BIT;break;
default:
printf("%i Bits per Pixel ???\n",bpp);
exit(1);
}
sprintf(text,"%sx%s %i colors, RGB mode, %s",
argv[1],argv[2],1<<bpp,
(db_flag) ? "doublebuffer" : "no doublebuffer");
if (ggiInit()<0)
{
printf("ggiInit() failed\n");
exit(1);
}
ctx=GGIMesaCreateContext();
if (ctx==NULL)
{
printf("GGIMesaCreateContext() failed\n");
exit(1);
}
vis=ggiOpen(NULL);
if (vis==NULL)
{
printf("ggiOpen() failed\n");
exit(1);
}
if (ggiSetGraphMode(vis,vis_x,vis_y,vir_x,vir_y,gt)<0)
{
printf("%s: can't set graphmode (%i %i %i %i) %i BPP\n",
argv[0],vis_x,vis_y,vir_x,vir_y,bpp);
exit(1);
}
if (GGIMesaSetVisual(ctx,vis,GL_TRUE,db_flag)<0)
{
printf ("GGIMesaSetVisual() failed\n");
exit(1);
}
GGIMesaMakeCurrent(ctx);
ggiGetMode(vis,&mode);
reshape(mode.visible.x,mode.visible.y);
init();
while (!ggiKbhit(vis)) idle();
GGIMesaDestroyContext(ctx);
ggiClose(vis);
printf("%s\n",text);
ggiExit();
return 0;
}

132
progs/ggi/sphere.asc Normal file
View File

@@ -0,0 +1,132 @@
Ambient light color: Red=0.039216 Green=0.039216 Blue=0.039216
Named object: "Object01"
Tri-mesh, Vertices: 20 Faces: 36
Vertex list:
Vertex 0: X: -210 Y: -432.781738 Z: 180.000031
Vertex 1: X: -610.810303 Y: 144.260559 Z: 103.580154
Vertex 2: X: 56.586655 Y: 144.260544 Z: -128.902023
Vertex 3: X: -75.776352 Y: 144.260605 Z: 565.321838
Vertex 4: X: -462.815979 Y: -347.937683 Z: 131.797302
Vertex 5: X: -616.506042 Y: -126.67173 Z: 102.494209
Vertex 6: X: -41.847229 Y: -347.937683 Z: -14.843644
Vertex 7: X: 60.375015 Y: -126.671753 Z: -133.291641
Vertex 8: X: -125.336807 Y: -347.937653 Z: 423.046448
Vertex 9: X: -73.868958 Y: -126.671692 Z: 570.797424
Vertex 10: X: -448.353271 Y: 237.304672 Z: -92.34951
Vertex 11: X: -192.440964 Y: 237.304672 Z: -181.494431
Vertex 12: X: 145.038193 Y: 237.304672 Z: 109.754745
Vertex 13: X: 94.283768 Y: 237.304688 Z: 375.953766
Vertex 14: X: -326.684937 Y: 237.304733 Z: 522.594727
Vertex 15: X: -531.842834 Y: 237.304718 Z: 345.540588
Vertex 16: X: -331.419525 Y: -225.964966 Z: -168.564438
Vertex 17: X: 152.575485 Y: -225.964935 Z: 249.129868
Vertex 18: X: -451.155914 Y: -225.964905 Z: 459.434662
Vertex 19: X: -298.413483 Y: 423.31897 Z: 163.142761
Face list:
Face 0: A:0 B:4 C:6 AB:1 BC:1 CA:1
Face 1: A:4 B:5 C:16 AB:1 BC:1 CA:1
Face 2: A:4 B:16 C:6 AB:1 BC:1 CA:1
Face 3: A:6 B:16 C:7 AB:1 BC:1 CA:1
Face 4: A:5 B:1 C:10 AB:1 BC:1 CA:1
Face 5: A:5 B:10 C:16 AB:1 BC:1 CA:1
Face 6: A:16 B:10 C:11 AB:1 BC:1 CA:1
Face 7: A:16 B:11 C:7 AB:1 BC:1 CA:1
Face 8: A:7 B:11 C:2 AB:1 BC:1 CA:1
Face 9: A:0 B:6 C:8 AB:1 BC:1 CA:1
Face 10: A:6 B:7 C:17 AB:1 BC:1 CA:1
Face 11: A:6 B:17 C:8 AB:1 BC:1 CA:1
Face 12: A:8 B:17 C:9 AB:1 BC:1 CA:1
Face 13: A:7 B:2 C:12 AB:1 BC:1 CA:1
Face 14: A:7 B:12 C:17 AB:1 BC:1 CA:1
Face 15: A:17 B:12 C:13 AB:1 BC:1 CA:1
Face 16: A:17 B:13 C:9 AB:1 BC:1 CA:1
Face 17: A:9 B:13 C:3 AB:1 BC:1 CA:1
Face 18: A:0 B:8 C:4 AB:1 BC:1 CA:1
Face 19: A:8 B:9 C:18 AB:1 BC:1 CA:1
Face 20: A:8 B:18 C:4 AB:1 BC:1 CA:1
Face 21: A:4 B:18 C:5 AB:1 BC:1 CA:1
Face 22: A:9 B:3 C:14 AB:1 BC:1 CA:1
Face 23: A:9 B:14 C:18 AB:1 BC:1 CA:1
Face 24: A:18 B:14 C:15 AB:1 BC:1 CA:1
Face 25: A:18 B:15 C:5 AB:1 BC:1 CA:1
Face 26: A:5 B:15 C:1 AB:1 BC:1 CA:1
Face 27: A:1 B:15 C:10 AB:1 BC:1 CA:1
Face 28: A:15 B:14 C:19 AB:1 BC:1 CA:1
Face 29: A:15 B:19 C:10 AB:1 BC:1 CA:1
Face 30: A:10 B:19 C:11 AB:1 BC:1 CA:1
Face 31: A:14 B:3 C:13 AB:1 BC:1 CA:1
Face 32: A:14 B:13 C:19 AB:1 BC:1 CA:1
Face 33: A:19 B:13 C:12 AB:1 BC:1 CA:1
Face 34: A:19 B:12 C:11 AB:1 BC:1 CA:1
Page 1
Face 35: A:11 B:12 C:2 AB:1 BC:1 CA:1
Page 2

264
progs/ggi/torus.asc Normal file
View File

@@ -0,0 +1,264 @@
Ambient light color: Red=0.039216 Green=0.039216 Blue=0.039216
Named object: "Object01"
Tri-mesh, Vertices: 40 Faces: 80
Vertex list:
Vertex 0: X: -50.170624 Y: -0.000026 Z: -240.147842
Vertex 1: X: -80.584503 Y: -63.958851 Z: -205.014572
Vertex 2: X: -129.795166 Y: -39.528744 Z: -148.16774
Vertex 3: X: -129.795166 Y: 39.528721 Z: -148.16774
Vertex 4: X: -80.584503 Y: 63.958797 Z: -205.014572
Vertex 5: X: 85.963654 Y: -0.000002 Z: 31.490465
Vertex 6: X: 39.614838 Y: -63.958828 Z: 34.827602
Vertex 7: X: -35.37915 Y: -39.528728 Z: 40.227196
Vertex 8: X: -35.37912 Y: 39.528736 Z: 40.227188
Vertex 9: X: 39.614838 Y: 63.95882 Z: 34.827595
Vertex 10: X: -9.852051 Y: 0.000023 Z: 319.829254
Vertex 11: X: -44.985352 Y: -63.958805 Z: 289.415405
Vertex 12: X: -101.832199 Y: -39.528709 Z: 240.204758
Vertex 13: X: -101.832184 Y: 39.528755 Z: 240.204773
Vertex 14: X: -44.985352 Y: 63.958843 Z: 289.415405
Vertex 15: X: -281.490326 Y: 0.000035 Z: 455.963654
Vertex 16: X: -284.827484 Y: -63.958794 Z: 409.614868
Vertex 17: X: -290.227112 Y: -39.528702 Z: 334.62085
Vertex 18: X: -290.227112 Y: 39.528763 Z: 334.62088
Vertex 19: X: -284.827484 Y: 63.958855 Z: 409.614838
Vertex 20: X: -569.829163 Y: 0.000026 Z: 360.14798
Vertex 21: X: -539.415344 Y: -63.958801 Z: 325.014709
Vertex 22: X: -490.204712 Y: -39.528709 Z: 268.167847
Vertex 23: X: -490.204712 Y: 39.528755 Z: 268.167847
Vertex 24: X: -539.415344 Y: 63.958847 Z: 325.014679
Vertex 25: X: -705.963684 Y: 0.000002 Z: 88.509598
Vertex 26: X: -659.614807 Y: -63.958824 Z: 85.172462
Vertex 27: X: -584.62085 Y: -39.528725 Z: 79.77285
Vertex 28: X: -584.62085 Y: 39.52874 Z: 79.77285
Vertex 29: X: -659.614868 Y: 63.958824 Z: 85.172447
Vertex 30: X: -610.147827 Y: -0.000023 Z: -199.829361
Vertex 31: X: -575.014587 Y: -63.958847 Z: -169.415497
Vertex 32: X: -518.167725 Y: -39.528744 Z: -120.204819
Vertex 33: X: -518.167725 Y: 39.528721 Z: -120.204834
Vertex 34: X: -575.014587 Y: 63.958801 Z: -169.415497
Vertex 35: X: -338.509338 Y: -0.000035 Z: -335.963745
Vertex 36: X: -335.172241 Y: -63.958858 Z: -289.614868
Vertex 37: X: -329.772675 Y: -39.528751 Z: -214.620865
Vertex 38: X: -329.772675 Y: 39.528713 Z: -214.620865
Vertex 39: X: -335.172241 Y: 63.95879 Z: -289.614899
Face list:
Face 0: A:0 B:6 C:1 AB:0 BC:1 CA:1
Smoothing: 1
Face 1: A:0 B:5 C:6 AB:1 BC:1 CA:0
Smoothing: 1
Face 2: A:1 B:7 C:2 AB:0 BC:1 CA:1
Smoothing: 2
Face 3: A:1 B:6 C:7 AB:1 BC:1 CA:0
Smoothing: 2
Face 4: A:2 B:8 C:3 AB:0 BC:1 CA:1
Smoothing: 3
Face 5: A:2 B:7 C:8 AB:1 BC:1 CA:0
Smoothing: 3
Face 6: A:3 B:9 C:4 AB:0 BC:1 CA:1
Smoothing: 4
Face 7: A:3 B:8 C:9 AB:1 BC:1 CA:0
Page 1
Smoothing: 4
Face 8: A:4 B:5 C:0 AB:0 BC:1 CA:1
Smoothing: 5
Face 9: A:4 B:9 C:5 AB:1 BC:1 CA:0
Smoothing: 5
Face 10: A:5 B:11 C:6 AB:0 BC:1 CA:1
Smoothing: 6
Face 11: A:5 B:10 C:11 AB:1 BC:1 CA:0
Smoothing: 6
Face 12: A:6 B:12 C:7 AB:0 BC:1 CA:1
Smoothing: 7
Face 13: A:6 B:11 C:12 AB:1 BC:1 CA:0
Smoothing: 7
Face 14: A:7 B:13 C:8 AB:0 BC:1 CA:1
Smoothing: 8
Face 15: A:7 B:12 C:13 AB:1 BC:1 CA:0
Smoothing: 8
Face 16: A:8 B:14 C:9 AB:0 BC:1 CA:1
Smoothing: 9
Face 17: A:8 B:13 C:14 AB:1 BC:1 CA:0
Smoothing: 9
Face 18: A:9 B:10 C:5 AB:0 BC:1 CA:1
Smoothing: 10
Face 19: A:9 B:14 C:10 AB:1 BC:1 CA:0
Smoothing: 10
Face 20: A:10 B:16 C:11 AB:0 BC:1 CA:1
Smoothing: 11
Face 21: A:10 B:15 C:16 AB:1 BC:1 CA:0
Smoothing: 11
Face 22: A:11 B:17 C:12 AB:0 BC:1 CA:1
Smoothing: 12
Face 23: A:11 B:16 C:17 AB:1 BC:1 CA:0
Smoothing: 12
Face 24: A:12 B:18 C:13 AB:0 BC:1 CA:1
Smoothing: 13
Face 25: A:12 B:17 C:18 AB:1 BC:1 CA:0
Smoothing: 13
Face 26: A:13 B:19 C:14 AB:0 BC:1 CA:1
Smoothing: 14
Face 27: A:13 B:18 C:19 AB:1 BC:1 CA:0
Smoothing: 14
Face 28: A:14 B:15 C:10 AB:0 BC:1 CA:1
Smoothing: 15
Face 29: A:14 B:19 C:15 AB:1 BC:1 CA:0
Smoothing: 15
Face 30: A:15 B:21 C:16 AB:0 BC:1 CA:1
Smoothing: 16
Face 31: A:15 B:20 C:21 AB:1 BC:1 CA:0
Smoothing: 16
Face 32: A:16 B:22 C:17 AB:0 BC:1 CA:1
Smoothing: 17
Face 33: A:16 B:21 C:22 AB:1 BC:1 CA:0
Smoothing: 17
Face 34: A:17 B:23 C:18 AB:0 BC:1 CA:1
Smoothing: 18
Face 35: A:17 B:22 C:23 AB:1 BC:1 CA:0
Smoothing: 18
Face 36: A:18 B:24 C:19 AB:0 BC:1 CA:1
Smoothing: 19
Face 37: A:18 B:23 C:24 AB:1 BC:1 CA:0
Smoothing: 19
Page 2
Face 38: A:19 B:20 C:15 AB:0 BC:1 CA:1
Smoothing: 20
Face 39: A:19 B:24 C:20 AB:1 BC:1 CA:0
Smoothing: 20
Face 40: A:20 B:26 C:21 AB:0 BC:1 CA:1
Smoothing: 21
Face 41: A:20 B:25 C:26 AB:1 BC:1 CA:0
Smoothing: 21
Face 42: A:21 B:27 C:22 AB:0 BC:1 CA:1
Smoothing: 22
Face 43: A:21 B:26 C:27 AB:1 BC:1 CA:0
Smoothing: 22
Face 44: A:22 B:28 C:23 AB:0 BC:1 CA:1
Smoothing: 23
Face 45: A:22 B:27 C:28 AB:1 BC:1 CA:0
Smoothing: 23
Face 46: A:23 B:29 C:24 AB:0 BC:1 CA:1
Smoothing: 24
Face 47: A:23 B:28 C:29 AB:1 BC:1 CA:0
Smoothing: 24
Face 48: A:24 B:25 C:20 AB:0 BC:1 CA:1
Smoothing: 25
Face 49: A:24 B:29 C:25 AB:1 BC:1 CA:0
Smoothing: 25
Face 50: A:25 B:31 C:26 AB:0 BC:1 CA:1
Smoothing: 26
Face 51: A:25 B:30 C:31 AB:1 BC:1 CA:0
Smoothing: 26
Face 52: A:26 B:32 C:27 AB:0 BC:1 CA:1
Smoothing: 27
Face 53: A:26 B:31 C:32 AB:1 BC:1 CA:0
Smoothing: 27
Face 54: A:27 B:33 C:28 AB:0 BC:1 CA:1
Smoothing: 28
Face 55: A:27 B:32 C:33 AB:1 BC:1 CA:0
Smoothing: 28
Face 56: A:28 B:34 C:29 AB:0 BC:1 CA:1
Smoothing: 29
Face 57: A:28 B:33 C:34 AB:1 BC:1 CA:0
Smoothing: 29
Face 58: A:29 B:30 C:25 AB:0 BC:1 CA:1
Smoothing: 30
Face 59: A:29 B:34 C:30 AB:1 BC:1 CA:0
Smoothing: 30
Face 60: A:30 B:36 C:31 AB:0 BC:1 CA:1
Smoothing: 31
Face 61: A:30 B:35 C:36 AB:1 BC:1 CA:0
Smoothing: 31
Face 62: A:31 B:37 C:32 AB:0 BC:1 CA:1
Smoothing: 32
Face 63: A:31 B:36 C:37 AB:1 BC:1 CA:0
Smoothing: 32
Face 64: A:32 B:38 C:33 AB:0 BC:1 CA:1
Smoothing: 1
Face 65: A:32 B:37 C:38 AB:1 BC:1 CA:0
Smoothing: 1
Face 66: A:33 B:39 C:34 AB:0 BC:1 CA:1
Smoothing: 2
Face 67: A:33 B:38 C:39 AB:1 BC:1 CA:0
Smoothing: 2
Face 68: A:34 B:35 C:30 AB:0 BC:1 CA:1
Page 3
Smoothing: 3
Face 69: A:34 B:39 C:35 AB:1 BC:1 CA:0
Smoothing: 3
Face 70: A:35 B:1 C:36 AB:0 BC:1 CA:1
Smoothing: 4
Face 71: A:35 B:0 C:1 AB:1 BC:1 CA:0
Smoothing: 4
Face 72: A:36 B:2 C:37 AB:0 BC:1 CA:1
Smoothing: 5
Face 73: A:36 B:1 C:2 AB:1 BC:1 CA:0
Smoothing: 5
Face 74: A:37 B:3 C:38 AB:0 BC:1 CA:1
Smoothing: 6
Face 75: A:37 B:2 C:3 AB:1 BC:1 CA:0
Smoothing: 6
Face 76: A:38 B:4 C:39 AB:0 BC:1 CA:1
Smoothing: 7
Face 77: A:38 B:3 C:4 AB:1 BC:1 CA:0
Smoothing: 7
Face 78: A:39 B:0 C:35 AB:0 BC:1 CA:1
Smoothing: 8
Face 79: A:39 B:4 C:0 AB:1 BC:1 CA:0
Smoothing: 8
Page 4

396
progs/ggi/tube.asc Normal file
View File

@@ -0,0 +1,396 @@
Ambient light color: Red=0.039216 Green=0.039216 Blue=0.039216
Named object: "Object01"
Tri-mesh, Vertices: 64 Faces: 128
Vertex list:
Vertex 0: X: 61.483898 Y: 37.836231 Z: -70.94294
Vertex 1: X: 82.867447 Y: 37.836235 Z: -41.288902
Vertex 2: X: 91.275154 Y: 37.836239 Z: -5.70901
Vertex 3: X: 85.427025 Y: 37.836243 Z: 30.380013
Vertex 4: X: 66.213379 Y: 37.836243 Z: 61.483936
Vertex 5: X: 36.559322 Y: 37.836246 Z: 82.86747
Vertex 6: X: 0.979424 Y: 37.836246 Z: 91.275154
Vertex 7: X: -35.109554 Y: 37.836246 Z: 85.42701
Vertex 8: X: -66.213478 Y: 37.836246 Z: 66.213356
Vertex 9: X: -87.597 Y: 37.836243 Z: 36.559303
Vertex 10: X: -96.004677 Y: 37.836239 Z: 0.979406
Vertex 11: X: -90.156517 Y: 37.836235 Z: -35.109615
Vertex 12: X: -70.942848 Y: 37.836235 Z: -66.213516
Vertex 13: X: -41.288776 Y: 37.836231 Z: -87.597023
Vertex 14: X: -5.708872 Y: 37.836231 Z: -96.004692
Vertex 15: X: 30.380142 Y: 37.836231 Z: -90.156502
Vertex 16: X: 61.483898 Y: -38.14529 Z: -70.942932
Vertex 17: X: 82.867447 Y: -38.145287 Z: -41.288895
Vertex 18: X: 91.275154 Y: -38.145283 Z: -5.709003
Vertex 19: X: 85.427025 Y: -38.145279 Z: 30.38002
Vertex 20: X: 66.213379 Y: -38.145279 Z: 61.483944
Vertex 21: X: 36.559322 Y: -38.145275 Z: 82.867477
Vertex 22: X: 0.979424 Y: -38.145275 Z: 91.275162
Vertex 23: X: -35.109554 Y: -38.145275 Z: 85.427017
Vertex 24: X: -66.213478 Y: -38.145275 Z: 66.213364
Vertex 25: X: -87.597 Y: -38.145279 Z: 36.559311
Vertex 26: X: -96.004677 Y: -38.145283 Z: 0.979412
Vertex 27: X: -90.156517 Y: -38.145287 Z: -35.109608
Vertex 28: X: -70.942848 Y: -38.145287 Z: -66.213516
Vertex 29: X: -41.288776 Y: -38.14529 Z: -87.597015
Vertex 30: X: -5.708872 Y: -38.14529 Z: -96.004684
Vertex 31: X: 30.380142 Y: -38.14529 Z: -90.156494
Vertex 32: X: 29.53923 Y: 37.836235 Z: -36.632011
Vertex 33: X: 40.224194 Y: 37.836239 Z: -21.814436
Vertex 34: X: 44.425369 Y: 37.836239 Z: -4.035822
Vertex 35: X: 41.503166 Y: 37.836239 Z: 13.997195
Vertex 36: X: 31.902466 Y: 37.836243 Z: 29.539249
Vertex 37: X: 17.084883 Y: 37.836243 Z: 40.224201
Vertex 38: X: -0.693734 Y: 37.836243 Z: 44.425365
Vertex 39: X: -18.726728 Y: 37.836243 Z: 41.503159
Vertex 40: X: -34.26878 Y: 37.836243 Z: 31.902454
Vertex 41: X: -44.953732 Y: 37.836239 Z: 17.084871
Vertex 42: X: -49.154892 Y: 37.836239 Z: -0.693745
Vertex 43: X: -46.232677 Y: 37.836239 Z: -18.726759
Vertex 44: X: -36.631962 Y: 37.836235 Z: -34.268806
Vertex 45: X: -21.814371 Y: 37.836235 Z: -44.953747
Vertex 46: X: -4.035751 Y: 37.836235 Z: -49.1549
Vertex 47: X: 13.997261 Y: 37.836235 Z: -46.23267
Vertex 48: X: 29.53923 Y: -38.145287 Z: -36.632004
Vertex 49: X: 40.224194 Y: -38.145283 Z: -21.814428
Vertex 50: X: 44.425369 Y: -38.145283 Z: -4.035816
Vertex 51: X: 41.503166 Y: -38.145283 Z: 13.997201
Vertex 52: X: 31.902466 Y: -38.145279 Z: 29.539257
Vertex 53: X: 17.084883 Y: -38.145279 Z: 40.224209
Vertex 54: X: -0.693734 Y: -38.145279 Z: 44.425373
Vertex 55: X: -18.726728 Y: -38.145279 Z: 41.503166
Page 1
Vertex 56: X: -34.26878 Y: -38.145279 Z: 31.902462
Vertex 57: X: -44.953732 Y: -38.145283 Z: 17.084879
Vertex 58: X: -49.154892 Y: -38.145283 Z: -0.693738
Vertex 59: X: -46.232677 Y: -38.145283 Z: -18.726751
Vertex 60: X: -36.631962 Y: -38.145287 Z: -34.268799
Vertex 61: X: -21.814371 Y: -38.145287 Z: -44.953739
Vertex 62: X: -4.035751 Y: -38.145287 Z: -49.154892
Vertex 63: X: 13.997261 Y: -38.145287 Z: -46.232662
Face list:
Face 0: A:0 B:1 C:17 AB:1 BC:1 CA:0
Smoothing: 1
Face 1: A:0 B:17 C:16 AB:0 BC:1 CA:1
Smoothing: 1
Face 2: A:1 B:2 C:18 AB:1 BC:1 CA:0
Smoothing: 2
Face 3: A:1 B:18 C:17 AB:0 BC:1 CA:1
Smoothing: 2
Face 4: A:2 B:3 C:19 AB:1 BC:1 CA:0
Smoothing: 3
Face 5: A:2 B:19 C:18 AB:0 BC:1 CA:1
Smoothing: 3
Face 6: A:3 B:4 C:20 AB:1 BC:1 CA:0
Smoothing: 4
Face 7: A:3 B:20 C:19 AB:0 BC:1 CA:1
Smoothing: 4
Face 8: A:4 B:5 C:21 AB:1 BC:1 CA:0
Smoothing: 5
Face 9: A:4 B:21 C:20 AB:0 BC:1 CA:1
Smoothing: 5
Face 10: A:5 B:6 C:22 AB:1 BC:1 CA:0
Smoothing: 6
Face 11: A:5 B:22 C:21 AB:0 BC:1 CA:1
Smoothing: 6
Face 12: A:6 B:7 C:23 AB:1 BC:1 CA:0
Smoothing: 7
Face 13: A:6 B:23 C:22 AB:0 BC:1 CA:1
Smoothing: 7
Face 14: A:7 B:8 C:24 AB:1 BC:1 CA:0
Smoothing: 8
Face 15: A:7 B:24 C:23 AB:0 BC:1 CA:1
Smoothing: 8
Face 16: A:8 B:9 C:25 AB:1 BC:1 CA:0
Smoothing: 9
Face 17: A:8 B:25 C:24 AB:0 BC:1 CA:1
Smoothing: 9
Face 18: A:9 B:10 C:26 AB:1 BC:1 CA:0
Smoothing: 10
Face 19: A:9 B:26 C:25 AB:0 BC:1 CA:1
Smoothing: 10
Face 20: A:10 B:11 C:27 AB:1 BC:1 CA:0
Smoothing: 11
Face 21: A:10 B:27 C:26 AB:0 BC:1 CA:1
Smoothing: 11
Face 22: A:11 B:12 C:28 AB:1 BC:1 CA:0
Smoothing: 12
Face 23: A:11 B:28 C:27 AB:0 BC:1 CA:1
Smoothing: 12
Face 24: A:12 B:13 C:29 AB:1 BC:1 CA:0
Smoothing: 13
Face 25: A:12 B:29 C:28 AB:0 BC:1 CA:1
Smoothing: 13
Page 2
Face 26: A:13 B:14 C:30 AB:1 BC:1 CA:0
Smoothing: 14
Face 27: A:13 B:30 C:29 AB:0 BC:1 CA:1
Smoothing: 14
Face 28: A:14 B:15 C:31 AB:1 BC:1 CA:0
Smoothing: 15
Face 29: A:14 B:31 C:30 AB:0 BC:1 CA:1
Smoothing: 15
Face 30: A:15 B:0 C:16 AB:1 BC:1 CA:0
Smoothing: 16
Face 31: A:15 B:16 C:31 AB:0 BC:1 CA:1
Smoothing: 16
Face 32: A:32 B:49 C:33 AB:0 BC:1 CA:1
Smoothing: 17
Face 33: A:32 B:48 C:49 AB:1 BC:1 CA:0
Smoothing: 17
Face 34: A:33 B:50 C:34 AB:0 BC:1 CA:1
Smoothing: 18
Face 35: A:33 B:49 C:50 AB:1 BC:1 CA:0
Smoothing: 18
Face 36: A:34 B:51 C:35 AB:0 BC:1 CA:1
Smoothing: 19
Face 37: A:34 B:50 C:51 AB:1 BC:1 CA:0
Smoothing: 19
Face 38: A:35 B:52 C:36 AB:0 BC:1 CA:1
Smoothing: 20
Face 39: A:35 B:51 C:52 AB:1 BC:1 CA:0
Smoothing: 20
Face 40: A:36 B:53 C:37 AB:0 BC:1 CA:1
Smoothing: 21
Face 41: A:36 B:52 C:53 AB:1 BC:1 CA:0
Smoothing: 21
Face 42: A:37 B:54 C:38 AB:0 BC:1 CA:1
Smoothing: 22
Face 43: A:37 B:53 C:54 AB:1 BC:1 CA:0
Smoothing: 22
Face 44: A:38 B:55 C:39 AB:0 BC:1 CA:1
Smoothing: 23
Face 45: A:38 B:54 C:55 AB:1 BC:1 CA:0
Smoothing: 23
Face 46: A:39 B:56 C:40 AB:0 BC:1 CA:1
Smoothing: 24
Face 47: A:39 B:55 C:56 AB:1 BC:1 CA:0
Smoothing: 24
Face 48: A:40 B:57 C:41 AB:0 BC:1 CA:1
Smoothing: 25
Face 49: A:40 B:56 C:57 AB:1 BC:1 CA:0
Smoothing: 25
Face 50: A:41 B:58 C:42 AB:0 BC:1 CA:1
Smoothing: 26
Face 51: A:41 B:57 C:58 AB:1 BC:1 CA:0
Smoothing: 26
Face 52: A:42 B:59 C:43 AB:0 BC:1 CA:1
Smoothing: 27
Face 53: A:42 B:58 C:59 AB:1 BC:1 CA:0
Smoothing: 27
Face 54: A:43 B:60 C:44 AB:0 BC:1 CA:1
Smoothing: 28
Face 55: A:43 B:59 C:60 AB:1 BC:1 CA:0
Smoothing: 28
Face 56: A:44 B:61 C:45 AB:0 BC:1 CA:1
Page 3
Smoothing: 29
Face 57: A:44 B:60 C:61 AB:1 BC:1 CA:0
Smoothing: 29
Face 58: A:45 B:62 C:46 AB:0 BC:1 CA:1
Smoothing: 30
Face 59: A:45 B:61 C:62 AB:1 BC:1 CA:0
Smoothing: 30
Face 60: A:46 B:63 C:47 AB:0 BC:1 CA:1
Smoothing: 31
Face 61: A:46 B:62 C:63 AB:1 BC:1 CA:0
Smoothing: 31
Face 62: A:47 B:48 C:32 AB:0 BC:1 CA:1
Smoothing: 32
Face 63: A:47 B:63 C:48 AB:1 BC:1 CA:0
Smoothing: 32
Face 64: A:0 B:32 C:33 AB:0 BC:1 CA:0
Smoothing: 1
Face 65: A:0 B:33 C:1 AB:0 BC:0 CA:1
Smoothing: 1
Face 66: A:1 B:33 C:34 AB:0 BC:1 CA:0
Smoothing: 1
Face 67: A:1 B:34 C:2 AB:0 BC:0 CA:1
Smoothing: 1
Face 68: A:2 B:34 C:35 AB:0 BC:1 CA:0
Smoothing: 1
Face 69: A:2 B:35 C:3 AB:0 BC:0 CA:1
Smoothing: 1
Face 70: A:3 B:35 C:36 AB:0 BC:1 CA:0
Smoothing: 1
Face 71: A:3 B:36 C:4 AB:0 BC:0 CA:1
Smoothing: 1
Face 72: A:4 B:36 C:37 AB:0 BC:1 CA:0
Smoothing: 1
Face 73: A:4 B:37 C:5 AB:0 BC:0 CA:1
Smoothing: 1
Face 74: A:5 B:37 C:38 AB:0 BC:1 CA:0
Smoothing: 1
Face 75: A:5 B:38 C:6 AB:0 BC:0 CA:1
Smoothing: 1
Face 76: A:6 B:38 C:39 AB:0 BC:1 CA:0
Smoothing: 1
Face 77: A:6 B:39 C:7 AB:0 BC:0 CA:1
Smoothing: 1
Face 78: A:7 B:39 C:40 AB:0 BC:1 CA:0
Smoothing: 1
Face 79: A:7 B:40 C:8 AB:0 BC:0 CA:1
Smoothing: 1
Face 80: A:8 B:40 C:41 AB:0 BC:1 CA:0
Smoothing: 1
Face 81: A:8 B:41 C:9 AB:0 BC:0 CA:1
Smoothing: 1
Face 82: A:9 B:41 C:42 AB:0 BC:1 CA:0
Smoothing: 1
Face 83: A:9 B:42 C:10 AB:0 BC:0 CA:1
Smoothing: 1
Face 84: A:10 B:42 C:43 AB:0 BC:1 CA:0
Smoothing: 1
Face 85: A:10 B:43 C:11 AB:0 BC:0 CA:1
Smoothing: 1
Face 86: A:11 B:43 C:44 AB:0 BC:1 CA:0
Smoothing: 1
Page 4
Face 87: A:11 B:44 C:12 AB:0 BC:0 CA:1
Smoothing: 1
Face 88: A:12 B:44 C:45 AB:0 BC:1 CA:0
Smoothing: 1
Face 89: A:12 B:45 C:13 AB:0 BC:0 CA:1
Smoothing: 1
Face 90: A:13 B:45 C:46 AB:0 BC:1 CA:0
Smoothing: 1
Face 91: A:13 B:46 C:14 AB:0 BC:0 CA:1
Smoothing: 1
Face 92: A:14 B:46 C:47 AB:0 BC:1 CA:0
Smoothing: 1
Face 93: A:14 B:47 C:15 AB:0 BC:0 CA:1
Smoothing: 1
Face 94: A:15 B:47 C:32 AB:0 BC:1 CA:0
Smoothing: 1
Face 95: A:15 B:32 C:0 AB:0 BC:0 CA:1
Smoothing: 1
Face 96: A:16 B:17 C:49 AB:1 BC:0 CA:0
Smoothing: 2
Face 97: A:16 B:49 C:48 AB:0 BC:1 CA:0
Smoothing: 2
Face 98: A:17 B:18 C:50 AB:1 BC:0 CA:0
Smoothing: 2
Face 99: A:17 B:50 C:49 AB:0 BC:1 CA:0
Smoothing: 2
Face 100: A:18 B:19 C:51 AB:1 BC:0 CA:0
Smoothing: 2
Face 101: A:18 B:51 C:50 AB:0 BC:1 CA:0
Smoothing: 2
Face 102: A:19 B:20 C:52 AB:1 BC:0 CA:0
Smoothing: 2
Face 103: A:19 B:52 C:51 AB:0 BC:1 CA:0
Smoothing: 2
Face 104: A:20 B:21 C:53 AB:1 BC:0 CA:0
Smoothing: 2
Face 105: A:20 B:53 C:52 AB:0 BC:1 CA:0
Smoothing: 2
Face 106: A:21 B:22 C:54 AB:1 BC:0 CA:0
Smoothing: 2
Face 107: A:21 B:54 C:53 AB:0 BC:1 CA:0
Smoothing: 2
Face 108: A:22 B:23 C:55 AB:1 BC:0 CA:0
Smoothing: 2
Face 109: A:22 B:55 C:54 AB:0 BC:1 CA:0
Smoothing: 2
Face 110: A:23 B:24 C:56 AB:1 BC:0 CA:0
Smoothing: 2
Face 111: A:23 B:56 C:55 AB:0 BC:1 CA:0
Smoothing: 2
Face 112: A:24 B:25 C:57 AB:1 BC:0 CA:0
Smoothing: 2
Face 113: A:24 B:57 C:56 AB:0 BC:1 CA:0
Smoothing: 2
Face 114: A:25 B:26 C:58 AB:1 BC:0 CA:0
Smoothing: 2
Face 115: A:25 B:58 C:57 AB:0 BC:1 CA:0
Smoothing: 2
Face 116: A:26 B:27 C:59 AB:1 BC:0 CA:0
Smoothing: 2
Face 117: A:26 B:59 C:58 AB:0 BC:1 CA:0
Page 5
Smoothing: 2
Face 118: A:27 B:28 C:60 AB:1 BC:0 CA:0
Smoothing: 2
Face 119: A:27 B:60 C:59 AB:0 BC:1 CA:0
Smoothing: 2
Face 120: A:28 B:29 C:61 AB:1 BC:0 CA:0
Smoothing: 2
Face 121: A:28 B:61 C:60 AB:0 BC:1 CA:0
Smoothing: 2
Face 122: A:29 B:30 C:62 AB:1 BC:0 CA:0
Smoothing: 2
Face 123: A:29 B:62 C:61 AB:0 BC:1 CA:0
Smoothing: 2
Face 124: A:30 B:31 C:63 AB:1 BC:0 CA:0
Smoothing: 2
Face 125: A:30 B:63 C:62 AB:0 BC:1 CA:0
Smoothing: 2
Face 126: A:31 B:16 C:48 AB:1 BC:0 CA:0
Smoothing: 2
Face 127: A:31 B:48 C:63 AB:0 BC:1 CA:0
Smoothing: 2
Page 6

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