Compare commits

...

718 Commits

Author SHA1 Message Date
Keith Whitwell
11c0215bf8 Switch between memcpy implementations according to src/dest alignment. 2006-02-01 18:42:16 +00:00
Keith Whitwell
6a13b6c346 Debug off 2006-02-01 18:30:16 +00:00
Keith Whitwell
a103097ee5 Quieten depend 2006-02-01 18:29:56 +00:00
Keith Whitwell
7efad0d84c Just build the i915 on this branch 2006-02-01 18:29:25 +00:00
Keith Whitwell
42c88cd072 subtexrate test on this branch too 2006-02-01 18:14:09 +00:00
Keith Whitwell
2541c54e79 gearbox demo on this branch too 2006-02-01 18:13:23 +00:00
Keith Whitwell
33529e3d8e Bump driver date 2006-02-01 18:01:04 +00:00
Keith Whitwell
84c1b82081 Disable check_copytex_fragment_ops - it doesn't really apply. 2006-02-01 16:40:23 +00:00
Keith Whitwell
a97a1439ae Get batchbuffers working natively again. This code still
relies over-heavily on the DRI lock to protect offsets in the
command stream from changing before being queued on the ring,
and should be viewed as being a pretty temporary mechanism
before a more robust alternative is implemented, most likely
based on a batchbuffer relocation list that will be used
to patch prebuilt batchbuffers after validation takes place.
2006-02-01 15:54:42 +00:00
Keith Whitwell
2fd2910010 Remove the last of the old AllocateAgp mechanism.
Move the batchbuffer code to being effectively a ring of
bufmgr buffers.
2006-02-01 15:51:31 +00:00
Keith Whitwell
fbbda155e0 Add code to map/unmap all texture images for the software rasterizer.
Add the color and depth buffers to the validation list to ensure they
are fenced correctly by hardware rasterization.
2006-02-01 15:50:14 +00:00
Keith Whitwell
a49c3c0fae Ensure that color buffers and textures are mapped (bmBufferMap) before
software rasterizer fallbacks.  This has two functions, firstly to
ensure that the Data pointers point to something and secondly to
ensure than any pending fences on those buffers are discharged before
allowing the software rasterizer to read/write the data.

This needs to be integrated with Brian's validate code.
2006-02-01 15:48:52 +00:00
Keith Whitwell
baf5998d59 file gearbox.c was added on branch texman_0_1_branch on 2006-02-01 18:13:23 +0000 2006-01-30 15:35:35 +00:00
Keith Whitwell
4c5acef241 Get hardware-accelerated CopyTexSubImage working well enough to run
Brian's gearbox demo.
2006-01-28 23:28:14 +00:00
Keith Whitwell
9839e272cf Allow ValidateBuffers to allocate memory for buffers which haven't yet
got it by other methods.  Typically this is buffers being written to by
hardware excluding the fixed front/back/depth buffers which are have
pre-allocated memory.

At some point will want to pass BM_READ/BM_WRITE flags to catch the
couple of cases where buffers are treated differently in each case.
2006-01-28 23:27:39 +00:00
Keith Whitwell
b57e79ff14 remove debug 2006-01-28 17:52:50 +00:00
Keith Whitwell
43824acb4e Build fixes 2006-01-28 17:52:05 +00:00
Keith Whitwell
d8f509e749 Use the x86 __memcpy to avoid performance clif for uploads where the
source data is worse than 64-byte aligned.
2006-01-28 17:50:59 +00:00
Keith Whitwell
eb91c93c2e file subtexrate.c was added on branch texman_0_1_branch on 2006-02-01 18:14:09 +0000 2006-01-27 15:44:40 +00:00
Keith Whitwell
79de983b6f initial copytexsubimage code, untested 2006-01-27 11:58:00 +00:00
Brian Paul
fdb3acf016 added _swrast_eject_texture_images() 2006-01-27 03:42:56 +00:00
Keith Whitwell
2807d1f58a Get readbuffer correctly. 2006-01-26 18:30:34 +00:00
Keith Whitwell
93f913926e - Remove (most of) old agp client memory hack.
- Implement an accelerated version of glCopyPixels using the blitter.
2006-01-26 17:21:38 +00:00
Keith Whitwell
33ca04f379 Expand the buffer manager to include a notion of multiple pools within
a memory space.  Allow some pools to be excluded from the upload/evict
processing, meaning that any buffers within those pools are effectively
fixed.  Add a mechanism to create buffers in those pools.

This allows the legacy fixed front/depth/back buffers to be represented
in this scheme and will allow other future pinned buffers to be allocated
from fixed pools in such a way that they cannot fragment the rest of
the texture memory.
2006-01-26 14:50:02 +00:00
Brian Paul
398cb30c72 Added _swrast_validate_texture_images() to make sure all textures have
data resident for software rasterization.
Relies on new swrast driver function: ValidateTextureImage()
2006-01-26 04:05:53 +00:00
Keith Whitwell
f67bb30314 Fix confusion over pitch. demos/texobj renders correctly. 2006-01-25 17:16:46 +00:00
Keith Whitwell
4578d7b9f0 Offset returns weren't being returned. 2006-01-25 16:57:36 +00:00
Keith Whitwell
dcdfc154c3 Remove silly debug. 2006-01-25 16:46:10 +00:00
Keith Whitwell
696ba32779 Another texture manager checkpoint:
- Add code to validate textures before use.
- Simplify vertex paths for now.
- Make vertex paths validate textures.  This is done pretty
  with some pretty heavy-handed use of the dri lock - fixing this is
  a priority.
- Add lots of debug statements

demos/texobj renders, but textures are incorrect.
2006-01-25 15:40:50 +00:00
Keith Whitwell
dcfe55539f Remove dead code. Gears runs. 2006-01-24 18:55:52 +00:00
Keith Whitwell
ff84b1f1b2 Checkpoint of texture manager rework for i915.
Compiles but won't do any more than that.
2006-01-24 18:35:53 +00:00
Keith Whitwell
3bca9c47f4 Add another layer on top of the simple 2d regions in intel_regions.[ch]
which keeps track of a whole, well-defined mipmap tree.  These are a
fixed layout on intel hardware and managing them is complicated in the
face of GL's TexImage function calls where data can arrive in any order,
making it difficult to guess a layout ahead of time.

Wrapping mipmap trees up in a struct and programming interface like this
reduces the burden elsewhere.
2006-01-24 16:38:43 +00:00
Keith Whitwell
d4d7fdb43b layer 2d region semantics and blits on top of bufmgr buffers 2006-01-23 12:53:11 +00:00
Keith Whitwell
d65dab5777 import via texture semantics 2006-01-23 12:52:28 +00:00
Keith Whitwell
638ca019ef Add a faked-out implementation of the buffer manager that uses the same
techniques as the old dri memory manager behind the new interface.  Will
use this to port the i915 driver to this interface to hopefully get
some easy insights from using the interface.
2006-01-16 15:30:45 +00:00
Michal Krol
b4f70646b4 remove some test code;
rewrite the intermediate code executor to address
64-bit platforms and global memory;
store built-in library code in a precompiled form only;
2006-01-16 12:34:16 +00:00
Michal Krol
8defce2cf1 remove slang_*_gc.h files;
rename slang_*_gc_bin.h files to slang_*_gc.h ones;
store built-in library code in a precompiled form only;
2006-01-16 12:27:22 +00:00
Aapo Tahkola
0f488bb16d Missing bits of code spotted by Tilman Sauerbeck 2006-01-15 13:53:54 +00:00
Aapo Tahkola
1bcc323857 Fix ARB_position_invariant handling 2006-01-15 00:07:11 +00:00
Adam Jackson
93d0935ef7 Fix the default target to remake readtex.o if needed 2006-01-13 16:34:00 +00:00
Aapo Tahkola
4078c647d5 namespace pollution fixes (Tilman Sauerbeck) 2006-01-13 15:11:57 +00:00
Aapo Tahkola
458479fedb Fix invalid tex coord routing and couple other small things. 2006-01-13 15:03:57 +00:00
Brian Paul
1814d6541b added a couple new assertions to help debug XGL problem 2006-01-10 15:48:56 +00:00
Aapo Tahkola
2d4ff6a8cf Missing patch from Ben Skeggs:
Lots of changes, and fixes for some badness on my behalf.

1. Disposable data used during fp compile is now per-context,
   rather than per-program to save memory.

2. Track usage of INPUT/TEMP registers from Mesa program, free
   them when no longer required so the hw temps can be re-used.

3. Changed LAST_NODE to OUTPUT_COLOR (see r300_reg.h)

4. Implemented remaining ARB_f_p instructions, with the exception
   of the trig/LIT opcodes.

5. Treat ZERO/ONE swizzles the same way as other native swizzles.

6. emit_arith changes, basically a complete re-write.  Should
   produce cleaner instructions, but no real functional changes.
   internal reg -> hw reg routines shared with emit_tex.  A bit
   messy still.
