Compare commits

..

409 Commits

Author SHA1 Message Date
Brian
70d227ac62 7.0.3 release candidate 3 2008-04-01 18:04:13 -06:00
Eric Anholt
7f2c4f96f5 Bug #13492: Only call ProgramStringNotify if program parsing succeeded.
Wine intentionally tries some out-of-spec programs to test strictness, and
calling ProgramStringNotify on the results of a failed program parse resulted
in crashes in the 965 driver.
(cherry picked from commit 185320ae13)
2008-04-01 16:27:48 -07:00
Roland Scheidegger
667f0f60fc fix mistakenly set ATIFragmentShader._Enabled bit (bug 15269) 2008-04-01 23:25:04 +02:00
Brian
7592b8cc10 added some missing calls to _mesa_enable_x_y_extensions() 2008-04-01 08:41:24 -06:00
Brian
f55b831859 fix ARB f/v program comment parsing bug 2008-03-31 15:00:18 -06:00
Markus Amsler
217f7f7e5d fix parsing bug involving comments at the end of ARB v/f programs 2008-03-31 15:00:18 -06:00
Xiang, Haihao
1e83d70b6d i965: Apply -ve rhw to 965. Fix the regression introduced by
commit da476ff02d. (bug#14940)
2008-03-31 09:37:55 +08:00
Brian
767dfa5b9c fix texture/renderbuffer mix-up in test_attachment_completeness() 2008-03-28 13:25:25 -06:00
Alan Hourihane
7ff5b38126 Fix build problems 2008-03-27 16:36:12 +00:00
Brian
e209f5300d updated glext.h to version 40 2008-03-25 08:11:47 -06:00
Brian
3c4b50c352 updated to version 40 2008-03-25 08:11:36 -06:00
Brian
4e7c2fcf18 add GL_READ_FRAMEBUFFER_BINDING_EXT case, regenerate get.c file 2008-03-24 19:55:46 -06:00
Brian
22534f94f5 fix wrong values for GL_READ/DRAW_FRAMEBUFFER_BINDING_EXT tokens 2008-03-24 19:55:04 -06:00
Brian
1a6928fdbe use ctx->Driver.DeleteProgram() in a few more places 2008-03-22 10:27:08 -06:00
Brian
325dbbac47 delete default programs with ctx->Driver.DeleteProgram() 2008-03-22 09:11:35 -06:00
Brian
39ac6b0481 Fix some PBO breakage.
In _mesa_Bitmap, can't early return if bitmap ptr is NULL, it may be an offset
into a PBO.  Similarly for _mesa_GetTexImage.
2008-03-21 12:32:29 -06:00
Brian
46cc4854e9 fix IEEE_ONE definition for ICC compiler (bug 15134) 2008-03-19 17:25:18 -06:00
Alan Hourihane
f93882512e set outputs_safe to 0 as it's possible for the code generation
to slip over the allocated memory for the vb.

pull in sse fixes from gallium-0.1
2008-03-19 01:03:48 +00:00
Markus Amsler
0dee2a4f6f only set InputsRead bit if input is really used 2008-03-17 08:35:34 -06:00
Brian
3cebc35669 init tmpNode to zeros 2008-03-14 14:16:00 -06:00
Brian Paul
e75a204fb9 mesa: fix emit_clamp() so that we don't use an output register as temporary
IR_CLAMP is decomposed into OPCODE_MIN+OPCODE_MAX.  Allocate a temporary
register for the intermediate value so we don't inadvertantly use an output
register (which are write-only on some GPUs).
2008-03-14 13:57:53 -06:00
Roland Scheidegger
ac06a5c16a fix state.lightprod ambient/specular w value (bug #14983) 2008-03-13 12:43:53 +01:00
Dan Nicholson
ed758fee0c Merge branch '7.0-glx' into mesa_7_0_branch 2008-03-10 16:45:49 -07:00
Jeremy Huddleston
a21c61ee8b Darwin: Fixed small error in darwin config files 2008-03-10 16:02:55 -07:00
Dan Nicholson
24697da20e glapi: Resync generated files with 7.0 branch
The previous commits pulled in the generated files from master. This
regenerates the files from the source on the 7.0 branch.
2008-03-10 15:17:59 -07:00
Jeremy Huddleston
7120c0089d Darwin: Config/source fixes to now build glxdemo apps and OSMesa
Also added darwin-fat-32bit darwin-fat-all configs and deleted old darwin-x86ppc config
2008-03-10 15:13:44 -07:00
Dan Nicholson
88a436a8f7 glapi: Generate xserver glapi sources in the mesa tree
Instead of generating the glapi sources for the xserver and commiting
them to the xserver tree, we can keep them in the mesa tree and change
the xserver build to use the files from the mesa tree.

This makes the xserver glx build more robust as it reduces the chances
for mismatches of the glX API used in the xserver vs. in mesa.
(cherry picked from commit 7688791fc5)
2008-03-10 15:03:13 -07:00
Dan Nicholson
2fdb5a245d glapi: Correct prerequisites for gl_and_glX_API.xml
The indirect_dispatch.h and indirect_table.c source files use
gl_and_glX_API.xml in their generation rather than glX_API.xml, but it
wasn't listed in their prerequisites. In turn, gl_and_glX_API.xml uses
glX_API.xml, but this is already listed in $(COMMON_GLX).
(cherry picked from commit 929b6d2ebf)
2008-03-10 15:03:01 -07:00
Dan Nicholson
8441b53538 glapi: Use make automatic variables to clean up the commands
Make use of the make automatic variables $@ (the target) and $< (first
prerequisite) to clean up the commands for the glapi generation. This
improves readability and guards against typos since words are repeated
less frequently.
(cherry picked from commit fc67d47708)
2008-03-10 15:02:51 -07:00
Dan Nicholson
d336df8b73 glapi: Use variable for indent and flags
Put the path to indent and the flags to call it with in configs/default
rather than in the Makefile. This makes it easier to change the values
globally.
(cherry picked from commit 817af9bec2)
2008-03-10 15:02:36 -07:00
Brian
8aaf805b8a fix parsing of state.texenv.color (bug 14931) 2008-03-10 07:41:31 -06:00
Markus Amsler
8161fd2785 Set normalized flag for GLubyte arrays in _mesa_VertexAttribPointerNV() 2008-03-09 17:53:00 -06:00
Markus Amsler
2f23025dfe init vertex weight attrib to (1,0,0,0) 2008-03-09 17:51:21 -06:00
Brian
1867eac230 fix __builtin_expect() definition test for IBM XLC (sf bug 1909832) 2008-03-09 10:54:50 -06:00
Roland Scheidegger
096e35d05f state.depth.range alpha value should be 1, not 0 (bug #14733) 2008-03-01 02:57:01 +01:00
Xiang, Haihao
8998f52b97 Don't Swap buffer if a DRIDrawable is entirely obscured by another window. 2008-02-28 11:43:54 +01:00
Brian
0fd38dcc83 Replace glut_fbc.c with glut_fcb.c (cb=callback) 2008-02-25 10:57:54 -07:00
Brian
ff63cf8068 bump libGL.so version number 2008-02-22 07:59:39 -07:00
Brian
4716670de9 prep for 7.0.3 rc-2 2008-02-21 16:59:20 -07:00
Brian
33c5b38034 latest bug fixes 2008-02-20 09:39:59 -07:00
Brian
5737d6c565 Fix point rasterization regression caused by commit 95a2eb9767
Even-sized, non-AA points need 0.5 bias in position to hit the right pixels.
Test program from bug report 11016 retested and is OK.
2008-02-20 09:38:16 -07:00
Brian
08a7f56c6a raise GL_INVALID_OPERATION if glProgramString compilation fails
cherry picked from master.
2008-02-20 09:00:49 -07:00
Brian
7916f2b4aa Fix glBegin-time test for invalid programs/shaders.
Cherry picked from master.
2008-02-20 08:56:20 -07:00
Brian
193d303ac7 Added <size name="Get" mode="get"/> lines for point parameter tokens.
Cherry picked from master
2008-02-19 08:46:39 -07:00
Jeremy Huddleston
e70609b7b8 Apple: Pulled in changes from Apple's patchset to allow mesa to build on darwin again 2008-02-19 00:54:35 -08:00
Xiang, Haihao
da476ff02d i965: new integrated graphics chipset support 2008-02-19 15:59:50 +08:00
Brian
77e3b5d28b Fix potential glDrawPixels(GL_DEPTH_COMPONENT) crashes (bug 13915)
Also, general clean-up of the Xlib-optimized glDraw/CopyPixels code.
2008-02-16 09:56:26 -07:00
Brian
bf97ca448c Fix glBindTexture crash (bug 14514) 2008-02-15 13:42:19 -07:00
Roland Scheidegger
c5f8ff8b32 fix bug with generated fragment programs if vertex shader is active
When generating a fragment program from fixed function, checking
texUnit->_ReallyEnabled is not sufficient, need texUnit->Enabled too
since the former also represents texture enables from an active vertex
shader.
2008-02-15 17:26:58 +01:00
caner
50465766d1 miniglx doc updates 2008-02-14 09:34:08 -07:00
Xiang, Haihao
7d8df58a63 _mesa_swizzle_ubyt_image: Don't use single swizzle_copy call
if components don't match. fix #13508
2008-02-13 07:07:47 -07:00
Andy Skinner
762c074012 added -altopts to allow overriding all other opts 2008-02-07 13:19:55 -07:00
Brian
51f2ee3bfb fix bug 9871 2008-02-06 07:55:26 -07:00
Brian
b5cd34aa21 Fix bug 9871: enable user-defined clip planes for R300
Patch provided by Erkin Bahceci <erkinbah@gmail.com>
2008-02-06 07:54:24 -07:00
Tony DeFeo
ae5c6dcd42 [965] Fix memory leak when deleting buffers with backing store. 2008-02-05 10:49:44 -08:00
Roland Scheidegger
97196d0c8c regenerate glsl library functions 2008-01-31 01:36:23 +01:00
Roland Scheidegger
f6de56b88a fix w component of glsl vec4 asin 2008-01-31 01:35:52 +01:00
Brian
d64ea43b76 fix bugs 13507, 14293 2008-01-30 08:12:06 -07:00
Brian
2deaf93d24 check if fb->Delete is null (bugs 13507,14293) 2008-01-30 08:12:06 -07:00
Alex Deucher
a107ec8300 Add new RV380 pci id
bug 14289
(cherry picked from commit 80efe27560)
2008-01-29 10:15:32 -05:00
Alex Deucher
120a1f9508 Merge branch 'mesa_7_0_branch' of git+ssh://agd5f@git.freedesktop.org/git/mesa/mesa into mesa_7_0_branch 2008-01-29 09:50:26 -05:00
Alex Deucher
bb84007a57 R300: RV410 SE chips have half the pipes of regular RV410
This fixes 3D rendering on x700 SE chips.  Reported
by Kano.
(cherry picked from commit 0b7e0f8159)
2008-01-29 09:46:48 -05:00
Alan Hourihane
86234e55a6 pull some more fixes for pbo access from trunk 2008-01-28 11:23:53 +00:00
Alan Hourihane
61972077cd fix some pbo path problems 2008-01-28 11:15:53 +00:00
Xiang, Haihao
5a7feb8ea2 i965: valid message length includes message header. 2008-01-25 17:23:55 +08:00
Xiang, Haihao
4b4c131cd0 i965: re-define the type of reg.loopcount.
avoid some issues such that 1 + (-2) gets a big
positive value.
2008-01-25 17:23:15 +08:00
Brian
0fd23f01c6 Assorted patches for miniglx/linux-solo (Gavin Li <codeview@gmail.com>) 2008-01-23 16:04:02 -07:00
Adam Jackson
557b0d9df7 glxinfo: Fix multisample visual reporting.
strstr() == 0 tests for the string _not_ being present.  Originally
Red Hat bug #351871.
2008-01-22 14:04:39 -07:00
Brian
888f4380cf fix GLX vertex array bug 14197 2008-01-22 08:41:22 -07:00
Brian
3266c5e95a fix pc vs. gc->ps usage (bug 14197) 2008-01-22 08:38:48 -07:00
Brian
834decdaae Don't build yuvrect_client by default
Added 'extra' rule to build optional yuvrect_client, shape, xdemo programs
2008-01-22 07:56:31 -07:00
Brian
18b2d83173 remove unused var 2008-01-22 07:54:37 -07:00
Alexey Sokolov
30c65c3c62 define M_PI if needed 2008-01-22 07:42:40 -07:00
Brian
04fcc4cf1e prep for 7.0.3 release 2008-01-21 16:21:39 -07:00
Michel Dänzer
48ae5cf09d i965: Fix byte vs. pixel unit mixup for aligned texture pitch.
I sincerely hope I don't manage to mess this up yet again...

Thanks again to Todd Merrill for pointing out the problem and testing the fix
on IRC.
2008-01-14 16:30:58 +01:00
Michel Dänzer
45cdb6eb45 i965: Fix unresolved symbol intel_miptree_pitch_align.
For some reason, I thought that function was shared with i915tex... The good
news is that i965 gets to keep the lower pitch alignment requirements.

Thanks to Todd Merrill for pointing out the problem on IRC.
2008-01-11 16:32:39 +01:00
Keith Packard
b9f3f732aa i915tex: Centralize mipmap pitch computations.
mipmap pitches must account for the device alignment requirements, which
used to be fairly simple; just align to a 4-byte boundary. However, to allow
textures to be drawn to under TTM, they now need to be aligned to a 64-byte
boundary. Placing all of the alignment constraints in a single function
allows this new constraint to be applied uniformly.

There was some pitch constraining code in intel_miptree_create, but that was
modifying the pitch long after the miptree had been layed out, so it only
served to wreck the mipmap and cause rendering errors.

(cherry picked from commit a183efc132 with manual
changes for mesa_7_0_branch by Michel Dänzer. One side effect of this is that
i965 also aligns the pitch of 2D textures to multiples of 64 bytes, hopefully
that won't cause any issues)
2008-01-08 16:48:13 +01:00
Brian
17006ddd6b fix 3d proxy texture depth bug 2008-01-05 15:44:51 -07:00
Brian
b77a354df3 fix depth/1 typo in glTexImage3D proxy code 2008-01-05 15:44:51 -07:00
Brian
71d46beebf additional stub functions 2008-01-02 07:23:41 -07:00
Brian
454e296eb1 additional GL_COLOR_ATTACHMENTx_EXT cases (bug 13767) 2008-01-02 07:20:08 -07:00
Brian
f9b696be2b fix vbo display list memleak upon context destruction 2008-01-01 10:23:56 -07:00
Brian
c923edbc71 additional GL_COLOR_ATTACHMENTx_EXT cases (bug 13767) 2008-01-01 10:10:18 -07:00
Brian
e20c1d987f fix GLSL uniform/attrib bugs (13753) 2008-01-01 09:59:51 -07:00
Bruce Merry
cd354eb10f Convert to 0/1 when setting boolean uniforms
Also add some extra tests to the shader_api regression tests
2008-01-01 09:59:51 -07:00
Bruce Merry
e9ac27ee23 Make use of count in _mesa_uniform_matrix 2008-01-01 09:59:50 -07:00
Bruce Merry
3f9dc9f5b6 Add a test program to test for assorted bugs in shader_api.c 2008-01-01 09:59:50 -07:00
Bruce Merry
ba709875ae More fixes to shader_api
- return GL_INVALID_OPERATION instead of GL_INVALID_VALUE if location is bad
- correct the type-checking of uniforms from my previous commit
- accept location of -1 in _mesa_uniform_matrix
2008-01-01 09:59:50 -07:00
Bruce Merry
80f8397b35 Fix several bugs relating to uniforms and attributes in GLSL API
- fix sizes for GL_FLOAT_MAT2x3 and GL_FLOAT_MAT4x3 in sizeof_glsl_type
- fix size returns in _mesa_get_active_attrib
- fix out-of-bounds array access to vec_types in _mesa_get_active_attrib
- fix queries of matrix uniforms in _mesa_get_uniformfv
- fix _mesa_get_uniformfv to only return one base, even from an array
- allow location == -1 in _mesa_uniform
- validate types in _mesa_uniform
- allow array overruns in _mesa_uniform
2008-01-01 09:59:50 -07:00
Brian
b45fa27fa1 added 'get' info for framebuffer object tokens 2008-01-01 09:26:30 -07:00
Brian
b59480645d add 'Get' info for MAX_3D_TEXTURE_SIZE (for bug 13811) 2008-01-01 09:04:13 -07:00
Brian
148cb36979 add missing double quote (bug 13878) 2008-01-01 07:59:58 -07:00
Roland Scheidegger
c1eb78f7ff fix GL_LINE_LOOP with drivers using own render pipeline stage (#12410, #13527)
primitive needs to include the begin/end flags (broken since vbo-0.2). Should
fix missing first/last line segment on gamma, i810, i915, mga, r200, radeon,
s3v, savage, unichrome (r300 already correct). Tested on r200, fixes #13527.
2007-12-22 18:49:42 +01:00
Brian
8aa0fd6b20 glGetActiveUniform fix 2007-12-20 09:08:12 -07:00
Brian
a1b3a908f5 return correct size from glGetActiveUniform (bug 13751) 2007-12-20 09:08:12 -07:00
Xiang, Haihao
f9e70d951a i965: allocate GRF registers before building subroutines,
it ensures there are sufficient registers for all subroutines.
2007-12-19 10:44:00 +08:00
Xiang, Haihao
41ed6be1da i965: restore the flag after building the subroutine of the
GS thread. fix #13240
2007-12-19 10:36:56 +08:00
Brian
27de28fc3e Remove -I$(TOP)/src/mesa/transform 2007-12-18 17:07:11 -07:00
Brian
dd2f01c229 simplify update two-side lighting test (follow-on to previous front/back-face changes) 2007-12-18 16:28:36 -07:00
Brian
deb5c56c77 fix NEED_SECONDARY_COLOR for vert/frag progs 2007-12-18 16:28:36 -07:00
Michel Dänzer
0107acded0 i915tex: Fix issues with glDrawBuffer(GL_NONE).
Don't dereference NULL renderbuffer pointer, and make sure the software
fallback sticks.

Fixes https://bugs.freedesktop.org/show_bug.cgi?id=13694 .
2007-12-17 12:32:26 +01:00
Brian
2ac5e08d1d fix polygon cull regression 2007-12-14 14:36:23 -07:00
Dan Nicholson
1837b8c214 configs: Fix linking with static libGL and --as-needed
Linking of the programs breaks when using a static libGL and the GNU ld
option --as-needed. This is because libXext is needed for the XShm
functions.
(cherry picked from commit 6aaf9bdd41)
2007-12-07 11:51:18 -08:00
Brian
03d2bc1774 fix gl_FrontFacing 2007-12-04 14:07:15 -07:00
Brian
385bddbde0 fix span->facing computation and gl_FrontFacing initialization 2007-12-04 14:07:15 -07:00
Brian
c135426267 Fix gl_FrontFacing compilation problem 2007-12-04 14:07:15 -07:00
Michel Dänzer
4be0c98120 Use -Bsymbolic for linking all shared objects.
Fixes https://bugs.freedesktop.org/show_bug.cgi?id=10132 .

Also remove comment about SONAME, as SONAME only applies to shared libraries.
(cherry picked from commit fc7ddea853)
2007-12-04 18:33:07 +01:00
Brian
e760aebd5a fix two-side lighting bug/crash 2007-12-03 14:13:08 -07:00
Brian
1f6e7d9c29 fix DD_TRI_LIGHT_TWOSIDE bug (#13368) 2007-12-03 14:12:34 -07:00
Dan Nicholson
c6d421af05 Fix the library name in glw.pc
Fix a copy and paste error s/GLU/GLw/ in glw.pc.
(cherry picked from commit 2dc85e8078)
2007-12-03 12:08:03 -08:00
Brian
952df5e493 fix two-sided stencil 2007-12-03 12:00:21 -07:00
Brian
45acb8b058 added missing quote char 2007-12-03 12:00:21 -07:00
Michel Dänzer
e8997c0183 i915tex: Fix up state changes for i8xx.
(cherry picked from commit 2af613e0b8)
2007-12-03 09:38:13 +01:00
Brian
169e62f563 fix-build: remove ctx->_Facing assignment 2007-11-30 15:52:41 -07:00
Brian
1b43babfb1 fix broken two-sided stencil 2007-11-30 13:01:42 -07:00
Brian
43e902f774 better front-plane clip test 2007-11-30 09:09:12 -07:00
Xiang, Haihao
b0a800e249 i965: use uncompressed instruction to ensure only
Pixel Mask Copy is modified as the pixel shader thread
turns off pixels based on kill instructions.
2007-11-30 12:36:07 +08:00
Brian
73d5f232ad New ctx->Driver.Map/UnmapTexture() functions for accessing textures from t_vb_program.c 2007-11-29 08:18:11 -07:00
Brian
f7209541e4 cleanups, comments
Conflicts:

	src/mesa/tnl/t_vb_program.c
2007-11-29 08:18:11 -07:00
Brian
397a32dca7 Move _mesa_load_tracked_matrices() from TNL module to prog_statevars.c 2007-11-29 08:18:11 -07:00
Roland Scheidegger
e0719d7122 make sure state token values are fully initialized 2007-11-29 03:08:48 +01:00
Michel Dänzer
3f18c0a9f2 r200: Fix texture format regression on big endian systems.
See https://bugs.freedesktop.org/show_bug.cgi?id=13324 .

Also use tx_table_be for VALID_FORMAT, in case r200SetTexImages ever gets
called for MESA_FORMAT_RGB888.
(cherry picked from commit dc88a96631)
2007-11-28 10:25:01 +01:00
Delle
b14be61938 use DEFAULT_SOFTWARE_DEPTH_BITS 2007-11-27 18:18:48 -07:00
Brian
440d620308 minor additions to avoid FAQs 2007-11-27 10:32:39 -07:00
Brian
8dd9df0f3e document GLSL float f/F suffix bug 2007-11-27 10:32:39 -07:00
Brian
6b9534eaf5 set fp->UsesKill when emitting OPCODE_KIL 2007-11-27 10:32:39 -07:00
Brian
c91d374ad7 improve 24-bit Z to 32-bit Z conversion 2007-11-27 10:32:39 -07:00
Keith Whitwell
1cab4160bc i915tex: Fix some minor batchbuffer errors. 2007-11-26 17:12:15 +01:00
Keith Whitwell
718d2dfbbd i915tex: Catch cases where not all state is emitted for a new batchbuffer.
This could lead to incorrect rendering or even lockups.
2007-11-26 17:10:26 +01:00
Michel Dänzer
0967e1270d i915tex: Some additional blit fixes and assertions. 2007-11-26 16:59:41 +01:00
Michel Dänzer
a08c02f1a8 i915tex: Actually wait for previous commands to complete for glFinish(). 2007-11-26 16:59:00 +01:00
Brian
bdfd9afead Consolidate texture fetch code and use partial derivatives when possible. 2007-11-23 12:01:39 -07:00
Brian
1c91a590d6 fix a few GLSL bugs 2007-11-23 10:28:33 -07:00
Brian
65bd7968bf Fix parsing of gl_FrontLightModelProduct.sceneColor, don't segfault on variable
array indexes.
2007-11-23 10:26:02 -07:00
Brian
6ccd23b87b need to check border width in sample_linear_2d() - fixes failed assertion in texwrap.c test 2007-11-23 09:14:27 -07:00
Brian
823409b7d0 Bump version numbers to 7.0.3 for next release 2007-11-22 09:36:35 -07:00
Brian
c85d31f4a0 Recompute ctx->Point._Size if GL_POINT_SIZE_MIN/MAX changes.
Note that all the point size clamping stuff has been redone in Mesa/master.
2007-11-22 09:36:35 -07:00
Roland Scheidegger
24af5c44da fix z buffer read/write issue with rv100-like chips and old ddx 2007-11-22 02:55:25 +01:00
Brian
75efacf8eb Initial 7.0.3 relnotes 2007-11-20 08:16:25 -07:00
Brian
825e810247 bring over Fortran fixes from master 2007-11-20 08:15:19 -07:00
Brian
e20723cfc1 Obsolete 2007-11-20 08:13:14 -07:00
Brian
9f39a67c1d Rename glut_fbc.c -> glut_fcb.c (cb=callback) 2007-11-20 08:13:03 -07:00
Brian
2044f3f791 clamp lambda to Min/MaxLod 2007-11-19 13:05:10 -07:00
Brian
30d4e8c422 fix some texture format assertions, etc 2007-11-19 10:37:41 -07:00
Brian
92d552f6a2 fix out-of-bounds array index (ix=-1) 2007-11-19 09:54:41 -07:00
Brian
5adfcbbc4f added gl_dispatch_stub_772() 2007-11-16 10:03:57 -07:00
Roland Scheidegger
69969b3819 fix position invariant vertex programs for sw-tnl
do the same math as for fixed function pipe, including
user clip planes.
(mostly resurrected from the dead t_vb_arbprogram.c code)
2007-11-15 02:06:15 +01:00
Roland Scheidegger
edfee04fcb fix bogus assumption if ddx has set up surface reg for z buffer
this is wrong since even if ddx has not set up a surface reg to cover the z
buffer we should pretend it has on those rv100 chips since they presumably do
not do z buffer tiling if not using hyperz, so we can use linear addressing
just the same. Doesn't seem to fix #13080, but it's wrong anyway and the bug
almost certainly broke newer non-tcl chips.
2007-11-15 01:16:27 +01:00
Brian
28c9930888 add pointer to Gallium3D info 2007-11-13 09:51:14 -07:00
Brian
e3a35a123e DRI memory manager info (fixes dangling link) 2007-11-13 09:50:42 -07:00
Brian
412168f2e8 remove dependency on libGLU 2007-11-12 08:21:21 -07:00
Brian
fc0fa0d636 add glw.pc.in to tarball list, remove from DEPEND_FILES 2007-11-12 07:52:20 -07:00
Brian
8a40b670c3 added md5 checksums 2007-11-10 09:53:00 -07:00
Brian
d9fa5cbfc9 final changes for 7.0.2 relesae 2007-11-10 09:41:52 -07:00
Benno Schulenberg
1c21564292 code clean-ups, reformatting 2007-11-09 08:53:41 -07:00
Benno Schulenberg
6cc96bf156 remove commented-out code 2007-11-09 08:53:15 -07:00
Brian
29afd4bbc4 fix blender/unichrome crash, bug 13142 2007-11-08 07:36:30 -07:00
Benno Schulenberg
4e3db063ec fix Unichrome/Blender crash, bug 13142 2007-11-08 07:36:30 -07:00
Brian
6560744c38 added -fno-strict-aliasing and -fPIC flags 2007-11-08 07:36:30 -07:00
Brian
572ad87881 change filenames for rc2 2007-11-08 07:36:30 -07:00
Michel Dänzer
2ab75d6cfa r200: Fix SetTexOffset format for 16 bit pixmaps/textures.
Use symbolic array indices to clarify.
2007-11-06 18:39:50 +01:00
Chris Rankin
041a8eb5ec r200: Implement SetTexOffset hook.
Implementation guidance by Michel Dänzer, final testing by Timo Aaltonen.
2007-11-06 18:32:33 +01:00
Brian
c1c13bdcfa Check for NULL VB->EdgeFlag array.
There might be a bug elsewhere, but this is a simple work-around for now.
See bug 12614
2007-11-05 14:43:03 -07:00
Brian
403edd34dd fix mmx code (bug 12614) 2007-11-05 14:38:12 -07:00
Brian
f279e48416 fix mmx code (bug 12614) 2007-11-05 14:38:05 -07:00
Brian
bf854d8d27 SSE codegen fixes 2007-11-03 08:45:42 -06:00
Brian
f334121679 Fix mem leak in SSE code generation path (Michel Dänzer) and don't crash if _mesa_exec_malloc() returns NULL. 2007-11-03 08:44:48 -06:00
Dan Nicholson
b88e2be609 Add -fno-strict-aliasing workaround for all GCC targets
Use a GCC option to work around aliasing bugs. See commit 013dbcd for
more details.
(cherry picked from commit 01b18abf93)

Conflicts:

    configs/freebsd
2007-11-01 11:07:02 -07:00
Dan Nicholson
08229c8bb8 configs: Set -fexceptions for GLUT on linux-dri like other targets
Quite a while ago, the GCC option -fexceptions was added for building
libglut. See here:

  http://article.gmane.org/gmane.comp.video.mesa3d.devel/9499

This was missing in the linux-dri targets.
(cherry picked from commit dbcd20f1c2)
2007-11-01 11:02:05 -07:00
Dan Nicholson
c984017f71 configs: Always use -fPIC for shared libraries, never for static
Mesa currently disables -fPIC for DRI on x86, but most Linux distros are
re-enabling -fPIC for all DRI arches. Let's just do that here since
that's normally what's wanted for shared libraries. Some justification:

http://bugs.gentoo.org/show_bug.cgi?id=110840#c9

On the other hand, position-independent code is only necessary when
building shared libraries, so disable it for the static cases.
(cherry picked from commit c3b5adaa9a)
2007-11-01 11:01:10 -07:00
Dan Nicholson
00e7dd8a13 Add -fno-strict-aliasing workaround for Linux GCC targets
Most Linux distros work around aliasing problems in Mesa by compiling
with the GCC option -fno-strict-aliasing. Two examples:

  https://bugs.freedesktop.org/show_bug.cgi?id=6046
  http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=394311

This makes -fno-strict-aliasing the default with a comment that
developers should consider commenting it out. There is a already a note
about these bugs in docs/helpwanted.html.
(cherry picked from commit 013dbcd611)
2007-11-01 10:56:01 -07:00
Brian
d11b375b16 fix typo 2007-10-31 09:43:17 -06:00
Brian
d1afa8146f updated help/to-do list 2007-10-31 09:40:58 -06:00
Brian
31d4ba8a93 glDrawArrays(count=0) bugfix 2007-10-31 09:40:20 -06:00
Brian
1a7640958c check for count==0 in _mesa_validate_DrawArrays() 2007-10-31 09:39:20 -06:00
Brian
2e2a5a450b note G33/Q33/Q35 support 2007-10-31 08:19:14 -06:00
Brian
574fd63ff0 fix GL_ATI_separate_stencil 2007-10-30 10:46:31 -06:00
Brian
1063d47526 Alias glStencilOpSeparateATI with glStencilOpSeparate.
(Cherry-pick from master)
2007-10-30 10:45:47 -06:00
Brian
b59a892d3e Finish up ATI_separate_stencil
Add entrypoints to glapi XML file and regenerate files.
Implement glStencilOpSeparateATI().
Consolidate some code in stencil.c

Conflicts:

	src/mesa/glapi/dispatch.h
	src/mesa/glapi/glapioffsets.h
	src/mesa/glapi/glapitable.h
	src/mesa/glapi/glapitemp.h
	src/mesa/glapi/glprocs.h
	src/mesa/main/enums.c
	src/mesa/main/state.c
	src/mesa/sparc/glapi_sparc.S
	src/mesa/x86-64/glapi_x86-64.S
	src/mesa/x86/glapi_x86.S
2007-10-30 10:34:26 -06:00
Roland Scheidegger
6e5d5d77df add missing _mesa_StencilFuncSeparateATI function 2007-10-30 10:26:56 -06:00
Dan Nicholson
a6319d18cf Build xdemos programs by default on linux-dri
Since libglut is no longer hardcoded, we can build the xdemos programs
so long as a GLX enabled libGL and libGLU have been built.
(cherry picked from commit 06ca14543e)
2007-10-29 12:08:34 -07:00
Dan Nicholson
5103e883fd update APP_LIB_DEPS for static library configs (patch 3/3)
(cherry picked from commit 162914675a)
2007-10-29 12:06:50 -07:00
Dan Nicholson
98c4ea4b24 simplify APP_LIB_DEPS (patch 2/3)
(cherry picked from commit 9ef1d9f03a)
2007-10-29 12:06:23 -07:00
Dan Nicholson
29b8cac7d7 specify app lib dependencies in Makefiles (patch 1/3)
(cherry-picked from commit c05aa5ec4c)

Conflicts: progs/demos/Makefile
           progs/xdemos/Makefile
2007-10-29 12:05:54 -07:00
Dan Nicholson
cdb02d43fe linux-dri-xcb: Fix undefined refs when linking with libGL
GL_LIB_DEPS was missing -lXdamage and -lXfixes, which was causing
linker errors when trying to build the programs.
(cherry picked from commit 3b9e28d507)
2007-10-29 11:44:30 -07:00
Michel Dänzer
50cecddc4a driFenceType: Really return fence type, not flags.
This typo could lead to the i915tex driver waiting for an EXE only fence as RW,
causing it to abort with an error.
2007-10-29 13:27:59 +00:00
Alan Hourihane
177f6398e5 Only set R_MODE with NV_point_sprite 2007-10-28 20:08:15 +00:00
Dan Nicholson
887bd6a46f configs: Fix linux-static to link correctly
The linux-static target was missing necessary libraries and hardcoding
their location to /usr/X11R6/lib. This makes it comparable to the x86
and x86-64 static targets.
(cherry picked from commit 9514209593)
2007-10-26 15:49:00 -07:00
Brian
9af5153410 use grep -q 2007-10-25 14:48:08 -06:00
Dan Nicholson
0e2103689e More ignored programs merged back from master
Some more entries in progs/*/.gitignore that were in master.
2007-10-25 11:59:26 -07:00
Brian
2c496d8e46 simplify/fix the ASM_FLAGS tests (bug 12931) 2007-10-25 11:12:17 -06:00
Brian
8f0ba02e44 Cray Xt3 config 2007-10-25 11:12:07 -06:00
Brian
524c56e417 Fix merge 2007-10-24 16:36:00 -06:00
Brian
773f3a266c added catamount-osmesa-pgi config, fixes for cross-compiling 2007-10-24 16:35:47 -06:00
Brian
882ada0d22 don't build x86, x86-64 dirs if not needed 2007-10-24 16:33:24 -06:00
Brian
6229005f93 properly init dst reg's CondMask/Swizzle fields 2007-10-23 10:55:14 -06:00
Brian
6c63b35ef7 bump up MAX_INSTRUCTIONS and add an assertion to catch emitting too many instructions 2007-10-23 10:25:34 -06:00
Brian
fb85e50e09 add directfb glut sources to tarball 2007-10-23 08:22:11 -06:00
Brian
5e5f908d0c don't apply ColorMask to main gc 2007-10-22 17:54:07 -06:00
Michel Dänzer
c09e2143c7 i915tex: Don't emit 'empty' blit rectangles.
The hardware seems to interpret them differently and produce unexpected
results...
2007-10-17 18:28:46 +02:00
Brian
74ced1e67f fix fog, rescale_normals bugs (from gallium branch) 2007-10-15 18:02:14 -06:00
Andreas Micheler
dd02c1609e faster write_rgba_span_front() 2007-10-15 08:28:06 -06:00
Brian
cdf4880a79 replace 'brick' with correct program name in printfs 2007-10-10 10:57:37 -06:00
Mrc Gran
2ec8e8547d fix force_s3tc_enable option 2007-10-10 09:16:12 -06:00
Dan Nicholson
b7c36d1d33 Ignore more generated files in progs/
Many of the directories in progs/ were missing .gitignore files or
were tracking generated files. This patch is basically the process of
running `make' in each directory and then finding the untracked files
with `git-ls-files -o --exclude-per-directory=.gitignore'. The existing
files were also sorted.

Conflicts:

	progs/demos/.gitignore
	progs/tests/.gitignore
	progs/xdemos/.gitignore
2007-10-10 08:49:59 -06:00
Xiang, Haihao
970d18a708 Brian's fix for bug9829 2007-10-04 00:08:18 +02:00
Roland Scheidegger
9456e7f0ff minor fog calc cleanup 2007-10-03 22:34:36 +02:00
Roland Scheidegger
a5db24adc2 fog: fix issues with negative fog coords (may fix #10529)
Rework tnl fog a bit. Make sure we always use ABS(eyez) when fog coord source
is depth, OTOH it does not seem to be necessary to use it (as was done before
in some cases) if fog coord source is fogcoord (just to save some work).
This fixes tests/fog (the first 2 cases) with i915/i915tex.
2007-10-03 22:33:26 +02:00
Roland Scheidegger
17664e2620 make sure optimized fog params get updated 2007-10-03 22:33:03 +02:00
Roland Scheidegger
43a0eb0253 unbreak 3d textures (typo when setting tex layout) 2007-10-03 22:32:33 +02:00
Michel Dänzer
bcdaed2c0a i915tex: Work around texture pitch related performance drops on i915 at least. 2007-10-03 10:48:56 +02:00
Brian
78c6637db5 updated glext.h license info (Khronos), plus other clean-ups 2007-10-01 17:56:48 -06:00
Brian
44214a98fd fix VBO-split infinite loop (bug 12164) 2007-09-29 12:01:47 -06:00
Dan Nicholson
9cc6d2310c add support for LDFLAGS env var 2007-09-28 18:47:11 -06:00
Brian
1a045954be update the DRM/DRI instructions 2007-09-28 18:43:12 -06:00
Dave Airlie
b3fc9a1585 i965: fix vblank on 965gm laptops by bringing in code from i915
jbarnes has better fixes for this in 7.1, but for 7.0.2 this seems like the best
plan, for distros to pick it up.
2007-09-28 12:02:27 +10:00
Xiang, Haihao
2a86a449ca mesa: make sure the gotten value isn't greater than the
max depth buffer value on 64bit system. fix bug #12095
2007-09-27 10:44:45 -06:00
Xiang, Haihao
44f032db61 i965: handle all unfilled mode in clip stage. fix bug #12453 2007-09-27 10:40:22 -06:00
Brian
5a520729ee prep for 7.0.2 release 2007-09-27 10:35:10 -06:00
Brian
36fbe78c60 for Miniglx, use git sources 2007-09-27 10:34:44 -06:00
Brian
029bb17770 bump versions to 7.0.2 2007-09-27 10:30:13 -06:00
Brian
7958bee6be fix blend bug 12164 2007-09-27 10:25:57 -06:00
Brian
0b9bb21ce4 Restore old _TriangleCaps code to fix Blender problem (bug 12164) 2007-09-27 10:25:33 -06:00
Roland Bär
cfcc5b794e [i965] Bug #11812: Fix fwrite return value checks in AUB file code. 2007-09-26 08:00:17 -06:00
Zou Nan hai
925ff408a6 fix fd.o bug #12217, recalcuate urb when clip plane size change 2007-09-26 07:59:41 -06:00
Xiang, Haihao
f40ca444f5 i965: The cube map texture coordinates must be devided by the
component with the largest absolute value before they are
delivered. fix bug #12421
2007-09-26 07:58:57 -06:00
Zou Nan hai
638a5e0382 fix a bug in 965 ARB_occlusion_query,
fd.o bug #12132
2007-09-26 07:58:29 -06:00
Brian
6d777bf055 fix DrawRangeElements error msg 2007-09-23 13:57:36 -06:00
Brian
ae6d4e8bc0 fix -D_BSD_SOURC 2007-09-20 18:42:59 -06:00
Brian
f2728724d3 fix for __IBMC__ 2007-09-20 15:12:42 -06:00
Brian
bc95b34cce added bluegene-xlc-osmesa, fortran fixes 2007-09-20 15:12:21 -06:00
Brian
9eb89616af fixes for bluegene-xlc-osmesa config 2007-09-20 15:10:35 -06:00
Brian
f7713a6d81 Added bluegene-xlc-osmesa config (Alexander Neundorf) 2007-09-20 15:09:54 -06:00
Brian
1cec9b727a fix bug 10604 2007-09-14 13:43:58 -06:00
Brian
18a4730f5b From trunk: mesa: bind VBO_ATTRIB_XXX to correct input array when executing a display list. fix #10604
This also fixes Bill Mitchell's Fortan/plot bug.
2007-09-14 13:43:09 -06:00
Brian
1342aefcdd updated link 2007-09-14 09:57:16 -06:00
Brian
1fd4b1e702 fix glCopyPixel/glPixelZoom bug 12417) 2007-09-14 09:57:08 -06:00
Brian
32dff44c28 fix copypixels overlap test bug (#12417) 2007-09-14 09:56:05 -06:00
Brian
e7c2ae476a fix ARB fp/vp parsing bug 12313 2007-09-13 11:42:48 -06:00
Brian
a66301f83d added program_error2() function for better error reporting 2007-09-13 11:41:44 -06:00
Brian
a5f7d56221 Fix state.texgen parsing error (bug 12313).
Replace *(*inst++) with *(*inst)++ in a few places.
2007-09-13 11:29:51 -06:00
Brian
140080c1ec added .pc.in files to tarballs 2007-09-13 09:27:06 -06:00
Brian
ef43af6d43 added DSTDIR, pkg-config items 2007-09-12 10:12:20 -06:00
Brian
949d0532f0 updated with pkg-config info 2007-09-12 10:12:06 -06:00
Dan Nicholson
96efc76d74 pkg-config support 2007-09-12 10:03:31 -06:00
Dan Nicholson
6ca0d63692 DESTDIR support. 2007-09-12 10:01:06 -06:00
Xiang, Haihao
95fc2485e2 i965: fix bug#11925 2007-09-12 16:58:45 +08:00
Xiang, Haihao
d6ce1e4834 i965: fix #11378 2007-09-12 15:29:11 +08:00
Brian
2cc2b12fc7 fix indirect rendering crash 2007-09-11 10:59:10 -06:00
Brian
2259f81cf7 In _mesa_make_current(), don't unbind FBOs from the old context.
This fixes the X server crash reported by KeithP on Aug 29.
The old context's FBOs will be unreferenced during context destruction so
there's no memleak with this change.
2007-09-11 10:59:10 -06:00
Brian
791f12880f Update depth test state when binding new framebuffer object 2007-09-11 09:25:49 -06:00
Brian
7aa7373a64 fix comment 2007-09-11 09:25:49 -06:00
Xiang, Haihao
2f186a190f i965: take the secondary color into account when drawing
bitmap. fix#10688
2007-09-11 17:03:07 +08:00
Xiang, Haihao
357893a873 i965: limit on LOD Bias, fix#11987 2007-09-11 17:02:15 +08:00
Brian
a17881da5f clean-up (see bug 12317) 2007-09-10 08:36:01 -06:00
Brian
4872ee83a9 updated VC7 project files 2007-09-05 10:05:48 -06:00
Christoph Kubisch
5ec222a832 updated VC7 project files 2007-09-05 10:01:58 -06:00
Brian
40438b3440 Use temporary matrix in __gluInvertMatrixd() to fix aliasing problem (see bugs 12269, 6748) 2007-09-03 16:21:12 -06:00
Xiang, Haihao
e0b80660c8 fix bug#11009 2007-09-01 15:31:49 +08:00
Xiang, Haihao
a2016301f5 i965: Take the upper limitation on LOD into account. 2007-09-01 15:14:58 +08:00
Brian
7ec6729fb6 sync with trunk, fixing bug 12239 2007-08-31 16:36:17 -06:00
Brian
837a2cf72e fix i965 bugs, x86-64 bugs 2007-08-31 16:35:38 -06:00
Roland Scheidegger
0adca14536 fix another occurence of movaps which might not be aligned 2007-08-31 00:06:30 +02:00
Brian
57b0f66c6d s/movaps/movups/ (see bug 12216) 2007-08-30 08:41:43 -06:00
Xiang, Haihao
e47e7a9571 i965: store read drawable info in intel_context. Some OpenGL
operations are based on read drawable. fix bug#10136.
2007-08-30 14:06:26 +08:00
Xiang, Haihao
68ca01560f i965: check NULL pointer. fix bug#12193 2007-08-30 14:06:19 +08:00
Xiang, Haihao
64f1c91fcb i965: samplers group in fours in WM_STATE. fix bug#9415 2007-08-30 14:05:56 +08:00
Xiang, Haihao
7d33f94198 i965: flush batch buffer when getting the maximum. This makes
some 3D programs such as pymol work well.
2007-08-30 14:05:39 +08:00
Brian
d69a596193 Fixed bugs 6748, 12141 2007-08-27 10:48:31 -06:00
Colin McDonald
8aa4ae638e fixed problem with big glDrawArrays (see bug 12141) 2007-08-27 10:47:49 -06:00
Brian
3069f34841 new __gluInvertMatrix() function (Mesa bug 6748) 2007-08-27 10:36:25 -06:00
Adam Jackson
b3788a0e4f Unbreak Linux builds with -fvisibility=hidden. 2007-08-24 08:49:59 +01:00
Brian
582bc029ab remove CallDepth++/-- accidentally removed in prev commit 2007-08-24 08:45:27 +01:00
Brian
e9e3099433 remove unneeded CallStack array 2007-08-23 08:17:35 +01:00
Brian
4fc561cc7b refactor bounds checking code 2007-08-20 13:12:10 +01:00
Brian
ad3e3a0b99 don't map buffer in _mesa_validate_DrawElements() unless needed 2007-08-20 12:55:26 +01:00
Brian
bfb8c849cb Remove recent texobj refcount debug/logging code. 2007-08-16 09:11:11 +01:00
Michel Dänzer
09dd25b5d1 i915tex: Unreference texture buffers on context destruction.
Not doing this could cause the buffers to leak under some circumstances.
2007-08-16 08:45:16 +02:00
Roland Scheidegger
c48efb1dbe suppress warning about ncon visuals (bug #6689) 2007-08-16 02:43:45 +02:00
Brian
5408acb6b7 log deleting/binding of FBOs 2007-08-15 15:47:28 +01:00
Brian
15481160f9 more debug output (context destroy, fb destroy) 2007-08-15 12:52:00 +01:00
Brian
00ccff03a5 Rewrite quite a bit of the code for glPush/PopAttrib() for texture state.
Remove the Saved1D/2D/etc fields from gl_texture_attrib in mtypes.h
Use a new texture_state struct in attrib.c that has the extra information
for restoring texture object state and saving references to the texture
objects (so they can't accidentally get deleted while referenced by the
attribute stack).  All the texobj refcounting is mutex-protected now.
2007-08-15 11:21:06 +01:00
Brian
21594921b1 copy Target in _mesa_copy_texture_object() 2007-08-15 11:18:38 +01:00
Brian
42c91eebc9 Added _mesa_free_attrib_data() to free anything left in the attribute stack upon context destruction.
Also, a bit more refcount debug info.
2007-08-15 10:10:02 +01:00
Brian
88273e08b4 more tex obj ref count debugging (temporary) 2007-08-15 08:55:03 +01:00
Brian
08f7fb45ef added some temporary texobj ref counting debug output 2007-08-14 19:45:02 +01:00
Brian
75ebda3ce6 Fix a few more problems with freeing FBOs/textures during context destruction.
Free FBOs before textures since the later may be referenced by the former.
Need to bind the context we're destroying if there isn't a current context
so that ctx->DeleteTexture() etc can be used.
2007-08-14 11:57:16 +01:00
Brian
53ff15fcbf fix blending/banding bug 2007-08-13 21:17:04 +01:00
Dan Torop
72adb70ee2 fix spantmp2 READ_RGBA inline asm (#11931) 2007-08-13 21:14:51 +01:00
Brian
960d41fcfe added more i915/945 chipsets 2007-08-13 21:11:17 +01:00
Brian
0c4e35b070 Add PCI IDs for the G33, Q33, and Q35 chipsets.
Conflicts:

	src/mesa/drivers/dri/i915/i915_texstate.c
	src/mesa/drivers/dri/i915/intel_context.c
	src/mesa/drivers/dri/i915/intel_context.h
	src/mesa/drivers/dri/i915/intel_screen.c
	src/mesa/drivers/dri/i915/intel_tex.c
2007-08-13 21:06:33 +01:00
Wang Zhenyu
c53f1cb813 i915tex: Add support for 945GME 2007-08-13 21:00:28 +01:00
Brian
f6696cc15e free any render/framebuffers left in hash tables when freeing shared state 2007-08-13 17:39:05 +01:00
Michel Dänzer
fef9a41fe4 i915tex: Make sure pitch is aligned properly for render-to-texture.
Just always align texture pitch to multiples of 64 bytes for now, pending a
more sophisticated scheme to do it only when really necessary.
2007-08-13 13:22:43 +02:00
Brian
e279a0a076 Implement mutex/locking around texture object reference counting.
Use new _mesa_reference_texobj() function for referencing/unreferencing
textures.  Add new assertions/tests to try to detect invalid usage of
deleted textures.
2007-08-13 11:28:52 +01:00
Brian
88c8aaed96 fix link to 7.0.1 relnotes 2007-08-09 15:59:38 +01:00
Brian
62cbbd7226 fix byte swap bug for GLuint stencil indexes (bug 11909) 2007-08-09 08:45:01 +01:00
Brian
f7cbe7fcee move free() after dereference (bug 11878) 2007-08-07 22:06:48 +01:00
Brian
d8e4ff9079 fix potential NULL dereference (bug 11879) 2007-08-07 21:56:39 +01:00
Brian
510ff27eda remove SHELL line, replace -e test with new logic (Daniel Stone) 2007-08-07 21:52:22 +01:00
Brian
5abf055100 fix potential NULL dereference (bug 11880) 2007-08-07 21:46:42 +01:00
Brian
4bb5721f6b fix swizzle error test (bug 11881) 2007-08-07 21:43:46 +01:00
Brian
c41ab70d3a initial 7.0.2 notes 2007-08-07 08:44:35 +01:00
Brian
a05e403bf2 fix bug 9962 (vbo splitting) as in trunk 2007-08-07 08:43:31 +01:00
Brian
2f57e0f71d Merge branch 'mesa_7_0_branch' of git+ssh://brianp@git.freedesktop.org/git/mesa/mesa into mesa_7_0_branch 2007-08-07 08:21:50 +01:00
Brian
95a2eb9767 fix even-sized point positioning (bug 11874) 2007-08-07 08:20:18 +01:00
Brian
55175daed7 added md5 sums 2007-08-03 13:54:55 -06:00
Brian
ae16a51e95 added GLU bug fixes 2007-08-03 13:39:09 -06:00
Brian
4398d67546 update 7.0.1 release info/date 2007-08-03 13:32:47 -06:00
Brian
c93738687c remove -rc2 2007-08-03 13:32:28 -06:00
Brian
799492e606 add OSMESA_LIB_NAME 2007-08-03 10:08:16 -06:00
Brian
f33ff071bb added -lm 2007-08-03 07:24:33 -06:00
Brian
99e854743c added bluegene-osmesa 2007-08-02 14:24:05 -06:00
Brian
6f79062d91 OSmesa on BlueGene (Alexander Neundorf) 2007-08-02 14:22:52 -06:00
Brian
2f682c3995 fix stencil value masking bug 11805, and fix sizeof() bug 2007-08-02 09:08:53 -06:00
Brian
067370e68f fix invalid pointer usage in bezierPatchDeleteList(), bug 11807 2007-08-02 08:40:58 -06:00
Brian
2aa439a6a4 fix double free()s (bug 11808) 2007-08-02 08:38:10 -06:00
Brian
b477182dc3 s/MAX_TEXTURE_LEVELS/SIS_MAX_TEXTURE_LEVELS/ and add assertion (bug 11806) 2007-08-02 08:35:27 -06:00
Michel Dänzer
a8964ca89e i915tex: Better attempt to release miptree when overriding texture image.
The previous approach could lead to crashes in FBO code that dereferences the
miptree struct pointer unconditionally.
2007-08-02 12:14:03 +02:00
Brian
4f0e92d07c Merge branch 'mesa_7_0_branch' of git+ssh://brianp@git.freedesktop.org/git/mesa/mesa into mesa_7_0_branch 2007-08-01 17:03:09 -06:00
Brian
577f4e8a5f Obsolete 2007-08-01 11:45:47 -06:00
Brian
0586d9fe56 fix error code test limit (bug 11795) 2007-08-01 11:27:47 -06:00
Michel Dänzer
1f0d9bf05e i915tex: Missing piece of SetTexOffset hook implementation for I830 generation. 2007-08-01 17:46:32 +02:00
Michel Dänzer
8bcae2a527 i915tex: Implement SetTexOffset hook.
Only build tested for I830 generation.
2007-08-01 17:46:31 +02:00
Michel Dänzer
35ca9aae91 r300: Implement SetTexOffset hook. 2007-08-01 17:46:30 +02:00
Michel Dänzer
6cdd2bf8d7 Add interfaces for overriding texture images with driver specific 'offsets'.
To be used by AIGLX for GLX_EXT_texture_from_pixmap without several
additional data copies.
2007-08-01 17:46:29 +02:00
Brian
ce7d175adb fix mem leak (bug 11793) 2007-08-01 08:42:13 -06:00
Brian
1904fd095f fix mem leak (bug 11791) 2007-08-01 08:42:09 -06:00
Brian
897d0ac5cc fix some FreeBSD issues 2007-07-31 14:57:54 -06:00
Brian
e262d0182f fix failure caused by undeclared variable (bug 11783) 2007-07-31 09:43:40 -06:00
Brian
aa5b748c10 glGetAttribLocation always returned 1 (bug 11774) 2007-07-31 09:29:31 -06:00
Brian
3c182c5bc8 Added sunos5-v9-cc-g++ config (Roland Egger) 2007-07-30 09:00:09 -06:00
Brian
1b5677847b _mesa_pack_bitmap() fix from trunk 2007-07-30 08:13:05 -06:00
Brian
1be59a9dbe dlist polygon stipple fix from trunk 2007-07-30 08:12:29 -06:00
Brian
55c2178ad4 fix bug 11754 2007-07-29 18:28:09 -06:00
Jan Dvorak
3e3d392e1c fix glPointParameteriv bug 11754 2007-07-29 18:26:55 -06:00
Brian
756a7a4e4b minor tweaks 2007-07-27 11:44:55 -06:00
Brian
121b4ac220 More Mingw32 fixes from Zhang (zxpmyth@yahoo.com.cn) 2007-07-27 11:12:21 -06:00
Brian
cdbd5db3af release candidate 2 2007-07-27 11:10:00 -06:00
Brian
b2240f6ad4 fix bug 11731 2007-07-26 15:33:39 -06:00
Brian
33814a55f8 Fix function call bug 11731. Also, fix up IR_CALL/IR_FUNC confusion. 2007-07-26 15:32:34 -06:00
Brian
a57c5a417b generate error upon writing to varying var in fragment program (bug 11733) 2007-07-26 11:39:37 -06:00
Brian
ff1a28de17 clamp float colors 2007-07-26 08:19:40 -06:00
Brian
772f57f99b call ctx->Driver.NewProgram() instead of _mesa_new_program() 2007-07-24 09:56:54 -06:00
Brian
dacee32b8b fix logic error, typos 2007-07-24 09:19:44 -06:00
Brian
fa1a3eb06d fix GLX_STEREO bug 2007-07-23 16:54:35 -06:00
Brian
bd4817ca54 fix GLX_STEREO handling (bug 11705) 2007-07-23 16:51:03 -06:00
Brian
005eea249c Fix a number of MINGW32 issues (Zhang <zxpmyth@yahoo.com.cn>) 2007-07-21 11:27:22 -06:00
Brian
9747de8ec6 drop VC6 and VC7 project files until updated 2007-07-21 10:03:30 -06:00
Brian
849a9799d0 fix bug 11588 2007-07-13 16:37:18 -06:00
Jan Dvorak
e32ae4fe33 fix shader/info string length queries (bug 11588) 2007-07-13 16:35:19 -06:00
Brian
4595389c4c fix width/depth mix-up (bug 11577) 2007-07-12 21:43:39 -06:00
Brian
e8ccc7cc49 Merge branch 'mesa_7_0_branch' of git+ssh://brianp@git.freedesktop.org/git/mesa/mesa into mesa_7_0_branch 2007-07-12 14:49:56 -06:00
Brian
673d21047a fix swizzle-related bug 11534 2007-07-12 14:49:24 -06:00
Michel Dänzer
fdefc2bbda i915tex: Better procedure for dropping batchbuffer on virtual resolution change.
The previous procedure would often result in a GPU lockup.
2007-07-10 11:02:18 +02:00
Michel Dänzer
2079df8527 i915tex: Only wait for vblank when really necessary.
This avoids superfluous waits for vblank timing out under some circumstances.
2007-07-10 10:54:51 +02:00
Michel Dänzer
b53659452c Clear pointers to freed cliprects.
Not doing this could lead to double frees under rare circumstances.
2007-07-10 10:49:28 +02:00
Michel Dänzer
46f1d6653e Remove dubious compile-time test for pre-2.4 Linux kernels.
LINUX_VERSION_CODE shouldn't be used by userspace code, it can be defined empty
these days.

If anybody still cares about 2.2 kernels, they should reinstate this as a
proper runtime test.
2007-07-10 10:34:10 +02:00
Brian
c1938a60f7 Fix zero-size texture checking in _mesa_test_proxy_teximage(), bug 11309 2007-07-08 10:04:14 -06:00
Brian
d65110f352 Check if 'indices' is NULL, bug 11314 2007-07-08 09:21:21 -06:00
Brian
9fa3bbcb5a check depthScale value for optimized ushort->uint case (fixes bug 11474) 2007-07-08 08:53:09 -06:00
Brian
99d62f2922 fix i915 polygon stipple bug 2007-07-06 16:53:28 -06:00
Brian
284743cafe add GL_QUADS to i915_reduced_primitive_state() to fix redbook/polys demo 2007-07-06 16:52:34 -06:00
Xavier Bachelot
08d7307b2a call glutInit(), bug 11486 2007-07-06 12:54:40 -06:00
Brian
ef6a64abe6 fix a syntax error (missing right-paren) 2007-07-05 16:04:10 -06:00
Brian
18bfa52ef7 fix bug 11475 2007-07-05 09:42:07 -06:00
Brian
d62be2652c Copy from Mesa master. Includes fixes for bugs 11475 and 11448. 2007-07-05 09:40:37 -06:00
Eric Anholt
ea53ff80af fix LogicOp/bitmap problem, bug 11133 2007-07-04 07:37:28 -06:00
Brian
feeca1bcbc add fbdev/ to DEMO_FILES 2007-07-03 15:46:48 -06:00
Brian
12e7278c08 document GLSL fixes 2007-07-03 12:21:11 -06:00
Brian
45b5c44eb9 bring over Roland's DOT3_RGBA fix from master 2007-07-03 12:20:52 -06:00
Brian
e3456c1028 added vec2(vec4) constructor, bug 11404 2007-07-03 11:42:03 -06:00
Brian
327fb38573 add code for stpq, rgba writemasks in make_writemask(), bug 11404 2007-07-03 11:41:07 -06:00
Brian
1d25d9e15f Bump version to 7.0.1 2007-07-03 10:04:41 -06:00
Brian
cc7cee3f48 Revert the version of libOSMesa.so to 6.5.3 to avoid linking issues that were caused by bumping to 7.0 2007-07-03 10:03:01 -06:00
Brian
d7062710cd use _mesa_unpack_stencil_span() in draw_stencil_pixels(), bug 11457 2007-07-03 08:58:03 -06:00
Brian
9bfba734d8 add const to wglSetPixelFormat() to match .h declaration 2007-07-02 10:15:39 -06:00
Brian
aaebf2f47e regenerated 2007-06-29 07:51:49 -06:00
Brian
23f8d77b38 Add a few missing GL 2.0 entrypoints, regenerate related files.
Specifically:
  glVertexAttrib4bv
  glVertexAttrib4iv
  glVertexAttrib4ubv
  glVertexAttrib4uiv
  glVertexAttrib4usv
2007-06-28 16:38:48 -06:00
Brian
87d22ee0fe initial 7.0.1 relnotes 2007-06-28 08:11:36 -06:00
zhang
52e25f63d4 a variety of fixes for MingW 2007-06-28 08:10:09 -06:00
Brian
f3fb67972b remove obsolete t_save_api.c 2007-06-28 07:43:32 -06:00
Brian
6400756364 remove obsolete sources 2007-06-28 07:21:59 -06:00
Brian
d59f0314bd md5 sums for 7.0 2007-06-22 16:50:24 -06:00
Brian
131baefac3 fix date for 7.0 release 2007-06-22 16:41:36 -06:00
Brian
a450078b67 update version 2007-06-22 16:40:17 -06:00
Brian
f6b041bf6c bring in Eric's FreeBSD fixes for -pthread 2007-06-22 15:40:46 -06:00
Brian
4f340d181a set tentative 7.0 release date 2007-06-20 19:59:15 -06:00
Brian
b58e38e936 fix TEXTREL problem (bug 7459) 2007-06-12 09:52:05 -06:00
Brian
8713cb48a8 Fix TEXREL issues when using GLX_USE_TLS (see bug 7459). 2007-06-12 09:46:12 -06:00
Brian
277c5e57ed fix GLX_USE_TLS breakage 2007-06-12 08:57:39 -06:00
Brian
b3d62d5af5 disable depthBits check in check_compatible(), see bug 11161 2007-06-08 12:36:00 -06:00
Brian
9c0f0c8d81 remove old comment about DEFAULT_SOFTWARE_DEPTH_BITS 2007-06-08 12:35:37 -06:00
Brian
18a0a2a7ac document bug 11049 fix 2007-05-23 16:50:22 -06:00
Brian
8b99d9e33c restore GL_TEXTURE_LOD_BIAS in _mesa_PopAttrib(), bug 11049 2007-05-23 16:49:19 -06:00
Brian
01e7e153e3 document point attentuation fix 2007-05-23 08:59:02 -06:00
Brian
0ad4ca24d2 Fix point attentuation problem (bug 11042)
ctx->Point._Attentuation was computed in wrong place and the VB->Eye coord Z
array wasn't indexed correctly in run_point_stage().
2007-05-23 08:56:45 -06:00
Brian
724a155552 if light position is local, treat it as a homogeneous coord and divide by W (see bug 11009) 2007-05-21 10:55:15 -06:00
Roland Scheidegger
d38b74a316 fix miptree layout (i915) for small compressed mipmaps
This seems to work now. Also fix i945 set_level_info, need to match i915
behaviour for storing mip height, as it's assumed to be the mip width
(in texels) elsewhere and the division by 4 is done later (untested).
2007-05-19 04:43:50 +02:00
Roland Scheidegger
54cab4b47b fix copy & paste bug of previous commit, breaking dxt5 formats 2007-05-19 03:56:06 +02:00
Roland Scheidegger
c093666bc5 fix miptree comparison with compressed textures
TexelBytes is always 0 with compressed textures, thus would never match
mt->cpp. This caused constant blitting around of textures, and it fixes at
least the horrible performance of Q3 if compressed textures are enabled.
2007-05-19 01:39:54 +02:00
Roland Scheidegger
04972f6761 fix small s3tc mipmaps (#10968)
make sure that always whole blocks are uploaded.
(May still not work correctly if the top mip map is not at least a full block,
that is 4 pixels wide - not sure, but probably doesn't happen in real world)
2007-05-19 01:39:16 +02:00
Brian
67f8234622 set version to 7.0 2007-05-18 09:41:34 -06:00
Brian
201d6dbd9c fix STATE_HALF_VECTOR value (bug 10987) 2007-05-18 09:35:18 -06:00
Ian Romanick
fbcac5aa83 Refactor determining whether a texture target can use compressed format 2007-05-17 14:45:25 -07:00
Brian
2b72ab8f8f document glXDestroyPbuffer fix 2007-05-17 15:30:39 -06:00
Brian
0ea97b9408 In DestroyPbuffer(), use GetReq() intead of GetReqExtra(). See bug 10983. 2007-05-17 15:26:39 -06:00
Brian
28683ac7c0 version 7.0, not 7.1 2007-05-17 09:07:25 -06:00
Brian
c72e3e210f version should be 7.0 2007-05-17 09:04:19 -06:00
1009 changed files with 122911 additions and 106465 deletions

4
.gitattributes vendored
View File

@@ -1,4 +0,0 @@
*.dsp -crlf
*.dsw -crlf
*.sln -crlf
*.vcproj -crlf

6
.gitignore vendored
View File

@@ -8,9 +8,3 @@ depend
depend.bak
lib
lib64
configure
autom4te.cache
aclocal.m4
config.log
config.status
cscope*

View File

@@ -14,25 +14,25 @@ default: $(TOP)/configs/current
doxygen:
cd doxygen && $(MAKE)
(cd doxygen ; make) ; \
clean:
-@touch $(TOP)/configs/current
-@for dir in $(SUBDIRS) ; do \
@for dir in $(SUBDIRS) ; do \
if [ -d $$dir ] ; then \
(cd $$dir && $(MAKE) clean) ; \
fi \
done
-@test -s $(TOP)/configs/current || rm -f $(TOP)/configs/current
realclean: clean
realclean:
touch $(TOP)/configs/current
$(MAKE) clean
-rm -rf lib*
-rm -f $(TOP)/configs/current
-rm -f $(TOP)/configs/autoconf
-rm -rf autom4te.cache
-find . '(' -name '*.o' -o -name '*.a' -o -name '*.so' -o \
-name depend -o -name depend.bak ')' -exec rm -f '{}' ';'
-rm -f `find . -name \*.o`
-rm -f `find . -name \*.a`
-rm -f `find . -name \*.so`
-rm -f `find . -name depend`
@@ -48,20 +48,14 @@ install:
linux-directfb-install:
cd src/mesa/drivers/directfb && $(MAKE) install
.PHONY: default doxygen clean realclean install linux-directfb-install
# If there's no current configuration file
$(TOP)/configs/current:
@echo
@echo
@echo "Please choose a configuration from the following list:"
@ls -1 $(TOP)/configs | grep -v "current\|default\|CVS\|autoconf.*"
@ls -1 $(TOP)/configs | grep -v "current\|default\|CVS"
@echo
@echo "Then type 'make <config>' (ex: 'make linux-x86')"
@echo
@echo "Or, run './configure' then 'make'"
@echo "See './configure --help' for details"
@echo
@echo "(ignore the following error message)"
@exit 1
@@ -72,10 +66,9 @@ aix-64 \
aix-64-static \
aix-gcc \
aix-static \
autoconf \
beos \
bluegene-osmesa \
bluegene-xlc-osmesa \
beos \
catamount-osmesa-pgi \
darwin \
darwin-fat-32bit \
@@ -174,25 +167,17 @@ ultrix-gcc:
# Rules for making release tarballs
DIRECTORY = Mesa-7.1-rc3
LIB_NAME = MesaLib-7.1-rc3
DEMO_NAME = MesaDemos-7.1-rc3
GLUT_NAME = MesaGLUT-7.1-rc3
DIRECTORY = Mesa-7.0.3-rc3
LIB_NAME = MesaLib-7.0.3-rc3
DEMO_NAME = MesaDemos-7.0.3-rc3
GLUT_NAME = MesaGLUT-7.0.3-rc3
MAIN_FILES = \
$(DIRECTORY)/Makefile* \
$(DIRECTORY)/configure \
$(DIRECTORY)/configure.ac \
$(DIRECTORY)/acinclude.m4 \
$(DIRECTORY)/aclocal.m4 \
$(DIRECTORY)/descrip.mms \
$(DIRECTORY)/mms-config. \
$(DIRECTORY)/bin/config.guess \
$(DIRECTORY)/bin/config.sub \
$(DIRECTORY)/bin/install-sh \
$(DIRECTORY)/bin/mklib \
$(DIRECTORY)/bin/minstall \
$(DIRECTORY)/bin/version.mk \
$(DIRECTORY)/configs/[a-z]* \
$(DIRECTORY)/docs/*.html \
$(DIRECTORY)/docs/COPYING \
@@ -233,40 +218,48 @@ MAIN_FILES = \
$(DIRECTORY)/src/mesa/depend \
$(DIRECTORY)/src/mesa/main/*.[chS] \
$(DIRECTORY)/src/mesa/main/descrip.mms \
$(DIRECTORY)/src/mesa/main/sources \
$(DIRECTORY)/src/mesa/glapi/*.[chS] \
$(DIRECTORY)/src/mesa/glapi/descrip.mms \
$(DIRECTORY)/src/mesa/glapi/sources \
$(DIRECTORY)/src/mesa/math/*.[ch] \
$(DIRECTORY)/src/mesa/math/descrip.mms \
$(DIRECTORY)/src/mesa/math/sources \
$(DIRECTORY)/src/mesa/shader/*.[ch] \
$(DIRECTORY)/src/mesa/shader/descrip.mms \
$(DIRECTORY)/src/mesa/shader/sources \
$(DIRECTORY)/src/mesa/shader/grammar/*.[ch] \
$(DIRECTORY)/src/mesa/shader/grammar/descrip.mms \
$(DIRECTORY)/src/mesa/shader/grammar/sources \
$(DIRECTORY)/src/mesa/shader/slang/*.[ch] \
$(DIRECTORY)/src/mesa/shader/slang/descrip.mms \
$(DIRECTORY)/src/mesa/shader/slang/sources \
$(DIRECTORY)/src/mesa/shader/slang/library/*.[ch] \
$(DIRECTORY)/src/mesa/shader/slang/library/*.gc \
$(DIRECTORY)/src/mesa/shader/slang/library/*.syn \
$(DIRECTORY)/src/mesa/shader/slang/library/Makefile \
$(DIRECTORY)/src/mesa/swrast/*.[ch] \
$(DIRECTORY)/src/mesa/swrast/descrip.mms \
$(DIRECTORY)/src/mesa/swrast/sources \
$(DIRECTORY)/src/mesa/swrast_setup/*.[ch] \
$(DIRECTORY)/src/mesa/swrast_setup/descrip.mms \
$(DIRECTORY)/src/mesa/swrast_setup/sources \
$(DIRECTORY)/src/mesa/vbo/*.[chS] \
$(DIRECTORY)/src/mesa/vbo/descrip.mms \
$(DIRECTORY)/src/mesa/tnl/*.[chS] \
$(DIRECTORY)/src/mesa/tnl/descrip.mms \
$(DIRECTORY)/src/mesa/tnl/sources \
$(DIRECTORY)/src/mesa/tnl_dd/*.[ch] \
$(DIRECTORY)/src/mesa/tnl_dd/imm/*.[ch] \
$(DIRECTORY)/src/mesa/tnl_dd/imm/NOTES.imm \
$(DIRECTORY)/src/mesa/drivers/Makefile \
$(DIRECTORY)/src/mesa/drivers/beos/*.cpp \
$(DIRECTORY)/src/mesa/drivers/beos/Makefile \
$(DIRECTORY)/src/mesa/drivers/common/*.[ch] \
$(DIRECTORY)/src/mesa/drivers/common/descrip.mms \
$(DIRECTORY)/src/mesa/drivers/common/sources \
$(DIRECTORY)/src/mesa/drivers/directfb/*.[ch] \
$(DIRECTORY)/src/mesa/drivers/directfb/Makefile \
$(DIRECTORY)/src/mesa/drivers/dos/*.[chS] \
$(DIRECTORY)/src/mesa/drivers/fbdev/Makefile \
$(DIRECTORY)/src/mesa/drivers/fbdev/glfbdev.c \
$(DIRECTORY)/src/mesa/drivers/glide/*.[ch] \
$(DIRECTORY)/src/mesa/drivers/ggi/*.[ch] \
@@ -276,7 +269,6 @@ MAIN_FILES = \
$(DIRECTORY)/src/mesa/drivers/ggi/display/*.c \
$(DIRECTORY)/src/mesa/drivers/ggi/display/fbdev.conf.in \
$(DIRECTORY)/src/mesa/drivers/ggi/include/ggi/mesa/*.h \
$(DIRECTORY)/src/mesa/drivers/osmesa/Makefile \
$(DIRECTORY)/src/mesa/drivers/osmesa/Makefile.win \
$(DIRECTORY)/src/mesa/drivers/osmesa/descrip.mms \
$(DIRECTORY)/src/mesa/drivers/osmesa/osmesa.def \
@@ -284,8 +276,8 @@ MAIN_FILES = \
$(DIRECTORY)/src/mesa/drivers/svga/*.[ch] \
$(DIRECTORY)/src/mesa/drivers/windows/*/*.[ch] \
$(DIRECTORY)/src/mesa/drivers/windows/*/*.def \
$(DIRECTORY)/src/mesa/drivers/x11/Makefile \
$(DIRECTORY)/src/mesa/drivers/x11/descrip.mms \
$(DIRECTORY)/src/mesa/drivers/x11/sources \
$(DIRECTORY)/src/mesa/drivers/x11/*.[ch] \
$(DIRECTORY)/src/mesa/ppc/*.[ch] \
$(DIRECTORY)/src/mesa/sparc/*.[chS] \
@@ -314,14 +306,12 @@ MAIN_FILES = \
DRI_FILES = \
$(DIRECTORY)/include/GL/internal/dri_interface.h \
$(DIRECTORY)/include/GL/internal/dri_sarea.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/dri.pc.in \
$(DIRECTORY)/src/mesa/drivers/dri/common/xmlpool/*.[ch] \
$(DIRECTORY)/src/mesa/drivers/dri/common/xmlpool/*.po \
$(DIRECTORY)/src/mesa/drivers/dri/*/*.[chS] \
@@ -445,20 +435,9 @@ LIB_FILES = $(MAIN_FILES) $(DRI_FILES) $(SGI_GLU_FILES) $(GLW_FILES)
# Everything for new a Mesa release:
tarballs: rm_depend configure aclocal.m4 lib_gz demo_gz glut_gz \
lib_bz2 demo_bz2 glut_bz2 lib_zip demo_zip glut_zip md5
tarballs: rm_depend lib_gz demo_gz glut_gz lib_bz2 demo_bz2 glut_bz2 lib_zip demo_zip glut_zip md5
# Helper for autoconf builds
ACLOCAL = aclocal
ACLOCAL_FLAGS =
AUTOCONF = autoconf
AC_FLAGS =
aclocal.m4: configure.ac acinclude.m4
$(ACLOCAL) $(ACLOCAL_FLAGS)
configure: configure.ac aclocal.m4 acinclude.m4
$(AUTOCONF) $(AC_FLAGS)
rm_depend:
@for dep in $(DEPEND_FILES) ; do \
rm -f $$dep ; \
@@ -467,7 +446,6 @@ rm_depend:
lib_gz:
rm -f configs/current ; \
rm -f configs/autoconf ; \
cd .. ; \
tar -cf $(LIB_NAME).tar $(LIB_FILES) ; \
gzip $(LIB_NAME).tar ; \
@@ -487,7 +465,6 @@ glut_gz:
lib_bz2:
rm -f configs/current ; \
rm -f configs/autoconf ; \
cd .. ; \
tar -cf $(LIB_NAME).tar $(LIB_FILES) ; \
bzip2 $(LIB_NAME).tar ; \
@@ -507,7 +484,6 @@ glut_bz2:
lib_zip:
rm -f configs/current ; \
rm -f configs/autoconf ; \
rm -f $(LIB_NAME).zip ; \
cd .. ; \
zip -qr $(LIB_NAME).zip $(LIB_FILES) ; \
@@ -535,6 +511,3 @@ md5:
@-md5sum $(GLUT_NAME).tar.gz
@-md5sum $(GLUT_NAME).tar.bz2
@-md5sum $(GLUT_NAME).zip
.PHONY: tarballs rm_depend lib_gz demo_gz glut_gz lib_bz2 demo_bz2 \
glut_bz2 lib_zip demo_zip glut_zip md5

View File

@@ -1,119 +0,0 @@
# A few convenience macros for Mesa, mostly to keep all the platform
# specifics out of configure.ac.
# MESA_PIC_FLAGS()
#
# Find out whether to build PIC code using the option --enable-pic and
# the configure enable_static/enable_shared settings. If PIC is needed,
# figure out the necessary flags for the platform and compiler.
#
# The platform checks have been shamelessly taken from libtool and
# stripped down to just what's needed for Mesa. See _LT_COMPILER_PIC in
# /usr/share/aclocal/libtool.m4 or
# http://git.savannah.gnu.org/gitweb/?p=libtool.git;a=blob;f=libltdl/m4/libtool.m4;hb=HEAD
#
AC_DEFUN([MESA_PIC_FLAGS],
[AC_REQUIRE([AC_PROG_CC])dnl
AC_ARG_VAR([PIC_FLAGS], [compiler flags for PIC code])
AC_ARG_ENABLE([pic],
[AS_HELP_STRING([--disable-pic],
[compile PIC objects @<:@default=enabled for shared builds
on supported platforms@:>@])],
[enable_pic="$enableval"
test "x$enable_pic" = x && enable_pic=auto],
[enable_pic=auto])
# disable PIC by default for static builds
if test "$enable_pic" = auto && test "$enable_static" = yes; then
enable_pic=no
fi
# if PIC hasn't been explicitly disabled, try to figure out the flags
if test "$enable_pic" != no; then
AC_MSG_CHECKING([for $CC option to produce PIC])
# allow the user's flags to override
if test "x$PIC_FLAGS" = x; then
# see if we're using GCC
if test "x$GCC" = xyes; then
case "$host_os" in
aix*|beos*|cygwin*|irix5*|irix6*|osf3*|osf4*|osf5*)
# PIC is the default for these OSes.
;;
mingw*|os2*|pw32*)
# This hack is so that the source file can tell whether
# it is being built for inclusion in a dll (and should
# export symbols for example).
PIC_FLAGS="-DDLL_EXPORT"
;;
darwin*|rhapsody*)
# PIC is the default on this platform
# Common symbols not allowed in MH_DYLIB files
PIC_FLAGS="-fno-common"
;;
hpux*)
# PIC is the default for IA64 HP-UX and 64-bit HP-UX,
# but not for PA HP-UX.
case $host_cpu in
hppa*64*|ia64*)
;;
*)
PIC_FLAGS="-fPIC"
;;
esac
;;
*)
# Everyone else on GCC uses -fPIC
PIC_FLAGS="-fPIC"
;;
esac
else # !GCC
case "$host_os" in
hpux9*|hpux10*|hpux11*)
# PIC is the default for IA64 HP-UX and 64-bit HP-UX,
# but not for PA HP-UX.
case "$host_cpu" in
hppa*64*|ia64*)
# +Z the default
;;
*)
PIC_FLAGS="+Z"
;;
esac
;;
linux*|k*bsd*-gnu)
case `basename "$CC"` in
icc*|ecc*|ifort*)
PIC_FLAGS="-KPIC"
;;
pgcc*|pgf77*|pgf90*|pgf95*)
# Portland Group compilers (*not* the Pentium gcc
# compiler, which looks to be a dead project)
PIC_FLAGS="-fpic"
;;
ccc*)
# All Alpha code is PIC.
;;
xl*)
# IBM XL C 8.0/Fortran 10.1 on PPC
PIC_FLAGS="-qpic"
;;
*)
case `$CC -V 2>&1 | sed 5q` in
*Sun\ C*|*Sun\ F*)
# Sun C 5.9 or Sun Fortran
PIC_FLAGS="-KPIC"
;;
esac
esac
;;
solaris*)
PIC_FLAGS="-KPIC"
;;
sunos4*)
PIC_FLAGS="-PIC"
;;
esac
fi # GCC
fi # PIC_FLAGS
AC_MSG_RESULT([$PIC_FLAGS])
fi
AC_SUBST([PIC_FLAGS])
])# MESA_PIC_FLAGS

View File

@@ -1,16 +0,0 @@
#! /bin/sh
srcdir=`dirname "$0"`
test -z "$srcdir" && srcdir=.
SRCDIR=`(cd "$srcdir" && pwd)`
ORIGDIR=`pwd`
if test "x$SRCDIR" != "x$ORIGDIR"; then
echo "Mesa cannot be built when srcdir != builddir" 1>&2
exit 1
fi
autoreconf -v --install || exit 1
"$srcdir"/configure "$@"

View File

@@ -1,48 +0,0 @@
#!/bin/bash -e
usage()
{
echo "Usage: $0 <target1> <target2>"
echo "Highlight differences between Mesa configs"
echo "Example:"
echo " $0 linux linux-x86"
}
die()
{
echo "$@" >&2
return 1
}
case "$1" in
-h|--help) usage; exit 0;;
esac
[ $# -lt 2 ] && die 2 targets needed. See $0 --help
target1=$1
target2=$2
topdir=$(cd "`dirname $0`"/..; pwd)
cd "$topdir"
[ -f "./configs/$target1" ] || die Missing configs/$target1
[ -f "./configs/$target2" ] || die Missing configs/$target2
trap 'rm -f "$t1" "$t2"' 0
t1=$(mktemp)
t2=$(mktemp)
make -f- -n -p <<EOF | sed '/^# Not a target/,/^$/d' > $t1
TOP = .
include \$(TOP)/configs/$target1
default:
EOF
make -f- -n -p <<EOF | sed '/^# Not a target/,/^$/d' > $t2
TOP = .
include \$(TOP)/configs/$target2
default:
EOF
diff -pu -I'^#' $t1 $t2

1516
bin/config.guess vendored

File diff suppressed because it is too large Load Diff

1626
bin/config.sub vendored

File diff suppressed because it is too large Load Diff

View File

@@ -1 +0,0 @@
minstall

View File

@@ -42,8 +42,6 @@ if [ $# -ge 2 ] ; then
exit 0
fi
PWDSAVE=`pwd`
# determine file's type
if [ -h "$FILE" ] ; then
#echo $FILE is a symlink
@@ -59,6 +57,7 @@ if [ $# -ge 2 ] ; then
FILE=`basename "$FILE"`
# Go to $DEST and make the link
PWDSAVE="$PWD"
cd "$DEST" # pushd
$RM "$FILE"
$SYMLINK "$TARGET" "$FILE"

View File

@@ -61,8 +61,7 @@ do
echo ' -minor N specifies minor version number (default is 0)'
echo ' -patch N specifies patch version number (default is 0)'
echo ' -lLIBRARY specifies a dependency on LIBRARY'
echo ' -LDIR search in DIR for library dependencies at build time'
echo ' -RDIR search in DIR for library dependencies at run time'
echo ' -LDIR search in DIR for library dependencies'
echo ' -linker L explicity specify the linker program to use (eg: gcc, g++)'
echo ' Not observed on all systems at this time.'
echo ' -ldflags OPT specify any additional linker flags in OPT'
@@ -108,12 +107,6 @@ do
-L*)
DEPS="$DEPS $1"
;;
-R*)
DEPS="$DEPS $1"
;;
-Wl*)
DEPS="$DEPS $1"
;;
-pthread)
# this is a special case (see bugzilla 10876)
DEPS="$DEPS $1"
@@ -205,7 +198,7 @@ fi
#
case $ARCH in
'Linux' | 'OpenBSD' | 'DragonFly' | 'GNU' | GNU/*)
'Linux' | 'OpenBSD' | 'GNU' | GNU/*)
# we assume gcc
if [ "x$LINK" = "x" ] ; then
@@ -340,7 +333,7 @@ case $ARCH in
# use g++
LINK="g++"
else
echo "mklib: warning: can't find C++ compiler, trying CC."
echo "mklib: warning: can't find C++ comiler, trying CC."
LINK="CC"
fi
else
@@ -369,11 +362,9 @@ case $ARCH in
# Check if objects are SPARC v9
# file says: ELF 64-bit MSB relocatable SPARCV9 Version 1
set ${OBJECTS}
if [ ${LINK} = "cc" -o ${LINK} = "CC" ] ; then
SPARCV9=`file $1 | grep SPARCV9`
if [ "${SPARCV9}" ] ; then
OPTS="${OPTS} -xarch=v9"
fi
SPARCV9=`file $1 | grep SPARCV9`
if [ "${SPARCV9}" ] ; then
OPTS="${OPTS} -xarch=v9"
fi
if [ "${ALTOPTS}" ] ; then
OPTS=${ALTOPTS}
@@ -385,7 +376,7 @@ case $ARCH in
${LINK} ${OPTS} ${LDFLAGS} -o ${LIBNAME} ${OBJECTS} ${DEPS}
else
rm -f ${LIBNAME}.${MAJOR} ${LIBNAME}
${LINK} ${OPTS} ${LDFLAGS} -o ${LIBNAME}.${MAJOR} -h ${LIBNAME}.${MAJOR} ${OBJECTS} ${DEPS}
${LINK} ${OPTS} ${LDFLAGS} -o ${LIBNAME}.${MAJOR} ${OBJECTS} ${DEPS}
ln -s ${LIBNAME}.${MAJOR} ${LIBNAME}
fi
FINAL_LIBS="${LIBNAME}.${MAJOR} ${LIBNAME}"

View File

@@ -1,17 +0,0 @@
#!/usr/bin/make -sf
# Print the various Mesa version fields. This is mostly used to add the
# version to configure.
# This reflects that this script is usually called from the toplevel
TOP = .
include $(TOP)/configs/default
version:
@echo $(MESA_VERSION)
major:
@echo $(MESA_MAJOR)
minor:
@echo $(MESA_MINOR)
tiny:
@echo $(MESA_TINY)

1
configs/.gitignore vendored
View File

@@ -1,2 +1 @@
current
autoconf

View File

@@ -1,106 +0,0 @@
# Autoconf configuration
# Pull in the defaults
include $(TOP)/configs/default
# This is generated by configure
CONFIG_NAME = autoconf
# Compiler and flags
CC = @CC@
CXX = @CXX@
OPT_FLAGS = @OPT_FLAGS@
ARCH_FLAGS = @ARCH_FLAGS@
ASM_FLAGS = @ASM_FLAGS@
PIC_FLAGS = @PIC_FLAGS@
DEFINES = @DEFINES@
CFLAGS = @CPPFLAGS@ @CFLAGS@ \
$(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) $(ASM_FLAGS) $(DEFINES)
CXXFLAGS = @CPPFLAGS@ @CXXFLAGS@ \
$(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) $(DEFINES)
LDFLAGS = @LDFLAGS@
EXTRA_LIB_PATH = @EXTRA_LIB_PATH@
# Assembler
ASM_SOURCES = @ASM_SOURCES@
ASM_API = @ASM_API@
# Misc tools and flags
MAKE = @MAKE@
MKLIB_OPTIONS = @MKLIB_OPTIONS@
MKDEP = @MKDEP@
MKDEP_OPTIONS = @MKDEP_OPTIONS@
INSTALL = $(TOP)/bin/minstall
# Python and flags (generally only needed by the developers)
PYTHON2 = python
PYTHON_FLAGS = -t -O -O
# Library names (base name)
GL_LIB = GL
GLU_LIB = GLU
GLUT_LIB = glut
GLW_LIB = GLw
OSMESA_LIB = @OSMESA_LIB@
# Library names (actual file names)
GL_LIB_NAME = @GL_LIB_NAME@
GLU_LIB_NAME = @GLU_LIB_NAME@
GLUT_LIB_NAME = @GLUT_LIB_NAME@
GLW_LIB_NAME = @GLW_LIB_NAME@
OSMESA_LIB_NAME = @OSMESA_LIB_NAME@
# Directories to build
LIB_DIR = @LIB_DIR@
SRC_DIRS = @SRC_DIRS@
GLU_DIRS = @GLU_DIRS@
DRIVER_DIRS = @DRIVER_DIRS@
# Which subdirs under $(TOP)/progs/ to enter:
PROGRAM_DIRS = @PROGRAM_DIRS@
# Driver specific build vars
DRI_DIRS = @DRI_DIRS@
WINDOW_SYSTEM = @WINDOW_SYSTEM@
USING_EGL = @USING_EGL@
# Dependencies
X11_INCLUDES = @X11_INCLUDES@
# Library/program dependencies
GL_LIB_DEPS = $(EXTRA_LIB_PATH) @GL_LIB_DEPS@
OSMESA_LIB_DEPS = -L$(TOP)/$(LIB_DIR) @OSMESA_MESA_DEPS@ \
$(EXTRA_LIB_PATH) @OSMESA_LIB_DEPS@
GLU_LIB_DEPS = -L$(TOP)/$(LIB_DIR) @GLU_MESA_DEPS@ \
$(EXTRA_LIB_PATH) @GLU_LIB_DEPS@
GLUT_LIB_DEPS = -L$(TOP)/$(LIB_DIR) @GLUT_MESA_DEPS@ \
$(EXTRA_LIB_PATH) @GLUT_LIB_DEPS@
GLW_LIB_DEPS = -L$(TOP)/$(LIB_DIR) @GLW_MESA_DEPS@ \
$(EXTRA_LIB_PATH) @GLW_LIB_DEPS@
APP_LIB_DEPS = $(EXTRA_LIB_PATH) @APP_LIB_DEPS@
# DRI dependencies
DRI_LIB_DEPS = $(EXTRA_LIB_PATH) @DRI_LIB_DEPS@
LIBDRM_CFLAGS = @LIBDRM_CFLAGS@
LIBDRM_LIB = @LIBDRM_LIBS@
DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@
EXPAT_INCLUDES = @EXPAT_INCLUDES@
# Autoconf directories
prefix = @prefix@
exec_prefix = @exec_prefix@
libdir = @libdir@
includedir = @includedir@
# Installation directories (for make install)
INSTALL_DIR = $(prefix)
INSTALL_LIB_DIR = $(libdir)
INSTALL_INC_DIR = $(includedir)
# DRI installation directories
DRI_DRIVER_INSTALL_DIR = @DRI_DRIVER_INSTALL_DIR@
# Where libGL will look for DRI hardware drivers
DRI_DRIVER_SEARCH_DIR = $(DRI_DRIVER_INSTALL_DIR)
# Additional per-platform configuration settings
@EXTRA_CONFIG_LINES@

View File

@@ -1,42 +0,0 @@
# MinGW config include file updated for Mesa 7.0
#
# Updated : by Heromyth, on 2007-7-21
# Email : zxpmyth@yahoo.com.cn
# Bugs : 1) All the default settings work fine. But the setting X86=1 can't work.
# The others havn't been tested yet.
# 2) The generated DLLs are *not* compatible with the ones built
# with the other compilers like VC8, especially for GLUT.
# 3) Although more tests are needed, it can be used individually!
# The generated DLLs by MingW with STDCALL are not totally compatible
# with the ones linked by Microsoft's compilers.
#
# xxx_USING_STDCALL = 1 Compiling MESA with __stdcall. This is default!
#
# xxx_USING_STDCALL = 0 Compiling MESA without __stdcall. I like this:)
#
# In fact, GL_USING_STDCALL and GLUT_USING_STDCALL can be
# different. For example:
#
# GL_USING_STDCALL = 0
# GLUT_USING_STDCALL = 1
#
# Suggested setting:
#
# ALL_USING_STDCALL = 1
#
# That's default!
#
ALL_USING_STDCALL = 1
ifeq ($(ALL_USING_STDCALL),1)
GL_USING_STDCALL = 1
GLUT_USING_STDCALL = 1
else
GL_USING_STDCALL = 0
GLUT_USING_STDCALL = 0
endif

View File

@@ -9,9 +9,8 @@ CONFIG_NAME = default
# Version info
MESA_MAJOR=7
MESA_MINOR=1
MESA_TINY=0
MESA_VERSION = $(MESA_MAJOR).$(MESA_MINOR).$(MESA_TINY)
MESA_MINOR=0
MESA_TINY=3
# external projects. This should be useless now that we use libdrm.
DRM_SOURCE_PATH=$(TOP)/../drm
@@ -75,18 +74,17 @@ PROGRAM_DIRS = demos redbook samples glsl xdemos
GL_LIB_DEPS = $(EXTRA_LIB_PATH) -lX11 -lXext -lm -lpthread
OSMESA_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GL_LIB)
GLU_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GL_LIB) -lm
GLUT_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GLU_LIB) -l$(GL_LIB) $(EXTRA_LIB_PATH) -lX11 -lXmu -lXi -lm
GLUT_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GLU_LIB) -l$(GL_LIB) $(EXTRA_LIB_PATH) -lX11 -lXmu -lXt -lXi -lm
GLW_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GL_LIB) $(EXTRA_LIB_PATH) -lXt -lX11
# Program dependencies - specific GL/glut libraries added in Makefiles
APP_LIB_DEPS = -lm
# Installation directories (for make install)
INSTALL_DIR = /usr/local
INSTALL_LIB_DIR = $(INSTALL_DIR)/$(LIB_DIR)
INSTALL_INC_DIR = $(INSTALL_DIR)/include
DRI_DRIVER_INSTALL_DIR = $(INSTALL_LIB_DIR)/dri
DRI_DRIVER_INSTALL_DIR = /usr/X11R6/lib/modules/dri
# Where libGL will look for DRI hardware drivers
DRI_DRIVER_SEARCH_DIR = $(DRI_DRIVER_INSTALL_DIR)

View File

@@ -15,7 +15,7 @@ PIC_FLAGS = -fPIC
DEFINES = -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_BSD_SOURCE -DUSE_XSHM \
-DHZ=100
X11_INCLUDES = -I/usr/local/include
X11_INCLUDES = -I/usr/X11R6/include
CFLAGS += $(WARN_FLAGS) $(OPT_FLAGS) $(PIC_FLAGS) $(DEFINES) $(X11_INCLUDES) -ffast-math -pedantic
@@ -27,5 +27,5 @@ GLUT_CFLAGS = -fexceptions
CFLAGS += -fno-strict-aliasing
CXXFLAGS += -fno-strict-aliasing
EXTRA_LIB_PATH = -L/usr/local/lib
EXTRA_LIB_PATH = -L/usr/X11R6/lib
APP_LIB_DEPS = -L$(TOP)/$(LIB_DIR) $(EXTRA_LIB_PATH) -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) -lXext -lXmu -lXi -lX11 -lm

View File

@@ -9,10 +9,10 @@ CONFIG_NAME = freebsd-dri
CC = gcc
CXX = g++
WARN_FLAGS = -Wall
OPT_FLAGS = -O -g
OPT_FLAGS = -O
EXPAT_INCLUDES = -I/usr/local/include
X11_INCLUDES = -I/usr/local/include
X11_INCLUDES = -I/usr/X11R6/include
DEFINES = -DPTHREADS -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER \
-DGLX_DIRECT_RENDERING -DGLX_INDIRECT_RENDERING \
-DHAVE_ALIAS
@@ -32,11 +32,11 @@ ASM_SOURCES =
LIBDRM_CFLAGS = `pkg-config --cflags libdrm`
LIBDRM_LIB = `pkg-config --libs libdrm`
DRI_LIB_DEPS = -L/usr/local/lib -lm -pthread -lexpat $(LIBDRM_LIB)
GL_LIB_DEPS = -L/usr/local/lib -lX11 -lXext -lXxf86vm -lXdamage -lXfixes \
GL_LIB_DEPS = -L/usr/X11R6/lib -lX11 -lXext -lXxf86vm -lXdamage -lXfixes \
-lm -pthread $(LIBDRM_LIB)
GLUT_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -L/usr/local/lib -lGLU -lGL -lX11 -lXmu -lXt -lXi -lm
GLW_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -L/usr/local/lib -lGL -lXt -lX11
GLUT_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -L/usr/X11R6/lib -lGLU -lGL -lX11 -lXmu -lXt -lXi -lm
GLW_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -L/usr/X11R6/lib -lGL -lXt -lX11
# Directories

View File

@@ -47,7 +47,8 @@ LIBDRM_CFLAGS = `pkg-config --cflags libdrm`
LIBDRM_LIB = `pkg-config --libs libdrm`
DRI_LIB_DEPS = $(EXTRA_LIB_PATH) -lm -lpthread -lexpat -ldl $(LIBDRM_LIB)
GL_LIB_DEPS = $(EXTRA_LIB_PATH) -lX11 -lXext -lXxf86vm -lXdamage -lXfixes \
-lm -lpthread -ldl $(LIBDRM_LIB)
-lm -lpthread -ldl \
$(LIBDRM_LIB)
# This is now 0 by default since it seems to confuse the hell out of people
@@ -70,5 +71,5 @@ WINDOW_SYSTEM=dri
# gamma are missing because they have not been converted to use the new
# interface.
DRI_DIRS = i810 i915 i965 mach64 mga r128 r200 r300 radeon s3v \
DRI_DIRS = i810 i915tex i915 i965 mach64 mga r128 r200 r300 radeon s3v \
savage sis tdfx trident unichrome ffb

View File

@@ -20,5 +20,5 @@ EXTRA_LIB_PATH=-L/usr/X11R6/lib64
# the new interface. i810 are missing because there is no x86-64
# system where they could *ever* be used.
#
DRI_DIRS = i915 i965 mach64 mga r128 r200 r300 radeon savage tdfx unichrome
DRI_DIRS = i915tex i915 i965 mach64 mga r128 r200 radeon tdfx unichrome savage r300

View File

@@ -25,4 +25,4 @@ PROGRAM_DIRS = osdemos
# Dependencies
OSMESA_LIB_DEPS = -lm -lpthread
GLU_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(OSMESA_LIB)
APP_LIB_DEPS = -lm -lpthread
APP_LIB_DEPS = -lOSMesa -lGLU

View File

@@ -28,4 +28,4 @@ PROGRAM_DIRS =
# Dependencies
OSMESA_LIB_DEPS = -lm -lpthread
GLU_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(OSMESA_LIB)
APP_LIB_DEPS = -lm -lpthread
APP_LIB_DEPS = -lOSMesa16

View File

@@ -29,4 +29,4 @@ PROGRAM_DIRS =
# Dependencies
OSMESA_LIB_DEPS = -lm -lpthread
APP_LIB_DEPS = -lm -lpthread
APP_LIB_DEPS = -lOSMesa16

View File

@@ -28,4 +28,4 @@ PROGRAM_DIRS =
# Dependencies
OSMESA_LIB_DEPS = -lm -lpthread
GLU_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(OSMESA_LIB)
APP_LIB_DEPS = -lm -lpthread
APP_LIB_DEPS = -lOSMesa32

View File

@@ -24,8 +24,7 @@ PCIACCESS_LIB = `pkg-config --libs pciaccess`
DEFINES = -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE \
-D_BSD_SOURCE -D_GNU_SOURCE -DHAVE_POSIX_MEMALIGN \
-DPTHREADS -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER \
-DHAVE_ALIAS
-DPTHREADS -DUSE_EXTERNAL_DXTN_LIB=1 -DDRM_USE_MALLOC -DIN_DRI_DRIVER
CFLAGS = $(WARN_FLAGS) $(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) $(DEFINES) \
$(ASM_FLAGS) -std=c99 -ffast-math

File diff suppressed because it is too large Load Diff

View File

@@ -1,805 +0,0 @@
Name
MESA_texture_array
Name Strings
GL_MESA_texture_array
Contact
Ian Romanick, IBM (idr 'at' us.ibm.com)
IP Status
No known IP issues.
Status
Shipping in Mesa 7.1
Version
$Date: 2007/05/16$ $Revision: 0.4$
Number
TBD
Dependencies
OpenGL 1.2 or GL_EXT_texture3D is required.
Support for ARB_fragment_program is assumed, but not required.
Support for ARB_fragment_program_shadow is assumed, but not required.
Support for EXT_framebuffer_object is assumed, but not required.
Written based on the wording of the OpenGL 2.0 specification and
ARB_fragment_program_shadow but not dependent on them.
Overview
There are a number of circumstances where an application may wish to
blend two textures out of a larger set of textures. Moreover, in some
cases the selected textures may vary on a per-fragment basis within
a polygon. Several examples include:
1. High dynamic range textures. The application stores several
different "exposures" of an image as different textures. On a
per-fragment basis, the application selects which exposures are
used.
2. A terrain engine where the altitude of a point determines the
texture applied to it. If the transition is from beach sand to
grass to rocks to snow, the application will store each texture
in a different texture map, and dynamically select which two
textures to blend at run-time.
3. Storing short video clips in textures. Each depth slice is a
single frame of video.
Several solutions to this problem have been proposed, but they either
involve using a separate texture unit for each texture map or using 3D
textures without mipmaps. Both of these options have major drawbacks.
This extension provides a third alternative that eliminates the major
drawbacks of both previous methods. A new texture target,
TEXTURE_2D_ARRAY, is added that functions identically to TEXTURE_3D in
all aspects except the sizes of the non-base level images. In
traditional 3D texturing, the size of the N+1 LOD is half the size
of the N LOD in all three dimensions. For the TEXTURE_2D_ARRAY target,
the height and width of the N+1 LOD is halved, but the depth is the
same for all levels of detail. The texture then becomes an array of
2D textures. The per-fragment texel is selected by the R texture
coordinate.
References:
http://www.opengl.org/discussion_boards/cgi_directory/ultimatebb.cgi?ubb=get_topic;f=3;t=011557
http://www.opengl.org/discussion_boards/cgi_directory/ultimatebb.cgi?ubb=get_topic;f=3;t=000516
http://www.opengl.org/discussion_boards/cgi_directory/ultimatebb.cgi?ubb=get_topic;f=3;t=011903
http://www.delphi3d.net/articles/viewarticle.php?article=terraintex.htm
New Procedures and Functions
All functions come directly from EXT_texture_array.
void FramebufferTextureLayerEXT(enum target, enum attachment,
uint texture, int level, int layer);
New Tokens
All token names and values come directly from EXT_texture_array.
Accepted by the <cap> parameter of Enable, Disable, and IsEnabled, by
the <pname> parameter of GetBooleanv, GetIntegerv, GetFloatv, and
GetDoublev, and by the <target> parameter of TexImage3D, GetTexImage,
GetTexLevelParameteriv, GetTexLevelParameterfv, GetTexParameteriv, and
GetTexParameterfv:
TEXTURE_1D_ARRAY_EXT 0x8C18
TEXTURE_2D_ARRAY_EXT 0x8C1A
Accepted by the <target> parameter of TexImage2D, TexSubImage2D,
CopyTexImage2D, CopyTexSubImage2D, CompressedTexImage2D,
CompressedTexSubImage2D, GetTexLevelParameteriv, and
GetTexLevelParameterfv:
TEXTURE_1D_ARRAY_EXT
PROXY_TEXTURE_1D_ARRAY_EXT 0x8C19
Accepted by the <target> parameter of TexImage3D, TexSubImage3D,
CopyTexSubImage3D, CompressedTexImage3D, CompressedTexSubImage3D,
GetTexLevelParameteriv, and GetTexLevelParameterfv:
TEXTURE_2D_ARRAY_EXT
PROXY_TEXTURE_2D_ARRAY_EXT 0x8C1B
Accepted by the <pname> parameter of GetBooleanv, GetIntegerv,
GetFloatv, and GetDoublev
TEXTURE_BINDING_1D_ARRAY_EXT 0x8C1C
TEXTURE_BINDING_2D_ARRAY_EXT 0x8C1D
MAX_ARRAY_TEXTURE_LAYERS_EXT 0x88FF
Accepted by the <param> parameter of TexParameterf, TexParameteri,
TexParameterfv, and TexParameteriv when the <pname> parameter is
TEXTURE_COMPARE_MODE_ARB:
COMPARE_REF_DEPTH_TO_TEXTURE_EXT 0x884E
(Note: COMPARE_REF_DEPTH_TO_TEXTURE_EXT is simply an alias for the
existing COMPARE_R_TO_TEXTURE token in OpenGL 2.0; the alternate name
reflects the fact that the R coordinate is not always used.)
Accepted by the <internalformat> parameter of TexImage3D and
CompressedTexImage3D, and by the <format> parameter of
CompressedTexSubImage3D:
COMPRESSED_RGB_S3TC_DXT1_EXT
COMPRESSED_RGBA_S3TC_DXT1_EXT
COMPRESSED_RGBA_S3TC_DXT3_EXT
COMPRESSED_RGBA_S3TC_DXT5_EXT
Accepted by the <pname> parameter of
GetFramebufferAttachmentParameterivEXT:
FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER_EXT 0x8CD4
(Note: FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER is simply an alias for the
FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_EXT token provided in
EXT_framebuffer_object. This extension generalizes the notion of
"<zoffset>" to include layers of an array texture.)
Additions to Chapter 2 of the OpenGL 2.0 Specification (OpenGL Operation)
None
Additions to Chapter 3 of the OpenGL 2.0 Specification (Rasterization)
-- Section 3.8.1 "Texture Image Specification"
Change the first paragraph (page 150) to say (spec changes identical to
EXT_texture_array):
"The command
void TexImage3D(enum target, int level, int internalformat,
sizei width, sizei height, sizei depth, int border,
enum format, enum type, void *data);
is used to specify a three-dimensional texture image. target must be one
one of TEXTURE_3D for a three-dimensional texture or
TEXTURE_2D_ARRAY_EXT for an two-dimensional array texture.
Additionally, target may be either PROXY_TEXTURE_3D for a
three-dimensional proxy texture, or PROXY_TEXTURE_2D_ARRAY_EXT for a
two-dimensional proxy array texture."
Change the fourth paragraph on page 151 to say (spec changes identical
to EXT_texture_array):
"Textures with a base internal format of DEPTH_COMPONENT are supported
by texture image specification commands only if target is TEXTURE_1D,
TEXTURE_2D, TEXTURE_1D_ARRAY_EXT, TEXTURE_2D_ARRAY_EXT,
PROXY_TEXTURE_1D, PROXY_TEXTURE_2D, PROXY_TEXTURE_1D_ARRAY_EXT, or
PROXY_TEXTURE_2D_ARRAY_EXT. Using this format in conjunction with any
other target will result in an INVALID_OPERATION error."
Change the fourth paragraph on page 156 to say (spec changes identical
to EXT_texture_array):
"The command
void TexImage2D(enum target, int level,
int internalformat, sizei width, sizei height,
int border, enum format, enum type, void *data);
is used to specify a two-dimensional texture image. target must be one
of TEXTURE_2D for a two-dimensional texture, TEXTURE_1D_ARRAY_EXT for a
one-dimensional array texture, or one of TEXTURE_CUBE_MAP_POSITIVE_X,
TEXTURE_CUBE_MAP_NEGATIVE_X, TEXTURE_CUBE_MAP_POSITIVE_Y,
TEXTURE_CUBE_MAP_NEGATIVE_Y, TEXTURE_CUBE_MAP_POSITIVE_Z, or
TEXTURE_CUBE_MAP_NEGATIVE_Z for a cube map texture. Additionally,
target may be either PROXY_TEXTURE_2D for a two-dimensional proxy
texture, PROXY_TEXTURE_1D_ARRAY_EXT for a one-dimensional proxy array
texture, or PROXY TEXTURE_CUBE_MAP for a cube map proxy texture in the
special case discussed in section 3.8.11. The other parameters match
the corresponding parameters of TexImage3D.
For the purposes of decoding the texture image, TexImage2D is
equivalent to calling TexImage3D with corresponding arguments and depth
of 1, except that
* The border depth, d_b, is zero, and the depth of the image is
always 1 regardless of the value of border.
* The border height, h_b, is zero if <target> is
TEXTURE_1D_ARRAY_EXT, and <border> otherwise.
* Convolution will be performed on the image (possibly changing its
width and height) if SEPARABLE 2D or CONVOLUTION 2D is enabled.
* UNPACK SKIP IMAGES is ignored."
-- Section 3.8.2 "Alternate Texture Image Specification Commands"
Change the second paragraph (page 159) (spec changes identical
to EXT_texture_array):
"The command
void CopyTexImage2D(enum target, int level,
enum internalformat, int x, int y, sizei width,
sizei height, int border);
defines a two-dimensional texture image in exactly the manner of
TexImage2D, except that the image data are taken from the framebuffer
rather than from client memory. Currently, target must be one of
TEXTURE_2D, TEXTURE_1D_ARRAY_EXT, TEXTURE_CUBE_MAP_POSITIVE_X,
TEXTURE_CUBE_MAP_NEGATIVE_X, TEXTURE_CUBE MAP_POSITIVE_Y,
TEXTURE_CUBE_MAP_NEGATIVE_Y, TEXTURE_CUBE_MAP_POSITIVE_Z, or
TEXTURE_CUBE_MAP_NEGATIVE_Z.
Change the last paragraph on page 160 to say (spec changes identical
to EXT_texture_array):
"Currently the target arguments of TexSubImage1D and CopyTexSubImage1D
must be TEXTURE_1D, the target arguments of TexSubImage2D and
CopyTexSubImage2D must be one of TEXTURE_2D, TEXTURE_1D_ARRAY_EXT,
TEXTURE_CUBE_MAP_POSITIVE_X, TEXTURE_CUBE_MAP_NEGATIVE_X,
TEXTURE_CUBE_MAP_POSITIVE_Y, TEXTURE_CUBE_MAP_NEGATIVE_Y,
TEXTURE_CUBE_MAP_POSITIVE_Z, or TEXTURE_CUBE_MAP_NEGATIVE_Z, and the
target arguments of TexSubImage3D and CopyTexSubImage3D must be
TEXTURE_3D or TEXTURE_2D_ARRAY_EXT. ..."
-- Section 3.8.4 "Texture Parameters"
Change the first paragraph (page 166) to say:
"Various parameters control how the texel array is treated when
specified or changed, and when applied to a fragment. Each parameter is
set by calling
void TexParameter{if}(enum target, enum pname, T param);
void TexParameter{if}v(enum target, enum pname, T params);
target is the target, either TEXTURE_1D, TEXTURE_2D, TEXTURE_3D,
TEXTURE_CUBE_MAP, TEXTURE_1D_ARRAY_EXT, or TEXTURE_2D_ARRAY_EXT."
-- Section 3.8.8 "Texture Minification" in the section "Scale Factor and Level of Detail"
Change the first paragraph (page 172) to say:
"Let s(x,y) be the function that associates an s texture coordinate
with each set of window coordinates (x,y) that lie within a primitive;
define t(x,y) and r(x,y) analogously. Let u(x,y) = w_t * s(x,y),
v(x,y) = h_t * t(x,y), and w(x,y) = d_t * r(x,y), where w_t, h_t,
and d_t are as defined by equations 3.15, 3.16, and 3.17 with
w_s, h_s, and d_s equal to the width, height, and depth of the
image array whose level is level_base. For a one-dimensional
texture or a one-dimensional array texture, define v(x,y) = 0 and
w(x,y) = 0; for a two-dimensional texture or a two-dimensional array
texture, define w(x,y) = 0..."
-- Section 3.8.8 "Texture Minification" in the section "Mipmapping"
Change the third paragraph (page 174) to say:
"For a two-dimensional texture, two-dimensional array texture, or
cube map texture,"
Change the fourth paragraph (page 174) to say:
"And for a one-dimensional texture or a one-dimensional array texture,"
After the first paragraph (page 175) add:
"For one-dimensional array textures, h_b and d_b are treated as 1,
regardless of the actual values, when performing mipmap calculations.
For two-dimensional array textures, d_b is always treated as one,
regardless of the actual value, when performing mipmap calculations."
-- Section 3.8.8 "Automatic Mipmap Generation" in the section "Mipmapping"
Change the third paragraph (page 176) to say (spec changes identical
to EXT_texture_array):
"The contents of the derived arrays are computed by repeated, filtered
reduction of the level_base array. For one- and two-dimensional array
textures, each layer is filtered independently. ..."
-- Section 3.8.8 "Manual Mipmap Generation" in the section "Mipmapping"
Change first paragraph to say (spec changes identical to
EXT_texture_array):
"Mipmaps can be generated manually with the command
void GenerateMipmapEXT(enum target);
where <target> is one of TEXTURE_1D, TEXTURE_2D, TEXTURE_CUBE_MAP,
TEXTURE_3D, TEXTURE_1D_ARRAY, or TEXTURE_2D_ARRAY. Mipmap generation
affects the texture image attached to <target>. ..."
-- Section 3.8.10 "Texture Completeness"
Change the second paragaph (page 177) to say (spec changes identical
to EXT_texture_array):
"For one-, two-, or three-dimensional textures and one- or
two-dimensional array textures, a texture is complete if the following
conditions all hold true:"
-- Section 3.8.11 "Texture State and Proxy State"
Change the second and third paragraphs (page 179) to say (spec changes
identical to EXT_texture_array):
"In addition to image arrays for one-, two-, and three-dimensional
textures, one- and two-dimensional array textures, and the six image
arrays for the cube map texture, partially instantiated image arrays
are maintained for one-, two-, and three-dimensional textures and one-
and two-dimensional array textures. Additionally, a single proxy image
array is maintained for the cube map texture. Each proxy image array
includes width, height, depth, border width, and internal format state
values, as well as state for the red, green, blue, alpha, luminance,
and intensity component resolutions. Proxy image arrays do not include
image data, nor do they include texture properties. When TexImage3D is
executed with target specified as PROXY_TEXTURE_3D, the
three-dimensional proxy state values of the specified level-of-detail
are recomputed and updated. If the image array would not be supported
by TexImage3D called with target set to TEXTURE 3D, no error is
generated, but the proxy width, height, depth, border width, and
component resolutions are set to zero. If the image array would be
supported by such a call to TexImage3D, the proxy state values are set
exactly as though the actual image array were being specified. No pixel
data are transferred or processed in either case.
Proxy arrays for one- and two-dimensional textures and one- and
two-dimensional array textures are operated on in the same way when
TexImage1D is executed with target specified as PROXY_TEXTURE_1D,
TexImage2D is executed with target specified as PROXY_TEXTURE_2D or
PROXY_TEXTURE_1D_ARRAY_EXT, or TexImage3D is executed with target
specified as PROXY_TETXURE_2D_ARRAY_EXT."
-- Section 3.8.12 "Texture Objects"
Change section (page 180) to say (spec changes identical to
EXT_texture_array):
"In addition to the default textures TEXTURE_1D, TEXTURE_2D,
TEXTURE_3D, TEXTURE_CUBE_MAP, TEXTURE_1D_ARRAY_EXT, and TEXTURE_2D_EXT,
named one-, two-, and three-dimensional, cube map, and one- and
two-dimensional array texture objects can be created and operated upon.
The name space for texture objects is the unsigned integers, with zero
reserved by the GL.
A texture object is created by binding an unused name to TEXTURE_1D,
TEXTURE_2D, TEXTURE_3D, TEXTURE_CUBE_MAP, TEXTURE_1D_ARRAY_EXT, or
TEXTURE_2D_ARRAY_EXT. The binding is effected by calling
void BindTexture(enum target, uint texture);
with <target> set to the desired texture target and <texture> set to
the unused name. The resulting texture object is a new state vector,
comprising all the state values listed in section 3.8.11, set to the
same initial values. If the new texture object is bound to TEXTURE_1D,
TEXTURE_2D, TEXTURE_3D, TEXTURE_CUBE_MAP, TEXTURE_1D_ARRAY_EXT, or
TEXTURE_2D_ARRAY_EXT, it is and remains a one-, two-,
three-dimensional, cube map, one- or two-dimensional array texture
respectively until it is deleted.
BindTexture may also be used to bind an existing texture object to
either TEXTURE_1D, TEXTURE_2D, TEXTURE_3D, TEXTURE_CUBE_MAP,
TEXTURE_1D_ARRAY_EXT, or TEXTURE_2D_ARRAY_EXT. The error
INVALID_OPERATION is generated if an attempt is made to bind a texture
object of different dimensionality than the specified target. If the
bind is successful no change is made to the state of the bound texture
object, and any previous binding to target is broken.
While a texture object is bound, GL operations on the target to which
it is bound affect the bound object, and queries of the target to which
it is bound return state from the bound object. If texture mapping of
the dimensionality of the target to which a texture object is bound is
enabled, the state of the bound texture object directs the texturing
operation.
In the initial state, TEXTURE_1D, TEXTURE_2D, TEXTURE_3D,
TEXTURE_CUBE_MAP, TEXTURE_1D_ARRAY_EXT, and TEXTURE_2D_ARRAY_EXT have
one-, two-, three-dimensional, cube map, and one- and two-dimensional
array texture state vectors respectively associated with them. In order
that access to these initial textures not be lost, they are treated as
texture objects all of whose names are 0. The initial one-, two-,
three-dimensional, cube map, one- and two-dimensional array textures
are therefore operated upon, queried, and applied as TEXTURE_1D,
TEXTURE_2D, TEXTURE_3D, TEXTURE_CUBE_MAP, TEXTURE_1D_ARRAY_EXT, and
TEXTURE_2D_ARRAY_EXT respectively while 0 is bound to the corresponding
targets.
Change second paragraph on page 181 to say (spec changes identical to
EXT_texture_array):
"... If a texture that is currently bound to one of the targets
TEXTURE_1D, TEXTURE_2D, TEXTURE_3D, TEXTURE_CUBE_MAP,
TEXTURE_1D_ARRAY_EXT, or TEXTURE_2D_ARRAY_EXT is deleted, it is as
though BindTexture had been executed with the same target and texture
zero. ..."
Change second paragraph on page 182 to say (spec changes identical to
EXT_texture_array):
"The texture object name space, including the initial one-, two-, and
three dimensional, cube map, and one- and two-dimensional array texture
objects, is shared among all texture units. ..."
-- Section 3.8.14 "Depth Texture Comparison Modes" in "Texture Comparison Modes"
Change second through fourth paragraphs (page 188) to say:
"Let D_t be the depth texture value, in the range [0, 1]. For
texture lookups from one- and two-dimesional, rectangle, and
one-dimensional array targets, let R be the interpolated <r>
texture coordinate, clamped to the range [0, 1]. For texture lookups
from two-dimesional array texture targets, let R be the interpolated
<q> texture coordinate, clamped to the range [0, 1]. Then the
effective texture value L_t, I_t, or A_t is computed as follows:
If the value of TEXTURE_COMPARE_MODE is NONE, then
r = Dt
If the value of TEXTURE_COMPARE_MODE is
COMPARE_REF_DEPTH_TO_TEXTURE_EXT), then r depends on the texture
comparison function as shown in table 3.27."
-- Section 3.8.15 "Texture Application"
Change the first paragraph (page 189) to say:
"Texturing is enabled or disabled using the generic Enable and Disable
commands, respectively, with the symbolic constants TEXTURE_1D,
TEXTURE_2D, TEXTURE_3D, TEXTURE_CUBE_MAP, TEXTURE_1D_ARRAY_EXT, or
TEXTURE_2D_ARRAY_EXT to enable one-, two-, three-dimensional, cube
map, one-dimensional array, or two-dimensional array texture,
respectively. If both two- and one-dimensional textures are enabled,
the two-dimensional texture is used. If the three-dimensional and
either of the two- or one-dimensional textures is enabled, the
three-dimensional texture is used. If the cube map texture and any of
the three-, two-, or one-dimensional textures is enabled, then cube map
texturing is used. If one-dimensional array texture is enabled and any
of cube map, three-, two-, or one-dimensional textures is enabled,
one-dimensional array texturing is used. If two-dimensional array
texture is enabled and any of cube map, three-, two-, one-dimensional
textures or one-dimensional array texture is enabled, two-dimensional
array texturing is used..."
-- Section 3.11.2 of ARB_fragment_program (Fragment Program Grammar and Restrictions):
(mostly add to existing grammar rules)
<optionName> ::= "MESA_texture_array"
<texTarget> ::= "1D"
| "2D"
| "3D"
| "CUBE"
| "RECT"
| <arrayTarget> (if program option is present)
| <shadowTarget> (if program option is present)
<arrayTarget> ::= "ARRAY1D"
| "ARRAY2D"
<shadowTarget> ::= "SHADOW1D"
| "SHADOW2D"
| "SHADOWRECT"
| <shadowArrayTarget> (if program option is present)
<shadowArrayTarget> ::= "SHADOWARRAY1D"
| "SHADOWARRAY2D"
-- Add Section 3.11.4.5.4 "Texture Stack Option"
"If a fragment program specifies the "MESA_texture_array" program
option, the <texTarget> rule is modified to add the texture targets
ARRAY1D and ARRAY2D (See Section 3.11.2)."
-- Section 3.11.6 "Fragment Program Texture Instruction Set"
(replace 1st and 2nd paragraphs with the following paragraphs)
"The first three texture instructions described below specify the
mapping of 4-tuple input vectors to 4-tuple output vectors.
The sampling of the texture works as described in section 3.8,
except that texture environments and texture functions are not
applicable, and the texture enables hierarchy is replaced by explicit
references to the desired texture target (i.e., 1D, 2D, 3D, cube map,
rectangle, ARRAY1D, ARRAY2D). These texture instructions specify
how the 4-tuple is mapped into the coordinates used for sampling. The
following function is used to describe the texture sampling in the
descriptions below:
vec4 TextureSample(vec4 coord, float lodBias, int texImageUnit,
enum texTarget);
Note that not all four components of the texture coordinates <coord>
are used by all texture targets. Component usage for each <texTarget>
is defined in table X.
coordinates used
texTarget Texture Type s t r layer shadow
---------------- --------------------- ----- ----- ------
1D TEXTURE_1D x - - - -
2D TEXTURE_2D x y - - -
3D TEXTURE_3D x y z - -
CUBE TEXTURE_CUBE_MAP x y z - -
RECT TEXTURE_RECTANGLE_ARB x y - - -
ARRAY1D TEXTURE_1D_ARRAY_EXT x - - y -
ARRAY2D TEXTURE_2D_ARRAY_EXT x y - z -
SHADOW1D TEXTURE_1D x - - - z
SHADOW2D TEXTURE_2D x y - - z
SHADOWRECT TEXTURE_RECTANGLE_ARB x y - - z
SHADOWARRAY1D TEXTURE_1D_ARRAY_EXT x - - y z
SHADOWARRAY2D TEXTURE_2D_ARRAY_EXT x y - z w
Table X: Texture types accessed for each of the <texTarget>, and
coordinate mappings. The "coordinates used" column indicate the
input values used for each coordinate of the texture lookup, the
layer selector for array textures, and the reference value for
texture comparisons."
-- Section 3.11.6.2 "TXP: Project coordinate and map to color"
Add to the end of the section:
"A program will fail to load if the TXP instruction is used in
conjunction with the SHADOWARRAY2D target."
Additions to Chapter 4 of the OpenGL 2.0 Specification (Per-Fragment Operations)
-- Section 4.4.2.3 "Attaching Texture Images to a Framebuffer"
Add to the end of the section (spec changes identical to
EXT_texture_array):
"The command
void FramebufferTextureLayerEXT(enum target, enum attachment,
uint texture, int level, int layer);
operates identically to FramebufferTexture3DEXT, except that it
attaches a single layer of a three-dimensional texture or a one- or
two-dimensional array texture. <layer> is an integer indicating the
layer number, and is treated identically to the <zoffset> parameter in
FramebufferTexture3DEXT. The error INVALID_VALUE is generated if
<layer> is negative. The error INVALID_OPERATION is generated if
<texture> is non-zero and is not the name of a three dimensional
texture or one- or two-dimensional array texture. Unlike
FramebufferTexture3D, no <textarget> parameter is accepted.
If <texture> is non-zero and the command does not result in an error,
the framebuffer attachment state corresponding to <attachment> is
updated as in the other FramebufferTexture commands, except that
FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER_EXT is set to <layer>."
-- Section 4.4.4.1 "Framebuffer Attachment Completeness"
Add to the end of the list of completeness rules (spec changes
identical to EXT_texture_array):
"* If FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT is TEXTURE and
FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT names a one- or
two-dimensional array texture, then
FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER_EXT must be smaller than the
number of layers in the texture."
Additions to Chapter 5 of the OpenGL 2.0 Specification (Special Functions)
-- Section 5.4 "Display Lists"
Change the first paragraphi on page 242 to say (spec changes
identical to EXT_texture_array):
"TexImage3D, TexImage2D, TexImage1D, Histogram, and ColorTable are
executed immediately when called with the corresponding proxy arguments
PROXY_TEXTURE_3D or PROXY_TEXTURE_2D_ARRAY_EXT; PROXY_TEXTURE_2D,
PROXY_TEXTURE_CUBE_MAP, or PROXY_TEXTURE_1D_ARRAY_EXT;
PROXY_TEXTURE_1D; PROXY_HISTOGRAM; and PROXY_COLOR_TABLE,
PROXY_POST_CONVOLUTION_COLOR_TABLE, or
PROXY_POST_COLOR_MATRIX_COLOR_TABLE."
Additions to Chapter 6 of the OpenGL 2.0 Specification (State and State Requests)
-- Section 6.1.3 "Enumerated Queries"
Add after the line beginning "If the value of
FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT is TEXTURE" (spec changes
identical to EXT_texture_array):
"If <pname> is FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER_EXT and the
texture object named FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT is a
three-dimensional texture or a one- or two-dimensional array texture,
then <params> will contain the number of texture layer attached to the
attachment point. Otherwise, <params> will contain the value zero."
-- Section 6.1.4 "Texture Queries"
Change the first three paragraphs (page 248) to say (spec changes
identical to EXT_texture_array):
"The command
void GetTexImage(enum tex, int lod, enum format,
enum type, void *img);
is used to obtain texture images. It is somewhat different from the
other get commands; tex is a symbolic value indicating which texture
(or texture face in the case of a cube map texture target name) is to
be obtained. TEXTURE_1D, TEXTURE_2D, TEXTURE_3D, TEXTURE_1D_ARRAY_EXT,
and TEXTURE_2D_ARRAY_EXT indicate a one-, two-, or three-dimensional
texture, or one- or two-dimensional array texture, respectively.
TEXTURE_CUBE_MAP_POSITIVE_X, ...
GetTexImage obtains... from the first image to the last for
three-dimensional textures. One- and two-dimensional array textures
are treated as two- and three-dimensional images, respectively, where
the layers are treated as rows or images. These groups are then...
For three-dimensional and two-dimensional array textures, pixel storage
operations are applied as if the image were two-dimensional, except
that the additional pixel storage state values PACK_IMAGE_HEIGHT and
PACK_SKIP_IMAGES are applied. ..."
Additions to Appendix A of the OpenGL 2.0 Specification (Invariance)
None
Additions to the AGL/GLX/WGL Specifications
None
GLX Protocol
None
Dependencies on ARB_fragment_program
If ARB_fragment_program is not supported, the changes to section 3.11
should be ignored.
Dependencies on EXT_framebuffer_object
If EXT_framebuffer_object is not supported, the changes to section
3.8.8 ("Manual Mipmap Generation"), 4.4.2.3, and 6.1.3 should be ignored.
Dependencies on EXT_texture_compression_s3tc and NV_texture_compression_vtc
(Identical dependency as EXT_texture_array.)
S3TC texture compression is supported for two-dimensional array textures.
When <target> is TEXTURE_2D_ARRAY_EXT, each layer is stored independently
as a compressed two-dimensional textures. When specifying or querying
compressed images using one of the S3TC formats, the images are provided
and/or returned as a series of two-dimensional textures stored
consecutively in memory, with the layer closest to zero specified first.
For array textures, images are not arranged in 4x4x4 or 4x4x2 blocks as in
the three-dimensional compression format provided in the
EXT_texture_compression_vtc extension. Pixel store parameters, including
those specific to three-dimensional images, are ignored when compressed
image data are provided or returned, as in the
EXT_texture_compression_s3tc extension.
S3TC compression is not supported for one-dimensional texture targets in
EXT_texture_compression_s3tc, and is not supported for one-dimensional
array textures in this extension. If compressed one-dimensional arrays
are needed, use a two-dimensional texture with a height of one.
This extension allows the use of the four S3TC internal format types in
TexImage3D, CompressedTexImage3D, and CompressedTexSubImage3D calls.
Errors
None
New State
(add to table 6.15, p. 276)
Initial
Get Value Type Get Command Value Description Sec. Attribute
---------------------------- ----- ----------- ----- -------------------- ------ ---------
TEXTURE_BINDING_1D_ARRAY_EXT 2*xZ+ GetIntegerv 0 texture object bound 3.8.12 texture
to TEXTURE_1D_ARRAY
TEXTURE_BINDING_2D_ARRAY_EXT 2*xZ+ GetIntegerv 0 texture object bound 3.8.12 texture
to TEXTURE_2D_ARRAY
New Implementation Dependent State
(add to Table 6.32, p. 293)
Minimum
Get Value Type Get Command Value Description Sec. Attribute
---------------------------- ---- ----------- ------- ------------------ ----- ---------
MAX_TEXTURE_ARRAY_LAYERS_EXT Z+ GetIntegerv 64 maximum number of 3.8.1 -
layers for texture
arrays
Issues
(1) Is "texture stack" a good name for this functionality?
NO. The name is changed to "array texture" to match the
nomenclature used by GL_EXT_texture_array.
(2) Should the R texture coordinate be treated as normalized or
un-normalized? If it were un-normalized, floor(R) could be thought
of as a direct index into the array texture. This may be more
convenient for applications.
RESOLVED. All texture coordinates are normalized. The issue of
un-normalized texture coordinates has been discussed in the ARB
before and should be left for a layered extension.
RE-RESOLVED. The R coordinate is un-normalized. Accessing an array
using [0, layers-1] coordinates is much more natural.
(3) How does LOD selection work for stacked textures?
RESOLVED. For 2D array textures the R coordinate is ignored, and
the LOD selection equations for 2D textures are used. For 1D
array textures the T coordinate is ignored, and the LOD selection
equations for 1D textures are used. The expected usage is in a
fragment program with an explicit LOD selection.
(4) What is the maximum size of a 2D array texture? Is it the same
as for a 3D texture, or should a new query be added? How about for 1D
array textures?
RESOLVED. A new query is added.
(5) How are array textures exposed in GLSL?
RESOLVED. Use GL_EXT_texture_array.
(6) Should a 1D array texture also be exposed?
RESOLVED. For orthogonality, yes.
(7) How are stacked textures attached to framebuffer objects?
RESOLVED. Layers of both one- and two-dimensional array textures
are attached using FreambufferTextureLayerEXT. Once attached, the
array texture layer behaves exactly as either a one- or
two-dimensional texture.
(8) How is this extension related to GL_EXT_texture_array?
This extension adapats GL_MESAX_texture_stack to the notation,
indexing, and FBO access of GL_EXT_texture_array. This extension
replaces the GLSL support of GL_EXT_texture_array with
GL_ARB_fragment_program support.
Assembly program support is also provided by GL_NV_gpu_program4.
GL_NV_gpu_program4 also adds support for other features that are
specific to Nvidia hardware, while this extension adds only support
for array textures.
Much of text of this extension that has changed since
GL_MESAX_texture_stack comes directly from either
GL_EXT_texture_array or GL_NV_gpu_program4.
Revision History
||2005/11/15||0.1||idr||Initial draft MESAX version.||
||2005/12/07||0.2||idr||Added framebuffer object interactions.||
||2005/12/12||0.3||idr||Updated fragment program interactions.||
||2007/05/16||0.4||idr||Converted to MESA_texture_array. Brought in line with EXT_texture_array and NV_gpu_program4.||

View File

@@ -1,163 +1,163 @@
File: docs/README.WIN32
Last updated: Apr 25, 2007 - Karl Schultz - kschultz@users.sourceforge.net
Quick Start
----- -----
Unzip the MesaLib, MesaGLUT, and MesaDemos ZIP files into the same
directory. The libs and demos build separately, so if you do not care
about the demos or GLUT, you only need to unzip MesaLib. If you unzip
more than one ZIP file, they all need to be unzipped into the same
directory. Don't worry, you will not overwrite anything.
The Windows build system uses Microsoft Visual Studio. Project files
for a specific version of Visual Studio are in their own directory in
the top-level "windows" directory. For example, Visual Studio 8 files
are in windows/VC8.
Support has been dropped for versions of Visual Studio prior to 8. The
main reason is because Microsoft now provides a free compiler and
developer environment. Visual Studio Express can be found at
http://msdn.microsoft.com/vstudio/express/visualc/default.aspx
You'll also need the Platform SDK. Instructions for obtaining and
using the SDK with Visual Studio Express can be found at
http://msdn.microsoft.com/vstudio/express/visualc/usingpsdk/
If you are stuck using VC6 or VC7, you may start with these project
files, but you may need to modify them to reflect changes in the
Mesa source code tree. If you sucessfully update the project files,
please submit them to the author of this document so that they may
be included in the next distribution.
The project files to build the core Mesa library, Windows Mesa
drivers, OSMesa, and GLU are in the mesa directory. The project files
to build GLUT and some demo programs are in the progs directory.
Makefiles are no longer shipped or supported, but can be generated
from the projects using Visual Studio.
Windows Drivers
------- -------
At this time, only the GDI driver is known to work. Most of the demos
in progs/demos should work with this driver.
Source code also exists in the tree for other drivers in
src/mesa/drivers/windows, but the status of this code is unknown.
The GDI driver operates basically by writing pixel spans into a DIB
section and then blitting the DIB to the window. The driver was
recently cleaned up and rewitten and so may have bugs or may be
missing some functionality. The older versions of the CVS source may
be useful in figuring out any problems, or report them to me.
To build Mesa with the GDI driver, build the mesa, gdi, and glu
projects in the Visual Studio workspace found at
windows/VC8/mesa/mesa.sln
The osmesa DLL can also be built with the osmesa project.
The build system creates a lib top-level directory and copies
resulting LIB and DLL files to this lib directory. The files are:
OPENGL32.LIB, GLU32.LIB, OSMESA32.LIB
OPENGL32.DLL, GLU32.DLL, OSMESA32.DLL
If the MesaDemos ZIP file was extracted, the DLL files are also copied
to the demos directory. This facilitates running the demos as described
below.
GLUT and Demos
---- --- -----
A Visual Studio workspace can be found at
windows/VC8/progs/progs.sln
It can be used to build GLUT and a few demos. The GLUT lib and DLL
are copied to the top-level lib directory, along with the Mesa libs.
The demo build system expects to find the LIB files in the top level
lib directory, so you must build the Mesa libs first. The demo
executables are placed in the demos directory, because some of them
rely on data files found there. Also, the Mesa lib DLL's were copied
there by the Mesa lib build process. Therefore, you should be able to
simply run the demo executables from the demo directory.
If you want to run the demos from the Visual Studio, you may have to
change the startup directory and explicitly state where the executables are.
You may also build all the demo programs by using a makefile. Go to
the progs/demos directory and make sure you have executed VCVARS32.BAT
or whatever setup script is appropriate for your compiler. Then,
nmake -f Makefile.win
should build all the demos.
Build System Notes
----- ------ -----
VC6 (not actively supported)
---
Visual Studio 6 does not recognize files with the .cc extension as C++
language files, without a lot of unnatural tweaking. So, the VC6
build process uses custom build steps to compile these files in the
GLU library.
Two additional configurations are provided, Debug x86 and Release x86
that activate the shader code compilation by defining SLANG_86. It is
unknown if and how this works.
VC7 (not actively supported)
---
The above-mentioned .cc problem does not exist in this version.
VC8
---
No notes.
General
-------
After building, you can copy the above DLL files to a place in your
PATH such as $SystemRoot/SYSTEM32. If you don't like putting things
in a system directory, place them in the same directory as the
executable(s). Be careful about accidentially overwriting files of
the same name in the SYSTEM32 directory.
The DLL files are built so that the external entry points use the
stdcall calling convention.
Static LIB files are not built. The LIB files that are built with are
the linker import files associated with the DLL files.
The si-glu sources are used to build the GLU libs. This was done
mainly to get the better tessellator code.
To build "mangled" Mesa, add the preprocessor define USE_MGL_NAMESPACE
to the project settings. You will also need to edit src/mesa.def to
change all the gl* symbols to mgl*. Because this is easy to do with a
global replace operation in a text editor, no additional mangled
version of mesa.def is maintained or shipped.
If you have a Windows-related build problem or question, it is
probably better to direct it to me (kschultz@users.sourceforge.net),
rather than directly to the other Mesa developers. I will help you as
much as I can. I also monitor the Mesa mailing lists and will answer
questions in this area there as well.
Karl Schultz
File: docs/README.WIN32
Last updated: Apr 25, 2007 - Karl Schultz - kschultz@users.sourceforge.net
Quick Start
----- -----
Unzip the MesaLib, MesaGLUT, and MesaDemos ZIP files into the same
directory. The libs and demos build separately, so if you do not care
about the demos or GLUT, you only need to unzip MesaLib. If you unzip
more than one ZIP file, they all need to be unzipped into the same
directory. Don't worry, you will not overwrite anything.
The Windows build system uses Microsoft Visual Studio. Project files
for a specific version of Visual Studio are in their own directory in
the top-level "windows" directory. For example, Visual Studio 8 files
are in windows/VC8.
Support has been dropped for versions of Visual Studio prior to 8. The
main reason is because Microsoft now provides a free compiler and
developer environment. Visual Studio Express can be found at
http://msdn.microsoft.com/vstudio/express/visualc/default.aspx
You'll also need the Platform SDK. Instructions for obtaining and
using the SDK with Visual Studio Express can be found at
http://msdn.microsoft.com/vstudio/express/visualc/usingpsdk/
If you are stuck using VC6 or VC7, you may start with these project
files, but you may need to modify them to reflect changes in the
Mesa source code tree. If you sucessfully update the project files,
please submit them to the author of this document so that they may
be included in the next distribution.
The project files to build the core Mesa library, Windows Mesa
drivers, OSMesa, and GLU are in the mesa directory. The project files
to build GLUT and some demo programs are in the progs directory.
Makefiles are no longer shipped or supported, but can be generated
from the projects using Visual Studio.
Windows Drivers
------- -------
At this time, only the GDI driver is known to work. Most of the demos
in progs/demos should work with this driver.
Source code also exists in the tree for other drivers in
src/mesa/drivers/windows, but the status of this code is unknown.
The GDI driver operates basically by writing pixel spans into a DIB
section and then blitting the DIB to the window. The driver was
recently cleaned up and rewitten and so may have bugs or may be
missing some functionality. The older versions of the CVS source may
be useful in figuring out any problems, or report them to me.
To build Mesa with the GDI driver, build the mesa, gdi, and glu
projects in the Visual Studio workspace found at
windows/VC8/mesa/mesa.sln
The osmesa DLL can also be built with the osmesa project.
The build system creates a lib top-level directory and copies
resulting LIB and DLL files to this lib directory. The files are:
OPENGL32.LIB, GLU32.LIB, OSMESA32.LIB
OPENGL32.DLL, GLU32.DLL, OSMESA32.DLL
If the MesaDemos ZIP file was extracted, the DLL files are also copied
to the demos directory. This facilitates running the demos as described
below.
GLUT and Demos
---- --- -----
A Visual Studio workspace can be found at
windows/VC8/progs/progs.sln
It can be used to build GLUT and a few demos. The GLUT lib and DLL
are copied to the top-level lib directory, along with the Mesa libs.
The demo build system expects to find the LIB files in the top level
lib directory, so you must build the Mesa libs first. The demo
executables are placed in the demos directory, because some of them
rely on data files found there. Also, the Mesa lib DLL's were copied
there by the Mesa lib build process. Therefore, you should be able to
simply run the demo executables from the demo directory.
If you want to run the demos from the Visual Studio, you may have to
change the startup directory and explicitly state where the executables are.
You may also build all the demo programs by using a makefile. Go to
the progs/demos directory and make sure you have executed VCVARS32.BAT
or whatever setup script is appropriate for your compiler. Then,
nmake -f Makefile.win
should build all the demos.
Build System Notes
----- ------ -----
VC6 (not actively supported)
---
Visual Studio 6 does not recognize files with the .cc extension as C++
language files, without a lot of unnatural tweaking. So, the VC6
build process uses custom build steps to compile these files in the
GLU library.
Two additional configurations are provided, Debug x86 and Release x86
that activate the shader code compilation by defining SLANG_86. It is
unknown if and how this works.
VC7 (not actively supported)
---
The above-mentioned .cc problem does not exist in this version.
VC8
---
No notes.
General
-------
After building, you can copy the above DLL files to a place in your
PATH such as $SystemRoot/SYSTEM32. If you don't like putting things
in a system directory, place them in the same directory as the
executable(s). Be careful about accidentially overwriting files of
the same name in the SYSTEM32 directory.
The DLL files are built so that the external entry points use the
stdcall calling convention.
Static LIB files are not built. The LIB files that are built with are
the linker import files associated with the DLL files.
The si-glu sources are used to build the GLU libs. This was done
mainly to get the better tessellator code.
To build "mangled" Mesa, add the preprocessor define USE_MGL_NAMESPACE
to the project settings. You will also need to edit src/mesa.def to
change all the gl* symbols to mgl*. Because this is easy to do with a
global replace operation in a text editor, no additional mangled
version of mesa.def is maintained or shipped.
If you have a Windows-related build problem or question, it is
probably better to direct it to me (kschultz@users.sourceforge.net),
rather than directly to the other Mesa developers. I will help you as
much as I can. I also monitor the Mesa mailing lists and will answer
questions in this area there as well.
Karl Schultz

View File

@@ -1,289 +0,0 @@
<html>
<title>Compilation and Installation using Autoconf</title>
<link rel="stylesheet" type="text/css" href="mesa.css"></head>
<body>
<h1>Compilation and Installation using Autoconf</h1>
<ol>
<li><a href="#basic">Basic Usage</a></li>
<li><a href="#driver">Driver Options</a></li>
<ul>
<li><a href="#xlib">Xlib Driver Options</a></li>
<li><a href="#dri">DRI Driver Options</a></li>
<li><a href="#osmesa">OSMesa Driver Options</a></li>
</ul>
<li><a href="#library">Library Options</a></li>
<ul>
<li><a href="#glu">GLU</a></li>
<li><a href="#glw">GLw</a></li>
<li><a href="#glut">GLUT</a></li>
</ul>
<li><a href="#demos">Demo Program Options</a></li>
</ol>
<a name="basic">
<h2>1. Basic Usage</h2>
<p>
The autoconf generated configure script can be used to guess your
platform and change various options for building Mesa. To use the
configure script, type:
</p>
<pre>
./configure
</pre>
<p>
To see a short description of all the options, type <code>./configure
--help</code>. If you are using a development snapshot and the configure
script does not exist, type <code>./autogen.sh</code> to generate it
first. If you know the options you want to pass to
<code>configure</code>, you can pass them to <code>autogen.sh</code>. It
will run <code>configure</code> with these options after it is
generated. Once you have run <code>configure</code> and set the options
to your preference, type:
</p>
<pre>
make
</pre>
<p>
This will produce libGL.so and several other libraries depending on the
options you have chosen. Later, if you want to rebuild for a different
configuration run <code>make realclean</code> before rebuilding.
</p>
<p>
Some of the generic autoconf options are used with Mesa:
<ul>
<li><code>--prefix=PREFIX</code> - This is the root directory where
files will be installed by <code>make install</code>. The default is
<code>/usr/local</code>.
</li>
<li><code>--exec-prefix=EPREFIX</code> - This is the root directory
where architecture-dependent files will be installed. In Mesa, this is
only used to derive the directory for the libraries. The default is
<code>${prefix}</code>.
</li>
<li><code>--libdir=LIBDIR</code> - This option specifies the directory
where the GL libraries will be installed. The default is
<code>${exec_prefix}/lib</code>. It also serves as the name of the
library staging area in the source tree. For instance, if the option
<code>--libdir=/usr/local/lib64</code> is used, the libraries will be
created in a <code>lib64</code> directory at the top of the Mesa source
tree.
</li>
<li><code>--enable-static, --disable-shared</code> - By default, Mesa
will build shared libraries. Either of these options will force static
libraries to be built. It is not currently possible to build static and
shared libraries in a single pass.
</li>
<li><code>CC, CFLAGS, CXX, CXXFLAGS</code> - These environment variables
control the C and C++ compilers used during the build. By default,
<code>gcc</code> and <code>g++</code> are used with the options
<code>"-g -O2"</code>.
</li>
<li><code>LDFLAGS</code> - An environment variable specifying flags to
pass when linking programs. These are normally empty, but can be used
to direct the linker to use libraries in nonstandard directories. For
example, <code>LDFLAGS="-L/usr/X11R6/lib"</code>.
</li>
<li><code>PKG_CONFIG_PATH</code> - When available, the
<code>pkg-config</code> utility is used to search for external libraries
on the system. This environment variable is used to control the search
path for <code>pkg-config</code>. For instance, setting
<code>PKG_CONFIG_PATH=/usr/X11R6/lib/pkgconfig</code> will search for
package metadata in <code>/usr/X11R6</code> before the standard
directories.
</li>
</ul>
</p>
<p>
There are also a few general options for altering the Mesa build:
<ul>
<li><code>--with-x</code> - When the X11 development libraries are
needed, the <code>pkg-config</code> utility <a href="#pkg-config">will
be used</a> for locating them. If they cannot be found through
<code>pkg-config</code> a fallback routing using <code>imake</code> will
be used. In this case, the <code>--with-x</code>,
<code>--x-includes</code> and <code>--x-libraries</code> options can
control the use of X for Mesa.
</li>
<li><code>--enable-gl-osmesa</code> - The <a href="osmesa.html">OSMesa
library</a> can be built on top of libGL for drivers that provide it.
This option controls whether to build libOSMesa. By default, this is
enabled for the Xlib driver and disabled otherwise. Note that this
option is different than using OSMesa as the driver.
</li>
<li><code>--enable-debug</code> - This option will enable compiler
options and macros to aid in debugging the Mesa libraries.
</li>
<li><code>--disable-asm</code> - There are assembly routines
available for a few architectures. These will be used by default if
one of these architectures is detected. This option ensures that
assembly will not be used.
</li>
<li><code>--enable-32-bit, --enable-64-bit</code> - By default, the
build will compile code as directed by the environment variables
<code>CC</code>, <code>CFLAGS</code>, etc. If the compiler is
<code>gcc</code>, these options offer a helper to add the compiler flags
to force 32- or 64-bit code generation as used on the x86 and x86_64
architectures.
</li>
</ul>
</p>
<a name="driver">
<h2>2. Driver Options</h2>
<p>
There are several different driver modes that Mesa can use. These are
described in more detail in the <a href="install.html">basic
installation instructions</a>. The Mesa driver is controlled through the
configure option --with-driver. There are currently three supported
options in the configure script.
</p>
<ul>
<a name="xlib">
<li><b><em>Xlib</em></b> - This is the default mode for building Mesa.
It uses Xlib as a software renderer to do all rendering. It corresponds
to the option <code>--with-driver=xlib</code>. The libX11 and libXext
libraries, as well as the X11 development headers, will be need to
support the Xlib driver.
</li>
<a name="dri">
<li><b><em>DRI</em></b> - This mode uses the DRI hardware drivers for
accelerated OpenGL rendering. Enable the DRI drivers with the option
<code>--with-driver=dri</code>. See the <a href="install.html">basic
installation instructions</a> for details on prerequisites for the DRI
drivers.
</li>
<!-- DRI specific options -->
<p>
<ul>
<li><code>--with-dri-driverdir=DIR</code> - This option specifies the
location the DRI drivers will be installed to and the location libGL
will search for DRI drivers. The default is <code>${libdir}/dri</code>.
</li>
<li><code>--with-dri-drivers=DRIVER,DRIVER,...</code> - This option
allows a specific set of DRI drivers to be built. For example,
<code>--with-dri-drivers="swrast,i965,radeon,nouveau"</code>. By
default, the drivers will be chosen depending on the target platform.
See the directory <code>src/mesa/drivers/dri</code> in the source tree
for available drivers. Beware that the swrast DRI driver is used by both
libGL and the X.Org xserver GLX module to do software rendering, so you
may run into problems if it is not available.</li>
<!-- This explanation might be totally bogus. Kristian? -->
<li><code>--disable-driglx-direct</code> - Disable direct rendering in
GLX. Normally, direct hardware rendering through the DRI drivers and
indirect software rendering are enabled in GLX. This option disables
direct rendering entirely. It can be useful on architectures where
kernel DRM modules are not available.
</li>
<li><code>--enable-glx-tls</code> - Enable Thread Local Storage (TLS) in
GLX.
</li>
<li><code>--with-expat=DIR</code> - The DRI-enabled libGL uses expat to
parse the DRI configuration files in <code>/etc/drirc</code> and
<code>~/.drirc</code>. This option allows a specific expat installation
to be used. For example, <code>--with-expat=/usr/local</code> will
search for expat headers and libraries in <code>/usr/local/include</code>
and <code>/usr/local/lib</code>, respectively.
</li>
</ul>
</p>
<a name="osmesa">
<li><b><em>OSMesa</em></b> - No libGL is built in this
mode. Instead, the driver code is built into the Off-Screen Mesa
(OSMesa) library. See the <a href="osmesa.html">Off-Screen Rendering</a>
page for more details.
</li>
<!-- OSMesa specific options -->
<p>
<ul>
<li><code>--with-osmesa-bits=BITS</code> - This option allows the size
of the color channel in bits to be specified. By default, an 8-bit
channel will be used, and the driver will be named libOSMesa. Other
options are 16- and 32-bit color channels, which will add the bit size
to the library name. For example, <code>--with-osmesa-bits=16</code>
will create the libOSMesa16 library with a 16-bit color channel.
</li>
</ul>
</p>
</ul>
<a name="library">
<h2>3. Library Options</h2>
<p>
The configure script provides more fine grained control over the GL
libraries that will be built. More details on the specific GL libraries
can be found in the <a href="install.html">basic installation
instructions</a>.
<ul>
<a name="glu">
<li><b><em>GLU</em></b> - The libGLU library will be built by default
on all drivers. This can be disable with the option
<code>--disable-glu</code>.
</li>
<a name="glw">
<li><b><em>GLw</em></b> - The libGLw library will be built by default
if libGLU has been enabled. This can be disable with the option
<code>--disable-glw</code>.
</li>
<a name="glut">
<li><b><em>GLUT</em></b> - The libglut library will be built by default
if libGLU has been enabled and the glut source code from the MesaGLUT
tarball is available. This can be disable with the option
<code>--disable-glut</code>.
</li>
</ul>
</p>
<a name="demos">
<h2>4. Demo Program Options</h2>
<p>
There are many demonstration programs in the MesaDemos tarball. If the
programs are available when <code>./configure</code> is run, a subset of
the programs will be built depending on the driver and library options
chosen. See the directory <code>progs</code> for the full set of demos.
<ul>
<li><code>--with-demos=DEMOS,DEMOS,...</code> - This option allows a
specific set of demo programs to be built. For example,
<code>--with-demos="xdemos,slang"</code>. Beware that if this option is
used, it will not be ensured that the necessary GL libraries will be
available.
</li>
<li><code>--without-demos</code> - This completely disables building the
demo programs. It is equivalent to <code>--with-demos=no</code>.
</li>
</ul>
</p>
</body>
</html>

View File

@@ -9,9 +9,9 @@
<H1>Bug Database</H1>
<p>
The Mesa bug database is hosted on
<a href="http://freedesktop.org" target="_parent">freedesktop.org</a>.
The old bug database on SourceForge is no longer used.
The Mesa bug database is now hosted on
<a href="http://freedesktop.org" target="_parent">freedesktop.org</a>
instead of SourceForge.
</p>
<p>
@@ -26,20 +26,16 @@ Please follow these bug reporting guidelines:
</p>
<ul>
<li>Check if a new version of Mesa is available which might have fixed
the problem.
<li>Check if your bug is already reported in the database.
<li>Monitor your bug report for requests for additional information, etc.
<li>If you're reporting a crash, try to use your debugger (gdb) to get a stack
trace. Also, recompile Mesa in debug mode to get more detailed information.
<li>Describe in detail how to reproduce the bug, especially with games
and applications that the Mesa developers might not be familiar with.
<li>Make sure you're using the most recent version of Mesa
<li>Make sure your bug isn't already reported
<li>Include as much information as possible in the report
<li>Provide a simple GLUT-based test program if possible
<li>Check back for follow-ups to the report
</ul>
<p>
Bug reports will automatically be forwarded by bugzilla to the Mesa
developer's mailing list.
Bug reports will automatically be forwarded to the Mesa developer's mailing
list.
</p>
<p>

View File

@@ -1,107 +0,0 @@
<HTML>
<TITLE>Cell Driver</TITLE>
<link rel="stylesheet" type="text/css" href="mesa.css"></head>
<BODY>
<H1>Mesa Cell Driver</H1>
<p>
The Mesa
<a href="http://en.wikipedia.org/wiki/Cell_%28microprocessor%29" target="_parent">Cell</a>
driver is part of the
<a href="http://www.tungstengraphics.com/wiki/index.php/Gallium3D" target="_parent">Gallium3D</a>
architecture.
</p>
<p>
<a href="http://www.tungstengraphics.com/" target="_parent">Tungsten Graphics</a>
is leading the project.
Two phases are planned.
First, to implement the framework for parallel rasterization using the Cell
SPEs, including texture mapping.
Second, to implement a full-featured OpenGL driver with support for GLSL, etc.
</p>
<H2>Source Code</H2>
<p>
The Cell driver source code is on the <code>gallium-0.1</code> branch of the
git repository.
After you've cloned the repository, check out the branch with:
</p>
<pre>
git-checkout -b gallium-0.1 origin/gallium-0.1
</pre>
<p>
To build the driver you'll need the IBM Cell SDK (version 2.1 or 3.0).
To use the driver you'll need a Cell system, such as a PS3 running Linux,
or the Cell Simulator (untested, though).
</p>
<p>
If using Cell SDK 3.0, first edit configs/linux-cell and add
<code>-DSPU_MAIN_PARAM_LONG_LONG</code> to the SPU_CFLAGS.
</p>
<p>
To compile the code, run <code>make linux-cell</code>.
</p>
<p>
To use the library, make sure <code>LD_LIBRARY_PATH</code> points the Mesa/lib/
directory that contains <code>libGL.so</code>.
</p>
<p>
Verify that the Cell driver is being used by running <code>glxinfo</code>
and looking for:
<pre>
OpenGL renderer string: Gallium 0.1, Cell on Xlib
</pre>
<H2>Driver Implementation Summary</H2>
<p>
Rasterization is parallelized across the SPUs in a tiled-based manner.
Batches of transformed triangles are sent to the SPUs (actually, pulled by from
main memory by the SPUs).
Each SPU loops over a set of 32x32-pixel screen tiles, rendering the triangles
into each tile.
Because of the limited SPU memory, framebuffer tiles are paged in/out of
SPU local store as needed.
Similarly, textures are tiled and brought into local store as needed.
</p>
<p>
More recently, vertex transformation has been parallelized across the SPUs
as well.
</p>
<H2>Status</H2>
<p>
As of February 2008 the driver supports smooth/flat shaded triangle rendering
with Z testing and simple texture mapping.
Simple demos like gears run successfully.
To test texture mapping, try progs/demos/texcyl (press right mouse button for
rendering options).
</p>
<H2>Contributing</H2>
<p>
If you're interested in contributing to the effort, familiarize yourself
with the code, join the <a href="lists.html">mesa3d-dev mailing list</a>,
and describe what you'd like to do.
</p>
</BODY>
</HTML>

View File

@@ -75,7 +75,6 @@ a:visited {
<li><a href="subset.html" target="MainFrame">Mesa Subset Driver</a>
<li><a href="glfbdev-driver.html" target="MainFrame">glFBDev Driver</a>
<LI><A HREF="dispatch.html" target="MainFrame">GL Dispatch</A>
<li><a href="cell.html" target="MainFrame">Cell Driver</A>
</ul>
<b>Links</b>

View File

@@ -135,12 +135,12 @@ Update the docs/VERSIONS file too.
</p>
<p>
Edit the MESA_MAJOR, MESA_MINOR and MESA_TINY version numbers in
configs/default.
Edit configs/default and change the MESA_MAJOR, MESA_MINOR and MESA_TINY
version numbers.
</p>
<p>
Make sure the values in src/mesa/main/version.h are correct.
Make sure the values in src/mesa/main/version.h is correct.
</p>
<p>

View File

@@ -9,7 +9,7 @@
<H1>Downloading</H1>
<p>
Last stable release: <b>7.0.3</b>
Last stable release: <b>7.0.2</b>
</p>
<p>
@@ -18,11 +18,6 @@ Primary download site:
target="_parent">SourceForge</a>
</p>
<p>
When a new release is coming, release candidates (betas) can be found
<a href="http://www.mesa3d.org/beta/">here</a>.
</p>
<p>
Mesa is distributed in several parts:

View File

@@ -187,7 +187,24 @@ has Mesa packages (like RPM or DEB) which you can easily install.
</a></p>
<h2><a name="part2">2.2 I get undefined symbols such as bgnpolygon, v3f, etc...</a></h2>
<h2><a name="part2">2.2 Running <code>configure; make</code> doesn't Work</a></h2>
<p>
Mesa no longer supports GNU autoconf/automake. Why?
<ul>
<li>It seemed to seldom work on anything but Linux
<li>The config files were hard to maintain and hard to understand
<li>libtool caused a lot of grief
</ul>
<p>
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.
</p>
<h2><a name="part2">2.3 I get undefined symbols such as bgnpolygon, v3f, etc...</a></h2>
<p>
<a name="part2">You're application is written in IRIS GL, not OpenGL.
IRIS GL was the predecessor to OpenGL and is a different thing (almost)
@@ -196,7 +213,7 @@ Mesa's not the solution.
</a></p>
<h2><a name="part2">2.3 Where is the GLUT library?</a></h2>
<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 MesaGLUT-x.y.z.tar.gz file.
If you don't already have GLUT installed, you should grab the MesaGLUT
@@ -205,7 +222,7 @@ package and compile it with the rest of Mesa.
<h2><a name="part2">2.4 What's the proper place for the libraries and headers?</a></h2>
<h2><a name="part2">2.5 What's the proper place for the libraries and headers?</a></h2>
<p>
<a name="part2">On Linux-based systems you'll want to follow the
</a><a href="http://oss.sgi.com/projects/ogl-sample/ABI/index.html"
@@ -328,9 +345,9 @@ will fix the problem.
First, join the <a href="http://www.mesa3d.org/lists.html">Mesa3d-dev
mailing list</a>.
That's where Mesa development is discussed.
</p>
</a></p>
<p>
The <a href="http://www.opengl.org/documentation" target="_parent">
The </a><a href="http://www.opengl.org/documentation" target="_parent">
OpenGL Specification</a> is the bible for OpenGL implemention work.
You should read it.
</p>

View File

@@ -21,42 +21,10 @@
<a name="unix-x11">
<H2>1. Unix/X11 Compilation and Installation</H1>
<h3>1.1 Prerequisites for DRI and Hardware Acceleration</h3>
<h3>1.1 Compilation</h3>
<p>
To build Mesa 7.1 with DRI-based hardware acceleration you must first have
the <a href="http://dri.freedesktop.org/libdrm/" target="_parent">DRM version 2.3.1</a>.
</p>
<p>
You should also be using the Xorg server version 1.4 or 1.5.
</p>
<h3>1.2 Autoconf Compilation</h3>
<p>
Mesa may be <a href="autoconf.html">built using autoconf</a>.
This should work well on most GNU-based systems.
When that fails, the traditional Mesa build system is available.
<h3>1.3 Traditional Compilation</h3>
<p>
The traditional Mesa build system is based on a collection of pre-defined
system configurations.
</p>
<p>
To see the list of configurations, type <b>make</b> alone.
Then choose a configuration from the list and type <b>make configname</b>.
</p>
<p>
Mesa may be built in several different ways using the predefined configurations:
Mesa may be compiled in several different ways:
</p>
<ul>
<li><b><em>Stand-alone/Xlib mode</em></b> - Mesa will be compiled as
@@ -81,6 +49,43 @@ accelerated OpenGL rendering (for ATI, Intel, Matrox, etc) will be built.
The libGL.so library will support the GLX extension and will load/use
the DRI hardware drivers.
<p>
<b>Prerequisites:</b>
</p>
<ol>
<li>
<p>
For Mesa 7.0.2 <a href="http://dri.freedesktop.org/libdrm/">
DRM version 2.3</a> is required.
</p>
<p>
To check if you already have it, run:
<br>
<code>pkg-config --modversion libdrm</code>
</p>
<p>
You can download and install a <a href="http://dri.freedesktop.org/libdrm/">
tarball release</a> or get the code from git with:
<br>
<code>git clone git://anongit.freedesktop.org/git/mesa/drm</code>
<br>
Then revert to the drm-2.3.0 tag with:
<br>
<code>git-reset --hard drm-2.3.0</code>
</p>
</li>
<li>
Relatively recent
<a href="http://freedesktop.org/wiki/Software_2fXserver" target="_parent">
X.org</a> release.
Mesa depends on a number of X header and library files.
</li>
</ol>
<p>
Build Mesa and the DRI hardware drivers by running
@@ -93,13 +98,8 @@ There are also <code>linux-dri-x86</code>, <code>linux-dri-x86-64</code>,
and <code>linux-ppc</code> configurations which are optimized for those
architectures.
</p>
<p>
Make sure you have the prerequisite versions of DRM and Xserver mentioned
above.
</p>
</li>
</ul>
@@ -109,7 +109,7 @@ Later, if you want to rebuild for a different configuration run
</p>
<h3>1.4 The libraries</h3>
<h3>1.2 The libraries</h3>
<p>
When compilation has finished, look in the top-level <code>lib/</code>
@@ -150,15 +150,15 @@ lrwxrwxrwx 1 brian users 23 Mar 26 07:53 libOSMesa.so.6 -> libOSM
If you built the DRI hardware drivers, you'll also see the DRI drivers:
</p>
<pre>
-rwxr-xr-x 1 brian users 15607851 Jul 21 12:11 ffb_dri.so
-rwxr-xr-x 1 brian users 15148747 Jul 21 12:11 i810_dri.so
-rwxr-xr-x 1 brian users 14497814 Jul 21 12:11 i830_dri.so
-rwxr-xr-x 1 brian users 16895413 Jul 21 12:11 i915_dri.so
-rwxr-xr-x 1 brian users 15607851 Jul 21 12:11 ffb_dri.so*
-rwxr-xr-x 1 brian users 15148747 Jul 21 12:11 i810_dri.so*
-rwxr-xr-x 1 brian users 14497814 Jul 21 12:11 i830_dri.so*
-rwxr-xr-x 1 brian users 16895413 Jul 21 12:11 i915_dri.so*
-rwxr-xr-x 1 brian users 11320803 Jul 21 12:11 mach64_dri.so
-rwxr-xr-x 1 brian users 11418014 Jul 21 12:12 mga_dri.so
-rwxr-xr-x 1 brian users 11064426 Jul 21 12:12 r128_dri.so
-rwxr-xr-x 1 brian users 11849858 Jul 21 12:12 r200_dri.so
-rwxr-xr-x 1 brian users 16050488 Jul 21 12:11 r300_dri.so
-rwxr-xr-x 1 brian users 16050488 Jul 21 12:11 r300_dri.so*
-rwxr-xr-x 1 brian users 11757388 Jul 21 12:12 radeon_dri.so
-rwxr-xr-x 1 brian users 11232304 Jul 21 12:13 s3v_dri.so
-rwxr-xr-x 1 brian users 11062970 Jul 21 12:13 savage_dri.so
@@ -169,7 +169,7 @@ If you built the DRI hardware drivers, you'll also see the DRI drivers:
</pre>
<h3>1.5 Running the demos</h3>
<h3>1.3 Running the demos</h3>
<p>
If you downloaded/unpacked the MesaDemos-x.y.z.tar.gz archive or
@@ -178,15 +178,18 @@ bunch of demonstration programs.
</p>
<p>
Before running a demo, you'll probably have to set two environment variables
to indicate where the libraries are located. For example:
Before running a demo, you may have to set an environment variable
(such as <b>LD_LIBRARY_PATH</b> on Linux) to indicate where the
libraries are located. For example:
<p>
<blockquote>
<b>cd lib/</b>
<b>cd</b> into the Mesa <b>lib/</b> directory.
<br>
<b>export LD_LIBRARY_PATH=${PWD}</b>
<b>setenv LD_LIBRARY_PATH ${cwd}</b> (if using csh or tcsh shell)
<br>
<b>export LIBGL_DRIVERS_PATH=${PWD}</b> (if using DRI drivers)
or,
<br>
<b>export LD_LIBRARY_PATH=${PWD}</b> (if using bash or sh shell)
</blockquote>
<p>
@@ -244,7 +247,7 @@ Retrace your steps if this doesn't look right.
</p>
<H3>1.6 Installing the header and library files</H3>
<H3>1.4 Installing the header and library files</H3>
<p>
The standard location for the OpenGL header files on Unix-type systems is
@@ -284,7 +287,7 @@ This is a handy way to compare multiple OpenGL implementations.
</p>
<H3>1.7 Building OpenGL Programs With pkg-config</H3>
<H3>1.5 pkg-config support</H3>
<p>
Running <code>make install</code> will install package configuration files

21
docs/memory.html Normal file
View File

@@ -0,0 +1,21 @@
<HTML>
<TITLE>Mesa News</TITLE>
<head><link rel="stylesheet" type="text/css" href="mesa.css"></head>
<BODY>
<body bgcolor="#eeeeee">
<H1>DRI Memory Management</H1>
<p>
Thomas Hellstr&ouml;m's
<a href="http://www.tungstengraphics.com/mm.pdf">Memory Management
whitepaper</a> describes the goals, design and implementation of the
new DRI memory management system.
</p>
</body>
</html>

View File

@@ -11,21 +11,6 @@
<H1>News</H1>
<h2>April 4, 2008</h2>
<p>
<a href="relnotes-7.0.3.html">Mesa 7.0.3</a> is released.
This is a bug-fix release.
</p>
<h2>January 24, 2008</h2>
<p>
Added a new page describing the <a href="cell.html">Mesa Cell driver</a>.
</p>
<h2>November 13, 2007</h2>
<p>

View File

@@ -8,7 +8,7 @@
<body bgcolor="#eeeeee">
<H1>Mesa 7.0.3 Release Notes / April 4, 2008</H1>
<H1>Mesa 7.0.3 Release Notes / March TBD, 2008</H1>
<p>
Mesa 7.0.3 is a stable release with bug fixes since version 7.0.2.
@@ -17,15 +17,6 @@ Mesa 7.0.3 is a stable release with bug fixes since version 7.0.2.
<h2>MD5 checksums</h2>
<pre>
3fd1cb76531b2515ef7db92d9a93dbf8 MesaLib-7.0.3.tar.gz
e6e6379d7793af40a6bc3ce1bace572e MesaLib-7.0.3.tar.bz2
97882bac195229ee0b78cab82e0e3be1 MesaLib-7.0.3.zip
8abf6bbcb1661e7dd4ce73b3fbb85898 MesaDemos-7.0.3.tar.gz
47fd6863621d3c9c7dbb870ab7f0c303 MesaDemos-7.0.3.tar.bz2
99e442e14da1928f76a7297bb421a3af MesaDemos-7.0.3.zip
2b50fe9fadc4709b57c52adef09fce3c MesaGLUT-7.0.3.tar.gz
0ff23c4e91b238abae63a5fc9fa003e7 MesaGLUT-7.0.3.tar.bz2
70e83554a4462dad28e0d6e20f79aada MesaGLUT-7.0.3.zip
</pre>

View File

@@ -1,75 +0,0 @@
<HTML>
<TITLE>Mesa Release Notes</TITLE>
<head><link rel="stylesheet" type="text/css" href="mesa.css"></head>
<BODY>
<body bgcolor="#eeeeee">
<H1>Mesa 7.1 Release Notes / May XX, 2008</H1>
<p>
Mesa 7.1 is a new development release.
There have been many internal code changes since Mesa 7.0.x.
It should be relatively stable, but those who are especially concerned about
stability should wait for Mesa 7.2.
</p>
<h2>MD5 checksums</h2>
<pre>
TBD
</pre>
<h2>New features</h2>
<ul>
<li>autoconf-based configuration (and clean-up of Makefiles)
<li>Reduced dependencies between X server and Mesa
<li>GL_EXT_texture_from_pixmap extension for Xlib driver
<li>Support for the GL shading language with i965 driver (implemented by Intel)
</ul>
<h2>Bug fixes</h2>
<ul>
<li>Fixed a number of minor GLSL intrinsic function/constructor bugs
<li>Fixed some error code/detection bugs in the GLSL-related API functions
</ul>
<h2>To Do (someday) items</h2>
<ul>
<li>Remove the MEMCPY() and _mesa_memcpy() wrappers and just use memcpy().
Probably do the same for malloc, calloc, etc.
The wrappers were useful in the past for memory debugging but now we
have valgrind. Not worried about SunOS 4 support anymore either...
<li>Switch to freeglut
<li>Fix linux-glide target/driver.
<li>Improved lambda and derivative calculation for frag progs.
</ul>
<h2>Driver Status</h2>
<pre>
Driver Status
---------------------- ----------------------
DRI drivers varies with the driver
XMesa/GLX (on Xlib) implements OpenGL 2.1
OSMesa (off-screen) implements OpenGL 2.1
Windows/Win32 implements OpenGL 2.1
Glide (3dfx Voodoo1/2) implements OpenGL 1.3
SVGA unsupported
Wind River UGL unsupported
DJGPP unsupported
GGI unsupported
BeOS unsupported
Allegro unsupported
D3D unsupported
</pre>
</body>
</html>

View File

@@ -20,7 +20,6 @@ The release notes summarize what's new or changed in each Mesa release.
</p>
<UL>
<LI><A HREF="relnotes-7.1.html">7.1 release notes</A>
<LI><A HREF="relnotes-7.0.3.html">7.0.3 release notes</A>
<LI><A HREF="relnotes-7.0.2.html">7.0.2 release notes</A>
<LI><A HREF="relnotes-7.0.1.html">7.0.1 release notes</A>

View File

@@ -85,27 +85,6 @@ Once your account is established:
</ol>
<H2>Windows Users</H2>
<p>
If you're <a href="http://git.or.cz/gitwiki/WindowsInstall" target="_parent">
using git on Windows</a> you'll want to enable automatic CR/LF conversion in
your local copy of the repository:
</p>
<pre>
git config --global core.autocrlf true
</pre>
<p>
This will cause git to convert all text files to CR+LF on checkout,
and to LF on commit.
</p>
<p>
Unix users don't need to set this option.
</p>
<br>
<a name="developer">
<H2>Development Branches</H2>

View File

@@ -1,33 +1,33 @@
default: full
all: full subset
%.tag: %.doxy
doxygen $<
FULL = \
main.doxy \
math.doxy \
vbo.doxy \
glapi.doxy \
shader.doxy \
swrast.doxy \
swrast_setup.doxy \
tnl.doxy \
tnl_dd.doxy
full: $(FULL:.doxy=.tag)
$(foreach FILE,$(FULL),doxygen $(FILE);)
SUBSET = \
main.doxy \
math.doxy \
miniglx.doxy
subset: $(SUBSET:.doxy=.tag)
$(foreach FILE,$(SUBSET),doxygen $(FILE);)
clean:
-rm -rf $(FULL:.doxy=) $(SUBSET:.doxy=)
-rm -rf *.tag
default: full
all: full subset
%.tag: %.doxy
doxygen $<
FULL = \
main.doxy \
math.doxy \
vbo.doxy \
glapi.doxy \
shader.doxy \
swrast.doxy \
swrast_setup.doxy \
tnl.doxy \
tnl_dd.doxy
full: $(FULL:.doxy=.tag)
$(foreach FILE,$(FULL),doxygen $(FILE);)
SUBSET = \
main.doxy \
math.doxy \
miniglx.doxy
subset: $(SUBSET:.doxy=.tag)
$(foreach FILE,$(SUBSET),doxygen $(FILE);)
clean:
rm -rf $(FULL:.doxy=) $(SUBSET:.doxy=)
rm -rf *.tag

View File

@@ -1,19 +1,19 @@
doxygen tnl_dd.doxy
doxygen vbo.doxy
doxygen math.doxy
doxygen swrast.doxy
doxygen swrast_setup.doxy
doxygen tnl.doxy
doxygen core.doxy
doxygen glapi.doxy
doxygen shader.doxy
echo Building again, to resolve tags
doxygen tnl_dd.doxy
doxygen vbo.doxy
doxygen math.doxy
doxygen swrast.doxy
doxygen swrast_setup.doxy
doxygen tnl.doxy
doxygen glapi.doxy
doxygen shader.doxy
doxygen tnl_dd.doxy
doxygen vbo.doxy
doxygen math.doxy
doxygen swrast.doxy
doxygen swrast_setup.doxy
doxygen tnl.doxy
doxygen core.doxy
doxygen glapi.doxy
doxygen shader.doxy
echo Building again, to resolve tags
doxygen tnl_dd.doxy
doxygen vbo.doxy
doxygen math.doxy
doxygen swrast.doxy
doxygen swrast_setup.doxy
doxygen tnl.doxy
doxygen glapi.doxy
doxygen shader.doxy

View File

@@ -1,17 +1,17 @@
<html>
<head>
<title>Mesa Source Code Documentation</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head>
<body>
<div class="qindex">
<a class="qindex" href="../main/index.html">core</a> |
<a class="qindex" href="../glapi/index.html">glapi</a> |
<a class="qindex" href="../vbo/index.html">vbo</a> |
<a class="qindex" href="../math/index.html">math</a> |
<a class="qindex" href="../shader/index.html">shader</a> |
<a class="qindex" href="../swrast/index.html">swrast</a> |
<a class="qindex" href="../swrast_setup/index.html">swrast_setup</a> |
<a class="qindex" href="../tnl/index.html">tnl</a> |
<a class="qindex" href="../tnl_dd/index.html">tnl_dd</a>
</div>
<html>
<head>
<title>Mesa Source Code Documentation</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head>
<body>
<div class="qindex">
<a class="qindex" href="../main/index.html">core</a> |
<a class="qindex" href="../glapi/index.html">glapi</a> |
<a class="qindex" href="../vbo/index.html">vbo</a> |
<a class="qindex" href="../math/index.html">math</a> |
<a class="qindex" href="../shader/index.html">shader</a> |
<a class="qindex" href="../swrast/index.html">swrast</a> |
<a class="qindex" href="../swrast_setup/index.html">swrast_setup</a> |
<a class="qindex" href="../tnl/index.html">tnl</a> |
<a class="qindex" href="../tnl_dd/index.html">tnl_dd</a>
</div>

View File

@@ -1,11 +1,11 @@
<html>
<head><title>Mesa Source Code Documentation</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head>
<body>
<div class="qindex">
<a class="qindex" href="../core_subset/index.html">Mesa Core</a> |
<a class="qindex" href="../math_subset/index.html">math</a> |
<a class="qindex" href="../miniglx/index.html">MiniGLX</a> |
<a class="qindex" href="../radeon_subset/index.html">radeon_subset</a>
</div>
<html>
<head><title>Mesa Source Code Documentation</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head>
<body>
<div class="qindex">
<a class="qindex" href="../core_subset/index.html">Mesa Core</a> |
<a class="qindex" href="../math_subset/index.html">math</a> |
<a class="qindex" href="../miniglx/index.html">MiniGLX</a> |
<a class="qindex" href="../radeon_subset/index.html">radeon_subset</a>
</div>

76
include/GL/foomesa.h Normal file
View File

@@ -0,0 +1,76 @@
/*
* Mesa 3-D graphics library
* Version: 3.0
* Copyright (C) 1995-1998 Brian Paul
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/*
* Example Foo/Mesa interface. See src/ddsample.c for more info.
*/
#ifndef FOOMESA_H
#define FOOMESA_H
typedef struct foo_mesa_visual *FooMesaVisual;
typedef struct foo_mesa_buffer *FooMesaBuffer;
typedef struct foo_mesa_context *FooMesaContext;
#ifdef BEOS
#pragma export on
#endif
extern FooMesaVisual FooMesaChooseVisual( /* your params */ );
extern void FooMesaDestroyVisual( FooMesaVisual visual );
extern FooMesaBuffer FooMesaCreateBuffer( FooMesaVisual visual,
void *your_window_id );
extern void FooMesaDestroyBuffer( FooMesaBuffer buffer );
extern FooMesaContext FooMesaCreateContext( FooMesaVisual visual,
FooMesaContext sharelist );
extern void FooMesaDestroyContext( FooMesaContext context );
extern void FooMesaMakeCurrent( FooMesaContext context, FooMesaBuffer buffer );
extern void FooMesaSwapBuffers( FooMesaBuffer buffer );
/* Probably some more functions... */
#ifdef BEOS
#pragma export off
#endif
#endif

View File

@@ -1,8 +1,8 @@
/*
* Mesa 3-D graphics library
* Version: 6.5.1
* Version: 7.0
*
* Copyright (C) 1999-2006 Brian Paul All Rights Reserved.
* Copyright (C) 1999-2007 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"),
@@ -2210,39 +2210,6 @@ GLAPI void GLAPIENTRY glGetProgramRegisterfvMESA(GLenum target, GLsizei len, con
#endif /* GL_MESA_program_debug */
#ifndef GL_MESA_texture_array
#define GL_MESA_texture_array 1
/* GL_MESA_texture_array uses the same enum values as GL_EXT_texture_array.
*/
#ifndef GL_EXT_texture_array
#ifdef GL_GLEXT_PROTOTYPES
GLAPI void APIENTRY glFramebufferTextureLayerEXT(GLenum target,
GLenum attachment, GLuint texture, GLint level, GLint layer);
#endif /* GL_GLEXT_PROTOTYPES */
#if 0
/* (temporarily) disabled because of collision with typedef in glext.h
* that happens if apps include both gl.h and glext.h
*/
typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURELAYEREXTPROC) (GLenum target,
GLenum attachment, GLuint texture, GLint level, GLint layer);
#endif
#define GL_TEXTURE_1D_ARRAY_EXT 0x8C18
#define GL_PROXY_TEXTURE_1D_ARRAY_EXT 0x8C19
#define GL_TEXTURE_2D_ARRAY_EXT 0x8C1A
#define GL_PROXY_TEXTURE_2D_ARRAY_EXT 0x8C1B
#define GL_TEXTURE_BINDING_1D_ARRAY_EXT 0x8C1C
#define GL_TEXTURE_BINDING_2D_ARRAY_EXT 0x8C1D
#define GL_MAX_ARRAY_TEXTURE_LAYERS_EXT 0x88FF
#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER_EXT 0x8CD4
#endif
#endif
#ifndef GL_ATI_blend_equation_separate
#define GL_ATI_blend_equation_separate 1

View File

@@ -1,6 +1,5 @@
/*
* Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
* Copyright 2007-2008 Red Hat, Inc.
* (C) Copyright IBM Corporation 2004
* All Rights Reserved.
*
@@ -34,12 +33,12 @@
*
* \author Kevin E. Martin <kevin@precisioninsight.com>
* \author Ian Romanick <idr@us.ibm.com>
* \author Kristian Høgsberg <krh@redhat.com>
*/
#ifndef DRI_INTERFACE_H
#define DRI_INTERFACE_H
#include <GL/internal/glcore.h>
#include <drm.h>
/**
@@ -49,190 +48,65 @@
* side library and the DRI (direct rendering infrastructure).
*/
/*@{*/
typedef struct __DRIdisplayRec __DRIdisplay;
typedef struct __DRIscreenRec __DRIscreen;
typedef struct __DRIcontextRec __DRIcontext;
typedef struct __DRIdrawableRec __DRIdrawable;
typedef struct __DRIconfigRec __DRIconfig;
typedef struct __DRIframebufferRec __DRIframebuffer;
typedef struct __DRIversionRec __DRIversion;
typedef struct __DRIcoreExtensionRec __DRIcoreExtension;
typedef struct __DRIextensionRec __DRIextension;
typedef struct __DRIcopySubBufferExtensionRec __DRIcopySubBufferExtension;
typedef struct __DRIswapControlExtensionRec __DRIswapControlExtension;
typedef struct __DRIallocateExtensionRec __DRIallocateExtension;
typedef struct __DRIframeTrackingExtensionRec __DRIframeTrackingExtension;
typedef struct __DRImediaStreamCounterExtensionRec __DRImediaStreamCounterExtension;
typedef struct __DRItexOffsetExtensionRec __DRItexOffsetExtension;
typedef struct __DRItexBufferExtensionRec __DRItexBufferExtension;
typedef struct __DRIlegacyExtensionRec __DRIlegacyExtension;
typedef struct __DRIswrastExtensionRec __DRIswrastExtension;
typedef struct __DRIdisplayRec __DRIdisplay;
typedef struct __DRIscreenRec __DRIscreen;
typedef struct __DRIcontextRec __DRIcontext;
typedef struct __DRIdrawableRec __DRIdrawable;
typedef struct __DRIdriverRec __DRIdriver;
typedef struct __DRIframebufferRec __DRIframebuffer;
typedef struct __DRIversionRec __DRIversion;
typedef struct __DRIinterfaceMethodsRec __DRIinterfaceMethods;
typedef unsigned long __DRIid;
typedef void __DRInativeDisplay;
/*@}*/
/**
* Extension struct. Drivers 'inherit' from this struct by embedding
* it as the first element in the extension struct.
* \name Functions provided by the driver loader.
*/
/*@{*/
/**
* Type of a pointer to \c glXGetScreenDriver, as returned by
* \c glXGetProcAddress. This function is used to get the name of the DRI
* driver for the specified screen of the specified display. The driver
* name is typically used with \c glXGetDriverConfig.
*
* We never break API in for a DRI extension. If we need to change
* the way things work in a non-backwards compatible manner, we
* introduce a new extension. During a transition period, we can
* leave both the old and the new extension in the driver, which
* allows us to move to the new interface without having to update the
* loader(s) in lock step.
* \sa glXGetScreenDriver, glXGetProcAddress, glXGetDriverConfig
*/
typedef const char * (* PFNGLXGETSCREENDRIVERPROC) (__DRInativeDisplay *dpy, int scrNum);
/**
* Type of a pointer to \c glXGetDriverConfig, as returned by
* \c glXGetProcAddress. This function is used to get the XML document
* describing the configuration options available for the specified driver.
*
* However, we can add entry points to an extension over time as long
* as we don't break the old ones. As we add entry points to an
* extension, we increase the version number. The corresponding
* #define can be used to guard code that accesses the new entry
* points at compile time and the version field in the extension
* struct can be used at run-time to determine how to use the
* extension.
* \sa glXGetDriverConfig, glXGetProcAddress, glXGetScreenDriver
*/
struct __DRIextensionRec {
const char *name;
int version;
};
typedef const char * (* PFNGLXGETDRIVERCONFIGPROC) (const char *driverName);
/**
* The first set of extension are the screen extensions, returned by
* __DRIcore::getExtensions(). This entry point will return a list of
* extensions and the loader can use the ones it knows about by
* casting them to more specific extensions and advertising any GLX
* extensions the DRI extensions enables.
* Type of a pointer to \c glxEnableExtension, as returned by
* \c __DRIinterfaceMethods::getProcAddress. This function is used to enable
* a GLX extension on the specified screen.
*/
/**
* Used by drivers to indicate support for setting the read drawable.
*/
#define __DRI_READ_DRAWABLE "DRI_ReadDrawable"
#define __DRI_READ_DRAWABLE_VERSION 1
/**
* Used by drivers that implement the GLX_MESA_copy_sub_buffer extension.
*/
#define __DRI_COPY_SUB_BUFFER "DRI_CopySubBuffer"
#define __DRI_COPY_SUB_BUFFER_VERSION 1
struct __DRIcopySubBufferExtensionRec {
__DRIextension base;
void (*copySubBuffer)(__DRIdrawable *drawable, int x, int y, int w, int h);
};
/**
* Used by drivers that implement the GLX_SGI_swap_control or
* GLX_MESA_swap_control extension.
*/
#define __DRI_SWAP_CONTROL "DRI_SwapControl"
#define __DRI_SWAP_CONTROL_VERSION 1
struct __DRIswapControlExtensionRec {
__DRIextension base;
void (*setSwapInterval)(__DRIdrawable *drawable, unsigned int inteval);
unsigned int (*getSwapInterval)(__DRIdrawable *drawable);
};
/**
* Used by drivers that implement the GLX_MESA_allocate_memory.
*/
#define __DRI_ALLOCATE "DRI_Allocate"
#define __DRI_ALLOCATE_VERSION 1
struct __DRIallocateExtensionRec {
__DRIextension base;
void *(*allocateMemory)(__DRIscreen *screen, GLsizei size,
GLfloat readfreq, GLfloat writefreq,
GLfloat priority);
void (*freeMemory)(__DRIscreen *screen, GLvoid *pointer);
GLuint (*memoryOffset)(__DRIscreen *screen, const GLvoid *pointer);
};
/**
* Used by drivers that implement the GLX_MESA_swap_frame_usage extension.
*/
#define __DRI_FRAME_TRACKING "DRI_FrameTracking"
#define __DRI_FRAME_TRACKING_VERSION 1
struct __DRIframeTrackingExtensionRec {
__DRIextension base;
/**
* Enable or disable frame usage tracking.
*
* \since Internal API version 20030317.
*/
int (*frameTracking)(__DRIdrawable *drawable, GLboolean enable);
/**
* Retrieve frame usage information.
*
* \since Internal API version 20030317.
*/
int (*queryFrameTracking)(__DRIdrawable *drawable,
int64_t * sbc, int64_t * missedFrames,
float * lastMissedUsage, float * usage);
};
typedef void (* PFNGLXSCRENABLEEXTENSIONPROC) ( void *psc, const char * name );
/*@}*/
/**
* Used by drivers that implement the GLX_SGI_video_sync extension.
* \name Functions and data provided by the driver.
*/
#define __DRI_MEDIA_STREAM_COUNTER "DRI_MediaStreamCounter"
#define __DRI_MEDIA_STREAM_COUNTER_VERSION 1
struct __DRImediaStreamCounterExtensionRec {
__DRIextension base;
/*@{*/
/**
* Wait for the MSC to equal target_msc, or, if that has already passed,
* the next time (MSC % divisor) is equal to remainder. If divisor is
* zero, the function will return as soon as MSC is greater than or equal
* to target_msc.
*/
int (*waitForMSC)(__DRIdrawable *drawable,
int64_t target_msc, int64_t divisor, int64_t remainder,
int64_t * msc, int64_t * sbc);
/**
* Get the number of vertical refreshes since some point in time before
* this function was first called (i.e., system start up).
*/
int (*getDrawableMSC)(__DRIscreen *screen, __DRIdrawable *drawable,
int64_t *msc);
};
#define __DRI_TEX_OFFSET "DRI_TexOffset"
#define __DRI_TEX_OFFSET_VERSION 1
struct __DRItexOffsetExtensionRec {
__DRIextension base;
/**
* Method to override base texture image with a driver specific 'offset'.
* The depth passed in allows e.g. to ignore the alpha channel of texture
* images where the non-alpha components don't occupy a whole texel.
*
* For GLX_EXT_texture_from_pixmap with AIGLX.
*/
void (*setTexOffset)(__DRIcontext *pDRICtx, GLint texname,
unsigned long long offset, GLint depth, GLuint pitch);
};
#define __DRI_TEX_BUFFER "DRI_TexBuffer"
#define __DRI_TEX_BUFFER_VERSION 1
struct __DRItexBufferExtensionRec {
__DRIextension base;
/**
* Method to override base texture image with the contents of a
* __DRIdrawable.
*
* For GLX_EXT_texture_from_pixmap with AIGLX.
*/
void (*setTexBuffer)(__DRIcontext *pDRICtx,
GLint target,
__DRIdrawable *pDraw);
};
typedef void *(CREATENEWSCREENFUNC)(__DRInativeDisplay *dpy, int scrn,
__DRIscreen *psc, const __GLcontextModes * modes,
const __DRIversion * ddx_version, const __DRIversion * dri_version,
const __DRIversion * drm_version, const __DRIframebuffer * frame_buffer,
void * pSAREA, int fd, int internal_api_version,
const __DRIinterfaceMethods * interface,
__GLcontextModes ** driver_modes);
typedef CREATENEWSCREENFUNC* PFNCREATENEWSCREENFUNC;
extern CREATENEWSCREENFUNC __driCreateNewScreen_20050727;
/**
@@ -243,289 +117,6 @@ extern const char __driConfigOptions[];
/*@}*/
/**
* The following extensions describe loader features that the DRI
* driver can make use of. Some of these are mandatory, such as the
* getDrawableInfo extension for DRI and the DRI Loader extensions for
* DRI2, while others are optional, and if present allow the driver to
* expose certain features. The loader pass in a NULL terminated
* array of these extensions to the driver in the createNewScreen
* constructor.
*/
typedef struct __DRIgetDrawableInfoExtensionRec __DRIgetDrawableInfoExtension;
typedef struct __DRIsystemTimeExtensionRec __DRIsystemTimeExtension;
typedef struct __DRIdamageExtensionRec __DRIdamageExtension;
typedef struct __DRIloaderExtensionRec __DRIloaderExtension;
typedef struct __DRIswrastLoaderExtensionRec __DRIswrastLoaderExtension;
/**
* Callback to getDrawableInfo protocol
*/
#define __DRI_GET_DRAWABLE_INFO "DRI_GetDrawableInfo"
#define __DRI_GET_DRAWABLE_INFO_VERSION 1
struct __DRIgetDrawableInfoExtensionRec {
__DRIextension base;
/**
* This function is used to get information about the position, size, and
* clip rects of a drawable.
*/
GLboolean (* getDrawableInfo) ( __DRIdrawable *drawable,
unsigned int * index, unsigned int * stamp,
int * x, int * y, int * width, int * height,
int * numClipRects, drm_clip_rect_t ** pClipRects,
int * backX, int * backY,
int * numBackClipRects, drm_clip_rect_t ** pBackClipRects,
void *loaderPrivate);
};
/**
* Callback to get system time for media stream counter extensions.
*/
#define __DRI_SYSTEM_TIME "DRI_SystemTime"
#define __DRI_SYSTEM_TIME_VERSION 1
struct __DRIsystemTimeExtensionRec {
__DRIextension base;
/**
* Get the 64-bit unadjusted system time (UST).
*/
int (*getUST)(int64_t * ust);
/**
* Get the media stream counter (MSC) rate.
*
* Matching the definition in GLX_OML_sync_control, this function returns
* the rate of the "media stream counter". In practical terms, this is
* the frame refresh rate of the display.
*/
GLboolean (*getMSCRate)(__DRIdrawable *draw,
int32_t * numerator, int32_t * denominator,
void *loaderPrivate);
};
/**
* Damage reporting
*/
#define __DRI_DAMAGE "DRI_Damage"
#define __DRI_DAMAGE_VERSION 1
struct __DRIdamageExtensionRec {
__DRIextension base;
/**
* Reports areas of the given drawable which have been modified by the
* driver.
*
* \param drawable which the drawing was done to.
* \param rects rectangles affected, with the drawable origin as the
* origin.
* \param x X offset of the drawable within the screen (used in the
* front_buffer case)
* \param y Y offset of the drawable within the screen.
* \param front_buffer boolean flag for whether the drawing to the
* drawable was actually done directly to the front buffer (instead
* of backing storage, for example)
* \param loaderPrivate the data passed in at createNewDrawable time
*/
void (*reportDamage)(__DRIdrawable *draw,
int x, int y,
drm_clip_rect_t *rects, int num_rects,
GLboolean front_buffer,
void *loaderPrivate);
};
/**
* DRI2 Loader extension. This extension describes the basic
* functionality the loader needs to provide for the DRI driver.
*/
#define __DRI_LOADER "DRI_Loader"
#define __DRI_LOADER_VERSION 1
struct __DRIloaderExtensionRec {
__DRIextension base;
/**
* Ping the windowing system to get it to reemit info for the
* specified drawable in the DRI2 event buffer.
*
* \param draw the drawable for which to request info
* \param tail the new event buffer tail pointer
*/
void (*reemitDrawableInfo)(__DRIdrawable *draw, unsigned int *tail,
void *loaderPrivate);
void (*postDamage)(__DRIdrawable *draw, struct drm_clip_rect *rects,
int num_rects, void *loaderPrivate);
};
#define __DRI_SWRAST_IMAGE_OP_DRAW 1
#define __DRI_SWRAST_IMAGE_OP_CLEAR 2
#define __DRI_SWRAST_IMAGE_OP_SWAP 3
/**
* SWRast Loader extension.
*/
#define __DRI_SWRAST_LOADER "DRI_SWRastLoader"
#define __DRI_SWRAST_LOADER_VERSION 1
struct __DRIswrastLoaderExtensionRec {
__DRIextension base;
/*
* Drawable position and size
*/
void (*getDrawableInfo)(__DRIdrawable *drawable,
int *x, int *y, int *width, int *height,
void *loaderPrivate);
/**
* Put image to drawable
*/
void (*putImage)(__DRIdrawable *drawable, int op,
int x, int y, int width, int height, char *data,
void *loaderPrivate);
/**
* Get image from drawable
*/
void (*getImage)(__DRIdrawable *drawable,
int x, int y, int width, int height, char *data,
void *loaderPrivate);
};
/**
* The remaining extensions describe driver extensions, immediately
* available interfaces provided by the driver. To start using the
* driver, dlsym() for the __DRI_DRIVER_EXTENSIONS symbol and look for
* the extension you need in the array.
*/
#define __DRI_DRIVER_EXTENSIONS "__driDriverExtensions"
/**
* Tokens for __DRIconfig attribs. A number of attributes defined by
* GLX or EGL standards are not in the table, as they must be provided
* by the loader. For example, FBConfig ID or visual ID, drawable type.
*/
#define __DRI_ATTRIB_BUFFER_SIZE 1
#define __DRI_ATTRIB_LEVEL 2
#define __DRI_ATTRIB_RED_SIZE 3
#define __DRI_ATTRIB_GREEN_SIZE 4
#define __DRI_ATTRIB_BLUE_SIZE 5
#define __DRI_ATTRIB_LUMINANCE_SIZE 6
#define __DRI_ATTRIB_ALPHA_SIZE 7
#define __DRI_ATTRIB_ALPHA_MASK_SIZE 8
#define __DRI_ATTRIB_DEPTH_SIZE 9
#define __DRI_ATTRIB_STENCIL_SIZE 10
#define __DRI_ATTRIB_ACCUM_RED_SIZE 11
#define __DRI_ATTRIB_ACCUM_GREEN_SIZE 12
#define __DRI_ATTRIB_ACCUM_BLUE_SIZE 13
#define __DRI_ATTRIB_ACCUM_ALPHA_SIZE 14
#define __DRI_ATTRIB_SAMPLE_BUFFERS 15
#define __DRI_ATTRIB_SAMPLES 16
#define __DRI_ATTRIB_RENDER_TYPE 17
#define __DRI_ATTRIB_CONFIG_CAVEAT 18
#define __DRI_ATTRIB_CONFORMANT 19
#define __DRI_ATTRIB_DOUBLE_BUFFER 20
#define __DRI_ATTRIB_STEREO 21
#define __DRI_ATTRIB_AUX_BUFFERS 22
#define __DRI_ATTRIB_TRANSPARENT_TYPE 23
#define __DRI_ATTRIB_TRANSPARENT_INDEX_VALUE 24
#define __DRI_ATTRIB_TRANSPARENT_RED_VALUE 25
#define __DRI_ATTRIB_TRANSPARENT_GREEN_VALUE 26
#define __DRI_ATTRIB_TRANSPARENT_BLUE_VALUE 27
#define __DRI_ATTRIB_TRANSPARENT_ALPHA_VALUE 28
#define __DRI_ATTRIB_FLOAT_MODE 29
#define __DRI_ATTRIB_RED_MASK 30
#define __DRI_ATTRIB_GREEN_MASK 31
#define __DRI_ATTRIB_BLUE_MASK 32
#define __DRI_ATTRIB_ALPHA_MASK 33
#define __DRI_ATTRIB_MAX_PBUFFER_WIDTH 34
#define __DRI_ATTRIB_MAX_PBUFFER_HEIGHT 35
#define __DRI_ATTRIB_MAX_PBUFFER_PIXELS 36
#define __DRI_ATTRIB_OPTIMAL_PBUFFER_WIDTH 37
#define __DRI_ATTRIB_OPTIMAL_PBUFFER_HEIGHT 38
#define __DRI_ATTRIB_VISUAL_SELECT_GROUP 39
#define __DRI_ATTRIB_SWAP_METHOD 40
#define __DRI_ATTRIB_MAX_SWAP_INTERVAL 41
#define __DRI_ATTRIB_MIN_SWAP_INTERVAL 42
#define __DRI_ATTRIB_BIND_TO_TEXTURE_RGB 43
#define __DRI_ATTRIB_BIND_TO_TEXTURE_RGBA 44
#define __DRI_ATTRIB_BIND_TO_MIPMAP_TEXTURE 45
#define __DRI_ATTRIB_BIND_TO_TEXTURE_TARGETS 46
#define __DRI_ATTRIB_YINVERTED 47
/* __DRI_ATTRIB_RENDER_TYPE */
#define __DRI_ATTRIB_RGBA_BIT 0x01
#define __DRI_ATTRIB_COLOR_INDEX_BIT 0x02
#define __DRI_ATTRIB_LUMINANCE_BIT 0x04
/* __DRI_ATTRIB_CONFIG_CAVEAT */
#define __DRI_ATTRIB_SLOW_BIT 0x01
#define __DRI_ATTRIB_NON_CONFORMANT_CONFIG 0x02
/* __DRI_ATTRIB_TRANSPARENT_TYPE */
#define __DRI_ATTRIB_TRANSPARENT_RGB 0x00
#define __DRI_ATTRIB_TRANSPARENT_INDEX 0x01
/* __DRI_ATTRIB_BIND_TO_TEXTURE_TARGETS */
#define __DRI_ATTRIB_TEXTURE_1D_BIT 0x01
#define __DRI_ATTRIB_TEXTURE_2D_BIT 0x02
#define __DRI_ATTRIB_TEXTURE_RECTANGLE_BIT 0x04
/**
* This extension defines the core DRI functionality.
*/
#define __DRI_CORE "DRI_Core"
#define __DRI_CORE_VERSION 1
struct __DRIcoreExtensionRec {
__DRIextension base;
__DRIscreen *(*createNewScreen)(int screen, int fd,
unsigned int sarea_handle,
const __DRIextension **extensions,
const __DRIconfig ***driverConfigs,
void *loaderPrivate);
void (*destroyScreen)(__DRIscreen *screen);
const __DRIextension **(*getExtensions)(__DRIscreen *screen);
int (*getConfigAttrib)(const __DRIconfig *config,
unsigned int attrib,
unsigned int *value);
int (*indexConfigAttrib)(const __DRIconfig *config, int index,
unsigned int *attrib, unsigned int *value);
__DRIdrawable *(*createNewDrawable)(__DRIscreen *screen,
const __DRIconfig *config,
unsigned int drawable_id,
unsigned int head,
void *loaderPrivate);
void (*destroyDrawable)(__DRIdrawable *drawable);
void (*swapBuffers)(__DRIdrawable *drawable);
__DRIcontext *(*createNewContext)(__DRIscreen *screen,
const __DRIconfig *config,
__DRIcontext *shared,
void *loaderPrivate);
int (*copyContext)(__DRIcontext *dest,
__DRIcontext *src,
unsigned long mask);
void (*destroyContext)(__DRIcontext *context);
int (*bindContext)(__DRIcontext *ctx,
__DRIdrawable *pdraw,
__DRIdrawable *pread);
int (*unbindContext)(__DRIcontext *ctx);
};
/**
* Stored version of some component (i.e., server-side DRI module, kernel-side
@@ -542,6 +133,133 @@ struct __DRIversionRec {
int patch; /**< Patch-level. */
};
typedef void (*__DRIfuncPtr)(void);
struct __DRIinterfaceMethodsRec {
/**
* Get pointer to named function.
*/
__DRIfuncPtr (*getProcAddress)( const char * proc_name );
/**
* Create a list of \c __GLcontextModes structures.
*/
__GLcontextModes * (*createContextModes)(unsigned count,
size_t minimum_bytes_per_struct);
/**
* Destroy a list of \c __GLcontextModes structures.
*
* \todo
* Determine if the drivers actually need to call this.
*/
void (*destroyContextModes)( __GLcontextModes * modes );
/**
* Get the \c __DRIscreen for a given display and screen number.
*/
__DRIscreen *(*getScreen)(__DRInativeDisplay *dpy, int screenNum);
/**
* \name Client/server protocol functions.
*
* These functions implement the DRI client/server protocol for
* context and drawable operations. Platforms that do not implement
* the wire protocol (e.g., EGL) will implement glorified no-op functions.
*/
/*@{*/
/**
* Determine if the specified window ID still exists.
*
* \note
* Implementations may assume that the driver will only pass an ID into
* this function that actually corresponds to a window. On
* implementations where windows can only be destroyed by the DRI driver
* (e.g., EGL), this function is allowed to always return \c GL_TRUE.
*/
GLboolean (*windowExists)(__DRInativeDisplay *dpy, __DRIid draw);
/**
* Create the server-side portion of the GL context.
*/
GLboolean (* createContext)( __DRInativeDisplay *dpy, int screenNum,
int configID, void * contextID, drm_context_t * hw_context );
/**
* Destroy the server-side portion of the GL context.
*/
GLboolean (* destroyContext)( __DRInativeDisplay *dpy, int screenNum,
__DRIid context );
/**
* Create the server-side portion of the drawable.
*/
GLboolean (*createDrawable)( __DRInativeDisplay * ndpy, int screen,
__DRIid drawable, drm_drawable_t * hHWDrawable );
/**
* Destroy the server-side portion of the drawable.
*/
GLboolean (*destroyDrawable)( __DRInativeDisplay * ndpy, int screen,
__DRIid drawable );
/**
* This function is used to get information about the position, size, and
* clip rects of a drawable.
*/
GLboolean (* getDrawableInfo) ( __DRInativeDisplay *dpy, int scrn,
__DRIid draw, unsigned int * index, unsigned int * stamp,
int * x, int * y, int * width, int * height,
int * numClipRects, drm_clip_rect_t ** pClipRects,
int * backX, int * backY,
int * numBackClipRects, drm_clip_rect_t ** pBackClipRects );
/*@}*/
/**
* \name Timing related functions.
*/
/*@{*/
/**
* Get the 64-bit unadjusted system time (UST).
*/
int (*getUST)(int64_t * ust);
/**
* Get the media stream counter (MSC) rate.
*
* Matching the definition in GLX_OML_sync_control, this function returns
* the rate of the "media stream counter". In practical terms, this is
* the frame refresh rate of the display.
*/
GLboolean (*getMSCRate)(__DRInativeDisplay * dpy, __DRIid drawable,
int32_t * numerator, int32_t * denominator);
/*@}*/
/**
* Reports areas of the given drawable which have been modified by the
* driver.
*
* \param drawable which the drawing was done to.
* \param rects rectangles affected, with the drawable origin as the
* origin.
* \param x X offset of the drawable within the screen (used in the
* front_buffer case)
* \param y Y offset of the drawable within the screen.
* \param front_buffer boolean flag for whether the drawing to the
* drawable was actually done directly to the front buffer (instead
* of backing storage, for example)
*/
void (*reportDamage)(__DRInativeDisplay * dpy, int screen,
__DRIid drawable,
int x, int y,
drm_clip_rect_t *rects, int num_rects,
int front_buffer);
};
/**
* Framebuffer information record. Used by libGL to communicate information
* about the framebuffer to the driver's \c __driCreateNewScreen function.
@@ -571,59 +289,229 @@ struct __DRIframebufferRec {
/**
* This extension provides alternative screen, drawable and context
* constructors for legacy DRI functionality. This is used in
* conjunction with the core extension.
* Screen dependent methods. This structure is initialized during the
* \c __DRIdisplayRec::createScreen call.
*/
#define __DRI_LEGACY "DRI_Legacy"
#define __DRI_LEGACY_VERSION 1
struct __DRIscreenRec {
/**
* Method to destroy the private DRI screen data.
*/
void (*destroyScreen)(__DRInativeDisplay *dpy, int scrn, void *screenPrivate);
struct __DRIlegacyExtensionRec {
__DRIextension base;
/**
* Method to create the private DRI drawable data and initialize the
* drawable dependent methods.
*/
void *(*createNewDrawable)(__DRInativeDisplay *dpy, const __GLcontextModes *modes,
__DRIid draw, __DRIdrawable *pdraw,
int renderType, const int *attrs);
__DRIscreen *(*createNewScreen)(int screen,
const __DRIversion *ddx_version,
const __DRIversion *dri_version,
const __DRIversion *drm_version,
const __DRIframebuffer *frame_buffer,
void *pSAREA, int fd,
const __DRIextension **extensions,
const __DRIconfig ***driver_configs,
void *loaderPrivate);
/**
* Method to return a pointer to the DRI drawable data.
*/
__DRIdrawable *(*getDrawable)(__DRInativeDisplay *dpy, __DRIid draw,
void *drawablePrivate);
__DRIdrawable *(*createNewDrawable)(__DRIscreen *screen,
const __DRIconfig *config,
drm_drawable_t hwDrawable,
int renderType, const int *attrs,
void *loaderPrivate);
/**
* Opaque pointer to private per screen direct rendering data. \c NULL
* if direct rendering is not supported on this screen. Never
* dereferenced in libGL.
*/
void *private;
__DRIcontext *(*createNewContext)(__DRIscreen *screen,
const __DRIconfig *config,
int render_type,
__DRIcontext *shared,
drm_context_t hwContext,
void *loaderPrivate);
/**
* Get the number of vertical refreshes since some point in time before
* this function was first called (i.e., system start up).
*
* \since Internal API version 20030317.
*/
int (*getMSC)( void *screenPrivate, int64_t *msc );
/**
* Opaque pointer that points back to the containing
* \c __GLXscreenConfigs. This data structure is shared with DRI drivers
* but \c __GLXscreenConfigs is not. However, they are needed by some GLX
* functions called by DRI drivers.
*
* \since Internal API version 20030813.
*/
void *screenConfigs;
/**
* Functions associated with MESA_allocate_memory.
*
* \since Internal API version 20030815.
*/
/*@{*/
void *(*allocateMemory)(__DRInativeDisplay *dpy, int scrn, GLsizei size,
GLfloat readfreq, GLfloat writefreq,
GLfloat priority);
void (*freeMemory)(__DRInativeDisplay *dpy, int scrn, GLvoid *pointer);
GLuint (*memoryOffset)(__DRInativeDisplay *dpy, int scrn, const GLvoid *pointer);
/*@}*/
/**
* Method to create the private DRI context data and initialize the
* context dependent methods.
*
* \since Internal API version 20031201.
*/
void * (*createNewContext)(__DRInativeDisplay *dpy, const __GLcontextModes *modes,
int render_type,
void *sharedPrivate, __DRIcontext *pctx);
/**
* Method to override base texture image with a driver specific 'offset'.
* The depth passed in allows e.g. to ignore the alpha channel of texture
* images where the non-alpha components don't occupy a whole texel.
*
* For GLX_EXT_texture_from_pixmap with AIGLX.
*
* \since Internal API version 20070121.
*/
void (*setTexOffset)(__DRIcontext *pDRICtx, GLint texname,
unsigned long long offset, GLint depth, GLuint pitch);
};
/**
* This extension provides alternative screen, drawable and context
* constructors for swrast DRI functionality. This is used in
* conjunction with the core extension.
* Context dependent methods. This structure is initialized during the
* \c __DRIscreenRec::createContext call.
*/
#define __DRI_SWRAST "DRI_SWRast"
#define __DRI_SWRAST_VERSION 1
struct __DRIcontextRec {
/**
* Method to destroy the private DRI context data.
*/
void (*destroyContext)(__DRInativeDisplay *dpy, int scrn, void *contextPrivate);
struct __DRIswrastExtensionRec {
__DRIextension base;
/**
* Opaque pointer to private per context direct rendering data.
* \c NULL if direct rendering is not supported on the display or
* screen used to create this context. Never dereferenced in libGL.
*/
void *private;
__DRIscreen *(*createNewScreen)(int screen,
const __DRIextension **extensions,
const __DRIconfig ***driver_configs,
void *loaderPrivate);
/**
* Pointer to the mode used to create this context.
*
* \since Internal API version 20040317.
*/
const __GLcontextModes * mode;
__DRIdrawable *(*createNewDrawable)(__DRIscreen *screen,
const __DRIconfig *config,
void *loaderPrivate);
/**
* Method to bind a DRI drawable to a DRI graphics context.
*
* \since Internal API version 20050727.
*/
GLboolean (*bindContext)(__DRInativeDisplay *dpy, int scrn, __DRIid draw,
__DRIid read, __DRIcontext *ctx);
/**
* Method to unbind a DRI drawable from a DRI graphics context.
*
* \since Internal API version 20050727.
*/
GLboolean (*unbindContext)(__DRInativeDisplay *dpy, int scrn, __DRIid draw,
__DRIid read, __DRIcontext *ctx);
};
/**
* Drawable dependent methods. This structure is initialized during the
* \c __DRIscreenRec::createDrawable call. \c createDrawable is not called
* by libGL at this time. It's currently used via the dri_util.c utility code
* instead.
*/
struct __DRIdrawableRec {
/**
* Method to destroy the private DRI drawable data.
*/
void (*destroyDrawable)(__DRInativeDisplay *dpy, void *drawablePrivate);
/**
* Method to swap the front and back buffers.
*/
void (*swapBuffers)(__DRInativeDisplay *dpy, void *drawablePrivate);
/**
* Opaque pointer to private per drawable direct rendering data.
* \c NULL if direct rendering is not supported on the display or
* screen used to create this drawable. Never dereferenced in libGL.
*/
void *private;
/**
* Get the number of completed swap buffers for this drawable.
*
* \since Internal API version 20030317.
*/
int (*getSBC)(__DRInativeDisplay *dpy, void *drawablePrivate, int64_t *sbc );
/**
* Wait for the SBC to be greater than or equal target_sbc.
*
* \since Internal API version 20030317.
*/
int (*waitForSBC)( __DRInativeDisplay * dpy, void *drawablePriv,
int64_t target_sbc,
int64_t * msc, int64_t * sbc );
/**
* Wait for the MSC to equal target_msc, or, if that has already passed,
* the next time (MSC % divisor) is equal to remainder. If divisor is
* zero, the function will return as soon as MSC is greater than or equal
* to target_msc.
*
* \since Internal API version 20030317.
*/
int (*waitForMSC)( __DRInativeDisplay * dpy, void *drawablePriv,
int64_t target_msc, int64_t divisor, int64_t remainder,
int64_t * msc, int64_t * sbc );
/**
* Like \c swapBuffers, but does NOT have an implicit \c glFlush. Once
* rendering is complete, waits until MSC is equal to target_msc, or
* if that has already passed, waits until (MSC % divisor) is equal
* to remainder. If divisor is zero, the swap will happen as soon as
* MSC is greater than or equal to target_msc.
*
* \since Internal API version 20030317.
*/
int64_t (*swapBuffersMSC)(__DRInativeDisplay *dpy, void *drawablePrivate,
int64_t target_msc,
int64_t divisor, int64_t remainder);
/**
* Enable or disable frame usage tracking.
*
* \since Internal API version 20030317.
*/
int (*frameTracking)(__DRInativeDisplay *dpy, void *drawablePrivate, GLboolean enable);
/**
* Retrieve frame usage information.
*
* \since Internal API version 20030317.
*/
int (*queryFrameTracking)(__DRInativeDisplay *dpy, void *drawablePrivate,
int64_t * sbc, int64_t * missedFrames,
float * lastMissedUsage, float * usage );
/**
* Used by drivers that implement the GLX_SGI_swap_control or
* GLX_MESA_swap_control extension.
*
* \since Internal API version 20030317.
*/
unsigned swap_interval;
/**
* Used by drivers that implement the GLX_MESA_copy_sub_buffer extension.
*
* \since Internal API version 20060314.
*/
void (*copySubBuffer)(__DRInativeDisplay *dpy, void *drawablePrivate,
int x, int y, int w, int h);
};
#endif

View File

@@ -1,134 +0,0 @@
/*
* Copyright 2007 Red Hat, Inc
* All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* on the rights to use, copy, modify, merge, publish, distribute, sub
* license, and/or sell copies of the Software, and to permit persons to whom
* the Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
* THE COPYRIGHT HOLDERS AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
* USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef DRI_SAREA_H
#define DRI_SAREA_H
#include <drm.h>
/* The DRI2 SAREA holds a list of self-describing blocks. Each block
* is 8 byte aligned and has a common 32-bit header word. The upper
* 16 bits describe the type of the block and the lower 16 bits the
* size. DRI2 only defines a couple of blocks and allows drivers to
* define driver specific blocks using type codes from 0x8000 and up.
* The type code 0x0000 defines the end of the sarea. */
#define DRI2_SAREA_BLOCK_HEADER(type, size) (((type) << 16) | (size))
#define DRI2_SAREA_BLOCK_TYPE(b) ((b) >> 16)
#define DRI2_SAREA_BLOCK_SIZE(b) ((b) & 0xffff)
#define DRI2_SAREA_BLOCK_NEXT(p) \
((void *) ((unsigned char *) (p) + \
DRI2_SAREA_BLOCK_SIZE(*(unsigned int *) p)))
#define DRI2_SAREA_BLOCK_END 0x0000
#define DRI2_SAREA_BLOCK_LOCK 0x0001
#define DRI2_SAREA_BLOCK_EVENT_BUFFER 0x0002
/* Chipset specific blocks start at 0x8000, 0xffff is reserved. */
typedef struct __DRILock __DRILock;
typedef struct __DRIEventBuffer __DRIEventBuffer;
typedef struct __DRIDrawableBuffer __DRIDrawableBuffer;
typedef struct __DRIDrawableConfigEvent __DRIDrawableConfigEvent;
typedef struct __DRIBufferAttachEvent __DRIBufferAttachEvent;
struct __DRILock {
unsigned int block_header;
drm_hw_lock_t lock;
/* We use this with DRM_CAS to allocate lock IDs for the real lock.*/
unsigned int next_id;
};
struct __DRIEventBuffer {
unsigned int block_header;
unsigned int head; /* last valid event */
unsigned int prealloc; /* event currently being written */
unsigned int size; /* size of data */
unsigned char data[0];
};
enum {
/* the four standard color buffers */
DRI_DRAWABLE_BUFFER_FRONT_LEFT = 0,
DRI_DRAWABLE_BUFFER_BACK_LEFT = 1,
DRI_DRAWABLE_BUFFER_FRONT_RIGHT = 2,
DRI_DRAWABLE_BUFFER_BACK_RIGHT = 3,
/* optional aux buffer */
DRI_DRAWABLE_BUFFER_AUX0 = 4,
DRI_DRAWABLE_BUFFER_AUX1 = 5,
DRI_DRAWABLE_BUFFER_AUX2 = 6,
DRI_DRAWABLE_BUFFER_AUX3 = 7,
DRI_DRAWABLE_BUFFER_DEPTH = 8,
DRI_DRAWABLE_BUFFER_STENCIL = 9,
DRI_DRAWABLE_BUFFER_ACCUM = 10,
/* generic renderbuffers */
DRI_DRAWABLE_BUFFER_COLOR0 = 11,
DRI_DRAWABLE_BUFFER_COLOR1 = 12,
DRI_DRAWABLE_BUFFER_COLOR2 = 13,
DRI_DRAWABLE_BUFFER_COLOR3 = 14,
DRI_DRAWABLE_BUFFER_COLOR4 = 15,
DRI_DRAWABLE_BUFFER_COLOR5 = 16,
DRI_DRAWABLE_BUFFER_COLOR6 = 17,
DRI_DRAWABLE_BUFFER_COLOR7 = 18,
DRI_DRAWABLE_BUFFER_COUNT = 19
};
struct __DRIDrawableBuffer {
unsigned int attachment;
unsigned int handle;
unsigned int pitch;
unsigned short cpp;
/* Upper 8 bits are driver specific, lower 8 bits generic. The
* bits can inidicate buffer properties such as tiled, swizzled etc. */
unsigned short flags;
};
#define DRI2_EVENT_HEADER(type, size) (((type) << 16) | (size))
#define DRI2_EVENT_TYPE(b) ((b) >> 16)
#define DRI2_EVENT_SIZE(b) ((b) & 0xffff)
#define DRI2_EVENT_PAD 0x0000
#define DRI2_EVENT_DRAWABLE_CONFIG 0x0001
#define DRI2_EVENT_BUFFER_ATTACH 0x0002
struct __DRIDrawableConfigEvent {
unsigned int event_header;
unsigned int drawable;
short x;
short y;
unsigned int width;
unsigned int height;
unsigned int num_rects;
struct drm_clip_rect rects[0];
};
struct __DRIBufferAttachEvent {
unsigned int event_header;
unsigned int drawable;
__DRIDrawableBuffer buffer;
};
#endif /* DRI_SAREA_H */

View File

@@ -41,7 +41,6 @@
#define GL_CORE_SGI 1
#define GL_CORE_MESA 2
#define GL_CORE_APPLE 4
#define GL_CORE_WINDOWS 8
typedef struct __GLcontextRec __GLcontext;

View File

@@ -1,79 +1,79 @@
/****************************************************************************
*
* Mesa bindings for SciTech MGL
*
* Copyright (C) 1996 SciTech Software.
* All rights reserved.
*
* Filename: mglmesa.h
* Version: Revision: 1.1.1.1
*
* Language: ANSI C
* Environment: Any
*
* Description: Header file for the Mesa/OpenGL interface bindings for the
* SciTech MGL graphics library. Uses the MGL internal
* device context structures to get direct access to the
* high performance MGL rasterization functions for maximum
* performance. Utilizes the VESA VBE/AF Accelerator Functions
* via the MGL's accelerated device driver functions, as well
* as basic DirectDraw accelerated functions provided by the
* MGL.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*
****************************************************************************/
#ifndef __MGLMESA_H
#define __MGLMESA_H
#include "mgraph.h"
/*------------------------- Function Prototypes ---------------------------*/
#ifdef __cplusplus
extern "C" { /* Use "C" linkage when in C++ mode */
#endif
#ifndef __WINDOWS__
#define GLAPIENTRY
#endif
#ifdef __WINDOWS__
bool GLAPIENTRY MGLMesaInitDLL(MGLCallbacks *cb,char *version);
#endif
void GLAPIENTRY MGLMesaChooseVisual(MGLDC *dc,MGLVisual *visual);
bool GLAPIENTRY MGLMesaSetVisual(MGLDC *dc,MGLVisual *visual);
bool GLAPIENTRY MGLMesaCreateContext(MGLDC *dc,bool forceMemDC);
void GLAPIENTRY MGLMesaDestroyContext(MGLDC *dc);
void GLAPIENTRY MGLMesaMakeCurrent(MGLDC *dc);
void GLAPIENTRY MGLMesaSwapBuffers(MGLDC *dc,bool waitVRT);
/* Palette manipulation support. The reason we provide palette manipulation
* routines is so that when rendering in double buffered modes with a
* software backbuffer, the palette for the backbuffer is kept consistent
* with the hardware front buffer.
*/
void GLAPIENTRY MGLMesaSetPaletteEntry(MGLDC *dc,int entry,uchar red,uchar green,uchar blue);
void GLAPIENTRY MGLMesaSetPalette(MGLDC *dc,palette_t *pal,int numColors,int startIndex);
void GLAPIENTRY MGLMesaRealizePalette(MGLDC *dc,int numColors,int startIndex,int waitVRT);
#ifdef __cplusplus
} /* End of "C" linkage for C++ */
#endif /* __cplusplus */
#endif /* __MGLMESA_H */
/****************************************************************************
*
* Mesa bindings for SciTech MGL
*
* Copyright (C) 1996 SciTech Software.
* All rights reserved.
*
* Filename: mglmesa.h
* Version: Revision: 1.1.1.1
*
* Language: ANSI C
* Environment: Any
*
* Description: Header file for the Mesa/OpenGL interface bindings for the
* SciTech MGL graphics library. Uses the MGL internal
* device context structures to get direct access to the
* high performance MGL rasterization functions for maximum
* performance. Utilizes the VESA VBE/AF Accelerator Functions
* via the MGL's accelerated device driver functions, as well
* as basic DirectDraw accelerated functions provided by the
* MGL.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*
****************************************************************************/
#ifndef __MGLMESA_H
#define __MGLMESA_H
#include "mgraph.h"
/*------------------------- Function Prototypes ---------------------------*/
#ifdef __cplusplus
extern "C" { /* Use "C" linkage when in C++ mode */
#endif
#ifndef __WINDOWS__
#define GLAPIENTRY
#endif
#ifdef __WINDOWS__
bool GLAPIENTRY MGLMesaInitDLL(MGLCallbacks *cb,char *version);
#endif
void GLAPIENTRY MGLMesaChooseVisual(MGLDC *dc,MGLVisual *visual);
bool GLAPIENTRY MGLMesaSetVisual(MGLDC *dc,MGLVisual *visual);
bool GLAPIENTRY MGLMesaCreateContext(MGLDC *dc,bool forceMemDC);
void GLAPIENTRY MGLMesaDestroyContext(MGLDC *dc);
void GLAPIENTRY MGLMesaMakeCurrent(MGLDC *dc);
void GLAPIENTRY MGLMesaSwapBuffers(MGLDC *dc,bool waitVRT);
/* Palette manipulation support. The reason we provide palette manipulation
* routines is so that when rendering in double buffered modes with a
* software backbuffer, the palette for the backbuffer is kept consistent
* with the hardware front buffer.
*/
void GLAPIENTRY MGLMesaSetPaletteEntry(MGLDC *dc,int entry,uchar red,uchar green,uchar blue);
void GLAPIENTRY MGLMesaSetPalette(MGLDC *dc,palette_t *pal,int numColors,int startIndex);
void GLAPIENTRY MGLMesaRealizePalette(MGLDC *dc,int numColors,int startIndex,int waitVRT);
#ifdef __cplusplus
} /* End of "C" linkage for C++ */
#endif /* __cplusplus */
#endif /* __MGLMESA_H */

View File

@@ -130,7 +130,7 @@ extern void WMesaPaletteChange(HPALETTE Pal);
extern void WMesaMove(void);
void WMesaShareLists(WMesaContext ctx_to_share, WMesaContext ctx);
#ifdef __cplusplus
}

View File

@@ -1,8 +1,8 @@
/*
* Mesa 3-D graphics library
* Version: 7.1
* Version: 4.1
*
* Copyright (C) 1999-2007 Brian Paul All Rights Reserved.
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -397,25 +397,6 @@ extern XMesaBuffer XMesaCreatePBuffer(XMesaVisual v, XMesaColormap cmap,
/*
* Texture from Pixmap
* New in Mesa 7.1
*/
extern void
XMesaBindTexImage(XMesaDisplay *dpy, XMesaBuffer drawable, int buffer,
const int *attrib_list);
extern void
XMesaReleaseTexImage(XMesaDisplay *dpy, XMesaBuffer drawable, int buffer);
extern XMesaBuffer
XMesaCreatePixmapTextureBuffer(XMesaVisual v, XMesaPixmap p,
XMesaColormap cmap,
int format, int target, int mipmap);
#ifdef __cplusplus
}
#endif

View File

@@ -66,7 +66,6 @@ typedef XColor XMesaColor;
#define XMesaDrawPoints XDrawPoints
#define XMesaDrawLine XDrawLine
#define XMesaFillRectangle XFillRectangle
#define XMesaGetImage XGetImage
#define XMesaPutImage XPutImage
#define XMesaCopyArea XCopyArea

View File

@@ -39,19 +39,11 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#ifndef _XMESA_XF86_H_
#define _XMESA_XF86_H_
#include "GL/glxtokens.h"
#include "scrnintstr.h"
#include "pixmapstr.h"
#include "gcstruct.h"
#include "servermd.h"
typedef struct _XMesaImageRec {
int width, height;
char *data;
int bytes_per_line; /* Padded to 32 bits */
int bits_per_pixel;
} XMesaImage;
typedef struct _XMesaImageRec XMesaImage;
typedef ScreenRec XMesaDisplay;
typedef PixmapPtr XMesaPixmap;
@@ -128,26 +120,6 @@ do { \
(*__gc->ops->PolyFillRect)((DrawablePtr)__b, __gc, 1, __r); \
} while (0)
static _X_INLINE XMesaImage *XMesaGetImage(XMesaDisplay *dpy, PixmapPtr p, int x,
int y, unsigned int width,
unsigned int height,
unsigned long plane_mask, int format)
{
XMesaImage *img = Xcalloc(sizeof(*img));
img->width = p->drawable.width;
img->height = p->drawable.height;
img->bits_per_pixel = p->drawable.bitsPerPixel;
img->bytes_per_line = PixmapBytePad(width, p->drawable.depth);
img->data = malloc(height * img->bytes_per_line);
/* Assumes: Images are always in ZPixmap format */
(*p->drawable.pScreen->GetImage)(&p->drawable, x, y, width, height,
plane_mask, ZPixmap, img->data);
return img;
}
#define XMesaPutImage(__d,__b,__gc,__i,__sx,__sy,__x,__y,__w,__h) \
do { \
/* Assumes: Images are always in ZPixmap format */ \
@@ -169,13 +141,8 @@ do { \
/* CreatePixmap returns a PixmapPtr; so, it cannot be inside braces */
#ifdef CREATE_PIXMAP_USAGE_SCRATCH
#define XMesaCreatePixmap(__d,__b,__w,__h,__depth) \
(*__d->CreatePixmap)(__d, __w, __h, __depth, 0)
#else
#define XMesaCreatePixmap(__d,__b,__w,__h,__depth) \
(*__d->CreatePixmap)(__d, __w, __h, __depth)
#endif
#define XMesaFreePixmap(__d,__b) \
(*__d->DestroyPixmap)(__b)

View File

@@ -25,7 +25,7 @@ subdirs:
install:
clean:
-@for dir in $(SUBDIRS) tests ; do \
@for dir in $(SUBDIRS) tests ; do \
if [ -d $$dir ] ; then \
(cd $$dir && $(MAKE) clean) ; \
fi \

View File

@@ -19,8 +19,8 @@ INCLUDES = -I. -I- -I../../include
default: demo sample GLInfo
clean:
-rm -f demo sample GLInfo
-rm -f *.o
rm -f demo sample GLInfo
rm -f *.o
demo: demo.o
$(LD) demo.o $(LDFLAGS) $(LIBS) -o $@

View File

@@ -32,7 +32,6 @@ osdemo
paltex
pixeltex
pointblast
rain
ray
readpix
readtex.c

View File

@@ -11,11 +11,9 @@ OSMESA16_LIBS = -L$(TOP)/$(LIB_DIR) -lglut -lOSMesa16 -lGLU -lGL $(APP_LIB_DEPS)
OSMESA32_LIBS = -L$(TOP)/$(LIB_DIR) -lglut -lOSMesa32 -lGLU -lGL $(APP_LIB_DEPS)
LIB_DEP = $(TOP)/$(LIB_DIR)/$(GL_LIB_NAME) $(TOP)/$(LIB_DIR)/$(GLU_LIB_NAME) \
$(TOP)/$(LIB_DIR)/$(GLUT_LIB_NAME)
LIB_DEP = $(TOP)/$(LIB_DIR)/$(GL_LIB_NAME) $(TOP)/$(LIB_DIR)/$(GLU_LIB_NAME) $(TOP)/$(LIB_DIR)/$(GLUT_LIB_NAME)
LIBS = -L$(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) \
$(APP_LIB_DEPS)
LIBS = -L$(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) $(APP_LIB_DEPS)
PROGS = \
arbfplight \
@@ -23,7 +21,6 @@ PROGS = \
arbocclude \
bounce \
clearspd \
copypix \
cubemap \
drawpix \
engine \
@@ -47,7 +44,6 @@ PROGS = \
multiarb \
paltex \
pointblast \
rain \
ray \
readpix \
reflect \
@@ -76,7 +72,7 @@ PROGS = \
.SUFFIXES:
.SUFFIXES: .c
.SUFFIXES: .cxx
# make executable from .c file:
.c: $(LIB_DEP) readtex.o
@@ -157,18 +153,6 @@ fslight: fslight.o
fslight.o: fslight.c extfuncs.h
$(CC) -c -I$(INCDIR) $(CFLAGS) fslight.c
rain: particles.o rain.o readtex.o
$(CXX) $(LDFLAGS) $^ $(LIBS) -o $@
rain.o: rain.cxx readtex.h
$(CXX) -c -I$(INCDIR) $(CXXFLAGS) $<
particles.o: particles.cxx
$(CXX) -c -I$(INCDIR) $(CXXFLAGS) $<
viewdds: viewdds.c
$(CC) -I$(INCDIR) $(CFLAGS) $< readtex.o $(LIBS) -L. -lgltc -o $@
clean:

View File

@@ -1,248 +0,0 @@
/**
* glCopyPixels test
*
* Brian Paul
* 14 Sep 2007
*/
#define GL_GLEXT_PROTOTYPES
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <GL/glut.h>
#include "readtex.h"
#define IMAGE_FILE "../images/arch.rgb"
static int ImgWidth, ImgHeight;
static GLenum ImgFormat;
static GLubyte *Image = NULL;
static int WinWidth = 800, WinHeight = 800;
static int Xpos, Ypos;
static int Scissor = 0;
static float Xzoom, Yzoom;
static GLboolean DrawFront = GL_FALSE;
static GLboolean Dither = GL_TRUE;
static void Reset( void )
{
Xpos = Ypos = 20;
Scissor = 0;
Xzoom = Yzoom = 1.0;
}
static void Display( void )
{
const int dx = (WinWidth - ImgWidth) / 2;
const int dy = (WinHeight - ImgHeight) / 2;
if (DrawFront) {
glDrawBuffer(GL_FRONT);
glReadBuffer(GL_FRONT);
}
else {
glDrawBuffer(GL_BACK);
glReadBuffer(GL_BACK);
}
glClear( GL_COLOR_BUFFER_BIT );
/* draw original image */
glWindowPos2iARB(dx, dy);
glDrawPixels(ImgWidth, ImgHeight, ImgFormat, GL_UNSIGNED_BYTE, Image);
if (Scissor)
glEnable(GL_SCISSOR_TEST);
/* draw copy */
glPixelZoom(Xzoom, Yzoom);
glWindowPos2iARB(Xpos, Ypos);
glCopyPixels(dx, dy, ImgWidth, ImgHeight, GL_COLOR);
glPixelZoom(1, 1);
glDisable(GL_SCISSOR_TEST);
if (DrawFront)
glFinish();
else
glutSwapBuffers();
}
static void Reshape( int width, int height )
{
WinWidth = width;
WinHeight = height;
glViewport( 0, 0, width, height );
glMatrixMode( GL_PROJECTION );
glLoadIdentity();
glOrtho( 0.0, width, 0.0, height, 0.0, 2.0 );
glMatrixMode( GL_MODELVIEW );
glLoadIdentity();
glScissor(width/4, height/4, width/2, height/2);
}
static void Key( unsigned char key, int x, int y )
{
(void) x;
(void) y;
switch (key) {
case ' ':
Reset();
break;
case 'd':
Dither = !Dither;
if (Dither)
glEnable(GL_DITHER);
else
glDisable(GL_DITHER);
break;
case 's':
Scissor = !Scissor;
break;
case 'x':
Xzoom -= 0.1;
break;
case 'X':
Xzoom += 0.1;
break;
case 'y':
Yzoom -= 0.1;
break;
case 'Y':
Yzoom += 0.1;
break;
case 'f':
DrawFront = !DrawFront;
printf("glDrawBuffer(%s)\n", DrawFront ? "GL_FRONT" : "GL_BACK");
break;
case 27:
exit(0);
break;
}
glutPostRedisplay();
}
static void SpecialKey( int key, int x, int y )
{
const int step = (glutGetModifiers() & GLUT_ACTIVE_SHIFT) ? 10 : 1;
(void) x;
(void) y;
switch (key) {
case GLUT_KEY_UP:
Ypos += step;
break;
case GLUT_KEY_DOWN:
Ypos -= step;
break;
case GLUT_KEY_LEFT:
Xpos -= step;
break;
case GLUT_KEY_RIGHT:
Xpos += step;
break;
}
glutPostRedisplay();
}
static void Init( GLboolean ciMode, const char *filename )
{
printf("GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
Image = LoadRGBImage( filename, &ImgWidth, &ImgHeight, &ImgFormat );
if (!Image) {
printf("Couldn't read %s\n", filename);
exit(0);
}
if (ciMode) {
/* Convert RGB image to grayscale */
GLubyte *indexImage = (GLubyte *) malloc( ImgWidth * ImgHeight );
GLint i;
for (i=0; i<ImgWidth*ImgHeight; i++) {
int gray = Image[i*3] + Image[i*3+1] + Image[i*3+2];
indexImage[i] = gray / 3;
}
free(Image);
Image = indexImage;
ImgFormat = GL_COLOR_INDEX;
for (i=0;i<255;i++) {
float g = i / 255.0;
glutSetColor(i, g, g, g);
}
}
printf("Loaded %d by %d image\n", ImgWidth, ImgHeight );
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
glPixelStorei(GL_UNPACK_ROW_LENGTH, ImgWidth);
Reset();
}
static void Usage(void)
{
printf("Keys:\n");
printf(" SPACE Reset Parameters\n");
printf(" Up/Down Move image up/down (SHIFT for large step)\n");
printf(" Left/Right Move image left/right (SHIFT for large step)\n");
printf(" x Decrease X-axis PixelZoom\n");
printf(" X Increase X-axis PixelZoom\n");
printf(" y Decrease Y-axis PixelZoom\n");
printf(" Y Increase Y-axis PixelZoom\n");
printf(" s Toggle GL_SCISSOR_TEST\n");
printf(" f Toggle front/back buffer drawing\n");
printf(" ESC Exit\n");
}
int main( int argc, char *argv[] )
{
GLboolean ciMode = GL_FALSE;
const char *filename = IMAGE_FILE;
int i = 1;
if (argc > i && strcmp(argv[i], "-ci")==0) {
ciMode = GL_TRUE;
i++;
}
if (argc > i) {
filename = argv[i];
}
glutInit( &argc, argv );
glutInitWindowPosition( 0, 0 );
glutInitWindowSize( WinWidth, WinHeight );
if (ciMode)
glutInitDisplayMode( GLUT_INDEX | GLUT_DOUBLE );
else
glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE);
glutCreateWindow(argv[0]);
Init(ciMode, filename);
Usage();
glutReshapeFunc( Reshape );
glutKeyboardFunc( Key );
glutSpecialFunc( SpecialKey );
glutDisplayFunc( Display );
glutMainLoop();
return 0;
}

View File

@@ -47,8 +47,6 @@ static GLfloat Xrot = 0, Yrot = 0;
static GLfloat EyeDist = 10;
static GLboolean use_vertex_arrays = GL_FALSE;
static GLboolean anim = GL_TRUE;
static GLboolean NoClear = GL_FALSE;
static GLint FrameParity = 0;
#define eps1 0.99
#define br 20.0 /* box radius */
@@ -158,30 +156,7 @@ static void draw_skybox( void )
static void draw( void )
{
if (NoClear) {
/* This demonstrates how we can avoid calling glClear.
* This method only works if every pixel in the window is painted for
* every frame.
* We can simply skip clearing of the color buffer in this case.
* For the depth buffer, we alternately use a different subrange of
* the depth buffer for each frame. For the odd frame use the range
* [0, 0.5] with GL_LESS. For the even frames, use the range [1, 0.5]
* with GL_GREATER.
*/
FrameParity = 1 - FrameParity;
if (FrameParity) {
glDepthRange(0.0, 0.5);
glDepthFunc(GL_LESS);
}
else {
glDepthRange(1.0, 0.5);
glDepthFunc(GL_GREATER);
}
}
else {
/* ordinary clearing */
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
}
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glPushMatrix(); /*MODELVIEW*/
glTranslatef( 0.0, 0.0, -EyeDist );
@@ -477,24 +452,6 @@ static void usage(void)
}
static void parse_args(int argc, char *argv[])
{
int initFlag = 0;
int i;
for (i = 1; i < argc; i++) {
if (strcmp(argv[i], "-i") == 0)
initFlag = 1;
else if (strcmp(argv[i], "--noclear") == 0)
NoClear = GL_TRUE;
else {
fprintf(stderr, "Bad option: %s\n", argv[i]);
exit(1);
}
}
init (initFlag);
}
int main( int argc, char *argv[] )
{
glutInit(&argc, argv);
@@ -502,13 +459,17 @@ int main( int argc, char *argv[] )
glutInitWindowSize(600, 500);
glutInitDisplayMode( GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE );
glutCreateWindow("Texture Cube Mapping");
if (argc > 1 && strcmp(argv[1] , "-i") == 0)
init( 1 );
else
init( 0 );
glutReshapeFunc( reshape );
glutKeyboardFunc( key );
glutSpecialFunc( specialkey );
glutDisplayFunc( draw );
if (anim)
glutIdleFunc(idle);
parse_args(argc, argv);
usage();
glutMainLoop();
return 0;

View File

@@ -1,6 +1,6 @@
# Makefile for GLUT-based demo programs for VMS
# contributed by Jouk Jansen joukj@hrem.nano.tudelft.nl
# Last update : 30 November 2007
# contributed by Jouk Jansen joukj@hrem.stm.tudelft.nl
# Last update : 20 May 2005
.first
define gl [--.include.gl]
@@ -21,10 +21,10 @@ LIB_DEP = [--.lib]$(GL_LIB) [--.lib]$(GLU_LIB) [--.lib]$(GLUT_LIB)
.endif
PROGS = bounce.exe,clearspd.exe,drawpix.exe,gamma.exe,gears.exe,\
glinfo.exe,glutfx.exe,isosurf.exe,morph3d.exe,\
paltex.exe,pointblast.exe,reflect.exe,spectex.exe,stex3d.exe,\
tessdemo.exe,texcyl.exe,texobj.exe,trispd.exe,winpos.exe
PROGS = bounce.exe;,clearspd.exe;,drawpix.exe;,gamma.exe;,gears.exe;,\
glinfo.exe;,glutfx.exe;,isosurf.exe;,morph3d.exe;,\
paltex.exe;,pointblast.exe;,reflect.exe;,spectex.exe;,stex3d.exe;,\
tessdemo.exe;,texcyl.exe;,texobj.exe;,trispd.exe;,winpos.exe;
##### RULES #####
@@ -39,33 +39,33 @@ clean :
delete *.obj;*
realclean :
delete *.exe;*
delete $(PROGS)
delete *.obj;*
bounce.exe : bounce.obj $(LIB_DEP)
clearspd.exe : clearspd.obj $(LIB_DEP)
drawpix.exe : drawpix.obj $(LIB_DEP) [-.util]readtex.obj
bounce.exe; : bounce.obj $(LIB_DEP)
clearspd.exe; : clearspd.obj $(LIB_DEP)
drawpix.exe; : drawpix.obj $(LIB_DEP) [-.util]readtex.obj
cxxlink $(MMS$TARGET_NAME),[-.util]readtex.obj,$(GL_LIBS)
gamma.exe : gamma.obj $(LIB_DEP)
gears.exe : gears.obj $(LIB_DEP)
glinfo.exe : glinfo.obj $(LIB_DEP)
glutfx.exe : glutfx.obj $(LIB_DEP)
isosurf.exe : isosurf.obj $(LIB_DEP) [-.util]readtex.obj
gamma.exe; : gamma.obj $(LIB_DEP)
gears.exe; : gears.obj $(LIB_DEP)
glinfo.exe; : glinfo.obj $(LIB_DEP)
glutfx.exe; : glutfx.obj $(LIB_DEP)
isosurf.exe; : isosurf.obj $(LIB_DEP) [-.util]readtex.obj
cxxlink $(MMS$TARGET_NAME),[-.util]readtex.obj,$(GL_LIBS)
morph3d.exe : morph3d.obj $(LIB_DEP)
paltex.exe : paltex.obj $(LIB_DEP)
pointblast.exe : pointblast.obj $(LIB_DEP)
reflect.exe : reflect.obj [-.util]readtex.obj [-.util]showbuffer.obj\
morph3d.exe; : morph3d.obj $(LIB_DEP)
paltex.exe; : paltex.obj $(LIB_DEP)
pointblast.exe; : pointblast.obj $(LIB_DEP)
reflect.exe; : reflect.obj [-.util]readtex.obj [-.util]showbuffer.obj\
$(LIB_DEP)
cxxlink $(MMS$TARGET_NAME),[-.util]readtex,showbuffer,$(GL_LIBS)
spectex.exe : spectex.obj $(LIB_DEP)
stex3d.exe : stex3d.obj $(LIB_DEP)
tessdemo.exe : tessdemo.obj $(LIB_DEP)
texcyl.exe : texcyl.obj [-.util]readtex.obj $(LIB_DEP)
spectex.exe; : spectex.obj $(LIB_DEP)
stex3d.exe; : stex3d.obj $(LIB_DEP)
tessdemo.exe; : tessdemo.obj $(LIB_DEP)
texcyl.exe; : texcyl.obj [-.util]readtex.obj $(LIB_DEP)
cxxlink $(MMS$TARGET_NAME),[-.util]readtex.obj,$(GL_LIBS)
texobj.exe : texobj.obj $(LIB_DEP)
trispd.exe : trispd.obj $(LIB_DEP)
winpos.exe : winpos.obj [-.util]readtex.obj $(LIB_DEP)
texobj.exe; : texobj.obj $(LIB_DEP)
trispd.exe; : trispd.obj $(LIB_DEP)
winpos.exe; : winpos.obj [-.util]readtex.obj $(LIB_DEP)
cxxlink $(MMS$TARGET_NAME),[-.util]readtex.obj,$(GL_LIBS)

View File

@@ -445,8 +445,8 @@ DrawConnector(float length, float thickness,
for (i = 0; i <= 36; i++) {
const int j = i % 36;
glNormal3f(normals[j][0], normals[j][1], 0);
glVertex3f(points[j][0], points[j][1], z1);
glVertex3f(points[j][0], points[j][1], z0);
glVertex3f(points[j][0], points[j][1], z1);
}
glEnd();
}
@@ -745,7 +745,7 @@ DrawEngine(const Engine *eng, float crankAngle)
glTranslatef(0, 0, -0.5 * crankLen);
/* crankshaft */
glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, CrankshaftColor);
glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, CrankshaftColor);
glColor4fv(CrankshaftColor);
DrawPositionedCrankshaft(eng, crankAngle);
@@ -764,12 +764,12 @@ DrawEngine(const Engine *eng, float crankAngle)
rot += k * eng->V_Angle;
/* piston */
glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, PistonColor);
glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, PistonColor);
glColor4fv(PistonColor);
DrawPositionedPiston(eng, rot);
/* connecting rod */
glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, ConnRodColor);
glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, ConnRodColor);
glColor4fv(ConnRodColor);
DrawPositionedConnectingRod(eng, rot);
glPopMatrix();
@@ -784,7 +784,7 @@ DrawEngine(const Engine *eng, float crankAngle)
}
glEnable(GL_CULL_FACE);
glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, BlockColor);
glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, BlockColor);
glColor4fv(BlockColor);
if (eng->CrankList)
glCallList(eng->BlockList);
@@ -1254,7 +1254,6 @@ Init(void)
{
const GLfloat lightColor[4] = { 0.7, 0.7, 0.7, 1.0 };
const GLfloat specular[4] = { 0.8, 0.8, 0.8, 1.0 };
const GLfloat backColor[4] = { 1, 1, 0, 0 };
Q = gluNewQuadric();
gluQuadricNormals(Q, GLU_SMOOTH);
@@ -1266,14 +1265,10 @@ Init(void)
glEnable(GL_LIGHTING);
glEnable(GL_LIGHT0);
glLightfv(GL_LIGHT0, GL_DIFFUSE, lightColor);
glMaterialf(GL_FRONT, GL_SHININESS, 40);
glMaterialfv(GL_FRONT, GL_SPECULAR, specular);
glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, 40);
glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, specular);
glEnable(GL_NORMALIZE);
glMaterialfv(GL_BACK, GL_DIFFUSE, backColor);
#if 0
glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, 1);
#endif
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
InitViewInfo(&View);

View File

@@ -27,9 +27,6 @@ static GLint T0 = 0;
static GLint Frames = 0;
static GLint autoexit = 0;
static GLint win = 0;
static GLboolean Visible = GL_TRUE;
static GLboolean Animate = GL_TRUE;
static GLfloat viewDist = 40.0;
/**
@@ -182,9 +179,6 @@ draw(void)
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glPushMatrix();
glTranslatef(0.0, 0.0, -viewDist);
glRotatef(view_rotx, 1.0, 0.0, 0.0);
glRotatef(view_roty, 0.0, 1.0, 0.0);
glRotatef(view_rotz, 0.0, 0.0, 1.0);
@@ -246,15 +240,6 @@ idle(void)
glutPostRedisplay();
}
static void
update_idle_func(void)
{
if (Visible && Animate)
glutIdleFunc(idle);
else
glutIdleFunc(NULL);
}
/* change view angle, exit upon ESC */
/* ARGSUSED1 */
static void
@@ -267,16 +252,6 @@ key(unsigned char k, int x, int y)
case 'Z':
view_rotz -= 5.0;
break;
case 'd':
viewDist += 1.0;
break;
case 'D':
viewDist -= 1.0;
break;
case 'a':
Animate = !Animate;
update_idle_func();
break;
case 27: /* Escape */
cleanup();
exit(0);
@@ -320,8 +295,10 @@ reshape(int width, int height)
glViewport(0, 0, (GLint) width, (GLint) height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glFrustum(-1.0, 1.0, -h, h, 5.0, 200.0);
glFrustum(-1.0, 1.0, -h, h, 5.0, 60.0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glTranslatef(0.0, 0.0, -40.0);
}
static void
@@ -374,12 +351,13 @@ init(int argc, char *argv[])
}
}
static void
visible(int vis)
{
Visible = vis;
update_idle_func();
if (vis == GLUT_VISIBLE)
glutIdleFunc(idle);
else
glutIdleFunc(NULL);
}
int main(int argc, char *argv[])
@@ -397,7 +375,6 @@ int main(int argc, char *argv[])
glutKeyboardFunc(key);
glutSpecialFunc(special);
glutVisibilityFunc(visible);
update_idle_func();
glutMainLoop();
return 0; /* ANSI C requires main to return int. */

View File

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

0
progs/demos/glslnoise.c Normal file → Executable file
View File

View File

@@ -159,18 +159,6 @@ static void Key( unsigned char key, int x, int y )
case 'B':
Bias += 10;
break;
case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9':
Bias = 100.0 * (key - '0');
break;
case 27:
exit(0);
break;

View File

@@ -1,3 +1,4 @@
/*
* GL_ARB_multitexture demo
*
@@ -31,6 +32,7 @@ static GLint NumUnits = 1;
static GLboolean TexEnabled[8];
static GLfloat Drift = 0.0;
static GLfloat drift_increment = 0.005;
static GLfloat Xrot = 20.0, Yrot = 30.0, Zrot = 0.0;
@@ -39,7 +41,9 @@ static void Idle( void )
if (Animate) {
GLint i;
Drift = glutGet(GLUT_ELAPSED_TIME) * 0.001;
Drift += drift_increment;
if (Drift >= 1.0)
Drift = 0.0;
for (i = 0; i < NumUnits; i++) {
glActiveTextureARB(GL_TEXTURE0_ARB + i);
@@ -53,11 +57,10 @@ static void Idle( void )
glTranslatef(0.0, Drift, 0.0);
}
else {
float tx = 0.5, ty = 0.5;
glTranslatef(tx, ty, 0.0);
glTranslatef(0.5, 0.5, 0.0);
glRotatef(180.0 * Drift, 0, 0, 1);
glScalef(1.0/i, 1.0/i, 1.0/i);
glTranslatef(-tx, -ty + i * 0.1, 0.0);
glTranslatef(-0.5, -0.5, 0.0);
}
}
glMatrixMode(GL_MODELVIEW);
@@ -69,9 +72,10 @@ static void Idle( void )
static void DrawObject(void)
{
static const GLfloat tex_coords[] = { 0.0, 0.0, 1.0, 1.0, 0.0 };
static const GLfloat vtx_coords[] = { -1.0, -1.0, 1.0, 1.0, -1.0 };
GLint i, j;
GLint i;
GLint j;
static const GLfloat tex_coords[] = { 0.0, 0.0, 1.0, 1.0, 0.0 };
static const GLfloat vtx_coords[] = { -1.0, -1.0, 1.0, 1.0, -1.0 };
if (!TexEnabled[0] && !TexEnabled[1])
glColor3f(0.1, 0.1, 0.1); /* add onto this */
@@ -79,20 +83,37 @@ static void DrawObject(void)
glColor3f(1, 1, 1); /* modulate this */
glBegin(GL_QUADS);
for (j = 0; j < 4; j++ ) {
for (i = 0; i < NumUnits; i++) {
if (TexEnabled[i])
glMultiTexCoord2fARB(GL_TEXTURE0_ARB + i,
tex_coords[j], tex_coords[j+1]);
/* Toggle between the vector and scalar entry points. This is done purely
* to hit multiple paths in the driver.
*/
if ( Drift > 0.49 ) {
for (j = 0; j < 4; j++ ) {
for (i = 0; i < NumUnits; i++)
glMultiTexCoord2fARB(GL_TEXTURE0_ARB + i,
tex_coords[j], tex_coords[j+1]);
glVertex2f( vtx_coords[j], vtx_coords[j+1] );
}
glVertex2f( vtx_coords[j], vtx_coords[j+1] );
}
else {
for (j = 0; j < 4; j++ ) {
for (i = 0; i < NumUnits; i++)
glMultiTexCoord2fvARB(GL_TEXTURE0_ARB + i, & tex_coords[j]);
glVertex2fv( & vtx_coords[j] );
}
}
glEnd();
}
static void Display( void )
{
static GLint T0 = 0;
static GLint Frames = 0;
GLint t;
glClear( GL_COLOR_BUFFER_BIT );
glPushMatrix();
@@ -104,6 +125,16 @@ static void Display( void )
glPopMatrix();
glutSwapBuffers();
Frames++;
t = glutGet(GLUT_ELAPSED_TIME);
if (t - T0 >= 250) {
GLfloat seconds = (t - T0) / 1000.0;
drift_increment = 2.2 * seconds / Frames;
T0 = t;
Frames = 0;
}
}
@@ -120,34 +151,24 @@ static void Reshape( int width, int height )
}
static void ToggleUnit(int unit)
{
TexEnabled[unit] = !TexEnabled[unit];
glActiveTextureARB(GL_TEXTURE0_ARB + unit);
if (TexEnabled[unit])
glEnable(GL_TEXTURE_2D);
else
glDisable(GL_TEXTURE_2D);
printf("Enabled: ");
for (unit = 0; unit < NumUnits; unit++)
printf("%d ", (int) TexEnabled[unit]);
printf("\n");
}
static void ModeMenu(int entry)
{
if (entry >= TEX0 && entry <= TEX7) {
/* toggle */
GLint i = entry - TEX0;
ToggleUnit(i);
TexEnabled[i] = !TexEnabled[i];
glActiveTextureARB(GL_TEXTURE0_ARB + i);
if (TexEnabled[i])
glEnable(GL_TEXTURE_2D);
else
glDisable(GL_TEXTURE_2D);
printf("Enabled: ");
for (i = 0; i < NumUnits; i++)
printf("%d ", (int) TexEnabled[i]);
printf("\n");
}
else if (entry==ANIMATE) {
Animate = !Animate;
if (Animate)
glutIdleFunc(Idle);
else
glutIdleFunc(NULL);
}
else if (entry==QUIT) {
exit(0);
@@ -162,36 +183,9 @@ static void Key( unsigned char key, int x, int y )
(void) x;
(void) y;
switch (key) {
case 'a':
Animate = !Animate;
break;
case '0':
ToggleUnit(0);
break;
case '1':
ToggleUnit(1);
break;
case '2':
ToggleUnit(2);
break;
case '3':
ToggleUnit(3);
break;
case '4':
ToggleUnit(4);
break;
case '5':
ToggleUnit(5);
break;
case '6':
ToggleUnit(6);
break;
case '7':
ToggleUnit(7);
break;
case 27:
exit(0);
break;
case 27:
exit(0);
break;
}
glutPostRedisplay();
}
@@ -333,8 +327,7 @@ int main( int argc, char *argv[] )
glutKeyboardFunc( Key );
glutSpecialFunc( SpecialKey );
glutDisplayFunc( Display );
if (Animate)
glutIdleFunc(Idle);
glutIdleFunc( Idle );
glutCreateMenu(ModeMenu);

View File

@@ -8,7 +8,6 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <time.h>
#include <GL/glut.h>

View File

@@ -9,7 +9,6 @@
* Added GL_EXT_packed_depth_stencil support on 15 March 2006.
* Added GL_EXT_framebuffer_object support on 27 March 2006.
* Removed old SGIX extension support on 5 April 2006.
* Added vertex / fragment program support on 7 June 2007 (Ian Romanick).
*
* Copyright (C) 1999-2006 Brian Paul All Rights Reserved.
*
@@ -35,7 +34,6 @@
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <GL/glut.h>
#include "showbuffer.h"
@@ -69,28 +67,8 @@ static GLboolean NeedNewShadowMap = GL_FALSE;
static GLuint ShadowTexture, GrayTexture;
static GLuint ShadowFBO;
static GLfloat lightModelview[16];
static GLfloat lightProjection[16];
static GLuint vert_prog;
static GLuint frag_progs[3];
static GLuint curr_frag = 0;
static GLuint max_frag = 1;
#define NUM_FRAG_MODES 3
static const char *FragProgNames[] = {
"fixed-function",
"program without \"OPTION ARB_fragment_program_shadow\"",
"program with \"OPTION ARB_fragment_program_shadow\"",
};
static GLboolean HaveShadow = GL_FALSE;
static GLboolean HaveFBO = GL_FALSE;
static GLboolean UseFBO = GL_FALSE;
static GLboolean HaveVP = GL_FALSE;
static GLboolean HaveFP = GL_FALSE;
static GLboolean HaveFP_Shadow = GL_FALSE;
static GLboolean UseVP = GL_FALSE;
static GLboolean HavePackedDepthStencil = GL_FALSE;
static GLboolean UsePackedDepthStencil = GL_FALSE;
static GLboolean HaveEXTshadowFuncs = GL_FALSE;
@@ -113,103 +91,6 @@ static GLuint DisplayMode;
#define MAT4_MUL(dest_vec, src_mat, src_vec) \
"DP4 " dest_vec ".x, " src_mat "[0], " src_vec ";\n" \
"DP4 " dest_vec ".y, " src_mat "[1], " src_vec ";\n" \
"DP4 " dest_vec ".z, " src_mat "[2], " src_vec ";\n" \
"DP4 " dest_vec ".w, " src_mat "[3], " src_vec ";\n"
#define MAT3_MUL(dest_vec, src_mat, src_vec) \
"DP3 " dest_vec ".x, " src_mat "[0], " src_vec ";\n" \
"DP3 " dest_vec ".y, " src_mat "[1], " src_vec ";\n" \
"DP3 " dest_vec ".z, " src_mat "[2], " src_vec ";\n"
#define NORMALIZE(dest, src) \
"DP3 " dest ".w, " src ", " src ";\n" \
"RSQ " dest ".w, " dest ".w;\n" \
"MUL " dest ", " src ", " dest ".w;\n"
/**
* Vertex program for shadow mapping.
*/
static const char vert_code[] =
"!!ARBvp1.0\n"
"ATTRIB iPos = vertex.position;\n"
"ATTRIB iNorm = vertex.normal;\n"
"PARAM mvinv[4] = { state.matrix.modelview.invtrans };\n"
"PARAM mvp[4] = { state.matrix.mvp };\n"
"PARAM mv[4] = { state.matrix.modelview };\n"
"PARAM texmat[4] = { state.matrix.texture[0] };\n"
"PARAM lightPos = state.light[0].position;\n"
"PARAM ambientCol = state.lightprod[0].ambient;\n"
"PARAM diffuseCol = state.lightprod[0].diffuse;\n"
"TEMP n, lightVec;\n"
"ALIAS V = lightVec;\n"
"ALIAS NdotL = n;\n"
"OUTPUT oPos = result.position;\n"
"OUTPUT oColor = result.color;\n"
"OUTPUT oTex = result.texcoord[0];\n"
/* Transform the vertex to clip coordinates. */
MAT4_MUL("oPos", "mvp", "iPos")
/* Transform the vertex to eye coordinates. */
MAT4_MUL("V", "mv", "iPos")
/* Transform the vertex to projected light coordinates. */
MAT4_MUL("oTex", "texmat", "iPos")
/* Transform the normal to eye coordinates. */
MAT3_MUL("n", "mvinv", "iNorm")
/* Calculate the vector from the vertex to the light in eye
* coordinates.
*/
"SUB lightVec, lightPos, V;\n"
NORMALIZE("lightVec", "lightVec")
/* Compute diffuse lighting coefficient.
*/
"DP3 NdotL.x, n, lightVec;\n"
"MAX NdotL.x, NdotL.x, {0.0};\n"
"MIN NdotL.x, NdotL.x, {1.0};\n"
/* Accumulate color contributions.
*/
"MOV oColor, diffuseCol;\n"
"MAD oColor.xyz, NdotL.x, diffuseCol, ambientCol;\n"
"END\n"
;
static const char frag_code[] =
"!!ARBfp1.0\n"
"TEMP shadow, temp;\n"
"TXP shadow, fragment.texcoord[0], texture[0], 2D;\n"
"RCP temp.x, fragment.texcoord[0].w;\n"
"MUL temp.x, temp.x, fragment.texcoord[0].z;\n"
"SGE shadow, shadow.x, temp.x;\n"
"MUL result.color.rgb, fragment.color, shadow.x;\n"
"MOV result.color.a, fragment.color;\n"
"END\n"
;
static const char frag_shadow_code[] =
"!!ARBfp1.0\n"
"OPTION ARB_fragment_program_shadow;\n"
"TEMP shadow;\n"
"TXP shadow, fragment.texcoord[0], texture[0], SHADOW2D;\n"
"MUL result.color.rgb, fragment.color, shadow.x;\n"
"MOV result.color.a, fragment.color.a;\n"
"END\n"
;
static void
DrawScene(void)
{
@@ -253,56 +134,27 @@ DrawScene(void)
}
/**
* Calculate modelview and project matrices for the light
*
* Stores the results in \c lightProjection (projection matrix) and
* \c lightModelview (modelview matrix).
/*
* Load the GL_TEXTURE matrix with the projection from the light
* source's point of view.
*/
static void
MakeShadowMatrix(const GLfloat lightPos[4], const GLfloat spotDir[3],
GLfloat spotAngle, GLfloat shadowNear, GLfloat shadowFar)
{
/* compute frustum to enclose spot light cone */
const GLfloat d = shadowNear * tan(spotAngle);
glMatrixMode(GL_PROJECTION);
glPushMatrix();
GLfloat d;
glMatrixMode(GL_TEXTURE);
glLoadIdentity();
glTranslatef(0.5, 0.5, 0.5 + Bias);
glScalef(0.5, 0.5, 0.5);
d = shadowNear * tan(spotAngle);
glFrustum(-d, d, -d, d, shadowNear, shadowFar);
glGetFloatv(GL_PROJECTION_MATRIX, lightProjection);
glPopMatrix();
glMatrixMode(GL_MODELVIEW);
glPushMatrix();
glLoadIdentity();
gluLookAt(lightPos[0], lightPos[1], lightPos[2],
lightPos[0] + spotDir[0],
lightPos[1] + spotDir[1],
lightPos[2] + spotDir[2],
0.0, 1.0, 0.0);
glGetFloatv(GL_MODELVIEW_MATRIX, lightModelview);
glPopMatrix();
}
/**
* Load \c GL_TEXTURE matrix with light's MVP matrix.
*/
static void SetShadowTextureMatrix(void)
{
static const GLfloat biasMatrix[16] = {
0.5, 0.0, 0.0, 0.0,
0.0, 0.5, 0.0, 0.0,
0.0, 0.0, 0.5, 0.0,
0.5, 0.5, 0.5, 1.0,
};
glMatrixMode(GL_TEXTURE);
glLoadMatrixf(biasMatrix);
glTranslatef(0.0, 0.0, Bias);
glMultMatrixf(lightProjection);
glMultMatrixf(lightModelview);
0, 1, 0);
glMatrixMode(GL_MODELVIEW);
}
@@ -406,6 +258,7 @@ RenderShadowMap(void)
{
GLenum depthFormat; /* GL_DEPTH_COMPONENT or GL_DEPTH_STENCIL_EXT */
GLenum depthType; /* GL_UNSIGNED_INT_24_8_EXT or GL_UNSIGNED_INT */
float d;
if (WindowWidth >= 1024 && WindowHeight >= 1024) {
ShadowTexWidth = ShadowTexHeight = 1024;
@@ -430,11 +283,17 @@ RenderShadowMap(void)
depthType = GL_UNSIGNED_INT;
}
glMatrixMode(GL_PROJECTION);
glLoadMatrixf(lightProjection);
/* compute frustum to enclose spot light cone */
d = ShadowNear * tan(SpotAngle);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glFrustum(-d, d, -d, d, ShadowNear, ShadowFar);
glMatrixMode(GL_MODELVIEW);
glLoadMatrixf(lightModelview);
glLoadIdentity();
gluLookAt(LightPos[0], LightPos[1], LightPos[2], /* from */
0, 0, 0, /* target */
0, 1, 0); /* up */
if (UseFBO) {
GLenum fbo_status;
@@ -530,11 +389,10 @@ ShowShadowMap(void)
DisableTexgen();
/* interpret texture's depth values as luminance values */
if (HaveShadow) {
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_MODE_ARB, GL_NONE);
}
#if defined(GL_ARB_shadow)
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_MODE_ARB, GL_NONE);
glTexParameteri(GL_TEXTURE_2D, GL_DEPTH_TEXTURE_MODE_ARB, GL_LUMINANCE);
#endif
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
glBegin(GL_POLYGON);
@@ -562,7 +420,6 @@ Display(void)
LightPos, SpotDir);
if (NeedNewShadowMap) {
MakeShadowMatrix(LightPos, SpotDir, SpotAngle, ShadowNear, ShadowFar);
RenderShadowMap();
NeedNewShadowMap = GL_FALSE;
}
@@ -600,13 +457,12 @@ Display(void)
}
if (DisplayMode == SHOW_DEPTH_MAPPING) {
if (HaveShadow) {
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_MODE_ARB, GL_NONE);
}
#if defined(GL_ARB_shadow)
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_MODE_ARB, GL_NONE);
#endif
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
glEnable(GL_TEXTURE_2D);
SetShadowTextureMatrix();
MakeShadowMatrix(LightPos, SpotDir, SpotAngle, ShadowNear, ShadowFar);
EnableIdentityTexgen();
}
else if (DisplayMode == SHOW_DISTANCE) {
@@ -620,44 +476,19 @@ Display(void)
}
else {
assert(DisplayMode == SHOW_SHADOWS);
if (HaveShadow) {
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_MODE_ARB,
GL_COMPARE_R_TO_TEXTURE_ARB);
}
if (curr_frag > 0) {
glEnable(GL_FRAGMENT_PROGRAM_ARB);
}
else {
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
}
#if defined(GL_ARB_shadow)
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_MODE_ARB,
GL_COMPARE_R_TO_TEXTURE_ARB);
#endif
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
glEnable(GL_TEXTURE_2D);
SetShadowTextureMatrix();
if (UseVP) {
glEnable(GL_VERTEX_PROGRAM_ARB);
}
else {
glEnable(GL_LIGHTING);
EnableIdentityTexgen();
}
MakeShadowMatrix(LightPos, SpotDir, SpotAngle, ShadowNear, ShadowFar);
EnableIdentityTexgen();
}
DrawScene();
if (UseVP) {
glDisable(GL_VERTEX_PROGRAM_ARB);
}
else {
DisableTexgen();
glDisable(GL_LIGHTING);
}
if (curr_frag > 0) {
glDisable(GL_FRAGMENT_PROGRAM_ARB);
}
DisableTexgen();
glDisable(GL_TEXTURE_1D);
glDisable(GL_TEXTURE_2D);
}
@@ -730,18 +561,6 @@ Key(unsigned char key, int x, int y)
case 'm':
DisplayMode = SHOW_DEPTH_MAPPING;
break;
case 'M':
curr_frag = (1 + curr_frag) % max_frag;
if (!HaveShadow && (curr_frag == 0)) {
curr_frag = 1;
}
printf("Using fragment %s\n", FragProgNames[curr_frag]);
if (HaveFP) {
glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, frag_progs[curr_frag]);
}
break;
case 'n':
case 's':
case ' ':
@@ -753,10 +572,10 @@ Key(unsigned char key, int x, int y)
if (Operator >= 8)
Operator = 0;
printf("Operator: %s\n", OperatorName[Operator]);
if (HaveShadow) {
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_FUNC_ARB,
OperatorFunc[Operator]);
}
#if defined(GL_ARB_shadow)
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_FUNC_ARB,
OperatorFunc[Operator]);
#endif
}
break;
case 'p':
@@ -773,11 +592,6 @@ Key(unsigned char key, int x, int y)
NeedNewShadowMap = GL_TRUE;
}
break;
case 'v':
UseVP = !UseVP && HaveVP;
printf("Using vertex %s mode.\n",
UseVP ? "program" : "fixed-function");
break;
case 'z':
Zrot -= step;
break;
@@ -832,76 +646,28 @@ SpecialKey(int key, int x, int y)
}
/* A helper for finding errors in program strings */
static int FindLine( const char *program, int position )
{
int i, line = 1;
for (i = 0; i < position; i++) {
if (program[i] == '\n')
line++;
}
return line;
}
static GLuint
compile_program(GLenum target, const char *code)
{
GLuint p;
GLint errorPos;
glGenProgramsARB(1, & p);
glBindProgramARB(target, p);
glProgramStringARB(target, GL_PROGRAM_FORMAT_ASCII_ARB,
strlen(code), code);
glGetIntegerv(GL_PROGRAM_ERROR_POSITION_ARB, &errorPos);
if (glGetError() != GL_NO_ERROR || errorPos != -1) {
int l = FindLine(code, errorPos);
printf("Fragment Program Error (pos=%d line=%d): %s\n", errorPos, l,
(char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB));
exit(0);
}
glBindProgramARB(target, 0);
return p;
}
static void
Init(void)
{
static const GLfloat borderColor[4] = {1.0, 0.0, 0.0, 0.0};
if (!glutExtensionSupported("GL_ARB_depth_texture")) {
printf("Sorry, this demo requires the GL_ARB_depth_texture extension\n");
#if defined(GL_ARB_depth_texture) && defined(GL_ARB_shadow)
if (!glutExtensionSupported("GL_ARB_depth_texture") ||
!glutExtensionSupported("GL_ARB_shadow")) {
#else
if (1) {
#endif
printf("Sorry, this demo requires the GL_ARB_depth_texture and GL_ARB_shadow extensions\n");
exit(1);
}
printf("Using GL_ARB_depth_texture and GL_ARB_shadow\n");
HaveShadow = glutExtensionSupported("GL_ARB_shadow");
HaveVP = glutExtensionSupported("GL_ARB_vertex_program");
HaveFP = glutExtensionSupported("GL_ARB_fragment_program");
HaveFP_Shadow = glutExtensionSupported("GL_ARB_fragment_program_shadow");
if (!HaveShadow && !HaveFP) {
printf("Sorry, this demo requires either the GL_ARB_shadow extension "
"or the GL_ARB_fragment_program extension\n");
exit(1);
}
printf("Using GL_ARB_depth_texture\n");
if (HaveShadow) {
printf("and GL_ARB_shadow\n");
}
if (HaveFP) {
printf("and GL_ARB_fragment_program\n");
}
#if defined(GL_ARB_shadow_ambient)
HaveShadowAmbient = glutExtensionSupported("GL_ARB_shadow_ambient");
if (HaveShadowAmbient) {
printf("and GL_ARB_shadow_ambient\n");
}
#endif
HaveEXTshadowFuncs = glutExtensionSupported("GL_EXT_shadow_funcs");
@@ -924,15 +690,15 @@ Init(void)
glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_BORDER_COLOR, borderColor);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
if (HaveShadow) {
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_MODE_ARB,
GL_COMPARE_R_TO_TEXTURE_ARB);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_FUNC_ARB, GL_LEQUAL);
}
#if defined(GL_ARB_shadow)
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_MODE_ARB,
GL_COMPARE_R_TO_TEXTURE_ARB);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_FUNC_ARB, GL_LEQUAL);
#endif
if (HaveShadowAmbient) {
#if defined(GL_ARB_shadow_ambient)
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_FAIL_VALUE_ARB, 0.3);
#endif
}
#if defined(GL_EXT_framebuffer_object)
@@ -955,6 +721,7 @@ Init(void)
glGenTextures(1, &GrayTexture);
glBindTexture(GL_TEXTURE_1D, GrayTexture);
glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_WRAP_S, GL_CLAMP);
glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_WRAP_T, GL_CLAMP);
glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
{
@@ -966,30 +733,6 @@ Init(void)
256, 0, GL_LUMINANCE, GL_UNSIGNED_BYTE, image);
}
if (HaveVP) {
vert_prog = compile_program(GL_VERTEX_PROGRAM_ARB, vert_code);
glBindProgramARB(GL_VERTEX_PROGRAM_ARB, vert_prog);
}
max_frag = 1;
frag_progs[0] = 0;
if (HaveFP) {
frag_progs[1] = compile_program(GL_FRAGMENT_PROGRAM_ARB, frag_code);
max_frag = 2;
}
if (HaveFP && HaveFP_Shadow) {
frag_progs[2] = compile_program(GL_FRAGMENT_PROGRAM_ARB,
frag_shadow_code);
max_frag = 3;
}
if (!HaveShadow) {
curr_frag = 1;
glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, frag_progs[curr_frag]);
}
glEnable(GL_DEPTH_TEST);
glEnable(GL_LIGHTING);
glEnable(GL_LIGHT0);
@@ -1008,8 +751,6 @@ PrintHelp(void)
printf(" f = toggle nearest/bilinear texture filtering\n");
printf(" b/B = decrease/increase shadow map Z bias\n");
printf(" p = toggle use of packed depth/stencil\n");
printf(" M = cycle through fragment program modes\n");
printf(" v = toggle vertex program modes\n");
printf(" cursor keys = rotate scene\n");
printf(" <shift> + cursor keys = rotate light source\n");
if (HaveEXTshadowFuncs)

View File

@@ -333,13 +333,13 @@ menu(int option)
smooth = 0;
break;
case 10:
glPointSize(16.0);
glPointSize(4.0);
break;
case 11:
glPointSize(32.0);
glPointSize(8.0);
break;
case 12:
glPointSize(64.0);
glPointSize(16.0);
break;
case 13:
spin = 1 - spin;
@@ -411,19 +411,19 @@ key(unsigned char c, int x, int y)
glutPostRedisplay();
break;
case '1':
glPointSize(16.0);
glPointSize(2.0);
glutPostRedisplay();
break;
case '2':
glPointSize(32.0);
glPointSize(4.0);
glutPostRedisplay();
break;
case '3':
glPointSize(64.0);
glPointSize(8.0);
glutPostRedisplay();
break;
case '4':
glPointSize(128.0);
glPointSize(16.0);
glutPostRedisplay();
break;
case 27:
@@ -526,9 +526,9 @@ main(int argc, char **argv)
glutAddMenuEntry("Threshold 10", 7);
glutAddMenuEntry("Point smooth on", 8);
glutAddMenuEntry("Point smooth off", 9);
glutAddMenuEntry("Point size 16", 10);
glutAddMenuEntry("Point size 32", 11);
glutAddMenuEntry("Point size 64", 12);
glutAddMenuEntry("Point size 4", 10);
glutAddMenuEntry("Point size 8", 11);
glutAddMenuEntry("Point size 16", 12);
glutAddMenuEntry("Toggle spin", 13);
glutAddMenuEntry("200 points ", 14);
glutAddMenuEntry("500 points ", 15);
@@ -544,7 +544,7 @@ main(int argc, char **argv)
glEnable(GL_DEPTH_TEST);
glEnable(GL_POINT_SMOOTH);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glPointSize(32.0);
glPointSize(16.0);
#ifdef GL_ARB_point_parameters
glPointParameterfvARB(GL_POINT_DISTANCE_ATTENUATION_ARB, theQuad);
#endif

View File

@@ -1,9 +1,13 @@
/*
* GL_ARB_pixel_buffer_object test
* GL_ARB_multitexture demo
*
* Command line options:
* -w WIDTH -h HEIGHT sets window size
* -info print GL implementation information
*
*
* Brian Paul November 1998 This program is in the public domain.
* Modified on 12 Feb 2002 for > 2 texture units.
*/
#define GL_GLEXT_PROTOTYPES
@@ -21,8 +25,6 @@
#define PBO 11
#define QUIT 100
static GLuint DrawPBO;
static GLboolean Animate = GL_TRUE;
static GLboolean use_pbo = 1;
static GLboolean whole_rect = 1;
@@ -47,7 +49,7 @@ static void Idle( void )
}
}
/*static int max( int a, int b ) { return a > b ? a : b; }*/
static int max( int a, int b ) { return a > b ? a : b; }
static int min( int a, int b ) { return a < b ? a : b; }
static void DrawObject()
@@ -60,7 +62,6 @@ static void DrawObject()
* release the old copy of the texture and allocate a new one
* without waiting for outstanding rendering to complete.
*/
glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_EXT, DrawPBO);
glBufferDataARB(GL_PIXEL_UNPACK_BUFFER_EXT, size, NULL, GL_STREAM_DRAW_ARB);
{
@@ -68,7 +69,7 @@ static void DrawObject()
printf("char %d\n", (unsigned char)(Drift * 255));
memset(image, (unsigned char)(Drift * 255), size);
memset(image, size, (unsigned char)(Drift * 255));
glUnmapBufferARB(GL_PIXEL_UNPACK_BUFFER_EXT);
}
@@ -85,9 +86,7 @@ static void DrawObject()
if (image == NULL)
image = malloc(size);
glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_EXT, 0);
memset(image, (unsigned char)(Drift * 255), size);
memset(image, size, (unsigned char)(Drift * 255));
/* BGRA should be the fast path for regular uploads as well.
*/
@@ -228,12 +227,12 @@ static void SpecialKey( int key, int x, int y )
static void Init( int argc, char *argv[] )
{
const char *exten = (const char *) glGetString(GL_EXTENSIONS);
GLuint texObj;
GLuint texObj, DrawPBO;
GLint size;
if (!strstr(exten, "GL_ARB_pixel_buffer_object")) {
printf("Sorry, GL_ARB_pixel_buffer_object not supported by this renderer.\n");
if (!strstr(exten, "GL_ARB_multitexture")) {
printf("Sorry, GL_ARB_multitexture not supported by this renderer.\n");
exit(1);
}

View File

@@ -76,7 +76,6 @@ int textureWidth = 64;
int textureHeight = 64;
int winWidth = 580, winHeight = 720;
int win;
struct formatInfo {
GLenum baseFormat;
@@ -289,7 +288,6 @@ static void keyboard( unsigned char c, int x, int y )
displayLevelInfo = !displayLevelInfo;
break;
case 27: /* Escape key should force exit. */
glutDestroyWindow(win);
exit(0);
break;
default:
@@ -787,7 +785,7 @@ int main( int argc, char *argv[] )
glutInitWindowSize( winWidth, winHeight );
glutInitWindowPosition( 0, 0 );
win = glutCreateWindow( "Texture Environment Test" );
glutCreateWindow( "Texture Environment Test" );
initialize();
instructions();

View File

@@ -60,6 +60,6 @@ eglgears.o: eglgears.c $(HEADERS)
clean:
-rm -f *.o *~
-rm -f *.so
-rm -f $(PROGRAMS)
rm -f *.o *~
rm -f *.so
rm -f $(PROGRAMS)

View File

@@ -37,8 +37,8 @@ LIBS = -L$(TOP)/$(LIB_DIR) -l$(GLU_LIB) -l$(GL_LIB) $(APP_LIB_DEPS)
default: depend $(PROGS)
clean:
-rm -f $(PROGS)
-rm -f *.o
rm -f $(PROGS)
rm -f *.o
depend: $(SOURCES)

View File

@@ -23,21 +23,11 @@
#include <GL/glfbdev.h>
#include <math.h>
/**
* Choose one of these modes
*/
/*static const int XRes = 1280, YRes = 1024, Hz = 75;*/
/*static const int XRes = 1280, YRes = 1024, Hz = 70;*/
/*static const int XRes = 1280, YRes = 1024, Hz = 60;*/
static const int XRes = 1024, YRes = 768, Hz = 70;
static int DesiredDepth = 32;
static int NumFrames = 100;
#define DEFAULT_DEPTH 8
static struct fb_fix_screeninfo FixedInfo;
static struct fb_var_screeninfo VarInfo, OrigVarInfo;
static int DesiredDepth = 0;
static int OriginalVT = -1;
static int ConsoleFD = -1;
static int FrameBufferFD = -1;
@@ -237,6 +227,7 @@ initialize_fbdev( void )
VarInfo = OrigVarInfo;
/* set the depth, resolution, etc */
DesiredDepth = 32;
if (DesiredDepth)
VarInfo.bits_per_pixel = DesiredDepth;
@@ -260,60 +251,16 @@ initialize_fbdev( void )
VarInfo.blue.length = 8;
VarInfo.transp.length = 8;
}
/* timing values taken from /etc/fb.modes */
if (XRes == 1280 && YRes == 1024) {
VarInfo.xres_virtual = VarInfo.xres = XRes;
VarInfo.yres_virtual = VarInfo.yres = YRes;
if (Hz == 75) {
VarInfo.pixclock = 7408;
VarInfo.left_margin = 248;
VarInfo.right_margin = 16;
VarInfo.upper_margin = 38;
VarInfo.lower_margin = 1;
VarInfo.hsync_len = 144;
VarInfo.vsync_len = 3;
}
else if (Hz == 70) {
VarInfo.pixclock = 7937;
VarInfo.left_margin = 216;
VarInfo.right_margin = 80;
VarInfo.upper_margin = 36;
VarInfo.lower_margin = 1;
VarInfo.hsync_len = 112;
VarInfo.vsync_len = 5;
}
else if (Hz == 60) {
VarInfo.pixclock = 9260;
VarInfo.left_margin = 248;
VarInfo.right_margin = 48;
VarInfo.upper_margin = 38;
VarInfo.lower_margin = 1;
VarInfo.hsync_len = 112;
VarInfo.vsync_len = 3;
}
else {
fprintf(stderr, "invalid rate for 1280x1024\n");
exit(1);
}
}
else if (XRes == 1024 && YRes == 768 && Hz == 70) {
VarInfo.xres_virtual = VarInfo.xres = XRes;
VarInfo.yres_virtual = VarInfo.yres = YRes;
if (Hz == 70) {
VarInfo.pixclock = 13334;
VarInfo.left_margin = 144;
VarInfo.right_margin = 24;
VarInfo.upper_margin = 29;
VarInfo.lower_margin = 3;
VarInfo.hsync_len = 136;
VarInfo.vsync_len = 6;
}
else {
fprintf(stderr, "invalid rate for 1024x768\n");
exit(1);
}
}
/* timing values taken from /etc/fb.modes (1280x1024 @ 75Hz) */
VarInfo.xres_virtual = VarInfo.xres = 1280;
VarInfo.yres_virtual = VarInfo.yres = 1024;
VarInfo.pixclock = 7408;
VarInfo.left_margin = 248;
VarInfo.right_margin = 16;
VarInfo.upper_margin = 38;
VarInfo.lower_margin = 1;
VarInfo.hsync_len = 144;
VarInfo.vsync_len = 3;
VarInfo.xoffset = 0;
VarInfo.yoffset = 0;
@@ -391,7 +338,7 @@ initialize_fbdev( void )
printf("MMIOAddress = %p\n", MMIOAddress);
/* try out some simple MMIO register reads */
if (0)
if (1)
{
typedef unsigned int CARD32;
typedef unsigned char CARD8;
@@ -505,7 +452,6 @@ gltest( void )
GLFBDevVisualPtr vis;
int bytes, r, g, b, a;
float ang;
int i;
printf("GLFBDEV_VENDOR = %s\n", glFBDevGetString(GLFBDEV_VENDOR));
printf("GLFBDEV_VERSION = %s\n", glFBDevGetString(GLFBDEV_VERSION));
@@ -545,17 +491,13 @@ gltest( void )
glEnable(GL_LIGHT0);
glEnable(GL_DEPTH_TEST);
printf("Drawing %d frames...\n", NumFrames);
ang = 0.0;
for (i = 0; i < NumFrames; i++) {
for (ang = 0; ang <= 180; ang += 15) {
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glPushMatrix();
glRotatef(ang, 1, 0, 0);
doughnut(1, 3, 40, 20);
glPopMatrix();
glFBDevSwapBuffers(buf);
ang += 15.0;
}
/* clean up */
@@ -568,29 +510,12 @@ gltest( void )
}
static void
parse_args(int argc, char *argv[])
{
int i;
for (i = 1; i < argc; i++) {
if (strcmp(argv[i], "-f") == 0) {
NumFrames = atoi(argv[i+1]);
i++;
}
}
}
int
main( int argc, char *argv[] )
{
signal(SIGUSR1, signal_handler); /* exit if someone tries a vt switch */
signal(SIGSEGV, signal_handler); /* catch segfaults */
parse_args(argc, argv);
printf("Setting mode to %d x %d @ %d Hz, %d bpp\n", XRes, YRes, Hz, DesiredDepth);
initialize_fbdev();
gltest();
shutdown_fbdev();

View File

@@ -86,9 +86,9 @@ UTIL_FILES = readtex.h readtex.c
default: $(UTIL_FILES) $(PROGS)
clean:
-rm -f $(PROGS)
-rm -f *.o
-rm -f getproclist.h
rm -f $(PROGS)
rm -f *.o
rm -f getproclist.h
# auto code generation

View File

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

View File

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

View File

@@ -4,14 +4,10 @@ bump
deriv
extfuncs.h
mandelbrot
multitex
noise
points
readtex.c
readtex.h
shaderutil.c
shaderutil.h
texdemo1
toyball
trirast
twoside
toyball

View File

@@ -10,18 +10,13 @@ LIB_DEP = $(TOP)/$(LIB_DIR)/$(GL_LIB_NAME) $(TOP)/$(LIB_DIR)/$(GLU_LIB_NAME) $(T
LIBS = -L$(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) $(APP_LIB_DEPS)
PROGS = \
bitmap \
brick \
bump \
deriv \
mandelbrot \
multitex \
noise \
points \
texdemo1 \
toyball \
twoside \
trirast
texdemo1
##### RULES #####
@@ -46,7 +41,6 @@ default: $(PROGS)
extfuncs.h: $(TOP)/progs/util/extfuncs.h
cp $< .
readtex.c: $(TOP)/progs/util/readtex.c
cp $< .
@@ -56,107 +50,22 @@ readtex.h: $(TOP)/progs/util/readtex.h
readtex.o: readtex.c readtex.h
$(CC) -c -I$(INCDIR) $(CFLAGS) readtex.c
brick.c: extfuncs.h
shaderutil.c: $(TOP)/progs/util/shaderutil.c
cp $< .
bump.c: extfuncs.h
shaderutil.h: $(TOP)/progs/util/shaderutil.h
cp $< .
mandelbrot.c: extfuncs.h
shaderutil.o: shaderutil.c shaderutil.h
$(CC) -c -I$(INCDIR) $(CFLAGS) shaderutil.c
toyball.c: extfuncs.h
texdemo1: texdemo1.o readtex.o
$(CC) -I$(INCDIR) $(CFLAGS) $(LDFLAGS) texdemo1.o readtex.o $(LIBS) -o $@
bitmap.o: bitmap.c extfuncs.h shaderutil.h
$(CC) -c -I$(INCDIR) $(CFLAGS) bitmap.c
bitmap: bitmap.o shaderutil.o
$(CC) -I$(INCDIR) $(CFLAGS) $(LDFLAGS) bitmap.o shaderutil.o $(LIBS) -o $@
brick.o: brick.c extfuncs.h shaderutil.h
$(CC) -c -I$(INCDIR) $(CFLAGS) brick.c
brick: brick.o shaderutil.o
$(CC) -I$(INCDIR) $(CFLAGS) $(LDFLAGS) brick.o shaderutil.o $(LIBS) -o $@
bump.o: bump.c extfuncs.h shaderutil.h
$(CC) -c -I$(INCDIR) $(CFLAGS) bump.c
bump: bump.o shaderutil.o
$(CC) -I$(INCDIR) $(CFLAGS) $(LDFLAGS) bump.o shaderutil.o $(LIBS) -o $@
deriv.o: deriv.c extfuncs.h shaderutil.h
$(CC) -c -I$(INCDIR) $(CFLAGS) deriv.c
deriv: deriv.o shaderutil.o
$(CC) -I$(INCDIR) $(CFLAGS) $(LDFLAGS) deriv.o shaderutil.o $(LIBS) -o $@
mandelbrot.o: mandelbrot.c extfuncs.h shaderutil.h
$(CC) -c -I$(INCDIR) $(CFLAGS) mandelbrot.c
mandelbrot: mandelbrot.o shaderutil.o
$(CC) -I$(INCDIR) $(CFLAGS) $(LDFLAGS) mandelbrot.o shaderutil.o $(LIBS) -o $@
multitex.o: multitex.c extfuncs.h readtex.h shaderutil.h
$(CC) -c -I$(INCDIR) $(CFLAGS) multitex.c
multitex: multitex.o readtex.o shaderutil.o
$(CC) -I$(INCDIR) $(CFLAGS) $(LDFLAGS) multitex.o readtex.o shaderutil.o $(LIBS) -o $@
noise.o: noise.c extfuncs.h shaderutil.h
$(CC) -c -I$(INCDIR) $(CFLAGS) noise.c
noise: noise.o shaderutil.o
$(CC) -I$(INCDIR) $(CFLAGS) $(LDFLAGS) noise.o shaderutil.o $(LIBS) -o $@
points.o: points.c extfuncs.h shaderutil.h
$(CC) -c -I$(INCDIR) $(CFLAGS) points.c
points: points.o shaderutil.o
$(CC) -I$(INCDIR) $(CFLAGS) $(LDFLAGS) points.o shaderutil.o $(LIBS) -o $@
texdemo1.o: texdemo1.c readtex.h extfuncs.h shaderutil.h
texdemo1.o: texdemo1.c readtex.h extfuncs.h
$(CC) -c -I$(INCDIR) $(CFLAGS) texdemo1.c
texdemo1: texdemo1.o readtex.o shaderutil.o
$(CC) -I$(INCDIR) $(CFLAGS) $(LDFLAGS) texdemo1.o readtex.o shaderutil.o $(LIBS) -o $@
toyball.o: toyball.c extfuncs.h shaderutil.h
$(CC) -c -I$(INCDIR) $(CFLAGS) toyball.c
toyball: toyball.o shaderutil.o
$(CC) -I$(INCDIR) $(CFLAGS) $(LDFLAGS) toyball.o shaderutil.o $(LIBS) -o $@
twoside.o: twoside.c extfuncs.h shaderutil.h
$(CC) -c -I$(INCDIR) $(CFLAGS) twoside.c
twoside: twoside.o shaderutil.o
$(CC) -I$(INCDIR) $(CFLAGS) $(LDFLAGS) twoside.o shaderutil.o $(LIBS) -o $@
trirast.o: trirast.c extfuncs.h shaderutil.h
$(CC) -c -I$(INCDIR) $(CFLAGS) trirast.c
trirast: trirast.o shaderutil.o
$(CC) -I$(INCDIR) $(CFLAGS) $(LDFLAGS) trirast.o shaderutil.o $(LIBS) -o $@
clean:
-rm -f $(PROGS)
-rm -f *.o *~
-rm -f extfuncs.h
-rm -f shaderutil.*

View File

@@ -1,323 +0,0 @@
/**
* Implement glRasterPos + glBitmap with textures + shaders.
* Brian Paul
* 14 May 2007
*/
#include <assert.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <GL/gl.h>
#include <GL/glut.h>
#include <GL/glext.h>
#include "extfuncs.h"
#include "shaderutil.h"
static GLuint FragShader;
static GLuint VertShader;
static GLuint Program;
static GLint Win = 0;
static GLint WinWidth = 500, WinHeight = 500;
static GLboolean Anim = GL_TRUE;
static GLboolean Bitmap = GL_FALSE;
static GLfloat Xrot = 20.0f, Yrot = 70.0f;
static GLint uTex, uScale;
static GLuint Textures[2];
#define TEX_WIDTH 16
#define TEX_HEIGHT 8
static void
BitmapText(const char *s)
{
while (*s) {
glutBitmapCharacter(GLUT_BITMAP_8_BY_13, (int) *s);
s++;
}
}
static void
Redisplay(void)
{
static const GLfloat px[3] = { 1.2, 0, 0};
static const GLfloat nx[3] = {-1.2, 0, 0};
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glPushMatrix();
glRotatef(Xrot, 1.0f, 0.0f, 0.0f);
glRotatef(Yrot, 0.0f, 1.0f, 0.0f);
glEnable(GL_LIGHTING);
glPushMatrix();
glScalef(0.5, 0.5, 0.5);
glutSolidDodecahedron();
glPopMatrix();
glDisable(GL_LIGHTING);
glColor3f(0, 1, 0);
glBegin(GL_LINES);
glVertex3f(-1, 0, 0);
glVertex3f( 1, 0, 0);
glEnd();
glColor3f(1, 1, 0);
if (Bitmap) {
glRasterPos3fv(px);
BitmapText("+X");
glRasterPos3fv(nx);
BitmapText("-X");
}
else {
glUseProgram_func(Program);
/* vertex positions (deltas) depend on texture size and window size */
if (uScale != -1) {
glUniform2f_func(uScale,
2.0 * TEX_WIDTH / WinWidth,
2.0 * TEX_HEIGHT / WinHeight);
}
/* draw +X */
glBindTexture(GL_TEXTURE_2D, Textures[0]);
glBegin(GL_QUADS);
glTexCoord2f(0, 0); glVertex3fv(px);
glTexCoord2f(1, 0); glVertex3fv(px);
glTexCoord2f(1, 1); glVertex3fv(px);
glTexCoord2f(0, 1); glVertex3fv(px);
glEnd();
/* draw -X */
glBindTexture(GL_TEXTURE_2D, Textures[1]);
glBegin(GL_QUADS);
glTexCoord2f(0, 0); glVertex3fv(nx);
glTexCoord2f(1, 0); glVertex3fv(nx);
glTexCoord2f(1, 1); glVertex3fv(nx);
glTexCoord2f(0, 1); glVertex3fv(nx);
glEnd();
glUseProgram_func(0);
}
glPopMatrix();
glutSwapBuffers();
}
static void
Idle(void)
{
Yrot = glutGet(GLUT_ELAPSED_TIME) * 0.01;
glutPostRedisplay();
}
static void
Reshape(int width, int height)
{
WinWidth = width;
WinHeight = height;
glViewport(0, 0, width, height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glFrustum(-1.0, 1.0, -1.0, 1.0, 5.0, 25.0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glTranslatef(0.0f, 0.0f, -10.0f);
}
static void
Key(unsigned char key, int x, int y)
{
(void) x;
(void) y;
switch(key) {
case ' ':
case 'a':
Anim = !Anim;
if (Anim)
glutIdleFunc(Idle);
else
glutIdleFunc(NULL);
break;
case 'b':
Bitmap = !Bitmap;
if (Bitmap)
printf("Using glBitmap\n");
else
printf("Using billboard texture\n");
break;
case 27:
glDeleteShader_func(FragShader);
glDeleteShader_func(VertShader);
glDeleteProgram_func(Program);
glutDestroyWindow(Win);
exit(0);
}
glutPostRedisplay();
}
static void
SpecialKey(int key, int x, int y)
{
const GLfloat step = 0.125f;
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;
}
/*printf("Xrot: %f Yrot: %f\n", Xrot, Yrot);*/
glutPostRedisplay();
}
static void
MakeTexImage(const char *p, GLuint texobj)
{
GLubyte image[TEX_HEIGHT][TEX_WIDTH];
GLuint i, j, k;
for (i = 0; i < TEX_HEIGHT; i++) {
for (j = 0; j < TEX_WIDTH; j++) {
k = i * TEX_WIDTH + j;
if (p[k] == ' ') {
image[i][j] = 0;
}
else {
image[i][j] = 255;
}
}
}
glBindTexture(GL_TEXTURE_2D, texobj);
glTexImage2D(GL_TEXTURE_2D, 0, GL_INTENSITY, TEX_WIDTH, TEX_HEIGHT, 0,
GL_RED, GL_UNSIGNED_BYTE, image);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 1);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
}
static void
MakeBitmapTextures(void)
{
const char *px =
" X X "
" X X X "
" X X X "
" XXXXX X "
" X X X "
" X X X "
" X X "
" X X ";
const char *nx =
" X X "
" X X "
" X X "
" XXXXX X "
" X X "
" X X "
" X X "
" X X ";
glGenTextures(2, Textures);
MakeTexImage(px, Textures[0]);
MakeTexImage(nx, Textures[1]);
}
static void
Init(void)
{
/* Fragment shader: modulate raster color by texture, discard fragments
* with alpha < 1.0
*/
static const char *fragShaderText =
"uniform sampler2D tex2d; \n"
"void main() {\n"
" vec4 c = texture2D(tex2d, gl_TexCoord[0].xy); \n"
" if (c.w < 1.0) \n"
" discard; \n"
" gl_FragColor = c * gl_Color; \n"
"}\n";
/* Vertex shader: compute new vertex position based on incoming vertex pos,
* texcoords and special scale factor.
*/
static const char *vertShaderText =
"uniform vec2 scale; \n"
"void main() {\n"
" vec4 p = gl_ModelViewProjectionMatrix * gl_Vertex;\n"
" gl_Position.xy = p.xy + gl_MultiTexCoord0.xy * scale * p.w; \n"
" gl_Position.zw = p.zw; \n"
" gl_TexCoord[0] = gl_MultiTexCoord0; \n"
" gl_FrontColor = gl_Color; \n"
"}\n";
if (!ShadersSupported())
exit(1);
GetExtensionFuncs();
VertShader = CompileShaderText(GL_VERTEX_SHADER, vertShaderText);
FragShader = CompileShaderText(GL_FRAGMENT_SHADER, fragShaderText);
Program = LinkShaders(VertShader, FragShader);
glUseProgram_func(Program);
uScale = glGetUniformLocation_func(Program, "scale");
uTex = glGetUniformLocation_func(Program, "tex2d");
if (uTex != -1) {
glUniform1i_func(uTex, 0); /* tex unit 0 */
}
glUseProgram_func(0);
glClearColor(0.3f, 0.3f, 0.3f, 0.0f);
glEnable(GL_DEPTH_TEST);
glEnable(GL_NORMALIZE);
glEnable(GL_LIGHT0);
MakeBitmapTextures();
}
int
main(int argc, char *argv[])
{
glutInit(&argc, argv);
glutInitWindowSize(WinWidth, WinHeight);
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
Win = glutCreateWindow(argv[0]);
glutReshapeFunc(Reshape);
glutKeyboardFunc(Key);
glutSpecialFunc(SpecialKey);
glutDisplayFunc(Redisplay);
if (Anim)
glutIdleFunc(Idle);
Init();
glutMainLoop();
return 0;
}

View File

@@ -13,7 +13,6 @@
#include <GL/glut.h>
#include <GL/glext.h>
#include "extfuncs.h"
#include "shaderutil.h"
static char *FragProgFile = "CH06-brick.frag.txt";
@@ -24,15 +23,23 @@ static GLuint fragShader;
static GLuint vertShader;
static GLuint program;
struct uniform_info {
const char *name;
GLuint size;
GLint location;
GLfloat value[4];
};
static struct uniform_info Uniforms[] = {
/* vert */
{ "LightPosition", 3, GL_FLOAT, { 0.1, 0.1, 9.0, 0}, -1 },
{ "LightPosition", 3, -1, { 0.1, 0.1, 9.0, 0} },
/* frag */
{ "BrickColor", 3, GL_FLOAT, { 0.8, 0.2, 0.2, 0 }, -1 },
{ "MortarColor", 3, GL_FLOAT, { 0.6, 0.6, 0.6, 0 }, -1 },
{ "BrickSize", 2, GL_FLOAT, { 1.0, 0.3, 0, 0 }, -1 },
{ "BrickPct", 2, GL_FLOAT, { 0.9, 0.8, 0, 0 }, -1 },
END_OF_UNIFORMS
{ "BrickColor", 3, -1, { 0.8, 0.2, 0.2, 0 } },
{ "MortarColor", 3, -1, { 0.6, 0.6, 0.6, 0 } },
{ "BrickSize", 2, -1, { 1.0, 0.3, 0, 0 } },
{ "BrickPct", 2, -1, { 0.9, 0.8, 0, 0 } },
{ NULL, 0, 0, { 0, 0, 0, 0 } }
};
static GLint win = 0;
@@ -138,21 +145,122 @@ SpecialKey(int key, int x, int y)
static void
LoadAndCompileShader(GLuint shader, const char *text)
{
GLint stat;
glShaderSource_func(shader, 1, (const GLchar **) &text, NULL);
glCompileShader_func(shader);
glGetShaderiv_func(shader, GL_COMPILE_STATUS, &stat);
if (!stat) {
GLchar log[1000];
GLsizei len;
glGetShaderInfoLog_func(shader, 1000, &len, log);
fprintf(stderr, "brick: problem compiling shader: %s\n", log);
exit(1);
}
else {
printf("Shader compiled OK\n");
}
}
/**
* Read a shader from a file.
*/
static void
ReadShader(GLuint shader, const char *filename)
{
const int max = 100*1000;
int n;
char *buffer = (char*) malloc(max);
FILE *f = fopen(filename, "r");
if (!f) {
fprintf(stderr, "brick: Unable to open shader file %s\n", filename);
exit(1);
}
n = fread(buffer, 1, max, f);
printf("brick: read %d bytes from shader file %s\n", n, filename);
if (n > 0) {
buffer[n] = 0;
LoadAndCompileShader(shader, buffer);
}
fclose(f);
free(buffer);
}
static void
CheckLink(GLuint prog)
{
GLint stat;
glGetProgramiv_func(prog, GL_LINK_STATUS, &stat);
if (!stat) {
GLchar log[1000];
GLsizei len;
glGetProgramInfoLog_func(prog, 1000, &len, log);
fprintf(stderr, "Linker error:\n%s\n", log);
}
else {
fprintf(stderr, "Link success!\n");
}
}
static void
Init(void)
{
if (!ShadersSupported())
exit(1);
const char *version;
GLint i;
version = (const char *) glGetString(GL_VERSION);
if (version[0] != '2' || version[1] != '.') {
printf("Warning: this program expects OpenGL 2.0\n");
/*exit(1);*/
}
GetExtensionFuncs();
vertShader = CompileShaderFile(GL_VERTEX_SHADER, VertProgFile);
fragShader = CompileShaderFile(GL_FRAGMENT_SHADER, FragProgFile);
program = LinkShaders(vertShader, fragShader);
vertShader = glCreateShader_func(GL_VERTEX_SHADER);
ReadShader(vertShader, VertProgFile);
fragShader = glCreateShader_func(GL_FRAGMENT_SHADER);
ReadShader(fragShader, FragProgFile);
program = glCreateProgram_func();
glAttachShader_func(program, fragShader);
glAttachShader_func(program, vertShader);
glLinkProgram_func(program);
CheckLink(program);
glUseProgram_func(program);
InitUniforms(program, Uniforms);
for (i = 0; Uniforms[i].name; i++) {
Uniforms[i].location
= glGetUniformLocation_func(program, Uniforms[i].name);
printf("Uniform %s location: %d\n", Uniforms[i].name,
Uniforms[i].location);
switch (Uniforms[i].size) {
case 1:
glUniform1fv_func(Uniforms[i].location, 1, Uniforms[i].value);
break;
case 2:
glUniform2fv_func(Uniforms[i].location, 1, Uniforms[i].value);
break;
case 3:
glUniform3fv_func(Uniforms[i].location, 1, Uniforms[i].value);
break;
case 4:
glUniform4fv_func(Uniforms[i].location, 1, Uniforms[i].value);
break;
default:
abort();
}
}
assert(glGetError() == 0);

View File

@@ -13,7 +13,6 @@
#include <GL/glu.h>
#include <GL/glext.h>
#include "extfuncs.h"
#include "shaderutil.h"
static char *FragProgFile = "CH11-bumpmap.frag.txt";
@@ -25,13 +24,20 @@ static GLuint vertShader;
static GLuint program;
struct uniform_info {
const char *name;
GLuint size;
GLint location;
GLfloat value[4];
};
static struct uniform_info Uniforms[] = {
{ "LightPosition", 3, GL_FLOAT, { 0.57737, 0.57735, 0.57735, 0.0 }, -1 },
{ "SurfaceColor", 3, GL_FLOAT, { 0.8, 0.8, 0.2, 0 }, -1 },
{ "BumpDensity", 1, GL_FLOAT, { 10.0, 0, 0, 0 }, -1 },
{ "BumpSize", 1, GL_FLOAT, { 0.125, 0, 0, 0 }, -1 },
{ "SpecularFactor", 1, GL_FLOAT, { 0.5, 0, 0, 0 }, -1 },
END_OF_UNIFORMS
{ "LightPosition", 3, -1, { 0.57737, 0.57735, 0.57735, 0.0 } },
{ "SurfaceColor", 3, -1, { 0.8, 0.8, 0.2, 0 } },
{ "BumpDensity", 1, -1, { 10.0, 0, 0, 0 } },
{ "BumpSize", 1, -1, { 0.125, 0, 0, 0 } },
{ "SpecularFactor", 1, -1, { 0.5, 0, 0, 0 } },
{ NULL, 0, 0, { 0, 0, 0, 0 } }
};
static GLint win = 0;
@@ -226,18 +232,100 @@ SpecialKey(int key, int x, int y)
}
static void
LoadAndCompileShader(GLuint shader, const char *text)
{
GLint stat;
glShaderSource_func(shader, 1, (const GLchar **) &text, NULL);
glCompileShader_func(shader);
glGetShaderiv_func(shader, GL_COMPILE_STATUS, &stat);
if (!stat) {
GLchar log[1000];
GLsizei len;
glGetShaderInfoLog_func(shader, 1000, &len, log);
fprintf(stderr, "bump: problem compiling shader: %s\n", log);
exit(1);
}
else {
printf("Shader compiled OK\n");
}
}
/**
* Read a shader from a file.
*/
static void
ReadShader(GLuint shader, const char *filename)
{
const int max = 100*1000;
int n;
char *buffer = (char*) malloc(max);
FILE *f = fopen(filename, "r");
if (!f) {
fprintf(stderr, "bump: Unable to open shader file %s\n", filename);
exit(1);
}
n = fread(buffer, 1, max, f);
printf("bump: read %d bytes from shader file %s\n", n, filename);
if (n > 0) {
buffer[n] = 0;
LoadAndCompileShader(shader, buffer);
}
fclose(f);
free(buffer);
}
static void
CheckLink(GLuint prog)
{
GLint stat;
glGetProgramiv_func(prog, GL_LINK_STATUS, &stat);
if (!stat) {
GLchar log[1000];
GLsizei len;
glGetProgramInfoLog_func(prog, 1000, &len, log);
fprintf(stderr, "Linker error:\n%s\n", log);
}
else {
fprintf(stderr, "Link success!\n");
}
}
static void
Init(void)
{
if (!ShadersSupported())
exit(1);
const char *version;
GLint i;
version = (const char *) glGetString(GL_VERSION);
if (version[0] != '2' || version[1] != '.') {
printf("Warning: this program expects OpenGL 2.0\n");
/*exit(1);*/
}
printf("GL_RENDERER = %s\n",(const char *) glGetString(GL_RENDERER));
GetExtensionFuncs();
vertShader = CompileShaderFile(GL_VERTEX_SHADER, VertProgFile);
fragShader = CompileShaderFile(GL_FRAGMENT_SHADER, FragProgFile);
program = LinkShaders(vertShader, fragShader);
vertShader = glCreateShader_func(GL_VERTEX_SHADER);
ReadShader(vertShader, VertProgFile);
fragShader = glCreateShader_func(GL_FRAGMENT_SHADER);
ReadShader(fragShader, FragProgFile);
program = glCreateProgram_func();
glAttachShader_func(program, fragShader);
glAttachShader_func(program, vertShader);
glLinkProgram_func(program);
CheckLink(program);
glUseProgram_func(program);
assert(glIsProgram_func(program));
@@ -248,7 +336,28 @@ Init(void)
CheckError(__LINE__);
InitUniforms(program, Uniforms);
for (i = 0; Uniforms[i].name; i++) {
Uniforms[i].location
= glGetUniformLocation_func(program, Uniforms[i].name);
printf("Uniform %s location: %d\n", Uniforms[i].name,
Uniforms[i].location);
switch (Uniforms[i].size) {
case 1:
glUniform1fv_func(Uniforms[i].location, 1, Uniforms[i].value);
break;
case 2:
glUniform2fv_func(Uniforms[i].location, 1, Uniforms[i].value);
break;
case 3:
glUniform3fv_func(Uniforms[i].location, 1, Uniforms[i].value);
break;
case 4:
glUniform4fv_func(Uniforms[i].location, 1, Uniforms[i].value);
break;
default:
abort();
}
}
CheckError(__LINE__);

View File

@@ -17,7 +17,6 @@
#include <GL/glut.h>
#include <GL/glext.h>
#include "extfuncs.h"
#include "shaderutil.h"
static char *FragProgFile = NULL;
@@ -160,6 +159,68 @@ MakeRect(void)
}
static void
LoadAndCompileShader(GLuint shader, const char *text)
{
GLint stat;
glShaderSource_func(shader, 1, (const GLchar **) &text, NULL);
glCompileShader_func(shader);
glGetShaderiv_func(shader, GL_COMPILE_STATUS, &stat);
if (!stat) {
GLchar log[1000];
GLsizei len;
glGetShaderInfoLog_func(shader, 1000, &len, log);
fprintf(stderr, "fslight: problem compiling shader:\n%s\n", log);
exit(1);
}
}
/**
* Read a shader from a file.
*/
static void
ReadShader(GLuint shader, const char *filename)
{
const int max = 100*1000;
int n;
char *buffer = (char*) malloc(max);
FILE *f = fopen(filename, "r");
if (!f) {
fprintf(stderr, "fslight: Unable to open shader file %s\n", filename);
exit(1);
}
n = fread(buffer, 1, max, f);
printf("fslight: read %d bytes from shader file %s\n", n, filename);
if (n > 0) {
buffer[n] = 0;
LoadAndCompileShader(shader, buffer);
}
fclose(f);
free(buffer);
}
static void
CheckLink(GLuint prog)
{
GLint stat;
glGetProgramiv_func(prog, GL_LINK_STATUS, &stat);
if (!stat) {
GLchar log[1000];
GLsizei len;
glGetProgramInfoLog_func(prog, 1000, &len, log);
fprintf(stderr, "Linker error:\n%s\n", log);
}
}
static void
Init(void)
{
@@ -173,16 +234,33 @@ Init(void)
" gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;\n"
" gl_TexCoord[0] = gl_MultiTexCoord0;\n"
"}\n";
const char *version;
if (!ShadersSupported())
version = (const char *) glGetString(GL_VERSION);
if (version[0] != '2' || version[1] != '.') {
printf("This program requires OpenGL 2.x, found %s\n", version);
exit(1);
}
GetExtensionFuncs();
vertShader = CompileShaderText(GL_VERTEX_SHADER, vertShaderText);
fragShader = CompileShaderText(GL_FRAGMENT_SHADER, fragShaderText);
program = LinkShaders(vertShader, fragShader);
fragShader = glCreateShader_func(GL_FRAGMENT_SHADER);
if (FragProgFile)
ReadShader(fragShader, FragProgFile);
else
LoadAndCompileShader(fragShader, fragShaderText);
vertShader = glCreateShader_func(GL_VERTEX_SHADER);
if (VertProgFile)
ReadShader(vertShader, VertProgFile);
else
LoadAndCompileShader(vertShader, vertShaderText);
program = glCreateProgram_func();
glAttachShader_func(program, fragShader);
glAttachShader_func(program, vertShader);
glLinkProgram_func(program);
CheckLink(program);
glUseProgram_func(program);
/*assert(glGetError() == 0);*/

View File

@@ -13,7 +13,6 @@
#include <GL/glut.h>
#include <GL/glext.h>
#include "extfuncs.h"
#include "shaderutil.h"
static char *FragProgFile = "CH18-mandel.frag.txt";
@@ -25,21 +24,28 @@ static GLuint vertShader;
static GLuint program;
struct uniform_info {
const char *name;
GLuint size;
GLint location;
GLfloat value[4];
};
static struct uniform_info Uniforms[] = {
/* vert */
{ "LightPosition", 3, GL_FLOAT, { 0.1, 0.1, 9.0, 0}, -1 },
{ "SpecularContribution", 1, GL_FLOAT, { 0.5, 0, 0, 0 }, -1 },
{ "DiffuseContribution", 1, GL_FLOAT, { 0.5, 0, 0, 0 }, -1 },
{ "Shininess", 1, GL_FLOAT, { 20.0, 0, 0, 0 }, -1 },
{ "LightPosition", 3, -1, { 0.1, 0.1, 9.0, 0} },
{ "SpecularContribution", 1, -1, { 0.5, 0, 0, 0 } },
{ "DiffuseContribution", 1, -1, { 0.5, 0, 0, 0 } },
{ "Shininess", 1, -1, { 20.0, 0, 0, 0 } },
/* frag */
{ "MaxIterations", 1, GL_FLOAT, { 12, 0, 0, 0 }, -1 },
{ "Zoom", 1, GL_FLOAT, { 0.125, 0, 0, 0 }, -1 },
{ "Xcenter", 1, GL_FLOAT, { -1.5, 0, 0, 0 }, -1 },
{ "Ycenter", 1, GL_FLOAT, { .005, 0, 0, 0 }, -1 },
{ "InnerColor", 3, GL_FLOAT, { 1, 0, 0, 0 }, -1 },
{ "OuterColor1", 3, GL_FLOAT, { 0, 1, 0, 0 }, -1 },
{ "OuterColor2", 3, GL_FLOAT, { 0, 0, 1, 0 }, -1 },
END_OF_UNIFORMS
{ "MaxIterations", 1, -1, { 12, 0, 0, 0 } },
{ "Zoom", 1, -1, { 0.125, 0, 0, 0 } },
{ "Xcenter", 1, -1, { -1.5, 0, 0, 0 } },
{ "Ycenter", 1, -1, { .005, 0, 0, 0 } },
{ "InnerColor", 3, -1, { 1, 0, 0, 0 } },
{ "OuterColor1", 3, -1, { 0, 1, 0, 0 } },
{ "OuterColor2", 3, -1, { 0, 0, 1, 0 } },
{ NULL, 0, 0, { 0, 0, 0, 0 } }
};
static GLint win = 0;
@@ -151,21 +157,123 @@ SpecialKey(int key, int x, int y)
}
static void
LoadAndCompileShader(GLuint shader, const char *text)
{
GLint stat;
glShaderSource_func(shader, 1, (const GLchar **) &text, NULL);
glCompileShader_func(shader);
glGetShaderiv_func(shader, GL_COMPILE_STATUS, &stat);
if (!stat) {
GLchar log[1000];
GLsizei len;
glGetShaderInfoLog_func(shader, 1000, &len, log);
fprintf(stderr, "mandelbrot: problem compiling shader: %s\n", log);
exit(1);
}
else {
printf("Shader compiled OK\n");
}
}
/**
* Read a shader from a file.
*/
static void
ReadShader(GLuint shader, const char *filename)
{
const int max = 100*1000;
int n;
char *buffer = (char*) malloc(max);
FILE *f = fopen(filename, "r");
if (!f) {
fprintf(stderr, "mandelbrot: Unable to open shader file %s\n", filename);
exit(1);
}
n = fread(buffer, 1, max, f);
printf("mandelbrot: read %d bytes from shader file %s\n", n, filename);
if (n > 0) {
buffer[n] = 0;
LoadAndCompileShader(shader, buffer);
}
fclose(f);
free(buffer);
}
static void
CheckLink(GLuint prog)
{
GLint stat;
glGetProgramiv_func(prog, GL_LINK_STATUS, &stat);
if (!stat) {
GLchar log[1000];
GLsizei len;
glGetProgramInfoLog_func(prog, 1000, &len, log);
fprintf(stderr, "Linker error:\n%s\n", log);
}
else {
fprintf(stderr, "Link success!\n");
}
}
static void
Init(void)
{
if (!ShadersSupported())
exit(1);
const char *version;
GLint i;
version = (const char *) glGetString(GL_VERSION);
if (version[0] != '2' || version[1] != '.') {
printf("Warning: this program expects OpenGL 2.0\n");
/*exit(1);*/
}
GetExtensionFuncs();
vertShader = CompileShaderFile(GL_VERTEX_SHADER, VertProgFile);
fragShader = CompileShaderFile(GL_FRAGMENT_SHADER, FragProgFile);
program = LinkShaders(vertShader, fragShader);
vertShader = glCreateShader_func(GL_VERTEX_SHADER);
ReadShader(vertShader, VertProgFile);
fragShader = glCreateShader_func(GL_FRAGMENT_SHADER);
ReadShader(fragShader, FragProgFile);
program = glCreateProgram_func();
glAttachShader_func(program, fragShader);
glAttachShader_func(program, vertShader);
glLinkProgram_func(program);
CheckLink(program);
glUseProgram_func(program);
InitUniforms(program, Uniforms);
for (i = 0; Uniforms[i].name; i++) {
Uniforms[i].location
= glGetUniformLocation_func(program, Uniforms[i].name);
printf("Uniform %s location: %d\n", Uniforms[i].name,
Uniforms[i].location);
switch (Uniforms[i].size) {
case 1:
glUniform1fv_func(Uniforms[i].location, 1, Uniforms[i].value);
break;
case 2:
glUniform2fv_func(Uniforms[i].location, 1, Uniforms[i].value);
break;
case 3:
glUniform3fv_func(Uniforms[i].location, 1, Uniforms[i].value);
break;
case 4:
glUniform4fv_func(Uniforms[i].location, 1, Uniforms[i].value);
break;
default:
abort();
}
}
uZoom = glGetUniformLocation_func(program, "Zoom");
uXcenter = glGetUniformLocation_func(program, "Xcenter");

View File

@@ -1,285 +0,0 @@
/**
* Test multi-texturing with GL shading language.
*
* Copyright (C) 2008 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <assert.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "GL/glut.h"
#include "readtex.h"
#include "extfuncs.h"
#include "shaderutil.h"
static const char *Demo = "multitex";
static const char *VertFile = "multitex.vert.txt";
static const char *FragFile = "multitex.frag.txt";
static const char *TexFiles[2] =
{
"../images/tile.rgb",
"../images/tree2.rgba"
};
static GLuint Program;
static GLfloat Xrot = -90.0, Yrot = .0, Zrot = 0.0;
static GLfloat EyeDist = 10;
static GLboolean Anim = GL_TRUE;
/* value[0] = tex unit */
static struct uniform_info Uniforms[] = {
{ "tex1", 1, GL_INT, { 0, 0, 0, 0 }, -1 },
{ "tex2", 1, GL_INT, { 1, 0, 0, 0 }, -1 },
END_OF_UNIFORMS
};
static void
DrawPolygon(GLfloat size)
{
glPushMatrix();
glRotatef(90, 1, 0, 0);
glNormal3f(0, 0, 1);
glBegin(GL_POLYGON);
glMultiTexCoord2f(GL_TEXTURE0, 0, 0);
glMultiTexCoord2f(GL_TEXTURE1, 0, 0);
glVertex2f(-size, -size);
glMultiTexCoord2f(GL_TEXTURE0, 2, 0);
glMultiTexCoord2f(GL_TEXTURE1, 1, 0);
glVertex2f( size, -size);
glMultiTexCoord2f(GL_TEXTURE0, 2, 2);
glMultiTexCoord2f(GL_TEXTURE1, 1, 1);
glVertex2f( size, size);
glMultiTexCoord2f(GL_TEXTURE0, 0, 2);
glMultiTexCoord2f(GL_TEXTURE1, 0, 1);
glVertex2f(-size, size);
glEnd();
glPopMatrix();
}
static void
draw(void)
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glPushMatrix(); /* modelview matrix */
glTranslatef(0.0, 0.0, -EyeDist);
glRotatef(Zrot, 0, 0, 1);
glRotatef(Yrot, 0, 1, 0);
glRotatef(Xrot, 1, 0, 0);
DrawPolygon(3.0);
glPopMatrix();
glutSwapBuffers();
}
static void
idle(void)
{
GLfloat t = 0.05 * glutGet(GLUT_ELAPSED_TIME);
Yrot = t;
glutPostRedisplay();
}
static void
key(unsigned char k, int x, int y)
{
(void) x;
(void) y;
switch (k) {
case ' ':
case 'a':
Anim = !Anim;
if (Anim)
glutIdleFunc(idle);
else
glutIdleFunc(NULL);
break;
case 'z':
EyeDist -= 0.5;
if (EyeDist < 3.0)
EyeDist = 3.0;
break;
case 'Z':
EyeDist += 0.5;
if (EyeDist > 90.0)
EyeDist = 90;
break;
case 27:
exit(0);
}
glutPostRedisplay();
}
static void
specialkey(int key, int x, int y)
{
GLfloat step = 2.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();
}
/* new window size or exposure */
static void
Reshape(int width, int height)
{
GLfloat ar = (float) width / (float) height;
glViewport(0, 0, (GLint)width, (GLint)height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glFrustum(-2.0*ar, 2.0*ar, -2.0, 2.0, 4.0, 100.0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
}
static void
InitTextures(void)
{
GLenum filter = GL_LINEAR;
int i;
for (i = 0; i < 2; i++) {
GLint imgWidth, imgHeight;
GLenum imgFormat;
GLubyte *image = NULL;
image = LoadRGBImage(TexFiles[i], &imgWidth, &imgHeight, &imgFormat);
if (!image) {
printf("Couldn't read %s\n", TexFiles[i]);
exit(0);
}
glActiveTexture(GL_TEXTURE0 + i);
glBindTexture(GL_TEXTURE_2D, 42 + i);
gluBuild2DMipmaps(GL_TEXTURE_2D, 4, 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, filter);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, filter);
}
}
static GLuint
CreateProgram(const char *vertProgFile, const char *fragProgFile,
struct uniform_info *uniforms)
{
GLuint fragShader, vertShader, program;
vertShader = CompileShaderFile(GL_VERTEX_SHADER, vertProgFile);
fragShader = CompileShaderFile(GL_FRAGMENT_SHADER, fragProgFile);
assert(vertShader);
program = LinkShaders(vertShader, fragShader);
glUseProgram_func(program);
InitUniforms(program, uniforms);
return program;
}
static void
InitPrograms(void)
{
Program = CreateProgram(VertFile, FragFile, Uniforms);
}
static void
InitGL(void)
{
const char *version = (const char *) glGetString(GL_VERSION);
if (version[0] != '2' || version[1] != '.') {
printf("Warning: this program expects OpenGL 2.0\n");
/*exit(1);*/
}
printf("GL_RENDERER = %s\n",(const char *) glGetString(GL_RENDERER));
GetExtensionFuncs();
InitTextures();
InitPrograms();
glEnable(GL_DEPTH_TEST);
glClearColor(.6, .6, .9, 0);
glColor3f(1.0, 1.0, 1.0);
}
int
main(int argc, char *argv[])
{
glutInit(&argc, argv);
glutInitWindowSize(500, 400);
glutInitDisplayMode(GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE);
glutCreateWindow(Demo);
glutReshapeFunc(Reshape);
glutKeyboardFunc(key);
glutSpecialFunc(specialkey);
glutDisplayFunc(draw);
if (Anim)
glutIdleFunc(idle);
InitGL();
glutMainLoop();
return 0;
}

View File

@@ -1,15 +0,0 @@
// Multi-texture fragment shader
// Brian Paul
// Composite second texture over first.
// We're assuming the 2nd texture has a meaningful alpha channel.
uniform sampler2D tex1;
uniform sampler2D tex2;
void main()
{
vec4 t1 = texture2D(tex1, gl_TexCoord[0].xy, 0.0);
vec4 t2 = texture2D(tex2, gl_TexCoord[1].xy, 0.0);
gl_FragColor = mix(t1, t2, t2.w);
}

View File

@@ -1,10 +0,0 @@
// Multi-texture vertex shader
// Brian Paul
void main()
{
gl_TexCoord[0] = gl_MultiTexCoord0;
gl_TexCoord[1] = gl_MultiTexCoord1;
gl_Position = ftransform();
}

View File

@@ -12,7 +12,6 @@
#include <GL/glut.h>
#include <GL/glext.h>
#include "extfuncs.h"
#include "shaderutil.h"
static const char *VertShaderText =
@@ -35,11 +34,18 @@ static const char *FragShaderText =
"}\n";
struct uniform_info {
const char *name;
GLuint size;
GLint location;
GLfloat value[4];
};
static struct uniform_info Uniforms[] = {
{ "Scale", 4, GL_FLOAT, { 0.5, 0.4, 0.0, 0}, -1 },
{ "Bias", 4, GL_FLOAT, { 0.5, 0.3, 0.0, 0}, -1 },
{ "Slice", 1, GL_FLOAT, { 0.5, 0, 0, 0}, -1 },
END_OF_UNIFORMS
{ "Scale", 4, -1, { 0.5, 0.4, 0.0, 0} },
{ "Bias", 4, -1, { 0.5, 0.3, 0.0, 0} },
{ "Slice", 1, -1, { 0.5, 0, 0, 0} },
{ NULL, 0, 0, { 0, 0, 0, 0 } }
};
/* program/shader objects */
@@ -168,21 +174,95 @@ SpecialKey(int key, int x, int y)
static void
LoadAndCompileShader(GLuint shader, const char *text)
{
GLint stat;
glShaderSource_func(shader, 1, (const GLchar **) &text, NULL);
glCompileShader_func(shader);
glGetShaderiv_func(shader, GL_COMPILE_STATUS, &stat);
if (!stat) {
GLchar log[1000];
GLsizei len;
glGetShaderInfoLog_func(shader, 1000, &len, log);
fprintf(stderr, "noise: problem compiling shader: %s\n", log);
exit(1);
}
else {
printf("Shader compiled OK\n");
}
}
static void
CheckLink(GLuint prog)
{
GLint stat;
glGetProgramiv_func(prog, GL_LINK_STATUS, &stat);
if (!stat) {
GLchar log[1000];
GLsizei len;
glGetProgramInfoLog_func(prog, 1000, &len, log);
fprintf(stderr, "Linker error:\n%s\n", log);
}
else {
fprintf(stderr, "Link success!\n");
}
}
static void
Init(void)
{
if (!ShadersSupported())
exit(1);
const char *version;
GLint i;
version = (const char *) glGetString(GL_VERSION);
if (version[0] != '2' || version[1] != '.') {
printf("Warning: this program expects OpenGL 2.0\n");
/*exit(1);*/
}
GetExtensionFuncs();
vertShader = CompileShaderText(GL_VERTEX_SHADER, VertShaderText);
fragShader = CompileShaderText(GL_FRAGMENT_SHADER, FragShaderText);
program = LinkShaders(vertShader, fragShader);
vertShader = glCreateShader_func(GL_VERTEX_SHADER);
LoadAndCompileShader(vertShader, VertShaderText);
fragShader = glCreateShader_func(GL_FRAGMENT_SHADER);
LoadAndCompileShader(fragShader, FragShaderText);
program = glCreateProgram_func();
glAttachShader_func(program, fragShader);
glAttachShader_func(program, vertShader);
glLinkProgram_func(program);
CheckLink(program);
glUseProgram_func(program);
InitUniforms(program, Uniforms);
for (i = 0; Uniforms[i].name; i++) {
Uniforms[i].location
= glGetUniformLocation_func(program, Uniforms[i].name);
printf("Uniform %s location: %d\n", Uniforms[i].name,
Uniforms[i].location);
switch (Uniforms[i].size) {
case 1:
glUniform1fv_func(Uniforms[i].location, 1, Uniforms[i].value);
break;
case 2:
glUniform2fv_func(Uniforms[i].location, 1, Uniforms[i].value);
break;
case 3:
glUniform3fv_func(Uniforms[i].location, 1, Uniforms[i].value);
break;
case 4:
glUniform4fv_func(Uniforms[i].location, 1, Uniforms[i].value);
break;
default:
abort();
}
}
assert(glGetError() == 0);

View File

@@ -1,260 +0,0 @@
/**
* Implement smooth (AA) points with shaders.
* A simple variation could be used for sprite points.
* Brian Paul
* 29 July 2007
*/
#include <assert.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <GL/gl.h>
#include <GL/glut.h>
#include <GL/glext.h>
#include "extfuncs.h"
#include "shaderutil.h"
static GLuint FragShader;
static GLuint VertShader;
static GLuint Program;
static GLint Win = 0;
static GLint WinWidth = 500, WinHeight = 200;
static GLfloat Xpos = 0.0f, Ypos = 0.0f;
static GLint uViewportInv;
static GLboolean Smooth = GL_TRUE, Blend = GL_TRUE;
/**
* Issue vertices for a "shader point".
* The position is duplicated, only texcoords (or other vertex attrib) change.
* The vertex program will compute the "real" quad corners.
*/
static void
PointVertex3f(GLfloat x, GLfloat y, GLfloat z)
{
glTexCoord2f(-1, -1);
glVertex3f(x, y, z);
glTexCoord2f( 1, -1);
glVertex3f(x, y, z);
glTexCoord2f( 1, 1);
glVertex3f(x, y, z);
glTexCoord2f(-1, 1);
glVertex3f(x, y, z);
}
static void
DrawPoints(GLboolean shaderPoints)
{
int i;
for (i = 0; i < 9; i++) {
GLfloat x = i - 4, y = 0, z = 0;
/* note: can't call glPointSize inside Begin/End :( */
glPointSize( 2 + i * 5 );
if (shaderPoints) {
glBegin(GL_QUADS);
PointVertex3f(x, y, z);
glEnd();
}
else {
glBegin(GL_POINTS);
glVertex3f(x, y, z);
glEnd();
}
}
}
/**
* Top row of points rendered convetionally,
* bottom row rendered with shaders.
*/
static void
Redisplay(void)
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
if (Smooth)
glEnable(GL_POINT_SMOOTH);
else
glDisable(GL_POINT_SMOOTH);
if (Blend)
glEnable(GL_BLEND);
else
glDisable(GL_BLEND);
glPushMatrix();
glTranslatef(Xpos, Ypos, 0);
/*
* regular points
*/
glPushMatrix();
glTranslatef(0, 1.2, 0);
glUseProgram_func(0);
DrawPoints(GL_FALSE);
glPopMatrix();
/*
* shader points
*/
glPushMatrix();
glTranslatef(0, -1.2, 0);
glUseProgram_func(Program);
if (uViewportInv != -1) {
glUniform2f_func(uViewportInv, 1.0 / WinWidth, 1.0 / WinHeight);
}
DrawPoints(GL_TRUE);
glPopMatrix();
glPopMatrix();
glutSwapBuffers();
}
static void
Reshape(int width, int height)
{
WinWidth = width;
WinHeight = height;
glViewport(0, 0, width, height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glFrustum(-1.0, 1.0, -1.0, 1.0, 4.0, 30.0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glTranslatef(0.0f, 0.0f, -20.0f);
}
static void
Key(unsigned char key, int x, int y)
{
(void) x;
(void) y;
switch(key) {
case 'b':
Blend = !Blend;
break;
case 's':
Smooth = !Smooth;
break;
case 27:
glDeleteShader_func(FragShader);
glDeleteShader_func(VertShader);
glDeleteProgram_func(Program);
glutDestroyWindow(Win);
exit(0);
}
glutPostRedisplay();
}
static void
SpecialKey(int key, int x, int y)
{
const GLfloat step = 1/100.0;
switch(key) {
case GLUT_KEY_UP:
Ypos += step;
break;
case GLUT_KEY_DOWN:
Ypos -= step;
break;
case GLUT_KEY_LEFT:
Xpos -= step;
break;
case GLUT_KEY_RIGHT:
Xpos += step;
break;
}
glutPostRedisplay();
}
static void
Init(void)
{
/* Fragment shader: compute distance of fragment from center of point
* (we're using texcoords but another varying could be used).
* if dist > 1, discard (coverage==0)
* if dist < k, coverage = 1
* else, coverage = func(dist)
* Note: length() uses sqrt() and may be expensive. The distance could
* be squared instead (with adjustments to the threshold (k) test)
*/
static const char *fragShaderText =
"void main() {\n"
" float cover; \n"
" float k = 2.0 / gl_Point.size; \n"
" float d = length(gl_TexCoord[0].xy); \n"
" if (d >= 1.0) \n"
" discard; \n"
" if (d < 1.0 - k) \n"
" cover = 1.0; \n"
" else \n"
" cover = (1.0 - d) * 0.5 * gl_Point.size; \n"
" gl_FragColor.rgb = gl_Color.rgb; \n"
" gl_FragColor.a = cover; \n"
"}\n";
/* Vertex shader: compute new vertex position based on incoming vertex pos,
* texcoords, point size, and inverse viewport scale factor.
* Note: should compute point size attenuation here too.
*/
static const char *vertShaderText =
"uniform vec2 viewportInv; \n"
"void main() {\n"
" vec4 pos = gl_ModelViewProjectionMatrix * gl_Vertex;\n"
" gl_Position.xy = pos.xy + gl_MultiTexCoord0.xy * viewportInv \n"
" * gl_Point.size * pos.w; \n"
" gl_Position.zw = pos.zw; \n"
" gl_TexCoord[0] = gl_MultiTexCoord0; \n"
" gl_FrontColor = gl_Color; \n"
"}\n";
if (!ShadersSupported())
exit(1);
GetExtensionFuncs();
VertShader = CompileShaderText(GL_VERTEX_SHADER, vertShaderText);
FragShader = CompileShaderText(GL_FRAGMENT_SHADER, fragShaderText);
Program = LinkShaders(VertShader, FragShader);
glUseProgram_func(Program);
uViewportInv = glGetUniformLocation_func(Program, "viewportInv");
glUseProgram_func(0);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
}
int
main(int argc, char *argv[])
{
glutInit(&argc, argv);
glutInitWindowSize(WinWidth, WinHeight);
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
Win = glutCreateWindow(argv[0]);
glutReshapeFunc(Reshape);
glutKeyboardFunc(Key);
glutSpecialFunc(SpecialKey);
glutDisplayFunc(Redisplay);
Init();
glutMainLoop();
return 0;
}

View File

@@ -31,7 +31,6 @@
#include "GL/glut.h"
#include "readtex.h"
#include "extfuncs.h"
#include "shaderutil.h"
static const char *Demo = "texdemo1";
@@ -51,19 +50,38 @@ static GLfloat EyeDist = 10;
static GLboolean Anim = GL_TRUE;
struct uniform_info {
const char *name;
GLuint size;
GLint location;
GLenum type; /**< GL_FLOAT or GL_INT */
GLfloat value[4];
};
static struct uniform_info ReflectUniforms[] = {
{ "cubeTex", 1, GL_INT, { 0, 0, 0, 0 }, -1 },
{ "lightPos", 3, GL_FLOAT, { 10, 10, 20, 0 }, -1 },
END_OF_UNIFORMS
{ "cubeTex", 1, -1, GL_INT, { 0, 0, 0, 0 } },
{ "lightPos", 3, -1, GL_FLOAT, { 10, 10, 20, 0 } },
{ NULL, 0, 0, 0, { 0, 0, 0, 0 } }
};
static struct uniform_info SimpleUniforms[] = {
{ "tex2d", 1, GL_INT, { 1, 0, 0, 0 }, -1 },
{ "lightPos", 3, GL_FLOAT, { 10, 10, 20, 0 }, -1 },
END_OF_UNIFORMS
{ "tex2d", 1, -1, GL_INT, { 1, 0, 0, 0 } },
{ "lightPos", 3, -1, GL_FLOAT, { 10, 10, 20, 0 } },
{ NULL, 0, 0, 0, { 0, 0, 0, 0 } }
};
static void
CheckError(int line)
{
GLenum err = glGetError();
if (err) {
printf("GL Error %s (0x%x) at line %d\n",
gluErrorString(err), (int) err, line);
}
}
static void
DrawGround(GLfloat size)
{
@@ -368,19 +386,132 @@ InitTextures(GLboolean useImageFiles)
}
static void
LoadAndCompileShader(GLuint shader, const char *text)
{
GLint stat;
glShaderSource_func(shader, 1, (const GLchar **) &text, NULL);
glCompileShader_func(shader);
glGetShaderiv_func(shader, GL_COMPILE_STATUS, &stat);
if (!stat) {
GLchar log[1000];
GLsizei len;
glGetShaderInfoLog_func(shader, 1000, &len, log);
fprintf(stderr, "%s: problem compiling shader: %s\n", Demo, log);
exit(1);
}
else {
printf("Shader compiled OK\n");
}
}
/**
* Read a shader from a file.
*/
static void
ReadShader(GLuint shader, const char *filename)
{
const int max = 100*1000;
int n;
char *buffer = (char*) malloc(max);
FILE *f = fopen(filename, "r");
if (!f) {
fprintf(stderr, "%s: Unable to open shader file %s\n", Demo, filename);
exit(1);
}
n = fread(buffer, 1, max, f);
printf("%s: read %d bytes from shader file %s\n", Demo, n, filename);
if (n > 0) {
buffer[n] = 0;
LoadAndCompileShader(shader, buffer);
}
fclose(f);
free(buffer);
}
static void
CheckLink(GLuint prog)
{
GLint stat;
glGetProgramiv_func(prog, GL_LINK_STATUS, &stat);
if (!stat) {
GLchar log[1000];
GLsizei len;
glGetProgramInfoLog_func(prog, 1000, &len, log);
fprintf(stderr, "Linker error:\n%s\n", log);
}
else {
fprintf(stderr, "Link success!\n");
}
}
static GLuint
CreateProgram(const char *vertProgFile, const char *fragProgFile,
struct uniform_info *uniforms)
{
GLuint fragShader, vertShader, program;
GLuint fragShader = 0, vertShader = 0, program = 0;
GLint i;
vertShader = CompileShaderFile(GL_VERTEX_SHADER, vertProgFile);
fragShader = CompileShaderFile(GL_FRAGMENT_SHADER, fragProgFile);
program = LinkShaders(vertShader, fragShader);
program = glCreateProgram_func();
if (vertProgFile) {
vertShader = glCreateShader_func(GL_VERTEX_SHADER);
ReadShader(vertShader, vertProgFile);
glAttachShader_func(program, vertShader);
}
if (fragProgFile) {
fragShader = glCreateShader_func(GL_FRAGMENT_SHADER);
ReadShader(fragShader, fragProgFile);
glAttachShader_func(program, fragShader);
}
glLinkProgram_func(program);
CheckLink(program);
glUseProgram_func(program);
InitUniforms(program, uniforms);
assert(glIsProgram_func(program));
assert(glIsShader_func(fragShader));
assert(glIsShader_func(vertShader));
CheckError(__LINE__);
for (i = 0; uniforms[i].name; i++) {
uniforms[i].location
= glGetUniformLocation_func(program, uniforms[i].name);
printf("Uniform %s location: %d\n", uniforms[i].name,
uniforms[i].location);
switch (uniforms[i].size) {
case 1:
if (uniforms[i].type == GL_INT)
glUniform1i_func(uniforms[i].location,
(GLint) uniforms[i].value[0]);
else
glUniform1fv_func(uniforms[i].location, 1, uniforms[i].value);
break;
case 2:
glUniform2fv_func(uniforms[i].location, 1, uniforms[i].value);
break;
case 3:
glUniform3fv_func(uniforms[i].location, 1, uniforms[i].value);
break;
case 4:
glUniform4fv_func(uniforms[i].location, 1, uniforms[i].value);
break;
default:
abort();
}
}
CheckError(__LINE__);
return program;
}

View File

@@ -13,7 +13,6 @@
#include <GL/glut.h>
#include <GL/glext.h>
#include "extfuncs.h"
#include "shaderutil.h"
static char *FragProgFile = "CH11-toyball.frag.txt";
@@ -25,23 +24,30 @@ static GLuint vertShader;
static GLuint program;
struct uniform_info {
const char *name;
GLuint size;
GLint location;
GLfloat value[4];
};
static struct uniform_info Uniforms[] = {
{ "LightDir", 4, GL_FLOAT, { 0.57737, 0.57735, 0.57735, 0.0 }, -1 },
{ "HVector", 4, GL_FLOAT, { 0.32506, 0.32506, 0.88808, 0.0 }, -1 },
{ "BallCenter", 4, GL_FLOAT, { 0.0, 0.0, 0.0, 1.0 }, -1 },
{ "SpecularColor", 4, GL_FLOAT, { 0.4, 0.4, 0.4, 60.0 }, -1 },
{ "Red", 4, GL_FLOAT, { 0.6, 0.0, 0.0, 1.0 }, -1 },
{ "Blue", 4, GL_FLOAT, { 0.0, 0.3, 0.6, 1.0 }, -1 },
{ "Yellow", 4, GL_FLOAT, { 0.6, 0.5, 0.0, 1.0 }, -1 },
{ "HalfSpace0", 4, GL_FLOAT, { 1.0, 0.0, 0.0, 0.2 }, -1 },
{ "HalfSpace1", 4, GL_FLOAT, { 0.309016994, 0.951056516, 0.0, 0.2 }, -1 },
{ "HalfSpace2", 4, GL_FLOAT, { -0.809016994, 0.587785252, 0.0, 0.2 }, -1 },
{ "HalfSpace3", 4, GL_FLOAT, { -0.809016994, -0.587785252, 0.0, 0.2 }, -1 },
{ "HalfSpace4", 4, GL_FLOAT, { 0.309116994, -0.951056516, 0.0, 0.2 }, -1 },
{ "InOrOutInit", 1, GL_FLOAT, { -3.0, 0, 0, 0 }, -1 },
{ "StripeWidth", 1, GL_FLOAT, { 0.3, 0, 0, 0 }, -1 },
{ "FWidth", 1, GL_FLOAT, { 0.005, 0, 0, 0 }, -1 },
END_OF_UNIFORMS
{ "LightDir", 4, -1, { 0.57737, 0.57735, 0.57735, 0.0 } },
{ "HVector", 4, -1, { 0.32506, 0.32506, 0.88808, 0.0 } },
{ "BallCenter", 4, -1, { 0.0, 0.0, 0.0, 1.0 } },
{ "SpecularColor", 4, -1, { 0.4, 0.4, 0.4, 60.0 } },
{ "Red", 4, -1, { 0.6, 0.0, 0.0, 1.0 } },
{ "Blue", 4, -1, { 0.0, 0.3, 0.6, 1.0 } },
{ "Yellow", 4, -1, { 0.6, 0.5, 0.0, 1.0 } },
{ "HalfSpace0", 4, -1, { 1.0, 0.0, 0.0, 0.2 } },
{ "HalfSpace1", 4, -1, { 0.309016994, 0.951056516, 0.0, 0.2 } },
{ "HalfSpace2", 4, -1, { -0.809016994, 0.587785252, 0.0, 0.2 } },
{ "HalfSpace3", 4, -1, { -0.809016994, -0.587785252, 0.0, 0.2 } },
{ "HalfSpace4", 4, -1, { 0.309116994, -0.951056516, 0.0, 0.2 } },
{ "InOrOutInit", 1, -1, { -3.0, 0, 0, 0 } },
{ "StripeWidth", 1, -1, { 0.3, 0, 0, 0 } },
{ "FWidth", 1, -1, { 0.005, 0, 0, 0 } },
{ NULL, 0, 0, { 0, 0, 0, 0 } }
};
static GLint win = 0;
@@ -165,21 +171,128 @@ SpecialKey(int key, int x, int y)
static void
LoadAndCompileShader(GLuint shader, const char *text)
{
GLint stat;
glShaderSource_func(shader, 1, (const GLchar **) &text, NULL);
glCompileShader_func(shader);
glGetShaderiv_func(shader, GL_COMPILE_STATUS, &stat);
if (!stat) {
GLchar log[1000];
GLsizei len;
glGetShaderInfoLog_func(shader, 1000, &len, log);
fprintf(stderr, "toyball: problem compiling shader: %s\n", log);
exit(1);
}
else {
printf("Shader compiled OK\n");
}
}
/**
* Read a shader from a file.
*/
static void
ReadShader(GLuint shader, const char *filename)
{
const int max = 100*1000;
int n;
char *buffer = (char*) malloc(max);
FILE *f = fopen(filename, "r");
if (!f) {
fprintf(stderr, "toyball: Unable to open shader file %s\n", filename);
exit(1);
}
n = fread(buffer, 1, max, f);
printf("toyball: read %d bytes from shader file %s\n", n, filename);
if (n > 0) {
buffer[n] = 0;
LoadAndCompileShader(shader, buffer);
}
fclose(f);
free(buffer);
}
static void
CheckLink(GLuint prog)
{
GLint stat;
glGetProgramiv_func(prog, GL_LINK_STATUS, &stat);
if (!stat) {
GLchar log[1000];
GLsizei len;
glGetProgramInfoLog_func(prog, 1000, &len, log);
fprintf(stderr, "Linker error:\n%s\n", log);
}
else {
fprintf(stderr, "Link success!\n");
}
}
static void
Init(void)
{
if (!ShadersSupported())
exit(1);
const char *version;
GLint i;
version = (const char *) glGetString(GL_VERSION);
if (version[0] != '2' || version[1] != '.') {
printf("Warning: this program expects OpenGL 2.0\n");
/*exit(1);*/
}
printf("GL_RENDERER = %s\n",(const char *) glGetString(GL_RENDERER));
GetExtensionFuncs();
vertShader = CompileShaderFile(GL_VERTEX_SHADER, VertProgFile);
fragShader = CompileShaderFile(GL_FRAGMENT_SHADER, FragProgFile);
program = LinkShaders(vertShader, fragShader);
vertShader = glCreateShader_func(GL_VERTEX_SHADER);
ReadShader(vertShader, VertProgFile);
fragShader = glCreateShader_func(GL_FRAGMENT_SHADER);
ReadShader(fragShader, FragProgFile);
program = glCreateProgram_func();
glAttachShader_func(program, fragShader);
glAttachShader_func(program, vertShader);
glLinkProgram_func(program);
CheckLink(program);
glUseProgram_func(program);
InitUniforms(program, Uniforms);
assert(glIsProgram_func(program));
assert(glIsShader_func(fragShader));
assert(glIsShader_func(vertShader));
for (i = 0; Uniforms[i].name; i++) {
Uniforms[i].location
= glGetUniformLocation_func(program, Uniforms[i].name);
printf("Uniform %s location: %d\n", Uniforms[i].name,
Uniforms[i].location);
switch (Uniforms[i].size) {
case 1:
glUniform1fv_func(Uniforms[i].location, 1, Uniforms[i].value);
break;
case 2:
glUniform2fv_func(Uniforms[i].location, 1, Uniforms[i].value);
break;
case 3:
glUniform3fv_func(Uniforms[i].location, 1, Uniforms[i].value);
break;
case 4:
glUniform4fv_func(Uniforms[i].location, 1, Uniforms[i].value);
break;
default:
abort();
}
}
assert(glGetError() == 0);

View File

@@ -1,259 +0,0 @@
/**
* Demonstration of doing triangle rasterization with a fragment program.
* Basic idea:
* 1. Draw screen-aligned quad / bounding box around the triangle verts.
* 2. For each pixel in the quad, determine if pixel is inside/outside
* the triangle edges.
*
* Brian Paul
* 1 Aug 2007
*/
#include <assert.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <GL/gl.h>
#include <GL/glut.h>
#include <GL/glext.h>
#include "extfuncs.h"
#include "shaderutil.h"
static GLint WinWidth = 300, WinHeight = 300;
static char *FragProgFile = NULL;
static char *VertProgFile = NULL;
static GLuint fragShader;
static GLuint vertShader;
static GLuint program;
static GLint win = 0;
static GLboolean anim = GL_TRUE;
static GLfloat Zrot = 0.0f;
static GLint uv0, uv1, uv2;
static const GLfloat TriVerts[3][2] = {
{ 50, 50 },
{ 250, 50 },
{ 150, 250 }
};
static void
RotateVerts(GLfloat a,
GLuint n, const GLfloat vertsIn[][2], GLfloat vertsOut[][2])
{
GLuint i;
GLfloat cx = WinWidth / 2, cy = WinHeight / 2;
for (i = 0; i < n; i++) {
float x = vertsIn[i][0] - cx;
float y = vertsIn[i][1] - cy;
vertsOut[i][0] = x * cos(a) + y * sin(a) + cx;
vertsOut[i][1] = -x * sin(a) + y * cos(a) + cy;
}
}
static void
ComputeBounds(GLuint n, GLfloat vertsIn[][2],
GLfloat *xmin, GLfloat *ymin,
GLfloat *xmax, GLfloat *ymax)
{
GLuint i;
*xmin = *xmax = vertsIn[0][0];
*ymin = *ymax = vertsIn[0][1];
for (i = 1; i < n; i++) {
if (vertsIn[i][0] < *xmin)
*xmin = vertsIn[i][0];
else if (vertsIn[i][0] > *xmax)
*xmax = vertsIn[i][0];
if (vertsIn[i][1] < *ymin)
*ymin = vertsIn[i][1];
else if (vertsIn[i][1] > *ymax)
*ymax = vertsIn[i][1];
}
}
static void
Redisplay(void)
{
GLfloat v[3][2], xmin, ymin, xmax, ymax;
RotateVerts(Zrot, 3, TriVerts, v);
ComputeBounds(3, v, &xmin, &ymin, &xmax, &ymax);
glUniform2fv_func(uv0, 1, v[0]);
glUniform2fv_func(uv1, 1, v[1]);
glUniform2fv_func(uv2, 1, v[2]);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glPushMatrix();
glBegin(GL_POLYGON);
glVertex2f(xmin, ymin);
glVertex2f(xmax, ymin);
glVertex2f(xmax, ymax);
glVertex2f(xmin, ymax);
glEnd();
glPopMatrix();
glutSwapBuffers();
}
static void
Idle(void)
{
if (anim) {
Zrot = glutGet(GLUT_ELAPSED_TIME) * 0.0005;
glutPostRedisplay();
}
else
abort();
}
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
CleanUp(void)
{
glDeleteShader_func(fragShader);
glDeleteShader_func(vertShader);
glDeleteProgram_func(program);
glutDestroyWindow(win);
}
static void
Key(unsigned char key, int x, int y)
{
(void) x;
(void) y;
switch(key) {
case ' ':
case 'a':
anim = !anim;
if (anim)
glutIdleFunc(Idle);
else
glutIdleFunc(NULL);
break;
case 'z':
Zrot = 0;
break;
case 's':
Zrot += 0.05;
break;
case 27:
CleanUp();
exit(0);
break;
}
glutPostRedisplay();
}
static void
Init(void)
{
static const char *fragShaderText =
"uniform vec2 v0, v1, v2; \n"
"float crs(const vec2 u, const vec2 v) \n"
"{ \n"
" return u.x * v.y - u.y * v.x; \n"
"} \n"
"\n"
"void main() {\n"
" vec2 p = gl_FragCoord.xy; \n"
" if (crs(v1 - v0, p - v0) >= 0 && \n"
" crs(v2 - v1, p - v1) >= 0 && \n"
" crs(v0 - v2, p - v2) >= 0) \n"
" gl_FragColor = vec4(1.0); \n"
" else \n"
" gl_FragColor = vec4(0.5); \n"
"}\n";
static const char *vertShaderText =
"void main() {\n"
" gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;\n"
"}\n";
if (!ShadersSupported())
exit(1);
GetExtensionFuncs();
vertShader = CompileShaderText(GL_VERTEX_SHADER, vertShaderText);
fragShader = CompileShaderText(GL_FRAGMENT_SHADER, fragShaderText);
program = LinkShaders(vertShader, fragShader);
glUseProgram_func(program);
uv0 = glGetUniformLocation_func(program, "v0");
uv1 = glGetUniformLocation_func(program, "v1");
uv2 = glGetUniformLocation_func(program, "v2");
printf("Uniforms: %d %d %d\n", uv0, uv1, uv2);
/*assert(glGetError() == 0);*/
glClearColor(0.3f, 0.3f, 0.3f, 0.0f);
glEnable(GL_DEPTH_TEST);
printf("GL_RENDERER = %s\n",(const char *) glGetString(GL_RENDERER));
assert(glIsProgram_func(program));
assert(glIsShader_func(fragShader));
assert(glIsShader_func(vertShader));
glColor3f(1, 0, 0);
}
static void
ParseOptions(int argc, char *argv[])
{
int i;
for (i = 1; i < argc; i++) {
if (strcmp(argv[i], "-fs") == 0) {
FragProgFile = argv[i+1];
}
else if (strcmp(argv[i], "-vs") == 0) {
VertProgFile = argv[i+1];
}
}
}
int
main(int argc, char *argv[])
{
glutInit(&argc, argv);
glutInitWindowPosition( 0, 0);
glutInitWindowSize(WinWidth, WinHeight);
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
win = glutCreateWindow(argv[0]);
glutReshapeFunc(Reshape);
glutKeyboardFunc(Key);
glutDisplayFunc(Redisplay);
if (anim)
glutIdleFunc(Idle);
ParseOptions(argc, argv);
Init();
glutMainLoop();
return 0;
}

View File

@@ -1,270 +0,0 @@
/**
* Test two-sided lighting with shaders.
* Both GL_VERTEX_PROGRAM_TWO_SIDE and gl_FrontFacing can be tested
* (see keys below).
*
* Brian Paul
* 18 Dec 2007
*/
#include <assert.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <GL/gl.h>
#include <GL/glut.h>
#include <GL/glext.h>
#include "extfuncs.h"
#include "shaderutil.h"
static GLint WinWidth = 300, WinHeight = 300;
static char *FragProgFile = NULL;
static char *VertProgFile = NULL;
static GLuint fragShader;
static GLuint vertShader;
static GLuint program;
static GLint win = 0;
static GLboolean anim = 0*GL_TRUE;
static GLboolean DetermineInFragProg = GL_TRUE;
static GLfloat Yrot = 0.0f;
static GLint u_fragface;
static GLenum FrontWinding = GL_CCW;
static int prevTime = 0;
static const GLfloat Red[4] = {1, 0, 0, 0};
static const GLfloat Green[4] = {0, 1, 0, 0};
static void
Redisplay(void)
{
float xmin = -1, xmax = 1, ymin = -1, ymax = 1;
glFrontFace(FrontWinding);
if (DetermineInFragProg) {
glUniform1i_func(u_fragface, 1);
glDisable(GL_VERTEX_PROGRAM_TWO_SIDE);
}
else {
glUniform1i_func(u_fragface, 0);
glEnable(GL_VERTEX_PROGRAM_TWO_SIDE);
}
glClear(GL_COLOR_BUFFER_BIT);
glPushMatrix();
glRotatef(Yrot, 0, 1, 0);
glBegin(GL_POLYGON);
glColor4fv(Red);
glSecondaryColor3fv_func(Green);
glVertex2f(xmin, ymin);
glVertex2f(xmax, ymin);
glVertex2f(xmax, ymax);
glVertex2f(xmin, ymax);
glEnd();
glPopMatrix();
glutSwapBuffers();
}
static void
Idle(void)
{
int curTime = glutGet(GLUT_ELAPSED_TIME);
int dt = curTime - prevTime;
if (prevTime == 0) {
prevTime = curTime;
return;
}
prevTime = curTime;
Yrot += dt * 0.1;
glutPostRedisplay();
}
static void
Reshape(int width, int height)
{
float ar = (float) width / height;
glViewport(0, 0, width, height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glFrustum(-ar, ar, -1, 1, 5, 15);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glTranslatef(0, 0, -10);
}
static void
CleanUp(void)
{
glDeleteShader_func(fragShader);
glDeleteShader_func(vertShader);
glDeleteProgram_func(program);
glutDestroyWindow(win);
}
static void
Key(unsigned char key, int x, int y)
{
(void) x;
(void) y;
switch(key) {
case ' ':
case 'a':
anim = !anim;
if (anim) {
prevTime = glutGet(GLUT_ELAPSED_TIME);
glutIdleFunc(Idle);
}
else
glutIdleFunc(NULL);
break;
case 'f':
printf("Using frag shader gl_FrontFacing\n");
DetermineInFragProg = GL_TRUE;
break;
case 'v':
printf("Using vert shader Two-sided lighting\n");
DetermineInFragProg = GL_FALSE;
break;
case 'r':
Yrot = 0;
anim = 0;
glutIdleFunc(NULL);
break;
case 's':
Yrot += 5;
break;
case 'w':
if (FrontWinding == GL_CCW) {
FrontWinding = GL_CW;
printf("FrontFace = GL_CW\n");
}
else {
FrontWinding = GL_CCW;
printf("FrontFace = GL_CCW\n");
}
break;
case 27:
CleanUp();
exit(0);
break;
}
glutPostRedisplay();
}
static void
Init(void)
{
static const char *fragShaderText =
"uniform bool fragface; \n"
"void main() { \n"
" if (!fragface || gl_FrontFacing) { \n"
" gl_FragColor = gl_Color; \n"
" } \n"
" else { \n"
" gl_FragColor = 0.8 * gl_SecondaryColor; \n"
" } \n"
"} \n";
static const char *vertShaderText =
"uniform bool fragface; \n"
"void main() { \n"
" gl_FrontColor = gl_Color; \n"
" if (fragface) { \n"
" // front/back chosen in frag prog \n"
" gl_FrontSecondaryColor = gl_SecondaryColor; \n"
" } \n"
" else { \n"
" // front/back chosen in prim setup \n"
" gl_BackColor = gl_SecondaryColor; \n"
" } \n"
" gl_Position = ftransform(); \n"
"} \n";
if (!ShadersSupported())
exit(1);
GetExtensionFuncs();
vertShader = CompileShaderText(GL_VERTEX_SHADER, vertShaderText);
fragShader = CompileShaderText(GL_FRAGMENT_SHADER, fragShaderText);
program = LinkShaders(vertShader, fragShader);
glUseProgram_func(program);
u_fragface = glGetUniformLocation_func(program, "fragface");
printf("Uniforms: %d\n", u_fragface);
/*assert(glGetError() == 0);*/
glClearColor(0.3f, 0.3f, 0.3f, 0.0f);
printf("GL_RENDERER = %s\n",(const char *) glGetString(GL_RENDERER));
assert(glIsProgram_func(program));
assert(glIsShader_func(fragShader));
assert(glIsShader_func(vertShader));
}
static void
ParseOptions(int argc, char *argv[])
{
int i;
for (i = 1; i < argc; i++) {
if (strcmp(argv[i], "-fs") == 0) {
FragProgFile = argv[i+1];
}
else if (strcmp(argv[i], "-vs") == 0) {
VertProgFile = argv[i+1];
}
}
}
static void
Usage(void)
{
printf("Keys:\n");
printf(" f - do front/back determination in fragment shader\n");
printf(" v - do front/back determination in vertex shader\n");
printf(" r - reset, show front\n");
printf(" a - toggle animation\n");
printf(" s - step rotation\n");
printf(" w - toggle CW, CCW front-face winding\n");
}
int
main(int argc, char *argv[])
{
glutInit(&argc, argv);
glutInitWindowPosition( 0, 0);
glutInitWindowSize(WinWidth, WinHeight);
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE);
win = glutCreateWindow(argv[0]);
glutReshapeFunc(Reshape);
glutKeyboardFunc(Key);
glutDisplayFunc(Redisplay);
if (anim)
glutIdleFunc(Idle);
ParseOptions(argc, argv);
Init();
Usage();
glutMainLoop();
return 0;
}

View File

@@ -43,8 +43,8 @@ LIBS = -L$(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) $(APP_LIB_DEPS
default: depend $(PROGS)
clean:
-rm -f $(PROGS)
-rm -f *.o
rm -f $(PROGS)
rm -f *.o
depend: $(SOURCES)

View File

@@ -5,19 +5,15 @@ include $(TOP)/configs/current
INCDIR = $(TOP)/include
OSMESA_LIBS = -L$(TOP)/$(LIB_DIR) -l$(GLU_LIB) -l$(OSMESA_LIB) $(APP_LIB_DEPS)
OSMESA_LIBS = -L$(TOP)/$(LIB_DIR) -lOSMesa $(APP_LIB_DEPS)
OSMESA16_LIBS = -L$(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -lOSMesa16 -l$(GLU_LIB) \
-l$(GL_LIB) $(APP_LIB_DEPS)
OSMESA16_LIBS = -L$(TOP)/$(LIB_DIR) -lglut -lOSMesa16 -lGLU -lGL $(APP_LIB_DEPS)
OSMESA32_LIBS = -L$(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -lOSMesa32 -l$(GLU_LIB) \
-l$(GL_LIB) $(APP_LIB_DEPS)
OSMESA32_LIBS = -L$(TOP)/$(LIB_DIR) -lglut -lOSMesa32 -lGLU -lGL $(APP_LIB_DEPS)
LIB_DEP = $(TOP)/$(LIB_DIR)/$(GL_LIB_NAME) $(TOP)/$(LIB_DIR)/$(GLU_LIB_NAME) \
$(TOP)/$(LIB_DIR)/$(GLUT_LIB_NAME)
LIB_DEP = $(TOP)/$(LIB_DIR)/$(GL_LIB_NAME) $(TOP)/$(LIB_DIR)/$(GLU_LIB_NAME) $(TOP)/$(LIB_DIR)/$(GLUT_LIB_NAME)
LIBS = -L$(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) \
$(APP_LIB_DEPS)
LIBS = -L$(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) $(APP_LIB_DEPS)
PROGS = \
osdemo \

View File

@@ -407,10 +407,7 @@ test(GLenum type, GLint bits, const char *filename)
glGetIntegerv(GL_ALPHA_BITS, &cBits);
assert(cBits == bits);
if (WriteFiles)
printf("Rendering %d bit/channel image: %s\n", bits, filename);
else
printf("Rendering %d bit/channel image\n", bits);
printf("Rendering %d bit/channel image: %s\n", bits, filename);
OSMesaColorClamp(GL_TRUE);
@@ -461,8 +458,6 @@ main( int argc, char *argv[] )
{
int i;
printf("Use -f to write image files\n");
for (i = 1; i < argc; i++) {
if (strcmp(argv[i], "-f") == 0)
WriteFiles = GL_TRUE;

View File

@@ -25,27 +25,6 @@ static int doPrint = 1;
static int deltaY;
GLint windW, windH;
static const struct {
GLenum mode;
const char *name;
} LogicOpModes[] = {
{ GL_SET, "GL_SET" },
{ GL_COPY, "GL_COPY" },
{ GL_NOOP, "GL_NOOP" },
{ GL_AND, "GL_AND" },
{ GL_INVERT, "GL_INVERT" },
{ GL_OR, "GL_OR" },
{ GL_XOR, "GL_XOR" },
{ GL_NOR, "GL_NOR" },
{ GL_NAND, "GL_NAND" },
{ GL_OR_REVERSE, "GL_OR_REVERSE" },
{ GL_OR_INVERTED, "GL_OR_INVERTED" },
{ GL_AND_INVERTED, "GL_AND_INVERTED" },
{ 0, NULL }
};
static void DrawString(const char *string)
{
int i;
@@ -68,7 +47,7 @@ static void Reshape(int width, int height)
windH = (GLint)height;
glViewport(0, 0, (GLint)width, (GLint)height);
deltaY = windH /20;
deltaY = windH /16;
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
@@ -126,7 +105,7 @@ static void Draw(void)
{
int stringOffset = 5, stringx = 8;
int x1, x2, xleft, xright;
int i, k;
int i;
(dithering) ? glEnable(GL_DITHER) : glDisable(GL_DITHER);
glDisable(GL_BLEND);
@@ -143,7 +122,6 @@ static void Draw(void)
/* Draw labels */
glColor3f(0.8, 0.8, 0.0);
i = windH - deltaY + stringOffset;
glRasterPos2f(stringx, i); i -= deltaY;
DrawString("SOURCE");
glRasterPos2f(stringx, i); i -= deltaY;
@@ -158,12 +136,21 @@ static void Draw(void)
DrawString("reverse_subtract");
glRasterPos2f(stringx, i); i -= deltaY;
DrawString("clear");
glRasterPos2f(stringx, i); i -= deltaY;
DrawString("set");
glRasterPos2f(stringx, i); i -= deltaY;
DrawString("copy");
glRasterPos2f(stringx, i); i -= deltaY;
DrawString("noop");
glRasterPos2f(stringx, i); i -= deltaY;
DrawString("and");
glRasterPos2f(stringx, i); i -= deltaY;
DrawString("invert");
glRasterPos2f(stringx, i); i -= deltaY;
DrawString("or");
glRasterPos2f(stringx, i); i -= deltaY;
DrawString("xor");
for (k = 0; LogicOpModes[k].name; k++) {
glRasterPos2f(stringx, i);
i -= deltaY;
DrawString(LogicOpModes[k].name);
}
i = windH - deltaY;
x1 = windW/4;
@@ -206,23 +193,43 @@ static void Draw(void)
glLogicOp(GL_CLEAR);
glRectf(x1, i, x2, i+deltaY);
for (k = 0; LogicOpModes[k].name; k++) {
i -= deltaY;
glLogicOp(LogicOpModes[k].mode);
glRectf(x1, i, x2, i+deltaY);
if (LogicOpModes[k].mode == GL_XOR) {
glRectf(x1, i+10, x2, i+5);
}
}
i -= deltaY;
glLogicOp(GL_SET);
glRectf(x1, i, x2, i+deltaY);
if (doPrint) {
glDisable(GL_BLEND);
if (supportlogops & 2)
i -= deltaY;
glLogicOp(GL_COPY);
glRectf(x1, i, x2, i+deltaY);
i -= deltaY;
glLogicOp(GL_NOOP);
glRectf(x1, i, x2, i+deltaY);
i -= deltaY;
glLogicOp(GL_AND);
glRectf(x1, i, x2, i+deltaY);
i -= deltaY;
glLogicOp(GL_INVERT);
glRectf(x1, i, x2, i+deltaY);
i -= deltaY;
glLogicOp(GL_OR);
glRectf(x1, i, x2, i+deltaY);
i -= deltaY;
glLogicOp(GL_XOR);
glRectf(x1, i, x2, i+deltaY);
glRectf(x1, i+10, x2, i+5);
if (doPrint) {
glDisable(GL_BLEND);
if (supportlogops & 2)
glDisable(GL_COLOR_LOGIC_OP);
glColor3f(1.0, 1.0, 1.0);
PrintColorStrings();
}
glFlush();
glColor3f(1.0, 1.0, 1.0);
PrintColorStrings();
}
glFlush();
if (doubleBuffer) {
glutSwapBuffers();
@@ -264,7 +271,7 @@ int main(int argc, char **argv)
exit(1);
}
glutInitWindowPosition(0, 0); glutInitWindowSize( 800, 520);
glutInitWindowPosition(0, 0); glutInitWindowSize( 800, 400);
type = GLUT_RGB;
type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;

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