2006-01-09 22:53:38 +00:00
Aapo Tahkola
c217d5a3a8 Fix pow <small> and a very stypid bug with dummy srcs(0 equals to tmp0.x)</small>. demos/cubemap looks perfect now. 2006-01-09 20:00:03 +00:00
Aapo Tahkola
0946e0f418 Fix cube maps. 2006-01-09 19:20:46 +00:00
Aapo Tahkola
7a028bd1ca Fix node setup(from Ben Skeggs) 2006-01-09 18:31:42 +00:00
Brian Paul
d469e5e5a0 s/GLuint/GLbitfield/ 2006-01-09 17:57:47 +00:00
Brian Paul
c2901e4f4c only call xmesa_set_renderbuffer_funcs() when really necessary 2006-01-09 17:56:55 +00:00
Brian Paul
41b9756e9a check XGetGeometry() return value 2006-01-09 16:59:30 +00:00
Roland Scheidegger
8bc4dae67e cube maps on r100 require newer drm than the same feature on r200 (regression from introducing unfied initialization). Fix wrong (so far unused) family assignment for r100 cards. 2006-01-07 20:42:16 +00:00
Keith Whitwell
eda59aa87e Oops - bad file-completion typo. 2006-01-05 11:01:18 +00:00
Keith Whitwell
ca188de098 add simple test for program local parameters 2006-01-05 10:57:57 +00:00
Brian Paul
30cc822163 install GLw headers (bug 5396) 2006-01-04 20:10:16 +00:00
Brian Paul
413a49ce59 special-case Darwin (bug 4509) 2006-01-04 20:06:13 +00:00
Jerome Glisse
31be39742b Use X11_INCLUDES config macro instead of
hardcoded path in makefile.
2006-01-02 18:47:00 +00:00
Brian Paul
3086efe357 remove bogus wings3d link 2005-12-30 19:15:40 +00:00
Keith Whitwell
cabecbd314 recalculate state on drawable changes 2005-12-30 13:03:08 +00:00
Keith Whitwell
1d43e729ec properly notify driver on scissor change in MakeCurrent 2005-12-30 13:02:27 +00:00
Dave Airlie
8c137e2f94 fill out framebuffer egl stuff enable egl on R300 2005-12-30 11:18:04 +00:00
Dave Airlie
fb83a42d31 fixup stamp so driver updates drawable info 2005-12-30 10:12:26 +00:00
Dave Airlie
456a513daa add support for PCIE card to EGL, doesn't fully work yet but these changes
need to get off my hard disk
2005-12-29 00:56:01 +00:00
Dave Airlie
577d23011b add EGL to r300 makefile 2005-12-29 00:42:25 +00:00
Dave Airlie
369ae3e2c4 rv370 not rv350 2005-12-29 00:38:12 +00:00
Dave Airlie
77a7c2ad92 typo 2005-12-29 00:37:24 +00:00
Dave Airlie
4dac78463e add some card type ioctl support 2005-12-29 00:36:07 +00:00
Dave Airlie
edf570da67 use card_type not isPCI 2005-12-29 00:30:53 +00:00
Dave Airlie
49b9355020 add some r300 information 2005-12-28 23:42:41 +00:00
Dave Airlie
1b6a081885 update to new API 2005-12-23 08:42:29 +00:00
Dave Airlie
bc8390fa6c this needs to be calloced 2005-12-23 08:17:44 +00:00
Dave Airlie
ad960612ce fixup driver for some api changes 2005-12-23 07:58:24 +00:00
Aapo Tahkola
11decab34a Handle fatal case. 2005-12-18 21:40:13 +00:00
Aapo Tahkola
3ad366dff2 Drop output checking. 2005-12-17 18:59:18 +00:00
Aapo Tahkola
d57ce4a2c1 No you arent. 2005-12-17 12:28:58 +00:00
Aapo Tahkola
707343dcf5 Warn only when being enabled. 2005-12-17 12:20:51 +00:00
Aapo Tahkola
feb7221ecb I think this has been tested well enough already. 2005-12-17 12:08:41 +00:00
Aapo Tahkola
1d32fc7332 Enable CB_DPATH by default. 2005-12-17 11:59:13 +00:00
Aapo Tahkola
fd1627312d Fix (likely) typo. 2005-12-17 11:43:59 +00:00
Aapo Tahkola
e34700af7a Add some missing hooks. This should fix various little problems with window movement and 2d windows flashing on top of 3d windows. This problem was previously shadowed by r300ResetHwState as it gets called frequently. 2005-12-17 11:39:40 +00:00
Brian Paul
c9b4acfeb8 minor code movement 2005-12-17 05:37:15 +00:00
Karl Schultz
782291ab91 fix thinko in last revision. 2005-12-16 16:38:44 +00:00
Brian Paul
924fb5e916 move va_end() call (Evgeny Kotsuba) 2005-12-15 15:23:54 +00:00
Karl Schultz
841c9018b1 Work In Progress. Move some of the frame buffer, render buffer, etc init code from the create context path to the make current path, where it is lazily initialized. This didn't buy me very much except to make it look closer to the X11 driver. Fix up some of this same code to correct some errors.
The next step is to reorganize the wmesa context data structure to inherit the gl_context by containment so I can have access to the wmesa context in the update state path.  The driver is still currently not responding to changes in the Draw and Read Buffer state.
2005-12-15 01:02:37 +00:00
Brian Paul
b6d7a0c5a5 regenerate to pick up glGetQueryObject[u]i64vEXT funcs 2005-12-14 14:23:37 +00:00
Keith Whitwell
0970787228 Fix typo. 2005-12-14 09:31:25 +00:00
Brian Paul
c8d1741b78 use GLbitfield instead of GLuint 2005-12-14 03:06:16 +00:00
Brian Paul
1add059bd1 Removed the GL_SGIX/SGIS_pixel_texture extensions. Same thing can be
done with fragment programs nowadays.
2005-12-14 03:04:58 +00:00
Dave Airlie
c9797f6b76 fix from Roland for mipmapped compressed textures
remove some debug
2005-12-13 19:53:28 +00:00
Brian Paul
0063084804 silence warning, bug 5318 2005-12-12 15:27:55 +00:00
Keith Whitwell
40332059e4 Split _MaintainTexEnvProgram into two flags _Maintain and _Use. This
restores the ability to run the software driver with program TNL but
tradtional swrast.
2005-12-12 12:57:08 +00:00
Eric Anholt
3e1a5a38ae Regenerate for recent glapi changes (GetQueryObjecti64vEXT). 2005-12-11 07:42:37 +00:00
Brian Paul
790ab0a0b6 s/eglShowSurfaceMESA/eglShowScreenSurfaceMESA/ 2005-12-10 17:59:36 +00:00
Brian Paul
f06ce1ba71 Rename eglDRIShowSurfaceMESA.
s/_eglAddMode/_eglAddNewMode/
2005-12-10 17:56:00 +00:00
Brian Paul
98d9bb66a4 updates to match other changes elsewhere 2005-12-10 17:55:15 +00:00
Brian Paul
215aa20f5c rename eglShowSurfaceMESA, add EGL_SCREEN_POSITION_GRANULARITY_MESA 2005-12-10 17:54:36 +00:00
Brian Paul
4882279633 Some initial per-thread support.
Rename eglShowSurfaceMESA to eglShowScreenSurfaceMESA.
2005-12-10 17:54:00 +00:00
Brian Paul
b04dd5c587 Added EGL_SCREEN_POSITION_GRANULARITY_MESA query.
Rename eglShowSurfaceMESA to eglShowScreenSurfaceMESA.
2005-12-10 17:53:07 +00:00
Brian Paul
ad6f8eba00 lots of updates, mode sorting, etc 2005-12-10 17:52:11 +00:00
Brian Paul
6002d2ff4e implement config sorting for eglChooseConfig() 2005-12-10 17:51:13 +00:00
Brian Paul
21b2784ff5 'a' key to toggle animation 2005-12-08 17:49:50 +00:00
Brian Paul
5abc246f8d bump version number 2005-12-08 14:51:36 +00:00
Brian Paul
72d1bb5756 don't need LONGLONG typedefs 2005-12-08 14:50:28 +00:00
Brian Paul
91ed68b2b9 do away with 'long long' usage 2005-12-08 14:50:03 +00:00
Brian Paul
5262c225ba remove stray _ from GL[u]int64_EXT 2005-12-08 14:10:59 +00:00
Karl Schultz
1acea5f289 update for symbol export changes 2005-12-08 04:36:42 +00:00
Karl Schultz
5bdec89da5 add {} to RENDER_SPAN macro to fix compilation problem 2005-12-08 04:35:07 +00:00
Karl Schultz
59af97420e use 64-bit typedefs for portability 2005-12-08 04:34:17 +00:00
Karl Schultz
0694adaf71 add 64-bit typedefs for portability 2005-12-08 04:33:17 +00:00
Karl Schultz
4c3443b460 handle 64-bit types for Windows. 2005-12-08 04:32:02 +00:00
Karl Schultz
f2b9fa03da reapply recent changes with Visual Studio instead of direct text editing. 2005-12-08 04:30:44 +00:00
Brian Paul
0fa8c59e64 Updates for GL_EXT_timer_query:
New GLint64EXT and GLuint64EXT types (use C99's long long types).
New glGetQueryObject[u]i64vEXT() functions.
2005-12-07 14:48:19 +00:00
Karl Schultz
98bebc7212 Fix bugzilla 5253. Add {} around code in RENDER_SPAN macros when code includes a variable declaration. 2005-12-07 05:09:14 +00:00
Aapo Tahkola
abccd5b729 Make missing interpolator inputs fatal 2005-12-06 22:26:21 +00:00
Aapo Tahkola
9309ba78d1 Fix secondary color for VP's 2005-12-06 19:49:18 +00:00
Brian Paul
9580179dfb C++ fixes, mostly casts (Stephane Conversy) 2005-12-06 15:41:43 +00:00
Eric Anholt
d5179613d5 Add support for GL_EXT_secondary_color. It looks like using
NEED_SECONDARY_COLOR to turn it off/on was what we wanted -- now results look
correct using seccolor on Savage IX and Savage4.
2005-12-06 10:38:37 +00:00
Keith Whitwell
b4ebb68202 Add guard before calling ctx->Driver.BindProgram 2005-12-05 11:44:09 +00:00
Aapo Tahkola
f27c07c99e Fix AL8 2005-12-05 09:30:58 +00:00
Dave Airlie
923257fe07 update r300 drm minimum to 20 2005-12-05 01:14:13 +00:00
Dave Airlie
f93feb7aed Fix r300 rectangular texture upload and swtcl coordinate fixing same as radeon
sw tcl
2005-12-04 00:37:35 +00:00
Brian Paul
eb06704a7c Added PCI_CHIP_RV410_5E4B (Adam Kirchhoff) 2005-12-02 23:57:37 +00:00
Brian Paul
99f13343cf Fix two failures encountered when running out of memory during XImage
allocation.
Append \n to _mesa_warning() strings.
2005-12-02 19:41:43 +00:00
Brian Paul
1b3128cc9a Test sizeof(drm_handle_t) instead of LONG64 when returning handles 2005-12-02 18:17:11 +00:00
Brian Paul
8716e7570d fix _mesa_ffs() return, test for more platforms (Evgeny Kotsuba) 2005-12-02 18:06:01 +00:00
Ian Romanick
5abff7bc4d Fix build issues on x86-64 due to missing include path in
glapi_x86-64.S.

Bug: #5602
2005-12-02 00:25:06 +00:00
Keith Whitwell
c9515bf1ae Call ProgramStringNotify after creating tnl programs. 2005-12-01 14:24:37 +00:00
Keith Whitwell
bfba2705b6 Remove VB->LastClipped 2005-12-01 12:54:21 +00:00
Keith Whitwell
dd4f0d1a93 Clean up clipping somewhat
- no need to update ClipMask on generated vertices
	- remove the VB->LastClipped value

Line clipping algorithm changed and simplified somewhat.  The old one
was based on the triangle routine and probably wouldn't have recognized
lines that were clipped down to nothing (ie culled, but not by a single
plane).
2005-12-01 12:53:15 +00:00
Brian Paul
f285f0d8f6 remove uintptr_t cast 2005-12-01 01:00:13 +00:00
Brian Paul
6b25193b92 try removing need for the uintptr_t casts 2005-12-01 00:59:51 +00:00
Brian Paul
0e31e02aef Added FinishRenderTexture() device driver function to indicate when
rendering to a texture has likely completed.
Fixed refcount issue in texture renderbuffer wrapper.
2005-12-01 00:25:00 +00:00
Brian Paul
cf2702e3db added comment about glTexImage and renderbuffers 2005-12-01 00:18:49 +00:00
Brian Paul
31e739a189 get depthBits from the current drawbuffer 2005-12-01 00:15:41 +00:00
Brian Paul
94ae2b4f25 fxt1_decode_1() should not be static 2005-11-30 14:47:34 +00:00
Ian Romanick
5910dfacf1 This is a major re-work of the __indirect_glInterleavedArrays routine. The
big, ugly, error prone switch-statement is replaced with a compact table.
I also added numerous comments, including a comment explaining how the
format parameter is validated.

Explicitly pass GL_FLOAT as the type in the cases where that is the only
possible value (e.g., everywhere except the call to glColorPointer).

Validate that stride is >= 0.

Tested with all modes (including the two error modes) of
progs/tests/interleave.c.

Bug: #5001, #5058
Reviewed by: Brian Paul
2005-11-30 00:06:48 +00:00
Brian Paul
96f216565e assorted fixes for server-side direct rendering (bug 5199) 2005-11-29 23:01:43 +00:00
Brian Paul
2d8eb9eaf3 remove dri_client/ dir from tarball 2005-11-29 22:41:23 +00:00
Brian Paul
126482a12f use the files from the drm tree/package 2005-11-29 22:37:19 +00:00
Michel Dänzer
9790e641ef If the DDX driver didn't reserve any video RAM for textures, fall back to
using only GART memory for textures instead of segfaulting in the texture
management code. (Bug 5115)
2005-11-29 13:13:34 +00:00
Brian Paul
58f45fa44d added _EGLExtensions typedef 2005-11-29 04:44:33 +00:00
Brian Paul
5285c32a17 Put extension flags, string into separate struct. 2005-11-29 04:43:37 +00:00
Brian Paul
f576450cae clean up the drmGetMap/drmMap code 2005-11-29 04:18:38 +00:00
Brian Paul
4683e8e954 apparently need to load colormap after setting the mode to make it work reliably 2005-11-29 03:00:02 +00:00
Keith Whitwell
2b8e66d210 Remove the many aliases for 'struct mem_block' in mm.h 2005-11-28 13:17:15 +00:00
Keith Whitwell
aae2b8b8eb Correct author attribution of mm.h 2005-11-28 12:05:29 +00:00
Brian Paul
4f12aa5a6a check for driver_modes == NULL. Don't need driver_modes for EGL driver 2005-11-28 00:04:35 +00:00
Brian Paul
a913d9f2f7 rearrange some code to put in more logical order, misc clean-ups 2005-11-28 00:02:06 +00:00
Brian Paul
3070a581fc Lots of fixes, clean-ups, new comments, etc.
To set the FBdev video mode, need to add a \n char to the string.
2005-11-28 00:00:08 +00:00
Brian Paul
d548bf41d3 Redo _eglInitSurface() so it can be used with all surface types.
Redo _eglInitContext() to do error checking, attribute list parsing, etc.
2005-11-27 23:57:19 +00:00
Brian Paul
49b2d2e90f include stdint.h for BSD 2005-11-27 23:46:55 +00:00
Brian Paul
024b5896f0 use ADD_POINTERS macro instead of (uintptr_t) cast 2005-11-25 17:07:10 +00:00
Keith Whitwell
96bf6abb66 Use _mesa_exec_free for fp->func. 2005-11-24 10:59:10 +00:00
Brian Paul
2a76d952b8 use new _egl_api struct 2005-11-24 04:06:51 +00:00
Brian Paul
1ac1c1c423 use _egl_api struct, make some functions static 2005-11-24 04:05:27 +00:00
Brian Paul
daf585d0f0 Move all the EGL API function pointers into a new _egl_api struct. 2005-11-24 04:02:16 +00:00
Brian Paul
d2c64e0b83 report error token in message printed in _eglError() 2005-11-24 03:53:46 +00:00
Brian Paul
b1abf1ea8e change error test in _eglParseConfigAttribs() 2005-11-24 03:48:19 +00:00
Brian Paul
ff707ead2b init attribs to EGL_DONT_CARE in _eglParseConfigAttribs() 2005-11-24 03:41:56 +00:00
Aapo Tahkola
181f2b92cb Couple changes that were missed. 2005-11-23 13:02:25 +00:00
Brian Paul
023c95481b check/print EGL_SCREEN_BIT_MESA, fix eglGetDisplay() call 2005-11-23 01:45:25 +00:00
Brian Paul
957b517c4f Choose the display mode / surface size in an intelligent way.
Fix // comments.
More error checking, etc.
2005-11-23 01:44:38 +00:00
Brian Paul
39591da355 update some comments 2005-11-23 01:42:40 +00:00
Brian Paul
a3d2c69e61 fixed wrong return value in radeonShowSurfaceMESA() 2005-11-23 01:39:56 +00:00
Brian Paul
b8829facc7 change error message 2005-11-23 01:38:30 +00:00
Brian Paul
b711eb793b use _eglLog() 2005-11-23 01:38:12 +00:00
Brian Paul
f049ca4e33 New _eglLog() function to replace fprintf/printf calls for debug/info. 2005-11-23 01:37:30 +00:00
Brian Paul
9bcc9e9174 reference bug 5131 in comment in _tnl_free_vertices() 2005-11-22 23:29:27 +00:00
Brian Paul
286f3fbb3a disable freeing of fp->func, see comment (bug 5131) 2005-11-22 23:27:27 +00:00
Keith Whitwell
e6e1c3fc11 Use correct enums for program output variables. Fixes
fp/tri-depthwrite.
2005-11-22 12:20:03 +00:00
Keith Whitwell
ec1ffd9f25 track state flags which might invalidate parameter lists 2005-11-22 12:12:17 +00:00
Keith Whitwell
5a771857d9 Make sure tnl->_DoVertexFog is kept uptodate. Fixes fog in i915
driver.
2005-11-22 10:58:05 +00:00
Dave Airlie
bf44f6cfac bit 31 of this inserts a nop after the current instruction 2005-11-21 11:39:49 +00:00
Dave Airlie
1ea61b5cad get rid of some of those unknowns figured out from reg dumper 2005-11-21 11:35:36 +00:00
Brian Paul
ec770b8c60 move _mesa_init_instruction() to program.c 2005-11-20 17:57:22 +00:00
Brian Paul
1a61462318 s/Saturate/SaturateMode/ 2005-11-20 17:54:29 +00:00
Brian Paul
e31ac05223 Make Saturate a 2-bit field again, renamed to SaturateMode with three
possible values: SATURATE_OFF, SATURATE_ZERO_ONE and SATURATE_PLUS_MINUS_ONE.
2005-11-20 17:52:40 +00:00
Brian Paul
22db535776 additional clean-ups and improvements 2005-11-19 23:45:10 +00:00
Brian Paul
55194df035 remove incorrect cast 2005-11-19 23:29:18 +00:00
Brian Paul
1353ebed81 Saturate is a 1-bit boolean field 2005-11-19 23:28:55 +00:00
Brian Paul
5d7b49f7e7 Bunch of little fixes:
Fix mem leaks in _mesa_TexEnvProgramCacheDestroy().
Check if ctx->Driver.BindProgram is non-null before calling.
s/unsigned/GLuint/
Use MAX_INSTRUCTIONS instead of magic 100, check program length after it's made.
Use _mesa_init_instruction() instead of _mesa_memset().
2005-11-19 23:12:20 +00:00
Brian Paul
1ad3b7e28b call gluDeleteQuadric() to fix mem leak 2005-11-19 23:09:14 +00:00
Brian Paul
6f445a1061 in run_texnorm_stage() check if the texture unit is really enabled before trying to normalize the texcoords 2005-11-19 17:08:15 +00:00
Brian Paul
41c8eabe0f update some vars 2005-11-19 16:50:36 +00:00
Brian Paul
63d683091f No longer derive 'ati_fragment_shader' from 'program' class. Only the
program->Id and program->RefCount fields were used and ATI fragment shaders
didn't have too much in common with ARB/NV vertex/fragment programs anyway.
2005-11-19 16:43:04 +00:00
Brian Paul
430c469c5b remove #include arbfragparse.h 2005-11-19 15:44:53 +00:00
Brian Paul
47e511c36d remove #include arbfragparse.h, s/PI/M_PI/ 2005-11-19 15:42:39 +00:00
Brian Paul
9fd133511c removed arbfragparse.[ch] arbvertparse.[ch] 2005-11-19 15:37:00 +00:00
Brian Paul
8c41a14c5e Remove the _mesa_parse_arb_vertex/fragment_program() functions into
arbprogparse.c and remove arbvertparse.[ch] and arbfragparse.[ch].
Clean up quite a bit of the arb parsing code.
Rewrite parser extension code to avoid a mess of string operations every
time the parser was used.
2005-11-19 15:36:28 +00:00
Brian Paul
5754809421 update comments, remove ^M chars 2005-11-19 14:57:47 +00:00
Brian Paul
8c765ad312 move a bunch of gl2/shading language structs from mtypes.h to shaderobjects.h 2005-11-19 14:49:25 +00:00
Aapo Tahkola
ddf61bfec9 Try to detect when native support to given texture width is not available. 2005-11-18 20:53:50 +00:00
Aapo Tahkola
f31448f3c8 Fix typo causing secondary color not to work properly. 2005-11-18 18:05:19 +00:00
Aapo Tahkola
40ca5b455f Reduce stderr noise. 2005-11-18 17:57:27 +00:00
Brian Paul
311bcf5090 In _mesa_RenderbufferStorageEXT(), try to avoid needless reallocation.
Simplify _mesa_GetRenderbufferParameterivEXT() queries.
2005-11-18 02:24:14 +00:00
Brian Paul
948ab5d8a9 move _mesa_update_state() calls before error tests that depend on framebuffer completeness 2005-11-17 05:01:26 +00:00
Brian Paul
74e9a43a2a optimize drawing GL_DEPTH_STENCIL pixels into a GL_DEPTH_STENCIL renderbuffer 2005-11-17 05:00:17 +00:00
Brian Paul
5ba41dfa81 s/MEMCPY/_mesa_memcpy/ and fix typo 2005-11-17 04:51:56 +00:00
Brian Paul
11f179e01b optimize case of reading GL_DEPTH_STENCIL pixels from GL_DEPTH_STENCIL renderbuffer 2005-11-17 04:51:08 +00:00
Brian Paul
f81c78f87d delete frame/renderbuffers upon exit, more error checking 2005-11-17 02:08:10 +00:00
Brian Paul
547113c16c improved error checking in error_check_format_type() 2005-11-17 02:05:42 +00:00
Thomas Hellström
154cc16d08 Fixes for x86_64 Unichrome. 2005-11-16 19:24:00 +00:00
Thomas Hellström
0ba7be0a50 Bring in last minute 6_4 branch changes to the unichrome driver
to the trunk.
2005-11-16 17:24:26 +00:00
Brian Paul
32fe233d54 added -ds option to test GL_EXT_packed_depth_stencil with framebuffer objects 2005-11-16 14:48:11 +00:00
Brian Paul
0f29ef6092 additional comments about GL_DEPTH_STENCIL buffers 2005-11-16 04:17:20 +00:00
Brian Paul
94f70fab64 added depthstencil.[ch] 2005-11-16 04:12:08 +00:00
Brian Paul
1a5f1bdb42 Use new gl_framebuffer _Depth/_StencilBuffer fields instead of
Attachment[BUFFER_DEPTH/STENCIL].Renderbuffer.  The former may be wrappers
around combined depth/stencil renderbuffers attached at the later points.
2005-11-16 04:09:26 +00:00
Brian Paul
909e8a7abb added depthstencil.c 2005-11-16 04:06:32 +00:00
Brian Paul
847160466c Support for combined depth/stencil renderbuffers (GL_EXT_packed_depth_stencil).
depthstencil.c provides wrappers for treating depth/stencil buffers either
as regular depth or stencil renderbuffers.
2005-11-16 04:05:54 +00:00
Brian Paul
06185363dd added _mesa_new_depthstencil_renderbuffer() for combined depth/stencil buffers 2005-11-16 04:00:31 +00:00
Brian Paul
c731d6223c Added error checking in _tnl_Begin to detect incomplete framebuffer.
Set new tnl->DiscardPrimitive field to true when such error is
detected to discard the glBegin/End primitive when flushing.
Added some new comments.
2005-11-16 02:47:16 +00:00
Brian Paul
0ad64faec7 change an assertion 2005-11-16 02:00:34 +00:00
Brian Paul
738f501f73 Replace GL_POLYGON+1 with PRIM_OUTSIDE_BEGIN_END 2005-11-16 01:58:19 +00:00
Brian Paul
62620d349b add GL_INVALID_FRAMEBUFFER_OPERATION_EXT in _mesa_error() 2005-11-16 01:11:06 +00:00
Brian Paul
daeb0056df fix color interpolation problem reported on VMS 2005-11-15 15:08:03 +00:00
Brian Paul
7edf68e081 check for ctx==NULL, bug 4087 2005-11-15 14:50:55 +00:00
Brian Paul
1e134cf7e4 Fix problem in stencil_and_ztest_span() when using h/w stencil buffer.
Fix a comment typo.
Remove some unneeded #includes.
2005-11-15 04:01:29 +00:00
Ian Romanick
5ef524cd01 Two subtle things missed on the previous commit. 2005-11-15 01:55:46 +00:00
Ian Romanick
a163256cc2 Add the ability for interleave to test passing invalid format enums
and invalid stride values (see bugzilla #5058).
2005-11-15 01:46:49 +00:00
Ian Romanick
e5700a1ba3 Simple test of glInterleavedArrays functionality. 2005-11-14 23:31:05 +00:00
Brian Paul
cb6b47b795 remove unneeded RasterPosValid check 2005-11-14 18:23:56 +00:00
Brian Paul
7b98b40e47 Improve _mesa_print_program().
Added make_state_string() to produce a string from a GL state vector.
2005-11-12 23:25:49 +00:00
Brian Paul
b3c095f074 fix comment for TexSrcTarget 2005-11-12 23:24:32 +00:00
Brian Paul
662fbf8a62 Added _mesa_light() helper function so we can avoid transforming then
un-transforming light positions and spot directions when popping light
state off the attribute stack.
2005-11-12 18:58:12 +00:00
Brian Paul
ba3da6154c Added OSMesaColorClamp(), bug 4917 2005-11-12 18:44:29 +00:00
Brian Paul
e3636b4114 update an assertion 2005-11-12 17:59:05 +00:00
Brian Paul
bed8363aa6 update some assertions 2005-11-12 17:56:18 +00:00
Brian Paul
de99760bf3 Move stuff common to vertex/fragment_program into the base class, including:
Instructions, InputsRead, OutputsWritten, and Parameters.
Also, added debug functions: _mesa_print_instruction(),
_mesa_print_program_parameters() and revamp _mesa_print_program().
2005-11-12 17:53:14 +00:00
Brian Paul
77ee31930a Make _mesa_is_proxy_texture() non-static and use in a few more places.
Use COPY_4FV() where possible.
Added some comments, clean-ups.
2005-11-11 15:33:36 +00:00
Ian Romanick
0325bc6359 Support for "fragment program to C" and TCC has been removed from the
source code, so there is no reason for this config to exist.  This
fixes fdo bugzilla #5004.
2005-11-10 16:25:37 +00:00
Brian Paul
418a7dbd75 s/MAX_LIGHTS/ctx->Const.MaxLights/ and spruce up some comments 2005-11-10 16:22:56 +00:00
Brian Paul
6297799fee fix popping of GL_SPOT_DIRECTION (bug 5005) 2005-11-10 16:19:44 +00:00
Brian Paul
db40ebfbb7 remove -DMESA_DEBUG 2005-11-10 05:10:49 +00:00
Brian Paul
1984aabe83 Move code to enable FP exceptions into debug.c (set MESA_DEBUG=fpexceptions).
Get rid of MESA_DEBUG preprocessor symbol, just use DEBUG instead.
2005-11-10 05:10:25 +00:00
Brian Paul
a8446f72f4 fix popping of GL_EYE_PLANE state (bug 4996) 2005-11-09 16:52:21 +00:00
Brian Paul
a8717180d9 Bug 4996.
Replace use of FLOAT_TO_USHORT with either CLAMPED_FLOAT_TO_USHORT or
UNCLAMPED_FLOAT_TO_USHORT.  Same should be done for UBYTE, UINT, etc.
2005-11-09 16:30:50 +00:00
Brian Paul
cfca72cfb1 use UNCLAMPED_FLOAT_TO_USHORT/UBYTE in clear_rgba_buffer() (bug #4992) 2005-11-09 01:17:33 +00:00
Brian Paul
8850a7e20f Move COPY_FLOAT() macro down into glide driver.
Rewrite COPY_4FV() macro to not use COPY_FLOAT(), and use integer moves as
originally intended.
2005-11-09 00:56:51 +00:00
Ian Romanick
5374e4ba7e At keithw's request, remove all traces of the "fragment program to C" and
TCC experiment.
2005-11-08 22:54:22 +00:00
Ian Romanick
4884db6eb2 This patch adds the missing NV_vertex_program2 and NV_vertex_program3
instructions to the various internal tables.  It does not add support for
them to the parser nor does it add support for them to the program
interpreter.

It also corrects some errors in the comments in program_instruction.h.

This patch breaks the instruction union in t_vb_arbprogram.h.  The opcode
field in that union was only 6 bits.  When there were only 59+3 instructions
that worked fine. However, this patch increases the base instruction count
to 69.  This requires 7 bits.  The problem is that increasing the opcode
width to 7 bits increases the size of instruction::rsw to 33 bits.  I've
increased the size of the union to 64-bit, but this is just a temporary hack
(and probably breaks the build on some systems).
2005-11-08 22:40:26 +00:00
Brian Paul
e1a5edf083 s/_mesa_debug_fp_inst/_mesa_print_program/ 2005-11-08 14:53:24 +00:00
Brian Paul
bdd80bf819 remove _mesa_debug_fp_inst() 2005-11-08 14:52:51 +00:00
Brian Paul
0bffb1192a some initial work on upcoming GL_EXT_framebuffer_blit extension 2005-11-08 14:45:48 +00:00
Brian Paul
3e9c099088 remove a bunch of extension stuff that's in glxext.h 2005-11-08 14:44:07 +00:00
Brian Paul
02df9e1ed4 minor work in _mesa_print_program() 2005-11-08 14:42:52 +00:00
Brian Paul
832026f906 remove unneeded #includes 2005-11-08 14:41:41 +00:00
Brian Paul
beff21e7bf remove unneeded #includes 2005-11-07 17:36:34 +00:00
Brian Paul
189bbe0b8c s/_mesa_debug_fp_inst/_mesa_print_program/ 2005-11-07 16:03:46 +00:00
Brian Paul
c657d8e3e4 s/_mesa_debug_vp_inst/_mesa_print_program/ 2005-11-05 20:18:51 +00:00
Brian Paul
30d6a4bffa consolidate vertex/fragment program printing into _mesa_print_program() 2005-11-05 20:18:18 +00:00
Brian Paul
237dae74f7 use _mesa_program_file_string() and _mesa_opcode_string() 2005-11-05 19:33:13 +00:00
Brian Paul
bf41bc03c2 added _mesa_program_file_string() 2005-11-05 19:32:36 +00:00
Brian Paul
b7c87974b3 Use _mesa_opcode_string() 2005-11-05 19:24:08 +00:00
Brian Paul
c289f48342 use _mesa_num_inst_src_regs() and _mesa_opcode_string() 2005-11-05 19:16:19 +00:00
Brian Paul
b88fb724e6 use _mesa_num_inst_src_regs() instead of nr_args() 2005-11-05 19:15:27 +00:00
Brian Paul
1fcdaf1c3b added _mesa_num_inst_src_regs() and _mesa_opcode_string() 2005-11-05 19:12:36 +00:00
Brian Paul
637c375ee2 s/Negate/NegateBase/ 2005-11-05 17:23:45 +00:00
Brian Paul
9ba4ef3102 s/TexSrcIdx/TexSrcTarget/ 2005-11-05 17:18:09 +00:00
Brian Paul
7e807510d8 Unify vertex/fragment program instuctions.
Based on patch by Ian (#4967) but also unify instruction opcodes.
2005-11-05 17:10:45 +00:00
Brian Paul
73347516be remove unneeded #includes 2005-11-05 17:08:50 +00:00
Brian Paul
41c8b71871 remove unneeded #include 2005-11-05 17:07:00 +00:00
Aapo Tahkola
47adbde5e5 Fix broken build. 2005-11-05 14:49:26 +00:00
Brian Paul
8894a55d5f added MESA_GLX_ALPHA_BITS env var 2005-11-05 03:12:06 +00:00
Brian Paul
fd4395b8d1 don't need MAKE_SWIZZLE() macro 2005-11-05 03:02:28 +00:00
Brian Paul
613e1ad5d5 Replace parameter_type enum in program.[ch], use register_file enums instead. 2005-11-05 02:15:21 +00:00
Brian Paul
4d0b7618cb minor improvements in _mesa_init_teximage_fields() 2005-11-05 02:12:44 +00:00
Brian Paul
95ebb5f485 use VERT_RESULT_HPOS, VERT_BIT_POS tokens 2005-11-04 16:52:41 +00:00
Brian Paul
2cb1cf484a better ffs() function (bug 4956) 2005-11-04 16:47:22 +00:00
Brian Paul
8ff68b2bf3 just pass ctx to do_ndc_cliptest() rather than stuffing it in the arb_vp_machine struct 2005-11-04 16:43:28 +00:00
Brian Paul
c12ee99d11 MESA_GLX_ALPHA_BITS env var to force visual with alpha channel 2005-11-04 16:41:06 +00:00
Brian Paul
f805cdfedf remove unneeded HIDDEN definition (bug 4956) 2005-11-04 00:58:17 +00:00
Brian Paul
84f3ff91d9 fix MinGW problems (bug 4956) 2005-11-04 00:52:08 +00:00
Adam Jackson
d78834b306 s/dri.sourceforge.net/dri.freedesktop.org/ 2005-11-03 20:49:07 +00:00
Brian Paul
72030e0d91 Streamline code generation by using a fixed size instruction buffer in
arb_program struct.
2005-11-03 03:30:34 +00:00
Brian Paul
ccfe3d4683 use WRITEMASK_* tokens 2005-11-03 02:35:15 +00:00
Brian Paul
7ae9713a60 s/15/VERT_RESULT_MAX/ 2005-11-03 02:28:47 +00:00
Brian Paul
1624162b0c added a const, clean-up 2005-11-03 02:26:47 +00:00
Brian Paul
45cd2f9305 fix typo, minor clean-ups 2005-11-03 02:25:10 +00:00
Brian Paul
bcf4ae7816 added osdemos/ dir to DEMO_FILES 2005-11-02 21:01:26 +00:00
Brian Paul
60031ace75 implement USE_MGL_NAMESPACE for x86-64 dispatch code (Mark Bolstad) 2005-11-02 20:59:37 +00:00
Brian Paul
90ebb581e6 Rename FRAG_OUTPUT_* tokens to FRAG_RESULT_* to match vertex program convention 2005-11-02 18:06:12 +00:00
Jouk Jansen
5a02209cd2 Committing in .
Updated OpenVMS compile support (define tnl for include files)
 Modified Files:
 	Mesa/src/mesa/drivers/common/descrip.mms
 ----------------------------------------------------------------------
2005-11-02 15:24:14 +00:00
Aapo Tahkola
eda460035e Use ctx->VertexProgram._Current . 2005-11-02 14:12:52 +00:00
Aapo Tahkola
26b1c97a9d Remove some ghost code and adjust things a bit. 2005-11-02 14:07:03 +00:00
Keith Whitwell
e4894177ba More useful ARL test 2005-11-02 12:58:38 +00:00
Eric Anholt
3a5626cb84 First step of Radeon DRI unification:
- Makes all three drivers use the same screen structure and setup code, with a
  few ifdefs for the separate compilation to deal with symbols not being
  available to all drivers and the fact that we have no mechanism for dealing
  with different config options for different chip families in the same driver.
  These issues should be dealt with later.
- Introduces IS_R[123]00_CLASS(radeonScreenPtr) macro for code for taking
  different paths depending on the general class of chipset.
- Adds many new R300-class PCI IDs, though not all those listed in
  radeon_driver.c.
2005-11-02 01:15:07 +00:00
Keith Whitwell
a9b927cb6e add an arl test 2005-11-01 20:29:59 +00:00
Aapo Tahkola
a546abc8da Fix broken tnl stage. 2005-11-01 18:12:58 +00:00
Keith Whitwell
f4fbda35b0 Add a NotifyInputChanges() callback so that drivers (particularly tnl
drivers) can track when the sizes or strides of incoming VB->AttribPtr
arrays have changed.
2005-11-01 17:29:46 +00:00
Keith Whitwell
c3626a91ce Several fp and vp tweaks:
- Renumber VERT_RESULT_* values so that they match the
	  numbers of the corresponding FRAG_ATTRIB_ values.

        - Add ctx->VertexProgram._Current and FragmentProgram._Current
	  values which point to either the current client-supplied
	  program if enabled, or otherwise to the current mesa-internal
	  program.  Thus this program is always the correct one for
	  the current state, providing that the mesa flags to turn on
	  automatic generation are enabled.

	- Add callbacks to ctx->Driver.BindProgram() in texenvprogram.c
	  and t_vp_build.c so that the driver knows when the generated
	  program changes.  This is cleaner than trying to code all the
	  possible _NEW_* flags into the driver, and more precise as well.

	- Add a UsesKill flag to identify fragment programs with that
	  instruction, as these can require special treatment.

	- Move the FRAG_OUTPUT values to mtypes.h, near to similar defn's.
2005-11-01 17:25:49 +00:00
Aapo Tahkola
6aa6d440d9 Re-enable fallbacks. 2005-11-01 16:59:13 +00:00
Aapo Tahkola
e7d6bb9dc4 -Fix first frame -bug
-Use 16-bit elts in vtxfmt_a path if possible
-Optimize VSF param uploading
-return in r300DepthMask looks suspicious, use r300Enable instead
-Dont use r300ResetHwState in invalidate state(disabled, missing hooks, possible instabilities)
2005-11-01 15:52:08 +00:00
Aapo Tahkola
3cf156df2b Fix segmentation fault in _tnl_ProgramCacheDestroy(). 2005-11-01 15:43:06 +00:00
Keith Whitwell
da70bc6baa Make colors match the fp tests (really) 2005-11-01 12:22:48 +00:00
Keith Whitwell
a605d9c3de Make colors match the fp tests 2005-11-01 12:20:13 +00:00
Keith Whitwell
d9f362a667 standalone tests for vp instructions 2005-11-01 06:28:39 +00:00
Brian Paul
0505103710 Re-org and clean-up of vertx/fragment program limits (instructions,
temporaries, parameters, etc).
glGetProgramivARB() now returns all the right things.
Updated i915 and r300 code to initialize program native limits and
current program's native instruction/temporary/etc counts.
2005-11-01 04:36:33 +00:00
Brian Paul
ffec105109 fix problems found with gcc 2.96 (bug 4934) 2005-10-31 21:52:56 +00:00
Brian Paul
dcf4c17fb1 check swrast->_FogEnabled instead of ctx->Fog.Enabled 2005-10-31 19:46:55 +00:00
Aapo Tahkola
821b3dd562 Need more than 200 instructions. 2005-10-31 14:37:33 +00:00
Aapo Tahkola
37f2eaa316 Improve tnl program searching performance. 2005-10-31 14:34:32 +00:00
Brian Paul
18e7c5c5fe Simplify parse_attrib_binding().
Now only use VERT_ATTRIB_* and FRAG_ATTRIB_* tokens instead of
hard-coded numbers.
Note: previous check-in did similarly for output register parsing.
2005-10-30 21:46:00 +00:00
Brian Paul
7aebaf3deb Lots of clean-up in arb program parser.
Use new _mesa_init_fp/vp_instruction() function to initialize instructions.
2005-10-30 21:23:23 +00:00
Brian Paul
094a1ddf24 need to use absolute value for RSQ 2005-10-30 16:52:02 +00:00
Brian Paul
5d04101d18 added some assertions to catch unexpected swizzle values in cvp_emit_arg(), currently fails sometimes 2005-10-29 18:29:54 +00:00
Brian Paul
32df89e12d Use MAKE_SWIZZLE4() macro in a few more places.
Clean up the parse_extended_swizzle_mask() and parse_swizzle_mask() functions.
2005-10-29 18:26:43 +00:00
Brian Paul
5b3cf5af74 reduced swizzle comment 2005-10-29 18:18:46 +00:00
Brian Paul
1a979736a6 Free old parameter list before assigning new one. FIxes memory leak. 2005-10-29 17:07:09 +00:00
Brian Paul
5244fc6d60 added warning about use of REG_SCRATCH 2005-10-29 16:51:34 +00:00
Brian Paul
3c2f8b22b9 clean-up comments 2005-10-29 16:17:01 +00:00
Brian Paul
a2e696e521 s/lenght/length/ 2005-10-29 16:15:47 +00:00
Brian Paul
af13891dbd fix LIT bug 2005-10-29 16:05:18 +00:00
Brian Paul
4174f79b19 fix a few bugs in SWZ execution 2005-10-29 16:03:19 +00:00
Brian Paul
db02ab767f fix errors in RoughApproxPower(), do_LIT(), _tnl_program_string() 2005-10-29 15:56:53 +00:00
Brian Paul
4570364097 If parsing a program fails, don't change the vertex/fragment program object.
Specifically, don't attach a dummy program.
This change also fixes an occasional segfault.
Some code clean-ups.  Use GLboolean instead of GLuint to return pass/fail.
2005-10-29 15:52:31 +00:00
Eric Anholt
aba878d8c2 Bug #4901: Correct secondary color emission when lighting is turned off, tested
with seccolor on rv200 and r200.

Submitted by:	sroland
2005-10-29 00:27:01 +00:00
Ian Romanick
d7d41ceeb0 Add new test "texfilt". This test is a cousin to texwrap. Instead of
testing various texture wrap modes, this test examines various texture
filter modes, including anisotropic.

Add CFLAGS to a couple places in Makefile so that 32-bit builds on
64-bit archs will work correctly.
2005-10-28 18:41:03 +00:00
Brian Paul
3eec2901db Keith's fixes for RSW and XPD (need temporaries) 2005-10-28 15:40:08 +00:00
Brian Paul
86734ddae4 include tnl.h to silence warning 2005-10-28 15:22:28 +00:00
Brian Paul
b3c98e6205 Added assert that result != arg0 in do_RSW. This currently fails and needs fixing. 2005-10-28 14:41:06 +00:00
Brian Paul
b5ee368baf TNL module needs to implement ctx->Driver.ProgramStringNotify() function
so that calls to glProgramStringARB() to specify a new program causes the
TNL-attached data to get recomputed.
2005-10-28 14:32:49 +00:00
Brian Paul
f51bf9e23c add newline at end of file 2005-10-28 13:12:28 +00:00
Brian Paul
8cb2923038 don't use -Wmissing-prototypes for C++ code 2005-10-28 13:11:00 +00:00
Brian Paul
ca33e21165 silence a bunch of compiler warnings 2005-10-28 13:09:23 +00:00
Aapo Tahkola
5222c58a68 Silence gcc-4 warnings. 2005-10-28 12:43:41 +00:00
Aapo Tahkola
dc44372ba7 Fix texture mixup when two or more contexts. 2005-10-28 12:14:58 +00:00
Dave Airlie
eb171b0c10 fix missing commit for span changes 2005-10-28 12:05:25 +00:00
Dave Airlie
3b3adf3daa fix up radeon span functions using latest r200 code from Brian,
tested with reflect on 32-bit.. not sure why depthHasSurface isn't needed
2005-10-28 12:00:09 +00:00
Aapo Tahkola
a4af1119f5 Compiled arrays for vtxfmt_a path. 2005-10-28 09:28:32 +00:00
Eric Anholt
9c8f649930 GC a bit of dead code I noticed while looking at texwrap. 2005-10-28 07:00:41 +00:00
Eric Anholt
c57be49099 Correct the ordering of the blend constant color. 2005-10-28 06:15:11 +00:00
Eric Anholt
4b9f1308e5 Add support for GL_EXT_stencil_wrap, from hearing that the windows drivers did
it, and guessing that the two remaining entries in the 3-bit values were the
new funcs.  Tested with modified stencilwrap test.  Also, remove the commented
fallback stuff -- more modification to stencilwrap suggests that those issues
were just from span readback, not stencil implementation.
2005-10-27 21:21:05 +00:00
Eric Anholt
215c4c3a9c Bug #1028: Add hardware-accelerated stencil support to r128. Testing with
stencilwrap reported many issues with various modes.  Some of these were
complicated by the fact that spans are broken (Bug #1615), but some appear to be
real bugs.  However, while spans remain broken, I found that visual results were
better by avoiding fallbacks rather than avoiding just a broken stencil
implementation.  Note that this required changing the depth spans at 24+8bpp
into read-modify-write cycles.  It would be nicer as a single write with
a mask, but the kernel span blits turn off masking.

Reviewed by:	ajax
2005-10-27 20:26:24 +00:00
Eric Anholt
512c994b92 Bug #4900: Fix the non-fogcoord fog test on r100 (and rv200) at tcl_mode=1 by
flipping the signs on two factors.  While this contradicts the DDK, it matches
what r200 does, and it fixes the test.
2005-10-27 19:59:41 +00:00
Eric Anholt
170a61ec00 Add support for HW stencil spans, mirroring the depth spans support. Used for
Rage 128 stencil support.
2005-10-27 06:01:50 +00:00
Eric Anholt
2d0c92d81b Bump driver date for recent extension adds. 2005-10-27 01:46:39 +00:00
Aapo Tahkola
03833ba2ca Cover my arse. 2005-10-26 18:02:37 +00:00
Aapo Tahkola
d240b29b95 Reduce stderr noise and fix some compiler warnings. 2005-10-26 17:55:28 +00:00
Aapo Tahkola
22605caea8 Remove few outdated r200 files. 2005-10-26 17:04:15 +00:00
Aapo Tahkola
4dc3249f0d Sync with my local tree.
Changes to current operation:
-Elts are no longer converted to 16-bit format
-Cube maps
2005-10-26 16:42:06 +00:00
Aapo Tahkola
23f076ca67 Fix invalid vsf temp count for rv350. 2005-10-26 13:35:41 +00:00
Eric Anholt
5f79025e0d Fix the RGB order of the specular color emit, and turn GL_EXT_secondary_color
back on.  Tested using seccolor modified to use the blue channel instead of
green, since green stays in the same place across RGB/BGR mistakes.  Also hook
in UpdateSpecular on COLOR_EXT change, which might have resulted in missing
statechanges before.
2005-10-26 10:46:49 +00:00
Eric Anholt
f8a5898ca0 Add support for GL_EXT_fog_coord, tested using tests/fog.c. (Also, matches the
output from indirect rendering).
2005-10-26 10:11:34 +00:00
Eric Anholt
9eaed1178d Add built programs to .cvsignore. 2005-10-26 09:53:38 +00:00
Eric Anholt
896735e412 Add a fog mode (normal and fog_coord, leaner/exp/exp2 mode) testing program I
wrote for sis, which has also exposed a few bugs elsewhere.
2005-10-26 09:48:03 +00:00
Eric Anholt
2330ed08c3 Add disabled support for GL_EXT_fog_coord. While it seems correct to me, it's
not respecting the coords (or perhaps interpreting them differently?) in my
testing.  However, in the process it led to a fix of a secondary color handling
issue where it would be taken from the wrong offset, I believe, based off of
reading the r200 driver.  Also add a minor tweak to save time in the
fog-but-not-specular case.
2005-10-26 09:37:53 +00:00
Eric Anholt
a09d002bb5 Move the front.offset setting above a check to shortcut reallocating buffers if
width and height stayed the same.  Rely on front.offset pointing at the origin
in the window (rather than the origin of the front buffer), and fix the coords
in swapbuffers, which were wrong.  This is different from other drivers because
we've got a back buffer with a 0,0 origin at the window's origin, which makes it
more convenient to have the front buffer match it.
2005-10-25 21:10:28 +00:00
Eric Anholt
f1113fa99d Initial add of some (disabled) SiS 6326 drawing code integrated from Alan Cox's
last drop I saw, which was in turn based on a code drop of mine.  Texturing,
culling, and several extensions are unimplemented, and some features could
probably be improved. It's untested, but there don't appear to be regressions on
the 300-series code, so I'd like to get these bits in now so that it can be
worked on as not a huge diff.
2005-10-25 20:37:01 +00:00
Brian Paul
7e4cc1c29f updates from 6.4 branch 2005-10-24 23:33:27 +00:00
Eric Anholt
005070a62a Cut a bunch of code by not trying to precompute the blit commands and instead
just do it per blit.  No noticable performance difference (or behavior
difference, in my tests), and a significant difference in sanity.
2005-10-24 22:38:11 +00:00
Eric Anholt
7040b7ad88 In the last commit I added in a fatal error on unknown base formats so I
wouldn't get confused when adding support for new formats.  However, it resulted
in dying in texenv instead of drawing something undefined for GL_DECAL.  Do what
GLcore apparently does and just pass the fragment through.
2005-10-24 22:23:52 +00:00
Eric Anholt
f33beed330 Fix and enable GL_MESA_ycbcr_texture. Looks fine with yuvrect. I'm slightly
concerned that TEXEL_YUV422 looks like TEXEL_YVU422 and TEXEL_VUY422 looks like
TEXEL_VYU422 in yuvrect, but I'm happy enough for now.
2005-10-24 22:01:40 +00:00
Eric Anholt
81d3bf58ff Add support for GL_EXT_secondary_color, tested with seccolor test. 2005-10-24 21:30:06 +00:00
Eric Anholt
310f1551b4 Turn off the AGP dispatch path yet again, as it seems to be broken (found with
tuxracer and the upcoming support for secondary color).
2005-10-24 21:19:06 +00:00
Brian Paul
32340aea13 fragment program writing to result.depth.z was broken 2005-10-24 19:28:36 +00:00
Adam Jackson
c92adf4682 Add RV350 AQ chip. (popolon at popolon dot org) 2005-10-24 17:42:55 +00:00
Eric Anholt
414b742c97 Since we memcpy texture data synchronously to the card, idle the engine before
we start copying.  I haven't seen it go wrong before, but I'm pretty sure this
fix is correct.
2005-10-24 10:24:23 +00:00
Eric Anholt
60b639b9a6 - Add a few more hardware internal formats that are supported. Some remaining
ones require custom texstore, so they aren't done yet.
- Add YCBCR support commented out, since the yuvsquare test didn't work with
  just the bits I've added.
- Add the no-compression GL_ARB_texture_compression support.
- Add the driconf texture depth option and try to respect it.
2005-10-24 09:59:43 +00:00
Eric Anholt
971bdc193c Fix the GL_BLEND case (and remove the fallback associated with it) by converting
the float values to bytes before packing them.  Tested with texenv.
2005-10-24 09:02:07 +00:00
Eric Anholt
9e87119d87 Fix texenv by moving a misplaced check for being in fallback (should cover only
render state, not texture state).  While here, move a SIS_FIREVERTICES to a more
appropriate location, though it was harmless.
2005-10-24 08:27:30 +00:00
Eric Anholt
9192ab3f5d Add support for GL_ARB_texture_border_clamp and GL_ARB_texture_mirrored_repeat,
tested using texwrap, fixing the sourcing of border constant values (use the
bytes, not the floats!).  Remove the fallback on GL_CLAMP_TO_EDGE, which acts
properly, and add a note to GL_CLAMP about nonconformance (whcih is what the
fallback for CLAMP_TO_EDGE was probably targeting).
2005-10-24 08:02:44 +00:00
Eric Anholt
6efd595bf5 Fix a typo in a fallback string. 2005-10-24 07:21:56 +00:00
Eric Anholt
dc793d4e9a Add support for GL_EXT_stencil_wrap by guessing that the skip of two values in
the register header was meaningful.  It turns out those were the proper values
for the plain INCR/DECR ops, while what we were using as INCR/DECR were the
_WRAP versions.  Tested with stencil_wrap (didn't expose normal/_WRAP swapping)
and stencilwrap (exposed it nicely) tests.  Props to idr for poking me about
adding this.
2005-10-24 06:40:56 +00:00
Roland Scheidegger
3265585b15 disable yuv textures (GL_MESA_ycbcr_texture) on rv250 (hw bug, #2078). Change the initialization to fail if an unknown pci id is detected, instead of accepting all values which are not r100-based radeons. 2005-10-22 02:03:13 +00:00
Eric Anholt
1c04be573e Fix FreeBSD build by building libGL in the order desired, and doing a fix to my
mklib changes.
2005-10-22 01:41:40 +00:00
Brian Paul
52f686c480 fix GLX server resize/crash when resizing windows 2005-10-21 21:39:10 +00:00
Brian Paul
7d3b26022b check span.y >=0 (bug 4842) 2005-10-21 18:35:35 +00:00
Keith Whitwell
e516654dec new depth tests 2005-10-21 18:34:22 +00:00
Keith Whitwell
f28cbb6a7f simplify, remove sgi messages 2005-10-21 18:33:53 +00:00
Brian Paul
32a7ab2197 Darwin version fix (SF bug 1334274) 2005-10-21 15:39:42 +00:00
Brian Paul
54cfe69436 fix broken SWZ instruction 2005-10-21 15:22:36 +00:00
Brian Paul
b3f2e15035 fix broken KIL 2005-10-21 14:22:38 +00:00
Keith Whitwell
3a09ea919c better looking tests 2005-10-21 10:27:37 +00:00
Keith Whitwell
2ea6b800c0 Make test visible 2005-10-21 10:07:52 +00:00
Keith Whitwell
8975cbb36b Better looking test. 2005-10-21 08:34:06 +00:00
Dave Airlie
eedc45709f add the tile bits for offset, and unk bit 31 of size 2005-10-21 06:20:27 +00:00
Brian Paul
f468dfde17 restore FASTCALL stuff 2005-10-20 22:51:50 +00:00
Brian Paul
adfd5510c0 fix bad loops in TransposeMatrix[fd]() 2005-10-20 22:04:01 +00:00
Keith Whitwell
a90909e892 A bunch of little tests which exercise each ARB_fp instruction plus
a couple of other interesting cases.
2005-10-20 21:40:23 +00:00
Brian Paul
f344be793c added mm.c mm.h execmem.c 2005-10-20 21:29:32 +00:00
Brian Paul
255afe4abd fix another renderbuffer wrapping bug 2005-10-20 21:25:41 +00:00
Brian Paul
c8f86105d0 Disable the FASTCALL optimization because it still breaks server-side GLX. 2005-10-20 21:12:35 +00:00
Eric Anholt
6f980dbf21 Bump driver dates for the crasher fixes yesterday. 2005-10-20 20:11:46 +00:00
Jouk Jansen
b50a51118c descrip.mms syntax correction 2005-10-20 13:06:03 +00:00
Dave Airlie
806e25a5d9 fixes for r300_tex.c from Aapo Tahkola 2005-10-20 06:06:18 +00:00
Brian Paul
301c3dcb6c s/glut_gz2/glut_bz2/ 2005-10-19 20:26:13 +00:00
Eric Anholt
2420318cd9 Make SiS a little more like other drivers: Add SIS_DEBUG (only option being
"fall" so far) and make the fallback_force option be no_rast like other drivers.
Incidentally, makes no_rast not crash (though it still fails to render).
2005-10-19 03:23:29 +00:00
Eric Anholt
e0cb784e03 Remove some long-dead code. 2005-10-19 03:07:05 +00:00
Eric Anholt
d76c7d7d3e Fix a missed merge for idr's dispatch changes: failure to do driInitExtensions
in __driCreateNewScreen_20050727 resulted in crashing in dispatch.
2005-10-19 02:46:42 +00:00
Brian Paul
dc4070c787 updated for new mm.c, execmem.c files 2005-10-19 01:28:14 +00:00
Brian Paul
ca2db58166 s/memcpy/_mesa_memcpy/, s/FREE/_mesa_free/ 2005-10-19 01:26:48 +00:00
Eric Anholt
deadd47aab Bug #4615: Fix the SiS driver for the renderbuffer changes. Previously, all
drirenderbuffers pointed at screen offset 0 and NULL.  Instead, set up the front
buffer at startup but leave the others for later, since sis allocates them on
demand rather than using the static method of the other non-sis-descendent
drivers.  Some basic apps work, but fallbacks may be broken still.
2005-10-19 00:53:05 +00:00
Eric Anholt
bf3f0bcf80 Fix a missed merge for idr's dispatch changes: failure to do driInitExtensions
in __driCreateNewScreen_20050727 resulted in crashing in dispatch.  Rendering
remains broken.
2005-10-18 23:48:59 +00:00
Eric Anholt
b83435f53b Attempt to fix libGL on FreeBSD, where the library was being built without any
dependencies, breaking builds of third-party software.
2005-10-18 23:36:40 +00:00
Brian Paul
d99c37bca6 move _mesa_exec_malloc/free() up near other malloc/free prototypes 2005-10-18 15:02:45 +00:00
Brian Paul
1c236fd5c7 Lots of clean-ups. Replace __inline__ with INLINE macro. Use the
_mesa_calloc(), _mesa_free() functions.  Clean-up formatting, doxygen-style
comments.
2005-10-18 15:01:19 +00:00
Keith Whitwell
005469005d Add _mesa_exec_malloc() and _mesa_exec_free() for allocating
executable memory.  Based on Thomas Hellstrom's patch.
TODO: glapi.c also needs this, but cannot access this code.
2005-10-18 13:29:59 +00:00
Roland Scheidegger
05e1a49ab4 on r200, don't emit fog coords when fog isn't actually enabled. Fix bug with vtxfmt not causing a fallback when fog coords are active. 2005-10-18 13:09:53 +00:00
Brian Paul
730200303d added some header files to DRI_FILES (Donnie Berkholz) 2005-10-17 22:38:44 +00:00
Roland Scheidegger
2d61d30117 add GL_EXT_fog_coord support to radeon driver. No vtxfmt code (just uses fallback) yet. May cause a tcl fallback if fog coord is used together with separate specular lighting. Fog factors are precomputed and then submitted instead of the raw coords (chip limitation, same as on r200). 2005-10-17 00:54:12 +00:00
Roland Scheidegger
dd5a86339f fix some obvious typos in radeon_reg.h (only currently unused bits affected) 2005-10-16 22:45:59 +00:00
Roland Scheidegger
247f3b3e81 enable cube maps on radeon (#2241 on bugzilla). No vtxfmt code yet (just generates vfmt fallback). Code by Andreas Stenglein, some small adjustments by me. 2005-10-15 23:45:53 +00:00
Roland Scheidegger
ccf1378131 fix two bugs wrt calculating max possible texture sizes for texture rectangles/cube maps. 2005-10-15 01:07:59 +00:00
Roland Scheidegger
30daa75293 enable 3rd texture unit on radeon (default still 2 enabled units). Disable some multitexcoord codegen stuff noone understands to make it work. Replace most code testing explicitly for unit 0 and 1 with loops instead of adding test for unit 2, smaller/more readable code at the cost of maybe some slight performance hit. (Code provided by Andreas Stenglein, some adjustments by me.) 2005-10-13 14:30:20 +00:00
Roland Scheidegger
ed2f8635f0 make sure texture matrix is updated often enough with texture rectangles 2005-10-13 00:35:51 +00:00
Roland Scheidegger
6ff023fe3a fix potential bug when emitting elts with lots of components 2005-10-13 00:33:46 +00:00
Brian Paul
96e1ccedec remove unused _mesa_log2() (bug 4468) 2005-10-12 19:46:48 +00:00
Brian Paul
c81de36223 change includes (bug 4468) 2005-10-12 19:46:29 +00:00
Brian Paul
f525d3e139 fix GLAPI/extern problem (bug 4757) 2005-10-12 19:37:38 +00:00
Roland Scheidegger
d084c3d4dc Minor driver cleanup. Remove unnecessery/unneded radeon/r200AllocDmaRegionVerts function. No longer compile the radeon_compat stuff which was for drm 1.1 compatibility presumably but unused since about forever into the driver. 2005-10-11 17:55:54 +00:00
Ian Romanick
44b1bd7597 ifdef out some code to make glapi.c linkable in libglx.so (on the
server).  This isn't strictly needed yet, but it doesn't hurt anything
either.  However, the patches for fd.o bug #2996 require this to build.
2005-10-11 16:56:39 +00:00
Brian Paul
e7325294d0 check for PIXMAP in clip routine (SF bug 1323215) 2005-10-11 01:21:40 +00:00
Brian Paul
ac04a4fa7f fixed constant fogcoord bug (#4729) 2005-10-10 18:39:34 +00:00
Ian Romanick
8d29d463a3 Add 'get' data for glGetFramebufferAttachmentParameterivEXT enums.
Remove an extra closing parenthesis in the Linux version of the SWAP_32 macro.
2005-10-10 17:11:02 +00:00
Roland Scheidegger
1c0f11046a do not set format of the incoming vertices needed for fog_coord in the generic state functions. This is done in the vtxfmt/hwtcl/swtcl pathes respectively. 2005-10-08 23:41:20 +00:00
Roland Scheidegger
30f2d6f0cb remove code dealing with drm versions older than 1.3. The driver requires (and requests) 1.3 since quite some time already to work at all. 2005-10-08 23:36:35 +00:00
Brian Paul
b4269c07f8 change test for presence of accum buffer 2005-10-08 21:36:38 +00:00
Brian Paul
cf085db28a Query/print GL_RED/GREEN/BLUE/ALPHA_BITS 2005-10-08 14:42:51 +00:00
Brian Paul
474f28e57c Fix some issues with state updates and renderbuffers. Querying GL_RED_BITS,
etc. after calling glRenderBufferStorageEXT gave undefined results.
2005-10-08 14:41:17 +00:00
Brian Paul
81a22ef539 MATH_DEBUG changes from bug #4468. 2005-10-07 17:18:51 +00:00
Keith Whitwell
f2802c40ff Populate arb_fp_instruction negate field correctly. 2005-10-07 09:55:26 +00:00
Brian Paul
dfe7aedf84 Fix a number of point size attenuation problems.
Move size clamping into the rasterization function.
2005-10-07 03:56:29 +00:00
Roland Scheidegger
9dd973ec3b fix problems with some texgen modes by putting the chip into LOCAL_VIEWER mode for lighting (potentially causes slight misrenderings with the specular components of lights if the light model is not set for local viewer). 2005-10-05 22:40:09 +00:00
Roland Scheidegger
24a44d74b6 reverse accidentally commited part of last commit (makes it compile again...). 2005-10-05 20:28:31 +00:00
Roland Scheidegger
44dace86ea enable point sizes larger than 1 (for aliased points only) by using the hw point sprite primitive. 2005-10-05 16:15:16 +00:00
Brian Paul
26f69d87a4 fix byteswapping bug in _mesa_texstore_ycbcr() (Benjamin Herrenschmidt) 2005-10-05 13:36:05 +00:00
Roland Scheidegger
ea20c324ae fix typo in radeon_maos_arrays.c from last commit (code currently unused, that path is compile-tested only). 2005-10-05 13:09:15 +00:00
Roland Scheidegger
11f763f505 remove unneeded parameter from radeonUploadTexMatrix. 2005-10-05 12:38:07 +00:00
Roland Scheidegger
a3c8de2fa7 Remove the tcl fallback for texture rectangle (by manipulating the texture matrix) (tested with texrect). Enable texgen for r/q coordinates (tested with projtex). Fix projected texcoords when an app uses TexCoord3x and the texture matrix to save on vertex size (fixes ut2k3 shadow projectors in tcl mode). From texgenmix, all cases with all texgen or no texgen work, with the exception of texgen enabled for s/t only, this one works with hw tcl, but not with vtxfmt (suspect issues with vtxfmt), the mixed cases do not work (which is expected, and should be rare in practice), with the exception of the first one which hits a tcl fallback. 2005-10-05 11:42:44 +00:00
Brian Paul
06f606ce57 Remove _IsPowerOfTwo from gl_texture_object, not really needed. 2005-10-05 04:07:50 +00:00
Brian Paul
198a88923c s/IntFormat/InternalFormat/ and s/Format/_BaseFormat/ for gl_color_table. 2005-10-05 02:11:15 +00:00
Brian Paul
8184ec9fb6 added GL_INVALID_FRAMEBUFFER_OPERATION_EXT to gluErrorString() 2005-10-05 02:08:53 +00:00
Brian Paul
a9fc8ba756 In gl_texture_image replace IntFormat with InternalFormat and Format with
_BaseFormat to be consistant with gl_renderbuffer.
2005-10-05 01:48:07 +00:00
Brian Paul
91802fdf73 check if deleting currently bound frame/renderbuffer object 2005-10-04 16:01:02 +00:00
Brian Paul
7edf1e80bd glBindTexture changes, new assertions 2005-10-04 15:16:27 +00:00
Brian Paul
9e920fb93c fix glIsRender/FramebufferEXT() assertions 2005-10-04 15:01:51 +00:00
Brian Paul
bc6cced479 fix behaviour of glIsFrame/Renderbuffer() 2005-10-04 15:01:27 +00:00
Brian Paul
14c38b8f4f Use Visual.depthBits rather than Renderbuffer::DepthBits for depth buffer
operations.
2005-10-04 14:49:30 +00:00
Brian Paul
eb063cfa38 change initialization of renderbuffer DepthBits 2005-10-04 14:48:24 +00:00
Adam Jackson
199ef86b5e Bug #1155: Define IEEE_ONE on Super-H as well. 2005-10-03 20:02:07 +00:00
Brian Paul
a6296dd2c3 disable a warning 2005-10-03 16:11:47 +00:00
Brian Paul
071b30aba1 added a few calls to _mesa_update_framebuffer_visual() 2005-10-03 16:11:35 +00:00
Brian Paul
b0e7d850d1 finish up some missing code 2005-10-03 16:11:21 +00:00
Ian Romanick
8ef0519bbe Change the 'count' for COMPRESSED_TEXTURE_FORMATS from "?" to "-1". This
signals to the script (glX_proto_size.py) that generates the server-side
size functions that a handcoded query is needed to determine the data size.

Also do s/FOG_COORD_SOURCE/FOG_COORD_SRC/.

When initializing the count in glx_enum::__init__, cast the local property
to int.  Thanks to Python's dynamic typing, if this isn't done the type of
stored count will be a string instead of an int.
2005-10-03 15:05:40 +00:00
Ian Romanick
9a3a1497e5 Remove the non-existant --get-alias-set option from the help text.
Update printPixelFunction (which is only used to generate code for the
server-side) to use the correct method for obtaining the dimensions of the
image parameter to a function.

Only use byteswap.h when building generated code on Linux.  Elsewhere use
the (horrible!) macros from X11/misc.h.

Make sure that enums associated with the generic "Get" function get applied
to GetIntegerv, GetBooleanv, GetFloatv, and GetDoublev.
2005-10-03 14:59:26 +00:00
Brian Paul
1fc4b21eb2 check for GL_DEPTH_STENCIL_EXT 2005-10-01 16:09:45 +00:00
Brian Paul
2794507289 plug in _mesa_texstore_z24_s8() 2005-10-01 16:09:26 +00:00
Brian Paul
184a970722 added _mesa_texstore_z24_s8() 2005-10-01 16:08:27 +00:00
Brian Paul
b0a0ca8bd9 GL_EXT_packed_depth_stencil changes 2005-10-01 16:06:25 +00:00
Brian Paul
0899afae33 additional error checking for GL_EXT_packed_depth_stencil 2005-10-01 16:05:30 +00:00
Brian Paul
cef88397a6 fix an assertion 2005-10-01 16:04:38 +00:00
Brian Paul
7f78c93015 simplify the read_depth_stencil_pixels() function 2005-10-01 16:04:09 +00:00
Brian Paul
9758ef9e7b fix broken z24_s8 fetcher 2005-10-01 16:03:30 +00:00
Brian Paul
252194d74e updated comment 2005-10-01 16:03:00 +00:00
Brian Paul
31340f6645 added _mesa_pack_depth_stencil_span() 2005-10-01 16:02:38 +00:00
Brian Paul
3d61c2e778 move around some error checking 2005-10-01 16:02:11 +00:00
Brian Paul
d0529b67f4 use fmod() to prevent overflow of angle variable 2005-09-30 15:03:33 +00:00
Brian Paul
76560af99d implemented fallbacks for GL_EXT_packed_depth_stencil 2005-09-30 03:01:30 +00:00
Brian Paul
82b29819a9 minor improvements 2005-09-30 03:01:11 +00:00
Brian Paul
f493a04be0 added _swrast_get_row() 2005-09-30 03:00:03 +00:00
Brian Paul
1ad6e08090 call glFinish if drawing to front buffer 2005-09-29 18:46:27 +00:00
Brian Paul
b2404b132d implement CopyPixels for GL_DEPTH_STENCIL_EXT 2005-09-29 04:28:21 +00:00
Brian Paul
3fd819aef8 added _swrast_put_row() 2005-09-29 04:27:47 +00:00
Brian Paul
8d0edf015d Rewrite much of the pixel zoom code.
Zoomed DrawPixels of packed depth/stencil works now.
2005-09-29 03:20:15 +00:00
Brian Paul
5208867f12 add error checks for framebuffer completeness 2005-09-28 16:20:34 +00:00
Brian Paul
d95000da2f check for framebuffer completeness, code clean-up 2005-09-28 15:46:46 +00:00
Brian Paul
f7a8d8ffbb updated assertions (see bug 4590) 2005-09-28 14:20:06 +00:00
Brian Paul
1ad7b99925 Initial work for GL_EXT_packed_depth_stencil extension.
glReadPixels done, glDrawPixels mostly done.
2005-09-28 02:29:50 +00:00
Brian Paul
b955474093 change initialization of rb->DepthBits 2005-09-28 02:28:42 +00:00
Brian Paul
1b5d3d647e added GL_EXT_packed_depth_stencil 2005-09-28 02:28:00 +00:00
Brian Paul
ac3ec5096a added _mesa_scale_and_bias_depth() 2005-09-28 02:27:22 +00:00
Brian Paul
dbd0fa920e tweak glAccum error checking 2005-09-27 16:10:49 +00:00
Brian Paul
78b3b667b5 generate GL_INVALID_OPERATION in glAccum if read/draw buffers aren't the same 2005-09-27 15:52:27 +00:00
Brian Paul
99796464c5 Lift all the format/type error checking out of the _swrast_Draw/Read/CopyPixels
functions into the _mesa_Draw/Read/CopyPixels functions.
2005-09-27 01:25:24 +00:00
Brian Paul
70c3bebcde glDraw/CopyPixels of stencil data didn't obey the stencil write mask. Fixed. 2005-09-26 23:06:01 +00:00
Roland Scheidegger
afb9fb0965 remove identity check for texgen planes (which was just plain wrong). 2005-09-26 20:31:40 +00:00
Roland Scheidegger
84c9e671ed fix projective texturing for (swtcl) texture rectangles. Fix wrong argument order for texgen/texmat matrix multiplication. 2005-09-26 17:11:16 +00:00
Brian Paul
ad271b8c98 Added XMesaDrawable to xmesa_renderbuffer. Use it in a few places instead
of the XMesaPixmap field to avoid some X server-side issues with casting.
2005-09-26 00:38:00 +00:00
Dave Airlie
4aeaff2ae7 Add support for texture compression to R300 driver
This isn't perfect, texcmp still has some issues with the small textures..
but its a good start
2005-09-25 10:20:38 +00:00
Dave Airlie
310a10b0f2 add link for radeon_egl.c 2005-09-25 09:45:42 +00:00
Jouk Jansen
d997b90433 Committing in .
1) change compilation on VMS to use IEEE floating points

 2) one more problem with _mesa_sprintf solved

 Modified Files:
 	Mesa/docs/README.VMS Mesa/progs/demos/descrip.mms
 	Mesa/progs/tests/descrip.mms Mesa/progs/util/descrip.mms
 	Mesa/progs/xdemos/descrip.mms Mesa/src/glu/mesa/descrip.mms
 	Mesa/src/glu/sgi/descrip.mms Mesa/src/glut/glx/descrip.mms
 	Mesa/src/mesa/array_cache/descrip.mms
 	Mesa/src/mesa/drivers/common/descrip.mms
 	Mesa/src/mesa/drivers/osmesa/descrip.mms
 	Mesa/src/mesa/drivers/x11/descrip.mms
 	Mesa/src/mesa/glapi/descrip.mms Mesa/src/mesa/main/descrip.mms
 	Mesa/src/mesa/main/texobj.c Mesa/src/mesa/math/descrip.mms
 	Mesa/src/mesa/shader/descrip.mms
 	Mesa/src/mesa/shader/grammar/descrip.mms
 	Mesa/src/mesa/shader/slang/descrip.mms
 	Mesa/src/mesa/swrast/descrip.mms
 	Mesa/src/mesa/swrast_setup/descrip.mms
 	Mesa/src/mesa/tnl/descrip.mms
 ----------------------------------------------------------------------
2005-09-23 07:03:53 +00:00
Brian Paul
79b4dbc496 remove printf 2005-09-23 03:24:27 +00:00
Brian Paul
048b13df65 Replace gl_framebuffer's _ColorReadBufferMask with _ColorReadBufferIndex,
Streamline the _mesa_update_framebuffer() function a bit.
2005-09-23 03:22:20 +00:00
Brian Paul
d5861c06f2 fix clipped glReadPixels bug 2005-09-23 02:16:49 +00:00
Brian Paul
36d9ee1828 added XOR line optimization 2005-09-23 01:42:23 +00:00
Brian Paul
6d3637849b Added a fast xor_line() function. Uses XDrawLine with GXxor mode.
Only used for front-buffer window/pixmap rendering, GL_FLAT shade model,
no Z test or other fragment operations.
2005-09-23 01:40:59 +00:00
Brian Paul
0efc17c105 Add Wrapper field to gl_renderbuffer. Used for wrapping one renderbuffer
with another, such as wrapping a hardware/win-sys RGB renderbuffer with a
software-based alpha buffer.
Previous alpha buffer wrapping was conflicting with the X driver's
xmesa_renderbuffer structure containment/inheritance.  That lead to
memory corruption.
2005-09-23 01:20:09 +00:00
Brian Paul
e5fce1694c improve the test for using software alpha buffer 2005-09-23 01:17:07 +00:00
Ian Romanick
7b01068a23 Enable GL_ARB_texture_mirrored_repeat on Savage4. Refactor the code that
sets the texture wrap mode and texture filter mode for Savage4 to the new
functions savage4_set_wrap_mode and savage4_set_filter_mode.

This was tested with texwrap and tunnel.
2005-09-22 21:25:31 +00:00
Brian Paul
676d0accf5 Replace gl_renderbuffer.ComponentSizes[] with separate RedBits, GreenBits,
BlueBits, etc fields.
2005-09-22 05:19:57 +00:00
Brian Paul
f1e2826856 When testing visual attributes, use the Draw/Read buffer, not the context. 2005-09-22 05:00:12 +00:00
Brian Paul
4fd11949f0 fix a debug message 2005-09-22 04:58:42 +00:00
Brian Paul
63016507d7 changed a renderbuffer check 2005-09-22 04:52:45 +00:00
Brian Paul
7d39e82976 s/GL_DEPTH_BITS/GL_TEXTURE_DEPTH_SIZE_ARB/ in _mesa_GetTexLevelParameteriv() 2005-09-21 21:19:22 +00:00
Brian Paul
8bdc1ae358 add missing scale factor in _swrast_read_depth_span_float() 2005-09-21 18:16:33 +00:00
Brian Paul
978ef2bb6d Remove ACCUM_BITS. 2005-09-21 03:35:08 +00:00
Brian Paul
3e37bafab0 replace GLdepth with GLuint and remove GLdepth 2005-09-21 02:47:32 +00:00
Brian Paul
4092fbd55a replace GLdepth with GLuint 2005-09-21 02:46:17 +00:00
Brian Paul
5bfb9356d6 s/programss/programs/ 2005-09-20 21:04:02 +00:00
Brian Paul
5434695017 initial check-in 2005-09-20 15:51:44 +00:00
Brian Paul
9e4e3adcf8 remove 31-bit Z buffer work-around 2005-09-20 04:47:34 +00:00
Brian Paul
8fadf8f900 change mask[] test in put_mono_row_uint() 2005-09-20 04:47:04 +00:00
Brian Paul
14570e6d7c compute z[i] as GLuint 2005-09-20 04:45:26 +00:00
Brian Paul
f39569f550 some improvements to _swrast_clear_depth_buffer() 2005-09-20 04:36:50 +00:00
Brian Paul
000abaa12d remove unneeded sizeof(GLdepth) test 2005-09-20 04:35:40 +00:00
Brian Paul
7265556b9a Change zLeft and zval to GLuint. Seems to fix 32-bit Z computation 2005-09-20 04:34:29 +00:00
Brian Paul
22607975b4 replace STENCIL_BITS with stencilMax value 2005-09-20 04:31:24 +00:00
Brian Paul
3211b28ee6 remove STENCIL_MAX 2005-09-20 04:25:03 +00:00
Brian Paul
cd81190d5c change location of ffs() code for windows 2005-09-20 02:44:40 +00:00
Brian Paul
17d6fff30c init a=0 2005-09-19 21:16:29 +00:00
Brian Paul
c650bb0b7d s/GLchan/GLubyte/, fix error string, add comment 2005-09-19 20:32:21 +00:00
Brian Paul
02237f447f updated comment 2005-09-19 20:29:34 +00:00
Brian Paul
b3aefd1cfb additional wrapper updates, bug 4468 2005-09-19 20:12:32 +00:00
Brian Paul
a01cb26a90 s/unsigned long/drm_handle_t/ to get compilation of fb driver to work 2005-09-19 17:17:58 +00:00
Brian Paul
26bb7bc025 compilation fixes, don't know if runtime works 2005-09-19 17:17:18 +00:00
Brian Paul
6707433272 Fix potential segfault when trying to read pixels outside renderbuffer bounds.
Use _swrast_get_values() which does clipping.
2005-09-16 21:15:27 +00:00
Brian Paul
82e314252f remove unused _swrast_read_depth_span() 2005-09-16 21:10:27 +00:00
Brian Paul
f2ea634c0c lots of little clean-ups, improvements 2005-09-16 21:07:48 +00:00
Brian Paul
6ae8747539 change some comments 2005-09-16 21:06:57 +00:00
Brian Paul
62a2f8cdd6 pass mask=NULL to write all pixels in clear_ci_buffer_with_masking() 2005-09-16 21:06:33 +00:00
Brian Paul
db64b60225 remove unused ctx var 2005-09-16 18:18:47 +00:00
Brian Paul
aa2069586d use mesa import wrappers, bug 4468 2005-09-16 18:14:24 +00:00
Brian Paul
3cc67cb8cd alphabetize 2005-09-16 04:18:09 +00:00
Brian Paul
aa8abf8081 Rework the texture filtering functions a bit.
No need to pass the texture unit number as an argument.
2005-09-16 04:16:48 +00:00
Brian Paul
792a1bcbe4 replace a couple macros with inlined functions 2005-09-16 01:42:07 +00:00
Brian Paul
8885b077ed more GLuint->GLbitfield changes 2005-09-16 01:41:03 +00:00
Brian Paul
e00ac11d4d Replace GLuint with GLbitfield where appropriate. Also replace GLuint
with GLboolean in a few places.
2005-09-15 05:00:45 +00:00
Brian Paul
0f540f4b04 Code clean-ups, reorg. 2005-09-15 03:58:52 +00:00
Brian Paul
e64874ac2d silence warning 2005-09-15 01:58:39 +00:00
Brian Paul
63b5b8eaff Remove a bunch texel fetch functions that can be handled by the new
adaptor functions.
2005-09-15 01:55:40 +00:00
Brian Paul
9a22b555cf updated comments 2005-09-15 01:08:24 +00:00
Brian Paul
da9f65268d New set_fetch_functions() to set a gl_texture_image's FetchTexel functions
from the gl_texture_format's functions.
Added "adaptor" functions to allow sampling a float-valued texture with
GLchans and vice versa.  This will allow trimming down the number of
texture fetch routines.
2005-09-15 01:06:19 +00:00
Brian Paul
7fb9352fe4 replace s_texture.[ch] with s_texcombine.[ch] and s_texfilter.[ch] 2005-09-15 01:00:20 +00:00
Brian Paul
55187ea63e Update includes post-splitting of s_texture.c 2005-09-15 00:58:03 +00:00
Brian Paul
2cd8791cad Split the s_texture.c file into two new files:
s_texcombine.c - for texture combining/application
  s_texfilter.c - for texture sampling/filtering
2005-09-15 00:57:00 +00:00
Brian Paul
6ce60beb28 remove unused vars 2005-09-14 18:21:05 +00:00
Brian Paul
5f16244879 remove _tnl_MakeCurrent call 2005-09-14 18:09:15 +00:00
Brian Paul
a25fe61607 initial 6.5 release notes 2005-09-14 14:34:54 +00:00
Brian Paul
b43671c8bf Remove _tnl_MakeCurrent() and the unused ctx->Driver.MakeCurrent() callback. 2005-09-14 14:32:20 +00:00
Dave Airlie
04adb70f32 fix breakage from Brians changes earlier 2005-09-14 12:08:32 +00:00
Brian Paul
a702bbfff3 clean-up some _mesa_make_current() code 2005-09-14 03:11:36 +00:00
Brian Paul
5250aa7c6a remove rm -f line 2005-09-14 02:18:43 +00:00
Brian Paul
7a534dcab1 remove .a file before creating new one 2005-09-14 02:18:09 +00:00
Brian Paul
41cf68b4cb pageflip change from radeon driver 2005-09-14 00:49:09 +00:00
Brian Paul
a400a1e404 Instead of calling _mesa_ResizeBuffersMESA() in the Viewport function,
call driUpdateFramebufferSize() when window size/position changes.
2005-09-14 00:42:33 +00:00
Brian Paul
f157e2dee4 make some funcs static 2005-09-14 00:37:10 +00:00
Brian Paul
ff9d235042 Instead of calling _mesa_ResizeBuffersMESA() in the Viewport function,
call driUpdateFramebufferSize() when window size/position changes.
2005-09-14 00:36:27 +00:00
Brian Paul
48799287b3 use mklib script to make drivers instead of gcc -shared 2005-09-14 00:33:03 +00:00
Brian Paul
a60ff20c58 updated comment 2005-09-14 00:11:30 +00:00
Brian Paul
67a8decffe make some functions static 2005-09-14 00:10:56 +00:00
Brian Paul
e42a31350d Instead of calling _mesa_ResizeBuffersMESA() in the Viewport function,
call driUpdateFramebufferSize() when we detect changes in window size/
position in radeonGetLock().
2005-09-14 00:10:27 +00:00
Brian Paul
9ae952a88c added driUpdateFramebufferSize() 2005-09-14 00:09:09 +00:00
Brian Paul
f084f60f8b Move _mesa_add_soft_renderbuffers() from framebuffer.c to renderbuffer.c
Update some comments, code, etc.
2005-09-13 23:37:50 +00:00
Brian Paul
7909dd920d update like for MD2 viewer 2005-09-13 18:18:47 +00:00
Brian Paul
56ff8ed6d8 replace semicolon with && 2005-09-13 15:04:30 +00:00
Brian Paul
363344f5b8 print version with debug info 2005-09-13 14:48:28 +00:00
Brian Paul
7bb7f97594 fix FreeBSD problem (bug 4435) 2005-09-13 13:36:47 +00:00
Eric Anholt
914ec8ef58 Fix libGL build on FreeBSD by respecting ASM_FLAGS.
Submitted by:	Diego Pettenò <flameeyes@gentoo.org>
2005-09-13 05:19:02 +00:00
Brian Paul
878c371e6c Replace ctx->Driver.StencilOp/Func/Mask() functions with
ctx->Driver.Stencil*Separate() functions.
2005-09-13 04:42:09 +00:00
Brian Paul
42c34efd23 OpenGL 2.0's two-sided stencil feature wasn't implemented correctly.
See comment near top of stencil.c for info about OpenGL 2.0 vs.
GL_EXT_stencil_two_side.
2005-09-13 02:59:53 +00:00
Brian Paul
bdf8441f80 just some reformatting 2005-09-13 02:57:07 +00:00
Brian Paul
56a2e084be Clear either 8 or 16-bit stencil buffers. 2005-09-13 02:03:06 +00:00
Brian Paul
b5932cfc9d Use GLuint/GLint intead of GLstencil for stencil state. 2005-09-13 02:02:03 +00:00
Brian Paul
a96f889a57 Move the ctx->FirstTimeCurrent initialization 2005-09-13 01:19:29 +00:00
Brian Paul
5179f671e7 init StencilOpSeparate to NULL 2005-09-13 01:17:01 +00:00
Roland Scheidegger
8d2139e513 add GL_ATI_fragment_shader support for r200 2005-09-12 23:45:05 +00:00
Brian Paul
fd9de710f5 added a return upon out-of-memory, remove a needless assignment 2005-09-12 23:18:21 +00:00
Brian Paul
f6e3234639 restore brace lost in previous check-in 2005-09-12 21:41:45 +00:00
Roland Scheidegger
f20917de5b add complete support for ATI_fragment_shader for the r200. Most of the new code is in the new file r200_fragshader.c. Reverse engeneered by Dave Airlie and me 2005-09-12 21:20:10 +00:00
Roland Scheidegger
11543624ed remove unnecessary Swizzle parameter from struct (forgotten when the code was refactored) 2005-09-12 17:21:40 +00:00
Brian Paul
28569c25f6 use ASM_API variable, bug 4415 2005-09-12 15:19:19 +00:00
Brian Paul
68d436140d make lookup_query_object() static 2005-09-12 15:05:57 +00:00
Brian Paul
758f447a17 remove rendundant r,g,b,a vars (bug 4331) 2005-09-12 13:59:29 +00:00
Dave Airlie
2745df2774 add 1002:5460 M22 X300 card 2005-09-11 04:02:41 +00:00
Dave Airlie
654286eab1 fix dri drivers build 2005-09-11 03:58:29 +00:00
Brian Paul
2eef2eca87 Silence some warnings. 2005-09-11 01:45:04 +00:00
Brian Paul
7f8cb30ccc bunch of updates 2005-09-10 16:57:22 +00:00
Brian Paul
80cef697f4 put GLUT sources into a separate tarball 2005-09-10 16:54:05 +00:00
Brian Paul
26c7e65785 Clean-up of sources/Makefile, bug 4111 2005-09-10 16:41:17 +00:00
Brian Paul
5704b8e57a fix a problem w/ color index mode when CHAN_BITS=16 2005-09-10 16:27:51 +00:00
Brian Paul
f15b499cfd make some vars static 2005-09-10 16:20:47 +00:00
Brian Paul
392c93e398 fix GLubyte/GLchan inconsistencies (bug 4331) 2005-09-10 16:19:36 +00:00
Roland Scheidegger
0ca6715ba5 new demo to test ATI_fragment_shader, not very creative but easy to know if the output is correct. Tests single-pass as well as multi-pass shader (only pseudo-dependant texture read though, and no tex coord swizzling), src and dst modifiers, src repetition, dst masks, constants, and some ops. Both shaders run succesfully with swrast as well as r200. 2005-09-10 01:02:25 +00:00
Roland Scheidegger
c53d2d0ca8 add the new drm packets needed for ATI_fragment_shader to the sanity code of the r200 and radeon driver 2005-09-10 00:31:11 +00:00
Roland Scheidegger
6c2e82b601 add reverse-engeneered register bits needed for ATI_fragment_shader (Dave Airlie, me) 2005-09-10 00:11:27 +00:00
Brian Paul
402b2bea64 Add offset and pitch fields to intelRegion. Remove frontOffset, frontPitch,
backOffset, backPitch, depthOffset, depthPitch, textureOffset fields.
2005-09-10 00:10:15 +00:00
Roland Scheidegger
036a99452d add _tnl_arb_vertex_program_stage to all drivers which already have _tnl_vertex_program_stage. Fixes crashes when using vertex programs. Tested on r200 only (fix by Keith Whitwell) 2005-09-09 23:31:31 +00:00
Brian Paul
a3dd2ce29e remove the redundant textureSize field, use tex.size instead, it's always the same value 2005-09-09 22:57:05 +00:00
Brian Paul
338cbb0e5c don't generate selection hits for glBitmap, glDraw/CopyPixels. Misc clean-ups 2005-09-09 16:40:47 +00:00
Roland Scheidegger
b346213960 fix some bugs with handling of GL_DOT4_ATI, GL_DOT3_ATI and GL_DOT2_ADD_ATI ATI_fs instructions. 2005-09-09 15:43:11 +00:00
Roland Scheidegger
95db1f0127 add missing fallback string for ARB_vertex_program 2005-09-09 12:51:38 +00:00
Roland Scheidegger
7e3be5559e Fix wrong fallback bit being set by the tcl fallback caused by ARB_vertex_program. Disable ARB_vertex_program by default - it is incredibly slow, and just plain doesn't work anyway (arbvptorus fails an assertion, arbvpmesh has bogus output) 2005-09-09 01:38:21 +00:00
Keith Whitwell
45ba4e4332 use an explicit reserved field, rather than magic number in bound 2005-09-08 21:40:10 +00:00
Brian Paul
d9b9b4b3be Fix the comment for the 'bound' field: it's a bitmask, not an index.
In driTexturesGone(), set bound = 0, not 99.
2005-09-08 18:47:36 +00:00
Keith Whitwell
b5cbaf945d Keep NumTemporaries uptodate.
Make sure oC alpha is populated when separate_specular enabled.
2005-09-08 18:45:03 +00:00
Keith Whitwell
b15f46a093 Treat NegateBase as a bitfield, not a boolean. 2005-09-08 18:36:39 +00:00
Keith Whitwell
5cf1397710 be consistent in populating NegateBase field 2005-09-08 18:35:48 +00:00
Brian Paul
4618a9bfc2 check for either GL_ARB_depth_texture or GL_SGIX_depth_texture in a few places 2005-09-08 15:28:45 +00:00
Brian Paul
f36954ec3c fix precision problem in depth clearing (bug 4395) 2005-09-08 13:55:05 +00:00
Roland Scheidegger
f4ff4d36ed fix incorrect swizzling handling. fix code so it can potentially handle implementations with less than 6 texture units correctly. 2005-09-08 13:41:54 +00:00
Jouk Jansen
21ed29598f Committing in .
Define suseconds_t for OpenVMS

 Modified Files:
 	Mesa/src/mesa/drivers/x11/xm_dd.c
 ----------------------------------------------------------------------
2005-09-08 10:05:37 +00:00
Roland Scheidegger
ce3350770c add a bunch of FLUSH_VERTICES to some of the ATI_fs functions, most notably when changing the global ati fragment shader constants. 2005-09-08 00:12:57 +00:00
Brian Paul
692147ebf7 some clean-up and re-org for renderbuffers 2005-09-07 23:28:41 +00:00
Brian Paul
526242614f some updates, but code still out of date 2005-09-07 23:26:01 +00:00
Brian Paul
ab8ef280ec new comment 2005-09-07 23:21:59 +00:00
Brian Paul
f0da327c87 minor tweaks to _mesa_ResizeBuffersMESA() 2005-09-07 23:21:40 +00:00
Roland Scheidegger
b683b0df45 fix bug with ATI_fragment_shader in swrast (need to copy all 4 values due to later applied srcRep) 2005-09-07 21:59:30 +00:00
Brian Paul
8693b70e8f try to fix renderbuffer breakage, primarily in calculate_buffer_parameters() 2005-09-07 18:32:29 +00:00
Brian Paul
eba4ff6e0a minor formatting fix 2005-09-06 21:22:16 +00:00
Brian Paul
d869a43554 added viaRenderbufferStorage() function 2005-09-06 20:42:23 +00:00
Brian Paul
20354edf35 just changes/updates to comments 2005-09-06 14:47:57 +00:00
Brian Paul
bd07168eb2 added -Wmissing-prototypes to WARN_FLAGS 2005-09-06 03:13:18 +00:00
Brian Paul
158a2aa488 Use mklib script instead of ar. Make libmesa.a instead of mesa.a 2005-09-06 03:02:01 +00:00
Brian Paul
c0b4b9fc3e remove DEFARRAY, CHECKARRAY stuff 2005-09-06 02:56:51 +00:00
Brian Paul
e2399effa0 minor clean-up of texture_combine() 2005-09-06 02:55:34 +00:00
Brian Paul
3622f4f27f don't use DEFARRAY/CHECKARRAY stuff 2005-09-06 02:44:00 +00:00
Brian Paul
fcb6a0fa3e make some functions static 2005-09-05 21:17:44 +00:00
Brian Paul
6575e37cbf make r128SpanRenderStart/Finish static 2005-09-05 21:09:22 +00:00
Brian Paul
e3c8a0c16d remove obsolete CurrentBufferBit 2005-09-05 21:04:22 +00:00
Brian Paul
3952d6d4bb remove unused var 2005-09-05 21:03:48 +00:00
Karl Schultz
f66084b834 Add support for memory contexts (Thomas Kaltofen). Cleanup compilation warnings. 2005-09-05 14:48:39 +00:00
Karl Schultz
e15c2d077a remove _swrast_DrawBuffer 2005-09-05 14:08:51 +00:00
Karl Schultz
53a3c70580 Windows mesa.def file had been moved to the drivers dir tree some time ago. This copy is not needed. 2005-09-05 14:03:41 +00:00
Karl Schultz
e81cbd876e fix var declaration so that a C compiler can build it. 2005-09-05 13:45:23 +00:00
Brian Paul
b4b040f7d8 just formatting clean-ups 2005-09-04 22:55:57 +00:00
Brian Paul
16e7aebfe3 Simplify radeonSetCliprects(). Remove the 'mode' parameter. 2005-09-04 22:20:07 +00:00
Brian Paul
87ce68e1b3 Further clean-up and simplification of the span-related functions. 2005-09-04 22:16:08 +00:00
Brian Paul
61ba6b5a74 Add new void *addr and __DRIdrawablePrivate parameters to
driNewRenderbuffer().
2005-09-04 22:13:42 +00:00
Brian Paul
6e0e6eff05 Fix UpdatePageFlipping() function. Always call driFlipRenderbuffers()
with pfCurrentPage value, in case it's initially 1 instead of 0.
2005-09-04 16:15:38 +00:00
Brian Paul
d575a4c4a1 minor clean-ups 2005-09-04 15:03:36 +00:00
Brian Paul
0cfd4f92dd replace GET_SRC_PTR, GET_DST_PTR with GET_PTR 2005-09-04 15:02:48 +00:00
Brian Paul
eae73dbd91 Use InitPointers helper 2005-09-04 15:01:33 +00:00
Brian Paul
90cfbd3dd5 Combine GET_DST_PTR and GET_SRC_PTR into just GET_PTR. 2005-09-04 15:00:04 +00:00
Brian Paul
f8cc27ecfc Added InitPointers helper function 2005-09-04 14:59:34 +00:00
Brian Paul
16f76703a5 replace assertion with a conditional return 2005-09-04 14:59:18 +00:00
Brian Paul
05aed23d1b fudge set_component_sizes() a bit, see comments 2005-09-03 17:33:16 +00:00
Brian Paul
acafeeb6dc Remove last remnants of pre-renderbuffer code. 2005-09-03 16:57:58 +00:00
Brian Paul
54be0763e1 renderbuffer updates 2005-09-03 16:55:02 +00:00
Brian Paul
2b81c8999f SetBuffer, renderbuffer changes 2005-09-03 16:54:20 +00:00
Brian Paul
6e57725061 use new InitStencil/DepthPointer functions 2005-09-03 16:49:35 +00:00
Brian Paul
b0715811e8 remove dead code 2005-09-03 16:48:48 +00:00
Brian Paul
f6540c6252 remove SetBuffer 2005-09-03 16:47:30 +00:00
Brian Paul
687918b794 SetBuffer, renderbuffer changes 2005-09-03 16:43:02 +00:00
Brian Paul
e6925b51e1 added flippedData field for page flipping, code to flip stereo color buffers 2005-09-03 16:42:19 +00:00
Brian Paul
c6262cd8c5 added SetStencil/DepthPointer functions 2005-09-03 16:41:30 +00:00
Brian Paul
3ba814ae07 remove SetBuffer(). Misc renderbuffer changes. 2005-09-03 16:40:44 +00:00
Brian Paul
7fa6c1afb9 silence misc warnings 2005-09-03 16:39:57 +00:00
Dave Airlie
624ad14a58 Check for ATI_fragment_shader enabled 2005-09-02 23:52:05 +00:00
Brian Paul
712e5042de fix some strict aliasing problems related to choosing framebuffer configs (Matthias Hopf) 2005-09-02 17:07:00 +00:00
Brian Paul
93cfdfe1ef GL_EXT_timer_query 2005-09-02 14:02:44 +00:00
Brian Paul
14520eb25e comments 2005-09-02 13:55:50 +00:00
Brian Paul
c799e9ec24 added GL_EXT_timer_query token 2005-09-02 13:43:26 +00:00
Brian Paul
4fb995084e Prototype implementation of new GL_EXT_timer_query extension (not finalized yet).
Extends the query mechanism to query elapsed time while rendering.
2005-09-02 13:42:49 +00:00
Brian Paul
8cdf372946 replace -1 with PROGRAM_UNDEFINED when initializing instructions 2005-09-02 13:40:09 +00:00
Brian Paul
350a167635 set depthHasSurface for stencil renderbuffer 2005-09-02 13:20:20 +00:00
Roland Scheidegger
3c450b2917 ATI_fragment_shader fixes: fix bug in passTexCoord (caused by recent changes). Fix sampling from wrong texture unit. Apply swizzling before texture sampling, and hopefully get non-projected coordinates from swrast. (still does not work at all with sw doom3, way too dark just the same as with the doom3 arb2 path) 2005-09-02 12:05:38 +00:00
Brian Paul
a02febb8cc change scratch pointer from _int32_t to u_int32_t to silence warning. Is this field actually used for anything? 2005-09-02 03:39:31 +00:00
Brian Paul
a517cc1ef6 remove unneeded assertion in stencil/depth LOCAL_DEPTH_VARS code 2005-09-02 03:36:41 +00:00
Brian Paul
b343f06a09 set depthHasSurface field for stencil renderbuffer 2005-09-02 03:28:08 +00:00
Roland Scheidegger
f519a770d0 add error checking to the GL_ATI_FRAGMENT_SHADER entrypoints. Fix bug with scope of ati fragment shader constants. Fix issues with specifying color/alpha instructions not pair-wise. Change internal representation of the shader (to better fit how the extension works, should make driver implementations simpler, and saves some memory). (still doesn't work correctly with doom3 and swrast, but not worse than before) 2005-09-02 01:11:53 +00:00
Brian Paul
b252e0f47f added an assertion to help debug broken stencil readback 2005-09-01 20:14:50 +00:00
Brian Paul
238de2db12 added driFlipRenderbuffers() 2005-09-01 20:11:32 +00:00
Brian Paul
da84f0b642 fix page flipping breakage 2005-09-01 20:10:17 +00:00
Brian Paul
98e92d261b fix typo 2005-09-01 14:04:45 +00:00
Brian Paul
4d11d45d84 some missing renderbuffer changes (Roland) 2005-09-01 14:04:32 +00:00
Brian Paul
fcbfeb5d28 Finish up some of the gl_renderbuffer work.
Use driRenderbuffer's offset, pitch fields in the span routines.
Remove the SetBuffer driver function.
Consolidate the code for setting CTX_RB3D_COLOROFFSET and CTX_RB3D_COLORPITCH
state in new radeonUpdateDrawBuffer() function.
Old code is surrounded by #if 000 / #endif, temporarily.
2005-09-01 04:03:44 +00:00
Brian Paul
982e8e4d5c Finish up some of the gl_renderbuffer work.
Use driRenderbuffer's offset, pitch fields in the span routines.
Remove the SetBuffer driver function.
Consolidate the code for setting CTX_RB3D_COLOROFFSET and CTX_RB3D_COLORPITCH
state in new radeonUpdateDrawBuffer() function.
2005-09-01 03:54:34 +00:00
Brian Paul
8e5479c7f8 s/__inline/INLINE/ 2005-09-01 03:50:54 +00:00
Brian Paul
f1d269060b use char* instead of GLubyte* in i915_program_error() to silence warnings 2005-09-01 03:32:48 +00:00
Brian Paul
f069e74dd8 use proper datatypes to silence a bunch of warnings 2005-09-01 03:19:45 +00:00
Brian Paul
5545245fe7 added a few more fields to help with DRI drivers 2005-09-01 03:07:29 +00:00
Brian Paul
db84ec2c6d remove fxDDSetBuffer() 2005-09-01 03:06:28 +00:00
Brian Paul
af39910f94 remove set_buffer() 2005-09-01 03:05:39 +00:00
Brian Paul
c958a9798a remove old set_buffer routine and misc code 2005-09-01 03:04:41 +00:00
Brian Paul
26bb5239c8 remove the old set_buffer() routine 2005-09-01 02:56:47 +00:00
Brian Paul
527835977a Just additional comments. 2005-08-31 21:38:53 +00:00
Roland Scheidegger
36603539cc enable GL_ARB_texture_env_crossbar on r200, separate the enable bits for texture sampling and texture environment, optimize away texture sampling for units if the result is not used, always emit the env instructions in-order and try to eliminate GL_REPLACE env instructions. 2005-08-31 19:11:09 +00:00
Brian Paul
d5783737f1 use 'f' key to toggle front/back buffer rendering 2005-08-31 16:42:59 +00:00
Brian Paul
2c8524b4fb remove dead code, update comments 2005-08-31 16:04:17 +00:00
Alan Hourihane
cbafed8716 reverse a bogus patch 2005-08-31 15:11:21 +00:00
Dave Airlie
3d4d6d29e2 complete fix for miniglx startup issue since driver version checks 2005-08-31 01:24:01 +00:00
Brian Paul
275a563bea remove redundant ctx->Driver fallback assignments that were already done in _mesa_init_driver_functions() 2005-08-31 00:39:32 +00:00
Brian Paul
f830f640b6 fix a cast/assignment warning 2005-08-31 00:00:17 +00:00
Brian Paul
513a553d4a silence fprintf and casting warnings 2005-08-30 23:57:04 +00:00
Brian Paul
16fb04ccb5 added some parenthesis to silence warnings 2005-08-30 23:50:23 +00:00
Alan Hourihane
f98b9853e1 drmUnmap correct size 2005-08-30 20:37:30 +00:00
Alan Hourihane
b41c025420 move via_dri.h to server 2005-08-30 19:46:08 +00:00
Alan Hourihane
9165d46fdb define Bool for solo builds 2005-08-30 19:22:46 +00:00
Alan Hourihane
d5cc77e37c Fixes from https://bugs.freedesktop.org/attachment.cgi?id=3077 2005-08-30 19:14:23 +00:00
Brian Paul
156dc55628 fix APP_LIB_DEPS 2005-08-29 22:45:52 +00:00
Ian Romanick
f0d0e50994 Implement GL_ARB_texture_env_combine, GL_EXT_texture_env_combine, and
GL_ARB_texture_env_crossbar for i810.  This passes both demos/texenv and all
of glean's texCombine tests.
2005-08-29 15:43:02 +00:00
Alan Hourihane
d9089ab96e remove drmAddress 2005-08-29 15:23:55 +00:00
Brian Paul
3a165edc9a added note about IEEE vs VAX floating point (bug 4270) 2005-08-29 14:45:30 +00:00
Brian Paul
49fd874f24 fix a few proxy color table bugs (bug 4270) 2005-08-28 17:12:07 +00:00
Brian Paul
082501a74c check the Ready flag when getting GL_QUERY_RESULT_ARB 2005-08-27 14:04:37 +00:00
Brian Paul
23ffc3a85d Rearrange the code related to GL_ARB_occlusion_object to generalize query
objects for future types of queries.
2005-08-27 13:56:08 +00:00
Adam Jackson
ca1ac986a1 /dri/msg 2005-08-26 17:50:39 +00:00
Alan Hourihane
f4166a1fd7 Fix the scripts for the cygwin & mingw changes 2005-08-26 09:37:41 +00:00
Brian Paul
adbf932ec1 added singlebuffer demo 2005-08-25 23:26:51 +00:00
Brian Paul
59d680db22 Demo of how to do (nearly) flicker-free rendering with a single color buffer. 2005-08-25 23:25:25 +00:00
Brian Paul
713635adef fix comment and #if test 2005-08-25 22:09:43 +00:00
Brian Paul
a2c65f4793 don't compile debug code (bug 4242: rand undefined) 2005-08-25 19:43:38 +00:00
Brian Paul
2735b33638 remove stray references to ctx->Depth.OcclusionTest 2005-08-25 19:38:42 +00:00
Ian Romanick
8bc0b3f961 Fix texture format selection. ChooseTextureFormat is supposed to select the
hardware format of the texture, and SetTexImages is supposed to use the
format selected by ChooseTextureFormat.  However, both routines were making
their choices based on the texture's BaseFormat.  This is wrong.
ChooseTextureFormat uses BaseFormat and SetTexImages uses
TexFormat->MesaFormat.

Once SetTexImages was fixed to use the right format values,
ChooseTextureFormat was cleaned up.  It now uses the few available texture
formats supported by the i810 in a smarter way.  This should improve the
quality of LUMINANCE, LUMINANCE_ALPHA, and INTENSITY textures.

I tested this by cycling through all the texture formats in demos/texenv and
tests/yuvsquare.
2005-08-25 19:15:01 +00:00
Alan Hourihane
8de9d92acf update for mingw 2005-08-25 18:08:16 +00:00
Brian Paul
8e247d52e3 Update the glut idle function after a new window is created 2005-08-25 17:46:04 +00:00
Brian Paul
b8a804d24f initial 6.5 changes (reflect demo, remove GL_HP_occlusion_test) 2005-08-25 14:24:49 +00:00
Brian Paul
6e4f594a02 removed GL_HP_occlusion_test extension 2005-08-25 14:23:38 +00:00
Brian Paul
dd1a9f75dc fix segfault in Fake_glXCreatePBuffer(), bug 4235 2005-08-25 14:07:06 +00:00
Brian Paul
7e6553c1aa s/GLX_RGBA_BIT/GLX_RGBA_TYPE/ (bug 4237) 2005-08-25 13:18:53 +00:00
Eric Anholt
61d386a93f Attempt to fix the issue reported by Alan Grimes with DRM_RADEON_TEXTURE
erroring out when it shouldn't.  The errno could be changed by usleep() between
the ioctl call and the loop check, if a signal was received.  This could cause
an EAGAIN return from the DRM_RADEON_TEXTURE ioctl to not loop again.
Instead of checking errno, check thevalue of ret itself, since it is a saved
(and sign-flipped) copy of errno from the ioctl call.
2005-08-25 03:38:07 +00:00
Brian Paul
d545d916a8 make tiles a little smaller so they're all visible 2005-08-25 03:09:12 +00:00
Brian Paul
9e385282fc also check for texture border in sample_linear_2d() 2005-08-25 03:05:10 +00:00
Brian Paul
5d7c486d90 Added multi-window support. Press 'n' to create new window, 'k' to kill
a window.  Good for exercising multi-window rendering.
2005-08-24 21:32:02 +00:00
Alan Hourihane
c58cea0085 Fix Windows build problems.
GCC's visibility attribute is for ELF systems, so undef INTERNAL
GCC's fastcall attribute interferes with __stdcall so undef FASTCALL
2005-08-24 09:08:06 +00:00
Brian Paul
334f2d8077 GLw demo doesn't belong here 2005-08-23 14:50:02 +00:00
Brian Paul
17756df903 removed lines that caused some files to be included in tarballs multiple times 2005-08-23 13:40:30 +00:00
Brian Paul
edf0d14bd4 simplify, clean-up texel addressing macros 2005-08-23 03:50:12 +00:00
Brian Paul
249160fdfa update version to 6.5.0 2005-08-23 00:45:54 +00:00
736 changed files with 51953 additions and 44210 deletions

View File

@@ -137,6 +137,7 @@ ultrix-gcc:
DIRECTORY = Mesa-6.5
LIB_NAME = MesaLib-6.5
DEMO_NAME = MesaDemos-6.5
GLUT_NAME = MesaGLUT-6.5
MAIN_FILES = \
$(DIRECTORY)/Makefile* \
@@ -213,7 +214,6 @@ MAIN_FILES = \
$(DIRECTORY)/src/mesa/drivers/directfb/*.[ch] \
$(DIRECTORY)/src/mesa/drivers/directfb/Makefile \
$(DIRECTORY)/src/mesa/drivers/dos/*.[chS] \
$(DIRECTORY)/src/mesa/drivers/dri/common/*.[ch] \
$(DIRECTORY)/src/mesa/drivers/fbdev/glfbdev.c \
$(DIRECTORY)/src/mesa/drivers/glide/*.[ch] \
$(DIRECTORY)/src/mesa/drivers/ggi/*.[ch] \
@@ -260,16 +260,15 @@ MAIN_FILES = \
$(DIRECTORY)/windows/VC7/mesa/osmesa/osmesa.vcproj
DRI_FILES = \
$(DIRECTORY)/include/GL/internal/*.h \
$(DIRECTORY)/include/GL/internal/dri_interface.h \
$(DIRECTORY)/include/GL/internal/sarea.h \
$(DIRECTORY)/src/glx/Makefile \
$(DIRECTORY)/src/glx/x11/Makefile \
$(DIRECTORY)/src/glx/x11/*.[ch] \
$(DIRECTORY)/src/mesa/drivers/dri/Makefile \
$(DIRECTORY)/src/mesa/drivers/dri/Makefile.template \
$(DIRECTORY)/src/mesa/drivers/dri/common/*.[ch] \
$(DIRECTORY)/src/mesa/drivers/dri/common/xmlpool/*.[ch] \
$(DIRECTORY)/src/mesa/drivers/dri/common/xmlpool/*.po \
$(DIRECTORY)/src/mesa/drivers/dri/dri_client/imports/*.h \
$(DIRECTORY)/src/mesa/drivers/dri/*/*.[chS] \
$(DIRECTORY)/src/mesa/drivers/dri/*/Makefile \
$(DIRECTORY)/src/mesa/drivers/dri/*/Doxyfile \
@@ -312,7 +311,7 @@ GLW_FILES = \
$(DIRECTORY)/src/glw/README \
$(DIRECTORY)/src/glw/depend
PROG_FILES = \
DEMO_FILES = \
$(DIRECTORY)/progs/beos/*.cpp \
$(DIRECTORY)/progs/beos/Makefile \
$(DIRECTORY)/progs/images/*.rgb \
@@ -323,6 +322,8 @@ PROG_FILES = \
$(DIRECTORY)/progs/demos/*.cxx \
$(DIRECTORY)/progs/demos/*.dat \
$(DIRECTORY)/progs/demos/README \
$(DIRECTORY)/progs/osdemos/Makefile \
$(DIRECTORY)/progs/osdemos/*.c \
$(DIRECTORY)/progs/xdemos/Makefile* \
$(DIRECTORY)/progs/xdemos/descrip.mms \
$(DIRECTORY)/progs/xdemos/*.[chf] \
@@ -337,10 +338,8 @@ PROG_FILES = \
$(DIRECTORY)/progs/windml/*.bmp \
$(DIRECTORY)/progs/ggi/*.c \
$(DIRECTORY)/windows/VC6/progs/demos/*.dsp \
$(DIRECTORY)/windows/VC6/progs/glut/glut.dsp \
$(DIRECTORY)/windows/VC6/progs/progs.dsw \
$(DIRECTORY)/windows/VC7/progs/demos/*.vcproj \
$(DIRECTORY)/windows/VC7/progs/glut/glut.vcproj \
$(DIRECTORY)/windows/VC7/progs/progs.sln
GLUT_FILES = \
@@ -359,7 +358,9 @@ GLUT_FILES = \
$(DIRECTORY)/src/glut/dos/Makefile.DJ \
$(DIRECTORY)/src/glut/dos/PC_HW/*.[chS] \
$(DIRECTORY)/src/glut/ggi/*.[ch] \
$(DIRECTORY)/src/glut/ggi/Makefile
$(DIRECTORY)/src/glut/ggi/Makefile \
$(DIRECTORY)/windows/VC6/progs/glut/glut.dsp \
$(DIRECTORY)/windows/VC7/progs/glut/glut.vcproj
DEPEND_FILES = \
$(TOP)/src/mesa/depend \
@@ -370,11 +371,9 @@ DEPEND_FILES = \
LIB_FILES = $(MAIN_FILES) $(DRI_FILES) $(SGI_GLU_FILES) $(GLW_FILES)
DEMO_FILES = $(PROG_FILES) $(GLUT_FILES)
# Everything for new a Mesa release:
tarballs: rm_depend lib_gz demo_gz lib_bz2 demo_bz2 lib_zip demo_zip md5
tarballs: rm_depend lib_gz demo_gz glut_gz lib_bz2 demo_bz2 glut_bz2 lib_zip demo_zip glut_zip md5
rm_depend:
@@ -396,6 +395,12 @@ demo_gz:
gzip $(DEMO_NAME).tar ; \
mv $(DEMO_NAME).tar.gz $(DIRECTORY)
glut_gz:
cd .. ; \
tar -cf $(GLUT_NAME).tar $(GLUT_FILES) ; \
gzip $(GLUT_NAME).tar ; \
mv $(GLUT_NAME).tar.gz $(DIRECTORY)
lib_bz2:
rm -f configs/current ; \
cd .. ; \
@@ -409,6 +414,12 @@ demo_bz2:
bzip2 $(DEMO_NAME).tar ; \
mv $(DEMO_NAME).tar.bz2 $(DIRECTORY)
glut_bz2:
cd .. ; \
tar -cf $(GLUT_NAME).tar $(GLUT_FILES) ; \
bzip2 $(GLUT_NAME).tar ; \
mv $(GLUT_NAME).tar.bz2 $(DIRECTORY)
lib_zip:
rm -f configs/current ; \
rm -f $(LIB_NAME).zip ; \
@@ -422,6 +433,12 @@ demo_zip:
zip -qr $(DEMO_NAME).zip $(DEMO_FILES) ; \
mv $(DEMO_NAME).zip $(DIRECTORY)
glut_zip:
rm -f $(GLUT_NAME).zip ; \
cd .. ; \
zip -qr $(GLUT_NAME).zip $(GLUT_FILES) ; \
mv $(GLUT_NAME).zip $(DIRECTORY)
md5:
@-md5sum $(LIB_NAME).tar.gz
@-md5sum $(LIB_NAME).tar.bz2
@@ -429,3 +446,6 @@ md5:
@-md5sum $(DEMO_NAME).tar.gz
@-md5sum $(DEMO_NAME).tar.bz2
@-md5sum $(DEMO_NAME).zip
@-md5sum $(GLUT_NAME).tar.gz
@-md5sum $(GLUT_NAME).tar.bz2
@-md5sum $(GLUT_NAME).zip

View File

@@ -12,7 +12,7 @@ TOP=.
INCLUDE_DIR="/usr/local/include"
LIB_DIR="/usr/local/lib"
if [ x$# == "x0" ] ; then
if [ "x$#" = "x0" ] ; then
echo
echo "***** Mesa installation - You may need root privileges to do this *****"
echo
@@ -20,7 +20,7 @@ echo "Default directory for header files is:" ${INCLUDE_DIR}
echo "Enter new directory or press <Enter> to accept this default."
read INPUT
if [ x${INPUT} != "x" ] ; then
if [ "x${INPUT}" != "x" ] ; then
INCLUDE_DIR=${INPUT}
fi
@@ -29,7 +29,7 @@ echo "Default directory for library files is:" ${LIB_DIR}
echo "Enter new directory or press <Enter> to accept this default."
read INPUT
if [ x${INPUT} != "x" ] ; then
if [ "x${INPUT}" != "x" ] ; then
LIB_DIR=${INPUT}
fi
@@ -47,7 +47,16 @@ fi
# flags:
# -f = force
# -d = preserve symlinks
# -d = preserve symlinks (does not work on BSD)
if [ `uname` = "FreeBSD" ] ; then
CP_FLAGS="-f"
elif [ `uname` = "Darwin" ] ; then
CP_FLAGS="-f"
else
CP_FLAGS="-fd"
fi
set -v
@@ -56,7 +65,8 @@ mkdir ${INCLUDE_DIR}/GL
mkdir ${INCLUDE_DIR}/GLES
mkdir ${LIB_DIR}
cp -f ${TOP}/include/GL/*.h ${INCLUDE_DIR}/GL
cp -f ${TOP}/include/GLES/*.h ${INCLUDE_DIR}/GLES
cp -fd ${TOP}/lib*/lib* ${LIB_DIR}
cp -f ${TOP}/src/glw/*.h ${INCLUDE_DIR}/GL
# NOT YET: cp -f ${TOP}/include/GLES/*.h ${INCLUDE_DIR}/GLES
cp ${CP_FLAGS} ${TOP}/lib*/lib* ${LIB_DIR}
echo "Done."

View File

@@ -209,10 +209,8 @@ case $ARCH in
elif [ $STATIC = 1 ] ; then
LIBNAME="lib${LIBNAME}" # prefix with "lib"
echo "mklib: Making" $ARCH "static library: " ${LIBNAME}.a
LINK="ar"
OPTS="-ru"
# make lib
${LINK} ${OPTS} ${LIBNAME}.a ${OBJECTS}
rm -f ${LIBNAME}.a
ar -ru ${LIBNAME}.a ${OBJECTS}
ranlib ${LIBNAME}.a
# finish up
FINAL_LIBS=${LIBNAME}.a
@@ -309,11 +307,23 @@ case $ARCH in
;;
'FreeBSD')
# we assume gcc
if [ "x$LINK" = "x" ] ; then
# -linker was not specified so set default link command now
if [ $CPLUSPLUS = 1 ] ; then
LINK=g++
else
LINK=gcc
fi
fi
if [ $NOPREFIX = 1 ] ; then
# No "lib" or ".so" part
echo "mklib: Making FreeBSD shared library: " ${LIBNAME}
OPTS="-shared"
rm -f ${LIBNAME}
ld -Bshareable -o ${LIBNAME} ${OBJECTS}
${LINK} ${OPTS} -o ${LIBNAME} ${OBJECTS} ${DEPS}
FINAL_LIBS=${LIBNAME}
elif [ $STATIC = 1 ] ; then
STLIB="lib${LIBNAME}.a"
@@ -323,12 +333,13 @@ case $ARCH in
ranlib ${STLIB}
FINAL_LIBS=${STLIB}
else
SHLIB="lib${LIBNAME}.so.${MAJOR}.${MINOR}"
SHLIB="lib${LIBNAME}.so.${MAJOR}"
OPTS="-shared -Wl,-soname,${SHLIB}"
echo "mklib: Making FreeBSD shared library: " ${SHLIB}
rm -f ${SHLIB}
ld -Bshareable -o ${SHLIB} ${OBJECTS}
# XXX make lib${LIBNAME}.so.${MAJOR} symlink?
FINAL_LIBS=${SHLIB}
${LINK} ${OPTS} -o ${SHLIB} ${OBJECTS} ${DEPS}
ln -sf ${SHLIB} "lib${LIBNAME}.so"
FINAL_LIBS="${SHLIB} lib${LIBNAME}.so"
fi
;;
@@ -415,6 +426,7 @@ case $ARCH in
if [ $STATIC = 1 ] ; then
LIBNAME="lib${LIBNAME}.a"
echo "mklib: Making AIX static library: " ${LIBNAME}
rm -f ${LIBNAME}
ar -ruv ${X64} ${LIBNAME} ${OBJECTS}
FINAL_LIBS=${LIBNAME}
else
@@ -492,7 +504,7 @@ case $ARCH in
else
LIBNAME="lib${LIBNAME}.dylib"
echo "mklib: Making Darwin shared library: " ${LIBNAME}
FLAGS="-dynamiclib -multiply_defined suppress"
FLAGS="-dynamiclib -multiply_defined suppress -current_version ${MAJOR}.${MINOR}.0 -compatibility_version ${MAJOR}.${MINOR}.0"
if [ $CPLUSPLUS = 1 ] ; then
LINK="g++"
else

View File

@@ -26,7 +26,8 @@ ifeq ($(CPU), x86)
-DUSE_3DNOW_ASM \
-DUSE_SSE_ASM
ASM_SOURCES = $(X86_SOURCES) $(X86_API)
ASM_SOURCES = $(X86_SOURCES)
ASM_API = $(X86_API)
CC = gcc
CXX = g++

View File

@@ -5,11 +5,13 @@ include $(TOP)/configs/default
CONFIG_NAME = darwin
# Compiler and flags
CC = cc
CXX = cc
CC = c++
CXX = c++
CFLAGS = -I/usr/X11R6/include -O3 -fPIC -fno-common -ffast-math -funroll-loops -fexpensive-optimizations -no-cpp-precomp -dynamic -Ddarwin
CXXFLAGS = -I/usr/X11R6/include -O3 -fPIC -fno-common -ffast-math -funroll-loops -fexpensive-optimizations -no-cpp-precomp -dynamic -Ddarwin
MKLIB_OPTIONS = -cplusplus
# Library names (actual file names)
GL_LIB_NAME = libGL.dylib
GLU_LIB_NAME = libGLU.dylib

View File

@@ -7,8 +7,8 @@ CONFIG_NAME = default
# Version info
MESA_MAJOR=6
MESA_MINOR=3
MESA_TINY=2
MESA_MINOR=5
MESA_TINY=0
# external projects. This should be useless now that we use libdrm.
DRM_SOURCE_PATH=$(TOP)/../drm

View File

@@ -9,9 +9,9 @@ CC = gcc
CXX = g++
MAKE = gmake
CFLAGS = -O2 -fPIC -pedantic -I/usr/X11R6/include -DUSE_XSHM -DHZ=100
CFLAGS = -O2 -fPIC -pedantic -I/usr/X11R6/include -DUSE_XSHM -DHZ=100 \
$(ASM_FLAGS)
CXXFLAGS = -O2 -fPIC -pedantic
GLUT_CFLAGS = -fexceptions
APP_LIB_DEPS = -L$(LIB_DIR) -L/usr/X11R6/lib -lXext -lXmu -lXi -lX11 -lm
APP_LIB_DEPS = -L$(LIB_DIR) -L/usr/X11R6/lib -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) -lXext -lXmu -lXi -lX11 -lm

View File

@@ -16,7 +16,7 @@ X11_INCLUDES = -I/usr/X11R6/include
DEFINES = -DPTHREADS -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER \
-DGLX_DIRECT_RENDERING -DHAVE_ALIAS
CFLAGS = $(DEFINES) -Wmissing-prototypes -g -std=c99 -Wundef -fPIC \
-ffast-math $(X11_INCLUDES)
-ffast-math $(ASM_FLAGS) $(X11_INCLUDES)
CXXFLAGS = $(DEFINES) -Wall -g -ansi -pedantic -fPIC
ASM_SOURCES =
@@ -24,14 +24,14 @@ ASM_SOURCES =
# Library/program dependencies
LIBDRM_LIB = `pkg-config --libs libdrm` -ldrm
DRI_LIB_DEPS = -L/usr/local/lib -lm -lpthread -lexpat $(LIBDRM_LIB)
GL_LIB_DEPS = -L/usr/X11R6/lib -lX11 -lXext -lm -lpthread $(LIBDRM_LIB)
GL_LIB_DEPS = -L/usr/X11R6/lib -lX11 -lXext -lXxf86vm -lm -lpthread $(LIBDRM_LIB)
GLUT_LIB_DEPS = -L$(LIB_DIR) -L/usr/X11R6/lib -lGLU -lGL -lX11 -lXmu -lXt -lXi -lm
GLW_LIB_DEPS = -L$(LIB_DIR) -L/usr/X11R6/lib -lGL -lXt -lXm -lX11
# Directories
SRC_DIRS = mesa glu glut/glx glw glx/x11
SRC_DIRS = glx/x11 mesa glu glut/glx glw
DRIVER_DIRS = dri
PROGRAM_DIRS =
WINDOW_SYSTEM=dri

View File

@@ -6,4 +6,5 @@ include $(TOP)/configs/freebsd-dri
CONFIG_NAME = freebsd-dri-x86-64
ASM_FLAGS = -DUSE_X86_64_ASM
ASM_SOURCES = $(X86-64_SOURCES) $(X86-64_API)
ASM_SOURCES = $(X86-64_SOURCES)
ASM_API = $(X86-64_API)

View File

@@ -10,3 +10,4 @@ PIC_FLAGS =
ASM_FLAGS = -DUSE_X86_ASM -DUSE_MMX_ASM -DUSE_3DNOW_ASM -DUSE_SSE_ASM
ASM_SOURCES = $(X86_SOURCES)
ASM_API = $(X86_API)

View File

@@ -8,7 +8,6 @@ CONFIG_NAME = linux
CC = gcc
CXX = g++
WARN_FLAGS = -Wall
OPT_FLAGS = -O3 -g
PIC_FLAGS = -fPIC
@@ -22,10 +21,10 @@ DEFINES = -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE \
X11_INCLUDES = -I/usr/X11R6/include
CFLAGS = $(WARN_FLAGS) $(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) $(DEFINES) \
$(ASM_FLAGS) $(X11_INCLUDES) -std=c99 -ffast-math
CFLAGS = -Wall -Wmissing-prototypes $(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) \
$(DEFINES) $(ASM_FLAGS) $(X11_INCLUDES) -std=c99 -ffast-math
CXXFLAGS = $(WARN_FLAGS) $(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) $(DEFINES) \
CXXFLAGS = -Wall $(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) $(DEFINES) \
$(X11_INCLUDES)
GLUT_CFLAGS = -fexceptions

View File

@@ -5,4 +5,4 @@ include $(TOP)/configs/linux
CONFIG_NAME = linux-debug
OPT_FLAGS = -g
DEFINES += -DDEBUG -DMESA_DEBUG -DRUN_DEBUG_BENCHMARK
DEFINES += -DDEBUG -DDEBUG_MATH

View File

@@ -17,7 +17,8 @@ HAVE_X86 = $(shell uname -m | grep 'i[3-6]86' >/dev/null && echo yes)
ifeq ($(HAVE_X86), yes)
CFLAGS += -DUSE_X86_ASM -DUSE_MMX_ASM -DUSE_3DNOW_ASM -DUSE_SSE_ASM
CXXFLAGS += -DUSE_X86_ASM -DUSE_MMX_ASM -DUSE_3DNOW_ASM -DUSE_SSE_ASM
ASM_SOURCES = $(X86_SOURCES) $(X86_API)
ASM_SOURCES = $(X86_SOURCES)
ASM_API = $(X86_API)
endif
# Directories

View File

@@ -9,12 +9,11 @@ CONFIG_NAME = linux-dri
CC = gcc
CXX = g++
MKDEP = /usr/X11R6/bin/makedepend
#MKDEP = /usr/X11R6/bin/makedepend
#MKDEP = gcc -M
#MKDEP_OPTIONS = -MF depend
WARN_FLAGS = -Wall
OPT_FLAGS = -O -g
OPT_FLAGS = -g
PIC_FLAGS = -fPIC
# Add '-DGLX_USE_TLS' to ARCH_FLAGS to enable TLS support.
@@ -27,10 +26,10 @@ DEFINES = -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE \
X11_INCLUDES = -I/usr/X11R6/include
CFLAGS = $(WARN_FLAGS) $(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) $(DEFINES) \
$(ASM_FLAGS) -std=c99 -ffast-math
CFLAGS = -Wall -Wmissing-prototypes $(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) \
$(DEFINES) $(ASM_FLAGS) -std=c99 -ffast-math
CXXFLAGS = $(WARN_FLAGS) $(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) $(DEFINES)
CXXFLAGS = -Wall $(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) $(DEFINES)
ASM_SOURCES =
@@ -64,5 +63,7 @@ WINDOW_SYSTEM=dri
# gamma are missing because they have not been converted to use the new
# interface.
DRI_DIRS = i810 i830 i915 mach64 mga r128 r200 r300 radeon s3v \
DRI_DIRS = i810 i915 mach64 mga r128 r200 r300 radeon s3v \
savage sis tdfx trident unichrome ffb
DRI_DIRS = i915

View File

@@ -13,4 +13,5 @@ ARCH_FLAGS = -m32
ASM_FLAGS = -DUSE_X86_ASM -DUSE_MMX_ASM -DUSE_3DNOW_ASM -DUSE_SSE_ASM
ASM_SOURCES = $(X86_SOURCES)
ASM_API = $(X86_API)

View File

@@ -8,7 +8,8 @@ CONFIG_NAME = linux-dri-x86-64
ARCH_FLAGS = -m64
ASM_FLAGS = -DUSE_X86_64_ASM
ASM_SOURCES = $(X86-64_SOURCES) $(X86-64_API)
ASM_SOURCES = $(X86-64_SOURCES)
ASM_API = $(X86-64_API)
LIB_DIR = $(TOP)/lib64

View File

@@ -16,6 +16,7 @@ GL_LIB_DEPS = -L/usr/X11R6/lib -lX11 -lXext -lm -lpthread
GLUT_LIB_DEPS = -L$(LIB_DIR) -l$(GLU_LIB) -l$(GL_LIB) -L/usr/X11R6/lib -lX11 -lXmu -lXt -lXi -lm
APP_LIB_DEPS = -L$(LIB_DIR) -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) -lm
ASM_SOURCES = $(X86_SOURCES) $(X86_API)
ASM_SOURCES = $(X86_SOURCES)
ASM_API = $(X86_API)

View File

@@ -24,6 +24,7 @@ GLUT_LIB_DEPS = -L$(LIB_DIR) -l$(GLU_LIB) -l$(GL_LIB) -L/usr/X11R6/lib -lX11 -lX
APP_LIB_DEPS = -L$(LIB_DIR) -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) -L/usr/X11R6/lib -lX11 -lXmu -lXt -lXi -lm
MKLIB_OPTIONS = -arch icc
ASM_SOURCES = $(X86_SOURCES) $(X86_API)
ASM_SOURCES = $(X86_SOURCES)
ASM_API = $(X86_API)

View File

@@ -8,9 +8,9 @@ CONFIG_NAME = linux-profile
CC = gcc
CXX = g++
CFLAGS = -pg -O -ansi -pedantic -Wall -Wmissing-prototypes -Wundef -fPIC -ffast-math -D_POSIX_SOURCE -D_SVID_SOURCE -D_BSD_SOURCE -I/usr/X11R6/include -DUSE_XSHM -DPTHREADS -DDEBUG -DMESA_DEBUG
CFLAGS = -pg -O -ansi -pedantic -Wall -Wmissing-prototypes -Wundef -fPIC -ffast-math -D_POSIX_SOURCE -D_SVID_SOURCE -D_BSD_SOURCE -I/usr/X11R6/include -DUSE_XSHM -DPTHREADS -DDEBUG
CXXFLAGS = -pg -O -ansi -pedantic -Wall -Wundef -fPIC -ffast-math -D_POSIX_SOURCE -D_SVID_SOURCE -D_BSD_SOURCE -DDEBUG -DMESA_DEBUG
CXXFLAGS = -pg -O -ansi -pedantic -Wall -Wundef -fPIC -ffast-math -D_POSIX_SOURCE -D_SVID_SOURCE -D_BSD_SOURCE -DDEBUG
GLUT_CFLAGS = -fexceptions

View File

@@ -10,3 +10,4 @@ PIC_FLAGS =
ASM_FLAGS = -DUSE_X86_ASM -DUSE_MMX_ASM -DUSE_3DNOW_ASM -DUSE_SSE_ASM
ASM_SOURCES = $(X86_SOURCES)
ASM_API = $(X86_API)

View File

@@ -1,22 +0,0 @@
# Configuration for debugging on Linux
include $(TOP)/configs/default
CONFIG_NAME = linux-tcc
# Compiler and flags
CC = gcc
CXX = g++
TCC_DIR=/home/progs/tcc-0.9.20
CFLAGS = -g -ansi -pedantic -Wall -Wmissing-prototypes -Wundef -fPIC -ffast-math -D_POSIX_SOURCE -D_SVID_SOURCE -D_BSD_SOURCE -I/usr/X11R6/include -DUSE_XSHM -DPTHREADS -DDEBUG -DMESA_DEBUG -DUSE_TCC -I$(TCC_DIR)
CXXFLAGS = -g -ansi -pedantic -Wall -Wundef -fPIC -ffast-math -D_POSIX_SOURCE -D_SVID_SOURCE -D_BSD_SOURCE -DDEBUG -DMESA_DEBUG
GLUT_CFLAGS = -fexceptions
GL_LIB_DEPS = -L/usr/X11R6/lib -lX11 -lXext -lm -lpthread -L$(TCC_DIR) -ltcc -ldl
GLUT_LIB_DEPS = -L$(LIB_DIR) -l$(GLU_LIB) -l$(GL_LIB) -L/usr/X11R6/lib -lX11 -lXmu -lXt -lXi -lm
GLW_LIB_DEPS = -L$(LIB_DIR) -l$(GL_LIB) -lXt -L/usr/X11R6/lib -lX11
APP_LIB_DEPS = -L$(LIB_DIR) -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) -lm

View File

@@ -5,4 +5,5 @@ include $(TOP)/configs/linux
CONFIG_NAME = linux-x86
ASM_FLAGS = -DUSE_X86_ASM -DUSE_MMX_ASM -DUSE_3DNOW_ASM -DUSE_SSE_ASM
ASM_SOURCES = $(X86_SOURCES) $(X86_API)
ASM_SOURCES = $(X86_SOURCES)
ASM_API = $(X86_API)

View File

@@ -6,7 +6,8 @@ CONFIG_NAME = linux-x86-64
ARCH_FLAGS = -m64
ASM_SOURCES = $(X86-64_SOURCES) $(X86-64_API)
ASM_SOURCES = $(X86-64_SOURCES)
ASM_API = $(X86-64_API)
ASM_FLAGS = -DUSE_X86_64_ASM
LIB_DIR = $(TOP)/lib64

View File

@@ -4,4 +4,4 @@ include $(TOP)/configs/linux-x86-64
CONFIG_NAME = linux-x86-64-debug
DEFINES += -DDEBUG -DMESA_DEBUG -DRUN_DEBUG_BENCHMARK
DEFINES += -DDEBUG -DDEBUG_MATH

View File

@@ -6,4 +6,4 @@ include $(TOP)/configs/linux-x86
CONFIG_NAME = linux-x86-debug
OPT_FLAGS = -g
DEFINES += -DDEBUG -DMESA_DEBUG -DRUN_DEBUG_BENCHMARK
DEFINES += -DDEBUG -DDEBUG_MATH

View File

@@ -15,7 +15,8 @@ CXXFLAGS = -Wall -O3 -ansi -pedantic -fPIC -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199
GLUT_CFLAGS = -fexceptions
ASM_SOURCES = $(X86_SOURCES) $(X86_API)
ASM_SOURCES = $(X86_SOURCES)
ASM_API = $(X86_API)
# Library/program dependencies
GL_LIB_DEPS = -L/usr/X11R6/lib -lX11 -lXext -L/usr/local/glide/lib -lglide3x -lm -lpthread

View File

@@ -15,7 +15,8 @@ CXXFLAGS = -Wall -O3 -ansi -pedantic -fPIC -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199
GLUT_CFLAGS = -fexceptions
ASM_SOURCES = $(X86_SOURCES) $(X86_API)
ASM_SOURCES = $(X86_SOURCES)
ASM_API = $(X86_API)
# Library/program dependencies
GL_LIB_DEPS = -L/usr/X11R6/lib -lX11 -lXext -lm -lpthread -lXCB

View File

@@ -16,7 +16,8 @@ ARCH_FLAGS ?=
DEFINES = -D_REENTRANT -DUSE_XSHM
ASM_SOURCES = $(SPARC_SOURCES) $(SPARC_API)
ASM_SOURCES = $(SPARC_SOURCES)
ASM_API = $(SPARC_API)
ASM_FLAGS = -DUSE_SPARC_ASM
CFLAGS = $(WARN_FLAGS) $(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) $(DEFINES) \

View File

@@ -26,3 +26,13 @@ On Alpha platforms at default a sharable images for the libraries are created.
To get a static library make it by typing MMS/MACRO=(NOSHARE=1).
On VAX platforms only static libraries can be build.
23-sep-2005
changed default compilation to use /float=ieee/ieee=denorm. The reason for
this is that it makes Mesa on OpenVMS better compatible with other platforms
and other packages for VMS that I maintain.
For more information see
http://nchrem.tnw.tudelft.nl/openvms
https://bugs.freedesktop.org/show_bug.cgi?id=4270
You may want to compile Mesa to use VAX-floating point arithmetic, instead
of IEEE floating point by removing the /float=IEEE/denorm flag from the
compiler options in the descrip.mms files.

50
docs/RELNOTES-6.4 Normal file
View File

@@ -0,0 +1,50 @@
Mesa 6.4 Release Notes
October 24, 2005
Introduction
------------
Mesa uses an even/odd version number scheme like the Linux kernel.
Odd numbered versions (such as 6.3) designate new developmental releases.
Even numbered versions (such as 6.4) designate stable releases.
6.4 is a bug-fix release. See the VERSIONS file for details.
GLUT tarball
------------
Starting with 6.4, the GLUT library sources are distributed in a separate
tarball. This was done at the request of Linux distro vendors who prefer
to use freeglut.
Driver Status
---------------------- ----------------------
DRI drivers varies with the driver
XMesa (Xlib) implements OpenGL 1.5
OSMesa (off-screen) implements OpenGL 1.5
Windows/Win32 implements OpenGL 1.5
Glide (3dfx Voodoo1/2) requires updates
SVGA requires updates
DJGPP requires updates
GGI requires updates
BeOS requires updates
Allegro requires updates
D3D requires updates
The drivers which require updates mostly need to be updated to work
with the new gl_renderbuffer / gl_framebuffer infrastructure introduced
in Mesa 6.3.
----------------------------------------------------------------------
$Id: RELNOTES-6.4,v 3.1 2005/10/24 23:33:27 brianp Exp $

74
docs/RELNOTES-6.5 Normal file
View File

@@ -0,0 +1,74 @@
Mesa 6.5 Release Notes
month, day, 2005
Introduction
------------
Mesa uses an even/odd version number scheme like the Linux kernel.
Odd numbered versions (such as 6.5) designate new developmental releases.
Even numbered versions (such as 6.4) designate stable releases.
New Features
------------
GL_EXT_timer_query - used to get elapsed time information from the renderer.
Driver Interface Changes
------------------------
Stencil: The Driver.StencilOp/Func/Mask() functions have been replaced by
the two-sided versions: Driver.Stencil*Separate().
To Do
-----
Fix linux-glide target/driver.
Fix lambda calculation for frag progs.
Removed Extensions
------------------
The following extensions have been removed:
GL_HP_occlusion_test - this is superceded by GL_ARB_occlusion_query.
To Do (someday) items
---------------------
Switch to freeglut
Increase MAX_DRAWBUFFERS
Driver Status
---------------------- ----------------------
DRI drivers varies with the driver
XMesa (Xlib) implements OpenGL 1.5
OSMesa (off-screen) implements OpenGL 1.5
Glide (3dfx Voodoo1/2) implements OpenGL 1.3
SVGA implements OpenGL 1.3
Wind River UGL implements OpenGL 1.3
Windows/Win32 implements OpenGL 1.5
DJGPP implements OpenGL 1.5
GGI implements OpenGL 1.3
BeOS implements OpenGL 1.5
Allegro needs updating
D3D needs updating
----------------------------------------------------------------------
$Id: RELNOTES-6.5,v 3.1 2005/09/14 14:34:54 brianp Exp $

View File

@@ -1372,3 +1372,56 @@ Mesa Version History
- wglGetProcAddress() didn't handle wgl-functions
- fixed glxext.h cross-compile issue (Colin Harrison)
- assorted DRI driver fixes
6.4 October 24, 2005
New:
- Added a fast XOR line drawing function in Xlib driver
- Added support for GL_ARB_texture_mirrored_repeat to savage
driver (supported only on Savage4 hardware).
Changes:
- Mesa now packaged in three parts: Library, Demos and GLUT
Bug fixes:
- GLX_X_RENDERABLE token wasn't accepted by glXChooseFBConfig
- Some files were present multiple times in the 6.3.2 tarballs
- r200_vtxtmp_x86.S file was missing from 6.3.2 tarball (bug 4207)
- glxgears_fbconfig demo didn't work (bug 4237)
- fixed bug when bilinear sampling 2d textures with borders
- glXCreatePbuffer() could segfault instead of returning 0 (bug 4235)
- fixed undefined frexp and rand in X.org libGLcore.a (bug 4242)
- fixed a few problems with proxy color tables (bug 4270)
- fixed precision problem in Z clearing (bug 4395)
- glBitmap, glDraw/CopyPixels mistakenly generated selection hits
- fixed potential segfault caused by reading pixels outside
of renderbuffer bounds
- glGetTexLevelParameter didn't accept GL_TEXTURE_DEPTH_SIZE_ARB
- fixed memory corruption bug involving software alpha buffers
- glReadPixels clipped by window bounds was sometimes broken
- glDraw/CopyPixels of stencil data ignored the stencil write mask
- glReadPixels from a texture bound to a framebuffer object didn't work
- glIsRender/FramebufferEXT weren't totally correct
- fixed a number of point size attenuation/fade bugs
- fixed glFogCoord bug 4729
- GLX encoding for transpose matrix functions was broken
- fixed broken fragment program KIL and SWZ instructions
- fragment programs that wrote result.depth.z didn't work
6.5 month, day, 2005
New:
- GL_EXT_packed_depth_stencil extension
- GL_EXT_timer_query extension
- reflect demo improved to support multiple windows
- singlebuffer demo (shows no/little-flicker single-buffered rendering)
- r200: enable GL_ARB_texture_env_crossbar, separate the texture
sampling unit bits from the texture env combine enable bits
- r200: add support for GL_ATI_fragment_shader
- added fast XOR-mode line drawing optimization
- radeon: add support for all 3 tmus, GL_ARB_texture_cube_map
and GL_EXT_fog_coord
- MESA_GLX_ALPHA_BITS env var for xlib driver
Changes:
- removed GL_HP_occlusion_test (use GL_ARB_occlusion_query instead)
- removed GL_SGIX/SGIS_pixel_texture extensions
Bug fixes:

View File

@@ -37,8 +37,6 @@ a:visited {
<b>Download / Install</b>
<ul>
<li><a href="http://www.sourceforge.net/projects/mesa3d" target="_parent">Stable Release (6.2.1)</a>
<li><a href="http://www.sourceforge.net/projects/mesa3d" target="_parent">Devel Release (6.3.2)</a>
<li><a href="download.html" target="MainFrame">Downloading/Unpacking</a>
<li><a href="install.html" target="MainFrame">Compilation/Installation</a>
<li><a href="glu.html" target="MainFrame">SGI's GLU</a>
@@ -81,7 +79,7 @@ a:visited {
<b>Links</b>
<ul>
<li><a href="http://www.opengl.org" target="_parent">OpenGL website</a>
<li><a href="http://dri.sourceforge.net" target="_parent">DRI website</a>
<li><a href="http://dri.freedesktop.org" target="_parent">DRI website</a>
<li><a href="http://www.freedesktop.org" target="_parent">freedesktop.org</a>
<li><a href="games.html" target="MainFrame">Games and Entertainment</a>
<li><a href="libraries.html" target="MainFrame">Libraries and Toolkits</a>
@@ -91,9 +89,13 @@ a:visited {
<li><a href="demos.html" target="MainFrame">Demos / other</a>
</ul>
<b>Hosted by:</b>
<br>
<blockquote>
<A HREF="http://sourceforge.net"
target="_parent"><IMG SRC="http://sourceforge.net/sflogo.php?group_id=3&type=1"
WIDTH="88" HEIGHT="31" ALIGN="BOTTOM" ALT="Sourceforge.net" BORDER="0"></A>
</blockquote>
</body>
</html>
</html>

View File

@@ -6,101 +6,129 @@
<BODY>
<H1>Downloading / Unpacking</H1>
<H1>Downloading</H1>
<p>
Mesa can be downloaded from the
<a href="http://www.sourceforge.net/projects/mesa3d" target="_parent">
SourceForge download area</A>.
Last development release: <b>6.3.2</b>
</p>
<p>
Since version 2.3, Mesa is distributed in two pieces: main library code
and demos. If you're upgrading from a previous version of Mesa or you're not
interested in the demos you can just download the core Mesa archive file.
Last stable release: <b>6.2.1</b>
</p>
<p>
Mesa is available in at least three archive formats:
Primary download site:
<a href="http://sourceforge.net/project/showfiles.php?group_id=3"
target="_parent">SourceForge</a>
</p>
<p>
Mesa is distributed in several parts:
</p>
<ul>
<li><b>MesaLib-x.y.z</b> - the main Mesa library source code, drivers
and documentation.
</li>
<li><b>MesaDemos-x.y.z</b> - OpenGL demonstration and test programs.
Most of the programs require GLUT (either the
<a href="http://www.opengl.org/resources/libraries/glut.html"
target="_parent">original GLUT by Mark Kilgard</a> or
<a href="http://freeglut.sourceforge.net" target="_parent">freeglut</a> or
<a href="http://freeglut.sourceforge.net" target="_parent">OpenGLUT</a>).
</li>
<li><b>MesaGLUT-x.y.z</b> - Mark Kilgard's GLUT, easily compiled and used
with Mesa. Plus, other implementation of GLUT for DOS, OS/2, BeOS, etc.
</li>
</ul>
<p>
If you're not interested in running the demos, you'll only need the first
package.
</p>
<p>
The packages are available in .tar.gz, .tar.bz2 and .zip formats.
Other organizations might offer additional package formats.
</p>
<H1>Unpacking</H1>
<p>
All the packages should be in the same directory prior to unpacking.
</p>
<ul>
<li>To unpack .tar.gz files:
<pre>
1. GNU zip/tar
Download MesaLib-X.Y.tar.gz and optionally MesaDemos-X.Y.tar.gz
Unpack with:
gzcat MesaLib-X.Y.tar.gz | tar xf -
gzcat MesaDemos-X.Y.tar.gz | tar xf -
or
gunzip MesaLib-X.Y.tar.gz ; tar xf MesaLib-X.Y.tar
gunzip MesaDemos-X.Y.tar.gz ; tar xf MesaLib-X.Y.tar
or
tar zxf MesaLib-X.Y.tar.gz
tar zxf MesaDemos-X.Y.tar.gz
If you don't have gzcat try zcat instead.
2. Unix compressed/tar
Download MesaLib-X.Y.tar.Z and optionally MesaDemos-X.Y.tar.Z
Unpack with:
zcat MesaLib-X.Y.tar.Z | tar xf -
zcat MesaDemos-X.Y.tar.Z | tar xf -
3. ZIP format
Download MesaLib-X.Y.zip and optionally MesaDemos-X.Y.zip
Unpack with:
unzip MesaLib-X.Y.zip
unzip MesaDemos-X.Y.zip
tar zxf MesaLib-X.Y.tar.gz
tar zxf MesaDemos-X.Y.tar.gz
tar zxf MesaGLUT-X.Y.tar.gz
</pre>
or
<pre>
gzcat MesaLib-X.Y.tar.gz | tar xf -
gzcat MesaDemos-X.Y.tar.gz | tar xf -
gzcat MesaGLUT-X.Y.tar.gz | tar xf -
</pre>
or
<pre>
gunzip MesaLib-X.Y.tar.gz ; tar xf MesaLib-X.Y.tar
gunzip MesaDemos-X.Y.tar.gz ; tar xf MesaDemos-X.Y.tar
gunzip MesaGLUT-X.Y.tar.gz ; tar xf MesaGLUT-X.Y.tar
</pre>
<li>To unpack .tar.bz2 files:
<pre>
bunzip2 -c MesaLib-X.Y.tar.gz | tar xf -
bunzip2 -c MesaDemos-X.Y.tar.gz | tar xf -
bunzip2 -c MesaGLUT-X.Y.tar.gz | tar xf -
</pre>
<li>To unpack .zip files:
<pre>
unzip MesaLib-X.Y.zip
unzip MesaDemos-X.Y.zip
unzip MesaGLUT-X.Y.zip
</pre>
</ul>
<h1>Contents</h1>
<p>
After unpacking you'll have these directories (and more):
After unpacking you'll have these directories:
</p>
<pre>
Makefile.X11 - top-level Makefile for X11-based systems
Make-config - system configurations used by the Makefile.X11
Makefile - top-level Makefile for most systems
configs/ - makefile parameter files for various systems
include/ - GL header (include) files
bin/ - shell scripts for making shared libraries, etc
lib/ - final client libraries, created during compilation
docs/ - documentation
src/ - source code for libraries
src/mesa - sources for the main Mesa library and device drivers
src/glu - libGLU source code
src/glw - Xt/Motif/OpenGL widget code
</pre>
If you downloaded and unpacked the MesaDemos.X.Y package:
and if you downloaded and unpacked the MesaDemos.X.Y archive:
src/glut - GLUT source code
progs/ - OpenGL programs
<pre>
progs/demos - original Mesa demos
progs/xdemos - GLX OpenGL/Mesa demos
progs/redbook - examples from the OpenGL Programming Guide
progs/samples - examples from SGI
progs/images/ - image files
</pre>
If you downloaded and unpacked the MesaGLUT.X.Y package:
<pre>
src/glut - GLUT library source code
</pre>
<p>
Proceed to <a href="install.html">compilation and installation
Proceed to the <a href="install.html">compilation and installation
instructions</a>.
</p>
<H1>GLUT</H1>
<p>
Mesa 2.5 and later includes Mark Kilgard's GLUT library (GL Utility Toolkit).
GLUT is built automatically on systems which support it.
</p>
<p>
The GLUT tests, demos, examples, etc are not included, just the main library.
To obtain the latest complete release of GLUT please visit the
<a href="http://www.opengl.org/resources/libraries/glut.html"
target ="_parent">GLUT page</a> on www.opengl.org.
</p>
</BODY>
</HTML>

View File

@@ -37,6 +37,7 @@ software driver:
"window" to render into a window, or "disable" to disable the Glide driver.
<li>MESA_GLX_FORCE_ALPHA - if set, forces RGB windows to have an alpha channel.
<li>MESA_GLX_DEPTH_BITS - specifies default number of bits for depth buffer.
<li>MESA_GLX_ALPHA_BITS - specifies default number of bits for alpha channel.
</ul>

View File

@@ -9,7 +9,7 @@
<center>
<h1>Mesa Frequently Asked Questions</h1>
Last updated: 17 November 2004
Last updated: 21 October 2004
</center>
<br>
@@ -39,14 +39,14 @@ See the </a><a href="http://www.opengl.org/">OpenGL website</a> for more
information.
</p>
<p>
Mesa 5.x supports the OpenGL 1.4 specification.
Mesa 6.x supports the OpenGL 1.5 specification.
</p>
<h2>1.2 Does Mesa support/use graphics hardware?</h2>
<p>
Yes. Specifically, Mesa serves as the OpenGL core for the open-source
XFree86/DRI OpenGL drivers. See the <a href="http://dri.sf.net/">DRI
Yes. Specifically, Mesa serves as the OpenGL core for the open-source DRI
drivers for XFree86/X.org. See the <a href="http://dri.sf.net/">DRI
website</a> for more information.
</p>
<p>
@@ -62,7 +62,8 @@ operating systems today.
Still, Mesa serves at least these purposes:
</p>
<ul>
<li>Mesa is used as the core of the open-source XFree86/DRI hardware drivers.
<li>Mesa is used as the core of the open-source XFree86/X.org DRI
hardware drivers.
</li>
<li>Mesa is quite portable and allows OpenGL to be used on systems
that have no other OpenGL solution.
@@ -86,8 +87,8 @@ Still, Mesa serves at least these purposes:
<h2>1.4 What's the difference between"Stand-Alone" Mesa and the DRI drivers?</h2>
<p>
<em>Stand-alone Mesa</em> is the original incarnation of Mesa.
On systems running the X Window System, it does all its rendering through
the Xlib API.
On systems running the X Window System it does all its rendering through
the Xlib API:
<ul>
<li>The GLX API is supported, but it's really just an emulation of the
real thing.
@@ -116,21 +117,10 @@ within the DRI (Direct Rendering Infrastructure):
<h2>1.5 How do I upgrade my DRI installation to use a new Mesa release?</h2>
<p>
You don't! A copy of the Mesa source code lives inside the XFree86/DRI source
tree and gets compiled into the individual DRI driver modules.
If you try to install Mesa over an XFree86/DRI installation, you'll lose
hardware rendering (because stand-alone Mesa's libGL.so is different than
the XFree86 libGL.so).
</p>
<p>
The DRI developers will incorporate the latest release of Mesa into the
DRI drivers when the time is right.
</p>
<p>
To upgrade, either look for a new release of <a href="http://www.xfree86.org"
target="_parent">XFree86</a> or visit the
<a href="http://dri.sf.net" target="_parent">DRI website</a> to see
if there's newer drivers.
This wasn't easy in the past.
Now, the DRI drivers are included in the Mesa tree and can be compiled
separately from the X server.
Just follow the Mesa <a href="install.html">compilation instructions</a>.
</p>
@@ -201,7 +191,7 @@ Mesa no longer supports GNU autoconf/automake. Why?
</ul>
<p>
Now, Mesa again uses a conventional Makefile system (as it did originally).
Now Mesa again uses a conventional Makefile system (as it did originally).
Basically, each Makefile in the tree includes one of the configuration
files from the config/ directory.
The config files specify all the variables for a variety of popular systems.
@@ -219,9 +209,9 @@ Mesa's not the solution.
<h2><a name="part2">2.4 Where is the GLUT library?</a></h2>
<p>
<a name="part2">GLUT (OpenGL Utility Toolkit) is in the separate MesaDemos-x.y.z.tar.gz file.
If you don't already have GLUT installed, you should grab the MesaDemos
package and unpack it before compiling Mesa.
<a name="part2">GLUT (OpenGL Utility Toolkit) is in the separate MesaGLUT-x.y.z.tar.gz file.
If you don't already have GLUT installed, you should grab the MesaGLUT
package and compile it with the rest of Mesa.
</a></p>
@@ -250,7 +240,7 @@ Mesa version number.
version number.
</li></ul>
<p>
After installing XFree86 and the DRI drivers, some of these files
After installing XFree86/X.org and the DRI drivers, some of these files
may be symlinks into the /usr/X11R6/ tree.
</p>
<p>

View File

@@ -136,7 +136,7 @@ GL_ARB_fragment_program extensions.
<p>
Ongoing: Mesa is used as the core of many hardware OpenGL drivers for
the XFree86 X.org X servers within the
<A href="http://dri.sourceforge.net/" target="_parent">DRI project</A>.
<A href="http://dri.freedesktop.org/" target="_parent">DRI project</A>.
I continue to enhance Mesa with new extensions and features.
</p>

View File

@@ -32,7 +32,7 @@
- VRML viewer
</li><li><a href="http://aig.cs.man.ac.uk/systems/Maverik/" target="_parent">Maverik</a>
- VR graphics and interaction system
</li><li><a href="http://www.swissquake.ch/chumb.alum-soft" target="_parent">MD2 Viewer</a>
</li><li><a href="http://www.swissquake.ch/chumbalum-soft/md2v" target="_parent">MD2 Viewer</a>
- View .MD2 files
</li><li><a href="http://www.megacads.dlr.de/" target="_parent">MegaCads</a>
- Multiblock-Elliptic-Grid-Generation-And-CAD-System
@@ -62,8 +62,6 @@
</li><li><a href="http://mesa3d.sourceforge.net/notfound.html">VRweb</a> - VRML browser
</li><li><a href="http://www.csv.ica.uni-stuttgart.de/vrml/dune/" target="_parent">white_dune</a>
- graphical VRML97 Editor and animation tool
</li><li><a href="http://www.wings3d.org/" target="_parent">Wings 3D</a> - static 3D modeller
with VRML export. Uses SDL library.
</li></ul>

View File

@@ -11,6 +11,57 @@
<H1>News</H1>
<h2>October 24, 2005</h2>
<p>
Mesa 6.4 has been released. This is a stable, bug-fix release.
</p>
<pre>
New:
- Added a fast XOR line drawing function in Xlib driver
- Added support for GL_ARB_texture_mirrored_repeat to savage
driver (supported only on Savage4 hardware).
Changes:
- Mesa now packaged in three parts: Library, Demos and GLUT
Bug fixes:
- GLX_X_RENDERABLE token wasn't accepted by glXChooseFBConfig
- Some files were present multiple times in the 6.3.2 tarballs
- r200_vtxtmp_x86.S file was missing from 6.3.2 tarball (bug 4207)
- glxgears_fbconfig demo didn't work (bug 4237)
- fixed bug when bilinear sampling 2d textures with borders
- glXCreatePbuffer() could segfault instead of returning 0 (bug 4235)
- fixed undefined frexp and rand in X.org libGLcore.a (bug 4242)
- fixed a few problems with proxy color tables (bug 4270)
- fixed precision problem in Z clearing (bug 4395)
- glBitmap, glDraw/CopyPixels mistakenly generated selection hits
- fixed potential segfault caused by reading pixels outside
of renderbuffer bounds
- glGetTexLevelParameter didn't accept GL_TEXTURE_DEPTH_SIZE_ARB
- fixed memory corruption bug involving software alpha buffers
- glReadPixels clipped by window bounds was sometimes broken
- glDraw/CopyPixels of stencil data ignored the stencil write mask
- glReadPixels from a texture bound to a framebuffer object didn't work
- glIsRender/FramebufferEXT weren't totally correct
- fixed a number of point size attenuation/fade bugs
- fixed glFogCoord bug 4729
- GLX encoding for transpose matrix functions was broken
- fixed broken fragment program KIL and SWZ instructions
</pre>
<p>
The MD5 checksums are:
</p>
<pre>
1cce0c1eb4fd15e9dfe837a1ce0c9812 MesaLib-6.4.tar.gz
85a84e47a3f718f752f306b9e0954ef6 MesaLib-6.4.tar.bz2
b976fea4f3ee06354c53f91b6e3f2ffc MesaLib-6.4.zip
d8734f2c69bcf7ef9f5ae454a85743ba MesaDemos-6.4.tar.gz
1a8c4d4fc699233f5fdb902b8753099e MesaDemos-6.4.tar.bz2
607ab7c7a7de0cc5febbdde2bfa03098 MesaDemos-6.4.zip
3260156f66174322a092be0767962d34 MesaGLUT-6.4.tar.gz
0465d053f83775f44a12dec4050dfd78 MesaGLUT-6.4.tar.bz2
02abfcdcdf72ba938ae00f6e3b70fbe0 MesaGLUT-6.4.zip
</pre>
<h2>August 19, 2005</h2>
<p>
Mesa 6.3.2 has been released.
@@ -1051,6 +1102,6 @@ source code</a>.</p>
<hr>
$Id: news.html,v 3.24 2005/08/19 23:42:29 brianp Exp $
$Id: news.html,v 3.25 2005/10/24 23:33:27 brianp Exp $
</body>
</html>

View File

@@ -13,6 +13,7 @@ The release notes summarize what's new or changed in each Mesa release.
</p>
<UL>
<LI><A HREF="RELNOTES-6.4">RELNOTES-6.4</A>
<LI><A HREF="RELNOTES-6.3.2">RELNOTES-6.3.2</A>
<LI><A HREF="RELNOTES-6.3">RELNOTES-6.3</A>
<LI><A HREF="RELNOTES-6.2.1">RELNOTES-6.2.1</A>

View File

@@ -33,7 +33,7 @@ Be warned that some drivers may be out of date and no longer function.
<UL>
<LI>Xlib driver for the X Window System <A HREF="README.X11">(README.X11)</A>
<li><a href="http://dri.sourceforge.net/" target="_parent">
<li><a href="http://dri.freedesktop.org/" target="_parent">
DRI hardware drivers</a> for the X window system
<LI>Microsoft Windows <A HREF="README.WIN32">(README.WIN32)</A>
<LI>DEC VMS <A HREF="README.VMS">(README.VMS)</A>
@@ -53,4 +53,4 @@ DRI hardware drivers</a> for the X window system
</UL>
</body>
</html>
</html>

View File

@@ -2231,6 +2231,46 @@ typedef void (APIENTRYP PFNGLBLENDEQUATIONSEPARATEATIPROC) (GLenum modeRGB, GLen
#endif /* GL_ATI_blend_equation_separate */
#ifndef GL_EXT_timer_query
#define GL_EXT_timer_query 1
/* Define 64-bit types */
#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
typedef long long int GLint64EXT;
typedef unsigned long long int GLuint64EXT;
#elif defined(_WIN32)
typedef __int64 GLint64EXT;
typedef unsigned __int64 GLuint64EXT;
#else
/* this might actually be a 32-bit type */
typedef long int GLint64EXT;
typedef unsigned long int GLuint64EXT;
#endif
#define GL_TIME_ELAPSED_EXT 0x88BF
GLAPI void GLAPIENTRY glGetQueryObjecti64vEXT(GLuint id, GLenum pname, GLint64EXT *params);
GLAPI void GLAPIENTRY glGetQueryObjectui64vEXT(GLuint id, GLenum pname, GLuint64EXT *params);
typedef void (APIENTRYP PFNGLGETQUERYOBJECTI64VEXTPROC) (GLuint id, GLenum pname, GLint64EXT *params);
typedef void (APIENTRYP PFNGLGETQUERYOBJECTUI64VEXTPROC) (GLuint id, GLenum pname, GLuint64EXT *params);
#endif /* GL_EXT_timer_query */
#ifndef GL_EXT_packed_depth_stencil
#define GL_EXT_packed_depth_stencil 1
#define GL_DEPTH_STENCIL_EXT 0x84F9
#define GL_UNSIGNED_INT_24_8_EXT 0x84FA
#define GL_DEPTH24_STENCIL8_EXT 0x88F0
#define GL_TEXTURE_STENCIL_SIZE_EXT 0x88F1
#endif /* GL_EXT_packed_depth_stencil */
/**
** NOTE!!!!! If you add new functions to this file, or update
** glext.h be sure to regenerate the gl_mangle.h file. See comments

View File

@@ -520,8 +520,10 @@
#define glGetProgramStringNV MANGLE(GetProgramStringNV)
#define glGetQueryivARB MANGLE(GetQueryivARB)
#define glGetQueryiv MANGLE(GetQueryiv)
#define glGetQueryObjecti64vEXT MANGLE(GetQueryObjecti64vEXT)
#define glGetQueryObjectivARB MANGLE(GetQueryObjectivARB)
#define glGetQueryObjectiv MANGLE(GetQueryObjectiv)
#define glGetQueryObjectui64vEXT MANGLE(GetQueryObjectui64vEXT)
#define glGetQueryObjectuivARB MANGLE(GetQueryObjectuivARB)
#define glGetQueryObjectuiv MANGLE(GetQueryObjectuiv)
#define glGetRenderbufferParameterivEXT MANGLE(GetRenderbufferParameterivEXT)

View File

@@ -1,8 +1,8 @@
/*
* Mesa 3-D graphics library
* Version: 5.1
* Version: 6.5
*
* Copyright (C) 1999-2003 Brian Paul All Rights Reserved.
* Copyright (C) 1999-2005 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -65,7 +65,7 @@ glFBDevGetString( int str );
typedef void (*GLFBDevProc)();
extern const GLFBDevProc
extern GLFBDevProc
glFBDevGetProcAddress( const char *procName );

View File

@@ -1,6 +1,6 @@
/*
* Mesa 3-D graphics library
* Version: 6.3
* Version: 6.5
*
* Copyright (C) 1999-2005 Brian Paul All Rights Reserved.
*
@@ -302,138 +302,6 @@ extern void (*glXGetProcAddress(const GLubyte *procname))( void );
#else
/*
* 28. GLX_EXT_visual_info extension
*/
#ifndef GLX_EXT_visual_info
#define GLX_EXT_visual_info 1
#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
#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
extern void glXCopySubBufferMESA( Display *dpy, GLXDrawable drawable,
int x, int y, int width, int height );
#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 Bool glXSet3DfxModeMESA( int mode );
#endif /* GLX_MESA_set_3dfx_mode */
/*
* ARB 2. GLX_ARB_get_proc_address
@@ -441,7 +309,8 @@ extern Bool glXSet3DfxModeMESA( int mode );
#ifndef GLX_ARB_get_proc_address
#define GLX_ARB_get_proc_address 1
extern void (*glXGetProcAddressARB(const GLubyte *procName))();
typedef void (*__GLXextFuncPtr)(void);
extern __GLXextFuncPtr glXGetProcAddressARB (const GLubyte *);
#endif /* GLX_ARB_get_proc_address */
@@ -469,19 +338,6 @@ typedef void ( * PFNGLXFREEMEMORYNVPROC) (GLvoid *pointer);
#endif /* GLX_NV_vertex_array_range */
/*
* ???. GLX_MESA_agp_offset
*/
#ifndef GLX_MESA_agp_offset
#define GLX_MESA_agp_offset 1
extern GLuint glXGetAGPOffsetMESA(const GLvoid *pointer);
typedef GLuint (* PFNGLXGETAGPOFFSETMESAPROC) (const GLvoid *pointer);
#endif /* GLX_MESA_agp_offset */
/*
* ???. GLX_MESA_allocate_memory
*/
@@ -497,8 +353,10 @@ typedef GLuint (* PFNGLXGETMEMORYOFFSETMESAPROC) (Display *dpy, int scrn, const
#endif /* GLX_MESA_allocate_memory */
/*
* ARB ?. GLX_ARB_render_texture
* XXX This was never finalized!
*/
#ifndef GLX_ARB_render_texture
#define GLX_ARB_render_texture 1

View File

@@ -39,7 +39,6 @@
#define DRI_INTERFACE_H
#include <GL/internal/glcore.h>
#include <xf86drm.h>
#include <drm.h>
/**

View File

@@ -1,8 +1,8 @@
/*
* Mesa 3-D graphics library
* Version: 6.3
* Version: 6.5
*
* Copyright (C) 1999-2003 Brian Paul All Rights Reserved.
* Copyright (C) 1999-2005 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -61,7 +61,7 @@ extern "C" {
#define OSMESA_MAJOR_VERSION 6
#define OSMESA_MINOR_VERSION 3
#define OSMESA_MINOR_VERSION 5
#define OSMESA_PATCH_VERSION 0
@@ -267,6 +267,15 @@ GLAPI OSMESAproc GLAPIENTRY
OSMesaGetProcAddress( const char *funcName );
/**
* Enable/disable color clamping, off by default.
* New in Mesa 6.4.2
*/
GLAPI void GLAPIENTRY
OSMesaColorClamp(GLboolean enable);
#if defined(__BEOS__) || defined(__QUICKDRAW__)
#pragma export off
#endif

View File

@@ -78,7 +78,7 @@ typedef struct wmesa_context *WMesaContext;
* appropriate colormap.
*
* Input:
* hWnd - Window handle
* hDC - Windows device or memory context
* Pal - Palette to use
* rgb_flag - GL_TRUE = RGB mode,
* GL_FALSE = color index mode
@@ -91,7 +91,7 @@ typedef struct wmesa_context *WMesaContext;
*
* Return: a WMesa_context or NULL if error.
*/
extern WMesaContext WMesaCreateContext(HWND hWnd,HPALETTE* pPal,
extern WMesaContext WMesaCreateContext(HDC hDC,HPALETTE* pPal,
GLboolean rgb_flag,
GLboolean db_flag,
GLboolean alpha_flag);

View File

@@ -235,21 +235,23 @@ GLAPI EGLBoolean APIENTRY eglCopyBuffers (EGLDisplay dpy, EGLSurface surface, Na
#ifndef EGL_MESA_screen_surface
#define EGL_MESA_screen_surface 1
#define EGL_BAD_SCREEN_MESA 0x4000
#define EGL_BAD_MODE_MESA 0x4001
#define EGL_SCREEN_COUNT_MESA 0x4002
#define EGL_SCREEN_POSITION_MESA 0x4003
#define EGL_MODE_ID_MESA 0x4004
#define EGL_REFRESH_RATE_MESA 0x4005
#define EGL_OPTIMAL_MODE_MESA 0x4006
#define EGL_SCREEN_BIT_MESA 0x08
#define EGL_BAD_SCREEN_MESA 0x4000
#define EGL_BAD_MODE_MESA 0x4001
#define EGL_SCREEN_COUNT_MESA 0x4002
#define EGL_SCREEN_POSITION_MESA 0x4003
#define EGL_SCREEN_POSITION_GRANULARITY_MESA 0x4004
#define EGL_MODE_ID_MESA 0x4005
#define EGL_REFRESH_RATE_MESA 0x4006
#define EGL_OPTIMAL_MESA 0x4007
#define EGL_INTERLACED_MESA 0x4008
#define EGL_SCREEN_BIT_MESA 0x08
GLAPI EGLBoolean APIENTRY eglChooseModeMESA(EGLDisplay dpy, EGLScreenMESA screen, const EGLint *attrib_list, EGLModeMESA *modes, EGLint modes_size, EGLint *num_modes);
GLAPI EGLBoolean APIENTRY eglGetModesMESA(EGLDisplay dpy, EGLScreenMESA screen, EGLModeMESA *modes, EGLint modes_size, EGLint *num_modes);
GLAPI EGLBoolean APIENTRY eglGetModeAttribMESA(EGLDisplay dpy, EGLModeMESA mode, EGLint attribute, EGLint *value);
GLAPI EGLBoolean APIENTRY eglGetScreensMESA(EGLDisplay dpy, EGLScreenMESA *screens, EGLint max_screens, EGLint *num_screens);
GLAPI EGLSurface APIENTRY eglCreateScreenSurfaceMESA(EGLDisplay dpy, EGLConfig config, const EGLint *attrib_list);
GLAPI EGLBoolean APIENTRY eglShowSurfaceMESA(EGLDisplay dpy, EGLint screen, EGLSurface surface, EGLModeMESA mode);
GLAPI EGLBoolean APIENTRY eglShowScreenSurfaceMESA(EGLDisplay dpy, EGLint screen, EGLSurface surface, EGLModeMESA mode);
GLAPI EGLBoolean APIENTRY eglScreenPositionMESA(EGLDisplay dpy, EGLScreenMESA screen, EGLint x, EGLint y);
GLAPI EGLBoolean APIENTRY eglQueryScreenMESA(EGLDisplay dpy, EGLScreenMESA screen, EGLint attribute, EGLint *value);
GLAPI EGLBoolean APIENTRY eglQueryScreenSurfaceMESA(EGLDisplay dpy, EGLScreenMESA screen, EGLSurface *surface);

View File

@@ -25,6 +25,7 @@ PROGS = \
fplight \
gamma \
gears \
gearbox \
geartrain \
glinfo \
gloss \
@@ -37,13 +38,13 @@ PROGS = \
multiarb \
occlude \
paltex \
pixeltex \
pointblast \
ray \
readpix \
reflect \
renormal \
shadowtex \
singlebuffer \
spectex \
spriteblast \
stex3d \

View File

@@ -10,7 +10,7 @@
##### MACROS #####
INCDIR = ([--.include],[-.util])
CFLAGS = /include=$(INCDIR)/prefix=all/name=(as_is,short)
CFLAGS =/include=$(INCDIR)/prefix=all/name=(as_is,short)/float=ieee/ieee=denorm
.ifdef SHARE
GL_LIBS = $(XLIBS)

View File

@@ -71,7 +71,9 @@ static void Display( void )
glDisable(GL_SCISSOR_TEST);
glDisable(GL_FOG);
if (!DrawFront)
if (DrawFront)
glFinish();
else
glutSwapBuffers();
}

486
progs/demos/gearbox.c Normal file
View File

@@ -0,0 +1,486 @@
/*
* Use glCopyTexSubImage2D to draw animated gears on the sides of a box.
*
* Brian Paul
* 27 January 2006
*/
#include <math.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <GL/glut.h>
#ifndef M_PI
#define M_PI 3.14159265
#endif
static GLint WinWidth = 800, WinHeight = 500;
static GLint TexWidth, TexHeight;
static GLuint TexObj = 1;
static GLenum IntFormat = GL_RGBA;
static GLboolean WireFrame = GL_FALSE;
static GLint T0 = 0;
static GLint Frames = 0;
static GLint Win = 0;
static GLfloat ViewRotX = 20.0, ViewRotY = 30.0, ViewRotZ = 0.0;
static GLint Gear1, Gear2, Gear3;
static GLfloat GearRot = 0.0;
static GLfloat CubeRot = 0.0;
/**
Draw a gear wheel. You'll probably want to call this function when
building a display list since we do a lot of trig here.
Input: inner_radius - radius of hole at center
outer_radius - radius at center of teeth
width - width of gear
teeth - number of teeth
tooth_depth - depth of tooth
**/
static void
gear(GLfloat inner_radius, GLfloat outer_radius, GLfloat width,
GLint teeth, GLfloat tooth_depth)
{
GLint i;
GLfloat r0, r1, r2;
GLfloat angle, da;
GLfloat u, v, len;
r0 = inner_radius;
r1 = outer_radius - tooth_depth / 2.0;
r2 = outer_radius + tooth_depth / 2.0;
da = 2.0 * M_PI / teeth / 4.0;
glShadeModel(GL_FLAT);
glNormal3f(0.0, 0.0, 1.0);
/* draw front face */
glBegin(GL_QUAD_STRIP);
for (i = 0; i <= teeth; i++) {
angle = i * 2.0 * M_PI / teeth;
glVertex3f(r0 * cos(angle), r0 * sin(angle), width * 0.5);
glVertex3f(r1 * cos(angle), r1 * sin(angle), width * 0.5);
if (i < teeth) {
glVertex3f(r0 * cos(angle), r0 * sin(angle), width * 0.5);
glVertex3f(r1 * cos(angle + 3 * da), r1 * sin(angle + 3 * da), width * 0.5);
}
}
glEnd();
/* draw front sides of teeth */
glBegin(GL_QUADS);
da = 2.0 * M_PI / teeth / 4.0;
for (i = 0; i < teeth; i++) {
angle = i * 2.0 * M_PI / teeth;
glVertex3f(r1 * cos(angle), r1 * sin(angle), width * 0.5);
glVertex3f(r2 * cos(angle + da), r2 * sin(angle + da), width * 0.5);
glVertex3f(r2 * cos(angle + 2 * da), r2 * sin(angle + 2 * da), width * 0.5);
glVertex3f(r1 * cos(angle + 3 * da), r1 * sin(angle + 3 * da), width * 0.5);
}
glEnd();
glNormal3f(0.0, 0.0, -1.0);
/* draw back face */
glBegin(GL_QUAD_STRIP);
for (i = 0; i <= teeth; i++) {
angle = i * 2.0 * M_PI / teeth;
glVertex3f(r1 * cos(angle), r1 * sin(angle), -width * 0.5);
glVertex3f(r0 * cos(angle), r0 * sin(angle), -width * 0.5);
if (i < teeth) {
glVertex3f(r1 * cos(angle + 3 * da), r1 * sin(angle + 3 * da), -width * 0.5);
glVertex3f(r0 * cos(angle), r0 * sin(angle), -width * 0.5);
}
}
glEnd();
/* draw back sides of teeth */
glBegin(GL_QUADS);
da = 2.0 * M_PI / teeth / 4.0;
for (i = 0; i < teeth; i++) {
angle = i * 2.0 * M_PI / teeth;
glVertex3f(r1 * cos(angle + 3 * da), r1 * sin(angle + 3 * da), -width * 0.5);
glVertex3f(r2 * cos(angle + 2 * da), r2 * sin(angle + 2 * da), -width * 0.5);
glVertex3f(r2 * cos(angle + da), r2 * sin(angle + da), -width * 0.5);
glVertex3f(r1 * cos(angle), r1 * sin(angle), -width * 0.5);
}
glEnd();
/* draw outward faces of teeth */
glBegin(GL_QUAD_STRIP);
for (i = 0; i < teeth; i++) {
angle = i * 2.0 * M_PI / teeth;
glVertex3f(r1 * cos(angle), r1 * sin(angle), width * 0.5);
glVertex3f(r1 * cos(angle), r1 * sin(angle), -width * 0.5);
u = r2 * cos(angle + da) - r1 * cos(angle);
v = r2 * sin(angle + da) - r1 * sin(angle);
len = sqrt(u * u + v * v);
u /= len;
v /= len;
glNormal3f(v, -u, 0.0);
glVertex3f(r2 * cos(angle + da), r2 * sin(angle + da), width * 0.5);
glVertex3f(r2 * cos(angle + da), r2 * sin(angle + da), -width * 0.5);
glNormal3f(cos(angle), sin(angle), 0.0);
glVertex3f(r2 * cos(angle + 2 * da), r2 * sin(angle + 2 * da), width * 0.5);
glVertex3f(r2 * cos(angle + 2 * da), r2 * sin(angle + 2 * da), -width * 0.5);
u = r1 * cos(angle + 3 * da) - r2 * cos(angle + 2 * da);
v = r1 * sin(angle + 3 * da) - r2 * sin(angle + 2 * da);
glNormal3f(v, -u, 0.0);
glVertex3f(r1 * cos(angle + 3 * da), r1 * sin(angle + 3 * da), width * 0.5);
glVertex3f(r1 * cos(angle + 3 * da), r1 * sin(angle + 3 * da), -width * 0.5);
glNormal3f(cos(angle), sin(angle), 0.0);
}
glVertex3f(r1 * cos(0), r1 * sin(0), width * 0.5);
glVertex3f(r1 * cos(0), r1 * sin(0), -width * 0.5);
glEnd();
glShadeModel(GL_SMOOTH);
/* draw inside radius cylinder */
glBegin(GL_QUAD_STRIP);
for (i = 0; i <= teeth; i++) {
angle = i * 2.0 * M_PI / teeth;
glNormal3f(-cos(angle), -sin(angle), 0.0);
glVertex3f(r0 * cos(angle), r0 * sin(angle), -width * 0.5);
glVertex3f(r0 * cos(angle), r0 * sin(angle), width * 0.5);
}
glEnd();
}
static void
cleanup(void)
{
glDeleteTextures(1, &TexObj);
glDeleteLists(Gear1, 1);
glDeleteLists(Gear2, 1);
glDeleteLists(Gear3, 1);
glutDestroyWindow(Win);
}
static void
DrawGears(void)
{
if (WireFrame) {
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
}
glPushMatrix();
glRotatef(20/*ViewRotX*/, 1.0, 0.0, 0.0);
glRotatef(ViewRotY, 0.0, 1.0, 0.0);
glRotatef(ViewRotZ, 0.0, 0.0, 1.0);
glPushMatrix();
glTranslatef(-3.0, -2.0, 0.0);
glRotatef(GearRot, 0.0, 0.0, 1.0);
glCallList(Gear1);
glPopMatrix();
glPushMatrix();
glTranslatef(3.1, -2.0, 0.0);
glRotatef(-2.0 * GearRot - 9.0, 0.0, 0.0, 1.0);
glCallList(Gear2);
glPopMatrix();
glPushMatrix();
glTranslatef(-3.1, 4.2, 0.0);
glRotatef(-2.0 * GearRot - 25.0, 0.0, 0.0, 1.0);
glCallList(Gear3);
glPopMatrix();
glPopMatrix();
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
}
static void
DrawCube(void)
{
static const GLfloat texcoords[4][2] = {
{ 0, 0 }, { 1, 0 }, { 1, 1 }, { 0, 1 }
};
static const GLfloat vertices[4][2] = {
{ -1, -1 }, { 1, -1 }, { 1, 1 }, { -1, 1 }
};
static const GLfloat xforms[6][4] = {
{ 0, 0, 1, 0 },
{ 90, 0, 1, 0 },
{ 180, 0, 1, 0 },
{ 270, 0, 1, 0 },
{ 90, 1, 0, 0 },
{ -90, 1, 0, 0 }
};
static const GLfloat mat[4] = { 1.0, 1.0, 0.5, 1.0 };
GLint i, j;
glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, mat);
glEnable(GL_TEXTURE_2D);
glPushMatrix();
glRotatef(ViewRotX, 1.0, 0.0, 0.0);
glRotatef(15, 1, 0, 0);
glRotatef(CubeRot, 0, 1, 0);
glScalef(4, 4, 4);
for (i = 0; i < 6; i++) {
glPushMatrix();
glRotatef(xforms[i][0], xforms[i][1], xforms[i][2], xforms[i][3]);
glTranslatef(0, 0, 1.1);
glBegin(GL_POLYGON);
glNormal3f(0, 0, 1);
for (j = 0; j < 4; j++) {
glTexCoord2fv(texcoords[j]);
glVertex2fv(vertices[j]);
}
glEnd();
glPopMatrix();
}
glPopMatrix();
glDisable(GL_TEXTURE_2D);
}
static void
draw(void)
{
float ar;
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glTranslatef(0.0, 0.0, -40.0);
glDisable(GL_SCISSOR_TEST);
glClear(GL_DEPTH_BUFFER_BIT);
glEnable(GL_SCISSOR_TEST);
/* draw gears */
glViewport(0, 0, TexWidth, TexHeight);
glScissor(0, 0, TexWidth, TexHeight);
glClearColor(0.5, 0.5, 0.8, 0.0);
glClearColor(1, 1, 1, 0);
glClear(GL_COLOR_BUFFER_BIT);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glFrustum(-1.0, 1.0, -1.0, 1.0, 5.0, 60.0);
glMatrixMode(GL_MODELVIEW);
DrawGears();
glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, TexWidth, TexHeight);
/* draw textured cube */
glViewport(TexWidth, 0, WinWidth - TexWidth, WinHeight);
glScissor(TexWidth, 0, WinWidth - TexWidth, WinHeight);
glClearColor(0.5, 0.5, 0.8, 0.0);
glClear(GL_COLOR_BUFFER_BIT);
ar = (float) (WinWidth - TexWidth) / WinHeight;
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glFrustum(-ar, ar, -1.0, 1.0, 5.0, 60.0);
glMatrixMode(GL_MODELVIEW);
DrawCube();
/* finish up */
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 %6.3f seconds = %6.3f FPS\n", Frames, seconds, fps);
T0 = t;
Frames = 0;
}
}
}
static void
idle(void)
{
static double t0 = -1.;
double dt, t = glutGet(GLUT_ELAPSED_TIME) / 1000.0;
if (t0 < 0.0)
t0 = t;
dt = t - t0;
t0 = t;
GearRot += 70.0 * dt; /* 70 degrees per second */
GearRot = fmod(GearRot, 360.0); /* prevents eventual overflow */
CubeRot += 15.0 * dt;
glutPostRedisplay();
}
/* change view angle, exit upon ESC */
static void
key(unsigned char k, int x, int y)
{
(void) x;
(void) y;
switch (k) {
case 'w':
WireFrame = !WireFrame;
break;
case 'z':
ViewRotZ += 5.0;
break;
case 'Z':
ViewRotZ -= 5.0;
break;
case 27: /* Escape */
cleanup();
exit(0);
break;
default:
return;
}
glutPostRedisplay();
}
/* change view angle */
static void
special(int k, int x, int y)
{
(void) x;
(void) y;
switch (k) {
case GLUT_KEY_UP:
ViewRotX += 5.0;
break;
case GLUT_KEY_DOWN:
ViewRotX -= 5.0;
break;
case GLUT_KEY_LEFT:
ViewRotY += 5.0;
break;
case GLUT_KEY_RIGHT:
ViewRotY -= 5.0;
break;
default:
return;
}
glutPostRedisplay();
}
/* new window size or exposure */
static void
reshape(int width, int height)
{
WinWidth = width;
WinHeight = height;
}
static void
init(int argc, char *argv[])
{
static GLfloat pos[4] = {5.0, 5.0, 10.0, 0.0};
static GLfloat red[4] = {0.8, 0.1, 0.0, 1.0};
static GLfloat green[4] = {0.0, 0.8, 0.2, 1.0};
static GLfloat blue[4] = {0.2, 0.2, 1.0, 1.0};
GLint i;
glLightfv(GL_LIGHT0, GL_POSITION, pos);
#if 0
glEnable(GL_CULL_FACE);
#endif
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);
/* xxx make size dynamic */
TexWidth = 256;
TexHeight = 256;
glBindTexture(GL_TEXTURE_2D, TexObj);
glTexImage2D(GL_TEXTURE_2D, 0, IntFormat, TexWidth, TexHeight, 0,
GL_RGBA, GL_UNSIGNED_BYTE, NULL);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
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));
}
}
}
static 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);
glutInitWindowSize(WinWidth, WinHeight);
Win = glutCreateWindow("gearbox");
init(argc, argv);
glutDisplayFunc(draw);
glutReshapeFunc(reshape);
glutKeyboardFunc(key);
glutSpecialFunc(special);
glutVisibilityFunc(visible);
glutMainLoop();
return 0; /* ANSI C requires main to return int. */
}

View File

@@ -234,7 +234,9 @@ idle(void)
dt = t - t0;
t0 = t;
angle += 70.0 * dt; /* 90 degrees per second */
angle += 70.0 * dt; /* 70 degrees per second */
angle = fmod(angle, 360.0); /* prevents eventual overflow */
glutPostRedisplay();
}

View File

@@ -176,6 +176,7 @@ So the angle is:
static int mono=0;
static int smooth=1;
static int anim=1;
static GLint WindH, WindW;
static GLfloat step=0;
static GLfloat seno;
@@ -660,13 +661,6 @@ static void draw_ico( void )
}
static void draw ( void ) {
static double t0 = -1.;
double dt, t = glutGet(GLUT_ELAPSED_TIME) / 1000.0;
if (t0 < 0.0)
t0 = t;
dt = t - t0;
t0 = t;
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
glPushMatrix();
@@ -688,11 +682,19 @@ static void draw ( void ) {
glutSwapBuffers();
step += dt;
}
static void idle_( void )
{
static double t0 = -1.;
double dt, t = glutGet(GLUT_ELAPSED_TIME) / 1000.0;
if (t0 < 0.0)
t0 = t;
dt = t - t0;
t0 = t;
step += dt;
glutPostRedisplay();
}
@@ -718,11 +720,19 @@ static void key( unsigned char k, int x, int y )
case '4': object=4; break;
case '5': object=5; break;
case ' ': mono^=1; break;
case 13: smooth^=1; break;
case 's': smooth^=1; break;
case 'a':
anim^=1;
if (anim)
glutIdleFunc( idle_ );
else
glutIdleFunc(NULL);
break;
case 27:
exit(0);
}
pinit();
glutPostRedisplay();
}
static void pinit(void)

View File

@@ -1,210 +0,0 @@
/*
* 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 "readtex.h"
#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

@@ -186,11 +186,12 @@ Display( void )
else {
/* clear the temporary image to white (helpful for debugging */
memset(TempImage, 255, ImgWidth * ImgHeight * 4);
#if 0
/* you might use this when debugging */
#if 1
glReadPixels(APosX, APosY, ImgWidth, ImgHeight,
ReadFormat, ReadType, TempImage);
(void) ComplexReadPixels;
#else
/* you might use this when debugging */
ComplexReadPixels(APosX, APosY, ImgWidth, ImgHeight,
ReadFormat, ReadType, TempImage);
#endif

View File

@@ -1,4 +1,3 @@
/*
* Demo of a reflective, texture-mapped surface with OpenGL.
* Brian Paul August 14, 1995 This file is in the public domain.
@@ -24,9 +23,11 @@
* 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)
* Brian Paul (August 2005 - added multi window feature)
*/
#include <assert.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
@@ -36,40 +37,102 @@
#define DEG2RAD (3.14159/180.0)
#define TABLE_TEXTURE "../images/tile.rgb"
static GLint ImgWidth, ImgHeight;
static GLenum ImgFormat;
static GLubyte *Image = NULL;
#define MAX_OBJECTS 2
static GLint table_list;
static GLint objects_list[MAX_OBJECTS];
static GLfloat xrot, yrot;
static GLfloat spin;
static GLint Width = 400, Height = 300;
static GLenum ShowBuffer = GL_NONE;
static GLboolean Anim = GL_TRUE;
/* performance info */
static GLint T0 = 0;
static GLint Frames = 0;
#define INIT_WIDTH 400
#define INIT_HEIGHT 300
static void make_table( void )
struct window {
int id; /* returned by glutCreateWindow() */
int width, height;
GLboolean anim;
GLfloat xrot, yrot;
GLfloat spin;
GLenum showBuffer;
GLenum drawBuffer;
GLuint table_list;
GLuint objects_list[MAX_OBJECTS];
double t0;
struct window *next;
};
static struct window *FirstWindow = NULL;
static void
CreateWindow(void);
static struct window *
CurrentWindow(void)
{
int id = glutGetWindow();
struct window *w;
for (w = FirstWindow; w; w = w->next) {
if (w->id == id)
return w;
}
return NULL;
}
static GLboolean
AnyAnimating(void)
{
struct window *w;
for (w = FirstWindow; w; w = w->next) {
if (w->anim)
return 1;
}
return 0;
}
static void
KillWindow(struct window *w)
{
struct window *win, *prev = NULL;
for (win = FirstWindow; win; win = win->next) {
if (win == w) {
if (prev) {
prev->next = win->next;
}
else {
FirstWindow = win->next;
}
glutDestroyWindow(win->id);
win->next = NULL;
free(win);
return;
}
prev = win;
}
}
static void
KillAllWindows(void)
{
while (FirstWindow)
KillWindow(FirstWindow);
}
static GLuint
MakeTable(void)
{
static GLfloat table_mat[] = { 1.0, 1.0, 1.0, 0.6 };
static GLfloat gray[] = { 0.4, 0.4, 0.4, 1.0 };
GLuint table_list;
table_list = glGenLists(1);
glNewList( table_list, GL_COMPILE );
/* load table's texture */
glMaterialfv( GL_FRONT, GL_AMBIENT_AND_DIFFUSE, table_mat );
/* glMaterialfv( GL_FRONT, GL_EMISSION, gray );*/
/*glMaterialfv( GL_FRONT, GL_EMISSION, gray );*/
glMaterialfv( GL_FRONT, GL_DIFFUSE, table_mat );
glMaterialfv( GL_FRONT, GL_AMBIENT, gray );
@@ -88,10 +151,12 @@ static void make_table( void )
glDisable( GL_TEXTURE_2D );
glEndList();
return table_list;
}
static void make_objects( void )
static void
MakeObjects(GLuint *objects_list)
{
GLUquadricObj *q;
@@ -116,32 +181,36 @@ static void make_objects( void )
glMaterialfv( GL_FRONT, GL_EMISSION, black );
gluCylinder( q, 1.5, 0.0, 2.5, 15, 1 );
glEndList();
gluDeleteQuadric(q);
}
static void init( void )
static void
InitWindow(struct window *w)
{
make_table();
make_objects();
GLint imgWidth, imgHeight;
GLenum imgFormat;
GLubyte *image = NULL;
Image = LoadRGBImage( TABLE_TEXTURE, &ImgWidth, &ImgHeight, &ImgFormat );
if (!Image) {
w->table_list = MakeTable();
MakeObjects(w->objects_list);
image = LoadRGBImage( TABLE_TEXTURE, &imgWidth, &imgHeight, &imgFormat );
if (!image) {
printf("Couldn't read %s\n", TABLE_TEXTURE);
exit(0);
}
gluBuild2DMipmaps(GL_TEXTURE_2D, 3, ImgWidth, ImgHeight,
ImgFormat, GL_UNSIGNED_BYTE, Image);
gluBuild2DMipmaps(GL_TEXTURE_2D, 3, imgWidth, imgHeight,
imgFormat, GL_UNSIGNED_BYTE, image);
free(image);
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT );
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT );
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST );
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST );
xrot = 30.0;
yrot = 50.0;
spin = 0.0;
glShadeModel( GL_FLAT );
glEnable( GL_LIGHT0 );
@@ -153,14 +222,15 @@ static void init( void )
}
static void reshape(int w, int h)
static void
Reshape(int width, int height)
{
struct window *w = CurrentWindow();
GLfloat yAspect = 2.5;
GLfloat xAspect = yAspect * (float) w / (float) h;
Width = w;
Height = h;
glViewport(0, 0, w, h);
GLfloat xAspect = yAspect * (float) width / (float) height;
w->width = width;
w->height = height;
glViewport(0, 0, width, height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glFrustum( -xAspect, xAspect, -yAspect, yAspect, 10.0, 30.0 );
@@ -169,8 +239,8 @@ static void reshape(int w, int h)
}
static void draw_objects( GLfloat eyex, GLfloat eyey, GLfloat eyez )
static void
DrawObjects(struct window *w, GLfloat eyex, GLfloat eyey, GLfloat eyez)
{
(void) eyex;
(void) eyey;
@@ -178,62 +248,65 @@ static void draw_objects( GLfloat eyex, GLfloat eyey, GLfloat eyez )
#ifndef USE_ZBUFFER
if (eyex<0.5) {
#endif
glPushMatrix();
glTranslatef( 1.0, 1.5, 0.0 );
glRotatef( spin, 1.0, 0.5, 0.0 );
glRotatef( 0.5*spin, 0.0, 0.5, 1.0 );
glCallList( objects_list[0] );
glPopMatrix();
glPushMatrix();
glTranslatef( -1.0, 0.85+3.0*fabs( cos(0.01*spin) ), 0.0 );
glRotatef( 0.5*spin, 0.0, 0.5, 1.0 );
glRotatef( spin, 1.0, 0.5, 0.0 );
glScalef( 0.5, 0.5, 0.5 );
glCallList( objects_list[1] );
glPopMatrix();
glPushMatrix();
glTranslatef( 1.0, 1.5, 0.0 );
glRotatef( w->spin, 1.0, 0.5, 0.0 );
glRotatef( 0.5*w->spin, 0.0, 0.5, 1.0 );
glCallList( w->objects_list[0] );
glPopMatrix();
glPushMatrix();
glTranslatef( -1.0, 0.85+3.0*fabs( cos(0.01*w->spin) ), 0.0 );
glRotatef( 0.5*w->spin, 0.0, 0.5, 1.0 );
glRotatef( w->spin, 1.0, 0.5, 0.0 );
glScalef( 0.5, 0.5, 0.5 );
glCallList( w->objects_list[1] );
glPopMatrix();
#ifndef USE_ZBUFFER
}
else {
glPushMatrix();
glTranslatef( -1.0, 0.85+3.0*fabs( cos(0.01*spin) ), 0.0 );
glRotatef( 0.5*spin, 0.0, 0.5, 1.0 );
glRotatef( spin, 1.0, 0.5, 0.0 );
glScalef( 0.5, 0.5, 0.5 );
glCallList( objects_list[1] );
glPopMatrix();
glPushMatrix();
glTranslatef( -1.0, 0.85+3.0*fabs( cos(0.01*w->spin) ), 0.0 );
glRotatef( 0.5*w->spin, 0.0, 0.5, 1.0 );
glRotatef( w->spin, 1.0, 0.5, 0.0 );
glScalef( 0.5, 0.5, 0.5 );
glCallList( w->objects_list[1] );
glPopMatrix();
glPushMatrix();
glTranslatef( 1.0, 1.5, 0.0 );
glRotatef( spin, 1.0, 0.5, 0.0 );
glRotatef( 0.5*spin, 0.0, 0.5, 1.0 );
glCallList( objects_list[0] );
glPopMatrix();
glPushMatrix();
glTranslatef( 1.0, 1.5, 0.0 );
glRotatef( w->spin, 1.0, 0.5, 0.0 );
glRotatef( 0.5*w->spin, 0.0, 0.5, 1.0 );
glCallList( w->objects_list[0] );
glPopMatrix();
}
#endif
}
static void draw_table( void )
static void
DrawTable(struct window *w)
{
glCallList( table_list );
glCallList(w->table_list);
}
static void draw_scene( void )
static void
DrawWindow(void)
{
struct window *w = CurrentWindow();
static GLfloat light_pos[] = { 0.0, 20.0, 0.0, 1.0 };
GLfloat dist = 20.0;
GLfloat eyex, eyey, eyez;
glDrawBuffer(w->drawBuffer);
glReadBuffer(w->drawBuffer);
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);
eyex = dist * cos(w->yrot * DEG2RAD) * cos(w->xrot * DEG2RAD);
eyez = dist * sin(w->yrot * DEG2RAD) * cos(w->xrot * DEG2RAD);
eyey = dist * sin(w->xrot * DEG2RAD);
/* view from top */
glPushMatrix();
@@ -247,7 +320,7 @@ static void draw_scene( void )
glStencilFunc( GL_ALWAYS, 1, 0xffffffff );
glStencilOp( GL_REPLACE, GL_REPLACE, GL_REPLACE );
glColorMask( GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE );
draw_table();
DrawTable(w);
glColorMask( GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE );
glEnable( GL_DEPTH_TEST );
@@ -264,7 +337,7 @@ static void draw_scene( void )
/* Reposition light in reflected space. */
glLightfv(GL_LIGHT0, GL_POSITION, light_pos);
draw_objects(eyex, eyey, eyez);
DrawObjects(w, eyex, eyey, eyez);
glPopMatrix();
/* Restore light's original unreflected position. */
@@ -277,128 +350,224 @@ static void draw_scene( void )
glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
glEnable( GL_TEXTURE_2D );
draw_table();
DrawTable(w);
glDisable( GL_TEXTURE_2D );
glDisable( GL_BLEND );
/* view from top */
glPushMatrix();
draw_objects(eyex, eyey, eyez);
DrawObjects(w, eyex, eyey, eyez);
glPopMatrix();
glPopMatrix();
if (ShowBuffer == GL_DEPTH) {
ShowDepthBuffer(Width, Height, 1.0, 0.0);
if (w->showBuffer == GL_DEPTH) {
ShowDepthBuffer(w->width, w->height, 1.0, 0.0);
}
else if (ShowBuffer == GL_STENCIL) {
ShowStencilBuffer(Width, Height, 255.0, 0.0);
else if (w->showBuffer == GL_STENCIL) {
ShowStencilBuffer(w->width, w->height, 255.0, 0.0);
}
else if (ShowBuffer == GL_ALPHA) {
ShowAlphaBuffer(Width, Height);
else if (w->showBuffer == GL_ALPHA) {
ShowAlphaBuffer(w->width, w->height);
}
glutSwapBuffers();
if (w->drawBuffer == GL_BACK)
glutSwapBuffers();
else
glFinish();
/* calc/show frame rate */
{
static GLint t0 = 0;
static GLint frames = 0;
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;
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 idle( void )
static void
Idle(void)
{
static double t0 = -1.;
double dt, t = glutGet(GLUT_ELAPSED_TIME) / 1000.0;
if (t0 < 0.0)
t0 = t;
dt = t - t0;
t0 = t;
spin += 60.0 * dt;
yrot += 90.0 * dt;
glutPostRedisplay();
double t = glutGet(GLUT_ELAPSED_TIME) / 1000.0;
struct window *w;
for (w = FirstWindow; w; w = w->next) {
if (w->anim) {
double dt;
if (w->t0 < 0.0)
w->t0 = t;
dt = t - w->t0;
w->t0 = t;
w->spin += 60.0 * dt;
w->yrot += 90.0 * dt;
assert(w->id);
glutSetWindow(w->id);
glutPostRedisplay();
}
}
}
static void Key( unsigned char key, int x, int y )
static void
UpdateIdleFunc(void)
{
if (AnyAnimating())
glutIdleFunc(Idle);
else
glutIdleFunc(NULL);
}
static void
Key(unsigned char key, int x, int y)
{
struct window *w = CurrentWindow();
(void) x;
(void) y;
if (key == 'd') {
ShowBuffer = GL_DEPTH;
}
else if (key == 's') {
ShowBuffer = GL_STENCIL;
}
else if (key == 'a') {
ShowBuffer = GL_ALPHA;
}
else if (key == ' ') {
Anim = !Anim;
if (Anim)
glutIdleFunc(idle);
switch (key) {
case 'd':
w->showBuffer = GL_DEPTH;
glutPostRedisplay();
break;
case 's':
w->showBuffer = GL_STENCIL;
glutPostRedisplay();
break;
case 'a':
w->showBuffer = GL_ALPHA;
glutPostRedisplay();
break;
case 'c':
w->showBuffer = GL_NONE;
glutPostRedisplay();
break;
case 'f':
if (w->drawBuffer == GL_FRONT)
w->drawBuffer = GL_BACK;
else
glutIdleFunc(NULL);
}
else if (key==27) {
w->drawBuffer = GL_FRONT;
glutPostRedisplay();
break;
case ' ':
w->anim = !w->anim;
w->t0 = -1;
UpdateIdleFunc();
glutPostRedisplay();
break;
case 'n':
CreateWindow();
UpdateIdleFunc();
break;
case 'k':
KillWindow(w);
if (FirstWindow == NULL)
exit(0);
break;
case 27:
KillAllWindows();
exit(0);
break;
default:
;
}
else {
ShowBuffer = GL_NONE;
}
glutPostRedisplay();
}
static void SpecialKey( int key, int x, int y )
static void
SpecialKey(int key, int x, int y)
{
struct window *w = CurrentWindow();
(void) x;
(void) y;
switch (key) {
case GLUT_KEY_UP:
xrot += 3.0;
if ( xrot > 85 )
xrot = 85;
w->xrot += 3.0;
if (w->xrot > 85)
w->xrot = 85;
break;
case GLUT_KEY_DOWN:
xrot -= 3.0;
if ( xrot < 5 )
xrot = 5;
w->xrot -= 3.0;
if (w->xrot < 5)
w->xrot = 5;
break;
case GLUT_KEY_LEFT:
yrot += 3.0;
w->yrot += 3.0;
break;
case GLUT_KEY_RIGHT:
yrot -= 3.0;
w->yrot -= 3.0;
break;
}
glutPostRedisplay();
}
int main( int argc, char *argv[] )
static void
CreateWindow(void)
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH | GLUT_STENCIL | GLUT_ALPHA);
glutInitWindowPosition( 0, 0 );
glutInitWindowSize( Width, Height );
glutCreateWindow(argv[0]);
glutReshapeFunc(reshape);
glutDisplayFunc(draw_scene);
char title[1000];
struct window *w = (struct window *) calloc(1, sizeof(struct window));
glutInitWindowSize(INIT_WIDTH, INIT_HEIGHT);
w->id = glutCreateWindow("foo");
sprintf(title, "reflect window %d", w->id);
glutSetWindowTitle(title);
assert(w->id);
w->width = INIT_WIDTH;
w->height = INIT_HEIGHT;
w->anim = GL_TRUE;
w->xrot = 30.0;
w->yrot = 50.0;
w->spin = 0.0;
w->showBuffer = GL_NONE;
w->drawBuffer = GL_BACK;
InitWindow(w);
glutReshapeFunc(Reshape);
glutDisplayFunc(DrawWindow);
glutKeyboardFunc(Key);
glutSpecialFunc(SpecialKey);
glutIdleFunc(idle);
init();
/* insert at head of list */
w->next = FirstWindow;
FirstWindow = w;
}
static void
Usage(void)
{
printf("Keys:\n");
printf(" a - show alpha buffer\n");
printf(" d - show depth buffer\n");
printf(" s - show stencil buffer\n");
printf(" c - show color buffer\n");
printf(" f - toggle rendering to front/back color buffer\n");
printf(" n - create new window\n");
printf(" k - kill window\n");
printf(" SPACE - toggle animation\n");
printf(" ARROWS - rotate scene\n");
}
int
main(int argc, char *argv[])
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH |
GLUT_STENCIL | GLUT_ALPHA);
CreateWindow();
glutIdleFunc(Idle);
Usage();
glutMainLoop();
return 0;
}

269
progs/demos/singlebuffer.c Normal file
View File

@@ -0,0 +1,269 @@
/*
* Demo of (nearly) flicker-free drawing with a single color buffer.
*
* Basically, draw the scene into the Z buffer first, then draw the
* scene into the color buffer. Finally, "clear" the background by
* setting the fragments we didn't hit earlier.
*
* This won't work if you need blending. The technique works best
* when the scene is relatively simple and can be rendered quickly
* (i.e. with hardware), and when the objects don't move too much from
* one frame to the next.
*
* Brian Paul
* 25 August 2005
*
* See Mesa license for terms.
*/
#include <stdio.h>
#include <stdlib.h>
#include <GL/glut.h>
#define FLICKER 0
#define NO_FLICKER 1
static GLint Mode = NO_FLICKER;
static GLfloat Xrot = 0, Yrot = 0, Zrot = 0;
static GLboolean Anim = GL_TRUE;
static GLfloat ClearColor[4] = {0.2, 0.2, 0.9, 0.0};
static GLfloat NearClip = 5.0, FarClip = 25.0, ViewDist = 7.0;
static double PrevTime = -1;
struct box {
float tx, ty, tz;
float rx, ry, rz, ra;
float sx, sy, sz;
float color[4];
};
#define NUM_BOXES 25
struct box Boxes[NUM_BOXES];
/* Return random float in [0,1] */
static float
Random(void)
{
int i = rand();
return (float) (i % 1000) / 1000.0;
}
static void
MakeBoxes(void)
{
int i;
for (i = 0; i < NUM_BOXES; i++) {
Boxes[i].tx = -1.0 + 2.0 * Random();
Boxes[i].ty = -1.0 + 2.0 * Random();
Boxes[i].tz = -1.0 + 2.0 * Random();
Boxes[i].sx = 0.1 + Random() * 0.4;
Boxes[i].sy = 0.1 + Random() * 0.4;
Boxes[i].sz = 0.1 + Random() * 0.4;
Boxes[i].rx = Random();
Boxes[i].ry = Random();
Boxes[i].rz = Random();
Boxes[i].ra = Random() * 360.0;
Boxes[i].color[0] = Random();
Boxes[i].color[1] = Random();
Boxes[i].color[2] = Random();
Boxes[i].color[3] = 1.0;
}
}
static void
DrawBoxes(void)
{
int i;
for (i = 0; i < NUM_BOXES; i++) {
glPushMatrix();
glTranslatef(Boxes[i].tx, Boxes[i].ty, Boxes[i].tz);
glRotatef(Boxes[i].ra, Boxes[i].rx, Boxes[i].ry, Boxes[i].rz);
glScalef(Boxes[i].sx, Boxes[i].sy, Boxes[i].sz);
glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, Boxes[i].color);
glutSolidCube(1.0);
glPopMatrix();
}
}
static void
Idle(void)
{
double dt, t = glutGet(GLUT_ELAPSED_TIME) * 0.001;
if (PrevTime < 0.0)
PrevTime = t;
dt = t - PrevTime;
PrevTime = t;
Xrot += 16.0 * dt;
Yrot += 12.0 * dt;
Zrot += 8.0 * dt;
glutPostRedisplay();
}
static void
Draw(void)
{
if (Mode == FLICKER) {
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
}
else {
/* don't clear color buffer */
glClear(GL_DEPTH_BUFFER_BIT);
/* update Z buffer only */
glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);
}
glPushMatrix();
glRotatef(Xrot, 1, 0, 0);
glRotatef(Yrot, 0, 1, 0);
glRotatef(Zrot, 0, 0, 1);
DrawBoxes();
if (Mode == NO_FLICKER) {
/* update color buffer now */
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
glDepthFunc(GL_EQUAL);
DrawBoxes();
glDepthFunc(GL_LESS);
}
glPopMatrix();
if (Mode == NO_FLICKER) {
/* "clear" the untouched pixels now.
* Note: if you comment-out this code you'll see something interesting.
*/
GLfloat x = FarClip / NearClip;
GLfloat z = -(FarClip - ViewDist - 1.0);
glDisable(GL_LIGHTING);
glColor4fv(ClearColor);
glBegin(GL_POLYGON);
glVertex3f(-x, -x, z);
glVertex3f( x, -x, z);
glVertex3f( x, x, z);
glVertex3f(-x, x, z);
glEnd();
glEnable(GL_LIGHTING);
}
/* This is where you'd normally do SwapBuffers */
glFinish();
}
static void
Reshape(int width, int height)
{
glViewport(0, 0, width, height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glFrustum(-1.0, 1.0, -1.0, 1.0, NearClip, FarClip);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glTranslatef(0.0, 0.0, -ViewDist);
}
static void
Key(unsigned char key, int x, int y)
{
(void) x;
(void) y;
switch (key) {
case 'a':
Anim = !Anim;
if (Anim)
glutIdleFunc(Idle);
else
glutIdleFunc(NULL);
PrevTime = -1;
break;
case 'm':
Mode = !Mode;
break;
case 'b':
MakeBoxes();
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)
{
glClearColor(ClearColor[0], ClearColor[1], ClearColor[2], ClearColor[3]);
glEnable(GL_DEPTH_TEST);
glEnable(GL_LIGHTING);
glEnable(GL_LIGHT0);
glEnable(GL_CULL_FACE);
glEnable(GL_NORMALIZE);
MakeBoxes();
}
static void
Usage(void)
{
printf("Keys:\n");
printf(" m - toggle drawing mode (flicker vs. no flicker)\n");
printf(" a - toggle animation\n");
printf(" b - generate new boxes\n");
printf(" ARROWS - rotate scene\n");
printf(" ESC - exit\n");
}
int
main(int argc, char *argv[])
{
glutInit(&argc, argv);
glutInitWindowSize(800, 800);
glutInitDisplayMode(GLUT_RGB | GLUT_SINGLE | GLUT_DEPTH);
glutCreateWindow(argv[0]);
glutReshapeFunc(Reshape);
glutKeyboardFunc(Key);
glutSpecialFunc(SpecialKey);
glutDisplayFunc(Draw);
if (Anim)
glutIdleFunc(Idle);
Init();
Usage();
glutMainLoop();
return 0;
}

View File

@@ -116,6 +116,12 @@ TypeStr(GLenum type)
}
}
/* On x86, there is a performance cliff for memcpy to texture memory
* for sources below 64 byte alignment. We do our best with this in
* the driver, but it is better if the images are correctly aligned to
* start with:
*/
#define ALIGN (1<<7)
static void
MeasureDownloadRate(void)
@@ -128,13 +134,20 @@ MeasureDownloadRate(void)
int count;
int i;
texImage = (GLubyte *) malloc(bytes);
getImage = (GLubyte *) malloc(bytes);
texImage = (GLubyte *) malloc(bytes + ALIGN);
getImage = (GLubyte *) malloc(bytes + ALIGN);
if (!texImage || !getImage) {
DownloadRate = 0.0;
return;
}
texImage = (GLubyte *)((((unsigned)texImage) + ALIGN) & ~(ALIGN-1));
getImage = (GLubyte *)((((unsigned)getImage) + ALIGN) & ~(ALIGN-1));
for (i = 1; !(((unsigned)texImage) & i); i<<=1)
;
printf("texture image alignment: %d bytes\n", i);
for (i = 0; i < bytes; i++) {
texImage[i] = i & 0xff;
}
@@ -178,12 +191,15 @@ MeasureDownloadRate(void)
FormatTable[Format].Type, texImage);
}
#if 1
/* draw a tiny polygon to force texture into texram */
glBegin(GL_TRIANGLES);
glTexCoord2f(0, 0); glVertex2f(1, 1);
glTexCoord2f(1, 0); glVertex2f(3, 1);
glTexCoord2f(0.5, 1); glVertex2f(2, 3);
glEnd();
/* glFinish(); */
#endif
t1 = glutGet(GLUT_ELAPSED_TIME) * 0.001;
time = t1 - t0;
@@ -209,8 +225,8 @@ MeasureDownloadRate(void)
}
#endif
free(texImage);
free(getImage);
/* free(texImage); */
/* free(getImage); */
{
GLint err = glGetError();

View File

@@ -92,7 +92,7 @@ static void idle( void )
dt = t - t0;
t0 = t;
Angle += 120.0*dt;
glutPostRedisplay();
/* glutPostRedisplay(); */
}

View File

@@ -152,7 +152,7 @@ main(int argc, char *argv[])
return 0;
}
eglShowSurfaceMESA(d, screen, screen_surf, mode);
eglShowScreenSurfaceMESA(d, screen, screen_surf, mode);
b = eglMakeCurrent(d, screen_surf, screen_surf, ctx);
if (!b) {

View File

@@ -603,7 +603,7 @@ main(int argc, char *argv[])
return 0;
}
eglShowSurfaceMESA(d, screen, screen_surf, mode);
eglShowScreenSurfaceMESA(d, screen, screen_surf, mode);
b = eglMakeCurrent(d, screen_surf, screen_surf, ctx);
if (!b) {

View File

@@ -35,6 +35,8 @@
#include <GLES/egl.h>
#include <assert.h>
#define MAX_CONFIGS 10
#define MAX_MODES 100
#define BENCHMARK
@@ -87,9 +89,11 @@ 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 GLfloat eyesep = 5.0; /* Eye separation. */
//static GLfloat fix_point = 40.0; /* Fixation point distance. */
//static GLfloat left, right, asp; /* Stereo frustum params. */
#if 0
static GLfloat eyesep = 5.0; /* Eye separation. */
static GLfloat fix_point = 40.0; /* Fixation point distance. */
static GLfloat left, right, asp; /* Stereo frustum params. */
#endif
/*
@@ -339,7 +343,6 @@ static void run_gears(EGLDisplay dpy, EGLSurface surf, int ttr)
draw();
// DBR : Swap the Buffers
eglSwapBuffers(dpy, surf);
@@ -359,21 +362,18 @@ main(int argc, char *argv[])
int maj, min;
EGLContext ctx;
EGLSurface screen_surf;
EGLConfig configs[10];
EGLConfig configs[MAX_CONFIGS];
EGLint numConfigs, i;
EGLBoolean b;
const EGLint screenAttribs[] = {
EGL_WIDTH, 1024,
EGL_HEIGHT, 768,
EGL_NONE
};
EGLModeMESA mode;
EGLDisplay d;
EGLint screenAttribs[10];
EGLModeMESA mode[MAX_MODES];
EGLScreenMESA screen;
EGLint count;
EGLint count, chosenMode;
GLboolean printInfo = GL_FALSE;
EGLint width = 0, height = 0;
/* parse cmd line args */
for (i = 1; i < argc; i++)
{
if (strcmp(argv[i], "-info") == 0)
@@ -384,42 +384,73 @@ main(int argc, char *argv[])
printf("Warning: unknown parameter: %s\n", argv[i]);
}
// DBR : Create EGL context/surface etc
EGLDisplay d = eglGetDisplay(":0");
/* DBR : Create EGL context/surface etc */
d = eglGetDisplay(":0");
assert(d);
if (!eglInitialize(d, &maj, &min)) {
printf("demo: eglInitialize failed\n");
printf("eglgears: eglInitialize failed\n");
exit(1);
}
printf("EGL version = %d.%d\n", maj, min);
printf("EGL_VENDOR = %s\n", eglQueryString(d, EGL_VENDOR));
printf("eglgears: EGL version = %d.%d\n", maj, min);
printf("eglgears: EGL_VENDOR = %s\n", eglQueryString(d, EGL_VENDOR));
eglGetConfigs(d, configs, 10, &numConfigs);
/* XXX use ChooseConfig */
eglGetConfigs(d, configs, MAX_CONFIGS, &numConfigs);
eglGetScreensMESA(d, &screen, 1, &count);
eglGetModesMESA(d, screen, &mode, 1, &count);
if (!eglGetModesMESA(d, screen, mode, MAX_MODES, &count) || count == 0) {
printf("eglgears: eglGetModesMESA failed!\n");
return 0;
}
/* Print list of modes, and find the one to use */
printf("eglgears: Found %d modes:\n", count);
for (i = 0; i < count; i++) {
EGLint w, h;
eglGetModeAttribMESA(d, mode[i], EGL_WIDTH, &w);
eglGetModeAttribMESA(d, mode[i], EGL_HEIGHT, &h);
printf("%3d: %d x %d\n", i, w, h);
if (w > width && h > height && w <= 1280 && h <= 1024) {
width = w;
height = h;
chosenMode = i;
}
}
printf("eglgears: Using screen mode/size %d: %d x %d\n", chosenMode, width, height);
ctx = eglCreateContext(d, configs[0], EGL_NO_CONTEXT, NULL);
if (ctx == EGL_NO_CONTEXT) {
printf("failed to create context\n");
printf("eglgears: failed to create context\n");
return 0;
}
/* build up screenAttribs array */
i = 0;
screenAttribs[i++] = EGL_WIDTH;
screenAttribs[i++] = width;
screenAttribs[i++] = EGL_HEIGHT;
screenAttribs[i++] = height;
screenAttribs[i++] = EGL_NONE;
screen_surf = eglCreateScreenSurfaceMESA(d, configs[0], screenAttribs);
if (screen_surf == EGL_NO_SURFACE) {
printf("failed to create screen surface\n");
printf("eglgears: failed to create screen surface\n");
return 0;
}
eglShowSurfaceMESA(d, screen, screen_surf, mode);
b = eglShowScreenSurfaceMESA(d, screen, screen_surf, mode[chosenMode]);
if (!b) {
printf("eglgears: show surface failed\n");
return 0;
}
b = eglMakeCurrent(d, screen_surf, screen_surf, ctx);
if (!b) {
printf("make current failed\n");
printf("eglgears: make current failed\n");
return 0;
}
// DBR
if (printInfo)
{
@@ -429,20 +460,16 @@ main(int argc, char *argv[])
printf("GL_EXTENSIONS = %s\n", (char *) glGetString(GL_EXTENSIONS));
}
init(); // Initialise the GL visual
reshape(1024,768);
init();
reshape(width, height);
glDrawBuffer( GL_BACK );
glDrawBuffer( GL_BACK );
// DBR : Run the simulation
run_gears(d, screen_surf, 5.0);
// DBR : Destroy EGL context/surface etc
eglDestroySurface(d, screen_surf);
eglDestroyContext(d, ctx);
eglTerminate(d);
// DBR
return 0;
}

View File

@@ -48,9 +48,9 @@ PrintConfigs(EGLDisplay d)
eglGetConfigs(d, configs, MAX_CONFIGS, &numConfigs);
printf("Configurations:\n");
printf(" bf lv d st colorbuffer dp st supported \n");
printf(" bf lv d st colorbuffer dp st supported\n");
printf(" id sz l b ro r g b a th cl surfaces \n");
printf("----------------------------------------------\n");
printf("---------------------------------------------------\n");
for (i = 0; i < numConfigs; i++) {
EGLint id, size, level;
EGLint red, green, blue, alpha;
@@ -77,6 +77,10 @@ PrintConfigs(EGLDisplay d)
strcat(surfString, "pb,");
if (surfaces & EGL_PIXMAP_BIT)
strcat(surfString, "pix,");
#ifdef EGL_MESA_screen_surface
if (surfaces & EGL_SCREEN_BIT_MESA)
strcat(surfString, "scrn,");
#endif
if (strlen(surfString) > 0)
surfString[strlen(surfString) - 1] = 0;
@@ -136,7 +140,7 @@ main(int argc, char *argv[])
{
int maj, min;
/*EGLDisplay d = eglGetDisplay(EGL_DEFAULT_DISPLAY);*/
EGLDisplay d = eglGetDisplay("!r200_dri");
EGLDisplay d = eglGetDisplay(":0");
if (!eglInitialize(d, &maj, &min)) {
printf("eglinfo: eglInitialize failed\n");

127
progs/fp/Makefile Normal file
View File

@@ -0,0 +1,127 @@
# progs/tests/Makefile
# These programs aren't intended to be included with the normal distro.
# They're not too interesting but they're good for testing.
TOP = ../..
include $(TOP)/configs/current
LIBS = $(APP_LIB_DEPS)
SOURCES = \
tri-abs.c \
tri-add.c \
tri-cmp.c \
tri-cos.c \
tri-dp3.c \
tri-dp4.c \
tri-dph.c \
tri-dst.c \
tri-ex2.c \
tri-flr.c \
tri-frc.c \
tri-kil.c \
tri-lg2.c \
tri-lit.c \
tri-lrp.c \
tri-mad.c \
tri-max.c \
tri-min.c \
tri-mov.c \
tri-mul.c \
tri-pow.c \
tri-param.c \
tri-rcp.c \
tri-rsq.c \
tri-scs.c \
tri-sge.c \
tri-sge2.c \
tri-sin.c \
tri-slt.c \
tri-sub.c \
tri-swz.c \
tri-swz2.c \
tri-tex.c \
tri-xpd.c \
tri-position.c \
tri-depth.c \
tri-depth2.c \
tri-depthwrite.c \
tri-depthwrite2.c \
NOTDONE=\
tri-txb.c \
tri-txp.c \
tri-depthwrite.c \
tri-fogoption.c
PROGS = $(SOURCES:%.c=%)
INCLUDES = -I. -I$(TOP)/include -I../samples
UTIL_FILES = readtex.h readtex.c
##### RULES #####
.SUFFIXES:
.SUFFIXES: .c
.c:
$(CC) $(INCLUDES) $(CFLAGS) $< $(LIBS) -o $@
.c.o:
$(CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) $< -o $@
.S.o:
$(CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) $< -o $@
##### TARGETS #####
default: $(UTIL_FILES) $(PROGS)
clean:
rm -f $(PROGS)
rm -f *.o
rm -f getproclist.h
# auto code generation
getprocaddress: getprocaddress.c getproclist.h
getproclist.h: $(TOP)/src/mesa/glapi/gl_API.xml getprocaddress.c getprocaddress.py
python getprocaddress.py > getproclist.h
texrect: texrect.o readtex.o
$(CC) texrect.o readtex.o $(LIBS) -o $@
texrect.o: texrect.c readtex.h
$(CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) $< -o $@
invert: invert.o readtex.o
$(CC) invert.o readtex.o $(LIBS) -o $@
invert.o: invert.c readtex.h
$(CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) $< -o $@
readtex.o: readtex.c
$(CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) $< -o $@
readtex.h: $(TOP)/progs/util/readtex.h
ln -s $(TOP)/progs/util/readtex.h .
readtex.c: $(TOP)/progs/util/readtex.c
ln -s $(TOP)/progs/util/readtex.c .
# Emacs tags
tags:
etags `find . -name \*.[ch]` `find ../include`

107
progs/fp/tri-abs.c Normal file
View File

@@ -0,0 +1,107 @@
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define GL_GLEXT_PROTOTYPES
#include <GL/glut.h>
static void Init( void )
{
static const char *modulate2D =
"!!ARBfp1.0\n"
"TEMP R0;\n"
"SUB R0, {0.5}.x, fragment.color; \n"
"ABS result.color, R0; \n"
"END"
;
GLuint modulateProg;
if (!glutExtensionSupported("GL_ARB_fragment_program")) {
printf("Error: GL_ARB_fragment_program not supported!\n");
exit(1);
}
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
/* Setup the fragment program */
glGenProgramsARB(1, &modulateProg);
glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg);
glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB,
strlen(modulate2D), (const GLubyte *)modulate2D);
printf("glGetError = 0x%x\n", (int) glGetError());
printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n",
(char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB));
glEnable(GL_FRAGMENT_PROGRAM_ARB);
glClearColor(.3, .3, .3, 0);
}
static void Reshape(int width, int height)
{
glViewport(0, 0, (GLint)width, (GLint)height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
glMatrixMode(GL_MODELVIEW);
}
static void Key(unsigned char key, int x, int y)
{
switch (key) {
case 27:
exit(1);
default:
return;
}
glutPostRedisplay();
}
static void Draw(void)
{
glClear(GL_COLOR_BUFFER_BIT);
glBegin(GL_TRIANGLES);
glColor3f(0,0,1);
glVertex3f( 0.9, -0.9, -30.0);
glColor3f(1,0,0);
glVertex3f( 0.9, 0.9, -30.0);
glColor3f(0,1,0);
glVertex3f(-0.9, 0.0, -30.0);
glEnd();
glFlush();
}
int main(int argc, char **argv)
{
GLenum type;
glutInit(&argc, argv);
glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250);
type = GLUT_RGB;
type |= GLUT_SINGLE;
glutInitDisplayMode(type);
if (glutCreateWindow("First Tri") == GL_FALSE) {
exit(1);
}
Init();
glutReshapeFunc(Reshape);
glutKeyboardFunc(Key);
glutDisplayFunc(Draw);
glutMainLoop();
return 0;
}

110
progs/fp/tri-add.c Normal file
View File

@@ -0,0 +1,110 @@
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define GL_GLEXT_PROTOTYPES
#include <GL/glut.h>
static void Init( void )
{
static const char *modulate2D =
"!!ARBfp1.0\n"
"TEMP R0;\n"
"ADD R0, fragment.color, fragment.color; \n"
"ADD result.color, R0, R0; \n"
"END"
;
GLuint modulateProg;
if (!glutExtensionSupported("GL_ARB_fragment_program")) {
printf("Error: GL_ARB_fragment_program not supported!\n");
exit(1);
}
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
/* Setup the fragment program */
glGenProgramsARB(1, &modulateProg);
glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg);
glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB,
strlen(modulate2D), (const GLubyte *)modulate2D);
printf("glGetError = 0x%x\n", (int) glGetError());
printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n",
(char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB));
glEnable(GL_FRAGMENT_PROGRAM_ARB);
glClearColor(.3, .3, .3, 0);
}
static void Reshape(int width, int height)
{
glViewport(0, 0, (GLint)width, (GLint)height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
glMatrixMode(GL_MODELVIEW);
}
static void Key(unsigned char key, int x, int y)
{
switch (key) {
case 27:
exit(1);
default:
return;
}
glutPostRedisplay();
}
static void Draw(void)
{
glClear(GL_COLOR_BUFFER_BIT);
glBegin(GL_TRIANGLES);
glColor3f(0,0,1);
glVertex3f( 0.9, -0.9, -30.0);
glColor3f(1,0,0);
glVertex3f( 0.9, 0.9, -30.0);
glColor3f(0,1,0);
glVertex3f(-0.9, 0.0, -30.0);
glEnd();
glFlush();
}
int main(int argc, char **argv)
{
GLenum type;
glutInit(&argc, argv);
glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250);
type = GLUT_RGB;
type |= GLUT_SINGLE;
glutInitDisplayMode(type);
if (glutCreateWindow("First Tri") == GL_FALSE) {
exit(1);
}
Init();
glutReshapeFunc(Reshape);
glutKeyboardFunc(Key);
glutDisplayFunc(Draw);
glutMainLoop();
return 0;
}

110
progs/fp/tri-cmp.c Normal file
View File

@@ -0,0 +1,110 @@
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define GL_GLEXT_PROTOTYPES
#include <GL/glut.h>
static void Init( void )
{
static const char *modulate2D =
"!!ARBfp1.0\n"
"TEMP R0;\n"
"SUB R0, {0.5}.x, fragment.color; \n"
"CMP result.color, R0, fragment.color, {0.0}.x; \n"
"END"
;
GLuint modulateProg;
if (!glutExtensionSupported("GL_ARB_fragment_program")) {
printf("Error: GL_ARB_fragment_program not supported!\n");
exit(1);
}
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
/* Setup the fragment program */
glGenProgramsARB(1, &modulateProg);
glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg);
glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB,
strlen(modulate2D), (const GLubyte *)modulate2D);
printf("glGetError = 0x%x\n", (int) glGetError());
printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n",
(char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB));
glEnable(GL_FRAGMENT_PROGRAM_ARB);
glClearColor(.3, .3, .3, 0);
}
static void Reshape(int width, int height)
{
glViewport(0, 0, (GLint)width, (GLint)height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
glMatrixMode(GL_MODELVIEW);
}
static void Key(unsigned char key, int x, int y)
{
switch (key) {
case 27:
exit(1);
default:
return;
}
glutPostRedisplay();
}
static void Draw(void)
{
glClear(GL_COLOR_BUFFER_BIT);
glBegin(GL_TRIANGLES);
glColor3f(0,0,1);
glVertex3f( 0.9, -0.9, -30.0);
glColor3f(1,0,0);
glVertex3f( 0.9, 0.9, -30.0);
glColor3f(0,1,0);
glVertex3f(-0.9, 0.0, -30.0);
glEnd();
glFlush();
}
int main(int argc, char **argv)
{
GLenum type;
glutInit(&argc, argv);
glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250);
type = GLUT_RGB;
type |= GLUT_SINGLE;
glutInitDisplayMode(type);
if (glutCreateWindow("First Tri") == GL_FALSE) {
exit(1);
}
Init();
glutReshapeFunc(Reshape);
glutKeyboardFunc(Key);
glutDisplayFunc(Draw);
glutMainLoop();
return 0;
}

113
progs/fp/tri-cos.c Normal file
View File

@@ -0,0 +1,113 @@
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define GL_GLEXT_PROTOTYPES
#include <GL/glut.h>
#include "GL/gl.h"
static void Init( void )
{
static const char *modulate2D =
"!!ARBfp1.0\n"
"TEMP R0; \n"
"MUL R0, fragment.color, {3.14}.x; \n"
"COS result.color.x, R0.x; \n"
"COS result.color.y, R0.y; \n"
"COS result.color.z, R0.z; \n"
"END"
;
GLuint modulateProg;
if (!glutExtensionSupported("GL_ARB_fragment_program")) {
printf("Error: GL_ARB_fragment_program not supported!\n");
exit(1);
}
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
/* Setup the fragment program */
glGenProgramsARB(1, &modulateProg);
glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg);
glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB,
strlen(modulate2D), (const GLubyte *)modulate2D);
printf("glGetError = 0x%x\n", (int) glGetError());
printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n",
(char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB));
glEnable(GL_FRAGMENT_PROGRAM_ARB);
glClearColor(.3, .3, .3, 0);
}
static void Reshape(int width, int height)
{
glViewport(0, 0, (GLint)width, (GLint)height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
glMatrixMode(GL_MODELVIEW);
}
static void Key(unsigned char key, int x, int y)
{
switch (key) {
case 27:
exit(1);
default:
return;
}
glutPostRedisplay();
}
static void Draw(void)
{
glClear(GL_COLOR_BUFFER_BIT);
glBegin(GL_TRIANGLES);
glColor3f(0,0,1);
glVertex3f( 0.9, -0.9, -30.0);
glColor3f(1,0,0);
glVertex3f( 0.9, 0.9, -30.0);
glColor3f(0,1,0);
glVertex3f(-0.9, 0.0, -30.0);
glEnd();
glFlush();
}
int main(int argc, char **argv)
{
GLenum type;
glutInit(&argc, argv);
glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250);
type = GLUT_RGB;
type |= GLUT_SINGLE;
glutInitDisplayMode(type);
if (glutCreateWindow("First Tri") == GL_FALSE) {
exit(1);
}
Init();
glutReshapeFunc(Reshape);
glutKeyboardFunc(Key);
glutDisplayFunc(Draw);
glutMainLoop();
return 0;
}

111
progs/fp/tri-depth.c Normal file
View File

@@ -0,0 +1,111 @@
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define GL_GLEXT_PROTOTYPES
#include <GL/glut.h>
#include "GL/gl.h"
static void Init( void )
{
/* scale of 10.0 gives me a visible result on nv hardware.
*/
static const char *modulate2D =
"!!ARBfp1.0\n"
"MUL result.color, fragment.position.z, {10.0}.x; \n"
"END"
;
GLuint modulateProg;
if (!glutExtensionSupported("GL_ARB_fragment_program")) {
printf("Error: GL_ARB_fragment_program not supported!\n");
exit(1);
}
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
/* Setup the fragment program */
glGenProgramsARB(1, &modulateProg);
glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg);
glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB,
strlen(modulate2D), (const GLubyte *)modulate2D);
printf("glGetError = 0x%x\n", (int) glGetError());
printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n",
(char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB));
glEnable(GL_FRAGMENT_PROGRAM_ARB);
glClearColor(.3, .3, .3, 0);
}
static void Reshape(int width, int height)
{
glViewport(0, 0, (GLint)width, (GLint)height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
glMatrixMode(GL_MODELVIEW);
}
static void Key(unsigned char key, int x, int y)
{
switch (key) {
case 27:
exit(1);
default:
return;
}
glutPostRedisplay();
}
static void Draw(void)
{
glClear(GL_COLOR_BUFFER_BIT);
glBegin(GL_TRIANGLES);
glColor3f(0,0,1);
glVertex3f( 0.9, -0.9, -40.0);
glColor3f(1,0,0);
glVertex3f( 0.9, 0.9, -40.0);
glColor3f(0,1,0);
glVertex3f(-0.9, 0.0, -25.0);
glEnd();
glFlush();
}
int main(int argc, char **argv)
{
GLenum type;
glutInit(&argc, argv);
glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250);
type = GLUT_RGB;
type |= GLUT_SINGLE;
glutInitDisplayMode(type);
if (glutCreateWindow("First Tri") == GL_FALSE) {
exit(1);
}
Init();
glutReshapeFunc(Reshape);
glutKeyboardFunc(Key);
glutDisplayFunc(Draw);
glutMainLoop();
return 0;
}

116
progs/fp/tri-depth2.c Normal file
View File

@@ -0,0 +1,116 @@
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define GL_GLEXT_PROTOTYPES
#include <GL/glut.h>
#include "GL/gl.h"
static void Init( void )
{
/* scale of 10.0 gives me a visible result on nv hardware.
*/
static const char *modulate2D =
"!!ARBfp1.0\n"
"TEMP R0;\n"
"MUL R0, fragment.position.z, {10.0}.x;\n"
"MOV result.color, R0; \n"
"END"
;
GLuint modulateProg;
if (!glutExtensionSupported("GL_ARB_fragment_program")) {
printf("Error: GL_ARB_fragment_program not supported!\n");
exit(1);
}
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
/* Setup the fragment program */
glGenProgramsARB(1, &modulateProg);
glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg);
glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB,
strlen(modulate2D), (const GLubyte *)modulate2D);
printf("glGetError = 0x%x\n", (int) glGetError());
printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n",
(char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB));
glEnable(GL_FRAGMENT_PROGRAM_ARB);
glClearColor(.3, .3, .3, 0);
}
static void Reshape(int width, int height)
{
glViewport(0, 0, (GLint)width, (GLint)height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
glMatrixMode(GL_MODELVIEW);
}
static void Key(unsigned char key, int x, int y)
{
switch (key) {
case 27:
exit(1);
default:
return;
}
glutPostRedisplay();
}
static void Draw(void)
{
glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
glEnable(GL_DEPTH_TEST);
glBegin(GL_TRIANGLES);
glColor3f(0,0,1);
glVertex3f( 0.9, -0.9, -30.0);
glVertex3f( 0.9, 0.9, -30.0);
glVertex3f(-0.9, 0.0, -30.0);
glColor3f(0,1,0);
glVertex3f(-0.9, -0.9, -40.0);
glVertex3f(-0.9, 0.9, -40.0);
glVertex3f( 0.9, 0.0, -25.0);
glEnd();
glFlush();
}
int main(int argc, char **argv)
{
GLenum type;
glutInit(&argc, argv);
glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250);
type = GLUT_RGB | GLUT_DEPTH;
type |= GLUT_SINGLE;
glutInitDisplayMode(type);
if (glutCreateWindow("First Tri") == GL_FALSE) {
exit(1);
}
Init();
glutReshapeFunc(Reshape);
glutKeyboardFunc(Key);
glutDisplayFunc(Draw);
glutMainLoop();
return 0;
}

107
progs/fp/tri-depthwrite.c Normal file
View File

@@ -0,0 +1,107 @@
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define GL_GLEXT_PROTOTYPES
#include <GL/glut.h>
static void Init(void)
{
static const char *modulate2D =
"!!ARBfp1.0\n"
"MUL result.depth.z, fragment.color.z, {.1}.x; \n"
"MOV result.color.xy, fragment.color; \n"
"END"
;
GLuint modulateProg;
if (!glutExtensionSupported("GL_ARB_fragment_program")) {
printf("Error: GL_ARB_fragment_program not supported!\n");
exit(1);
}
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
/* Setup the fragment program */
glGenProgramsARB(1, &modulateProg);
glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg);
glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB,
strlen(modulate2D), (const GLubyte *)modulate2D);
printf("glGetError = 0x%x\n", (int) glGetError());
printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n",
(char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB));
glEnable(GL_FRAGMENT_PROGRAM_ARB);
glClearColor(.3, .3, .3, 0);
}
static void Reshape(int width, int height)
{
glViewport(0, 0, (GLint)width, (GLint)height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
glMatrixMode(GL_MODELVIEW);
}
static void Key(unsigned char key, int x, int y)
{
switch (key) {
case 27:
exit(1);
default:
return;
}
glutPostRedisplay();
}
static void Draw(void)
{
glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
glEnable(GL_DEPTH_TEST);
glBegin(GL_TRIANGLES);
glColor4f(.8,0,.5,0);
glVertex3f( 0.9, -0.9, -30.0);
glVertex3f( 0.9, 0.9, -30.0);
glVertex3f(-0.9, 0.0, -30.0);
glColor4f(0,.8,.7,0);
glVertex3f(-0.9, -0.9, -40.0);
glColor4f(0,.8,.7,0);
glVertex3f(-0.9, 0.9, -40.0);
glColor4f(0,.8,.3,0);
glVertex3f( 0.9, 0.0, -40.0);
glEnd();
glFlush();
}
int main(int argc, char **argv)
{
glutInit(&argc, argv);
glutInitWindowPosition(0, 0); glutInitWindowSize( 300, 300);
glutInitDisplayMode(GLUT_DEPTH | GLUT_RGB | GLUT_SINGLE);
if (glutCreateWindow("Depth Test") == GL_FALSE) {
exit(1);
}
Init();
glutReshapeFunc(Reshape);
glutKeyboardFunc(Key);
glutDisplayFunc(Draw);
glutMainLoop();
return 0;
}

107
progs/fp/tri-depthwrite2.c Normal file
View File

@@ -0,0 +1,107 @@
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define GL_GLEXT_PROTOTYPES
#include <GL/glut.h>
static void Init(void)
{
static const char *modulate2D =
"!!ARBfp1.0\n"
"MUL result.depth.z, fragment.color.z, {.1}.x; \n"
"MOV result.color, fragment.color.z; \n"
"END"
;
GLuint modulateProg;
if (!glutExtensionSupported("GL_ARB_fragment_program")) {
printf("Error: GL_ARB_fragment_program not supported!\n");
exit(1);
}
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
/* Setup the fragment program */
glGenProgramsARB(1, &modulateProg);
glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg);
glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB,
strlen(modulate2D), (const GLubyte *)modulate2D);
printf("glGetError = 0x%x\n", (int) glGetError());
printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n",
(char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB));
glEnable(GL_FRAGMENT_PROGRAM_ARB);
glClearColor(.3, .3, .3, 0);
}
static void Reshape(int width, int height)
{
glViewport(0, 0, (GLint)width, (GLint)height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
glMatrixMode(GL_MODELVIEW);
}
static void Key(unsigned char key, int x, int y)
{
switch (key) {
case 27:
exit(1);
default:
return;
}
glutPostRedisplay();
}
static void Draw(void)
{
glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
glEnable(GL_DEPTH_TEST);
glBegin(GL_TRIANGLES);
glColor4f(.8,0,.5,0);
glVertex3f( 0.9, -0.9, -30.0);
glVertex3f( 0.9, 0.9, -30.0);
glVertex3f(-0.9, 0.0, -30.0);
glColor4f(0,.8,.7,0);
glVertex3f(-0.9, -0.9, -40.0);
glColor4f(0,.8,.7,0);
glVertex3f(-0.9, 0.9, -40.0);
glColor4f(0,.8,.3,0);
glVertex3f( 0.9, 0.0, -40.0);
glEnd();
glFlush();
}
int main(int argc, char **argv)
{
glutInit(&argc, argv);
glutInitWindowPosition(0, 0); glutInitWindowSize( 300, 300);
glutInitDisplayMode(GLUT_DEPTH | GLUT_RGB | GLUT_SINGLE);
if (glutCreateWindow("Depth Test") == GL_FALSE) {
exit(1);
}
Init();
glutReshapeFunc(Reshape);
glutKeyboardFunc(Key);
glutDisplayFunc(Draw);
glutMainLoop();
return 0;
}

109
progs/fp/tri-dp3.c Normal file
View File

@@ -0,0 +1,109 @@
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define GL_GLEXT_PROTOTYPES
#include <GL/glut.h>
static void Init( void )
{
static const char *modulate2D =
"!!ARBfp1.0\n"
"TEMP R0;\n"
"DP3 result.color, fragment.color, fragment.color; \n"
"END"
;
GLuint modulateProg;
if (!glutExtensionSupported("GL_ARB_fragment_program")) {
printf("Error: GL_ARB_fragment_program not supported!\n");
exit(1);
}
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
/* Setup the fragment program */
glGenProgramsARB(1, &modulateProg);
glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg);
glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB,
strlen(modulate2D), (const GLubyte *)modulate2D);
printf("glGetError = 0x%x\n", (int) glGetError());
printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n",
(char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB));
glEnable(GL_FRAGMENT_PROGRAM_ARB);
glClearColor(.3, .3, .3, 0);
}
static void Reshape(int width, int height)
{
glViewport(0, 0, (GLint)width, (GLint)height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
glMatrixMode(GL_MODELVIEW);
}
static void Key(unsigned char key, int x, int y)
{
switch (key) {
case 27:
exit(1);
default:
return;
}
glutPostRedisplay();
}
static void Draw(void)
{
glClear(GL_COLOR_BUFFER_BIT);
glBegin(GL_TRIANGLES);
glColor3f(0,0,1);
glVertex3f( 0.9, -0.9, -30.0);
glColor3f(1,0,0);
glVertex3f( 0.9, 0.9, -30.0);
glColor3f(0,1,0);
glVertex3f(-0.9, 0.0, -30.0);
glEnd();
glFlush();
}
int main(int argc, char **argv)
{
GLenum type;
glutInit(&argc, argv);
glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250);
type = GLUT_RGB;
type |= GLUT_SINGLE;
glutInitDisplayMode(type);
if (glutCreateWindow("First Tri") == GL_FALSE) {
exit(1);
}
Init();
glutReshapeFunc(Reshape);
glutKeyboardFunc(Key);
glutDisplayFunc(Draw);
glutMainLoop();
return 0;
}

109
progs/fp/tri-dp4.c Normal file
View File

@@ -0,0 +1,109 @@
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define GL_GLEXT_PROTOTYPES
#include <GL/glut.h>
static void Init( void )
{
static const char *modulate2D =
"!!ARBfp1.0\n"
"TEMP R0;\n"
"DP4 result.color, fragment.color.xxxx, fragment.color; \n"
"END"
;
GLuint modulateProg;
if (!glutExtensionSupported("GL_ARB_fragment_program")) {
printf("Error: GL_ARB_fragment_program not supported!\n");
exit(1);
}
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
/* Setup the fragment program */
glGenProgramsARB(1, &modulateProg);
glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg);
glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB,
strlen(modulate2D), (const GLubyte *)modulate2D);
printf("glGetError = 0x%x\n", (int) glGetError());
printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n",
(char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB));
glEnable(GL_FRAGMENT_PROGRAM_ARB);
glClearColor(.3, .3, .3, 0);
}
static void Reshape(int width, int height)
{
glViewport(0, 0, (GLint)width, (GLint)height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
glMatrixMode(GL_MODELVIEW);
}
static void Key(unsigned char key, int x, int y)
{
switch (key) {
case 27:
exit(1);
default:
return;
}
glutPostRedisplay();
}
static void Draw(void)
{
glClear(GL_COLOR_BUFFER_BIT);
glBegin(GL_TRIANGLES);
glColor3f(0,0,1);
glVertex3f( 0.9, -0.9, -30.0);
glColor3f(1,0,0);
glVertex3f( 0.9, 0.9, -30.0);
glColor3f(0,1,0);
glVertex3f(-0.9, 0.0, -30.0);
glEnd();
glFlush();
}
int main(int argc, char **argv)
{
GLenum type;
glutInit(&argc, argv);
glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250);
type = GLUT_RGB;
type |= GLUT_SINGLE;
glutInitDisplayMode(type);
if (glutCreateWindow("First Tri") == GL_FALSE) {
exit(1);
}
Init();
glutReshapeFunc(Reshape);
glutKeyboardFunc(Key);
glutDisplayFunc(Draw);
glutMainLoop();
return 0;
}

109
progs/fp/tri-dph.c Normal file
View File

@@ -0,0 +1,109 @@
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define GL_GLEXT_PROTOTYPES
#include <GL/glut.h>
static void Init( void )
{
static const char *modulate2D =
"!!ARBfp1.0\n"
"TEMP R0;\n"
"DPH result.color, fragment.color, fragment.color.xyzx; \n"
"END"
;
GLuint modulateProg;
if (!glutExtensionSupported("GL_ARB_fragment_program")) {
printf("Error: GL_ARB_fragment_program not supported!\n");
exit(1);
}
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
/* Setup the fragment program */
glGenProgramsARB(1, &modulateProg);
glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg);
glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB,
strlen(modulate2D), (const GLubyte *)modulate2D);
printf("glGetError = 0x%x\n", (int) glGetError());
printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n",
(char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB));
glEnable(GL_FRAGMENT_PROGRAM_ARB);
glClearColor(.3, .3, .3, 0);
}
static void Reshape(int width, int height)
{
glViewport(0, 0, (GLint)width, (GLint)height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
glMatrixMode(GL_MODELVIEW);
}
static void Key(unsigned char key, int x, int y)
{
switch (key) {
case 27:
exit(1);
default:
return;
}
glutPostRedisplay();
}
static void Draw(void)
{
glClear(GL_COLOR_BUFFER_BIT);
glBegin(GL_TRIANGLES);
glColor3f(0,0,1);
glVertex3f( 0.9, -0.9, -30.0);
glColor3f(1,0,0);
glVertex3f( 0.9, 0.9, -30.0);
glColor3f(0,1,0);
glVertex3f(-0.9, 0.0, -30.0);
glEnd();
glFlush();
}
int main(int argc, char **argv)
{
GLenum type;
glutInit(&argc, argv);
glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250);
type = GLUT_RGB;
type |= GLUT_SINGLE;
glutInitDisplayMode(type);
if (glutCreateWindow("First Tri") == GL_FALSE) {
exit(1);
}
Init();
glutReshapeFunc(Reshape);
glutKeyboardFunc(Key);
glutDisplayFunc(Draw);
glutMainLoop();
return 0;
}

109
progs/fp/tri-dst.c Normal file
View File

@@ -0,0 +1,109 @@
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define GL_GLEXT_PROTOTYPES
#include <GL/glut.h>
#include "GL/gl.h"
static void Init( void )
{
static const char *modulate2D =
"!!ARBfp1.0\n"
"DST result.color, fragment.color, fragment.color; \n"
"END"
;
GLuint modulateProg;
if (!glutExtensionSupported("GL_ARB_fragment_program")) {
printf("Error: GL_ARB_fragment_program not supported!\n");
exit(1);
}
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
/* Setup the fragment program */
glGenProgramsARB(1, &modulateProg);
glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg);
glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB,
strlen(modulate2D), (const GLubyte *)modulate2D);
printf("glGetError = 0x%x\n", (int) glGetError());
printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n",
(char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB));
glEnable(GL_FRAGMENT_PROGRAM_ARB);
glClearColor(.3, .3, .3, 0);
}
static void Reshape(int width, int height)
{
glViewport(0, 0, (GLint)width, (GLint)height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
glMatrixMode(GL_MODELVIEW);
}
static void Key(unsigned char key, int x, int y)
{
switch (key) {
case 27:
exit(1);
default:
return;
}
glutPostRedisplay();
}
static void Draw(void)
{
glClear(GL_COLOR_BUFFER_BIT);
glBegin(GL_TRIANGLES);
glColor3f(0,0,1);
glVertex3f( 0.9, -0.9, -30.0);
glColor3f(1,0,0);
glVertex3f( 0.9, 0.9, -30.0);
glColor3f(0,1,0);
glVertex3f(-0.9, 0.0, -30.0);
glEnd();
glFlush();
}
int main(int argc, char **argv)
{
GLenum type;
glutInit(&argc, argv);
glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250);
type = GLUT_RGB;
type |= GLUT_SINGLE;
glutInitDisplayMode(type);
if (glutCreateWindow("First Tri") == GL_FALSE) {
exit(1);
}
Init();
glutReshapeFunc(Reshape);
glutKeyboardFunc(Key);
glutDisplayFunc(Draw);
glutMainLoop();
return 0;
}

110
progs/fp/tri-ex2.c Normal file
View File

@@ -0,0 +1,110 @@
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define GL_GLEXT_PROTOTYPES
#include <GL/glut.h>
static void Init( void )
{
static const char *modulate2D =
"!!ARBfp1.0\n"
"TEMP R0;\n"
"EX2 R0, fragment.color.x; \n"
"SUB result.color, R0, {1.0}.x; \n"
"END"
;
GLuint modulateProg;
if (!glutExtensionSupported("GL_ARB_fragment_program")) {
printf("Error: GL_ARB_fragment_program not supported!\n");
exit(1);
}
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
/* Setup the fragment program */
glGenProgramsARB(1, &modulateProg);
glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg);
glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB,
strlen(modulate2D), (const GLubyte *)modulate2D);
printf("glGetError = 0x%x\n", (int) glGetError());
printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n",
(char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB));
glEnable(GL_FRAGMENT_PROGRAM_ARB);
glClearColor(.3, .3, .3, 0);
}
static void Reshape(int width, int height)
{
glViewport(0, 0, (GLint)width, (GLint)height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
glMatrixMode(GL_MODELVIEW);
}
static void Key(unsigned char key, int x, int y)
{
switch (key) {
case 27:
exit(1);
default:
return;
}
glutPostRedisplay();
}
static void Draw(void)
{
glClear(GL_COLOR_BUFFER_BIT);
glBegin(GL_TRIANGLES);
glColor3f(0,0,1);
glVertex3f( 0.9, -0.9, -30.0);
glColor3f(1,0,0);
glVertex3f( 0.9, 0.9, -30.0);
glColor3f(0,1,0);
glVertex3f(-0.9, 0.0, -30.0);
glEnd();
glFlush();
}
int main(int argc, char **argv)
{
GLenum type;
glutInit(&argc, argv);
glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250);
type = GLUT_RGB;
type |= GLUT_SINGLE;
glutInitDisplayMode(type);
if (glutCreateWindow("First Tri") == GL_FALSE) {
exit(1);
}
Init();
glutReshapeFunc(Reshape);
glutKeyboardFunc(Key);
glutDisplayFunc(Draw);
glutMainLoop();
return 0;
}

110
progs/fp/tri-flr.c Normal file
View File

@@ -0,0 +1,110 @@
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define GL_GLEXT_PROTOTYPES
#include <GL/glut.h>
static void Init( void )
{
static const char *modulate2D =
"!!ARBfp1.0\n"
"TEMP R0;\n"
"ADD R0, fragment.color, {0.5}.x; \n"
"FLR result.color, R0; \n"
"END"
;
GLuint modulateProg;
if (!glutExtensionSupported("GL_ARB_fragment_program")) {
printf("Error: GL_ARB_fragment_program not supported!\n");
exit(1);
}
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
/* Setup the fragment program */
glGenProgramsARB(1, &modulateProg);
glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg);
glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB,
strlen(modulate2D), (const GLubyte *)modulate2D);
printf("glGetError = 0x%x\n", (int) glGetError());
printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n",
(char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB));
glEnable(GL_FRAGMENT_PROGRAM_ARB);
glClearColor(.3, .3, .3, 0);
}
static void Reshape(int width, int height)
{
glViewport(0, 0, (GLint)width, (GLint)height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
glMatrixMode(GL_MODELVIEW);
}
static void Key(unsigned char key, int x, int y)
{
switch (key) {
case 27:
exit(1);
default:
return;
}
glutPostRedisplay();
}
static void Draw(void)
{
glClear(GL_COLOR_BUFFER_BIT);
glBegin(GL_TRIANGLES);
glColor3f(0,0,1);
glVertex3f( 0.9, -0.9, -30.0);
glColor3f(1,0,0);
glVertex3f( 0.9, 0.9, -30.0);
glColor3f(0,1,0);
glVertex3f(-0.9, 0.0, -30.0);
glEnd();
glFlush();
}
int main(int argc, char **argv)
{
GLenum type;
glutInit(&argc, argv);
glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250);
type = GLUT_RGB;
type |= GLUT_SINGLE;
glutInitDisplayMode(type);
if (glutCreateWindow("First Tri") == GL_FALSE) {
exit(1);
}
Init();
glutReshapeFunc(Reshape);
glutKeyboardFunc(Key);
glutDisplayFunc(Draw);
glutMainLoop();
return 0;
}

109
progs/fp/tri-fp.c Normal file
View File

@@ -0,0 +1,109 @@
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define GL_GLEXT_PROTOTYPES
#include <GL/glut.h>
#include "GL/gl.h"
static void Init( void )
{
static const char *modulate2D =
"!!ARBfp1.0\n"
"SLT result.color, {0.5}.x, fragment.color; \n"
"END"
;
GLuint modulateProg;
if (!glutExtensionSupported("GL_ARB_fragment_program")) {
printf("Error: GL_ARB_fragment_program not supported!\n");
exit(1);
}
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
/* Setup the fragment program */
glGenProgramsARB(1, &modulateProg);
glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg);
glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB,
strlen(modulate2D), (const GLubyte *)modulate2D);
printf("glGetError = 0x%x\n", (int) glGetError());
printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n",
(char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB));
glEnable(GL_FRAGMENT_PROGRAM_ARB);
glClearColor(.3, .3, .3, 0);
}
static void Reshape(int width, int height)
{
glViewport(0, 0, (GLint)width, (GLint)height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
glMatrixMode(GL_MODELVIEW);
}
static void Key(unsigned char key, int x, int y)
{
switch (key) {
case 27:
exit(1);
default:
return;
}
glutPostRedisplay();
}
static void Draw(void)
{
glClear(GL_COLOR_BUFFER_BIT);
glBegin(GL_TRIANGLES);
glColor3f(0,0,1);
glVertex3f( 0.9, -0.9, -30.0);
glColor3f(1,0,0);
glVertex3f( 0.9, 0.9, -30.0);
glColor3f(0,1,0);
glVertex3f(-0.9, 0.0, -30.0);
glEnd();
glFlush();
}
int main(int argc, char **argv)
{
GLenum type;
glutInit(&argc, argv);
glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250);
type = GLUT_RGB;
type |= GLUT_SINGLE;
glutInitDisplayMode(type);
if (glutCreateWindow("First Tri") == GL_FALSE) {
exit(1);
}
Init();
glutReshapeFunc(Reshape);
glutKeyboardFunc(Key);
glutDisplayFunc(Draw);
glutMainLoop();
return 0;
}

111
progs/fp/tri-frc.c Normal file
View File

@@ -0,0 +1,111 @@
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define GL_GLEXT_PROTOTYPES
#include <GL/glut.h>
#include "GL/gl.h"
static void Init( void )
{
static const char *modulate2D =
"!!ARBfp1.0\n"
"TEMP R0; \n"
"MUL R0, fragment.color, {3.0}.x; \n"
"FRC result.color, R0; \n"
"END"
;
GLuint modulateProg;
if (!glutExtensionSupported("GL_ARB_fragment_program")) {
printf("Error: GL_ARB_fragment_program not supported!\n");
exit(1);
}
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
/* Setup the fragment program */
glGenProgramsARB(1, &modulateProg);
glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg);
glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB,
strlen(modulate2D), (const GLubyte *)modulate2D);
printf("glGetError = 0x%x\n", (int) glGetError());
printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n",
(char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB));
glEnable(GL_FRAGMENT_PROGRAM_ARB);
glClearColor(.3, .3, .3, 0);
}
static void Reshape(int width, int height)
{
glViewport(0, 0, (GLint)width, (GLint)height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
glMatrixMode(GL_MODELVIEW);
}
static void Key(unsigned char key, int x, int y)
{
switch (key) {
case 27:
exit(1);
default:
return;
}
glutPostRedisplay();
}
static void Draw(void)
{
glClear(GL_COLOR_BUFFER_BIT);
glBegin(GL_TRIANGLES);
glColor3f(0,0,1);
glVertex3f( 0.9, -0.9, -30.0);
glColor3f(1,0,0);
glVertex3f( 0.9, 0.9, -30.0);
glColor3f(0,1,0);
glVertex3f(-0.9, 0.0, -30.0);
glEnd();
glFlush();
}
int main(int argc, char **argv)
{
GLenum type;
glutInit(&argc, argv);
glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250);
type = GLUT_RGB;
type |= GLUT_SINGLE;
glutInitDisplayMode(type);
if (glutCreateWindow("First Tri") == GL_FALSE) {
exit(1);
}
Init();
glutReshapeFunc(Reshape);
glutKeyboardFunc(Key);
glutDisplayFunc(Draw);
glutMainLoop();
return 0;
}

109
progs/fp/tri-inv.c Normal file
View File

@@ -0,0 +1,109 @@
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define GL_GLEXT_PROTOTYPES
#include <GL/glut.h>
static void Init( void )
{
static const char *modulate2D =
"!!ARBfp1.0\n"
"TEMP R0;\n"
"INV result.color, fragment.color; \n"
"END"
;
GLuint modulateProg;
if (!glutExtensionSupported("GL_ARB_fragment_program")) {
printf("Error: GL_ARB_fragment_program not supported!\n");
exit(1);
}
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
/* Setup the fragment program */
glGenProgramsARB(1, &modulateProg);
glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg);
glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB,
strlen(modulate2D), (const GLubyte *)modulate2D);
printf("glGetError = 0x%x\n", (int) glGetError());
printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n",
(char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB));
glEnable(GL_FRAGMENT_PROGRAM_ARB);
glClearColor(.3, .3, .3, 0);
}
static void Reshape(int width, int height)
{
glViewport(0, 0, (GLint)width, (GLint)height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
glMatrixMode(GL_MODELVIEW);
}
static void Key(unsigned char key, int x, int y)
{
switch (key) {
case 27:
exit(1);
default:
return;
}
glutPostRedisplay();
}
static void Draw(void)
{
glClear(GL_COLOR_BUFFER_BIT);
glBegin(GL_TRIANGLES);
glColor3f(0,0,1);
glVertex3f( 0.9, -0.9, -30.0);
glColor3f(1,0,0);
glVertex3f( 0.9, 0.9, -30.0);
glColor3f(0,1,0);
glVertex3f(-0.9, 0.0, -30.0);
glEnd();
glFlush();
}
int main(int argc, char **argv)
{
GLenum type;
glutInit(&argc, argv);
glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250);
type = GLUT_RGB;
type |= GLUT_SINGLE;
glutInitDisplayMode(type);
if (glutCreateWindow("First Tri") == GL_FALSE) {
exit(1);
}
Init();
glutReshapeFunc(Reshape);
glutKeyboardFunc(Key);
glutDisplayFunc(Draw);
glutMainLoop();
return 0;
}

111
progs/fp/tri-kil.c Normal file
View File

@@ -0,0 +1,111 @@
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define GL_GLEXT_PROTOTYPES
#include <GL/glut.h>
static void Init( void )
{
static const char *modulate2D =
"!!ARBfp1.0\n"
"TEMP R0;\n"
"SUB R0, fragment.color, {0.5,0,0,0}; \n"
"KIL R0;"
"MOV result.color, R0;"
"END"
;
GLuint modulateProg;
if (!glutExtensionSupported("GL_ARB_fragment_program")) {
printf("Error: GL_ARB_fragment_program not supported!\n");
exit(1);
}
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
/* Setup the fragment program */
glGenProgramsARB(1, &modulateProg);
glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg);
glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB,
strlen(modulate2D), (const GLubyte *)modulate2D);
printf("glGetError = 0x%x\n", (int) glGetError());
printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n",
(char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB));
glEnable(GL_FRAGMENT_PROGRAM_ARB);
glClearColor(.3, .3, .3, 0);
}
static void Reshape(int width, int height)
{
glViewport(0, 0, (GLint)width, (GLint)height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
glMatrixMode(GL_MODELVIEW);
}
static void Key(unsigned char key, int x, int y)
{
switch (key) {
case 27:
exit(1);
default:
return;
}
glutPostRedisplay();
}
static void Draw(void)
{
glClear(GL_COLOR_BUFFER_BIT);
glBegin(GL_TRIANGLES);
glColor3f(0,0,1);
glVertex3f( 0.9, -0.9, -30.0);
glColor3f(1,0,0);
glVertex3f( 0.9, 0.9, -30.0);
glColor3f(0,1,0);
glVertex3f(-0.9, 0.0, -30.0);
glEnd();
glFlush();
}
int main(int argc, char **argv)
{
GLenum type;
glutInit(&argc, argv);
glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250);
type = GLUT_RGB;
type |= GLUT_SINGLE;
glutInitDisplayMode(type);
if (glutCreateWindow("First Tri") == GL_FALSE) {
exit(1);
}
Init();
glutReshapeFunc(Reshape);
glutKeyboardFunc(Key);
glutDisplayFunc(Draw);
glutMainLoop();
return 0;
}

110
progs/fp/tri-lg2.c Normal file
View File

@@ -0,0 +1,110 @@
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define GL_GLEXT_PROTOTYPES
#include <GL/glut.h>
static void Init( void )
{
static const char *modulate2D =
"!!ARBfp1.0\n"
"TEMP R0;\n"
"MUL R0, fragment.color, {4.0}.x; \n"
"LG2 result.color, R0.x; \n"
"END"
;
GLuint modulateProg;
if (!glutExtensionSupported("GL_ARB_fragment_program")) {
printf("Error: GL_ARB_fragment_program not supported!\n");
exit(1);
}
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
/* Setup the fragment program */
glGenProgramsARB(1, &modulateProg);
glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg);
glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB,
strlen(modulate2D), (const GLubyte *)modulate2D);
printf("glGetError = 0x%x\n", (int) glGetError());
printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n",
(char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB));
glEnable(GL_FRAGMENT_PROGRAM_ARB);
glClearColor(.3, .3, .3, 0);
}
static void Reshape(int width, int height)
{
glViewport(0, 0, (GLint)width, (GLint)height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
glMatrixMode(GL_MODELVIEW);
}
static void Key(unsigned char key, int x, int y)
{
switch (key) {
case 27:
exit(1);
default:
return;
}
glutPostRedisplay();
}
static void Draw(void)
{
glClear(GL_COLOR_BUFFER_BIT);
glBegin(GL_TRIANGLES);
glColor3f(0,0,1);
glVertex3f( 0.9, -0.9, -30.0);
glColor3f(1,0,0);
glVertex3f( 0.9, 0.9, -30.0);
glColor3f(0,1,0);
glVertex3f(-0.9, 0.0, -30.0);
glEnd();
glFlush();
}
int main(int argc, char **argv)
{
GLenum type;
glutInit(&argc, argv);
glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250);
type = GLUT_RGB;
type |= GLUT_SINGLE;
glutInitDisplayMode(type);
if (glutCreateWindow("First Tri") == GL_FALSE) {
exit(1);
}
Init();
glutReshapeFunc(Reshape);
glutKeyboardFunc(Key);
glutDisplayFunc(Draw);
glutMainLoop();
return 0;
}

111
progs/fp/tri-lit.c Normal file
View File

@@ -0,0 +1,111 @@
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define GL_GLEXT_PROTOTYPES
#include <GL/glut.h>
#include "GL/gl.h"
static void Init( void )
{
static const char *modulate2D =
"!!ARBfp1.0\n"
"TEMP R0;\n"
"SUB R0, {0.5}.x, fragment.color; \n"
"LIT result.color, R0; \n"
"END"
;
GLuint modulateProg;
if (!glutExtensionSupported("GL_ARB_fragment_program")) {
printf("Error: GL_ARB_fragment_program not supported!\n");
exit(1);
}
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
/* Setup the fragment program */
glGenProgramsARB(1, &modulateProg);
glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg);
glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB,
strlen(modulate2D), (const GLubyte *)modulate2D);
printf("glGetError = 0x%x\n", (int) glGetError());
printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n",
(char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB));
glEnable(GL_FRAGMENT_PROGRAM_ARB);
glClearColor(.3, .3, .3, 0);
}
static void Reshape(int width, int height)
{
glViewport(0, 0, (GLint)width, (GLint)height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
glMatrixMode(GL_MODELVIEW);
}
static void Key(unsigned char key, int x, int y)
{
switch (key) {
case 27:
exit(1);
default:
return;
}
glutPostRedisplay();
}
static void Draw(void)
{
glClear(GL_COLOR_BUFFER_BIT);
glBegin(GL_TRIANGLES);
glColor3f(0,0,1);
glVertex3f( 0.9, -0.9, -30.0);
glColor3f(1,0,0);
glVertex3f( 0.9, 0.9, -30.0);
glColor3f(0,1,0);
glVertex3f(-0.9, 0.0, -30.0);
glEnd();
glFlush();
}
int main(int argc, char **argv)
{
GLenum type;
glutInit(&argc, argv);
glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250);
type = GLUT_RGB;
type |= GLUT_SINGLE;
glutInitDisplayMode(type);
if (glutCreateWindow("First Tri") == GL_FALSE) {
exit(1);
}
Init();
glutReshapeFunc(Reshape);
glutKeyboardFunc(Key);
glutDisplayFunc(Draw);
glutMainLoop();
return 0;
}

109
progs/fp/tri-lrp.c Normal file
View File

@@ -0,0 +1,109 @@
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define GL_GLEXT_PROTOTYPES
#include <GL/glut.h>
static void Init( void )
{
static const char *modulate2D =
"!!ARBfp1.0\n"
"TEMP R0, R1;\n"
"LRP result.color, fragment.color.z, {1,0,0,1}, {0,1,0,1}; \n"
"END"
;
GLuint modulateProg;
if (!glutExtensionSupported("GL_ARB_fragment_program")) {
printf("Error: GL_ARB_fragment_program not supported!\n");
exit(1);
}
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
/* Setup the fragment program */
glGenProgramsARB(1, &modulateProg);
glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg);
glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB,
strlen(modulate2D), (const GLubyte *)modulate2D);
printf("glGetError = 0x%x\n", (int) glGetError());
printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n",
(char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB));
glEnable(GL_FRAGMENT_PROGRAM_ARB);
glClearColor(.3, .3, .3, 0);
}
static void Reshape(int width, int height)
{
glViewport(0, 0, (GLint)width, (GLint)height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
glMatrixMode(GL_MODELVIEW);
}
static void Key(unsigned char key, int x, int y)
{
switch (key) {
case 27:
exit(1);
default:
return;
}
glutPostRedisplay();
}
static void Draw(void)
{
glClear(GL_COLOR_BUFFER_BIT);
glBegin(GL_TRIANGLES);
glColor3f(0,0,1);
glVertex3f( 0.9, -0.9, -30.0);
glColor3f(1,0,0);
glVertex3f( 0.9, 0.9, -30.0);
glColor3f(0,1,0);
glVertex3f(-0.9, 0.0, -30.0);
glEnd();
glFlush();
}
int main(int argc, char **argv)
{
GLenum type;
glutInit(&argc, argv);
glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250);
type = GLUT_RGB;
type |= GLUT_SINGLE;
glutInitDisplayMode(type);
if (glutCreateWindow("First Tri") == GL_FALSE) {
exit(1);
}
Init();
glutReshapeFunc(Reshape);
glutKeyboardFunc(Key);
glutDisplayFunc(Draw);
glutMainLoop();
return 0;
}

109
progs/fp/tri-mad.c Normal file
View File

@@ -0,0 +1,109 @@
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define GL_GLEXT_PROTOTYPES
#include <GL/glut.h>
static void Init( void )
{
static const char *modulate2D =
"!!ARBfp1.0\n"
"TEMP R0, R1;\n"
"MAD result.color, fragment.color.z, {1,0,0,1}, fragment.color; \n"
"END"
;
GLuint modulateProg;
if (!glutExtensionSupported("GL_ARB_fragment_program")) {
printf("Error: GL_ARB_fragment_program not supported!\n");
exit(1);
}
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
/* Setup the fragment program */
glGenProgramsARB(1, &modulateProg);
glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg);
glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB,
strlen(modulate2D), (const GLubyte *)modulate2D);
printf("glGetError = 0x%x\n", (int) glGetError());
printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n",
(char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB));
glEnable(GL_FRAGMENT_PROGRAM_ARB);
glClearColor(.3, .3, .3, 0);
}
static void Reshape(int width, int height)
{
glViewport(0, 0, (GLint)width, (GLint)height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
glMatrixMode(GL_MODELVIEW);
}
static void Key(unsigned char key, int x, int y)
{
switch (key) {
case 27:
exit(1);
default:
return;
}
glutPostRedisplay();
}
static void Draw(void)
{
glClear(GL_COLOR_BUFFER_BIT);
glBegin(GL_TRIANGLES);
glColor3f(0,0,1);
glVertex3f( 0.9, -0.9, -30.0);
glColor3f(1,0,0);
glVertex3f( 0.9, 0.9, -30.0);
glColor3f(0,1,0);
glVertex3f(-0.9, 0.0, -30.0);
glEnd();
glFlush();
}
int main(int argc, char **argv)
{
GLenum type;
glutInit(&argc, argv);
glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250);
type = GLUT_RGB;
type |= GLUT_SINGLE;
glutInitDisplayMode(type);
if (glutCreateWindow("First Tri") == GL_FALSE) {
exit(1);
}
Init();
glutReshapeFunc(Reshape);
glutKeyboardFunc(Key);
glutDisplayFunc(Draw);
glutMainLoop();
return 0;
}

109
progs/fp/tri-max.c Normal file
View File

@@ -0,0 +1,109 @@
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define GL_GLEXT_PROTOTYPES
#include <GL/glut.h>
#include "GL/gl.h"
static void Init( void )
{
static const char *modulate2D =
"!!ARBfp1.0\n"
"MAX result.color, {0.5}.x, fragment.color; \n"
"END"
;
GLuint modulateProg;
if (!glutExtensionSupported("GL_ARB_fragment_program")) {
printf("Error: GL_ARB_fragment_program not supported!\n");
exit(1);
}
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
/* Setup the fragment program */
glGenProgramsARB(1, &modulateProg);
glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg);
glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB,
strlen(modulate2D), (const GLubyte *)modulate2D);
printf("glGetError = 0x%x\n", (int) glGetError());
printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n",
(char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB));
glEnable(GL_FRAGMENT_PROGRAM_ARB);
glClearColor(.3, .3, .3, 0);
}
static void Reshape(int width, int height)
{
glViewport(0, 0, (GLint)width, (GLint)height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
glMatrixMode(GL_MODELVIEW);
}
static void Key(unsigned char key, int x, int y)
{
switch (key) {
case 27:
exit(1);
default:
return;
}
glutPostRedisplay();
}
static void Draw(void)
{
glClear(GL_COLOR_BUFFER_BIT);
glBegin(GL_TRIANGLES);
glColor3f(0,0,1);
glVertex3f( 0.9, -0.9, -30.0);
glColor3f(1,0,0);
glVertex3f( 0.9, 0.9, -30.0);
glColor3f(0,1,0);
glVertex3f(-0.9, 0.0, -30.0);
glEnd();
glFlush();
}
int main(int argc, char **argv)
{
GLenum type;
glutInit(&argc, argv);
glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250);
type = GLUT_RGB;
type |= GLUT_SINGLE;
glutInitDisplayMode(type);
if (glutCreateWindow("First Tri") == GL_FALSE) {
exit(1);
}
Init();
glutReshapeFunc(Reshape);
glutKeyboardFunc(Key);
glutDisplayFunc(Draw);
glutMainLoop();
return 0;
}

109
progs/fp/tri-min.c Normal file
View File

@@ -0,0 +1,109 @@
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define GL_GLEXT_PROTOTYPES
#include <GL/glut.h>
#include "GL/gl.h"
static void Init( void )
{
static const char *modulate2D =
"!!ARBfp1.0\n"
"MIN result.color, {0.5}.x, fragment.color; \n"
"END"
;
GLuint modulateProg;
if (!glutExtensionSupported("GL_ARB_fragment_program")) {
printf("Error: GL_ARB_fragment_program not supported!\n");
exit(1);
}
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
/* Setup the fragment program */
glGenProgramsARB(1, &modulateProg);
glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg);
glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB,
strlen(modulate2D), (const GLubyte *)modulate2D);
printf("glGetError = 0x%x\n", (int) glGetError());
printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n",
(char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB));
glEnable(GL_FRAGMENT_PROGRAM_ARB);
glClearColor(.3, .3, .3, 0);
}
static void Reshape(int width, int height)
{
glViewport(0, 0, (GLint)width, (GLint)height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
glMatrixMode(GL_MODELVIEW);
}
static void Key(unsigned char key, int x, int y)
{
switch (key) {
case 27:
exit(1);
default:
return;
}
glutPostRedisplay();
}
static void Draw(void)
{
glClear(GL_COLOR_BUFFER_BIT);
glBegin(GL_TRIANGLES);
glColor3f(0,0,1);
glVertex3f( 0.9, -0.9, -30.0);
glColor3f(1,0,0);
glVertex3f( 0.9, 0.9, -30.0);
glColor3f(0,1,0);
glVertex3f(-0.9, 0.0, -30.0);
glEnd();
glFlush();
}
int main(int argc, char **argv)
{
GLenum type;
glutInit(&argc, argv);
glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250);
type = GLUT_RGB;
type |= GLUT_SINGLE;
glutInitDisplayMode(type);
if (glutCreateWindow("First Tri") == GL_FALSE) {
exit(1);
}
Init();
glutReshapeFunc(Reshape);
glutKeyboardFunc(Key);
glutDisplayFunc(Draw);
glutMainLoop();
return 0;
}

102
progs/fp/tri-mov.c Normal file
View File

@@ -0,0 +1,102 @@
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define GL_GLEXT_PROTOTYPES
#include <GL/glut.h>
#include "GL/gl.h"
static void Init( void )
{
static const char *modulate2D =
"!!ARBfp1.0\n"
"MOV result.color, fragment.color; \n"
"END"
;
GLuint modulateProg;
if (!glutExtensionSupported("GL_ARB_fragment_program")) {
printf("Error: GL_ARB_fragment_program not supported!\n");
exit(1);
}
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
/* Setup the fragment program */
glGenProgramsARB(1, &modulateProg);
glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg);
glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB,
strlen(modulate2D), (const GLubyte *)modulate2D);
printf("glGetError = 0x%x\n", (int) glGetError());
printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n",
(char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB));
glEnable(GL_FRAGMENT_PROGRAM_ARB);
glClearColor(.3, .3, .3, 0);
}
static void Reshape(int width, int height)
{
glViewport(0, 0, (GLint)width, (GLint)height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
glMatrixMode(GL_MODELVIEW);
}
static void Key(unsigned char key, int x, int y)
{
switch (key) {
case 27:
exit(1);
default:
return;
}
glutPostRedisplay();
}
static void Draw(void)
{
glClear(GL_COLOR_BUFFER_BIT);
glBegin(GL_TRIANGLES);
glColor3f(0,0,1);
glVertex3f( 0.9, -0.9, -30.0);
glColor3f(1,0,0);
glVertex3f( 0.9, 0.9, -30.0);
glColor3f(0,1,0);
glVertex3f(-0.9, 0.0, -30.0);
glEnd();
glFlush();
}
int main(int argc, char **argv)
{
GLenum type;
glutInit(&argc, argv);
glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250);
type = GLUT_RGB | GLUT_SINGLE;
glutInitDisplayMode(type);
if (glutCreateWindow("First Tri") == GL_FALSE) {
exit(1);
}
Init();
glutReshapeFunc(Reshape);
glutKeyboardFunc(Key);
glutDisplayFunc(Draw);
glutMainLoop();
return 0;
}

109
progs/fp/tri-mul.c Normal file
View File

@@ -0,0 +1,109 @@
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define GL_GLEXT_PROTOTYPES
#include <GL/glut.h>
#include "GL/gl.h"
static void Init( void )
{
static const char *modulate2D =
"!!ARBfp1.0\n"
"MUL result.color, fragment.color, fragment.color; \n"
"END"
;
GLuint modulateProg;
if (!glutExtensionSupported("GL_ARB_fragment_program")) {
printf("Error: GL_ARB_fragment_program not supported!\n");
exit(1);
}
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
/* Setup the fragment program */
glGenProgramsARB(1, &modulateProg);
glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg);
glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB,
strlen(modulate2D), (const GLubyte *)modulate2D);
printf("glGetError = 0x%x\n", (int) glGetError());
printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n",
(char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB));
glEnable(GL_FRAGMENT_PROGRAM_ARB);
glClearColor(.3, .3, .3, 0);
}
static void Reshape(int width, int height)
{
glViewport(0, 0, (GLint)width, (GLint)height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
glMatrixMode(GL_MODELVIEW);
}
static void Key(unsigned char key, int x, int y)
{
switch (key) {
case 27:
exit(1);
default:
return;
}
glutPostRedisplay();
}
static void Draw(void)
{
glClear(GL_COLOR_BUFFER_BIT);
glBegin(GL_TRIANGLES);
glColor3f(0,0,1);
glVertex3f( 0.9, -0.9, -30.0);
glColor3f(1,0,0);
glVertex3f( 0.9, 0.9, -30.0);
glColor3f(0,1,0);
glVertex3f(-0.9, 0.0, -30.0);
glEnd();
glFlush();
}
int main(int argc, char **argv)
{
GLenum type;
glutInit(&argc, argv);
glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250);
type = GLUT_RGB;
type |= GLUT_SINGLE;
glutInitDisplayMode(type);
if (glutCreateWindow("First Tri") == GL_FALSE) {
exit(1);
}
Init();
glutReshapeFunc(Reshape);
glutKeyboardFunc(Key);
glutDisplayFunc(Draw);
glutMainLoop();
return 0;
}

114
progs/fp/tri-param.c Normal file
View File

@@ -0,0 +1,114 @@
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define GL_GLEXT_PROTOTYPES
#include <GL/glut.h>
#include "GL/gl.h"
static void Init( void )
{
static const char *modulate2D =
"!!ARBfp1.0\n"
"MOV result.color, program.local[32]; \n"
"END"
;
GLuint modulateProg;
if (!glutExtensionSupported("GL_ARB_fragment_program")) {
printf("Error: GL_ARB_fragment_program not supported!\n");
exit(1);
}
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
/* Setup the fragment program */
glGenProgramsARB(1, &modulateProg);
glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg);
glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB,
strlen(modulate2D), (const GLubyte *)modulate2D);
printf("glGetError = 0x%x\n", (int) glGetError());
printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n",
(char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB));
glEnable(GL_FRAGMENT_PROGRAM_ARB);
glClearColor(.3, .3, .3, 0);
}
static void Reshape(int width, int height)
{
glViewport(0, 0, (GLint)width, (GLint)height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
glMatrixMode(GL_MODELVIEW);
}
static void Key(unsigned char key, int x, int y)
{
switch (key) {
case 27:
exit(1);
default:
return;
}
glutPostRedisplay();
}
static void Draw(void)
{
glClear(GL_COLOR_BUFFER_BIT);
glProgramLocalParameter4fARB(GL_FRAGMENT_PROGRAM_ARB, 32, 0.25, .5, 0.25, 1);
glBegin(GL_TRIANGLES);
glColor3f(0,0,1);
glVertex3f( 0.9, -0.9, -30.0);
glColor3f(1,0,0);
glVertex3f( 0.9, 0.0, -30.0);
glColor3f(0,1,0);
glVertex3f(-0.9, 0.0, -30.0);
glEnd();
glProgramLocalParameter4fARB(GL_FRAGMENT_PROGRAM_ARB, 32, 0.25, 0, 0.25, 1);
glBegin(GL_TRIANGLES);
glColor3f(0,0,1);
glVertex3f( 0.9, 0.0, -30.0);
glColor3f(1,0,0);
glVertex3f( 0.9, 0.9, -30.0);
glColor3f(0,1,0);
glVertex3f(-0.9, 0.0, -30.0);
glEnd();
glFlush();
}
int main(int argc, char **argv)
{
GLenum type;
glutInit(&argc, argv);
glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250);
type = GLUT_RGB | GLUT_SINGLE;
glutInitDisplayMode(type);
if (glutCreateWindow("First Tri") == GL_FALSE) {
exit(1);
}
Init();
glutReshapeFunc(Reshape);
glutKeyboardFunc(Key);
glutDisplayFunc(Draw);
glutMainLoop();
return 0;
}

109
progs/fp/tri-position.c Normal file
View File

@@ -0,0 +1,109 @@
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define GL_GLEXT_PROTOTYPES
#include <GL/glut.h>
#include "GL/gl.h"
static void Init( void )
{
static const char *modulate2D =
"!!ARBfp1.0\n"
"MUL result.color, fragment.position, {.005}.x; \n"
"END"
;
GLuint modulateProg;
if (!glutExtensionSupported("GL_ARB_fragment_program")) {
printf("Error: GL_ARB_fragment_program not supported!\n");
exit(1);
}
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
/* Setup the fragment program */
glGenProgramsARB(1, &modulateProg);
glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg);
glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB,
strlen(modulate2D), (const GLubyte *)modulate2D);
printf("glGetError = 0x%x\n", (int) glGetError());
printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n",
(char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB));
glEnable(GL_FRAGMENT_PROGRAM_ARB);
glClearColor(.3, .3, .3, 0);
}
static void Reshape(int width, int height)
{
glViewport(0, 0, (GLint)width, (GLint)height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
glMatrixMode(GL_MODELVIEW);
}
static void Key(unsigned char key, int x, int y)
{
switch (key) {
case 27:
exit(1);
default:
return;
}
glutPostRedisplay();
}
static void Draw(void)
{
glClear(GL_COLOR_BUFFER_BIT);
glBegin(GL_TRIANGLES);
glColor3f(0,0,1);
glVertex3f( 0.9, -0.9, -30.0);
glColor3f(1,0,0);
glVertex3f( 0.9, 0.9, -30.0);
glColor3f(0,1,0);
glVertex3f(-0.9, 0.0, -30.0);
glEnd();
glFlush();
}
int main(int argc, char **argv)
{
GLenum type;
glutInit(&argc, argv);
glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250);
type = GLUT_RGB;
type |= GLUT_SINGLE;
glutInitDisplayMode(type);
if (glutCreateWindow("First Tri") == GL_FALSE) {
exit(1);
}
Init();
glutReshapeFunc(Reshape);
glutKeyboardFunc(Key);
glutDisplayFunc(Draw);
glutMainLoop();
return 0;
}

109
progs/fp/tri-pow.c Normal file
View File

@@ -0,0 +1,109 @@
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define GL_GLEXT_PROTOTYPES
#include <GL/glut.h>
static void Init( void )
{
static const char *modulate2D =
"!!ARBfp1.0\n"
"TEMP R0;\n"
"POW result.color, fragment.color.x, fragment.color.y; \n"
"END"
;
GLuint modulateProg;
if (!glutExtensionSupported("GL_ARB_fragment_program")) {
printf("Error: GL_ARB_fragment_program not supported!\n");
exit(1);
}
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
/* Setup the fragment program */
glGenProgramsARB(1, &modulateProg);
glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg);
glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB,
strlen(modulate2D), (const GLubyte *)modulate2D);
printf("glGetError = 0x%x\n", (int) glGetError());
printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n",
(char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB));
glEnable(GL_FRAGMENT_PROGRAM_ARB);
glClearColor(.3, .3, .3, 0);
}
static void Reshape(int width, int height)
{
glViewport(0, 0, (GLint)width, (GLint)height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
glMatrixMode(GL_MODELVIEW);
}
static void Key(unsigned char key, int x, int y)
{
switch (key) {
case 27:
exit(1);
default:
return;
}
glutPostRedisplay();
}
static void Draw(void)
{
glClear(GL_COLOR_BUFFER_BIT);
glBegin(GL_TRIANGLES);
glColor3f(0,0,1);
glVertex3f( 0.9, -0.9, -30.0);
glColor3f(1,0,0);
glVertex3f( 0.9, 0.9, -30.0);
glColor3f(0,1,0);
glVertex3f(-0.9, 0.0, -30.0);
glEnd();
glFlush();
}
int main(int argc, char **argv)
{
GLenum type;
glutInit(&argc, argv);
glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250);
type = GLUT_RGB;
type |= GLUT_SINGLE;
glutInitDisplayMode(type);
if (glutCreateWindow("First Tri") == GL_FALSE) {
exit(1);
}
Init();
glutReshapeFunc(Reshape);
glutKeyboardFunc(Key);
glutDisplayFunc(Draw);
glutMainLoop();
return 0;
}

110
progs/fp/tri-rcp.c Normal file
View File

@@ -0,0 +1,110 @@
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define GL_GLEXT_PROTOTYPES
#include <GL/glut.h>
static void Init( void )
{
static const char *modulate2D =
"!!ARBfp1.0\n"
"TEMP R0;\n"
"ADD R0, fragment.color.x, fragment.color.x; \n"
"RCP result.color, R0.x; \n"
"END"
;
GLuint modulateProg;
if (!glutExtensionSupported("GL_ARB_fragment_program")) {
printf("Error: GL_ARB_fragment_program not supported!\n");
exit(1);
}
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
/* Setup the fragment program */
glGenProgramsARB(1, &modulateProg);
glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg);
glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB,
strlen(modulate2D), (const GLubyte *)modulate2D);
printf("glGetError = 0x%x\n", (int) glGetError());
printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n",
(char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB));
glEnable(GL_FRAGMENT_PROGRAM_ARB);
glClearColor(.3, .3, .3, 0);
}
static void Reshape(int width, int height)
{
glViewport(0, 0, (GLint)width, (GLint)height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
glMatrixMode(GL_MODELVIEW);
}
static void Key(unsigned char key, int x, int y)
{
switch (key) {
case 27:
exit(1);
default:
return;
}
glutPostRedisplay();
}
static void Draw(void)
{
glClear(GL_COLOR_BUFFER_BIT);
glBegin(GL_TRIANGLES);
glColor3f(0,0,1);
glVertex3f( 0.9, -0.9, -30.0);
glColor3f(1,0,0);
glVertex3f( 0.9, 0.9, -30.0);
glColor3f(0,1,0);
glVertex3f(-0.9, 0.0, -30.0);
glEnd();
glFlush();
}
int main(int argc, char **argv)
{
GLenum type;
glutInit(&argc, argv);
glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250);
type = GLUT_RGB;
type |= GLUT_SINGLE;
glutInitDisplayMode(type);
if (glutCreateWindow("First Tri") == GL_FALSE) {
exit(1);
}
Init();
glutReshapeFunc(Reshape);
glutKeyboardFunc(Key);
glutDisplayFunc(Draw);
glutMainLoop();
return 0;
}

110
progs/fp/tri-rsq.c Normal file
View File

@@ -0,0 +1,110 @@
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define GL_GLEXT_PROTOTYPES
#include <GL/glut.h>
static void Init( void )
{
static const char *modulate2D =
"!!ARBfp1.0\n"
"TEMP R0;\n"
"MUL R0, fragment.color, {3.0}.x; \n"
"RSQ result.color, R0.x; \n"
"END"
;
GLuint modulateProg;
if (!glutExtensionSupported("GL_ARB_fragment_program")) {
printf("Error: GL_ARB_fragment_program not supported!\n");
exit(1);
}
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
/* Setup the fragment program */
glGenProgramsARB(1, &modulateProg);
glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg);
glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB,
strlen(modulate2D), (const GLubyte *)modulate2D);
printf("glGetError = 0x%x\n", (int) glGetError());
printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n",
(char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB));
glEnable(GL_FRAGMENT_PROGRAM_ARB);
glClearColor(.3, .3, .3, 0);
}
static void Reshape(int width, int height)
{
glViewport(0, 0, (GLint)width, (GLint)height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
glMatrixMode(GL_MODELVIEW);
}
static void Key(unsigned char key, int x, int y)
{
switch (key) {
case 27:
exit(1);
default:
return;
}
glutPostRedisplay();
}
static void Draw(void)
{
glClear(GL_COLOR_BUFFER_BIT);
glBegin(GL_TRIANGLES);
glColor3f(0,0,1);
glVertex3f( 0.9, -0.9, -30.0);
glColor3f(1,0,0);
glVertex3f( 0.9, 0.9, -30.0);
glColor3f(0,1,0);
glVertex3f(-0.9, 0.0, -30.0);
glEnd();
glFlush();
}
int main(int argc, char **argv)
{
GLenum type;
glutInit(&argc, argv);
glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250);
type = GLUT_RGB;
type |= GLUT_SINGLE;
glutInitDisplayMode(type);
if (glutCreateWindow("First Tri") == GL_FALSE) {
exit(1);
}
Init();
glutReshapeFunc(Reshape);
glutKeyboardFunc(Key);
glutDisplayFunc(Draw);
glutMainLoop();
return 0;
}

111
progs/fp/tri-scs.c Normal file
View File

@@ -0,0 +1,111 @@
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define GL_GLEXT_PROTOTYPES
#include <GL/glut.h>
#include "GL/gl.h"
static void Init( void )
{
static const char *modulate2D =
"!!ARBfp1.0\n"
"TEMP R0; \n"
"MUL R0, fragment.color, {3.14}.x; \n"
"SCS result.color, R0.x; \n"
"END"
;
GLuint modulateProg;
if (!glutExtensionSupported("GL_ARB_fragment_program")) {
printf("Error: GL_ARB_fragment_program not supported!\n");
exit(1);
}
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
/* Setup the fragment program */
glGenProgramsARB(1, &modulateProg);
glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg);
glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB,
strlen(modulate2D), (const GLubyte *)modulate2D);
printf("glGetError = 0x%x\n", (int) glGetError());
printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n",
(char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB));
glEnable(GL_FRAGMENT_PROGRAM_ARB);
glClearColor(.3, .3, .3, 0);
}
static void Reshape(int width, int height)
{
glViewport(0, 0, (GLint)width, (GLint)height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
glMatrixMode(GL_MODELVIEW);
}
static void Key(unsigned char key, int x, int y)
{
switch (key) {
case 27:
exit(1);
default:
return;
}
glutPostRedisplay();
}
static void Draw(void)
{
glClear(GL_COLOR_BUFFER_BIT);
glBegin(GL_TRIANGLES);
glColor3f(0,0,1);
glVertex3f( 0.9, -0.9, -30.0);
glColor3f(1,0,0);
glVertex3f( 0.9, 0.9, -30.0);
glColor3f(0,1,0);
glVertex3f(-0.9, 0.0, -30.0);
glEnd();
glFlush();
}
int main(int argc, char **argv)
{
GLenum type;
glutInit(&argc, argv);
glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250);
type = GLUT_RGB;
type |= GLUT_SINGLE;
glutInitDisplayMode(type);
if (glutCreateWindow("First Tri") == GL_FALSE) {
exit(1);
}
Init();
glutReshapeFunc(Reshape);
glutKeyboardFunc(Key);
glutDisplayFunc(Draw);
glutMainLoop();
return 0;
}

109
progs/fp/tri-sge.c Normal file
View File

@@ -0,0 +1,109 @@
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define GL_GLEXT_PROTOTYPES
#include <GL/glut.h>
#include "GL/gl.h"
static void Init( void )
{
static const char *modulate2D =
"!!ARBfp1.0\n"
"SGE result.color, {0.5}.x, fragment.color; \n"
"END"
;
GLuint modulateProg;
if (!glutExtensionSupported("GL_ARB_fragment_program")) {
printf("Error: GL_ARB_fragment_program not supported!\n");
exit(1);
}
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
/* Setup the fragment program */
glGenProgramsARB(1, &modulateProg);
glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg);
glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB,
strlen(modulate2D), (const GLubyte *)modulate2D);
printf("glGetError = 0x%x\n", (int) glGetError());
printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n",
(char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB));
glEnable(GL_FRAGMENT_PROGRAM_ARB);
glClearColor(.3, .3, .3, 0);
}
static void Reshape(int width, int height)
{
glViewport(0, 0, (GLint)width, (GLint)height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
glMatrixMode(GL_MODELVIEW);
}
static void Key(unsigned char key, int x, int y)
{
switch (key) {
case 27:
exit(1);
default:
return;
}
glutPostRedisplay();
}
static void Draw(void)
{
glClear(GL_COLOR_BUFFER_BIT);
glBegin(GL_TRIANGLES);
glColor3f(0,0,1);
glVertex3f( 0.9, -0.9, -30.0);
glColor3f(1,0,0);
glVertex3f( 0.9, 0.9, -30.0);
glColor3f(0,1,0);
glVertex3f(-0.9, 0.0, -30.0);
glEnd();
glFlush();
}
int main(int argc, char **argv)
{
GLenum type;
glutInit(&argc, argv);
glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250);
type = GLUT_RGB;
type |= GLUT_SINGLE;
glutInitDisplayMode(type);
if (glutCreateWindow("First Tri") == GL_FALSE) {
exit(1);
}
Init();
glutReshapeFunc(Reshape);
glutKeyboardFunc(Key);
glutDisplayFunc(Draw);
glutMainLoop();
return 0;
}

114
progs/fp/tri-sge2.c Normal file
View File

@@ -0,0 +1,114 @@
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define GL_GLEXT_PROTOTYPES
#include <GL/glut.h>
#include "GL/gl.h"
static void Init( void )
{
static const char *modulate2D =
"!!ARBfp1.0\n"
"TEMP R0;\n"
"TEMP R1;\n"
"SGE R0, fragment.color, fragment.color.yzxw; \n"
"SGE R1, fragment.color, fragment.color.zxyw; \n"
"MUL R0, R0, R1; \n"
"MUL result.color, R0, fragment.color; \n"
"END"
;
GLuint modulateProg;
if (!glutExtensionSupported("GL_ARB_fragment_program")) {
printf("Error: GL_ARB_fragment_program not supported!\n");
exit(1);
}
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
/* Setup the fragment program */
glGenProgramsARB(1, &modulateProg);
glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg);
glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB,
strlen(modulate2D), (const GLubyte *)modulate2D);
printf("glGetError = 0x%x\n", (int) glGetError());
printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n",
(char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB));
glEnable(GL_FRAGMENT_PROGRAM_ARB);
glClearColor(.3, .3, .3, 0);
}
static void Reshape(int width, int height)
{
glViewport(0, 0, (GLint)width, (GLint)height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
glMatrixMode(GL_MODELVIEW);
}
static void Key(unsigned char key, int x, int y)
{
switch (key) {
case 27:
exit(1);
default:
return;
}
glutPostRedisplay();
}
static void Draw(void)
{
glClear(GL_COLOR_BUFFER_BIT);
glBegin(GL_TRIANGLES);
glColor3f(0,0,1);
glVertex3f( 0.9, -0.9, -30.0);
glColor3f(1,0,0);
glVertex3f( 0.9, 0.9, -30.0);
glColor3f(0,1,0);
glVertex3f(-0.9, 0.0, -30.0);
glEnd();
glFlush();
}
int main(int argc, char **argv)
{
GLenum type;
glutInit(&argc, argv);
glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250);
type = GLUT_RGB;
type |= GLUT_SINGLE;
glutInitDisplayMode(type);
if (glutCreateWindow("First Tri") == GL_FALSE) {
exit(1);
}
Init();
glutReshapeFunc(Reshape);
glutKeyboardFunc(Key);
glutDisplayFunc(Draw);
glutMainLoop();
return 0;
}

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